aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h3
-rw-r--r--include/linux/aer.h2
-rw-r--r--include/linux/ahci_platform.h13
-rw-r--r--include/linux/ata_platform.h5
-rw-r--r--include/linux/atmel-mci.h2
-rw-r--r--include/linux/atmel_tc.h13
-rw-r--r--include/linux/atomic.h36
-rw-r--r--include/linux/audit.h27
-rw-r--r--include/linux/backing-dev.h4
-rw-r--r--include/linux/balloon_compaction.h169
-rw-r--r--include/linux/bcma/bcma.h6
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h8
-rw-r--r--include/linux/bcma/bcma_regs.h5
-rw-r--r--include/linux/bcma/bcma_soc.h1
-rw-r--r--include/linux/bio.h65
-rw-r--r--include/linux/bitops.h20
-rw-r--r--include/linux/blk-mq.h23
-rw-r--r--include/linux/blk_types.h18
-rw-r--r--include/linux/blkdev.h80
-rw-r--r--include/linux/bpf.h136
-rw-r--r--include/linux/brcmphy.h137
-rw-r--r--include/linux/buffer_head.h47
-rw-r--r--include/linux/ceph/libceph.h1
-rw-r--r--include/linux/ceph/pagelist.h5
-rw-r--r--include/linux/ceph/rados.h225
-rw-r--r--include/linux/cgroup.h26
-rw-r--r--include/linux/clk-private.h2
-rw-r--r--include/linux/clk-provider.h33
-rw-r--r--include/linux/clk.h29
-rw-r--r--include/linux/clk/at91_pmc.h1
-rw-r--r--include/linux/clk/ti.h1
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/cma.h7
-rw-r--r--include/linux/com20020.h29
-rw-r--r--include/linux/compaction.h24
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler-gcc5.h65
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/cpufreq-dt.h22
-rw-r--r--include/linux/cpufreq.h5
-rw-r--r--include/linux/cpumask.h11
-rw-r--r--include/linux/cpuset.h3
-rw-r--r--include/linux/crash_dump.h15
-rw-r--r--include/linux/crc-t10dif.h5
-rw-r--r--include/linux/cycx_x25.h125
-rw-r--r--include/linux/dcache.h9
-rw-r--r--include/linux/devcoredump.h35
-rw-r--r--include/linux/device.h15
-rw-r--r--include/linux/dma-mapping.h26
-rw-r--r--include/linux/dma/dw.h64
-rw-r--r--include/linux/dmaengine.h17
-rw-r--r--include/linux/dmar.h8
-rw-r--r--include/linux/dw_dmac.h111
-rw-r--r--include/linux/dynamic_debug.h12
-rw-r--r--include/linux/dynamic_queue_limits.h12
-rw-r--r--include/linux/efi.h17
-rw-r--r--include/linux/etherdevice.h1
-rw-r--r--include/linux/ethtool.h4
-rw-r--r--include/linux/extcon/extcon-gpio.h4
-rw-r--r--include/linux/extcon/sm5502.h287
-rw-r--r--include/linux/f2fs_fs.h6
-rw-r--r--include/linux/filter.h196
-rw-r--r--include/linux/flex_proportions.h5
-rw-r--r--include/linux/font.h4
-rw-r--r--include/linux/fs.h115
-rw-r--r--include/linux/fs_enet_pd.h1
-rw-r--r--include/linux/fsl_ifc.h6
-rw-r--r--include/linux/fsldma.h13
-rw-r--r--include/linux/ftrace.h10
-rw-r--r--include/linux/genalloc.h7
-rw-r--r--include/linux/genl_magic_func.h4
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/gpio/driver.h8
-rw-r--r--include/linux/hid.h43
-rw-r--r--include/linux/huge_mm.h2
-rw-r--r--include/linux/i82593.h229
-rw-r--r--include/linux/ieee80211.h73
-rw-r--r--include/linux/if_macvlan.h1
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/ima.h4
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/interrupt.h5
-rw-r--r--include/linux/iommu.h26
-rw-r--r--include/linux/ioport.h5
-rw-r--r--include/linux/ipack.h24
-rw-r--r--include/linux/irq.h8
-rw-r--r--include/linux/irq_work.h3
-rw-r--r--include/linux/irqchip/arm-gic.h16
-rw-r--r--include/linux/irqchip/irq-omap-intc.h32
-rw-r--r--include/linux/irqdesc.h29
-rw-r--r--include/linux/jbd2.h2
-rw-r--r--include/linux/jump_label.h17
-rw-r--r--include/linux/kernel.h62
-rw-r--r--include/linux/kernel_stat.h4
-rw-r--r--include/linux/kernelcapi.h2
-rw-r--r--include/linux/kexec.h1
-rw-r--r--include/linux/key-type.h34
-rw-r--r--include/linux/kgdb.h2
-rw-r--r--include/linux/khugepaged.h17
-rw-r--r--include/linux/kvm_host.h32
-rw-r--r--include/linux/kvm_types.h14
-rw-r--r--include/linux/leds.h16
-rw-r--r--include/linux/libata.h12
-rw-r--r--include/linux/list.h1
-rw-r--r--include/linux/lockd/lockd.h1
-rw-r--r--include/linux/lockdep.h8
-rw-r--r--include/linux/mailbox_client.h46
-rw-r--r--include/linux/mailbox_controller.h133
-rw-r--r--include/linux/mei_cl_bus.h1
-rw-r--r--include/linux/memcontrol.h73
-rw-r--r--include/linux/memory.h2
-rw-r--r--include/linux/memory_hotplug.h1
-rw-r--r--include/linux/mempolicy.h7
-rw-r--r--include/linux/mfd/arizona/registers.h29
-rw-r--r--include/linux/mfd/core.h3
-rw-r--r--include/linux/mfd/cros_ec.h24
-rw-r--r--include/linux/mfd/cros_ec_commands.h3
-rw-r--r--include/linux/mfd/da9052/da9052.h2
-rw-r--r--include/linux/mfd/davinci_voicecodec.h2
-rw-r--r--include/linux/mfd/hi6421-pmic.h41
-rw-r--r--include/linux/mfd/max14577-private.h95
-rw-r--r--include/linux/mfd/max14577.h30
-rw-r--r--include/linux/mfd/max77693-private.h77
-rw-r--r--include/linux/mfd/max77693.h40
-rw-r--r--include/linux/mfd/rk808.h196
-rw-r--r--include/linux/mfd/rn5t618.h228
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h1
-rw-r--r--include/linux/mfd/ti_ssp.h93
-rw-r--r--include/linux/mfd/tmio.h25
-rw-r--r--include/linux/mfd/tps65217.h2
-rw-r--r--include/linux/micrel_phy.h1
-rw-r--r--include/linux/migrate.h14
-rw-r--r--include/linux/mlx4/device.h17
-rw-r--r--include/linux/mlx5/device.h152
-rw-r--r--include/linux/mlx5/driver.h118
-rw-r--r--include/linux/mlx5/mlx5_ifc.h349
-rw-r--r--include/linux/mlx5/qp.h38
-rw-r--r--include/linux/mm.h47
-rw-r--r--include/linux/mmc/card.h10
-rw-r--r--include/linux/mmc/dw_mmc.h4
-rw-r--r--include/linux/mmc/host.h12
-rw-r--r--include/linux/mmc/mmc.h7
-rw-r--r--include/linux/mmc/sdhci.h3
-rw-r--r--include/linux/mmc/slot-gpio.h5
-rw-r--r--include/linux/mmdebug.h20
-rw-r--r--include/linux/mmu_notifier.h24
-rw-r--r--include/linux/mmzone.h51
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--include/linux/mount.h3
-rw-r--r--include/linux/msi.h6
-rw-r--r--include/linux/mtd/cfi.h22
-rw-r--r--include/linux/mtd/nand.h12
-rw-r--r--include/linux/mtd/spi-nor.h21
-rw-r--r--include/linux/mutex.h4
-rw-r--r--include/linux/netdevice.h260
-rw-r--r--include/linux/netfilter/ipset/ip_set.h60
-rw-r--r--include/linux/netfilter/ipset/ip_set_list.h1
-rw-r--r--include/linux/netfilter_bridge.h50
-rw-r--r--include/linux/nfs4.h29
-rw-r--r--include/linux/nfs_fs.h45
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_xdr.h36
-rw-r--r--include/linux/nmi.h13
-rw-r--r--include/linux/of.h87
-rw-r--r--include/linux/of_address.h27
-rw-r--r--include/linux/of_pci.h13
-rw-r--r--include/linux/of_reserved_mem.h9
-rw-r--r--include/linux/omap-dma.h37
-rw-r--r--include/linux/oom.h3
-rw-r--r--include/linux/pagemap.h30
-rw-r--r--include/linux/pci-acpi.h7
-rw-r--r--include/linux/pci.h60
-rw-r--r--include/linux/pci_hotplug.h2
-rw-r--r--include/linux/pci_ids.h20
-rw-r--r--include/linux/percpu-defs.h3
-rw-r--r--include/linux/percpu-refcount.h122
-rw-r--r--include/linux/percpu.h13
-rw-r--r--include/linux/percpu_counter.h10
-rw-r--r--include/linux/perf_event.h14
-rw-r--r--include/linux/phonedev.h25
-rw-r--r--include/linux/phy.h27
-rw-r--r--include/linux/phy_fixed.h31
-rw-r--r--include/linux/pl320-ipc.h (renamed from include/linux/mailbox.h)0
-rw-r--r--include/linux/platform_data/dma-dw.h59
-rw-r--r--include/linux/platform_data/drv260x-pdata.h28
-rw-r--r--include/linux/platform_data/elm.h16
-rw-r--r--include/linux/platform_data/gpio-dwapb.h32
-rw-r--r--include/linux/platform_data/i2c-designware.h21
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h1
-rw-r--r--include/linux/platform_data/rcar-du.h4
-rw-r--r--include/linux/platform_data/samsung-usbphy.h27
-rw-r--r--include/linux/platform_data/tegra_emc.h34
-rw-r--r--include/linux/pm.h5
-rw-r--r--include/linux/pm_domain.h130
-rw-r--r--include/linux/pm_qos.h5
-rw-r--r--include/linux/pnfs_osd_xdr.h2
-rw-r--r--include/linux/power_supply.h8
-rw-r--r--include/linux/prio_heap.h58
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/proportions.h5
-rw-r--r--include/linux/random.h4
-rw-r--r--include/linux/rbtree_augmented.h10
-rw-r--r--include/linux/rcupdate.h121
-rw-r--r--include/linux/rcutiny.h2
-rw-r--r--include/linux/reboot.h3
-rw-r--r--include/linux/regulator/consumer.h2
-rw-r--r--include/linux/rhashtable.h2
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rmap.h2
-rw-r--r--include/linux/rtnetlink.h10
-rw-r--r--include/linux/rwsem.h2
-rw-r--r--include/linux/sched.h52
-rw-r--r--include/linux/screen_info.h8
-rw-r--r--include/linux/seccomp.h25
-rw-r--r--include/linux/security.h10
-rw-r--r--include/linux/seqlock.h19
-rw-r--r--include/linux/serial_8250.h6
-rw-r--r--include/linux/serial_core.h20
-rw-r--r--include/linux/signal.h29
-rw-r--r--include/linux/skbuff.h358
-rw-r--r--include/linux/slab.h64
-rw-r--r--include/linux/slab_def.h20
-rw-r--r--include/linux/smp.h2
-rw-r--r--include/linux/soc/ti/knav_dma.h175
-rw-r--r--include/linux/soc/ti/knav_qmss.h90
-rw-r--r--include/linux/spi/mcp23s08.h18
-rw-r--r--include/linux/spi/pxa2xx_spi.h9
-rw-r--r--include/linux/spinlock.h8
-rw-r--r--include/linux/string.h7
-rw-r--r--include/linux/string_helpers.h65
-rw-r--r--include/linux/sunrpc/svc.h1
-rw-r--r--include/linux/sunrpc/xprt.h1
-rw-r--r--include/linux/suspend.h6
-rw-r--r--include/linux/swap.h22
-rw-r--r--include/linux/syscalls.h3
-rw-r--r--include/linux/t10-pi.h22
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/thermal.h4
-rw-r--r--include/linux/ti_wilink_st.h2
-rw-r--r--include/linux/tick.h4
-rw-r--r--include/linux/topology.h17
-rw-r--r--include/linux/torture.h5
-rw-r--r--include/linux/tracepoint.h11
-rw-r--r--include/linux/tty.h15
-rw-r--r--include/linux/tty_driver.h4
-rw-r--r--include/linux/udp.h16
-rw-r--r--include/linux/uio.h3
-rw-r--r--include/linux/uio_driver.h12
-rw-r--r--include/linux/uprobes.h14
-rw-r--r--include/linux/usb.h12
-rw-r--r--include/linux/usb/chipidea.h1
-rw-r--r--include/linux/usb/gadget.h26
-rw-r--r--include/linux/usb/hcd.h4
-rw-r--r--include/linux/usb/of.h5
-rw-r--r--include/linux/usb/quirks.h22
-rw-r--r--include/linux/usb/usbnet.h4
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/virtio.h14
-rw-r--r--include/linux/virtio_config.h17
-rw-r--r--include/linux/vm_event_item.h7
-rw-r--r--include/linux/wait.h21
-rw-r--r--include/linux/watchdog.h9
-rw-r--r--include/linux/zsmalloc.h2
263 files changed, 5320 insertions, 2901 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 807cbc46d73e..407a12f663eb 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -432,6 +432,7 @@ static inline bool acpi_driver_match_device(struct device *dev,
432int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); 432int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
433int acpi_device_modalias(struct device *, char *, int); 433int acpi_device_modalias(struct device *, char *, int);
434 434
435struct platform_device *acpi_create_platform_device(struct acpi_device *);
435#define ACPI_PTR(_ptr) (_ptr) 436#define ACPI_PTR(_ptr) (_ptr)
436 437
437#else /* !CONFIG_ACPI */ 438#else /* !CONFIG_ACPI */
@@ -587,7 +588,6 @@ static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
587#if defined(CONFIG_ACPI) && defined(CONFIG_PM) 588#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
588struct acpi_device *acpi_dev_pm_get_node(struct device *dev); 589struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
589int acpi_dev_pm_attach(struct device *dev, bool power_on); 590int acpi_dev_pm_attach(struct device *dev, bool power_on);
590void acpi_dev_pm_detach(struct device *dev, bool power_off);
591#else 591#else
592static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev) 592static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
593{ 593{
@@ -597,7 +597,6 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
597{ 597{
598 return -ENODEV; 598 return -ENODEV;
599} 599}
600static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {}
601#endif 600#endif
602 601
603#ifdef CONFIG_ACPI 602#ifdef CONFIG_ACPI
diff --git a/include/linux/aer.h b/include/linux/aer.h
index c826d1c28f9c..4fef65e57023 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -7,6 +7,8 @@
7#ifndef _AER_H_ 7#ifndef _AER_H_
8#define _AER_H_ 8#define _AER_H_
9 9
10#include <linux/types.h>
11
10#define AER_NONFATAL 0 12#define AER_NONFATAL 0
11#define AER_FATAL 1 13#define AER_FATAL 1
12#define AER_CORRECTABLE 2 14#define AER_CORRECTABLE 2
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index 09a947e8bc87..642d6ae4030c 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -22,19 +22,6 @@ struct ata_port_info;
22struct ahci_host_priv; 22struct ahci_host_priv;
23struct platform_device; 23struct platform_device;
24 24
25/*
26 * Note ahci_platform_data is deprecated, it is only kept around for use
27 * by the old da850 and spear13xx ahci code.
28 * New drivers should instead declare their own platform_driver struct, and
29 * use ahci_platform* functions in their own probe, suspend and resume methods.
30 */
31struct ahci_platform_data {
32 int (*init)(struct device *dev, void __iomem *addr);
33 void (*exit)(struct device *dev);
34 int (*suspend)(struct device *dev);
35 int (*resume)(struct device *dev);
36};
37
38int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); 25int ahci_platform_enable_clks(struct ahci_host_priv *hpriv);
39void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); 26void ahci_platform_disable_clks(struct ahci_host_priv *hpriv);
40int ahci_platform_enable_resources(struct ahci_host_priv *hpriv); 27int ahci_platform_enable_resources(struct ahci_host_priv *hpriv);
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index b9fde17f767c..5c618a084225 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -8,11 +8,6 @@ struct pata_platform_info {
8 * spacing used by ata_std_ports(). 8 * spacing used by ata_std_ports().
9 */ 9 */
10 unsigned int ioport_shift; 10 unsigned int ioport_shift;
11 /*
12 * Indicate platform specific irq types and initial
13 * IRQ flags when call request_irq()
14 */
15 unsigned int irq_flags;
16}; 11};
17 12
18extern int __pata_platform_probe(struct device *dev, 13extern int __pata_platform_probe(struct device *dev,
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 4c7a4b2104bf..91b77f8d495d 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_ATMEL_MCI_H 1#ifndef __LINUX_ATMEL_MCI_H
2#define __LINUX_ATMEL_MCI_H 2#define __LINUX_ATMEL_MCI_H
3 3
4#include <linux/types.h>
5
4#define ATMCI_MAX_NR_SLOTS 2 6#define ATMCI_MAX_NR_SLOTS 2
5 7
6/** 8/**
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h
index 89a931babecf..b87c1c7c242a 100644
--- a/include/linux/atmel_tc.h
+++ b/include/linux/atmel_tc.h
@@ -44,12 +44,13 @@ struct atmel_tcb_config {
44/** 44/**
45 * struct atmel_tc - information about a Timer/Counter Block 45 * struct atmel_tc - information about a Timer/Counter Block
46 * @pdev: physical device 46 * @pdev: physical device
47 * @iomem: resource associated with the I/O register
48 * @regs: mapping through which the I/O registers can be accessed 47 * @regs: mapping through which the I/O registers can be accessed
48 * @id: block id
49 * @tcb_config: configuration data from SoC 49 * @tcb_config: configuration data from SoC
50 * @irq: irq for each of the three channels 50 * @irq: irq for each of the three channels
51 * @clk: internal clock source for each of the three channels 51 * @clk: internal clock source for each of the three channels
52 * @node: list node, for tclib internal use 52 * @node: list node, for tclib internal use
53 * @allocated: if already used, for tclib internal use
53 * 54 *
54 * On some platforms, each TC channel has its own clocks and IRQs, 55 * On some platforms, each TC channel has its own clocks and IRQs,
55 * while on others, all TC channels share the same clock and IRQ. 56 * while on others, all TC channels share the same clock and IRQ.
@@ -61,15 +62,16 @@ struct atmel_tcb_config {
61 */ 62 */
62struct atmel_tc { 63struct atmel_tc {
63 struct platform_device *pdev; 64 struct platform_device *pdev;
64 struct resource *iomem;
65 void __iomem *regs; 65 void __iomem *regs;
66 int id;
66 const struct atmel_tcb_config *tcb_config; 67 const struct atmel_tcb_config *tcb_config;
67 int irq[3]; 68 int irq[3];
68 struct clk *clk[3]; 69 struct clk *clk[3];
69 struct list_head node; 70 struct list_head node;
71 bool allocated;
70}; 72};
71 73
72extern struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name); 74extern struct atmel_tc *atmel_tc_alloc(unsigned block);
73extern void atmel_tc_free(struct atmel_tc *tc); 75extern void atmel_tc_free(struct atmel_tc *tc);
74 76
75/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */ 77/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */
@@ -258,5 +260,10 @@ extern const u8 atmel_tc_divisors[5];
258#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */ 260#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */
259#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */ 261#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */
260#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */ 262#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */
263#define ATMEL_TC_ALL_IRQ (ATMEL_TC_COVFS | ATMEL_TC_LOVRS | \
264 ATMEL_TC_CPAS | ATMEL_TC_CPBS | \
265 ATMEL_TC_CPCS | ATMEL_TC_LDRAS | \
266 ATMEL_TC_LDRBS | ATMEL_TC_ETRGS) \
267 /* all IRQs */
261 268
262#endif 269#endif
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index fef3a809e7cf..5b08a8540ecf 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -3,42 +3,6 @@
3#define _LINUX_ATOMIC_H 3#define _LINUX_ATOMIC_H
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5 5
6/*
7 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
8 * We need the ugly external functions to break header recursion hell.
9 */
10#ifndef smp_mb__before_atomic_inc
11static inline void __deprecated smp_mb__before_atomic_inc(void)
12{
13 extern void __smp_mb__before_atomic(void);
14 __smp_mb__before_atomic();
15}
16#endif
17
18#ifndef smp_mb__after_atomic_inc
19static inline void __deprecated smp_mb__after_atomic_inc(void)
20{
21 extern void __smp_mb__after_atomic(void);
22 __smp_mb__after_atomic();
23}
24#endif
25
26#ifndef smp_mb__before_atomic_dec
27static inline void __deprecated smp_mb__before_atomic_dec(void)
28{
29 extern void __smp_mb__before_atomic(void);
30 __smp_mb__before_atomic();
31}
32#endif
33
34#ifndef smp_mb__after_atomic_dec
35static inline void __deprecated smp_mb__after_atomic_dec(void)
36{
37 extern void __smp_mb__after_atomic(void);
38 __smp_mb__after_atomic();
39}
40#endif
41
42/** 6/**
43 * atomic_add_unless - add unless the number is already a given value 7 * atomic_add_unless - add unless the number is already a given value
44 * @v: pointer of type atomic_t 8 * @v: pointer of type atomic_t
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 22cfddb75566..e58fe7df8b9c 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -66,12 +66,16 @@ struct audit_krule {
66 66
67struct audit_field { 67struct audit_field {
68 u32 type; 68 u32 type;
69 u32 val; 69 union {
70 kuid_t uid; 70 u32 val;
71 kgid_t gid; 71 kuid_t uid;
72 kgid_t gid;
73 struct {
74 char *lsm_str;
75 void *lsm_rule;
76 };
77 };
72 u32 op; 78 u32 op;
73 char *lsm_str;
74 void *lsm_rule;
75}; 79};
76 80
77extern int is_audit_feature_set(int which); 81extern int is_audit_feature_set(int which);
@@ -86,7 +90,7 @@ extern unsigned compat_dir_class[];
86extern unsigned compat_chattr_class[]; 90extern unsigned compat_chattr_class[];
87extern unsigned compat_signal_class[]; 91extern unsigned compat_signal_class[];
88 92
89extern int __weak audit_classify_compat_syscall(int abi, unsigned syscall); 93extern int audit_classify_compat_syscall(int abi, unsigned syscall);
90 94
91/* audit_names->type values */ 95/* audit_names->type values */
92#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */ 96#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */
@@ -109,12 +113,13 @@ extern void audit_log_session_info(struct audit_buffer *ab);
109#endif 113#endif
110 114
111#ifdef CONFIG_AUDITSYSCALL 115#ifdef CONFIG_AUDITSYSCALL
116#include <asm/syscall.h> /* for syscall_get_arch() */
117
112/* These are defined in auditsc.c */ 118/* These are defined in auditsc.c */
113 /* Public API */ 119 /* Public API */
114extern int audit_alloc(struct task_struct *task); 120extern int audit_alloc(struct task_struct *task);
115extern void __audit_free(struct task_struct *task); 121extern void __audit_free(struct task_struct *task);
116extern void __audit_syscall_entry(int arch, 122extern void __audit_syscall_entry(int major, unsigned long a0, unsigned long a1,
117 int major, unsigned long a0, unsigned long a1,
118 unsigned long a2, unsigned long a3); 123 unsigned long a2, unsigned long a3);
119extern void __audit_syscall_exit(int ret_success, long ret_value); 124extern void __audit_syscall_exit(int ret_success, long ret_value);
120extern struct filename *__audit_reusename(const __user char *uptr); 125extern struct filename *__audit_reusename(const __user char *uptr);
@@ -141,12 +146,12 @@ static inline void audit_free(struct task_struct *task)
141 if (unlikely(task->audit_context)) 146 if (unlikely(task->audit_context))
142 __audit_free(task); 147 __audit_free(task);
143} 148}
144static inline void audit_syscall_entry(int arch, int major, unsigned long a0, 149static inline void audit_syscall_entry(int major, unsigned long a0,
145 unsigned long a1, unsigned long a2, 150 unsigned long a1, unsigned long a2,
146 unsigned long a3) 151 unsigned long a3)
147{ 152{
148 if (unlikely(current->audit_context)) 153 if (unlikely(current->audit_context))
149 __audit_syscall_entry(arch, major, a0, a1, a2, a3); 154 __audit_syscall_entry(major, a0, a1, a2, a3);
150} 155}
151static inline void audit_syscall_exit(void *pt_regs) 156static inline void audit_syscall_exit(void *pt_regs)
152{ 157{
@@ -322,7 +327,7 @@ static inline int audit_alloc(struct task_struct *task)
322} 327}
323static inline void audit_free(struct task_struct *task) 328static inline void audit_free(struct task_struct *task)
324{ } 329{ }
325static inline void audit_syscall_entry(int arch, int major, unsigned long a0, 330static inline void audit_syscall_entry(int major, unsigned long a0,
326 unsigned long a1, unsigned long a2, 331 unsigned long a1, unsigned long a2,
327 unsigned long a3) 332 unsigned long a3)
328{ } 333{ }
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e488e9459a93..5da6012b7a14 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -28,12 +28,10 @@ struct dentry;
28 * Bits in backing_dev_info.state 28 * Bits in backing_dev_info.state
29 */ 29 */
30enum bdi_state { 30enum bdi_state {
31 BDI_wb_alloc, /* Default embedded wb allocated */
32 BDI_async_congested, /* The async (write) queue is getting full */ 31 BDI_async_congested, /* The async (write) queue is getting full */
33 BDI_sync_congested, /* The sync queue is getting full */ 32 BDI_sync_congested, /* The sync queue is getting full */
34 BDI_registered, /* bdi_register() was done */ 33 BDI_registered, /* bdi_register() was done */
35 BDI_writeback_running, /* Writeback is in progress */ 34 BDI_writeback_running, /* Writeback is in progress */
36 BDI_unused, /* Available bits start here */
37}; 35};
38 36
39typedef int (congested_fn)(void *, int); 37typedef int (congested_fn)(void *, int);
@@ -50,7 +48,6 @@ enum bdi_stat_item {
50 48
51struct bdi_writeback { 49struct bdi_writeback {
52 struct backing_dev_info *bdi; /* our parent bdi */ 50 struct backing_dev_info *bdi; /* our parent bdi */
53 unsigned int nr;
54 51
55 unsigned long last_old_flush; /* last old data flush */ 52 unsigned long last_old_flush; /* last old data flush */
56 53
@@ -124,7 +121,6 @@ void bdi_start_background_writeback(struct backing_dev_info *bdi);
124void bdi_writeback_workfn(struct work_struct *work); 121void bdi_writeback_workfn(struct work_struct *work);
125int bdi_has_dirty_io(struct backing_dev_info *bdi); 122int bdi_has_dirty_io(struct backing_dev_info *bdi);
126void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); 123void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
127void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2);
128 124
129extern spinlock_t bdi_lock; 125extern spinlock_t bdi_lock;
130extern struct list_head bdi_list; 126extern struct list_head bdi_list;
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index 089743ade734..9b0a15d06a4f 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -27,10 +27,13 @@
27 * counter raised only while it is under our special handling; 27 * counter raised only while it is under our special handling;
28 * 28 *
29 * iii. after the lockless scan step have selected a potential balloon page for 29 * iii. after the lockless scan step have selected a potential balloon page for
30 * isolation, re-test the page->mapping flags and the page ref counter 30 * isolation, re-test the PageBalloon mark and the PagePrivate flag
31 * under the proper page lock, to ensure isolating a valid balloon page 31 * under the proper page lock, to ensure isolating a valid balloon page
32 * (not yet isolated, nor under release procedure) 32 * (not yet isolated, nor under release procedure)
33 * 33 *
34 * iv. isolation or dequeueing procedure must clear PagePrivate flag under
35 * page lock together with removing page from balloon device page list.
36 *
34 * The functions provided by this interface are placed to help on coping with 37 * The functions provided by this interface are placed to help on coping with
35 * the aforementioned balloon page corner case, as well as to ensure the simple 38 * the aforementioned balloon page corner case, as well as to ensure the simple
36 * set of exposed rules are satisfied while we are dealing with balloon pages 39 * set of exposed rules are satisfied while we are dealing with balloon pages
@@ -54,43 +57,22 @@
54 * balloon driver as a page book-keeper for its registered balloon devices. 57 * balloon driver as a page book-keeper for its registered balloon devices.
55 */ 58 */
56struct balloon_dev_info { 59struct balloon_dev_info {
57 void *balloon_device; /* balloon device descriptor */
58 struct address_space *mapping; /* balloon special page->mapping */
59 unsigned long isolated_pages; /* # of isolated pages for migration */ 60 unsigned long isolated_pages; /* # of isolated pages for migration */
60 spinlock_t pages_lock; /* Protection to pages list */ 61 spinlock_t pages_lock; /* Protection to pages list */
61 struct list_head pages; /* Pages enqueued & handled to Host */ 62 struct list_head pages; /* Pages enqueued & handled to Host */
63 int (*migratepage)(struct balloon_dev_info *, struct page *newpage,
64 struct page *page, enum migrate_mode mode);
62}; 65};
63 66
64extern struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info); 67extern struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info);
65extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info); 68extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
66extern struct balloon_dev_info *balloon_devinfo_alloc(
67 void *balloon_dev_descriptor);
68 69
69static inline void balloon_devinfo_free(struct balloon_dev_info *b_dev_info) 70static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
70{
71 kfree(b_dev_info);
72}
73
74/*
75 * balloon_page_free - release a balloon page back to the page free lists
76 * @page: ballooned page to be set free
77 *
78 * This function must be used to properly set free an isolated/dequeued balloon
79 * page at the end of a sucessful page migration, or at the balloon driver's
80 * page release procedure.
81 */
82static inline void balloon_page_free(struct page *page)
83{ 71{
84 /* 72 balloon->isolated_pages = 0;
85 * Balloon pages always get an extra refcount before being isolated 73 spin_lock_init(&balloon->pages_lock);
86 * and before being dequeued to help on sorting out fortuite colisions 74 INIT_LIST_HEAD(&balloon->pages);
87 * between a thread attempting to isolate and another thread attempting 75 balloon->migratepage = NULL;
88 * to release the very same balloon page.
89 *
90 * Before we handle the page back to Buddy, lets drop its extra refcnt.
91 */
92 put_page(page);
93 __free_page(page);
94} 76}
95 77
96#ifdef CONFIG_BALLOON_COMPACTION 78#ifdef CONFIG_BALLOON_COMPACTION
@@ -98,107 +80,58 @@ extern bool balloon_page_isolate(struct page *page);
98extern void balloon_page_putback(struct page *page); 80extern void balloon_page_putback(struct page *page);
99extern int balloon_page_migrate(struct page *newpage, 81extern int balloon_page_migrate(struct page *newpage,
100 struct page *page, enum migrate_mode mode); 82 struct page *page, enum migrate_mode mode);
101extern struct address_space
102*balloon_mapping_alloc(struct balloon_dev_info *b_dev_info,
103 const struct address_space_operations *a_ops);
104
105static inline void balloon_mapping_free(struct address_space *balloon_mapping)
106{
107 kfree(balloon_mapping);
108}
109 83
110/* 84/*
111 * page_flags_cleared - helper to perform balloon @page ->flags tests. 85 * __is_movable_balloon_page - helper to perform @page PageBalloon tests
112 *
113 * As balloon pages are obtained from buddy and we do not play with page->flags
114 * at driver level (exception made when we get the page lock for compaction),
115 * we can safely identify a ballooned page by checking if the
116 * PAGE_FLAGS_CHECK_AT_PREP page->flags are all cleared. This approach also
117 * helps us skip ballooned pages that are locked for compaction or release, thus
118 * mitigating their racy check at balloon_page_movable()
119 */
120static inline bool page_flags_cleared(struct page *page)
121{
122 return !(page->flags & PAGE_FLAGS_CHECK_AT_PREP);
123}
124
125/*
126 * __is_movable_balloon_page - helper to perform @page mapping->flags tests
127 */ 86 */
128static inline bool __is_movable_balloon_page(struct page *page) 87static inline bool __is_movable_balloon_page(struct page *page)
129{ 88{
130 struct address_space *mapping = page->mapping; 89 return PageBalloon(page);
131 return mapping_balloon(mapping);
132} 90}
133 91
134/* 92/*
135 * balloon_page_movable - test page->mapping->flags to identify balloon pages 93 * balloon_page_movable - test PageBalloon to identify balloon pages
136 * that can be moved by compaction/migration. 94 * and PagePrivate to check that the page is not
137 * 95 * isolated and can be moved by compaction/migration.
138 * This function is used at core compaction's page isolation scheme, therefore
139 * most pages exposed to it are not enlisted as balloon pages and so, to avoid
140 * undesired side effects like racing against __free_pages(), we cannot afford
141 * holding the page locked while testing page->mapping->flags here.
142 * 96 *
143 * As we might return false positives in the case of a balloon page being just 97 * As we might return false positives in the case of a balloon page being just
144 * released under us, the page->mapping->flags need to be re-tested later, 98 * released under us, this need to be re-tested later, under the page lock.
145 * under the proper page lock, at the functions that will be coping with the
146 * balloon page case.
147 */ 99 */
148static inline bool balloon_page_movable(struct page *page) 100static inline bool balloon_page_movable(struct page *page)
149{ 101{
150 /* 102 return PageBalloon(page) && PagePrivate(page);
151 * Before dereferencing and testing mapping->flags, let's make sure
152 * this is not a page that uses ->mapping in a different way
153 */
154 if (page_flags_cleared(page) && !page_mapped(page) &&
155 page_count(page) == 1)
156 return __is_movable_balloon_page(page);
157
158 return false;
159} 103}
160 104
161/* 105/*
162 * isolated_balloon_page - identify an isolated balloon page on private 106 * isolated_balloon_page - identify an isolated balloon page on private
163 * compaction/migration page lists. 107 * compaction/migration page lists.
164 *
165 * After a compaction thread isolates a balloon page for migration, it raises
166 * the page refcount to prevent concurrent compaction threads from re-isolating
167 * the same page. For that reason putback_movable_pages(), or other routines
168 * that need to identify isolated balloon pages on private pagelists, cannot
169 * rely on balloon_page_movable() to accomplish the task.
170 */ 108 */
171static inline bool isolated_balloon_page(struct page *page) 109static inline bool isolated_balloon_page(struct page *page)
172{ 110{
173 /* Already isolated balloon pages, by default, have a raised refcount */ 111 return PageBalloon(page);
174 if (page_flags_cleared(page) && !page_mapped(page) &&
175 page_count(page) >= 2)
176 return __is_movable_balloon_page(page);
177
178 return false;
179} 112}
180 113
181/* 114/*
182 * balloon_page_insert - insert a page into the balloon's page list and make 115 * balloon_page_insert - insert a page into the balloon's page list and make
183 * the page->mapping assignment accordingly. 116 * the page->private assignment accordingly.
117 * @balloon : pointer to balloon device
184 * @page : page to be assigned as a 'balloon page' 118 * @page : page to be assigned as a 'balloon page'
185 * @mapping : allocated special 'balloon_mapping'
186 * @head : balloon's device page list head
187 * 119 *
188 * Caller must ensure the page is locked and the spin_lock protecting balloon 120 * Caller must ensure the page is locked and the spin_lock protecting balloon
189 * pages list is held before inserting a page into the balloon device. 121 * pages list is held before inserting a page into the balloon device.
190 */ 122 */
191static inline void balloon_page_insert(struct page *page, 123static inline void balloon_page_insert(struct balloon_dev_info *balloon,
192 struct address_space *mapping, 124 struct page *page)
193 struct list_head *head)
194{ 125{
195 page->mapping = mapping; 126 __SetPageBalloon(page);
196 list_add(&page->lru, head); 127 SetPagePrivate(page);
128 set_page_private(page, (unsigned long)balloon);
129 list_add(&page->lru, &balloon->pages);
197} 130}
198 131
199/* 132/*
200 * balloon_page_delete - delete a page from balloon's page list and clear 133 * balloon_page_delete - delete a page from balloon's page list and clear
201 * the page->mapping assignement accordingly. 134 * the page->private assignement accordingly.
202 * @page : page to be released from balloon's page list 135 * @page : page to be released from balloon's page list
203 * 136 *
204 * Caller must ensure the page is locked and the spin_lock protecting balloon 137 * Caller must ensure the page is locked and the spin_lock protecting balloon
@@ -206,8 +139,12 @@ static inline void balloon_page_insert(struct page *page,
206 */ 139 */
207static inline void balloon_page_delete(struct page *page) 140static inline void balloon_page_delete(struct page *page)
208{ 141{
209 page->mapping = NULL; 142 __ClearPageBalloon(page);
210 list_del(&page->lru); 143 set_page_private(page, 0);
144 if (PagePrivate(page)) {
145 ClearPagePrivate(page);
146 list_del(&page->lru);
147 }
211} 148}
212 149
213/* 150/*
@@ -216,11 +153,7 @@ static inline void balloon_page_delete(struct page *page)
216 */ 153 */
217static inline struct balloon_dev_info *balloon_page_device(struct page *page) 154static inline struct balloon_dev_info *balloon_page_device(struct page *page)
218{ 155{
219 struct address_space *mapping = page->mapping; 156 return (struct balloon_dev_info *)page_private(page);
220 if (likely(mapping))
221 return mapping->private_data;
222
223 return NULL;
224} 157}
225 158
226static inline gfp_t balloon_mapping_gfp_mask(void) 159static inline gfp_t balloon_mapping_gfp_mask(void)
@@ -228,34 +161,24 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
228 return GFP_HIGHUSER_MOVABLE; 161 return GFP_HIGHUSER_MOVABLE;
229} 162}
230 163
231static inline bool balloon_compaction_check(void)
232{
233 return true;
234}
235
236#else /* !CONFIG_BALLOON_COMPACTION */ 164#else /* !CONFIG_BALLOON_COMPACTION */
237 165
238static inline void *balloon_mapping_alloc(void *balloon_device, 166static inline void balloon_page_insert(struct balloon_dev_info *balloon,
239 const struct address_space_operations *a_ops) 167 struct page *page)
240{
241 return ERR_PTR(-EOPNOTSUPP);
242}
243
244static inline void balloon_mapping_free(struct address_space *balloon_mapping)
245{ 168{
246 return; 169 __SetPageBalloon(page);
170 list_add(&page->lru, &balloon->pages);
247} 171}
248 172
249static inline void balloon_page_insert(struct page *page, 173static inline void balloon_page_delete(struct page *page)
250 struct address_space *mapping,
251 struct list_head *head)
252{ 174{
253 list_add(&page->lru, head); 175 __ClearPageBalloon(page);
176 list_del(&page->lru);
254} 177}
255 178
256static inline void balloon_page_delete(struct page *page) 179static inline bool __is_movable_balloon_page(struct page *page)
257{ 180{
258 list_del(&page->lru); 181 return false;
259} 182}
260 183
261static inline bool balloon_page_movable(struct page *page) 184static inline bool balloon_page_movable(struct page *page)
@@ -289,9 +212,5 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
289 return GFP_HIGHUSER; 212 return GFP_HIGHUSER;
290} 213}
291 214
292static inline bool balloon_compaction_check(void)
293{
294 return false;
295}
296#endif /* CONFIG_BALLOON_COMPACTION */ 215#endif /* CONFIG_BALLOON_COMPACTION */
297#endif /* _LINUX_BALLOON_COMPACTION_H */ 216#endif /* _LINUX_BALLOON_COMPACTION_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 0272e49135d0..729f48e6b20b 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -267,7 +267,7 @@ struct bcma_device {
267 u8 core_unit; 267 u8 core_unit;
268 268
269 u32 addr; 269 u32 addr;
270 u32 addr1; 270 u32 addr_s[8];
271 u32 wrap; 271 u32 wrap;
272 272
273 void __iomem *io_addr; 273 void __iomem *io_addr;
@@ -323,6 +323,8 @@ struct bcma_bus {
323 struct pci_dev *host_pci; 323 struct pci_dev *host_pci;
324 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */ 324 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
325 struct sdio_func *host_sdio; 325 struct sdio_func *host_sdio;
326 /* Pointer to platform device (only for BCMA_HOSTTYPE_SOC) */
327 struct platform_device *host_pdev;
326 }; 328 };
327 329
328 struct bcma_chipinfo chipinfo; 330 struct bcma_chipinfo chipinfo;
@@ -332,10 +334,10 @@ struct bcma_bus {
332 struct bcma_device *mapped_core; 334 struct bcma_device *mapped_core;
333 struct list_head cores; 335 struct list_head cores;
334 u8 nr_cores; 336 u8 nr_cores;
335 u8 init_done:1;
336 u8 num; 337 u8 num;
337 338
338 struct bcma_drv_cc drv_cc; 339 struct bcma_drv_cc drv_cc;
340 struct bcma_drv_cc_b drv_cc_b;
339 struct bcma_drv_pci drv_pci[2]; 341 struct bcma_drv_pci drv_pci[2];
340 struct bcma_drv_pcie2 drv_pcie2; 342 struct bcma_drv_pcie2 drv_pcie2;
341 struct bcma_drv_mips drv_mips; 343 struct bcma_drv_mips drv_mips;
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 63d105cd14a3..db6fa217f98b 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -644,6 +644,12 @@ struct bcma_drv_cc {
644#endif 644#endif
645}; 645};
646 646
647struct bcma_drv_cc_b {
648 struct bcma_device *core;
649 u8 setup_done:1;
650 void __iomem *mii;
651};
652
647/* Register access */ 653/* Register access */
648#define bcma_cc_read32(cc, offset) \ 654#define bcma_cc_read32(cc, offset) \
649 bcma_read32((cc)->core, offset) 655 bcma_read32((cc)->core, offset)
@@ -699,4 +705,6 @@ extern void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid);
699 705
700extern u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc); 706extern u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc);
701 707
708void bcma_chipco_b_mii_write(struct bcma_drv_cc_b *ccb, u32 offset, u32 value);
709
702#endif /* LINUX_BCMA_DRIVER_CC_H_ */ 710#endif /* LINUX_BCMA_DRIVER_CC_H_ */
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 917dcd7965e7..e64ae7bf80a1 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -39,6 +39,11 @@
39#define BCMA_RESET_CTL_RESET 0x0001 39#define BCMA_RESET_CTL_RESET 0x0001
40#define BCMA_RESET_ST 0x0804 40#define BCMA_RESET_ST 0x0804
41 41
42#define BCMA_NS_ROM_IOST_BOOT_DEV_MASK 0x0003
43#define BCMA_NS_ROM_IOST_BOOT_DEV_NOR 0x0000
44#define BCMA_NS_ROM_IOST_BOOT_DEV_NAND 0x0001
45#define BCMA_NS_ROM_IOST_BOOT_DEV_ROM 0x0002
46
42/* BCMA PCI config space registers. */ 47/* BCMA PCI config space registers. */
43#define BCMA_PCI_PMCSR 0x44 48#define BCMA_PCI_PMCSR 0x44
44#define BCMA_PCI_PE 0x100 49#define BCMA_PCI_PE 0x100
diff --git a/include/linux/bcma/bcma_soc.h b/include/linux/bcma/bcma_soc.h
index 4203c5593b9f..f24d245f8394 100644
--- a/include/linux/bcma/bcma_soc.h
+++ b/include/linux/bcma/bcma_soc.h
@@ -10,6 +10,7 @@ struct bcma_soc {
10}; 10};
11 11
12int __init bcma_host_soc_register(struct bcma_soc *soc); 12int __init bcma_host_soc_register(struct bcma_soc *soc);
13int __init bcma_host_soc_init(struct bcma_soc *soc);
13 14
14int bcma_bus_register(struct bcma_bus *bus); 15int bcma_bus_register(struct bcma_bus *bus);
15 16
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b39e5000ff58..7347f486ceca 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -292,7 +292,24 @@ static inline unsigned bio_segments(struct bio *bio)
292 */ 292 */
293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt) 293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
294 294
295enum bip_flags {
296 BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */
297 BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */
298 BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */
299 BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */
300 BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */
301};
302
295#if defined(CONFIG_BLK_DEV_INTEGRITY) 303#if defined(CONFIG_BLK_DEV_INTEGRITY)
304
305static inline struct bio_integrity_payload *bio_integrity(struct bio *bio)
306{
307 if (bio->bi_rw & REQ_INTEGRITY)
308 return bio->bi_integrity;
309
310 return NULL;
311}
312
296/* 313/*
297 * bio integrity payload 314 * bio integrity payload
298 */ 315 */
@@ -301,21 +318,40 @@ struct bio_integrity_payload {
301 318
302 struct bvec_iter bip_iter; 319 struct bvec_iter bip_iter;
303 320
304 /* kill - should just use bip_vec */
305 void *bip_buf; /* generated integrity data */
306
307 bio_end_io_t *bip_end_io; /* saved I/O completion fn */ 321 bio_end_io_t *bip_end_io; /* saved I/O completion fn */
308 322
309 unsigned short bip_slab; /* slab the bip came from */ 323 unsigned short bip_slab; /* slab the bip came from */
310 unsigned short bip_vcnt; /* # of integrity bio_vecs */ 324 unsigned short bip_vcnt; /* # of integrity bio_vecs */
311 unsigned short bip_max_vcnt; /* integrity bio_vec slots */ 325 unsigned short bip_max_vcnt; /* integrity bio_vec slots */
312 unsigned bip_owns_buf:1; /* should free bip_buf */ 326 unsigned short bip_flags; /* control flags */
313 327
314 struct work_struct bip_work; /* I/O completion */ 328 struct work_struct bip_work; /* I/O completion */
315 329
316 struct bio_vec *bip_vec; 330 struct bio_vec *bip_vec;
317 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */ 331 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */
318}; 332};
333
334static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
335{
336 struct bio_integrity_payload *bip = bio_integrity(bio);
337
338 if (bip)
339 return bip->bip_flags & flag;
340
341 return false;
342}
343
344static inline sector_t bip_get_seed(struct bio_integrity_payload *bip)
345{
346 return bip->bip_iter.bi_sector;
347}
348
349static inline void bip_set_seed(struct bio_integrity_payload *bip,
350 sector_t seed)
351{
352 bip->bip_iter.bi_sector = seed;
353}
354
319#endif /* CONFIG_BLK_DEV_INTEGRITY */ 355#endif /* CONFIG_BLK_DEV_INTEGRITY */
320 356
321extern void bio_trim(struct bio *bio, int offset, int size); 357extern void bio_trim(struct bio *bio, int offset, int size);
@@ -342,6 +378,7 @@ static inline struct bio *bio_next_split(struct bio *bio, int sectors,
342} 378}
343 379
344extern struct bio_set *bioset_create(unsigned int, unsigned int); 380extern struct bio_set *bioset_create(unsigned int, unsigned int);
381extern struct bio_set *bioset_create_nobvec(unsigned int, unsigned int);
345extern void bioset_free(struct bio_set *); 382extern void bioset_free(struct bio_set *);
346extern mempool_t *biovec_create_pool(int pool_entries); 383extern mempool_t *biovec_create_pool(int pool_entries);
347 384
@@ -353,7 +390,6 @@ extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *);
353extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs); 390extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs);
354 391
355extern struct bio_set *fs_bio_set; 392extern struct bio_set *fs_bio_set;
356unsigned int bio_integrity_tag_size(struct bio *bio);
357 393
358static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) 394static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs)
359{ 395{
@@ -661,14 +697,10 @@ struct biovec_slab {
661 for_each_bio(_bio) \ 697 for_each_bio(_bio) \
662 bip_for_each_vec(_bvl, _bio->bi_integrity, _iter) 698 bip_for_each_vec(_bvl, _bio->bi_integrity, _iter)
663 699
664#define bio_integrity(bio) (bio->bi_integrity != NULL)
665
666extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); 700extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
667extern void bio_integrity_free(struct bio *); 701extern void bio_integrity_free(struct bio *);
668extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); 702extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
669extern int bio_integrity_enabled(struct bio *bio); 703extern bool bio_integrity_enabled(struct bio *bio);
670extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
671extern int bio_integrity_get_tag(struct bio *, void *, unsigned int);
672extern int bio_integrity_prep(struct bio *); 704extern int bio_integrity_prep(struct bio *);
673extern void bio_integrity_endio(struct bio *, int); 705extern void bio_integrity_endio(struct bio *, int);
674extern void bio_integrity_advance(struct bio *, unsigned int); 706extern void bio_integrity_advance(struct bio *, unsigned int);
@@ -680,14 +712,14 @@ extern void bio_integrity_init(void);
680 712
681#else /* CONFIG_BLK_DEV_INTEGRITY */ 713#else /* CONFIG_BLK_DEV_INTEGRITY */
682 714
683static inline int bio_integrity(struct bio *bio) 715static inline void *bio_integrity(struct bio *bio)
684{ 716{
685 return 0; 717 return NULL;
686} 718}
687 719
688static inline int bio_integrity_enabled(struct bio *bio) 720static inline bool bio_integrity_enabled(struct bio *bio)
689{ 721{
690 return 0; 722 return false;
691} 723}
692 724
693static inline int bioset_integrity_create(struct bio_set *bs, int pool_size) 725static inline int bioset_integrity_create(struct bio_set *bs, int pool_size)
@@ -733,6 +765,11 @@ static inline void bio_integrity_init(void)
733 return; 765 return;
734} 766}
735 767
768static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
769{
770 return false;
771}
772
736#endif /* CONFIG_BLK_DEV_INTEGRITY */ 773#endif /* CONFIG_BLK_DEV_INTEGRITY */
737 774
738#endif /* CONFIG_BLOCK */ 775#endif /* CONFIG_BLOCK */
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index cbc5833fb221..be5fd38bd5a0 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -32,26 +32,6 @@ extern unsigned long __sw_hweight64(__u64 w);
32 */ 32 */
33#include <asm/bitops.h> 33#include <asm/bitops.h>
34 34
35/*
36 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
37 * We need the ugly external functions to break header recursion hell.
38 */
39#ifndef smp_mb__before_clear_bit
40static inline void __deprecated smp_mb__before_clear_bit(void)
41{
42 extern void __smp_mb__before_atomic(void);
43 __smp_mb__before_atomic();
44}
45#endif
46
47#ifndef smp_mb__after_clear_bit
48static inline void __deprecated smp_mb__after_clear_bit(void)
49{
50 extern void __smp_mb__after_atomic(void);
51 __smp_mb__after_atomic();
52}
53#endif
54
55#define for_each_set_bit(bit, addr, size) \ 35#define for_each_set_bit(bit, addr, size) \
56 for ((bit) = find_first_bit((addr), (size)); \ 36 for ((bit) = find_first_bit((addr), (size)); \
57 (bit) < (size); \ 37 (bit) < (size); \
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index a1e31f274fcd..c9be1589415a 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -4,6 +4,7 @@
4#include <linux/blkdev.h> 4#include <linux/blkdev.h>
5 5
6struct blk_mq_tags; 6struct blk_mq_tags;
7struct blk_flush_queue;
7 8
8struct blk_mq_cpu_notifier { 9struct blk_mq_cpu_notifier {
9 struct list_head list; 10 struct list_head list;
@@ -34,6 +35,7 @@ struct blk_mq_hw_ctx {
34 35
35 struct request_queue *queue; 36 struct request_queue *queue;
36 unsigned int queue_num; 37 unsigned int queue_num;
38 struct blk_flush_queue *fq;
37 39
38 void *driver_data; 40 void *driver_data;
39 41
@@ -77,8 +79,9 @@ struct blk_mq_tag_set {
77 struct list_head tag_list; 79 struct list_head tag_list;
78}; 80};
79 81
80typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *); 82typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *, bool);
81typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int); 83typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int);
84typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool);
82typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int); 85typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int);
83typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int); 86typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
84typedef int (init_request_fn)(void *, struct request *, unsigned int, 87typedef int (init_request_fn)(void *, struct request *, unsigned int,
@@ -86,6 +89,9 @@ typedef int (init_request_fn)(void *, struct request *, unsigned int,
86typedef void (exit_request_fn)(void *, struct request *, unsigned int, 89typedef void (exit_request_fn)(void *, struct request *, unsigned int,
87 unsigned int); 90 unsigned int);
88 91
92typedef void (busy_iter_fn)(struct blk_mq_hw_ctx *, struct request *, void *,
93 bool);
94
89struct blk_mq_ops { 95struct blk_mq_ops {
90 /* 96 /*
91 * Queue request 97 * Queue request
@@ -100,7 +106,7 @@ struct blk_mq_ops {
100 /* 106 /*
101 * Called on request timeout 107 * Called on request timeout
102 */ 108 */
103 rq_timed_out_fn *timeout; 109 timeout_fn *timeout;
104 110
105 softirq_done_fn *complete; 111 softirq_done_fn *complete;
106 112
@@ -115,6 +121,10 @@ struct blk_mq_ops {
115 /* 121 /*
116 * Called for every command allocated by the block layer to allow 122 * Called for every command allocated by the block layer to allow
117 * the driver to set up driver specific data. 123 * the driver to set up driver specific data.
124 *
125 * Tag greater than or equal to queue_depth is for setting up
126 * flush request.
127 *
118 * Ditto for exit/teardown. 128 * Ditto for exit/teardown.
119 */ 129 */
120 init_request_fn *init_request; 130 init_request_fn *init_request;
@@ -140,6 +150,7 @@ enum {
140}; 150};
141 151
142struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); 152struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
153void blk_mq_finish_init(struct request_queue *q);
143int blk_mq_register_disk(struct gendisk *); 154int blk_mq_register_disk(struct gendisk *);
144void blk_mq_unregister_disk(struct gendisk *); 155void blk_mq_unregister_disk(struct gendisk *);
145 156
@@ -159,8 +170,9 @@ struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag);
159struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index); 170struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index);
160struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int); 171struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int);
161 172
162void blk_mq_end_io(struct request *rq, int error); 173void blk_mq_start_request(struct request *rq);
163void __blk_mq_end_io(struct request *rq, int error); 174void blk_mq_end_request(struct request *rq, int error);
175void __blk_mq_end_request(struct request *rq, int error);
164 176
165void blk_mq_requeue_request(struct request *rq); 177void blk_mq_requeue_request(struct request *rq);
166void blk_mq_add_to_requeue_list(struct request *rq, bool at_head); 178void blk_mq_add_to_requeue_list(struct request *rq, bool at_head);
@@ -173,7 +185,8 @@ void blk_mq_stop_hw_queues(struct request_queue *q);
173void blk_mq_start_hw_queues(struct request_queue *q); 185void blk_mq_start_hw_queues(struct request_queue *q);
174void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); 186void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
175void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); 187void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
176void blk_mq_tag_busy_iter(struct blk_mq_tags *tags, void (*fn)(void *data, unsigned long *), void *data); 188void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn,
189 void *priv);
177 190
178/* 191/*
179 * Driver command data is immediately after the request. So subtract request 192 * Driver command data is immediately after the request. So subtract request
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 66c2167f04a9..445d59231bc4 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -78,9 +78,11 @@ struct bio {
78 struct io_context *bi_ioc; 78 struct io_context *bi_ioc;
79 struct cgroup_subsys_state *bi_css; 79 struct cgroup_subsys_state *bi_css;
80#endif 80#endif
81 union {
81#if defined(CONFIG_BLK_DEV_INTEGRITY) 82#if defined(CONFIG_BLK_DEV_INTEGRITY)
82 struct bio_integrity_payload *bi_integrity; /* data integrity */ 83 struct bio_integrity_payload *bi_integrity; /* data integrity */
83#endif 84#endif
85 };
84 86
85 unsigned short bi_vcnt; /* how many bio_vec's */ 87 unsigned short bi_vcnt; /* how many bio_vec's */
86 88
@@ -118,10 +120,8 @@ struct bio {
118#define BIO_USER_MAPPED 6 /* contains user pages */ 120#define BIO_USER_MAPPED 6 /* contains user pages */
119#define BIO_EOPNOTSUPP 7 /* not supported */ 121#define BIO_EOPNOTSUPP 7 /* not supported */
120#define BIO_NULL_MAPPED 8 /* contains invalid user pages */ 122#define BIO_NULL_MAPPED 8 /* contains invalid user pages */
121#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */ 123#define BIO_QUIET 9 /* Make BIO Quiet */
122#define BIO_QUIET 10 /* Make BIO Quiet */ 124#define BIO_SNAP_STABLE 10 /* bio data must be snapshotted during write */
123#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */
124#define BIO_SNAP_STABLE 12 /* bio data must be snapshotted during write */
125 125
126/* 126/*
127 * Flags starting here get preserved by bio_reset() - this includes 127 * Flags starting here get preserved by bio_reset() - this includes
@@ -162,6 +162,7 @@ enum rq_flag_bits {
162 __REQ_WRITE_SAME, /* write same block many times */ 162 __REQ_WRITE_SAME, /* write same block many times */
163 163
164 __REQ_NOIDLE, /* don't anticipate more IO after this one */ 164 __REQ_NOIDLE, /* don't anticipate more IO after this one */
165 __REQ_INTEGRITY, /* I/O includes block integrity payload */
165 __REQ_FUA, /* forced unit access */ 166 __REQ_FUA, /* forced unit access */
166 __REQ_FLUSH, /* request for cache flush */ 167 __REQ_FLUSH, /* request for cache flush */
167 168
@@ -186,9 +187,7 @@ enum rq_flag_bits {
186 __REQ_FLUSH_SEQ, /* request for flush sequence */ 187 __REQ_FLUSH_SEQ, /* request for flush sequence */
187 __REQ_IO_STAT, /* account I/O stat */ 188 __REQ_IO_STAT, /* account I/O stat */
188 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 189 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
189 __REQ_KERNEL, /* direct IO to kernel pages */
190 __REQ_PM, /* runtime pm request */ 190 __REQ_PM, /* runtime pm request */
191 __REQ_END, /* last of chain of requests */
192 __REQ_HASHED, /* on IO scheduler merge hash */ 191 __REQ_HASHED, /* on IO scheduler merge hash */
193 __REQ_MQ_INFLIGHT, /* track inflight for MQ */ 192 __REQ_MQ_INFLIGHT, /* track inflight for MQ */
194 __REQ_NR_BITS, /* stops here */ 193 __REQ_NR_BITS, /* stops here */
@@ -204,13 +203,14 @@ enum rq_flag_bits {
204#define REQ_DISCARD (1ULL << __REQ_DISCARD) 203#define REQ_DISCARD (1ULL << __REQ_DISCARD)
205#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME) 204#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME)
206#define REQ_NOIDLE (1ULL << __REQ_NOIDLE) 205#define REQ_NOIDLE (1ULL << __REQ_NOIDLE)
206#define REQ_INTEGRITY (1ULL << __REQ_INTEGRITY)
207 207
208#define REQ_FAILFAST_MASK \ 208#define REQ_FAILFAST_MASK \
209 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 209 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
210#define REQ_COMMON_MASK \ 210#define REQ_COMMON_MASK \
211 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \ 211 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \
212 REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \ 212 REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \
213 REQ_SECURE) 213 REQ_SECURE | REQ_INTEGRITY)
214#define REQ_CLONE_MASK REQ_COMMON_MASK 214#define REQ_CLONE_MASK REQ_COMMON_MASK
215 215
216#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME) 216#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME)
@@ -240,9 +240,7 @@ enum rq_flag_bits {
240#define REQ_IO_STAT (1ULL << __REQ_IO_STAT) 240#define REQ_IO_STAT (1ULL << __REQ_IO_STAT)
241#define REQ_MIXED_MERGE (1ULL << __REQ_MIXED_MERGE) 241#define REQ_MIXED_MERGE (1ULL << __REQ_MIXED_MERGE)
242#define REQ_SECURE (1ULL << __REQ_SECURE) 242#define REQ_SECURE (1ULL << __REQ_SECURE)
243#define REQ_KERNEL (1ULL << __REQ_KERNEL)
244#define REQ_PM (1ULL << __REQ_PM) 243#define REQ_PM (1ULL << __REQ_PM)
245#define REQ_END (1ULL << __REQ_END)
246#define REQ_HASHED (1ULL << __REQ_HASHED) 244#define REQ_HASHED (1ULL << __REQ_HASHED)
247#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT) 245#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT)
248 246
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 518b46555b80..aac0f9ea952a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -36,6 +36,7 @@ struct request;
36struct sg_io_hdr; 36struct sg_io_hdr;
37struct bsg_job; 37struct bsg_job;
38struct blkcg_gq; 38struct blkcg_gq;
39struct blk_flush_queue;
39 40
40#define BLKDEV_MIN_RQ 4 41#define BLKDEV_MIN_RQ 4
41#define BLKDEV_MAX_RQ 128 /* Default maximum */ 42#define BLKDEV_MAX_RQ 128 /* Default maximum */
@@ -455,14 +456,7 @@ struct request_queue {
455 */ 456 */
456 unsigned int flush_flags; 457 unsigned int flush_flags;
457 unsigned int flush_not_queueable:1; 458 unsigned int flush_not_queueable:1;
458 unsigned int flush_queue_delayed:1; 459 struct blk_flush_queue *fq;
459 unsigned int flush_pending_idx:1;
460 unsigned int flush_running_idx:1;
461 unsigned long flush_pending_since;
462 struct list_head flush_queue[2];
463 struct list_head flush_data_in_flight;
464 struct request *flush_rq;
465 spinlock_t mq_flush_lock;
466 460
467 struct list_head requeue_list; 461 struct list_head requeue_list;
468 spinlock_t requeue_lock; 462 spinlock_t requeue_lock;
@@ -865,7 +859,7 @@ extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
865 859
866static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 860static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
867{ 861{
868 return bdev->bd_disk->queue; 862 return bdev->bd_disk->queue; /* this is never NULL */
869} 863}
870 864
871/* 865/*
@@ -1142,8 +1136,7 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1142/* 1136/*
1143 * tag stuff 1137 * tag stuff
1144 */ 1138 */
1145#define blk_rq_tagged(rq) \ 1139#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED)
1146 ((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED))
1147extern int blk_queue_start_tag(struct request_queue *, struct request *); 1140extern int blk_queue_start_tag(struct request_queue *, struct request *);
1148extern struct request *blk_queue_find_tag(struct request_queue *, int); 1141extern struct request *blk_queue_find_tag(struct request_queue *, int);
1149extern void blk_queue_end_tag(struct request_queue *, struct request *); 1142extern void blk_queue_end_tag(struct request_queue *, struct request *);
@@ -1285,10 +1278,9 @@ static inline int queue_alignment_offset(struct request_queue *q)
1285static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector) 1278static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector)
1286{ 1279{
1287 unsigned int granularity = max(lim->physical_block_size, lim->io_min); 1280 unsigned int granularity = max(lim->physical_block_size, lim->io_min);
1288 unsigned int alignment = (sector << 9) & (granularity - 1); 1281 unsigned int alignment = sector_div(sector, granularity >> 9) << 9;
1289 1282
1290 return (granularity + lim->alignment_offset - alignment) 1283 return (granularity + lim->alignment_offset - alignment) % granularity;
1291 & (granularity - 1);
1292} 1284}
1293 1285
1294static inline int bdev_alignment_offset(struct block_device *bdev) 1286static inline int bdev_alignment_offset(struct block_device *bdev)
@@ -1464,32 +1456,31 @@ static inline uint64_t rq_io_start_time_ns(struct request *req)
1464 1456
1465#if defined(CONFIG_BLK_DEV_INTEGRITY) 1457#if defined(CONFIG_BLK_DEV_INTEGRITY)
1466 1458
1467#define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */ 1459enum blk_integrity_flags {
1468#define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */ 1460 BLK_INTEGRITY_VERIFY = 1 << 0,
1461 BLK_INTEGRITY_GENERATE = 1 << 1,
1462 BLK_INTEGRITY_DEVICE_CAPABLE = 1 << 2,
1463 BLK_INTEGRITY_IP_CHECKSUM = 1 << 3,
1464};
1469 1465
1470struct blk_integrity_exchg { 1466struct blk_integrity_iter {
1471 void *prot_buf; 1467 void *prot_buf;
1472 void *data_buf; 1468 void *data_buf;
1473 sector_t sector; 1469 sector_t seed;
1474 unsigned int data_size; 1470 unsigned int data_size;
1475 unsigned short sector_size; 1471 unsigned short interval;
1476 const char *disk_name; 1472 const char *disk_name;
1477}; 1473};
1478 1474
1479typedef void (integrity_gen_fn) (struct blk_integrity_exchg *); 1475typedef int (integrity_processing_fn) (struct blk_integrity_iter *);
1480typedef int (integrity_vrfy_fn) (struct blk_integrity_exchg *);
1481typedef void (integrity_set_tag_fn) (void *, void *, unsigned int);
1482typedef void (integrity_get_tag_fn) (void *, void *, unsigned int);
1483 1476
1484struct blk_integrity { 1477struct blk_integrity {
1485 integrity_gen_fn *generate_fn; 1478 integrity_processing_fn *generate_fn;
1486 integrity_vrfy_fn *verify_fn; 1479 integrity_processing_fn *verify_fn;
1487 integrity_set_tag_fn *set_tag_fn;
1488 integrity_get_tag_fn *get_tag_fn;
1489 1480
1490 unsigned short flags; 1481 unsigned short flags;
1491 unsigned short tuple_size; 1482 unsigned short tuple_size;
1492 unsigned short sector_size; 1483 unsigned short interval;
1493 unsigned short tag_size; 1484 unsigned short tag_size;
1494 1485
1495 const char *name; 1486 const char *name;
@@ -1504,10 +1495,10 @@ extern int blk_integrity_compare(struct gendisk *, struct gendisk *);
1504extern int blk_rq_map_integrity_sg(struct request_queue *, struct bio *, 1495extern int blk_rq_map_integrity_sg(struct request_queue *, struct bio *,
1505 struct scatterlist *); 1496 struct scatterlist *);
1506extern int blk_rq_count_integrity_sg(struct request_queue *, struct bio *); 1497extern int blk_rq_count_integrity_sg(struct request_queue *, struct bio *);
1507extern int blk_integrity_merge_rq(struct request_queue *, struct request *, 1498extern bool blk_integrity_merge_rq(struct request_queue *, struct request *,
1508 struct request *); 1499 struct request *);
1509extern int blk_integrity_merge_bio(struct request_queue *, struct request *, 1500extern bool blk_integrity_merge_bio(struct request_queue *, struct request *,
1510 struct bio *); 1501 struct bio *);
1511 1502
1512static inline 1503static inline
1513struct blk_integrity *bdev_get_integrity(struct block_device *bdev) 1504struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
@@ -1520,12 +1511,9 @@ static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
1520 return disk->integrity; 1511 return disk->integrity;
1521} 1512}
1522 1513
1523static inline int blk_integrity_rq(struct request *rq) 1514static inline bool blk_integrity_rq(struct request *rq)
1524{ 1515{
1525 if (rq->bio == NULL) 1516 return rq->cmd_flags & REQ_INTEGRITY;
1526 return 0;
1527
1528 return bio_integrity(rq->bio);
1529} 1517}
1530 1518
1531static inline void blk_queue_max_integrity_segments(struct request_queue *q, 1519static inline void blk_queue_max_integrity_segments(struct request_queue *q,
@@ -1564,7 +1552,7 @@ static inline int blk_rq_map_integrity_sg(struct request_queue *q,
1564} 1552}
1565static inline struct blk_integrity *bdev_get_integrity(struct block_device *b) 1553static inline struct blk_integrity *bdev_get_integrity(struct block_device *b)
1566{ 1554{
1567 return 0; 1555 return NULL;
1568} 1556}
1569static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk) 1557static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
1570{ 1558{
@@ -1590,17 +1578,17 @@ static inline unsigned short queue_max_integrity_segments(struct request_queue *
1590{ 1578{
1591 return 0; 1579 return 0;
1592} 1580}
1593static inline int blk_integrity_merge_rq(struct request_queue *rq, 1581static inline bool blk_integrity_merge_rq(struct request_queue *rq,
1594 struct request *r1, 1582 struct request *r1,
1595 struct request *r2) 1583 struct request *r2)
1596{ 1584{
1597 return 0; 1585 return true;
1598} 1586}
1599static inline int blk_integrity_merge_bio(struct request_queue *rq, 1587static inline bool blk_integrity_merge_bio(struct request_queue *rq,
1600 struct request *r, 1588 struct request *r,
1601 struct bio *b) 1589 struct bio *b)
1602{ 1590{
1603 return 0; 1591 return true;
1604} 1592}
1605static inline bool blk_integrity_is_initialized(struct gendisk *g) 1593static inline bool blk_integrity_is_initialized(struct gendisk *g)
1606{ 1594{
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
new file mode 100644
index 000000000000..3cf91754a957
--- /dev/null
+++ b/include/linux/bpf.h
@@ -0,0 +1,136 @@
1/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of version 2 of the GNU General Public
5 * License as published by the Free Software Foundation.
6 */
7#ifndef _LINUX_BPF_H
8#define _LINUX_BPF_H 1
9
10#include <uapi/linux/bpf.h>
11#include <linux/workqueue.h>
12#include <linux/file.h>
13
14struct bpf_map;
15
16/* map is generic key/value storage optionally accesible by eBPF programs */
17struct bpf_map_ops {
18 /* funcs callable from userspace (via syscall) */
19 struct bpf_map *(*map_alloc)(union bpf_attr *attr);
20 void (*map_free)(struct bpf_map *);
21 int (*map_get_next_key)(struct bpf_map *map, void *key, void *next_key);
22
23 /* funcs callable from userspace and from eBPF programs */
24 void *(*map_lookup_elem)(struct bpf_map *map, void *key);
25 int (*map_update_elem)(struct bpf_map *map, void *key, void *value);
26 int (*map_delete_elem)(struct bpf_map *map, void *key);
27};
28
29struct bpf_map {
30 atomic_t refcnt;
31 enum bpf_map_type map_type;
32 u32 key_size;
33 u32 value_size;
34 u32 max_entries;
35 struct bpf_map_ops *ops;
36 struct work_struct work;
37};
38
39struct bpf_map_type_list {
40 struct list_head list_node;
41 struct bpf_map_ops *ops;
42 enum bpf_map_type type;
43};
44
45void bpf_register_map_type(struct bpf_map_type_list *tl);
46void bpf_map_put(struct bpf_map *map);
47struct bpf_map *bpf_map_get(struct fd f);
48
49/* function argument constraints */
50enum bpf_arg_type {
51 ARG_ANYTHING = 0, /* any argument is ok */
52
53 /* the following constraints used to prototype
54 * bpf_map_lookup/update/delete_elem() functions
55 */
56 ARG_CONST_MAP_PTR, /* const argument used as pointer to bpf_map */
57 ARG_PTR_TO_MAP_KEY, /* pointer to stack used as map key */
58 ARG_PTR_TO_MAP_VALUE, /* pointer to stack used as map value */
59
60 /* the following constraints used to prototype bpf_memcmp() and other
61 * functions that access data on eBPF program stack
62 */
63 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */
64 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */
65};
66
67/* type of values returned from helper functions */
68enum bpf_return_type {
69 RET_INTEGER, /* function returns integer */
70 RET_VOID, /* function doesn't return anything */
71 RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */
72};
73
74/* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs
75 * to in-kernel helper functions and for adjusting imm32 field in BPF_CALL
76 * instructions after verifying
77 */
78struct bpf_func_proto {
79 u64 (*func)(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
80 bool gpl_only;
81 enum bpf_return_type ret_type;
82 enum bpf_arg_type arg1_type;
83 enum bpf_arg_type arg2_type;
84 enum bpf_arg_type arg3_type;
85 enum bpf_arg_type arg4_type;
86 enum bpf_arg_type arg5_type;
87};
88
89/* bpf_context is intentionally undefined structure. Pointer to bpf_context is
90 * the first argument to eBPF programs.
91 * For socket filters: 'struct bpf_context *' == 'struct sk_buff *'
92 */
93struct bpf_context;
94
95enum bpf_access_type {
96 BPF_READ = 1,
97 BPF_WRITE = 2
98};
99
100struct bpf_verifier_ops {
101 /* return eBPF function prototype for verification */
102 const struct bpf_func_proto *(*get_func_proto)(enum bpf_func_id func_id);
103
104 /* return true if 'size' wide access at offset 'off' within bpf_context
105 * with 'type' (read or write) is allowed
106 */
107 bool (*is_valid_access)(int off, int size, enum bpf_access_type type);
108};
109
110struct bpf_prog_type_list {
111 struct list_head list_node;
112 struct bpf_verifier_ops *ops;
113 enum bpf_prog_type type;
114};
115
116void bpf_register_prog_type(struct bpf_prog_type_list *tl);
117
118struct bpf_prog;
119
120struct bpf_prog_aux {
121 atomic_t refcnt;
122 bool is_gpl_compatible;
123 enum bpf_prog_type prog_type;
124 struct bpf_verifier_ops *ops;
125 struct bpf_map **used_maps;
126 u32 used_map_cnt;
127 struct bpf_prog *prog;
128 struct work_struct work;
129};
130
131void bpf_prog_put(struct bpf_prog *prog);
132struct bpf_prog *bpf_prog_get(u32 ufd);
133/* verify correctness of eBPF program */
134int bpf_check(struct bpf_prog *fp, union bpf_attr *attr);
135
136#endif /* _LINUX_BPF_H */
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 61219b9b3445..7ccd928cc1f2 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -13,7 +13,11 @@
13#define PHY_ID_BCM5461 0x002060c0 13#define PHY_ID_BCM5461 0x002060c0
14#define PHY_ID_BCM57780 0x03625d90 14#define PHY_ID_BCM57780 0x03625d90
15 15
16#define PHY_ID_BCM7250 0xae025280
17#define PHY_ID_BCM7364 0xae025260
16#define PHY_ID_BCM7366 0x600d8490 18#define PHY_ID_BCM7366 0x600d8490
19#define PHY_ID_BCM7425 0x03625e60
20#define PHY_ID_BCM7429 0x600d8730
17#define PHY_ID_BCM7439 0x600d8480 21#define PHY_ID_BCM7439 0x600d8480
18#define PHY_ID_BCM7445 0x600d8510 22#define PHY_ID_BCM7445 0x600d8510
19 23
@@ -21,9 +25,9 @@
21#define PHY_BCM_OUI_1 0x00206000 25#define PHY_BCM_OUI_1 0x00206000
22#define PHY_BCM_OUI_2 0x0143bc00 26#define PHY_BCM_OUI_2 0x0143bc00
23#define PHY_BCM_OUI_3 0x03625c00 27#define PHY_BCM_OUI_3 0x03625c00
24#define PHY_BCM_OUI_4 0x600d0000 28#define PHY_BCM_OUI_4 0x600d8400
25#define PHY_BCM_OUI_5 0x03625e00 29#define PHY_BCM_OUI_5 0x03625e00
26 30#define PHY_BCM_OUI_6 0xae025000
27 31
28#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 32#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001
29#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 33#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002
@@ -38,7 +42,8 @@
38#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 42#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
39#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 43#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
40/* Broadcom BCM7xxx specific workarounds */ 44/* Broadcom BCM7xxx specific workarounds */
41#define PHY_BRCM_100MBPS_WAR 0x00010000 45#define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff)
46#define PHY_BRCM_7XXX_PATCH(x) ((x) & 0xff)
42#define PHY_BCM_FLAGS_VALID 0x80000000 47#define PHY_BCM_FLAGS_VALID 0x80000000
43 48
44/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */ 49/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */
@@ -92,4 +97,130 @@
92 97
93#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 98#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
94 99
100/*
101 * Broadcom LED source encodings. These are used in BCM5461, BCM5481,
102 * BCM5482, and possibly some others.
103 */
104#define BCM_LED_SRC_LINKSPD1 0x0
105#define BCM_LED_SRC_LINKSPD2 0x1
106#define BCM_LED_SRC_XMITLED 0x2
107#define BCM_LED_SRC_ACTIVITYLED 0x3
108#define BCM_LED_SRC_FDXLED 0x4
109#define BCM_LED_SRC_SLAVE 0x5
110#define BCM_LED_SRC_INTR 0x6
111#define BCM_LED_SRC_QUALITY 0x7
112#define BCM_LED_SRC_RCVLED 0x8
113#define BCM_LED_SRC_MULTICOLOR1 0xa
114#define BCM_LED_SRC_OPENSHORT 0xb
115#define BCM_LED_SRC_OFF 0xe /* Tied high */
116#define BCM_LED_SRC_ON 0xf /* Tied low */
117
118
119/*
120 * BCM5482: Shadow registers
121 * Shadow values go into bits [14:10] of register 0x1c to select a shadow
122 * register to access.
123 */
124/* 00101: Spare Control Register 3 */
125#define BCM54XX_SHD_SCR3 0x05
126#define BCM54XX_SHD_SCR3_DEF_CLK125 0x0001
127#define BCM54XX_SHD_SCR3_DLLAPD_DIS 0x0002
128#define BCM54XX_SHD_SCR3_TRDDAPD 0x0004
129
130/* 01010: Auto Power-Down */
131#define BCM54XX_SHD_APD 0x0a
132#define BCM54XX_SHD_APD_EN 0x0020
133
134#define BCM5482_SHD_LEDS1 0x0d /* 01101: LED Selector 1 */
135 /* LED3 / ~LINKSPD[2] selector */
136#define BCM5482_SHD_LEDS1_LED3(src) ((src & 0xf) << 4)
137 /* LED1 / ~LINKSPD[1] selector */
138#define BCM5482_SHD_LEDS1_LED1(src) ((src & 0xf) << 0)
139#define BCM54XX_SHD_RGMII_MODE 0x0b /* 01011: RGMII Mode Selector */
140#define BCM5482_SHD_SSD 0x14 /* 10100: Secondary SerDes control */
141#define BCM5482_SHD_SSD_LEDM 0x0008 /* SSD LED Mode enable */
142#define BCM5482_SHD_SSD_EN 0x0001 /* SSD enable */
143#define BCM5482_SHD_MODE 0x1f /* 11111: Mode Control Register */
144#define BCM5482_SHD_MODE_1000BX 0x0001 /* Enable 1000BASE-X registers */
145
146
147/*
148 * EXPANSION SHADOW ACCESS REGISTERS. (PHY REG 0x15, 0x16, and 0x17)
149 */
150#define MII_BCM54XX_EXP_AADJ1CH0 0x001f
151#define MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN 0x0200
152#define MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF 0x0100
153#define MII_BCM54XX_EXP_AADJ1CH3 0x601f
154#define MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ 0x0002
155#define MII_BCM54XX_EXP_EXP08 0x0F08
156#define MII_BCM54XX_EXP_EXP08_RJCT_2MHZ 0x0001
157#define MII_BCM54XX_EXP_EXP08_EARLY_DAC_WAKE 0x0200
158#define MII_BCM54XX_EXP_EXP75 0x0f75
159#define MII_BCM54XX_EXP_EXP75_VDACCTRL 0x003c
160#define MII_BCM54XX_EXP_EXP75_CM_OSC 0x0001
161#define MII_BCM54XX_EXP_EXP96 0x0f96
162#define MII_BCM54XX_EXP_EXP96_MYST 0x0010
163#define MII_BCM54XX_EXP_EXP97 0x0f97
164#define MII_BCM54XX_EXP_EXP97_MYST 0x0c0c
165
166/*
167 * BCM5482: Secondary SerDes registers
168 */
169#define BCM5482_SSD_1000BX_CTL 0x00 /* 1000BASE-X Control */
170#define BCM5482_SSD_1000BX_CTL_PWRDOWN 0x0800 /* Power-down SSD */
171#define BCM5482_SSD_SGMII_SLAVE 0x15 /* SGMII Slave Register */
172#define BCM5482_SSD_SGMII_SLAVE_EN 0x0002 /* Slave mode enable */
173#define BCM5482_SSD_SGMII_SLAVE_AD 0x0001 /* Slave auto-detection */
174
175
176/*****************************************************************************/
177/* Fast Ethernet Transceiver definitions. */
178/*****************************************************************************/
179
180#define MII_BRCM_FET_INTREG 0x1a /* Interrupt register */
181#define MII_BRCM_FET_IR_MASK 0x0100 /* Mask all interrupts */
182#define MII_BRCM_FET_IR_LINK_EN 0x0200 /* Link status change enable */
183#define MII_BRCM_FET_IR_SPEED_EN 0x0400 /* Link speed change enable */
184#define MII_BRCM_FET_IR_DUPLEX_EN 0x0800 /* Duplex mode change enable */
185#define MII_BRCM_FET_IR_ENABLE 0x4000 /* Interrupt enable */
186
187#define MII_BRCM_FET_BRCMTEST 0x1f /* Brcm test register */
188#define MII_BRCM_FET_BT_SRE 0x0080 /* Shadow register enable */
189
190
191/*** Shadow register definitions ***/
192
193#define MII_BRCM_FET_SHDW_MISCCTRL 0x10 /* Shadow misc ctrl */
194#define MII_BRCM_FET_SHDW_MC_FAME 0x4000 /* Force Auto MDIX enable */
195
196#define MII_BRCM_FET_SHDW_AUXMODE4 0x1a /* Auxiliary mode 4 */
197#define MII_BRCM_FET_SHDW_AM4_LED_MASK 0x0003
198#define MII_BRCM_FET_SHDW_AM4_LED_MODE1 0x0001
199
200#define MII_BRCM_FET_SHDW_AUXSTAT2 0x1b /* Auxiliary status 2 */
201#define MII_BRCM_FET_SHDW_AS2_APDE 0x0020 /* Auto power down enable */
202
203/*
204 * Indirect register access functions for the 1000BASE-T/100BASE-TX/10BASE-T
205 * 0x1c shadow registers.
206 */
207static inline int bcm54xx_shadow_read(struct phy_device *phydev, u16 shadow)
208{
209 phy_write(phydev, MII_BCM54XX_SHD, MII_BCM54XX_SHD_VAL(shadow));
210 return MII_BCM54XX_SHD_DATA(phy_read(phydev, MII_BCM54XX_SHD));
211}
212
213static inline int bcm54xx_shadow_write(struct phy_device *phydev, u16 shadow,
214 u16 val)
215{
216 return phy_write(phydev, MII_BCM54XX_SHD,
217 MII_BCM54XX_SHD_WRITE |
218 MII_BCM54XX_SHD_VAL(shadow) |
219 MII_BCM54XX_SHD_DATA(val));
220}
221
222#define BRCM_CL45VEN_EEE_CONTROL 0x803d
223#define LPI_FEATURE_EN 0x8000
224#define LPI_FEATURE_EN_DIG1000X 0x4000
225
95#endif /* _LINUX_BRCMPHY_H */ 226#endif /* _LINUX_BRCMPHY_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 324329ceea1e..73b45225a7ca 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -175,12 +175,13 @@ void __wait_on_buffer(struct buffer_head *);
175wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); 175wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
176struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block, 176struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
177 unsigned size); 177 unsigned size);
178struct buffer_head *__getblk(struct block_device *bdev, sector_t block, 178struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block,
179 unsigned size); 179 unsigned size, gfp_t gfp);
180void __brelse(struct buffer_head *); 180void __brelse(struct buffer_head *);
181void __bforget(struct buffer_head *); 181void __bforget(struct buffer_head *);
182void __breadahead(struct block_device *, sector_t block, unsigned int size); 182void __breadahead(struct block_device *, sector_t block, unsigned int size);
183struct buffer_head *__bread(struct block_device *, sector_t block, unsigned size); 183struct buffer_head *__bread_gfp(struct block_device *,
184 sector_t block, unsigned size, gfp_t gfp);
184void invalidate_bh_lrus(void); 185void invalidate_bh_lrus(void);
185struct buffer_head *alloc_buffer_head(gfp_t gfp_flags); 186struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
186void free_buffer_head(struct buffer_head * bh); 187void free_buffer_head(struct buffer_head * bh);
@@ -295,7 +296,13 @@ static inline void bforget(struct buffer_head *bh)
295static inline struct buffer_head * 296static inline struct buffer_head *
296sb_bread(struct super_block *sb, sector_t block) 297sb_bread(struct super_block *sb, sector_t block)
297{ 298{
298 return __bread(sb->s_bdev, block, sb->s_blocksize); 299 return __bread_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
300}
301
302static inline struct buffer_head *
303sb_bread_unmovable(struct super_block *sb, sector_t block)
304{
305 return __bread_gfp(sb->s_bdev, block, sb->s_blocksize, 0);
299} 306}
300 307
301static inline void 308static inline void
@@ -307,7 +314,7 @@ sb_breadahead(struct super_block *sb, sector_t block)
307static inline struct buffer_head * 314static inline struct buffer_head *
308sb_getblk(struct super_block *sb, sector_t block) 315sb_getblk(struct super_block *sb, sector_t block)
309{ 316{
310 return __getblk(sb->s_bdev, block, sb->s_blocksize); 317 return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
311} 318}
312 319
313static inline struct buffer_head * 320static inline struct buffer_head *
@@ -344,6 +351,36 @@ static inline void lock_buffer(struct buffer_head *bh)
344 __lock_buffer(bh); 351 __lock_buffer(bh);
345} 352}
346 353
354static inline struct buffer_head *getblk_unmovable(struct block_device *bdev,
355 sector_t block,
356 unsigned size)
357{
358 return __getblk_gfp(bdev, block, size, 0);
359}
360
361static inline struct buffer_head *__getblk(struct block_device *bdev,
362 sector_t block,
363 unsigned size)
364{
365 return __getblk_gfp(bdev, block, size, __GFP_MOVABLE);
366}
367
368/**
369 * __bread() - reads a specified block and returns the bh
370 * @bdev: the block_device to read from
371 * @block: number of block
372 * @size: size (in bytes) to read
373 *
374 * Reads a specified block, and returns buffer head that contains it.
375 * The page cache is allocated from movable area so that it can be migrated.
376 * It returns NULL if the block was unreadable.
377 */
378static inline struct buffer_head *
379__bread(struct block_device *bdev, sector_t block, unsigned size)
380{
381 return __bread_gfp(bdev, block, size, __GFP_MOVABLE);
382}
383
347extern int __set_page_dirty_buffers(struct page *page); 384extern int __set_page_dirty_buffers(struct page *page);
348 385
349#else /* CONFIG_BLOCK */ 386#else /* CONFIG_BLOCK */
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 279b0afac1c1..07bc359b88ac 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -211,7 +211,6 @@ extern struct page **ceph_get_direct_page_vector(const void __user *data,
211 bool write_page); 211 bool write_page);
212extern void ceph_put_page_vector(struct page **pages, int num_pages, 212extern void ceph_put_page_vector(struct page **pages, int num_pages,
213 bool dirty); 213 bool dirty);
214extern void ceph_release_page_vector(struct page **pages, int num_pages);
215extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); 214extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
216extern int ceph_copy_user_to_page_vector(struct page **pages, 215extern int ceph_copy_user_to_page_vector(struct page **pages,
217 const void __user *data, 216 const void __user *data,
diff --git a/include/linux/ceph/pagelist.h b/include/linux/ceph/pagelist.h
index 9660d6b0a35d..5f871d84ddce 100644
--- a/include/linux/ceph/pagelist.h
+++ b/include/linux/ceph/pagelist.h
@@ -2,6 +2,7 @@
2#define __FS_CEPH_PAGELIST_H 2#define __FS_CEPH_PAGELIST_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/atomic.h>
5 6
6struct ceph_pagelist { 7struct ceph_pagelist {
7 struct list_head head; 8 struct list_head head;
@@ -10,6 +11,7 @@ struct ceph_pagelist {
10 size_t room; 11 size_t room;
11 struct list_head free_list; 12 struct list_head free_list;
12 size_t num_pages_free; 13 size_t num_pages_free;
14 atomic_t refcnt;
13}; 15};
14 16
15struct ceph_pagelist_cursor { 17struct ceph_pagelist_cursor {
@@ -26,9 +28,10 @@ static inline void ceph_pagelist_init(struct ceph_pagelist *pl)
26 pl->room = 0; 28 pl->room = 0;
27 INIT_LIST_HEAD(&pl->free_list); 29 INIT_LIST_HEAD(&pl->free_list);
28 pl->num_pages_free = 0; 30 pl->num_pages_free = 0;
31 atomic_set(&pl->refcnt, 1);
29} 32}
30 33
31extern int ceph_pagelist_release(struct ceph_pagelist *pl); 34extern void ceph_pagelist_release(struct ceph_pagelist *pl);
32 35
33extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l); 36extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l);
34 37
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index f20e0d8a2155..2f822dca1046 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -172,6 +172,7 @@ extern const char *ceph_osd_state_name(int s);
172#define CEPH_OSD_OP_MODE_WR 0x2000 172#define CEPH_OSD_OP_MODE_WR 0x2000
173#define CEPH_OSD_OP_MODE_RMW 0x3000 173#define CEPH_OSD_OP_MODE_RMW 0x3000
174#define CEPH_OSD_OP_MODE_SUB 0x4000 174#define CEPH_OSD_OP_MODE_SUB 0x4000
175#define CEPH_OSD_OP_MODE_CACHE 0x8000
175 176
176#define CEPH_OSD_OP_TYPE 0x0f00 177#define CEPH_OSD_OP_TYPE 0x0f00
177#define CEPH_OSD_OP_TYPE_LOCK 0x0100 178#define CEPH_OSD_OP_TYPE_LOCK 0x0100
@@ -181,103 +182,135 @@ extern const char *ceph_osd_state_name(int s);
181#define CEPH_OSD_OP_TYPE_PG 0x0500 182#define CEPH_OSD_OP_TYPE_PG 0x0500
182#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */ 183#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */
183 184
185#define __CEPH_OSD_OP1(mode, nr) \
186 (CEPH_OSD_OP_MODE_##mode | (nr))
187
188#define __CEPH_OSD_OP(mode, type, nr) \
189 (CEPH_OSD_OP_MODE_##mode | CEPH_OSD_OP_TYPE_##type | (nr))
190
191#define __CEPH_FORALL_OSD_OPS(f) \
192 /** data **/ \
193 /* read */ \
194 f(READ, __CEPH_OSD_OP(RD, DATA, 1), "read") \
195 f(STAT, __CEPH_OSD_OP(RD, DATA, 2), "stat") \
196 f(MAPEXT, __CEPH_OSD_OP(RD, DATA, 3), "mapext") \
197 \
198 /* fancy read */ \
199 f(MASKTRUNC, __CEPH_OSD_OP(RD, DATA, 4), "masktrunc") \
200 f(SPARSE_READ, __CEPH_OSD_OP(RD, DATA, 5), "sparse-read") \
201 \
202 f(NOTIFY, __CEPH_OSD_OP(RD, DATA, 6), "notify") \
203 f(NOTIFY_ACK, __CEPH_OSD_OP(RD, DATA, 7), "notify-ack") \
204 \
205 /* versioning */ \
206 f(ASSERT_VER, __CEPH_OSD_OP(RD, DATA, 8), "assert-version") \
207 \
208 f(LIST_WATCHERS, __CEPH_OSD_OP(RD, DATA, 9), "list-watchers") \
209 \
210 f(LIST_SNAPS, __CEPH_OSD_OP(RD, DATA, 10), "list-snaps") \
211 \
212 /* sync */ \
213 f(SYNC_READ, __CEPH_OSD_OP(RD, DATA, 11), "sync_read") \
214 \
215 /* write */ \
216 f(WRITE, __CEPH_OSD_OP(WR, DATA, 1), "write") \
217 f(WRITEFULL, __CEPH_OSD_OP(WR, DATA, 2), "writefull") \
218 f(TRUNCATE, __CEPH_OSD_OP(WR, DATA, 3), "truncate") \
219 f(ZERO, __CEPH_OSD_OP(WR, DATA, 4), "zero") \
220 f(DELETE, __CEPH_OSD_OP(WR, DATA, 5), "delete") \
221 \
222 /* fancy write */ \
223 f(APPEND, __CEPH_OSD_OP(WR, DATA, 6), "append") \
224 f(STARTSYNC, __CEPH_OSD_OP(WR, DATA, 7), "startsync") \
225 f(SETTRUNC, __CEPH_OSD_OP(WR, DATA, 8), "settrunc") \
226 f(TRIMTRUNC, __CEPH_OSD_OP(WR, DATA, 9), "trimtrunc") \
227 \
228 f(TMAPUP, __CEPH_OSD_OP(RMW, DATA, 10), "tmapup") \
229 f(TMAPPUT, __CEPH_OSD_OP(WR, DATA, 11), "tmapput") \
230 f(TMAPGET, __CEPH_OSD_OP(RD, DATA, 12), "tmapget") \
231 \
232 f(CREATE, __CEPH_OSD_OP(WR, DATA, 13), "create") \
233 f(ROLLBACK, __CEPH_OSD_OP(WR, DATA, 14), "rollback") \
234 \
235 f(WATCH, __CEPH_OSD_OP(WR, DATA, 15), "watch") \
236 \
237 /* omap */ \
238 f(OMAPGETKEYS, __CEPH_OSD_OP(RD, DATA, 17), "omap-get-keys") \
239 f(OMAPGETVALS, __CEPH_OSD_OP(RD, DATA, 18), "omap-get-vals") \
240 f(OMAPGETHEADER, __CEPH_OSD_OP(RD, DATA, 19), "omap-get-header") \
241 f(OMAPGETVALSBYKEYS, __CEPH_OSD_OP(RD, DATA, 20), "omap-get-vals-by-keys") \
242 f(OMAPSETVALS, __CEPH_OSD_OP(WR, DATA, 21), "omap-set-vals") \
243 f(OMAPSETHEADER, __CEPH_OSD_OP(WR, DATA, 22), "omap-set-header") \
244 f(OMAPCLEAR, __CEPH_OSD_OP(WR, DATA, 23), "omap-clear") \
245 f(OMAPRMKEYS, __CEPH_OSD_OP(WR, DATA, 24), "omap-rm-keys") \
246 f(OMAP_CMP, __CEPH_OSD_OP(RD, DATA, 25), "omap-cmp") \
247 \
248 /* tiering */ \
249 f(COPY_FROM, __CEPH_OSD_OP(WR, DATA, 26), "copy-from") \
250 f(COPY_GET_CLASSIC, __CEPH_OSD_OP(RD, DATA, 27), "copy-get-classic") \
251 f(UNDIRTY, __CEPH_OSD_OP(WR, DATA, 28), "undirty") \
252 f(ISDIRTY, __CEPH_OSD_OP(RD, DATA, 29), "isdirty") \
253 f(COPY_GET, __CEPH_OSD_OP(RD, DATA, 30), "copy-get") \
254 f(CACHE_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 31), "cache-flush") \
255 f(CACHE_EVICT, __CEPH_OSD_OP(CACHE, DATA, 32), "cache-evict") \
256 f(CACHE_TRY_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 33), "cache-try-flush") \
257 \
258 /* convert tmap to omap */ \
259 f(TMAP2OMAP, __CEPH_OSD_OP(RMW, DATA, 34), "tmap2omap") \
260 \
261 /* hints */ \
262 f(SETALLOCHINT, __CEPH_OSD_OP(WR, DATA, 35), "set-alloc-hint") \
263 \
264 /** multi **/ \
265 f(CLONERANGE, __CEPH_OSD_OP(WR, MULTI, 1), "clonerange") \
266 f(ASSERT_SRC_VERSION, __CEPH_OSD_OP(RD, MULTI, 2), "assert-src-version") \
267 f(SRC_CMPXATTR, __CEPH_OSD_OP(RD, MULTI, 3), "src-cmpxattr") \
268 \
269 /** attrs **/ \
270 /* read */ \
271 f(GETXATTR, __CEPH_OSD_OP(RD, ATTR, 1), "getxattr") \
272 f(GETXATTRS, __CEPH_OSD_OP(RD, ATTR, 2), "getxattrs") \
273 f(CMPXATTR, __CEPH_OSD_OP(RD, ATTR, 3), "cmpxattr") \
274 \
275 /* write */ \
276 f(SETXATTR, __CEPH_OSD_OP(WR, ATTR, 1), "setxattr") \
277 f(SETXATTRS, __CEPH_OSD_OP(WR, ATTR, 2), "setxattrs") \
278 f(RESETXATTRS, __CEPH_OSD_OP(WR, ATTR, 3), "resetxattrs") \
279 f(RMXATTR, __CEPH_OSD_OP(WR, ATTR, 4), "rmxattr") \
280 \
281 /** subop **/ \
282 f(PULL, __CEPH_OSD_OP1(SUB, 1), "pull") \
283 f(PUSH, __CEPH_OSD_OP1(SUB, 2), "push") \
284 f(BALANCEREADS, __CEPH_OSD_OP1(SUB, 3), "balance-reads") \
285 f(UNBALANCEREADS, __CEPH_OSD_OP1(SUB, 4), "unbalance-reads") \
286 f(SCRUB, __CEPH_OSD_OP1(SUB, 5), "scrub") \
287 f(SCRUB_RESERVE, __CEPH_OSD_OP1(SUB, 6), "scrub-reserve") \
288 f(SCRUB_UNRESERVE, __CEPH_OSD_OP1(SUB, 7), "scrub-unreserve") \
289 f(SCRUB_STOP, __CEPH_OSD_OP1(SUB, 8), "scrub-stop") \
290 f(SCRUB_MAP, __CEPH_OSD_OP1(SUB, 9), "scrub-map") \
291 \
292 /** lock **/ \
293 f(WRLOCK, __CEPH_OSD_OP(WR, LOCK, 1), "wrlock") \
294 f(WRUNLOCK, __CEPH_OSD_OP(WR, LOCK, 2), "wrunlock") \
295 f(RDLOCK, __CEPH_OSD_OP(WR, LOCK, 3), "rdlock") \
296 f(RDUNLOCK, __CEPH_OSD_OP(WR, LOCK, 4), "rdunlock") \
297 f(UPLOCK, __CEPH_OSD_OP(WR, LOCK, 5), "uplock") \
298 f(DNLOCK, __CEPH_OSD_OP(WR, LOCK, 6), "dnlock") \
299 \
300 /** exec **/ \
301 /* note: the RD bit here is wrong; see special-case below in helper */ \
302 f(CALL, __CEPH_OSD_OP(RD, EXEC, 1), "call") \
303 \
304 /** pg **/ \
305 f(PGLS, __CEPH_OSD_OP(RD, PG, 1), "pgls") \
306 f(PGLS_FILTER, __CEPH_OSD_OP(RD, PG, 2), "pgls-filter") \
307 f(PG_HITSET_LS, __CEPH_OSD_OP(RD, PG, 3), "pg-hitset-ls") \
308 f(PG_HITSET_GET, __CEPH_OSD_OP(RD, PG, 4), "pg-hitset-get")
309
184enum { 310enum {
185 /** data **/ 311#define GENERATE_ENUM_ENTRY(op, opcode, str) CEPH_OSD_OP_##op = (opcode),
186 /* read */ 312__CEPH_FORALL_OSD_OPS(GENERATE_ENUM_ENTRY)
187 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, 313#undef GENERATE_ENUM_ENTRY
188 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
189 CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3,
190
191 /* fancy read */
192 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
193 CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5,
194
195 CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6,
196 CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7,
197
198 /* versioning */
199 CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8,
200
201 /* write */
202 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
203 CEPH_OSD_OP_WRITEFULL = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 2,
204 CEPH_OSD_OP_TRUNCATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 3,
205 CEPH_OSD_OP_ZERO = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 4,
206 CEPH_OSD_OP_DELETE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 5,
207
208 /* fancy write */
209 CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6,
210 CEPH_OSD_OP_STARTSYNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 7,
211 CEPH_OSD_OP_SETTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 8,
212 CEPH_OSD_OP_TRIMTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 9,
213
214 CEPH_OSD_OP_TMAPUP = CEPH_OSD_OP_MODE_RMW | CEPH_OSD_OP_TYPE_DATA | 10,
215 CEPH_OSD_OP_TMAPPUT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 11,
216 CEPH_OSD_OP_TMAPGET = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 12,
217
218 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
219 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14,
220
221 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
222
223 /* omap */
224 CEPH_OSD_OP_OMAPGETKEYS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 17,
225 CEPH_OSD_OP_OMAPGETVALS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 18,
226 CEPH_OSD_OP_OMAPGETHEADER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 19,
227 CEPH_OSD_OP_OMAPGETVALSBYKEYS =
228 CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 20,
229 CEPH_OSD_OP_OMAPSETVALS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 21,
230 CEPH_OSD_OP_OMAPSETHEADER = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 22,
231 CEPH_OSD_OP_OMAPCLEAR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 23,
232 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24,
233 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25,
234
235 /* hints */
236 CEPH_OSD_OP_SETALLOCHINT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 35,
237
238 /** multi **/
239 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
240 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2,
241 CEPH_OSD_OP_SRC_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 3,
242
243 /** attrs **/
244 /* read */
245 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
246 CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
247 CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3,
248
249 /* write */
250 CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
251 CEPH_OSD_OP_SETXATTRS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 2,
252 CEPH_OSD_OP_RESETXATTRS = CEPH_OSD_OP_MODE_WR|CEPH_OSD_OP_TYPE_ATTR | 3,
253 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
254
255 /** subop **/
256 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
257 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
258 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
259 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
260 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
261 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
262 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
263 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
264 CEPH_OSD_OP_SCRUB_MAP = CEPH_OSD_OP_MODE_SUB | 9,
265
266 /** lock **/
267 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
268 CEPH_OSD_OP_WRUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 2,
269 CEPH_OSD_OP_RDLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 3,
270 CEPH_OSD_OP_RDUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 4,
271 CEPH_OSD_OP_UPLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 5,
272 CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
273
274 /** exec **/
275 /* note: the RD bit here is wrong; see special-case below in helper */
276 CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
277
278 /** pg **/
279 CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1,
280 CEPH_OSD_OP_PGLS_FILTER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 2,
281}; 314};
282 315
283static inline int ceph_osd_op_type_lock(int op) 316static inline int ceph_osd_op_type_lock(int op)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b5223c570eba..1d5196889048 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -27,7 +27,6 @@
27 27
28struct cgroup_root; 28struct cgroup_root;
29struct cgroup_subsys; 29struct cgroup_subsys;
30struct inode;
31struct cgroup; 30struct cgroup;
32 31
33extern int cgroup_init_early(void); 32extern int cgroup_init_early(void);
@@ -38,7 +37,8 @@ extern void cgroup_exit(struct task_struct *p);
38extern int cgroupstats_build(struct cgroupstats *stats, 37extern int cgroupstats_build(struct cgroupstats *stats,
39 struct dentry *dentry); 38 struct dentry *dentry);
40 39
41extern int proc_cgroup_show(struct seq_file *, void *); 40extern int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
41 struct pid *pid, struct task_struct *tsk);
42 42
43/* define the enumeration of all cgroup subsystems */ 43/* define the enumeration of all cgroup subsystems */
44#define SUBSYS(_x) _x ## _cgrp_id, 44#define SUBSYS(_x) _x ## _cgrp_id,
@@ -161,11 +161,6 @@ static inline void css_put(struct cgroup_subsys_state *css)
161 161
162/* bits in struct cgroup flags field */ 162/* bits in struct cgroup flags field */
163enum { 163enum {
164 /*
165 * Control Group has previously had a child cgroup or a task,
166 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
167 */
168 CGRP_RELEASABLE,
169 /* Control Group requires release notifications to userspace */ 164 /* Control Group requires release notifications to userspace */
170 CGRP_NOTIFY_ON_RELEASE, 165 CGRP_NOTIFY_ON_RELEASE,
171 /* 166 /*
@@ -235,13 +230,6 @@ struct cgroup {
235 struct list_head e_csets[CGROUP_SUBSYS_COUNT]; 230 struct list_head e_csets[CGROUP_SUBSYS_COUNT];
236 231
237 /* 232 /*
238 * Linked list running through all cgroups that can
239 * potentially be reaped by the release agent. Protected by
240 * release_list_lock
241 */
242 struct list_head release_list;
243
244 /*
245 * list of pidlists, up to two for each namespace (one for procs, one 233 * list of pidlists, up to two for each namespace (one for procs, one
246 * for tasks); created on demand. 234 * for tasks); created on demand.
247 */ 235 */
@@ -250,6 +238,9 @@ struct cgroup {
250 238
251 /* used to wait for offlining of csses */ 239 /* used to wait for offlining of csses */
252 wait_queue_head_t offline_waitq; 240 wait_queue_head_t offline_waitq;
241
242 /* used to schedule release agent */
243 struct work_struct release_agent_work;
253}; 244};
254 245
255#define MAX_CGROUP_ROOT_NAMELEN 64 246#define MAX_CGROUP_ROOT_NAMELEN 64
@@ -536,13 +527,10 @@ static inline bool cgroup_has_tasks(struct cgroup *cgrp)
536 return !list_empty(&cgrp->cset_links); 527 return !list_empty(&cgrp->cset_links);
537} 528}
538 529
539/* returns ino associated with a cgroup, 0 indicates unmounted root */ 530/* returns ino associated with a cgroup */
540static inline ino_t cgroup_ino(struct cgroup *cgrp) 531static inline ino_t cgroup_ino(struct cgroup *cgrp)
541{ 532{
542 if (cgrp->kn) 533 return cgrp->kn->ino;
543 return cgrp->kn->ino;
544 else
545 return 0;
546} 534}
547 535
548/* cft/css accessors for cftype->write() operation */ 536/* cft/css accessors for cftype->write() operation */
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index efbf70b9fd84..0ca5f6046920 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -46,8 +46,10 @@ struct clk {
46 unsigned int enable_count; 46 unsigned int enable_count;
47 unsigned int prepare_count; 47 unsigned int prepare_count;
48 unsigned long accuracy; 48 unsigned long accuracy;
49 int phase;
49 struct hlist_head children; 50 struct hlist_head children;
50 struct hlist_node child_node; 51 struct hlist_node child_node;
52 struct hlist_node debug_node;
51 unsigned int notifier_count; 53 unsigned int notifier_count;
52#ifdef CONFIG_DEBUG_FS 54#ifdef CONFIG_DEBUG_FS
53 struct dentry *dentry; 55 struct dentry *dentry;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 411dd7eb2653..be21af149f11 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/of.h>
16 17
17#ifdef CONFIG_COMMON_CLK 18#ifdef CONFIG_COMMON_CLK
18 19
@@ -129,6 +130,14 @@ struct dentry;
129 * set then clock accuracy will be initialized to parent accuracy 130 * set then clock accuracy will be initialized to parent accuracy
130 * or 0 (perfect clock) if clock has no parent. 131 * or 0 (perfect clock) if clock has no parent.
131 * 132 *
133 * @get_phase: Queries the hardware to get the current phase of a clock.
134 * Returned values are 0-359 degrees on success, negative
135 * error codes on failure.
136 *
137 * @set_phase: Shift the phase this clock signal in degrees specified
138 * by the second argument. Valid values for degrees are
139 * 0-359. Return 0 on success, otherwise -EERROR.
140 *
132 * @init: Perform platform-specific initialization magic. 141 * @init: Perform platform-specific initialization magic.
133 * This is not not used by any of the basic clock types. 142 * This is not not used by any of the basic clock types.
134 * Please consider other ways of solving initialization problems 143 * Please consider other ways of solving initialization problems
@@ -177,6 +186,8 @@ struct clk_ops {
177 unsigned long parent_rate, u8 index); 186 unsigned long parent_rate, u8 index);
178 unsigned long (*recalc_accuracy)(struct clk_hw *hw, 187 unsigned long (*recalc_accuracy)(struct clk_hw *hw,
179 unsigned long parent_accuracy); 188 unsigned long parent_accuracy);
189 int (*get_phase)(struct clk_hw *hw);
190 int (*set_phase)(struct clk_hw *hw, int degrees);
180 void (*init)(struct clk_hw *hw); 191 void (*init)(struct clk_hw *hw);
181 int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); 192 int (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
182}; 193};
@@ -488,6 +499,28 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
488 struct clk_hw *gate_hw, const struct clk_ops *gate_ops, 499 struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
489 unsigned long flags); 500 unsigned long flags);
490 501
502/***
503 * struct clk_gpio_gate - gpio gated clock
504 *
505 * @hw: handle between common and hardware-specific interfaces
506 * @gpiod: gpio descriptor
507 *
508 * Clock with a gpio control for enabling and disabling the parent clock.
509 * Implements .enable, .disable and .is_enabled
510 */
511
512struct clk_gpio {
513 struct clk_hw hw;
514 struct gpio_desc *gpiod;
515};
516
517extern const struct clk_ops clk_gpio_gate_ops;
518struct clk *clk_register_gpio_gate(struct device *dev, const char *name,
519 const char *parent_name, struct gpio_desc *gpio,
520 unsigned long flags);
521
522void of_gpio_clk_gate_setup(struct device_node *node);
523
491/** 524/**
492 * clk_register - allocate a new clock, register it and return an opaque cookie 525 * clk_register - allocate a new clock, register it and return an opaque cookie
493 * @dev: device that is registering this clock 526 * @dev: device that is registering this clock
diff --git a/include/linux/clk.h b/include/linux/clk.h
index afb44bfaf8d1..c7f258a81761 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -106,6 +106,25 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
106 */ 106 */
107long clk_get_accuracy(struct clk *clk); 107long clk_get_accuracy(struct clk *clk);
108 108
109/**
110 * clk_set_phase - adjust the phase shift of a clock signal
111 * @clk: clock signal source
112 * @degrees: number of degrees the signal is shifted
113 *
114 * Shifts the phase of a clock signal by the specified degrees. Returns 0 on
115 * success, -EERROR otherwise.
116 */
117int clk_set_phase(struct clk *clk, int degrees);
118
119/**
120 * clk_get_phase - return the phase shift of a clock signal
121 * @clk: clock signal source
122 *
123 * Returns the phase shift of a clock node in degrees, otherwise returns
124 * -EERROR.
125 */
126int clk_get_phase(struct clk *clk);
127
109#else 128#else
110 129
111static inline long clk_get_accuracy(struct clk *clk) 130static inline long clk_get_accuracy(struct clk *clk)
@@ -113,6 +132,16 @@ static inline long clk_get_accuracy(struct clk *clk)
113 return -ENOTSUPP; 132 return -ENOTSUPP;
114} 133}
115 134
135static inline long clk_set_phase(struct clk *clk, int phase)
136{
137 return -ENOTSUPP;
138}
139
140static inline long clk_get_phase(struct clk *clk)
141{
142 return -ENOTSUPP;
143}
144
116#endif 145#endif
117 146
118/** 147/**
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
index de4268d4987a..c8e3b3d1eded 100644
--- a/include/linux/clk/at91_pmc.h
+++ b/include/linux/clk/at91_pmc.h
@@ -125,6 +125,7 @@ extern void __iomem *at91_pmc_base;
125#define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */ 125#define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */
126#define AT91_PMC_PLLADIV2_OFF (0 << 12) 126#define AT91_PMC_PLLADIV2_OFF (0 << 12)
127#define AT91_PMC_PLLADIV2_ON (1 << 12) 127#define AT91_PMC_PLLADIV2_ON (1 << 12)
128#define AT91_PMC_H32MXDIV BIT(24)
128 129
129#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */ 130#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */
130#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */ 131#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index e8d8a35034a5..f75acbf70e96 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -292,6 +292,7 @@ void omap2xxx_clkt_vps_init(void);
292void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index); 292void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index);
293void ti_dt_clocks_register(struct ti_dt_clk *oclks); 293void ti_dt_clocks_register(struct ti_dt_clk *oclks);
294void ti_dt_clk_init_provider(struct device_node *np, int index); 294void ti_dt_clk_init_provider(struct device_node *np, int index);
295void ti_dt_clk_init_retry_clks(void);
295void ti_dt_clockdomains_setup(void); 296void ti_dt_clockdomains_setup(void);
296int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw, 297int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
297 ti_of_clk_init_cb_t func); 298 ti_of_clk_init_cb_t func);
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 653f0e2b6ca9..abcafaa20b86 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -287,7 +287,7 @@ extern struct clocksource* clocksource_get_next(void);
287extern void clocksource_change_rating(struct clocksource *cs, int rating); 287extern void clocksource_change_rating(struct clocksource *cs, int rating);
288extern void clocksource_suspend(void); 288extern void clocksource_suspend(void);
289extern void clocksource_resume(void); 289extern void clocksource_resume(void);
290extern struct clocksource * __init __weak clocksource_default_clock(void); 290extern struct clocksource * __init clocksource_default_clock(void);
291extern void clocksource_mark_unstable(struct clocksource *cs); 291extern void clocksource_mark_unstable(struct clocksource *cs);
292 292
293extern u64 293extern u64
diff --git a/include/linux/cma.h b/include/linux/cma.h
index 371b93042520..a93438beb33c 100644
--- a/include/linux/cma.h
+++ b/include/linux/cma.h
@@ -18,10 +18,13 @@ struct cma;
18extern phys_addr_t cma_get_base(struct cma *cma); 18extern phys_addr_t cma_get_base(struct cma *cma);
19extern unsigned long cma_get_size(struct cma *cma); 19extern unsigned long cma_get_size(struct cma *cma);
20 20
21extern int __init cma_declare_contiguous(phys_addr_t size, 21extern int __init cma_declare_contiguous(phys_addr_t base,
22 phys_addr_t base, phys_addr_t limit, 22 phys_addr_t size, phys_addr_t limit,
23 phys_addr_t alignment, unsigned int order_per_bit, 23 phys_addr_t alignment, unsigned int order_per_bit,
24 bool fixed, struct cma **res_cma); 24 bool fixed, struct cma **res_cma);
25extern int cma_init_reserved_mem(phys_addr_t base,
26 phys_addr_t size, int order_per_bit,
27 struct cma **res_cma);
25extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align); 28extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align);
26extern bool cma_release(struct cma *cma, struct page *pages, int count); 29extern bool cma_release(struct cma *cma, struct page *pages, int count);
27#endif 30#endif
diff --git a/include/linux/com20020.h b/include/linux/com20020.h
index 5dcfb944b6ce..85898995b234 100644
--- a/include/linux/com20020.h
+++ b/include/linux/com20020.h
@@ -41,6 +41,35 @@ extern const struct net_device_ops com20020_netdev_ops;
41#define BUS_ALIGN 1 41#define BUS_ALIGN 1
42#endif 42#endif
43 43
44#define PLX_PCI_MAX_CARDS 2
45
46struct com20020_pci_channel_map {
47 u32 bar;
48 u32 offset;
49 u32 size; /* 0x00 - auto, e.g. length of entire bar */
50};
51
52struct com20020_pci_card_info {
53 const char *name;
54 int devcount;
55
56 struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS];
57
58 unsigned int flags;
59};
60
61struct com20020_priv {
62 struct com20020_pci_card_info *ci;
63 struct list_head list_dev;
64};
65
66struct com20020_dev {
67 struct list_head list;
68 struct net_device *dev;
69
70 struct com20020_priv *pci_priv;
71 int index;
72};
44 73
45#define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */ 74#define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */
46#define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */ 75#define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 01e3132820da..60bdf8dc02a3 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -2,14 +2,24 @@
2#define _LINUX_COMPACTION_H 2#define _LINUX_COMPACTION_H
3 3
4/* Return values for compact_zone() and try_to_compact_pages() */ 4/* Return values for compact_zone() and try_to_compact_pages() */
5/* compaction didn't start as it was deferred due to past failures */
6#define COMPACT_DEFERRED 0
5/* compaction didn't start as it was not possible or direct reclaim was more suitable */ 7/* compaction didn't start as it was not possible or direct reclaim was more suitable */
6#define COMPACT_SKIPPED 0 8#define COMPACT_SKIPPED 1
7/* compaction should continue to another pageblock */ 9/* compaction should continue to another pageblock */
8#define COMPACT_CONTINUE 1 10#define COMPACT_CONTINUE 2
9/* direct compaction partially compacted a zone and there are suitable pages */ 11/* direct compaction partially compacted a zone and there are suitable pages */
10#define COMPACT_PARTIAL 2 12#define COMPACT_PARTIAL 3
11/* The full zone was compacted */ 13/* The full zone was compacted */
12#define COMPACT_COMPLETE 3 14#define COMPACT_COMPLETE 4
15
16/* Used to signal whether compaction detected need_sched() or lock contention */
17/* No contention detected */
18#define COMPACT_CONTENDED_NONE 0
19/* Either need_sched() was true or fatal signal pending */
20#define COMPACT_CONTENDED_SCHED 1
21/* Zone lock or lru_lock was contended in async compaction */
22#define COMPACT_CONTENDED_LOCK 2
13 23
14#ifdef CONFIG_COMPACTION 24#ifdef CONFIG_COMPACTION
15extern int sysctl_compact_memory; 25extern int sysctl_compact_memory;
@@ -22,7 +32,8 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
22extern int fragmentation_index(struct zone *zone, unsigned int order); 32extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 33extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 34 int order, gfp_t gfp_mask, nodemask_t *mask,
25 enum migrate_mode mode, bool *contended); 35 enum migrate_mode mode, int *contended,
36 struct zone **candidate_zone);
26extern void compact_pgdat(pg_data_t *pgdat, int order); 37extern void compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat); 38extern void reset_isolation_suitable(pg_data_t *pgdat);
28extern unsigned long compaction_suitable(struct zone *zone, int order); 39extern unsigned long compaction_suitable(struct zone *zone, int order);
@@ -91,7 +102,8 @@ static inline bool compaction_restarting(struct zone *zone, int order)
91#else 102#else
92static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 103static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
93 int order, gfp_t gfp_mask, nodemask_t *nodemask, 104 int order, gfp_t gfp_mask, nodemask_t *nodemask,
94 enum migrate_mode mode, bool *contended) 105 enum migrate_mode mode, int *contended,
106 struct zone **candidate_zone)
95{ 107{
96 return COMPACT_CONTINUE; 108 return COMPACT_CONTINUE;
97} 109}
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 2507fd2a1eb4..d1a558239b1a 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -71,7 +71,6 @@
71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
72 * 72 *
73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. 73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
74 * Fixed in GCC 4.8.2 and later versions.
75 * 74 *
76 * (asm goto is automatically volatile - the naming reflects this.) 75 * (asm goto is automatically volatile - the naming reflects this.)
77 */ 76 */
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
new file mode 100644
index 000000000000..c8c565952548
--- /dev/null
+++ b/include/linux/compiler-gcc5.h
@@ -0,0 +1,65 @@
1#ifndef __LINUX_COMPILER_H
2#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
3#endif
4
5#define __used __attribute__((__used__))
6#define __must_check __attribute__((warn_unused_result))
7#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
8
9/* Mark functions as cold. gcc will assume any path leading to a call
10 to them will be unlikely. This means a lot of manual unlikely()s
11 are unnecessary now for any paths leading to the usual suspects
12 like BUG(), printk(), panic() etc. [but let's keep them for now for
13 older compilers]
14
15 Early snapshots of gcc 4.3 don't support this and we can't detect this
16 in the preprocessor, but we can live with this because they're unreleased.
17 Maketime probing would be overkill here.
18
19 gcc also has a __attribute__((__hot__)) to move hot functions into
20 a special section, but I don't see any sense in this right now in
21 the kernel context */
22#define __cold __attribute__((__cold__))
23
24#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
25
26#ifndef __CHECKER__
27# define __compiletime_warning(message) __attribute__((warning(message)))
28# define __compiletime_error(message) __attribute__((error(message)))
29#endif /* __CHECKER__ */
30
31/*
32 * Mark a position in code as unreachable. This can be used to
33 * suppress control flow warnings after asm blocks that transfer
34 * control elsewhere.
35 *
36 * Early snapshots of gcc 4.5 don't support this and we can't detect
37 * this in the preprocessor, but we can live with this because they're
38 * unreleased. Really, we need to have autoconf for the kernel.
39 */
40#define unreachable() __builtin_unreachable()
41
42/* Mark a function definition as prohibited from being cloned. */
43#define __noclone __attribute__((__noclone__))
44
45/*
46 * Tell the optimizer that something else uses this function or variable.
47 */
48#define __visible __attribute__((externally_visible))
49
50/*
51 * GCC 'asm goto' miscompiles certain code sequences:
52 *
53 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
54 *
55 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
56 *
57 * (asm goto is automatically volatile - the naming reflects this.)
58 */
59#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
60
61#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
62#define __HAVE_BUILTIN_BSWAP32__
63#define __HAVE_BUILTIN_BSWAP64__
64#define __HAVE_BUILTIN_BSWAP16__
65#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 95978ad7fcdd..b2d9a43012b2 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -213,6 +213,7 @@ extern struct bus_type cpu_subsys;
213extern void cpu_hotplug_begin(void); 213extern void cpu_hotplug_begin(void);
214extern void cpu_hotplug_done(void); 214extern void cpu_hotplug_done(void);
215extern void get_online_cpus(void); 215extern void get_online_cpus(void);
216extern bool try_get_online_cpus(void);
216extern void put_online_cpus(void); 217extern void put_online_cpus(void);
217extern void cpu_hotplug_disable(void); 218extern void cpu_hotplug_disable(void);
218extern void cpu_hotplug_enable(void); 219extern void cpu_hotplug_enable(void);
@@ -230,6 +231,7 @@ int cpu_down(unsigned int cpu);
230static inline void cpu_hotplug_begin(void) {} 231static inline void cpu_hotplug_begin(void) {}
231static inline void cpu_hotplug_done(void) {} 232static inline void cpu_hotplug_done(void) {}
232#define get_online_cpus() do { } while (0) 233#define get_online_cpus() do { } while (0)
234#define try_get_online_cpus() true
233#define put_online_cpus() do { } while (0) 235#define put_online_cpus() do { } while (0)
234#define cpu_hotplug_disable() do { } while (0) 236#define cpu_hotplug_disable() do { } while (0)
235#define cpu_hotplug_enable() do { } while (0) 237#define cpu_hotplug_enable() do { } while (0)
diff --git a/include/linux/cpufreq-dt.h b/include/linux/cpufreq-dt.h
new file mode 100644
index 000000000000..0414009e2c30
--- /dev/null
+++ b/include/linux/cpufreq-dt.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2014 Marvell
3 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __CPUFREQ_DT_H__
11#define __CPUFREQ_DT_H__
12
13struct cpufreq_dt_platform_data {
14 /*
15 * True when each CPU has its own clock to control its
16 * frequency, false when all CPUs are controlled by a single
17 * clock.
18 */
19 bool independent_clocks;
20};
21
22#endif /* __CPUFREQ_DT_H__ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 7d1955afa62c..503b085b7832 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -112,6 +112,9 @@ struct cpufreq_policy {
112 spinlock_t transition_lock; 112 spinlock_t transition_lock;
113 wait_queue_head_t transition_wait; 113 wait_queue_head_t transition_wait;
114 struct task_struct *transition_task; /* Task which is doing the transition */ 114 struct task_struct *transition_task; /* Task which is doing the transition */
115
116 /* For cpufreq driver's internal use */
117 void *driver_data;
115}; 118};
116 119
117/* Only for ACPI */ 120/* Only for ACPI */
@@ -216,6 +219,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
216struct cpufreq_driver { 219struct cpufreq_driver {
217 char name[CPUFREQ_NAME_LEN]; 220 char name[CPUFREQ_NAME_LEN];
218 u8 flags; 221 u8 flags;
222 void *driver_data;
219 223
220 /* needed by all drivers */ 224 /* needed by all drivers */
221 int (*init) (struct cpufreq_policy *policy); 225 int (*init) (struct cpufreq_policy *policy);
@@ -309,6 +313,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data);
309int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 313int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
310 314
311const char *cpufreq_get_current_driver(void); 315const char *cpufreq_get_current_driver(void);
316void *cpufreq_get_driver_data(void);
312 317
313static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, 318static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
314 unsigned int min, unsigned int max) 319 unsigned int min, unsigned int max)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 2997af6d2ccd..0a9a6da21e74 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -666,10 +666,19 @@ static inline size_t cpumask_size(void)
666 * 666 *
667 * This code makes NR_CPUS length memcopy and brings to a memory corruption. 667 * This code makes NR_CPUS length memcopy and brings to a memory corruption.
668 * cpumask_copy() provide safe copy functionality. 668 * cpumask_copy() provide safe copy functionality.
669 *
670 * Note that there is another evil here: If you define a cpumask_var_t
671 * as a percpu variable then the way to obtain the address of the cpumask
672 * structure differently influences what this_cpu_* operation needs to be
673 * used. Please use this_cpu_cpumask_var_t in those cases. The direct use
674 * of this_cpu_ptr() or this_cpu_read() will lead to failures when the
675 * other type of cpumask_var_t implementation is configured.
669 */ 676 */
670#ifdef CONFIG_CPUMASK_OFFSTACK 677#ifdef CONFIG_CPUMASK_OFFSTACK
671typedef struct cpumask *cpumask_var_t; 678typedef struct cpumask *cpumask_var_t;
672 679
680#define this_cpu_cpumask_var_ptr(x) this_cpu_read(x)
681
673bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); 682bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
674bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); 683bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
675bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); 684bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
@@ -681,6 +690,8 @@ void free_bootmem_cpumask_var(cpumask_var_t mask);
681#else 690#else
682typedef struct cpumask cpumask_var_t[1]; 691typedef struct cpumask cpumask_var_t[1];
683 692
693#define this_cpu_cpumask_var_ptr(x) this_cpu_ptr(x)
694
684static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) 695static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
685{ 696{
686 return true; 697 return true;
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 6e39c9bb0dae..2f073db7392e 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -86,7 +86,8 @@ extern void __cpuset_memory_pressure_bump(void);
86 86
87extern void cpuset_task_status_allowed(struct seq_file *m, 87extern void cpuset_task_status_allowed(struct seq_file *m,
88 struct task_struct *task); 88 struct task_struct *task);
89extern int proc_cpuset_show(struct seq_file *, void *); 89extern int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
90 struct pid *pid, struct task_struct *tsk);
90 91
91extern int cpuset_mem_spread_node(void); 92extern int cpuset_mem_spread_node(void);
92extern int cpuset_slab_spread_node(void); 93extern int cpuset_slab_spread_node(void);
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 72ab536ad3de..3849fce7ecfe 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -14,14 +14,13 @@
14extern unsigned long long elfcorehdr_addr; 14extern unsigned long long elfcorehdr_addr;
15extern unsigned long long elfcorehdr_size; 15extern unsigned long long elfcorehdr_size;
16 16
17extern int __weak elfcorehdr_alloc(unsigned long long *addr, 17extern int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size);
18 unsigned long long *size); 18extern void elfcorehdr_free(unsigned long long addr);
19extern void __weak elfcorehdr_free(unsigned long long addr); 19extern ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos);
20extern ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos); 20extern ssize_t elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos);
21extern ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos); 21extern int remap_oldmem_pfn_range(struct vm_area_struct *vma,
22extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma, 22 unsigned long from, unsigned long pfn,
23 unsigned long from, unsigned long pfn, 23 unsigned long size, pgprot_t prot);
24 unsigned long size, pgprot_t prot);
25 24
26extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 25extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
27 unsigned long, int); 26 unsigned long, int);
diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
index b3cb71f0d3b0..cf53d0773ce3 100644
--- a/include/linux/crc-t10dif.h
+++ b/include/linux/crc-t10dif.h
@@ -6,7 +6,8 @@
6#define CRC_T10DIF_DIGEST_SIZE 2 6#define CRC_T10DIF_DIGEST_SIZE 2
7#define CRC_T10DIF_BLOCK_SIZE 1 7#define CRC_T10DIF_BLOCK_SIZE 1
8 8
9__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len); 9extern __u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer,
10__u16 crc_t10dif(unsigned char const *, size_t); 10 size_t len);
11extern __u16 crc_t10dif(unsigned char const *, size_t);
11 12
12#endif 13#endif
diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h
deleted file mode 100644
index 362bf19d6cf1..000000000000
--- a/include/linux/cycx_x25.h
+++ /dev/null
@@ -1,125 +0,0 @@
1#ifndef _CYCX_X25_H
2#define _CYCX_X25_H
3/*
4* cycx_x25.h Cyclom X.25 firmware API definitions.
5*
6* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7*
8* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
9*
10* Based on sdla_x25.h by Gene Kozin <74604.152@compuserve.com>
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* as published by the Free Software Foundation; either version
15* 2 of the License, or (at your option) any later version.
16* ============================================================================
17* 2000/04/02 acme dprintk and cycx_debug
18* 1999/01/03 acme judicious use of data types
19* 1999/01/02 acme #define X25_ACK_N3 0x4411
20* 1998/12/28 acme cleanup: lot'o'things removed
21* commands listed,
22* TX25Cmd & TX25Config structs
23* typedef'ed
24*/
25#ifndef PACKED
26#define PACKED __attribute__((packed))
27#endif
28
29/* X.25 shared memory layout. */
30#define X25_MBOX_OFFS 0x300 /* general mailbox block */
31#define X25_RXMBOX_OFFS 0x340 /* receive mailbox */
32
33/* Debug */
34#define dprintk(level, format, a...) if (cycx_debug >= level) printk(format, ##a)
35
36extern unsigned int cycx_debug;
37
38/* Data Structures */
39/* X.25 Command Block. */
40struct cycx_x25_cmd {
41 u16 command;
42 u16 link; /* values: 0 or 1 */
43 u16 len; /* values: 0 thru 0x205 (517) */
44 u32 buf;
45} PACKED;
46
47/* Defines for the 'command' field. */
48#define X25_CONNECT_REQUEST 0x4401
49#define X25_CONNECT_RESPONSE 0x4402
50#define X25_DISCONNECT_REQUEST 0x4403
51#define X25_DISCONNECT_RESPONSE 0x4404
52#define X25_DATA_REQUEST 0x4405
53#define X25_ACK_TO_VC 0x4406
54#define X25_INTERRUPT_RESPONSE 0x4407
55#define X25_CONFIG 0x4408
56#define X25_CONNECT_INDICATION 0x4409
57#define X25_CONNECT_CONFIRM 0x440A
58#define X25_DISCONNECT_INDICATION 0x440B
59#define X25_DISCONNECT_CONFIRM 0x440C
60#define X25_DATA_INDICATION 0x440E
61#define X25_INTERRUPT_INDICATION 0x440F
62#define X25_ACK_FROM_VC 0x4410
63#define X25_ACK_N3 0x4411
64#define X25_CONNECT_COLLISION 0x4413
65#define X25_N3WIN 0x4414
66#define X25_LINE_ON 0x4415
67#define X25_LINE_OFF 0x4416
68#define X25_RESET_REQUEST 0x4417
69#define X25_LOG 0x4500
70#define X25_STATISTIC 0x4600
71#define X25_TRACE 0x4700
72#define X25_N2TRACEXC 0x4702
73#define X25_N3TRACEXC 0x4703
74
75/**
76 * struct cycx_x25_config - cyclom2x x25 firmware configuration
77 * @link - link number
78 * @speed - line speed
79 * @clock - internal/external
80 * @n2 - # of level 2 retransm.(values: 1 thru FF)
81 * @n2win - level 2 window (values: 1 thru 7)
82 * @n3win - level 3 window (values: 1 thru 7)
83 * @nvc - # of logical channels (values: 1 thru 64)
84 * @pktlen - level 3 packet length - log base 2 of size
85 * @locaddr - my address
86 * @remaddr - remote address
87 * @t1 - time, in seconds
88 * @t2 - time, in seconds
89 * @t21 - time, in seconds
90 * @npvc - # of permanent virt. circuits (1 thru nvc)
91 * @t23 - time, in seconds
92 * @flags - see dosx25.doc, in portuguese, for details
93 */
94struct cycx_x25_config {
95 u8 link;
96 u8 speed;
97 u8 clock;
98 u8 n2;
99 u8 n2win;
100 u8 n3win;
101 u8 nvc;
102 u8 pktlen;
103 u8 locaddr;
104 u8 remaddr;
105 u16 t1;
106 u16 t2;
107 u8 t21;
108 u8 npvc;
109 u8 t23;
110 u8 flags;
111} PACKED;
112
113struct cycx_x25_stats {
114 u16 rx_crc_errors;
115 u16 rx_over_errors;
116 u16 n2_tx_frames;
117 u16 n2_rx_frames;
118 u16 tx_timeouts;
119 u16 rx_timeouts;
120 u16 n3_tx_packets;
121 u16 n3_rx_packets;
122 u16 tx_aborts;
123 u16 rx_aborts;
124} PACKED;
125#endif /* _CYCX_X25_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 75a227cc7ce2..b2a2a08523bf 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -11,7 +11,6 @@
11#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
12#include <linux/lockref.h> 12#include <linux/lockref.h>
13 13
14struct nameidata;
15struct path; 14struct path;
16struct vfsmount; 15struct vfsmount;
17 16
@@ -226,11 +225,6 @@ struct dentry_operations {
226 225
227extern seqlock_t rename_lock; 226extern seqlock_t rename_lock;
228 227
229static inline int dname_external(const struct dentry *dentry)
230{
231 return dentry->d_name.name != dentry->d_iname;
232}
233
234/* 228/*
235 * These are the low-level FS interfaces to the dcache.. 229 * These are the low-level FS interfaces to the dcache..
236 */ 230 */
@@ -254,7 +248,7 @@ extern struct dentry * d_obtain_root(struct inode *);
254extern void shrink_dcache_sb(struct super_block *); 248extern void shrink_dcache_sb(struct super_block *);
255extern void shrink_dcache_parent(struct dentry *); 249extern void shrink_dcache_parent(struct dentry *);
256extern void shrink_dcache_for_umount(struct super_block *); 250extern void shrink_dcache_for_umount(struct super_block *);
257extern int d_invalidate(struct dentry *); 251extern void d_invalidate(struct dentry *);
258 252
259/* only used at mount-time */ 253/* only used at mount-time */
260extern struct dentry * d_make_root(struct inode *); 254extern struct dentry * d_make_root(struct inode *);
@@ -269,7 +263,6 @@ extern void d_prune_aliases(struct inode *);
269 263
270/* test whether we have any submounts in a subdir tree */ 264/* test whether we have any submounts in a subdir tree */
271extern int have_submounts(struct dentry *); 265extern int have_submounts(struct dentry *);
272extern int check_submounts_and_drop(struct dentry *);
273 266
274/* 267/*
275 * This adds the entry to the hash queues. 268 * This adds the entry to the hash queues.
diff --git a/include/linux/devcoredump.h b/include/linux/devcoredump.h
new file mode 100644
index 000000000000..c0a360e99f64
--- /dev/null
+++ b/include/linux/devcoredump.h
@@ -0,0 +1,35 @@
1#ifndef __DEVCOREDUMP_H
2#define __DEVCOREDUMP_H
3
4#include <linux/device.h>
5#include <linux/module.h>
6#include <linux/vmalloc.h>
7
8#ifdef CONFIG_DEV_COREDUMP
9void dev_coredumpv(struct device *dev, const void *data, size_t datalen,
10 gfp_t gfp);
11
12void dev_coredumpm(struct device *dev, struct module *owner,
13 const void *data, size_t datalen, gfp_t gfp,
14 ssize_t (*read)(char *buffer, loff_t offset, size_t count,
15 const void *data, size_t datalen),
16 void (*free)(const void *data));
17#else
18static inline void dev_coredumpv(struct device *dev, const void *data,
19 size_t datalen, gfp_t gfp)
20{
21 vfree(data);
22}
23
24static inline void
25dev_coredumpm(struct device *dev, struct module *owner,
26 const void *data, size_t datalen, gfp_t gfp,
27 ssize_t (*read)(char *buffer, loff_t offset, size_t count,
28 const void *data, size_t datalen),
29 void (*free)(const void *data))
30{
31 free(data);
32}
33#endif /* CONFIG_DEV_COREDUMP */
34
35#endif /* __DEVCOREDUMP_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index 43d183aeb25b..ce1f21608b16 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -181,13 +181,14 @@ extern int bus_unregister_notifier(struct bus_type *bus,
181 * with the device lock held in the core, so be careful. 181 * with the device lock held in the core, so be careful.
182 */ 182 */
183#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 183#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
184#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ 184#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device to be removed */
185#define BUS_NOTIFY_BIND_DRIVER 0x00000003 /* driver about to be 185#define BUS_NOTIFY_REMOVED_DEVICE 0x00000003 /* device removed */
186#define BUS_NOTIFY_BIND_DRIVER 0x00000004 /* driver about to be
186 bound */ 187 bound */
187#define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */ 188#define BUS_NOTIFY_BOUND_DRIVER 0x00000005 /* driver bound to device */
188#define BUS_NOTIFY_UNBIND_DRIVER 0x00000005 /* driver about to be 189#define BUS_NOTIFY_UNBIND_DRIVER 0x00000006 /* driver about to be
189 unbound */ 190 unbound */
190#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound 191#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound
191 from the device */ 192 from the device */
192 193
193extern struct kset *bus_get_kset(struct bus_type *bus); 194extern struct kset *bus_get_kset(struct bus_type *bus);
@@ -607,8 +608,8 @@ extern int devres_release_group(struct device *dev, void *id);
607extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); 608extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
608extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, 609extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt,
609 va_list ap); 610 va_list ap);
610extern char *devm_kasprintf(struct device *dev, gfp_t gfp, 611extern __printf(3, 4)
611 const char *fmt, ...); 612char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...);
612static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 613static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
613{ 614{
614 return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 615 return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 931b70986272..d5d388160f42 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -263,6 +263,32 @@ struct dma_attrs;
263#define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ 263#define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
264 dma_unmap_sg(dev, sgl, nents, dir) 264 dma_unmap_sg(dev, sgl, nents, dir)
265 265
266#else
267static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
268 dma_addr_t *dma_addr, gfp_t gfp)
269{
270 DEFINE_DMA_ATTRS(attrs);
271 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
272 return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
273}
274
275static inline void dma_free_writecombine(struct device *dev, size_t size,
276 void *cpu_addr, dma_addr_t dma_addr)
277{
278 DEFINE_DMA_ATTRS(attrs);
279 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
280 return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
281}
282
283static inline int dma_mmap_writecombine(struct device *dev,
284 struct vm_area_struct *vma,
285 void *cpu_addr, dma_addr_t dma_addr,
286 size_t size)
287{
288 DEFINE_DMA_ATTRS(attrs);
289 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
290 return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
291}
266#endif /* CONFIG_HAVE_DMA_ATTRS */ 292#endif /* CONFIG_HAVE_DMA_ATTRS */
267 293
268#ifdef CONFIG_NEED_DMA_MAP_STATE 294#ifdef CONFIG_NEED_DMA_MAP_STATE
diff --git a/include/linux/dma/dw.h b/include/linux/dma/dw.h
new file mode 100644
index 000000000000..71456442ebe3
--- /dev/null
+++ b/include/linux/dma/dw.h
@@ -0,0 +1,64 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
6 * Copyright (C) 2014 Intel Corporation
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#ifndef _DMA_DW_H
13#define _DMA_DW_H
14
15#include <linux/clk.h>
16#include <linux/device.h>
17#include <linux/dmaengine.h>
18
19#include <linux/platform_data/dma-dw.h>
20
21struct dw_dma;
22
23/**
24 * struct dw_dma_chip - representation of DesignWare DMA controller hardware
25 * @dev: struct device of the DMA controller
26 * @irq: irq line
27 * @regs: memory mapped I/O space
28 * @clk: hclk clock
29 * @dw: struct dw_dma that is filed by dw_dma_probe()
30 */
31struct dw_dma_chip {
32 struct device *dev;
33 int irq;
34 void __iomem *regs;
35 struct clk *clk;
36 struct dw_dma *dw;
37};
38
39/* Export to the platform drivers */
40int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata);
41int dw_dma_remove(struct dw_dma_chip *chip);
42
43/* DMA API extensions */
44struct dw_desc;
45
46struct dw_cyclic_desc {
47 struct dw_desc **desc;
48 unsigned long periods;
49 void (*period_callback)(void *param);
50 void *period_callback_param;
51};
52
53struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
54 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
55 enum dma_transfer_direction direction);
56void dw_dma_cyclic_free(struct dma_chan *chan);
57int dw_dma_cyclic_start(struct dma_chan *chan);
58void dw_dma_cyclic_stop(struct dma_chan *chan);
59
60dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
61
62dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
63
64#endif /* _DMA_DW_H */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 212c5b9ac106..653a1fd07ae8 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -199,15 +199,12 @@ enum dma_ctrl_flags {
199 * configuration data in statically from the platform). An additional 199 * configuration data in statically from the platform). An additional
200 * argument of struct dma_slave_config must be passed in with this 200 * argument of struct dma_slave_config must be passed in with this
201 * command. 201 * command.
202 * @FSLDMA_EXTERNAL_START: this command will put the Freescale DMA controller
203 * into external start mode.
204 */ 202 */
205enum dma_ctrl_cmd { 203enum dma_ctrl_cmd {
206 DMA_TERMINATE_ALL, 204 DMA_TERMINATE_ALL,
207 DMA_PAUSE, 205 DMA_PAUSE,
208 DMA_RESUME, 206 DMA_RESUME,
209 DMA_SLAVE_CONFIG, 207 DMA_SLAVE_CONFIG,
210 FSLDMA_EXTERNAL_START,
211}; 208};
212 209
213/** 210/**
@@ -307,7 +304,9 @@ enum dma_slave_buswidth {
307 * struct dma_slave_config - dma slave channel runtime config 304 * struct dma_slave_config - dma slave channel runtime config
308 * @direction: whether the data shall go in or out on this slave 305 * @direction: whether the data shall go in or out on this slave
309 * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are 306 * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are
310 * legal values. 307 * legal values. DEPRECATED, drivers should use the direction argument
308 * to the device_prep_slave_sg and device_prep_dma_cyclic functions or
309 * the dir field in the dma_interleaved_template structure.
311 * @src_addr: this is the physical address where DMA slave data 310 * @src_addr: this is the physical address where DMA slave data
312 * should be read (RX), if the source is memory this argument is 311 * should be read (RX), if the source is memory this argument is
313 * ignored. 312 * ignored.
@@ -755,6 +754,16 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
755 return chan->device->device_prep_interleaved_dma(chan, xt, flags); 754 return chan->device->device_prep_interleaved_dma(chan, xt, flags);
756} 755}
757 756
757static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_sg(
758 struct dma_chan *chan,
759 struct scatterlist *dst_sg, unsigned int dst_nents,
760 struct scatterlist *src_sg, unsigned int src_nents,
761 unsigned long flags)
762{
763 return chan->device->device_prep_dma_sg(chan, dst_sg, dst_nents,
764 src_sg, src_nents, flags);
765}
766
758static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) 767static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
759{ 768{
760 if (!chan || !caps) 769 if (!chan || !caps)
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 1deece46a0ca..593fff99e6bf 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -56,13 +56,19 @@ struct dmar_drhd_unit {
56 struct intel_iommu *iommu; 56 struct intel_iommu *iommu;
57}; 57};
58 58
59struct dmar_pci_path {
60 u8 bus;
61 u8 device;
62 u8 function;
63};
64
59struct dmar_pci_notify_info { 65struct dmar_pci_notify_info {
60 struct pci_dev *dev; 66 struct pci_dev *dev;
61 unsigned long event; 67 unsigned long event;
62 int bus; 68 int bus;
63 u16 seg; 69 u16 seg;
64 u16 level; 70 u16 level;
65 struct acpi_dmar_pci_path path[]; 71 struct dmar_pci_path path[];
66} __attribute__((packed)); 72} __attribute__((packed));
67 73
68extern struct rw_semaphore dmar_global_lock; 74extern struct rw_semaphore dmar_global_lock;
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
deleted file mode 100644
index 68b4024184de..000000000000
--- a/include/linux/dw_dmac.h
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
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 version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef DW_DMAC_H
12#define DW_DMAC_H
13
14#include <linux/dmaengine.h>
15
16/**
17 * struct dw_dma_slave - Controller-specific information about a slave
18 *
19 * @dma_dev: required DMA master device. Depricated.
20 * @bus_id: name of this device channel, not just a device name since
21 * devices may have more than one channel e.g. "foo_tx"
22 * @cfg_hi: Platform-specific initializer for the CFG_HI register
23 * @cfg_lo: Platform-specific initializer for the CFG_LO register
24 * @src_master: src master for transfers on allocated channel.
25 * @dst_master: dest master for transfers on allocated channel.
26 */
27struct dw_dma_slave {
28 struct device *dma_dev;
29 u32 cfg_hi;
30 u32 cfg_lo;
31 u8 src_master;
32 u8 dst_master;
33};
34
35/**
36 * struct dw_dma_platform_data - Controller configuration parameters
37 * @nr_channels: Number of channels supported by hardware (max 8)
38 * @is_private: The device channels should be marked as private and not for
39 * by the general purpose DMA channel allocator.
40 * @chan_allocation_order: Allocate channels starting from 0 or 7
41 * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0.
42 * @block_size: Maximum block size supported by the controller
43 * @nr_masters: Number of AHB masters supported by the controller
44 * @data_width: Maximum data width supported by hardware per AHB master
45 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
46 */
47struct dw_dma_platform_data {
48 unsigned int nr_channels;
49 bool is_private;
50#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
51#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
52 unsigned char chan_allocation_order;
53#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
54#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
55 unsigned char chan_priority;
56 unsigned short block_size;
57 unsigned char nr_masters;
58 unsigned char data_width[4];
59};
60
61/* bursts size */
62enum dw_dma_msize {
63 DW_DMA_MSIZE_1,
64 DW_DMA_MSIZE_4,
65 DW_DMA_MSIZE_8,
66 DW_DMA_MSIZE_16,
67 DW_DMA_MSIZE_32,
68 DW_DMA_MSIZE_64,
69 DW_DMA_MSIZE_128,
70 DW_DMA_MSIZE_256,
71};
72
73/* Platform-configurable bits in CFG_HI */
74#define DWC_CFGH_FCMODE (1 << 0)
75#define DWC_CFGH_FIFO_MODE (1 << 1)
76#define DWC_CFGH_PROTCTL(x) ((x) << 2)
77#define DWC_CFGH_SRC_PER(x) ((x) << 7)
78#define DWC_CFGH_DST_PER(x) ((x) << 11)
79
80/* Platform-configurable bits in CFG_LO */
81#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */
82#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12)
83#define DWC_CFGL_LOCK_CH_XACT (2 << 12)
84#define DWC_CFGL_LOCK_BUS_XFER (0 << 14) /* scope of LOCK_BUS */
85#define DWC_CFGL_LOCK_BUS_BLOCK (1 << 14)
86#define DWC_CFGL_LOCK_BUS_XACT (2 << 14)
87#define DWC_CFGL_LOCK_CH (1 << 15) /* channel lockout */
88#define DWC_CFGL_LOCK_BUS (1 << 16) /* busmaster lockout */
89#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */
90#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */
91
92/* DMA API extensions */
93struct dw_cyclic_desc {
94 struct dw_desc **desc;
95 unsigned long periods;
96 void (*period_callback)(void *param);
97 void *period_callback_param;
98};
99
100struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
101 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
102 enum dma_transfer_direction direction);
103void dw_dma_cyclic_free(struct dma_chan *chan);
104int dw_dma_cyclic_start(struct dma_chan *chan);
105void dw_dma_cyclic_stop(struct dma_chan *chan);
106
107dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
108
109dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
110
111#endif /* DW_DMAC_H */
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 2fe93b26b42f..4f1bbc68cd1b 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -42,7 +42,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
42#if defined(CONFIG_DYNAMIC_DEBUG) 42#if defined(CONFIG_DYNAMIC_DEBUG)
43extern int ddebug_remove_module(const char *mod_name); 43extern int ddebug_remove_module(const char *mod_name);
44extern __printf(2, 3) 44extern __printf(2, 3)
45int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); 45void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
46 46
47extern int ddebug_dyndbg_module_param_cb(char *param, char *val, 47extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
48 const char *modname); 48 const char *modname);
@@ -50,15 +50,15 @@ extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
50struct device; 50struct device;
51 51
52extern __printf(3, 4) 52extern __printf(3, 4)
53int __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev, 53void __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev,
54 const char *fmt, ...); 54 const char *fmt, ...);
55 55
56struct net_device; 56struct net_device;
57 57
58extern __printf(3, 4) 58extern __printf(3, 4)
59int __dynamic_netdev_dbg(struct _ddebug *descriptor, 59void __dynamic_netdev_dbg(struct _ddebug *descriptor,
60 const struct net_device *dev, 60 const struct net_device *dev,
61 const char *fmt, ...); 61 const char *fmt, ...);
62 62
63#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ 63#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
64 static struct _ddebug __aligned(8) \ 64 static struct _ddebug __aligned(8) \
diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
index 5621547d631b..a4be70398ce1 100644
--- a/include/linux/dynamic_queue_limits.h
+++ b/include/linux/dynamic_queue_limits.h
@@ -73,14 +73,22 @@ static inline void dql_queued(struct dql *dql, unsigned int count)
73{ 73{
74 BUG_ON(count > DQL_MAX_OBJECT); 74 BUG_ON(count > DQL_MAX_OBJECT);
75 75
76 dql->num_queued += count;
77 dql->last_obj_cnt = count; 76 dql->last_obj_cnt = count;
77
78 /* We want to force a write first, so that cpu do not attempt
79 * to get cache line containing last_obj_cnt, num_queued, adj_limit
80 * in Shared state, but directly does a Request For Ownership
81 * It is only a hint, we use barrier() only.
82 */
83 barrier();
84
85 dql->num_queued += count;
78} 86}
79 87
80/* Returns how many objects can be queued, < 0 indicates over limit. */ 88/* Returns how many objects can be queued, < 0 indicates over limit. */
81static inline int dql_avail(const struct dql *dql) 89static inline int dql_avail(const struct dql *dql)
82{ 90{
83 return dql->adj_limit - dql->num_queued; 91 return ACCESS_ONCE(dql->adj_limit) - ACCESS_ONCE(dql->num_queued);
84} 92}
85 93
86/* Record number of completed objects and recalculate the limit. */ 94/* Record number of completed objects and recalculate the limit. */
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 45cb4ffdea62..0949f9c7e872 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -92,6 +92,7 @@ typedef struct {
92#define EFI_MEMORY_WC ((u64)0x0000000000000002ULL) /* write-coalescing */ 92#define EFI_MEMORY_WC ((u64)0x0000000000000002ULL) /* write-coalescing */
93#define EFI_MEMORY_WT ((u64)0x0000000000000004ULL) /* write-through */ 93#define EFI_MEMORY_WT ((u64)0x0000000000000004ULL) /* write-through */
94#define EFI_MEMORY_WB ((u64)0x0000000000000008ULL) /* write-back */ 94#define EFI_MEMORY_WB ((u64)0x0000000000000008ULL) /* write-back */
95#define EFI_MEMORY_UCE ((u64)0x0000000000000010ULL) /* uncached, exported */
95#define EFI_MEMORY_WP ((u64)0x0000000000001000ULL) /* write-protect */ 96#define EFI_MEMORY_WP ((u64)0x0000000000001000ULL) /* write-protect */
96#define EFI_MEMORY_RP ((u64)0x0000000000002000ULL) /* read-protect */ 97#define EFI_MEMORY_RP ((u64)0x0000000000002000ULL) /* read-protect */
97#define EFI_MEMORY_XP ((u64)0x0000000000004000ULL) /* execute-protect */ 98#define EFI_MEMORY_XP ((u64)0x0000000000004000ULL) /* execute-protect */
@@ -502,6 +503,10 @@ typedef efi_status_t efi_get_next_variable_t (unsigned long *name_size, efi_char
502typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor, 503typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor,
503 u32 attr, unsigned long data_size, 504 u32 attr, unsigned long data_size,
504 void *data); 505 void *data);
506typedef efi_status_t
507efi_set_variable_nonblocking_t(efi_char16_t *name, efi_guid_t *vendor,
508 u32 attr, unsigned long data_size, void *data);
509
505typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count); 510typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count);
506typedef void efi_reset_system_t (int reset_type, efi_status_t status, 511typedef void efi_reset_system_t (int reset_type, efi_status_t status,
507 unsigned long data_size, efi_char16_t *data); 512 unsigned long data_size, efi_char16_t *data);
@@ -821,6 +826,7 @@ extern struct efi {
821 efi_get_variable_t *get_variable; 826 efi_get_variable_t *get_variable;
822 efi_get_next_variable_t *get_next_variable; 827 efi_get_next_variable_t *get_next_variable;
823 efi_set_variable_t *set_variable; 828 efi_set_variable_t *set_variable;
829 efi_set_variable_nonblocking_t *set_variable_nonblocking;
824 efi_query_variable_info_t *query_variable_info; 830 efi_query_variable_info_t *query_variable_info;
825 efi_update_capsule_t *update_capsule; 831 efi_update_capsule_t *update_capsule;
826 efi_query_capsule_caps_t *query_capsule_caps; 832 efi_query_capsule_caps_t *query_capsule_caps;
@@ -886,6 +892,13 @@ extern bool efi_poweroff_required(void);
886 (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \ 892 (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \
887 (md) = (void *)(md) + (m)->desc_size) 893 (md) = (void *)(md) + (m)->desc_size)
888 894
895/*
896 * Format an EFI memory descriptor's type and attributes to a user-provided
897 * character buffer, as per snprintf(), and return the buffer.
898 */
899char * __init efi_md_typeattr_format(char *buf, size_t size,
900 const efi_memory_desc_t *md);
901
889/** 902/**
890 * efi_range_is_wc - check the WC bit on an address range 903 * efi_range_is_wc - check the WC bit on an address range
891 * @start: starting kvirt address 904 * @start: starting kvirt address
@@ -1034,6 +1047,7 @@ struct efivar_operations {
1034 efi_get_variable_t *get_variable; 1047 efi_get_variable_t *get_variable;
1035 efi_get_next_variable_t *get_next_variable; 1048 efi_get_next_variable_t *get_next_variable;
1036 efi_set_variable_t *set_variable; 1049 efi_set_variable_t *set_variable;
1050 efi_set_variable_nonblocking_t *set_variable_nonblocking;
1037 efi_query_variable_store_t *query_variable_store; 1051 efi_query_variable_store_t *query_variable_store;
1038}; 1052};
1039 1053
@@ -1227,4 +1241,7 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
1227 unsigned long *load_addr, 1241 unsigned long *load_addr,
1228 unsigned long *load_size); 1242 unsigned long *load_size);
1229 1243
1244efi_status_t efi_parse_options(char *cmdline);
1245
1246bool efi_runtime_disabled(void);
1230#endif /* _LINUX_EFI_H */ 1247#endif /* _LINUX_EFI_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 9c5529dc6d07..733980fce8e3 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -29,6 +29,7 @@
29#include <asm/bitsperlong.h> 29#include <asm/bitsperlong.h>
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32u32 eth_get_headlen(void *data, unsigned int max_len);
32__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 33__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
33extern const struct header_ops eth_header_ops; 34extern const struct header_ops eth_header_ops;
34 35
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index e658229fee39..c1a2d60dfb82 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -257,6 +257,10 @@ struct ethtool_ops {
257 struct ethtool_eeprom *, u8 *); 257 struct ethtool_eeprom *, u8 *);
258 int (*get_eee)(struct net_device *, struct ethtool_eee *); 258 int (*get_eee)(struct net_device *, struct ethtool_eee *);
259 int (*set_eee)(struct net_device *, struct ethtool_eee *); 259 int (*set_eee)(struct net_device *, struct ethtool_eee *);
260 int (*get_tunable)(struct net_device *,
261 const struct ethtool_tunable *, void *);
262 int (*set_tunable)(struct net_device *,
263 const struct ethtool_tunable *, const void *);
260 264
261 265
262}; 266};
diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 8900fdf511c6..0b17ad43fbfc 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -34,8 +34,10 @@
34 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW). 34 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
35 * @state_on: print_state is overriden with state_on if attached. 35 * @state_on: print_state is overriden with state_on if attached.
36 * If NULL, default method of extcon class is used. 36 * If NULL, default method of extcon class is used.
37 * @state_off: print_state is overriden with state_on if detached. 37 * @state_off: print_state is overriden with state_off if detached.
38 * If NUll, default method of extcon class is used. 38 * If NUll, default method of extcon class is used.
39 * @check_on_resume: Boolean describing whether to check the state of gpio
40 * while resuming from sleep.
39 * 41 *
40 * Note that in order for state_on or state_off to be valid, both state_on 42 * Note that in order for state_on or state_off to be valid, both state_on
41 * and state_off should be not NULL. If at least one of them is NULL, 43 * and state_off should be not NULL. If at least one of them is NULL,
diff --git a/include/linux/extcon/sm5502.h b/include/linux/extcon/sm5502.h
deleted file mode 100644
index 030526bf8d79..000000000000
--- a/include/linux/extcon/sm5502.h
+++ /dev/null
@@ -1,287 +0,0 @@
1/*
2 * sm5502.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_EXTCON_SM5502_H
18#define __LINUX_EXTCON_SM5502_H
19
20enum sm5502_types {
21 TYPE_SM5502,
22};
23
24/* SM5502 registers */
25enum sm5502_reg {
26 SM5502_REG_DEVICE_ID = 0x01,
27 SM5502_REG_CONTROL,
28 SM5502_REG_INT1,
29 SM5502_REG_INT2,
30 SM5502_REG_INTMASK1,
31 SM5502_REG_INTMASK2,
32 SM5502_REG_ADC,
33 SM5502_REG_TIMING_SET1,
34 SM5502_REG_TIMING_SET2,
35 SM5502_REG_DEV_TYPE1,
36 SM5502_REG_DEV_TYPE2,
37 SM5502_REG_BUTTON1,
38 SM5502_REG_BUTTON2,
39 SM5502_REG_CAR_KIT_STATUS,
40 SM5502_REG_RSVD1,
41 SM5502_REG_RSVD2,
42 SM5502_REG_RSVD3,
43 SM5502_REG_RSVD4,
44 SM5502_REG_MANUAL_SW1,
45 SM5502_REG_MANUAL_SW2,
46 SM5502_REG_DEV_TYPE3,
47 SM5502_REG_RSVD5,
48 SM5502_REG_RSVD6,
49 SM5502_REG_RSVD7,
50 SM5502_REG_RSVD8,
51 SM5502_REG_RSVD9,
52 SM5502_REG_RESET,
53 SM5502_REG_RSVD10,
54 SM5502_REG_RESERVED_ID1,
55 SM5502_REG_RSVD11,
56 SM5502_REG_RSVD12,
57 SM5502_REG_RESERVED_ID2,
58 SM5502_REG_RSVD13,
59 SM5502_REG_OCP,
60 SM5502_REG_RSVD14,
61 SM5502_REG_RSVD15,
62 SM5502_REG_RSVD16,
63 SM5502_REG_RSVD17,
64 SM5502_REG_RSVD18,
65 SM5502_REG_RSVD19,
66 SM5502_REG_RSVD20,
67 SM5502_REG_RSVD21,
68 SM5502_REG_RSVD22,
69 SM5502_REG_RSVD23,
70 SM5502_REG_RSVD24,
71 SM5502_REG_RSVD25,
72 SM5502_REG_RSVD26,
73 SM5502_REG_RSVD27,
74 SM5502_REG_RSVD28,
75 SM5502_REG_RSVD29,
76 SM5502_REG_RSVD30,
77 SM5502_REG_RSVD31,
78 SM5502_REG_RSVD32,
79 SM5502_REG_RSVD33,
80 SM5502_REG_RSVD34,
81 SM5502_REG_RSVD35,
82 SM5502_REG_RSVD36,
83 SM5502_REG_RESERVED_ID3,
84
85 SM5502_REG_END,
86};
87
88/* Define SM5502 MASK/SHIFT constant */
89#define SM5502_REG_DEVICE_ID_VENDOR_SHIFT 0
90#define SM5502_REG_DEVICE_ID_VERSION_SHIFT 3
91#define SM5502_REG_DEVICE_ID_VENDOR_MASK (0x3 << SM5502_REG_DEVICE_ID_VENDOR_SHIFT)
92#define SM5502_REG_DEVICE_ID_VERSION_MASK (0x1f << SM5502_REG_DEVICE_ID_VERSION_SHIFT)
93
94#define SM5502_REG_CONTROL_MASK_INT_SHIFT 0
95#define SM5502_REG_CONTROL_WAIT_SHIFT 1
96#define SM5502_REG_CONTROL_MANUAL_SW_SHIFT 2
97#define SM5502_REG_CONTROL_RAW_DATA_SHIFT 3
98#define SM5502_REG_CONTROL_SW_OPEN_SHIFT 4
99#define SM5502_REG_CONTROL_MASK_INT_MASK (0x1 << SM5502_REG_CONTROL_MASK_INT_SHIFT)
100#define SM5502_REG_CONTROL_WAIT_MASK (0x1 << SM5502_REG_CONTROL_WAIT_SHIFT)
101#define SM5502_REG_CONTROL_MANUAL_SW_MASK (0x1 << SM5502_REG_CONTROL_MANUAL_SW_SHIFT)
102#define SM5502_REG_CONTROL_RAW_DATA_MASK (0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT)
103#define SM5502_REG_CONTROL_SW_OPEN_MASK (0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT)
104
105#define SM5502_REG_INTM1_ATTACH_SHIFT 0
106#define SM5502_REG_INTM1_DETACH_SHIFT 1
107#define SM5502_REG_INTM1_KP_SHIFT 2
108#define SM5502_REG_INTM1_LKP_SHIFT 3
109#define SM5502_REG_INTM1_LKR_SHIFT 4
110#define SM5502_REG_INTM1_OVP_EVENT_SHIFT 5
111#define SM5502_REG_INTM1_OCP_EVENT_SHIFT 6
112#define SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT 7
113#define SM5502_REG_INTM1_ATTACH_MASK (0x1 << SM5502_REG_INTM1_ATTACH_SHIFT)
114#define SM5502_REG_INTM1_DETACH_MASK (0x1 << SM5502_REG_INTM1_DETACH_SHIFT)
115#define SM5502_REG_INTM1_KP_MASK (0x1 << SM5502_REG_INTM1_KP_SHIFT)
116#define SM5502_REG_INTM1_LKP_MASK (0x1 << SM5502_REG_INTM1_LKP_SHIFT)
117#define SM5502_REG_INTM1_LKR_MASK (0x1 << SM5502_REG_INTM1_LKR_SHIFT)
118#define SM5502_REG_INTM1_OVP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OVP_EVENT_SHIFT)
119#define SM5502_REG_INTM1_OCP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OCP_EVENT_SHIFT)
120#define SM5502_REG_INTM1_OVP_OCP_DIS_MASK (0x1 << SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT)
121
122#define SM5502_REG_INTM2_VBUS_DET_SHIFT 0
123#define SM5502_REG_INTM2_REV_ACCE_SHIFT 1
124#define SM5502_REG_INTM2_ADC_CHG_SHIFT 2
125#define SM5502_REG_INTM2_STUCK_KEY_SHIFT 3
126#define SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT 4
127#define SM5502_REG_INTM2_MHL_SHIFT 5
128#define SM5502_REG_INTM2_VBUS_DET_MASK (0x1 << SM5502_REG_INTM2_VBUS_DET_SHIFT)
129#define SM5502_REG_INTM2_REV_ACCE_MASK (0x1 << SM5502_REG_INTM2_REV_ACCE_SHIFT)
130#define SM5502_REG_INTM2_ADC_CHG_MASK (0x1 << SM5502_REG_INTM2_ADC_CHG_SHIFT)
131#define SM5502_REG_INTM2_STUCK_KEY_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_SHIFT)
132#define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT)
133#define SM5502_REG_INTM2_MHL_MASK (0x1 << SM5502_REG_INTM2_MHL_SHIFT)
134
135#define SM5502_REG_ADC_SHIFT 0
136#define SM5502_REG_ADC_MASK (0x1f << SM5502_REG_ADC_SHIFT)
137
138#define SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT 4
139#define SM5502_REG_TIMING_SET1_KEY_PRESS_MASK (0xf << SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT)
140#define TIMING_KEY_PRESS_100MS 0x0
141#define TIMING_KEY_PRESS_200MS 0x1
142#define TIMING_KEY_PRESS_300MS 0x2
143#define TIMING_KEY_PRESS_400MS 0x3
144#define TIMING_KEY_PRESS_500MS 0x4
145#define TIMING_KEY_PRESS_600MS 0x5
146#define TIMING_KEY_PRESS_700MS 0x6
147#define TIMING_KEY_PRESS_800MS 0x7
148#define TIMING_KEY_PRESS_900MS 0x8
149#define TIMING_KEY_PRESS_1000MS 0x9
150#define SM5502_REG_TIMING_SET1_ADC_DET_SHIFT 0
151#define SM5502_REG_TIMING_SET1_ADC_DET_MASK (0xf << SM5502_REG_TIMING_SET1_ADC_DET_SHIFT)
152#define TIMING_ADC_DET_50MS 0x0
153#define TIMING_ADC_DET_100MS 0x1
154#define TIMING_ADC_DET_150MS 0x2
155#define TIMING_ADC_DET_200MS 0x3
156#define TIMING_ADC_DET_300MS 0x4
157#define TIMING_ADC_DET_400MS 0x5
158#define TIMING_ADC_DET_500MS 0x6
159#define TIMING_ADC_DET_600MS 0x7
160#define TIMING_ADC_DET_700MS 0x8
161#define TIMING_ADC_DET_800MS 0x9
162#define TIMING_ADC_DET_900MS 0xA
163#define TIMING_ADC_DET_1000MS 0xB
164
165#define SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT 4
166#define SM5502_REG_TIMING_SET2_SW_WAIT_MASK (0xf << SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT)
167#define TIMING_SW_WAIT_10MS 0x0
168#define TIMING_SW_WAIT_30MS 0x1
169#define TIMING_SW_WAIT_50MS 0x2
170#define TIMING_SW_WAIT_70MS 0x3
171#define TIMING_SW_WAIT_90MS 0x4
172#define TIMING_SW_WAIT_110MS 0x5
173#define TIMING_SW_WAIT_130MS 0x6
174#define TIMING_SW_WAIT_150MS 0x7
175#define TIMING_SW_WAIT_170MS 0x8
176#define TIMING_SW_WAIT_190MS 0x9
177#define TIMING_SW_WAIT_210MS 0xA
178#define SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT 0
179#define SM5502_REG_TIMING_SET2_LONG_KEY_MASK (0xf << SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT)
180#define TIMING_LONG_KEY_300MS 0x0
181#define TIMING_LONG_KEY_400MS 0x1
182#define TIMING_LONG_KEY_500MS 0x2
183#define TIMING_LONG_KEY_600MS 0x3
184#define TIMING_LONG_KEY_700MS 0x4
185#define TIMING_LONG_KEY_800MS 0x5
186#define TIMING_LONG_KEY_900MS 0x6
187#define TIMING_LONG_KEY_1000MS 0x7
188#define TIMING_LONG_KEY_1100MS 0x8
189#define TIMING_LONG_KEY_1200MS 0x9
190#define TIMING_LONG_KEY_1300MS 0xA
191#define TIMING_LONG_KEY_1400MS 0xB
192#define TIMING_LONG_KEY_1500MS 0xC
193
194#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT 0
195#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT 1
196#define SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT 2
197#define SM5502_REG_DEV_TYPE1_UART_SHIFT 3
198#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT 4
199#define SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT 5
200#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT 6
201#define SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT 7
202#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT)
203#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1__MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT)
204#define SM5502_REG_DEV_TYPE1_USB_SDP_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT)
205#define SM5502_REG_DEV_TYPE1_UART_MASK (0x1 << SM5502_REG_DEV_TYPE1_UART_SHIFT)
206#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_MASK (0x1 << SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT)
207#define SM5502_REG_DEV_TYPE1_USB_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT)
208#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT)
209#define SM5502_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT)
210
211#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT 0
212#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT 1
213#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT 2
214#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT 3
215#define SM5502_REG_DEV_TYPE2_PPD_SHIFT 4
216#define SM5502_REG_DEV_TYPE2_TTY_SHIFT 5
217#define SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT 6
218#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT)
219#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT)
220#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT)
221#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT)
222#define SM5502_REG_DEV_TYPE2_PPD_MASK (0x1 << SM5502_REG_DEV_TYPE2_PPD_SHIFT)
223#define SM5502_REG_DEV_TYPE2_TTY_MASK (0x1 << SM5502_REG_DEV_TYPE2_TTY_SHIFT)
224#define SM5502_REG_DEV_TYPE2_AV_CABLE_MASK (0x1 << SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT)
225
226#define SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT 0
227#define SM5502_REG_MANUAL_SW1_DP_SHIFT 2
228#define SM5502_REG_MANUAL_SW1_DM_SHIFT 5
229#define SM5502_REG_MANUAL_SW1_VBUSIN_MASK (0x3 << SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT)
230#define SM5502_REG_MANUAL_SW1_DP_MASK (0x7 << SM5502_REG_MANUAL_SW1_DP_SHIFT)
231#define SM5502_REG_MANUAL_SW1_DM_MASK (0x7 << SM5502_REG_MANUAL_SW1_DM_SHIFT)
232#define VBUSIN_SWITCH_OPEN 0x0
233#define VBUSIN_SWITCH_VBUSOUT 0x1
234#define VBUSIN_SWITCH_MIC 0x2
235#define VBUSIN_SWITCH_VBUSOUT_WITH_USB 0x3
236#define DM_DP_CON_SWITCH_OPEN 0x0
237#define DM_DP_CON_SWITCH_USB 0x1
238#define DM_DP_CON_SWITCH_AUDIO 0x2
239#define DM_DP_CON_SWITCH_UART 0x3
240#define DM_DP_SWITCH_OPEN ((DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
241 | (DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
242#define DM_DP_SWITCH_USB ((DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
243 | (DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
244#define DM_DP_SWITCH_AUDIO ((DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
245 | (DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
246#define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
247 | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
248
249/* SM5502 Interrupts */
250enum sm5502_irq {
251 /* INT1 */
252 SM5502_IRQ_INT1_ATTACH,
253 SM5502_IRQ_INT1_DETACH,
254 SM5502_IRQ_INT1_KP,
255 SM5502_IRQ_INT1_LKP,
256 SM5502_IRQ_INT1_LKR,
257 SM5502_IRQ_INT1_OVP_EVENT,
258 SM5502_IRQ_INT1_OCP_EVENT,
259 SM5502_IRQ_INT1_OVP_OCP_DIS,
260
261 /* INT2 */
262 SM5502_IRQ_INT2_VBUS_DET,
263 SM5502_IRQ_INT2_REV_ACCE,
264 SM5502_IRQ_INT2_ADC_CHG,
265 SM5502_IRQ_INT2_STUCK_KEY,
266 SM5502_IRQ_INT2_STUCK_KEY_RCV,
267 SM5502_IRQ_INT2_MHL,
268
269 SM5502_IRQ_NUM,
270};
271
272#define SM5502_IRQ_INT1_ATTACH_MASK BIT(0)
273#define SM5502_IRQ_INT1_DETACH_MASK BIT(1)
274#define SM5502_IRQ_INT1_KP_MASK BIT(2)
275#define SM5502_IRQ_INT1_LKP_MASK BIT(3)
276#define SM5502_IRQ_INT1_LKR_MASK BIT(4)
277#define SM5502_IRQ_INT1_OVP_EVENT_MASK BIT(5)
278#define SM5502_IRQ_INT1_OCP_EVENT_MASK BIT(6)
279#define SM5502_IRQ_INT1_OVP_OCP_DIS_MASK BIT(7)
280#define SM5502_IRQ_INT2_VBUS_DET_MASK BIT(0)
281#define SM5502_IRQ_INT2_REV_ACCE_MASK BIT(1)
282#define SM5502_IRQ_INT2_ADC_CHG_MASK BIT(2)
283#define SM5502_IRQ_INT2_STUCK_KEY_MASK BIT(3)
284#define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK BIT(4)
285#define SM5502_IRQ_INT2_MHL_MASK BIT(5)
286
287#endif /* __LINUX_EXTCON_SM5502_H */
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 08ed2b0a96e6..860313a33a43 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -15,8 +15,9 @@
15#include <linux/types.h> 15#include <linux/types.h>
16 16
17#define F2FS_SUPER_OFFSET 1024 /* byte-size offset */ 17#define F2FS_SUPER_OFFSET 1024 /* byte-size offset */
18#define F2FS_LOG_SECTOR_SIZE 9 /* 9 bits for 512 byte */ 18#define F2FS_MIN_LOG_SECTOR_SIZE 9 /* 9 bits for 512 bytes */
19#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* 4KB: F2FS_BLKSIZE */ 19#define F2FS_MAX_LOG_SECTOR_SIZE 12 /* 12 bits for 4096 bytes */
20#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* log number for sector/blk */
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */ 21#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */ 22#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22#define F2FS_BLK_ALIGN(x) (((x) + F2FS_BLKSIZE - 1) / F2FS_BLKSIZE) 23#define F2FS_BLK_ALIGN(x) (((x) + F2FS_BLKSIZE - 1) / F2FS_BLKSIZE)
@@ -85,6 +86,7 @@ struct f2fs_super_block {
85/* 86/*
86 * For checkpoint 87 * For checkpoint
87 */ 88 */
89#define CP_FSCK_FLAG 0x00000010
88#define CP_ERROR_FLAG 0x00000008 90#define CP_ERROR_FLAG 0x00000008
89#define CP_COMPACT_SUM_FLAG 0x00000004 91#define CP_COMPACT_SUM_FLAG 0x00000004
90#define CP_ORPHAN_PRESENT_FLAG 0x00000002 92#define CP_ORPHAN_PRESENT_FLAG 0x00000002
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a5227ab8ccb1..ca95abd2bed1 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -4,58 +4,24 @@
4#ifndef __LINUX_FILTER_H__ 4#ifndef __LINUX_FILTER_H__
5#define __LINUX_FILTER_H__ 5#define __LINUX_FILTER_H__
6 6
7#include <stdarg.h>
8
7#include <linux/atomic.h> 9#include <linux/atomic.h>
8#include <linux/compat.h> 10#include <linux/compat.h>
9#include <linux/skbuff.h> 11#include <linux/skbuff.h>
12#include <linux/linkage.h>
13#include <linux/printk.h>
10#include <linux/workqueue.h> 14#include <linux/workqueue.h>
11#include <uapi/linux/filter.h>
12 15
13/* Internally used and optimized filter representation with extended 16#include <asm/cacheflush.h>
14 * instruction set based on top of classic BPF.
15 */
16 17
17/* instruction classes */ 18#include <uapi/linux/filter.h>
18#define BPF_ALU64 0x07 /* alu mode in double word width */ 19#include <uapi/linux/bpf.h>
19
20/* ld/ldx fields */
21#define BPF_DW 0x18 /* double word */
22#define BPF_XADD 0xc0 /* exclusive add */
23
24/* alu/jmp fields */
25#define BPF_MOV 0xb0 /* mov reg to reg */
26#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */
27
28/* change endianness of a register */
29#define BPF_END 0xd0 /* flags for endianness conversion: */
30#define BPF_TO_LE 0x00 /* convert to little-endian */
31#define BPF_TO_BE 0x08 /* convert to big-endian */
32#define BPF_FROM_LE BPF_TO_LE
33#define BPF_FROM_BE BPF_TO_BE
34
35#define BPF_JNE 0x50 /* jump != */
36#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */
37#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
38#define BPF_CALL 0x80 /* function call */
39#define BPF_EXIT 0x90 /* function return */
40
41/* Register numbers */
42enum {
43 BPF_REG_0 = 0,
44 BPF_REG_1,
45 BPF_REG_2,
46 BPF_REG_3,
47 BPF_REG_4,
48 BPF_REG_5,
49 BPF_REG_6,
50 BPF_REG_7,
51 BPF_REG_8,
52 BPF_REG_9,
53 BPF_REG_10,
54 __MAX_BPF_REG,
55};
56 20
57/* BPF has 10 general purpose 64-bit registers and stack frame. */ 21struct sk_buff;
58#define MAX_BPF_REG __MAX_BPF_REG 22struct sock;
23struct seccomp_data;
24struct bpf_prog_aux;
59 25
60/* ArgX, context and stack frame pointer register positions. Note, 26/* ArgX, context and stack frame pointer register positions. Note,
61 * Arg1, Arg2, Arg3, etc are used as argument mappings of function 27 * Arg1, Arg2, Arg3, etc are used as argument mappings of function
@@ -161,6 +127,30 @@ enum {
161 .off = 0, \ 127 .off = 0, \
162 .imm = IMM }) 128 .imm = IMM })
163 129
130/* BPF_LD_IMM64 macro encodes single 'load 64-bit immediate' insn */
131#define BPF_LD_IMM64(DST, IMM) \
132 BPF_LD_IMM64_RAW(DST, 0, IMM)
133
134#define BPF_LD_IMM64_RAW(DST, SRC, IMM) \
135 ((struct bpf_insn) { \
136 .code = BPF_LD | BPF_DW | BPF_IMM, \
137 .dst_reg = DST, \
138 .src_reg = SRC, \
139 .off = 0, \
140 .imm = (__u32) (IMM) }), \
141 ((struct bpf_insn) { \
142 .code = 0, /* zero is reserved opcode */ \
143 .dst_reg = 0, \
144 .src_reg = 0, \
145 .off = 0, \
146 .imm = ((__u64) (IMM)) >> 32 })
147
148#define BPF_PSEUDO_MAP_FD 1
149
150/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */
151#define BPF_LD_MAP_FD(DST, MAP_FD) \
152 BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD)
153
164/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */ 154/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */
165 155
166#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \ 156#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \
@@ -299,14 +289,6 @@ enum {
299#define SK_RUN_FILTER(filter, ctx) \ 289#define SK_RUN_FILTER(filter, ctx) \
300 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi) 290 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi)
301 291
302struct bpf_insn {
303 __u8 code; /* opcode */
304 __u8 dst_reg:4; /* dest register */
305 __u8 src_reg:4; /* source register */
306 __s16 off; /* signed offset */
307 __s32 imm; /* signed immediate constant */
308};
309
310#ifdef CONFIG_COMPAT 292#ifdef CONFIG_COMPAT
311/* A struct sock_filter is architecture independent. */ 293/* A struct sock_filter is architecture independent. */
312struct compat_sock_fprog { 294struct compat_sock_fprog {
@@ -320,20 +302,23 @@ struct sock_fprog_kern {
320 struct sock_filter *filter; 302 struct sock_filter *filter;
321}; 303};
322 304
323struct sk_buff; 305struct bpf_binary_header {
324struct sock; 306 unsigned int pages;
325struct seccomp_data; 307 u8 image[];
308};
326 309
327struct bpf_prog { 310struct bpf_prog {
328 u32 jited:1, /* Is our filter JIT'ed? */ 311 u16 pages; /* Number of allocated pages */
329 len:31; /* Number of filter blocks */ 312 bool jited; /* Is our filter JIT'ed? */
313 u32 len; /* Number of filter blocks */
330 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 314 struct sock_fprog_kern *orig_prog; /* Original BPF program */
315 struct bpf_prog_aux *aux; /* Auxiliary fields */
331 unsigned int (*bpf_func)(const struct sk_buff *skb, 316 unsigned int (*bpf_func)(const struct sk_buff *skb,
332 const struct bpf_insn *filter); 317 const struct bpf_insn *filter);
318 /* Instructions for interpreter */
333 union { 319 union {
334 struct sock_filter insns[0]; 320 struct sock_filter insns[0];
335 struct bpf_insn insnsi[0]; 321 struct bpf_insn insnsi[0];
336 struct work_struct work;
337 }; 322 };
338}; 323};
339 324
@@ -353,6 +338,26 @@ static inline unsigned int bpf_prog_size(unsigned int proglen)
353 338
354#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) 339#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
355 340
341#ifdef CONFIG_DEBUG_SET_MODULE_RONX
342static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
343{
344 set_memory_ro((unsigned long)fp, fp->pages);
345}
346
347static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
348{
349 set_memory_rw((unsigned long)fp, fp->pages);
350}
351#else
352static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
353{
354}
355
356static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
357{
358}
359#endif /* CONFIG_DEBUG_SET_MODULE_RONX */
360
356int sk_filter(struct sock *sk, struct sk_buff *skb); 361int sk_filter(struct sock *sk, struct sk_buff *skb);
357 362
358void bpf_prog_select_runtime(struct bpf_prog *fp); 363void bpf_prog_select_runtime(struct bpf_prog *fp);
@@ -361,6 +366,17 @@ void bpf_prog_free(struct bpf_prog *fp);
361int bpf_convert_filter(struct sock_filter *prog, int len, 366int bpf_convert_filter(struct sock_filter *prog, int len,
362 struct bpf_insn *new_prog, int *new_len); 367 struct bpf_insn *new_prog, int *new_len);
363 368
369struct bpf_prog *bpf_prog_alloc(unsigned int size, gfp_t gfp_extra_flags);
370struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
371 gfp_t gfp_extra_flags);
372void __bpf_prog_free(struct bpf_prog *fp);
373
374static inline void bpf_prog_unlock_free(struct bpf_prog *fp)
375{
376 bpf_prog_unlock_ro(fp);
377 __bpf_prog_free(fp);
378}
379
364int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog); 380int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog);
365void bpf_prog_destroy(struct bpf_prog *fp); 381void bpf_prog_destroy(struct bpf_prog *fp);
366 382
@@ -377,6 +393,38 @@ void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
377u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); 393u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
378void bpf_int_jit_compile(struct bpf_prog *fp); 394void bpf_int_jit_compile(struct bpf_prog *fp);
379 395
396#ifdef CONFIG_BPF_JIT
397typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size);
398
399struct bpf_binary_header *
400bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr,
401 unsigned int alignment,
402 bpf_jit_fill_hole_t bpf_fill_ill_insns);
403void bpf_jit_binary_free(struct bpf_binary_header *hdr);
404
405void bpf_jit_compile(struct bpf_prog *fp);
406void bpf_jit_free(struct bpf_prog *fp);
407
408static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
409 u32 pass, void *image)
410{
411 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
412 flen, proglen, pass, image);
413 if (image)
414 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
415 16, 1, image, proglen, false);
416}
417#else
418static inline void bpf_jit_compile(struct bpf_prog *fp)
419{
420}
421
422static inline void bpf_jit_free(struct bpf_prog *fp)
423{
424 bpf_prog_unlock_free(fp);
425}
426#endif /* CONFIG_BPF_JIT */
427
380#define BPF_ANC BIT(15) 428#define BPF_ANC BIT(15)
381 429
382static inline u16 bpf_anc_helper(const struct sock_filter *ftest) 430static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
@@ -424,36 +472,6 @@ static inline void *bpf_load_pointer(const struct sk_buff *skb, int k,
424 return bpf_internal_load_pointer_neg_helper(skb, k, size); 472 return bpf_internal_load_pointer_neg_helper(skb, k, size);
425} 473}
426 474
427#ifdef CONFIG_BPF_JIT
428#include <stdarg.h>
429#include <linux/linkage.h>
430#include <linux/printk.h>
431
432void bpf_jit_compile(struct bpf_prog *fp);
433void bpf_jit_free(struct bpf_prog *fp);
434
435static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
436 u32 pass, void *image)
437{
438 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
439 flen, proglen, pass, image);
440 if (image)
441 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
442 16, 1, image, proglen, false);
443}
444#else
445#include <linux/slab.h>
446
447static inline void bpf_jit_compile(struct bpf_prog *fp)
448{
449}
450
451static inline void bpf_jit_free(struct bpf_prog *fp)
452{
453 kfree(fp);
454}
455#endif /* CONFIG_BPF_JIT */
456
457static inline int bpf_tell_extensions(void) 475static inline int bpf_tell_extensions(void)
458{ 476{
459 return SKF_AD_MAX; 477 return SKF_AD_MAX;
diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h
index 4ebc49fae391..0d348e011a6e 100644
--- a/include/linux/flex_proportions.h
+++ b/include/linux/flex_proportions.h
@@ -10,6 +10,7 @@
10#include <linux/percpu_counter.h> 10#include <linux/percpu_counter.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/seqlock.h> 12#include <linux/seqlock.h>
13#include <linux/gfp.h>
13 14
14/* 15/*
15 * When maximum proportion of some event type is specified, this is the 16 * When maximum proportion of some event type is specified, this is the
@@ -32,7 +33,7 @@ struct fprop_global {
32 seqcount_t sequence; 33 seqcount_t sequence;
33}; 34};
34 35
35int fprop_global_init(struct fprop_global *p); 36int fprop_global_init(struct fprop_global *p, gfp_t gfp);
36void fprop_global_destroy(struct fprop_global *p); 37void fprop_global_destroy(struct fprop_global *p);
37bool fprop_new_period(struct fprop_global *p, int periods); 38bool fprop_new_period(struct fprop_global *p, int periods);
38 39
@@ -79,7 +80,7 @@ struct fprop_local_percpu {
79 raw_spinlock_t lock; /* Protect period and numerator */ 80 raw_spinlock_t lock; /* Protect period and numerator */
80}; 81};
81 82
82int fprop_local_init_percpu(struct fprop_local_percpu *pl); 83int fprop_local_init_percpu(struct fprop_local_percpu *pl, gfp_t gfp);
83void fprop_local_destroy_percpu(struct fprop_local_percpu *pl); 84void fprop_local_destroy_percpu(struct fprop_local_percpu *pl);
84void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl); 85void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl);
85void __fprop_inc_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl, 86void __fprop_inc_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl,
diff --git a/include/linux/font.h b/include/linux/font.h
index 40a24ab41b36..d6821769dd1e 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -31,6 +31,7 @@ struct font_desc {
31#define SUN12x22_IDX 7 31#define SUN12x22_IDX 7
32#define ACORN8x8_IDX 8 32#define ACORN8x8_IDX 8
33#define MINI4x6_IDX 9 33#define MINI4x6_IDX 9
34#define FONT6x10_IDX 10
34 35
35extern const struct font_desc font_vga_8x8, 36extern const struct font_desc font_vga_8x8,
36 font_vga_8x16, 37 font_vga_8x16,
@@ -41,7 +42,8 @@ extern const struct font_desc font_vga_8x8,
41 font_sun_8x16, 42 font_sun_8x16,
42 font_sun_12x22, 43 font_sun_12x22,
43 font_acorn_8x8, 44 font_acorn_8x8,
44 font_mini_4x6; 45 font_mini_4x6,
46 font_6x10;
45 47
46/* Find a font with a specific name */ 48/* Find a font with a specific name */
47 49
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 94187721ad41..9ab779e8a63c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -192,8 +192,6 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
192#define READ 0 192#define READ 0
193#define WRITE RW_MASK 193#define WRITE RW_MASK
194#define READA RWA_MASK 194#define READA RWA_MASK
195#define KERNEL_READ (READ|REQ_KERNEL)
196#define KERNEL_WRITE (WRITE|REQ_KERNEL)
197 195
198#define READ_SYNC (READ | REQ_SYNC) 196#define READ_SYNC (READ | REQ_SYNC)
199#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) 197#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
@@ -225,6 +223,13 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
225#define ATTR_TIMES_SET (1 << 16) 223#define ATTR_TIMES_SET (1 << 16)
226 224
227/* 225/*
226 * Whiteout is represented by a char device. The following constants define the
227 * mode and device number to use.
228 */
229#define WHITEOUT_MODE 0
230#define WHITEOUT_DEV 0
231
232/*
228 * This is the Inode Attributes structure, used for notify_change(). It 233 * This is the Inode Attributes structure, used for notify_change(). It
229 * uses the above definitions as flags, to know which values have changed. 234 * uses the above definitions as flags, to know which values have changed.
230 * Also, in this manner, a Filesystem can look at only the values it cares 235 * Also, in this manner, a Filesystem can look at only the values it cares
@@ -256,6 +261,12 @@ struct iattr {
256 */ 261 */
257#include <linux/quota.h> 262#include <linux/quota.h>
258 263
264/*
265 * Maximum number of layers of fs stack. Needs to be limited to
266 * prevent kernel stack overflow
267 */
268#define FILESYSTEM_MAX_STACK_DEPTH 2
269
259/** 270/**
260 * enum positive_aop_returns - aop return codes with specific semantics 271 * enum positive_aop_returns - aop return codes with specific semantics
261 * 272 *
@@ -628,11 +639,13 @@ static inline int inode_unhashed(struct inode *inode)
628 * 2: child/target 639 * 2: child/target
629 * 3: xattr 640 * 3: xattr
630 * 4: second non-directory 641 * 4: second non-directory
631 * The last is for certain operations (such as rename) which lock two 642 * 5: second parent (when locking independent directories in rename)
643 *
644 * I_MUTEX_NONDIR2 is for certain operations (such as rename) which lock two
632 * non-directories at once. 645 * non-directories at once.
633 * 646 *
634 * The locking order between these classes is 647 * The locking order between these classes is
635 * parent -> child -> normal -> xattr -> second non-directory 648 * parent[2] -> child -> grandchild -> normal -> xattr -> second non-directory
636 */ 649 */
637enum inode_i_mutex_lock_class 650enum inode_i_mutex_lock_class
638{ 651{
@@ -640,7 +653,8 @@ enum inode_i_mutex_lock_class
640 I_MUTEX_PARENT, 653 I_MUTEX_PARENT,
641 I_MUTEX_CHILD, 654 I_MUTEX_CHILD,
642 I_MUTEX_XATTR, 655 I_MUTEX_XATTR,
643 I_MUTEX_NONDIR2 656 I_MUTEX_NONDIR2,
657 I_MUTEX_PARENT2,
644}; 658};
645 659
646void lock_two_nondirectories(struct inode *, struct inode*); 660void lock_two_nondirectories(struct inode *, struct inode*);
@@ -851,13 +865,7 @@ static inline struct file *get_file(struct file *f)
851 */ 865 */
852#define FILE_LOCK_DEFERRED 1 866#define FILE_LOCK_DEFERRED 1
853 867
854/* 868/* legacy typedef, should eventually be removed */
855 * The POSIX file lock owner is determined by
856 * the "struct files_struct" in the thread group
857 * (or NULL for no owner - BSD locks).
858 *
859 * Lockd stuffs a "host" pointer into this.
860 */
861typedef void *fl_owner_t; 869typedef void *fl_owner_t;
862 870
863struct file_lock_operations { 871struct file_lock_operations {
@@ -868,10 +876,13 @@ struct file_lock_operations {
868struct lock_manager_operations { 876struct lock_manager_operations {
869 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 877 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
870 unsigned long (*lm_owner_key)(struct file_lock *); 878 unsigned long (*lm_owner_key)(struct file_lock *);
879 void (*lm_get_owner)(struct file_lock *, struct file_lock *);
880 void (*lm_put_owner)(struct file_lock *);
871 void (*lm_notify)(struct file_lock *); /* unblock callback */ 881 void (*lm_notify)(struct file_lock *); /* unblock callback */
872 int (*lm_grant)(struct file_lock *, struct file_lock *, int); 882 int (*lm_grant)(struct file_lock *, int);
873 void (*lm_break)(struct file_lock *); 883 bool (*lm_break)(struct file_lock *);
874 int (*lm_change)(struct file_lock **, int); 884 int (*lm_change)(struct file_lock **, int, struct list_head *);
885 void (*lm_setup)(struct file_lock *, void **);
875}; 886};
876 887
877struct lock_manager { 888struct lock_manager {
@@ -966,7 +977,7 @@ void locks_free_lock(struct file_lock *fl);
966extern void locks_init_lock(struct file_lock *); 977extern void locks_init_lock(struct file_lock *);
967extern struct file_lock * locks_alloc_lock(void); 978extern struct file_lock * locks_alloc_lock(void);
968extern void locks_copy_lock(struct file_lock *, struct file_lock *); 979extern void locks_copy_lock(struct file_lock *, struct file_lock *);
969extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); 980extern void locks_copy_conflock(struct file_lock *, struct file_lock *);
970extern void locks_remove_posix(struct file *, fl_owner_t); 981extern void locks_remove_posix(struct file *, fl_owner_t);
971extern void locks_remove_file(struct file *); 982extern void locks_remove_file(struct file *);
972extern void locks_release_private(struct file_lock *); 983extern void locks_release_private(struct file_lock *);
@@ -980,11 +991,9 @@ extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
980extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 991extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
981extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); 992extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
982extern void lease_get_mtime(struct inode *, struct timespec *time); 993extern void lease_get_mtime(struct inode *, struct timespec *time);
983extern int generic_setlease(struct file *, long, struct file_lock **); 994extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
984extern int vfs_setlease(struct file *, long, struct file_lock **); 995extern int vfs_setlease(struct file *, long, struct file_lock **, void **);
985extern int lease_modify(struct file_lock **, int); 996extern int lease_modify(struct file_lock **, int, struct list_head *);
986extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
987extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
988#else /* !CONFIG_FILE_LOCKING */ 997#else /* !CONFIG_FILE_LOCKING */
989static inline int fcntl_getlk(struct file *file, unsigned int cmd, 998static inline int fcntl_getlk(struct file *file, unsigned int cmd,
990 struct flock __user *user) 999 struct flock __user *user)
@@ -1013,12 +1022,12 @@ static inline int fcntl_setlk64(unsigned int fd, struct file *file,
1013#endif 1022#endif
1014static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg) 1023static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
1015{ 1024{
1016 return 0; 1025 return -EINVAL;
1017} 1026}
1018 1027
1019static inline int fcntl_getlease(struct file *filp) 1028static inline int fcntl_getlease(struct file *filp)
1020{ 1029{
1021 return 0; 1030 return F_UNLCK;
1022} 1031}
1023 1032
1024static inline void locks_init_lock(struct file_lock *fl) 1033static inline void locks_init_lock(struct file_lock *fl)
@@ -1026,7 +1035,7 @@ static inline void locks_init_lock(struct file_lock *fl)
1026 return; 1035 return;
1027} 1036}
1028 1037
1029static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl) 1038static inline void locks_copy_conflock(struct file_lock *new, struct file_lock *fl)
1030{ 1039{
1031 return; 1040 return;
1032} 1041}
@@ -1100,33 +1109,22 @@ static inline void lease_get_mtime(struct inode *inode, struct timespec *time)
1100} 1109}
1101 1110
1102static inline int generic_setlease(struct file *filp, long arg, 1111static inline int generic_setlease(struct file *filp, long arg,
1103 struct file_lock **flp) 1112 struct file_lock **flp, void **priv)
1104{ 1113{
1105 return -EINVAL; 1114 return -EINVAL;
1106} 1115}
1107 1116
1108static inline int vfs_setlease(struct file *filp, long arg, 1117static inline int vfs_setlease(struct file *filp, long arg,
1109 struct file_lock **lease) 1118 struct file_lock **lease, void **priv)
1110{ 1119{
1111 return -EINVAL; 1120 return -EINVAL;
1112} 1121}
1113 1122
1114static inline int lease_modify(struct file_lock **before, int arg) 1123static inline int lease_modify(struct file_lock **before, int arg,
1124 struct list_head *dispose)
1115{ 1125{
1116 return -EINVAL; 1126 return -EINVAL;
1117} 1127}
1118
1119static inline int lock_may_read(struct inode *inode, loff_t start,
1120 unsigned long len)
1121{
1122 return 1;
1123}
1124
1125static inline int lock_may_write(struct inode *inode, loff_t start,
1126 unsigned long len)
1127{
1128 return 1;
1129}
1130#endif /* !CONFIG_FILE_LOCKING */ 1128#endif /* !CONFIG_FILE_LOCKING */
1131 1129
1132 1130
@@ -1151,8 +1149,8 @@ extern void fasync_free(struct fasync_struct *);
1151/* can be called from interrupts */ 1149/* can be called from interrupts */
1152extern void kill_fasync(struct fasync_struct **, int, int); 1150extern void kill_fasync(struct fasync_struct **, int, int);
1153 1151
1154extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); 1152extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
1155extern int f_setown(struct file *filp, unsigned long arg, int force); 1153extern void f_setown(struct file *filp, unsigned long arg, int force);
1156extern void f_delown(struct file *filp); 1154extern void f_delown(struct file *filp);
1157extern pid_t f_getown(struct file *filp); 1155extern pid_t f_getown(struct file *filp);
1158extern int send_sigurg(struct fown_struct *fown); 1156extern int send_sigurg(struct fown_struct *fown);
@@ -1284,6 +1282,11 @@ struct super_block {
1284 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp; 1282 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
1285 struct list_lru s_inode_lru ____cacheline_aligned_in_smp; 1283 struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
1286 struct rcu_head rcu; 1284 struct rcu_head rcu;
1285
1286 /*
1287 * Indicates how deep in a filesystem stack this SB is
1288 */
1289 int s_stack_depth;
1287}; 1290};
1288 1291
1289extern struct timespec current_fs_time(struct super_block *sb); 1292extern struct timespec current_fs_time(struct super_block *sb);
@@ -1416,6 +1419,7 @@ extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct ino
1416extern int vfs_rmdir(struct inode *, struct dentry *); 1419extern int vfs_rmdir(struct inode *, struct dentry *);
1417extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); 1420extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1418extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int); 1421extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int);
1422extern int vfs_whiteout(struct inode *, struct dentry *);
1419 1423
1420/* 1424/*
1421 * VFS dentry helper functions. 1425 * VFS dentry helper functions.
@@ -1506,7 +1510,7 @@ struct file_operations {
1506 int (*flock) (struct file *, int, struct file_lock *); 1510 int (*flock) (struct file *, int, struct file_lock *);
1507 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); 1511 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
1508 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); 1512 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
1509 int (*setlease)(struct file *, long, struct file_lock **); 1513 int (*setlease)(struct file *, long, struct file_lock **, void **);
1510 long (*fallocate)(struct file *file, int mode, loff_t offset, 1514 long (*fallocate)(struct file *file, int mode, loff_t offset,
1511 loff_t len); 1515 loff_t len);
1512 int (*show_fdinfo)(struct seq_file *m, struct file *f); 1516 int (*show_fdinfo)(struct seq_file *m, struct file *f);
@@ -1546,6 +1550,9 @@ struct inode_operations {
1546 umode_t create_mode, int *opened); 1550 umode_t create_mode, int *opened);
1547 int (*tmpfile) (struct inode *, struct dentry *, umode_t); 1551 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
1548 int (*set_acl)(struct inode *, struct posix_acl *, int); 1552 int (*set_acl)(struct inode *, struct posix_acl *, int);
1553
1554 /* WARNING: probably going away soon, do not use! */
1555 int (*dentry_open)(struct dentry *, struct file *, const struct cred *);
1549} ____cacheline_aligned; 1556} ____cacheline_aligned;
1550 1557
1551ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1558ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
@@ -1643,6 +1650,9 @@ struct super_operations {
1643#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT) 1650#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
1644#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC) 1651#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
1645 1652
1653#define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \
1654 (inode)->i_rdev == WHITEOUT_DEV)
1655
1646/* 1656/*
1647 * Inode state bits. Protected by inode->i_lock 1657 * Inode state bits. Protected by inode->i_lock
1648 * 1658 *
@@ -1855,7 +1865,8 @@ extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
1855extern void kern_unmount(struct vfsmount *mnt); 1865extern void kern_unmount(struct vfsmount *mnt);
1856extern int may_umount_tree(struct vfsmount *); 1866extern int may_umount_tree(struct vfsmount *);
1857extern int may_umount(struct vfsmount *); 1867extern int may_umount(struct vfsmount *);
1858extern long do_mount(const char *, const char *, const char *, unsigned long, void *); 1868extern long do_mount(const char *, const char __user *,
1869 const char *, unsigned long, void *);
1859extern struct vfsmount *collect_mounts(struct path *); 1870extern struct vfsmount *collect_mounts(struct path *);
1860extern void drop_collected_mounts(struct vfsmount *); 1871extern void drop_collected_mounts(struct vfsmount *);
1861extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1872extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
@@ -1874,7 +1885,7 @@ extern int current_umask(void);
1874extern void ihold(struct inode * inode); 1885extern void ihold(struct inode * inode);
1875extern void iput(struct inode *); 1886extern void iput(struct inode *);
1876 1887
1877static inline struct inode *file_inode(struct file *f) 1888static inline struct inode *file_inode(const struct file *f)
1878{ 1889{
1879 return f->f_inode; 1890 return f->f_inode;
1880} 1891}
@@ -2057,6 +2068,7 @@ extern struct file *file_open_name(struct filename *, int, umode_t);
2057extern struct file *filp_open(const char *, int, umode_t); 2068extern struct file *filp_open(const char *, int, umode_t);
2058extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2069extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2059 const char *, int); 2070 const char *, int);
2071extern int vfs_open(const struct path *, struct file *, const struct cred *);
2060extern struct file * dentry_open(const struct path *, int, const struct cred *); 2072extern struct file * dentry_open(const struct path *, int, const struct cred *);
2061extern int filp_close(struct file *, fl_owner_t id); 2073extern int filp_close(struct file *, fl_owner_t id);
2062 2074
@@ -2270,7 +2282,9 @@ extern sector_t bmap(struct inode *, sector_t);
2270#endif 2282#endif
2271extern int notify_change(struct dentry *, struct iattr *, struct inode **); 2283extern int notify_change(struct dentry *, struct iattr *, struct inode **);
2272extern int inode_permission(struct inode *, int); 2284extern int inode_permission(struct inode *, int);
2285extern int __inode_permission(struct inode *, int);
2273extern int generic_permission(struct inode *, int); 2286extern int generic_permission(struct inode *, int);
2287extern int __check_sticky(struct inode *dir, struct inode *inode);
2274 2288
2275static inline bool execute_ok(struct inode *inode) 2289static inline bool execute_ok(struct inode *inode)
2276{ 2290{
@@ -2455,6 +2469,7 @@ extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo
2455extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 2469extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2456 2470
2457/* fs/block_dev.c */ 2471/* fs/block_dev.c */
2472extern ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to);
2458extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from); 2473extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from);
2459extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2474extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2460 int datasync); 2475 int datasync);
@@ -2469,6 +2484,9 @@ extern ssize_t iter_file_splice_write(struct pipe_inode_info *,
2469 struct file *, loff_t *, size_t, unsigned int); 2484 struct file *, loff_t *, size_t, unsigned int);
2470extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2485extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2471 struct file *out, loff_t *, size_t len, unsigned int flags); 2486 struct file *out, loff_t *, size_t len, unsigned int flags);
2487extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2488 loff_t *opos, size_t len, unsigned int flags);
2489
2472 2490
2473extern void 2491extern void
2474file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2492file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
@@ -2611,6 +2629,7 @@ extern int simple_write_end(struct file *file, struct address_space *mapping,
2611 struct page *page, void *fsdata); 2629 struct page *page, void *fsdata);
2612extern int always_delete_dentry(const struct dentry *); 2630extern int always_delete_dentry(const struct dentry *);
2613extern struct inode *alloc_anon_inode(struct super_block *); 2631extern struct inode *alloc_anon_inode(struct super_block *);
2632extern int simple_nosetlease(struct file *, long, struct file_lock **, void **);
2614extern const struct dentry_operations simple_dentry_operations; 2633extern const struct dentry_operations simple_dentry_operations;
2615 2634
2616extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); 2635extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
@@ -2753,6 +2772,14 @@ static inline int is_sxid(umode_t mode)
2753 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2772 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2754} 2773}
2755 2774
2775static inline int check_sticky(struct inode *dir, struct inode *inode)
2776{
2777 if (!(dir->i_mode & S_ISVTX))
2778 return 0;
2779
2780 return __check_sticky(dir, inode);
2781}
2782
2756static inline void inode_has_no_xattr(struct inode *inode) 2783static inline void inode_has_no_xattr(struct inode *inode)
2757{ 2784{
2758 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) 2785 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC))
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index efb05961bdd8..77d783f71527 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -139,7 +139,6 @@ struct fs_platform_info {
139 int rx_ring, tx_ring; /* number of buffers on rx */ 139 int rx_ring, tx_ring; /* number of buffers on rx */
140 __u8 macaddr[ETH_ALEN]; /* mac address */ 140 __u8 macaddr[ETH_ALEN]; /* mac address */
141 int rx_copybreak; /* limit we copy small frames */ 141 int rx_copybreak; /* limit we copy small frames */
142 int use_napi; /* use NAPI */
143 int napi_weight; /* NAPI weight */ 142 int napi_weight; /* NAPI weight */
144 143
145 int use_rmii; /* use RMII mode */ 144 int use_rmii; /* use RMII mode */
diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
index f49ddb1b2273..84d60cb841b1 100644
--- a/include/linux/fsl_ifc.h
+++ b/include/linux/fsl_ifc.h
@@ -781,13 +781,13 @@ struct fsl_ifc_regs {
781 __be32 amask; 781 __be32 amask;
782 u32 res4[0x2]; 782 u32 res4[0x2];
783 } amask_cs[FSL_IFC_BANK_COUNT]; 783 } amask_cs[FSL_IFC_BANK_COUNT];
784 u32 res5[0x17]; 784 u32 res5[0x18];
785 struct { 785 struct {
786 __be32 csor_ext;
787 __be32 csor; 786 __be32 csor;
787 __be32 csor_ext;
788 u32 res6; 788 u32 res6;
789 } csor_cs[FSL_IFC_BANK_COUNT]; 789 } csor_cs[FSL_IFC_BANK_COUNT];
790 u32 res7[0x19]; 790 u32 res7[0x18];
791 struct { 791 struct {
792 __be32 ftim[4]; 792 __be32 ftim[4];
793 u32 res8[0x8]; 793 u32 res8[0x8];
diff --git a/include/linux/fsldma.h b/include/linux/fsldma.h
new file mode 100644
index 000000000000..b213c02963c9
--- /dev/null
+++ b/include/linux/fsldma.h
@@ -0,0 +1,13 @@
1/*
2 * This is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 */
7
8#ifndef FSL_DMA_H
9#define FSL_DMA_H
10/* fsl dma API for enxternal start */
11int fsl_dma_external_start(struct dma_chan *dchan, int enable);
12
13#endif
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index f0b0edbf55a9..662697babd48 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -56,6 +56,8 @@ struct ftrace_ops;
56typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip, 56typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
57 struct ftrace_ops *op, struct pt_regs *regs); 57 struct ftrace_ops *op, struct pt_regs *regs);
58 58
59ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);
60
59/* 61/*
60 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are 62 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are
61 * set in the flags member. 63 * set in the flags member.
@@ -89,6 +91,9 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
89 * INITIALIZED - The ftrace_ops has already been initialized (first use time 91 * INITIALIZED - The ftrace_ops has already been initialized (first use time
90 * register_ftrace_function() is called, it will initialized the ops) 92 * register_ftrace_function() is called, it will initialized the ops)
91 * DELETED - The ops are being deleted, do not let them be registered again. 93 * DELETED - The ops are being deleted, do not let them be registered again.
94 * ADDING - The ops is in the process of being added.
95 * REMOVING - The ops is in the process of being removed.
96 * MODIFYING - The ops is in the process of changing its filter functions.
92 */ 97 */
93enum { 98enum {
94 FTRACE_OPS_FL_ENABLED = 1 << 0, 99 FTRACE_OPS_FL_ENABLED = 1 << 0,
@@ -100,6 +105,9 @@ enum {
100 FTRACE_OPS_FL_STUB = 1 << 6, 105 FTRACE_OPS_FL_STUB = 1 << 6,
101 FTRACE_OPS_FL_INITIALIZED = 1 << 7, 106 FTRACE_OPS_FL_INITIALIZED = 1 << 7,
102 FTRACE_OPS_FL_DELETED = 1 << 8, 107 FTRACE_OPS_FL_DELETED = 1 << 8,
108 FTRACE_OPS_FL_ADDING = 1 << 9,
109 FTRACE_OPS_FL_REMOVING = 1 << 10,
110 FTRACE_OPS_FL_MODIFYING = 1 << 11,
103}; 111};
104 112
105#ifdef CONFIG_DYNAMIC_FTRACE 113#ifdef CONFIG_DYNAMIC_FTRACE
@@ -132,7 +140,7 @@ struct ftrace_ops {
132 int nr_trampolines; 140 int nr_trampolines;
133 struct ftrace_ops_hash local_hash; 141 struct ftrace_ops_hash local_hash;
134 struct ftrace_ops_hash *func_hash; 142 struct ftrace_ops_hash *func_hash;
135 struct ftrace_hash *tramp_hash; 143 struct ftrace_ops_hash old_hash;
136 unsigned long trampoline; 144 unsigned long trampoline;
137#endif 145#endif
138}; 146};
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 1c2fdaa2ffc3..1ccaab44abcc 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -110,6 +110,10 @@ extern void gen_pool_set_algo(struct gen_pool *pool, genpool_algo_t algo,
110extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size, 110extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
111 unsigned long start, unsigned int nr, void *data); 111 unsigned long start, unsigned int nr, void *data);
112 112
113extern unsigned long gen_pool_first_fit_order_align(unsigned long *map,
114 unsigned long size, unsigned long start, unsigned int nr,
115 void *data);
116
113extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size, 117extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,
114 unsigned long start, unsigned int nr, void *data); 118 unsigned long start, unsigned int nr, void *data);
115 119
@@ -117,6 +121,9 @@ extern struct gen_pool *devm_gen_pool_create(struct device *dev,
117 int min_alloc_order, int nid); 121 int min_alloc_order, int nid);
118extern struct gen_pool *dev_get_gen_pool(struct device *dev); 122extern struct gen_pool *dev_get_gen_pool(struct device *dev);
119 123
124bool addr_in_gen_pool(struct gen_pool *pool, unsigned long start,
125 size_t size);
126
120#ifdef CONFIG_OF 127#ifdef CONFIG_OF
121extern struct gen_pool *of_get_named_gen_pool(struct device_node *np, 128extern struct gen_pool *of_get_named_gen_pool(struct device_node *np,
122 const char *propname, int index); 129 const char *propname, int index);
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
index c0894dd8827b..667c31101b8b 100644
--- a/include/linux/genl_magic_func.h
+++ b/include/linux/genl_magic_func.h
@@ -178,12 +178,12 @@ static int s_name ## _from_attrs_for_change(struct s_name *s, \
178#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \ 178#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \
179 nla = ntb[attr_nr]; \ 179 nla = ntb[attr_nr]; \
180 if (nla) { \ 180 if (nla) { \
181 if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \ 181 if (exclude_invariants && !!((attr_flag) & DRBD_F_INVARIANT)) { \
182 pr_info("<< must not change invariant attr: %s\n", #name); \ 182 pr_info("<< must not change invariant attr: %s\n", #name); \
183 return -EEXIST; \ 183 return -EEXIST; \
184 } \ 184 } \
185 assignment; \ 185 assignment; \
186 } else if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \ 186 } else if (exclude_invariants && !!((attr_flag) & DRBD_F_INVARIANT)) { \
187 /* attribute missing from payload, */ \ 187 /* attribute missing from payload, */ \
188 /* which was expected */ \ 188 /* which was expected */ \
189 } else if ((attr_flag) & DRBD_F_REQUIRED) { \ 189 } else if ((attr_flag) & DRBD_F_REQUIRED) { \
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 5e7219dc0fae..41b30fd4d041 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -156,7 +156,7 @@ struct vm_area_struct;
156#define GFP_DMA32 __GFP_DMA32 156#define GFP_DMA32 __GFP_DMA32
157 157
158/* Convert GFP flags to their corresponding migrate type */ 158/* Convert GFP flags to their corresponding migrate type */
159static inline int allocflags_to_migratetype(gfp_t gfp_flags) 159static inline int gfpflags_to_migratetype(const gfp_t gfp_flags)
160{ 160{
161 WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK); 161 WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
162 162
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index c5e41da20112..249db3057e4d 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -56,6 +56,8 @@ struct seq_file;
56 * as the chip access may sleep when e.g. reading out the IRQ status 56 * as the chip access may sleep when e.g. reading out the IRQ status
57 * registers. 57 * registers.
58 * @exported: flags if the gpiochip is exported for use from sysfs. Private. 58 * @exported: flags if the gpiochip is exported for use from sysfs. Private.
59 * @irq_not_threaded: flag must be set if @can_sleep is set but the
60 * IRQs don't need to be threaded
59 * 61 *
60 * A gpio_chip can help platforms abstract various sources of GPIOs so 62 * A gpio_chip can help platforms abstract various sources of GPIOs so
61 * they can all be accessed through a common programing interface. 63 * they can all be accessed through a common programing interface.
@@ -101,6 +103,7 @@ struct gpio_chip {
101 struct gpio_desc *desc; 103 struct gpio_desc *desc;
102 const char *const *names; 104 const char *const *names;
103 bool can_sleep; 105 bool can_sleep;
106 bool irq_not_threaded;
104 bool exported; 107 bool exported;
105 108
106#ifdef CONFIG_GPIOLIB_IRQCHIP 109#ifdef CONFIG_GPIOLIB_IRQCHIP
@@ -141,7 +144,7 @@ extern const char *gpiochip_is_requested(struct gpio_chip *chip,
141 144
142/* add/remove chips */ 145/* add/remove chips */
143extern int gpiochip_add(struct gpio_chip *chip); 146extern int gpiochip_add(struct gpio_chip *chip);
144extern int gpiochip_remove(struct gpio_chip *chip); 147extern void gpiochip_remove(struct gpio_chip *chip);
145extern struct gpio_chip *gpiochip_find(void *data, 148extern struct gpio_chip *gpiochip_find(void *data,
146 int (*match)(struct gpio_chip *chip, void *data)); 149 int (*match)(struct gpio_chip *chip, void *data));
147 150
@@ -166,7 +169,8 @@ int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
166 169
167#endif /* CONFIG_GPIOLIB_IRQCHIP */ 170#endif /* CONFIG_GPIOLIB_IRQCHIP */
168 171
169int gpiochip_request_own_desc(struct gpio_desc *desc, const char *label); 172struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum,
173 const char *label);
170void gpiochip_free_own_desc(struct gpio_desc *desc); 174void gpiochip_free_own_desc(struct gpio_desc *desc);
171 175
172#else /* CONFIG_GPIOLIB */ 176#else /* CONFIG_GPIOLIB */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 78ea9bf941cd..06c4607744f6 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -234,6 +234,33 @@ struct hid_item {
234#define HID_DG_BARRELSWITCH 0x000d0044 234#define HID_DG_BARRELSWITCH 0x000d0044
235#define HID_DG_ERASER 0x000d0045 235#define HID_DG_ERASER 0x000d0045
236#define HID_DG_TABLETPICK 0x000d0046 236#define HID_DG_TABLETPICK 0x000d0046
237
238#define HID_CP_CONSUMERCONTROL 0x000c0001
239#define HID_CP_NUMERICKEYPAD 0x000c0002
240#define HID_CP_PROGRAMMABLEBUTTONS 0x000c0003
241#define HID_CP_MICROPHONE 0x000c0004
242#define HID_CP_HEADPHONE 0x000c0005
243#define HID_CP_GRAPHICEQUALIZER 0x000c0006
244#define HID_CP_FUNCTIONBUTTONS 0x000c0036
245#define HID_CP_SELECTION 0x000c0080
246#define HID_CP_MEDIASELECTION 0x000c0087
247#define HID_CP_SELECTDISC 0x000c00ba
248#define HID_CP_PLAYBACKSPEED 0x000c00f1
249#define HID_CP_PROXIMITY 0x000c0109
250#define HID_CP_SPEAKERSYSTEM 0x000c0160
251#define HID_CP_CHANNELLEFT 0x000c0161
252#define HID_CP_CHANNELRIGHT 0x000c0162
253#define HID_CP_CHANNELCENTER 0x000c0163
254#define HID_CP_CHANNELFRONT 0x000c0164
255#define HID_CP_CHANNELCENTERFRONT 0x000c0165
256#define HID_CP_CHANNELSIDE 0x000c0166
257#define HID_CP_CHANNELSURROUND 0x000c0167
258#define HID_CP_CHANNELLOWFREQUENCYENHANCEMENT 0x000c0168
259#define HID_CP_CHANNELTOP 0x000c0169
260#define HID_CP_CHANNELUNKNOWN 0x000c016a
261#define HID_CP_APPLICATIONLAUNCHBUTTONS 0x000c0180
262#define HID_CP_GENERICGUIAPPLICATIONCONTROLS 0x000c0200
263
237#define HID_DG_CONFIDENCE 0x000d0047 264#define HID_DG_CONFIDENCE 0x000d0047
238#define HID_DG_WIDTH 0x000d0048 265#define HID_DG_WIDTH 0x000d0048
239#define HID_DG_HEIGHT 0x000d0049 266#define HID_DG_HEIGHT 0x000d0049
@@ -312,11 +339,8 @@ struct hid_item {
312 * Vendor specific HID device groups 339 * Vendor specific HID device groups
313 */ 340 */
314#define HID_GROUP_RMI 0x0100 341#define HID_GROUP_RMI 0x0100
315
316/*
317 * Vendor specific HID device groups
318 */
319#define HID_GROUP_WACOM 0x0101 342#define HID_GROUP_WACOM 0x0101
343#define HID_GROUP_LOGITECH_DJ_DEVICE 0x0102
320 344
321/* 345/*
322 * This is the global environment of the parser. This information is 346 * This is the global environment of the parser. This information is
@@ -1063,6 +1087,17 @@ static inline void hid_hw_wait(struct hid_device *hdev)
1063 hdev->ll_driver->wait(hdev); 1087 hdev->ll_driver->wait(hdev);
1064} 1088}
1065 1089
1090/**
1091 * hid_report_len - calculate the report length
1092 *
1093 * @report: the report we want to know the length
1094 */
1095static inline int hid_report_len(struct hid_report *report)
1096{
1097 /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
1098 return ((report->size - 1) >> 3) + 1 + (report->id > 0);
1099}
1100
1066int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 1101int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1067 int interrupt); 1102 int interrupt);
1068 1103
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 63579cb8d3dc..ad9051bab267 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -132,7 +132,7 @@ extern int __pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
132static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma, 132static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
133 spinlock_t **ptl) 133 spinlock_t **ptl)
134{ 134{
135 VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); 135 VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma);
136 if (pmd_trans_huge(*pmd)) 136 if (pmd_trans_huge(*pmd))
137 return __pmd_trans_huge_lock(pmd, vma, ptl); 137 return __pmd_trans_huge_lock(pmd, vma, ptl);
138 else 138 else
diff --git a/include/linux/i82593.h b/include/linux/i82593.h
deleted file mode 100644
index afac5c7a323d..000000000000
--- a/include/linux/i82593.h
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * Definitions for Intel 82593 CSMA/CD Core LAN Controller
3 * The definitions are taken from the 1992 users manual with Intel
4 * order number 297125-001.
5 *
6 * /usr/src/pc/RCS/i82593.h,v 1.1 1996/07/17 15:23:12 root Exp
7 *
8 * Copyright 1994, Anders Klemets <klemets@it.kth.se>
9 *
10 * HISTORY
11 * i82593.h,v
12 * Revision 1.4 2005/11/4 09:15:00 baroniunas
13 * Modified copyright with permission of author as follows:
14 *
15 * "If I82539.H is the only file with my copyright statement
16 * that is included in the Source Forge project, then you have
17 * my approval to change the copyright statement to be a GPL
18 * license, in the way you proposed on October 10."
19 *
20 * Revision 1.1 1996/07/17 15:23:12 root
21 * Initial revision
22 *
23 * Revision 1.3 1995/04/05 15:13:58 adj
24 * Initial alpha release
25 *
26 * Revision 1.2 1994/06/16 23:57:31 klemets
27 * Mirrored all the fields in the configuration block.
28 *
29 * Revision 1.1 1994/06/02 20:25:34 klemets
30 * Initial revision
31 *
32 *
33 */
34#ifndef _I82593_H
35#define _I82593_H
36
37/* Intel 82593 CSMA/CD Core LAN Controller */
38
39/* Port 0 Command Register definitions */
40
41/* Execution operations */
42#define OP0_NOP 0 /* CHNL = 0 */
43#define OP0_SWIT_TO_PORT_1 0 /* CHNL = 1 */
44#define OP0_IA_SETUP 1
45#define OP0_CONFIGURE 2
46#define OP0_MC_SETUP 3
47#define OP0_TRANSMIT 4
48#define OP0_TDR 5
49#define OP0_DUMP 6
50#define OP0_DIAGNOSE 7
51#define OP0_TRANSMIT_NO_CRC 9
52#define OP0_RETRANSMIT 12
53#define OP0_ABORT 13
54/* Reception operations */
55#define OP0_RCV_ENABLE 8
56#define OP0_RCV_DISABLE 10
57#define OP0_STOP_RCV 11
58/* Status pointer control operations */
59#define OP0_FIX_PTR 15 /* CHNL = 1 */
60#define OP0_RLS_PTR 15 /* CHNL = 0 */
61#define OP0_RESET 14
62
63#define CR0_CHNL (1 << 4) /* 0=Channel 0, 1=Channel 1 */
64#define CR0_STATUS_0 0x00
65#define CR0_STATUS_1 0x20
66#define CR0_STATUS_2 0x40
67#define CR0_STATUS_3 0x60
68#define CR0_INT_ACK (1 << 7) /* 0=No ack, 1=acknowledge */
69
70/* Port 0 Status Register definitions */
71
72#define SR0_NO_RESULT 0 /* dummy */
73#define SR0_EVENT_MASK 0x0f
74#define SR0_IA_SETUP_DONE 1
75#define SR0_CONFIGURE_DONE 2
76#define SR0_MC_SETUP_DONE 3
77#define SR0_TRANSMIT_DONE 4
78#define SR0_TDR_DONE 5
79#define SR0_DUMP_DONE 6
80#define SR0_DIAGNOSE_PASSED 7
81#define SR0_TRANSMIT_NO_CRC_DONE 9
82#define SR0_RETRANSMIT_DONE 12
83#define SR0_EXECUTION_ABORTED 13
84#define SR0_END_OF_FRAME 8
85#define SR0_RECEPTION_ABORTED 10
86#define SR0_DIAGNOSE_FAILED 15
87#define SR0_STOP_REG_HIT 11
88
89#define SR0_CHNL (1 << 4)
90#define SR0_EXECUTION (1 << 5)
91#define SR0_RECEPTION (1 << 6)
92#define SR0_INTERRUPT (1 << 7)
93#define SR0_BOTH_RX_TX (SR0_EXECUTION | SR0_RECEPTION)
94
95#define SR3_EXEC_STATE_MASK 0x03
96#define SR3_EXEC_IDLE 0
97#define SR3_TX_ABORT_IN_PROGRESS 1
98#define SR3_EXEC_ACTIVE 2
99#define SR3_ABORT_IN_PROGRESS 3
100#define SR3_EXEC_CHNL (1 << 2)
101#define SR3_STP_ON_NO_RSRC (1 << 3)
102#define SR3_RCVING_NO_RSRC (1 << 4)
103#define SR3_RCV_STATE_MASK 0x60
104#define SR3_RCV_IDLE 0x00
105#define SR3_RCV_READY 0x20
106#define SR3_RCV_ACTIVE 0x40
107#define SR3_RCV_STOP_IN_PROG 0x60
108#define SR3_RCV_CHNL (1 << 7)
109
110/* Port 1 Command Register definitions */
111
112#define OP1_NOP 0
113#define OP1_SWIT_TO_PORT_0 1
114#define OP1_INT_DISABLE 2
115#define OP1_INT_ENABLE 3
116#define OP1_SET_TS 5
117#define OP1_RST_TS 7
118#define OP1_POWER_DOWN 8
119#define OP1_RESET_RING_MNGMT 11
120#define OP1_RESET 14
121#define OP1_SEL_RST 15
122
123#define CR1_STATUS_4 0x00
124#define CR1_STATUS_5 0x20
125#define CR1_STATUS_6 0x40
126#define CR1_STOP_REG_UPDATE (1 << 7)
127
128/* Receive frame status bits */
129
130#define RX_RCLD (1 << 0)
131#define RX_IA_MATCH (1 << 1)
132#define RX_NO_AD_MATCH (1 << 2)
133#define RX_NO_SFD (1 << 3)
134#define RX_SRT_FRM (1 << 7)
135#define RX_OVRRUN (1 << 8)
136#define RX_ALG_ERR (1 << 10)
137#define RX_CRC_ERR (1 << 11)
138#define RX_LEN_ERR (1 << 12)
139#define RX_RCV_OK (1 << 13)
140#define RX_TYP_LEN (1 << 15)
141
142/* Transmit status bits */
143
144#define TX_NCOL_MASK 0x0f
145#define TX_FRTL (1 << 4)
146#define TX_MAX_COL (1 << 5)
147#define TX_HRT_BEAT (1 << 6)
148#define TX_DEFER (1 << 7)
149#define TX_UND_RUN (1 << 8)
150#define TX_LOST_CTS (1 << 9)
151#define TX_LOST_CRS (1 << 10)
152#define TX_LTCOL (1 << 11)
153#define TX_OK (1 << 13)
154#define TX_COLL (1 << 15)
155
156struct i82593_conf_block {
157 u_char fifo_limit : 4,
158 forgnesi : 1,
159 fifo_32 : 1,
160 d6mod : 1,
161 throttle_enb : 1;
162 u_char throttle : 6,
163 cntrxint : 1,
164 contin : 1;
165 u_char addr_len : 3,
166 acloc : 1,
167 preamb_len : 2,
168 loopback : 2;
169 u_char lin_prio : 3,
170 tbofstop : 1,
171 exp_prio : 3,
172 bof_met : 1;
173 u_char : 4,
174 ifrm_spc : 4;
175 u_char : 5,
176 slottim_low : 3;
177 u_char slottim_hi : 3,
178 : 1,
179 max_retr : 4;
180 u_char prmisc : 1,
181 bc_dis : 1,
182 : 1,
183 crs_1 : 1,
184 nocrc_ins : 1,
185 crc_1632 : 1,
186 : 1,
187 crs_cdt : 1;
188 u_char cs_filter : 3,
189 crs_src : 1,
190 cd_filter : 3,
191 : 1;
192 u_char : 2,
193 min_fr_len : 6;
194 u_char lng_typ : 1,
195 lng_fld : 1,
196 rxcrc_xf : 1,
197 artx : 1,
198 sarec : 1,
199 tx_jabber : 1, /* why is this called max_len in the manual? */
200 hash_1 : 1,
201 lbpkpol : 1;
202 u_char : 6,
203 fdx : 1,
204 : 1;
205 u_char dummy_6 : 6, /* supposed to be ones */
206 mult_ia : 1,
207 dis_bof : 1;
208 u_char dummy_1 : 1, /* supposed to be one */
209 tx_ifs_retrig : 2,
210 mc_all : 1,
211 rcv_mon : 2,
212 frag_acpt : 1,
213 tstrttrs : 1;
214 u_char fretx : 1,
215 runt_eop : 1,
216 hw_sw_pin : 1,
217 big_endn : 1,
218 syncrqs : 1,
219 sttlen : 1,
220 tx_eop : 1,
221 rx_eop : 1;
222 u_char rbuf_size : 5,
223 rcvstop : 1,
224 : 2;
225};
226
227#define I82593_MAX_MULTICAST_ADDRESSES 128 /* Hardware hashed filter */
228
229#endif /* _I82593_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 63ab3873c5ed..b1be39c76931 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -6,6 +6,7 @@
6 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> 6 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
7 * Copyright (c) 2005, Devicescape Software, Inc. 7 * Copyright (c) 2005, Devicescape Software, Inc.
8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> 8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
9 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
@@ -165,8 +166,12 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
165 166
166#define IEEE80211_MAX_MESH_ID_LEN 32 167#define IEEE80211_MAX_MESH_ID_LEN 32
167 168
169#define IEEE80211_FIRST_TSPEC_TSID 8
168#define IEEE80211_NUM_TIDS 16 170#define IEEE80211_NUM_TIDS 16
169 171
172/* number of user priorities 802.11 uses */
173#define IEEE80211_NUM_UPS 8
174
170#define IEEE80211_QOS_CTL_LEN 2 175#define IEEE80211_QOS_CTL_LEN 2
171/* 1d tag mask */ 176/* 1d tag mask */
172#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 177#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
@@ -838,6 +843,16 @@ enum ieee80211_vht_opmode_bits {
838 843
839#define WLAN_SA_QUERY_TR_ID_LEN 2 844#define WLAN_SA_QUERY_TR_ID_LEN 2
840 845
846/**
847 * struct ieee80211_tpc_report_ie
848 *
849 * This structure refers to "TPC Report element"
850 */
851struct ieee80211_tpc_report_ie {
852 u8 tx_power;
853 u8 link_margin;
854} __packed;
855
841struct ieee80211_mgmt { 856struct ieee80211_mgmt {
842 __le16 frame_control; 857 __le16 frame_control;
843 __le16 duration; 858 __le16 duration;
@@ -973,6 +988,13 @@ struct ieee80211_mgmt {
973 u8 action_code; 988 u8 action_code;
974 u8 operating_mode; 989 u8 operating_mode;
975 } __packed vht_opmode_notif; 990 } __packed vht_opmode_notif;
991 struct {
992 u8 action_code;
993 u8 dialog_token;
994 u8 tpc_elem_id;
995 u8 tpc_elem_length;
996 struct ieee80211_tpc_report_ie tpc;
997 } __packed tpc_report;
976 } u; 998 } u;
977 } __packed action; 999 } __packed action;
978 } u; 1000 } u;
@@ -1806,7 +1828,8 @@ enum ieee80211_eid {
1806 WLAN_EID_DMG_TSPEC = 146, 1828 WLAN_EID_DMG_TSPEC = 146,
1807 WLAN_EID_DMG_AT = 147, 1829 WLAN_EID_DMG_AT = 147,
1808 WLAN_EID_DMG_CAP = 148, 1830 WLAN_EID_DMG_CAP = 148,
1809 /* 149-150 reserved for Cisco */ 1831 /* 149 reserved for Cisco */
1832 WLAN_EID_CISCO_VENDOR_SPECIFIC = 150,
1810 WLAN_EID_DMG_OPERATION = 151, 1833 WLAN_EID_DMG_OPERATION = 151,
1811 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152, 1834 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152,
1812 WLAN_EID_DMG_BEAM_REFINEMENT = 153, 1835 WLAN_EID_DMG_BEAM_REFINEMENT = 153,
@@ -1865,6 +1888,7 @@ enum ieee80211_category {
1865 WLAN_CATEGORY_DLS = 2, 1888 WLAN_CATEGORY_DLS = 2,
1866 WLAN_CATEGORY_BACK = 3, 1889 WLAN_CATEGORY_BACK = 3,
1867 WLAN_CATEGORY_PUBLIC = 4, 1890 WLAN_CATEGORY_PUBLIC = 4,
1891 WLAN_CATEGORY_RADIO_MEASUREMENT = 5,
1868 WLAN_CATEGORY_HT = 7, 1892 WLAN_CATEGORY_HT = 7,
1869 WLAN_CATEGORY_SA_QUERY = 8, 1893 WLAN_CATEGORY_SA_QUERY = 8,
1870 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, 1894 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
@@ -2378,4 +2402,51 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2378#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) 2402#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
2379#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) 2403#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
2380 2404
2405/**
2406 * ieee80211_action_contains_tpc - checks if the frame contains TPC element
2407 * @skb: the skb containing the frame, length will be checked
2408 *
2409 * This function checks if it's either TPC report action frame or Link
2410 * Measurement report action frame as defined in IEEE Std. 802.11-2012 8.5.2.5
2411 * and 8.5.7.5 accordingly.
2412 */
2413static inline bool ieee80211_action_contains_tpc(struct sk_buff *skb)
2414{
2415 struct ieee80211_mgmt *mgmt = (void *)skb->data;
2416
2417 if (!ieee80211_is_action(mgmt->frame_control))
2418 return false;
2419
2420 if (skb->len < IEEE80211_MIN_ACTION_SIZE +
2421 sizeof(mgmt->u.action.u.tpc_report))
2422 return false;
2423
2424 /*
2425 * TPC report - check that:
2426 * category = 0 (Spectrum Management) or 5 (Radio Measurement)
2427 * spectrum management action = 3 (TPC/Link Measurement report)
2428 * TPC report EID = 35
2429 * TPC report element length = 2
2430 *
2431 * The spectrum management's tpc_report struct is used here both for
2432 * parsing tpc_report and radio measurement's link measurement report
2433 * frame, since the relevant part is identical in both frames.
2434 */
2435 if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT &&
2436 mgmt->u.action.category != WLAN_CATEGORY_RADIO_MEASUREMENT)
2437 return false;
2438
2439 /* both spectrum mgmt and link measurement have same action code */
2440 if (mgmt->u.action.u.tpc_report.action_code !=
2441 WLAN_ACTION_SPCT_TPC_RPRT)
2442 return false;
2443
2444 if (mgmt->u.action.u.tpc_report.tpc_elem_id != WLAN_EID_TPC_REPORT ||
2445 mgmt->u.action.u.tpc_report.tpc_elem_length !=
2446 sizeof(struct ieee80211_tpc_report_ie))
2447 return false;
2448
2449 return true;
2450}
2451
2381#endif /* LINUX_IEEE80211_H */ 2452#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 6b2c7cf352a5..6f6929ea8a0c 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -60,6 +60,7 @@ struct macvlan_dev {
60#ifdef CONFIG_NET_POLL_CONTROLLER 60#ifdef CONFIG_NET_POLL_CONTROLLER
61 struct netpoll *netpoll; 61 struct netpoll *netpoll;
62#endif 62#endif
63 unsigned int macaddr_count;
63}; 64};
64 65
65static inline void macvlan_count_rx(const struct macvlan_dev *vlan, 66static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f47550d75f85..2c677afeea47 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -39,6 +39,7 @@ static inline struct igmpv3_query *
39 39
40extern int sysctl_igmp_max_memberships; 40extern int sysctl_igmp_max_memberships;
41extern int sysctl_igmp_max_msf; 41extern int sysctl_igmp_max_msf;
42extern int sysctl_igmp_qrv;
42 43
43struct ip_sf_socklist { 44struct ip_sf_socklist {
44 unsigned int sl_max; 45 unsigned int sl_max;
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 7cf5e9b32550..120ccc53fcb7 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -15,7 +15,7 @@ struct linux_binprm;
15 15
16#ifdef CONFIG_IMA 16#ifdef CONFIG_IMA
17extern int ima_bprm_check(struct linux_binprm *bprm); 17extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_file_check(struct file *file, int mask); 18extern int ima_file_check(struct file *file, int mask, int opened);
19extern void ima_file_free(struct file *file); 19extern void ima_file_free(struct file *file);
20extern int ima_file_mmap(struct file *file, unsigned long prot); 20extern int ima_file_mmap(struct file *file, unsigned long prot);
21extern int ima_module_check(struct file *file); 21extern int ima_module_check(struct file *file);
@@ -27,7 +27,7 @@ static inline int ima_bprm_check(struct linux_binprm *bprm)
27 return 0; 27 return 0;
28} 28}
29 29
30static inline int ima_file_check(struct file *file, int mask) 30static inline int ima_file_check(struct file *file, int mask, int opened)
31{ 31{
32 return 0; 32 return 0;
33} 33}
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 2bb4c4f3531a..77fc43f8fb72 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -111,12 +111,21 @@ extern struct group_info init_groups;
111#ifdef CONFIG_PREEMPT_RCU 111#ifdef CONFIG_PREEMPT_RCU
112#define INIT_TASK_RCU_PREEMPT(tsk) \ 112#define INIT_TASK_RCU_PREEMPT(tsk) \
113 .rcu_read_lock_nesting = 0, \ 113 .rcu_read_lock_nesting = 0, \
114 .rcu_read_unlock_special = 0, \ 114 .rcu_read_unlock_special.s = 0, \
115 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \ 115 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
116 INIT_TASK_RCU_TREE_PREEMPT() 116 INIT_TASK_RCU_TREE_PREEMPT()
117#else 117#else
118#define INIT_TASK_RCU_PREEMPT(tsk) 118#define INIT_TASK_RCU_PREEMPT(tsk)
119#endif 119#endif
120#ifdef CONFIG_TASKS_RCU
121#define INIT_TASK_RCU_TASKS(tsk) \
122 .rcu_tasks_holdout = false, \
123 .rcu_tasks_holdout_list = \
124 LIST_HEAD_INIT(tsk.rcu_tasks_holdout_list), \
125 .rcu_tasks_idle_cpu = -1,
126#else
127#define INIT_TASK_RCU_TASKS(tsk)
128#endif
120 129
121extern struct cred init_cred; 130extern struct cred init_cred;
122 131
@@ -224,6 +233,7 @@ extern struct task_group root_task_group;
224 INIT_FTRACE_GRAPH \ 233 INIT_FTRACE_GRAPH \
225 INIT_TRACE_RECURSION \ 234 INIT_TRACE_RECURSION \
226 INIT_TASK_RCU_PREEMPT(tsk) \ 235 INIT_TASK_RCU_PREEMPT(tsk) \
236 INIT_TASK_RCU_TASKS(tsk) \
227 INIT_CPUSET_SEQ(tsk) \ 237 INIT_CPUSET_SEQ(tsk) \
228 INIT_RT_MUTEXES(tsk) \ 238 INIT_RT_MUTEXES(tsk) \
229 INIT_VTIME(tsk) \ 239 INIT_VTIME(tsk) \
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 698ad053d064..69517a24bc50 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -193,11 +193,6 @@ extern void irq_wake_thread(unsigned int irq, void *dev_id);
193/* The following three functions are for the core kernel use only. */ 193/* The following three functions are for the core kernel use only. */
194extern void suspend_device_irqs(void); 194extern void suspend_device_irqs(void);
195extern void resume_device_irqs(void); 195extern void resume_device_irqs(void);
196#ifdef CONFIG_PM_SLEEP
197extern int check_wakeup_irqs(void);
198#else
199static inline int check_wakeup_irqs(void) { return 0; }
200#endif
201 196
202/** 197/**
203 * struct irq_affinity_notify - context for notification of IRQ affinity changes 198 * struct irq_affinity_notify - context for notification of IRQ affinity changes
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 20f9a527922a..e6a7c9ff72f2 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -57,8 +57,11 @@ struct iommu_domain {
57 struct iommu_domain_geometry geometry; 57 struct iommu_domain_geometry geometry;
58}; 58};
59 59
60#define IOMMU_CAP_CACHE_COHERENCY 0x1 60enum iommu_cap {
61#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 61 IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA
62 transactions */
63 IOMMU_CAP_INTR_REMAP, /* IOMMU supports interrupt isolation */
64};
62 65
63/* 66/*
64 * Following constraints are specifc to FSL_PAMUV1: 67 * Following constraints are specifc to FSL_PAMUV1:
@@ -80,6 +83,7 @@ enum iommu_attr {
80 DOMAIN_ATTR_FSL_PAMU_STASH, 83 DOMAIN_ATTR_FSL_PAMU_STASH,
81 DOMAIN_ATTR_FSL_PAMU_ENABLE, 84 DOMAIN_ATTR_FSL_PAMU_ENABLE,
82 DOMAIN_ATTR_FSL_PAMUV1, 85 DOMAIN_ATTR_FSL_PAMUV1,
86 DOMAIN_ATTR_NESTING, /* two stages of translation */
83 DOMAIN_ATTR_MAX, 87 DOMAIN_ATTR_MAX,
84}; 88};
85 89
@@ -94,7 +98,6 @@ enum iommu_attr {
94 * @map: map a physically contiguous memory region to an iommu domain 98 * @map: map a physically contiguous memory region to an iommu domain
95 * @unmap: unmap a physically contiguous memory region from an iommu domain 99 * @unmap: unmap a physically contiguous memory region from an iommu domain
96 * @iova_to_phys: translate iova to physical address 100 * @iova_to_phys: translate iova to physical address
97 * @domain_has_cap: domain capabilities query
98 * @add_device: add device to iommu grouping 101 * @add_device: add device to iommu grouping
99 * @remove_device: remove device from iommu grouping 102 * @remove_device: remove device from iommu grouping
100 * @domain_get_attr: Query domain attributes 103 * @domain_get_attr: Query domain attributes
@@ -102,6 +105,7 @@ enum iommu_attr {
102 * @pgsize_bitmap: bitmap of supported page sizes 105 * @pgsize_bitmap: bitmap of supported page sizes
103 */ 106 */
104struct iommu_ops { 107struct iommu_ops {
108 bool (*capable)(enum iommu_cap);
105 int (*domain_init)(struct iommu_domain *domain); 109 int (*domain_init)(struct iommu_domain *domain);
106 void (*domain_destroy)(struct iommu_domain *domain); 110 void (*domain_destroy)(struct iommu_domain *domain);
107 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 111 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
@@ -111,8 +115,6 @@ struct iommu_ops {
111 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, 115 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
112 size_t size); 116 size_t size);
113 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); 117 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
114 int (*domain_has_cap)(struct iommu_domain *domain,
115 unsigned long cap);
116 int (*add_device)(struct device *dev); 118 int (*add_device)(struct device *dev);
117 void (*remove_device)(struct device *dev); 119 void (*remove_device)(struct device *dev);
118 int (*device_group)(struct device *dev, unsigned int *groupid); 120 int (*device_group)(struct device *dev, unsigned int *groupid);
@@ -142,6 +144,7 @@ struct iommu_ops {
142 144
143extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); 145extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
144extern bool iommu_present(struct bus_type *bus); 146extern bool iommu_present(struct bus_type *bus);
147extern bool iommu_capable(struct bus_type *bus, enum iommu_cap cap);
145extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); 148extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
146extern struct iommu_group *iommu_group_get_by_id(int id); 149extern struct iommu_group *iommu_group_get_by_id(int id);
147extern void iommu_domain_free(struct iommu_domain *domain); 150extern void iommu_domain_free(struct iommu_domain *domain);
@@ -154,8 +157,6 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
154extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, 157extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
155 size_t size); 158 size_t size);
156extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); 159extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
157extern int iommu_domain_has_cap(struct iommu_domain *domain,
158 unsigned long cap);
159extern void iommu_set_fault_handler(struct iommu_domain *domain, 160extern void iommu_set_fault_handler(struct iommu_domain *domain,
160 iommu_fault_handler_t handler, void *token); 161 iommu_fault_handler_t handler, void *token);
161 162
@@ -250,6 +251,11 @@ static inline bool iommu_present(struct bus_type *bus)
250 return false; 251 return false;
251} 252}
252 253
254static inline bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
255{
256 return false;
257}
258
253static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) 259static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
254{ 260{
255 return NULL; 261 return NULL;
@@ -304,12 +310,6 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_ad
304 return 0; 310 return 0;
305} 311}
306 312
307static inline int iommu_domain_has_cap(struct iommu_domain *domain,
308 unsigned long cap)
309{
310 return 0;
311}
312
313static inline void iommu_set_fault_handler(struct iommu_domain *domain, 313static inline void iommu_set_fault_handler(struct iommu_domain *domain,
314 iommu_fault_handler_t handler, void *token) 314 iommu_fault_handler_t handler, void *token)
315{ 315{
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 142ec544167c..2c5250222278 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -215,6 +215,11 @@ static inline int __deprecated check_region(resource_size_t s,
215 215
216/* Wrappers for managed devices */ 216/* Wrappers for managed devices */
217struct device; 217struct device;
218
219extern int devm_request_resource(struct device *dev, struct resource *root,
220 struct resource *new);
221extern void devm_release_resource(struct device *dev, struct resource *new);
222
218#define devm_request_region(dev,start,n,name) \ 223#define devm_request_region(dev,start,n,name) \
219 __devm_request_region(dev, &ioport_resource, (start), (n), (name)) 224 __devm_request_region(dev, &ioport_resource, (start), (n), (name))
220#define devm_request_mem_region(dev,start,n,name) \ 225#define devm_request_mem_region(dev,start,n,name) \
diff --git a/include/linux/ipack.h b/include/linux/ipack.h
index 1888e06ddf64..8bddc3fbdddf 100644
--- a/include/linux/ipack.h
+++ b/include/linux/ipack.h
@@ -172,6 +172,7 @@ struct ipack_bus_ops {
172 * @ops: bus operations for the mezzanine drivers 172 * @ops: bus operations for the mezzanine drivers
173 */ 173 */
174struct ipack_bus_device { 174struct ipack_bus_device {
175 struct module *owner;
175 struct device *parent; 176 struct device *parent;
176 int slots; 177 int slots;
177 int bus_nr; 178 int bus_nr;
@@ -189,7 +190,8 @@ struct ipack_bus_device {
189 * available bus device in ipack. 190 * available bus device in ipack.
190 */ 191 */
191struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, 192struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots,
192 const struct ipack_bus_ops *ops); 193 const struct ipack_bus_ops *ops,
194 struct module *owner);
193 195
194/** 196/**
195 * ipack_bus_unregister -- unregister an ipack bus 197 * ipack_bus_unregister -- unregister an ipack bus
@@ -265,3 +267,23 @@ void ipack_put_device(struct ipack_device *dev);
265 .format = (_format), \ 267 .format = (_format), \
266 .vendor = (vend), \ 268 .vendor = (vend), \
267 .device = (dev) 269 .device = (dev)
270
271/**
272 * ipack_get_carrier - it increase the carrier ref. counter of
273 * the carrier module
274 * @dev: mezzanine device which wants to get the carrier
275 */
276static inline int ipack_get_carrier(struct ipack_device *dev)
277{
278 return try_module_get(dev->bus->owner);
279}
280
281/**
282 * ipack_get_carrier - it decrease the carrier ref. counter of
283 * the carrier module
284 * @dev: mezzanine device which wants to get the carrier
285 */
286static inline void ipack_put_carrier(struct ipack_device *dev)
287{
288 module_put(dev->bus->owner);
289}
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 62af59242ddc..03f48d936f66 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -173,6 +173,7 @@ struct irq_data {
173 * IRQD_IRQ_DISABLED - Disabled state of the interrupt 173 * IRQD_IRQ_DISABLED - Disabled state of the interrupt
174 * IRQD_IRQ_MASKED - Masked state of the interrupt 174 * IRQD_IRQ_MASKED - Masked state of the interrupt
175 * IRQD_IRQ_INPROGRESS - In progress state of the interrupt 175 * IRQD_IRQ_INPROGRESS - In progress state of the interrupt
176 * IRQD_WAKEUP_ARMED - Wakeup mode armed
176 */ 177 */
177enum { 178enum {
178 IRQD_TRIGGER_MASK = 0xf, 179 IRQD_TRIGGER_MASK = 0xf,
@@ -186,6 +187,7 @@ enum {
186 IRQD_IRQ_DISABLED = (1 << 16), 187 IRQD_IRQ_DISABLED = (1 << 16),
187 IRQD_IRQ_MASKED = (1 << 17), 188 IRQD_IRQ_MASKED = (1 << 17),
188 IRQD_IRQ_INPROGRESS = (1 << 18), 189 IRQD_IRQ_INPROGRESS = (1 << 18),
190 IRQD_WAKEUP_ARMED = (1 << 19),
189}; 191};
190 192
191static inline bool irqd_is_setaffinity_pending(struct irq_data *d) 193static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
@@ -257,6 +259,12 @@ static inline bool irqd_irq_inprogress(struct irq_data *d)
257 return d->state_use_accessors & IRQD_IRQ_INPROGRESS; 259 return d->state_use_accessors & IRQD_IRQ_INPROGRESS;
258} 260}
259 261
262static inline bool irqd_is_wakeup_armed(struct irq_data *d)
263{
264 return d->state_use_accessors & IRQD_WAKEUP_ARMED;
265}
266
267
260/* 268/*
261 * Functions for chained handlers which can be enabled/disabled by the 269 * Functions for chained handlers which can be enabled/disabled by the
262 * standard disable_irq/enable_irq calls. Must be called with 270 * standard disable_irq/enable_irq calls. Must be called with
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index bf9422c3aefe..bf3fe719c7ce 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -39,9 +39,12 @@ bool irq_work_queue_on(struct irq_work *work, int cpu);
39#endif 39#endif
40 40
41void irq_work_run(void); 41void irq_work_run(void);
42void irq_work_tick(void);
42void irq_work_sync(struct irq_work *work); 43void irq_work_sync(struct irq_work *work);
43 44
44#ifdef CONFIG_IRQ_WORK 45#ifdef CONFIG_IRQ_WORK
46#include <asm/irq_work.h>
47
45bool irq_work_needs_cpu(void); 48bool irq_work_needs_cpu(void);
46#else 49#else
47static inline bool irq_work_needs_cpu(void) { return false; } 50static inline bool irq_work_needs_cpu(void) { return false; }
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 45e2d8c15bd2..13eed92c7d24 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -21,7 +21,11 @@
21#define GIC_CPU_ACTIVEPRIO 0xd0 21#define GIC_CPU_ACTIVEPRIO 0xd0
22#define GIC_CPU_IDENT 0xfc 22#define GIC_CPU_IDENT 0xfc
23 23
24#define GICC_ENABLE 0x1
25#define GICC_INT_PRI_THRESHOLD 0xf0
24#define GICC_IAR_INT_ID_MASK 0x3ff 26#define GICC_IAR_INT_ID_MASK 0x3ff
27#define GICC_INT_SPURIOUS 1023
28#define GICC_DIS_BYPASS_MASK 0x1e0
25 29
26#define GIC_DIST_CTRL 0x000 30#define GIC_DIST_CTRL 0x000
27#define GIC_DIST_CTR 0x004 31#define GIC_DIST_CTR 0x004
@@ -39,6 +43,18 @@
39#define GIC_DIST_SGI_PENDING_CLEAR 0xf10 43#define GIC_DIST_SGI_PENDING_CLEAR 0xf10
40#define GIC_DIST_SGI_PENDING_SET 0xf20 44#define GIC_DIST_SGI_PENDING_SET 0xf20
41 45
46#define GICD_ENABLE 0x1
47#define GICD_DISABLE 0x0
48#define GICD_INT_ACTLOW_LVLTRIG 0x0
49#define GICD_INT_EN_CLR_X32 0xffffffff
50#define GICD_INT_EN_SET_SGI 0x0000ffff
51#define GICD_INT_EN_CLR_PPI 0xffff0000
52#define GICD_INT_DEF_PRI 0xa0
53#define GICD_INT_DEF_PRI_X4 ((GICD_INT_DEF_PRI << 24) |\
54 (GICD_INT_DEF_PRI << 16) |\
55 (GICD_INT_DEF_PRI << 8) |\
56 GICD_INT_DEF_PRI)
57
42#define GICH_HCR 0x0 58#define GICH_HCR 0x0
43#define GICH_VTR 0x4 59#define GICH_VTR 0x4
44#define GICH_VMCR 0x8 60#define GICH_VMCR 0x8
diff --git a/include/linux/irqchip/irq-omap-intc.h b/include/linux/irqchip/irq-omap-intc.h
new file mode 100644
index 000000000000..e06b370cfc0d
--- /dev/null
+++ b/include/linux/irqchip/irq-omap-intc.h
@@ -0,0 +1,32 @@
1/**
2 * irq-omap-intc.h - INTC Idle Functions
3 *
4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Author: Felipe Balbi <balbi@ti.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 of
10 * the License as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H
19#define __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H
20
21void omap2_init_irq(void);
22void omap3_init_irq(void);
23void ti81xx_init_irq(void);
24
25int omap_irq_pending(void);
26void omap_intc_save_context(void);
27void omap_intc_restore_context(void);
28void omap3_intc_suspend(void);
29void omap3_intc_prepare_idle(void);
30void omap3_intc_resume_idle(void);
31
32#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H */
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 472c021a2d4f..faf433af425e 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -12,6 +12,8 @@ struct irq_affinity_notify;
12struct proc_dir_entry; 12struct proc_dir_entry;
13struct module; 13struct module;
14struct irq_desc; 14struct irq_desc;
15struct irq_domain;
16struct pt_regs;
15 17
16/** 18/**
17 * struct irq_desc - interrupt descriptor 19 * struct irq_desc - interrupt descriptor
@@ -36,6 +38,11 @@ struct irq_desc;
36 * @threads_oneshot: bitfield to handle shared oneshot threads 38 * @threads_oneshot: bitfield to handle shared oneshot threads
37 * @threads_active: number of irqaction threads currently running 39 * @threads_active: number of irqaction threads currently running
38 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers 40 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
41 * @nr_actions: number of installed actions on this descriptor
42 * @no_suspend_depth: number of irqactions on a irq descriptor with
43 * IRQF_NO_SUSPEND set
44 * @force_resume_depth: number of irqactions on a irq descriptor with
45 * IRQF_FORCE_RESUME set
39 * @dir: /proc/irq/ procfs entry 46 * @dir: /proc/irq/ procfs entry
40 * @name: flow handler name for /proc/interrupts output 47 * @name: flow handler name for /proc/interrupts output
41 */ 48 */
@@ -68,6 +75,11 @@ struct irq_desc {
68 unsigned long threads_oneshot; 75 unsigned long threads_oneshot;
69 atomic_t threads_active; 76 atomic_t threads_active;
70 wait_queue_head_t wait_for_threads; 77 wait_queue_head_t wait_for_threads;
78#ifdef CONFIG_PM_SLEEP
79 unsigned int nr_actions;
80 unsigned int no_suspend_depth;
81 unsigned int force_resume_depth;
82#endif
71#ifdef CONFIG_PROC_FS 83#ifdef CONFIG_PROC_FS
72 struct proc_dir_entry *dir; 84 struct proc_dir_entry *dir;
73#endif 85#endif
@@ -118,6 +130,23 @@ static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *de
118 130
119int generic_handle_irq(unsigned int irq); 131int generic_handle_irq(unsigned int irq);
120 132
133#ifdef CONFIG_HANDLE_DOMAIN_IRQ
134/*
135 * Convert a HW interrupt number to a logical one using a IRQ domain,
136 * and handle the result interrupt number. Return -EINVAL if
137 * conversion failed. Providing a NULL domain indicates that the
138 * conversion has already been done.
139 */
140int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
141 bool lookup, struct pt_regs *regs);
142
143static inline int handle_domain_irq(struct irq_domain *domain,
144 unsigned int hwirq, struct pt_regs *regs)
145{
146 return __handle_domain_irq(domain, hwirq, true, regs);
147}
148#endif
149
121/* Test to see if a driver has successfully requested an irq */ 150/* Test to see if a driver has successfully requested an irq */
122static inline int irq_has_action(unsigned int irq) 151static inline int irq_has_action(unsigned int irq)
123{ 152{
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 0dae71e9971c..704b9a599b26 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1042,7 +1042,7 @@ void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
1042extern void jbd2_journal_commit_transaction(journal_t *); 1042extern void jbd2_journal_commit_transaction(journal_t *);
1043 1043
1044/* Checkpoint list management */ 1044/* Checkpoint list management */
1045int __jbd2_journal_clean_checkpoint_list(journal_t *journal); 1045void __jbd2_journal_clean_checkpoint_list(journal_t *journal);
1046int __jbd2_journal_remove_checkpoint(struct journal_head *); 1046int __jbd2_journal_remove_checkpoint(struct journal_head *);
1047void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *); 1047void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1048 1048
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 784304b222b3..98f923b6a0ea 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -8,28 +8,28 @@
8 * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com> 8 * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com>
9 * 9 *
10 * Jump labels provide an interface to generate dynamic branches using 10 * Jump labels provide an interface to generate dynamic branches using
11 * self-modifying code. Assuming toolchain and architecture support the result 11 * self-modifying code. Assuming toolchain and architecture support, the result
12 * of a "if (static_key_false(&key))" statement is a unconditional branch (which 12 * of a "if (static_key_false(&key))" statement is an unconditional branch (which
13 * defaults to false - and the true block is placed out of line). 13 * defaults to false - and the true block is placed out of line).
14 * 14 *
15 * However at runtime we can change the branch target using 15 * However at runtime we can change the branch target using
16 * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key 16 * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key
17 * object and for as long as there are references all branches referring to 17 * object, and for as long as there are references all branches referring to
18 * that particular key will point to the (out of line) true block. 18 * that particular key will point to the (out of line) true block.
19 * 19 *
20 * Since this relies on modifying code the static_key_slow_{inc,dec}() functions 20 * Since this relies on modifying code, the static_key_slow_{inc,dec}() functions
21 * must be considered absolute slow paths (machine wide synchronization etc.). 21 * must be considered absolute slow paths (machine wide synchronization etc.).
22 * OTOH, since the affected branches are unconditional their runtime overhead 22 * OTOH, since the affected branches are unconditional, their runtime overhead
23 * will be absolutely minimal, esp. in the default (off) case where the total 23 * will be absolutely minimal, esp. in the default (off) case where the total
24 * effect is a single NOP of appropriate size. The on case will patch in a jump 24 * effect is a single NOP of appropriate size. The on case will patch in a jump
25 * to the out-of-line block. 25 * to the out-of-line block.
26 * 26 *
27 * When the control is directly exposed to userspace it is prudent to delay the 27 * When the control is directly exposed to userspace, it is prudent to delay the
28 * decrement to avoid high frequency code modifications which can (and do) 28 * decrement to avoid high frequency code modifications which can (and do)
29 * cause significant performance degradation. Struct static_key_deferred and 29 * cause significant performance degradation. Struct static_key_deferred and
30 * static_key_slow_dec_deferred() provide for this. 30 * static_key_slow_dec_deferred() provide for this.
31 * 31 *
32 * Lacking toolchain and or architecture support, it falls back to a simple 32 * Lacking toolchain and or architecture support, jump labels fall back to a simple
33 * conditional branch. 33 * conditional branch.
34 * 34 *
35 * struct static_key my_key = STATIC_KEY_INIT_TRUE; 35 * struct static_key my_key = STATIC_KEY_INIT_TRUE;
@@ -43,8 +43,7 @@
43 * 43 *
44 * Not initializing the key (static data is initialized to 0s anyway) is the 44 * Not initializing the key (static data is initialized to 0s anyway) is the
45 * same as using STATIC_KEY_INIT_FALSE. 45 * same as using STATIC_KEY_INIT_FALSE.
46 * 46 */
47*/
48 47
49#include <linux/types.h> 48#include <linux/types.h>
50#include <linux/compiler.h> 49#include <linux/compiler.h>
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 95624bed87ef..3d770f5564b8 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -376,10 +376,6 @@ extern unsigned long simple_strtoul(const char *,char **,unsigned int);
376extern long simple_strtol(const char *,char **,unsigned int); 376extern long simple_strtol(const char *,char **,unsigned int);
377extern unsigned long long simple_strtoull(const char *,char **,unsigned int); 377extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
378extern long long simple_strtoll(const char *,char **,unsigned int); 378extern long long simple_strtoll(const char *,char **,unsigned int);
379#define strict_strtoul kstrtoul
380#define strict_strtol kstrtol
381#define strict_strtoull kstrtoull
382#define strict_strtoll kstrtoll
383 379
384extern int num_to_str(char *buf, int size, unsigned long long num); 380extern int num_to_str(char *buf, int size, unsigned long long num);
385 381
@@ -407,6 +403,7 @@ int vsscanf(const char *, const char *, va_list);
407extern int get_option(char **str, int *pint); 403extern int get_option(char **str, int *pint);
408extern char *get_options(const char *str, int nints, int *ints); 404extern char *get_options(const char *str, int nints, int *ints);
409extern unsigned long long memparse(const char *ptr, char **retptr); 405extern unsigned long long memparse(const char *ptr, char **retptr);
406extern bool parse_option_str(const char *str, const char *option);
410 407
411extern int core_kernel_text(unsigned long addr); 408extern int core_kernel_text(unsigned long addr);
412extern int core_kernel_data(unsigned long addr); 409extern int core_kernel_data(unsigned long addr);
@@ -496,6 +493,7 @@ static inline char *hex_byte_pack_upper(char *buf, u8 byte)
496 493
497extern int hex_to_bin(char ch); 494extern int hex_to_bin(char ch);
498extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); 495extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
496extern char *bin2hex(char *dst, const void *src, size_t count);
499 497
500bool mac_pton(const char *s, u8 *mac); 498bool mac_pton(const char *s, u8 *mac);
501 499
@@ -715,23 +713,8 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
715 (void) (&_max1 == &_max2); \ 713 (void) (&_max1 == &_max2); \
716 _max1 > _max2 ? _max1 : _max2; }) 714 _max1 > _max2 ? _max1 : _max2; })
717 715
718#define min3(x, y, z) ({ \ 716#define min3(x, y, z) min((typeof(x))min(x, y), z)
719 typeof(x) _min1 = (x); \ 717#define max3(x, y, z) max((typeof(x))max(x, y), z)
720 typeof(y) _min2 = (y); \
721 typeof(z) _min3 = (z); \
722 (void) (&_min1 == &_min2); \
723 (void) (&_min1 == &_min3); \
724 _min1 < _min2 ? (_min1 < _min3 ? _min1 : _min3) : \
725 (_min2 < _min3 ? _min2 : _min3); })
726
727#define max3(x, y, z) ({ \
728 typeof(x) _max1 = (x); \
729 typeof(y) _max2 = (y); \
730 typeof(z) _max3 = (z); \
731 (void) (&_max1 == &_max2); \
732 (void) (&_max1 == &_max3); \
733 _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \
734 (_max2 > _max3 ? _max2 : _max3); })
735 718
736/** 719/**
737 * min_not_zero - return the minimum that is _not_ zero, unless both are zero 720 * min_not_zero - return the minimum that is _not_ zero, unless both are zero
@@ -746,20 +729,13 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
746/** 729/**
747 * clamp - return a value clamped to a given range with strict typechecking 730 * clamp - return a value clamped to a given range with strict typechecking
748 * @val: current value 731 * @val: current value
749 * @min: minimum allowable value 732 * @lo: lowest allowable value
750 * @max: maximum allowable value 733 * @hi: highest allowable value
751 * 734 *
752 * This macro does strict typechecking of min/max to make sure they are of the 735 * This macro does strict typechecking of lo/hi to make sure they are of the
753 * same type as val. See the unnecessary pointer comparisons. 736 * same type as val. See the unnecessary pointer comparisons.
754 */ 737 */
755#define clamp(val, min, max) ({ \ 738#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
756 typeof(val) __val = (val); \
757 typeof(min) __min = (min); \
758 typeof(max) __max = (max); \
759 (void) (&__val == &__min); \
760 (void) (&__val == &__max); \
761 __val = __val < __min ? __min: __val; \
762 __val > __max ? __max: __val; })
763 739
764/* 740/*
765 * ..and if you can't take the strict 741 * ..and if you can't take the strict
@@ -781,36 +757,26 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
781 * clamp_t - return a value clamped to a given range using a given type 757 * clamp_t - return a value clamped to a given range using a given type
782 * @type: the type of variable to use 758 * @type: the type of variable to use
783 * @val: current value 759 * @val: current value
784 * @min: minimum allowable value 760 * @lo: minimum allowable value
785 * @max: maximum allowable value 761 * @hi: maximum allowable value
786 * 762 *
787 * This macro does no typechecking and uses temporary variables of type 763 * This macro does no typechecking and uses temporary variables of type
788 * 'type' to make all the comparisons. 764 * 'type' to make all the comparisons.
789 */ 765 */
790#define clamp_t(type, val, min, max) ({ \ 766#define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
791 type __val = (val); \
792 type __min = (min); \
793 type __max = (max); \
794 __val = __val < __min ? __min: __val; \
795 __val > __max ? __max: __val; })
796 767
797/** 768/**
798 * clamp_val - return a value clamped to a given range using val's type 769 * clamp_val - return a value clamped to a given range using val's type
799 * @val: current value 770 * @val: current value
800 * @min: minimum allowable value 771 * @lo: minimum allowable value
801 * @max: maximum allowable value 772 * @hi: maximum allowable value
802 * 773 *
803 * This macro does no typechecking and uses temporary variables of whatever 774 * This macro does no typechecking and uses temporary variables of whatever
804 * type the input argument 'val' is. This is useful when val is an unsigned 775 * type the input argument 'val' is. This is useful when val is an unsigned
805 * type and min and max are literals that will otherwise be assigned a signed 776 * type and min and max are literals that will otherwise be assigned a signed
806 * integer type. 777 * integer type.
807 */ 778 */
808#define clamp_val(val, min, max) ({ \ 779#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
809 typeof(val) __val = (val); \
810 typeof(val) __min = (min); \
811 typeof(val) __max = (max); \
812 __val = __val < __min ? __min: __val; \
813 __val > __max ? __max: __val; })
814 780
815 781
816/* 782/*
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index ecbc52f9ff77..8422b4ed6882 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -44,8 +44,8 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
44DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat); 44DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
45 45
46/* Must have preemption disabled for this to be meaningful. */ 46/* Must have preemption disabled for this to be meaningful. */
47#define kstat_this_cpu (&__get_cpu_var(kstat)) 47#define kstat_this_cpu this_cpu_ptr(&kstat)
48#define kcpustat_this_cpu (&__get_cpu_var(kernel_cpustat)) 48#define kcpustat_this_cpu this_cpu_ptr(&kernel_cpustat)
49#define kstat_cpu(cpu) per_cpu(kstat, cpu) 49#define kstat_cpu(cpu) per_cpu(kstat, cpu)
50#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu) 50#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu)
51 51
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index 9be37da93680..e985ba679c4a 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -41,7 +41,7 @@ u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
41u16 capi20_get_version(u32 contr, struct capi_version *verp); 41u16 capi20_get_version(u32 contr, struct capi_version *verp);
42u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]); 42u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
43u16 capi20_get_profile(u32 contr, struct capi_profile *profp); 43u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
44int capi20_manufacturer(unsigned int cmd, void __user *data); 44int capi20_manufacturer(unsigned long cmd, void __user *data);
45 45
46#define CAPICTR_UP 0 46#define CAPICTR_UP 0
47#define CAPICTR_DOWN 1 47#define CAPICTR_DOWN 1
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 4b2a0e11cc5b..9d957b7ae095 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -178,6 +178,7 @@ struct kexec_buf {
178 struct kimage *image; 178 struct kimage *image;
179 char *buffer; 179 char *buffer;
180 unsigned long bufsz; 180 unsigned long bufsz;
181 unsigned long mem;
181 unsigned long memsz; 182 unsigned long memsz;
182 unsigned long buf_align; 183 unsigned long buf_align;
183 unsigned long buf_min; 184 unsigned long buf_min;
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 44792ee649de..ff9f1d394235 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -53,6 +53,24 @@ typedef int (*request_key_actor_t)(struct key_construction *key,
53 const char *op, void *aux); 53 const char *op, void *aux);
54 54
55/* 55/*
56 * Preparsed matching criterion.
57 */
58struct key_match_data {
59 /* Comparison function, defaults to exact description match, but can be
60 * overridden by type->match_preparse(). Should return true if a match
61 * is found and false if not.
62 */
63 bool (*cmp)(const struct key *key,
64 const struct key_match_data *match_data);
65
66 const void *raw_data; /* Raw match data */
67 void *preparsed; /* For ->match_preparse() to stash stuff */
68 unsigned lookup_type; /* Type of lookup for this search. */
69#define KEYRING_SEARCH_LOOKUP_DIRECT 0x0000 /* Direct lookup by description. */
70#define KEYRING_SEARCH_LOOKUP_ITERATE 0x0001 /* Iterative search. */
71};
72
73/*
56 * kernel managed key type definition 74 * kernel managed key type definition
57 */ 75 */
58struct key_type { 76struct key_type {
@@ -65,11 +83,6 @@ struct key_type {
65 */ 83 */
66 size_t def_datalen; 84 size_t def_datalen;
67 85
68 /* Default key search algorithm. */
69 unsigned def_lookup_type;
70#define KEYRING_SEARCH_LOOKUP_DIRECT 0x0000 /* Direct lookup by description. */
71#define KEYRING_SEARCH_LOOKUP_ITERATE 0x0001 /* Iterative search. */
72
73 /* vet a description */ 86 /* vet a description */
74 int (*vet_description)(const char *description); 87 int (*vet_description)(const char *description);
75 88
@@ -96,8 +109,15 @@ struct key_type {
96 */ 109 */
97 int (*update)(struct key *key, struct key_preparsed_payload *prep); 110 int (*update)(struct key *key, struct key_preparsed_payload *prep);
98 111
99 /* match a key against a description */ 112 /* Preparse the data supplied to ->match() (optional). The
100 int (*match)(const struct key *key, const void *desc); 113 * data to be preparsed can be found in match_data->raw_data.
114 * The lookup type can also be set by this function.
115 */
116 int (*match_preparse)(struct key_match_data *match_data);
117
118 /* Free preparsed match data (optional). This should be supplied it
119 * ->match_preparse() is supplied. */
120 void (*match_free)(struct key_match_data *match_data);
101 121
102 /* clear some of the data from a key on revokation (optional) 122 /* clear some of the data from a key on revokation (optional)
103 * - the key's semaphore will be write-locked by the caller 123 * - the key's semaphore will be write-locked by the caller
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 6b06d378f3df..e465bb15912d 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -283,7 +283,7 @@ struct kgdb_io {
283 283
284extern struct kgdb_arch arch_kgdb_ops; 284extern struct kgdb_arch arch_kgdb_ops;
285 285
286extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs); 286extern unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs);
287 287
288#ifdef CONFIG_SERIAL_KGDB_NMI 288#ifdef CONFIG_SERIAL_KGDB_NMI
289extern int kgdb_register_nmi_console(void); 289extern int kgdb_register_nmi_console(void);
diff --git a/include/linux/khugepaged.h b/include/linux/khugepaged.h
index 6b394f0b5148..eeb307985715 100644
--- a/include/linux/khugepaged.h
+++ b/include/linux/khugepaged.h
@@ -6,7 +6,8 @@
6#ifdef CONFIG_TRANSPARENT_HUGEPAGE 6#ifdef CONFIG_TRANSPARENT_HUGEPAGE
7extern int __khugepaged_enter(struct mm_struct *mm); 7extern int __khugepaged_enter(struct mm_struct *mm);
8extern void __khugepaged_exit(struct mm_struct *mm); 8extern void __khugepaged_exit(struct mm_struct *mm);
9extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma); 9extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma,
10 unsigned long vm_flags);
10 11
11#define khugepaged_enabled() \ 12#define khugepaged_enabled() \
12 (transparent_hugepage_flags & \ 13 (transparent_hugepage_flags & \
@@ -35,13 +36,13 @@ static inline void khugepaged_exit(struct mm_struct *mm)
35 __khugepaged_exit(mm); 36 __khugepaged_exit(mm);
36} 37}
37 38
38static inline int khugepaged_enter(struct vm_area_struct *vma) 39static inline int khugepaged_enter(struct vm_area_struct *vma,
40 unsigned long vm_flags)
39{ 41{
40 if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags)) 42 if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags))
41 if ((khugepaged_always() || 43 if ((khugepaged_always() ||
42 (khugepaged_req_madv() && 44 (khugepaged_req_madv() && (vm_flags & VM_HUGEPAGE))) &&
43 vma->vm_flags & VM_HUGEPAGE)) && 45 !(vm_flags & VM_NOHUGEPAGE))
44 !(vma->vm_flags & VM_NOHUGEPAGE))
45 if (__khugepaged_enter(vma->vm_mm)) 46 if (__khugepaged_enter(vma->vm_mm))
46 return -ENOMEM; 47 return -ENOMEM;
47 return 0; 48 return 0;
@@ -54,11 +55,13 @@ static inline int khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm)
54static inline void khugepaged_exit(struct mm_struct *mm) 55static inline void khugepaged_exit(struct mm_struct *mm)
55{ 56{
56} 57}
57static inline int khugepaged_enter(struct vm_area_struct *vma) 58static inline int khugepaged_enter(struct vm_area_struct *vma,
59 unsigned long vm_flags)
58{ 60{
59 return 0; 61 return 0;
60} 62}
61static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma) 63static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma,
64 unsigned long vm_flags)
62{ 65{
63 return 0; 66 return 0;
64} 67}
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index a4c33b34fe3f..ea53b04993f2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -136,12 +136,11 @@ static inline bool is_error_page(struct page *page)
136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22 136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
137#define KVM_REQ_ENABLE_IBS 23 137#define KVM_REQ_ENABLE_IBS 23
138#define KVM_REQ_DISABLE_IBS 24 138#define KVM_REQ_DISABLE_IBS 24
139#define KVM_REQ_APIC_PAGE_RELOAD 25
139 140
140#define KVM_USERSPACE_IRQ_SOURCE_ID 0 141#define KVM_USERSPACE_IRQ_SOURCE_ID 0
141#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 142#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
142 143
143struct kvm;
144struct kvm_vcpu;
145extern struct kmem_cache *kvm_vcpu_cache; 144extern struct kmem_cache *kvm_vcpu_cache;
146 145
147extern spinlock_t kvm_lock; 146extern spinlock_t kvm_lock;
@@ -200,6 +199,17 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, unsigned long hva,
200int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu); 199int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
201#endif 200#endif
202 201
202/*
203 * Carry out a gup that requires IO. Allow the mm to relinquish the mmap
204 * semaphore if the filemap/swap has to wait on a page lock. pagep == NULL
205 * controls whether we retry the gup one more time to completion in that case.
206 * Typically this is called after a FAULT_FLAG_RETRY_NOWAIT in the main tdp
207 * handler.
208 */
209int kvm_get_user_page_io(struct task_struct *tsk, struct mm_struct *mm,
210 unsigned long addr, bool write_fault,
211 struct page **pagep);
212
203enum { 213enum {
204 OUTSIDE_GUEST_MODE, 214 OUTSIDE_GUEST_MODE,
205 IN_GUEST_MODE, 215 IN_GUEST_MODE,
@@ -325,8 +335,6 @@ struct kvm_kernel_irq_routing_entry {
325 struct hlist_node link; 335 struct hlist_node link;
326}; 336};
327 337
328struct kvm_irq_routing_table;
329
330#ifndef KVM_PRIVATE_MEM_SLOTS 338#ifndef KVM_PRIVATE_MEM_SLOTS
331#define KVM_PRIVATE_MEM_SLOTS 0 339#define KVM_PRIVATE_MEM_SLOTS 0
332#endif 340#endif
@@ -528,6 +536,8 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
528unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 536unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
529unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable); 537unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
530unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn); 538unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
539unsigned long gfn_to_hva_memslot_prot(struct kvm_memory_slot *slot, gfn_t gfn,
540 bool *writable);
531void kvm_release_page_clean(struct page *page); 541void kvm_release_page_clean(struct page *page);
532void kvm_release_page_dirty(struct page *page); 542void kvm_release_page_dirty(struct page *page);
533void kvm_set_page_accessed(struct page *page); 543void kvm_set_page_accessed(struct page *page);
@@ -579,6 +589,7 @@ void kvm_flush_remote_tlbs(struct kvm *kvm);
579void kvm_reload_remote_mmus(struct kvm *kvm); 589void kvm_reload_remote_mmus(struct kvm *kvm);
580void kvm_make_mclock_inprogress_request(struct kvm *kvm); 590void kvm_make_mclock_inprogress_request(struct kvm *kvm);
581void kvm_make_scan_ioapic_request(struct kvm *kvm); 591void kvm_make_scan_ioapic_request(struct kvm *kvm);
592bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
582 593
583long kvm_arch_dev_ioctl(struct file *filp, 594long kvm_arch_dev_ioctl(struct file *filp,
584 unsigned int ioctl, unsigned long arg); 595 unsigned int ioctl, unsigned long arg);
@@ -624,6 +635,8 @@ void kvm_arch_exit(void);
624int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu); 635int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
625void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu); 636void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
626 637
638void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu);
639
627void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu); 640void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
628void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); 641void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
629void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); 642void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
@@ -632,8 +645,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
632int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu); 645int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu);
633void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); 646void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
634 647
635int kvm_arch_hardware_enable(void *garbage); 648int kvm_arch_hardware_enable(void);
636void kvm_arch_hardware_disable(void *garbage); 649void kvm_arch_hardware_disable(void);
637int kvm_arch_hardware_setup(void); 650int kvm_arch_hardware_setup(void);
638void kvm_arch_hardware_unsetup(void); 651void kvm_arch_hardware_unsetup(void);
639void kvm_arch_check_processor_compat(void *rtn); 652void kvm_arch_check_processor_compat(void *rtn);
@@ -1034,8 +1047,6 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
1034 1047
1035extern bool kvm_rebooting; 1048extern bool kvm_rebooting;
1036 1049
1037struct kvm_device_ops;
1038
1039struct kvm_device { 1050struct kvm_device {
1040 struct kvm_device_ops *ops; 1051 struct kvm_device_ops *ops;
1041 struct kvm *kvm; 1052 struct kvm *kvm;
@@ -1068,12 +1079,11 @@ struct kvm_device_ops {
1068void kvm_device_get(struct kvm_device *dev); 1079void kvm_device_get(struct kvm_device *dev);
1069void kvm_device_put(struct kvm_device *dev); 1080void kvm_device_put(struct kvm_device *dev);
1070struct kvm_device *kvm_device_from_filp(struct file *filp); 1081struct kvm_device *kvm_device_from_filp(struct file *filp);
1082int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type);
1083void kvm_unregister_device_ops(u32 type);
1071 1084
1072extern struct kvm_device_ops kvm_mpic_ops; 1085extern struct kvm_device_ops kvm_mpic_ops;
1073extern struct kvm_device_ops kvm_xics_ops; 1086extern struct kvm_device_ops kvm_xics_ops;
1074extern struct kvm_device_ops kvm_vfio_ops;
1075extern struct kvm_device_ops kvm_arm_vgic_v2_ops;
1076extern struct kvm_device_ops kvm_flic_ops;
1077 1087
1078#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT 1088#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
1079 1089
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index b0bcce0ddc95..b606bb689a3e 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -17,6 +17,20 @@
17#ifndef __KVM_TYPES_H__ 17#ifndef __KVM_TYPES_H__
18#define __KVM_TYPES_H__ 18#define __KVM_TYPES_H__
19 19
20struct kvm;
21struct kvm_async_pf;
22struct kvm_device_ops;
23struct kvm_interrupt;
24struct kvm_irq_routing_table;
25struct kvm_memory_slot;
26struct kvm_one_reg;
27struct kvm_run;
28struct kvm_userspace_memory_region;
29struct kvm_vcpu;
30struct kvm_vcpu_init;
31
32enum kvm_mr_change;
33
20#include <asm/types.h> 34#include <asm/types.h>
21 35
22/* 36/*
diff --git a/include/linux/leds.h b/include/linux/leds.h
index e43686472197..a57611d0c94e 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -13,8 +13,8 @@
13#define __LINUX_LEDS_H_INCLUDED 13#define __LINUX_LEDS_H_INCLUDED
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h>
17#include <linux/rwsem.h> 16#include <linux/rwsem.h>
17#include <linux/spinlock.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20 20
@@ -31,8 +31,8 @@ enum led_brightness {
31 31
32struct led_classdev { 32struct led_classdev {
33 const char *name; 33 const char *name;
34 int brightness; 34 enum led_brightness brightness;
35 int max_brightness; 35 enum led_brightness max_brightness;
36 int flags; 36 int flags;
37 37
38 /* Lower 16 bits reflect status */ 38 /* Lower 16 bits reflect status */
@@ -140,6 +140,16 @@ extern void led_blink_set_oneshot(struct led_classdev *led_cdev,
140 */ 140 */
141extern void led_set_brightness(struct led_classdev *led_cdev, 141extern void led_set_brightness(struct led_classdev *led_cdev,
142 enum led_brightness brightness); 142 enum led_brightness brightness);
143/**
144 * led_update_brightness - update LED brightness
145 * @led_cdev: the LED to query
146 *
147 * Get an LED's current brightness and update led_cdev->brightness
148 * member with the obtained value.
149 *
150 * Returns: 0 on success or negative error value on failure
151 */
152extern int led_update_brightness(struct led_classdev *led_cdev);
143 153
144/* 154/*
145 * LED Triggers 155 * LED Triggers
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 92abb497ab14..bd5fefeaf548 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1404,14 +1404,14 @@ static inline int sata_srst_pmp(struct ata_link *link)
1404 * printk helpers 1404 * printk helpers
1405 */ 1405 */
1406__printf(3, 4) 1406__printf(3, 4)
1407int ata_port_printk(const struct ata_port *ap, const char *level, 1407void ata_port_printk(const struct ata_port *ap, const char *level,
1408 const char *fmt, ...); 1408 const char *fmt, ...);
1409__printf(3, 4) 1409__printf(3, 4)
1410int ata_link_printk(const struct ata_link *link, const char *level, 1410void ata_link_printk(const struct ata_link *link, const char *level,
1411 const char *fmt, ...); 1411 const char *fmt, ...);
1412__printf(3, 4) 1412__printf(3, 4)
1413int ata_dev_printk(const struct ata_device *dev, const char *level, 1413void ata_dev_printk(const struct ata_device *dev, const char *level,
1414 const char *fmt, ...); 1414 const char *fmt, ...);
1415 1415
1416#define ata_port_err(ap, fmt, ...) \ 1416#define ata_port_err(ap, fmt, ...) \
1417 ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__) 1417 ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)
diff --git a/include/linux/list.h b/include/linux/list.h
index cbbb96fcead9..f33f831eb3c8 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -5,6 +5,7 @@
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/poison.h> 6#include <linux/poison.h>
7#include <linux/const.h> 7#include <linux/const.h>
8#include <linux/kernel.h>
8 9
9/* 10/*
10 * Simple doubly linked list implementation. 11 * Simple doubly linked list implementation.
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 219d79627c05..ff82a32871b5 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -178,7 +178,6 @@ struct nlm_block {
178 unsigned char b_granted; /* VFS granted lock */ 178 unsigned char b_granted; /* VFS granted lock */
179 struct nlm_file * b_file; /* file in question */ 179 struct nlm_file * b_file; /* file in question */
180 struct cache_req * b_cache_req; /* deferred request handling */ 180 struct cache_req * b_cache_req; /* deferred request handling */
181 struct file_lock * b_fl; /* set for GETLK */
182 struct cache_deferred_req * b_deferred_req; 181 struct cache_deferred_req * b_deferred_req;
183 unsigned int b_flags; /* block flags */ 182 unsigned int b_flags; /* block flags */
184#define B_QUEUED 1 /* lock queued */ 183#define B_QUEUED 1 /* lock queued */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 008388f920d7..74ab23176e9b 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 4 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
5 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> 5 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
6 * 6 *
7 * see Documentation/lockdep-design.txt for more details. 7 * see Documentation/locking/lockdep-design.txt for more details.
8 */ 8 */
9#ifndef __LINUX_LOCKDEP_H 9#ifndef __LINUX_LOCKDEP_H
10#define __LINUX_LOCKDEP_H 10#define __LINUX_LOCKDEP_H
@@ -362,6 +362,10 @@ extern void lockdep_trace_alloc(gfp_t mask);
362 WARN_ON(debug_locks && !lockdep_is_held(l)); \ 362 WARN_ON(debug_locks && !lockdep_is_held(l)); \
363 } while (0) 363 } while (0)
364 364
365#define lockdep_assert_held_once(l) do { \
366 WARN_ON_ONCE(debug_locks && !lockdep_is_held(l)); \
367 } while (0)
368
365#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) 369#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
366 370
367#else /* !CONFIG_LOCKDEP */ 371#else /* !CONFIG_LOCKDEP */
@@ -412,6 +416,7 @@ struct lock_class_key { };
412#define lockdep_depth(tsk) (0) 416#define lockdep_depth(tsk) (0)
413 417
414#define lockdep_assert_held(l) do { (void)(l); } while (0) 418#define lockdep_assert_held(l) do { (void)(l); } while (0)
419#define lockdep_assert_held_once(l) do { (void)(l); } while (0)
415 420
416#define lockdep_recursing(tsk) (0) 421#define lockdep_recursing(tsk) (0)
417 422
@@ -505,6 +510,7 @@ static inline void print_irqtrace_events(struct task_struct *curr)
505 510
506#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_) 511#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_)
507#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_) 512#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_)
513#define lock_map_acquire_tryread(l) lock_acquire_shared_recursive(l, 0, 1, NULL, _THIS_IP_)
508#define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 514#define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
509 515
510#ifdef CONFIG_PROVE_LOCKING 516#ifdef CONFIG_PROVE_LOCKING
diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
new file mode 100644
index 000000000000..307d9cab2026
--- /dev/null
+++ b/include/linux/mailbox_client.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2013-2014 Linaro Ltd.
3 * Author: Jassi Brar <jassisinghbrar@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __MAILBOX_CLIENT_H
11#define __MAILBOX_CLIENT_H
12
13#include <linux/of.h>
14#include <linux/device.h>
15
16struct mbox_chan;
17
18/**
19 * struct mbox_client - User of a mailbox
20 * @dev: The client device
21 * @tx_block: If the mbox_send_message should block until data is
22 * transmitted.
23 * @tx_tout: Max block period in ms before TX is assumed failure
24 * @knows_txdone: If the client could run the TX state machine. Usually
25 * if the client receives some ACK packet for transmission.
26 * Unused if the controller already has TX_Done/RTR IRQ.
27 * @rx_callback: Atomic callback to provide client the data received
28 * @tx_done: Atomic callback to tell client of data transmission
29 */
30struct mbox_client {
31 struct device *dev;
32 bool tx_block;
33 unsigned long tx_tout;
34 bool knows_txdone;
35
36 void (*rx_callback)(struct mbox_client *cl, void *mssg);
37 void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
38};
39
40struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index);
41int mbox_send_message(struct mbox_chan *chan, void *mssg);
42void mbox_client_txdone(struct mbox_chan *chan, int r); /* atomic */
43bool mbox_client_peek_data(struct mbox_chan *chan); /* atomic */
44void mbox_free_channel(struct mbox_chan *chan); /* may sleep */
45
46#endif /* __MAILBOX_CLIENT_H */
diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h
new file mode 100644
index 000000000000..d4cf96f07cfc
--- /dev/null
+++ b/include/linux/mailbox_controller.h
@@ -0,0 +1,133 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 */
6
7#ifndef __MAILBOX_CONTROLLER_H
8#define __MAILBOX_CONTROLLER_H
9
10#include <linux/of.h>
11#include <linux/types.h>
12#include <linux/timer.h>
13#include <linux/device.h>
14#include <linux/completion.h>
15
16struct mbox_chan;
17
18/**
19 * struct mbox_chan_ops - methods to control mailbox channels
20 * @send_data: The API asks the MBOX controller driver, in atomic
21 * context try to transmit a message on the bus. Returns 0 if
22 * data is accepted for transmission, -EBUSY while rejecting
23 * if the remote hasn't yet read the last data sent. Actual
24 * transmission of data is reported by the controller via
25 * mbox_chan_txdone (if it has some TX ACK irq). It must not
26 * sleep.
27 * @startup: Called when a client requests the chan. The controller
28 * could ask clients for additional parameters of communication
29 * to be provided via client's chan_data. This call may
30 * block. After this call the Controller must forward any
31 * data received on the chan by calling mbox_chan_received_data.
32 * The controller may do stuff that need to sleep.
33 * @shutdown: Called when a client relinquishes control of a chan.
34 * This call may block too. The controller must not forward
35 * any received data anymore.
36 * The controller may do stuff that need to sleep.
37 * @last_tx_done: If the controller sets 'txdone_poll', the API calls
38 * this to poll status of last TX. The controller must
39 * give priority to IRQ method over polling and never
40 * set both txdone_poll and txdone_irq. Only in polling
41 * mode 'send_data' is expected to return -EBUSY.
42 * The controller may do stuff that need to sleep/block.
43 * Used only if txdone_poll:=true && txdone_irq:=false
44 * @peek_data: Atomic check for any received data. Return true if controller
45 * has some data to push to the client. False otherwise.
46 */
47struct mbox_chan_ops {
48 int (*send_data)(struct mbox_chan *chan, void *data);
49 int (*startup)(struct mbox_chan *chan);
50 void (*shutdown)(struct mbox_chan *chan);
51 bool (*last_tx_done)(struct mbox_chan *chan);
52 bool (*peek_data)(struct mbox_chan *chan);
53};
54
55/**
56 * struct mbox_controller - Controller of a class of communication channels
57 * @dev: Device backing this controller
58 * @ops: Operators that work on each communication chan
59 * @chans: Array of channels
60 * @num_chans: Number of channels in the 'chans' array.
61 * @txdone_irq: Indicates if the controller can report to API when
62 * the last transmitted data was read by the remote.
63 * Eg, if it has some TX ACK irq.
64 * @txdone_poll: If the controller can read but not report the TX
65 * done. Ex, some register shows the TX status but
66 * no interrupt rises. Ignored if 'txdone_irq' is set.
67 * @txpoll_period: If 'txdone_poll' is in effect, the API polls for
68 * last TX's status after these many millisecs
69 * @of_xlate: Controller driver specific mapping of channel via DT
70 * @poll: API private. Used to poll for TXDONE on all channels.
71 * @node: API private. To hook into list of controllers.
72 */
73struct mbox_controller {
74 struct device *dev;
75 struct mbox_chan_ops *ops;
76 struct mbox_chan *chans;
77 int num_chans;
78 bool txdone_irq;
79 bool txdone_poll;
80 unsigned txpoll_period;
81 struct mbox_chan *(*of_xlate)(struct mbox_controller *mbox,
82 const struct of_phandle_args *sp);
83 /* Internal to API */
84 struct timer_list poll;
85 struct list_head node;
86};
87
88/*
89 * The length of circular buffer for queuing messages from a client.
90 * 'msg_count' tracks the number of buffered messages while 'msg_free'
91 * is the index where the next message would be buffered.
92 * We shouldn't need it too big because every transfer is interrupt
93 * triggered and if we have lots of data to transfer, the interrupt
94 * latencies are going to be the bottleneck, not the buffer length.
95 * Besides, mbox_send_message could be called from atomic context and
96 * the client could also queue another message from the notifier 'tx_done'
97 * of the last transfer done.
98 * REVISIT: If too many platforms see the "Try increasing MBOX_TX_QUEUE_LEN"
99 * print, it needs to be taken from config option or somesuch.
100 */
101#define MBOX_TX_QUEUE_LEN 20
102
103/**
104 * struct mbox_chan - s/w representation of a communication chan
105 * @mbox: Pointer to the parent/provider of this channel
106 * @txdone_method: Way to detect TXDone chosen by the API
107 * @cl: Pointer to the current owner of this channel
108 * @tx_complete: Transmission completion
109 * @active_req: Currently active request hook
110 * @msg_count: No. of mssg currently queued
111 * @msg_free: Index of next available mssg slot
112 * @msg_data: Hook for data packet
113 * @lock: Serialise access to the channel
114 * @con_priv: Hook for controller driver to attach private data
115 */
116struct mbox_chan {
117 struct mbox_controller *mbox;
118 unsigned txdone_method;
119 struct mbox_client *cl;
120 struct completion tx_complete;
121 void *active_req;
122 unsigned msg_count, msg_free;
123 void *msg_data[MBOX_TX_QUEUE_LEN];
124 spinlock_t lock; /* Serialise access to the channel */
125 void *con_priv;
126};
127
128int mbox_controller_register(struct mbox_controller *mbox); /* can sleep */
129void mbox_controller_unregister(struct mbox_controller *mbox); /* can sleep */
130void mbox_chan_received_data(struct mbox_chan *chan, void *data); /* atomic */
131void mbox_chan_txdone(struct mbox_chan *chan, int r); /* atomic */
132
133#endif /* __MAILBOX_CONTROLLER_H */
diff --git a/include/linux/mei_cl_bus.h b/include/linux/mei_cl_bus.h
index d14af7b722ef..164aad1f9f12 100644
--- a/include/linux/mei_cl_bus.h
+++ b/include/linux/mei_cl_bus.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/uuid.h> 5#include <linux/uuid.h>
6#include <linux/mod_devicetable.h>
6 7
7struct mei_cl_device; 8struct mei_cl_device;
8 9
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index e0752d204d9e..6b75640ef5ab 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -139,48 +139,23 @@ static inline bool mem_cgroup_disabled(void)
139 return false; 139 return false;
140} 140}
141 141
142void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locked, 142struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, bool *locked,
143 unsigned long *flags); 143 unsigned long *flags);
144 144void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool locked,
145extern atomic_t memcg_moving; 145 unsigned long flags);
146 146void mem_cgroup_update_page_stat(struct mem_cgroup *memcg,
147static inline void mem_cgroup_begin_update_page_stat(struct page *page, 147 enum mem_cgroup_stat_index idx, int val);
148 bool *locked, unsigned long *flags) 148
149{ 149static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg,
150 if (mem_cgroup_disabled())
151 return;
152 rcu_read_lock();
153 *locked = false;
154 if (atomic_read(&memcg_moving))
155 __mem_cgroup_begin_update_page_stat(page, locked, flags);
156}
157
158void __mem_cgroup_end_update_page_stat(struct page *page,
159 unsigned long *flags);
160static inline void mem_cgroup_end_update_page_stat(struct page *page,
161 bool *locked, unsigned long *flags)
162{
163 if (mem_cgroup_disabled())
164 return;
165 if (*locked)
166 __mem_cgroup_end_update_page_stat(page, flags);
167 rcu_read_unlock();
168}
169
170void mem_cgroup_update_page_stat(struct page *page,
171 enum mem_cgroup_stat_index idx,
172 int val);
173
174static inline void mem_cgroup_inc_page_stat(struct page *page,
175 enum mem_cgroup_stat_index idx) 150 enum mem_cgroup_stat_index idx)
176{ 151{
177 mem_cgroup_update_page_stat(page, idx, 1); 152 mem_cgroup_update_page_stat(memcg, idx, 1);
178} 153}
179 154
180static inline void mem_cgroup_dec_page_stat(struct page *page, 155static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg,
181 enum mem_cgroup_stat_index idx) 156 enum mem_cgroup_stat_index idx)
182{ 157{
183 mem_cgroup_update_page_stat(page, idx, -1); 158 mem_cgroup_update_page_stat(memcg, idx, -1);
184} 159}
185 160
186unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 161unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
@@ -315,13 +290,14 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
315{ 290{
316} 291}
317 292
318static inline void mem_cgroup_begin_update_page_stat(struct page *page, 293static inline struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page,
319 bool *locked, unsigned long *flags) 294 bool *locked, unsigned long *flags)
320{ 295{
296 return NULL;
321} 297}
322 298
323static inline void mem_cgroup_end_update_page_stat(struct page *page, 299static inline void mem_cgroup_end_page_stat(struct mem_cgroup *memcg,
324 bool *locked, unsigned long *flags) 300 bool locked, unsigned long flags)
325{ 301{
326} 302}
327 303
@@ -343,12 +319,12 @@ static inline bool mem_cgroup_oom_synchronize(bool wait)
343 return false; 319 return false;
344} 320}
345 321
346static inline void mem_cgroup_inc_page_stat(struct page *page, 322static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg,
347 enum mem_cgroup_stat_index idx) 323 enum mem_cgroup_stat_index idx)
348{ 324{
349} 325}
350 326
351static inline void mem_cgroup_dec_page_stat(struct page *page, 327static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg,
352 enum mem_cgroup_stat_index idx) 328 enum mem_cgroup_stat_index idx)
353{ 329{
354} 330}
@@ -440,11 +416,6 @@ void __memcg_kmem_uncharge_pages(struct page *page, int order);
440 416
441int memcg_cache_id(struct mem_cgroup *memcg); 417int memcg_cache_id(struct mem_cgroup *memcg);
442 418
443int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s,
444 struct kmem_cache *root_cache);
445void memcg_free_cache_params(struct kmem_cache *s);
446
447int memcg_update_cache_size(struct kmem_cache *s, int num_groups);
448void memcg_update_array_size(int num_groups); 419void memcg_update_array_size(int num_groups);
449 420
450struct kmem_cache * 421struct kmem_cache *
@@ -574,16 +545,6 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg)
574 return -1; 545 return -1;
575} 546}
576 547
577static inline int memcg_alloc_cache_params(struct mem_cgroup *memcg,
578 struct kmem_cache *s, struct kmem_cache *root_cache)
579{
580 return 0;
581}
582
583static inline void memcg_free_cache_params(struct kmem_cache *s)
584{
585}
586
587static inline struct kmem_cache * 548static inline struct kmem_cache *
588memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp) 549memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
589{ 550{
diff --git a/include/linux/memory.h b/include/linux/memory.h
index bb7384e3c3d8..8b8d8d12348e 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -35,7 +35,7 @@ struct memory_block {
35}; 35};
36 36
37int arch_get_memory_phys_device(unsigned long start_pfn); 37int arch_get_memory_phys_device(unsigned long start_pfn);
38unsigned long __weak memory_block_size_bytes(void); 38unsigned long memory_block_size_bytes(void);
39 39
40/* These states are exposed to userspace as text strings in sysfs */ 40/* These states are exposed to userspace as text strings in sysfs */
41#define MEM_ONLINE (1<<0) /* exposed to userspace */ 41#define MEM_ONLINE (1<<0) /* exposed to userspace */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index d9524c49d767..8f1a41951df9 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -84,6 +84,7 @@ extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages);
84extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); 84extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
85/* VM interface that may be used by firmware interface */ 85/* VM interface that may be used by firmware interface */
86extern int online_pages(unsigned long, unsigned long, int); 86extern int online_pages(unsigned long, unsigned long, int);
87extern int test_pages_in_a_zone(unsigned long, unsigned long);
87extern void __offline_isolated_pages(unsigned long, unsigned long); 88extern void __offline_isolated_pages(unsigned long, unsigned long);
88 89
89typedef void (*online_page_callback_t)(struct page *page); 90typedef void (*online_page_callback_t)(struct page *page);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index f230a978e6ba..3d385c81c153 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -134,9 +134,10 @@ void mpol_free_shared_policy(struct shared_policy *p);
134struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, 134struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
135 unsigned long idx); 135 unsigned long idx);
136 136
137struct mempolicy *get_vma_policy(struct task_struct *tsk, 137struct mempolicy *get_task_policy(struct task_struct *p);
138 struct vm_area_struct *vma, unsigned long addr); 138struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
139bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma); 139 unsigned long addr);
140bool vma_policy_mof(struct vm_area_struct *vma);
140 141
141extern void numa_default_policy(void); 142extern void numa_default_policy(void);
142extern void numa_policy_init(void); 143extern void numa_policy_init(void);
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index dbd23c36de21..c0b075f6bc35 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -27,6 +27,7 @@
27#define ARIZONA_WRITE_SEQUENCER_CTRL_0 0x16 27#define ARIZONA_WRITE_SEQUENCER_CTRL_0 0x16
28#define ARIZONA_WRITE_SEQUENCER_CTRL_1 0x17 28#define ARIZONA_WRITE_SEQUENCER_CTRL_1 0x17
29#define ARIZONA_WRITE_SEQUENCER_CTRL_2 0x18 29#define ARIZONA_WRITE_SEQUENCER_CTRL_2 0x18
30#define ARIZONA_WRITE_SEQUENCER_CTRL_3 0x19
30#define ARIZONA_WRITE_SEQUENCER_PROM 0x1A 31#define ARIZONA_WRITE_SEQUENCER_PROM 0x1A
31#define ARIZONA_TONE_GENERATOR_1 0x20 32#define ARIZONA_TONE_GENERATOR_1 0x20
32#define ARIZONA_TONE_GENERATOR_2 0x21 33#define ARIZONA_TONE_GENERATOR_2 0x21
@@ -70,7 +71,9 @@
70#define ARIZONA_SAMPLE_RATE_3_STATUS 0x10C 71#define ARIZONA_SAMPLE_RATE_3_STATUS 0x10C
71#define ARIZONA_ASYNC_CLOCK_1 0x112 72#define ARIZONA_ASYNC_CLOCK_1 0x112
72#define ARIZONA_ASYNC_SAMPLE_RATE_1 0x113 73#define ARIZONA_ASYNC_SAMPLE_RATE_1 0x113
74#define ARIZONA_ASYNC_SAMPLE_RATE_2 0x114
73#define ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS 0x11B 75#define ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS 0x11B
76#define ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS 0x11C
74#define ARIZONA_OUTPUT_SYSTEM_CLOCK 0x149 77#define ARIZONA_OUTPUT_SYSTEM_CLOCK 0x149
75#define ARIZONA_OUTPUT_ASYNC_CLOCK 0x14A 78#define ARIZONA_OUTPUT_ASYNC_CLOCK 0x14A
76#define ARIZONA_RATE_ESTIMATOR_1 0x152 79#define ARIZONA_RATE_ESTIMATOR_1 0x152
@@ -1664,16 +1667,30 @@
1664/* 1667/*
1665 * R275 (0x113) - Async sample rate 1 1668 * R275 (0x113) - Async sample rate 1
1666 */ 1669 */
1667#define ARIZONA_ASYNC_SAMPLE_RATE_MASK 0x001F /* ASYNC_SAMPLE_RATE - [4:0] */ 1670#define ARIZONA_ASYNC_SAMPLE_RATE_1_MASK 0x001F /* ASYNC_SAMPLE_RATE_1 - [4:0] */
1668#define ARIZONA_ASYNC_SAMPLE_RATE_SHIFT 0 /* ASYNC_SAMPLE_RATE - [4:0] */ 1671#define ARIZONA_ASYNC_SAMPLE_RATE_1_SHIFT 0 /* ASYNC_SAMPLE_RATE_1 - [4:0] */
1669#define ARIZONA_ASYNC_SAMPLE_RATE_WIDTH 5 /* ASYNC_SAMPLE_RATE - [4:0] */ 1672#define ARIZONA_ASYNC_SAMPLE_RATE_1_WIDTH 5 /* ASYNC_SAMPLE_RATE_1 - [4:0] */
1673
1674/*
1675 * R276 (0x114) - Async sample rate 2
1676 */
1677#define ARIZONA_ASYNC_SAMPLE_RATE_2_MASK 0x001F /* ASYNC_SAMPLE_RATE_2 - [4:0] */
1678#define ARIZONA_ASYNC_SAMPLE_RATE_2_SHIFT 0 /* ASYNC_SAMPLE_RATE_2 - [4:0] */
1679#define ARIZONA_ASYNC_SAMPLE_RATE_2_WIDTH 5 /* ASYNC_SAMPLE_RATE_2 - [4:0] */
1670 1680
1671/* 1681/*
1672 * R283 (0x11B) - Async sample rate 1 status 1682 * R283 (0x11B) - Async sample rate 1 status
1673 */ 1683 */
1674#define ARIZONA_ASYNC_SAMPLE_RATE_STS_MASK 0x001F /* ASYNC_SAMPLE_RATE_STS - [4:0] */ 1684#define ARIZONA_ASYNC_SAMPLE_RATE_1_STS_MASK 0x001F /* ASYNC_SAMPLE_RATE_1_STS - [4:0] */
1675#define ARIZONA_ASYNC_SAMPLE_RATE_STS_SHIFT 0 /* ASYNC_SAMPLE_RATE_STS - [4:0] */ 1685#define ARIZONA_ASYNC_SAMPLE_RATE_1_STS_SHIFT 0 /* ASYNC_SAMPLE_RATE_1_STS - [4:0] */
1676#define ARIZONA_ASYNC_SAMPLE_RATE_STS_WIDTH 5 /* ASYNC_SAMPLE_RATE_STS - [4:0] */ 1686#define ARIZONA_ASYNC_SAMPLE_RATE_1_STS_WIDTH 5 /* ASYNC_SAMPLE_RATE_1_STS - [4:0] */
1687
1688/*
1689 * R284 (0x11C) - Async sample rate 2 status
1690 */
1691#define ARIZONA_ASYNC_SAMPLE_RATE_2_STS_MASK 0x001F /* ASYNC_SAMPLE_RATE_2_STS - [4:0] */
1692#define ARIZONA_ASYNC_SAMPLE_RATE_2_STS_SHIFT 0 /* ASYNC_SAMPLE_RATE_2_STS - [4:0] */
1693#define ARIZONA_ASYNC_SAMPLE_RATE_2_STS_WIDTH 5 /* ASYNC_SAMPLE_RATE_2_STS - [4:0] */
1677 1694
1678/* 1695/*
1679 * R329 (0x149) - Output system clock 1696 * R329 (0x149) - Output system clock
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index f543de91ce19..73e1709d4c09 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -44,6 +44,9 @@ struct mfd_cell {
44 */ 44 */
45 const char *of_compatible; 45 const char *of_compatible;
46 46
47 /* Matches ACPI PNP id, either _HID or _CID */
48 const char *acpi_pnpid;
49
47 /* 50 /*
48 * These resources can be specified relative to the parent device. 51 * These resources can be specified relative to the parent device.
49 * For accessing hardware you should use resources from the platform dev 52 * For accessing hardware you should use resources from the platform dev
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index fcbe9d129a9d..0e166b92f5b4 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -62,10 +62,6 @@ struct cros_ec_command {
62 * @dev: Device pointer 62 * @dev: Device pointer
63 * @was_wake_device: true if this device was set to wake the system from 63 * @was_wake_device: true if this device was set to wake the system from
64 * sleep at the last suspend 64 * sleep at the last suspend
65 * @cmd_xfer: send command to EC and get response
66 * Returns the number of bytes received if the communication succeeded, but
67 * that doesn't mean the EC was happy with the command. The caller
68 * should check msg.result for the EC's result code.
69 * 65 *
70 * @priv: Private data 66 * @priv: Private data
71 * @irq: Interrupt to use 67 * @irq: Interrupt to use
@@ -82,6 +78,10 @@ struct cros_ec_command {
82 * @dout_size: size of dout buffer to allocate (zero to use static dout) 78 * @dout_size: size of dout buffer to allocate (zero to use static dout)
83 * @parent: pointer to parent device (e.g. i2c or spi device) 79 * @parent: pointer to parent device (e.g. i2c or spi device)
84 * @wake_enabled: true if this device can wake the system from sleep 80 * @wake_enabled: true if this device can wake the system from sleep
81 * @cmd_xfer: send command to EC and get response
82 * Returns the number of bytes received if the communication succeeded, but
83 * that doesn't mean the EC was happy with the command. The caller
84 * should check msg.result for the EC's result code.
85 * @lock: one transaction at a time 85 * @lock: one transaction at a time
86 */ 86 */
87struct cros_ec_device { 87struct cros_ec_device {
@@ -92,8 +92,6 @@ struct cros_ec_device {
92 struct device *dev; 92 struct device *dev;
93 bool was_wake_device; 93 bool was_wake_device;
94 struct class *cros_class; 94 struct class *cros_class;
95 int (*cmd_xfer)(struct cros_ec_device *ec,
96 struct cros_ec_command *msg);
97 95
98 /* These are used to implement the platform-specific interface */ 96 /* These are used to implement the platform-specific interface */
99 void *priv; 97 void *priv;
@@ -104,6 +102,8 @@ struct cros_ec_device {
104 int dout_size; 102 int dout_size;
105 struct device *parent; 103 struct device *parent;
106 bool wake_enabled; 104 bool wake_enabled;
105 int (*cmd_xfer)(struct cros_ec_device *ec,
106 struct cros_ec_command *msg);
107 struct mutex lock; 107 struct mutex lock;
108}; 108};
109 109
@@ -153,6 +153,18 @@ int cros_ec_check_result(struct cros_ec_device *ec_dev,
153 struct cros_ec_command *msg); 153 struct cros_ec_command *msg);
154 154
155/** 155/**
156 * cros_ec_cmd_xfer - Send a command to the ChromeOS EC
157 *
158 * Call this to send a command to the ChromeOS EC. This should be used
159 * instead of calling the EC's cmd_xfer() callback directly.
160 *
161 * @ec_dev: EC device
162 * @msg: Message to write
163 */
164int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
165 struct cros_ec_command *msg);
166
167/**
156 * cros_ec_remove - Remove a ChromeOS EC 168 * cros_ec_remove - Remove a ChromeOS EC
157 * 169 *
158 * Call this to deregister a ChromeOS EC, then clean up any private data. 170 * Call this to deregister a ChromeOS EC, then clean up any private data.
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 7853a6410d14..a49cd41feea7 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -1928,9 +1928,6 @@ struct ec_response_power_info {
1928 1928
1929#define EC_CMD_I2C_PASSTHRU 0x9e 1929#define EC_CMD_I2C_PASSTHRU 0x9e
1930 1930
1931/* Slave address is 10 (not 7) bit */
1932#define EC_I2C_FLAG_10BIT (1 << 16)
1933
1934/* Read data; if not present, message is a write */ 1931/* Read data; if not present, message is a write */
1935#define EC_I2C_FLAG_READ (1 << 15) 1932#define EC_I2C_FLAG_READ (1 << 15)
1936 1933
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index bba65f51a0b5..c18a4c19d6fc 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -211,7 +211,7 @@ static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
211int da9052_device_init(struct da9052 *da9052, u8 chip_id); 211int da9052_device_init(struct da9052 *da9052, u8 chip_id);
212void da9052_device_exit(struct da9052 *da9052); 212void da9052_device_exit(struct da9052 *da9052);
213 213
214extern struct regmap_config da9052_regmap_config; 214extern const struct regmap_config da9052_regmap_config;
215 215
216int da9052_irq_init(struct da9052 *da9052); 216int da9052_irq_init(struct da9052 *da9052);
217int da9052_irq_exit(struct da9052 *da9052); 217int da9052_irq_exit(struct da9052 *da9052);
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 5166935ce66d..cb01496bfa49 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_ 23#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_
24#define __LINUX_MFD_DAVINIC_VOICECODEC_H_ 24#define __LINUX_MFD_DAVINCI_VOICECODEC_H_
25 25
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
diff --git a/include/linux/mfd/hi6421-pmic.h b/include/linux/mfd/hi6421-pmic.h
new file mode 100644
index 000000000000..587273e35acf
--- /dev/null
+++ b/include/linux/mfd/hi6421-pmic.h
@@ -0,0 +1,41 @@
1/*
2 * Header file for device driver Hi6421 PMIC
3 *
4 * Copyright (c) <2011-2014> HiSilicon Technologies Co., Ltd.
5 * http://www.hisilicon.com
6 * Copyright (c) <2013-2014> Linaro Ltd.
7 * http://www.linaro.org
8 *
9 * Author: Guodong Xu <guodong.xu@linaro.org>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __HI6421_PMIC_H
17#define __HI6421_PMIC_H
18
19/* Hi6421 registers are mapped to memory bus in 4 bytes stride */
20#define HI6421_REG_TO_BUS_ADDR(x) (x << 2)
21
22/* Hi6421 maximum register number */
23#define HI6421_REG_MAX 0xFF
24
25/* Hi6421 OCP (over current protection) and DEB (debounce) control register */
26#define HI6421_OCP_DEB_CTRL_REG HI6421_REG_TO_BUS_ADDR(0x51)
27#define HI6421_OCP_DEB_SEL_MASK 0x0C
28#define HI6421_OCP_DEB_SEL_8MS 0x00
29#define HI6421_OCP_DEB_SEL_16MS 0x04
30#define HI6421_OCP_DEB_SEL_32MS 0x08
31#define HI6421_OCP_DEB_SEL_64MS 0x0C
32#define HI6421_OCP_EN_DEBOUNCE_MASK 0x02
33#define HI6421_OCP_EN_DEBOUNCE_ENABLE 0x02
34#define HI6421_OCP_AUTO_STOP_MASK 0x01
35#define HI6421_OCP_AUTO_STOP_ENABLE 0x01
36
37struct hi6421_pmic {
38 struct regmap *regmap;
39};
40
41#endif /* __HI6421_PMIC_H */
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index 499253604026..f01c1fae4d84 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -72,15 +72,33 @@ enum max14577_muic_reg {
72 MAX14577_MUIC_REG_END, 72 MAX14577_MUIC_REG_END,
73}; 73};
74 74
75/*
76 * Combined charger types for max14577 and max77836.
77 *
78 * On max14577 three lower bits map to STATUS2/CHGTYP field.
79 * However the max77836 has different two last values of STATUS2/CHGTYP.
80 * To indicate the difference enum has two additional values for max77836.
81 * These values are just a register value bitwise OR with 0x8.
82 */
75enum max14577_muic_charger_type { 83enum max14577_muic_charger_type {
76 MAX14577_CHARGER_TYPE_NONE = 0, 84 MAX14577_CHARGER_TYPE_NONE = 0x0,
77 MAX14577_CHARGER_TYPE_USB, 85 MAX14577_CHARGER_TYPE_USB = 0x1,
78 MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT, 86 MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT = 0x2,
79 MAX14577_CHARGER_TYPE_DEDICATED_CHG, 87 MAX14577_CHARGER_TYPE_DEDICATED_CHG = 0x3,
80 MAX14577_CHARGER_TYPE_SPECIAL_500MA, 88 MAX14577_CHARGER_TYPE_SPECIAL_500MA = 0x4,
81 MAX14577_CHARGER_TYPE_SPECIAL_1A, 89 /* Special 1A or 2A charger */
82 MAX14577_CHARGER_TYPE_RESERVED, 90 MAX14577_CHARGER_TYPE_SPECIAL_1A = 0x5,
83 MAX14577_CHARGER_TYPE_DEAD_BATTERY = 7, 91 /* max14577: reserved, used on max77836 */
92 MAX14577_CHARGER_TYPE_RESERVED = 0x6,
93 /* max14577: dead-battery charing with maximum current 100mA */
94 MAX14577_CHARGER_TYPE_DEAD_BATTERY = 0x7,
95 /*
96 * max77836: special charger (bias on D+/D-),
97 * matches register value of 0x6
98 */
99 MAX77836_CHARGER_TYPE_SPECIAL_BIAS = 0xe,
100 /* max77836: reserved, register value 0x7 */
101 MAX77836_CHARGER_TYPE_RESERVED = 0xf,
84}; 102};
85 103
86/* MAX14577 interrupts */ 104/* MAX14577 interrupts */
@@ -121,13 +139,15 @@ enum max14577_muic_charger_type {
121#define STATUS2_CHGTYP_SHIFT 0 139#define STATUS2_CHGTYP_SHIFT 0
122#define STATUS2_CHGDETRUN_SHIFT 3 140#define STATUS2_CHGDETRUN_SHIFT 3
123#define STATUS2_DCDTMR_SHIFT 4 141#define STATUS2_DCDTMR_SHIFT 4
124#define STATUS2_DBCHG_SHIFT 5 142#define MAX14577_STATUS2_DBCHG_SHIFT 5
143#define MAX77836_STATUS2_DXOVP_SHIFT 5
125#define STATUS2_VBVOLT_SHIFT 6 144#define STATUS2_VBVOLT_SHIFT 6
126#define MAX77836_STATUS2_VIDRM_SHIFT 7 145#define MAX77836_STATUS2_VIDRM_SHIFT 7
127#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT) 146#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
128#define STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT) 147#define STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT)
129#define STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT) 148#define STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT)
130#define STATUS2_DBCHG_MASK BIT(STATUS2_DBCHG_SHIFT) 149#define MAX14577_STATUS2_DBCHG_MASK BIT(MAX14577_STATUS2_DBCHG_SHIFT)
150#define MAX77836_STATUS2_DXOVP_MASK BIT(MAX77836_STATUS2_DXOVP_SHIFT)
131#define STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT) 151#define STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT)
132#define MAX77836_STATUS2_VIDRM_MASK BIT(MAX77836_STATUS2_VIDRM_SHIFT) 152#define MAX77836_STATUS2_VIDRM_MASK BIT(MAX77836_STATUS2_VIDRM_SHIFT)
133 153
@@ -177,9 +197,11 @@ enum max14577_muic_charger_type {
177#define CTRL3_JIGSET_SHIFT 0 197#define CTRL3_JIGSET_SHIFT 0
178#define CTRL3_BOOTSET_SHIFT 2 198#define CTRL3_BOOTSET_SHIFT 2
179#define CTRL3_ADCDBSET_SHIFT 4 199#define CTRL3_ADCDBSET_SHIFT 4
200#define CTRL3_WBTH_SHIFT 6
180#define CTRL3_JIGSET_MASK (0x3 << CTRL3_JIGSET_SHIFT) 201#define CTRL3_JIGSET_MASK (0x3 << CTRL3_JIGSET_SHIFT)
181#define CTRL3_BOOTSET_MASK (0x3 << CTRL3_BOOTSET_SHIFT) 202#define CTRL3_BOOTSET_MASK (0x3 << CTRL3_BOOTSET_SHIFT)
182#define CTRL3_ADCDBSET_MASK (0x3 << CTRL3_ADCDBSET_SHIFT) 203#define CTRL3_ADCDBSET_MASK (0x3 << CTRL3_ADCDBSET_SHIFT)
204#define CTRL3_WBTH_MASK (0x3 << CTRL3_WBTH_SHIFT)
183 205
184/* Slave addr = 0x4A: Charger */ 206/* Slave addr = 0x4A: Charger */
185enum max14577_charger_reg { 207enum max14577_charger_reg {
@@ -210,16 +232,20 @@ enum max14577_charger_reg {
210#define CDETCTRL1_CHGTYPMAN_SHIFT 1 232#define CDETCTRL1_CHGTYPMAN_SHIFT 1
211#define CDETCTRL1_DCDEN_SHIFT 2 233#define CDETCTRL1_DCDEN_SHIFT 2
212#define CDETCTRL1_DCD2SCT_SHIFT 3 234#define CDETCTRL1_DCD2SCT_SHIFT 3
213#define CDETCTRL1_DCHKTM_SHIFT 4 235#define MAX14577_CDETCTRL1_DCHKTM_SHIFT 4
214#define CDETCTRL1_DBEXIT_SHIFT 5 236#define MAX77836_CDETCTRL1_CDLY_SHIFT 4
237#define MAX14577_CDETCTRL1_DBEXIT_SHIFT 5
238#define MAX77836_CDETCTRL1_DCDCPL_SHIFT 5
215#define CDETCTRL1_DBIDLE_SHIFT 6 239#define CDETCTRL1_DBIDLE_SHIFT 6
216#define CDETCTRL1_CDPDET_SHIFT 7 240#define CDETCTRL1_CDPDET_SHIFT 7
217#define CDETCTRL1_CHGDETEN_MASK BIT(CDETCTRL1_CHGDETEN_SHIFT) 241#define CDETCTRL1_CHGDETEN_MASK BIT(CDETCTRL1_CHGDETEN_SHIFT)
218#define CDETCTRL1_CHGTYPMAN_MASK BIT(CDETCTRL1_CHGTYPMAN_SHIFT) 242#define CDETCTRL1_CHGTYPMAN_MASK BIT(CDETCTRL1_CHGTYPMAN_SHIFT)
219#define CDETCTRL1_DCDEN_MASK BIT(CDETCTRL1_DCDEN_SHIFT) 243#define CDETCTRL1_DCDEN_MASK BIT(CDETCTRL1_DCDEN_SHIFT)
220#define CDETCTRL1_DCD2SCT_MASK BIT(CDETCTRL1_DCD2SCT_SHIFT) 244#define CDETCTRL1_DCD2SCT_MASK BIT(CDETCTRL1_DCD2SCT_SHIFT)
221#define CDETCTRL1_DCHKTM_MASK BIT(CDETCTRL1_DCHKTM_SHIFT) 245#define MAX14577_CDETCTRL1_DCHKTM_MASK BIT(MAX14577_CDETCTRL1_DCHKTM_SHIFT)
222#define CDETCTRL1_DBEXIT_MASK BIT(CDETCTRL1_DBEXIT_SHIFT) 246#define MAX77836_CDETCTRL1_CDDLY_MASK BIT(MAX77836_CDETCTRL1_CDDLY_SHIFT)
247#define MAX14577_CDETCTRL1_DBEXIT_MASK BIT(MAX14577_CDETCTRL1_DBEXIT_SHIFT)
248#define MAX77836_CDETCTRL1_DCDCPL_MASK BIT(MAX77836_CDETCTRL1_DCDCPL_SHIFT)
223#define CDETCTRL1_DBIDLE_MASK BIT(CDETCTRL1_DBIDLE_SHIFT) 249#define CDETCTRL1_DBIDLE_MASK BIT(CDETCTRL1_DBIDLE_SHIFT)
224#define CDETCTRL1_CDPDET_MASK BIT(CDETCTRL1_CDPDET_SHIFT) 250#define CDETCTRL1_CDPDET_MASK BIT(CDETCTRL1_CDPDET_SHIFT)
225 251
@@ -255,17 +281,36 @@ enum max14577_charger_reg {
255#define CHGCTRL7_OTPCGHCVS_SHIFT 0 281#define CHGCTRL7_OTPCGHCVS_SHIFT 0
256#define CHGCTRL7_OTPCGHCVS_MASK (0x3 << CHGCTRL7_OTPCGHCVS_SHIFT) 282#define CHGCTRL7_OTPCGHCVS_MASK (0x3 << CHGCTRL7_OTPCGHCVS_SHIFT)
257 283
258/* MAX14577 regulator current limits (as in CHGCTRL4 register), uA */ 284/* MAX14577 charger current limits (as in CHGCTRL4 register), uA */
259#define MAX14577_REGULATOR_CURRENT_LIMIT_MIN 90000 285#define MAX14577_CHARGER_CURRENT_LIMIT_MIN 90000U
260#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START 200000 286#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_START 200000U
261#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP 50000 287#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_STEP 50000U
262#define MAX14577_REGULATOR_CURRENT_LIMIT_MAX 950000 288#define MAX14577_CHARGER_CURRENT_LIMIT_MAX 950000U
263 289
264/* MAX77836 regulator current limits (as in CHGCTRL4 register), uA */ 290/* MAX77836 charger current limits (as in CHGCTRL4 register), uA */
265#define MAX77836_REGULATOR_CURRENT_LIMIT_MIN 45000 291#define MAX77836_CHARGER_CURRENT_LIMIT_MIN 45000U
266#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START 100000 292#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_START 100000U
267#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP 25000 293#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_STEP 25000U
268#define MAX77836_REGULATOR_CURRENT_LIMIT_MAX 475000 294#define MAX77836_CHARGER_CURRENT_LIMIT_MAX 475000U
295
296/*
297 * MAX14577 charger End-Of-Charge current limits
298 * (as in CHGCTRL5 register), uA
299 */
300#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN 50000U
301#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP 10000U
302#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX 200000U
303
304/*
305 * MAX14577/MAX77836 Battery Constant Voltage
306 * (as in CHGCTRL3 register), uV
307 */
308#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MIN 4000000U
309#define MAXIM_CHARGER_CONSTANT_VOLTAGE_STEP 20000U
310#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MAX 4350000U
311
312/* Default value for fast charge timer, in hours */
313#define MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT 5
269 314
270/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */ 315/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
271#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000 316#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index c83fbed1c7b6..ccfaf952c31b 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -54,6 +54,13 @@ struct max14577_regulator_platform_data {
54 struct device_node *of_node; 54 struct device_node *of_node;
55}; 55};
56 56
57struct max14577_charger_platform_data {
58 u32 constant_uvolt;
59 u32 fast_charge_uamp;
60 u32 eoc_uamp;
61 u32 ovp_uvolt;
62};
63
57/* 64/*
58 * MAX14577 MFD platform data 65 * MAX14577 MFD platform data
59 */ 66 */
@@ -74,4 +81,27 @@ struct max14577_platform_data {
74 struct max14577_regulator_platform_data *regulators; 81 struct max14577_regulator_platform_data *regulators;
75}; 82};
76 83
84/*
85 * Valid limits of current for max14577 and max77836 chargers.
86 * They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4
87 * register for given chipset.
88 */
89struct maxim_charger_current {
90 /* Minimal current, set in CHGCTRL4/MBCICHWRCL, uA */
91 unsigned int min;
92 /*
93 * Minimal current when high setting is active,
94 * set in CHGCTRL4/MBCICHWRCH, uA
95 */
96 unsigned int high_start;
97 /* Value of one step in high setting, uA */
98 unsigned int high_step;
99 /* Maximum current of high setting, uA */
100 unsigned int max;
101};
102
103extern const struct maxim_charger_current maxim_charger_currents[];
104extern int maxim_charger_calc_reg_current(const struct maxim_charger_current *limits,
105 unsigned int min_ua, unsigned int max_ua, u8 *dst);
106
77#endif /* __MAX14577_H__ */ 107#endif /* __MAX14577_H__ */
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index c466ff3e16b8..582e67f34054 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -46,7 +46,7 @@ enum max77693_pmic_reg {
46 MAX77693_LED_REG_VOUT_FLASH2 = 0x0C, 46 MAX77693_LED_REG_VOUT_FLASH2 = 0x0C,
47 MAX77693_LED_REG_FLASH_INT = 0x0E, 47 MAX77693_LED_REG_FLASH_INT = 0x0E,
48 MAX77693_LED_REG_FLASH_INT_MASK = 0x0F, 48 MAX77693_LED_REG_FLASH_INT_MASK = 0x0F,
49 MAX77693_LED_REG_FLASH_INT_STATUS = 0x10, 49 MAX77693_LED_REG_FLASH_STATUS = 0x10,
50 50
51 MAX77693_PMIC_REG_PMIC_ID1 = 0x20, 51 MAX77693_PMIC_REG_PMIC_ID1 = 0x20,
52 MAX77693_PMIC_REG_PMIC_ID2 = 0x21, 52 MAX77693_PMIC_REG_PMIC_ID2 = 0x21,
@@ -85,6 +85,65 @@ enum max77693_pmic_reg {
85 MAX77693_PMIC_REG_END, 85 MAX77693_PMIC_REG_END,
86}; 86};
87 87
88/* MAX77693 ITORCH register */
89#define TORCH_IOUT1_SHIFT 0
90#define TORCH_IOUT2_SHIFT 4
91#define TORCH_IOUT_MIN 15625
92#define TORCH_IOUT_MAX 250000
93#define TORCH_IOUT_STEP 15625
94
95/* MAX77693 IFLASH1 and IFLASH2 registers */
96#define FLASH_IOUT_MIN 15625
97#define FLASH_IOUT_MAX_1LED 1000000
98#define FLASH_IOUT_MAX_2LEDS 625000
99#define FLASH_IOUT_STEP 15625
100
101/* MAX77693 TORCH_TIMER register */
102#define TORCH_TMR_NO_TIMER 0x40
103#define TORCH_TIMEOUT_MIN 262000
104#define TORCH_TIMEOUT_MAX 15728000
105
106/* MAX77693 FLASH_TIMER register */
107#define FLASH_TMR_LEVEL 0x80
108#define FLASH_TIMEOUT_MIN 62500
109#define FLASH_TIMEOUT_MAX 1000000
110#define FLASH_TIMEOUT_STEP 62500
111
112/* MAX77693 FLASH_EN register */
113#define FLASH_EN_OFF 0x0
114#define FLASH_EN_FLASH 0x1
115#define FLASH_EN_TORCH 0x2
116#define FLASH_EN_ON 0x3
117#define FLASH_EN_SHIFT(x) (6 - ((x) - 1) * 2)
118#define TORCH_EN_SHIFT(x) (2 - ((x) - 1) * 2)
119
120/* MAX77693 MAX_FLASH1 register */
121#define MAX_FLASH1_MAX_FL_EN 0x80
122#define MAX_FLASH1_VSYS_MIN 2400
123#define MAX_FLASH1_VSYS_MAX 3400
124#define MAX_FLASH1_VSYS_STEP 33
125
126/* MAX77693 VOUT_CNTL register */
127#define FLASH_BOOST_FIXED 0x04
128#define FLASH_BOOST_LEDNUM_2 0x80
129
130/* MAX77693 VOUT_FLASH1 register */
131#define FLASH_VOUT_MIN 3300
132#define FLASH_VOUT_MAX 5500
133#define FLASH_VOUT_STEP 25
134#define FLASH_VOUT_RMIN 0x0c
135
136/* MAX77693 FLASH_STATUS register */
137#define FLASH_STATUS_FLASH_ON BIT(3)
138#define FLASH_STATUS_TORCH_ON BIT(2)
139
140/* MAX77693 FLASH_INT register */
141#define FLASH_INT_FLED2_OPEN BIT(0)
142#define FLASH_INT_FLED2_SHORT BIT(1)
143#define FLASH_INT_FLED1_OPEN BIT(2)
144#define FLASH_INT_FLED1_SHORT BIT(3)
145#define FLASH_INT_OVER_CURRENT BIT(4)
146
88/* MAX77693 CHG_CNFG_00 register */ 147/* MAX77693 CHG_CNFG_00 register */
89#define CHG_CNFG_00_CHG_MASK 0x1 148#define CHG_CNFG_00_CHG_MASK 0x1
90#define CHG_CNFG_00_BUCK_MASK 0x4 149#define CHG_CNFG_00_BUCK_MASK 0x4
@@ -251,6 +310,15 @@ enum max77693_haptic_reg {
251 MAX77693_HAPTIC_REG_END, 310 MAX77693_HAPTIC_REG_END,
252}; 311};
253 312
313/* max77693-pmic LSCNFG configuraton register */
314#define MAX77693_PMIC_LOW_SYS_MASK 0x80
315#define MAX77693_PMIC_LOW_SYS_SHIFT 7
316
317/* max77693-haptic configuration register */
318#define MAX77693_CONFIG2_MODE 7
319#define MAX77693_CONFIG2_MEN 6
320#define MAX77693_CONFIG2_HTYP 5
321
254enum max77693_irq_source { 322enum max77693_irq_source {
255 LED_INT = 0, 323 LED_INT = 0,
256 TOPSYS_INT, 324 TOPSYS_INT,
@@ -262,6 +330,13 @@ enum max77693_irq_source {
262 MAX77693_IRQ_GROUP_NR, 330 MAX77693_IRQ_GROUP_NR,
263}; 331};
264 332
333#define SRC_IRQ_CHARGER BIT(0)
334#define SRC_IRQ_TOP BIT(1)
335#define SRC_IRQ_FLASH BIT(2)
336#define SRC_IRQ_MUIC BIT(3)
337#define SRC_IRQ_ALL (SRC_IRQ_CHARGER | SRC_IRQ_TOP \
338 | SRC_IRQ_FLASH | SRC_IRQ_MUIC)
339
265#define LED_IRQ_FLED2_OPEN BIT(0) 340#define LED_IRQ_FLED2_OPEN BIT(0)
266#define LED_IRQ_FLED2_SHORT BIT(1) 341#define LED_IRQ_FLED2_SHORT BIT(1)
267#define LED_IRQ_FLED1_OPEN BIT(2) 342#define LED_IRQ_FLED1_OPEN BIT(2)
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 3f3dc45f93ee..f0b6585cd874 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -63,6 +63,45 @@ struct max77693_muic_platform_data {
63 int path_uart; 63 int path_uart;
64}; 64};
65 65
66/* MAX77693 led flash */
67
68/* triggers */
69enum max77693_led_trigger {
70 MAX77693_LED_TRIG_OFF,
71 MAX77693_LED_TRIG_FLASH,
72 MAX77693_LED_TRIG_TORCH,
73 MAX77693_LED_TRIG_EXT,
74 MAX77693_LED_TRIG_SOFT,
75};
76
77/* trigger types */
78enum max77693_led_trigger_type {
79 MAX77693_LED_TRIG_TYPE_EDGE,
80 MAX77693_LED_TRIG_TYPE_LEVEL,
81};
82
83/* boost modes */
84enum max77693_led_boost_mode {
85 MAX77693_LED_BOOST_NONE,
86 MAX77693_LED_BOOST_ADAPTIVE,
87 MAX77693_LED_BOOST_FIXED,
88};
89
90struct max77693_led_platform_data {
91 u32 fleds[2];
92 u32 iout_torch[2];
93 u32 iout_flash[2];
94 u32 trigger[2];
95 u32 trigger_type[2];
96 u32 num_leds;
97 u32 boost_mode;
98 u32 flash_timeout;
99 u32 boost_vout;
100 u32 low_vsys;
101};
102
103/* MAX77693 */
104
66struct max77693_platform_data { 105struct max77693_platform_data {
67 /* regulator data */ 106 /* regulator data */
68 struct max77693_regulator_data *regulators; 107 struct max77693_regulator_data *regulators;
@@ -70,5 +109,6 @@ struct max77693_platform_data {
70 109
71 /* muic data */ 110 /* muic data */
72 struct max77693_muic_platform_data *muic_data; 111 struct max77693_muic_platform_data *muic_data;
112 struct max77693_led_platform_data *led_data;
73}; 113};
74#endif /* __LINUX_MFD_MAX77693_H */ 114#endif /* __LINUX_MFD_MAX77693_H */
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
new file mode 100644
index 000000000000..fb09312d854b
--- /dev/null
+++ b/include/linux/mfd/rk808.h
@@ -0,0 +1,196 @@
1/*
2 * rk808.h for Rockchip RK808
3 *
4 * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
5 *
6 * Author: Chris Zhong <zyw@rock-chips.com>
7 * Author: Zhang Qing <zhangqing@rock-chips.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms and conditions of the GNU General Public License,
11 * version 2, as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 */
18
19#ifndef __LINUX_REGULATOR_rk808_H
20#define __LINUX_REGULATOR_rk808_H
21
22#include <linux/regulator/machine.h>
23#include <linux/regmap.h>
24
25/*
26 * rk808 Global Register Map.
27 */
28
29#define RK808_DCDC1 0 /* (0+RK808_START) */
30#define RK808_LDO1 4 /* (4+RK808_START) */
31#define RK808_NUM_REGULATORS 14
32
33enum rk808_reg {
34 RK808_ID_DCDC1,
35 RK808_ID_DCDC2,
36 RK808_ID_DCDC3,
37 RK808_ID_DCDC4,
38 RK808_ID_LDO1,
39 RK808_ID_LDO2,
40 RK808_ID_LDO3,
41 RK808_ID_LDO4,
42 RK808_ID_LDO5,
43 RK808_ID_LDO6,
44 RK808_ID_LDO7,
45 RK808_ID_LDO8,
46 RK808_ID_SWITCH1,
47 RK808_ID_SWITCH2,
48};
49
50#define RK808_SECONDS_REG 0x00
51#define RK808_MINUTES_REG 0x01
52#define RK808_HOURS_REG 0x02
53#define RK808_DAYS_REG 0x03
54#define RK808_MONTHS_REG 0x04
55#define RK808_YEARS_REG 0x05
56#define RK808_WEEKS_REG 0x06
57#define RK808_ALARM_SECONDS_REG 0x08
58#define RK808_ALARM_MINUTES_REG 0x09
59#define RK808_ALARM_HOURS_REG 0x0a
60#define RK808_ALARM_DAYS_REG 0x0b
61#define RK808_ALARM_MONTHS_REG 0x0c
62#define RK808_ALARM_YEARS_REG 0x0d
63#define RK808_RTC_CTRL_REG 0x10
64#define RK808_RTC_STATUS_REG 0x11
65#define RK808_RTC_INT_REG 0x12
66#define RK808_RTC_COMP_LSB_REG 0x13
67#define RK808_RTC_COMP_MSB_REG 0x14
68#define RK808_CLK32OUT_REG 0x20
69#define RK808_VB_MON_REG 0x21
70#define RK808_THERMAL_REG 0x22
71#define RK808_DCDC_EN_REG 0x23
72#define RK808_LDO_EN_REG 0x24
73#define RK808_SLEEP_SET_OFF_REG1 0x25
74#define RK808_SLEEP_SET_OFF_REG2 0x26
75#define RK808_DCDC_UV_STS_REG 0x27
76#define RK808_DCDC_UV_ACT_REG 0x28
77#define RK808_LDO_UV_STS_REG 0x29
78#define RK808_LDO_UV_ACT_REG 0x2a
79#define RK808_DCDC_PG_REG 0x2b
80#define RK808_LDO_PG_REG 0x2c
81#define RK808_VOUT_MON_TDB_REG 0x2d
82#define RK808_BUCK1_CONFIG_REG 0x2e
83#define RK808_BUCK1_ON_VSEL_REG 0x2f
84#define RK808_BUCK1_SLP_VSEL_REG 0x30
85#define RK808_BUCK1_DVS_VSEL_REG 0x31
86#define RK808_BUCK2_CONFIG_REG 0x32
87#define RK808_BUCK2_ON_VSEL_REG 0x33
88#define RK808_BUCK2_SLP_VSEL_REG 0x34
89#define RK808_BUCK2_DVS_VSEL_REG 0x35
90#define RK808_BUCK3_CONFIG_REG 0x36
91#define RK808_BUCK4_CONFIG_REG 0x37
92#define RK808_BUCK4_ON_VSEL_REG 0x38
93#define RK808_BUCK4_SLP_VSEL_REG 0x39
94#define RK808_BOOST_CONFIG_REG 0x3a
95#define RK808_LDO1_ON_VSEL_REG 0x3b
96#define RK808_LDO1_SLP_VSEL_REG 0x3c
97#define RK808_LDO2_ON_VSEL_REG 0x3d
98#define RK808_LDO2_SLP_VSEL_REG 0x3e
99#define RK808_LDO3_ON_VSEL_REG 0x3f
100#define RK808_LDO3_SLP_VSEL_REG 0x40
101#define RK808_LDO4_ON_VSEL_REG 0x41
102#define RK808_LDO4_SLP_VSEL_REG 0x42
103#define RK808_LDO5_ON_VSEL_REG 0x43
104#define RK808_LDO5_SLP_VSEL_REG 0x44
105#define RK808_LDO6_ON_VSEL_REG 0x45
106#define RK808_LDO6_SLP_VSEL_REG 0x46
107#define RK808_LDO7_ON_VSEL_REG 0x47
108#define RK808_LDO7_SLP_VSEL_REG 0x48
109#define RK808_LDO8_ON_VSEL_REG 0x49
110#define RK808_LDO8_SLP_VSEL_REG 0x4a
111#define RK808_DEVCTRL_REG 0x4b
112#define RK808_INT_STS_REG1 0x4c
113#define RK808_INT_STS_MSK_REG1 0x4d
114#define RK808_INT_STS_REG2 0x4e
115#define RK808_INT_STS_MSK_REG2 0x4f
116#define RK808_IO_POL_REG 0x50
117
118/* IRQ Definitions */
119#define RK808_IRQ_VOUT_LO 0
120#define RK808_IRQ_VB_LO 1
121#define RK808_IRQ_PWRON 2
122#define RK808_IRQ_PWRON_LP 3
123#define RK808_IRQ_HOTDIE 4
124#define RK808_IRQ_RTC_ALARM 5
125#define RK808_IRQ_RTC_PERIOD 6
126#define RK808_IRQ_PLUG_IN_INT 7
127#define RK808_IRQ_PLUG_OUT_INT 8
128#define RK808_NUM_IRQ 9
129
130#define RK808_IRQ_VOUT_LO_MSK BIT(0)
131#define RK808_IRQ_VB_LO_MSK BIT(1)
132#define RK808_IRQ_PWRON_MSK BIT(2)
133#define RK808_IRQ_PWRON_LP_MSK BIT(3)
134#define RK808_IRQ_HOTDIE_MSK BIT(4)
135#define RK808_IRQ_RTC_ALARM_MSK BIT(5)
136#define RK808_IRQ_RTC_PERIOD_MSK BIT(6)
137#define RK808_IRQ_PLUG_IN_INT_MSK BIT(0)
138#define RK808_IRQ_PLUG_OUT_INT_MSK BIT(1)
139
140#define RK808_VBAT_LOW_2V8 0x00
141#define RK808_VBAT_LOW_2V9 0x01
142#define RK808_VBAT_LOW_3V0 0x02
143#define RK808_VBAT_LOW_3V1 0x03
144#define RK808_VBAT_LOW_3V2 0x04
145#define RK808_VBAT_LOW_3V3 0x05
146#define RK808_VBAT_LOW_3V4 0x06
147#define RK808_VBAT_LOW_3V5 0x07
148#define VBAT_LOW_VOL_MASK (0x07 << 0)
149#define EN_VABT_LOW_SHUT_DOWN (0x00 << 4)
150#define EN_VBAT_LOW_IRQ (0x1 << 4)
151#define VBAT_LOW_ACT_MASK (0x1 << 4)
152
153#define BUCK_ILMIN_MASK (7 << 0)
154#define BOOST_ILMIN_MASK (7 << 0)
155#define BUCK1_RATE_MASK (3 << 3)
156#define BUCK2_RATE_MASK (3 << 3)
157#define MASK_ALL 0xff
158
159#define SWITCH2_EN BIT(6)
160#define SWITCH1_EN BIT(5)
161#define DEV_OFF_RST BIT(3)
162
163#define VB_LO_ACT BIT(4)
164#define VB_LO_SEL_3500MV (7 << 0)
165
166#define VOUT_LO_INT BIT(0)
167#define CLK32KOUT2_EN BIT(0)
168
169enum {
170 BUCK_ILMIN_50MA,
171 BUCK_ILMIN_100MA,
172 BUCK_ILMIN_150MA,
173 BUCK_ILMIN_200MA,
174 BUCK_ILMIN_250MA,
175 BUCK_ILMIN_300MA,
176 BUCK_ILMIN_350MA,
177 BUCK_ILMIN_400MA,
178};
179
180enum {
181 BOOST_ILMIN_75MA,
182 BOOST_ILMIN_100MA,
183 BOOST_ILMIN_125MA,
184 BOOST_ILMIN_150MA,
185 BOOST_ILMIN_175MA,
186 BOOST_ILMIN_200MA,
187 BOOST_ILMIN_225MA,
188 BOOST_ILMIN_250MA,
189};
190
191struct rk808 {
192 struct i2c_client *i2c;
193 struct regmap_irq_chip_data *irq_data;
194 struct regmap *regmap;
195};
196#endif /* __LINUX_REGULATOR_rk808_H */
diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h
new file mode 100644
index 000000000000..c72d5344f3b3
--- /dev/null
+++ b/include/linux/mfd/rn5t618.h
@@ -0,0 +1,228 @@
1/*
2 * MFD core driver for Ricoh RN5T618 PMIC
3 *
4 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * You should have received a copy of the GNU General Public License
11 * along with this program. If not, see <http://www.gnu.org/licenses/>.
12 */
13
14#ifndef __LINUX_MFD_RN5T618_H
15#define __LINUX_MFD_RN5T618_H
16
17#include <linux/regmap.h>
18
19#define RN5T618_LSIVER 0x00
20#define RN5T618_OTPVER 0x01
21#define RN5T618_IODAC 0x02
22#define RN5T618_VINDAC 0x03
23#define RN5T618_CPUCNT 0x06
24#define RN5T618_PSWR 0x07
25#define RN5T618_PONHIS 0x09
26#define RN5T618_POFFHIS 0x0a
27#define RN5T618_WATCHDOG 0x0b
28#define RN5T618_WATCHDOGCNT 0x0c
29#define RN5T618_PWRFUNC 0x0d
30#define RN5T618_SLPCNT 0x0e
31#define RN5T618_REPCNT 0x0f
32#define RN5T618_PWRONTIMSET 0x10
33#define RN5T618_NOETIMSETCNT 0x11
34#define RN5T618_PWRIREN 0x12
35#define RN5T618_PWRIRQ 0x13
36#define RN5T618_PWRMON 0x14
37#define RN5T618_PWRIRSEL 0x15
38#define RN5T618_DC1_SLOT 0x16
39#define RN5T618_DC2_SLOT 0x17
40#define RN5T618_DC3_SLOT 0x18
41#define RN5T618_LDO1_SLOT 0x1b
42#define RN5T618_LDO2_SLOT 0x1c
43#define RN5T618_LDO3_SLOT 0x1d
44#define RN5T618_LDO4_SLOT 0x1e
45#define RN5T618_LDO5_SLOT 0x1f
46#define RN5T618_PSO0_SLOT 0x25
47#define RN5T618_PSO1_SLOT 0x26
48#define RN5T618_PSO2_SLOT 0x27
49#define RN5T618_PSO3_SLOT 0x28
50#define RN5T618_LDORTC1_SLOT 0x2a
51#define RN5T618_DC1CTL 0x2c
52#define RN5T618_DC1CTL2 0x2d
53#define RN5T618_DC2CTL 0x2e
54#define RN5T618_DC2CTL2 0x2f
55#define RN5T618_DC3CTL 0x30
56#define RN5T618_DC3CTL2 0x31
57#define RN5T618_DC1DAC 0x36
58#define RN5T618_DC2DAC 0x37
59#define RN5T618_DC3DAC 0x38
60#define RN5T618_DC1DAC_SLP 0x3b
61#define RN5T618_DC2DAC_SLP 0x3c
62#define RN5T618_DC3DAC_SLP 0x3d
63#define RN5T618_DCIREN 0x40
64#define RN5T618_DCIRQ 0x41
65#define RN5T618_DCIRMON 0x42
66#define RN5T618_LDOEN1 0x44
67#define RN5T618_LDOEN2 0x45
68#define RN5T618_LDODIS 0x46
69#define RN5T618_LDO1DAC 0x4c
70#define RN5T618_LDO2DAC 0x4d
71#define RN5T618_LDO3DAC 0x4e
72#define RN5T618_LDO4DAC 0x4f
73#define RN5T618_LDO5DAC 0x50
74#define RN5T618_LDORTCDAC 0x56
75#define RN5T618_LDORTC2DAC 0x57
76#define RN5T618_LDO1DAC_SLP 0x58
77#define RN5T618_LDO2DAC_SLP 0x59
78#define RN5T618_LDO3DAC_SLP 0x5a
79#define RN5T618_LDO4DAC_SLP 0x5b
80#define RN5T618_LDO5DAC_SLP 0x5c
81#define RN5T618_ADCCNT1 0x64
82#define RN5T618_ADCCNT2 0x65
83#define RN5T618_ADCCNT3 0x66
84#define RN5T618_ILIMDATAH 0x68
85#define RN5T618_ILIMDATAL 0x69
86#define RN5T618_VBATDATAH 0x6a
87#define RN5T618_VBATDATAL 0x6b
88#define RN5T618_VADPDATAH 0x6c
89#define RN5T618_VADPDATAL 0x6d
90#define RN5T618_VUSBDATAH 0x6e
91#define RN5T618_VUSBDATAL 0x6f
92#define RN5T618_VSYSDATAH 0x70
93#define RN5T618_VSYSDATAL 0x71
94#define RN5T618_VTHMDATAH 0x72
95#define RN5T618_VTHMDATAL 0x73
96#define RN5T618_AIN1DATAH 0x74
97#define RN5T618_AIN1DATAL 0x75
98#define RN5T618_AIN0DATAH 0x76
99#define RN5T618_AIN0DATAL 0x77
100#define RN5T618_ILIMTHL 0x78
101#define RN5T618_ILIMTHH 0x79
102#define RN5T618_VBATTHL 0x7a
103#define RN5T618_VBATTHH 0x7b
104#define RN5T618_VADPTHL 0x7c
105#define RN5T618_VADPTHH 0x7d
106#define RN5T618_VUSBTHL 0x7e
107#define RN5T618_VUSBTHH 0x7f
108#define RN5T618_VSYSTHL 0x80
109#define RN5T618_VSYSTHH 0x81
110#define RN5T618_VTHMTHL 0x82
111#define RN5T618_VTHMTHH 0x83
112#define RN5T618_AIN1THL 0x84
113#define RN5T618_AIN1THH 0x85
114#define RN5T618_AIN0THL 0x86
115#define RN5T618_AIN0THH 0x87
116#define RN5T618_EN_ADCIR1 0x88
117#define RN5T618_EN_ADCIR2 0x89
118#define RN5T618_EN_ADCIR3 0x8a
119#define RN5T618_IR_ADC1 0x8c
120#define RN5T618_IR_ADC2 0x8d
121#define RN5T618_IR_ADC3 0x8e
122#define RN5T618_IOSEL 0x90
123#define RN5T618_IOOUT 0x91
124#define RN5T618_GPEDGE1 0x92
125#define RN5T618_GPEDGE2 0x93
126#define RN5T618_EN_GPIR 0x94
127#define RN5T618_IR_GPR 0x95
128#define RN5T618_IR_GPF 0x96
129#define RN5T618_MON_IOIN 0x97
130#define RN5T618_GPLED_FUNC 0x98
131#define RN5T618_INTPOL 0x9c
132#define RN5T618_INTEN 0x9d
133#define RN5T618_INTMON 0x9e
134#define RN5T618_PREVINDAC 0xb0
135#define RN5T618_BATDAC 0xb1
136#define RN5T618_CHGCTL1 0xb3
137#define RN5T618_CHGCTL2 0xb4
138#define RN5T618_VSYSSET 0xb5
139#define RN5T618_REGISET1 0xb6
140#define RN5T618_REGISET2 0xb7
141#define RN5T618_CHGISET 0xb8
142#define RN5T618_TIMSET 0xb9
143#define RN5T618_BATSET1 0xba
144#define RN5T618_BATSET2 0xbb
145#define RN5T618_DIESET 0xbc
146#define RN5T618_CHGSTATE 0xbd
147#define RN5T618_CHGCTRL_IRFMASK 0xbe
148#define RN5T618_CHGSTAT_IRFMASK1 0xbf
149#define RN5T618_CHGSTAT_IRFMASK2 0xc0
150#define RN5T618_CHGERR_IRFMASK 0xc1
151#define RN5T618_CHGCTRL_IRR 0xc2
152#define RN5T618_CHGSTAT_IRR1 0xc3
153#define RN5T618_CHGSTAT_IRR2 0xc4
154#define RN5T618_CHGERR_IRR 0xc5
155#define RN5T618_CHGCTRL_MONI 0xc6
156#define RN5T618_CHGSTAT_MONI1 0xc7
157#define RN5T618_CHGSTAT_MONI2 0xc8
158#define RN5T618_CHGERR_MONI 0xc9
159#define RN5T618_CHGCTRL_DETMOD1 0xca
160#define RN5T618_CHGCTRL_DETMOD2 0xcb
161#define RN5T618_CHGSTAT_DETMOD1 0xcc
162#define RN5T618_CHGSTAT_DETMOD2 0xcd
163#define RN5T618_CHGSTAT_DETMOD3 0xce
164#define RN5T618_CHGERR_DETMOD1 0xcf
165#define RN5T618_CHGERR_DETMOD2 0xd0
166#define RN5T618_CHGOSCCTL 0xd4
167#define RN5T618_CHGOSCSCORESET1 0xd5
168#define RN5T618_CHGOSCSCORESET2 0xd6
169#define RN5T618_CHGOSCSCORESET3 0xd7
170#define RN5T618_CHGOSCFREQSET1 0xd8
171#define RN5T618_CHGOSCFREQSET2 0xd9
172#define RN5T618_CONTROL 0xe0
173#define RN5T618_SOC 0xe1
174#define RN5T618_RE_CAP_H 0xe2
175#define RN5T618_RE_CAP_L 0xe3
176#define RN5T618_FA_CAP_H 0xe4
177#define RN5T618_FA_CAP_L 0xe5
178#define RN5T618_AGE 0xe6
179#define RN5T618_TT_EMPTY_H 0xe7
180#define RN5T618_TT_EMPTY_L 0xe8
181#define RN5T618_TT_FULL_H 0xe9
182#define RN5T618_TT_FULL_L 0xea
183#define RN5T618_VOLTAGE_1 0xeb
184#define RN5T618_VOLTAGE_0 0xec
185#define RN5T618_TEMP_1 0xed
186#define RN5T618_TEMP_0 0xee
187#define RN5T618_CC_CTRL 0xef
188#define RN5T618_CC_COUNT2 0xf0
189#define RN5T618_CC_COUNT1 0xf1
190#define RN5T618_CC_COUNT0 0xf2
191#define RN5T618_CC_SUMREG3 0xf3
192#define RN5T618_CC_SUMREG2 0xf4
193#define RN5T618_CC_SUMREG1 0xf5
194#define RN5T618_CC_SUMREG0 0xf6
195#define RN5T618_CC_OFFREG1 0xf7
196#define RN5T618_CC_OFFREG0 0xf8
197#define RN5T618_CC_GAINREG1 0xf9
198#define RN5T618_CC_GAINREG0 0xfa
199#define RN5T618_CC_AVEREG1 0xfb
200#define RN5T618_CC_AVEREG0 0xfc
201#define RN5T618_MAX_REG 0xfc
202
203#define RN5T618_REPCNT_REPWRON BIT(0)
204#define RN5T618_SLPCNT_SWPWROFF BIT(0)
205#define RN5T618_WATCHDOG_WDOGEN BIT(2)
206#define RN5T618_WATCHDOG_WDOGTIM_M (BIT(0) | BIT(1))
207#define RN5T618_WATCHDOG_WDOGTIM_S 0
208#define RN5T618_PWRIRQ_IR_WDOG BIT(6)
209
210enum {
211 RN5T618_DCDC1,
212 RN5T618_DCDC2,
213 RN5T618_DCDC3,
214 RN5T618_LDO1,
215 RN5T618_LDO2,
216 RN5T618_LDO3,
217 RN5T618_LDO4,
218 RN5T618_LDO5,
219 RN5T618_LDORTC1,
220 RN5T618_LDORTC2,
221 RN5T618_REG_NUM,
222};
223
224struct rn5t618 {
225 struct regmap *regmap;
226};
227
228#endif /* __LINUX_MFD_RN5T618_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index fb96c84dada5..e2e70053470e 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -155,6 +155,7 @@ struct ti_tscadc_dev {
155 void __iomem *tscadc_base; 155 void __iomem *tscadc_base;
156 int irq; 156 int irq;
157 int used_cells; /* 1-2 */ 157 int used_cells; /* 1-2 */
158 int tsc_wires;
158 int tsc_cell; /* -1 if not used */ 159 int tsc_cell; /* -1 if not used */
159 int adc_cell; /* -1 if not used */ 160 int adc_cell; /* -1 if not used */
160 struct mfd_cell cells[TSCADC_CELLS]; 161 struct mfd_cell cells[TSCADC_CELLS];
diff --git a/include/linux/mfd/ti_ssp.h b/include/linux/mfd/ti_ssp.h
deleted file mode 100644
index dbb4b43bd20e..000000000000
--- a/include/linux/mfd/ti_ssp.h
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Sequencer Serial Port (SSP) driver for Texas Instruments' SoCs
3 *
4 * Copyright (C) 2010 Texas Instruments Inc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __TI_SSP_H__
22#define __TI_SSP_H__
23
24struct ti_ssp_dev_data {
25 const char *dev_name;
26 void *pdata;
27 size_t pdata_size;
28};
29
30struct ti_ssp_data {
31 unsigned long out_clock;
32 struct ti_ssp_dev_data dev_data[2];
33};
34
35struct ti_ssp_spi_data {
36 unsigned long iosel;
37 int num_cs;
38 void (*select)(int cs);
39};
40
41/*
42 * Sequencer port IO pin configuration bits. These do not correlate 1-1 with
43 * the hardware. The iosel field in the port data combines iosel1 and iosel2,
44 * and is therefore not a direct map to register space. It is best to use the
45 * macros below to construct iosel values.
46 *
47 * least significant 16 bits --> iosel1
48 * most significant 16 bits --> iosel2
49 */
50
51#define SSP_IN 0x0000
52#define SSP_DATA 0x0001
53#define SSP_CLOCK 0x0002
54#define SSP_CHIPSEL 0x0003
55#define SSP_OUT 0x0004
56#define SSP_PIN_SEL(pin, v) ((v) << ((pin) * 3))
57#define SSP_PIN_MASK(pin) SSP_PIN_SEL(pin, 0x7)
58#define SSP_INPUT_SEL(pin) ((pin) << 16)
59
60/* Sequencer port config bits */
61#define SSP_EARLY_DIN BIT(8)
62#define SSP_DELAY_DOUT BIT(9)
63
64/* Sequence map definitions */
65#define SSP_CLK_HIGH BIT(0)
66#define SSP_CLK_LOW 0
67#define SSP_DATA_HIGH BIT(1)
68#define SSP_DATA_LOW 0
69#define SSP_CS_HIGH BIT(2)
70#define SSP_CS_LOW 0
71#define SSP_OUT_MODE BIT(3)
72#define SSP_IN_MODE 0
73#define SSP_DATA_REG BIT(4)
74#define SSP_ADDR_REG 0
75
76#define SSP_OPCODE_DIRECT ((0x0) << 5)
77#define SSP_OPCODE_TOGGLE ((0x1) << 5)
78#define SSP_OPCODE_SHIFT ((0x2) << 5)
79#define SSP_OPCODE_BRANCH0 ((0x4) << 5)
80#define SSP_OPCODE_BRANCH1 ((0x5) << 5)
81#define SSP_OPCODE_BRANCH ((0x6) << 5)
82#define SSP_OPCODE_STOP ((0x7) << 5)
83#define SSP_BRANCH(addr) ((addr) << 8)
84#define SSP_COUNT(cycles) ((cycles) << 8)
85
86int ti_ssp_raw_read(struct device *dev);
87int ti_ssp_raw_write(struct device *dev, u32 val);
88int ti_ssp_load(struct device *dev, int offs, u32* prog, int len);
89int ti_ssp_run(struct device *dev, u32 pc, u32 input, u32 *output);
90int ti_ssp_set_mode(struct device *dev, int mode);
91int ti_ssp_set_iosel(struct device *dev, u32 iosel);
92
93#endif /* __TI_SSP_H__ */
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 8f6f2e91e7ae..57388171610d 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -5,6 +5,7 @@
5#include <linux/fb.h> 5#include <linux/fb.h>
6#include <linux/io.h> 6#include <linux/io.h>
7#include <linux/jiffies.h> 7#include <linux/jiffies.h>
8#include <linux/mmc/card.h>
8#include <linux/platform_device.h> 9#include <linux/platform_device.h>
9#include <linux/pm_runtime.h> 10#include <linux/pm_runtime.h>
10 11
@@ -83,6 +84,27 @@
83 */ 84 */
84#define TMIO_MMC_HAVE_HIGH_REG (1 << 6) 85#define TMIO_MMC_HAVE_HIGH_REG (1 << 6)
85 86
87/*
88 * Some controllers have CMD12 automatically
89 * issue/non-issue register
90 */
91#define TMIO_MMC_HAVE_CMD12_CTRL (1 << 7)
92
93/*
94 * Some controllers needs to set 1 on SDIO status reserved bits
95 */
96#define TMIO_MMC_SDIO_STATUS_QUIRK (1 << 8)
97
98/*
99 * Some controllers have DMA enable/disable register
100 */
101#define TMIO_MMC_HAVE_CTL_DMA_REG (1 << 9)
102
103/*
104 * Some controllers allows to set SDx actual clock
105 */
106#define TMIO_MMC_CLK_ACTUAL (1 << 10)
107
86int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 108int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
87int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 109int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
88void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 110void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
@@ -96,6 +118,7 @@ struct tmio_mmc_dma {
96 int slave_id_tx; 118 int slave_id_tx;
97 int slave_id_rx; 119 int slave_id_rx;
98 int alignment_shift; 120 int alignment_shift;
121 dma_addr_t dma_rx_offset;
99 bool (*filter)(struct dma_chan *chan, void *arg); 122 bool (*filter)(struct dma_chan *chan, void *arg);
100}; 123};
101 124
@@ -120,6 +143,8 @@ struct tmio_mmc_data {
120 /* clock management callbacks */ 143 /* clock management callbacks */
121 int (*clk_enable)(struct platform_device *pdev, unsigned int *f); 144 int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
122 void (*clk_disable)(struct platform_device *pdev); 145 void (*clk_disable)(struct platform_device *pdev);
146 int (*multi_io_quirk)(struct mmc_card *card,
147 unsigned int direction, int blk_size);
123}; 148};
124 149
125/* 150/*
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 95d6938737fd..ac7fba44d7e4 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -60,6 +60,8 @@
60#define TPS65217_REG_SEQ5 0X1D 60#define TPS65217_REG_SEQ5 0X1D
61#define TPS65217_REG_SEQ6 0X1E 61#define TPS65217_REG_SEQ6 0X1E
62 62
63#define TPS65217_REG_MAX TPS65217_REG_SEQ6
64
63/* Register field definitions */ 65/* Register field definitions */
64#define TPS65217_CHIPID_CHIP_MASK 0xF0 66#define TPS65217_CHIPID_CHIP_MASK 0xF0
65#define TPS65217_CHIPID_REV_MASK 0x0F 67#define TPS65217_CHIPID_REV_MASK 0x0F
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 2e5b194b9b19..53d33dee70e1 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -37,6 +37,7 @@
37 37
38/* struct phy_device dev_flags definitions */ 38/* struct phy_device dev_flags definitions */
39#define MICREL_PHY_50MHZ_CLK 0x00000001 39#define MICREL_PHY_50MHZ_CLK 0x00000001
40#define MICREL_PHY_25MHZ_CLK 0x00000002
40 41
41#define MICREL_KSZ9021_EXTREG_CTRL 0xB 42#define MICREL_KSZ9021_EXTREG_CTRL 0xB
42#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC 43#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index a2901c414664..01aad3ed89ec 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -13,18 +13,9 @@ typedef void free_page_t(struct page *page, unsigned long private);
13 * Return values from addresss_space_operations.migratepage(): 13 * Return values from addresss_space_operations.migratepage():
14 * - negative errno on page migration failure; 14 * - negative errno on page migration failure;
15 * - zero on page migration success; 15 * - zero on page migration success;
16 *
17 * The balloon page migration introduces this special case where a 'distinct'
18 * return code is used to flag a successful page migration to unmap_and_move().
19 * This approach is necessary because page migration can race against balloon
20 * deflation procedure, and for such case we could introduce a nasty page leak
21 * if a successfully migrated balloon page gets released concurrently with
22 * migration's unmap_and_move() wrap-up steps.
23 */ 16 */
24#define MIGRATEPAGE_SUCCESS 0 17#define MIGRATEPAGE_SUCCESS 0
25#define MIGRATEPAGE_BALLOON_SUCCESS 1 /* special ret code for balloon page 18
26 * sucessful migration case.
27 */
28enum migrate_reason { 19enum migrate_reason {
29 MR_COMPACTION, 20 MR_COMPACTION,
30 MR_MEMORY_FAILURE, 21 MR_MEMORY_FAILURE,
@@ -82,9 +73,6 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
82 return -ENOSYS; 73 return -ENOSYS;
83} 74}
84 75
85/* Possible settings for the migrate_page() method in address_operations */
86#define migrate_page NULL
87
88#endif /* CONFIG_MIGRATION */ 76#endif /* CONFIG_MIGRATION */
89 77
90#ifdef CONFIG_NUMA_BALANCING 78#ifdef CONFIG_NUMA_BALANCING
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a5b7d7cfcedf..37e4404d0227 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -38,6 +38,7 @@
38#include <linux/completion.h> 38#include <linux/completion.h>
39#include <linux/radix-tree.h> 39#include <linux/radix-tree.h>
40#include <linux/cpu_rmap.h> 40#include <linux/cpu_rmap.h>
41#include <linux/crash_dump.h>
41 42
42#include <linux/atomic.h> 43#include <linux/atomic.h>
43 44
@@ -184,19 +185,24 @@ enum {
184 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9, 185 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9,
185 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10, 186 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10,
186 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11, 187 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11,
188 MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 12,
189 MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 13
187}; 190};
188 191
189enum { 192enum {
190 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0, 193 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0,
191 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1 194 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1,
195 MLX4_DEV_CAP_CQE_STRIDE_ENABLED = 1LL << 2,
196 MLX4_DEV_CAP_EQE_STRIDE_ENABLED = 1LL << 3
192}; 197};
193 198
194enum { 199enum {
195 MLX4_USER_DEV_CAP_64B_CQE = 1L << 0 200 MLX4_USER_DEV_CAP_LARGE_CQE = 1L << 0
196}; 201};
197 202
198enum { 203enum {
199 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0 204 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0,
205 MLX4_FUNC_CAP_EQE_CQE_STRIDE = 1L << 1
200}; 206};
201 207
202 208
@@ -577,7 +583,7 @@ struct mlx4_uar {
577}; 583};
578 584
579struct mlx4_bf { 585struct mlx4_bf {
580 unsigned long offset; 586 unsigned int offset;
581 int buf_size; 587 int buf_size;
582 struct mlx4_uar *uar; 588 struct mlx4_uar *uar;
583 void __iomem *reg; 589 void __iomem *reg;
@@ -701,6 +707,7 @@ struct mlx4_dev {
701 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 707 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
702 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 708 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
703 struct mlx4_vf_dev *dev_vfs; 709 struct mlx4_vf_dev *dev_vfs;
710 int nvfs[MLX4_MAX_PORTS + 1];
704}; 711};
705 712
706struct mlx4_eqe { 713struct mlx4_eqe {
@@ -1279,7 +1286,7 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
1279/* Returns true if running in low memory profile (kdump kernel) */ 1286/* Returns true if running in low memory profile (kdump kernel) */
1280static inline bool mlx4_low_memory_profile(void) 1287static inline bool mlx4_low_memory_profile(void)
1281{ 1288{
1282 return reset_devices; 1289 return is_kdump_kernel();
1283} 1290}
1284 1291
1285#endif /* MLX4_DEVICE_H */ 1292#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 334947151dfc..1d67fd32e71c 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -44,6 +44,50 @@
44#error Host endianness not defined 44#error Host endianness not defined
45#endif 45#endif
46 46
47/* helper macros */
48#define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)
49#define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
50#define __mlx5_bit_off(typ, fld) ((unsigned)(unsigned long)(&(__mlx5_nullp(typ)->fld)))
51#define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
52#define __mlx5_64_off(typ, fld) (__mlx5_bit_off(typ, fld) / 64)
53#define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
54#define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
55#define __mlx5_dw_mask(typ, fld) (__mlx5_mask(typ, fld) << __mlx5_dw_bit_off(typ, fld))
56#define __mlx5_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits)
57
58#define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8)
59#define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
60#define MLX5_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32)
61#define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
62#define MLX5_ADDR_OF(typ, p, fld) ((char *)(p) + MLX5_BYTE_OFF(typ, fld))
63
64/* insert a value to a struct */
65#define MLX5_SET(typ, p, fld, v) do { \
66 BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \
67 *((__be32 *)(p) + __mlx5_dw_off(typ, fld)) = \
68 cpu_to_be32((be32_to_cpu(*((__be32 *)(p) + __mlx5_dw_off(typ, fld))) & \
69 (~__mlx5_dw_mask(typ, fld))) | (((v) & __mlx5_mask(typ, fld)) \
70 << __mlx5_dw_bit_off(typ, fld))); \
71} while (0)
72
73#define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
74__mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
75__mlx5_mask(typ, fld))
76
77#define MLX5_GET_PR(typ, p, fld) ({ \
78 u32 ___t = MLX5_GET(typ, p, fld); \
79 pr_debug(#fld " = 0x%x\n", ___t); \
80 ___t; \
81})
82
83#define MLX5_SET64(typ, p, fld, v) do { \
84 BUILD_BUG_ON(__mlx5_bit_sz(typ, fld) != 64); \
85 BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \
86 *((__be64 *)(p) + __mlx5_64_off(typ, fld)) = cpu_to_be64(v); \
87} while (0)
88
89#define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld)))
90
47enum { 91enum {
48 MLX5_MAX_COMMANDS = 32, 92 MLX5_MAX_COMMANDS = 32,
49 MLX5_CMD_DATA_BLOCK_SIZE = 512, 93 MLX5_CMD_DATA_BLOCK_SIZE = 512,
@@ -71,6 +115,11 @@ enum {
71}; 115};
72 116
73enum { 117enum {
118 MLX5_MIN_PKEY_TABLE_SIZE = 128,
119 MLX5_MAX_LOG_PKEY_TABLE = 5,
120};
121
122enum {
74 MLX5_PERM_LOCAL_READ = 1 << 2, 123 MLX5_PERM_LOCAL_READ = 1 << 2,
75 MLX5_PERM_LOCAL_WRITE = 1 << 3, 124 MLX5_PERM_LOCAL_WRITE = 1 << 3,
76 MLX5_PERM_REMOTE_READ = 1 << 4, 125 MLX5_PERM_REMOTE_READ = 1 << 4,
@@ -184,10 +233,10 @@ enum {
184 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, 233 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29,
185 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30, 234 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
186 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32, 235 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
236 MLX5_DEV_CAP_FLAG_DCT = 1LL << 37,
187 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38, 237 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
188 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39, 238 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
189 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40, 239 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
190 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
191 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46, 240 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
192}; 241};
193 242
@@ -243,10 +292,14 @@ enum {
243}; 292};
244 293
245enum { 294enum {
246 MLX5_CAP_OFF_DCT = 41,
247 MLX5_CAP_OFF_CMDIF_CSUM = 46, 295 MLX5_CAP_OFF_CMDIF_CSUM = 46,
248}; 296};
249 297
298enum {
299 HCA_CAP_OPMOD_GET_MAX = 0,
300 HCA_CAP_OPMOD_GET_CUR = 1,
301};
302
250struct mlx5_inbox_hdr { 303struct mlx5_inbox_hdr {
251 __be16 opcode; 304 __be16 opcode;
252 u8 rsvd[4]; 305 u8 rsvd[4];
@@ -274,101 +327,6 @@ struct mlx5_cmd_query_adapter_mbox_out {
274 u8 vsd_psid[16]; 327 u8 vsd_psid[16];
275}; 328};
276 329
277struct mlx5_hca_cap {
278 u8 rsvd1[16];
279 u8 log_max_srq_sz;
280 u8 log_max_qp_sz;
281 u8 rsvd2;
282 u8 log_max_qp;
283 u8 log_max_strq_sz;
284 u8 log_max_srqs;
285 u8 rsvd4[2];
286 u8 rsvd5;
287 u8 log_max_cq_sz;
288 u8 rsvd6;
289 u8 log_max_cq;
290 u8 log_max_eq_sz;
291 u8 log_max_mkey;
292 u8 rsvd7;
293 u8 log_max_eq;
294 u8 max_indirection;
295 u8 log_max_mrw_sz;
296 u8 log_max_bsf_list_sz;
297 u8 log_max_klm_list_sz;
298 u8 rsvd_8_0;
299 u8 log_max_ra_req_dc;
300 u8 rsvd_8_1;
301 u8 log_max_ra_res_dc;
302 u8 rsvd9;
303 u8 log_max_ra_req_qp;
304 u8 rsvd10;
305 u8 log_max_ra_res_qp;
306 u8 rsvd11[4];
307 __be16 max_qp_count;
308 __be16 rsvd12;
309 u8 rsvd13;
310 u8 local_ca_ack_delay;
311 u8 rsvd14;
312 u8 num_ports;
313 u8 log_max_msg;
314 u8 rsvd15[3];
315 __be16 stat_rate_support;
316 u8 rsvd16[2];
317 __be64 flags;
318 u8 rsvd17;
319 u8 uar_sz;
320 u8 rsvd18;
321 u8 log_pg_sz;
322 __be16 bf_log_bf_reg_size;
323 u8 rsvd19[4];
324 __be16 max_desc_sz_sq;
325 u8 rsvd20[2];
326 __be16 max_desc_sz_rq;
327 u8 rsvd21[2];
328 __be16 max_desc_sz_sq_dc;
329 __be32 max_qp_mcg;
330 u8 rsvd22[3];
331 u8 log_max_mcg;
332 u8 rsvd23;
333 u8 log_max_pd;
334 u8 rsvd24;
335 u8 log_max_xrcd;
336 u8 rsvd25[42];
337 __be16 log_uar_page_sz;
338 u8 rsvd26[28];
339 u8 log_max_atomic_size_qp;
340 u8 rsvd27[2];
341 u8 log_max_atomic_size_dc;
342 u8 rsvd28[76];
343};
344
345
346struct mlx5_cmd_query_hca_cap_mbox_in {
347 struct mlx5_inbox_hdr hdr;
348 u8 rsvd[8];
349};
350
351
352struct mlx5_cmd_query_hca_cap_mbox_out {
353 struct mlx5_outbox_hdr hdr;
354 u8 rsvd0[8];
355 struct mlx5_hca_cap hca_cap;
356};
357
358
359struct mlx5_cmd_set_hca_cap_mbox_in {
360 struct mlx5_inbox_hdr hdr;
361 u8 rsvd[8];
362 struct mlx5_hca_cap hca_cap;
363};
364
365
366struct mlx5_cmd_set_hca_cap_mbox_out {
367 struct mlx5_outbox_hdr hdr;
368 u8 rsvd0[8];
369};
370
371
372struct mlx5_cmd_init_hca_mbox_in { 330struct mlx5_cmd_init_hca_mbox_in {
373 struct mlx5_inbox_hdr hdr; 331 struct mlx5_inbox_hdr hdr;
374 u8 rsvd0[2]; 332 u8 rsvd0[2];
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index b88e9b46d957..246310dc8bef 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -44,6 +44,7 @@
44 44
45#include <linux/mlx5/device.h> 45#include <linux/mlx5/device.h>
46#include <linux/mlx5/doorbell.h> 46#include <linux/mlx5/doorbell.h>
47#include <linux/mlx5/mlx5_ifc.h>
47 48
48enum { 49enum {
49 MLX5_BOARD_ID_LEN = 64, 50 MLX5_BOARD_ID_LEN = 64,
@@ -99,81 +100,6 @@ enum {
99}; 100};
100 101
101enum { 102enum {
102 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
103 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
104 MLX5_CMD_OP_INIT_HCA = 0x102,
105 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
106 MLX5_CMD_OP_ENABLE_HCA = 0x104,
107 MLX5_CMD_OP_DISABLE_HCA = 0x105,
108 MLX5_CMD_OP_QUERY_PAGES = 0x107,
109 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
110 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
111
112 MLX5_CMD_OP_CREATE_MKEY = 0x200,
113 MLX5_CMD_OP_QUERY_MKEY = 0x201,
114 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
115 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
116
117 MLX5_CMD_OP_CREATE_EQ = 0x301,
118 MLX5_CMD_OP_DESTROY_EQ = 0x302,
119 MLX5_CMD_OP_QUERY_EQ = 0x303,
120
121 MLX5_CMD_OP_CREATE_CQ = 0x400,
122 MLX5_CMD_OP_DESTROY_CQ = 0x401,
123 MLX5_CMD_OP_QUERY_CQ = 0x402,
124 MLX5_CMD_OP_MODIFY_CQ = 0x403,
125
126 MLX5_CMD_OP_CREATE_QP = 0x500,
127 MLX5_CMD_OP_DESTROY_QP = 0x501,
128 MLX5_CMD_OP_RST2INIT_QP = 0x502,
129 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
130 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
131 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
132 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
133 MLX5_CMD_OP_2ERR_QP = 0x507,
134 MLX5_CMD_OP_RTS2SQD_QP = 0x508,
135 MLX5_CMD_OP_SQD2RTS_QP = 0x509,
136 MLX5_CMD_OP_2RST_QP = 0x50a,
137 MLX5_CMD_OP_QUERY_QP = 0x50b,
138 MLX5_CMD_OP_CONF_SQP = 0x50c,
139 MLX5_CMD_OP_MAD_IFC = 0x50d,
140 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
141 MLX5_CMD_OP_SUSPEND_QP = 0x50f,
142 MLX5_CMD_OP_UNSUSPEND_QP = 0x510,
143 MLX5_CMD_OP_SQD2SQD_QP = 0x511,
144 MLX5_CMD_OP_ALLOC_QP_COUNTER_SET = 0x512,
145 MLX5_CMD_OP_DEALLOC_QP_COUNTER_SET = 0x513,
146 MLX5_CMD_OP_QUERY_QP_COUNTER_SET = 0x514,
147
148 MLX5_CMD_OP_CREATE_PSV = 0x600,
149 MLX5_CMD_OP_DESTROY_PSV = 0x601,
150 MLX5_CMD_OP_QUERY_PSV = 0x602,
151 MLX5_CMD_OP_QUERY_SIG_RULE_TABLE = 0x603,
152 MLX5_CMD_OP_QUERY_BLOCK_SIZE_TABLE = 0x604,
153
154 MLX5_CMD_OP_CREATE_SRQ = 0x700,
155 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
156 MLX5_CMD_OP_QUERY_SRQ = 0x702,
157 MLX5_CMD_OP_ARM_RQ = 0x703,
158 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
159
160 MLX5_CMD_OP_ALLOC_PD = 0x800,
161 MLX5_CMD_OP_DEALLOC_PD = 0x801,
162 MLX5_CMD_OP_ALLOC_UAR = 0x802,
163 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
164
165 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
166 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
167
168
169 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
170 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
171
172 MLX5_CMD_OP_ACCESS_REG = 0x805,
173 MLX5_CMD_OP_MAX = 0x810,
174};
175
176enum {
177 MLX5_REG_PCAP = 0x5001, 103 MLX5_REG_PCAP = 0x5001,
178 MLX5_REG_PMTU = 0x5003, 104 MLX5_REG_PMTU = 0x5003,
179 MLX5_REG_PTYS = 0x5004, 105 MLX5_REG_PTYS = 0x5004,
@@ -335,23 +261,30 @@ struct mlx5_port_caps {
335 int pkey_table_len; 261 int pkey_table_len;
336}; 262};
337 263
338struct mlx5_caps { 264struct mlx5_general_caps {
339 u8 log_max_eq; 265 u8 log_max_eq;
340 u8 log_max_cq; 266 u8 log_max_cq;
341 u8 log_max_qp; 267 u8 log_max_qp;
342 u8 log_max_mkey; 268 u8 log_max_mkey;
343 u8 log_max_pd; 269 u8 log_max_pd;
344 u8 log_max_srq; 270 u8 log_max_srq;
271 u8 log_max_strq;
272 u8 log_max_mrw_sz;
273 u8 log_max_bsf_list_size;
274 u8 log_max_klm_list_size;
345 u32 max_cqes; 275 u32 max_cqes;
346 int max_wqes; 276 int max_wqes;
277 u32 max_eqes;
278 u32 max_indirection;
347 int max_sq_desc_sz; 279 int max_sq_desc_sz;
348 int max_rq_desc_sz; 280 int max_rq_desc_sz;
281 int max_dc_sq_desc_sz;
349 u64 flags; 282 u64 flags;
350 u16 stat_rate_support; 283 u16 stat_rate_support;
351 int log_max_msg; 284 int log_max_msg;
352 int num_ports; 285 int num_ports;
353 int max_ra_res_qp; 286 u8 log_max_ra_res_qp;
354 int max_ra_req_qp; 287 u8 log_max_ra_req_qp;
355 int max_srq_wqes; 288 int max_srq_wqes;
356 int bf_reg_size; 289 int bf_reg_size;
357 int bf_regs_per_page; 290 int bf_regs_per_page;
@@ -363,6 +296,19 @@ struct mlx5_caps {
363 u8 log_max_mcg; 296 u8 log_max_mcg;
364 u32 max_qp_mcg; 297 u32 max_qp_mcg;
365 int min_page_sz; 298 int min_page_sz;
299 int pd_cap;
300 u32 max_qp_counters;
301 u32 pkey_table_size;
302 u8 log_max_ra_req_dc;
303 u8 log_max_ra_res_dc;
304 u32 uar_sz;
305 u8 min_log_pg_sz;
306 u8 log_max_xrcd;
307 u16 log_uar_page_sz;
308};
309
310struct mlx5_caps {
311 struct mlx5_general_caps gen;
366}; 312};
367 313
368struct mlx5_cmd_mailbox { 314struct mlx5_cmd_mailbox {
@@ -429,6 +375,16 @@ struct mlx5_core_mr {
429 u32 pd; 375 u32 pd;
430}; 376};
431 377
378enum mlx5_res_type {
379 MLX5_RES_QP,
380};
381
382struct mlx5_core_rsc_common {
383 enum mlx5_res_type res;
384 atomic_t refcount;
385 struct completion free;
386};
387
432struct mlx5_core_srq { 388struct mlx5_core_srq {
433 u32 srqn; 389 u32 srqn;
434 int max; 390 int max;
@@ -695,6 +651,9 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
695void mlx5_cmd_use_events(struct mlx5_core_dev *dev); 651void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
696void mlx5_cmd_use_polling(struct mlx5_core_dev *dev); 652void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
697int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr); 653int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr);
654int mlx5_cmd_status_to_err_v2(void *ptr);
655int mlx5_core_get_caps(struct mlx5_core_dev *dev, struct mlx5_caps *caps,
656 u16 opmod);
698int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, 657int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
699 int out_size); 658 int out_size);
700int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, 659int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
@@ -751,7 +710,7 @@ int mlx5_eq_init(struct mlx5_core_dev *dev);
751void mlx5_eq_cleanup(struct mlx5_core_dev *dev); 710void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
752void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas); 711void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
753void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn); 712void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
754void mlx5_qp_event(struct mlx5_core_dev *dev, u32 qpn, int event_type); 713void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
755void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); 714void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
756struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); 715struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
757void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector); 716void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector);
@@ -788,6 +747,7 @@ void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
788int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn, 747int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn,
789 int npsvs, u32 *sig_index); 748 int npsvs, u32 *sig_index);
790int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num); 749int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num);
750void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common);
791 751
792static inline u32 mlx5_mkey_to_idx(u32 mkey) 752static inline u32 mlx5_mkey_to_idx(u32 mkey)
793{ 753{
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
new file mode 100644
index 000000000000..5f48b8f592c5
--- /dev/null
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -0,0 +1,349 @@
1/*
2 * Copyright (c) 2014, 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_IFC_H
34#define MLX5_IFC_H
35
36enum {
37 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
38 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
39 MLX5_CMD_OP_INIT_HCA = 0x102,
40 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
41 MLX5_CMD_OP_ENABLE_HCA = 0x104,
42 MLX5_CMD_OP_DISABLE_HCA = 0x105,
43 MLX5_CMD_OP_QUERY_PAGES = 0x107,
44 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
45 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
46 MLX5_CMD_OP_CREATE_MKEY = 0x200,
47 MLX5_CMD_OP_QUERY_MKEY = 0x201,
48 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
49 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
50 MLX5_CMD_OP_PAGE_FAULT_RESUME = 0x204,
51 MLX5_CMD_OP_CREATE_EQ = 0x301,
52 MLX5_CMD_OP_DESTROY_EQ = 0x302,
53 MLX5_CMD_OP_QUERY_EQ = 0x303,
54 MLX5_CMD_OP_GEN_EQE = 0x304,
55 MLX5_CMD_OP_CREATE_CQ = 0x400,
56 MLX5_CMD_OP_DESTROY_CQ = 0x401,
57 MLX5_CMD_OP_QUERY_CQ = 0x402,
58 MLX5_CMD_OP_MODIFY_CQ = 0x403,
59 MLX5_CMD_OP_CREATE_QP = 0x500,
60 MLX5_CMD_OP_DESTROY_QP = 0x501,
61 MLX5_CMD_OP_RST2INIT_QP = 0x502,
62 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
63 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
64 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
65 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
66 MLX5_CMD_OP_2ERR_QP = 0x507,
67 MLX5_CMD_OP_2RST_QP = 0x50a,
68 MLX5_CMD_OP_QUERY_QP = 0x50b,
69 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
70 MLX5_CMD_OP_CREATE_PSV = 0x600,
71 MLX5_CMD_OP_DESTROY_PSV = 0x601,
72 MLX5_CMD_OP_CREATE_SRQ = 0x700,
73 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
74 MLX5_CMD_OP_QUERY_SRQ = 0x702,
75 MLX5_CMD_OP_ARM_RQ = 0x703,
76 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
77 MLX5_CMD_OP_CREATE_DCT = 0x710,
78 MLX5_CMD_OP_DESTROY_DCT = 0x711,
79 MLX5_CMD_OP_DRAIN_DCT = 0x712,
80 MLX5_CMD_OP_QUERY_DCT = 0x713,
81 MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION = 0x714,
82 MLX5_CMD_OP_QUERY_VPORT_STATE = 0x750,
83 MLX5_CMD_OP_MODIFY_VPORT_STATE = 0x751,
84 MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT = 0x752,
85 MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT = 0x753,
86 MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT = 0x754,
87 MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT = 0x755,
88 MLX5_CMD_OP_QUERY_RCOE_ADDRESS = 0x760,
89 MLX5_CMD_OP_SET_ROCE_ADDRESS = 0x761,
90 MLX5_CMD_OP_QUERY_VPORT_COUNTER = 0x770,
91 MLX5_CMD_OP_ALLOC_Q_COUNTER = 0x771,
92 MLX5_CMD_OP_DEALLOC_Q_COUNTER = 0x772,
93 MLX5_CMD_OP_QUERY_Q_COUNTER = 0x773,
94 MLX5_CMD_OP_ALLOC_PD = 0x800,
95 MLX5_CMD_OP_DEALLOC_PD = 0x801,
96 MLX5_CMD_OP_ALLOC_UAR = 0x802,
97 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
98 MLX5_CMD_OP_CONFIG_INT_MODERATION = 0x804,
99 MLX5_CMD_OP_ACCESS_REG = 0x805,
100 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
101 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
102 MLX5_CMD_OP_GET_DROPPED_PACKET_LOG = 0x80a,
103 MLX5_CMD_OP_MAD_IFC = 0x50d,
104 MLX5_CMD_OP_QUERY_MAD_DEMUX = 0x80b,
105 MLX5_CMD_OP_SET_MAD_DEMUX = 0x80c,
106 MLX5_CMD_OP_NOP = 0x80d,
107 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
108 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
109 MLX5_CMD_OP_SET_BURST_SIZE = 0x812,
110 MLX5_CMD_OP_QUERY_BURST_SZIE = 0x813,
111 MLX5_CMD_OP_ACTIVATE_TRACER = 0x814,
112 MLX5_CMD_OP_DEACTIVATE_TRACER = 0x815,
113 MLX5_CMD_OP_CREATE_SNIFFER_RULE = 0x820,
114 MLX5_CMD_OP_DESTROY_SNIFFER_RULE = 0x821,
115 MLX5_CMD_OP_QUERY_CONG_PARAMS = 0x822,
116 MLX5_CMD_OP_MODIFY_CONG_PARAMS = 0x823,
117 MLX5_CMD_OP_QUERY_CONG_STATISTICS = 0x824,
118 MLX5_CMD_OP_CREATE_TIR = 0x900,
119 MLX5_CMD_OP_MODIFY_TIR = 0x901,
120 MLX5_CMD_OP_DESTROY_TIR = 0x902,
121 MLX5_CMD_OP_QUERY_TIR = 0x903,
122 MLX5_CMD_OP_CREATE_TIS = 0x912,
123 MLX5_CMD_OP_MODIFY_TIS = 0x913,
124 MLX5_CMD_OP_DESTROY_TIS = 0x914,
125 MLX5_CMD_OP_QUERY_TIS = 0x915,
126 MLX5_CMD_OP_CREATE_SQ = 0x904,
127 MLX5_CMD_OP_MODIFY_SQ = 0x905,
128 MLX5_CMD_OP_DESTROY_SQ = 0x906,
129 MLX5_CMD_OP_QUERY_SQ = 0x907,
130 MLX5_CMD_OP_CREATE_RQ = 0x908,
131 MLX5_CMD_OP_MODIFY_RQ = 0x909,
132 MLX5_CMD_OP_DESTROY_RQ = 0x90a,
133 MLX5_CMD_OP_QUERY_RQ = 0x90b,
134 MLX5_CMD_OP_CREATE_RMP = 0x90c,
135 MLX5_CMD_OP_MODIFY_RMP = 0x90d,
136 MLX5_CMD_OP_DESTROY_RMP = 0x90e,
137 MLX5_CMD_OP_QUERY_RMP = 0x90f,
138 MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY = 0x910,
139 MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY = 0x911,
140 MLX5_CMD_OP_MAX = 0x911
141};
142
143struct mlx5_ifc_cmd_hca_cap_bits {
144 u8 reserved_0[0x80];
145
146 u8 log_max_srq_sz[0x8];
147 u8 log_max_qp_sz[0x8];
148 u8 reserved_1[0xb];
149 u8 log_max_qp[0x5];
150
151 u8 log_max_strq_sz[0x8];
152 u8 reserved_2[0x3];
153 u8 log_max_srqs[0x5];
154 u8 reserved_3[0x10];
155
156 u8 reserved_4[0x8];
157 u8 log_max_cq_sz[0x8];
158 u8 reserved_5[0xb];
159 u8 log_max_cq[0x5];
160
161 u8 log_max_eq_sz[0x8];
162 u8 reserved_6[0x2];
163 u8 log_max_mkey[0x6];
164 u8 reserved_7[0xc];
165 u8 log_max_eq[0x4];
166
167 u8 max_indirection[0x8];
168 u8 reserved_8[0x1];
169 u8 log_max_mrw_sz[0x7];
170 u8 reserved_9[0x2];
171 u8 log_max_bsf_list_size[0x6];
172 u8 reserved_10[0x2];
173 u8 log_max_klm_list_size[0x6];
174
175 u8 reserved_11[0xa];
176 u8 log_max_ra_req_dc[0x6];
177 u8 reserved_12[0xa];
178 u8 log_max_ra_res_dc[0x6];
179
180 u8 reserved_13[0xa];
181 u8 log_max_ra_req_qp[0x6];
182 u8 reserved_14[0xa];
183 u8 log_max_ra_res_qp[0x6];
184
185 u8 pad_cap[0x1];
186 u8 cc_query_allowed[0x1];
187 u8 cc_modify_allowed[0x1];
188 u8 reserved_15[0x1d];
189
190 u8 reserved_16[0x6];
191 u8 max_qp_cnt[0xa];
192 u8 pkey_table_size[0x10];
193
194 u8 eswitch_owner[0x1];
195 u8 reserved_17[0xa];
196 u8 local_ca_ack_delay[0x5];
197 u8 reserved_18[0x8];
198 u8 num_ports[0x8];
199
200 u8 reserved_19[0x3];
201 u8 log_max_msg[0x5];
202 u8 reserved_20[0x18];
203
204 u8 stat_rate_support[0x10];
205 u8 reserved_21[0x10];
206
207 u8 reserved_22[0x10];
208 u8 cmdif_checksum[0x2];
209 u8 sigerr_cqe[0x1];
210 u8 reserved_23[0x1];
211 u8 wq_signature[0x1];
212 u8 sctr_data_cqe[0x1];
213 u8 reserved_24[0x1];
214 u8 sho[0x1];
215 u8 tph[0x1];
216 u8 rf[0x1];
217 u8 dc[0x1];
218 u8 reserved_25[0x2];
219 u8 roce[0x1];
220 u8 atomic[0x1];
221 u8 rsz_srq[0x1];
222
223 u8 cq_oi[0x1];
224 u8 cq_resize[0x1];
225 u8 cq_moderation[0x1];
226 u8 sniffer_rule_flow[0x1];
227 u8 sniffer_rule_vport[0x1];
228 u8 sniffer_rule_phy[0x1];
229 u8 reserved_26[0x1];
230 u8 pg[0x1];
231 u8 block_lb_mc[0x1];
232 u8 reserved_27[0x3];
233 u8 cd[0x1];
234 u8 reserved_28[0x1];
235 u8 apm[0x1];
236 u8 reserved_29[0x7];
237 u8 qkv[0x1];
238 u8 pkv[0x1];
239 u8 reserved_30[0x4];
240 u8 xrc[0x1];
241 u8 ud[0x1];
242 u8 uc[0x1];
243 u8 rc[0x1];
244
245 u8 reserved_31[0xa];
246 u8 uar_sz[0x6];
247 u8 reserved_32[0x8];
248 u8 log_pg_sz[0x8];
249
250 u8 bf[0x1];
251 u8 reserved_33[0xa];
252 u8 log_bf_reg_size[0x5];
253 u8 reserved_34[0x10];
254
255 u8 reserved_35[0x10];
256 u8 max_wqe_sz_sq[0x10];
257
258 u8 reserved_36[0x10];
259 u8 max_wqe_sz_rq[0x10];
260
261 u8 reserved_37[0x10];
262 u8 max_wqe_sz_sq_dc[0x10];
263
264 u8 reserved_38[0x7];
265 u8 max_qp_mcg[0x19];
266
267 u8 reserved_39[0x18];
268 u8 log_max_mcg[0x8];
269
270 u8 reserved_40[0xb];
271 u8 log_max_pd[0x5];
272 u8 reserved_41[0xb];
273 u8 log_max_xrcd[0x5];
274
275 u8 reserved_42[0x20];
276
277 u8 reserved_43[0x3];
278 u8 log_max_rq[0x5];
279 u8 reserved_44[0x3];
280 u8 log_max_sq[0x5];
281 u8 reserved_45[0x3];
282 u8 log_max_tir[0x5];
283 u8 reserved_46[0x3];
284 u8 log_max_tis[0x5];
285
286 u8 reserved_47[0x13];
287 u8 log_max_rq_per_tir[0x5];
288 u8 reserved_48[0x3];
289 u8 log_max_tis_per_sq[0x5];
290
291 u8 reserved_49[0xe0];
292
293 u8 reserved_50[0x10];
294 u8 log_uar_page_sz[0x10];
295
296 u8 reserved_51[0x100];
297
298 u8 reserved_52[0x1f];
299 u8 cqe_zip[0x1];
300
301 u8 cqe_zip_timeout[0x10];
302 u8 cqe_zip_max_num[0x10];
303
304 u8 reserved_53[0x220];
305};
306
307struct mlx5_ifc_set_hca_cap_in_bits {
308 u8 opcode[0x10];
309 u8 reserved_0[0x10];
310
311 u8 reserved_1[0x10];
312 u8 op_mod[0x10];
313
314 u8 reserved_2[0x40];
315
316 struct mlx5_ifc_cmd_hca_cap_bits hca_capability_struct;
317};
318
319struct mlx5_ifc_query_hca_cap_in_bits {
320 u8 opcode[0x10];
321 u8 reserved_0[0x10];
322
323 u8 reserved_1[0x10];
324 u8 op_mod[0x10];
325
326 u8 reserved_2[0x40];
327};
328
329struct mlx5_ifc_query_hca_cap_out_bits {
330 u8 status[0x8];
331 u8 reserved_0[0x18];
332
333 u8 syndrome[0x20];
334
335 u8 reserved_1[0x40];
336
337 u8 capability_struct[256][0x8];
338};
339
340struct mlx5_ifc_set_hca_cap_out_bits {
341 u8 status[0x8];
342 u8 reserved_0[0x18];
343
344 u8 syndrome[0x20];
345
346 u8 reserved_1[0x40];
347};
348
349#endif /* MLX5_IFC_H */
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 9709b30e2d69..3fa075daeb1d 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -40,6 +40,15 @@
40#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5) 40#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5)
41#define MLX5_DIF_SIZE 8 41#define MLX5_DIF_SIZE 8
42#define MLX5_STRIDE_BLOCK_OP 0x400 42#define MLX5_STRIDE_BLOCK_OP 0x400
43#define MLX5_CPY_GRD_MASK 0xc0
44#define MLX5_CPY_APP_MASK 0x30
45#define MLX5_CPY_REF_MASK 0x0f
46#define MLX5_BSF_INC_REFTAG (1 << 6)
47#define MLX5_BSF_INL_VALID (1 << 15)
48#define MLX5_BSF_REFRESH_DIF (1 << 14)
49#define MLX5_BSF_REPEAT_BLOCK (1 << 7)
50#define MLX5_BSF_APPTAG_ESCAPE 0x1
51#define MLX5_BSF_APPREF_ESCAPE 0x2
43 52
44enum mlx5_qp_optpar { 53enum mlx5_qp_optpar {
45 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0, 54 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
@@ -287,6 +296,22 @@ struct mlx5_wqe_inline_seg {
287 __be32 byte_count; 296 __be32 byte_count;
288}; 297};
289 298
299enum mlx5_sig_type {
300 MLX5_DIF_CRC = 0x1,
301 MLX5_DIF_IPCS = 0x2,
302};
303
304struct mlx5_bsf_inl {
305 __be16 vld_refresh;
306 __be16 dif_apptag;
307 __be32 dif_reftag;
308 u8 sig_type;
309 u8 rp_inv_seed;
310 u8 rsvd[3];
311 u8 dif_inc_ref_guard_check;
312 __be16 dif_app_bitmask_check;
313};
314
290struct mlx5_bsf { 315struct mlx5_bsf {
291 struct mlx5_bsf_basic { 316 struct mlx5_bsf_basic {
292 u8 bsf_size_sbs; 317 u8 bsf_size_sbs;
@@ -310,14 +335,8 @@ struct mlx5_bsf {
310 __be32 w_tfs_psv; 335 __be32 w_tfs_psv;
311 __be32 m_tfs_psv; 336 __be32 m_tfs_psv;
312 } ext; 337 } ext;
313 struct mlx5_bsf_inl { 338 struct mlx5_bsf_inl w_inl;
314 __be32 w_inl_vld; 339 struct mlx5_bsf_inl m_inl;
315 __be32 w_rsvd;
316 __be64 w_block_format;
317 __be32 m_inl_vld;
318 __be32 m_rsvd;
319 __be64 m_block_format;
320 } inl;
321}; 340};
322 341
323struct mlx5_klm { 342struct mlx5_klm {
@@ -342,10 +361,9 @@ struct mlx5_stride_block_ctrl_seg {
342}; 361};
343 362
344struct mlx5_core_qp { 363struct mlx5_core_qp {
364 struct mlx5_core_rsc_common common; /* must be first */
345 void (*event) (struct mlx5_core_qp *, int); 365 void (*event) (struct mlx5_core_qp *, int);
346 int qpn; 366 int qpn;
347 atomic_t refcount;
348 struct completion free;
349 struct mlx5_rsc_debug *dbg; 367 struct mlx5_rsc_debug *dbg;
350 int pid; 368 int pid;
351}; 369};
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 8981cc882ed2..b46461116cd2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -18,6 +18,7 @@
18#include <linux/pfn.h> 18#include <linux/pfn.h>
19#include <linux/bit_spinlock.h> 19#include <linux/bit_spinlock.h>
20#include <linux/shrinker.h> 20#include <linux/shrinker.h>
21#include <linux/resource.h>
21 22
22struct mempolicy; 23struct mempolicy;
23struct anon_vma; 24struct anon_vma;
@@ -346,6 +347,7 @@ static inline int put_page_unless_one(struct page *page)
346} 347}
347 348
348extern int page_is_ram(unsigned long pfn); 349extern int page_is_ram(unsigned long pfn);
350extern int region_is_ram(resource_size_t phys_addr, unsigned long size);
349 351
350/* Support for virtually mapped pages */ 352/* Support for virtually mapped pages */
351struct page *vmalloc_to_page(const void *addr); 353struct page *vmalloc_to_page(const void *addr);
@@ -553,6 +555,25 @@ static inline void __ClearPageBuddy(struct page *page)
553 atomic_set(&page->_mapcount, -1); 555 atomic_set(&page->_mapcount, -1);
554} 556}
555 557
558#define PAGE_BALLOON_MAPCOUNT_VALUE (-256)
559
560static inline int PageBalloon(struct page *page)
561{
562 return atomic_read(&page->_mapcount) == PAGE_BALLOON_MAPCOUNT_VALUE;
563}
564
565static inline void __SetPageBalloon(struct page *page)
566{
567 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
568 atomic_set(&page->_mapcount, PAGE_BALLOON_MAPCOUNT_VALUE);
569}
570
571static inline void __ClearPageBalloon(struct page *page)
572{
573 VM_BUG_ON_PAGE(!PageBalloon(page), page);
574 atomic_set(&page->_mapcount, -1);
575}
576
556void put_page(struct page *page); 577void put_page(struct page *page);
557void put_pages_list(struct list_head *pages); 578void put_pages_list(struct list_head *pages);
558 579
@@ -1155,6 +1176,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
1155 1176
1156extern void truncate_pagecache(struct inode *inode, loff_t new); 1177extern void truncate_pagecache(struct inode *inode, loff_t new);
1157extern void truncate_setsize(struct inode *inode, loff_t newsize); 1178extern void truncate_setsize(struct inode *inode, loff_t newsize);
1179void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to);
1158void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); 1180void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
1159int truncate_inode_page(struct address_space *mapping, struct page *page); 1181int truncate_inode_page(struct address_space *mapping, struct page *page);
1160int generic_error_remove_page(struct address_space *mapping, struct page *page); 1182int generic_error_remove_page(struct address_space *mapping, struct page *page);
@@ -1213,7 +1235,6 @@ int __set_page_dirty_no_writeback(struct page *page);
1213int redirty_page_for_writepage(struct writeback_control *wbc, 1235int redirty_page_for_writepage(struct writeback_control *wbc,
1214 struct page *page); 1236 struct page *page);
1215void account_page_dirtied(struct page *page, struct address_space *mapping); 1237void account_page_dirtied(struct page *page, struct address_space *mapping);
1216void account_page_writeback(struct page *page);
1217int set_page_dirty(struct page *page); 1238int set_page_dirty(struct page *page);
1218int set_page_dirty_lock(struct page *page); 1239int set_page_dirty_lock(struct page *page);
1219int clear_page_dirty_for_io(struct page *page); 1240int clear_page_dirty_for_io(struct page *page);
@@ -1247,8 +1268,8 @@ static inline int stack_guard_page_end(struct vm_area_struct *vma,
1247 !vma_growsup(vma->vm_next, addr); 1268 !vma_growsup(vma->vm_next, addr);
1248} 1269}
1249 1270
1250extern pid_t 1271extern struct task_struct *task_of_stack(struct task_struct *task,
1251vm_is_stack(struct task_struct *task, struct vm_area_struct *vma, int in_group); 1272 struct vm_area_struct *vma, bool in_group);
1252 1273
1253extern unsigned long move_page_tables(struct vm_area_struct *vma, 1274extern unsigned long move_page_tables(struct vm_area_struct *vma,
1254 unsigned long old_addr, struct vm_area_struct *new_vma, 1275 unsigned long old_addr, struct vm_area_struct *new_vma,
@@ -1780,6 +1801,20 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1780 bool *need_rmap_locks); 1801 bool *need_rmap_locks);
1781extern void exit_mmap(struct mm_struct *); 1802extern void exit_mmap(struct mm_struct *);
1782 1803
1804static inline int check_data_rlimit(unsigned long rlim,
1805 unsigned long new,
1806 unsigned long start,
1807 unsigned long end_data,
1808 unsigned long start_data)
1809{
1810 if (rlim < RLIM_INFINITY) {
1811 if (((new - start) + (end_data - start_data)) > rlim)
1812 return -ENOSPC;
1813 }
1814
1815 return 0;
1816}
1817
1783extern int mm_take_all_locks(struct mm_struct *mm); 1818extern int mm_take_all_locks(struct mm_struct *mm);
1784extern void mm_drop_all_locks(struct mm_struct *mm); 1819extern void mm_drop_all_locks(struct mm_struct *mm);
1785 1820
@@ -1939,11 +1974,16 @@ static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm,
1939 1974
1940#ifdef CONFIG_MMU 1975#ifdef CONFIG_MMU
1941pgprot_t vm_get_page_prot(unsigned long vm_flags); 1976pgprot_t vm_get_page_prot(unsigned long vm_flags);
1977void vma_set_page_prot(struct vm_area_struct *vma);
1942#else 1978#else
1943static inline pgprot_t vm_get_page_prot(unsigned long vm_flags) 1979static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)
1944{ 1980{
1945 return __pgprot(0); 1981 return __pgprot(0);
1946} 1982}
1983static inline void vma_set_page_prot(struct vm_area_struct *vma)
1984{
1985 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
1986}
1947#endif 1987#endif
1948 1988
1949#ifdef CONFIG_NUMA_BALANCING 1989#ifdef CONFIG_NUMA_BALANCING
@@ -1985,6 +2025,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma,
1985#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 2025#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
1986#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ 2026#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
1987#define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */ 2027#define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */
2028#define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */
1988 2029
1989typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 2030typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1990 void *data); 2031 void *data);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index d424b9de3aff..b0692d28f8e6 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -42,7 +42,8 @@ struct mmc_csd {
42 unsigned int read_partial:1, 42 unsigned int read_partial:1,
43 read_misalign:1, 43 read_misalign:1,
44 write_partial:1, 44 write_partial:1,
45 write_misalign:1; 45 write_misalign:1,
46 dsr_imp:1;
46}; 47};
47 48
48struct mmc_ext_csd { 49struct mmc_ext_csd {
@@ -74,7 +75,7 @@ struct mmc_ext_csd {
74 unsigned int sec_trim_mult; /* Secure trim multiplier */ 75 unsigned int sec_trim_mult; /* Secure trim multiplier */
75 unsigned int sec_erase_mult; /* Secure erase multiplier */ 76 unsigned int sec_erase_mult; /* Secure erase multiplier */
76 unsigned int trim_timeout; /* In milliseconds */ 77 unsigned int trim_timeout; /* In milliseconds */
77 bool enhanced_area_en; /* enable bit */ 78 bool partition_setting_completed; /* enable bit */
78 unsigned long long enhanced_area_offset; /* Units: Byte */ 79 unsigned long long enhanced_area_offset; /* Units: Byte */
79 unsigned int enhanced_area_size; /* Units: KB */ 80 unsigned int enhanced_area_size; /* Units: KB */
80 unsigned int cache_size; /* Units: KB */ 81 unsigned int cache_size; /* Units: KB */
@@ -214,11 +215,12 @@ enum mmc_blk_status {
214}; 215};
215 216
216/* The number of MMC physical partitions. These consist of: 217/* The number of MMC physical partitions. These consist of:
217 * boot partitions (2), general purpose partitions (4) in MMC v4.4. 218 * boot partitions (2), general purpose partitions (4) and
219 * RPMB partition (1) in MMC v4.4.
218 */ 220 */
219#define MMC_NUM_BOOT_PARTITION 2 221#define MMC_NUM_BOOT_PARTITION 2
220#define MMC_NUM_GP_PARTITION 4 222#define MMC_NUM_GP_PARTITION 4
221#define MMC_NUM_PHY_PARTITION 6 223#define MMC_NUM_PHY_PARTITION 7
222#define MAX_MMC_PART_NAME_LEN 20 224#define MAX_MMC_PART_NAME_LEN 20
223 225
224/* 226/*
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 29ce014ab421..001366927cf4 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -26,6 +26,8 @@ enum dw_mci_state {
26 STATE_DATA_BUSY, 26 STATE_DATA_BUSY,
27 STATE_SENDING_STOP, 27 STATE_SENDING_STOP,
28 STATE_DATA_ERROR, 28 STATE_DATA_ERROR,
29 STATE_SENDING_CMD11,
30 STATE_WAITING_CMD11_DONE,
29}; 31};
30 32
31enum { 33enum {
@@ -188,7 +190,7 @@ struct dw_mci {
188 /* Workaround flags */ 190 /* Workaround flags */
189 u32 quirks; 191 u32 quirks;
190 192
191 struct regulator *vmmc; /* Power regulator */ 193 bool vqmmc_enabled;
192 unsigned long irq_flags; /* IRQ flags */ 194 unsigned long irq_flags; /* IRQ flags */
193 int irq; 195 int irq;
194}; 196};
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7960424d0bc0..df0c15396bbf 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -42,6 +42,7 @@ struct mmc_ios {
42#define MMC_POWER_OFF 0 42#define MMC_POWER_OFF 0
43#define MMC_POWER_UP 1 43#define MMC_POWER_UP 1
44#define MMC_POWER_ON 2 44#define MMC_POWER_ON 2
45#define MMC_POWER_UNDEFINED 3
45 46
46 unsigned char bus_width; /* data bus width */ 47 unsigned char bus_width; /* data bus width */
47 48
@@ -139,6 +140,13 @@ struct mmc_host_ops {
139 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 140 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
140 void (*hw_reset)(struct mmc_host *host); 141 void (*hw_reset)(struct mmc_host *host);
141 void (*card_event)(struct mmc_host *host); 142 void (*card_event)(struct mmc_host *host);
143
144 /*
145 * Optional callback to support controllers with HW issues for multiple
146 * I/O. Returns the number of supported blocks for the request.
147 */
148 int (*multi_io_quirk)(struct mmc_card *card,
149 unsigned int direction, int blk_size);
142}; 150};
143 151
144struct mmc_card; 152struct mmc_card;
@@ -265,7 +273,6 @@ struct mmc_host {
265 273
266#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 274#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
267#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */ 275#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 */
269#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ 276#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
270#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */ 277#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
271#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 278#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
@@ -365,6 +372,9 @@ struct mmc_host {
365 372
366 unsigned int slotno; /* used for sdio acpi binding */ 373 unsigned int slotno; /* used for sdio acpi binding */
367 374
375 int dsr_req; /* DSR value is valid */
376 u32 dsr; /* optional driver stage (DSR) value */
377
368 unsigned long private[0] ____cacheline_aligned; 378 unsigned long private[0] ____cacheline_aligned;
369}; 379};
370 380
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 64ec963ed347..1cd00b3a75b9 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -53,6 +53,11 @@
53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */ 53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */
54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */ 54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */
55 55
56#define MMC_TUNING_BLK_PATTERN_4BIT_SIZE 64
57#define MMC_TUNING_BLK_PATTERN_8BIT_SIZE 128
58extern const u8 tuning_blk_pattern_4bit[MMC_TUNING_BLK_PATTERN_4BIT_SIZE];
59extern const u8 tuning_blk_pattern_8bit[MMC_TUNING_BLK_PATTERN_8BIT_SIZE];
60
56 /* class 3 */ 61 /* class 3 */
57#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ 62#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
58 63
@@ -281,6 +286,7 @@ struct _mmc_csd {
281#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */ 286#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */
282#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ 287#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
283#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ 288#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */
289#define EXT_CSD_PARTITION_SETTING_COMPLETED 155 /* R/W */
284#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 290#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
285#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ 291#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
286#define EXT_CSD_HPI_MGMT 161 /* R/W */ 292#define EXT_CSD_HPI_MGMT 161 /* R/W */
@@ -349,6 +355,7 @@ struct _mmc_csd {
349#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3) 355#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3)
350#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) 356#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4)
351 357
358#define EXT_CSD_PART_SETTING_COMPLETED (0x1)
352#define EXT_CSD_PART_SUPPORT_PART_EN (0x1) 359#define EXT_CSD_PART_SUPPORT_PART_EN (0x1)
353 360
354#define EXT_CSD_CMD_SET_NORMAL (1<<0) 361#define EXT_CSD_CMD_SET_NORMAL (1<<0)
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 09ebe57d5ce9..dba793e3a331 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -98,6 +98,8 @@ struct sdhci_host {
98#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6) 98#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6)
99/* Controller does not support DDR50 */ 99/* Controller does not support DDR50 */
100#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7) 100#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7)
101/* Stop command (CMD12) can set Transfer Complete when not using MMC_RSP_BUSY */
102#define SDHCI_QUIRK2_STOP_WITH_TC (1<<8)
101 103
102 int irq; /* Device IRQ */ 104 int irq; /* Device IRQ */
103 void __iomem *ioaddr; /* Mapped address */ 105 void __iomem *ioaddr; /* Mapped address */
@@ -146,6 +148,7 @@ struct sdhci_host {
146 struct mmc_command *cmd; /* Current command */ 148 struct mmc_command *cmd; /* Current command */
147 struct mmc_data *data; /* Current data request */ 149 struct mmc_data *data; /* Current data request */
148 unsigned int data_early:1; /* Data finished before cmd */ 150 unsigned int data_early:1; /* Data finished before cmd */
151 unsigned int busy_handle:1; /* Handling the order of Busy-end */
149 152
150 struct sg_mapping_iter sg_miter; /* SG state for PIO */ 153 struct sg_mapping_iter sg_miter; /* SG state for PIO */
151 unsigned int blocks; /* remaining PIO blocks */ 154 unsigned int blocks; /* remaining PIO blocks */
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index d2433381e828..e56fa24c9322 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -24,7 +24,10 @@ void mmc_gpio_free_cd(struct mmc_host *host);
24 24
25int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, 25int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
26 unsigned int idx, bool override_active_level, 26 unsigned int idx, bool override_active_level,
27 unsigned int debounce); 27 unsigned int debounce, bool *gpio_invert);
28int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
29 unsigned int idx, bool override_active_level,
30 unsigned int debounce, bool *gpio_invert);
28void mmc_gpiod_free_cd(struct mmc_host *host); 31void mmc_gpiod_free_cd(struct mmc_host *host);
29void mmc_gpiod_request_cd_irq(struct mmc_host *host); 32void mmc_gpiod_request_cd_irq(struct mmc_host *host);
30 33
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 2f348d02f640..877ef226f90f 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -4,10 +4,14 @@
4#include <linux/stringify.h> 4#include <linux/stringify.h>
5 5
6struct page; 6struct page;
7struct vm_area_struct;
8struct mm_struct;
7 9
8extern void dump_page(struct page *page, const char *reason); 10extern void dump_page(struct page *page, const char *reason);
9extern void dump_page_badflags(struct page *page, const char *reason, 11extern void dump_page_badflags(struct page *page, const char *reason,
10 unsigned long badflags); 12 unsigned long badflags);
13void dump_vma(const struct vm_area_struct *vma);
14void dump_mm(const struct mm_struct *mm);
11 15
12#ifdef CONFIG_DEBUG_VM 16#ifdef CONFIG_DEBUG_VM
13#define VM_BUG_ON(cond) BUG_ON(cond) 17#define VM_BUG_ON(cond) BUG_ON(cond)
@@ -18,12 +22,28 @@ extern void dump_page_badflags(struct page *page, const char *reason,
18 BUG(); \ 22 BUG(); \
19 } \ 23 } \
20 } while (0) 24 } while (0)
25#define VM_BUG_ON_VMA(cond, vma) \
26 do { \
27 if (unlikely(cond)) { \
28 dump_vma(vma); \
29 BUG(); \
30 } \
31 } while (0)
32#define VM_BUG_ON_MM(cond, mm) \
33 do { \
34 if (unlikely(cond)) { \
35 dump_mm(mm); \
36 BUG(); \
37 } \
38 } while (0)
21#define VM_WARN_ON(cond) WARN_ON(cond) 39#define VM_WARN_ON(cond) WARN_ON(cond)
22#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) 40#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
23#define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format) 41#define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format)
24#else 42#else
25#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) 43#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
26#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) 44#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
45#define VM_BUG_ON_VMA(cond, vma) VM_BUG_ON(cond)
46#define VM_BUG_ON_MM(cond, mm) VM_BUG_ON(cond)
27#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond) 47#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
28#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) 48#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
29#define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond) 49#define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond)
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 27288692241e..88787bb4b3b9 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -57,10 +57,13 @@ struct mmu_notifier_ops {
57 * pte. This way the VM will provide proper aging to the 57 * pte. This way the VM will provide proper aging to the
58 * accesses to the page through the secondary MMUs and not 58 * accesses to the page through the secondary MMUs and not
59 * only to the ones through the Linux pte. 59 * only to the ones through the Linux pte.
60 * Start-end is necessary in case the secondary MMU is mapping the page
61 * at a smaller granularity than the primary MMU.
60 */ 62 */
61 int (*clear_flush_young)(struct mmu_notifier *mn, 63 int (*clear_flush_young)(struct mmu_notifier *mn,
62 struct mm_struct *mm, 64 struct mm_struct *mm,
63 unsigned long address); 65 unsigned long start,
66 unsigned long end);
64 67
65 /* 68 /*
66 * test_young is called to check the young/accessed bitflag in 69 * test_young is called to check the young/accessed bitflag in
@@ -175,7 +178,8 @@ extern void mmu_notifier_unregister_no_release(struct mmu_notifier *mn,
175extern void __mmu_notifier_mm_destroy(struct mm_struct *mm); 178extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
176extern void __mmu_notifier_release(struct mm_struct *mm); 179extern void __mmu_notifier_release(struct mm_struct *mm);
177extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, 180extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
178 unsigned long address); 181 unsigned long start,
182 unsigned long end);
179extern int __mmu_notifier_test_young(struct mm_struct *mm, 183extern int __mmu_notifier_test_young(struct mm_struct *mm,
180 unsigned long address); 184 unsigned long address);
181extern void __mmu_notifier_change_pte(struct mm_struct *mm, 185extern void __mmu_notifier_change_pte(struct mm_struct *mm,
@@ -194,10 +198,11 @@ static inline void mmu_notifier_release(struct mm_struct *mm)
194} 198}
195 199
196static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm, 200static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
197 unsigned long address) 201 unsigned long start,
202 unsigned long end)
198{ 203{
199 if (mm_has_notifiers(mm)) 204 if (mm_has_notifiers(mm))
200 return __mmu_notifier_clear_flush_young(mm, address); 205 return __mmu_notifier_clear_flush_young(mm, start, end);
201 return 0; 206 return 0;
202} 207}
203 208
@@ -255,7 +260,9 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
255 unsigned long ___address = __address; \ 260 unsigned long ___address = __address; \
256 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \ 261 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \
257 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \ 262 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
258 ___address); \ 263 ___address, \
264 ___address + \
265 PAGE_SIZE); \
259 __young; \ 266 __young; \
260}) 267})
261 268
@@ -266,7 +273,9 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
266 unsigned long ___address = __address; \ 273 unsigned long ___address = __address; \
267 __young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \ 274 __young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \
268 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \ 275 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
269 ___address); \ 276 ___address, \
277 ___address + \
278 PMD_SIZE); \
270 __young; \ 279 __young; \
271}) 280})
272 281
@@ -301,7 +310,8 @@ static inline void mmu_notifier_release(struct mm_struct *mm)
301} 310}
302 311
303static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm, 312static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
304 unsigned long address) 313 unsigned long start,
314 unsigned long end)
305{ 315{
306 return 0; 316 return 0;
307} 317}
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 318df7051850..48bf12ef6620 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -521,13 +521,13 @@ struct zone {
521 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; 521 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
522} ____cacheline_internodealigned_in_smp; 522} ____cacheline_internodealigned_in_smp;
523 523
524typedef enum { 524enum zone_flags {
525 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */ 525 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */
526 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */ 526 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */
527 ZONE_CONGESTED, /* zone has many dirty pages backed by 527 ZONE_CONGESTED, /* zone has many dirty pages backed by
528 * a congested BDI 528 * a congested BDI
529 */ 529 */
530 ZONE_TAIL_LRU_DIRTY, /* reclaim scanning has recently found 530 ZONE_DIRTY, /* reclaim scanning has recently found
531 * many dirty file pages at the tail 531 * many dirty file pages at the tail
532 * of the LRU. 532 * of the LRU.
533 */ 533 */
@@ -535,52 +535,7 @@ typedef enum {
535 * many pages under writeback 535 * many pages under writeback
536 */ 536 */
537 ZONE_FAIR_DEPLETED, /* fair zone policy batch depleted */ 537 ZONE_FAIR_DEPLETED, /* fair zone policy batch depleted */
538} zone_flags_t; 538};
539
540static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
541{
542 set_bit(flag, &zone->flags);
543}
544
545static inline int zone_test_and_set_flag(struct zone *zone, zone_flags_t flag)
546{
547 return test_and_set_bit(flag, &zone->flags);
548}
549
550static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag)
551{
552 clear_bit(flag, &zone->flags);
553}
554
555static inline int zone_is_reclaim_congested(const struct zone *zone)
556{
557 return test_bit(ZONE_CONGESTED, &zone->flags);
558}
559
560static inline int zone_is_reclaim_dirty(const struct zone *zone)
561{
562 return test_bit(ZONE_TAIL_LRU_DIRTY, &zone->flags);
563}
564
565static inline int zone_is_reclaim_writeback(const struct zone *zone)
566{
567 return test_bit(ZONE_WRITEBACK, &zone->flags);
568}
569
570static inline int zone_is_reclaim_locked(const struct zone *zone)
571{
572 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
573}
574
575static inline int zone_is_fair_depleted(const struct zone *zone)
576{
577 return test_bit(ZONE_FAIR_DEPLETED, &zone->flags);
578}
579
580static inline int zone_is_oom_locked(const struct zone *zone)
581{
582 return test_bit(ZONE_OOM_LOCKED, &zone->flags);
583}
584 539
585static inline unsigned long zone_end_pfn(const struct zone *zone) 540static inline unsigned long zone_end_pfn(const struct zone *zone)
586{ 541{
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index b43f4752304e..1c9effa25e26 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -78,6 +78,8 @@ struct kernel_param {
78 }; 78 };
79}; 79};
80 80
81extern const struct kernel_param __start___param[], __stop___param[];
82
81/* Special one for strings we want to copy into */ 83/* Special one for strings we want to copy into */
82struct kparam_string { 84struct kparam_string {
83 unsigned int maxlen; 85 unsigned int maxlen;
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 9262e4bf0cc3..c2c561dc0114 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -81,6 +81,9 @@ extern struct vfsmount *mntget(struct vfsmount *mnt);
81extern struct vfsmount *mnt_clone_internal(struct path *path); 81extern struct vfsmount *mnt_clone_internal(struct path *path);
82extern int __mnt_is_readonly(struct vfsmount *mnt); 82extern int __mnt_is_readonly(struct vfsmount *mnt);
83 83
84struct path;
85extern struct vfsmount *clone_private_mount(struct path *path);
86
84struct file_system_type; 87struct file_system_type;
85extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, 88extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
86 int flags, const char *name, 89 int flags, const char *name,
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 8103f32f6d87..44f4746d033b 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -29,7 +29,6 @@ struct msi_desc {
29 __u8 multi_cap : 3; /* log2 num of messages supported */ 29 __u8 multi_cap : 3; /* log2 num of messages supported */
30 __u8 maskbit : 1; /* mask-pending bit supported ? */ 30 __u8 maskbit : 1; /* mask-pending bit supported ? */
31 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 31 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
32 __u8 pos; /* Location of the msi capability */
33 __u16 entry_nr; /* specific enabled entry */ 32 __u16 entry_nr; /* specific enabled entry */
34 unsigned default_irq; /* default pre-assigned irq */ 33 unsigned default_irq; /* default pre-assigned irq */
35 } msi_attrib; 34 } msi_attrib;
@@ -47,8 +46,6 @@ struct msi_desc {
47 46
48 /* Last set MSI message */ 47 /* Last set MSI message */
49 struct msi_msg msg; 48 struct msi_msg msg;
50
51 struct kobject kobj;
52}; 49};
53 50
54/* 51/*
@@ -60,7 +57,6 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
60void arch_teardown_msi_irq(unsigned int irq); 57void arch_teardown_msi_irq(unsigned int irq);
61int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 58int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
62void arch_teardown_msi_irqs(struct pci_dev *dev); 59void arch_teardown_msi_irqs(struct pci_dev *dev);
63int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
64void arch_restore_msi_irqs(struct pci_dev *dev); 60void arch_restore_msi_irqs(struct pci_dev *dev);
65 61
66void default_teardown_msi_irqs(struct pci_dev *dev); 62void default_teardown_msi_irqs(struct pci_dev *dev);
@@ -77,8 +73,6 @@ struct msi_chip {
77 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev, 73 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev,
78 struct msi_desc *desc); 74 struct msi_desc *desc);
79 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq); 75 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq);
80 int (*check_device)(struct msi_chip *chip, struct pci_dev *dev,
81 int nvec, int type);
82}; 76};
83 77
84#endif /* LINUX_MSI_H */ 78#endif /* LINUX_MSI_H */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 37ef6b194089..299d7d31fe53 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -153,7 +153,7 @@ struct cfi_ident {
153 uint16_t MaxBufWriteSize; 153 uint16_t MaxBufWriteSize;
154 uint8_t NumEraseRegions; 154 uint8_t NumEraseRegions;
155 uint32_t EraseRegionInfo[0]; /* Not host ordered */ 155 uint32_t EraseRegionInfo[0]; /* Not host ordered */
156} __attribute__((packed)); 156} __packed;
157 157
158/* Extended Query Structure for both PRI and ALT */ 158/* Extended Query Structure for both PRI and ALT */
159 159
@@ -161,7 +161,7 @@ struct cfi_extquery {
161 uint8_t pri[3]; 161 uint8_t pri[3];
162 uint8_t MajorVersion; 162 uint8_t MajorVersion;
163 uint8_t MinorVersion; 163 uint8_t MinorVersion;
164} __attribute__((packed)); 164} __packed;
165 165
166/* Vendor-Specific PRI for Intel/Sharp Extended Command Set (0x0001) */ 166/* Vendor-Specific PRI for Intel/Sharp Extended Command Set (0x0001) */
167 167
@@ -180,7 +180,7 @@ struct cfi_pri_intelext {
180 uint8_t FactProtRegSize; 180 uint8_t FactProtRegSize;
181 uint8_t UserProtRegSize; 181 uint8_t UserProtRegSize;
182 uint8_t extra[0]; 182 uint8_t extra[0];
183} __attribute__((packed)); 183} __packed;
184 184
185struct cfi_intelext_otpinfo { 185struct cfi_intelext_otpinfo {
186 uint32_t ProtRegAddr; 186 uint32_t ProtRegAddr;
@@ -188,7 +188,7 @@ struct cfi_intelext_otpinfo {
188 uint8_t FactProtRegSize; 188 uint8_t FactProtRegSize;
189 uint16_t UserGroups; 189 uint16_t UserGroups;
190 uint8_t UserProtRegSize; 190 uint8_t UserProtRegSize;
191} __attribute__((packed)); 191} __packed;
192 192
193struct cfi_intelext_blockinfo { 193struct cfi_intelext_blockinfo {
194 uint16_t NumIdentBlocks; 194 uint16_t NumIdentBlocks;
@@ -196,7 +196,7 @@ struct cfi_intelext_blockinfo {
196 uint16_t MinBlockEraseCycles; 196 uint16_t MinBlockEraseCycles;
197 uint8_t BitsPerCell; 197 uint8_t BitsPerCell;
198 uint8_t BlockCap; 198 uint8_t BlockCap;
199} __attribute__((packed)); 199} __packed;
200 200
201struct cfi_intelext_regioninfo { 201struct cfi_intelext_regioninfo {
202 uint16_t NumIdentPartitions; 202 uint16_t NumIdentPartitions;
@@ -205,7 +205,7 @@ struct cfi_intelext_regioninfo {
205 uint8_t NumOpAllowedSimEraMode; 205 uint8_t NumOpAllowedSimEraMode;
206 uint8_t NumBlockTypes; 206 uint8_t NumBlockTypes;
207 struct cfi_intelext_blockinfo BlockTypes[1]; 207 struct cfi_intelext_blockinfo BlockTypes[1];
208} __attribute__((packed)); 208} __packed;
209 209
210struct cfi_intelext_programming_regioninfo { 210struct cfi_intelext_programming_regioninfo {
211 uint8_t ProgRegShift; 211 uint8_t ProgRegShift;
@@ -214,7 +214,7 @@ struct cfi_intelext_programming_regioninfo {
214 uint8_t Reserved2; 214 uint8_t Reserved2;
215 uint8_t ControlInvalid; 215 uint8_t ControlInvalid;
216 uint8_t Reserved3; 216 uint8_t Reserved3;
217} __attribute__((packed)); 217} __packed;
218 218
219/* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */ 219/* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */
220 220
@@ -233,7 +233,7 @@ struct cfi_pri_amdstd {
233 uint8_t VppMin; 233 uint8_t VppMin;
234 uint8_t VppMax; 234 uint8_t VppMax;
235 uint8_t TopBottom; 235 uint8_t TopBottom;
236} __attribute__((packed)); 236} __packed;
237 237
238/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */ 238/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */
239 239
@@ -245,18 +245,18 @@ struct cfi_pri_atmel {
245 uint8_t BottomBoot; 245 uint8_t BottomBoot;
246 uint8_t BurstMode; 246 uint8_t BurstMode;
247 uint8_t PageMode; 247 uint8_t PageMode;
248} __attribute__((packed)); 248} __packed;
249 249
250struct cfi_pri_query { 250struct cfi_pri_query {
251 uint8_t NumFields; 251 uint8_t NumFields;
252 uint32_t ProtField[1]; /* Not host ordered */ 252 uint32_t ProtField[1]; /* Not host ordered */
253} __attribute__((packed)); 253} __packed;
254 254
255struct cfi_bri_query { 255struct cfi_bri_query {
256 uint8_t PageModeReadCap; 256 uint8_t PageModeReadCap;
257 uint8_t NumFields; 257 uint8_t NumFields;
258 uint32_t ConfField[1]; /* Not host ordered */ 258 uint32_t ConfField[1]; /* Not host ordered */
259} __attribute__((packed)); 259} __packed;
260 260
261#define P_ID_NONE 0x0000 261#define P_ID_NONE 0x0000
262#define P_ID_INTEL_EXT 0x0001 262#define P_ID_INTEL_EXT 0x0001
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index c300db3ae285..e4d451e4600b 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -587,6 +587,11 @@ struct nand_buffers {
587 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds, 587 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds,
588 * also from the datasheet. It is the recommended ECC step 588 * also from the datasheet. It is the recommended ECC step
589 * size, if known; if unknown, set to zero. 589 * size, if known; if unknown, set to zero.
590 * @onfi_timing_mode_default: [INTERN] default ONFI timing mode. This field is
591 * either deduced from the datasheet if the NAND
592 * chip is not ONFI compliant or set to 0 if it is
593 * (an ONFI chip is always configured in mode 0
594 * after a NAND reset)
590 * @numchips: [INTERN] number of physical chips 595 * @numchips: [INTERN] number of physical chips
591 * @chipsize: [INTERN] the size of one chip for multichip arrays 596 * @chipsize: [INTERN] the size of one chip for multichip arrays
592 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 597 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -671,6 +676,7 @@ struct nand_chip {
671 uint8_t bits_per_cell; 676 uint8_t bits_per_cell;
672 uint16_t ecc_strength_ds; 677 uint16_t ecc_strength_ds;
673 uint16_t ecc_step_ds; 678 uint16_t ecc_step_ds;
679 int onfi_timing_mode_default;
674 int badblockpos; 680 int badblockpos;
675 int badblockbits; 681 int badblockbits;
676 682
@@ -766,12 +772,17 @@ struct nand_chip {
766 * @options: stores various chip bit options 772 * @options: stores various chip bit options
767 * @id_len: The valid length of the @id. 773 * @id_len: The valid length of the @id.
768 * @oobsize: OOB size 774 * @oobsize: OOB size
775 * @ecc: ECC correctability and step information from the datasheet.
769 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the 776 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the
770 * @ecc_strength_ds in nand_chip{}. 777 * @ecc_strength_ds in nand_chip{}.
771 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the 778 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the
772 * @ecc_step_ds in nand_chip{}, also from the datasheet. 779 * @ecc_step_ds in nand_chip{}, also from the datasheet.
773 * For example, the "4bit ECC for each 512Byte" can be set with 780 * For example, the "4bit ECC for each 512Byte" can be set with
774 * NAND_ECC_INFO(4, 512). 781 * NAND_ECC_INFO(4, 512).
782 * @onfi_timing_mode_default: the default ONFI timing mode entered after a NAND
783 * reset. Should be deduced from timings described
784 * in the datasheet.
785 *
775 */ 786 */
776struct nand_flash_dev { 787struct nand_flash_dev {
777 char *name; 788 char *name;
@@ -792,6 +803,7 @@ struct nand_flash_dev {
792 uint16_t strength_ds; 803 uint16_t strength_ds;
793 uint16_t step_ds; 804 uint16_t step_ds;
794 } ecc; 805 } ecc;
806 int onfi_timing_mode_default;
795}; 807};
796 808
797/** 809/**
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 9e6294f32ba8..046a0a2e4c4e 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -187,32 +187,17 @@ struct spi_nor {
187/** 187/**
188 * spi_nor_scan() - scan the SPI NOR 188 * spi_nor_scan() - scan the SPI NOR
189 * @nor: the spi_nor structure 189 * @nor: the spi_nor structure
190 * @id: the spi_device_id provided by the driver 190 * @name: the chip type name
191 * @mode: the read mode supported by the driver 191 * @mode: the read mode supported by the driver
192 * 192 *
193 * The drivers can use this fuction to scan the SPI NOR. 193 * The drivers can use this fuction to scan the SPI NOR.
194 * In the scanning, it will try to get all the necessary information to 194 * In the scanning, it will try to get all the necessary information to
195 * fill the mtd_info{} and the spi_nor{}. 195 * fill the mtd_info{} and the spi_nor{}.
196 * 196 *
197 * The board may assigns a spi_device_id with @id which be used to compared with 197 * The chip type name can be provided through the @name parameter.
198 * the spi_device_id detected by the scanning.
199 * 198 *
200 * Return: 0 for success, others for failure. 199 * Return: 0 for success, others for failure.
201 */ 200 */
202int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, 201int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode);
203 enum read_mode mode);
204extern const struct spi_device_id spi_nor_ids[];
205
206/**
207 * spi_nor_match_id() - find the spi_device_id by the name
208 * @name: the name of the spi_device_id
209 *
210 * The drivers use this function to find the spi_device_id
211 * specified by the @name.
212 *
213 * Return: returns the right spi_device_id pointer on success,
214 * and returns NULL on failure.
215 */
216const struct spi_device_id *spi_nor_match_id(char *name);
217 202
218#endif 203#endif
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 8d5535c58cc2..cc31498fc526 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -52,7 +52,7 @@ struct mutex {
52 atomic_t count; 52 atomic_t count;
53 spinlock_t wait_lock; 53 spinlock_t wait_lock;
54 struct list_head wait_list; 54 struct list_head wait_list;
55#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) 55#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
56 struct task_struct *owner; 56 struct task_struct *owner;
57#endif 57#endif
58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER 58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
@@ -133,7 +133,7 @@ static inline int mutex_is_locked(struct mutex *lock)
133 133
134/* 134/*
135 * See kernel/locking/mutex.c for detailed documentation of these APIs. 135 * See kernel/locking/mutex.c for detailed documentation of these APIs.
136 * Also see Documentation/mutex-design.txt. 136 * Also see Documentation/locking/mutex-design.txt.
137 */ 137 */
138#ifdef CONFIG_DEBUG_LOCK_ALLOC 138#ifdef CONFIG_DEBUG_LOCK_ALLOC
139extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); 139extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c8e388e5fccc..74fd5d37f15a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -30,6 +30,7 @@
30#include <linux/bug.h> 30#include <linux/bug.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/atomic.h> 32#include <linux/atomic.h>
33#include <linux/prefetch.h>
33#include <asm/cache.h> 34#include <asm/cache.h>
34#include <asm/byteorder.h> 35#include <asm/byteorder.h>
35 36
@@ -543,7 +544,7 @@ struct netdev_queue {
543 * read mostly part 544 * read mostly part
544 */ 545 */
545 struct net_device *dev; 546 struct net_device *dev;
546 struct Qdisc *qdisc; 547 struct Qdisc __rcu *qdisc;
547 struct Qdisc *qdisc_sleeping; 548 struct Qdisc *qdisc_sleeping;
548#ifdef CONFIG_SYSFS 549#ifdef CONFIG_SYSFS
549 struct kobject kobj; 550 struct kobject kobj;
@@ -997,6 +998,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
997 * Callback to use for xmit over the accelerated station. This 998 * Callback to use for xmit over the accelerated station. This
998 * is used in place of ndo_start_xmit on accelerated net 999 * is used in place of ndo_start_xmit on accelerated net
999 * devices. 1000 * devices.
1001 * bool (*ndo_gso_check) (struct sk_buff *skb,
1002 * struct net_device *dev);
1003 * Called by core transmit path to determine if device is capable of
1004 * performing GSO on a packet. The device returns true if it is
1005 * able to GSO the packet, false otherwise. If the return value is
1006 * false the stack will do software GSO.
1000 */ 1007 */
1001struct net_device_ops { 1008struct net_device_ops {
1002 int (*ndo_init)(struct net_device *dev); 1009 int (*ndo_init)(struct net_device *dev);
@@ -1146,6 +1153,8 @@ struct net_device_ops {
1146 struct net_device *dev, 1153 struct net_device *dev,
1147 void *priv); 1154 void *priv);
1148 int (*ndo_get_lock_subclass)(struct net_device *dev); 1155 int (*ndo_get_lock_subclass)(struct net_device *dev);
1156 bool (*ndo_gso_check) (struct sk_buff *skb,
1157 struct net_device *dev);
1149}; 1158};
1150 1159
1151/** 1160/**
@@ -1206,6 +1215,7 @@ enum netdev_priv_flags {
1206 IFF_SUPP_NOFCS = 1<<19, 1215 IFF_SUPP_NOFCS = 1<<19,
1207 IFF_LIVE_ADDR_CHANGE = 1<<20, 1216 IFF_LIVE_ADDR_CHANGE = 1<<20,
1208 IFF_MACVLAN = 1<<21, 1217 IFF_MACVLAN = 1<<21,
1218 IFF_XMIT_DST_RELEASE_PERM = 1<<22,
1209}; 1219};
1210 1220
1211#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN 1221#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1230,6 +1240,7 @@ enum netdev_priv_flags {
1230#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS 1240#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS
1231#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE 1241#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1232#define IFF_MACVLAN IFF_MACVLAN 1242#define IFF_MACVLAN IFF_MACVLAN
1243#define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM
1233 1244
1234/** 1245/**
1235 * struct net_device - The DEVICE structure. 1246 * struct net_device - The DEVICE structure.
@@ -1416,6 +1427,8 @@ enum netdev_priv_flags {
1416 * @gso_max_size: Maximum size of generic segmentation offload 1427 * @gso_max_size: Maximum size of generic segmentation offload
1417 * @gso_max_segs: Maximum number of segments that can be passed to the 1428 * @gso_max_segs: Maximum number of segments that can be passed to the
1418 * NIC for GSO 1429 * NIC for GSO
1430 * @gso_min_segs: Minimum number of segments that can be passed to the
1431 * NIC for GSO
1419 * 1432 *
1420 * @dcbnl_ops: Data Center Bridging netlink ops 1433 * @dcbnl_ops: Data Center Bridging netlink ops
1421 * @num_tc: Number of traffic classes in the net device 1434 * @num_tc: Number of traffic classes in the net device
@@ -1666,7 +1679,7 @@ struct net_device {
1666 unsigned int gso_max_size; 1679 unsigned int gso_max_size;
1667#define GSO_MAX_SEGS 65535 1680#define GSO_MAX_SEGS 65535
1668 u16 gso_max_segs; 1681 u16 gso_max_segs;
1669 1682 u16 gso_min_segs;
1670#ifdef CONFIG_DCB 1683#ifdef CONFIG_DCB
1671 const struct dcbnl_rtnl_ops *dcbnl_ops; 1684 const struct dcbnl_rtnl_ops *dcbnl_ops;
1672#endif 1685#endif
@@ -1747,6 +1760,12 @@ struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
1747 return &dev->_tx[index]; 1760 return &dev->_tx[index];
1748} 1761}
1749 1762
1763static inline struct netdev_queue *skb_get_tx_queue(const struct net_device *dev,
1764 const struct sk_buff *skb)
1765{
1766 return netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
1767}
1768
1750static inline void netdev_for_each_tx_queue(struct net_device *dev, 1769static inline void netdev_for_each_tx_queue(struct net_device *dev,
1751 void (*f)(struct net_device *, 1770 void (*f)(struct net_device *,
1752 struct netdev_queue *, 1771 struct netdev_queue *,
@@ -1781,24 +1800,13 @@ void dev_net_set(struct net_device *dev, struct net *net)
1781#endif 1800#endif
1782} 1801}
1783 1802
1784static inline bool netdev_uses_dsa_tags(struct net_device *dev) 1803static inline bool netdev_uses_dsa(struct net_device *dev)
1785{ 1804{
1786#ifdef CONFIG_NET_DSA_TAG_DSA 1805#if IS_ENABLED(CONFIG_NET_DSA)
1787 if (dev->dsa_ptr != NULL)
1788 return dsa_uses_dsa_tags(dev->dsa_ptr);
1789#endif
1790
1791 return 0;
1792}
1793
1794static inline bool netdev_uses_trailer_tags(struct net_device *dev)
1795{
1796#ifdef CONFIG_NET_DSA_TAG_TRAILER
1797 if (dev->dsa_ptr != NULL) 1806 if (dev->dsa_ptr != NULL)
1798 return dsa_uses_trailer_tags(dev->dsa_ptr); 1807 return dsa_uses_tagged_protocol(dev->dsa_ptr);
1799#endif 1808#endif
1800 1809 return false;
1801 return 0;
1802} 1810}
1803 1811
1804/** 1812/**
@@ -1879,11 +1887,20 @@ struct napi_gro_cb {
1879 /* jiffies when first packet was created/queued */ 1887 /* jiffies when first packet was created/queued */
1880 unsigned long age; 1888 unsigned long age;
1881 1889
1882 /* Used in ipv6_gro_receive() */ 1890 /* Used in ipv6_gro_receive() and foo-over-udp */
1883 u16 proto; 1891 u16 proto;
1884 1892
1885 /* Used in udp_gro_receive */ 1893 /* Used in udp_gro_receive */
1886 u16 udp_mark; 1894 u8 udp_mark:1;
1895
1896 /* GRO checksum is valid */
1897 u8 csum_valid:1;
1898
1899 /* Number of checksums via CHECKSUM_UNNECESSARY */
1900 u8 csum_cnt:3;
1901
1902 /* Used in foo-over-udp, set in udp[46]_gro_receive */
1903 u8 is_ipv6:1;
1887 1904
1888 /* used to support CHECKSUM_COMPLETE for tunneling protocols */ 1905 /* used to support CHECKSUM_COMPLETE for tunneling protocols */
1889 __wsum csum; 1906 __wsum csum;
@@ -1910,7 +1927,6 @@ struct packet_type {
1910struct offload_callbacks { 1927struct offload_callbacks {
1911 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1928 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1912 netdev_features_t features); 1929 netdev_features_t features);
1913 int (*gso_send_check)(struct sk_buff *skb);
1914 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1930 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1915 struct sk_buff *skb); 1931 struct sk_buff *skb);
1916 int (*gro_complete)(struct sk_buff *skb, int nhoff); 1932 int (*gro_complete)(struct sk_buff *skb, int nhoff);
@@ -1924,6 +1940,7 @@ struct packet_offload {
1924 1940
1925struct udp_offload { 1941struct udp_offload {
1926 __be16 port; 1942 __be16 port;
1943 u8 ipproto;
1927 struct offload_callbacks callbacks; 1944 struct offload_callbacks callbacks;
1928}; 1945};
1929 1946
@@ -1982,6 +1999,7 @@ struct pcpu_sw_netstats {
1982#define NETDEV_CHANGEUPPER 0x0015 1999#define NETDEV_CHANGEUPPER 0x0015
1983#define NETDEV_RESEND_IGMP 0x0016 2000#define NETDEV_RESEND_IGMP 0x0016
1984#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */ 2001#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */
2002#define NETDEV_CHANGEINFODATA 0x0018
1985 2003
1986int register_netdevice_notifier(struct notifier_block *nb); 2004int register_netdevice_notifier(struct notifier_block *nb);
1987int unregister_netdevice_notifier(struct notifier_block *nb); 2005int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -2074,8 +2092,8 @@ void __dev_remove_pack(struct packet_type *pt);
2074void dev_add_offload(struct packet_offload *po); 2092void dev_add_offload(struct packet_offload *po);
2075void dev_remove_offload(struct packet_offload *po); 2093void dev_remove_offload(struct packet_offload *po);
2076 2094
2077struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 2095struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
2078 unsigned short mask); 2096 unsigned short mask);
2079struct net_device *dev_get_by_name(struct net *net, const char *name); 2097struct net_device *dev_get_by_name(struct net *net, const char *name);
2080struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 2098struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
2081struct net_device *__dev_get_by_name(struct net *net, const char *name); 2099struct net_device *__dev_get_by_name(struct net *net, const char *name);
@@ -2153,11 +2171,97 @@ static inline void *skb_gro_network_header(struct sk_buff *skb)
2153static inline void skb_gro_postpull_rcsum(struct sk_buff *skb, 2171static inline void skb_gro_postpull_rcsum(struct sk_buff *skb,
2154 const void *start, unsigned int len) 2172 const void *start, unsigned int len)
2155{ 2173{
2156 if (skb->ip_summed == CHECKSUM_COMPLETE) 2174 if (NAPI_GRO_CB(skb)->csum_valid)
2157 NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum, 2175 NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum,
2158 csum_partial(start, len, 0)); 2176 csum_partial(start, len, 0));
2159} 2177}
2160 2178
2179/* GRO checksum functions. These are logical equivalents of the normal
2180 * checksum functions (in skbuff.h) except that they operate on the GRO
2181 * offsets and fields in sk_buff.
2182 */
2183
2184__sum16 __skb_gro_checksum_complete(struct sk_buff *skb);
2185
2186static inline bool __skb_gro_checksum_validate_needed(struct sk_buff *skb,
2187 bool zero_okay,
2188 __sum16 check)
2189{
2190 return (skb->ip_summed != CHECKSUM_PARTIAL &&
2191 NAPI_GRO_CB(skb)->csum_cnt == 0 &&
2192 (!zero_okay || check));
2193}
2194
2195static inline __sum16 __skb_gro_checksum_validate_complete(struct sk_buff *skb,
2196 __wsum psum)
2197{
2198 if (NAPI_GRO_CB(skb)->csum_valid &&
2199 !csum_fold(csum_add(psum, NAPI_GRO_CB(skb)->csum)))
2200 return 0;
2201
2202 NAPI_GRO_CB(skb)->csum = psum;
2203
2204 return __skb_gro_checksum_complete(skb);
2205}
2206
2207static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
2208{
2209 if (NAPI_GRO_CB(skb)->csum_cnt > 0) {
2210 /* Consume a checksum from CHECKSUM_UNNECESSARY */
2211 NAPI_GRO_CB(skb)->csum_cnt--;
2212 } else {
2213 /* Update skb for CHECKSUM_UNNECESSARY and csum_level when we
2214 * verified a new top level checksum or an encapsulated one
2215 * during GRO. This saves work if we fallback to normal path.
2216 */
2217 __skb_incr_checksum_unnecessary(skb);
2218 }
2219}
2220
2221#define __skb_gro_checksum_validate(skb, proto, zero_okay, check, \
2222 compute_pseudo) \
2223({ \
2224 __sum16 __ret = 0; \
2225 if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \
2226 __ret = __skb_gro_checksum_validate_complete(skb, \
2227 compute_pseudo(skb, proto)); \
2228 if (__ret) \
2229 __skb_mark_checksum_bad(skb); \
2230 else \
2231 skb_gro_incr_csum_unnecessary(skb); \
2232 __ret; \
2233})
2234
2235#define skb_gro_checksum_validate(skb, proto, compute_pseudo) \
2236 __skb_gro_checksum_validate(skb, proto, false, 0, compute_pseudo)
2237
2238#define skb_gro_checksum_validate_zero_check(skb, proto, check, \
2239 compute_pseudo) \
2240 __skb_gro_checksum_validate(skb, proto, true, check, compute_pseudo)
2241
2242#define skb_gro_checksum_simple_validate(skb) \
2243 __skb_gro_checksum_validate(skb, 0, false, 0, null_compute_pseudo)
2244
2245static inline bool __skb_gro_checksum_convert_check(struct sk_buff *skb)
2246{
2247 return (NAPI_GRO_CB(skb)->csum_cnt == 0 &&
2248 !NAPI_GRO_CB(skb)->csum_valid);
2249}
2250
2251static inline void __skb_gro_checksum_convert(struct sk_buff *skb,
2252 __sum16 check, __wsum pseudo)
2253{
2254 NAPI_GRO_CB(skb)->csum = ~pseudo;
2255 NAPI_GRO_CB(skb)->csum_valid = 1;
2256}
2257
2258#define skb_gro_checksum_try_convert(skb, proto, check, compute_pseudo) \
2259do { \
2260 if (__skb_gro_checksum_convert_check(skb)) \
2261 __skb_gro_checksum_convert(skb, check, \
2262 compute_pseudo(skb, proto)); \
2263} while (0)
2264
2161static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 2265static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
2162 unsigned short type, 2266 unsigned short type,
2163 const void *daddr, const void *saddr, 2267 const void *daddr, const void *saddr,
@@ -2261,12 +2365,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
2261DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 2365DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
2262 2366
2263void __netif_schedule(struct Qdisc *q); 2367void __netif_schedule(struct Qdisc *q);
2264 2368void netif_schedule_queue(struct netdev_queue *txq);
2265static inline void netif_schedule_queue(struct netdev_queue *txq)
2266{
2267 if (!(txq->state & QUEUE_STATE_ANY_XOFF))
2268 __netif_schedule(txq->qdisc);
2269}
2270 2369
2271static inline void netif_tx_schedule_all(struct net_device *dev) 2370static inline void netif_tx_schedule_all(struct net_device *dev)
2272{ 2371{
@@ -2302,11 +2401,7 @@ static inline void netif_tx_start_all_queues(struct net_device *dev)
2302 } 2401 }
2303} 2402}
2304 2403
2305static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) 2404void netif_tx_wake_queue(struct netdev_queue *dev_queue);
2306{
2307 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
2308 __netif_schedule(dev_queue->qdisc);
2309}
2310 2405
2311/** 2406/**
2312 * netif_wake_queue - restart transmit 2407 * netif_wake_queue - restart transmit
@@ -2394,6 +2489,34 @@ netif_xmit_frozen_or_drv_stopped(const struct netdev_queue *dev_queue)
2394 return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN; 2489 return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN;
2395} 2490}
2396 2491
2492/**
2493 * netdev_txq_bql_enqueue_prefetchw - prefetch bql data for write
2494 * @dev_queue: pointer to transmit queue
2495 *
2496 * BQL enabled drivers might use this helper in their ndo_start_xmit(),
2497 * to give appropriate hint to the cpu.
2498 */
2499static inline void netdev_txq_bql_enqueue_prefetchw(struct netdev_queue *dev_queue)
2500{
2501#ifdef CONFIG_BQL
2502 prefetchw(&dev_queue->dql.num_queued);
2503#endif
2504}
2505
2506/**
2507 * netdev_txq_bql_complete_prefetchw - prefetch bql data for write
2508 * @dev_queue: pointer to transmit queue
2509 *
2510 * BQL enabled drivers might use this helper in their TX completion path,
2511 * to give appropriate hint to the cpu.
2512 */
2513static inline void netdev_txq_bql_complete_prefetchw(struct netdev_queue *dev_queue)
2514{
2515#ifdef CONFIG_BQL
2516 prefetchw(&dev_queue->dql.limit);
2517#endif
2518}
2519
2397static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, 2520static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
2398 unsigned int bytes) 2521 unsigned int bytes)
2399{ 2522{
@@ -2578,19 +2701,7 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev,
2578 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); 2701 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
2579} 2702}
2580 2703
2581/** 2704void netif_wake_subqueue(struct net_device *dev, u16 queue_index);
2582 * netif_wake_subqueue - allow sending packets on subqueue
2583 * @dev: network device
2584 * @queue_index: sub queue index
2585 *
2586 * Resume individual transmit queue of a device with multiple transmit queues.
2587 */
2588static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2589{
2590 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2591 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
2592 __netif_schedule(txq->qdisc);
2593}
2594 2705
2595#ifdef CONFIG_XPS 2706#ifdef CONFIG_XPS
2596int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, 2707int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
@@ -2754,8 +2865,9 @@ int dev_set_mac_address(struct net_device *, struct sockaddr *);
2754int dev_change_carrier(struct net_device *, bool new_carrier); 2865int dev_change_carrier(struct net_device *, bool new_carrier);
2755int dev_get_phys_port_id(struct net_device *dev, 2866int dev_get_phys_port_id(struct net_device *dev,
2756 struct netdev_phys_port_id *ppid); 2867 struct netdev_phys_port_id *ppid);
2757int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2868struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
2758 struct netdev_queue *txq); 2869struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2870 struct netdev_queue *txq, int *ret);
2759int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2871int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2760int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2872int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2761bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb); 2873bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
@@ -3357,6 +3469,27 @@ int __init dev_proc_init(void);
3357#define dev_proc_init() 0 3469#define dev_proc_init() 0
3358#endif 3470#endif
3359 3471
3472static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops,
3473 struct sk_buff *skb, struct net_device *dev,
3474 bool more)
3475{
3476 skb->xmit_more = more ? 1 : 0;
3477 return ops->ndo_start_xmit(skb, dev);
3478}
3479
3480static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev,
3481 struct netdev_queue *txq, bool more)
3482{
3483 const struct net_device_ops *ops = dev->netdev_ops;
3484 int rc;
3485
3486 rc = __netdev_start_xmit(ops, skb, dev, more);
3487 if (rc == NETDEV_TX_OK)
3488 txq_trans_update(txq);
3489
3490 return rc;
3491}
3492
3360int netdev_class_create_file_ns(struct class_attribute *class_attr, 3493int netdev_class_create_file_ns(struct class_attribute *class_attr,
3361 const void *ns); 3494 const void *ns);
3362void netdev_class_remove_file_ns(struct class_attribute *class_attr, 3495void netdev_class_remove_file_ns(struct class_attribute *class_attr,
@@ -3447,10 +3580,12 @@ static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
3447 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 3580 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
3448} 3581}
3449 3582
3450static inline bool netif_needs_gso(struct sk_buff *skb, 3583static inline bool netif_needs_gso(struct net_device *dev, struct sk_buff *skb,
3451 netdev_features_t features) 3584 netdev_features_t features)
3452{ 3585{
3453 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 3586 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
3587 (dev->netdev_ops->ndo_gso_check &&
3588 !dev->netdev_ops->ndo_gso_check(skb, dev)) ||
3454 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) && 3589 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) &&
3455 (skb->ip_summed != CHECKSUM_UNNECESSARY))); 3590 (skb->ip_summed != CHECKSUM_UNNECESSARY)));
3456} 3591}
@@ -3494,6 +3629,12 @@ static inline bool netif_supports_nofcs(struct net_device *dev)
3494 return dev->priv_flags & IFF_SUPP_NOFCS; 3629 return dev->priv_flags & IFF_SUPP_NOFCS;
3495} 3630}
3496 3631
3632/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
3633static inline void netif_keep_dst(struct net_device *dev)
3634{
3635 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM);
3636}
3637
3497extern struct pernet_operations __net_initdata loopback_net_ops; 3638extern struct pernet_operations __net_initdata loopback_net_ops;
3498 3639
3499/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3640/* Logging, debugging and troubleshooting/diagnostic helpers. */
@@ -3523,22 +3664,22 @@ static inline const char *netdev_reg_state(const struct net_device *dev)
3523} 3664}
3524 3665
3525__printf(3, 4) 3666__printf(3, 4)
3526int netdev_printk(const char *level, const struct net_device *dev, 3667void netdev_printk(const char *level, const struct net_device *dev,
3527 const char *format, ...); 3668 const char *format, ...);
3528__printf(2, 3) 3669__printf(2, 3)
3529int netdev_emerg(const struct net_device *dev, const char *format, ...); 3670void netdev_emerg(const struct net_device *dev, const char *format, ...);
3530__printf(2, 3) 3671__printf(2, 3)
3531int netdev_alert(const struct net_device *dev, const char *format, ...); 3672void netdev_alert(const struct net_device *dev, const char *format, ...);
3532__printf(2, 3) 3673__printf(2, 3)
3533int netdev_crit(const struct net_device *dev, const char *format, ...); 3674void netdev_crit(const struct net_device *dev, const char *format, ...);
3534__printf(2, 3) 3675__printf(2, 3)
3535int netdev_err(const struct net_device *dev, const char *format, ...); 3676void netdev_err(const struct net_device *dev, const char *format, ...);
3536__printf(2, 3) 3677__printf(2, 3)
3537int netdev_warn(const struct net_device *dev, const char *format, ...); 3678void netdev_warn(const struct net_device *dev, const char *format, ...);
3538__printf(2, 3) 3679__printf(2, 3)
3539int netdev_notice(const struct net_device *dev, const char *format, ...); 3680void netdev_notice(const struct net_device *dev, const char *format, ...);
3540__printf(2, 3) 3681__printf(2, 3)
3541int netdev_info(const struct net_device *dev, const char *format, ...); 3682void netdev_info(const struct net_device *dev, const char *format, ...);
3542 3683
3543#define MODULE_ALIAS_NETDEV(device) \ 3684#define MODULE_ALIAS_NETDEV(device) \
3544 MODULE_ALIAS("netdev-" device) 3685 MODULE_ALIAS("netdev-" device)
@@ -3556,7 +3697,6 @@ do { \
3556({ \ 3697({ \
3557 if (0) \ 3698 if (0) \
3558 netdev_printk(KERN_DEBUG, __dev, format, ##args); \ 3699 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
3559 0; \
3560}) 3700})
3561#endif 3701#endif
3562 3702
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 96afc29184be..f1606fa6132d 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -57,6 +57,8 @@ enum ip_set_extension {
57 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER), 57 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER),
58 IPSET_EXT_BIT_COMMENT = 2, 58 IPSET_EXT_BIT_COMMENT = 2,
59 IPSET_EXT_COMMENT = (1 << IPSET_EXT_BIT_COMMENT), 59 IPSET_EXT_COMMENT = (1 << IPSET_EXT_BIT_COMMENT),
60 IPSET_EXT_BIT_SKBINFO = 3,
61 IPSET_EXT_SKBINFO = (1 << IPSET_EXT_BIT_SKBINFO),
60 /* Mark set with an extension which needs to call destroy */ 62 /* Mark set with an extension which needs to call destroy */
61 IPSET_EXT_BIT_DESTROY = 7, 63 IPSET_EXT_BIT_DESTROY = 7,
62 IPSET_EXT_DESTROY = (1 << IPSET_EXT_BIT_DESTROY), 64 IPSET_EXT_DESTROY = (1 << IPSET_EXT_BIT_DESTROY),
@@ -65,12 +67,14 @@ enum ip_set_extension {
65#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) 67#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT)
66#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) 68#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER)
67#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT) 69#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT)
70#define SET_WITH_SKBINFO(s) ((s)->extensions & IPSET_EXT_SKBINFO)
68#define SET_WITH_FORCEADD(s) ((s)->flags & IPSET_CREATE_FLAG_FORCEADD) 71#define SET_WITH_FORCEADD(s) ((s)->flags & IPSET_CREATE_FLAG_FORCEADD)
69 72
70/* Extension id, in size order */ 73/* Extension id, in size order */
71enum ip_set_ext_id { 74enum ip_set_ext_id {
72 IPSET_EXT_ID_COUNTER = 0, 75 IPSET_EXT_ID_COUNTER = 0,
73 IPSET_EXT_ID_TIMEOUT, 76 IPSET_EXT_ID_TIMEOUT,
77 IPSET_EXT_ID_SKBINFO,
74 IPSET_EXT_ID_COMMENT, 78 IPSET_EXT_ID_COMMENT,
75 IPSET_EXT_ID_MAX, 79 IPSET_EXT_ID_MAX,
76}; 80};
@@ -92,6 +96,10 @@ struct ip_set_ext {
92 u64 packets; 96 u64 packets;
93 u64 bytes; 97 u64 bytes;
94 u32 timeout; 98 u32 timeout;
99 u32 skbmark;
100 u32 skbmarkmask;
101 u32 skbprio;
102 u16 skbqueue;
95 char *comment; 103 char *comment;
96}; 104};
97 105
@@ -104,6 +112,13 @@ struct ip_set_comment {
104 char *str; 112 char *str;
105}; 113};
106 114
115struct ip_set_skbinfo {
116 u32 skbmark;
117 u32 skbmarkmask;
118 u32 skbprio;
119 u16 skbqueue;
120};
121
107struct ip_set; 122struct ip_set;
108 123
109#define ext_timeout(e, s) \ 124#define ext_timeout(e, s) \
@@ -112,7 +127,8 @@ struct ip_set;
112(struct ip_set_counter *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COUNTER]) 127(struct ip_set_counter *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COUNTER])
113#define ext_comment(e, s) \ 128#define ext_comment(e, s) \
114(struct ip_set_comment *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COMMENT]) 129(struct ip_set_comment *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COMMENT])
115 130#define ext_skbinfo(e, s) \
131(struct ip_set_skbinfo *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_SKBINFO])
116 132
117typedef int (*ipset_adtfn)(struct ip_set *set, void *value, 133typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
118 const struct ip_set_ext *ext, 134 const struct ip_set_ext *ext,
@@ -256,6 +272,8 @@ ip_set_put_flags(struct sk_buff *skb, struct ip_set *set)
256 cadt_flags |= IPSET_FLAG_WITH_COUNTERS; 272 cadt_flags |= IPSET_FLAG_WITH_COUNTERS;
257 if (SET_WITH_COMMENT(set)) 273 if (SET_WITH_COMMENT(set))
258 cadt_flags |= IPSET_FLAG_WITH_COMMENT; 274 cadt_flags |= IPSET_FLAG_WITH_COMMENT;
275 if (SET_WITH_SKBINFO(set))
276 cadt_flags |= IPSET_FLAG_WITH_SKBINFO;
259 if (SET_WITH_FORCEADD(set)) 277 if (SET_WITH_FORCEADD(set))
260 cadt_flags |= IPSET_FLAG_WITH_FORCEADD; 278 cadt_flags |= IPSET_FLAG_WITH_FORCEADD;
261 279
@@ -304,6 +322,43 @@ ip_set_update_counter(struct ip_set_counter *counter,
304 } 322 }
305} 323}
306 324
325static inline void
326ip_set_get_skbinfo(struct ip_set_skbinfo *skbinfo,
327 const struct ip_set_ext *ext,
328 struct ip_set_ext *mext, u32 flags)
329{
330 mext->skbmark = skbinfo->skbmark;
331 mext->skbmarkmask = skbinfo->skbmarkmask;
332 mext->skbprio = skbinfo->skbprio;
333 mext->skbqueue = skbinfo->skbqueue;
334}
335static inline bool
336ip_set_put_skbinfo(struct sk_buff *skb, struct ip_set_skbinfo *skbinfo)
337{
338 /* Send nonzero parameters only */
339 return ((skbinfo->skbmark || skbinfo->skbmarkmask) &&
340 nla_put_net64(skb, IPSET_ATTR_SKBMARK,
341 cpu_to_be64((u64)skbinfo->skbmark << 32 |
342 skbinfo->skbmarkmask))) ||
343 (skbinfo->skbprio &&
344 nla_put_net32(skb, IPSET_ATTR_SKBPRIO,
345 cpu_to_be32(skbinfo->skbprio))) ||
346 (skbinfo->skbqueue &&
347 nla_put_net16(skb, IPSET_ATTR_SKBQUEUE,
348 cpu_to_be16(skbinfo->skbqueue)));
349
350}
351
352static inline void
353ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo,
354 const struct ip_set_ext *ext)
355{
356 skbinfo->skbmark = ext->skbmark;
357 skbinfo->skbmarkmask = ext->skbmarkmask;
358 skbinfo->skbprio = ext->skbprio;
359 skbinfo->skbqueue = ext->skbqueue;
360}
361
307static inline bool 362static inline bool
308ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter) 363ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter)
309{ 364{
@@ -497,6 +552,9 @@ ip_set_put_extensions(struct sk_buff *skb, const struct ip_set *set,
497 if (SET_WITH_COMMENT(set) && 552 if (SET_WITH_COMMENT(set) &&
498 ip_set_put_comment(skb, ext_comment(e, set))) 553 ip_set_put_comment(skb, ext_comment(e, set)))
499 return -EMSGSIZE; 554 return -EMSGSIZE;
555 if (SET_WITH_SKBINFO(set) &&
556 ip_set_put_skbinfo(skb, ext_skbinfo(e, set)))
557 return -EMSGSIZE;
500 return 0; 558 return 0;
501} 559}
502 560
diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h
index 68c2aea897f5..fe2622a00151 100644
--- a/include/linux/netfilter/ipset/ip_set_list.h
+++ b/include/linux/netfilter/ipset/ip_set_list.h
@@ -6,5 +6,6 @@
6 6
7#define IP_SET_LIST_DEFAULT_SIZE 8 7#define IP_SET_LIST_DEFAULT_SIZE 8
8#define IP_SET_LIST_MIN_SIZE 4 8#define IP_SET_LIST_MIN_SIZE 4
9#define IP_SET_LIST_MAX_SIZE 65536
9 10
10#endif /* __IP_SET_LIST_H */ 11#endif /* __IP_SET_LIST_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 8ab1c278b66d..c755e4971fa3 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -15,7 +15,7 @@ enum nf_br_hook_priorities {
15 NF_BR_PRI_LAST = INT_MAX, 15 NF_BR_PRI_LAST = INT_MAX,
16}; 16};
17 17
18#ifdef CONFIG_BRIDGE_NETFILTER 18#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
19 19
20#define BRNF_PKT_TYPE 0x01 20#define BRNF_PKT_TYPE 0x01
21#define BRNF_BRIDGED_DNAT 0x02 21#define BRNF_BRIDGED_DNAT 0x02
@@ -24,16 +24,6 @@ enum nf_br_hook_priorities {
24#define BRNF_8021Q 0x10 24#define BRNF_8021Q 0x10
25#define BRNF_PPPoE 0x20 25#define BRNF_PPPoE 0x20
26 26
27/* Only used in br_forward.c */
28int nf_bridge_copy_header(struct sk_buff *skb);
29static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
30{
31 if (skb->nf_bridge &&
32 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
33 return nf_bridge_copy_header(skb);
34 return 0;
35}
36
37static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) 27static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
38{ 28{
39 switch (skb->protocol) { 29 switch (skb->protocol) {
@@ -46,6 +36,44 @@ static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
46 } 36 }
47} 37}
48 38
39static inline void nf_bridge_update_protocol(struct sk_buff *skb)
40{
41 if (skb->nf_bridge->mask & BRNF_8021Q)
42 skb->protocol = htons(ETH_P_8021Q);
43 else if (skb->nf_bridge->mask & BRNF_PPPoE)
44 skb->protocol = htons(ETH_P_PPP_SES);
45}
46
47/* Fill in the header for fragmented IP packets handled by
48 * the IPv4 connection tracking code.
49 *
50 * Only used in br_forward.c
51 */
52static inline int nf_bridge_copy_header(struct sk_buff *skb)
53{
54 int err;
55 unsigned int header_size;
56
57 nf_bridge_update_protocol(skb);
58 header_size = ETH_HLEN + nf_bridge_encap_header_len(skb);
59 err = skb_cow_head(skb, header_size);
60 if (err)
61 return err;
62
63 skb_copy_to_linear_data_offset(skb, -header_size,
64 skb->nf_bridge->data, header_size);
65 __skb_push(skb, nf_bridge_encap_header_len(skb));
66 return 0;
67}
68
69static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
70{
71 if (skb->nf_bridge &&
72 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
73 return nf_bridge_copy_header(skb);
74 return 0;
75}
76
49static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) 77static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
50{ 78{
51 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE)) 79 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE))
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index a1e3064a8d99..356acc2846fd 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -110,6 +110,20 @@ enum nfs_opnum4 {
110 OP_DESTROY_CLIENTID = 57, 110 OP_DESTROY_CLIENTID = 57,
111 OP_RECLAIM_COMPLETE = 58, 111 OP_RECLAIM_COMPLETE = 58,
112 112
113 /* nfs42 */
114 OP_ALLOCATE = 59,
115 OP_COPY = 60,
116 OP_COPY_NOTIFY = 61,
117 OP_DEALLOCATE = 62,
118 OP_IO_ADVISE = 63,
119 OP_LAYOUTERROR = 64,
120 OP_LAYOUTSTATS = 65,
121 OP_OFFLOAD_CANCEL = 66,
122 OP_OFFLOAD_STATUS = 67,
123 OP_READ_PLUS = 68,
124 OP_SEEK = 69,
125 OP_WRITE_SAME = 70,
126
113 OP_ILLEGAL = 10044, 127 OP_ILLEGAL = 10044,
114}; 128};
115 129
@@ -117,10 +131,10 @@ enum nfs_opnum4 {
117Needs to be updated if more operations are defined in future.*/ 131Needs to be updated if more operations are defined in future.*/
118 132
119#define FIRST_NFS4_OP OP_ACCESS 133#define FIRST_NFS4_OP OP_ACCESS
120#define LAST_NFS4_OP OP_RECLAIM_COMPLETE 134#define LAST_NFS4_OP OP_WRITE_SAME
121#define LAST_NFS40_OP OP_RELEASE_LOCKOWNER 135#define LAST_NFS40_OP OP_RELEASE_LOCKOWNER
122#define LAST_NFS41_OP OP_RECLAIM_COMPLETE 136#define LAST_NFS41_OP OP_RECLAIM_COMPLETE
123#define LAST_NFS42_OP OP_RECLAIM_COMPLETE 137#define LAST_NFS42_OP OP_WRITE_SAME
124 138
125enum nfsstat4 { 139enum nfsstat4 {
126 NFS4_OK = 0, 140 NFS4_OK = 0,
@@ -235,10 +249,11 @@ enum nfsstat4 {
235 /* nfs42 */ 249 /* nfs42 */
236 NFS4ERR_PARTNER_NOTSUPP = 10088, 250 NFS4ERR_PARTNER_NOTSUPP = 10088,
237 NFS4ERR_PARTNER_NO_AUTH = 10089, 251 NFS4ERR_PARTNER_NO_AUTH = 10089,
238 NFS4ERR_METADATA_NOTSUPP = 10090, 252 NFS4ERR_UNION_NOTSUPP = 10090,
239 NFS4ERR_OFFLOAD_DENIED = 10091, 253 NFS4ERR_OFFLOAD_DENIED = 10091,
240 NFS4ERR_WRONG_LFS = 10092, 254 NFS4ERR_WRONG_LFS = 10092,
241 NFS4ERR_BADLABEL = 10093, 255 NFS4ERR_BADLABEL = 10093,
256 NFS4ERR_OFFLOAD_NO_REQS = 10094,
242}; 257};
243 258
244static inline bool seqid_mutating_err(u32 err) 259static inline bool seqid_mutating_err(u32 err)
@@ -472,6 +487,9 @@ enum {
472 NFSPROC4_CLNT_GETDEVICELIST, 487 NFSPROC4_CLNT_GETDEVICELIST,
473 NFSPROC4_CLNT_BIND_CONN_TO_SESSION, 488 NFSPROC4_CLNT_BIND_CONN_TO_SESSION,
474 NFSPROC4_CLNT_DESTROY_CLIENTID, 489 NFSPROC4_CLNT_DESTROY_CLIENTID,
490
491 /* nfs42 */
492 NFSPROC4_CLNT_SEEK,
475}; 493};
476 494
477/* nfs41 types */ 495/* nfs41 types */
@@ -535,4 +553,9 @@ struct nfs4_deviceid {
535 char data[NFS4_DEVICEID4_SIZE]; 553 char data[NFS4_DEVICEID4_SIZE];
536}; 554};
537 555
556enum data_content4 {
557 NFS4_CONTENT_DATA = 0,
558 NFS4_CONTENT_HOLE = 1,
559};
560
538#endif 561#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 5180a7ededec..c72d1ad41ad4 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -443,31 +443,15 @@ static inline struct rpc_cred *nfs_file_cred(struct file *file)
443} 443}
444 444
445/* 445/*
446 * linux/fs/nfs/xattr.c
447 */
448#ifdef CONFIG_NFS_V3_ACL
449extern ssize_t nfs3_listxattr(struct dentry *, char *, size_t);
450extern ssize_t nfs3_getxattr(struct dentry *, const char *, void *, size_t);
451extern int nfs3_setxattr(struct dentry *, const char *,
452 const void *, size_t, int);
453extern int nfs3_removexattr (struct dentry *, const char *name);
454#else
455# define nfs3_listxattr NULL
456# define nfs3_getxattr NULL
457# define nfs3_setxattr NULL
458# define nfs3_removexattr NULL
459#endif
460
461/*
462 * linux/fs/nfs/direct.c 446 * linux/fs/nfs/direct.c
463 */ 447 */
464extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t); 448extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t);
465extern ssize_t nfs_file_direct_read(struct kiocb *iocb, 449extern ssize_t nfs_file_direct_read(struct kiocb *iocb,
466 struct iov_iter *iter, 450 struct iov_iter *iter,
467 loff_t pos, bool uio); 451 loff_t pos);
468extern ssize_t nfs_file_direct_write(struct kiocb *iocb, 452extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
469 struct iov_iter *iter, 453 struct iov_iter *iter,
470 loff_t pos, bool uio); 454 loff_t pos);
471 455
472/* 456/*
473 * linux/fs/nfs/dir.c 457 * linux/fs/nfs/dir.c
@@ -529,17 +513,9 @@ extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned
529extern int nfs_wb_all(struct inode *inode); 513extern int nfs_wb_all(struct inode *inode);
530extern int nfs_wb_page(struct inode *inode, struct page* page); 514extern int nfs_wb_page(struct inode *inode, struct page* page);
531extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 515extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
532#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
533extern int nfs_commit_inode(struct inode *, int); 516extern int nfs_commit_inode(struct inode *, int);
534extern struct nfs_commit_data *nfs_commitdata_alloc(void); 517extern struct nfs_commit_data *nfs_commitdata_alloc(void);
535extern void nfs_commit_free(struct nfs_commit_data *data); 518extern void nfs_commit_free(struct nfs_commit_data *data);
536#else
537static inline int
538nfs_commit_inode(struct inode *inode, int how)
539{
540 return 0;
541}
542#endif
543 519
544static inline int 520static inline int
545nfs_have_writebacks(struct inode *inode) 521nfs_have_writebacks(struct inode *inode)
@@ -557,23 +533,6 @@ extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
557 struct page *); 533 struct page *);
558 534
559/* 535/*
560 * linux/fs/nfs3proc.c
561 */
562#ifdef CONFIG_NFS_V3_ACL
563extern struct posix_acl *nfs3_get_acl(struct inode *inode, int type);
564extern int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type);
565extern int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
566 struct posix_acl *dfacl);
567extern const struct xattr_handler *nfs3_xattr_handlers[];
568#else
569static inline int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
570 struct posix_acl *dfacl)
571{
572 return 0;
573}
574#endif /* CONFIG_NFS_V3_ACL */
575
576/*
577 * inline functions 536 * inline functions
578 */ 537 */
579 538
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 922be2e050f5..a32ba0d7a98f 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -230,5 +230,6 @@ struct nfs_server {
230#define NFS_CAP_STATEID_NFSV41 (1U << 16) 230#define NFS_CAP_STATEID_NFSV41 (1U << 16)
231#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) 231#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
232#define NFS_CAP_SECURITY_LABEL (1U << 18) 232#define NFS_CAP_SECURITY_LABEL (1U << 18)
233#define NFS_CAP_SEEK (1U << 19)
233 234
234#endif 235#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 0040629894df..983876f24aed 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -252,17 +252,6 @@ struct nfs4_layoutget {
252 gfp_t gfp_flags; 252 gfp_t gfp_flags;
253}; 253};
254 254
255struct nfs4_getdevicelist_args {
256 struct nfs4_sequence_args seq_args;
257 const struct nfs_fh *fh;
258 u32 layoutclass;
259};
260
261struct nfs4_getdevicelist_res {
262 struct nfs4_sequence_res seq_res;
263 struct pnfs_devicelist *devlist;
264};
265
266struct nfs4_getdeviceinfo_args { 255struct nfs4_getdeviceinfo_args {
267 struct nfs4_sequence_args seq_args; 256 struct nfs4_sequence_args seq_args;
268 struct pnfs_device *pdev; 257 struct pnfs_device *pdev;
@@ -279,6 +268,9 @@ struct nfs4_layoutcommit_args {
279 __u64 lastbytewritten; 268 __u64 lastbytewritten;
280 struct inode *inode; 269 struct inode *inode;
281 const u32 *bitmask; 270 const u32 *bitmask;
271 size_t layoutupdate_len;
272 struct page *layoutupdate_page;
273 struct page **layoutupdate_pages;
282}; 274};
283 275
284struct nfs4_layoutcommit_res { 276struct nfs4_layoutcommit_res {
@@ -1239,6 +1231,25 @@ struct pnfs_ds_commit_info {
1239 1231
1240#endif /* CONFIG_NFS_V4_1 */ 1232#endif /* CONFIG_NFS_V4_1 */
1241 1233
1234#ifdef CONFIG_NFS_V4_2
1235struct nfs42_seek_args {
1236 struct nfs4_sequence_args seq_args;
1237
1238 struct nfs_fh *sa_fh;
1239 nfs4_stateid sa_stateid;
1240 u64 sa_offset;
1241 u32 sa_what;
1242};
1243
1244struct nfs42_seek_res {
1245 struct nfs4_sequence_res seq_res;
1246 unsigned int status;
1247
1248 u32 sr_eof;
1249 u64 sr_offset;
1250};
1251#endif
1252
1242struct nfs_page; 1253struct nfs_page;
1243 1254
1244#define NFS_PAGEVEC_SIZE (8U) 1255#define NFS_PAGEVEC_SIZE (8U)
@@ -1328,6 +1339,7 @@ struct nfs_commit_data {
1328 struct pnfs_layout_segment *lseg; 1339 struct pnfs_layout_segment *lseg;
1329 struct nfs_client *ds_clp; /* pNFS data server */ 1340 struct nfs_client *ds_clp; /* pNFS data server */
1330 int ds_commit_index; 1341 int ds_commit_index;
1342 loff_t lwb;
1331 const struct rpc_call_ops *mds_ops; 1343 const struct rpc_call_ops *mds_ops;
1332 const struct nfs_commit_completion_ops *completion_ops; 1344 const struct nfs_commit_completion_ops *completion_ops;
1333 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data); 1345 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
@@ -1346,6 +1358,7 @@ struct nfs_unlinkdata {
1346 struct inode *dir; 1358 struct inode *dir;
1347 struct rpc_cred *cred; 1359 struct rpc_cred *cred;
1348 struct nfs_fattr dir_attr; 1360 struct nfs_fattr dir_attr;
1361 long timeout;
1349}; 1362};
1350 1363
1351struct nfs_renamedata { 1364struct nfs_renamedata {
@@ -1359,6 +1372,7 @@ struct nfs_renamedata {
1359 struct dentry *new_dentry; 1372 struct dentry *new_dentry;
1360 struct nfs_fattr new_fattr; 1373 struct nfs_fattr new_fattr;
1361 void (*complete)(struct rpc_task *, struct nfs_renamedata *); 1374 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
1375 long timeout;
1362}; 1376};
1363 1377
1364struct nfs_access_entry; 1378struct nfs_access_entry;
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 1d2a6ab6b8bb..9b2022ab4d85 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -24,6 +24,19 @@ static inline void touch_nmi_watchdog(void)
24} 24}
25#endif 25#endif
26 26
27#if defined(CONFIG_HARDLOCKUP_DETECTOR)
28extern void watchdog_enable_hardlockup_detector(bool val);
29extern bool watchdog_hardlockup_detector_is_enabled(void);
30#else
31static inline void watchdog_enable_hardlockup_detector(bool val)
32{
33}
34static inline bool watchdog_hardlockup_detector_is_enabled(void)
35{
36 return true;
37}
38#endif
39
27/* 40/*
28 * Create trigger_all_cpu_backtrace() out of the arch-provided 41 * Create trigger_all_cpu_backtrace() out of the arch-provided
29 * base function. Return whether such support was available, 42 * base function. Return whether such support was available,
diff --git a/include/linux/of.h b/include/linux/of.h
index 6c4363b8ddc3..29f0adc5f3e4 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -267,14 +267,12 @@ extern int of_property_read_u64(const struct device_node *np,
267extern int of_property_read_string(struct device_node *np, 267extern int of_property_read_string(struct device_node *np,
268 const char *propname, 268 const char *propname,
269 const char **out_string); 269 const char **out_string);
270extern int of_property_read_string_index(struct device_node *np,
271 const char *propname,
272 int index, const char **output);
273extern int of_property_match_string(struct device_node *np, 270extern int of_property_match_string(struct device_node *np,
274 const char *propname, 271 const char *propname,
275 const char *string); 272 const char *string);
276extern int of_property_count_strings(struct device_node *np, 273extern int of_property_read_string_helper(struct device_node *np,
277 const char *propname); 274 const char *propname,
275 const char **out_strs, size_t sz, int index);
278extern int of_device_is_compatible(const struct device_node *device, 276extern int of_device_is_compatible(const struct device_node *device,
279 const char *); 277 const char *);
280extern int of_device_is_available(const struct device_node *device); 278extern int of_device_is_available(const struct device_node *device);
@@ -486,15 +484,9 @@ static inline int of_property_read_string(struct device_node *np,
486 return -ENOSYS; 484 return -ENOSYS;
487} 485}
488 486
489static inline int of_property_read_string_index(struct device_node *np, 487static inline int of_property_read_string_helper(struct device_node *np,
490 const char *propname, int index, 488 const char *propname,
491 const char **out_string) 489 const char **out_strs, size_t sz, int index)
492{
493 return -ENOSYS;
494}
495
496static inline int of_property_count_strings(struct device_node *np,
497 const char *propname)
498{ 490{
499 return -ENOSYS; 491 return -ENOSYS;
500} 492}
@@ -668,6 +660,70 @@ static inline int of_property_count_u64_elems(const struct device_node *np,
668} 660}
669 661
670/** 662/**
663 * of_property_read_string_array() - Read an array of strings from a multiple
664 * strings property.
665 * @np: device node from which the property value is to be read.
666 * @propname: name of the property to be searched.
667 * @out_strs: output array of string pointers.
668 * @sz: number of array elements to read.
669 *
670 * Search for a property in a device tree node and retrieve a list of
671 * terminated string values (pointer to data, not a copy) in that property.
672 *
673 * If @out_strs is NULL, the number of strings in the property is returned.
674 */
675static inline int of_property_read_string_array(struct device_node *np,
676 const char *propname, const char **out_strs,
677 size_t sz)
678{
679 return of_property_read_string_helper(np, propname, out_strs, sz, 0);
680}
681
682/**
683 * of_property_count_strings() - Find and return the number of strings from a
684 * multiple strings property.
685 * @np: device node from which the property value is to be read.
686 * @propname: name of the property to be searched.
687 *
688 * Search for a property in a device tree node and retrieve the number of null
689 * terminated string contain in it. Returns the number of strings on
690 * success, -EINVAL if the property does not exist, -ENODATA if property
691 * does not have a value, and -EILSEQ if the string is not null-terminated
692 * within the length of the property data.
693 */
694static inline int of_property_count_strings(struct device_node *np,
695 const char *propname)
696{
697 return of_property_read_string_helper(np, propname, NULL, 0, 0);
698}
699
700/**
701 * of_property_read_string_index() - Find and read a string from a multiple
702 * strings property.
703 * @np: device node from which the property value is to be read.
704 * @propname: name of the property to be searched.
705 * @index: index of the string in the list of strings
706 * @out_string: pointer to null terminated return string, modified only if
707 * return value is 0.
708 *
709 * Search for a property in a device tree node and retrieve a null
710 * terminated string value (pointer to data, not a copy) in the list of strings
711 * contained in that property.
712 * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
713 * property does not have a value, and -EILSEQ if the string is not
714 * null-terminated within the length of the property data.
715 *
716 * The out_string pointer is modified only if a valid string can be decoded.
717 */
718static inline int of_property_read_string_index(struct device_node *np,
719 const char *propname,
720 int index, const char **output)
721{
722 int rc = of_property_read_string_helper(np, propname, output, 1, index);
723 return rc < 0 ? rc : 0;
724}
725
726/**
671 * of_property_read_bool - Findfrom a property 727 * of_property_read_bool - Findfrom a property
672 * @np: device node from which the property value is to be read. 728 * @np: device node from which the property value is to be read.
673 * @propname: name of the property to be searched. 729 * @propname: name of the property to be searched.
@@ -863,4 +919,7 @@ static inline int of_changeset_update_property(struct of_changeset *ocs,
863} 919}
864#endif 920#endif
865 921
922/* CONFIG_OF_RESOLVE api */
923extern int of_resolve_phandles(struct device_node *tree);
924
866#endif /* _LINUX_OF_H */ 925#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index fb7b7221e063..8cb14eb393d6 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -23,17 +23,6 @@ struct of_pci_range {
23#define for_each_of_pci_range(parser, range) \ 23#define for_each_of_pci_range(parser, range) \
24 for (; of_pci_range_parser_one(parser, range);) 24 for (; of_pci_range_parser_one(parser, range);)
25 25
26static inline void of_pci_range_to_resource(struct of_pci_range *range,
27 struct device_node *np,
28 struct resource *res)
29{
30 res->flags = range->flags;
31 res->start = range->cpu_addr;
32 res->end = range->cpu_addr + range->size - 1;
33 res->parent = res->child = res->sibling = NULL;
34 res->name = np->full_name;
35}
36
37/* Translate a DMA address from device space to CPU space */ 26/* Translate a DMA address from device space to CPU space */
38extern u64 of_translate_dma_address(struct device_node *dev, 27extern u64 of_translate_dma_address(struct device_node *dev,
39 const __be32 *in_addr); 28 const __be32 *in_addr);
@@ -55,7 +44,9 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
55extern const __be32 *of_get_address(struct device_node *dev, int index, 44extern const __be32 *of_get_address(struct device_node *dev, int index,
56 u64 *size, unsigned int *flags); 45 u64 *size, unsigned int *flags);
57 46
47extern int pci_register_io_range(phys_addr_t addr, resource_size_t size);
58extern unsigned long pci_address_to_pio(phys_addr_t addr); 48extern unsigned long pci_address_to_pio(phys_addr_t addr);
49extern phys_addr_t pci_pio_to_address(unsigned long pio);
59 50
60extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, 51extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
61 struct device_node *node); 52 struct device_node *node);
@@ -80,6 +71,11 @@ static inline const __be32 *of_get_address(struct device_node *dev, int index,
80 return NULL; 71 return NULL;
81} 72}
82 73
74static inline phys_addr_t pci_pio_to_address(unsigned long pio)
75{
76 return 0;
77}
78
83static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser, 79static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
84 struct device_node *node) 80 struct device_node *node)
85{ 81{
@@ -138,6 +134,9 @@ extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
138 u64 *size, unsigned int *flags); 134 u64 *size, unsigned int *flags);
139extern int of_pci_address_to_resource(struct device_node *dev, int bar, 135extern int of_pci_address_to_resource(struct device_node *dev, int bar,
140 struct resource *r); 136 struct resource *r);
137extern int of_pci_range_to_resource(struct of_pci_range *range,
138 struct device_node *np,
139 struct resource *res);
141#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 140#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
142static inline int of_pci_address_to_resource(struct device_node *dev, int bar, 141static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
143 struct resource *r) 142 struct resource *r)
@@ -150,6 +149,12 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev,
150{ 149{
151 return NULL; 150 return NULL;
152} 151}
152static inline int of_pci_range_to_resource(struct of_pci_range *range,
153 struct device_node *np,
154 struct resource *res)
155{
156 return -ENOSYS;
157}
153#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 158#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
154 159
155#endif /* __OF_ADDRESS_H */ 160#endif /* __OF_ADDRESS_H */
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index dde3a4a0fa5d..1fd207e7a847 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -15,6 +15,7 @@ struct device_node *of_pci_find_child_device(struct device_node *parent,
15int of_pci_get_devfn(struct device_node *np); 15int of_pci_get_devfn(struct device_node *np);
16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); 16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
17int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 17int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
18int of_get_pci_domain_nr(struct device_node *node);
18#else 19#else
19static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) 20static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
20{ 21{
@@ -43,6 +44,18 @@ of_pci_parse_bus_range(struct device_node *node, struct resource *res)
43{ 44{
44 return -EINVAL; 45 return -EINVAL;
45} 46}
47
48static inline int
49of_get_pci_domain_nr(struct device_node *node)
50{
51 return -1;
52}
53#endif
54
55#if defined(CONFIG_OF_ADDRESS)
56int of_pci_get_host_bridge_resources(struct device_node *dev,
57 unsigned char busno, unsigned char bus_max,
58 struct list_head *resources, resource_size_t *io_base);
46#endif 59#endif
47 60
48#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI) 61#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index 5b5efae09135..ad2f67054372 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -16,7 +16,7 @@ struct reserved_mem {
16}; 16};
17 17
18struct reserved_mem_ops { 18struct reserved_mem_ops {
19 void (*device_init)(struct reserved_mem *rmem, 19 int (*device_init)(struct reserved_mem *rmem,
20 struct device *dev); 20 struct device *dev);
21 void (*device_release)(struct reserved_mem *rmem, 21 void (*device_release)(struct reserved_mem *rmem,
22 struct device *dev); 22 struct device *dev);
@@ -28,14 +28,17 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
28 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) 28 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
29 29
30#ifdef CONFIG_OF_RESERVED_MEM 30#ifdef CONFIG_OF_RESERVED_MEM
31void of_reserved_mem_device_init(struct device *dev); 31int of_reserved_mem_device_init(struct device *dev);
32void of_reserved_mem_device_release(struct device *dev); 32void of_reserved_mem_device_release(struct device *dev);
33 33
34void fdt_init_reserved_mem(void); 34void fdt_init_reserved_mem(void);
35void fdt_reserved_mem_save_node(unsigned long node, const char *uname, 35void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
36 phys_addr_t base, phys_addr_t size); 36 phys_addr_t base, phys_addr_t size);
37#else 37#else
38static inline void of_reserved_mem_device_init(struct device *dev) { } 38static inline int of_reserved_mem_device_init(struct device *dev)
39{
40 return -ENOSYS;
41}
39static inline void of_reserved_mem_device_release(struct device *pdev) { } 42static inline void of_reserved_mem_device_release(struct device *pdev) { }
40 43
41static inline void fdt_init_reserved_mem(void) { } 44static inline void fdt_init_reserved_mem(void) { }
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 6f06f8bc612c..e5a70132a240 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -306,15 +306,12 @@ extern void omap_set_dma_transfer_params(int lch, int data_type,
306 int elem_count, int frame_count, 306 int elem_count, int frame_count,
307 int sync_mode, 307 int sync_mode,
308 int dma_trigger, int src_or_dst_synch); 308 int dma_trigger, int src_or_dst_synch);
309extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode,
310 u32 color);
311extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode); 309extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
312extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode); 310extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode);
313 311
314extern void omap_set_dma_src_params(int lch, int src_port, int src_amode, 312extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
315 unsigned long src_start, 313 unsigned long src_start,
316 int src_ei, int src_fi); 314 int src_ei, int src_fi);
317extern void omap_set_dma_src_index(int lch, int eidx, int fidx);
318extern void omap_set_dma_src_data_pack(int lch, int enable); 315extern void omap_set_dma_src_data_pack(int lch, int enable);
319extern void omap_set_dma_src_burst_mode(int lch, 316extern void omap_set_dma_src_burst_mode(int lch,
320 enum omap_dma_burst_mode burst_mode); 317 enum omap_dma_burst_mode burst_mode);
@@ -322,7 +319,6 @@ extern void omap_set_dma_src_burst_mode(int lch,
322extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, 319extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
323 unsigned long dest_start, 320 unsigned long dest_start,
324 int dst_ei, int dst_fi); 321 int dst_ei, int dst_fi);
325extern void omap_set_dma_dest_index(int lch, int eidx, int fidx);
326extern void omap_set_dma_dest_data_pack(int lch, int enable); 322extern void omap_set_dma_dest_data_pack(int lch, int enable);
327extern void omap_set_dma_dest_burst_mode(int lch, 323extern void omap_set_dma_dest_burst_mode(int lch,
328 enum omap_dma_burst_mode burst_mode); 324 enum omap_dma_burst_mode burst_mode);
@@ -331,52 +327,19 @@ extern void omap_set_dma_params(int lch,
331 struct omap_dma_channel_params *params); 327 struct omap_dma_channel_params *params);
332 328
333extern void omap_dma_link_lch(int lch_head, int lch_queue); 329extern void omap_dma_link_lch(int lch_head, int lch_queue);
334extern void omap_dma_unlink_lch(int lch_head, int lch_queue);
335 330
336extern int omap_set_dma_callback(int lch, 331extern int omap_set_dma_callback(int lch,
337 void (*callback)(int lch, u16 ch_status, void *data), 332 void (*callback)(int lch, u16 ch_status, void *data),
338 void *data); 333 void *data);
339extern dma_addr_t omap_get_dma_src_pos(int lch); 334extern dma_addr_t omap_get_dma_src_pos(int lch);
340extern dma_addr_t omap_get_dma_dst_pos(int lch); 335extern dma_addr_t omap_get_dma_dst_pos(int lch);
341extern void omap_clear_dma(int lch);
342extern int omap_get_dma_active_status(int lch); 336extern int omap_get_dma_active_status(int lch);
343extern int omap_dma_running(void); 337extern int omap_dma_running(void);
344extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth, 338extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth,
345 int tparams); 339 int tparams);
346extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio,
347 unsigned char write_prio);
348extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype);
349extern void omap_set_dma_src_endian_type(int lch, enum end_type etype);
350extern int omap_get_dma_index(int lch, int *ei, int *fi);
351
352void omap_dma_global_context_save(void); 340void omap_dma_global_context_save(void);
353void omap_dma_global_context_restore(void); 341void omap_dma_global_context_restore(void);
354 342
355extern void omap_dma_disable_irq(int lch);
356
357/* Chaining APIs */
358#ifndef CONFIG_ARCH_OMAP1
359extern int omap_request_dma_chain(int dev_id, const char *dev_name,
360 void (*callback) (int lch, u16 ch_status,
361 void *data),
362 int *chain_id, int no_of_chans,
363 int chain_mode,
364 struct omap_dma_channel_params params);
365extern int omap_free_dma_chain(int chain_id);
366extern int omap_dma_chain_a_transfer(int chain_id, int src_start,
367 int dest_start, int elem_count,
368 int frame_count, void *callbk_data);
369extern int omap_start_dma_chain_transfers(int chain_id);
370extern int omap_stop_dma_chain_transfers(int chain_id);
371extern int omap_get_dma_chain_index(int chain_id, int *ei, int *fi);
372extern int omap_get_dma_chain_dst_pos(int chain_id);
373extern int omap_get_dma_chain_src_pos(int chain_id);
374
375extern int omap_modify_dma_chain_params(int chain_id,
376 struct omap_dma_channel_params params);
377extern int omap_dma_chain_status(int chain_id);
378#endif
379
380#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP) 343#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP)
381#include <mach/lcd_dma.h> 344#include <mach/lcd_dma.h>
382#else 345#else
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 647395a1a550..e8d6e1058723 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -50,6 +50,9 @@ static inline bool oom_task_origin(const struct task_struct *p)
50extern unsigned long oom_badness(struct task_struct *p, 50extern unsigned long oom_badness(struct task_struct *p,
51 struct mem_cgroup *memcg, const nodemask_t *nodemask, 51 struct mem_cgroup *memcg, const nodemask_t *nodemask,
52 unsigned long totalpages); 52 unsigned long totalpages);
53
54extern int oom_kills_count(void);
55extern void note_oom_kill(void);
53extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, 56extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
54 unsigned int points, unsigned long totalpages, 57 unsigned int points, unsigned long totalpages,
55 struct mem_cgroup *memcg, nodemask_t *nodemask, 58 struct mem_cgroup *memcg, nodemask_t *nodemask,
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 5ba1813337df..7ea069cd3257 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -24,8 +24,7 @@ enum mapping_flags {
24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ 24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ 25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ 26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27 AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */ 27 AS_EXITING = __GFP_BITS_SHIFT + 4, /* final truncate in progress */
28 AS_EXITING = __GFP_BITS_SHIFT + 5, /* final truncate in progress */
29}; 28};
30 29
31static inline void mapping_set_error(struct address_space *mapping, int error) 30static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -55,21 +54,6 @@ static inline int mapping_unevictable(struct address_space *mapping)
55 return !!mapping; 54 return !!mapping;
56} 55}
57 56
58static inline void mapping_set_balloon(struct address_space *mapping)
59{
60 set_bit(AS_BALLOON_MAP, &mapping->flags);
61}
62
63static inline void mapping_clear_balloon(struct address_space *mapping)
64{
65 clear_bit(AS_BALLOON_MAP, &mapping->flags);
66}
67
68static inline int mapping_balloon(struct address_space *mapping)
69{
70 return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags);
71}
72
73static inline void mapping_set_exiting(struct address_space *mapping) 57static inline void mapping_set_exiting(struct address_space *mapping)
74{ 58{
75 set_bit(AS_EXITING, &mapping->flags); 59 set_bit(AS_EXITING, &mapping->flags);
@@ -496,12 +480,14 @@ static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,
496} 480}
497 481
498/* 482/*
499 * This is exported only for wait_on_page_locked/wait_on_page_writeback. 483 * This is exported only for wait_on_page_locked/wait_on_page_writeback,
500 * Never use this directly! 484 * and for filesystems which need to wait on PG_private.
501 */ 485 */
502extern void wait_on_page_bit(struct page *page, int bit_nr); 486extern void wait_on_page_bit(struct page *page, int bit_nr);
503 487
504extern int wait_on_page_bit_killable(struct page *page, int bit_nr); 488extern int wait_on_page_bit_killable(struct page *page, int bit_nr);
489extern int wait_on_page_bit_killable_timeout(struct page *page,
490 int bit_nr, unsigned long timeout);
505 491
506static inline int wait_on_page_locked_killable(struct page *page) 492static inline int wait_on_page_locked_killable(struct page *page)
507{ 493{
@@ -510,6 +496,12 @@ static inline int wait_on_page_locked_killable(struct page *page)
510 return 0; 496 return 0;
511} 497}
512 498
499extern wait_queue_head_t *page_waitqueue(struct page *page);
500static inline void wake_up_page(struct page *page, int bit)
501{
502 __wake_up_bit(page_waitqueue(page), &page->flags, bit);
503}
504
513/* 505/*
514 * Wait for a page to be unlocked. 506 * Wait for a page to be unlocked.
515 * 507 *
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 64dacb7288a6..24c7728ca681 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -41,8 +41,13 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
41 41
42 if (pci_is_root_bus(pbus)) 42 if (pci_is_root_bus(pbus))
43 dev = pbus->bridge; 43 dev = pbus->bridge;
44 else 44 else {
45 /* If pbus is a virtual bus, there is no bridge to it */
46 if (!pbus->self)
47 return NULL;
48
45 dev = &pbus->self->dev; 49 dev = &pbus->self->dev;
50 }
46 51
47 return ACPI_HANDLE(dev); 52 return ACPI_HANDLE(dev);
48} 53}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 96453f9bc8ba..5be8db45e368 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -45,7 +45,7 @@
45 * In the interest of not exposing interfaces to user-space unnecessarily, 45 * In the interest of not exposing interfaces to user-space unnecessarily,
46 * the following kernel-only defines are being added here. 46 * the following kernel-only defines are being added here.
47 */ 47 */
48#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn) 48#define PCI_DEVID(bus, devfn) ((((u16)(bus)) << 8) | (devfn))
49/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ 49/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
50#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) 50#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)
51 51
@@ -457,6 +457,9 @@ struct pci_bus {
457 unsigned char primary; /* number of primary bridge */ 457 unsigned char primary; /* number of primary bridge */
458 unsigned char max_bus_speed; /* enum pci_bus_speed */ 458 unsigned char max_bus_speed; /* enum pci_bus_speed */
459 unsigned char cur_bus_speed; /* enum pci_bus_speed */ 459 unsigned char cur_bus_speed; /* enum pci_bus_speed */
460#ifdef CONFIG_PCI_DOMAINS_GENERIC
461 int domain_nr;
462#endif
460 463
461 char name[48]; 464 char name[48];
462 465
@@ -1103,6 +1106,9 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
1103 resource_size_t), 1106 resource_size_t),
1104 void *alignf_data); 1107 void *alignf_data);
1105 1108
1109
1110int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr);
1111
1106static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar) 1112static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar)
1107{ 1113{
1108 struct pci_bus_region region; 1114 struct pci_bus_region region;
@@ -1288,12 +1294,32 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
1288 */ 1294 */
1289#ifdef CONFIG_PCI_DOMAINS 1295#ifdef CONFIG_PCI_DOMAINS
1290extern int pci_domains_supported; 1296extern int pci_domains_supported;
1297int pci_get_new_domain_nr(void);
1291#else 1298#else
1292enum { pci_domains_supported = 0 }; 1299enum { pci_domains_supported = 0 };
1293static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 1300static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
1294static inline int pci_proc_domain(struct pci_bus *bus) { return 0; } 1301static inline int pci_proc_domain(struct pci_bus *bus) { return 0; }
1302static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
1295#endif /* CONFIG_PCI_DOMAINS */ 1303#endif /* CONFIG_PCI_DOMAINS */
1296 1304
1305/*
1306 * Generic implementation for PCI domain support. If your
1307 * architecture does not need custom management of PCI
1308 * domains then this implementation will be used
1309 */
1310#ifdef CONFIG_PCI_DOMAINS_GENERIC
1311static inline int pci_domain_nr(struct pci_bus *bus)
1312{
1313 return bus->domain_nr;
1314}
1315void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
1316#else
1317static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
1318 struct device *parent)
1319{
1320}
1321#endif
1322
1297/* some architectures require additional setup to direct VGA traffic */ 1323/* some architectures require additional setup to direct VGA traffic */
1298typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, 1324typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
1299 unsigned int command_bits, u32 flags); 1325 unsigned int command_bits, u32 flags);
@@ -1402,6 +1428,7 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
1402 1428
1403static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 1429static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
1404static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; } 1430static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; }
1431static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
1405 1432
1406#define dev_is_pci(d) (false) 1433#define dev_is_pci(d) (false)
1407#define dev_is_pf(d) (false) 1434#define dev_is_pf(d) (false)
@@ -1563,16 +1590,11 @@ enum pci_fixup_pass {
1563 1590
1564#ifdef CONFIG_PCI_QUIRKS 1591#ifdef CONFIG_PCI_QUIRKS
1565void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1592void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1566struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
1567int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); 1593int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
1568void pci_dev_specific_enable_acs(struct pci_dev *dev); 1594void pci_dev_specific_enable_acs(struct pci_dev *dev);
1569#else 1595#else
1570static inline void pci_fixup_device(enum pci_fixup_pass pass, 1596static inline void pci_fixup_device(enum pci_fixup_pass pass,
1571 struct pci_dev *dev) { } 1597 struct pci_dev *dev) { }
1572static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
1573{
1574 return pci_dev_get(dev);
1575}
1576static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, 1598static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
1577 u16 acs_flags) 1599 u16 acs_flags)
1578{ 1600{
@@ -1707,7 +1729,7 @@ bool pci_acs_path_enabled(struct pci_dev *start,
1707 struct pci_dev *end, u16 acs_flags); 1729 struct pci_dev *end, u16 acs_flags);
1708 1730
1709#define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ 1731#define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */
1710#define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) 1732#define PCI_VPD_LRDT_ID(x) ((x) | PCI_VPD_LRDT)
1711 1733
1712/* Large Resource Data Type Tag Item Names */ 1734/* Large Resource Data Type Tag Item Names */
1713#define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */ 1735#define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */
@@ -1834,15 +1856,17 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
1834 int (*fn)(struct pci_dev *pdev, 1856 int (*fn)(struct pci_dev *pdev,
1835 u16 alias, void *data), void *data); 1857 u16 alias, void *data), void *data);
1836 1858
1837/** 1859/* helper functions for operation of device flag */
1838 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device 1860static inline void pci_set_dev_assigned(struct pci_dev *pdev)
1839 * @pdev: the PCI device 1861{
1840 * 1862 pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
1841 * if the device is PCIE, return NULL 1863}
1842 * if the device isn't connected to a PCIe bridge (that is its parent is a 1864static inline void pci_clear_dev_assigned(struct pci_dev *pdev)
1843 * legacy PCI bridge and the bridge is directly connected to bus 0), return its 1865{
1844 * parent 1866 pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
1845 */ 1867}
1846struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev); 1868static inline bool pci_is_dev_assigned(struct pci_dev *pdev)
1847 1869{
1870 return (pdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) == PCI_DEV_FLAGS_ASSIGNED;
1871}
1848#endif /* LINUX_PCI_H */ 1872#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 5f2e559af6b0..2706ee9a4327 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -187,6 +187,4 @@ static inline int pci_get_hp_params(struct pci_dev *dev,
187 return -ENODEV; 187 return -ENODEV;
188} 188}
189#endif 189#endif
190
191void pci_configure_slot(struct pci_dev *dev);
192#endif 190#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 6ed0bb73a864..1fa99a301817 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2245,6 +2245,8 @@
2245#define PCI_VENDOR_ID_MORETON 0x15aa 2245#define PCI_VENDOR_ID_MORETON 0x15aa
2246#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000 2246#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000
2247 2247
2248#define PCI_VENDOR_ID_VMWARE 0x15ad
2249
2248#define PCI_VENDOR_ID_ZOLTRIX 0x15b0 2250#define PCI_VENDOR_ID_ZOLTRIX 0x15b0
2249#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0 2251#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0
2250 2252
@@ -2536,6 +2538,7 @@
2536#define PCI_DEVICE_ID_INTEL_EESSC 0x0008 2538#define PCI_DEVICE_ID_INTEL_EESSC 0x0008
2537#define PCI_DEVICE_ID_INTEL_SNB_IMC 0x0100 2539#define PCI_DEVICE_ID_INTEL_SNB_IMC 0x0100
2538#define PCI_DEVICE_ID_INTEL_IVB_IMC 0x0154 2540#define PCI_DEVICE_ID_INTEL_IVB_IMC 0x0154
2541#define PCI_DEVICE_ID_INTEL_IVB_E3_IMC 0x0150
2539#define PCI_DEVICE_ID_INTEL_HSW_IMC 0x0c00 2542#define PCI_DEVICE_ID_INTEL_HSW_IMC 0x0c00
2540#define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320 2543#define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320
2541#define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321 2544#define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321
@@ -2557,6 +2560,7 @@
2557#define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823 2560#define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823
2558#define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824 2561#define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824
2559#define PCI_DEVICE_ID_INTEL_MRST_SD2 0x084F 2562#define PCI_DEVICE_ID_INTEL_MRST_SD2 0x084F
2563#define PCI_DEVICE_ID_INTEL_QUARK_X1000_ILB 0x095E
2560#define PCI_DEVICE_ID_INTEL_I960 0x0960 2564#define PCI_DEVICE_ID_INTEL_I960 0x0960
2561#define PCI_DEVICE_ID_INTEL_I960RM 0x0962 2565#define PCI_DEVICE_ID_INTEL_I960RM 0x0962
2562#define PCI_DEVICE_ID_INTEL_CENTERTON_ILB 0x0c60 2566#define PCI_DEVICE_ID_INTEL_CENTERTON_ILB 0x0c60
@@ -2818,7 +2822,22 @@
2818#define PCI_DEVICE_ID_INTEL_UNC_R2PCIE 0x3c43 2822#define PCI_DEVICE_ID_INTEL_UNC_R2PCIE 0x3c43
2819#define PCI_DEVICE_ID_INTEL_UNC_R3QPI0 0x3c44 2823#define PCI_DEVICE_ID_INTEL_UNC_R3QPI0 0x3c44
2820#define PCI_DEVICE_ID_INTEL_UNC_R3QPI1 0x3c45 2824#define PCI_DEVICE_ID_INTEL_UNC_R3QPI1 0x3c45
2825#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_RAS 0x3c71 /* 15.1 */
2826#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR0 0x3c72 /* 16.2 */
2827#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR1 0x3c73 /* 16.3 */
2828#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR2 0x3c76 /* 16.6 */
2829#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR3 0x3c77 /* 16.7 */
2830#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_HA0 0x3ca0 /* 14.0 */
2831#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA 0x3ca8 /* 15.0 */
2832#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD0 0x3caa /* 15.2 */
2833#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD1 0x3cab /* 15.3 */
2834#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD2 0x3cac /* 15.4 */
2835#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD3 0x3cad /* 15.5 */
2836#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_DDRIO 0x3cb8 /* 17.0 */
2821#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0 2837#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0
2838#define PCI_DEVICE_ID_INTEL_SBRIDGE_SAD0 0x3cf4 /* 12.6 */
2839#define PCI_DEVICE_ID_INTEL_SBRIDGE_BR 0x3cf5 /* 13.6 */
2840#define PCI_DEVICE_ID_INTEL_SBRIDGE_SAD1 0x3cf6 /* 12.7 */
2822#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2841#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2823#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2842#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2824#define PCI_DEVICE_ID_INTEL_5100_19 0x65f3 2843#define PCI_DEVICE_ID_INTEL_5100_19 0x65f3
@@ -2860,6 +2879,7 @@
2860#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 2879#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
2861#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119 2880#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119
2862#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a 2881#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a
2882#define PCI_DEVICE_ID_INTEL_E6XX_CU 0x8183
2863#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186 2883#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186
2864#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 2884#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
2865#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 2885#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index cfd56046ecec..420032d41d27 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -257,9 +257,6 @@ do { \
257#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) 257#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var)))
258#define __get_cpu_var(var) (*this_cpu_ptr(&(var))) 258#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
259 259
260/* keep until we have removed all uses of __this_cpu_ptr */
261#define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
262
263/* 260/*
264 * Must be an lvalue. Since @var must be a simple identifier, 261 * Must be an lvalue. Since @var must be a simple identifier,
265 * we force a syntax error here if it isn't. 262 * we force a syntax error here if it isn't.
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index 68a64f11ce02..d5c89e0dd0e6 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -13,7 +13,7 @@
13 * 13 *
14 * The refcount will have a range of 0 to ((1U << 31) - 1), i.e. one bit less 14 * The refcount will have a range of 0 to ((1U << 31) - 1), i.e. one bit less
15 * than an atomic_t - this is because of the way shutdown works, see 15 * than an atomic_t - this is because of the way shutdown works, see
16 * percpu_ref_kill()/PCPU_COUNT_BIAS. 16 * percpu_ref_kill()/PERCPU_COUNT_BIAS.
17 * 17 *
18 * Before you call percpu_ref_kill(), percpu_ref_put() does not check for the 18 * Before you call percpu_ref_kill(), percpu_ref_put() does not check for the
19 * refcount hitting 0 - it can't, if it was in percpu mode. percpu_ref_kill() 19 * refcount hitting 0 - it can't, if it was in percpu mode. percpu_ref_kill()
@@ -49,29 +49,60 @@
49#include <linux/kernel.h> 49#include <linux/kernel.h>
50#include <linux/percpu.h> 50#include <linux/percpu.h>
51#include <linux/rcupdate.h> 51#include <linux/rcupdate.h>
52#include <linux/gfp.h>
52 53
53struct percpu_ref; 54struct percpu_ref;
54typedef void (percpu_ref_func_t)(struct percpu_ref *); 55typedef void (percpu_ref_func_t)(struct percpu_ref *);
55 56
57/* flags set in the lower bits of percpu_ref->percpu_count_ptr */
58enum {
59 __PERCPU_REF_ATOMIC = 1LU << 0, /* operating in atomic mode */
60 __PERCPU_REF_DEAD = 1LU << 1, /* (being) killed */
61 __PERCPU_REF_ATOMIC_DEAD = __PERCPU_REF_ATOMIC | __PERCPU_REF_DEAD,
62
63 __PERCPU_REF_FLAG_BITS = 2,
64};
65
66/* @flags for percpu_ref_init() */
67enum {
68 /*
69 * Start w/ ref == 1 in atomic mode. Can be switched to percpu
70 * operation using percpu_ref_switch_to_percpu(). If initialized
71 * with this flag, the ref will stay in atomic mode until
72 * percpu_ref_switch_to_percpu() is invoked on it.
73 */
74 PERCPU_REF_INIT_ATOMIC = 1 << 0,
75
76 /*
77 * Start dead w/ ref == 0 in atomic mode. Must be revived with
78 * percpu_ref_reinit() before used. Implies INIT_ATOMIC.
79 */
80 PERCPU_REF_INIT_DEAD = 1 << 1,
81};
82
56struct percpu_ref { 83struct percpu_ref {
57 atomic_t count; 84 atomic_long_t count;
58 /* 85 /*
59 * The low bit of the pointer indicates whether the ref is in percpu 86 * The low bit of the pointer indicates whether the ref is in percpu
60 * mode; if set, then get/put will manipulate the atomic_t. 87 * mode; if set, then get/put will manipulate the atomic_t.
61 */ 88 */
62 unsigned long pcpu_count_ptr; 89 unsigned long percpu_count_ptr;
63 percpu_ref_func_t *release; 90 percpu_ref_func_t *release;
64 percpu_ref_func_t *confirm_kill; 91 percpu_ref_func_t *confirm_switch;
92 bool force_atomic:1;
65 struct rcu_head rcu; 93 struct rcu_head rcu;
66}; 94};
67 95
68int __must_check percpu_ref_init(struct percpu_ref *ref, 96int __must_check percpu_ref_init(struct percpu_ref *ref,
69 percpu_ref_func_t *release); 97 percpu_ref_func_t *release, unsigned int flags,
70void percpu_ref_reinit(struct percpu_ref *ref); 98 gfp_t gfp);
71void percpu_ref_exit(struct percpu_ref *ref); 99void percpu_ref_exit(struct percpu_ref *ref);
100void percpu_ref_switch_to_atomic(struct percpu_ref *ref,
101 percpu_ref_func_t *confirm_switch);
102void percpu_ref_switch_to_percpu(struct percpu_ref *ref);
72void percpu_ref_kill_and_confirm(struct percpu_ref *ref, 103void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
73 percpu_ref_func_t *confirm_kill); 104 percpu_ref_func_t *confirm_kill);
74void __percpu_ref_kill_expedited(struct percpu_ref *ref); 105void percpu_ref_reinit(struct percpu_ref *ref);
75 106
76/** 107/**
77 * percpu_ref_kill - drop the initial ref 108 * percpu_ref_kill - drop the initial ref
@@ -88,26 +119,24 @@ static inline void percpu_ref_kill(struct percpu_ref *ref)
88 return percpu_ref_kill_and_confirm(ref, NULL); 119 return percpu_ref_kill_and_confirm(ref, NULL);
89} 120}
90 121
91#define PCPU_REF_DEAD 1
92
93/* 122/*
94 * Internal helper. Don't use outside percpu-refcount proper. The 123 * Internal helper. Don't use outside percpu-refcount proper. The
95 * function doesn't return the pointer and let the caller test it for NULL 124 * function doesn't return the pointer and let the caller test it for NULL
96 * because doing so forces the compiler to generate two conditional 125 * because doing so forces the compiler to generate two conditional
97 * branches as it can't assume that @ref->pcpu_count is not NULL. 126 * branches as it can't assume that @ref->percpu_count is not NULL.
98 */ 127 */
99static inline bool __pcpu_ref_alive(struct percpu_ref *ref, 128static inline bool __ref_is_percpu(struct percpu_ref *ref,
100 unsigned __percpu **pcpu_countp) 129 unsigned long __percpu **percpu_countp)
101{ 130{
102 unsigned long pcpu_ptr = ACCESS_ONCE(ref->pcpu_count_ptr); 131 unsigned long percpu_ptr = ACCESS_ONCE(ref->percpu_count_ptr);
103 132
104 /* paired with smp_store_release() in percpu_ref_reinit() */ 133 /* paired with smp_store_release() in percpu_ref_reinit() */
105 smp_read_barrier_depends(); 134 smp_read_barrier_depends();
106 135
107 if (unlikely(pcpu_ptr & PCPU_REF_DEAD)) 136 if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC))
108 return false; 137 return false;
109 138
110 *pcpu_countp = (unsigned __percpu *)pcpu_ptr; 139 *percpu_countp = (unsigned long __percpu *)percpu_ptr;
111 return true; 140 return true;
112} 141}
113 142
@@ -115,18 +144,20 @@ static inline bool __pcpu_ref_alive(struct percpu_ref *ref,
115 * percpu_ref_get - increment a percpu refcount 144 * percpu_ref_get - increment a percpu refcount
116 * @ref: percpu_ref to get 145 * @ref: percpu_ref to get
117 * 146 *
118 * Analagous to atomic_inc(). 147 * Analagous to atomic_long_inc().
119 */ 148 *
149 * This function is safe to call as long as @ref is between init and exit.
150 */
120static inline void percpu_ref_get(struct percpu_ref *ref) 151static inline void percpu_ref_get(struct percpu_ref *ref)
121{ 152{
122 unsigned __percpu *pcpu_count; 153 unsigned long __percpu *percpu_count;
123 154
124 rcu_read_lock_sched(); 155 rcu_read_lock_sched();
125 156
126 if (__pcpu_ref_alive(ref, &pcpu_count)) 157 if (__ref_is_percpu(ref, &percpu_count))
127 this_cpu_inc(*pcpu_count); 158 this_cpu_inc(*percpu_count);
128 else 159 else
129 atomic_inc(&ref->count); 160 atomic_long_inc(&ref->count);
130 161
131 rcu_read_unlock_sched(); 162 rcu_read_unlock_sched();
132} 163}
@@ -138,20 +169,20 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
138 * Increment a percpu refcount unless its count already reached zero. 169 * Increment a percpu refcount unless its count already reached zero.
139 * Returns %true on success; %false on failure. 170 * Returns %true on success; %false on failure.
140 * 171 *
141 * The caller is responsible for ensuring that @ref stays accessible. 172 * This function is safe to call as long as @ref is between init and exit.
142 */ 173 */
143static inline bool percpu_ref_tryget(struct percpu_ref *ref) 174static inline bool percpu_ref_tryget(struct percpu_ref *ref)
144{ 175{
145 unsigned __percpu *pcpu_count; 176 unsigned long __percpu *percpu_count;
146 int ret = false; 177 int ret;
147 178
148 rcu_read_lock_sched(); 179 rcu_read_lock_sched();
149 180
150 if (__pcpu_ref_alive(ref, &pcpu_count)) { 181 if (__ref_is_percpu(ref, &percpu_count)) {
151 this_cpu_inc(*pcpu_count); 182 this_cpu_inc(*percpu_count);
152 ret = true; 183 ret = true;
153 } else { 184 } else {
154 ret = atomic_inc_not_zero(&ref->count); 185 ret = atomic_long_inc_not_zero(&ref->count);
155 } 186 }
156 187
157 rcu_read_unlock_sched(); 188 rcu_read_unlock_sched();
@@ -166,23 +197,26 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref)
166 * Increment a percpu refcount unless it has already been killed. Returns 197 * Increment a percpu refcount unless it has already been killed. Returns
167 * %true on success; %false on failure. 198 * %true on success; %false on failure.
168 * 199 *
169 * Completion of percpu_ref_kill() in itself doesn't guarantee that tryget 200 * Completion of percpu_ref_kill() in itself doesn't guarantee that this
170 * will fail. For such guarantee, percpu_ref_kill_and_confirm() should be 201 * function will fail. For such guarantee, percpu_ref_kill_and_confirm()
171 * used. After the confirm_kill callback is invoked, it's guaranteed that 202 * should be used. After the confirm_kill callback is invoked, it's
172 * no new reference will be given out by percpu_ref_tryget(). 203 * guaranteed that no new reference will be given out by
204 * percpu_ref_tryget_live().
173 * 205 *
174 * The caller is responsible for ensuring that @ref stays accessible. 206 * This function is safe to call as long as @ref is between init and exit.
175 */ 207 */
176static inline bool percpu_ref_tryget_live(struct percpu_ref *ref) 208static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
177{ 209{
178 unsigned __percpu *pcpu_count; 210 unsigned long __percpu *percpu_count;
179 int ret = false; 211 int ret = false;
180 212
181 rcu_read_lock_sched(); 213 rcu_read_lock_sched();
182 214
183 if (__pcpu_ref_alive(ref, &pcpu_count)) { 215 if (__ref_is_percpu(ref, &percpu_count)) {
184 this_cpu_inc(*pcpu_count); 216 this_cpu_inc(*percpu_count);
185 ret = true; 217 ret = true;
218 } else if (!(ACCESS_ONCE(ref->percpu_count_ptr) & __PERCPU_REF_DEAD)) {
219 ret = atomic_long_inc_not_zero(&ref->count);
186 } 220 }
187 221
188 rcu_read_unlock_sched(); 222 rcu_read_unlock_sched();
@@ -196,16 +230,18 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
196 * 230 *
197 * Decrement the refcount, and if 0, call the release function (which was passed 231 * Decrement the refcount, and if 0, call the release function (which was passed
198 * to percpu_ref_init()) 232 * to percpu_ref_init())
233 *
234 * This function is safe to call as long as @ref is between init and exit.
199 */ 235 */
200static inline void percpu_ref_put(struct percpu_ref *ref) 236static inline void percpu_ref_put(struct percpu_ref *ref)
201{ 237{
202 unsigned __percpu *pcpu_count; 238 unsigned long __percpu *percpu_count;
203 239
204 rcu_read_lock_sched(); 240 rcu_read_lock_sched();
205 241
206 if (__pcpu_ref_alive(ref, &pcpu_count)) 242 if (__ref_is_percpu(ref, &percpu_count))
207 this_cpu_dec(*pcpu_count); 243 this_cpu_dec(*percpu_count);
208 else if (unlikely(atomic_dec_and_test(&ref->count))) 244 else if (unlikely(atomic_long_dec_and_test(&ref->count)))
209 ref->release(ref); 245 ref->release(ref);
210 246
211 rcu_read_unlock_sched(); 247 rcu_read_unlock_sched();
@@ -216,14 +252,16 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
216 * @ref: percpu_ref to test 252 * @ref: percpu_ref to test
217 * 253 *
218 * Returns %true if @ref reached zero. 254 * Returns %true if @ref reached zero.
255 *
256 * This function is safe to call as long as @ref is between init and exit.
219 */ 257 */
220static inline bool percpu_ref_is_zero(struct percpu_ref *ref) 258static inline bool percpu_ref_is_zero(struct percpu_ref *ref)
221{ 259{
222 unsigned __percpu *pcpu_count; 260 unsigned long __percpu *percpu_count;
223 261
224 if (__pcpu_ref_alive(ref, &pcpu_count)) 262 if (__ref_is_percpu(ref, &percpu_count))
225 return false; 263 return false;
226 return !atomic_read(&ref->count); 264 return !atomic_long_read(&ref->count);
227} 265}
228 266
229#endif 267#endif
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 6f61b61b7996..a3aa63e47637 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -48,9 +48,9 @@
48 * intelligent way to determine this would be nice. 48 * intelligent way to determine this would be nice.
49 */ 49 */
50#if BITS_PER_LONG > 32 50#if BITS_PER_LONG > 32
51#define PERCPU_DYNAMIC_RESERVE (20 << 10) 51#define PERCPU_DYNAMIC_RESERVE (28 << 10)
52#else 52#else
53#define PERCPU_DYNAMIC_RESERVE (12 << 10) 53#define PERCPU_DYNAMIC_RESERVE (20 << 10)
54#endif 54#endif
55 55
56extern void *pcpu_base_addr; 56extern void *pcpu_base_addr;
@@ -122,11 +122,16 @@ extern void __init setup_per_cpu_areas(void);
122#endif 122#endif
123extern void __init percpu_init_late(void); 123extern void __init percpu_init_late(void);
124 124
125extern void __percpu *__alloc_percpu_gfp(size_t size, size_t align, gfp_t gfp);
125extern void __percpu *__alloc_percpu(size_t size, size_t align); 126extern void __percpu *__alloc_percpu(size_t size, size_t align);
126extern void free_percpu(void __percpu *__pdata); 127extern void free_percpu(void __percpu *__pdata);
127extern phys_addr_t per_cpu_ptr_to_phys(void *addr); 128extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
128 129
129#define alloc_percpu(type) \ 130#define alloc_percpu_gfp(type, gfp) \
130 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 131 (typeof(type) __percpu *)__alloc_percpu_gfp(sizeof(type), \
132 __alignof__(type), gfp)
133#define alloc_percpu(type) \
134 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), \
135 __alignof__(type))
131 136
132#endif /* __LINUX_PERCPU_H */ 137#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index d5dd4657c8d6..50e50095c8d1 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -12,6 +12,7 @@
12#include <linux/threads.h> 12#include <linux/threads.h>
13#include <linux/percpu.h> 13#include <linux/percpu.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/gfp.h>
15 16
16#ifdef CONFIG_SMP 17#ifdef CONFIG_SMP
17 18
@@ -26,14 +27,14 @@ struct percpu_counter {
26 27
27extern int percpu_counter_batch; 28extern int percpu_counter_batch;
28 29
29int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, 30int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, gfp_t gfp,
30 struct lock_class_key *key); 31 struct lock_class_key *key);
31 32
32#define percpu_counter_init(fbc, value) \ 33#define percpu_counter_init(fbc, value, gfp) \
33 ({ \ 34 ({ \
34 static struct lock_class_key __key; \ 35 static struct lock_class_key __key; \
35 \ 36 \
36 __percpu_counter_init(fbc, value, &__key); \ 37 __percpu_counter_init(fbc, value, gfp, &__key); \
37 }) 38 })
38 39
39void percpu_counter_destroy(struct percpu_counter *fbc); 40void percpu_counter_destroy(struct percpu_counter *fbc);
@@ -89,7 +90,8 @@ struct percpu_counter {
89 s64 count; 90 s64 count;
90}; 91};
91 92
92static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount) 93static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount,
94 gfp_t gfp)
93{ 95{
94 fbc->count = amount; 96 fbc->count = amount;
95 return 0; 97 return 0;
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 707617a8c0f6..893a0d07986f 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -52,6 +52,7 @@ struct perf_guest_info_callbacks {
52#include <linux/atomic.h> 52#include <linux/atomic.h>
53#include <linux/sysfs.h> 53#include <linux/sysfs.h>
54#include <linux/perf_regs.h> 54#include <linux/perf_regs.h>
55#include <linux/workqueue.h>
55#include <asm/local.h> 56#include <asm/local.h>
56 57
57struct perf_callchain_entry { 58struct perf_callchain_entry {
@@ -268,6 +269,7 @@ struct pmu {
268 * enum perf_event_active_state - the states of a event 269 * enum perf_event_active_state - the states of a event
269 */ 270 */
270enum perf_event_active_state { 271enum perf_event_active_state {
272 PERF_EVENT_STATE_EXIT = -3,
271 PERF_EVENT_STATE_ERROR = -2, 273 PERF_EVENT_STATE_ERROR = -2,
272 PERF_EVENT_STATE_OFF = -1, 274 PERF_EVENT_STATE_OFF = -1,
273 PERF_EVENT_STATE_INACTIVE = 0, 275 PERF_EVENT_STATE_INACTIVE = 0,
@@ -507,6 +509,9 @@ struct perf_event_context {
507 int nr_cgroups; /* cgroup evts */ 509 int nr_cgroups; /* cgroup evts */
508 int nr_branch_stack; /* branch_stack evt */ 510 int nr_branch_stack; /* branch_stack evt */
509 struct rcu_head rcu_head; 511 struct rcu_head rcu_head;
512
513 struct delayed_work orphans_remove;
514 bool orphans_remove_sched;
510}; 515};
511 516
512/* 517/*
@@ -604,6 +609,13 @@ struct perf_sample_data {
604 u64 txn; 609 u64 txn;
605}; 610};
606 611
612/* default value for data source */
613#define PERF_MEM_NA (PERF_MEM_S(OP, NA) |\
614 PERF_MEM_S(LVL, NA) |\
615 PERF_MEM_S(SNOOP, NA) |\
616 PERF_MEM_S(LOCK, NA) |\
617 PERF_MEM_S(TLB, NA))
618
607static inline void perf_sample_data_init(struct perf_sample_data *data, 619static inline void perf_sample_data_init(struct perf_sample_data *data,
608 u64 addr, u64 period) 620 u64 addr, u64 period)
609{ 621{
@@ -616,7 +628,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
616 data->regs_user.regs = NULL; 628 data->regs_user.regs = NULL;
617 data->stack_user_size = 0; 629 data->stack_user_size = 0;
618 data->weight = 0; 630 data->weight = 0;
619 data->data_src.val = 0; 631 data->data_src.val = PERF_MEM_NA;
620 data->txn = 0; 632 data->txn = 0;
621} 633}
622 634
diff --git a/include/linux/phonedev.h b/include/linux/phonedev.h
deleted file mode 100644
index 4269de99e320..000000000000
--- a/include/linux/phonedev.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __LINUX_PHONEDEV_H
2#define __LINUX_PHONEDEV_H
3
4#include <linux/types.h>
5
6#ifdef __KERNEL__
7
8#include <linux/poll.h>
9
10struct phone_device {
11 struct phone_device *next;
12 const struct file_operations *f_op;
13 int (*open) (struct phone_device *, struct file *);
14 int board; /* Device private index */
15 int minor;
16};
17
18extern int phonedev_init(void);
19#define PHONE_MAJOR 100
20extern int phone_register_device(struct phone_device *, int unit);
21#define PHONE_UNIT_ANY -1
22extern void phone_unregister_device(struct phone_device *);
23
24#endif
25#endif
diff --git a/include/linux/phy.h b/include/linux/phy.h
index ed39956b5613..d090cfcaa167 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -598,6 +598,19 @@ static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
598} 598}
599 599
600/** 600/**
601 * phy_read_mmd_indirect - reads data from the MMD registers
602 * @phydev: The PHY device bus
603 * @prtad: MMD Address
604 * @devad: MMD DEVAD
605 * @addr: PHY address on the MII bus
606 *
607 * Description: it reads data from the MMD registers (clause 22 to access to
608 * clause 45) of the specified phy address.
609 */
610int phy_read_mmd_indirect(struct phy_device *phydev, int prtad,
611 int devad, int addr);
612
613/**
601 * phy_read - Convenience function for reading a given PHY register 614 * phy_read - Convenience function for reading a given PHY register
602 * @phydev: the phy_device struct 615 * @phydev: the phy_device struct
603 * @regnum: register number to read 616 * @regnum: register number to read
@@ -668,6 +681,20 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad,
668 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 681 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
669} 682}
670 683
684/**
685 * phy_write_mmd_indirect - writes data to the MMD registers
686 * @phydev: The PHY device
687 * @prtad: MMD Address
688 * @devad: MMD DEVAD
689 * @addr: PHY address on the MII bus
690 * @data: data to write in the MMD register
691 *
692 * Description: Write data from the MMD registers of the specified
693 * phy address.
694 */
695void phy_write_mmd_indirect(struct phy_device *phydev, int prtad,
696 int devad, int addr, u32 data);
697
671struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 698struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
672 bool is_c45, 699 bool is_c45,
673 struct phy_c45_device_ids *c45_ids); 700 struct phy_c45_device_ids *c45_ids);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index ae612acebb53..f2ca1b459377 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -14,34 +14,35 @@ struct device_node;
14#ifdef CONFIG_FIXED_PHY 14#ifdef CONFIG_FIXED_PHY
15extern int fixed_phy_add(unsigned int irq, int phy_id, 15extern int fixed_phy_add(unsigned int irq, int phy_id,
16 struct fixed_phy_status *status); 16 struct fixed_phy_status *status);
17extern int fixed_phy_register(unsigned int irq, 17extern struct phy_device *fixed_phy_register(unsigned int irq,
18 struct fixed_phy_status *status, 18 struct fixed_phy_status *status,
19 struct device_node *np); 19 struct device_node *np);
20extern void fixed_phy_del(int phy_addr); 20extern void fixed_phy_del(int phy_addr);
21extern int fixed_phy_set_link_update(struct phy_device *phydev,
22 int (*link_update)(struct net_device *,
23 struct fixed_phy_status *));
21#else 24#else
22static inline int fixed_phy_add(unsigned int irq, int phy_id, 25static inline int fixed_phy_add(unsigned int irq, int phy_id,
23 struct fixed_phy_status *status) 26 struct fixed_phy_status *status)
24{ 27{
25 return -ENODEV; 28 return -ENODEV;
26} 29}
27static inline int fixed_phy_register(unsigned int irq, 30static inline struct phy_device *fixed_phy_register(unsigned int irq,
28 struct fixed_phy_status *status, 31 struct fixed_phy_status *status,
29 struct device_node *np) 32 struct device_node *np)
30{ 33{
31 return -ENODEV; 34 return ERR_PTR(-ENODEV);
32} 35}
33static inline int fixed_phy_del(int phy_addr) 36static inline int fixed_phy_del(int phy_addr)
34{ 37{
35 return -ENODEV; 38 return -ENODEV;
36} 39}
37#endif /* CONFIG_FIXED_PHY */ 40static inline int fixed_phy_set_link_update(struct phy_device *phydev,
38
39/*
40 * This function issued only by fixed_phy-aware drivers, no need
41 * protect it with #ifdef
42 */
43extern int fixed_phy_set_link_update(struct phy_device *phydev,
44 int (*link_update)(struct net_device *, 41 int (*link_update)(struct net_device *,
45 struct fixed_phy_status *)); 42 struct fixed_phy_status *))
43{
44 return -ENODEV;
45}
46#endif /* CONFIG_FIXED_PHY */
46 47
47#endif /* __PHY_FIXED_H */ 48#endif /* __PHY_FIXED_H */
diff --git a/include/linux/mailbox.h b/include/linux/pl320-ipc.h
index 5161f63ec1c8..5161f63ec1c8 100644
--- a/include/linux/mailbox.h
+++ b/include/linux/pl320-ipc.h
diff --git a/include/linux/platform_data/dma-dw.h b/include/linux/platform_data/dma-dw.h
new file mode 100644
index 000000000000..d8155c005242
--- /dev/null
+++ b/include/linux/platform_data/dma-dw.h
@@ -0,0 +1,59 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
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 version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _PLATFORM_DATA_DMA_DW_H
12#define _PLATFORM_DATA_DMA_DW_H
13
14#include <linux/device.h>
15
16/**
17 * struct dw_dma_slave - Controller-specific information about a slave
18 *
19 * @dma_dev: required DMA master device. Depricated.
20 * @src_id: src request line
21 * @dst_id: dst request line
22 * @src_master: src master for transfers on allocated channel.
23 * @dst_master: dest master for transfers on allocated channel.
24 */
25struct dw_dma_slave {
26 struct device *dma_dev;
27 u8 src_id;
28 u8 dst_id;
29 u8 src_master;
30 u8 dst_master;
31};
32
33/**
34 * struct dw_dma_platform_data - Controller configuration parameters
35 * @nr_channels: Number of channels supported by hardware (max 8)
36 * @is_private: The device channels should be marked as private and not for
37 * by the general purpose DMA channel allocator.
38 * @chan_allocation_order: Allocate channels starting from 0 or 7
39 * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0.
40 * @block_size: Maximum block size supported by the controller
41 * @nr_masters: Number of AHB masters supported by the controller
42 * @data_width: Maximum data width supported by hardware per AHB master
43 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
44 */
45struct dw_dma_platform_data {
46 unsigned int nr_channels;
47 bool is_private;
48#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
49#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
50 unsigned char chan_allocation_order;
51#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
52#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
53 unsigned char chan_priority;
54 unsigned short block_size;
55 unsigned char nr_masters;
56 unsigned char data_width[4];
57};
58
59#endif /* _PLATFORM_DATA_DMA_DW_H */
diff --git a/include/linux/platform_data/drv260x-pdata.h b/include/linux/platform_data/drv260x-pdata.h
new file mode 100644
index 000000000000..0a03b0944411
--- /dev/null
+++ b/include/linux/platform_data/drv260x-pdata.h
@@ -0,0 +1,28 @@
1/*
2 * Platform data for DRV260X haptics driver family
3 *
4 * Author: Dan Murphy <dmurphy@ti.com>
5 *
6 * Copyright: (C) 2014 Texas Instruments, Inc.
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 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef _LINUX_DRV260X_PDATA_H
19#define _LINUX_DRV260X_PDATA_H
20
21struct drv260x_platform_data {
22 u32 library_selection;
23 u32 mode;
24 u32 vib_rated_voltage;
25 u32 vib_overdrive_voltage;
26};
27
28#endif
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
index 780d1e97f620..b8686c00f15f 100644
--- a/include/linux/platform_data/elm.h
+++ b/include/linux/platform_data/elm.h
@@ -42,8 +42,24 @@ struct elm_errorvec {
42 int error_loc[16]; 42 int error_loc[16];
43}; 43};
44 44
45#if IS_ENABLED(CONFIG_MTD_NAND_OMAP_BCH)
45void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, 46void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
46 struct elm_errorvec *err_vec); 47 struct elm_errorvec *err_vec);
47int elm_config(struct device *dev, enum bch_ecc bch_type, 48int elm_config(struct device *dev, enum bch_ecc bch_type,
48 int ecc_steps, int ecc_step_size, int ecc_syndrome_size); 49 int ecc_steps, int ecc_step_size, int ecc_syndrome_size);
50#else
51static inline void
52elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
53 struct elm_errorvec *err_vec)
54{
55}
56
57static inline int elm_config(struct device *dev, enum bch_ecc bch_type,
58 int ecc_steps, int ecc_step_size,
59 int ecc_syndrome_size)
60{
61 return -ENOSYS;
62}
63#endif /* CONFIG_MTD_NAND_ECC_BCH */
64
49#endif /* __ELM_H */ 65#endif /* __ELM_H */
diff --git a/include/linux/platform_data/gpio-dwapb.h b/include/linux/platform_data/gpio-dwapb.h
new file mode 100644
index 000000000000..28702c849af1
--- /dev/null
+++ b/include/linux/platform_data/gpio-dwapb.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright(c) 2014 Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef GPIO_DW_APB_H
15#define GPIO_DW_APB_H
16
17struct dwapb_port_property {
18 struct device_node *node;
19 const char *name;
20 unsigned int idx;
21 unsigned int ngpio;
22 unsigned int gpio_base;
23 unsigned int irq;
24 bool irq_shared;
25};
26
27struct dwapb_platform_data {
28 struct dwapb_port_property *properties;
29 unsigned int nports;
30};
31
32#endif
diff --git a/include/linux/platform_data/i2c-designware.h b/include/linux/platform_data/i2c-designware.h
new file mode 100644
index 000000000000..7a61fb27c25b
--- /dev/null
+++ b/include/linux/platform_data/i2c-designware.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright(c) 2014 Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef I2C_DESIGNWARE_H
15#define I2C_DESIGNWARE_H
16
17struct dw_i2c_platform_data {
18 unsigned int i2c_scl_freq;
19};
20
21#endif
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 16ec262dfcc8..090bbab0130a 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -71,6 +71,7 @@ struct omap_nand_platform_data {
71 struct mtd_partition *parts; 71 struct mtd_partition *parts;
72 int nr_parts; 72 int nr_parts;
73 bool dev_ready; 73 bool dev_ready;
74 bool flash_bbt;
74 enum nand_io xfer_type; 75 enum nand_io xfer_type;
75 int devsize; 76 int devsize;
76 enum omap_ecc ecc_opt; 77 enum omap_ecc ecc_opt;
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
index 1a2e9901a22e..a5f045e1d8fe 100644
--- a/include/linux/platform_data/rcar-du.h
+++ b/include/linux/platform_data/rcar-du.h
@@ -14,7 +14,7 @@
14#ifndef __RCAR_DU_H__ 14#ifndef __RCAR_DU_H__
15#define __RCAR_DU_H__ 15#define __RCAR_DU_H__
16 16
17#include <drm/drm_mode.h> 17#include <video/videomode.h>
18 18
19enum rcar_du_output { 19enum rcar_du_output {
20 RCAR_DU_OUTPUT_DPAD0, 20 RCAR_DU_OUTPUT_DPAD0,
@@ -35,7 +35,7 @@ enum rcar_du_encoder_type {
35struct rcar_du_panel_data { 35struct rcar_du_panel_data {
36 unsigned int width_mm; /* Panel width in mm */ 36 unsigned int width_mm; /* Panel width in mm */
37 unsigned int height_mm; /* Panel height in mm */ 37 unsigned int height_mm; /* Panel height in mm */
38 struct drm_mode_modeinfo mode; 38 struct videomode mode;
39}; 39};
40 40
41struct rcar_du_connector_lvds_data { 41struct rcar_du_connector_lvds_data {
diff --git a/include/linux/platform_data/samsung-usbphy.h b/include/linux/platform_data/samsung-usbphy.h
deleted file mode 100644
index 1bd24cba982b..000000000000
--- a/include/linux/platform_data/samsung-usbphy.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 * Author: Praveen Paneri <p.paneri@samsung.com>
5 *
6 * Defines platform data for samsung usb phy driver.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef __SAMSUNG_USBPHY_PLATFORM_H
15#define __SAMSUNG_USBPHY_PLATFORM_H
16
17/**
18 * samsung_usbphy_data - Platform data for USB PHY driver.
19 * @pmu_isolation: Function to control usb phy isolation in PMU.
20 */
21struct samsung_usbphy_data {
22 void (*pmu_isolation)(int on);
23};
24
25extern void samsung_usbphy_set_pdata(struct samsung_usbphy_data *pd);
26
27#endif /* __SAMSUNG_USBPHY_PLATFORM_H */
diff --git a/include/linux/platform_data/tegra_emc.h b/include/linux/platform_data/tegra_emc.h
deleted file mode 100644
index df67505e98f8..000000000000
--- a/include/linux/platform_data/tegra_emc.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright (C) 2011 Google, Inc.
3 *
4 * Author:
5 * Colin Cross <ccross@android.com>
6 * Olof Johansson <olof@lixom.net>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __TEGRA_EMC_H_
20#define __TEGRA_EMC_H_
21
22#define TEGRA_EMC_NUM_REGS 46
23
24struct tegra_emc_table {
25 unsigned long rate;
26 u32 regs[TEGRA_EMC_NUM_REGS];
27};
28
29struct tegra_emc_pdata {
30 int num_tables;
31 struct tegra_emc_table *tables;
32};
33
34#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 72c0fe098a27..383fd68aaee1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -619,6 +619,7 @@ extern int dev_pm_put_subsys_data(struct device *dev);
619 */ 619 */
620struct dev_pm_domain { 620struct dev_pm_domain {
621 struct dev_pm_ops ops; 621 struct dev_pm_ops ops;
622 void (*detach)(struct device *dev, bool power_off);
622}; 623};
623 624
624/* 625/*
@@ -679,12 +680,16 @@ struct dev_pm_domain {
679extern void device_pm_lock(void); 680extern void device_pm_lock(void);
680extern void dpm_resume_start(pm_message_t state); 681extern void dpm_resume_start(pm_message_t state);
681extern void dpm_resume_end(pm_message_t state); 682extern void dpm_resume_end(pm_message_t state);
683extern void dpm_resume_noirq(pm_message_t state);
684extern void dpm_resume_early(pm_message_t state);
682extern void dpm_resume(pm_message_t state); 685extern void dpm_resume(pm_message_t state);
683extern void dpm_complete(pm_message_t state); 686extern void dpm_complete(pm_message_t state);
684 687
685extern void device_pm_unlock(void); 688extern void device_pm_unlock(void);
686extern int dpm_suspend_end(pm_message_t state); 689extern int dpm_suspend_end(pm_message_t state);
687extern int dpm_suspend_start(pm_message_t state); 690extern int dpm_suspend_start(pm_message_t state);
691extern int dpm_suspend_noirq(pm_message_t state);
692extern int dpm_suspend_late(pm_message_t state);
688extern int dpm_suspend(pm_message_t state); 693extern int dpm_suspend(pm_message_t state);
689extern int dpm_prepare(pm_message_t state); 694extern int dpm_prepare(pm_message_t state);
690 695
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index ebc4c76ffb73..73e938b7e937 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -35,18 +35,10 @@ struct gpd_dev_ops {
35 int (*stop)(struct device *dev); 35 int (*stop)(struct device *dev);
36 int (*save_state)(struct device *dev); 36 int (*save_state)(struct device *dev);
37 int (*restore_state)(struct device *dev); 37 int (*restore_state)(struct device *dev);
38 int (*suspend)(struct device *dev);
39 int (*suspend_late)(struct device *dev);
40 int (*resume_early)(struct device *dev);
41 int (*resume)(struct device *dev);
42 int (*freeze)(struct device *dev);
43 int (*freeze_late)(struct device *dev);
44 int (*thaw_early)(struct device *dev);
45 int (*thaw)(struct device *dev);
46 bool (*active_wakeup)(struct device *dev); 38 bool (*active_wakeup)(struct device *dev);
47}; 39};
48 40
49struct gpd_cpu_data { 41struct gpd_cpuidle_data {
50 unsigned int saved_exit_latency; 42 unsigned int saved_exit_latency;
51 struct cpuidle_state *idle_state; 43 struct cpuidle_state *idle_state;
52}; 44};
@@ -71,7 +63,6 @@ struct generic_pm_domain {
71 unsigned int suspended_count; /* System suspend device counter */ 63 unsigned int suspended_count; /* System suspend device counter */
72 unsigned int prepared_count; /* Suspend counter of prepared devices */ 64 unsigned int prepared_count; /* Suspend counter of prepared devices */
73 bool suspend_power_off; /* Power status before system suspend */ 65 bool suspend_power_off; /* Power status before system suspend */
74 bool dev_irq_safe; /* Device callbacks are IRQ-safe */
75 int (*power_off)(struct generic_pm_domain *domain); 66 int (*power_off)(struct generic_pm_domain *domain);
76 s64 power_off_latency_ns; 67 s64 power_off_latency_ns;
77 int (*power_on)(struct generic_pm_domain *domain); 68 int (*power_on)(struct generic_pm_domain *domain);
@@ -80,8 +71,9 @@ struct generic_pm_domain {
80 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 71 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
81 bool max_off_time_changed; 72 bool max_off_time_changed;
82 bool cached_power_down_ok; 73 bool cached_power_down_ok;
83 struct device_node *of_node; /* Node in device tree */ 74 struct gpd_cpuidle_data *cpuidle_data;
84 struct gpd_cpu_data *cpu_data; 75 void (*attach_dev)(struct device *dev);
76 void (*detach_dev)(struct device *dev);
85}; 77};
86 78
87static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 79static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -108,7 +100,6 @@ struct gpd_timing_data {
108 100
109struct generic_pm_domain_data { 101struct generic_pm_domain_data {
110 struct pm_domain_data base; 102 struct pm_domain_data base;
111 struct gpd_dev_ops ops;
112 struct gpd_timing_data td; 103 struct gpd_timing_data td;
113 struct notifier_block nb; 104 struct notifier_block nb;
114 struct mutex lock; 105 struct mutex lock;
@@ -127,17 +118,11 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
127 return to_gpd_data(dev->power.subsys_data->domain_data); 118 return to_gpd_data(dev->power.subsys_data->domain_data);
128} 119}
129 120
130extern struct dev_power_governor simple_qos_governor;
131
132extern struct generic_pm_domain *dev_to_genpd(struct device *dev); 121extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
133extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, 122extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
134 struct device *dev, 123 struct device *dev,
135 struct gpd_timing_data *td); 124 struct gpd_timing_data *td);
136 125
137extern int __pm_genpd_of_add_device(struct device_node *genpd_node,
138 struct device *dev,
139 struct gpd_timing_data *td);
140
141extern int __pm_genpd_name_add_device(const char *domain_name, 126extern int __pm_genpd_name_add_device(const char *domain_name,
142 struct device *dev, 127 struct device *dev,
143 struct gpd_timing_data *td); 128 struct gpd_timing_data *td);
@@ -151,10 +136,6 @@ extern int pm_genpd_add_subdomain_names(const char *master_name,
151 const char *subdomain_name); 136 const char *subdomain_name);
152extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 137extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
153 struct generic_pm_domain *target); 138 struct generic_pm_domain *target);
154extern int pm_genpd_add_callbacks(struct device *dev,
155 struct gpd_dev_ops *ops,
156 struct gpd_timing_data *td);
157extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
158extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state); 139extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state);
159extern int pm_genpd_name_attach_cpuidle(const char *name, int state); 140extern int pm_genpd_name_attach_cpuidle(const char *name, int state);
160extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd); 141extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd);
@@ -165,8 +146,7 @@ extern void pm_genpd_init(struct generic_pm_domain *genpd,
165extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 146extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
166extern int pm_genpd_name_poweron(const char *domain_name); 147extern int pm_genpd_name_poweron(const char *domain_name);
167 148
168extern bool default_stop_ok(struct device *dev); 149extern struct dev_power_governor simple_qos_governor;
169
170extern struct dev_power_governor pm_domain_always_on_gov; 150extern struct dev_power_governor pm_domain_always_on_gov;
171#else 151#else
172 152
@@ -184,12 +164,6 @@ static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
184{ 164{
185 return -ENOSYS; 165 return -ENOSYS;
186} 166}
187static inline int __pm_genpd_of_add_device(struct device_node *genpd_node,
188 struct device *dev,
189 struct gpd_timing_data *td)
190{
191 return -ENOSYS;
192}
193static inline int __pm_genpd_name_add_device(const char *domain_name, 167static inline int __pm_genpd_name_add_device(const char *domain_name,
194 struct device *dev, 168 struct device *dev,
195 struct gpd_timing_data *td) 169 struct gpd_timing_data *td)
@@ -217,16 +191,6 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
217{ 191{
218 return -ENOSYS; 192 return -ENOSYS;
219} 193}
220static inline int pm_genpd_add_callbacks(struct device *dev,
221 struct gpd_dev_ops *ops,
222 struct gpd_timing_data *td)
223{
224 return -ENOSYS;
225}
226static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
227{
228 return -ENOSYS;
229}
230static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st) 194static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st)
231{ 195{
232 return -ENOSYS; 196 return -ENOSYS;
@@ -255,10 +219,6 @@ static inline int pm_genpd_name_poweron(const char *domain_name)
255{ 219{
256 return -ENOSYS; 220 return -ENOSYS;
257} 221}
258static inline bool default_stop_ok(struct device *dev)
259{
260 return false;
261}
262#define simple_qos_governor NULL 222#define simple_qos_governor NULL
263#define pm_domain_always_on_gov NULL 223#define pm_domain_always_on_gov NULL
264#endif 224#endif
@@ -269,45 +229,87 @@ static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
269 return __pm_genpd_add_device(genpd, dev, NULL); 229 return __pm_genpd_add_device(genpd, dev, NULL);
270} 230}
271 231
272static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
273 struct device *dev)
274{
275 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
276}
277
278static inline int pm_genpd_name_add_device(const char *domain_name, 232static inline int pm_genpd_name_add_device(const char *domain_name,
279 struct device *dev) 233 struct device *dev)
280{ 234{
281 return __pm_genpd_name_add_device(domain_name, dev, NULL); 235 return __pm_genpd_name_add_device(domain_name, dev, NULL);
282} 236}
283 237
284static inline int pm_genpd_remove_callbacks(struct device *dev)
285{
286 return __pm_genpd_remove_callbacks(dev, true);
287}
288
289#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME 238#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
290extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
291extern void pm_genpd_poweroff_unused(void); 239extern void pm_genpd_poweroff_unused(void);
292#else 240#else
293static inline void genpd_queue_power_off_work(struct generic_pm_domain *gpd) {}
294static inline void pm_genpd_poweroff_unused(void) {} 241static inline void pm_genpd_poweroff_unused(void) {}
295#endif 242#endif
296 243
297#ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP 244#ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP
298extern void pm_genpd_syscore_switch(struct device *dev, bool suspend); 245extern void pm_genpd_syscore_poweroff(struct device *dev);
246extern void pm_genpd_syscore_poweron(struct device *dev);
299#else 247#else
300static inline void pm_genpd_syscore_switch(struct device *dev, bool suspend) {} 248static inline void pm_genpd_syscore_poweroff(struct device *dev) {}
249static inline void pm_genpd_syscore_poweron(struct device *dev) {}
301#endif 250#endif
302 251
303static inline void pm_genpd_syscore_poweroff(struct device *dev) 252/* OF PM domain providers */
253struct of_device_id;
254
255struct genpd_onecell_data {
256 struct generic_pm_domain **domains;
257 unsigned int num_domains;
258};
259
260typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
261 void *data);
262
263#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
264int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
265 void *data);
266void of_genpd_del_provider(struct device_node *np);
267
268struct generic_pm_domain *__of_genpd_xlate_simple(
269 struct of_phandle_args *genpdspec,
270 void *data);
271struct generic_pm_domain *__of_genpd_xlate_onecell(
272 struct of_phandle_args *genpdspec,
273 void *data);
274
275int genpd_dev_pm_attach(struct device *dev);
276#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
277static inline int __of_genpd_add_provider(struct device_node *np,
278 genpd_xlate_t xlate, void *data)
279{
280 return 0;
281}
282static inline void of_genpd_del_provider(struct device_node *np) {}
283
284#define __of_genpd_xlate_simple NULL
285#define __of_genpd_xlate_onecell NULL
286
287static inline int genpd_dev_pm_attach(struct device *dev)
288{
289 return -ENODEV;
290}
291#endif /* CONFIG_PM_GENERIC_DOMAINS_OF */
292
293static inline int of_genpd_add_provider_simple(struct device_node *np,
294 struct generic_pm_domain *genpd)
295{
296 return __of_genpd_add_provider(np, __of_genpd_xlate_simple, genpd);
297}
298static inline int of_genpd_add_provider_onecell(struct device_node *np,
299 struct genpd_onecell_data *data)
304{ 300{
305 pm_genpd_syscore_switch(dev, true); 301 return __of_genpd_add_provider(np, __of_genpd_xlate_onecell, data);
306} 302}
307 303
308static inline void pm_genpd_syscore_poweron(struct device *dev) 304#ifdef CONFIG_PM
305extern int dev_pm_domain_attach(struct device *dev, bool power_on);
306extern void dev_pm_domain_detach(struct device *dev, bool power_off);
307#else
308static inline int dev_pm_domain_attach(struct device *dev, bool power_on)
309{ 309{
310 pm_genpd_syscore_switch(dev, false); 310 return -ENODEV;
311} 311}
312static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
313#endif
312 314
313#endif /* _LINUX_PM_DOMAIN_H */ 315#endif /* _LINUX_PM_DOMAIN_H */
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 9ab4bf7c4646..636e82834506 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -15,6 +15,7 @@ enum {
15 PM_QOS_CPU_DMA_LATENCY, 15 PM_QOS_CPU_DMA_LATENCY,
16 PM_QOS_NETWORK_LATENCY, 16 PM_QOS_NETWORK_LATENCY,
17 PM_QOS_NETWORK_THROUGHPUT, 17 PM_QOS_NETWORK_THROUGHPUT,
18 PM_QOS_MEMORY_BANDWIDTH,
18 19
19 /* insert new class ID */ 20 /* insert new class ID */
20 PM_QOS_NUM_CLASSES, 21 PM_QOS_NUM_CLASSES,
@@ -32,6 +33,7 @@ enum pm_qos_flags_status {
32#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 33#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
33#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 34#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 35#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
36#define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0
35#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 37#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0
36#define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 38#define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0
37#define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) 39#define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1)
@@ -69,7 +71,8 @@ struct dev_pm_qos_request {
69enum pm_qos_type { 71enum pm_qos_type {
70 PM_QOS_UNITIALIZED, 72 PM_QOS_UNITIALIZED,
71 PM_QOS_MAX, /* return the largest value */ 73 PM_QOS_MAX, /* return the largest value */
72 PM_QOS_MIN /* return the smallest value */ 74 PM_QOS_MIN, /* return the smallest value */
75 PM_QOS_SUM /* return the sum */
73}; 76};
74 77
75/* 78/*
diff --git a/include/linux/pnfs_osd_xdr.h b/include/linux/pnfs_osd_xdr.h
index fe25876c1a5d..17d7d0d20eca 100644
--- a/include/linux/pnfs_osd_xdr.h
+++ b/include/linux/pnfs_osd_xdr.h
@@ -5,7 +5,7 @@
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Benny Halevy <bhalevy@panasas.com> 7 * Benny Halevy <bhalevy@panasas.com>
8 * Boaz Harrosh <bharrosh@panasas.com> 8 * Boaz Harrosh <ooo@electrozaur.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 11 * it under the terms of the GNU General Public License version 2
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f3dea41dbcd2..3ed049673022 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -18,8 +18,6 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20 20
21struct device;
22
23/* 21/*
24 * All voltages, currents, charges, energies, time and temperatures in uV, 22 * All voltages, currents, charges, energies, time and temperatures in uV,
25 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise 23 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
@@ -102,9 +100,11 @@ enum power_supply_property {
102 POWER_SUPPLY_PROP_VOLTAGE_NOW, 100 POWER_SUPPLY_PROP_VOLTAGE_NOW,
103 POWER_SUPPLY_PROP_VOLTAGE_AVG, 101 POWER_SUPPLY_PROP_VOLTAGE_AVG,
104 POWER_SUPPLY_PROP_VOLTAGE_OCV, 102 POWER_SUPPLY_PROP_VOLTAGE_OCV,
103 POWER_SUPPLY_PROP_VOLTAGE_BOOT,
105 POWER_SUPPLY_PROP_CURRENT_MAX, 104 POWER_SUPPLY_PROP_CURRENT_MAX,
106 POWER_SUPPLY_PROP_CURRENT_NOW, 105 POWER_SUPPLY_PROP_CURRENT_NOW,
107 POWER_SUPPLY_PROP_CURRENT_AVG, 106 POWER_SUPPLY_PROP_CURRENT_AVG,
107 POWER_SUPPLY_PROP_CURRENT_BOOT,
108 POWER_SUPPLY_PROP_POWER_NOW, 108 POWER_SUPPLY_PROP_POWER_NOW,
109 POWER_SUPPLY_PROP_POWER_AVG, 109 POWER_SUPPLY_PROP_POWER_AVG,
110 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, 110 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
@@ -146,6 +146,7 @@ enum power_supply_property {
146 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ 146 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
147 POWER_SUPPLY_PROP_SCOPE, 147 POWER_SUPPLY_PROP_SCOPE,
148 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT, 148 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
149 POWER_SUPPLY_PROP_CALIBRATE,
149 /* Properties of type `const char *' */ 150 /* Properties of type `const char *' */
150 POWER_SUPPLY_PROP_MODEL_NAME, 151 POWER_SUPPLY_PROP_MODEL_NAME,
151 POWER_SUPPLY_PROP_MANUFACTURER, 152 POWER_SUPPLY_PROP_MANUFACTURER,
@@ -172,6 +173,7 @@ union power_supply_propval {
172 const char *strval; 173 const char *strval;
173}; 174};
174 175
176struct device;
175struct device_node; 177struct device_node;
176 178
177struct power_supply { 179struct power_supply {
@@ -291,6 +293,7 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
291 case POWER_SUPPLY_PROP_CURRENT_MAX: 293 case POWER_SUPPLY_PROP_CURRENT_MAX:
292 case POWER_SUPPLY_PROP_CURRENT_NOW: 294 case POWER_SUPPLY_PROP_CURRENT_NOW:
293 case POWER_SUPPLY_PROP_CURRENT_AVG: 295 case POWER_SUPPLY_PROP_CURRENT_AVG:
296 case POWER_SUPPLY_PROP_CURRENT_BOOT:
294 return 1; 297 return 1;
295 default: 298 default:
296 break; 299 break;
@@ -315,6 +318,7 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
315 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 318 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
316 case POWER_SUPPLY_PROP_VOLTAGE_AVG: 319 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
317 case POWER_SUPPLY_PROP_VOLTAGE_OCV: 320 case POWER_SUPPLY_PROP_VOLTAGE_OCV:
321 case POWER_SUPPLY_PROP_VOLTAGE_BOOT:
318 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 322 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
319 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX: 323 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
320 case POWER_SUPPLY_PROP_POWER_NOW: 324 case POWER_SUPPLY_PROP_POWER_NOW:
diff --git a/include/linux/prio_heap.h b/include/linux/prio_heap.h
deleted file mode 100644
index 08094350f26a..000000000000
--- a/include/linux/prio_heap.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _LINUX_PRIO_HEAP_H
2#define _LINUX_PRIO_HEAP_H
3
4/*
5 * Simple insertion-only static-sized priority heap containing
6 * pointers, based on CLR, chapter 7
7 */
8
9#include <linux/gfp.h>
10
11/**
12 * struct ptr_heap - simple static-sized priority heap
13 * @ptrs - pointer to data area
14 * @max - max number of elements that can be stored in @ptrs
15 * @size - current number of valid elements in @ptrs (in the range 0..@size-1
16 * @gt: comparison operator, which should implement "greater than"
17 */
18struct ptr_heap {
19 void **ptrs;
20 int max;
21 int size;
22 int (*gt)(void *, void *);
23};
24
25/**
26 * heap_init - initialize an empty heap with a given memory size
27 * @heap: the heap structure to be initialized
28 * @size: amount of memory to use in bytes
29 * @gfp_mask: mask to pass to kmalloc()
30 * @gt: comparison operator, which should implement "greater than"
31 */
32extern int heap_init(struct ptr_heap *heap, size_t size, gfp_t gfp_mask,
33 int (*gt)(void *, void *));
34
35/**
36 * heap_free - release a heap's storage
37 * @heap: the heap structure whose data should be released
38 */
39void heap_free(struct ptr_heap *heap);
40
41/**
42 * heap_insert - insert a value into the heap and return any overflowed value
43 * @heap: the heap to be operated on
44 * @p: the pointer to be inserted
45 *
46 * Attempts to insert the given value into the priority heap. If the
47 * heap is full prior to the insertion, then the resulting heap will
48 * consist of the smallest @max elements of the original heap and the
49 * new element; the greatest element will be removed from the heap and
50 * returned. Note that the returned element will be the new element
51 * (i.e. no change to the heap) if the new element is greater than all
52 * elements currently in the heap.
53 */
54extern void *heap_insert(struct ptr_heap *heap, void *p);
55
56
57
58#endif /* _LINUX_PRIO_HEAP_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 9d117f61d976..b97bf2ef996e 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -74,6 +74,8 @@ static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *p
74 74
75#endif /* CONFIG_PROC_FS */ 75#endif /* CONFIG_PROC_FS */
76 76
77struct net;
78
77static inline struct proc_dir_entry *proc_net_mkdir( 79static inline struct proc_dir_entry *proc_net_mkdir(
78 struct net *net, const char *name, struct proc_dir_entry *parent) 80 struct net *net, const char *name, struct proc_dir_entry *parent)
79{ 81{
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
index 26a8a4ed9b07..00e8e8fa7358 100644
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -12,6 +12,7 @@
12#include <linux/percpu_counter.h> 12#include <linux/percpu_counter.h>
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/gfp.h>
15 16
16struct prop_global { 17struct prop_global {
17 /* 18 /*
@@ -40,7 +41,7 @@ struct prop_descriptor {
40 struct mutex mutex; /* serialize the prop_global switch */ 41 struct mutex mutex; /* serialize the prop_global switch */
41}; 42};
42 43
43int prop_descriptor_init(struct prop_descriptor *pd, int shift); 44int prop_descriptor_init(struct prop_descriptor *pd, int shift, gfp_t gfp);
44void prop_change_shift(struct prop_descriptor *pd, int new_shift); 45void prop_change_shift(struct prop_descriptor *pd, int new_shift);
45 46
46/* 47/*
@@ -61,7 +62,7 @@ struct prop_local_percpu {
61 raw_spinlock_t lock; /* protect the snapshot state */ 62 raw_spinlock_t lock; /* protect the snapshot state */
62}; 63};
63 64
64int prop_local_init_percpu(struct prop_local_percpu *pl); 65int prop_local_init_percpu(struct prop_local_percpu *pl, gfp_t gfp);
65void prop_local_destroy_percpu(struct prop_local_percpu *pl); 66void prop_local_destroy_percpu(struct prop_local_percpu *pl);
66void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl); 67void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl);
67void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl, 68void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl,
diff --git a/include/linux/random.h b/include/linux/random.h
index 57fbbffd77a0..b05856e16b75 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -26,7 +26,7 @@ unsigned int get_random_int(void);
26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); 26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
27 27
28u32 prandom_u32(void); 28u32 prandom_u32(void);
29void prandom_bytes(void *buf, int nbytes); 29void prandom_bytes(void *buf, size_t nbytes);
30void prandom_seed(u32 seed); 30void prandom_seed(u32 seed);
31void prandom_reseed_late(void); 31void prandom_reseed_late(void);
32 32
@@ -35,7 +35,7 @@ struct rnd_state {
35}; 35};
36 36
37u32 prandom_u32_state(struct rnd_state *state); 37u32 prandom_u32_state(struct rnd_state *state);
38void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); 38void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes);
39 39
40/** 40/**
41 * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) 41 * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
index fea49b5da12a..378c5ee75f78 100644
--- a/include/linux/rbtree_augmented.h
+++ b/include/linux/rbtree_augmented.h
@@ -43,6 +43,16 @@ struct rb_augment_callbacks {
43 43
44extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, 44extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root,
45 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); 45 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
46/*
47 * Fixup the rbtree and update the augmented information when rebalancing.
48 *
49 * On insertion, the user must update the augmented information on the path
50 * leading to the inserted node, then call rb_link_node() as usual and
51 * rb_augment_inserted() instead of the usual rb_insert_color() call.
52 * If rb_augment_inserted() rebalances the rbtree, it will callback into
53 * a user provided function to update the augmented information on the
54 * affected subtrees.
55 */
46static inline void 56static inline void
47rb_insert_augmented(struct rb_node *node, struct rb_root *root, 57rb_insert_augmented(struct rb_node *node, struct rb_root *root,
48 const struct rb_augment_callbacks *augment) 58 const struct rb_augment_callbacks *augment)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d231aa17b1d7..53ff1a752d7e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -47,14 +47,12 @@
47#include <asm/barrier.h> 47#include <asm/barrier.h>
48 48
49extern int rcu_expedited; /* for sysctl */ 49extern int rcu_expedited; /* for sysctl */
50#ifdef CONFIG_RCU_TORTURE_TEST
51extern int rcutorture_runnable; /* for sysctl */
52#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
53 50
54enum rcutorture_type { 51enum rcutorture_type {
55 RCU_FLAVOR, 52 RCU_FLAVOR,
56 RCU_BH_FLAVOR, 53 RCU_BH_FLAVOR,
57 RCU_SCHED_FLAVOR, 54 RCU_SCHED_FLAVOR,
55 RCU_TASKS_FLAVOR,
58 SRCU_FLAVOR, 56 SRCU_FLAVOR,
59 INVALID_RCU_FLAVOR 57 INVALID_RCU_FLAVOR
60}; 58};
@@ -197,6 +195,28 @@ void call_rcu_sched(struct rcu_head *head,
197 195
198void synchronize_sched(void); 196void synchronize_sched(void);
199 197
198/**
199 * call_rcu_tasks() - Queue an RCU for invocation task-based grace period
200 * @head: structure to be used for queueing the RCU updates.
201 * @func: actual callback function to be invoked after the grace period
202 *
203 * The callback function will be invoked some time after a full grace
204 * period elapses, in other words after all currently executing RCU
205 * read-side critical sections have completed. call_rcu_tasks() assumes
206 * that the read-side critical sections end at a voluntary context
207 * switch (not a preemption!), entry into idle, or transition to usermode
208 * execution. As such, there are no read-side primitives analogous to
209 * rcu_read_lock() and rcu_read_unlock() because this primitive is intended
210 * to determine that all tasks have passed through a safe state, not so
211 * much for data-strcuture synchronization.
212 *
213 * See the description of call_rcu() for more detailed information on
214 * memory ordering guarantees.
215 */
216void call_rcu_tasks(struct rcu_head *head, void (*func)(struct rcu_head *head));
217void synchronize_rcu_tasks(void);
218void rcu_barrier_tasks(void);
219
200#ifdef CONFIG_PREEMPT_RCU 220#ifdef CONFIG_PREEMPT_RCU
201 221
202void __rcu_read_lock(void); 222void __rcu_read_lock(void);
@@ -238,8 +258,8 @@ static inline int rcu_preempt_depth(void)
238 258
239/* Internal to kernel */ 259/* Internal to kernel */
240void rcu_init(void); 260void rcu_init(void);
241void rcu_sched_qs(int cpu); 261void rcu_sched_qs(void);
242void rcu_bh_qs(int cpu); 262void rcu_bh_qs(void);
243void rcu_check_callbacks(int cpu, int user); 263void rcu_check_callbacks(int cpu, int user);
244struct notifier_block; 264struct notifier_block;
245void rcu_idle_enter(void); 265void rcu_idle_enter(void);
@@ -269,6 +289,14 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
269 struct task_struct *next) { } 289 struct task_struct *next) { }
270#endif /* CONFIG_RCU_USER_QS */ 290#endif /* CONFIG_RCU_USER_QS */
271 291
292#ifdef CONFIG_RCU_NOCB_CPU
293void rcu_init_nohz(void);
294#else /* #ifdef CONFIG_RCU_NOCB_CPU */
295static inline void rcu_init_nohz(void)
296{
297}
298#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
299
272/** 300/**
273 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers 301 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
274 * @a: Code that RCU needs to pay attention to. 302 * @a: Code that RCU needs to pay attention to.
@@ -294,6 +322,36 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
294 rcu_irq_exit(); \ 322 rcu_irq_exit(); \
295 } while (0) 323 } while (0)
296 324
325/*
326 * Note a voluntary context switch for RCU-tasks benefit. This is a
327 * macro rather than an inline function to avoid #include hell.
328 */
329#ifdef CONFIG_TASKS_RCU
330#define TASKS_RCU(x) x
331extern struct srcu_struct tasks_rcu_exit_srcu;
332#define rcu_note_voluntary_context_switch(t) \
333 do { \
334 if (ACCESS_ONCE((t)->rcu_tasks_holdout)) \
335 ACCESS_ONCE((t)->rcu_tasks_holdout) = false; \
336 } while (0)
337#else /* #ifdef CONFIG_TASKS_RCU */
338#define TASKS_RCU(x) do { } while (0)
339#define rcu_note_voluntary_context_switch(t) do { } while (0)
340#endif /* #else #ifdef CONFIG_TASKS_RCU */
341
342/**
343 * cond_resched_rcu_qs - Report potential quiescent states to RCU
344 *
345 * This macro resembles cond_resched(), except that it is defined to
346 * report potential quiescent states to RCU-tasks even if the cond_resched()
347 * machinery were to be shut off, as some advocate for PREEMPT kernels.
348 */
349#define cond_resched_rcu_qs() \
350do { \
351 rcu_note_voluntary_context_switch(current); \
352 cond_resched(); \
353} while (0)
354
297#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) 355#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
298bool __rcu_is_watching(void); 356bool __rcu_is_watching(void);
299#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 357#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
@@ -349,7 +407,7 @@ bool rcu_lockdep_current_cpu_online(void);
349#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ 407#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
350static inline bool rcu_lockdep_current_cpu_online(void) 408static inline bool rcu_lockdep_current_cpu_online(void)
351{ 409{
352 return 1; 410 return true;
353} 411}
354#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ 412#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
355 413
@@ -371,41 +429,7 @@ extern struct lockdep_map rcu_sched_lock_map;
371extern struct lockdep_map rcu_callback_map; 429extern struct lockdep_map rcu_callback_map;
372int debug_lockdep_rcu_enabled(void); 430int debug_lockdep_rcu_enabled(void);
373 431
374/** 432int rcu_read_lock_held(void);
375 * rcu_read_lock_held() - might we be in RCU read-side critical section?
376 *
377 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
378 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
379 * this assumes we are in an RCU read-side critical section unless it can
380 * prove otherwise. This is useful for debug checks in functions that
381 * require that they be called within an RCU read-side critical section.
382 *
383 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
384 * and while lockdep is disabled.
385 *
386 * Note that rcu_read_lock() and the matching rcu_read_unlock() must
387 * occur in the same context, for example, it is illegal to invoke
388 * rcu_read_unlock() in process context if the matching rcu_read_lock()
389 * was invoked from within an irq handler.
390 *
391 * Note that rcu_read_lock() is disallowed if the CPU is either idle or
392 * offline from an RCU perspective, so check for those as well.
393 */
394static inline int rcu_read_lock_held(void)
395{
396 if (!debug_lockdep_rcu_enabled())
397 return 1;
398 if (!rcu_is_watching())
399 return 0;
400 if (!rcu_lockdep_current_cpu_online())
401 return 0;
402 return lock_is_held(&rcu_lock_map);
403}
404
405/*
406 * rcu_read_lock_bh_held() is defined out of line to avoid #include-file
407 * hell.
408 */
409int rcu_read_lock_bh_held(void); 433int rcu_read_lock_bh_held(void);
410 434
411/** 435/**
@@ -593,6 +617,21 @@ static inline void rcu_preempt_sleep_check(void)
593#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v) 617#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v)
594 618
595/** 619/**
620 * lockless_dereference() - safely load a pointer for later dereference
621 * @p: The pointer to load
622 *
623 * Similar to rcu_dereference(), but for situations where the pointed-to
624 * object's lifetime is managed by something other than RCU. That
625 * "something other" might be reference counting or simple immortality.
626 */
627#define lockless_dereference(p) \
628({ \
629 typeof(p) _________p1 = ACCESS_ONCE(p); \
630 smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
631 (_________p1); \
632})
633
634/**
596 * rcu_assign_pointer() - assign to RCU-protected pointer 635 * rcu_assign_pointer() - assign to RCU-protected pointer
597 * @p: pointer to assign to 636 * @p: pointer to assign to
598 * @v: value to assign (publish) 637 * @v: value to assign (publish)
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index d40a6a451330..38cc5b1e252d 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -80,7 +80,7 @@ static inline void kfree_call_rcu(struct rcu_head *head,
80 80
81static inline void rcu_note_context_switch(int cpu) 81static inline void rcu_note_context_switch(int cpu)
82{ 82{
83 rcu_sched_qs(cpu); 83 rcu_sched_qs();
84} 84}
85 85
86/* 86/*
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 48bf152761c7..67fc8fcdc4b0 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -38,6 +38,9 @@ extern int reboot_force;
38extern int register_reboot_notifier(struct notifier_block *); 38extern int register_reboot_notifier(struct notifier_block *);
39extern int unregister_reboot_notifier(struct notifier_block *); 39extern int unregister_reboot_notifier(struct notifier_block *);
40 40
41extern int register_restart_handler(struct notifier_block *);
42extern int unregister_restart_handler(struct notifier_block *);
43extern void do_kernel_restart(char *cmd);
41 44
42/* 45/*
43 * Architecture-specific implementations of sys_reboot commands. 46 * Architecture-specific implementations of sys_reboot commands.
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index d347c805f923..f540b1496e2f 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -35,6 +35,8 @@
35#ifndef __LINUX_REGULATOR_CONSUMER_H_ 35#ifndef __LINUX_REGULATOR_CONSUMER_H_
36#define __LINUX_REGULATOR_CONSUMER_H_ 36#define __LINUX_REGULATOR_CONSUMER_H_
37 37
38#include <linux/err.h>
39
38struct device; 40struct device;
39struct notifier_block; 41struct notifier_block;
40struct regmap; 42struct regmap;
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 36826c0166c5..fb298e9d6d3a 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -44,6 +44,7 @@ struct rhashtable;
44 * @head_offset: Offset of rhash_head in struct to be hashed 44 * @head_offset: Offset of rhash_head in struct to be hashed
45 * @hash_rnd: Seed to use while hashing 45 * @hash_rnd: Seed to use while hashing
46 * @max_shift: Maximum number of shifts while expanding 46 * @max_shift: Maximum number of shifts while expanding
47 * @min_shift: Minimum number of shifts while shrinking
47 * @hashfn: Function to hash key 48 * @hashfn: Function to hash key
48 * @obj_hashfn: Function to hash object 49 * @obj_hashfn: Function to hash object
49 * @grow_decision: If defined, may return true if table should expand 50 * @grow_decision: If defined, may return true if table should expand
@@ -57,6 +58,7 @@ struct rhashtable_params {
57 size_t head_offset; 58 size_t head_offset;
58 u32 hash_rnd; 59 u32 hash_rnd;
59 size_t max_shift; 60 size_t max_shift;
61 size_t min_shift;
60 rht_hashfn_t hashfn; 62 rht_hashfn_t hashfn;
61 rht_obj_hashfn_t obj_hashfn; 63 rht_obj_hashfn_t obj_hashfn;
62 bool (*grow_decision)(const struct rhashtable *ht, 64 bool (*grow_decision)(const struct rhashtable *ht,
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 49a4d6f59108..e2c13cd863bd 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
97 __ring_buffer_alloc((size), (flags), &__key); \ 97 __ring_buffer_alloc((size), (flags), &__key); \
98}) 98})
99 99
100int ring_buffer_wait(struct ring_buffer *buffer, int cpu); 100int ring_buffer_wait(struct ring_buffer *buffer, int cpu, bool full);
101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, 101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
102 struct file *filp, poll_table *poll_table); 102 struct file *filp, poll_table *poll_table);
103 103
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index be574506e6a9..c0c2bce6b0b7 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -150,7 +150,7 @@ int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
150static inline void anon_vma_merge(struct vm_area_struct *vma, 150static inline void anon_vma_merge(struct vm_area_struct *vma,
151 struct vm_area_struct *next) 151 struct vm_area_struct *next)
152{ 152{
153 VM_BUG_ON(vma->anon_vma != next->anon_vma); 153 VM_BUG_ON_VMA(vma->anon_vma != next->anon_vma, vma);
154 unlink_anon_vmas(next); 154 unlink_anon_vmas(next);
155} 155}
156 156
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 167bae7bdfa4..6cacbce1a06c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -47,6 +47,16 @@ static inline int lockdep_rtnl_is_held(void)
47 rcu_dereference_check(p, lockdep_rtnl_is_held()) 47 rcu_dereference_check(p, lockdep_rtnl_is_held())
48 48
49/** 49/**
50 * rcu_dereference_bh_rtnl - rcu_dereference_bh with debug checking
51 * @p: The pointer to read, prior to dereference
52 *
53 * Do an rcu_dereference_bh(p), but check caller either holds rcu_read_lock_bh()
54 * or RTNL. Note : Please prefer rtnl_dereference() or rcu_dereference_bh()
55 */
56#define rcu_dereference_bh_rtnl(p) \
57 rcu_dereference_bh_check(p, lockdep_rtnl_is_held())
58
59/**
50 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL 60 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL
51 * @p: The pointer to read, prior to dereferencing 61 * @p: The pointer to read, prior to dereferencing
52 * 62 *
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 035d3c57fc8a..8f498cdde280 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -149,7 +149,7 @@ extern void downgrade_write(struct rw_semaphore *sem);
149 * static then another method for expressing nested locking is 149 * static then another method for expressing nested locking is
150 * the explicit definition of lock class keys and the use of 150 * the explicit definition of lock class keys and the use of
151 * lockdep_set_class() at lock initialization time. 151 * lockdep_set_class() at lock initialization time.
152 * See Documentation/lockdep-design.txt for more details.) 152 * See Documentation/locking/lockdep-design.txt for more details.)
153 */ 153 */
154extern void down_read_nested(struct rw_semaphore *sem, int subclass); 154extern void down_read_nested(struct rw_semaphore *sem, int subclass);
155extern void down_write_nested(struct rw_semaphore *sem, int subclass); 155extern void down_write_nested(struct rw_semaphore *sem, int subclass);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b867a4dab38a..5e344bbe63ec 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -57,6 +57,7 @@ struct sched_param {
57#include <linux/llist.h> 57#include <linux/llist.h>
58#include <linux/uidgid.h> 58#include <linux/uidgid.h>
59#include <linux/gfp.h> 59#include <linux/gfp.h>
60#include <linux/magic.h>
60 61
61#include <asm/processor.h> 62#include <asm/processor.h>
62 63
@@ -167,6 +168,7 @@ extern int nr_threads;
167DECLARE_PER_CPU(unsigned long, process_counts); 168DECLARE_PER_CPU(unsigned long, process_counts);
168extern int nr_processes(void); 169extern int nr_processes(void);
169extern unsigned long nr_running(void); 170extern unsigned long nr_running(void);
171extern bool single_task_running(void);
170extern unsigned long nr_iowait(void); 172extern unsigned long nr_iowait(void);
171extern unsigned long nr_iowait_cpu(int cpu); 173extern unsigned long nr_iowait_cpu(int cpu);
172extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load); 174extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load);
@@ -645,6 +647,7 @@ struct signal_struct {
645 * Live threads maintain their own counters and add to these 647 * Live threads maintain their own counters and add to these
646 * in __exit_signal, except for the group leader. 648 * in __exit_signal, except for the group leader.
647 */ 649 */
650 seqlock_t stats_lock;
648 cputime_t utime, stime, cutime, cstime; 651 cputime_t utime, stime, cutime, cstime;
649 cputime_t gtime; 652 cputime_t gtime;
650 cputime_t cgtime; 653 cputime_t cgtime;
@@ -1023,6 +1026,7 @@ struct sched_domain_topology_level {
1023extern struct sched_domain_topology_level *sched_domain_topology; 1026extern struct sched_domain_topology_level *sched_domain_topology;
1024 1027
1025extern void set_sched_topology(struct sched_domain_topology_level *tl); 1028extern void set_sched_topology(struct sched_domain_topology_level *tl);
1029extern void wake_up_if_idle(int cpu);
1026 1030
1027#ifdef CONFIG_SCHED_DEBUG 1031#ifdef CONFIG_SCHED_DEBUG
1028# define SD_INIT_NAME(type) .name = #type 1032# define SD_INIT_NAME(type) .name = #type
@@ -1212,6 +1216,13 @@ struct sched_dl_entity {
1212 struct hrtimer dl_timer; 1216 struct hrtimer dl_timer;
1213}; 1217};
1214 1218
1219union rcu_special {
1220 struct {
1221 bool blocked;
1222 bool need_qs;
1223 } b;
1224 short s;
1225};
1215struct rcu_node; 1226struct rcu_node;
1216 1227
1217enum perf_event_task_context { 1228enum perf_event_task_context {
@@ -1264,12 +1275,18 @@ struct task_struct {
1264 1275
1265#ifdef CONFIG_PREEMPT_RCU 1276#ifdef CONFIG_PREEMPT_RCU
1266 int rcu_read_lock_nesting; 1277 int rcu_read_lock_nesting;
1267 char rcu_read_unlock_special; 1278 union rcu_special rcu_read_unlock_special;
1268 struct list_head rcu_node_entry; 1279 struct list_head rcu_node_entry;
1269#endif /* #ifdef CONFIG_PREEMPT_RCU */ 1280#endif /* #ifdef CONFIG_PREEMPT_RCU */
1270#ifdef CONFIG_TREE_PREEMPT_RCU 1281#ifdef CONFIG_TREE_PREEMPT_RCU
1271 struct rcu_node *rcu_blocked_node; 1282 struct rcu_node *rcu_blocked_node;
1272#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 1283#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1284#ifdef CONFIG_TASKS_RCU
1285 unsigned long rcu_tasks_nvcsw;
1286 bool rcu_tasks_holdout;
1287 struct list_head rcu_tasks_holdout_list;
1288 int rcu_tasks_idle_cpu;
1289#endif /* #ifdef CONFIG_TASKS_RCU */
1273 1290
1274#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1291#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
1275 struct sched_info sched_info; 1292 struct sched_info sched_info;
@@ -1934,11 +1951,13 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1934#define tsk_used_math(p) ((p)->flags & PF_USED_MATH) 1951#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
1935#define used_math() tsk_used_math(current) 1952#define used_math() tsk_used_math(current)
1936 1953
1937/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags */ 1954/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags
1955 * __GFP_FS is also cleared as it implies __GFP_IO.
1956 */
1938static inline gfp_t memalloc_noio_flags(gfp_t flags) 1957static inline gfp_t memalloc_noio_flags(gfp_t flags)
1939{ 1958{
1940 if (unlikely(current->flags & PF_MEMALLOC_NOIO)) 1959 if (unlikely(current->flags & PF_MEMALLOC_NOIO))
1941 flags &= ~__GFP_IO; 1960 flags &= ~(__GFP_IO | __GFP_FS);
1942 return flags; 1961 return flags;
1943} 1962}
1944 1963
@@ -2011,29 +2030,21 @@ extern void task_clear_jobctl_trapping(struct task_struct *task);
2011extern void task_clear_jobctl_pending(struct task_struct *task, 2030extern void task_clear_jobctl_pending(struct task_struct *task,
2012 unsigned int mask); 2031 unsigned int mask);
2013 2032
2014#ifdef CONFIG_PREEMPT_RCU
2015
2016#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
2017#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
2018
2019static inline void rcu_copy_process(struct task_struct *p) 2033static inline void rcu_copy_process(struct task_struct *p)
2020{ 2034{
2035#ifdef CONFIG_PREEMPT_RCU
2021 p->rcu_read_lock_nesting = 0; 2036 p->rcu_read_lock_nesting = 0;
2022 p->rcu_read_unlock_special = 0; 2037 p->rcu_read_unlock_special.s = 0;
2023#ifdef CONFIG_TREE_PREEMPT_RCU
2024 p->rcu_blocked_node = NULL; 2038 p->rcu_blocked_node = NULL;
2025#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
2026 INIT_LIST_HEAD(&p->rcu_node_entry); 2039 INIT_LIST_HEAD(&p->rcu_node_entry);
2040#endif /* #ifdef CONFIG_PREEMPT_RCU */
2041#ifdef CONFIG_TASKS_RCU
2042 p->rcu_tasks_holdout = false;
2043 INIT_LIST_HEAD(&p->rcu_tasks_holdout_list);
2044 p->rcu_tasks_idle_cpu = -1;
2045#endif /* #ifdef CONFIG_TASKS_RCU */
2027} 2046}
2028 2047
2029#else
2030
2031static inline void rcu_copy_process(struct task_struct *p)
2032{
2033}
2034
2035#endif
2036
2037static inline void tsk_restore_flags(struct task_struct *task, 2048static inline void tsk_restore_flags(struct task_struct *task,
2038 unsigned long orig_flags, unsigned long flags) 2049 unsigned long orig_flags, unsigned long flags)
2039{ 2050{
@@ -2639,6 +2650,8 @@ static inline unsigned long *end_of_stack(struct task_struct *p)
2639} 2650}
2640 2651
2641#endif 2652#endif
2653#define task_stack_end_corrupted(task) \
2654 (*(end_of_stack(task)) != STACK_END_MAGIC)
2642 2655
2643static inline int object_is_on_stack(void *obj) 2656static inline int object_is_on_stack(void *obj)
2644{ 2657{
@@ -2661,6 +2674,7 @@ static inline unsigned long stack_not_used(struct task_struct *p)
2661 return (unsigned long)n - (unsigned long)end_of_stack(p); 2674 return (unsigned long)n - (unsigned long)end_of_stack(p);
2662} 2675}
2663#endif 2676#endif
2677extern void set_task_stack_end_magic(struct task_struct *tsk);
2664 2678
2665/* set thread flags in other task's structures 2679/* set thread flags in other task's structures
2666 * - see asm/thread_info.h for TIF_xxxx flags available 2680 * - see asm/thread_info.h for TIF_xxxx flags available
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 005bf3e38db5..f0f8bad54be9 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -5,12 +5,4 @@
5 5
6extern struct screen_info screen_info; 6extern struct screen_info screen_info;
7 7
8#define ORIG_X (screen_info.orig_x)
9#define ORIG_Y (screen_info.orig_y)
10#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
11#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
12#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
13#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
14#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
15#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
16#endif /* _SCREEN_INFO_H */ 8#endif /* _SCREEN_INFO_H */
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 5d586a45a319..a19ddacdac30 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -27,19 +27,23 @@ struct seccomp {
27 struct seccomp_filter *filter; 27 struct seccomp_filter *filter;
28}; 28};
29 29
30extern int __secure_computing(int); 30#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
31static inline int secure_computing(int this_syscall) 31extern int __secure_computing(void);
32static inline int secure_computing(void)
32{ 33{
33 if (unlikely(test_thread_flag(TIF_SECCOMP))) 34 if (unlikely(test_thread_flag(TIF_SECCOMP)))
34 return __secure_computing(this_syscall); 35 return __secure_computing();
35 return 0; 36 return 0;
36} 37}
37 38
38/* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */ 39#define SECCOMP_PHASE1_OK 0
39static inline void secure_computing_strict(int this_syscall) 40#define SECCOMP_PHASE1_SKIP 1
40{ 41
41 BUG_ON(secure_computing(this_syscall) != 0); 42extern u32 seccomp_phase1(struct seccomp_data *sd);
42} 43int seccomp_phase2(u32 phase1_result);
44#else
45extern void secure_computing_strict(int this_syscall);
46#endif
43 47
44extern long prctl_get_seccomp(void); 48extern long prctl_get_seccomp(void);
45extern long prctl_set_seccomp(unsigned long, char __user *); 49extern long prctl_set_seccomp(unsigned long, char __user *);
@@ -56,8 +60,11 @@ static inline int seccomp_mode(struct seccomp *s)
56struct seccomp { }; 60struct seccomp { };
57struct seccomp_filter { }; 61struct seccomp_filter { };
58 62
59static inline int secure_computing(int this_syscall) { return 0; } 63#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
64static inline int secure_computing(void) { return 0; }
65#else
60static inline void secure_computing_strict(int this_syscall) { return; } 66static inline void secure_computing_strict(int this_syscall) { return; }
67#endif
61 68
62static inline long prctl_get_seccomp(void) 69static inline long prctl_get_seccomp(void)
63{ 70{
diff --git a/include/linux/security.h b/include/linux/security.h
index 623f90e5f38d..ba96471c11ba 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1559,7 +1559,7 @@ struct security_operations {
1559 int (*file_lock) (struct file *file, unsigned int cmd); 1559 int (*file_lock) (struct file *file, unsigned int cmd);
1560 int (*file_fcntl) (struct file *file, unsigned int cmd, 1560 int (*file_fcntl) (struct file *file, unsigned int cmd,
1561 unsigned long arg); 1561 unsigned long arg);
1562 int (*file_set_fowner) (struct file *file); 1562 void (*file_set_fowner) (struct file *file);
1563 int (*file_send_sigiotask) (struct task_struct *tsk, 1563 int (*file_send_sigiotask) (struct task_struct *tsk,
1564 struct fown_struct *fown, int sig); 1564 struct fown_struct *fown, int sig);
1565 int (*file_receive) (struct file *file); 1565 int (*file_receive) (struct file *file);
@@ -1834,7 +1834,7 @@ int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
1834 unsigned long prot); 1834 unsigned long prot);
1835int security_file_lock(struct file *file, unsigned int cmd); 1835int security_file_lock(struct file *file, unsigned int cmd);
1836int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg); 1836int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
1837int security_file_set_fowner(struct file *file); 1837void security_file_set_fowner(struct file *file);
1838int security_file_send_sigiotask(struct task_struct *tsk, 1838int security_file_send_sigiotask(struct task_struct *tsk,
1839 struct fown_struct *fown, int sig); 1839 struct fown_struct *fown, int sig);
1840int security_file_receive(struct file *file); 1840int security_file_receive(struct file *file);
@@ -2108,7 +2108,7 @@ static inline int security_dentry_init_security(struct dentry *dentry,
2108static inline int security_inode_init_security(struct inode *inode, 2108static inline int security_inode_init_security(struct inode *inode,
2109 struct inode *dir, 2109 struct inode *dir,
2110 const struct qstr *qstr, 2110 const struct qstr *qstr,
2111 const initxattrs initxattrs, 2111 const initxattrs xattrs,
2112 void *fs_data) 2112 void *fs_data)
2113{ 2113{
2114 return 0; 2114 return 0;
@@ -2312,9 +2312,9 @@ static inline int security_file_fcntl(struct file *file, unsigned int cmd,
2312 return 0; 2312 return 0;
2313} 2313}
2314 2314
2315static inline int security_file_set_fowner(struct file *file) 2315static inline void security_file_set_fowner(struct file *file)
2316{ 2316{
2317 return 0; 2317 return;
2318} 2318}
2319 2319
2320static inline int security_file_send_sigiotask(struct task_struct *tsk, 2320static inline int security_file_send_sigiotask(struct task_struct *tsk,
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index cc359636cfa3..f5df8f687b4d 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -456,4 +456,23 @@ read_sequnlock_excl_irqrestore(seqlock_t *sl, unsigned long flags)
456 spin_unlock_irqrestore(&sl->lock, flags); 456 spin_unlock_irqrestore(&sl->lock, flags);
457} 457}
458 458
459static inline unsigned long
460read_seqbegin_or_lock_irqsave(seqlock_t *lock, int *seq)
461{
462 unsigned long flags = 0;
463
464 if (!(*seq & 1)) /* Even */
465 *seq = read_seqbegin(lock);
466 else /* Odd */
467 read_seqlock_excl_irqsave(lock, flags);
468
469 return flags;
470}
471
472static inline void
473done_seqretry_irqrestore(seqlock_t *lock, int seq, unsigned long flags)
474{
475 if (seq & 1)
476 read_sequnlock_excl_irqrestore(lock, flags);
477}
459#endif /* __LINUX_SEQLOCK_H */ 478#endif /* __LINUX_SEQLOCK_H */
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index f93649e22c43..3df10d5f154b 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -84,6 +84,7 @@ struct uart_8250_port {
84 unsigned char mcr_mask; /* mask of user bits */ 84 unsigned char mcr_mask; /* mask of user bits */
85 unsigned char mcr_force; /* mask of forced bits */ 85 unsigned char mcr_force; /* mask of forced bits */
86 unsigned char cur_iotype; /* Running I/O type */ 86 unsigned char cur_iotype; /* Running I/O type */
87 unsigned int rpm_tx_active;
87 88
88 /* 89 /*
89 * Some bits in registers are cleared on a read, so they must 90 * Some bits in registers are cleared on a read, so they must
@@ -96,10 +97,13 @@ struct uart_8250_port {
96 unsigned char msr_saved_flags; 97 unsigned char msr_saved_flags;
97 98
98 struct uart_8250_dma *dma; 99 struct uart_8250_dma *dma;
100 struct serial_rs485 rs485;
99 101
100 /* 8250 specific callbacks */ 102 /* 8250 specific callbacks */
101 int (*dl_read)(struct uart_8250_port *); 103 int (*dl_read)(struct uart_8250_port *);
102 void (*dl_write)(struct uart_8250_port *, int); 104 void (*dl_write)(struct uart_8250_port *, int);
105 int (*rs485_config)(struct uart_8250_port *,
106 struct serial_rs485 *rs485);
103}; 107};
104 108
105static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up) 109static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up)
@@ -121,6 +125,8 @@ extern void serial8250_early_out(struct uart_port *port, int offset, int value);
121extern int setup_early_serial8250_console(char *cmdline); 125extern int setup_early_serial8250_console(char *cmdline);
122extern void serial8250_do_set_termios(struct uart_port *port, 126extern void serial8250_do_set_termios(struct uart_port *port,
123 struct ktermios *termios, struct ktermios *old); 127 struct ktermios *termios, struct ktermios *old);
128extern int serial8250_do_startup(struct uart_port *port);
129extern void serial8250_do_shutdown(struct uart_port *port);
124extern void serial8250_do_pm(struct uart_port *port, unsigned int state, 130extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
125 unsigned int oldstate); 131 unsigned int oldstate);
126extern int fsl8250_handle_irq(struct uart_port *port); 132extern int fsl8250_handle_irq(struct uart_port *port);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index cf3a1e789bf5..21c2e05c1bc3 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -112,6 +112,7 @@ struct uart_icount {
112}; 112};
113 113
114typedef unsigned int __bitwise__ upf_t; 114typedef unsigned int __bitwise__ upf_t;
115typedef unsigned int __bitwise__ upstat_t;
115 116
116struct uart_port { 117struct uart_port {
117 spinlock_t lock; /* port lock */ 118 spinlock_t lock; /* port lock */
@@ -122,6 +123,10 @@ struct uart_port {
122 void (*set_termios)(struct uart_port *, 123 void (*set_termios)(struct uart_port *,
123 struct ktermios *new, 124 struct ktermios *new,
124 struct ktermios *old); 125 struct ktermios *old);
126 int (*startup)(struct uart_port *port);
127 void (*shutdown)(struct uart_port *port);
128 void (*throttle)(struct uart_port *port);
129 void (*unthrottle)(struct uart_port *port);
125 int (*handle_irq)(struct uart_port *); 130 int (*handle_irq)(struct uart_port *);
126 void (*pm)(struct uart_port *, unsigned int state, 131 void (*pm)(struct uart_port *, unsigned int state,
127 unsigned int old); 132 unsigned int old);
@@ -152,6 +157,7 @@ struct uart_port {
152 unsigned long sysrq; /* sysrq timeout */ 157 unsigned long sysrq; /* sysrq timeout */
153#endif 158#endif
154 159
160 /* flags must be updated while holding port mutex */
155 upf_t flags; 161 upf_t flags;
156 162
157#define UPF_FOURPORT ((__force upf_t) (1 << 1)) 163#define UPF_FOURPORT ((__force upf_t) (1 << 1))
@@ -187,6 +193,13 @@ struct uart_port {
187#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff)) 193#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff))
188#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY)) 194#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY))
189 195
196 /* status must be updated while holding port lock */
197 upstat_t status;
198
199#define UPSTAT_CTS_ENABLE ((__force upstat_t) (1 << 0))
200#define UPSTAT_DCD_ENABLE ((__force upstat_t) (1 << 1))
201
202 int hw_stopped; /* sw-assisted CTS flow state */
190 unsigned int mctrl; /* current modem ctrl settings */ 203 unsigned int mctrl; /* current modem ctrl settings */
191 unsigned int timeout; /* character-based timeout */ 204 unsigned int timeout; /* character-based timeout */
192 unsigned int type; /* port type */ 205 unsigned int type; /* port type */
@@ -347,11 +360,16 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
347static inline int uart_tx_stopped(struct uart_port *port) 360static inline int uart_tx_stopped(struct uart_port *port)
348{ 361{
349 struct tty_struct *tty = port->state->port.tty; 362 struct tty_struct *tty = port->state->port.tty;
350 if(tty->stopped || tty->hw_stopped) 363 if (tty->stopped || port->hw_stopped)
351 return 1; 364 return 1;
352 return 0; 365 return 0;
353} 366}
354 367
368static inline bool uart_cts_enabled(struct uart_port *uport)
369{
370 return uport->status & UPSTAT_CTS_ENABLE;
371}
372
355/* 373/*
356 * The following are helper functions for the low level drivers. 374 * The following are helper functions for the low level drivers.
357 */ 375 */
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 750196fcc0a5..ab1e0392b5ac 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -2,6 +2,7 @@
2#define _LINUX_SIGNAL_H 2#define _LINUX_SIGNAL_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/bug.h>
5#include <uapi/linux/signal.h> 6#include <uapi/linux/signal.h>
6 7
7struct task_struct; 8struct task_struct;
@@ -67,7 +68,6 @@ static inline int sigismember(sigset_t *set, int _sig)
67 68
68static inline int sigisemptyset(sigset_t *set) 69static inline int sigisemptyset(sigset_t *set)
69{ 70{
70 extern void _NSIG_WORDS_is_unsupported_size(void);
71 switch (_NSIG_WORDS) { 71 switch (_NSIG_WORDS) {
72 case 4: 72 case 4:
73 return (set->sig[3] | set->sig[2] | 73 return (set->sig[3] | set->sig[2] |
@@ -77,7 +77,7 @@ static inline int sigisemptyset(sigset_t *set)
77 case 1: 77 case 1:
78 return set->sig[0] == 0; 78 return set->sig[0] == 0;
79 default: 79 default:
80 _NSIG_WORDS_is_unsupported_size(); 80 BUILD_BUG();
81 return 0; 81 return 0;
82 } 82 }
83} 83}
@@ -90,24 +90,23 @@ static inline int sigisemptyset(sigset_t *set)
90#define _SIG_SET_BINOP(name, op) \ 90#define _SIG_SET_BINOP(name, op) \
91static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ 91static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
92{ \ 92{ \
93 extern void _NSIG_WORDS_is_unsupported_size(void); \
94 unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \ 93 unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \
95 \ 94 \
96 switch (_NSIG_WORDS) { \ 95 switch (_NSIG_WORDS) { \
97 case 4: \ 96 case 4: \
98 a3 = a->sig[3]; a2 = a->sig[2]; \ 97 a3 = a->sig[3]; a2 = a->sig[2]; \
99 b3 = b->sig[3]; b2 = b->sig[2]; \ 98 b3 = b->sig[3]; b2 = b->sig[2]; \
100 r->sig[3] = op(a3, b3); \ 99 r->sig[3] = op(a3, b3); \
101 r->sig[2] = op(a2, b2); \ 100 r->sig[2] = op(a2, b2); \
102 case 2: \ 101 case 2: \
103 a1 = a->sig[1]; b1 = b->sig[1]; \ 102 a1 = a->sig[1]; b1 = b->sig[1]; \
104 r->sig[1] = op(a1, b1); \ 103 r->sig[1] = op(a1, b1); \
105 case 1: \ 104 case 1: \
106 a0 = a->sig[0]; b0 = b->sig[0]; \ 105 a0 = a->sig[0]; b0 = b->sig[0]; \
107 r->sig[0] = op(a0, b0); \ 106 r->sig[0] = op(a0, b0); \
108 break; \ 107 break; \
109 default: \ 108 default: \
110 _NSIG_WORDS_is_unsupported_size(); \ 109 BUILD_BUG(); \
111 } \ 110 } \
112} 111}
113 112
@@ -128,16 +127,14 @@ _SIG_SET_BINOP(sigandnsets, _sig_andn)
128#define _SIG_SET_OP(name, op) \ 127#define _SIG_SET_OP(name, op) \
129static inline void name(sigset_t *set) \ 128static inline void name(sigset_t *set) \
130{ \ 129{ \
131 extern void _NSIG_WORDS_is_unsupported_size(void); \
132 \
133 switch (_NSIG_WORDS) { \ 130 switch (_NSIG_WORDS) { \
134 case 4: set->sig[3] = op(set->sig[3]); \ 131 case 4: set->sig[3] = op(set->sig[3]); \
135 set->sig[2] = op(set->sig[2]); \ 132 set->sig[2] = op(set->sig[2]); \
136 case 2: set->sig[1] = op(set->sig[1]); \ 133 case 2: set->sig[1] = op(set->sig[1]); \
137 case 1: set->sig[0] = op(set->sig[0]); \ 134 case 1: set->sig[0] = op(set->sig[0]); \
138 break; \ 135 break; \
139 default: \ 136 default: \
140 _NSIG_WORDS_is_unsupported_size(); \ 137 BUILD_BUG(); \
141 } \ 138 } \
142} 139}
143 140
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index a17ba0881afb..6c8b6f604e76 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -46,11 +46,29 @@
46 * 46 *
47 * The hardware you're dealing with doesn't calculate the full checksum 47 * The hardware you're dealing with doesn't calculate the full checksum
48 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums 48 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums
49 * for specific protocols e.g. TCP/UDP/SCTP, then, for such packets it will 49 * for specific protocols. For such packets it will set CHECKSUM_UNNECESSARY
50 * set CHECKSUM_UNNECESSARY if their checksums are okay. skb->csum is still 50 * if their checksums are okay. skb->csum is still undefined in this case
51 * undefined in this case though. It is a bad option, but, unfortunately, 51 * though. It is a bad option, but, unfortunately, nowadays most vendors do
52 * nowadays most vendors do this. Apparently with the secret goal to sell 52 * this. Apparently with the secret goal to sell you new devices, when you
53 * you new devices, when you will add new protocol to your host, f.e. IPv6 8) 53 * will add new protocol to your host, f.e. IPv6 8)
54 *
55 * CHECKSUM_UNNECESSARY is applicable to following protocols:
56 * TCP: IPv6 and IPv4.
57 * UDP: IPv4 and IPv6. A device may apply CHECKSUM_UNNECESSARY to a
58 * zero UDP checksum for either IPv4 or IPv6, the networking stack
59 * may perform further validation in this case.
60 * GRE: only if the checksum is present in the header.
61 * SCTP: indicates the CRC in SCTP header has been validated.
62 *
63 * skb->csum_level indicates the number of consecutive checksums found in
64 * the packet minus one that have been verified as CHECKSUM_UNNECESSARY.
65 * For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet
66 * and a device is able to verify the checksums for UDP (possibly zero),
67 * GRE (checksum flag is set), and TCP-- skb->csum_level would be set to
68 * two. If the device were only able to verify the UDP checksum and not
69 * GRE, either because it doesn't support GRE checksum of because GRE
70 * checksum is bad, skb->csum_level would be set to zero (TCP checksum is
71 * not considered in this case).
54 * 72 *
55 * CHECKSUM_COMPLETE: 73 * CHECKSUM_COMPLETE:
56 * 74 *
@@ -111,6 +129,9 @@
111#define CHECKSUM_COMPLETE 2 129#define CHECKSUM_COMPLETE 2
112#define CHECKSUM_PARTIAL 3 130#define CHECKSUM_PARTIAL 3
113 131
132/* Maximum value in skb->csum_level */
133#define SKB_MAX_CSUM_LEVEL 3
134
114#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES) 135#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES)
115#define SKB_WITH_OVERHEAD(X) \ 136#define SKB_WITH_OVERHEAD(X) \
116 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) 137 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
@@ -134,7 +155,7 @@ struct nf_conntrack {
134}; 155};
135#endif 156#endif
136 157
137#ifdef CONFIG_BRIDGE_NETFILTER 158#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
138struct nf_bridge_info { 159struct nf_bridge_info {
139 atomic_t use; 160 atomic_t use;
140 unsigned int mask; 161 unsigned int mask;
@@ -317,9 +338,10 @@ struct skb_shared_info {
317 338
318 339
319enum { 340enum {
320 SKB_FCLONE_UNAVAILABLE, 341 SKB_FCLONE_UNAVAILABLE, /* skb has no fclone (from head_cache) */
321 SKB_FCLONE_ORIG, 342 SKB_FCLONE_ORIG, /* orig skb (from fclone_cache) */
322 SKB_FCLONE_CLONE, 343 SKB_FCLONE_CLONE, /* companion fclone skb (from fclone_cache) */
344 SKB_FCLONE_FREE, /* this companion fclone skb is available */
323}; 345};
324 346
325enum { 347enum {
@@ -451,6 +473,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
451 * @tc_verd: traffic control verdict 473 * @tc_verd: traffic control verdict
452 * @hash: the packet hash 474 * @hash: the packet hash
453 * @queue_mapping: Queue mapping for multiqueue devices 475 * @queue_mapping: Queue mapping for multiqueue devices
476 * @xmit_more: More SKBs are pending for this queue
454 * @ndisc_nodetype: router type (from link layer) 477 * @ndisc_nodetype: router type (from link layer)
455 * @ooo_okay: allow the mapping of a socket to a queue to be changed 478 * @ooo_okay: allow the mapping of a socket to a queue to be changed
456 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport 479 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
@@ -459,8 +482,6 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
459 * @wifi_acked_valid: wifi_acked was set 482 * @wifi_acked_valid: wifi_acked was set
460 * @wifi_acked: whether frame was acked on wifi or not 483 * @wifi_acked: whether frame was acked on wifi or not
461 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 484 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
462 * @dma_cookie: a cookie to one of several possible DMA operations
463 * done by skb DMA functions
464 * @napi_id: id of the NAPI struct this skb came from 485 * @napi_id: id of the NAPI struct this skb came from
465 * @secmark: security marking 486 * @secmark: security marking
466 * @mark: Generic packet mark 487 * @mark: Generic packet mark
@@ -504,82 +525,99 @@ struct sk_buff {
504 char cb[48] __aligned(8); 525 char cb[48] __aligned(8);
505 526
506 unsigned long _skb_refdst; 527 unsigned long _skb_refdst;
528 void (*destructor)(struct sk_buff *skb);
507#ifdef CONFIG_XFRM 529#ifdef CONFIG_XFRM
508 struct sec_path *sp; 530 struct sec_path *sp;
509#endif 531#endif
532#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
533 struct nf_conntrack *nfct;
534#endif
535#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
536 struct nf_bridge_info *nf_bridge;
537#endif
510 unsigned int len, 538 unsigned int len,
511 data_len; 539 data_len;
512 __u16 mac_len, 540 __u16 mac_len,
513 hdr_len; 541 hdr_len;
514 union { 542
515 __wsum csum; 543 /* Following fields are _not_ copied in __copy_skb_header()
516 struct { 544 * Note that queue_mapping is here mostly to fill a hole.
517 __u16 csum_start; 545 */
518 __u16 csum_offset;
519 };
520 };
521 __u32 priority;
522 kmemcheck_bitfield_begin(flags1); 546 kmemcheck_bitfield_begin(flags1);
523 __u8 ignore_df:1, 547 __u16 queue_mapping;
524 cloned:1, 548 __u8 cloned:1,
525 ip_summed:2,
526 nohdr:1, 549 nohdr:1,
527 nfctinfo:3;
528 __u8 pkt_type:3,
529 fclone:2, 550 fclone:2,
530 ipvs_property:1,
531 peeked:1, 551 peeked:1,
532 nf_trace:1; 552 head_frag:1,
553 xmit_more:1;
554 /* one bit hole */
533 kmemcheck_bitfield_end(flags1); 555 kmemcheck_bitfield_end(flags1);
534 __be16 protocol;
535 556
536 void (*destructor)(struct sk_buff *skb); 557 /* fields enclosed in headers_start/headers_end are copied
537#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 558 * using a single memcpy() in __copy_skb_header()
538 struct nf_conntrack *nfct; 559 */
539#endif 560 /* private: */
540#ifdef CONFIG_BRIDGE_NETFILTER 561 __u32 headers_start[0];
541 struct nf_bridge_info *nf_bridge; 562 /* public: */
542#endif
543
544 int skb_iif;
545
546 __u32 hash;
547
548 __be16 vlan_proto;
549 __u16 vlan_tci;
550 563
551#ifdef CONFIG_NET_SCHED 564/* if you move pkt_type around you also must adapt those constants */
552 __u16 tc_index; /* traffic control index */ 565#ifdef __BIG_ENDIAN_BITFIELD
553#ifdef CONFIG_NET_CLS_ACT 566#define PKT_TYPE_MAX (7 << 5)
554 __u16 tc_verd; /* traffic control verdict */ 567#else
555#endif 568#define PKT_TYPE_MAX 7
556#endif 569#endif
570#define PKT_TYPE_OFFSET() offsetof(struct sk_buff, __pkt_type_offset)
557 571
558 __u16 queue_mapping; 572 __u8 __pkt_type_offset[0];
559 kmemcheck_bitfield_begin(flags2); 573 __u8 pkt_type:3;
560#ifdef CONFIG_IPV6_NDISC_NODETYPE
561 __u8 ndisc_nodetype:2;
562#endif
563 __u8 pfmemalloc:1; 574 __u8 pfmemalloc:1;
575 __u8 ignore_df:1;
576 __u8 nfctinfo:3;
577
578 __u8 nf_trace:1;
579 __u8 ip_summed:2;
564 __u8 ooo_okay:1; 580 __u8 ooo_okay:1;
565 __u8 l4_hash:1; 581 __u8 l4_hash:1;
566 __u8 sw_hash:1; 582 __u8 sw_hash:1;
567 __u8 wifi_acked_valid:1; 583 __u8 wifi_acked_valid:1;
568 __u8 wifi_acked:1; 584 __u8 wifi_acked:1;
585
569 __u8 no_fcs:1; 586 __u8 no_fcs:1;
570 __u8 head_frag:1; 587 /* Indicates the inner headers are valid in the skbuff. */
571 /* Encapsulation protocol and NIC drivers should use
572 * this flag to indicate to each other if the skb contains
573 * encapsulated packet or not and maybe use the inner packet
574 * headers if needed
575 */
576 __u8 encapsulation:1; 588 __u8 encapsulation:1;
577 __u8 encap_hdr_csum:1; 589 __u8 encap_hdr_csum:1;
578 __u8 csum_valid:1; 590 __u8 csum_valid:1;
579 __u8 csum_complete_sw:1; 591 __u8 csum_complete_sw:1;
580 /* 2/4 bit hole (depending on ndisc_nodetype presence) */ 592 __u8 csum_level:2;
581 kmemcheck_bitfield_end(flags2); 593 __u8 csum_bad:1;
582 594
595#ifdef CONFIG_IPV6_NDISC_NODETYPE
596 __u8 ndisc_nodetype:2;
597#endif
598 __u8 ipvs_property:1;
599 __u8 inner_protocol_type:1;
600 /* 4 or 6 bit hole */
601
602#ifdef CONFIG_NET_SCHED
603 __u16 tc_index; /* traffic control index */
604#ifdef CONFIG_NET_CLS_ACT
605 __u16 tc_verd; /* traffic control verdict */
606#endif
607#endif
608
609 union {
610 __wsum csum;
611 struct {
612 __u16 csum_start;
613 __u16 csum_offset;
614 };
615 };
616 __u32 priority;
617 int skb_iif;
618 __u32 hash;
619 __be16 vlan_proto;
620 __u16 vlan_tci;
583#ifdef CONFIG_NET_RX_BUSY_POLL 621#ifdef CONFIG_NET_RX_BUSY_POLL
584 unsigned int napi_id; 622 unsigned int napi_id;
585#endif 623#endif
@@ -592,13 +630,24 @@ struct sk_buff {
592 __u32 reserved_tailroom; 630 __u32 reserved_tailroom;
593 }; 631 };
594 632
595 __be16 inner_protocol; 633 union {
634 __be16 inner_protocol;
635 __u8 inner_ipproto;
636 };
637
596 __u16 inner_transport_header; 638 __u16 inner_transport_header;
597 __u16 inner_network_header; 639 __u16 inner_network_header;
598 __u16 inner_mac_header; 640 __u16 inner_mac_header;
641
642 __be16 protocol;
599 __u16 transport_header; 643 __u16 transport_header;
600 __u16 network_header; 644 __u16 network_header;
601 __u16 mac_header; 645 __u16 mac_header;
646
647 /* private: */
648 __u32 headers_end[0];
649 /* public: */
650
602 /* These elements must be at the end, see alloc_skb() for details. */ 651 /* These elements must be at the end, see alloc_skb() for details. */
603 sk_buff_data_t tail; 652 sk_buff_data_t tail;
604 sk_buff_data_t end; 653 sk_buff_data_t end;
@@ -730,6 +779,41 @@ static inline struct sk_buff *alloc_skb(unsigned int size,
730 return __alloc_skb(size, priority, 0, NUMA_NO_NODE); 779 return __alloc_skb(size, priority, 0, NUMA_NO_NODE);
731} 780}
732 781
782struct sk_buff *alloc_skb_with_frags(unsigned long header_len,
783 unsigned long data_len,
784 int max_page_order,
785 int *errcode,
786 gfp_t gfp_mask);
787
788/* Layout of fast clones : [skb1][skb2][fclone_ref] */
789struct sk_buff_fclones {
790 struct sk_buff skb1;
791
792 struct sk_buff skb2;
793
794 atomic_t fclone_ref;
795};
796
797/**
798 * skb_fclone_busy - check if fclone is busy
799 * @skb: buffer
800 *
801 * Returns true is skb is a fast clone, and its clone is not freed.
802 * Some drivers call skb_orphan() in their ndo_start_xmit(),
803 * so we also check that this didnt happen.
804 */
805static inline bool skb_fclone_busy(const struct sock *sk,
806 const struct sk_buff *skb)
807{
808 const struct sk_buff_fclones *fclones;
809
810 fclones = container_of(skb, struct sk_buff_fclones, skb1);
811
812 return skb->fclone == SKB_FCLONE_ORIG &&
813 fclones->skb2.fclone == SKB_FCLONE_CLONE &&
814 fclones->skb2.sk == sk;
815}
816
733static inline struct sk_buff *alloc_skb_fclone(unsigned int size, 817static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
734 gfp_t priority) 818 gfp_t priority)
735{ 819{
@@ -1038,6 +1122,7 @@ static inline int skb_header_cloned(const struct sk_buff *skb)
1038 * Drop a reference to the header part of the buffer. This is done 1122 * Drop a reference to the header part of the buffer. This is done
1039 * by acquiring a payload reference. You must not read from the header 1123 * by acquiring a payload reference. You must not read from the header
1040 * part of skb->data after this. 1124 * part of skb->data after this.
1125 * Note : Check if you can use __skb_header_release() instead.
1041 */ 1126 */
1042static inline void skb_header_release(struct sk_buff *skb) 1127static inline void skb_header_release(struct sk_buff *skb)
1043{ 1128{
@@ -1047,6 +1132,20 @@ static inline void skb_header_release(struct sk_buff *skb)
1047} 1132}
1048 1133
1049/** 1134/**
1135 * __skb_header_release - release reference to header
1136 * @skb: buffer to operate on
1137 *
1138 * Variant of skb_header_release() assuming skb is private to caller.
1139 * We can avoid one atomic operation.
1140 */
1141static inline void __skb_header_release(struct sk_buff *skb)
1142{
1143 skb->nohdr = 1;
1144 atomic_set(&skb_shinfo(skb)->dataref, 1 + (1 << SKB_DATAREF_SHIFT));
1145}
1146
1147
1148/**
1050 * skb_shared - is the buffer shared 1149 * skb_shared - is the buffer shared
1051 * @skb: buffer to check 1150 * @skb: buffer to check
1052 * 1151 *
@@ -1112,7 +1211,12 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
1112 might_sleep_if(pri & __GFP_WAIT); 1211 might_sleep_if(pri & __GFP_WAIT);
1113 if (skb_cloned(skb)) { 1212 if (skb_cloned(skb)) {
1114 struct sk_buff *nskb = skb_copy(skb, pri); 1213 struct sk_buff *nskb = skb_copy(skb, pri);
1115 kfree_skb(skb); /* Free our shared copy */ 1214
1215 /* Free our shared copy */
1216 if (likely(nskb))
1217 consume_skb(skb);
1218 else
1219 kfree_skb(skb);
1116 skb = nskb; 1220 skb = nskb;
1117 } 1221 }
1118 return skb; 1222 return skb;
@@ -1671,6 +1775,23 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
1671 skb->tail += len; 1775 skb->tail += len;
1672} 1776}
1673 1777
1778#define ENCAP_TYPE_ETHER 0
1779#define ENCAP_TYPE_IPPROTO 1
1780
1781static inline void skb_set_inner_protocol(struct sk_buff *skb,
1782 __be16 protocol)
1783{
1784 skb->inner_protocol = protocol;
1785 skb->inner_protocol_type = ENCAP_TYPE_ETHER;
1786}
1787
1788static inline void skb_set_inner_ipproto(struct sk_buff *skb,
1789 __u8 ipproto)
1790{
1791 skb->inner_ipproto = ipproto;
1792 skb->inner_protocol_type = ENCAP_TYPE_IPPROTO;
1793}
1794
1674static inline void skb_reset_inner_headers(struct sk_buff *skb) 1795static inline void skb_reset_inner_headers(struct sk_buff *skb)
1675{ 1796{
1676 skb->inner_mac_header = skb->mac_header; 1797 skb->inner_mac_header = skb->mac_header;
@@ -1856,18 +1977,6 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1856 return pskb_may_pull(skb, skb_network_offset(skb) + len); 1977 return pskb_may_pull(skb, skb_network_offset(skb) + len);
1857} 1978}
1858 1979
1859static inline void skb_pop_rcv_encapsulation(struct sk_buff *skb)
1860{
1861 /* Only continue with checksum unnecessary if device indicated
1862 * it is valid across encapsulation (skb->encapsulation was set).
1863 */
1864 if (skb->ip_summed == CHECKSUM_UNNECESSARY && !skb->encapsulation)
1865 skb->ip_summed = CHECKSUM_NONE;
1866
1867 skb->encapsulation = 0;
1868 skb->csum_valid = 0;
1869}
1870
1871/* 1980/*
1872 * CPUs often take a performance hit when accessing unaligned memory 1981 * CPUs often take a performance hit when accessing unaligned memory
1873 * locations. The actual performance hit varies, it can be small if the 1982 * locations. The actual performance hit varies, it can be small if the
@@ -2563,20 +2672,26 @@ __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2563__wsum skb_checksum(const struct sk_buff *skb, int offset, int len, 2672__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2564 __wsum csum); 2673 __wsum csum);
2565 2674
2566static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2675static inline void *__skb_header_pointer(const struct sk_buff *skb, int offset,
2567 int len, void *buffer) 2676 int len, void *data, int hlen, void *buffer)
2568{ 2677{
2569 int hlen = skb_headlen(skb);
2570
2571 if (hlen - offset >= len) 2678 if (hlen - offset >= len)
2572 return skb->data + offset; 2679 return data + offset;
2573 2680
2574 if (skb_copy_bits(skb, offset, buffer, len) < 0) 2681 if (!skb ||
2682 skb_copy_bits(skb, offset, buffer, len) < 0)
2575 return NULL; 2683 return NULL;
2576 2684
2577 return buffer; 2685 return buffer;
2578} 2686}
2579 2687
2688static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2689 int len, void *buffer)
2690{
2691 return __skb_header_pointer(skb, offset, len, skb->data,
2692 skb_headlen(skb), buffer);
2693}
2694
2580/** 2695/**
2581 * skb_needs_linearize - check if we need to linearize a given skb 2696 * skb_needs_linearize - check if we need to linearize a given skb
2582 * depending on the given device features. 2697 * depending on the given device features.
@@ -2667,6 +2782,8 @@ static inline ktime_t net_invalid_timestamp(void)
2667 return ktime_set(0, 0); 2782 return ktime_set(0, 0);
2668} 2783}
2669 2784
2785struct sk_buff *skb_clone_sk(struct sk_buff *skb);
2786
2670#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2787#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2671 2788
2672void skb_clone_tx_timestamp(struct sk_buff *skb); 2789void skb_clone_tx_timestamp(struct sk_buff *skb);
@@ -2782,6 +2899,42 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
2782 0 : __skb_checksum_complete(skb); 2899 0 : __skb_checksum_complete(skb);
2783} 2900}
2784 2901
2902static inline void __skb_decr_checksum_unnecessary(struct sk_buff *skb)
2903{
2904 if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
2905 if (skb->csum_level == 0)
2906 skb->ip_summed = CHECKSUM_NONE;
2907 else
2908 skb->csum_level--;
2909 }
2910}
2911
2912static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb)
2913{
2914 if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
2915 if (skb->csum_level < SKB_MAX_CSUM_LEVEL)
2916 skb->csum_level++;
2917 } else if (skb->ip_summed == CHECKSUM_NONE) {
2918 skb->ip_summed = CHECKSUM_UNNECESSARY;
2919 skb->csum_level = 0;
2920 }
2921}
2922
2923static inline void __skb_mark_checksum_bad(struct sk_buff *skb)
2924{
2925 /* Mark current checksum as bad (typically called from GRO
2926 * path). In the case that ip_summed is CHECKSUM_NONE
2927 * this must be the first checksum encountered in the packet.
2928 * When ip_summed is CHECKSUM_UNNECESSARY, this is the first
2929 * checksum after the last one validated. For UDP, a zero
2930 * checksum can not be marked as bad.
2931 */
2932
2933 if (skb->ip_summed == CHECKSUM_NONE ||
2934 skb->ip_summed == CHECKSUM_UNNECESSARY)
2935 skb->csum_bad = 1;
2936}
2937
2785/* Check if we need to perform checksum complete validation. 2938/* Check if we need to perform checksum complete validation.
2786 * 2939 *
2787 * Returns true if checksum complete is needed, false otherwise 2940 * Returns true if checksum complete is needed, false otherwise
@@ -2793,6 +2946,7 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
2793{ 2946{
2794 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) { 2947 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) {
2795 skb->csum_valid = 1; 2948 skb->csum_valid = 1;
2949 __skb_decr_checksum_unnecessary(skb);
2796 return false; 2950 return false;
2797 } 2951 }
2798 2952
@@ -2822,6 +2976,9 @@ static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb,
2822 skb->csum_valid = 1; 2976 skb->csum_valid = 1;
2823 return 0; 2977 return 0;
2824 } 2978 }
2979 } else if (skb->csum_bad) {
2980 /* ip_summed == CHECKSUM_NONE in this case */
2981 return 1;
2825 } 2982 }
2826 2983
2827 skb->csum = psum; 2984 skb->csum = psum;
@@ -2879,6 +3036,26 @@ static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
2879#define skb_checksum_simple_validate(skb) \ 3036#define skb_checksum_simple_validate(skb) \
2880 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo) 3037 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
2881 3038
3039static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
3040{
3041 return (skb->ip_summed == CHECKSUM_NONE &&
3042 skb->csum_valid && !skb->csum_bad);
3043}
3044
3045static inline void __skb_checksum_convert(struct sk_buff *skb,
3046 __sum16 check, __wsum pseudo)
3047{
3048 skb->csum = ~pseudo;
3049 skb->ip_summed = CHECKSUM_COMPLETE;
3050}
3051
3052#define skb_checksum_try_convert(skb, proto, check, compute_pseudo) \
3053do { \
3054 if (__skb_checksum_convert_check(skb)) \
3055 __skb_checksum_convert(skb, check, \
3056 compute_pseudo(skb, proto)); \
3057} while (0)
3058
2882#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 3059#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2883void nf_conntrack_destroy(struct nf_conntrack *nfct); 3060void nf_conntrack_destroy(struct nf_conntrack *nfct);
2884static inline void nf_conntrack_put(struct nf_conntrack *nfct) 3061static inline void nf_conntrack_put(struct nf_conntrack *nfct)
@@ -2892,7 +3069,7 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
2892 atomic_inc(&nfct->use); 3069 atomic_inc(&nfct->use);
2893} 3070}
2894#endif 3071#endif
2895#ifdef CONFIG_BRIDGE_NETFILTER 3072#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2896static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) 3073static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
2897{ 3074{
2898 if (nf_bridge && atomic_dec_and_test(&nf_bridge->use)) 3075 if (nf_bridge && atomic_dec_and_test(&nf_bridge->use))
@@ -2910,7 +3087,7 @@ static inline void nf_reset(struct sk_buff *skb)
2910 nf_conntrack_put(skb->nfct); 3087 nf_conntrack_put(skb->nfct);
2911 skb->nfct = NULL; 3088 skb->nfct = NULL;
2912#endif 3089#endif
2913#ifdef CONFIG_BRIDGE_NETFILTER 3090#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2914 nf_bridge_put(skb->nf_bridge); 3091 nf_bridge_put(skb->nf_bridge);
2915 skb->nf_bridge = NULL; 3092 skb->nf_bridge = NULL;
2916#endif 3093#endif
@@ -2924,19 +3101,22 @@ static inline void nf_reset_trace(struct sk_buff *skb)
2924} 3101}
2925 3102
2926/* Note: This doesn't put any conntrack and bridge info in dst. */ 3103/* Note: This doesn't put any conntrack and bridge info in dst. */
2927static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) 3104static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src,
3105 bool copy)
2928{ 3106{
2929#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 3107#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2930 dst->nfct = src->nfct; 3108 dst->nfct = src->nfct;
2931 nf_conntrack_get(src->nfct); 3109 nf_conntrack_get(src->nfct);
2932 dst->nfctinfo = src->nfctinfo; 3110 if (copy)
3111 dst->nfctinfo = src->nfctinfo;
2933#endif 3112#endif
2934#ifdef CONFIG_BRIDGE_NETFILTER 3113#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2935 dst->nf_bridge = src->nf_bridge; 3114 dst->nf_bridge = src->nf_bridge;
2936 nf_bridge_get(src->nf_bridge); 3115 nf_bridge_get(src->nf_bridge);
2937#endif 3116#endif
2938#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES) 3117#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES)
2939 dst->nf_trace = src->nf_trace; 3118 if (copy)
3119 dst->nf_trace = src->nf_trace;
2940#endif 3120#endif
2941} 3121}
2942 3122
@@ -2945,10 +3125,10 @@ static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2945#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 3125#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2946 nf_conntrack_put(dst->nfct); 3126 nf_conntrack_put(dst->nfct);
2947#endif 3127#endif
2948#ifdef CONFIG_BRIDGE_NETFILTER 3128#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2949 nf_bridge_put(dst->nf_bridge); 3129 nf_bridge_put(dst->nf_bridge);
2950#endif 3130#endif
2951 __nf_copy(dst, src); 3131 __nf_copy(dst, src, true);
2952} 3132}
2953 3133
2954#ifdef CONFIG_NETWORK_SECMARK 3134#ifdef CONFIG_NETWORK_SECMARK
@@ -3133,7 +3313,9 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
3133 3313
3134int skb_checksum_setup(struct sk_buff *skb, bool recalculate); 3314int skb_checksum_setup(struct sk_buff *skb, bool recalculate);
3135 3315
3136u32 __skb_get_poff(const struct sk_buff *skb); 3316u32 skb_get_poff(const struct sk_buff *skb);
3317u32 __skb_get_poff(const struct sk_buff *skb, void *data,
3318 const struct flow_keys *keys, int hlen);
3137 3319
3138/** 3320/**
3139 * skb_head_is_locked - Determine if the skb->head is locked down 3321 * skb_head_is_locked - Determine if the skb->head is locked down
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 1d9abb7d22a0..c265bec6a57d 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -158,31 +158,6 @@ size_t ksize(const void *);
158#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) 158#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
159#endif 159#endif
160 160
161#ifdef CONFIG_SLOB
162/*
163 * Common fields provided in kmem_cache by all slab allocators
164 * This struct is either used directly by the allocator (SLOB)
165 * or the allocator must include definitions for all fields
166 * provided in kmem_cache_common in their definition of kmem_cache.
167 *
168 * Once we can do anonymous structs (C11 standard) we could put a
169 * anonymous struct definition in these allocators so that the
170 * separate allocations in the kmem_cache structure of SLAB and
171 * SLUB is no longer needed.
172 */
173struct kmem_cache {
174 unsigned int object_size;/* The original size of the object */
175 unsigned int size; /* The aligned/padded/added on size */
176 unsigned int align; /* Alignment as calculated */
177 unsigned long flags; /* Active flags on the slab */
178 const char *name; /* Slab name for sysfs */
179 int refcount; /* Use counter */
180 void (*ctor)(void *); /* Called on object slot creation */
181 struct list_head list; /* List of all slab caches on the system */
182};
183
184#endif /* CONFIG_SLOB */
185
186/* 161/*
187 * Kmalloc array related definitions 162 * Kmalloc array related definitions
188 */ 163 */
@@ -363,14 +338,6 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s,
363} 338}
364#endif /* CONFIG_TRACING */ 339#endif /* CONFIG_TRACING */
365 340
366#ifdef CONFIG_SLAB
367#include <linux/slab_def.h>
368#endif
369
370#ifdef CONFIG_SLUB
371#include <linux/slub_def.h>
372#endif
373
374extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order); 341extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order);
375 342
376#ifdef CONFIG_TRACING 343#ifdef CONFIG_TRACING
@@ -582,37 +549,15 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
582 * allocator where we care about the real place the memory allocation 549 * allocator where we care about the real place the memory allocation
583 * request comes from. 550 * request comes from.
584 */ 551 */
585#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
586 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
587 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
588extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); 552extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
589#define kmalloc_track_caller(size, flags) \ 553#define kmalloc_track_caller(size, flags) \
590 __kmalloc_track_caller(size, flags, _RET_IP_) 554 __kmalloc_track_caller(size, flags, _RET_IP_)
591#else
592#define kmalloc_track_caller(size, flags) \
593 __kmalloc(size, flags)
594#endif /* DEBUG_SLAB */
595 555
596#ifdef CONFIG_NUMA 556#ifdef CONFIG_NUMA
597/*
598 * kmalloc_node_track_caller is a special version of kmalloc_node that
599 * records the calling function of the routine calling it for slab leak
600 * tracking instead of just the calling function (confusing, eh?).
601 * It's useful when the call to kmalloc_node comes from a widely-used
602 * standard allocator where we care about the real place the memory
603 * allocation request comes from.
604 */
605#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
606 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
607 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
608extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); 557extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
609#define kmalloc_node_track_caller(size, flags, node) \ 558#define kmalloc_node_track_caller(size, flags, node) \
610 __kmalloc_node_track_caller(size, flags, node, \ 559 __kmalloc_node_track_caller(size, flags, node, \
611 _RET_IP_) 560 _RET_IP_)
612#else
613#define kmalloc_node_track_caller(size, flags, node) \
614 __kmalloc_node(size, flags, node)
615#endif
616 561
617#else /* CONFIG_NUMA */ 562#else /* CONFIG_NUMA */
618 563
@@ -650,14 +595,7 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
650 return kmalloc_node(size, flags | __GFP_ZERO, node); 595 return kmalloc_node(size, flags | __GFP_ZERO, node);
651} 596}
652 597
653/* 598unsigned int kmem_cache_size(struct kmem_cache *s);
654 * Determine the size of a slab object
655 */
656static inline unsigned int kmem_cache_size(struct kmem_cache *s)
657{
658 return s->object_size;
659}
660
661void __init kmem_cache_init_late(void); 599void __init kmem_cache_init_late(void);
662 600
663#endif /* _LINUX_SLAB_H */ 601#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 8235dfbb3b05..b869d1662ba3 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -8,6 +8,8 @@
8 */ 8 */
9 9
10struct kmem_cache { 10struct kmem_cache {
11 struct array_cache __percpu *cpu_cache;
12
11/* 1) Cache tunables. Protected by slab_mutex */ 13/* 1) Cache tunables. Protected by slab_mutex */
12 unsigned int batchcount; 14 unsigned int batchcount;
13 unsigned int limit; 15 unsigned int limit;
@@ -71,23 +73,7 @@ struct kmem_cache {
71 struct memcg_cache_params *memcg_params; 73 struct memcg_cache_params *memcg_params;
72#endif 74#endif
73 75
74/* 6) per-cpu/per-node data, touched during every alloc/free */ 76 struct kmem_cache_node *node[MAX_NUMNODES];
75 /*
76 * We put array[] at the end of kmem_cache, because we want to size
77 * this array to nr_cpu_ids slots instead of NR_CPUS
78 * (see kmem_cache_init())
79 * We still use [NR_CPUS] and not [1] or [0] because cache_cache
80 * is statically defined, so we reserve the max number of cpus.
81 *
82 * We also need to guarantee that the list is able to accomodate a
83 * pointer for each node since "nodelists" uses the remainder of
84 * available pointers.
85 */
86 struct kmem_cache_node **node;
87 struct array_cache *array[NR_CPUS + MAX_NUMNODES];
88 /*
89 * Do not add fields after array[]
90 */
91}; 77};
92 78
93#endif /* _LINUX_SLAB_DEF_H */ 79#endif /* _LINUX_SLAB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 34347f26be9b..93dff5fff524 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -100,6 +100,7 @@ int smp_call_function_any(const struct cpumask *mask,
100 smp_call_func_t func, void *info, int wait); 100 smp_call_func_t func, void *info, int wait);
101 101
102void kick_all_cpus_sync(void); 102void kick_all_cpus_sync(void);
103void wake_up_all_idle_cpus(void);
103 104
104/* 105/*
105 * Generic and arch helpers 106 * Generic and arch helpers
@@ -148,6 +149,7 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
148} 149}
149 150
150static inline void kick_all_cpus_sync(void) { } 151static inline void kick_all_cpus_sync(void) { }
152static inline void wake_up_all_idle_cpus(void) { }
151 153
152#endif /* !SMP */ 154#endif /* !SMP */
153 155
diff --git a/include/linux/soc/ti/knav_dma.h b/include/linux/soc/ti/knav_dma.h
new file mode 100644
index 000000000000..dad035c16d94
--- /dev/null
+++ b/include/linux/soc/ti/knav_dma.h
@@ -0,0 +1,175 @@
1/*
2 * Copyright (C) 2014 Texas Instruments Incorporated
3 * Authors: Sandeep Nair <sandeep_n@ti.com
4 * Cyril Chemparathy <cyril@ti.com
5 Santosh Shilimkar <santosh.shilimkar@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__
18#define __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__
19
20/*
21 * PKTDMA descriptor manipulation macros for host packet descriptor
22 */
23#define MASK(x) (BIT(x) - 1)
24#define KNAV_DMA_DESC_PKT_LEN_MASK MASK(22)
25#define KNAV_DMA_DESC_PKT_LEN_SHIFT 0
26#define KNAV_DMA_DESC_PS_INFO_IN_SOP BIT(22)
27#define KNAV_DMA_DESC_PS_INFO_IN_DESC 0
28#define KNAV_DMA_DESC_TAG_MASK MASK(8)
29#define KNAV_DMA_DESC_SAG_HI_SHIFT 24
30#define KNAV_DMA_DESC_STAG_LO_SHIFT 16
31#define KNAV_DMA_DESC_DTAG_HI_SHIFT 8
32#define KNAV_DMA_DESC_DTAG_LO_SHIFT 0
33#define KNAV_DMA_DESC_HAS_EPIB BIT(31)
34#define KNAV_DMA_DESC_NO_EPIB 0
35#define KNAV_DMA_DESC_PSLEN_SHIFT 24
36#define KNAV_DMA_DESC_PSLEN_MASK MASK(6)
37#define KNAV_DMA_DESC_ERR_FLAG_SHIFT 20
38#define KNAV_DMA_DESC_ERR_FLAG_MASK MASK(4)
39#define KNAV_DMA_DESC_PSFLAG_SHIFT 16
40#define KNAV_DMA_DESC_PSFLAG_MASK MASK(4)
41#define KNAV_DMA_DESC_RETQ_SHIFT 0
42#define KNAV_DMA_DESC_RETQ_MASK MASK(14)
43#define KNAV_DMA_DESC_BUF_LEN_MASK MASK(22)
44
45#define KNAV_DMA_NUM_EPIB_WORDS 4
46#define KNAV_DMA_NUM_PS_WORDS 16
47#define KNAV_DMA_FDQ_PER_CHAN 4
48
49/* Tx channel scheduling priority */
50enum knav_dma_tx_priority {
51 DMA_PRIO_HIGH = 0,
52 DMA_PRIO_MED_H,
53 DMA_PRIO_MED_L,
54 DMA_PRIO_LOW
55};
56
57/* Rx channel error handling mode during buffer starvation */
58enum knav_dma_rx_err_mode {
59 DMA_DROP = 0,
60 DMA_RETRY
61};
62
63/* Rx flow size threshold configuration */
64enum knav_dma_rx_thresholds {
65 DMA_THRESH_NONE = 0,
66 DMA_THRESH_0 = 1,
67 DMA_THRESH_0_1 = 3,
68 DMA_THRESH_0_1_2 = 7
69};
70
71/* Descriptor type */
72enum knav_dma_desc_type {
73 DMA_DESC_HOST = 0,
74 DMA_DESC_MONOLITHIC = 2
75};
76
77/**
78 * struct knav_dma_tx_cfg: Tx channel configuration
79 * @filt_einfo: Filter extended packet info
80 * @filt_pswords: Filter PS words present
81 * @knav_dma_tx_priority: Tx channel scheduling priority
82 */
83struct knav_dma_tx_cfg {
84 bool filt_einfo;
85 bool filt_pswords;
86 enum knav_dma_tx_priority priority;
87};
88
89/**
90 * struct knav_dma_rx_cfg: Rx flow configuration
91 * @einfo_present: Extended packet info present
92 * @psinfo_present: PS words present
93 * @knav_dma_rx_err_mode: Error during buffer starvation
94 * @knav_dma_desc_type: Host or Monolithic desc
95 * @psinfo_at_sop: PS word located at start of packet
96 * @sop_offset: Start of packet offset
97 * @dst_q: Destination queue for a given flow
98 * @thresh: Rx flow size threshold
99 * @fdq[]: Free desc Queue array
100 * @sz_thresh0: RX packet size threshold 0
101 * @sz_thresh1: RX packet size threshold 1
102 * @sz_thresh2: RX packet size threshold 2
103 */
104struct knav_dma_rx_cfg {
105 bool einfo_present;
106 bool psinfo_present;
107 enum knav_dma_rx_err_mode err_mode;
108 enum knav_dma_desc_type desc_type;
109 bool psinfo_at_sop;
110 unsigned int sop_offset;
111 unsigned int dst_q;
112 enum knav_dma_rx_thresholds thresh;
113 unsigned int fdq[KNAV_DMA_FDQ_PER_CHAN];
114 unsigned int sz_thresh0;
115 unsigned int sz_thresh1;
116 unsigned int sz_thresh2;
117};
118
119/**
120 * struct knav_dma_cfg: Pktdma channel configuration
121 * @sl_cfg: Slave configuration
122 * @tx: Tx channel configuration
123 * @rx: Rx flow configuration
124 */
125struct knav_dma_cfg {
126 enum dma_transfer_direction direction;
127 union {
128 struct knav_dma_tx_cfg tx;
129 struct knav_dma_rx_cfg rx;
130 } u;
131};
132
133/**
134 * struct knav_dma_desc: Host packet descriptor layout
135 * @desc_info: Descriptor information like id, type, length
136 * @tag_info: Flow tag info written in during RX
137 * @packet_info: Queue Manager, policy, flags etc
138 * @buff_len: Buffer length in bytes
139 * @buff: Buffer pointer
140 * @next_desc: For chaining the descriptors
141 * @orig_len: length since 'buff_len' can be overwritten
142 * @orig_buff: buff pointer since 'buff' can be overwritten
143 * @epib: Extended packet info block
144 * @psdata: Protocol specific
145 */
146struct knav_dma_desc {
147 u32 desc_info;
148 u32 tag_info;
149 u32 packet_info;
150 u32 buff_len;
151 u32 buff;
152 u32 next_desc;
153 u32 orig_len;
154 u32 orig_buff;
155 u32 epib[KNAV_DMA_NUM_EPIB_WORDS];
156 u32 psdata[KNAV_DMA_NUM_PS_WORDS];
157 u32 pad[4];
158} ____cacheline_aligned;
159
160#if IS_ENABLED(CONFIG_KEYSTONE_NAVIGATOR_DMA)
161void *knav_dma_open_channel(struct device *dev, const char *name,
162 struct knav_dma_cfg *config);
163void knav_dma_close_channel(void *channel);
164#else
165static inline void *knav_dma_open_channel(struct device *dev, const char *name,
166 struct knav_dma_cfg *config)
167{
168 return (void *) NULL;
169}
170static inline void knav_dma_close_channel(void *channel)
171{}
172
173#endif
174
175#endif /* __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__ */
diff --git a/include/linux/soc/ti/knav_qmss.h b/include/linux/soc/ti/knav_qmss.h
new file mode 100644
index 000000000000..9f0ebb3bad27
--- /dev/null
+++ b/include/linux/soc/ti/knav_qmss.h
@@ -0,0 +1,90 @@
1/*
2 * Keystone Navigator Queue Management Sub-System header
3 *
4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
5 * Author: Sandeep Nair <sandeep_n@ti.com>
6 * Cyril Chemparathy <cyril@ti.com>
7 * Santosh Shilimkar <santosh.shilimkar@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#ifndef __SOC_TI_KNAV_QMSS_H__
20#define __SOC_TI_KNAV_QMSS_H__
21
22#include <linux/err.h>
23#include <linux/time.h>
24#include <linux/atomic.h>
25#include <linux/device.h>
26#include <linux/fcntl.h>
27#include <linux/dma-mapping.h>
28
29/* queue types */
30#define KNAV_QUEUE_QPEND ((unsigned)-2) /* interruptible qpend queue */
31#define KNAV_QUEUE_ACC ((unsigned)-3) /* Accumulated queue */
32#define KNAV_QUEUE_GP ((unsigned)-4) /* General purpose queue */
33
34/* queue flags */
35#define KNAV_QUEUE_SHARED 0x0001 /* Queue can be shared */
36
37/**
38 * enum knav_queue_ctrl_cmd - queue operations.
39 * @KNAV_QUEUE_GET_ID: Get the ID number for an open queue
40 * @KNAV_QUEUE_FLUSH: forcibly empty a queue if possible
41 * @KNAV_QUEUE_SET_NOTIFIER: Set a notifier callback to a queue handle.
42 * @KNAV_QUEUE_ENABLE_NOTIFY: Enable notifier callback for a queue handle.
43 * @KNAV_QUEUE_DISABLE_NOTIFY: Disable notifier callback for a queue handle.
44 * @KNAV_QUEUE_GET_COUNT: Get number of queues.
45 */
46enum knav_queue_ctrl_cmd {
47 KNAV_QUEUE_GET_ID,
48 KNAV_QUEUE_FLUSH,
49 KNAV_QUEUE_SET_NOTIFIER,
50 KNAV_QUEUE_ENABLE_NOTIFY,
51 KNAV_QUEUE_DISABLE_NOTIFY,
52 KNAV_QUEUE_GET_COUNT
53};
54
55/* Queue notifier callback prototype */
56typedef void (*knav_queue_notify_fn)(void *arg);
57
58/**
59 * struct knav_queue_notify_config: Notifier configuration
60 * @fn: Notifier function
61 * @fn_arg: Notifier function arguments
62 */
63struct knav_queue_notify_config {
64 knav_queue_notify_fn fn;
65 void *fn_arg;
66};
67
68void *knav_queue_open(const char *name, unsigned id,
69 unsigned flags);
70void knav_queue_close(void *qhandle);
71int knav_queue_device_control(void *qhandle,
72 enum knav_queue_ctrl_cmd cmd,
73 unsigned long arg);
74dma_addr_t knav_queue_pop(void *qhandle, unsigned *size);
75int knav_queue_push(void *qhandle, dma_addr_t dma,
76 unsigned size, unsigned flags);
77
78void *knav_pool_create(const char *name,
79 int num_desc, int region_id);
80void knav_pool_destroy(void *ph);
81int knav_pool_count(void *ph);
82void *knav_pool_desc_get(void *ph);
83void knav_pool_desc_put(void *ph, void *desc);
84int knav_pool_desc_map(void *ph, void *desc, unsigned size,
85 dma_addr_t *dma, unsigned *dma_sz);
86void *knav_pool_desc_unmap(void *ph, dma_addr_t dma, unsigned dma_sz);
87dma_addr_t knav_pool_desc_virt_to_dma(void *ph, void *virt);
88void *knav_pool_desc_dma_to_virt(void *ph, dma_addr_t dma);
89
90#endif /* __SOC_TI_KNAV_QMSS_H__ */
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h
index 2d676d5aaa89..aa07d7b32568 100644
--- a/include/linux/spi/mcp23s08.h
+++ b/include/linux/spi/mcp23s08.h
@@ -22,4 +22,22 @@ struct mcp23s08_platform_data {
22 * base to base+15 (or base+31 for s17 variant). 22 * base to base+15 (or base+31 for s17 variant).
23 */ 23 */
24 unsigned base; 24 unsigned base;
25 /* Marks the device as a interrupt controller.
26 * NOTE: The interrupt functionality is only supported for i2c
27 * versions of the chips. The spi chips can also do the interrupts,
28 * but this is not supported by the linux driver yet.
29 */
30 bool irq_controller;
31
32 /* Sets the mirror flag in the IOCON register. Devices
33 * with two interrupt outputs (these are the devices ending with 17 and
34 * those that have 16 IOs) have two IO banks: IO 0-7 form bank 1 and
35 * IO 8-15 are bank 2. These chips have two different interrupt outputs:
36 * One for bank 1 and another for bank 2. If irq-mirror is set, both
37 * interrupts are generated regardless of the bank that an input change
38 * occurred on. If it is not set, the interrupt are only generated for
39 * the bank they belong to.
40 * On devices with only one interrupt output this property is useless.
41 */
42 bool mirror;
25}; 43};
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h
index 82d5111cd0c2..d5a316550177 100644
--- a/include/linux/spi/pxa2xx_spi.h
+++ b/include/linux/spi/pxa2xx_spi.h
@@ -23,6 +23,8 @@
23#define PXA2XX_CS_ASSERT (0x01) 23#define PXA2XX_CS_ASSERT (0x01)
24#define PXA2XX_CS_DEASSERT (0x02) 24#define PXA2XX_CS_DEASSERT (0x02)
25 25
26struct dma_chan;
27
26/* device.platform_data for SSP controller devices */ 28/* device.platform_data for SSP controller devices */
27struct pxa2xx_spi_master { 29struct pxa2xx_spi_master {
28 u32 clock_enable; 30 u32 clock_enable;
@@ -30,10 +32,9 @@ struct pxa2xx_spi_master {
30 u8 enable_dma; 32 u8 enable_dma;
31 33
32 /* DMA engine specific config */ 34 /* DMA engine specific config */
33 int rx_chan_id; 35 bool (*dma_filter)(struct dma_chan *chan, void *param);
34 int tx_chan_id; 36 void *tx_param;
35 int rx_slave_id; 37 void *rx_param;
36 int tx_slave_id;
37 38
38 /* For non-PXA arches */ 39 /* For non-PXA arches */
39 struct ssp_device ssp; 40 struct ssp_device ssp;
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 3f2867ff0ced..262ba4ef9a8e 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -197,7 +197,13 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
197 _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ 197 _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \
198 } while (0) 198 } while (0)
199#else 199#else
200# define raw_spin_lock_nested(lock, subclass) _raw_spin_lock(lock) 200/*
201 * Always evaluate the 'subclass' argument to avoid that the compiler
202 * warns about set-but-not-used variables when building with
203 * CONFIG_DEBUG_LOCK_ALLOC=n and with W=1.
204 */
205# define raw_spin_lock_nested(lock, subclass) \
206 _raw_spin_lock(((void)(subclass), (lock)))
201# define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) 207# define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock)
202#endif 208#endif
203 209
diff --git a/include/linux/string.h b/include/linux/string.h
index d36977e029af..2e22a2e58f3a 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -41,7 +41,7 @@ extern int strcmp(const char *,const char *);
41extern int strncmp(const char *,const char *,__kernel_size_t); 41extern int strncmp(const char *,const char *,__kernel_size_t);
42#endif 42#endif
43#ifndef __HAVE_ARCH_STRNICMP 43#ifndef __HAVE_ARCH_STRNICMP
44extern int strnicmp(const char *, const char *, __kernel_size_t); 44#define strnicmp strncasecmp
45#endif 45#endif
46#ifndef __HAVE_ARCH_STRCASECMP 46#ifndef __HAVE_ARCH_STRCASECMP
47extern int strcasecmp(const char *s1, const char *s2); 47extern int strcasecmp(const char *s1, const char *s2);
@@ -132,7 +132,7 @@ int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);
132#endif 132#endif
133 133
134extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, 134extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
135 const void *from, size_t available); 135 const void *from, size_t available);
136 136
137/** 137/**
138 * strstarts - does @str start with @prefix? 138 * strstarts - does @str start with @prefix?
@@ -144,7 +144,8 @@ static inline bool strstarts(const char *str, const char *prefix)
144 return strncmp(str, prefix, strlen(prefix)) == 0; 144 return strncmp(str, prefix, strlen(prefix)) == 0;
145} 145}
146 146
147extern size_t memweight(const void *ptr, size_t bytes); 147size_t memweight(const void *ptr, size_t bytes);
148void memzero_explicit(void *s, size_t count);
148 149
149/** 150/**
150 * kbasename - return the last part of a pathname. 151 * kbasename - return the last part of a pathname.
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 3eeee9672a4a..6eb567ac56bc 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -20,40 +20,6 @@ int string_get_size(u64 size, enum string_size_units units,
20#define UNESCAPE_ANY \ 20#define UNESCAPE_ANY \
21 (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL) 21 (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL)
22 22
23/**
24 * string_unescape - unquote characters in the given string
25 * @src: source buffer (escaped)
26 * @dst: destination buffer (unescaped)
27 * @size: size of the destination buffer (0 to unlimit)
28 * @flags: combination of the flags (bitwise OR):
29 * %UNESCAPE_SPACE:
30 * '\f' - form feed
31 * '\n' - new line
32 * '\r' - carriage return
33 * '\t' - horizontal tab
34 * '\v' - vertical tab
35 * %UNESCAPE_OCTAL:
36 * '\NNN' - byte with octal value NNN (1 to 3 digits)
37 * %UNESCAPE_HEX:
38 * '\xHH' - byte with hexadecimal value HH (1 to 2 digits)
39 * %UNESCAPE_SPECIAL:
40 * '\"' - double quote
41 * '\\' - backslash
42 * '\a' - alert (BEL)
43 * '\e' - escape
44 * %UNESCAPE_ANY:
45 * all previous together
46 *
47 * Returns amount of characters processed to the destination buffer excluding
48 * trailing '\0'.
49 *
50 * Because the size of the output will be the same as or less than the size of
51 * the input, the transformation may be performed in place.
52 *
53 * Caller must provide valid source and destination pointers. Be aware that
54 * destination buffer will always be NULL-terminated. Source string must be
55 * NULL-terminated as well.
56 */
57int string_unescape(char *src, char *dst, size_t size, unsigned int flags); 23int string_unescape(char *src, char *dst, size_t size, unsigned int flags);
58 24
59static inline int string_unescape_inplace(char *buf, unsigned int flags) 25static inline int string_unescape_inplace(char *buf, unsigned int flags)
@@ -71,4 +37,35 @@ static inline int string_unescape_any_inplace(char *buf)
71 return string_unescape_any(buf, buf, 0); 37 return string_unescape_any(buf, buf, 0);
72} 38}
73 39
40#define ESCAPE_SPACE 0x01
41#define ESCAPE_SPECIAL 0x02
42#define ESCAPE_NULL 0x04
43#define ESCAPE_OCTAL 0x08
44#define ESCAPE_ANY \
45 (ESCAPE_SPACE | ESCAPE_OCTAL | ESCAPE_SPECIAL | ESCAPE_NULL)
46#define ESCAPE_NP 0x10
47#define ESCAPE_ANY_NP (ESCAPE_ANY | ESCAPE_NP)
48#define ESCAPE_HEX 0x20
49
50int string_escape_mem(const char *src, size_t isz, char **dst, size_t osz,
51 unsigned int flags, const char *esc);
52
53static inline int string_escape_mem_any_np(const char *src, size_t isz,
54 char **dst, size_t osz, const char *esc)
55{
56 return string_escape_mem(src, isz, dst, osz, ESCAPE_ANY_NP, esc);
57}
58
59static inline int string_escape_str(const char *src, char **dst, size_t sz,
60 unsigned int flags, const char *esc)
61{
62 return string_escape_mem(src, strlen(src), dst, sz, flags, esc);
63}
64
65static inline int string_escape_str_any_np(const char *src, char **dst,
66 size_t sz, const char *esc)
67{
68 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, esc);
69}
70
74#endif 71#endif
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index cf61ecd148e0..21678464883a 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -280,7 +280,6 @@ struct svc_rqst {
280 bool rq_splice_ok; /* turned off in gss privacy 280 bool rq_splice_ok; /* turned off in gss privacy
281 * to prevent encrypting page 281 * to prevent encrypting page
282 * cache pages */ 282 * cache pages */
283 wait_queue_head_t rq_wait; /* synchronization */
284 struct task_struct *rq_task; /* service thread */ 283 struct task_struct *rq_task; /* service thread */
285}; 284};
286 285
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index fcbfe8783243..cf391eef2e6d 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -357,6 +357,7 @@ int xs_swapper(struct rpc_xprt *xprt, int enable);
357#define XPRT_CONNECTION_ABORT (7) 357#define XPRT_CONNECTION_ABORT (7)
358#define XPRT_CONNECTION_CLOSE (8) 358#define XPRT_CONNECTION_CLOSE (8)
359#define XPRT_CONGESTED (9) 359#define XPRT_CONGESTED (9)
360#define XPRT_CONNECTION_REUSE (10)
360 361
361static inline void xprt_set_connected(struct rpc_xprt *xprt) 362static inline void xprt_set_connected(struct rpc_xprt *xprt)
362{ 363{
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 519064e0c943..3388c1b6f7d8 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -189,6 +189,8 @@ struct platform_suspend_ops {
189 189
190struct platform_freeze_ops { 190struct platform_freeze_ops {
191 int (*begin)(void); 191 int (*begin)(void);
192 int (*prepare)(void);
193 void (*restore)(void);
192 void (*end)(void); 194 void (*end)(void);
193}; 195};
194 196
@@ -371,6 +373,8 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
371extern bool events_check_enabled; 373extern bool events_check_enabled;
372 374
373extern bool pm_wakeup_pending(void); 375extern bool pm_wakeup_pending(void);
376extern void pm_system_wakeup(void);
377extern void pm_wakeup_clear(void);
374extern bool pm_get_wakeup_count(unsigned int *count, bool block); 378extern bool pm_get_wakeup_count(unsigned int *count, bool block);
375extern bool pm_save_wakeup_count(unsigned int count); 379extern bool pm_save_wakeup_count(unsigned int count);
376extern void pm_wakep_autosleep_enabled(bool set); 380extern void pm_wakep_autosleep_enabled(bool set);
@@ -418,6 +422,8 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
418#define pm_notifier(fn, pri) do { (void)(fn); } while (0) 422#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
419 423
420static inline bool pm_wakeup_pending(void) { return false; } 424static inline bool pm_wakeup_pending(void) { return false; }
425static inline void pm_system_wakeup(void) {}
426static inline void pm_wakeup_clear(void) {}
421 427
422static inline void lock_system_sleep(void) {} 428static inline void lock_system_sleep(void) {}
423static inline void unlock_system_sleep(void) {} 429static inline void unlock_system_sleep(void) {}
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1b72060f093a..37a585beef5c 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -327,8 +327,10 @@ extern void lru_cache_add_active_or_unevictable(struct page *page,
327extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 327extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
328 gfp_t gfp_mask, nodemask_t *mask); 328 gfp_t gfp_mask, nodemask_t *mask);
329extern int __isolate_lru_page(struct page *page, isolate_mode_t mode); 329extern int __isolate_lru_page(struct page *page, isolate_mode_t mode);
330extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 330extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
331 gfp_t gfp_mask, bool noswap); 331 unsigned long nr_pages,
332 gfp_t gfp_mask,
333 bool may_swap);
332extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, 334extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
333 gfp_t gfp_mask, bool noswap, 335 gfp_t gfp_mask, bool noswap,
334 struct zone *zone, 336 struct zone *zone,
@@ -354,22 +356,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
354extern int page_evictable(struct page *page); 356extern int page_evictable(struct page *page);
355extern void check_move_unevictable_pages(struct page **, int nr_pages); 357extern void check_move_unevictable_pages(struct page **, int nr_pages);
356 358
357extern unsigned long scan_unevictable_pages;
358extern int scan_unevictable_handler(struct ctl_table *, int,
359 void __user *, size_t *, loff_t *);
360#ifdef CONFIG_NUMA
361extern int scan_unevictable_register_node(struct node *node);
362extern void scan_unevictable_unregister_node(struct node *node);
363#else
364static inline int scan_unevictable_register_node(struct node *node)
365{
366 return 0;
367}
368static inline void scan_unevictable_unregister_node(struct node *node)
369{
370}
371#endif
372
373extern int kswapd_run(int nid); 359extern int kswapd_run(int nid);
374extern void kswapd_stop(int nid); 360extern void kswapd_stop(int nid);
375#ifdef CONFIG_MEMCG 361#ifdef CONFIG_MEMCG
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 0f86d85a9ce4..bda9b81357cc 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -65,6 +65,7 @@ struct old_linux_dirent;
65struct perf_event_attr; 65struct perf_event_attr;
66struct file_handle; 66struct file_handle;
67struct sigaltstack; 67struct sigaltstack;
68union bpf_attr;
68 69
69#include <linux/types.h> 70#include <linux/types.h>
70#include <linux/aio_abi.h> 71#include <linux/aio_abi.h>
@@ -875,5 +876,5 @@ asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
875 const char __user *uargs); 876 const char __user *uargs);
876asmlinkage long sys_getrandom(char __user *buf, size_t count, 877asmlinkage long sys_getrandom(char __user *buf, size_t count,
877 unsigned int flags); 878 unsigned int flags);
878 879asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size);
879#endif 880#endif
diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h
new file mode 100644
index 000000000000..6a8b9942632d
--- /dev/null
+++ b/include/linux/t10-pi.h
@@ -0,0 +1,22 @@
1#ifndef _LINUX_T10_PI_H
2#define _LINUX_T10_PI_H
3
4#include <linux/types.h>
5#include <linux/blkdev.h>
6
7/*
8 * T10 Protection Information tuple.
9 */
10struct t10_pi_tuple {
11 __be16 guard_tag; /* Checksum */
12 __be16 app_tag; /* Opaque storage */
13 __be32 ref_tag; /* Target LBA or indirect LBA */
14};
15
16
17extern struct blk_integrity t10_pi_type1_crc;
18extern struct blk_integrity t10_pi_type1_ip;
19extern struct blk_integrity t10_pi_type3_crc;
20extern struct blk_integrity t10_pi_type3_ip;
21
22#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index ac82c5ea955b..c2dee7deefa8 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -268,7 +268,7 @@ struct tcp_sock {
268 u32 retrans_stamp; /* Timestamp of the last retransmit, 268 u32 retrans_stamp; /* Timestamp of the last retransmit,
269 * also used in SYN-SENT to remember stamp of 269 * also used in SYN-SENT to remember stamp of
270 * the first SYN. */ 270 * the first SYN. */
271 u32 undo_marker; /* tracking retrans started here. */ 271 u32 undo_marker; /* snd_una upon a new recovery episode. */
272 int undo_retrans; /* number of undoable retransmissions. */ 272 int undo_retrans; /* number of undoable retransmissions. */
273 u32 total_retrans; /* Total retransmits for entire connection */ 273 u32 total_retrans; /* Total retransmits for entire connection */
274 274
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 0305cde21a74..ef90838b36a0 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -44,6 +44,10 @@
44#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ 44#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
45 ((long)t-2732+5)/10 : ((long)t-2732-5)/10) 45 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
46#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) 46#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
47#define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100)
48#define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732)
49#define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off))
50#define MILLICELSIUS_TO_DECI_KELVIN(t) MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, 2732)
47 51
48/* Adding event notification support elements */ 52/* Adding event notification support elements */
49#define THERMAL_GENL_FAMILY_NAME "thermal_event" 53#define THERMAL_GENL_FAMILY_NAME "thermal_event"
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 932b76392248..884d6263e962 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -268,7 +268,7 @@ struct kim_data_s {
268 struct st_data_s *core_data; 268 struct st_data_s *core_data;
269 struct chip_version version; 269 struct chip_version version;
270 unsigned char ldisc_install; 270 unsigned char ldisc_install;
271 unsigned char dev_name[UART_DEV_NAME_LEN]; 271 unsigned char dev_name[UART_DEV_NAME_LEN + 1];
272 unsigned char flow_cntrl; 272 unsigned char flow_cntrl;
273 unsigned long baud_rate; 273 unsigned long baud_rate;
274}; 274};
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 9a82c7dc3fdd..eda850ca757a 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -108,7 +108,7 @@ extern struct tick_sched *tick_get_tick_sched(int cpu);
108extern void tick_irq_enter(void); 108extern void tick_irq_enter(void);
109extern int tick_oneshot_mode_active(void); 109extern int tick_oneshot_mode_active(void);
110# ifndef arch_needs_cpu 110# ifndef arch_needs_cpu
111# define arch_needs_cpu(cpu) (0) 111# define arch_needs_cpu() (0)
112# endif 112# endif
113# else 113# else
114static inline void tick_clock_notify(void) { } 114static inline void tick_clock_notify(void) { }
@@ -181,14 +181,12 @@ static inline bool tick_nohz_full_cpu(int cpu)
181 return cpumask_test_cpu(cpu, tick_nohz_full_mask); 181 return cpumask_test_cpu(cpu, tick_nohz_full_mask);
182} 182}
183 183
184extern void tick_nohz_init(void);
185extern void __tick_nohz_full_check(void); 184extern void __tick_nohz_full_check(void);
186extern void tick_nohz_full_kick(void); 185extern void tick_nohz_full_kick(void);
187extern void tick_nohz_full_kick_cpu(int cpu); 186extern void tick_nohz_full_kick_cpu(int cpu);
188extern void tick_nohz_full_kick_all(void); 187extern void tick_nohz_full_kick_all(void);
189extern void __tick_nohz_task_switch(struct task_struct *tsk); 188extern void __tick_nohz_task_switch(struct task_struct *tsk);
190#else 189#else
191static inline void tick_nohz_init(void) { }
192static inline bool tick_nohz_full_enabled(void) { return false; } 190static inline bool tick_nohz_full_enabled(void) { return false; }
193static inline bool tick_nohz_full_cpu(int cpu) { return false; } 191static inline bool tick_nohz_full_cpu(int cpu) { return false; }
194static inline void __tick_nohz_full_check(void) { } 192static inline void __tick_nohz_full_check(void) { }
diff --git a/include/linux/topology.h b/include/linux/topology.h
index dda6ee521e74..909b6e43b694 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -119,11 +119,20 @@ static inline int numa_node_id(void)
119 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem(). 119 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
120 */ 120 */
121DECLARE_PER_CPU(int, _numa_mem_); 121DECLARE_PER_CPU(int, _numa_mem_);
122extern int _node_numa_mem_[MAX_NUMNODES];
122 123
123#ifndef set_numa_mem 124#ifndef set_numa_mem
124static inline void set_numa_mem(int node) 125static inline void set_numa_mem(int node)
125{ 126{
126 this_cpu_write(_numa_mem_, node); 127 this_cpu_write(_numa_mem_, node);
128 _node_numa_mem_[numa_node_id()] = node;
129}
130#endif
131
132#ifndef node_to_mem_node
133static inline int node_to_mem_node(int node)
134{
135 return _node_numa_mem_[node];
127} 136}
128#endif 137#endif
129 138
@@ -146,6 +155,7 @@ static inline int cpu_to_mem(int cpu)
146static inline void set_cpu_numa_mem(int cpu, int node) 155static inline void set_cpu_numa_mem(int cpu, int node)
147{ 156{
148 per_cpu(_numa_mem_, cpu) = node; 157 per_cpu(_numa_mem_, cpu) = node;
158 _node_numa_mem_[cpu_to_node(cpu)] = node;
149} 159}
150#endif 160#endif
151 161
@@ -159,6 +169,13 @@ static inline int numa_mem_id(void)
159} 169}
160#endif 170#endif
161 171
172#ifndef node_to_mem_node
173static inline int node_to_mem_node(int node)
174{
175 return node;
176}
177#endif
178
162#ifndef cpu_to_mem 179#ifndef cpu_to_mem
163static inline int cpu_to_mem(int cpu) 180static inline int cpu_to_mem(int cpu)
164{ 181{
diff --git a/include/linux/torture.h b/include/linux/torture.h
index 5ca58fcbaf1b..7759fc3c622d 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -51,7 +51,7 @@
51 51
52/* Definitions for online/offline exerciser. */ 52/* Definitions for online/offline exerciser. */
53int torture_onoff_init(long ooholdoff, long oointerval); 53int torture_onoff_init(long ooholdoff, long oointerval);
54char *torture_onoff_stats(char *page); 54void torture_onoff_stats(void);
55bool torture_onoff_failures(void); 55bool torture_onoff_failures(void);
56 56
57/* Low-rider random number generator. */ 57/* Low-rider random number generator. */
@@ -77,7 +77,8 @@ int torture_stutter_init(int s);
77/* Initialization and cleanup. */ 77/* Initialization and cleanup. */
78bool torture_init_begin(char *ttype, bool v, int *runnable); 78bool torture_init_begin(char *ttype, bool v, int *runnable);
79void torture_init_end(void); 79void torture_init_end(void);
80bool torture_cleanup(void); 80bool torture_cleanup_begin(void);
81void torture_cleanup_end(void);
81bool torture_must_stop(void); 82bool torture_must_stop(void);
82bool torture_must_stop_irq(void); 83bool torture_must_stop_irq(void);
83void torture_kthread_stopping(char *title); 84void torture_kthread_stopping(char *title);
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index b1293f15f592..e08e21e5f601 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -157,6 +157,12 @@ extern void syscall_unregfunc(void);
157 * Make sure the alignment of the structure in the __tracepoints section will 157 * Make sure the alignment of the structure in the __tracepoints section will
158 * not add unwanted padding between the beginning of the section and the 158 * not add unwanted padding between the beginning of the section and the
159 * structure. Force alignment to the same alignment as the section start. 159 * structure. Force alignment to the same alignment as the section start.
160 *
161 * When lockdep is enabled, we make sure to always do the RCU portions of
162 * the tracepoint code, regardless of whether tracing is on or we match the
163 * condition. This lets us find RCU issues triggered with tracepoints even
164 * when this tracepoint is off. This code has no purpose other than poking
165 * RCU a bit.
160 */ 166 */
161#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ 167#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
162 extern struct tracepoint __tracepoint_##name; \ 168 extern struct tracepoint __tracepoint_##name; \
@@ -167,6 +173,11 @@ extern void syscall_unregfunc(void);
167 TP_PROTO(data_proto), \ 173 TP_PROTO(data_proto), \
168 TP_ARGS(data_args), \ 174 TP_ARGS(data_args), \
169 TP_CONDITION(cond),,); \ 175 TP_CONDITION(cond),,); \
176 if (IS_ENABLED(CONFIG_LOCKDEP)) { \
177 rcu_read_lock_sched_notrace(); \
178 rcu_dereference_sched(__tracepoint_##name.funcs);\
179 rcu_read_unlock_sched_notrace(); \
180 } \
170 } \ 181 } \
171 __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \ 182 __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \
172 PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \ 183 PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 84132942902a..5171ef8f7b85 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -252,6 +252,7 @@ struct tty_struct {
252 struct rw_semaphore termios_rwsem; 252 struct rw_semaphore termios_rwsem;
253 struct mutex winsize_mutex; 253 struct mutex winsize_mutex;
254 spinlock_t ctrl_lock; 254 spinlock_t ctrl_lock;
255 spinlock_t flow_lock;
255 /* Termios values are protected by the termios rwsem */ 256 /* Termios values are protected by the termios rwsem */
256 struct ktermios termios, termios_locked; 257 struct ktermios termios, termios_locked;
257 struct termiox *termiox; /* May be NULL for unsupported */ 258 struct termiox *termiox; /* May be NULL for unsupported */
@@ -261,8 +262,13 @@ struct tty_struct {
261 unsigned long flags; 262 unsigned long flags;
262 int count; 263 int count;
263 struct winsize winsize; /* winsize_mutex */ 264 struct winsize winsize; /* winsize_mutex */
264 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 265 unsigned long stopped:1, /* flow_lock */
265 unsigned char ctrl_status; /* ctrl_lock */ 266 flow_stopped:1,
267 unused:BITS_PER_LONG - 2;
268 int hw_stopped;
269 unsigned long ctrl_status:8, /* ctrl_lock */
270 packet:1,
271 unused_ctrl:BITS_PER_LONG - 9;
266 unsigned int receive_room; /* Bytes free for queue */ 272 unsigned int receive_room; /* Bytes free for queue */
267 int flow_change; 273 int flow_change;
268 274
@@ -397,7 +403,9 @@ extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
397extern char *tty_name(struct tty_struct *tty, char *buf); 403extern char *tty_name(struct tty_struct *tty, char *buf);
398extern void tty_wait_until_sent(struct tty_struct *tty, long timeout); 404extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
399extern int tty_check_change(struct tty_struct *tty); 405extern int tty_check_change(struct tty_struct *tty);
406extern void __stop_tty(struct tty_struct *tty);
400extern void stop_tty(struct tty_struct *tty); 407extern void stop_tty(struct tty_struct *tty);
408extern void __start_tty(struct tty_struct *tty);
401extern void start_tty(struct tty_struct *tty); 409extern void start_tty(struct tty_struct *tty);
402extern int tty_register_driver(struct tty_driver *driver); 410extern int tty_register_driver(struct tty_driver *driver);
403extern int tty_unregister_driver(struct tty_driver *driver); 411extern int tty_unregister_driver(struct tty_driver *driver);
@@ -411,6 +419,7 @@ extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
411extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, 419extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
412 int buflen); 420 int buflen);
413extern void tty_write_message(struct tty_struct *tty, char *msg); 421extern void tty_write_message(struct tty_struct *tty, char *msg);
422extern int tty_send_xchar(struct tty_struct *tty, char ch);
414extern int tty_put_char(struct tty_struct *tty, unsigned char c); 423extern int tty_put_char(struct tty_struct *tty, unsigned char c);
415extern int tty_chars_in_buffer(struct tty_struct *tty); 424extern int tty_chars_in_buffer(struct tty_struct *tty);
416extern int tty_write_room(struct tty_struct *tty); 425extern int tty_write_room(struct tty_struct *tty);
@@ -495,8 +504,6 @@ extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty);
495extern struct mutex tty_mutex; 504extern struct mutex tty_mutex;
496extern spinlock_t tty_files_lock; 505extern spinlock_t tty_files_lock;
497 506
498extern void tty_write_unlock(struct tty_struct *tty);
499extern int tty_write_lock(struct tty_struct *tty, int ndelay);
500#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) 507#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
501 508
502extern void tty_port_init(struct tty_port *port); 509extern void tty_port_init(struct tty_port *port);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index e48c608a8fa8..92e337c18839 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -152,6 +152,8 @@
152 * This routine notifies the tty driver that it should stop 152 * This routine notifies the tty driver that it should stop
153 * outputting characters to the tty device. 153 * outputting characters to the tty device.
154 * 154 *
155 * Called with ->flow_lock held. Serialized with start() method.
156 *
155 * Optional: 157 * Optional:
156 * 158 *
157 * Note: Call stop_tty not this method. 159 * Note: Call stop_tty not this method.
@@ -161,6 +163,8 @@
161 * This routine notifies the tty driver that it resume sending 163 * This routine notifies the tty driver that it resume sending
162 * characters to the tty device. 164 * characters to the tty device.
163 * 165 *
166 * Called with ->flow_lock held. Serialized with stop() method.
167 *
164 * Optional: 168 * Optional:
165 * 169 *
166 * Note: Call start_tty not this method. 170 * Note: Call start_tty not this method.
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 247cfdcc4b08..ee3277593222 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -49,7 +49,11 @@ struct udp_sock {
49 unsigned int corkflag; /* Cork is required */ 49 unsigned int corkflag; /* Cork is required */
50 __u8 encap_type; /* Is this an Encapsulation socket? */ 50 __u8 encap_type; /* Is this an Encapsulation socket? */
51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */ 51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */
52 no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */ 52 no_check6_rx:1,/* Allow zero UDP6 checksums on RX? */
53 convert_csum:1;/* On receive, convert checksum
54 * unnecessary to checksum complete
55 * if possible.
56 */
53 /* 57 /*
54 * Following member retains the information to create a UDP header 58 * Following member retains the information to create a UDP header
55 * when the socket is uncorked. 59 * when the socket is uncorked.
@@ -98,6 +102,16 @@ static inline bool udp_get_no_check6_rx(struct sock *sk)
98 return udp_sk(sk)->no_check6_rx; 102 return udp_sk(sk)->no_check6_rx;
99} 103}
100 104
105static inline void udp_set_convert_csum(struct sock *sk, bool val)
106{
107 udp_sk(sk)->convert_csum = val;
108}
109
110static inline bool udp_get_convert_csum(struct sock *sk)
111{
112 return udp_sk(sk)->convert_csum;
113}
114
101#define udp_portaddr_for_each_entry(__sk, node, list) \ 115#define udp_portaddr_for_each_entry(__sk, node, list) \
102 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node) 116 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node)
103 117
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 290fbf0b6b8a..9b1581414cd4 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -80,6 +80,9 @@ size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
80 struct iov_iter *i); 80 struct iov_iter *i);
81size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, 81size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes,
82 struct iov_iter *i); 82 struct iov_iter *i);
83size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i);
84size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i);
85size_t iov_iter_zero(size_t bytes, struct iov_iter *);
83unsigned long iov_iter_alignment(const struct iov_iter *i); 86unsigned long iov_iter_alignment(const struct iov_iter *i);
84void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, 87void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov,
85 unsigned long nr_segs, size_t count); 88 unsigned long nr_segs, size_t count);
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 1ad4724458de..baa81718d985 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -63,7 +63,17 @@ struct uio_port {
63 63
64#define MAX_UIO_PORT_REGIONS 5 64#define MAX_UIO_PORT_REGIONS 5
65 65
66struct uio_device; 66struct uio_device {
67 struct module *owner;
68 struct device *dev;
69 int minor;
70 atomic_t event;
71 struct fasync_struct *async_queue;
72 wait_queue_head_t wait;
73 struct uio_info *info;
74 struct kobject *map_dir;
75 struct kobject *portio_dir;
76};
67 77
68/** 78/**
69 * struct uio_info - UIO device capabilities 79 * struct uio_info - UIO device capabilities
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 4f844c6b03ee..60beb5dc7977 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -98,11 +98,11 @@ struct uprobes_state {
98 struct xol_area *xol_area; 98 struct xol_area *xol_area;
99}; 99};
100 100
101extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 101extern int set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
102extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 102extern int set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
103extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 103extern bool is_swbp_insn(uprobe_opcode_t *insn);
104extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 104extern bool is_trap_insn(uprobe_opcode_t *insn);
105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 105extern unsigned long uprobe_get_swbp_addr(struct pt_regs *regs);
106extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs); 106extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs);
107extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); 107extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
108extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 108extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
@@ -128,8 +128,8 @@ extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
128extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); 128extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
129extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 129extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
130extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs); 130extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
131extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs); 131extern bool arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
132extern void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, 132extern void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
133 void *src, unsigned long len); 133 void *src, unsigned long len);
134#else /* !CONFIG_UPROBES */ 134#else /* !CONFIG_UPROBES */
135struct uprobes_state { 135struct uprobes_state {
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d2465bc0e73c..447a7e2fc19b 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1862,6 +1862,18 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1862/* debugfs stuff */ 1862/* debugfs stuff */
1863extern struct dentry *usb_debug_root; 1863extern struct dentry *usb_debug_root;
1864 1864
1865/* LED triggers */
1866enum usb_led_event {
1867 USB_LED_EVENT_HOST = 0,
1868 USB_LED_EVENT_GADGET = 1,
1869};
1870
1871#ifdef CONFIG_USB_LED_TRIG
1872extern void usb_led_activity(enum usb_led_event ev);
1873#else
1874static inline void usb_led_activity(enum usb_led_event ev) {}
1875#endif
1876
1865#endif /* __KERNEL__ */ 1877#endif /* __KERNEL__ */
1866 1878
1867#endif 1879#endif
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index bbe779f640be..e14c09a45c5a 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -31,6 +31,7 @@ struct ci_hdrc_platform_data {
31#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 31#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
32 void (*notify_event) (struct ci_hdrc *ci, unsigned event); 32 void (*notify_event) (struct ci_hdrc *ci, unsigned event);
33 struct regulator *reg_vbus; 33 struct regulator *reg_vbus;
34 bool tpl_support;
34}; 35};
35 36
36/* Default offset of capability registers */ 37/* Default offset of capability registers */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index c3a61853cd13..522cafe26790 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -345,12 +345,13 @@ static inline int usb_ep_queue(struct usb_ep *ep,
345 * @ep:the endpoint associated with the request 345 * @ep:the endpoint associated with the request
346 * @req:the request being canceled 346 * @req:the request being canceled
347 * 347 *
348 * if the request is still active on the endpoint, it is dequeued and its 348 * If the request is still active on the endpoint, it is dequeued and its
349 * completion routine is called (with status -ECONNRESET); else a negative 349 * completion routine is called (with status -ECONNRESET); else a negative
350 * error code is returned. 350 * error code is returned. This is guaranteed to happen before the call to
351 * usb_ep_dequeue() returns.
351 * 352 *
352 * note that some hardware can't clear out write fifos (to unlink the request 353 * Note that some hardware can't clear out write fifos (to unlink the request
353 * at the head of the queue) except as part of disconnecting from usb. such 354 * at the head of the queue) except as part of disconnecting from usb. Such
354 * restrictions prevent drivers from supporting configuration changes, 355 * restrictions prevent drivers from supporting configuration changes,
355 * even to configuration zero (a "chapter 9" requirement). 356 * even to configuration zero (a "chapter 9" requirement).
356 */ 357 */
@@ -816,6 +817,8 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
816 * Called in a context that permits sleeping. 817 * Called in a context that permits sleeping.
817 * @suspend: Invoked on USB suspend. May be called in_interrupt. 818 * @suspend: Invoked on USB suspend. May be called in_interrupt.
818 * @resume: Invoked on USB resume. May be called in_interrupt. 819 * @resume: Invoked on USB resume. May be called in_interrupt.
820 * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers
821 * and should be called in_interrupt.
819 * @driver: Driver model state for this driver. 822 * @driver: Driver model state for this driver.
820 * 823 *
821 * Devices are disabled till a gadget driver successfully bind()s, which 824 * Devices are disabled till a gadget driver successfully bind()s, which
@@ -873,6 +876,7 @@ struct usb_gadget_driver {
873 void (*disconnect)(struct usb_gadget *); 876 void (*disconnect)(struct usb_gadget *);
874 void (*suspend)(struct usb_gadget *); 877 void (*suspend)(struct usb_gadget *);
875 void (*resume)(struct usb_gadget *); 878 void (*resume)(struct usb_gadget *);
879 void (*reset)(struct usb_gadget *);
876 880
877 /* FIXME support safe rmmod */ 881 /* FIXME support safe rmmod */
878 struct device_driver driver; 882 struct device_driver driver;
@@ -1013,6 +1017,20 @@ extern void usb_gadget_set_state(struct usb_gadget *gadget,
1013 1017
1014/*-------------------------------------------------------------------------*/ 1018/*-------------------------------------------------------------------------*/
1015 1019
1020/* utility to tell udc core that the bus reset occurs */
1021extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
1022 struct usb_gadget_driver *driver);
1023
1024/*-------------------------------------------------------------------------*/
1025
1026/* utility to give requests back to the gadget layer */
1027
1028extern void usb_gadget_giveback_request(struct usb_ep *ep,
1029 struct usb_request *req);
1030
1031
1032/*-------------------------------------------------------------------------*/
1033
1016/* utility wrapping a simple endpoint selection policy */ 1034/* utility wrapping a simple endpoint selection policy */
1017 1035
1018extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 1036extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 485cd5e2100c..cd96a2bc3388 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -106,7 +106,8 @@ struct usb_hcd {
106 * OTG and some Host controllers need software interaction with phys; 106 * OTG and some Host controllers need software interaction with phys;
107 * other external phys should be software-transparent 107 * other external phys should be software-transparent
108 */ 108 */
109 struct usb_phy *phy; 109 struct usb_phy *usb_phy;
110 struct phy *phy;
110 111
111 /* Flags that need to be manipulated atomically because they can 112 /* Flags that need to be manipulated atomically because they can
112 * change while the host controller is running. Always use 113 * change while the host controller is running. Always use
@@ -144,6 +145,7 @@ struct usb_hcd {
144 unsigned has_tt:1; /* Integrated TT in root hub */ 145 unsigned has_tt:1; /* Integrated TT in root hub */
145 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ 146 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
146 unsigned can_do_streams:1; /* HC supports streams */ 147 unsigned can_do_streams:1; /* HC supports streams */
148 unsigned tpl_support:1; /* OTG & EH TPL support */
147 149
148 unsigned int irq; /* irq allocated */ 150 unsigned int irq; /* irq allocated */
149 void __iomem *regs; /* device memory/io */ 151 void __iomem *regs; /* device memory/io */
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index 8c38aa26b3bb..cfe0528cdbb1 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -14,6 +14,7 @@
14#if IS_ENABLED(CONFIG_OF) 14#if IS_ENABLED(CONFIG_OF)
15enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); 15enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
16enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np); 16enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np);
17bool of_usb_host_tpl_support(struct device_node *np);
17#else 18#else
18static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) 19static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
19{ 20{
@@ -25,6 +26,10 @@ of_usb_get_maximum_speed(struct device_node *np)
25{ 26{
26 return USB_SPEED_UNKNOWN; 27 return USB_SPEED_UNKNOWN;
27} 28}
29static inline bool of_usb_host_tpl_support(struct device_node *np)
30{
31 return false;
32}
28#endif 33#endif
29 34
30#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT) 35#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 55a17b188daa..9948c874e3f1 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -8,27 +8,27 @@
8#define __LINUX_USB_QUIRKS_H 8#define __LINUX_USB_QUIRKS_H
9 9
10/* string descriptors must not be fetched using a 255-byte read */ 10/* string descriptors must not be fetched using a 255-byte read */
11#define USB_QUIRK_STRING_FETCH_255 0x00000001 11#define USB_QUIRK_STRING_FETCH_255 BIT(0)
12 12
13/* device can't resume correctly so reset it instead */ 13/* device can't resume correctly so reset it instead */
14#define USB_QUIRK_RESET_RESUME 0x00000002 14#define USB_QUIRK_RESET_RESUME BIT(1)
15 15
16/* device can't handle Set-Interface requests */ 16/* device can't handle Set-Interface requests */
17#define USB_QUIRK_NO_SET_INTF 0x00000004 17#define USB_QUIRK_NO_SET_INTF BIT(2)
18 18
19/* device can't handle its Configuration or Interface strings */ 19/* device can't handle its Configuration or Interface strings */
20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 20#define USB_QUIRK_CONFIG_INTF_STRINGS BIT(3)
21 21
22/* device can't be reset(e.g morph devices), don't use reset */ 22/* device can't be reset(e.g morph devices), don't use reset */
23#define USB_QUIRK_RESET 0x00000010 23#define USB_QUIRK_RESET BIT(4)
24 24
25/* device has more interface descriptions than the bNumInterfaces count, 25/* device has more interface descriptions than the bNumInterfaces count,
26 and can't handle talking to these interfaces */ 26 and can't handle talking to these interfaces */
27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020 27#define USB_QUIRK_HONOR_BNUMINTERFACES BIT(5)
28 28
29/* device needs a pause during initialization, after we read the device 29/* device needs a pause during initialization, after we read the device
30 descriptor */ 30 descriptor */
31#define USB_QUIRK_DELAY_INIT 0x00000040 31#define USB_QUIRK_DELAY_INIT BIT(6)
32 32
33/* 33/*
34 * For high speed and super speed interupt endpoints, the USB 2.0 and 34 * For high speed and super speed interupt endpoints, the USB 2.0 and
@@ -39,6 +39,12 @@
39 * Devices with this quirk report their bInterval as the result of this 39 * Devices with this quirk report their bInterval as the result of this
40 * calculation instead of the exponent variable used in the calculation. 40 * calculation instead of the exponent variable used in the calculation.
41 */ 41 */
42#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL 0x00000080 42#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL BIT(7)
43
44/* device can't handle device_qualifier descriptor requests */
45#define USB_QUIRK_DEVICE_QUALIFIER BIT(8)
46
47/* device generates spurious wakeup, ignore remote wakeup capability */
48#define USB_QUIRK_IGNORE_REMOTE_WAKEUP BIT(9)
43 49
44#endif /* __LINUX_USB_QUIRKS_H */ 50#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 26088feb6608..d9a4905e01d0 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -78,6 +78,7 @@ struct usbnet {
78# define EVENT_NO_RUNTIME_PM 9 78# define EVENT_NO_RUNTIME_PM 9
79# define EVENT_RX_KILL 10 79# define EVENT_RX_KILL 10
80# define EVENT_LINK_CHANGE 11 80# define EVENT_LINK_CHANGE 11
81# define EVENT_SET_RX_MODE 12
81}; 82};
82 83
83static inline struct usb_driver *driver_of(struct usb_interface *intf) 84static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -159,6 +160,9 @@ struct driver_info {
159 /* called by minidriver when receiving indication */ 160 /* called by minidriver when receiving indication */
160 void (*indication)(struct usbnet *dev, void *ind, int indlen); 161 void (*indication)(struct usbnet *dev, void *ind, int indlen);
161 162
163 /* rx mode change (device changes address list filtering) */
164 void (*set_rx_mode)(struct usbnet *dev);
165
162 /* for new devices, use the descriptor-reading code instead */ 166 /* for new devices, use the descriptor-reading code instead */
163 int in; /* rx endpoint */ 167 int in; /* rx endpoint */
164 int out; /* tx endpoint */ 168 int out; /* tx endpoint */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 9b7de1b46437..a7f2604c5f25 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -73,6 +73,10 @@
73 /* Device advertises UAS but it is broken */ \ 73 /* Device advertises UAS but it is broken */ \
74 US_FLAG(BROKEN_FUA, 0x01000000) \ 74 US_FLAG(BROKEN_FUA, 0x01000000) \
75 /* Cannot handle FUA in WRITE or READ CDBs */ \ 75 /* Cannot handle FUA in WRITE or READ CDBs */ \
76 US_FLAG(NO_ATA_1X, 0x02000000) \
77 /* Cannot handle ATA_12 or ATA_16 CDBs */ \
78 US_FLAG(NO_REPORT_OPCODES, 0x04000000) \
79 /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \
76 80
77#define US_FLAG(name, value) US_FL_##name = value , 81#define US_FLAG(name, value) US_FL_##name = value ,
78enum { US_DO_ALL_FLAGS }; 82enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index b46671e28de2..65261a7244fc 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -78,6 +78,10 @@ bool virtqueue_is_broken(struct virtqueue *vq);
78/** 78/**
79 * virtio_device - representation of a device using virtio 79 * virtio_device - representation of a device using virtio
80 * @index: unique position on the virtio bus 80 * @index: unique position on the virtio bus
81 * @failed: saved value for CONFIG_S_FAILED bit (for restore)
82 * @config_enabled: configuration change reporting enabled
83 * @config_change_pending: configuration change reported while disabled
84 * @config_lock: protects configuration change reporting
81 * @dev: underlying device. 85 * @dev: underlying device.
82 * @id: the device type identification (used to match it with a driver). 86 * @id: the device type identification (used to match it with a driver).
83 * @config: the configuration ops for this device. 87 * @config: the configuration ops for this device.
@@ -88,6 +92,10 @@ bool virtqueue_is_broken(struct virtqueue *vq);
88 */ 92 */
89struct virtio_device { 93struct virtio_device {
90 int index; 94 int index;
95 bool failed;
96 bool config_enabled;
97 bool config_change_pending;
98 spinlock_t config_lock;
91 struct device dev; 99 struct device dev;
92 struct virtio_device_id id; 100 struct virtio_device_id id;
93 const struct virtio_config_ops *config; 101 const struct virtio_config_ops *config;
@@ -108,6 +116,12 @@ void unregister_virtio_device(struct virtio_device *dev);
108 116
109void virtio_break_device(struct virtio_device *dev); 117void virtio_break_device(struct virtio_device *dev);
110 118
119void virtio_config_changed(struct virtio_device *dev);
120#ifdef CONFIG_PM_SLEEP
121int virtio_device_freeze(struct virtio_device *dev);
122int virtio_device_restore(struct virtio_device *dev);
123#endif
124
111/** 125/**
112 * virtio_driver - operations for a virtio I/O driver 126 * virtio_driver - operations for a virtio I/O driver
113 * @driver: underlying device driver (populate name and owner). 127 * @driver: underlying device driver (populate name and owner).
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e8f8f71e843c..7f4ef66873ef 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -109,6 +109,23 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
109 return vq; 109 return vq;
110} 110}
111 111
112/**
113 * virtio_device_ready - enable vq use in probe function
114 * @vdev: the device
115 *
116 * Driver must call this to use vqs in the probe function.
117 *
118 * Note: vqs are enabled automatically after probe returns.
119 */
120static inline
121void virtio_device_ready(struct virtio_device *dev)
122{
123 unsigned status = dev->config->get_status(dev);
124
125 BUG_ON(status & VIRTIO_CONFIG_S_DRIVER_OK);
126 dev->config->set_status(dev, status | VIRTIO_CONFIG_S_DRIVER_OK);
127}
128
112static inline 129static inline
113const char *virtio_bus_name(struct virtio_device *vdev) 130const char *virtio_bus_name(struct virtio_device *vdev)
114{ 131{
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index ced92345c963..730334cdf037 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -72,6 +72,13 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
72 THP_ZERO_PAGE_ALLOC, 72 THP_ZERO_PAGE_ALLOC,
73 THP_ZERO_PAGE_ALLOC_FAILED, 73 THP_ZERO_PAGE_ALLOC_FAILED,
74#endif 74#endif
75#ifdef CONFIG_MEMORY_BALLOON
76 BALLOON_INFLATE,
77 BALLOON_DEFLATE,
78#ifdef CONFIG_BALLOON_COMPACTION
79 BALLOON_MIGRATE,
80#endif
81#endif
75#ifdef CONFIG_DEBUG_TLBFLUSH 82#ifdef CONFIG_DEBUG_TLBFLUSH
76#ifdef CONFIG_SMP 83#ifdef CONFIG_SMP
77 NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */ 84 NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 6fb1ba5f9b2f..e4a8eb9312ea 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -25,7 +25,7 @@ struct wait_bit_key {
25 void *flags; 25 void *flags;
26 int bit_nr; 26 int bit_nr;
27#define WAIT_ATOMIC_T_BIT_NR -1 27#define WAIT_ATOMIC_T_BIT_NR -1
28 unsigned long private; 28 unsigned long timeout;
29}; 29};
30 30
31struct wait_bit_queue { 31struct wait_bit_queue {
@@ -154,6 +154,7 @@ int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_ac
154void wake_up_bit(void *, int); 154void wake_up_bit(void *, int);
155void wake_up_atomic_t(atomic_t *); 155void wake_up_atomic_t(atomic_t *);
156int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned); 156int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned);
157int out_of_line_wait_on_bit_timeout(void *, int, wait_bit_action_f *, unsigned, unsigned long);
157int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned); 158int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned);
158int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned); 159int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
159wait_queue_head_t *bit_waitqueue(void *, int); 160wait_queue_head_t *bit_waitqueue(void *, int);
@@ -280,9 +281,11 @@ do { \
280 * wake_up() has to be called after changing any variable that could 281 * wake_up() has to be called after changing any variable that could
281 * change the result of the wait condition. 282 * change the result of the wait condition.
282 * 283 *
283 * The function returns 0 if the @timeout elapsed, or the remaining 284 * Returns:
284 * jiffies (at least 1) if the @condition evaluated to %true before 285 * 0 if the @condition evaluated to %false after the @timeout elapsed,
285 * the @timeout elapsed. 286 * 1 if the @condition evaluated to %true after the @timeout elapsed,
287 * or the remaining jiffies (at least 1) if the @condition evaluated
288 * to %true before the @timeout elapsed.
286 */ 289 */
287#define wait_event_timeout(wq, condition, timeout) \ 290#define wait_event_timeout(wq, condition, timeout) \
288({ \ 291({ \
@@ -363,9 +366,11 @@ do { \
363 * change the result of the wait condition. 366 * change the result of the wait condition.
364 * 367 *
365 * Returns: 368 * Returns:
366 * 0 if the @timeout elapsed, -%ERESTARTSYS if it was interrupted by 369 * 0 if the @condition evaluated to %false after the @timeout elapsed,
367 * a signal, or the remaining jiffies (at least 1) if the @condition 370 * 1 if the @condition evaluated to %true after the @timeout elapsed,
368 * evaluated to %true before the @timeout elapsed. 371 * the remaining jiffies (at least 1) if the @condition evaluated
372 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
373 * interrupted by a signal.
369 */ 374 */
370#define wait_event_interruptible_timeout(wq, condition, timeout) \ 375#define wait_event_interruptible_timeout(wq, condition, timeout) \
371({ \ 376({ \
@@ -859,6 +864,8 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
859 864
860extern int bit_wait(struct wait_bit_key *); 865extern int bit_wait(struct wait_bit_key *);
861extern int bit_wait_io(struct wait_bit_key *); 866extern int bit_wait_io(struct wait_bit_key *);
867extern int bit_wait_timeout(struct wait_bit_key *);
868extern int bit_wait_io_timeout(struct wait_bit_key *);
862 869
863/** 870/**
864 * wait_on_bit - wait for a bit to be cleared 871 * wait_on_bit - wait for a bit to be cleared
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 2a3038ee17a3..395b70e0eccf 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -97,13 +97,8 @@ struct watchdog_device {
97#define WDOG_UNREGISTERED 4 /* Has the device been unregistered */ 97#define WDOG_UNREGISTERED 4 /* Has the device been unregistered */
98}; 98};
99 99
100#ifdef CONFIG_WATCHDOG_NOWAYOUT 100#define WATCHDOG_NOWAYOUT IS_BUILTIN(CONFIG_WATCHDOG_NOWAYOUT)
101#define WATCHDOG_NOWAYOUT 1 101#define WATCHDOG_NOWAYOUT_INIT_STATUS (WATCHDOG_NOWAYOUT << WDOG_NO_WAY_OUT)
102#define WATCHDOG_NOWAYOUT_INIT_STATUS (1 << WDOG_NO_WAY_OUT)
103#else
104#define WATCHDOG_NOWAYOUT 0
105#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
106#endif
107 102
108/* Use the following function to check whether or not the watchdog is active */ 103/* Use the following function to check whether or not the watchdog is active */
109static inline bool watchdog_active(struct watchdog_device *wdd) 104static inline bool watchdog_active(struct watchdog_device *wdd)
diff --git a/include/linux/zsmalloc.h b/include/linux/zsmalloc.h
index e44d634e7fb7..05c214760977 100644
--- a/include/linux/zsmalloc.h
+++ b/include/linux/zsmalloc.h
@@ -46,6 +46,6 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
46 enum zs_mapmode mm); 46 enum zs_mapmode mm);
47void zs_unmap_object(struct zs_pool *pool, unsigned long handle); 47void zs_unmap_object(struct zs_pool *pool, unsigned long handle);
48 48
49u64 zs_get_total_size_bytes(struct zs_pool *pool); 49unsigned long zs_get_total_pages(struct zs_pool *pool);
50 50
51#endif 51#endif