History

Merge drm/drm-next into drm-misc-next

Backmerging required to pull topic/phy-compliance.

Thomas Zimmermann committed 6 years ago

Commit 08d99b22 parents 13e3d94 8f3d9f310045 files · +454296 −216090Browse files

Showing the changes to include/linux (350 of 10045 files). Show all

Unified · Split

350 files
  1. include/linux/acpi.h +31 −3
  2. include/linux/aer.h +2 −7
  3. include/linux/arch_topology.h +14 −5
  4. include/linux/atmel-isc-media.h +58 −0
  5. include/linux/binfmts.h +7 −1
  6. include/linux/bio.h +1 −14
  7. include/linux/bitfield.h +14 −0
  8. include/linux/bitmap.h +7 −1
  9. include/linux/bitops.h +2 −2
  10. include/linux/bits.h +21 −3
  11. include/linux/blk-cgroup.h +17 −26
  12. include/linux/blk-mq.h +6 −1
  13. include/linux/blkdev.h +6 −12
  14. include/linux/bootconfig.h +2 −1
  15. include/linux/bpf-cgroup.h +37 −6
  16. include/linux/bpf.h +131 −33
  17. include/linux/bpf_lsm.h +33 −0
  18. include/linux/bpf_types.h +4 −0
  19. include/linux/bpf_verifier.h +4 −0
  20. include/linux/brcmphy.h +2 −0
  21. include/linux/buffer_head.h +3 −3
  22. include/linux/ceph/ceph_fs.h +16 −2
  23. include/linux/ceph/debugfs.h +0 −14
  24. include/linux/ceph/libceph.h +1 −0
  25. include/linux/ceph/messenger.h +4 −3
  26. include/linux/ceph/osd_client.h +0 −17
  27. include/linux/ceph/osdmap.h +4 −0
  28. include/linux/ceph/rados.h +4 −2
  29. include/linux/cgroup-defs.h +8 −2
  30. include/linux/cgroup.h +15 −9
  31. include/linux/clk-provider.h +5 −5
  32. include/linux/clk/at91_pmc.h +23 −0
  33. include/linux/clocksource.h +52 −41
  34. include/linux/cma.h +12 −2
  35. include/linux/compat.h +5 −4
  36. include/linux/compiler.h +1 −1
  37. include/linux/compiler_types.h +1 −10
  38. include/linux/completion.h +4 −4
  39. include/linux/console.h +1 −0
  40. include/linux/const.h +1 −4
  41. include/linux/coresight.h +27 −0
  42. include/linux/cpu.h +17 −5
  43. include/linux/cpufreq.h +5 −0
  44. include/linux/cpuhotplug.h +1 −0
  45. include/linux/cpumask.h +7 −0
  46. include/linux/dax.h +7 −14
  47. include/linux/dccp.h +1 −1
  48. include/linux/debugfs.h +10 −11
  49. include/linux/devfreq.h +52 −54
  50. include/linux/devfreq_cooling.h +1 −1
  51. include/linux/device-mapper.h +3 −0
  52. include/linux/device.h +4 −6
  53. include/linux/device/driver.h +1 −1
  54. include/linux/dio.h +0 −5
  55. include/linux/dma-noncoherent.h +2 −2
  56. include/linux/dmaengine.h +36 −32
  57. include/linux/dmar.h +9 −5
  58. include/linux/dsa/8021q.h +0 −7
  59. include/linux/dw_apb_timer.h +0 −1
  60. include/linux/edac.h +5 −4
  61. include/linux/efi.h +121 −579
  62. include/linux/efi_embedded_fw.h +43 −0
  63. include/linux/elfnote.h +1 −1
  64. include/linux/err.h +0 −3
  65. include/linux/ethtool.h +63 −3
  66. include/linux/extcon-provider.h +14 −14
  67. include/linux/extcon.h +5 −0
  68. include/linux/f2fs_fs.h +1 −0
  69. include/linux/fanotify.h +2 −1
  70. include/linux/file.h +1 −0
  71. include/linux/filter.h +31 −17
  72. include/linux/firmware.h +9 −0
  73. include/linux/firmware/imx/ipc.h +0 −1
  74. include/linux/firmware/meson/meson_sm.h +2 −0
  75. include/linux/firmware/xlnx-zynqmp.h +11 −2
  76. include/linux/fs.h +10 −2
  77. include/linux/fscrypt.h +6 −0
  78. include/linux/fsl/mc.h +16 −0
  79. include/linux/fsl/ptp_qoriq.h +0 −2
  80. include/linux/fsnotify.h +58 −80
  81. include/linux/fsnotify_backend.h +49 −21
  82. include/linux/futex.h +10 −7
  83. include/linux/fwnode.h +2 −0
  84. include/linux/genhd.h +61 −473
  85. include/linux/gfp.h +8 −0
  86. include/linux/gpio.h +0 −2
  87. include/linux/gpio/consumer.h +12 −1
  88. include/linux/gpio/driver.h +70 −69
  89. include/linux/hardirq.h +4 −4
  90. include/linux/hashtable.h +2 −2
  91. include/linux/hmm.h +5 −120
  92. include/linux/huge_mm.h +46 −7
  93. include/linux/hugetlb.h +75 −13
  94. include/linux/hugetlb_cgroup.h +151 −18
  95. include/linux/i2c-smbus.h +2 −7
  96. include/linux/i2c.h +10 −2
  97. include/linux/ieee80211.h +24 −6
  98. include/linux/iio/common/cros_ec_sensors_core.h +14 −90
  99. include/linux/iio/iio.h +4 −0
  100. include/linux/iio/imu/adis.h +49 −2
  101. include/linux/ima.h +1 −2
  102. include/linux/inet_diag.h +28 −17
  103. include/linux/intel-iommu.h +2 −0
  104. include/linux/interrupt.h +2 −0
  105. include/linux/io-mapping.h +1 −1
  106. include/linux/io.h +0 −2
  107. include/linux/ioc3.h +0 −93
  108. include/linux/iocontext.h +1 −0
  109. include/linux/iommu.h +27 −8
  110. include/linux/iopoll.h +33 −7
  111. include/linux/ipv6.h +1 −0
  112. include/linux/irq.h +13 −0
  113. include/linux/irq_work.h +2 −0
  114. include/linux/irqchip/arm-gic-common.h +2 −0
  115. include/linux/irqchip/arm-gic-v3.h +22 −1
  116. include/linux/irqchip/arm-gic-v4.h +23 −2
  117. include/linux/irqdesc.h +1 −1
  118. include/linux/irqflags.h +69 −18
  119. include/linux/jiffies.h +1 −3
  120. include/linux/kasan.h +1 −1
  121. include/linux/kernel.h +7 −0
  122. include/linux/kernfs.h +9 −2
  123. include/linux/key-type.h +1 −1
  124. include/linux/kfifo.h +73 −0
  125. include/linux/kthread.h +2 −1
  126. include/linux/ktime.h +1 −8
  127. include/linux/kvm_host.h +40 −31
  128. include/linux/leds.h +1 −0
  129. include/linux/leds_pwm.h +0 −22
  130. include/linux/libata.h +116 −58
  131. include/linux/libnvdimm.h +2 −0
  132. include/linux/limits.h +2 −12
  133. include/linux/linkmode.h +7 −1
  134. include/linux/list.h +1 −1
  135. include/linux/lockdep.h +75 −11
  136. include/linux/lsm_hook_defs.h +381 −0
  137. include/linux/lsm_hooks.h +47 −617
  138. include/linux/math64.h +1 −19
  139. include/linux/mdio-xpcs.h +41 −0
  140. include/linux/mdio.h +4 −0
  141. include/linux/memblock.h +3 −0
  142. include/linux/memcontrol.h +34 −20
  143. include/linux/memory.h +0 −1
  144. include/linux/memory_hotplug.h +21 −13
  145. include/linux/mempolicy.h +1 −28
  146. include/linux/memremap.h +12 −2
  147. include/linux/mfd/iqs62x.h +139 −0
  148. include/linux/mfd/rk808.h +0 −2
  149. include/linux/mfd/rn5t618.h +26 −0
  150. include/linux/mfd/sc27xx-pmic.h +7 −0
  151. include/linux/mfd/wm831x/pdata.h +0 −1
  152. include/linux/mfd/wm8994/pdata.h +1 −1
  153. include/linux/mhi.h +700 −0
  154. include/linux/migrate.h +8 −0
  155. include/linux/mii.h +39 −18
  156. include/linux/min_heap.h +134 −0
  157. include/linux/miscdevice.h +13 −1
  158. include/linux/mlx5/device.h +6 −0
  159. include/linux/mlx5/driver.h +9 −30
  160. include/linux/mlx5/eswitch.h +36 −2
  161. include/linux/mlx5/fs.h +2 −0
  162. include/linux/mlx5/mlx5_ifc.h +31 −17
  163. include/linux/mlx5/mlx5_ifc_fpga.h +1 −1
  164. include/linux/mm.h +266 −47
  165. include/linux/mm_inline.h +8 −7
  166. include/linux/mm_types.h +8 −3
  167. include/linux/mmc/core.h +0 −3
  168. include/linux/mmc/host.h +7 −1
  169. include/linux/mmc/mmc.h +10 −0
  170. include/linux/mmc/sdio_func.h +1 −1
  171. include/linux/mmzone.h +7 −47
  172. include/linux/mod_devicetable.h +14 −3
  173. include/linux/most.h +337 −0
  174. include/linux/msdos_partition.h +50 −0
  175. include/linux/mtd/mtd.h +115 −10
  176. include/linux/mtd/partitions.h +0 −1
  177. include/linux/mtd/rawnand.h +10 −1
  178. include/linux/mtd/spi-nor.h +19 −266
  179. include/linux/mtd/spinand.h +45 −22
  180. include/linux/mutex.h +5 −2
  181. include/linux/namei.h +2 −2
  182. include/linux/netdev_features.h +3 −0
  183. include/linux/netdevice.h +16 −6
  184. include/linux/netfilter/ipset/ip_set.h +1 −1
  185. include/linux/netfilter/x_tables.h +4 −4
  186. include/linux/netfilter_arp/arp_tables.h +1 −1
  187. include/linux/netfilter_bridge/ebtables.h +1 −1
  188. include/linux/netfilter_ipv4/ip_tables.h +1 −1
  189. include/linux/netfilter_ipv6/ip6_tables.h +1 −1
  190. include/linux/netlink.h +15 −2
  191. include/linux/nfs_fs.h +1 −0
  192. include/linux/nfs_page.h +5 −0
  193. include/linux/nfs_xdr.h +16 −17
  194. include/linux/numa.h +29 −1
  195. include/linux/nvme-fc-driver.h +0 −4
  196. include/linux/nvmem-consumer.h +7 −0
  197. include/linux/of_address.h +9 −4
  198. include/linux/of_clk.h +4 −4
  199. include/linux/of_gpio.h +6 −3
  200. include/linux/page-flags.h +17 −1
  201. include/linux/page_ref.h +9 −0
  202. include/linux/page_reporting.h +26 −0
  203. include/linux/pagemap.h +15 −14
  204. include/linux/part_stat.h +115 −0
  205. include/linux/pci-acpi.h +8 −0
  206. include/linux/pci-epc.h +22 −5
  207. include/linux/pci-epf.h +25 −4
  208. include/linux/pci.h +22 −2
  209. include/linux/pci_ids.h +4 −0
  210. include/linux/pe.h +21 −0
  211. include/linux/percpu-rwsem.h +49 −34
  212. include/linux/percpu_counter.h +2 −2
  213. include/linux/perf/arm_pmu.h +1 −0
  214. include/linux/perf_event.h +20 −0
  215. include/linux/phy.h +61 −1
  216. include/linux/phy/tegra/xusb.h +2 −0
  217. include/linux/phylink.h +157 −25
  218. include/linux/pid.h +2 −0
  219. include/linux/pid_namespace.h +0 −2
  220. include/linux/pinctrl/pinctrl.h +1 −1
  221. include/linux/platform_data/cros_ec_proto.h +4 −0
  222. include/linux/platform_data/cros_ec_sensorhub.h +163 −0
  223. include/linux/platform_data/cros_usbpd_notify.h +17 −0
  224. include/linux/platform_data/dmtimer-omap.h +3 −3
  225. include/linux/platform_data/leds-kirkwood-ns2.h +0 −38
  226. include/linux/platform_data/mmc-esdhc-imx.h +1 −0
  227. include/linux/platform_data/pm33xx.h +5 −1
  228. include/linux/platform_data/pwm_omap_dmtimer.h +0 −90
  229. include/linux/platform_data/remoteproc-omap.h +0 −51
  230. include/linux/platform_data/ti-sysc.h +5 −0
  231. include/linux/platform_data/wilco-ec.h +6 −2
  232. include/linux/platform_device.h +5 −2
  233. include/linux/pm_qos.h +42 −39
  234. include/linux/pm_runtime.h +11 −1
  235. include/linux/pnp.h +1 −1
  236. include/linux/posix-timers.h +1 −1
  237. include/linux/power/bq2415x_charger.h +1 −1
  238. include/linux/power/charger-manager.h +1 −1
  239. include/linux/preempt.h +30 −0
  240. include/linux/printk.h +0 −5
  241. include/linux/proc_fs.h +18 −3
  242. include/linux/proc_ns.h +2 −5
  243. include/linux/psi.h +2 −0
  244. include/linux/psi_types.h +9 −1
  245. include/linux/ptp_clock_kernel.h +19 −0
  246. include/linux/pwm.h +3 −1
  247. include/linux/pwm_backlight.h +0 −2
  248. include/linux/qed/qed_chain.h +15 −9
  249. include/linux/raid/detect.h +3 −0
  250. include/linux/random.h +22 −0
  251. include/linux/rculist.h +2 −2
  252. include/linux/rcutiny.h +1 −0
  253. include/linux/rcutree.h +1 −0
  254. include/linux/rcuwait.h +10 −2
  255. include/linux/refcount.h +18 −5
  256. include/linux/regmap.h +2 −2
  257. include/linux/regulator/driver.h +2 −2
  258. include/linux/remoteproc.h +10 −6
  259. include/linux/remoteproc/qcom_q6v5_ipa_notify.h +82 −0
  260. include/linux/rhashtable.h +1 −1
  261. include/linux/ring_buffer.h +2 −2
  262. include/linux/rtc.h +0 −12
  263. include/linux/rwlock_types.h +5 −1
  264. include/linux/rwsem.h +5 −7
  265. include/linux/sched.h +25 −18
  266. include/linux/sched/signal.h +24 −1
  267. include/linux/sched/task.h +4 −0
  268. include/linux/sched/topology.h +8 −0
  269. include/linux/seccomp.h +2 −1
  270. include/linux/security.h +0 −1
  271. include/linux/selection.h +3 −1
  272. include/linux/seq_file.h +0 −1
  273. include/linux/serial_8250.h +4 −0
  274. include/linux/serial_core.h +2 −2
  275. include/linux/shmem_fs.h +1 −9
  276. include/linux/signal.h +4 −4
  277. include/linux/skbuff.h +55 −35
  278. include/linux/skmsg.h +22 −46
  279. include/linux/slab.h +1 −1
  280. include/linux/soc/qcom/apr.h +1 −0
  281. include/linux/soc/qcom/pdr.h +29 −0
  282. include/linux/soc/qcom/qmi.h +1 −0
  283. include/linux/soc/qcom/smd-rpm.h +1 −0
  284. include/linux/socket.h +6 −1
  285. include/linux/soundwire/sdw.h +49 −0
  286. include/linux/spi/corgi_lcd.h +0 −3
  287. include/linux/spi/ifx_modem.h +0 −5
  288. include/linux/spi/spi.h +7 −2
  289. include/linux/spinlock.h +25 −10
  290. include/linux/spinlock_types.h +20 −4
  291. include/linux/splice.h +3 −0
  292. include/linux/stackdepot.h +2 −0
  293. include/linux/stackprotector.h +1 −1
  294. include/linux/stmmac.h +1 −0
  295. include/linux/sunrpc/cache.h +6 −3
  296. include/linux/sunrpc/rpc_rdma.h +2 −1
  297. include/linux/sunrpc/sched.h +1 −0
  298. include/linux/sunrpc/svc.h +4 −1
  299. include/linux/sunrpc/svc_rdma.h +17 −7
  300. include/linux/sunrpc/svc_xprt.h +2 −0
  301. include/linux/sunrpc/xdr.h +53 −15
  302. include/linux/suspend.h +0 −34
  303. include/linux/swap.h +0 −1
  304. include/linux/swapops.h +4 −1
  305. include/linux/sysfs.h +54 −7
  306. include/linux/sysrq.h +7 −0
  307. include/linux/tcp.h +24 −2
  308. include/linux/tee_drv.h +1 −18
  309. include/linux/thermal.h +10 −0
  310. include/linux/threads.h +1 −1
  311. include/linux/time.h +1 −4
  312. include/linux/time32.h +1 −11
  313. include/linux/time64.h +1 −9
  314. include/linux/timer.h +1 −1
  315. include/linux/tnum.h +12 −0
  316. include/linux/topology.h +0 −17
  317. include/linux/trace_events.h +2 −0
  318. include/linux/uacce.h +163 −0
  319. include/linux/uio_driver.h +21 −12
  320. include/linux/unaligned/be_byteshift.h +3 −3
  321. include/linux/unaligned/generic.h +46 −0
  322. include/linux/unaligned/le_byteshift.h +3 −3
  323. include/linux/usb.h +9 −2
  324. include/linux/usb/audio-v2.h +13 −1
  325. include/linux/usb/audio-v3.h +1 −1
  326. include/linux/usb/cdc_ncm.h +12 −3
  327. include/linux/usb/ehci_def.h +1 −1
  328. include/linux/usb/gadget.h +1 −1
  329. include/linux/usb/hcd.h +1 −1
  330. include/linux/usb/role.h +21 −2
  331. include/linux/usb/typec.h +1 −2
  332. include/linux/usb/typec_altmode.h +0 −7
  333. include/linux/usb/typec_mux.h +22 −3
  334. include/linux/usb/typec_tbt.h +53 −0
  335. include/linux/usb_usual.h +1 −1
  336. include/linux/usbdevice_fs.h +1 −1
  337. include/linux/userfaultfd_k.h +41 −1
  338. include/linux/uuid.h +21 −1
  339. include/linux/vdpa.h +253 −0
  340. include/linux/vfio.h +17 −0
  341. include/linux/vhost_iotlb.h +47 −0
  342. include/linux/vm_event_item.h +5 −0
  343. include/linux/vmalloc.h +3 −2
  344. include/linux/vringh.h +36 −0
  345. include/linux/vt_kern.h +32 −32
  346. include/linux/wait.h +1 −0
  347. include/linux/workqueue.h +18 −2
  348. include/linux/xarray.h +7 −3
  349. include/linux/xattr.h +2 −1
  350. include/linux/zorro.h +0 −12
include/linux/acpi.h+31−3
@@ -416,9 +416,30 @@ extern void acpi_osi_setup(char *str); · 415 unmodified lines
416416 extern bool acpi_osi_is_win8(void);
417417
418418 #ifdef CONFIG_ACPI_NUMA
419−int acpi_map_pxm_to_online_node(int pxm);
420419 int acpi_map_pxm_to_node(int pxm);
421420 int acpi_get_node(acpi_handle handle);
421+
422+/**
423+ * acpi_map_pxm_to_online_node - Map proximity ID to online node
424+ * @pxm: ACPI proximity ID
425+ *
426+ * This is similar to acpi_map_pxm_to_node(), but always returns an online
427+ * node. When the mapped node from a given proximity ID is offline, it
428+ * looks up the node distance table and returns the nearest online node.
429+ *
430+ * ACPI device drivers, which are called after the NUMA initialization has
431+ * completed in the kernel, can call this interface to obtain their device
432+ * NUMA topology from ACPI tables. Such drivers do not have to deal with
433+ * offline nodes. A node may be offline when a device proximity ID is
434+ * unique, SRAT memory entry does not exist, or NUMA is disabled, ex.
435+ * "numa=off" on x86.
436+ */
437+static inline int acpi_map_pxm_to_online_node(int pxm)
438+{
439+ int node = acpi_map_pxm_to_node(pxm);
440+
441+ return numa_map_to_online_node(node);
442+}
422443 #else
423444 static inline int acpi_map_pxm_to_online_node(int pxm)
424445 {
@@ -488,6 +509,11 @@ void __init acpi_nvs_nosave_s3(void); · 63 unmodified lines
488509 void __init acpi_sleep_no_blacklist(void);
489510 #endif /* CONFIG_PM_SLEEP */
490511
512+int acpi_register_wakeup_handler(
513+ int wake_irq, bool (*wakeup)(void *context), void *context);
514+void acpi_unregister_wakeup_handler(
515+ bool (*wakeup)(void *context), void *context);
516+
491517 struct acpi_osc_context {
492518 char *uuid_str; /* UUID string */
493519 int rev;
@@ -530,8 +556,9 @@ extern bool osc_pc_lpi_support_confirmed; · 36 unmodified lines
530556 #define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004
531557 #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008
532558 #define OSC_PCI_MSI_SUPPORT 0x00000010
559+#define OSC_PCI_EDR_SUPPORT 0x00000080
533560 #define OSC_PCI_HPX_TYPE_3_SUPPORT 0x00000100
534−#define OSC_PCI_SUPPORT_MASKS 0x0000011f
561+#define OSC_PCI_SUPPORT_MASKS 0x0000019f
535562
536563 /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */
537564 #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001
@@ -540,7 +567,8 @@ extern bool osc_pc_lpi_support_confirmed; · 2 unmodified lines
540567 #define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008
541568 #define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
542569 #define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020
543−#define OSC_PCI_CONTROL_MASKS 0x0000003f
570+#define OSC_PCI_EXPRESS_DPC_CONTROL 0x00000080
571+#define OSC_PCI_CONTROL_MASKS 0x000000bf
544572
545573 #define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002
546574 #define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004
include/linux/aer.h+2−7
@@ -44,8 +44,7 @@ struct aer_capability_regs { · 43 unmodified lines
4444 /* PCIe port driver needs this function to enable AER */
4545 int pci_enable_pcie_error_reporting(struct pci_dev *dev);
4646 int pci_disable_pcie_error_reporting(struct pci_dev *dev);
47−int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
48−int pci_cleanup_aer_error_status_regs(struct pci_dev *dev);
47+int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
4948 void pci_save_aer_state(struct pci_dev *dev);
5049 void pci_restore_aer_state(struct pci_dev *dev);
5150 #else
@@ -57,11 +56,7 @@ static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) · 5 unmodified lines
5756 {
5857 return -EINVAL;
5958 }
60−static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
61−{
62− return -EINVAL;
63−}
64−static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev)
59+static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
6560 {
6661 return -EINVAL;
6762 }
include/linux/arch_topology.h+14−5
@@ -16,9 +16,7 @@ bool topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu); · 15 unmodified lines
1616
1717 DECLARE_PER_CPU(unsigned long, cpu_scale);
1818
19−struct sched_domain;
20−static inline
21−unsigned long topology_get_cpu_scale(int cpu)
19+static inline unsigned long topology_get_cpu_scale(int cpu)
2220 {
2321 return per_cpu(cpu_scale, cpu);
2422 }
@@ -27,12 +25,23 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity); · 2 unmodified lines
2725
2826 DECLARE_PER_CPU(unsigned long, freq_scale);
2927
30−static inline
31−unsigned long topology_get_freq_scale(int cpu)
28+static inline unsigned long topology_get_freq_scale(int cpu)
3229 {
3330 return per_cpu(freq_scale, cpu);
3431 }
3532
33+bool arch_freq_counters_available(struct cpumask *cpus);
34+
35+DECLARE_PER_CPU(unsigned long, thermal_pressure);
36+
37+static inline unsigned long topology_get_thermal_pressure(int cpu)
38+{
39+ return per_cpu(thermal_pressure, cpu);
40+}
41+
42+void arch_set_thermal_pressure(struct cpumask *cpus,
43+ unsigned long th_pressure);
44+
3645 struct cpu_topology {
3746 int thread_id;
3847 int core_id;
include/linux/atmel-isc-media.h+58−0
@@ -0,0 +1,58 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+/*
3+ * Copyright (c) 2019 Microchip Technology Inc. and its subsidiaries
4+ *
5+ * Author: Eugen Hristev <eugen.hristev@microchip.com>
6+ */
7+
8+#ifndef __LINUX_ATMEL_ISC_MEDIA_H__
9+#define __LINUX_ATMEL_ISC_MEDIA_H__
10+
11+/*
12+ * There are 8 controls available:
13+ * 4 gain controls, sliders, for each of the BAYER components: R, B, GR, GB.
14+ * These gains are multipliers for each component, in format unsigned 0:4:9 with
15+ * a default value of 512 (1.0 multiplier).
16+ * 4 offset controls, sliders, for each of the BAYER components: R, B, GR, GB.
17+ * These offsets are added/substracted from each component, in format signed
18+ * 1:12:0 with a default value of 0 (+/- 0)
19+ *
20+ * To expose this to userspace, added 8 custom controls, in an auto cluster.
21+ *
22+ * To summarize the functionality:
23+ * The auto cluster switch is the auto white balance control, and it works
24+ * like this:
25+ * AWB == 1: autowhitebalance is on, the do_white_balance button is inactive,
26+ * the gains/offsets are inactive, but volatile and readable.
27+ * Thus, the results of the whitebalance algorithm are available to userspace to
28+ * read at any time.
29+ * AWB == 0: autowhitebalance is off, cluster is in manual mode, user can
30+ * configure the gain/offsets directly.
31+ * More than that, if the do_white_balance button is
32+ * pressed, the driver will perform one-time-adjustment, (preferably with color
33+ * checker card) and the userspace can read again the new values.
34+ *
35+ * With this feature, the userspace can save the coefficients and reinstall them
36+ * for example after reboot or reprobing the driver.
37+ */
38+
39+enum atmel_isc_ctrl_id {
40+ /* Red component gain control */
41+ ISC_CID_R_GAIN = (V4L2_CID_USER_ATMEL_ISC_BASE + 0),
42+ /* Blue component gain control */
43+ ISC_CID_B_GAIN,
44+ /* Green Red component gain control */
45+ ISC_CID_GR_GAIN,
46+ /* Green Blue gain control */
47+ ISC_CID_GB_GAIN,
48+ /* Red component offset control */
49+ ISC_CID_R_OFFSET,
50+ /* Blue component offset control */
51+ ISC_CID_B_OFFSET,
52+ /* Green Red component offset control */
53+ ISC_CID_GR_OFFSET,
54+ /* Green Blue component offset control */
55+ ISC_CID_GB_OFFSET,
56+};
57+
58+#endif
include/linux/binfmts.h+7−1
@@ -44,7 +44,13 @@ struct linux_binprm { · 43 unmodified lines
4444 * exec has happened. Used to sanitize execution environment
4545 * and to set AT_SECURE auxv for glibc.
4646 */
47− secureexec:1;
47+ secureexec:1,
48+ /*
49+ * Set by flush_old_exec, when exec_mmap has been called.
50+ * This is past the point of no return, when the
51+ * exec_update_mutex has been taken.
52+ */
53+ called_exec_mmap:1;
4854 #ifdef __alpha__
4955 unsigned int taso:1;
5056 #endif
include/linux/bio.h+1−14
@@ -441,14 +441,6 @@ void __bio_add_page(struct bio *bio, struct page *page, · 440 unmodified lines
441441 unsigned int len, unsigned int off);
442442 int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);
443443 void bio_release_pages(struct bio *bio, bool mark_dirty);
444−struct rq_map_data;
445−extern struct bio *bio_map_user_iov(struct request_queue *,
446− struct iov_iter *, gfp_t);
447−extern void bio_unmap_user(struct bio *);
448−extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
449− gfp_t);
450−extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
451− gfp_t, int);
452444 extern void bio_set_pages_dirty(struct bio *bio);
453445 extern void bio_check_pages_dirty(struct bio *bio);
454446
@@ -463,14 +455,9 @@ extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, · 8 unmodified lines
463455 extern void bio_copy_data(struct bio *dst, struct bio *src);
464456 extern void bio_list_copy_data(struct bio *dst, struct bio *src);
465457 extern void bio_free_pages(struct bio *bio);
466−
467−extern struct bio *bio_copy_user_iov(struct request_queue *,
468− struct rq_map_data *,
469− struct iov_iter *,
470− gfp_t);
471−extern int bio_uncopy_user(struct bio *);
472458 void zero_fill_bio_iter(struct bio *bio, struct bvec_iter iter);
473459 void bio_truncate(struct bio *bio, unsigned new_size);
460+void guard_bio_eod(struct bio *bio);
474461
475462 static inline void zero_fill_bio(struct bio *bio)
476463 {
include/linux/bitfield.h+14−0
@@ -55,6 +55,19 @@ · 54 unmodified lines
5555 (1ULL << __bf_shf(_mask))); \
5656 })
5757
58+/**
59+ * FIELD_MAX() - produce the maximum value representable by a field
60+ * @_mask: shifted mask defining the field's length and position
61+ *
62+ * FIELD_MAX() returns the maximum value that can be held in the field
63+ * specified by @_mask.
64+ */
65+#define FIELD_MAX(_mask) \
66+ ({ \
67+ __BF_FIELD_CHECK(_mask, 0ULL, 0ULL, "FIELD_MAX: "); \
68+ (typeof(_mask))((_mask) >> __bf_shf(_mask)); \
69+ })
70+
5871 /**
5972 * FIELD_FIT() - check if value fits in the field
6073 * @_mask: shifted mask defining the field's length and position
@@ -110,6 +123,7 @@ static __always_inline u64 field_mask(u64 field) · 49 unmodified lines
110123 {
111124 return field / field_multiplier(field);
112125 }
126+#define field_max(field) ((typeof(field))field_mask(field))
113127 #define ____MAKE_OP(type,base,to,from) \
114128 static __always_inline __##type type##_encode_bits(base v, base field) \
115129 { \
include/linux/bitmap.h+7−1
@@ -50,7 +50,13 @@ · 49 unmodified lines
5050 * bitmap_set(dst, pos, nbits) Set specified bit area
5151 * bitmap_clear(dst, pos, nbits) Clear specified bit area
5252 * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area
53− * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above
53+ * bitmap_find_next_zero_area_off(buf, len, pos, n, mask, mask_off) as above
54+ * bitmap_next_clear_region(map, &start, &end, nbits) Find next clear region
55+ * bitmap_next_set_region(map, &start, &end, nbits) Find next set region
56+ * bitmap_for_each_clear_region(map, rs, re, start, end)
57+ * Iterate over all clear regions
58+ * bitmap_for_each_set_region(map, rs, re, start, end)
59+ * Iterate over all set regions
5460 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
5561 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
5662 * bitmap_cut(dst, src, first, n, nbits) Cut n bits from first, copy rest
include/linux/bitops.h+2−2
@@ -162,7 +162,7 @@ static inline __u8 ror8(__u8 word, unsigned int shift) · 161 unmodified lines
162162 *
163163 * This is safe to use for 16- and 8-bit types as well.
164164 */
165−static inline __s32 sign_extend32(__u32 value, int index)
165+static __always_inline __s32 sign_extend32(__u32 value, int index)
166166 {
167167 __u8 shift = 31 - index;
168168 return (__s32)(value << shift) >> shift;
@@ -173,7 +173,7 @@ static inline __s32 sign_extend32(__u32 value, int index) · 4 unmodified lines
173173 * @value: value to sign extend
174174 * @index: 0 based bit index (0<=index<64) to sign bit
175175 */
176−static inline __s64 sign_extend64(__u64 value, int index)
176+static __always_inline __s64 sign_extend64(__u64 value, int index)
177177 {
178178 __u8 shift = 63 - index;
179179 return (__s64)(value << shift) >> shift;
include/linux/bits.h+21−3
@@ -3,9 +3,9 @@ · 2 unmodified lines
33 #define __LINUX_BITS_H
44
55 #include <linux/const.h>
6+#include <vdso/bits.h>
67 #include <asm/bitsperlong.h>
78
8−#define BIT(nr) (UL(1) << (nr))
99 #define BIT_ULL(nr) (ULL(1) << (nr))
1010 #define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
1111 #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
@@ -18,12 +18,30 @@ · 6 unmodified lines
1818 * position @h. For example
1919 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
2020 */
21−#define GENMASK(h, l) \
21+#if !defined(__ASSEMBLY__) && \
22+ (!defined(CONFIG_CC_IS_GCC) || CONFIG_GCC_VERSION >= 49000)
23+#include <linux/build_bug.h>
24+#define GENMASK_INPUT_CHECK(h, l) \
25+ (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
26+ __builtin_constant_p((l) > (h)), (l) > (h), 0)))
27+#else
28+/*
29+ * BUILD_BUG_ON_ZERO is not available in h files included from asm files,
30+ * disable the input check if that is the case.
31+ */
32+#define GENMASK_INPUT_CHECK(h, l) 0
33+#endif
34+
35+#define __GENMASK(h, l) \
2236 (((~UL(0)) - (UL(1) << (l)) + 1) & \
2337 (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
38+#define GENMASK(h, l) \
39+ (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
2440
25−#define GENMASK_ULL(h, l) \
41+#define __GENMASK_ULL(h, l) \
2642 (((~ULL(0)) - (ULL(1) << (l)) + 1) & \
2743 (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
44+#define GENMASK_ULL(h, l) \
45+ (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
2846
2947 #endif /* __LINUX_BITS_H */
include/linux/blk-cgroup.h+17−26
@@ -46,6 +46,7 @@ struct blkcg_gq; · 45 unmodified lines
4646 struct blkcg {
4747 struct cgroup_subsys_state css;
4848 spinlock_t lock;
49+ refcount_t online_pin;
4950
5051 struct radix_tree_root blkg_tree;
5152 struct blkcg_gq __rcu *blkg_hint;
@@ -56,7 +57,6 @@ struct blkcg { · 4 unmodified lines
5657 struct list_head all_blkcgs_node;
5758 #ifdef CONFIG_CGROUP_WRITEBACK
5859 struct list_head cgwb_list;
59− refcount_t cgwb_refcnt;
6060 #endif
6161 };
6262
@@ -412,47 +412,38 @@ static inline struct blkcg *cpd_to_blkcg(struct blkcg_policy_data *cpd) · 349 unmodified lines
412412
413413 extern void blkcg_destroy_blkgs(struct blkcg *blkcg);
414414
415−#ifdef CONFIG_CGROUP_WRITEBACK
416−
417415 /**
418− * blkcg_cgwb_get - get a reference for blkcg->cgwb_list
416+ * blkcg_pin_online - pin online state
419417 * @blkcg: blkcg of interest
420418 *
421− * This is used to track the number of active wb's related to a blkcg.
419+ * While pinned, a blkcg is kept online. This is primarily used to
420+ * impedance-match blkg and cgwb lifetimes so that blkg doesn't go offline
421+ * while an associated cgwb is still active.
422422 */
423−static inline void blkcg_cgwb_get(struct blkcg *blkcg)
423+static inline void blkcg_pin_online(struct blkcg *blkcg)
424424 {
425− refcount_inc(&blkcg->cgwb_refcnt);
425+ refcount_inc(&blkcg->online_pin);
426426 }
427427
428428 /**
429− * blkcg_cgwb_put - put a reference for @blkcg->cgwb_list
429+ * blkcg_unpin_online - unpin online state
430430 * @blkcg: blkcg of interest
431431 *
432− * This is used to track the number of active wb's related to a blkcg.
433− * When this count goes to zero, all active wb has finished so the
432+ * This is primarily used to impedance-match blkg and cgwb lifetimes so
433+ * that blkg doesn't go offline while an associated cgwb is still active.
434+ * When this count goes to zero, all active cgwbs have finished so the
434435 * blkcg can continue destruction by calling blkcg_destroy_blkgs().
435− * This work may occur in cgwb_release_workfn() on the cgwb_release
436− * workqueue.
437436 */
438−static inline void blkcg_cgwb_put(struct blkcg *blkcg)
437+static inline void blkcg_unpin_online(struct blkcg *blkcg)
439438 {
440− if (refcount_dec_and_test(&blkcg->cgwb_refcnt))
439+ do {
440+ if (!refcount_dec_and_test(&blkcg->online_pin))
441+ break;
441442 blkcg_destroy_blkgs(blkcg);
443+ blkcg = blkcg_parent(blkcg);
444+ } while (blkcg);
442445 }
443446
444−#else
445−
446−static inline void blkcg_cgwb_get(struct blkcg *blkcg) { }
447−
448−static inline void blkcg_cgwb_put(struct blkcg *blkcg)
449−{
450− /* wb isn't being accounted, so trigger destruction right away */
451− blkcg_destroy_blkgs(blkcg);
452−}
453−
454−#endif
455−
456447 /**
457448 * blkg_path - format cgroup path of blkg
458449 * @blkg: blkg of interest
include/linux/blk-mq.h+6−1
@@ -162,7 +162,10 @@ struct blk_mq_hw_ctx { · 161 unmodified lines
162162 struct dentry *sched_debugfs_dir;
163163 #endif
164164
165− /** @hctx_list: List of all hardware queues. */
165+ /**
166+ * @hctx_list: if this hctx is not in use, this is an entry in
167+ * q->unused_hctx_list.
168+ */
166169 struct list_head hctx_list;
167170
168171 /**
@@ -409,6 +412,8 @@ enum { · 240 unmodified lines
409412 << BLK_MQ_F_ALLOC_POLICY_START_BIT)
410413
411414 struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
415+struct request_queue *blk_mq_init_queue_data(struct blk_mq_tag_set *set,
416+ void *queuedata);
412417 struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
413418 struct request_queue *q,
414419 bool elevator_init);
include/linux/blkdev.h+6−12
@@ -952,6 +952,10 @@ static inline unsigned int blk_rq_stats_sectors(const struct request *rq) · 951 unmodified lines
952952 }
953953
954954 #ifdef CONFIG_BLK_DEV_ZONED
955+
956+/* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
957+const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);
958+
955959 static inline unsigned int blk_rq_zone_no(struct request *rq)
956960 {
957961 return blk_queue_zone_no(rq->q, blk_rq_pos(rq));
@@ -1063,7 +1067,6 @@ extern void blk_abort_request(struct request *); · 105 unmodified lines
10631067 * Access functions for manipulating queue properties
10641068 */
10651069 extern void blk_cleanup_queue(struct request_queue *);
1066−extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
10671070 extern void blk_queue_bounce_limit(struct request_queue *, u64);
10681071 extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
10691072 extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int);
@@ -1140,8 +1143,7 @@ extern void blk_dump_rq_flags(struct request *, char *); · 70 unmodified lines
11401143 extern long nr_blockdev_pages(void);
11411144
11421145 bool __must_check blk_get_queue(struct request_queue *);
1143−struct request_queue *blk_alloc_queue(gfp_t);
1144−struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id);
1146+struct request_queue *blk_alloc_queue(make_request_fn make_request, int node_id);
11451147 extern void blk_put_queue(struct request_queue *);
11461148 extern void blk_set_queue_dying(struct request_queue *);
11471149
@@ -1484,15 +1486,6 @@ static inline unsigned int block_size(struct block_device *bdev) · 336 unmodified lines
14841486 return bdev->bd_block_size;
14851487 }
14861488
1487−typedef struct {struct page *v;} Sector;
1488−
1489−unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *);
1490−
1491−static inline void put_dev_sector(Sector p)
1492−{
1493− put_page(p.v);
1494−}
1495−
14961489 int kblockd_schedule_work(struct work_struct *work);
14971490 int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
14981491
@@ -1706,6 +1699,7 @@ struct block_device_operations { · 207 unmodified lines
17061699 void (*swap_slot_free_notify) (struct block_device *, unsigned long);
17071700 int (*report_zones)(struct gendisk *, sector_t sector,
17081701 unsigned int nr_zones, report_zones_cb cb, void *data);
1702+ char *(*devnode)(struct gendisk *disk, umode_t *mode);
17091703 struct module *owner;
17101704 const struct pr_ops *pr_ops;
17111705 };
include/linux/bootconfig.h+2−1
@@ -216,7 +216,8 @@ static inline int __init xbc_node_compose_key(struct xbc_node *node, · 215 unmodified lines
216216 }
217217
218218 /* XBC node initializer */
219−int __init xbc_init(char *buf);
219+int __init xbc_init(char *buf, const char **emsg, int *epos);
220+
220221
221222 /* XBC cleanup data structures */
222223 void __init xbc_destroy_all(void);
include/linux/bpf-cgroup.h+37−6
@@ -36,7 +36,7 @@ struct bpf_cgroup_storage_map; · 35 unmodified lines
3636
3737 struct bpf_storage_buffer {
3838 struct rcu_head rcu;
39− char data[0];
39+ char data[];
4040 };
4141
4242 struct bpf_cgroup_storage {
@@ -51,9 +51,18 @@ struct bpf_cgroup_storage { · 8 unmodified lines
5151 struct rcu_head rcu;
5252 };
5353
54+struct bpf_cgroup_link {
55+ struct bpf_link link;
56+ struct cgroup *cgroup;
57+ enum bpf_attach_type type;
58+};
59+
60+extern const struct bpf_link_ops bpf_cgroup_link_lops;
61+
5462 struct bpf_prog_list {
5563 struct list_head node;
5664 struct bpf_prog *prog;
65+ struct bpf_cgroup_link *link;
5766 struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE];
5867 };
5968
@@ -84,20 +93,27 @@ struct cgroup_bpf { · 24 unmodified lines
8493 int cgroup_bpf_inherit(struct cgroup *cgrp);
8594 void cgroup_bpf_offline(struct cgroup *cgrp);
8695
87−int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog,
88− struct bpf_prog *replace_prog,
96+int __cgroup_bpf_attach(struct cgroup *cgrp,
97+ struct bpf_prog *prog, struct bpf_prog *replace_prog,
98+ struct bpf_cgroup_link *link,
8999 enum bpf_attach_type type, u32 flags);
90100 int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog,
101+ struct bpf_cgroup_link *link,
91102 enum bpf_attach_type type);
103+int __cgroup_bpf_replace(struct cgroup *cgrp, struct bpf_cgroup_link *link,
104+ struct bpf_prog *new_prog);
92105 int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,
93106 union bpf_attr __user *uattr);
94107
95108 /* Wrapper for __cgroup_bpf_*() protected by cgroup_mutex */
96−int cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog,
97− struct bpf_prog *replace_prog, enum bpf_attach_type type,
109+int cgroup_bpf_attach(struct cgroup *cgrp,
110+ struct bpf_prog *prog, struct bpf_prog *replace_prog,
111+ struct bpf_cgroup_link *link, enum bpf_attach_type type,
98112 u32 flags);
99113 int cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog,
100− enum bpf_attach_type type, u32 flags);
114+ enum bpf_attach_type type);
115+int cgroup_bpf_replace(struct bpf_link *link, struct bpf_prog *old_prog,
116+ struct bpf_prog *new_prog);
101117 int cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,
102118 union bpf_attr __user *uattr);
103119
@@ -332,11 +348,13 @@ int cgroup_bpf_prog_attach(const union bpf_attr *attr, · 228 unmodified lines
332348 enum bpf_prog_type ptype, struct bpf_prog *prog);
333349 int cgroup_bpf_prog_detach(const union bpf_attr *attr,
334350 enum bpf_prog_type ptype);
351+int cgroup_bpf_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);
335352 int cgroup_bpf_prog_query(const union bpf_attr *attr,
336353 union bpf_attr __user *uattr);
337354 #else
338355
339356 struct bpf_prog;
357+struct bpf_link;
340358 struct cgroup_bpf {};
341359 static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; }
342360 static inline void cgroup_bpf_offline(struct cgroup *cgrp) {}
@@ -354,6 +372,19 @@ static inline int cgroup_bpf_prog_detach(const union bpf_attr *attr, · 11 unmodified lines
354372 return -EINVAL;
355373 }
356374
375+static inline int cgroup_bpf_link_attach(const union bpf_attr *attr,
376+ struct bpf_prog *prog)
377+{
378+ return -EINVAL;
379+}
380+
381+static inline int cgroup_bpf_replace(struct bpf_link *link,
382+ struct bpf_prog *old_prog,
383+ struct bpf_prog *new_prog)
384+{
385+ return -EINVAL;
386+}
387+
357388 static inline int cgroup_bpf_prog_query(const union bpf_attr *attr,
358389 union bpf_attr __user *uattr)
359390 {
include/linux/bpf.h+131−33
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/refcount.h>
1919 #include <linux/mutex.h>
2020 #include <linux/module.h>
21+#include <linux/kallsyms.h>
2122
2223 struct bpf_verifier_env;
2324 struct bpf_verifier_log;
@@ -160,6 +161,7 @@ static inline void copy_map_value(struct bpf_map *map, void *dst, void *src) · 136 unmodified lines
160161 }
161162 void copy_map_value_locked(struct bpf_map *map, void *dst, void *src,
162163 bool lock_src);
164+int bpf_obj_name_cpy(char *dst, const char *src, unsigned int size);
163165
164166 struct bpf_offload_dev;
165167 struct bpf_offloaded_map;
@@ -232,6 +234,7 @@ enum bpf_arg_type { · 66 unmodified lines
232234 ARG_CONST_SIZE_OR_ZERO, /* number of bytes accessed from memory or 0 */
233235
234236 ARG_PTR_TO_CTX, /* pointer to context */
237+ ARG_PTR_TO_CTX_OR_NULL, /* pointer to context or NULL */
235238 ARG_ANYTHING, /* any (initialized) argument is ok */
236239 ARG_PTR_TO_SPIN_LOCK, /* pointer to bpf_spin_lock */
237240 ARG_PTR_TO_SOCK_COMMON, /* pointer to sock_common */
@@ -433,6 +436,16 @@ struct btf_func_model { · 195 unmodified lines
433436 */
434437 #define BPF_TRAMP_F_SKIP_FRAME BIT(2)
435438
439+/* Each call __bpf_prog_enter + call bpf_func + call __bpf_prog_exit is ~50
440+ * bytes on x86. Pick a number to fit into BPF_IMAGE_SIZE / 2
441+ */
442+#define BPF_MAX_TRAMP_PROGS 40
443+
444+struct bpf_tramp_progs {
445+ struct bpf_prog *progs[BPF_MAX_TRAMP_PROGS];
446+ int nr_progs;
447+};
448+
436449 /* Different use cases for BPF trampoline:
437450 * 1. replace nop at the function entry (kprobe equivalent)
438451 * flags = BPF_TRAMP_F_RESTORE_REGS
@@ -455,16 +468,25 @@ struct btf_func_model { · 16 unmodified lines
455468 */
456469 int arch_prepare_bpf_trampoline(void *image, void *image_end,
457470 const struct btf_func_model *m, u32 flags,
458− struct bpf_prog **fentry_progs, int fentry_cnt,
459− struct bpf_prog **fexit_progs, int fexit_cnt,
471+ struct bpf_tramp_progs *tprogs,
460472 void *orig_call);
461473 /* these two functions are called from generated trampoline */
462474 u64 notrace __bpf_prog_enter(void);
463475 void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start);
464476
477+struct bpf_ksym {
478+ unsigned long start;
479+ unsigned long end;
480+ char name[KSYM_NAME_LEN];
481+ struct list_head lnode;
482+ struct latch_tree_node tnode;
483+ bool prog;
484+};
485+
465486 enum bpf_tramp_prog_type {
466487 BPF_TRAMP_FENTRY,
467488 BPF_TRAMP_FEXIT,
489+ BPF_TRAMP_MODIFY_RETURN,
468490 BPF_TRAMP_MAX,
469491 BPF_TRAMP_REPLACE, /* more than MAX */
470492 };
@@ -493,6 +515,7 @@ struct bpf_trampoline { · 22 unmodified lines
493515 /* Executable image of trampoline */
494516 void *image;
495517 u64 selector;
518+ struct bpf_ksym ksym;
496519 };
497520
498521 #define BPF_DISPATCHER_MAX 48 /* Fits in 2048B */
@@ -510,9 +533,10 @@ struct bpf_dispatcher { · 11 unmodified lines
510533 int num_progs;
511534 void *image;
512535 u32 image_off;
536+ struct bpf_ksym ksym;
513537 };
514538
515−static __always_inline unsigned int bpf_dispatcher_nopfunc(
539+static __always_inline unsigned int bpf_dispatcher_nop_func(
516540 const void *ctx,
517541 const struct bpf_insn *insnsi,
518542 unsigned int (*bpf_func)(const void *,
@@ -525,17 +549,21 @@ struct bpf_trampoline *bpf_trampoline_lookup(u64 key); · 6 unmodified lines
525549 int bpf_trampoline_link_prog(struct bpf_prog *prog);
526550 int bpf_trampoline_unlink_prog(struct bpf_prog *prog);
527551 void bpf_trampoline_put(struct bpf_trampoline *tr);
528−#define BPF_DISPATCHER_INIT(name) { \
529− .mutex = __MUTEX_INITIALIZER(name.mutex), \
530− .func = &name##func, \
531− .progs = {}, \
532− .num_progs = 0, \
533− .image = NULL, \
534− .image_off = 0 \
552+#define BPF_DISPATCHER_INIT(_name) { \
553+ .mutex = __MUTEX_INITIALIZER(_name.mutex), \
554+ .func = &_name##_func, \
555+ .progs = {}, \
556+ .num_progs = 0, \
557+ .image = NULL, \
558+ .image_off = 0, \
559+ .ksym = { \
560+ .name = #_name, \
561+ .lnode = LIST_HEAD_INIT(_name.ksym.lnode), \
562+ }, \
535563 }
536564
537565 #define DEFINE_BPF_DISPATCHER(name) \
538− noinline unsigned int name##func( \
566+ noinline unsigned int bpf_dispatcher_##name##_func( \
539567 const void *ctx, \
540568 const struct bpf_insn *insnsi, \
541569 unsigned int (*bpf_func)(const void *, \
@@ -543,26 +571,26 @@ void bpf_trampoline_put(struct bpf_trampoline *tr); · 1 unmodified line
543571 { \
544572 return bpf_func(ctx, insnsi); \
545573 } \
546− EXPORT_SYMBOL(name##func); \
547− struct bpf_dispatcher name = BPF_DISPATCHER_INIT(name);
574+ EXPORT_SYMBOL(bpf_dispatcher_##name##_func); \
575+ struct bpf_dispatcher bpf_dispatcher_##name = \
576+ BPF_DISPATCHER_INIT(bpf_dispatcher_##name);
548577 #define DECLARE_BPF_DISPATCHER(name) \
549− unsigned int name##func( \
578+ unsigned int bpf_dispatcher_##name##_func( \
550579 const void *ctx, \
551580 const struct bpf_insn *insnsi, \
552581 unsigned int (*bpf_func)(const void *, \
553582 const struct bpf_insn *)); \
554− extern struct bpf_dispatcher name;
555−#define BPF_DISPATCHER_FUNC(name) name##func
556−#define BPF_DISPATCHER_PTR(name) (&name)
583+ extern struct bpf_dispatcher bpf_dispatcher_##name;
584+#define BPF_DISPATCHER_FUNC(name) bpf_dispatcher_##name##_func
585+#define BPF_DISPATCHER_PTR(name) (&bpf_dispatcher_##name)
557586 void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from,
558587 struct bpf_prog *to);
559−struct bpf_image {
560− struct latch_tree_node tnode;
561− unsigned char data[];
562−};
563−#define BPF_IMAGE_SIZE (PAGE_SIZE - sizeof(struct bpf_image))
564−bool is_bpf_image_address(unsigned long address);
565−void *bpf_image_alloc(void);
588+/* Called only from JIT-enabled code, so there's no need for stubs. */
589+void *bpf_jit_alloc_exec_page(void);
590+void bpf_image_ksym_add(void *data, struct bpf_ksym *ksym);
591+void bpf_image_ksym_del(struct bpf_ksym *ksym);
592+void bpf_ksym_add(struct bpf_ksym *ksym);
593+void bpf_ksym_del(struct bpf_ksym *ksym);
566594 #else
567595 static inline struct bpf_trampoline *bpf_trampoline_lookup(u64 key)
568596 {
@@ -579,7 +607,7 @@ static inline int bpf_trampoline_unlink_prog(struct bpf_prog *prog) · 10 unmodified lines
579607 static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {}
580608 #define DEFINE_BPF_DISPATCHER(name)
581609 #define DECLARE_BPF_DISPATCHER(name)
582−#define BPF_DISPATCHER_FUNC(name) bpf_dispatcher_nopfunc
610+#define BPF_DISPATCHER_FUNC(name) bpf_dispatcher_nop_func
583611 #define BPF_DISPATCHER_PTR(name) NULL
584612 static inline void bpf_dispatcher_change_prog(struct bpf_dispatcher *d,
585613 struct bpf_prog *from,
@@ -640,8 +668,7 @@ struct bpf_prog_aux { · 54 unmodified lines
640668 void *jit_data; /* JIT specific data. arch dependent */
641669 struct bpf_jit_poke_descriptor *poke_tab;
642670 u32 size_poke_tab;
643− struct latch_tree_node ksym_tnode;
644− struct list_head ksym_lnode;
671+ struct bpf_ksym ksym;
645672 const struct bpf_prog_ops *ops;
646673 struct bpf_map **used_maps;
647674 struct bpf_prog *prog;
@@ -859,7 +886,7 @@ struct bpf_prog_array_item { · 211 unmodified lines
859886
860887 struct bpf_prog_array {
861888 struct rcu_head rcu;
862− struct bpf_prog_array_item items[0];
889+ struct bpf_prog_array_item items[];
863890 };
864891
865892 struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags);
@@ -885,7 +912,7 @@ int bpf_prog_array_copy(struct bpf_prog_array *old_array, · 19 unmodified lines
885912 struct bpf_prog *_prog; \
886913 struct bpf_prog_array *_array; \
887914 u32 _ret = 1; \
888− preempt_disable(); \
915+ migrate_disable(); \
889916 rcu_read_lock(); \
890917 _array = rcu_dereference(array); \
891918 if (unlikely(check_non_null && !_array))\
@@ -898,7 +925,7 @@ int bpf_prog_array_copy(struct bpf_prog_array *old_array, · 6 unmodified lines
898925 } \
899926 _out: \
900927 rcu_read_unlock(); \
901− preempt_enable(); \
928+ migrate_enable(); \
902929 _ret; \
903930 })
904931
@@ -932,7 +959,7 @@ _out: \ · 27 unmodified lines
932959 u32 ret; \
933960 u32 _ret = 1; \
934961 u32 _cn = 0; \
935− preempt_disable(); \
962+ migrate_disable(); \
936963 rcu_read_lock(); \
937964 _array = rcu_dereference(array); \
938965 _item = &_array->items[0]; \
@@ -944,7 +971,7 @@ _out: \ · 5 unmodified lines
944971 _item++; \
945972 } \
946973 rcu_read_unlock(); \
947− preempt_enable(); \
974+ migrate_enable(); \
948975 if (_ret) \
949976 _ret = (_cn ? NET_XMIT_CN : NET_XMIT_SUCCESS); \
950977 else \
@@ -961,6 +988,36 @@ _out: \ · 10 unmodified lines
961988 #ifdef CONFIG_BPF_SYSCALL
962989 DECLARE_PER_CPU(int, bpf_prog_active);
963990
991+/*
992+ * Block execution of BPF programs attached to instrumentation (perf,
993+ * kprobes, tracepoints) to prevent deadlocks on map operations as any of
994+ * these events can happen inside a region which holds a map bucket lock
995+ * and can deadlock on it.
996+ *
997+ * Use the preemption safe inc/dec variants on RT because migrate disable
998+ * is preemptible on RT and preemption in the middle of the RMW operation
999+ * might lead to inconsistent state. Use the raw variants for non RT
1000+ * kernels as migrate_disable() maps to preempt_disable() so the slightly
1001+ * more expensive save operation can be avoided.
1002+ */
1003+static inline void bpf_disable_instrumentation(void)
1004+{
1005+ migrate_disable();
1006+ if (IS_ENABLED(CONFIG_PREEMPT_RT))
1007+ this_cpu_inc(bpf_prog_active);
1008+ else
1009+ __this_cpu_inc(bpf_prog_active);
1010+}
1011+
1012+static inline void bpf_enable_instrumentation(void)
1013+{
1014+ if (IS_ENABLED(CONFIG_PREEMPT_RT))
1015+ this_cpu_dec(bpf_prog_active);
1016+ else
1017+ __this_cpu_dec(bpf_prog_active);
1018+ migrate_enable();
1019+}
1020+
9641021 extern const struct file_operations bpf_map_fops;
9651022 extern const struct file_operations bpf_prog_fops;
9661023
@@ -993,6 +1050,7 @@ void __bpf_free_used_maps(struct bpf_prog_aux *aux, · 26 unmodified lines
9931050 void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock);
9941051 void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock);
9951052
1053+struct bpf_map *bpf_map_get(u32 ufd);
9961054 struct bpf_map *bpf_map_get_with_uref(u32 ufd);
9971055 struct bpf_map *__bpf_map_get(struct fd f);
9981056 void bpf_map_inc(struct bpf_map *map);
@@ -1025,6 +1083,29 @@ extern int sysctl_unprivileged_bpf_disabled; · 26 unmodified lines
10251083 int bpf_map_new_fd(struct bpf_map *map, int flags);
10261084 int bpf_prog_new_fd(struct bpf_prog *prog);
10271085
1086+struct bpf_link {
1087+ atomic64_t refcnt;
1088+ const struct bpf_link_ops *ops;
1089+ struct bpf_prog *prog;
1090+ struct work_struct work;
1091+};
1092+
1093+struct bpf_link_ops {
1094+ void (*release)(struct bpf_link *link);
1095+ void (*dealloc)(struct bpf_link *link);
1096+
1097+};
1098+
1099+void bpf_link_init(struct bpf_link *link, const struct bpf_link_ops *ops,
1100+ struct bpf_prog *prog);
1101+void bpf_link_cleanup(struct bpf_link *link, struct file *link_file,
1102+ int link_fd);
1103+void bpf_link_inc(struct bpf_link *link);
1104+void bpf_link_put(struct bpf_link *link);
1105+int bpf_link_new_fd(struct bpf_link *link);
1106+struct file *bpf_link_new_file(struct bpf_link *link, int *reserved_fd);
1107+struct bpf_link *bpf_link_get_from_fd(u32 ufd);
1108+
10281109 int bpf_obj_pin_user(u32 ufd, const char __user *pathname);
10291110 int bpf_obj_get_user(const char __user *pathname, int flags);
10301111
@@ -1102,6 +1183,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, · 71 unmodified lines
11021183 union bpf_attr __user *uattr);
11031184 int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
11041185 union bpf_attr __user *uattr);
1186+int bpf_prog_test_run_tracing(struct bpf_prog *prog,
1187+ const union bpf_attr *kattr,
1188+ union bpf_attr __user *uattr);
11051189 int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
11061190 const union bpf_attr *kattr,
11071191 union bpf_attr __user *uattr);
@@ -1259,6 +1343,13 @@ static inline int bpf_prog_test_run_skb(struct bpf_prog *prog, · 151 unmodified lines
12591343 return -ENOTSUPP;
12601344 }
12611345
1346+static inline int bpf_prog_test_run_tracing(struct bpf_prog *prog,
1347+ const union bpf_attr *kattr,
1348+ union bpf_attr __user *uattr)
1349+{
1350+ return -ENOTSUPP;
1351+}
1352+
12621353 static inline int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
12631354 const union bpf_attr *kattr,
12641355 union bpf_attr __user *uattr)
@@ -1355,6 +1446,8 @@ static inline void bpf_map_offload_map_free(struct bpf_map *map) · 90 unmodified lines
13551446 #if defined(CONFIG_BPF_STREAM_PARSER)
13561447 int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, u32 which);
13571448 int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog);
1449+void sock_map_unhash(struct sock *sk);
1450+void sock_map_close(struct sock *sk, long timeout);
13581451 #else
13591452 static inline int sock_map_prog_update(struct bpf_map *map,
13601453 struct bpf_prog *prog, u32 which)
@@ -1367,7 +1460,7 @@ static inline int sock_map_get_from_fd(const union bpf_attr *attr, · 6 unmodified lines
13671460 {
13681461 return -EINVAL;
13691462 }
1370−#endif
1463+#endif /* CONFIG_BPF_STREAM_PARSER */
13711464
13721465 #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL)
13731466 void bpf_sk_reuseport_detach(struct sock *sk);
@@ -1417,6 +1510,7 @@ extern const struct bpf_func_proto bpf_get_stack_proto; · 43 unmodified lines
14171510 extern const struct bpf_func_proto bpf_sock_map_update_proto;
14181511 extern const struct bpf_func_proto bpf_sock_hash_update_proto;
14191512 extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto;
1513+extern const struct bpf_func_proto bpf_get_current_ancestor_cgroup_id_proto;
14201514 extern const struct bpf_func_proto bpf_msg_redirect_hash_proto;
14211515 extern const struct bpf_func_proto bpf_msg_redirect_map_proto;
14221516 extern const struct bpf_func_proto bpf_sk_redirect_hash_proto;
@@ -1428,6 +1522,10 @@ extern const struct bpf_func_proto bpf_strtol_proto; · 5 unmodified lines
14281522 extern const struct bpf_func_proto bpf_strtoul_proto;
14291523 extern const struct bpf_func_proto bpf_tcp_sock_proto;
14301524 extern const struct bpf_func_proto bpf_jiffies64_proto;
1525+extern const struct bpf_func_proto bpf_get_ns_current_pid_tgid_proto;
1526+
1527+const struct bpf_func_proto *bpf_tracing_func_proto(
1528+ enum bpf_func_id func_id, const struct bpf_prog *prog);
14311529
14321530 /* Shared helpers among cBPF and eBPF. */
14331531 void bpf_user_rnd_init_once(void);
include/linux/bpf_lsm.h+33−0
@@ -0,0 +1,33 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+
3+/*
4+ * Copyright (C) 2020 Google LLC.
5+ */
6+
7+#ifndef _LINUX_BPF_LSM_H
8+#define _LINUX_BPF_LSM_H
9+
10+#include <linux/bpf.h>
11+#include <linux/lsm_hooks.h>
12+
13+#ifdef CONFIG_BPF_LSM
14+
15+#define LSM_HOOK(RET, DEFAULT, NAME, ...) \
16+ RET bpf_lsm_##NAME(__VA_ARGS__);
17+#include <linux/lsm_hook_defs.h>
18+#undef LSM_HOOK
19+
20+int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
21+ const struct bpf_prog *prog);
22+
23+#else /* !CONFIG_BPF_LSM */
24+
25+static inline int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
26+ const struct bpf_prog *prog)
27+{
28+ return -EOPNOTSUPP;
29+}
30+
31+#endif /* CONFIG_BPF_LSM */
32+
33+#endif /* _LINUX_BPF_LSM_H */
include/linux/bpf_types.h+4−0
@@ -70,6 +70,10 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_STRUCT_OPS, bpf_struct_ops, · 69 unmodified lines
7070 void *, void *)
7171 BPF_PROG_TYPE(BPF_PROG_TYPE_EXT, bpf_extension,
7272 void *, void *)
73+#ifdef CONFIG_BPF_LSM
74+BPF_PROG_TYPE(BPF_PROG_TYPE_LSM, lsm,
75+ void *, void *)
76+#endif /* CONFIG_BPF_LSM */
7377 #endif
7478
7579 BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops)
include/linux/bpf_verifier.h+4−0
@@ -123,6 +123,10 @@ struct bpf_reg_state { · 122 unmodified lines
123123 s64 smax_value; /* maximum possible (s64)value */
124124 u64 umin_value; /* minimum possible (u64)value */
125125 u64 umax_value; /* maximum possible (u64)value */
126+ s32 s32_min_value; /* minimum possible (s32)value */
127+ s32 s32_max_value; /* maximum possible (s32)value */
128+ u32 u32_min_value; /* minimum possible (u32)value */
129+ u32 u32_max_value; /* maximum possible (u32)value */
126130 /* parentage chain for liveness checking */
127131 struct bpf_reg_state *parent;
128132 /* Inside the callee two registers can be both PTR_TO_STACK like
include/linux/brcmphy.h+2−0
@@ -79,6 +79,7 @@ · 78 unmodified lines
7979 #define MII_BCM54XX_ECR 0x10 /* BCM54xx extended control register */
8080 #define MII_BCM54XX_ECR_IM 0x1000 /* Interrupt mask */
8181 #define MII_BCM54XX_ECR_IF 0x0800 /* Interrupt force */
82+#define MII_BCM54XX_ECR_FIFOE 0x0001 /* FIFO elasticity */
8283
8384 #define MII_BCM54XX_ESR 0x11 /* BCM54xx extended status register */
8485 #define MII_BCM54XX_ESR_IS 0x1000 /* Interrupt status */
@@ -119,6 +120,7 @@ · 34 unmodified lines
119120 #define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x00
120121 #define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400
121122 #define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800
123+#define MII_BCM54XX_AUXCTL_ACTL_EXT_PKT_LEN 0x4000
122124
123125 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x07
124126 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN 0x0010
include/linux/buffer_head.h+3−3
@@ -22,9 +22,6 @@ enum bh_state_bits { · 21 unmodified lines
2222 BH_Dirty, /* Is dirty */
2323 BH_Lock, /* Is locked */
2424 BH_Req, /* Has been submitted for I/O */
25− BH_Uptodate_Lock,/* Used by the first bh in a page, to serialise
26− * IO completion of other buffers in the page
27− */
2825
2926 BH_Mapped, /* Has a disk mapping */
3027 BH_New, /* Disk mapping was newly created by get_block */
@@ -76,6 +73,9 @@ struct buffer_head { · 45 unmodified lines
7673 struct address_space *b_assoc_map; /* mapping this buffer is
7774 associated with */
7875 atomic_t b_count; /* users using this buffer_head */
76+ spinlock_t b_uptodate_lock; /* Used by the first bh in a page, to
77+ * serialise IO completion of other
78+ * buffers in the page */
7979 };
8080
8181 /*
include/linux/ceph/ceph_fs.h+16−2
@@ -444,8 +444,9 @@ union ceph_mds_request_args { · 443 unmodified lines
444444 } __attribute__ ((packed)) lookupino;
445445 } __attribute__ ((packed));
446446
447−#define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
448−#define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */
447+#define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
448+#define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */
449+#define CEPH_MDS_FLAG_ASYNC 4 /* request is asynchronous */
449450
450451 struct ceph_mds_request_head {
451452 __le64 oldest_client_tid;
@@ -530,6 +531,9 @@ struct ceph_mds_reply_lease { · 78 unmodified lines
530531 __le32 seq;
531532 } __attribute__ ((packed));
532533
534+#define CEPH_LEASE_VALID (1 | 2) /* old and new bit values */
535+#define CEPH_LEASE_PRIMARY_LINK 4 /* primary linkage */
536+
533537 struct ceph_mds_reply_dirfrag {
534538 __le32 frag; /* fragment */
535539 __le32 auth; /* auth mds, if this is a delegation point */
@@ -564,6 +568,7 @@ struct ceph_filelock { · 28 unmodified lines
564568 #define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
565569 #define CEPH_FILE_MODE_LAZY 4 /* lazy io */
566570 #define CEPH_FILE_MODE_BITS 4
571+#define CEPH_FILE_MODE_MASK ((1 << CEPH_FILE_MODE_BITS) - 1)
567572
568573 int ceph_flags_to_mode(int flags);
569574
@@ -655,10 +660,19 @@ int ceph_flags_to_mode(int flags); · 85 unmodified lines
655660 #define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \
656661 CEPH_CAP_ANY_FILE_WR | CEPH_CAP_FILE_LAZYIO | \
657662 CEPH_CAP_PIN)
663+#define CEPH_CAP_ALL_FILE (CEPH_CAP_PIN | CEPH_CAP_ANY_SHARED | \
664+ CEPH_CAP_AUTH_EXCL | CEPH_CAP_XATTR_EXCL | \
665+ CEPH_CAP_ANY_FILE_RD | CEPH_CAP_ANY_FILE_WR)
658666
659667 #define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
660668 CEPH_LOCK_IXATTR)
661669
670+/* cap masks async dir operations */
671+#define CEPH_CAP_DIR_CREATE CEPH_CAP_FILE_CACHE
672+#define CEPH_CAP_DIR_UNLINK CEPH_CAP_FILE_RD
673+#define CEPH_CAP_ANY_DIR_OPS (CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_RD | \
674+ CEPH_CAP_FILE_WREXTEND | CEPH_CAP_FILE_LAZYIO)
675+
662676 int ceph_caps_for_mode(int mode);
663677
664678 enum {
include/linux/ceph/debugfs.h+0−14
@@ -2,22 +2,8 @@ · 1 unmodified line
22 #ifndef _FS_CEPH_DEBUGFS_H
33 #define _FS_CEPH_DEBUGFS_H
44
5−#include <linux/ceph/ceph_debug.h>
65 #include <linux/ceph/types.h>
76
8−#define CEPH_DEFINE_SHOW_FUNC(name) \
9−static int name##_open(struct inode *inode, struct file *file) \
10−{ \
11− return single_open(file, name, inode->i_private); \
12−} \
13− \
14−static const struct file_operations name##_fops = { \
15− .open = name##_open, \
16− .read = seq_read, \
17− .llseek = seq_lseek, \
18− .release = single_release, \
19−};
20−
217 /* debugfs.c */
228 extern void ceph_debugfs_init(void);
239 extern void ceph_debugfs_cleanup(void);
include/linux/ceph/libceph.h+1−0
@@ -272,6 +272,7 @@ extern struct kmem_cache *ceph_cap_flush_cachep; · 271 unmodified lines
272272 extern struct kmem_cache *ceph_dentry_cachep;
273273 extern struct kmem_cache *ceph_file_cachep;
274274 extern struct kmem_cache *ceph_dir_file_cachep;
275+extern struct kmem_cache *ceph_mds_request_cachep;
275276
276277 /* ceph_common.c */
277278 extern bool libceph_compatible(void *data);
include/linux/ceph/messenger.h+4−3
@@ -175,9 +175,10 @@ struct ceph_msg_data { · 174 unmodified lines
175175 #endif /* CONFIG_BLOCK */
176176 struct ceph_bvec_iter bvec_pos;
177177 struct {
178− struct page **pages; /* NOT OWNER. */
178+ struct page **pages;
179179 size_t length; /* total # bytes */
180180 unsigned int alignment; /* first page */
181+ bool own_pages;
181182 };
182183 struct ceph_pagelist *pagelist;
183184 };
@@ -356,8 +357,8 @@ extern void ceph_con_keepalive(struct ceph_connection *con); · 172 unmodified lines
356357 extern bool ceph_con_keepalive_expired(struct ceph_connection *con,
357358 unsigned long interval);
358359
359−extern void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
360− size_t length, size_t alignment);
360+void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
361+ size_t length, size_t alignment, bool own_pages);
361362 extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg,
362363 struct ceph_pagelist *pagelist);
363364 #ifdef CONFIG_BLOCK
include/linux/ceph/osd_client.h+0−17
@@ -509,23 +509,6 @@ int ceph_osdc_call(struct ceph_osd_client *osdc, · 508 unmodified lines
509509 struct page *req_page, size_t req_len,
510510 struct page **resp_pages, size_t *resp_len);
511511
512−extern int ceph_osdc_readpages(struct ceph_osd_client *osdc,
513− struct ceph_vino vino,
514− struct ceph_file_layout *layout,
515− u64 off, u64 *plen,
516− u32 truncate_seq, u64 truncate_size,
517− struct page **pages, int nr_pages,
518− int page_align);
519−
520−extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
521− struct ceph_vino vino,
522− struct ceph_file_layout *layout,
523− struct ceph_snap_context *sc,
524− u64 off, u64 len,
525− u32 truncate_seq, u64 truncate_size,
526− struct timespec64 *mtime,
527− struct page **pages, int nr_pages);
528−
529512 int ceph_osdc_copy_from(struct ceph_osd_client *osdc,
530513 u64 src_snapid, u64 src_version,
531514 struct ceph_object_id *src_oid,
include/linux/ceph/osdmap.h+4−0
@@ -37,6 +37,9 @@ int ceph_spg_compare(const struct ceph_spg *lhs, const struct ceph_spg *rhs); · 36 unmodified lines
3737 #define CEPH_POOL_FLAG_HASHPSPOOL (1ULL << 0) /* hash pg seed and pool id
3838 together */
3939 #define CEPH_POOL_FLAG_FULL (1ULL << 1) /* pool is full */
40+#define CEPH_POOL_FLAG_FULL_QUOTA (1ULL << 10) /* pool ran out of quota,
41+ will set FULL too */
42+#define CEPH_POOL_FLAG_NEARFULL (1ULL << 11) /* pool is nearfull */
4043
4144 struct ceph_pg_pool_info {
4245 struct rb_node node;
@@ -304,5 +307,6 @@ extern struct ceph_pg_pool_info *ceph_pg_pool_by_id(struct ceph_osdmap *map, · 261 unmodified lines
304307
305308 extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id);
306309 extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name);
310+u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id);
307311
308312 #endif
include/linux/ceph/rados.h+4−2
@@ -143,8 +143,10 @@ extern const char *ceph_osd_state_name(int s); · 142 unmodified lines
143143 /*
144144 * osd map flag bits
145145 */
146−#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */
147−#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */
146+#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC),
147+ not set since ~luminous */
148+#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC),
149+ not set since ~luminous */
148150 #define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
149151 #define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
150152 #define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
include/linux/cgroup-defs.h+8−2
@@ -94,6 +94,11 @@ enum { · 93 unmodified lines
9494 * Enable legacy local memory.events.
9595 */
9696 CGRP_ROOT_MEMORY_LOCAL_EVENTS = (1 << 5),
97+
98+ /*
99+ * Enable recursive subtree protection
100+ */
101+ CGRP_ROOT_MEMORY_RECURSIVE_PROT = (1 << 6),
97102 };
98103
99104 /* cftype->flags */
@@ -628,8 +633,9 @@ struct cgroup_subsys { · 528 unmodified lines
628633 void (*cancel_attach)(struct cgroup_taskset *tset);
629634 void (*attach)(struct cgroup_taskset *tset);
630635 void (*post_attach)(void);
631− int (*can_fork)(struct task_struct *task);
632− void (*cancel_fork)(struct task_struct *task);
636+ int (*can_fork)(struct task_struct *task,
637+ struct css_set *cset);
638+ void (*cancel_fork)(struct task_struct *task, struct css_set *cset);
633639 void (*fork)(struct task_struct *task);
634640 void (*exit)(struct task_struct *task);
635641 void (*release)(struct task_struct *task);
include/linux/cgroup.h+15−9
@@ -27,6 +27,8 @@ · 26 unmodified lines
2727
2828 #include <linux/cgroup-defs.h>
2929
30+struct kernel_clone_args;
31+
3032 #ifdef CONFIG_CGROUPS
3133
3234 /*
@@ -58,10 +60,8 @@ struct css_task_iter { · 25 unmodified lines
5860 struct list_head *tcset_head;
5961
6062 struct list_head *task_pos;
61− struct list_head *tasks_head;
62− struct list_head *mg_tasks_head;
63− struct list_head *dying_tasks_head;
6463
64+ struct list_head *cur_tasks_head;
6565 struct css_set *cur_cset;
6666 struct css_set *cur_dcset;
6767 struct task_struct *cur_task;
@@ -121,9 +121,12 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns, · 53 unmodified lines
121121 struct pid *pid, struct task_struct *tsk);
122122
123123 void cgroup_fork(struct task_struct *p);
124−extern int cgroup_can_fork(struct task_struct *p);
125−extern void cgroup_cancel_fork(struct task_struct *p);
126−extern void cgroup_post_fork(struct task_struct *p);
124+extern int cgroup_can_fork(struct task_struct *p,
125+ struct kernel_clone_args *kargs);
126+extern void cgroup_cancel_fork(struct task_struct *p,
127+ struct kernel_clone_args *kargs);
128+extern void cgroup_post_fork(struct task_struct *p,
129+ struct kernel_clone_args *kargs);
127130 void cgroup_exit(struct task_struct *p);
128131 void cgroup_release(struct task_struct *p);
129132 void cgroup_free(struct task_struct *p);
@@ -707,9 +710,12 @@ static inline int cgroupstats_build(struct cgroupstats *stats, · 577 unmodified lines
707710 struct dentry *dentry) { return -EINVAL; }
708711
709712 static inline void cgroup_fork(struct task_struct *p) {}
710−static inline int cgroup_can_fork(struct task_struct *p) { return 0; }
711−static inline void cgroup_cancel_fork(struct task_struct *p) {}
712−static inline void cgroup_post_fork(struct task_struct *p) {}
713+static inline int cgroup_can_fork(struct task_struct *p,
714+ struct kernel_clone_args *kargs) { return 0; }
715+static inline void cgroup_cancel_fork(struct task_struct *p,
716+ struct kernel_clone_args *kargs) {}
717+static inline void cgroup_post_fork(struct task_struct *p,
718+ struct kernel_clone_args *kargs) {}
713719 static inline void cgroup_exit(struct task_struct *p) {}
714720 static inline void cgroup_release(struct task_struct *p) {}
715721 static inline void cgroup_free(struct task_struct *p) {}
include/linux/clk-provider.h+5−5
@@ -522,9 +522,9 @@ struct clk *clk_register_gate(struct device *dev, const char *name, · 521 unmodified lines
522522 * @clk_gate_flags: gate-specific flags for this clock
523523 * @lock: shared register lock for this clock
524524 */
525−#define clk_hw_register_gate_parent_hw(dev, name, parent_name, flags, reg, \
525+#define clk_hw_register_gate_parent_hw(dev, name, parent_hw, flags, reg, \
526526 bit_idx, clk_gate_flags, lock) \
527− __clk_hw_register_gate((dev), NULL, (name), (parent_name), NULL, \
527+ __clk_hw_register_gate((dev), NULL, (name), NULL, (parent_hw), \
528528 NULL, (flags), (reg), (bit_idx), \
529529 (clk_gate_flags), (lock))
530530 /**
@@ -539,10 +539,10 @@ struct clk *clk_register_gate(struct device *dev, const char *name, · 8 unmodified lines
539539 * @clk_gate_flags: gate-specific flags for this clock
540540 * @lock: shared register lock for this clock
541541 */
542−#define clk_hw_register_gate_parent_data(dev, name, parent_name, flags, reg, \
542+#define clk_hw_register_gate_parent_data(dev, name, parent_data, flags, reg, \
543543 bit_idx, clk_gate_flags, lock) \
544− __clk_hw_register_gate((dev), NULL, (name), (parent_name), NULL, \
545− NULL, (flags), (reg), (bit_idx), \
544+ __clk_hw_register_gate((dev), NULL, (name), NULL, NULL, (parent_data), \
545+ (flags), (reg), (bit_idx), \
546546 (clk_gate_flags), (lock))
547547 void clk_unregister_gate(struct clk *clk);
548548 void clk_hw_unregister_gate(struct clk_hw *hw);
include/linux/clk/at91_pmc.h+23−0
@@ -12,6 +12,9 @@ · 11 unmodified lines
1212 #ifndef AT91_PMC_H
1313 #define AT91_PMC_H
1414
15+#define AT91_PMC_V1 (1) /* PMC version 1 */
16+#define AT91_PMC_V2 (2) /* PMC version 2 [SAM9X60] */
17+
1518 #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
1619 #define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */
1720
@@ -30,16 +33,34 @@ · 12 unmodified lines
3033 #define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */
3134 #define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */
3235
36+#define AT91_PMC_PLL_CTRL0 0x0C /* PLL Control Register 0 [for SAM9X60] */
37+#define AT91_PMC_PLL_CTRL0_ENPLL (1 << 28) /* Enable PLL */
38+#define AT91_PMC_PLL_CTRL0_ENPLLCK (1 << 29) /* Enable PLL clock for PMC */
39+#define AT91_PMC_PLL_CTRL0_ENLOCK (1 << 31) /* Enable PLL lock */
40+
41+#define AT91_PMC_PLL_CTRL1 0x10 /* PLL Control Register 1 [for SAM9X60] */
42+
3343 #define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */
3444 #define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */
3545 #define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */
3646
47+#define AT91_PMC_PLL_ACR 0x18 /* PLL Analog Control Register [for SAM9X60] */
48+#define AT91_PMC_PLL_ACR_DEFAULT_UPLL 0x12020010UL /* Default PLL ACR value for UPLL */
49+#define AT91_PMC_PLL_ACR_DEFAULT_PLLA 0x00020010UL /* Default PLL ACR value for PLLA */
50+#define AT91_PMC_PLL_ACR_UTMIVR (1 << 12) /* UPLL Voltage regulator Control */
51+#define AT91_PMC_PLL_ACR_UTMIBG (1 << 13) /* UPLL Bandgap Control */
52+
3753 #define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */
3854 #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */
3955 #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */
4056 #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */
4157 #define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */
4258
59+#define AT91_PMC_PLL_UPDT 0x1C /* PMC PLL update register [for SAM9X60] */
60+#define AT91_PMC_PLL_UPDT_UPDATE (1 << 8) /* Update PLL settings */
61+#define AT91_PMC_PLL_UPDT_ID (1 << 0) /* PLL ID */
62+#define AT91_PMC_PLL_UPDT_STUPTIM (0xff << 16) /* Startup time */
63+
4364 #define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */
4465 #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
4566 #define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */
@@ -180,6 +201,8 @@ · 134 unmodified lines
180201 #define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */
181202 #define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */
182203
204+#define AT91_PMC_PLL_ISR0 0xEC /* PLL Interrupt Status Register 0 [SAM9X60 only] */
205+
183206 #define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/
184207 #define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */
185208 #define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */
include/linux/clocksource.h+52−41
@@ -23,18 +23,31 @@ · 22 unmodified lines
2323 struct clocksource;
2424 struct module;
2525
26−#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
26+#if defined(CONFIG_ARCH_CLOCKSOURCE_DATA) || \
27+ defined(CONFIG_GENERIC_GETTIMEOFDAY)
2728 #include <asm/clocksource.h>
2829 #endif
2930
31+#include <vdso/clocksource.h>
32+
3033 /**
3134 * struct clocksource - hardware abstraction for a free running counter
3235 * Provides mostly state-free accessors to the underlying hardware.
3336 * This is the structure used for system time.
3437 *
35− * @name: ptr to clocksource name
36− * @list: list head for registration
37− * @rating: rating value for selection (higher is better)
38+ * @read: Returns a cycle value, passes clocksource as argument
39+ * @mask: Bitmask for two's complement
40+ * subtraction of non 64 bit counters
41+ * @mult: Cycle to nanosecond multiplier
42+ * @shift: Cycle to nanosecond divisor (power of two)
43+ * @max_idle_ns: Maximum idle time permitted by the clocksource (nsecs)
44+ * @maxadj: Maximum adjustment value to mult (~11%)
45+ * @archdata: Optional arch-specific data
46+ * @max_cycles: Maximum safe cycle value which won't overflow on
47+ * multiplication
48+ * @name: Pointer to clocksource name
49+ * @list: List head for registration (internal)
50+ * @rating: Rating value for selection (higher is better)
3851 * To avoid rating inflation the following
3952 * list should give you a guide as to how
4053 * to assign your clocksource a rating
@@ -49,27 +62,23 @@ struct module; · 8 unmodified lines
4962 * 400-499: Perfect
5063 * The ideal clocksource. A must-use where
5164 * available.
52− * @read: returns a cycle value, passes clocksource as argument
53− * @enable: optional function to enable the clocksource
54− * @disable: optional function to disable the clocksource
55− * @mask: bitmask for two's complement
56− * subtraction of non 64 bit counters
57− * @mult: cycle to nanosecond multiplier
58− * @shift: cycle to nanosecond divisor (power of two)
59− * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
60− * @maxadj: maximum adjustment value to mult (~11%)
61− * @max_cycles: maximum safe cycle value which won't overflow on multiplication
62− * @flags: flags describing special properties
63− * @archdata: arch-specific data
64− * @suspend: suspend function for the clocksource, if necessary
65− * @resume: resume function for the clocksource, if necessary
65+ * @flags: Flags describing special properties
66+ * @enable: Optional function to enable the clocksource
67+ * @disable: Optional function to disable the clocksource
68+ * @suspend: Optional suspend function for the clocksource
69+ * @resume: Optional resume function for the clocksource
6670 * @mark_unstable: Optional function to inform the clocksource driver that
6771 * the watchdog marked the clocksource unstable
68− * @owner: module reference, must be set by clocksource in modules
72+ * @tick_stable: Optional function called periodically from the watchdog
73+ * code to provide stable syncrhonization points
74+ * @wd_list: List head to enqueue into the watchdog list (internal)
75+ * @cs_last: Last clocksource value for clocksource watchdog
76+ * @wd_last: Last watchdog value corresponding to @cs_last
77+ * @owner: Module reference, must be set by clocksource in modules
6978 *
7079 * Note: This struct is not used in hotpathes of the timekeeping code
7180 * because the timekeeper caches the hot path fields in its own data
72− * structure, so no line cache alignment is required,
81+ * structure, so no cache line alignment is required,
7382 *
7483 * The pointer to the clocksource itself is handed to the read
7584 * callback. If you need extra information there you can wrap struct
@@ -78,35 +87,37 @@ struct module; · 2 unmodified lines
7887 * structure.
7988 */
8089 struct clocksource {
81− u64 (*read)(struct clocksource *cs);
82− u64 mask;
83− u32 mult;
84− u32 shift;
85− u64 max_idle_ns;
86− u32 maxadj;
90+ u64 (*read)(struct clocksource *cs);
91+ u64 mask;
92+ u32 mult;
93+ u32 shift;
94+ u64 max_idle_ns;
95+ u32 maxadj;
8796 #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
8897 struct arch_clocksource_data archdata;
8998 #endif
90− u64 max_cycles;
91− const char *name;
92− struct list_head list;
93− int rating;
94− int (*enable)(struct clocksource *cs);
95− void (*disable)(struct clocksource *cs);
96− unsigned long flags;
97− void (*suspend)(struct clocksource *cs);
98− void (*resume)(struct clocksource *cs);
99− void (*mark_unstable)(struct clocksource *cs);
100− void (*tick_stable)(struct clocksource *cs);
99+ u64 max_cycles;
100+ const char *name;
101+ struct list_head list;
102+ int rating;
103+ enum vdso_clock_mode vdso_clock_mode;
104+ unsigned long flags;
105+
106+ int (*enable)(struct clocksource *cs);
107+ void (*disable)(struct clocksource *cs);
108+ void (*suspend)(struct clocksource *cs);
109+ void (*resume)(struct clocksource *cs);
110+ void (*mark_unstable)(struct clocksource *cs);
111+ void (*tick_stable)(struct clocksource *cs);
101112
102113 /* private: */
103114 #ifdef CONFIG_CLOCKSOURCE_WATCHDOG
104115 /* Watchdog related data, used by the framework */
105− struct list_head wd_list;
106− u64 cs_last;
107− u64 wd_last;
116+ struct list_head wd_list;
117+ u64 cs_last;
118+ u64 wd_last;
108119 #endif
109− struct module *owner;
120+ struct module *owner;
110121 };
111122
112123 /*
include/linux/cma.h+12−2
@@ -4,6 +4,7 @@ · 3 unmodified lines
44
55 #include <linux/init.h>
66 #include <linux/types.h>
7+#include <linux/numa.h>
78
89 /*
910 * There is always at least global CMA area and a few optional
@@ -24,10 +25,19 @@ extern phys_addr_t cma_get_base(const struct cma *cma); · 14 unmodified lines
2425 extern unsigned long cma_get_size(const struct cma *cma);
2526 extern const char *cma_get_name(const struct cma *cma);
2627
27−extern int __init cma_declare_contiguous(phys_addr_t base,
28+extern int __init cma_declare_contiguous_nid(phys_addr_t base,
2829 phys_addr_t size, phys_addr_t limit,
2930 phys_addr_t alignment, unsigned int order_per_bit,
30− bool fixed, const char *name, struct cma **res_cma);
31+ bool fixed, const char *name, struct cma **res_cma,
32+ int nid);
33+static inline int __init cma_declare_contiguous(phys_addr_t base,
34+ phys_addr_t size, phys_addr_t limit,
35+ phys_addr_t alignment, unsigned int order_per_bit,
36+ bool fixed, const char *name, struct cma **res_cma)
37+{
38+ return cma_declare_contiguous_nid(base, size, limit, alignment,
39+ order_per_bit, fixed, name, res_cma, NUMA_NO_NODE);
40+}
3141 extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
3242 unsigned int order_per_bit,
3343 const char *name,
include/linux/compat.h+5−4
@@ -454,12 +454,13 @@ extern void __user *compat_alloc_user_space(unsigned long len); · 453 unmodified lines
454454
455455 int compat_restore_altstack(const compat_stack_t __user *uss);
456456 int __compat_save_altstack(compat_stack_t __user *, unsigned long);
457−#define compat_save_altstack_ex(uss, sp) do { \
457+#define unsafe_compat_save_altstack(uss, sp, label) do { \
458458 compat_stack_t __user *__uss = uss; \
459459 struct task_struct *t = current; \
460− put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \
461− put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \
462− put_user_ex(t->sas_ss_size, &__uss->ss_size); \
460+ unsafe_put_user(ptr_to_compat((void __user *)t->sas_ss_sp), \
461+ &__uss->ss_sp, label); \
462+ unsafe_put_user(t->sas_ss_flags, &__uss->ss_flags, label); \
463+ unsafe_put_user(t->sas_ss_size, &__uss->ss_size, label); \
463464 if (t->sas_ss_flags & SS_AUTODISARM) \
464465 sas_ss_reset(t); \
465466 } while (0);
include/linux/compiler.h+1−1
@@ -347,7 +347,7 @@ static inline void *offset_to_ptr(const int *off) · 346 unmodified lines
347347 * compiler has support to do so.
348348 */
349349 #define compiletime_assert(condition, msg) \
350− _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
350+ _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
351351
352352 #define compiletime_assert_atomic_type(t) \
353353 compiletime_assert(__native_word(t), \
include/linux/compiler_types.h+1−10
@@ -129,22 +129,13 @@ struct ftrace_likely_data { · 128 unmodified lines
129129 #define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
130130
131131 /*
132− * Force always-inline if the user requests it so via the .config.
133132 * Prefer gnu_inline, so that extern inline functions do not emit an
134133 * externally visible function. This makes extern inline behave as per gnu89
135134 * semantics rather than c99. This prevents multiple symbol definition errors
136135 * of extern inline functions at link time.
137136 * A lot of inline functions can cause havoc with function tracing.
138− * Do not use __always_inline here, since currently it expands to inline again
139− * (which would break users of __always_inline).
140137 */
141−#if !defined(CONFIG_OPTIMIZE_INLINING)
142−#define inline inline __attribute__((__always_inline__)) __gnu_inline \
143− __inline_maybe_unused notrace
144−#else
145−#define inline inline __gnu_inline \
146− __inline_maybe_unused notrace
147−#endif
138+#define inline inline __gnu_inline __inline_maybe_unused notrace
148139
149140 /*
150141 * gcc provides both __inline__ and __inline as alternate spellings of
include/linux/completion.h+4−4
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 * See kernel/sched/completion.c for details.
1010 */
1111
12−#include <linux/wait.h>
12+#include <linux/swait.h>
1313
1414 /*
1515 * struct completion - structure used to maintain state for a "completion"
@@ -25,7 +25,7 @@ · 9 unmodified lines
2525 */
2626 struct completion {
2727 unsigned int done;
28− wait_queue_head_t wait;
28+ struct swait_queue_head wait;
2929 };
3030
3131 #define init_completion_map(x, m) __init_completion(x)
@@ -34,7 +34,7 @@ static inline void complete_acquire(struct completion *x) {} · 2 unmodified lines
3434 static inline void complete_release(struct completion *x) {}
3535
3636 #define COMPLETION_INITIALIZER(work) \
37− { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
37+ { 0, __SWAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
3838
3939 #define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \
4040 (*({ init_completion_map(&(work), &(map)); &(work); }))
@@ -85,7 +85,7 @@ static inline void complete_release(struct completion *x) {} · 44 unmodified lines
8585 static inline void __init_completion(struct completion *x)
8686 {
8787 x->done = 0;
88− init_waitqueue_head(&x->wait);
88+ init_swait_queue_head(&x->wait);
8989 }
9090
9191 /**
include/linux/console.h+1−0
@@ -148,6 +148,7 @@ struct console { · 147 unmodified lines
148148 struct tty_driver *(*device)(struct console *, int *);
149149 void (*unblank)(void);
150150 int (*setup)(struct console *, char *);
151+ int (*exit)(struct console *);
151152 int (*match)(struct console *, char *name, int idx, char *options);
152153 short flags;
153154 short index;
include/linux/const.h+1−4
@@ -1,9 +1,6 @@
11 #ifndef _LINUX_CONST_H
22 #define _LINUX_CONST_H
33
4−#include <uapi/linux/const.h>
5−
6−#define UL(x) (_UL(x))
7−#define ULL(x) (_ULL(x))
4+#include <vdso/const.h>
85
96 #endif /* _LINUX_CONST_H */
include/linux/coresight.h+27−0
@@ -41,6 +41,7 @@ enum coresight_dev_type { · 40 unmodified lines
4141 CORESIGHT_DEV_TYPE_LINKSINK,
4242 CORESIGHT_DEV_TYPE_SOURCE,
4343 CORESIGHT_DEV_TYPE_HELPER,
44+ CORESIGHT_DEV_TYPE_ECT,
4445 };
4546
4647 enum coresight_dev_subtype_sink {
@@ -68,6 +69,12 @@ enum coresight_dev_subtype_helper { · 21 unmodified lines
6869 CORESIGHT_DEV_SUBTYPE_HELPER_CATU,
6970 };
7071
72+/* Embedded Cross Trigger (ECT) sub-types */
73+enum coresight_dev_subtype_ect {
74+ CORESIGHT_DEV_SUBTYPE_ECT_NONE,
75+ CORESIGHT_DEV_SUBTYPE_ECT_CTI,
76+};
77+
7178 /**
7279 * union coresight_dev_subtype - further characterisation of a type
7380 * @sink_subtype: type of sink this component is, as defined
@@ -78,6 +85,8 @@ enum coresight_dev_subtype_helper { · 4 unmodified lines
7885 * by @coresight_dev_subtype_source.
7986 * @helper_subtype: type of helper this component is, as defined
8087 * by @coresight_dev_subtype_helper.
88+ * @ect_subtype: type of cross trigger this component is, as
89+ * defined by @coresight_dev_subtype_ect
8190 */
8291 union coresight_dev_subtype {
8392 /* We have some devices which acts as LINK and SINK */
@@ -87,6 +96,7 @@ union coresight_dev_subtype { · 3 unmodified lines
8796 };
8897 enum coresight_dev_subtype_source source_subtype;
8998 enum coresight_dev_subtype_helper helper_subtype;
99+ enum coresight_dev_subtype_ect ect_subtype;
90100 };
91101
92102 /**
@@ -153,6 +163,8 @@ struct coresight_connection { · 60 unmodified lines
153163 * activated but not yet enabled. Enabling for a _sink_
154164 * appens when a source has been selected for that it.
155165 * @ea: Device attribute for sink representation under PMU directory.
166+ * @ect_dev: Associated cross trigger device. Not part of the trace data
167+ * path or connections.
156168 */
157169 struct coresight_device {
158170 struct coresight_platform_data *pdata;
@@ -166,6 +178,8 @@ struct coresight_device { · 7 unmodified lines
166178 /* sink specific fields */
167179 bool activated; /* true only if a sink is part of a path */
168180 struct dev_ext_attribute *ea;
181+ /* cross trigger handling */
182+ struct coresight_device *ect_dev;
169183 };
170184
171185 /*
@@ -196,6 +210,7 @@ static struct coresight_dev_list (var) = { \ · 24 unmodified lines
196210 #define sink_ops(csdev) csdev->ops->sink_ops
197211 #define link_ops(csdev) csdev->ops->link_ops
198212 #define helper_ops(csdev) csdev->ops->helper_ops
213+#define ect_ops(csdev) csdev->ops->ect_ops
199214
200215 /**
201216 * struct coresight_ops_sink - basic operations for a sink
@@ -262,11 +277,23 @@ struct coresight_ops_helper { · 60 unmodified lines
262277 int (*disable)(struct coresight_device *csdev, void *data);
263278 };
264279
280+/**
281+ * struct coresight_ops_ect - Ops for an embedded cross trigger device
282+ *
283+ * @enable : Enable the device
284+ * @disable : Disable the device
285+ */
286+struct coresight_ops_ect {
287+ int (*enable)(struct coresight_device *csdev);
288+ int (*disable)(struct coresight_device *csdev);
289+};
290+
265291 struct coresight_ops {
266292 const struct coresight_ops_sink *sink_ops;
267293 const struct coresight_ops_link *link_ops;
268294 const struct coresight_ops_source *source_ops;
269295 const struct coresight_ops_helper *helper_ops;
296+ const struct coresight_ops_ect *ect_ops;
270297 };
271298
272299 #ifdef CONFIG_CORESIGHT
include/linux/cpu.h+17−5
@@ -88,10 +88,13 @@ extern ssize_t arch_cpu_release(const char *, size_t); · 87 unmodified lines
8888
8989 #ifdef CONFIG_SMP
9090 extern bool cpuhp_tasks_frozen;
91−int cpu_up(unsigned int cpu);
91+int add_cpu(unsigned int cpu);
92+int cpu_device_up(struct device *dev);
9293 void notify_cpu_starting(unsigned int cpu);
9394 extern void cpu_maps_update_begin(void);
9495 extern void cpu_maps_update_done(void);
96+int bringup_hibernate_cpu(unsigned int sleep_cpu);
97+void bringup_nonboot_cpus(unsigned int setup_max_cpus);
9598
9699 #else /* CONFIG_SMP */
97100 #define cpuhp_tasks_frozen 0
@@ -117,7 +120,9 @@ extern void lockdep_assert_cpus_held(void); · 19 unmodified lines
117120 extern void cpu_hotplug_disable(void);
118121 extern void cpu_hotplug_enable(void);
119122 void clear_tasks_mm_cpumask(int cpu);
120−int cpu_down(unsigned int cpu);
123+int remove_cpu(unsigned int cpu);
124+int cpu_device_down(struct device *dev);
125+extern void smp_shutdown_nonboot_cpus(unsigned int primary_cpu);
121126
122127 #else /* CONFIG_HOTPLUG_CPU */
123128
@@ -129,6 +134,7 @@ static inline int cpus_read_trylock(void) { return true; } · 5 unmodified lines
129134 static inline void lockdep_assert_cpus_held(void) { }
130135 static inline void cpu_hotplug_disable(void) { }
131136 static inline void cpu_hotplug_enable(void) { }
137+static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { }
132138 #endif /* !CONFIG_HOTPLUG_CPU */
133139
134140 /* Wrappers which go away once all code is converted */
@@ -138,12 +144,18 @@ static inline void get_online_cpus(void) { cpus_read_lock(); } · 3 unmodified lines
138144 static inline void put_online_cpus(void) { cpus_read_unlock(); }
139145
140146 #ifdef CONFIG_PM_SLEEP_SMP
141−extern int freeze_secondary_cpus(int primary);
147+int __freeze_secondary_cpus(int primary, bool suspend);
148+static inline int freeze_secondary_cpus(int primary)
149+{
150+ return __freeze_secondary_cpus(primary, true);
151+}
152+
142153 static inline int disable_nonboot_cpus(void)
143154 {
144− return freeze_secondary_cpus(0);
155+ return __freeze_secondary_cpus(0, false);
145156 }
146−extern void enable_nonboot_cpus(void);
157+
158+void enable_nonboot_cpus(void);
147159
148160 static inline int suspend_disable_secondary_cpus(void)
149161 {
include/linux/cpufreq.h+5−0
@@ -205,6 +205,7 @@ static inline bool policy_is_shared(struct cpufreq_policy *policy) · 204 unmodified lines
205205 unsigned int cpufreq_get(unsigned int cpu);
206206 unsigned int cpufreq_quick_get(unsigned int cpu);
207207 unsigned int cpufreq_quick_get_max(unsigned int cpu);
208+unsigned int cpufreq_get_hw_max_freq(unsigned int cpu);
208209 void disable_cpufreq(void);
209210
210211 u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
@@ -232,6 +233,10 @@ static inline unsigned int cpufreq_quick_get_max(unsigned int cpu) · 21 unmodified lines
232233 {
233234 return 0;
234235 }
236+static inline unsigned int cpufreq_get_hw_max_freq(unsigned int cpu)
237+{
238+ return 0;
239+}
235240 static inline void disable_cpufreq(void) { }
236241 #endif
237242
include/linux/cpuhotplug.h+1−0
@@ -102,6 +102,7 @@ enum cpuhp_state { · 101 unmodified lines
102102 CPUHP_AP_IRQ_ARMADA_XP_STARTING,
103103 CPUHP_AP_IRQ_BCM2836_STARTING,
104104 CPUHP_AP_IRQ_MIPS_GIC_STARTING,
105+ CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING,
105106 CPUHP_AP_ARM_MVEBU_COHERENCY,
106107 CPUHP_AP_MICROCODE_LOADER,
107108 CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
include/linux/cpumask.h+7−0
@@ -194,6 +194,11 @@ static inline unsigned int cpumask_local_spread(unsigned int i, int node) · 193 unmodified lines
194194 return 0;
195195 }
196196
197+static inline int cpumask_any_and_distribute(const struct cpumask *src1p,
198+ const struct cpumask *src2p) {
199+ return cpumask_next_and(-1, src1p, src2p);
200+}
201+
197202 #define for_each_cpu(cpu, mask) \
198203 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
199204 #define for_each_cpu_not(cpu, mask) \
@@ -245,6 +250,8 @@ static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) · 45 unmodified lines
245250 int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *);
246251 int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
247252 unsigned int cpumask_local_spread(unsigned int i, int node);
253+int cpumask_any_and_distribute(const struct cpumask *src1p,
254+ const struct cpumask *src2p);
248255
249256 /**
250257 * for_each_cpu - iterate over every cpu in a mask
include/linux/dax.h+7−14
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 typedef unsigned long dax_entry_t;
1414
1515 struct iomap_ops;
16+struct iomap;
1617 struct dax_device;
1718 struct dax_operations {
1819 /*
@@ -34,6 +35,8 @@ struct dax_operations { · 15 unmodified lines
3435 /* copy_to_iter: required operation for fs-dax direct-i/o */
3536 size_t (*copy_to_iter)(struct dax_device *, pgoff_t, void *, size_t,
3637 struct iov_iter *);
38+ /* zero_page_range: required operation. Zero page range */
39+ int (*zero_page_range)(struct dax_device *, pgoff_t, size_t);
3740 };
3841
3942 extern struct attribute_group dax_attribute_group;
@@ -199,6 +202,8 @@ size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, · 159 unmodified lines
199202 size_t bytes, struct iov_iter *i);
200203 size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
201204 size_t bytes, struct iov_iter *i);
205+int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff,
206+ size_t nr_pages);
202207 void dax_flush(struct dax_device *dax_dev, void *addr, size_t size);
203208
204209 ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
@@ -210,20 +215,8 @@ vm_fault_t dax_finish_sync_fault(struct vm_fault *vmf, · 5 unmodified lines
210215 int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
211216 int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
212217 pgoff_t index);
213−
214−#ifdef CONFIG_FS_DAX
215−int __dax_zero_page_range(struct block_device *bdev,
216− struct dax_device *dax_dev, sector_t sector,
217− unsigned int offset, unsigned int length);
218−#else
219−static inline int __dax_zero_page_range(struct block_device *bdev,
220− struct dax_device *dax_dev, sector_t sector,
221− unsigned int offset, unsigned int length)
222−{
223− return -ENXIO;
224−}
225−#endif
226−
218+int dax_iomap_zero(loff_t pos, unsigned offset, unsigned size,
219+ struct iomap *iomap);
227220 static inline bool dax_mapping(struct address_space *mapping)
228221 {
229222 return mapping->host && IS_DAX(mapping->host);
include/linux/dccp.h+1−1
@@ -198,7 +198,7 @@ enum dccp_role { · 197 unmodified lines
198198
199199 struct dccp_service_list {
200200 __u32 dccpsl_nr;
201− __be32 dccpsl_list[0];
201+ __be32 dccpsl_list[];
202202 };
203203
204204 #define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
include/linux/debugfs.h+10−11
@@ -35,6 +35,7 @@ struct debugfs_regset32 { · 34 unmodified lines
3535 const struct debugfs_reg32 *regs;
3636 int nregs;
3737 void __iomem *base;
38+ struct device *dev; /* Optional device for Runtime PM */
3839 };
3940
4041 extern struct dentry *arch_debugfs_dir;
@@ -67,10 +68,10 @@ struct dentry *debugfs_create_file_unsafe(const char *name, umode_t mode, · 26 unmodified lines
6768 struct dentry *parent, void *data,
6869 const struct file_operations *fops);
6970
70−struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
71− struct dentry *parent, void *data,
72− const struct file_operations *fops,
73− loff_t file_size);
71+void debugfs_create_file_size(const char *name, umode_t mode,
72+ struct dentry *parent, void *data,
73+ const struct file_operations *fops,
74+ loff_t file_size);
7475
7576 struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
7677
@@ -181,13 +182,11 @@ static inline struct dentry *debugfs_create_file_unsafe(const char *name, · 104 unmodified lines
181182 return ERR_PTR(-ENODEV);
182183 }
183184
184−static inline struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
185− struct dentry *parent, void *data,
186− const struct file_operations *fops,
187− loff_t file_size)
188−{
189− return ERR_PTR(-ENODEV);
190−}
185+static inline void debugfs_create_file_size(const char *name, umode_t mode,
186+ struct dentry *parent, void *data,
187+ const struct file_operations *fops,
188+ loff_t file_size)
189+{ }
191190
192191 static inline struct dentry *debugfs_create_dir(const char *name,
193192 struct dentry *parent)
include/linux/devfreq.h+52−54
@@ -158,7 +158,7 @@ struct devfreq_stats { · 157 unmodified lines
158158 * functions except for the context of callbacks defined in struct
159159 * devfreq_governor, the governor should protect its access with the
160160 * struct mutex lock in struct devfreq. A governor may use this mutex
161− * to protect its own private data in void *data as well.
161+ * to protect its own private data in ``void *data`` as well.
162162 */
163163 struct devfreq {
164164 struct list_head node;
@@ -201,24 +201,23 @@ struct devfreq_freqs { · 36 unmodified lines
201201 };
202202
203203 #if defined(CONFIG_PM_DEVFREQ)
204−extern struct devfreq *devfreq_add_device(struct device *dev,
205− struct devfreq_dev_profile *profile,
206− const char *governor_name,
207− void *data);
208−extern int devfreq_remove_device(struct devfreq *devfreq);
209−extern struct devfreq *devm_devfreq_add_device(struct device *dev,
210− struct devfreq_dev_profile *profile,
211− const char *governor_name,
212− void *data);
213−extern void devm_devfreq_remove_device(struct device *dev,
214− struct devfreq *devfreq);
204+struct devfreq *devfreq_add_device(struct device *dev,
205+ struct devfreq_dev_profile *profile,
206+ const char *governor_name,
207+ void *data);
208+int devfreq_remove_device(struct devfreq *devfreq);
209+struct devfreq *devm_devfreq_add_device(struct device *dev,
210+ struct devfreq_dev_profile *profile,
211+ const char *governor_name,
212+ void *data);
213+void devm_devfreq_remove_device(struct device *dev, struct devfreq *devfreq);
215214
216215 /* Supposed to be called by PM callbacks */
217−extern int devfreq_suspend_device(struct devfreq *devfreq);
218−extern int devfreq_resume_device(struct devfreq *devfreq);
216+int devfreq_suspend_device(struct devfreq *devfreq);
217+int devfreq_resume_device(struct devfreq *devfreq);
219218
220−extern void devfreq_suspend(void);
221−extern void devfreq_resume(void);
219+void devfreq_suspend(void);
220+void devfreq_resume(void);
222221
223222 /**
224223 * update_devfreq() - Reevaluate the device and configure frequency
@@ -226,39 +225,38 @@ extern void devfreq_resume(void); · 1 unmodified line
226225 *
227226 * Note: devfreq->lock must be held
228227 */
229−extern int update_devfreq(struct devfreq *devfreq);
228+int update_devfreq(struct devfreq *devfreq);
230229
231230 /* Helper functions for devfreq user device driver with OPP. */
232−extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
233− unsigned long *freq, u32 flags);
234−extern int devfreq_register_opp_notifier(struct device *dev,
235− struct devfreq *devfreq);
236−extern int devfreq_unregister_opp_notifier(struct device *dev,
237− struct devfreq *devfreq);
238−extern int devm_devfreq_register_opp_notifier(struct device *dev,
239− struct devfreq *devfreq);
240−extern void devm_devfreq_unregister_opp_notifier(struct device *dev,
241− struct devfreq *devfreq);
242−extern int devfreq_register_notifier(struct devfreq *devfreq,
243− struct notifier_block *nb,
244− unsigned int list);
245−extern int devfreq_unregister_notifier(struct devfreq *devfreq,
246− struct notifier_block *nb,
247− unsigned int list);
248−extern int devm_devfreq_register_notifier(struct device *dev,
231+struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
232+ unsigned long *freq, u32 flags);
233+int devfreq_register_opp_notifier(struct device *dev,
234+ struct devfreq *devfreq);
235+int devfreq_unregister_opp_notifier(struct device *dev,
236+ struct devfreq *devfreq);
237+int devm_devfreq_register_opp_notifier(struct device *dev,
238+ struct devfreq *devfreq);
239+void devm_devfreq_unregister_opp_notifier(struct device *dev,
240+ struct devfreq *devfreq);
241+int devfreq_register_notifier(struct devfreq *devfreq,
242+ struct notifier_block *nb,
243+ unsigned int list);
244+int devfreq_unregister_notifier(struct devfreq *devfreq,
245+ struct notifier_block *nb,
246+ unsigned int list);
247+int devm_devfreq_register_notifier(struct device *dev,
249248 struct devfreq *devfreq,
250249 struct notifier_block *nb,
251250 unsigned int list);
252−extern void devm_devfreq_unregister_notifier(struct device *dev,
251+void devm_devfreq_unregister_notifier(struct device *dev,
253252 struct devfreq *devfreq,
254253 struct notifier_block *nb,
255254 unsigned int list);
256−extern struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
257− int index);
255+struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index);
258256
259257 #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
260258 /**
261− * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq
259+ * struct devfreq_simple_ondemand_data - ``void *data`` fed to struct devfreq
262260 * and devfreq_add_device
263261 * @upthreshold: If the load is over this value, the frequency jumps.
264262 * Specify 0 to use the default. Valid value = 0 to 100.
@@ -278,7 +276,7 @@ struct devfreq_simple_ondemand_data { · 13 unmodified lines
278276
279277 #if IS_ENABLED(CONFIG_DEVFREQ_GOV_PASSIVE)
280278 /**
281− * struct devfreq_passive_data - void *data fed to struct devfreq
279+ * struct devfreq_passive_data - ``void *data`` fed to struct devfreq
282280 * and devfreq_add_device
283281 * @parent: the devfreq instance of parent device.
284282 * @get_target_freq: Optional callback, Returns desired operating frequency
@@ -311,9 +309,9 @@ struct devfreq_passive_data { · 26 unmodified lines
311309
312310 #else /* !CONFIG_PM_DEVFREQ */
313311 static inline struct devfreq *devfreq_add_device(struct device *dev,
314− struct devfreq_dev_profile *profile,
315− const char *governor_name,
316− void *data)
312+ struct devfreq_dev_profile *profile,
313+ const char *governor_name,
314+ void *data)
317315 {
318316 return ERR_PTR(-ENOSYS);
319317 }
@@ -350,31 +348,31 @@ static inline void devfreq_suspend(void) {} · 30 unmodified lines
350348 static inline void devfreq_resume(void) {}
351349
352350 static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
353− unsigned long *freq, u32 flags)
351+ unsigned long *freq, u32 flags)
354352 {
355353 return ERR_PTR(-EINVAL);
356354 }
357355
358356 static inline int devfreq_register_opp_notifier(struct device *dev,
359− struct devfreq *devfreq)
357+ struct devfreq *devfreq)
360358 {
361359 return -EINVAL;
362360 }
363361
364362 static inline int devfreq_unregister_opp_notifier(struct device *dev,
365− struct devfreq *devfreq)
363+ struct devfreq *devfreq)
366364 {
367365 return -EINVAL;
368366 }
369367
370368 static inline int devm_devfreq_register_opp_notifier(struct device *dev,
371− struct devfreq *devfreq)
369+ struct devfreq *devfreq)
372370 {
373371 return -EINVAL;
374372 }
375373
376374 static inline void devm_devfreq_unregister_opp_notifier(struct device *dev,
377− struct devfreq *devfreq)
375+ struct devfreq *devfreq)
378376 {
379377 }
380378
@@ -393,22 +391,22 @@ static inline int devfreq_unregister_notifier(struct devfreq *devfreq, · 12 unmodified lines
393391 }
394392
395393 static inline int devm_devfreq_register_notifier(struct device *dev,
396− struct devfreq *devfreq,
397− struct notifier_block *nb,
398− unsigned int list)
394+ struct devfreq *devfreq,
395+ struct notifier_block *nb,
396+ unsigned int list)
399397 {
400398 return 0;
401399 }
402400
403401 static inline void devm_devfreq_unregister_notifier(struct device *dev,
404− struct devfreq *devfreq,
405− struct notifier_block *nb,
406− unsigned int list)
402+ struct devfreq *devfreq,
403+ struct notifier_block *nb,
404+ unsigned int list)
407405 {
408406 }
409407
410408 static inline struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
411− int index)
409+ int index)
412410 {
413411 return ERR_PTR(-ENODEV);
414412 }
include/linux/devfreq_cooling.h+1−1
@@ -75,7 +75,7 @@ void devfreq_cooling_unregister(struct thermal_cooling_device *dfc); · 74 unmodified lines
7575
7676 #else /* !CONFIG_DEVFREQ_THERMAL */
7777
78−struct thermal_cooling_device *
78+static inline struct thermal_cooling_device *
7979 of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
8080 struct devfreq_cooling_power *dfc_power)
8181 {
include/linux/device-mapper.h+3−0
@@ -141,6 +141,8 @@ typedef long (*dm_dax_direct_access_fn) (struct dm_target *ti, pgoff_t pgoff, · 140 unmodified lines
141141 long nr_pages, void **kaddr, pfn_t *pfn);
142142 typedef size_t (*dm_dax_copy_iter_fn)(struct dm_target *ti, pgoff_t pgoff,
143143 void *addr, size_t bytes, struct iov_iter *i);
144+typedef int (*dm_dax_zero_page_range_fn)(struct dm_target *ti, pgoff_t pgoff,
145+ size_t nr_pages);
144146 #define PAGE_SECTORS (PAGE_SIZE / 512)
145147
146148 void dm_error(const char *message);
@@ -195,6 +197,7 @@ struct target_type { · 48 unmodified lines
195197 dm_dax_direct_access_fn direct_access;
196198 dm_dax_copy_iter_fn dax_copy_from_iter;
197199 dm_dax_copy_iter_fn dax_copy_to_iter;
200+ dm_dax_zero_page_range_fn dax_zero_page_range;
198201
199202 /* For internal device-mapper use. */
200203 struct list_head list;
include/linux/device.h+4−6
@@ -42,9 +42,8 @@ struct device_node; · 41 unmodified lines
4242 struct fwnode_handle;
4343 struct iommu_ops;
4444 struct iommu_group;
45−struct iommu_fwspec;
4645 struct dev_pin_info;
47−struct iommu_param;
46+struct dev_iommu;
4847
4948 /**
5049 * struct subsys_interface - interfaces to device functions
@@ -513,8 +512,7 @@ struct dev_links_info { · 462 unmodified lines
513512 * gone away. This should be set by the allocator of the
514513 * device (i.e. the bus driver that discovered the device).
515514 * @iommu_group: IOMMU group the device belongs to.
516− * @iommu_fwspec: IOMMU-specific properties supplied by firmware.
517− * @iommu_param: Per device generic IOMMU runtime data
515+ * @iommu: Per device generic IOMMU runtime data
518516 *
519517 * @offline_disabled: If set, the device is permanently online.
520518 * @offline: Set after successful invocation of bus type's .offline().
@@ -613,8 +611,7 @@ struct device { · 92 unmodified lines
613611
614612 void (*release)(struct device *dev);
615613 struct iommu_group *iommu_group;
616− struct iommu_fwspec *iommu_fwspec;
617− struct iommu_param *iommu_param;
614+ struct dev_iommu *iommu;
618615
619616 bool offline_disabled:1;
620617 bool offline:1;
@@ -828,6 +825,7 @@ extern struct device *device_find_child_by_name(struct device *parent, · 207 unmodified lines
828825 extern int device_rename(struct device *dev, const char *new_name);
829826 extern int device_move(struct device *dev, struct device *new_parent,
830827 enum dpm_order dpm_order);
828+extern int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid);
831829 extern const char *device_get_devnode(struct device *dev,
832830 umode_t *mode, kuid_t *uid, kgid_t *gid,
833831 const char **tmp);
include/linux/device/driver.h+1−1
@@ -236,9 +236,9 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev) · 235 unmodified lines
236236 }
237237 #endif
238238
239+extern int driver_deferred_probe_timeout;
239240 void driver_deferred_probe_add(struct device *dev);
240241 int driver_deferred_probe_check_state(struct device *dev);
241−int driver_deferred_probe_check_state_continue(struct device *dev);
242242 void driver_init(void);
243243
244244 /**
include/linux/dio.h+0−5
@@ -247,11 +247,6 @@ extern int dio_create_sysfs_dev_files(struct dio_dev *); · 246 unmodified lines
247247 /* New-style probing */
248248 extern int dio_register_driver(struct dio_driver *);
249249 extern void dio_unregister_driver(struct dio_driver *);
250−extern const struct dio_device_id *dio_match_device(const struct dio_device_id *ids, const struct dio_dev *z);
251−static inline struct dio_driver *dio_dev_driver(const struct dio_dev *d)
252−{
253− return d->driver;
254−}
255250
256251 #define dio_resource_start(d) ((d)->resource.start)
257252 #define dio_resource_end(d) ((d)->resource.end)
include/linux/dma-noncoherent.h+2−2
@@ -108,7 +108,7 @@ static inline void arch_dma_prep_coherent(struct page *page, size_t size) · 107 unmodified lines
108108 }
109109 #endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */
110110
111−void *uncached_kernel_address(void *addr);
112−void *cached_kernel_address(void *addr);
111+void *arch_dma_set_uncached(void *addr, size_t size);
112+void arch_dma_clear_uncached(void *addr, size_t size);
113113
114114 #endif /* _LINUX_DMA_NONCOHERENT_H */
include/linux/dmaengine.h+36−32
@@ -300,6 +300,8 @@ struct dma_router { · 299 unmodified lines
300300 * @chan_id: channel ID for sysfs
301301 * @dev: class device for sysfs
302302 * @name: backlink name for sysfs
303+ * @dbg_client_name: slave name for debugfs in format:
304+ * dev_name(requester's dev):channel name, for example: "2b00000.mcasp:tx"
303305 * @device_node: used to add this to the device chan list
304306 * @local: per-cpu pointer to a struct dma_chan_percpu
305307 * @client_count: how many clients are using this channel
@@ -318,6 +320,9 @@ struct dma_chan { · 12 unmodified lines
318320 int chan_id;
319321 struct dma_chan_dev *dev;
320322 const char *name;
323+#ifdef CONFIG_DEBUG_FS
324+ char *dbg_client_name;
325+#endif
321326
322327 struct list_head device_node;
323328 struct dma_chan_percpu __percpu *local;
@@ -618,10 +623,11 @@ static inline void dmaengine_unmap_put(struct dmaengine_unmap_data *unmap) · 294 unmodified lines
618623
619624 static inline void dma_descriptor_unmap(struct dma_async_tx_descriptor *tx)
620625 {
621− if (tx->unmap) {
622− dmaengine_unmap_put(tx->unmap);
623− tx->unmap = NULL;
624− }
626+ if (!tx->unmap)
627+ return;
628+
629+ dmaengine_unmap_put(tx->unmap);
630+ tx->unmap = NULL;
625631 }
626632
627633 #ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
@@ -805,7 +811,9 @@ struct dma_filter { · 177 unmodified lines
805811 * called and there are no further references to this structure. This
806812 * must be implemented to free resources however many existing drivers
807813 * do not and are therefore not safe to unbind while in use.
808− *
814+ * @dbg_summary_show: optional routine to show contents in debugfs; default code
815+ * will be used when this is omitted, but custom code can show extra,
816+ * controller specific information.
809817 */
810818 struct dma_device {
811819 struct kref ref;
@@ -891,6 +899,11 @@ struct dma_device { · 79 unmodified lines
891899 struct dma_tx_state *txstate);
892900 void (*device_issue_pending)(struct dma_chan *chan);
893901 void (*device_release)(struct dma_device *dev);
902+ /* debugfs support */
903+#ifdef CONFIG_DEBUG_FS
904+ void (*dbg_summary_show)(struct seq_file *s, struct dma_device *dev);
905+ struct dentry *dbg_dev_root;
906+#endif
894907 };
895908
896909 static inline int dmaengine_slave_config(struct dma_chan *chan,
@@ -1155,14 +1168,7 @@ static inline dma_cookie_t dmaengine_submit(struct dma_async_tx_descriptor *desc · 258 unmodified lines
11551168 static inline bool dmaengine_check_align(enum dmaengine_alignment align,
11561169 size_t off1, size_t off2, size_t len)
11571170 {
1158− size_t mask;
1159−
1160− if (!align)
1161− return true;
1162− mask = (1 << align) - 1;
1163− if (mask & (off1 | off2 | len))
1164− return false;
1165− return true;
1171+ return !(((1 << align) - 1) & (off1 | off2 | len));
11661172 }
11671173
11681174 static inline bool is_dma_copy_aligned(struct dma_device *dev, size_t off1,
@@ -1236,9 +1242,9 @@ static inline int dma_maxpq(struct dma_device *dma, enum dma_ctrl_flags flags) · 67 unmodified lines
12361242 {
12371243 if (dma_dev_has_pq_continue(dma) || !dmaf_continue(flags))
12381244 return dma_dev_to_maxpq(dma);
1239− else if (dmaf_p_disabled_continue(flags))
1245+ if (dmaf_p_disabled_continue(flags))
12401246 return dma_dev_to_maxpq(dma) - 1;
1241− else if (dmaf_continue(flags))
1247+ if (dmaf_continue(flags))
12421248 return dma_dev_to_maxpq(dma) - 3;
12431249 BUG();
12441250 }
@@ -1249,7 +1255,7 @@ static inline size_t dmaengine_get_icg(bool inc, bool sgl, size_t icg, · 4 unmodified lines
12491255 if (inc) {
12501256 if (dir_icg)
12511257 return dir_icg;
1252− else if (sgl)
1258+ if (sgl)
12531259 return icg;
12541260 }
12551261
@@ -1415,11 +1421,12 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie, · 159 unmodified lines
14151421 static inline void
14161422 dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used, u32 residue)
14171423 {
1418− if (st) {
1419− st->last = last;
1420− st->used = used;
1421− st->residue = residue;
1422− }
1424+ if (!st)
1425+ return;
1426+
1427+ st->last = last;
1428+ st->used = used;
1429+ st->residue = residue;
14231430 }
14241431
14251432 #ifdef CONFIG_DMA_ENGINE
@@ -1496,12 +1503,11 @@ static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx) · 70 unmodified lines
14961503 if (ret)
14971504 return ret;
14981505
1499− if (caps.descriptor_reuse) {
1500− tx->flags |= DMA_CTRL_REUSE;
1501− return 0;
1502− } else {
1506+ if (!caps.descriptor_reuse)
15031507 return -EPERM;
1504− }
1508+
1509+ tx->flags |= DMA_CTRL_REUSE;
1510+ return 0;
15051511 }
15061512
15071513 static inline void dmaengine_desc_clear_reuse(struct dma_async_tx_descriptor *tx)
@@ -1517,10 +1523,10 @@ static inline bool dmaengine_desc_test_reuse(struct dma_async_tx_descriptor *tx) · 9 unmodified lines
15171523 static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
15181524 {
15191525 /* this is supported for reusable desc, so check that */
1520− if (dmaengine_desc_test_reuse(desc))
1521− return desc->desc_free(desc);
1522− else
1526+ if (!dmaengine_desc_test_reuse(desc))
15231527 return -EPERM;
1528+
1529+ return desc->desc_free(desc);
15241530 }
15251531
15261532 /* --- DMA device --- */
@@ -1566,9 +1572,7 @@ dmaengine_get_direction_text(enum dma_transfer_direction dir) · 39 unmodified lines
15661572 case DMA_DEV_TO_DEV:
15671573 return "DEV_TO_DEV";
15681574 default:
1569− break;
1575+ return "invalid";
15701576 }
1571−
1572− return "invalid";
15731577 }
15741578 #endif /* DMAENGINE_H */
include/linux/dmar.h+9−5
@@ -69,19 +69,23 @@ struct dmar_pci_notify_info { · 68 unmodified lines
6969 extern struct rw_semaphore dmar_global_lock;
7070 extern struct list_head dmar_drhd_units;
7171
72−#define for_each_drhd_unit(drhd) \
73− list_for_each_entry_rcu(drhd, &dmar_drhd_units, list)
72+#define for_each_drhd_unit(drhd) \
73+ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
74+ dmar_rcu_check())
7475
7576 #define for_each_active_drhd_unit(drhd) \
76− list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
77+ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
78+ dmar_rcu_check()) \
7779 if (drhd->ignored) {} else
7880
7981 #define for_each_active_iommu(i, drhd) \
80− list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
82+ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
83+ dmar_rcu_check()) \
8184 if (i=drhd->iommu, drhd->ignored) {} else
8285
8386 #define for_each_iommu(i, drhd) \
84− list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
87+ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
88+ dmar_rcu_check()) \
8589 if (i=drhd->iommu, 0) {} else
8690
8791 static inline bool dmar_rcu_check(void)
include/linux/dsa/8021q.h+0−7
@@ -28,8 +28,6 @@ int dsa_8021q_rx_switch_id(u16 vid); · 27 unmodified lines
2828
2929 int dsa_8021q_rx_source_port(u16 vid);
3030
31−struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb);
32−
3331 #else
3432
3533 int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
@@ -64,11 +62,6 @@ int dsa_8021q_rx_source_port(u16 vid) · 28 unmodified lines
6462 return 0;
6563 }
6664
67−struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb)
68−{
69− return NULL;
70−}
71−
7265 #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */
7366
7467 #endif /* _NET_DSA_8021Q_H */
include/linux/dw_apb_timer.h+0−1
@@ -25,7 +25,6 @@ struct dw_apb_timer { · 24 unmodified lines
2525 struct dw_apb_clock_event_device {
2626 struct clock_event_device ced;
2727 struct dw_apb_timer timer;
28− struct irqaction irqaction;
2928 void (*eoi)(struct dw_apb_timer *);
3029 };
3130
include/linux/edac.h+5−4
@@ -383,6 +383,9 @@ struct dimm_info { · 382 unmodified lines
383383 unsigned int csrow, cschannel; /* Points to the old API data */
384384
385385 u16 smbios_handle; /* Handle for SMBIOS type 17 */
386+
387+ u32 ce_count;
388+ u32 ue_count;
386389 };
387390
388391 /**
@@ -442,6 +445,7 @@ struct errcount_attribute_data { · 53 unmodified lines
442445 * struct edac_raw_error_desc - Raw error report structure
443446 * @grain: minimum granularity for an error report, in bytes
444447 * @error_count: number of errors of the same type
448+ * @type: severity of the error (CE/UE/Fatal)
445449 * @top_layer: top layer of the error (layer[0])
446450 * @mid_layer: middle layer of the error (layer[1])
447451 * @low_layer: low layer of the error (layer[2])
@@ -453,8 +457,6 @@ struct errcount_attribute_data { · 5 unmodified lines
453457 * @location: location of the error
454458 * @label: label of the affected DIMM(s)
455459 * @other_detail: other driver-specific detail about the error
456− * @enable_per_layer_report: if false, the error affects all layers
457− * (typically, a memory controller error)
458460 */
459461 struct edac_raw_error_desc {
460462 char location[LOCATION_SIZE];
@@ -462,6 +464,7 @@ struct edac_raw_error_desc { · 1 unmodified line
462464 long grain;
463465
464466 u16 error_count;
467+ enum hw_event_mc_err_type type;
465468 int top_layer;
466469 int mid_layer;
467470 int low_layer;
@@ -470,7 +473,6 @@ struct edac_raw_error_desc { · 2 unmodified lines
470473 unsigned long syndrome;
471474 const char *msg;
472475 const char *other_detail;
473− bool enable_per_layer_report;
474476 };
475477
476478 /* MEMORY controller information structure
@@ -560,7 +562,6 @@ struct mem_ctl_info { · 83 unmodified lines
560562 */
561563 u32 ce_noinfo_count, ue_noinfo_count;
562564 u32 ue_mc, ce_mc;
563− u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS];
564565
565566 struct completion complete;
566567
include/linux/efi.h+121−579
@@ -56,19 +56,6 @@ typedef void *efi_handle_t; · 55 unmodified lines
5656 #define __efiapi
5757 #endif
5858
59−#define efi_get_handle_at(array, idx) \
60− (efi_is_native() ? (array)[idx] \
61− : (efi_handle_t)(unsigned long)((u32 *)(array))[idx])
62−
63−#define efi_get_handle_num(size) \
64− ((size) / (efi_is_native() ? sizeof(efi_handle_t) : sizeof(u32)))
65−
66−#define for_each_efi_handle(handle, array, size, i) \
67− for (i = 0; \
68− i < efi_get_handle_num(size) && \
69− ((handle = efi_get_handle_at((array), i)) || true); \
70− i++)
71−
7259 /*
7360 * The UEFI spec and EDK2 reference implementation both define EFI_GUID as
7461 * struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied alignment
@@ -157,15 +144,6 @@ typedef struct { · 82 unmodified lines
157144 u32 imagesize;
158145 } efi_capsule_header_t;
159146
160−struct efi_boot_memmap {
161− efi_memory_desc_t **map;
162− unsigned long *map_size;
163− unsigned long *desc_size;
164− u32 *desc_ver;
165− unsigned long *key_ptr;
166− unsigned long *buff_size;
167−};
168−
169147 /*
170148 * EFI capsule flags
171149 */
@@ -187,14 +165,6 @@ struct capsule_info { · 15 unmodified lines
187165
188166 int __efi_capsule_setup_info(struct capsule_info *cap_info);
189167
190−/*
191− * Allocation types for calls to boottime->allocate_pages.
192− */
193−#define EFI_ALLOCATE_ANY_PAGES 0
194−#define EFI_ALLOCATE_MAX_ADDRESS 1
195−#define EFI_ALLOCATE_ADDRESS 2
196−#define EFI_MAX_ALLOCATE_TYPE 3
197−
198168 typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
199169
200170 /*
@@ -224,291 +194,7 @@ typedef struct { · 23 unmodified lines
224194 u8 sets_to_zero;
225195 } efi_time_cap_t;
226196
227−typedef struct {
228− efi_table_hdr_t hdr;
229− u32 raise_tpl;
230− u32 restore_tpl;
231− u32 allocate_pages;
232− u32 free_pages;
233− u32 get_memory_map;
234− u32 allocate_pool;
235− u32 free_pool;
236− u32 create_event;
237− u32 set_timer;
238− u32 wait_for_event;
239− u32 signal_event;
240− u32 close_event;
241− u32 check_event;
242− u32 install_protocol_interface;
243− u32 reinstall_protocol_interface;
244− u32 uninstall_protocol_interface;
245− u32 handle_protocol;
246− u32 __reserved;
247− u32 register_protocol_notify;
248− u32 locate_handle;
249− u32 locate_device_path;
250− u32 install_configuration_table;
251− u32 load_image;
252− u32 start_image;
253− u32 exit;
254− u32 unload_image;
255− u32 exit_boot_services;
256− u32 get_next_monotonic_count;
257− u32 stall;
258− u32 set_watchdog_timer;
259− u32 connect_controller;
260− u32 disconnect_controller;
261− u32 open_protocol;
262− u32 close_protocol;
263− u32 open_protocol_information;
264− u32 protocols_per_handle;
265− u32 locate_handle_buffer;
266− u32 locate_protocol;
267− u32 install_multiple_protocol_interfaces;
268− u32 uninstall_multiple_protocol_interfaces;
269− u32 calculate_crc32;
270− u32 copy_mem;
271− u32 set_mem;
272− u32 create_event_ex;
273−} __packed efi_boot_services_32_t;
274−
275−/*
276− * EFI Boot Services table
277− */
278−typedef union {
279− struct {
280− efi_table_hdr_t hdr;
281− void *raise_tpl;
282− void *restore_tpl;
283− efi_status_t (__efiapi *allocate_pages)(int, int, unsigned long,
284− efi_physical_addr_t *);
285− efi_status_t (__efiapi *free_pages)(efi_physical_addr_t,
286− unsigned long);
287− efi_status_t (__efiapi *get_memory_map)(unsigned long *, void *,
288− unsigned long *,
289− unsigned long *, u32 *);
290− efi_status_t (__efiapi *allocate_pool)(int, unsigned long,
291− void **);
292− efi_status_t (__efiapi *free_pool)(void *);
293− void *create_event;
294− void *set_timer;
295− void *wait_for_event;
296− void *signal_event;
297− void *close_event;
298− void *check_event;
299− void *install_protocol_interface;
300− void *reinstall_protocol_interface;
301− void *uninstall_protocol_interface;
302− efi_status_t (__efiapi *handle_protocol)(efi_handle_t,
303− efi_guid_t *, void **);
304− void *__reserved;
305− void *register_protocol_notify;
306− efi_status_t (__efiapi *locate_handle)(int, efi_guid_t *,
307− void *, unsigned long *,
308− efi_handle_t *);
309− void *locate_device_path;
310− efi_status_t (__efiapi *install_configuration_table)(efi_guid_t *,
311− void *);
312− void *load_image;
313− void *start_image;
314− void *exit;
315− void *unload_image;
316− efi_status_t (__efiapi *exit_boot_services)(efi_handle_t,
317− unsigned long);
318− void *get_next_monotonic_count;
319− void *stall;
320− void *set_watchdog_timer;
321− void *connect_controller;
322− efi_status_t (__efiapi *disconnect_controller)(efi_handle_t,
323− efi_handle_t,
324− efi_handle_t);
325− void *open_protocol;
326− void *close_protocol;
327− void *open_protocol_information;
328− void *protocols_per_handle;
329− void *locate_handle_buffer;
330− efi_status_t (__efiapi *locate_protocol)(efi_guid_t *, void *,
331− void **);
332− void *install_multiple_protocol_interfaces;
333− void *uninstall_multiple_protocol_interfaces;
334− void *calculate_crc32;
335− void *copy_mem;
336− void *set_mem;
337− void *create_event_ex;
338− };
339− efi_boot_services_32_t mixed_mode;
340−} efi_boot_services_t;
341−
342−typedef enum {
343− EfiPciIoWidthUint8,
344− EfiPciIoWidthUint16,
345− EfiPciIoWidthUint32,
346− EfiPciIoWidthUint64,
347− EfiPciIoWidthFifoUint8,
348− EfiPciIoWidthFifoUint16,
349− EfiPciIoWidthFifoUint32,
350− EfiPciIoWidthFifoUint64,
351− EfiPciIoWidthFillUint8,
352− EfiPciIoWidthFillUint16,
353− EfiPciIoWidthFillUint32,
354− EfiPciIoWidthFillUint64,
355− EfiPciIoWidthMaximum
356−} EFI_PCI_IO_PROTOCOL_WIDTH;
357−
358−typedef enum {
359− EfiPciIoAttributeOperationGet,
360− EfiPciIoAttributeOperationSet,
361− EfiPciIoAttributeOperationEnable,
362− EfiPciIoAttributeOperationDisable,
363− EfiPciIoAttributeOperationSupported,
364− EfiPciIoAttributeOperationMaximum
365−} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
366−
367−typedef struct {
368− u32 read;
369− u32 write;
370−} efi_pci_io_protocol_access_32_t;
371−
372−typedef union efi_pci_io_protocol efi_pci_io_protocol_t;
373−
374−typedef
375−efi_status_t (__efiapi *efi_pci_io_protocol_cfg_t)(efi_pci_io_protocol_t *,
376− EFI_PCI_IO_PROTOCOL_WIDTH,
377− u32 offset,
378− unsigned long count,
379− void *buffer);
380−
381−typedef struct {
382− void *read;
383− void *write;
384−} efi_pci_io_protocol_access_t;
385−
386−typedef struct {
387− efi_pci_io_protocol_cfg_t read;
388− efi_pci_io_protocol_cfg_t write;
389−} efi_pci_io_protocol_config_access_t;
390−
391−union efi_pci_io_protocol {
392− struct {
393− void *poll_mem;
394− void *poll_io;
395− efi_pci_io_protocol_access_t mem;
396− efi_pci_io_protocol_access_t io;
397− efi_pci_io_protocol_config_access_t pci;
398− void *copy_mem;
399− void *map;
400− void *unmap;
401− void *allocate_buffer;
402− void *free_buffer;
403− void *flush;
404− efi_status_t (__efiapi *get_location)(efi_pci_io_protocol_t *,
405− unsigned long *segment_nr,
406− unsigned long *bus_nr,
407− unsigned long *device_nr,
408− unsigned long *func_nr);
409− void *attributes;
410− void *get_bar_attributes;
411− void *set_bar_attributes;
412− uint64_t romsize;
413− void *romimage;
414− };
415− struct {
416− u32 poll_mem;
417− u32 poll_io;
418− efi_pci_io_protocol_access_32_t mem;
419− efi_pci_io_protocol_access_32_t io;
420− efi_pci_io_protocol_access_32_t pci;
421− u32 copy_mem;
422− u32 map;
423− u32 unmap;
424− u32 allocate_buffer;
425− u32 free_buffer;
426− u32 flush;
427− u32 get_location;
428− u32 attributes;
429− u32 get_bar_attributes;
430− u32 set_bar_attributes;
431− u64 romsize;
432− u32 romimage;
433− } mixed_mode;
434−};
435−
436−#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001
437−#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002
438−#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004
439−#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008
440−#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010
441−#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020
442−#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040
443−#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
444−#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100
445−#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200
446−#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400
447−#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800
448−#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000
449−#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000
450−#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000
451−#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
452−#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000
453−#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000
454−#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000
455−
456−struct efi_dev_path;
457−
458−typedef union apple_properties_protocol apple_properties_protocol_t;
459−
460−union apple_properties_protocol {
461− struct {
462− unsigned long version;
463− efi_status_t (__efiapi *get)(apple_properties_protocol_t *,
464− struct efi_dev_path *,
465− efi_char16_t *, void *, u32 *);
466− efi_status_t (__efiapi *set)(apple_properties_protocol_t *,
467− struct efi_dev_path *,
468− efi_char16_t *, void *, u32);
469− efi_status_t (__efiapi *del)(apple_properties_protocol_t *,
470− struct efi_dev_path *,
471− efi_char16_t *);
472− efi_status_t (__efiapi *get_all)(apple_properties_protocol_t *,
473− void *buffer, u32 *);
474− };
475− struct {
476− u32 version;
477− u32 get;
478− u32 set;
479− u32 del;
480− u32 get_all;
481− } mixed_mode;
482−};
483−
484−typedef u32 efi_tcg2_event_log_format;
485−
486−typedef union efi_tcg2_protocol efi_tcg2_protocol_t;
487−
488−union efi_tcg2_protocol {
489− struct {
490− void *get_capability;
491− efi_status_t (__efiapi *get_event_log)(efi_handle_t,
492− efi_tcg2_event_log_format,
493− efi_physical_addr_t *,
494− efi_physical_addr_t *,
495− efi_bool_t *);
496− void *hash_log_extend_event;
497− void *submit_command;
498− void *get_active_pcr_banks;
499− void *set_active_pcr_banks;
500− void *get_result_of_set_active_pcr_banks;
501− };
502− struct {
503− u32 get_capability;
504− u32 get_event_log;
505− u32 hash_log_extend_event;
506− u32 submit_command;
507− u32 get_active_pcr_banks;
508− u32 set_active_pcr_banks;
509− u32 get_result_of_set_active_pcr_banks;
510− } mixed_mode;
511−};
197+typedef union efi_boot_services efi_boot_services_t;
512198
513199 /*
514200 * Types and defines for EFI ResetSystem
@@ -646,6 +332,9 @@ void efi_native_runtime_setup(void); · 131 unmodified lines
646332 #define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
647333 #define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0)
648334 #define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f)
335+#define EFI_LOAD_FILE_PROTOCOL_GUID EFI_GUID(0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
336+#define EFI_LOAD_FILE2_PROTOCOL_GUID EFI_GUID(0x4006c0c1, 0xfcb3, 0x403e, 0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d)
337+#define EFI_RT_PROPERTIES_TABLE_GUID EFI_GUID(0xeb66918a, 0x7eef, 0x402a, 0x84, 0x2e, 0x93, 0x1d, 0x21, 0xc3, 0x8a, 0xe9)
649338
650339 #define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f)
651340 #define EFI_SHIM_LOCK_GUID EFI_GUID(0x605dab50, 0xe046, 0x4300, 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23)
@@ -665,6 +354,7 @@ void efi_native_runtime_setup(void); · 13 unmodified lines
665354 #define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa)
666355 #define LINUX_EFI_TPM_FINAL_LOG_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25)
667356 #define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2)
357+#define LINUX_EFI_INITRD_MEDIA_GUID EFI_GUID(0x5568e427, 0x68fc, 0x4f3d, 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68)
668358
669359 /* OEM GUIDs */
670360 #define DELLEMC_EFI_RCI2_TABLE_GUID EFI_GUID(0x2d9f28a2, 0xa886, 0x456a, 0x97, 0xa8, 0xf1, 0x1e, 0xf2, 0x4f, 0xf4, 0x55)
@@ -788,74 +478,6 @@ struct efi_mem_range { · 117 unmodified lines
788478 u64 attribute;
789479 };
790480
791−struct efi_fdt_params {
792− u64 system_table;
793− u64 mmap;
794− u32 mmap_size;
795− u32 desc_size;
796− u32 desc_ver;
797−};
798−
799−typedef struct {
800− u32 revision;
801− efi_handle_t parent_handle;
802− efi_system_table_t *system_table;
803− efi_handle_t device_handle;
804− void *file_path;
805− void *reserved;
806− u32 load_options_size;
807− void *load_options;
808− void *image_base;
809− __aligned_u64 image_size;
810− unsigned int image_code_type;
811− unsigned int image_data_type;
812− efi_status_t ( __efiapi *unload)(efi_handle_t image_handle);
813−} efi_loaded_image_t;
814−
815−typedef struct {
816− u64 size;
817− u64 file_size;
818− u64 phys_size;
819− efi_time_t create_time;
820− efi_time_t last_access_time;
821− efi_time_t modification_time;
822− __aligned_u64 attribute;
823− efi_char16_t filename[1];
824−} efi_file_info_t;
825−
826−typedef struct efi_file_handle efi_file_handle_t;
827−
828−struct efi_file_handle {
829− u64 revision;
830− efi_status_t (__efiapi *open)(efi_file_handle_t *,
831− efi_file_handle_t **,
832− efi_char16_t *, u64, u64);
833− efi_status_t (__efiapi *close)(efi_file_handle_t *);
834− void *delete;
835− efi_status_t (__efiapi *read)(efi_file_handle_t *,
836− unsigned long *, void *);
837− void *write;
838− void *get_position;
839− void *set_position;
840− efi_status_t (__efiapi *get_info)(efi_file_handle_t *,
841− efi_guid_t *, unsigned long *,
842− void *);
843− void *set_info;
844− void *flush;
845−};
846−
847−typedef struct efi_file_io_interface efi_file_io_interface_t;
848−
849−struct efi_file_io_interface {
850− u64 revision;
851− int (__efiapi *open_volume)(efi_file_io_interface_t *,
852− efi_file_handle_t **);
853−};
854−
855−#define EFI_FILE_MODE_READ 0x0000000000000001
856−#define EFI_FILE_MODE_WRITE 0x0000000000000002
857−#define EFI_FILE_MODE_CREATE 0x8000000000000000
858−
859481 typedef struct {
860482 u32 version;
861483 u32 length;
@@ -865,6 +487,14 @@ typedef struct { · 3 unmodified lines
865487 #define EFI_PROPERTIES_TABLE_VERSION 0x00010000
866488 #define EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA 0x1
867489
490+typedef struct {
491+ u16 version;
492+ u16 length;
493+ u32 runtime_services_supported;
494+} efi_rt_properties_table_t;
495+
496+#define EFI_RT_PROPERTIES_TABLE_VERSION 0x1
497+
868498 #define EFI_INVALID_TABLE_ADDR (~0UL)
869499
870500 typedef struct {
@@ -896,48 +526,63 @@ typedef struct { · 25 unmodified lines
896526 efi_time_t time_of_revocation;
897527 } efi_cert_x509_sha256_t;
898528
529+extern unsigned long __ro_after_init efi_rng_seed; /* RNG Seed table */
530+
899531 /*
900532 * All runtime access to EFI goes through this structure:
901533 */
902534 extern struct efi {
903− efi_system_table_t *systab; /* EFI system table */
904− unsigned int runtime_version; /* Runtime services version */
905− unsigned long mps; /* MPS table */
906− unsigned long acpi; /* ACPI table (IA64 ext 0.71) */
907− unsigned long acpi20; /* ACPI table (ACPI 2.0) */
908− unsigned long smbios; /* SMBIOS table (32 bit entry point) */
909− unsigned long smbios3; /* SMBIOS table (64 bit entry point) */
910− unsigned long boot_info; /* boot info table */
911− unsigned long hcdp; /* HCDP table */
912− unsigned long uga; /* UGA table */
913− unsigned long fw_vendor; /* fw_vendor */
914− unsigned long runtime; /* runtime table */
915− unsigned long config_table; /* config tables */
916− unsigned long esrt; /* ESRT table */
917− unsigned long properties_table; /* properties table */
918− unsigned long mem_attr_table; /* memory attributes table */
919− unsigned long rng_seed; /* UEFI firmware random seed */
920− unsigned long tpm_log; /* TPM2 Event Log table */
921− unsigned long tpm_final_log; /* TPM2 Final Events Log table */
922− unsigned long mem_reserve; /* Linux EFI memreserve table */
923− efi_get_time_t *get_time;
924− efi_set_time_t *set_time;
925− efi_get_wakeup_time_t *get_wakeup_time;
926− efi_set_wakeup_time_t *set_wakeup_time;
927− efi_get_variable_t *get_variable;
928− efi_get_next_variable_t *get_next_variable;
929− efi_set_variable_t *set_variable;
930− efi_set_variable_t *set_variable_nonblocking;
931− efi_query_variable_info_t *query_variable_info;
932− efi_query_variable_info_t *query_variable_info_nonblocking;
933− efi_update_capsule_t *update_capsule;
934− efi_query_capsule_caps_t *query_capsule_caps;
935− efi_get_next_high_mono_count_t *get_next_high_mono_count;
936− efi_reset_system_t *reset_system;
937− struct efi_memory_map memmap;
938− unsigned long flags;
535+ const efi_runtime_services_t *runtime; /* EFI runtime services table */
536+ unsigned int runtime_version; /* Runtime services version */
537+ unsigned int runtime_supported_mask;
538+
539+ unsigned long acpi; /* ACPI table (IA64 ext 0.71) */
540+ unsigned long acpi20; /* ACPI table (ACPI 2.0) */
541+ unsigned long smbios; /* SMBIOS table (32 bit entry point) */
542+ unsigned long smbios3; /* SMBIOS table (64 bit entry point) */
543+ unsigned long esrt; /* ESRT table */
544+ unsigned long tpm_log; /* TPM2 Event Log table */
545+ unsigned long tpm_final_log; /* TPM2 Final Events Log table */
546+
547+ efi_get_time_t *get_time;
548+ efi_set_time_t *set_time;
549+ efi_get_wakeup_time_t *get_wakeup_time;
550+ efi_set_wakeup_time_t *set_wakeup_time;
551+ efi_get_variable_t *get_variable;
552+ efi_get_next_variable_t *get_next_variable;
553+ efi_set_variable_t *set_variable;
554+ efi_set_variable_t *set_variable_nonblocking;
555+ efi_query_variable_info_t *query_variable_info;
556+ efi_query_variable_info_t *query_variable_info_nonblocking;
557+ efi_update_capsule_t *update_capsule;
558+ efi_query_capsule_caps_t *query_capsule_caps;
559+ efi_get_next_high_mono_count_t *get_next_high_mono_count;
560+ efi_reset_system_t *reset_system;
561+
562+ struct efi_memory_map memmap;
563+ unsigned long flags;
939564 } efi;
940565
566+#define EFI_RT_SUPPORTED_GET_TIME 0x0001
567+#define EFI_RT_SUPPORTED_SET_TIME 0x0002
568+#define EFI_RT_SUPPORTED_GET_WAKEUP_TIME 0x0004
569+#define EFI_RT_SUPPORTED_SET_WAKEUP_TIME 0x0008
570+#define EFI_RT_SUPPORTED_GET_VARIABLE 0x0010
571+#define EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME 0x0020
572+#define EFI_RT_SUPPORTED_SET_VARIABLE 0x0040
573+#define EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP 0x0080
574+#define EFI_RT_SUPPORTED_CONVERT_POINTER 0x0100
575+#define EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT 0x0200
576+#define EFI_RT_SUPPORTED_RESET_SYSTEM 0x0400
577+#define EFI_RT_SUPPORTED_UPDATE_CAPSULE 0x0800
578+#define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES 0x1000
579+#define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO 0x2000
580+
581+#define EFI_RT_SUPPORTED_ALL 0x3fff
582+
583+#define EFI_RT_SUPPORTED_TIME_SERVICES 0x000f
584+#define EFI_RT_SUPPORTED_VARIABLE_SERVICES 0x0070
585+
941586 extern struct mm_struct efi_mm;
942587
943588 static inline int
@@ -987,14 +632,18 @@ extern int __init efi_memmap_split_count(efi_memory_desc_t *md, · 43 unmodified lines
987632 extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap,
988633 void *buf, struct efi_mem_range *mem);
989634
990−extern int efi_config_init(efi_config_table_type_t *arch_tables);
991635 #ifdef CONFIG_EFI_ESRT
992636 extern void __init efi_esrt_init(void);
993637 #else
994638 static inline void efi_esrt_init(void) { }
995639 #endif
996−extern int efi_config_parse_tables(void *config_tables, int count, int sz,
997− efi_config_table_type_t *arch_tables);
640+extern int efi_config_parse_tables(const efi_config_table_t *config_tables,
641+ int count,
642+ const efi_config_table_type_t *arch_tables);
643+extern int efi_systab_check_header(const efi_table_hdr_t *systab_hdr,
644+ int min_major_version);
645+extern void efi_systab_report_header(const efi_table_hdr_t *systab_hdr,
646+ unsigned long fw_vendor);
998647 extern u64 efi_get_iobase (void);
999648 extern int efi_mem_type(unsigned long phys_addr);
1000649 extern u64 efi_mem_attributes (unsigned long phys_addr);
@@ -1006,7 +655,7 @@ extern void efi_mem_reserve(phys_addr_t addr, u64 size); · 5 unmodified lines
1006655 extern int efi_mem_reserve_persistent(phys_addr_t addr, u64 size);
1007656 extern void efi_initialize_iomem_resources(struct resource *code_resource,
1008657 struct resource *data_resource, struct resource *bss_resource);
1009−extern int efi_get_fdt_params(struct efi_fdt_params *params);
658+extern u64 efi_get_fdt_params(struct efi_memory_map_data *data);
1010659 extern struct kobject *efi_kobj;
1011660
1012661 extern int efi_reboot_quirk_mode;
@@ -1018,6 +667,8 @@ extern void __init efi_fake_memmap(void); · 5 unmodified lines
1018667 static inline void efi_fake_memmap(void) { }
1019668 #endif
1020669
670+extern unsigned long efi_mem_attr_table;
671+
1021672 /*
1022673 * efi_memattr_perm_setter - arch specific callback function passed into
1023674 * efi_memattr_apply_permissions() that updates the
@@ -1124,6 +775,7 @@ extern int __init efi_setup_pcdp_console(char *); · 100 unmodified lines
1124775 #define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */
1125776 #define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */
1126777 #define EFI_MEM_NO_SOFT_RESERVE 11 /* Is the kernel configured to ignore soft reservations? */
778+#define EFI_PRESERVE_BS_REGIONS 12 /* Are EFI boot-services memory segments available? */
1127779
1128780 #ifdef CONFIG_EFI
1129781 /*
@@ -1142,6 +794,11 @@ static inline bool __pure efi_soft_reserve_enabled(void) · 12 unmodified lines
1142794 return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE)
1143795 && __efi_soft_reserve_enabled();
1144796 }
797+
798+static inline bool efi_rt_services_supported(unsigned int mask)
799+{
800+ return (efi.runtime_supported_mask & mask) == mask;
801+}
1145802 #else
1146803 static inline bool efi_enabled(int feature)
1147804 {
@@ -1160,6 +817,11 @@ static inline bool efi_soft_reserve_enabled(void) · 12 unmodified lines
1160817 {
1161818 return false;
1162819 }
820+
821+static inline bool efi_rt_services_supported(unsigned int mask)
822+{
823+ return false;
824+}
1163825 #endif
1164826
1165827 extern int efi_status_to_err(efi_status_t status);
@@ -1188,13 +850,6 @@ extern int efi_status_to_err(efi_status_t status); · 22 unmodified lines
1188850 */
1189851 #define EFI_VARIABLE_GUID_LEN UUID_STRING_LEN
1190852
1191−/*
1192− * The type of search to perform when calling boottime->locate_handle
1193− */
1194−#define EFI_LOCATE_ALL_HANDLES 0
1195−#define EFI_LOCATE_BY_REGISTER_NOTIFY 1
1196−#define EFI_LOCATE_BY_PROTOCOL 2
1197−
1198853 /*
1199854 * EFI Device Path information
1200855 */
@@ -1234,30 +889,40 @@ extern int efi_status_to_err(efi_status_t status); · 33 unmodified lines
1234889 #define EFI_DEV_END_ENTIRE 0xFF
1235890
1236891 struct efi_generic_dev_path {
1237− u8 type;
1238− u8 sub_type;
1239− u16 length;
1240−} __attribute ((packed));
892+ u8 type;
893+ u8 sub_type;
894+ u16 length;
895+} __packed;
896+
897+struct efi_acpi_dev_path {
898+ struct efi_generic_dev_path header;
899+ u32 hid;
900+ u32 uid;
901+} __packed;
902+
903+struct efi_pci_dev_path {
904+ struct efi_generic_dev_path header;
905+ u8 fn;
906+ u8 dev;
907+} __packed;
908+
909+struct efi_vendor_dev_path {
910+ struct efi_generic_dev_path header;
911+ efi_guid_t vendorguid;
912+ u8 vendordata[];
913+} __packed;
1241914
1242915 struct efi_dev_path {
1243− u8 type; /* can be replaced with unnamed */
1244− u8 sub_type; /* struct efi_generic_dev_path; */
1245− u16 length; /* once we've moved to -std=c11 */
1246916 union {
1247− struct {
1248− u32 hid;
1249− u32 uid;
1250− } acpi;
1251− struct {
1252− u8 fn;
1253− u8 dev;
1254− } pci;
917+ struct efi_generic_dev_path header;
918+ struct efi_acpi_dev_path acpi;
919+ struct efi_pci_dev_path pci;
920+ struct efi_vendor_dev_path vendor;
1255921 };
1256−} __attribute ((packed));
922+} __packed;
1257923
1258−#if IS_ENABLED(CONFIG_EFI_DEV_PATH_PARSER)
1259−struct device *efi_get_device_by_path(struct efi_dev_path **node, size_t *len);
1260−#endif
924+struct device *efi_get_device_by_path(const struct efi_dev_path **node,
925+ size_t *len);
1261926
1262927 static inline void memrange_efi_to_native(u64 *addr, u64 *npages)
1263928 {
@@ -1312,80 +977,6 @@ struct efivar_entry { · 48 unmodified lines
1312977 bool deleting;
1313978 };
1314979
1315−union efi_simple_text_output_protocol {
1316− struct {
1317− void *reset;
1318− efi_status_t (__efiapi *output_string)(efi_simple_text_output_protocol_t *,
1319− efi_char16_t *);
1320− void *test_string;
1321− };
1322− struct {
1323− u32 reset;
1324− u32 output_string;
1325− u32 test_string;
1326− } mixed_mode;
1327−};
1328−
1329−#define PIXEL_RGB_RESERVED_8BIT_PER_COLOR 0
1330−#define PIXEL_BGR_RESERVED_8BIT_PER_COLOR 1
1331−#define PIXEL_BIT_MASK 2
1332−#define PIXEL_BLT_ONLY 3
1333−#define PIXEL_FORMAT_MAX 4
1334−
1335−typedef struct {
1336− u32 red_mask;
1337− u32 green_mask;
1338− u32 blue_mask;
1339− u32 reserved_mask;
1340−} efi_pixel_bitmask_t;
1341−
1342−typedef struct {
1343− u32 version;
1344− u32 horizontal_resolution;
1345− u32 vertical_resolution;
1346− int pixel_format;
1347− efi_pixel_bitmask_t pixel_information;
1348− u32 pixels_per_scan_line;
1349−} efi_graphics_output_mode_info_t;
1350−
1351−typedef union efi_graphics_output_protocol_mode efi_graphics_output_protocol_mode_t;
1352−
1353−union efi_graphics_output_protocol_mode {
1354− struct {
1355− u32 max_mode;
1356− u32 mode;
1357− efi_graphics_output_mode_info_t *info;
1358− unsigned long size_of_info;
1359− efi_physical_addr_t frame_buffer_base;
1360− unsigned long frame_buffer_size;
1361− };
1362− struct {
1363− u32 max_mode;
1364− u32 mode;
1365− u32 info;
1366− u32 size_of_info;
1367− u64 frame_buffer_base;
1368− u32 frame_buffer_size;
1369− } mixed_mode;
1370−};
1371−
1372−typedef union efi_graphics_output_protocol efi_graphics_output_protocol_t;
1373−
1374−union efi_graphics_output_protocol {
1375− struct {
1376− void *query_mode;
1377− void *set_mode;
1378− void *blt;
1379− efi_graphics_output_protocol_mode_t *mode;
1380− };
1381− struct {
1382− u32 query_mode;
1383− u32 set_mode;
1384− u32 blt;
1385− u32 mode;
1386− } mixed_mode;
1387−};
1388−
1389980 extern struct list_head efivar_sysfs_list;
1390981
1391982 static inline void
@@ -1483,52 +1074,6 @@ static inline int efi_runtime_map_copy(void *buf, size_t bufsz) · 91 unmodified lines
14831074
14841075 #endif
14851076
1486−/* prototypes shared between arch specific and generic stub code */
1487−
1488−void efi_printk(char *str);
1489−
1490−void efi_free(unsigned long size, unsigned long addr);
1491−
1492−char *efi_convert_cmdline(efi_loaded_image_t *image, int *cmd_line_len);
1493−
1494−efi_status_t efi_get_memory_map(struct efi_boot_memmap *map);
1495−
1496−efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align,
1497− unsigned long *addr, unsigned long min);
1498−
1499−static inline
1500−efi_status_t efi_low_alloc(unsigned long size, unsigned long align,
1501− unsigned long *addr)
1502−{
1503− /*
1504− * Don't allocate at 0x0. It will confuse code that
1505− * checks pointers against NULL. Skip the first 8
1506− * bytes so we start at a nice even number.
1507− */
1508− return efi_low_alloc_above(size, align, addr, 0x8);
1509−}
1510−
1511−efi_status_t efi_high_alloc(unsigned long size, unsigned long align,
1512− unsigned long *addr, unsigned long max);
1513−
1514−efi_status_t efi_relocate_kernel(unsigned long *image_addr,
1515− unsigned long image_size,
1516− unsigned long alloc_size,
1517− unsigned long preferred_addr,
1518− unsigned long alignment,
1519− unsigned long min_addr);
1520−
1521−efi_status_t handle_cmdline_files(efi_loaded_image_t *image,
1522− char *cmd_line, char *option_string,
1523− unsigned long max_addr,
1524− unsigned long *load_addr,
1525− unsigned long *load_size);
1526−
1527−efi_status_t efi_parse_options(char const *cmdline);
1528−
1529−efi_status_t efi_setup_gop(struct screen_info *si, efi_guid_t *proto,
1530− unsigned long size);
1531−
15321077 #ifdef CONFIG_EFI
15331078 extern bool efi_runtime_disabled(void);
15341079 #else
@@ -1553,6 +1098,12 @@ static inline void · 18 unmodified lines
15531098 efi_enable_reset_attack_mitigation(void) { }
15541099 #endif
15551100
1101+#ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
1102+void efi_check_for_embedded_firmwares(void);
1103+#else
1104+static inline void efi_check_for_embedded_firmwares(void) { }
1105+#endif
1106+
15561107 efi_status_t efi_random_get_seed(void);
15571108
15581109 void efi_retrieve_tpm2_eventlog(void);
@@ -1606,15 +1157,6 @@ void efi_retrieve_tpm2_eventlog(void); · 47 unmodified lines
16061157 arch_efi_call_virt_teardown(); \
16071158 })
16081159
1609−typedef efi_status_t (*efi_exit_boot_map_processing)(
1610− struct efi_boot_memmap *map,
1611− void *priv);
1612−
1613−efi_status_t efi_exit_boot_services(void *handle,
1614− struct efi_boot_memmap *map,
1615− void *priv,
1616− efi_exit_boot_map_processing priv_func);
1617−
16181160 #define EFI_RANDOM_SEED_SIZE 64U
16191161
16201162 struct linux_efi_random_seed {
@@ -1701,6 +1243,6 @@ struct linux_efi_memreserve { · 80 unmodified lines
17011243 #define EFI_MEMRESERVE_COUNT(size) (((size) - sizeof(struct linux_efi_memreserve)) \
17021244 / sizeof(((struct linux_efi_memreserve *)0)->entry[0]))
17031245
1704−void efi_pci_disable_bridge_busmaster(void);
1246+void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size);
17051247
17061248 #endif /* _LINUX_EFI_H */
include/linux/efi_embedded_fw.h+43−0
@@ -0,0 +1,43 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_EFI_EMBEDDED_FW_H
3+#define _LINUX_EFI_EMBEDDED_FW_H
4+
5+#include <linux/list.h>
6+#include <linux/mod_devicetable.h>
7+
8+#define EFI_EMBEDDED_FW_PREFIX_LEN 8
9+
10+/*
11+ * This struct and efi_embedded_fw_list are private to the efi-embedded fw
12+ * implementation they are in this header for use by lib/test_firmware.c only!
13+ */
14+struct efi_embedded_fw {
15+ struct list_head list;
16+ const char *name;
17+ const u8 *data;
18+ size_t length;
19+};
20+
21+extern struct list_head efi_embedded_fw_list;
22+
23+/**
24+ * struct efi_embedded_fw_desc - This struct is used by the EFI embedded-fw
25+ * code to search for embedded firmwares.
26+ *
27+ * @name: Name to register the firmware with if found
28+ * @prefix: First 8 bytes of the firmware
29+ * @length: Length of the firmware in bytes including prefix
30+ * @sha256: SHA256 of the firmware
31+ */
32+struct efi_embedded_fw_desc {
33+ const char *name;
34+ u8 prefix[EFI_EMBEDDED_FW_PREFIX_LEN];
35+ u32 length;
36+ u8 sha256[32];
37+};
38+
39+extern const struct dmi_system_id touchscreen_dmi_table[];
40+
41+int efi_get_embedded_fw(const char *name, const u8 **dat, size_t *sz);
42+
43+#endif
include/linux/elfnote.h+1−1
@@ -59,7 +59,7 @@ · 58 unmodified lines
5959 ELFNOTE_END
6060
6161 #else /* !__ASSEMBLER__ */
62−#include <linux/elf.h>
62+#include <uapi/linux/elf.h>
6363 /*
6464 * Use an anonymous structure which matches the shape of
6565 * Elf{32,64}_Nhdr, but includes the name and desc data. The size and
include/linux/err.h+0−3
@@ -62,9 +62,6 @@ static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) · 61 unmodified lines
6262 return 0;
6363 }
6464
65−/* Deprecated */
66−#define PTR_RET(p) PTR_ERR_OR_ZERO(p)
67−
6865 #endif
6966
7067 #endif /* _LINUX_ERR_H */
include/linux/ethtool.h+63−3
@@ -177,8 +177,57 @@ void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst, · 176 unmodified lines
177177 bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
178178 const unsigned long *src);
179179
180+#define ETHTOOL_COALESCE_RX_USECS BIT(0)
181+#define ETHTOOL_COALESCE_RX_MAX_FRAMES BIT(1)
182+#define ETHTOOL_COALESCE_RX_USECS_IRQ BIT(2)
183+#define ETHTOOL_COALESCE_RX_MAX_FRAMES_IRQ BIT(3)
184+#define ETHTOOL_COALESCE_TX_USECS BIT(4)
185+#define ETHTOOL_COALESCE_TX_MAX_FRAMES BIT(5)
186+#define ETHTOOL_COALESCE_TX_USECS_IRQ BIT(6)
187+#define ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ BIT(7)
188+#define ETHTOOL_COALESCE_STATS_BLOCK_USECS BIT(8)
189+#define ETHTOOL_COALESCE_USE_ADAPTIVE_RX BIT(9)
190+#define ETHTOOL_COALESCE_USE_ADAPTIVE_TX BIT(10)
191+#define ETHTOOL_COALESCE_PKT_RATE_LOW BIT(11)
192+#define ETHTOOL_COALESCE_RX_USECS_LOW BIT(12)
193+#define ETHTOOL_COALESCE_RX_MAX_FRAMES_LOW BIT(13)
194+#define ETHTOOL_COALESCE_TX_USECS_LOW BIT(14)
195+#define ETHTOOL_COALESCE_TX_MAX_FRAMES_LOW BIT(15)
196+#define ETHTOOL_COALESCE_PKT_RATE_HIGH BIT(16)
197+#define ETHTOOL_COALESCE_RX_USECS_HIGH BIT(17)
198+#define ETHTOOL_COALESCE_RX_MAX_FRAMES_HIGH BIT(18)
199+#define ETHTOOL_COALESCE_TX_USECS_HIGH BIT(19)
200+#define ETHTOOL_COALESCE_TX_MAX_FRAMES_HIGH BIT(20)
201+#define ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL BIT(21)
202+
203+#define ETHTOOL_COALESCE_USECS \
204+ (ETHTOOL_COALESCE_RX_USECS | ETHTOOL_COALESCE_TX_USECS)
205+#define ETHTOOL_COALESCE_MAX_FRAMES \
206+ (ETHTOOL_COALESCE_RX_MAX_FRAMES | ETHTOOL_COALESCE_TX_MAX_FRAMES)
207+#define ETHTOOL_COALESCE_USECS_IRQ \
208+ (ETHTOOL_COALESCE_RX_USECS_IRQ | ETHTOOL_COALESCE_TX_USECS_IRQ)
209+#define ETHTOOL_COALESCE_MAX_FRAMES_IRQ \
210+ (ETHTOOL_COALESCE_RX_MAX_FRAMES_IRQ | \
211+ ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ)
212+#define ETHTOOL_COALESCE_USE_ADAPTIVE \
213+ (ETHTOOL_COALESCE_USE_ADAPTIVE_RX | ETHTOOL_COALESCE_USE_ADAPTIVE_TX)
214+#define ETHTOOL_COALESCE_USECS_LOW_HIGH \
215+ (ETHTOOL_COALESCE_RX_USECS_LOW | ETHTOOL_COALESCE_TX_USECS_LOW | \
216+ ETHTOOL_COALESCE_RX_USECS_HIGH | ETHTOOL_COALESCE_TX_USECS_HIGH)
217+#define ETHTOOL_COALESCE_MAX_FRAMES_LOW_HIGH \
218+ (ETHTOOL_COALESCE_RX_MAX_FRAMES_LOW | \
219+ ETHTOOL_COALESCE_TX_MAX_FRAMES_LOW | \
220+ ETHTOOL_COALESCE_RX_MAX_FRAMES_HIGH | \
221+ ETHTOOL_COALESCE_TX_MAX_FRAMES_HIGH)
222+#define ETHTOOL_COALESCE_PKT_RATE_RX_USECS \
223+ (ETHTOOL_COALESCE_USE_ADAPTIVE_RX | \
224+ ETHTOOL_COALESCE_RX_USECS_LOW | ETHTOOL_COALESCE_RX_USECS_HIGH | \
225+ ETHTOOL_COALESCE_PKT_RATE_LOW | ETHTOOL_COALESCE_PKT_RATE_HIGH | \
226+ ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL)
227+
180228 /**
181229 * struct ethtool_ops - optional netdev operations
230+ * @supported_coalesce_params: supported types of interrupt coalescing.
182231 * @get_drvinfo: Report driver/device information. Should only set the
183232 * @driver, @version, @fw_version and @bus_info fields. If not
184233 * implemented, the @driver and @bus_info fields will be filled in
@@ -207,8 +256,9 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 22 unmodified lines
207256 * or zero.
208257 * @get_coalesce: Get interrupt coalescing parameters. Returns a negative
209258 * error code or zero.
210− * @set_coalesce: Set interrupt coalescing parameters. Returns a negative
211− * error code or zero.
259+ * @set_coalesce: Set interrupt coalescing parameters. Supported coalescing
260+ * types should be set in @supported_coalesce_params.
261+ * Returns a negative error code or zero.
212262 * @get_ringparam: Report ring sizes
213263 * @set_ringparam: Set ring sizes. Returns a negative error code or zero.
214264 * @get_pauseparam: Report pause parameters
@@ -292,7 +342,8 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 77 unmodified lines
292342 * @set_per_queue_coalesce: Set interrupt coalescing parameters per queue.
293343 * It must check that the given queue number is valid. If neither a RX nor
294344 * a TX queue has this number, return -EINVAL. If only a RX queue or a TX
295− * queue has this number, ignore the inapplicable fields.
345+ * queue has this number, ignore the inapplicable fields. Supported
346+ * coalescing types should be set in @supported_coalesce_params.
296347 * Returns a negative error code or zero.
297348 * @get_link_ksettings: Get various device settings including Ethernet link
298349 * settings. The %cmd and %link_mode_masks_nwords fields should be
@@ -323,6 +374,7 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 24 unmodified lines
323374 * of the generic netdev features interface.
324375 */
325376 struct ethtool_ops {
377+ u32 supported_coalesce_params;
326378 void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
327379 int (*get_regs_len)(struct net_device *);
328380 void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
@@ -406,6 +458,8 @@ struct ethtool_ops { · 77 unmodified lines
406458 struct ethtool_stats *, u64 *);
407459 };
408460
461+int ethtool_check_ops(const struct ethtool_ops *ops);
462+
409463 struct ethtool_rx_flow_rule {
410464 struct flow_rule *rule;
411465 unsigned long priv[0];
@@ -420,4 +474,10 @@ struct ethtool_rx_flow_rule * · 8 unmodified lines
420474 ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input);
421475 void ethtool_rx_flow_rule_destroy(struct ethtool_rx_flow_rule *rule);
422476
477+bool ethtool_virtdev_validate_cmd(const struct ethtool_link_ksettings *cmd);
478+int ethtool_virtdev_set_link_ksettings(struct net_device *dev,
479+ const struct ethtool_link_ksettings *cmd,
480+ u32 *dev_speed, u8 *dev_duplex);
481+
482+
423483 #endif /* _LINUX_ETHTOOL_H */
include/linux/extcon-provider.h+14−14
@@ -17,30 +17,30 @@ struct extcon_dev; · 16 unmodified lines
1717 #if IS_ENABLED(CONFIG_EXTCON)
1818
1919 /* Following APIs register/unregister the extcon device. */
20−extern int extcon_dev_register(struct extcon_dev *edev);
21−extern void extcon_dev_unregister(struct extcon_dev *edev);
22−extern int devm_extcon_dev_register(struct device *dev,
20+int extcon_dev_register(struct extcon_dev *edev);
21+void extcon_dev_unregister(struct extcon_dev *edev);
22+int devm_extcon_dev_register(struct device *dev,
2323 struct extcon_dev *edev);
24−extern void devm_extcon_dev_unregister(struct device *dev,
24+void devm_extcon_dev_unregister(struct device *dev,
2525 struct extcon_dev *edev);
2626
2727 /* Following APIs allocate/free the memory of the extcon device. */
28−extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
29−extern void extcon_dev_free(struct extcon_dev *edev);
30−extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
28+struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
29+void extcon_dev_free(struct extcon_dev *edev);
30+struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
3131 const unsigned int *cable);
32−extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
32+void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
3333
3434 /* Synchronize the state and property value for each external connector. */
35−extern int extcon_sync(struct extcon_dev *edev, unsigned int id);
35+int extcon_sync(struct extcon_dev *edev, unsigned int id);
3636
3737 /*
3838 * Following APIs set the connected state of each external connector.
3939 * The 'id' argument indicates the defined external connector.
4040 */
41−extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
41+int extcon_set_state(struct extcon_dev *edev, unsigned int id,
4242 bool state);
43−extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
43+int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
4444 bool state);
4545
4646 /*
@@ -52,13 +52,13 @@ extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, · 5 unmodified lines
5252 * for each external connector. They are used to set the capability of the
5353 * property of each external connector based on the id and property.
5454 */
55−extern int extcon_set_property(struct extcon_dev *edev, unsigned int id,
55+int extcon_set_property(struct extcon_dev *edev, unsigned int id,
5656 unsigned int prop,
5757 union extcon_property_value prop_val);
58−extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
58+int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
5959 unsigned int prop,
6060 union extcon_property_value prop_val);
61−extern int extcon_set_property_capability(struct extcon_dev *edev,
61+int extcon_set_property_capability(struct extcon_dev *edev,
6262 unsigned int id, unsigned int prop);
6363
6464 #else /* CONFIG_EXTCON */
include/linux/extcon.h+5−0
@@ -286,6 +286,11 @@ static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, · 285 unmodified lines
286286 {
287287 return ERR_PTR(-ENODEV);
288288 }
289+
290+static inline const char *extcon_get_edev_name(struct extcon_dev *edev)
291+{
292+ return NULL;
293+}
289294 #endif /* CONFIG_EXTCON */
290295
291296 /*
include/linux/f2fs_fs.h+1−0
@@ -125,6 +125,7 @@ struct f2fs_super_block { · 124 unmodified lines
125125 /*
126126 * For checkpoint
127127 */
128+#define CP_RESIZEFS_FLAG 0x00004000
128129 #define CP_DISABLED_QUICK_FLAG 0x00002000
129130 #define CP_DISABLED_FLAG 0x00001000
130131 #define CP_QUOTA_NEED_FSCK_FLAG 0x00000800
include/linux/fanotify.h+2−1
@@ -47,7 +47,8 @@ · 46 unmodified lines
4747 * Directory entry modification events - reported only to directory
4848 * where entry is modified and not to a watching parent.
4949 */
50−#define FANOTIFY_DIRENT_EVENTS (FAN_MOVE | FAN_CREATE | FAN_DELETE)
50+#define FANOTIFY_DIRENT_EVENTS (FAN_MOVE | FAN_CREATE | FAN_DELETE | \
51+ FAN_DIR_MODIFY)
5152
5253 /* Events that can only be reported with data type FSNOTIFY_EVENT_INODE */
5354 #define FANOTIFY_INODE_EVENTS (FANOTIFY_DIRENT_EVENTS | \
include/linux/file.h+1−0
@@ -85,6 +85,7 @@ extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); · 84 unmodified lines
8585 extern int replace_fd(unsigned fd, struct file *file, unsigned flags);
8686 extern void set_close_on_exec(unsigned int fd, int flag);
8787 extern bool get_close_on_exec(unsigned int fd);
88+extern int __get_unused_fd_flags(unsigned flags, unsigned long nofile);
8889 extern int get_unused_fd_flags(unsigned flags);
8990 extern void put_unused_fd(unsigned int fd);
9091
include/linux/filter.h+31−17
@@ -561,7 +561,7 @@ DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key); · 560 unmodified lines
561561
562562 #define __BPF_PROG_RUN(prog, ctx, dfunc) ({ \
563563 u32 ret; \
564− cant_sleep(); \
564+ cant_migrate(); \
565565 if (static_branch_unlikely(&bpf_stats_enabled_key)) { \
566566 struct bpf_prog_stats *stats; \
567567 u64 start = sched_clock(); \
@@ -576,8 +576,30 @@ DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key); · 8 unmodified lines
576576 } \
577577 ret; })
578578
579−#define BPF_PROG_RUN(prog, ctx) __BPF_PROG_RUN(prog, ctx, \
580− bpf_dispatcher_nopfunc)
579+#define BPF_PROG_RUN(prog, ctx) \
580+ __BPF_PROG_RUN(prog, ctx, bpf_dispatcher_nop_func)
581+
582+/*
583+ * Use in preemptible and therefore migratable context to make sure that
584+ * the execution of the BPF program runs on one CPU.
585+ *
586+ * This uses migrate_disable/enable() explicitly to document that the
587+ * invocation of a BPF program does not require reentrancy protection
588+ * against a BPF program which is invoked from a preempting task.
589+ *
590+ * For non RT enabled kernels migrate_disable/enable() maps to
591+ * preempt_disable/enable(), i.e. it disables also preemption.
592+ */
593+static inline u32 bpf_prog_run_pin_on_cpu(const struct bpf_prog *prog,
594+ const void *ctx)
595+{
596+ u32 ret;
597+
598+ migrate_disable();
599+ ret = __BPF_PROG_RUN(prog, ctx, bpf_dispatcher_nop_func);
600+ migrate_enable();
601+ return ret;
602+}
581603
582604 #define BPF_SKB_CB_LEN QDISC_CB_PRIV_LEN
583605
@@ -655,6 +677,7 @@ static inline u8 *bpf_skb_cb(struct sk_buff *skb) · 71 unmodified lines
655677 return qdisc_skb_cb(skb)->data;
656678 }
657679
680+/* Must be invoked with migration disabled */
658681 static inline u32 __bpf_prog_run_save_cb(const struct bpf_prog *prog,
659682 struct sk_buff *skb)
660683 {
@@ -680,9 +703,9 @@ static inline u32 bpf_prog_run_save_cb(const struct bpf_prog *prog, · 19 unmodified lines
680703 {
681704 u32 res;
682705
683− preempt_disable();
706+ migrate_disable();
684707 res = __bpf_prog_run_save_cb(prog, skb);
685− preempt_enable();
708+ migrate_enable();
686709 return res;
687710 }
688711
@@ -695,13 +718,11 @@ static inline u32 bpf_prog_run_clear_cb(const struct bpf_prog *prog, · 6 unmodified lines
695718 if (unlikely(prog->cb_access))
696719 memset(cb_data, 0, BPF_SKB_CB_LEN);
697720
698− preempt_disable();
699− res = BPF_PROG_RUN(prog, skb);
700− preempt_enable();
721+ res = bpf_prog_run_pin_on_cpu(prog, skb);
701722 return res;
702723 }
703724
704−DECLARE_BPF_DISPATCHER(bpf_dispatcher_xdp)
725+DECLARE_BPF_DISPATCHER(xdp)
705726
706727 static __always_inline u32 bpf_prog_run_xdp(const struct bpf_prog *prog,
707728 struct xdp_buff *xdp)
@@ -712,8 +733,7 @@ static __always_inline u32 bpf_prog_run_xdp(const struct bpf_prog *prog, · 4 unmodified lines
712733 * already takes rcu_read_lock() when fetching the program, so
713734 * it's not necessary here anymore.
714735 */
715− return __BPF_PROG_RUN(prog, xdp,
716− BPF_DISPATCHER_FUNC(bpf_dispatcher_xdp));
736+ return __BPF_PROG_RUN(prog, xdp, BPF_DISPATCHER_FUNC(xdp));
717737 }
718738
719739 void bpf_prog_change_xdp(struct bpf_prog *prev_prog, struct bpf_prog *prog);
@@ -1063,7 +1083,6 @@ bpf_address_lookup(unsigned long addr, unsigned long *size, · 343 unmodified lines
10631083
10641084 void bpf_prog_kallsyms_add(struct bpf_prog *fp);
10651085 void bpf_prog_kallsyms_del(struct bpf_prog *fp);
1066−void bpf_get_prog_name(const struct bpf_prog *prog, char *sym);
10671086
10681087 #else /* CONFIG_BPF_JIT */
10691088
@@ -1132,11 +1151,6 @@ static inline void bpf_prog_kallsyms_del(struct bpf_prog *fp) · 62 unmodified lines
11321151 {
11331152 }
11341153
1135−static inline void bpf_get_prog_name(const struct bpf_prog *prog, char *sym)
1136−{
1137− sym[0] = '\0';
1138−}
1139−
11401154 #endif /* CONFIG_BPF_JIT */
11411155
11421156 void bpf_prog_kallsyms_del_all(struct bpf_prog *fp);
include/linux/firmware.h+9−0
@@ -44,6 +44,8 @@ int request_firmware(const struct firmware **fw, const char *name, · 43 unmodified lines
4444 struct device *device);
4545 int firmware_request_nowarn(const struct firmware **fw, const char *name,
4646 struct device *device);
47+int firmware_request_platform(const struct firmware **fw, const char *name,
48+ struct device *device);
4749 int request_firmware_nowait(
4850 struct module *module, bool uevent,
4951 const char *name, struct device *device, gfp_t gfp, void *context,
@@ -69,6 +71,13 @@ static inline int firmware_request_nowarn(const struct firmware **fw, · 19 unmodified lines
6971 return -EINVAL;
7072 }
7173
74+static inline int firmware_request_platform(const struct firmware **fw,
75+ const char *name,
76+ struct device *device)
77+{
78+ return -EINVAL;
79+}
80+
7281 static inline int request_firmware_nowait(
7382 struct module *module, bool uevent,
7483 const char *name, struct device *device, gfp_t gfp, void *context,
include/linux/firmware/imx/ipc.h+0−1
@@ -25,7 +25,6 @@ enum imx_sc_rpc_svc { · 24 unmodified lines
2525 IMX_SC_RPC_SVC_PAD = 6,
2626 IMX_SC_RPC_SVC_MISC = 7,
2727 IMX_SC_RPC_SVC_IRQ = 8,
28− IMX_SC_RPC_SVC_ABORT = 9
2928 };
3029
3130 struct imx_sc_rpc_msg {
include/linux/firmware/meson/meson_sm.h+2−0
@@ -12,6 +12,8 @@ enum { · 11 unmodified lines
1212 SM_EFUSE_WRITE,
1313 SM_EFUSE_USER_MAX,
1414 SM_GET_CHIP_ID,
15+ SM_A1_PWRC_SET,
16+ SM_A1_PWRC_GET,
1517 };
1618
1719 struct meson_sm_firmware;
include/linux/firmware/xlnx-zynqmp.h+11−2
@@ -82,6 +82,7 @@ enum pm_api_id { · 81 unmodified lines
8282 PM_CLOCK_GETRATE,
8383 PM_CLOCK_SETPARENT,
8484 PM_CLOCK_GETPARENT,
85+ PM_SECURE_AES = 47,
8586 PM_FEATURE_CHECK = 63,
8687 PM_API_MAX,
8788 };
@@ -100,7 +101,8 @@ enum pm_ret_status { · 12 unmodified lines
100101 };
101102
102103 enum pm_ioctl_id {
103− IOCTL_SET_SD_TAPDELAY = 7,
104+ IOCTL_SD_DLL_RESET = 6,
105+ IOCTL_SET_SD_TAPDELAY,
104106 IOCTL_SET_PLL_FRAC_MODE,
105107 IOCTL_GET_PLL_FRAC_MODE,
106108 IOCTL_SET_PLL_FRAC_DATA,
@@ -271,6 +273,12 @@ enum tap_delay_type { · 164 unmodified lines
271273 PM_TAPDELAY_OUTPUT,
272274 };
273275
276+enum dll_reset_type {
277+ PM_DLL_RESET_ASSERT,
278+ PM_DLL_RESET_RELEASE,
279+ PM_DLL_RESET_PULSE,
280+};
281+
274282 /**
275283 * struct zynqmp_pm_query_data - PM query data
276284 * @qid: query ID
@@ -315,12 +323,13 @@ struct zynqmp_eemi_ops { · 38 unmodified lines
315323 const u32 capabilities,
316324 const u32 qos,
317325 const enum zynqmp_pm_request_ack ack);
326+ int (*aes)(const u64 address, u32 *out);
318327 };
319328
320329 int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1,
321330 u32 arg2, u32 arg3, u32 *ret_payload);
322331
323−#if IS_REACHABLE(CONFIG_ARCH_ZYNQMP)
332+#if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE)
324333 const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void);
325334 #else
326335 static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
include/linux/fs.h+10−2
@@ -526,6 +526,11 @@ static inline void i_mmap_lock_write(struct address_space *mapping) · 525 unmodified lines
526526 down_write(&mapping->i_mmap_rwsem);
527527 }
528528
529+static inline int i_mmap_trylock_write(struct address_space *mapping)
530+{
531+ return down_write_trylock(&mapping->i_mmap_rwsem);
532+}
533+
529534 static inline void i_mmap_unlock_write(struct address_space *mapping)
530535 {
531536 up_write(&mapping->i_mmap_rwsem);
@@ -698,6 +703,7 @@ struct inode { · 166 unmodified lines
698703 struct rcu_head i_rcu;
699704 };
700705 atomic64_t i_version;
706+ atomic64_t i_sequence; /* see futex */
701707 atomic_t i_count;
702708 atomic_t i_dio_count;
703709 atomic_t i_writecount;
@@ -2699,7 +2705,6 @@ static inline void unregister_chrdev(unsigned int major, const char *name) · 1995 unmodified lines
26992705
27002706 #ifdef CONFIG_BLOCK
27012707 #define BLKDEV_MAJOR_MAX 512
2702−extern const char *__bdevname(dev_t, char *buffer);
27032708 extern const char *bdevname(struct block_device *bdev, char *buffer);
27042709 extern struct block_device *lookup_bdev(const char *);
27052710 extern void blkdev_show(struct seq_file *,off_t);
@@ -2982,6 +2987,7 @@ extern int do_pipe_flags(int *, int); · 276 unmodified lines
29822987 id(UNKNOWN, unknown) \
29832988 id(FIRMWARE, firmware) \
29842989 id(FIRMWARE_PREALLOC_BUFFER, firmware) \
2990+ id(FIRMWARE_EFI_EMBEDDED, firmware) \
29852991 id(MODULE, kernel-module) \
29862992 id(KEXEC_IMAGE, kexec-image) \
29872993 id(KEXEC_INITRAMFS, kexec-initramfs) \
@@ -3012,6 +3018,8 @@ extern int kernel_read_file(struct file *, void **, loff_t *, loff_t, · 24 unmodified lines
30123018 enum kernel_read_file_id);
30133019 extern int kernel_read_file_from_path(const char *, void **, loff_t *, loff_t,
30143020 enum kernel_read_file_id);
3021+extern int kernel_read_file_from_path_initns(const char *, void **, loff_t *, loff_t,
3022+ enum kernel_read_file_id);
30153023 extern int kernel_read_file_from_fd(int, void **, loff_t *, loff_t,
30163024 enum kernel_read_file_id);
30173025 extern ssize_t kernel_read(struct file *, void *, size_t, loff_t *);
@@ -3391,7 +3399,7 @@ static inline bool io_is_direct(struct file *filp) · 373 unmodified lines
33913399 return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host);
33923400 }
33933401
3394−static inline bool vma_is_dax(struct vm_area_struct *vma)
3402+static inline bool vma_is_dax(const struct vm_area_struct *vma)
33953403 {
33963404 return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host);
33973405 }
include/linux/fscrypt.h+6−0
@@ -139,6 +139,7 @@ extern void fscrypt_free_bounce_page(struct page *bounce_page); · 138 unmodified lines
139139 extern int fscrypt_ioctl_set_policy(struct file *, const void __user *);
140140 extern int fscrypt_ioctl_get_policy(struct file *, void __user *);
141141 extern int fscrypt_ioctl_get_policy_ex(struct file *, void __user *);
142+extern int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg);
142143 extern int fscrypt_has_permitted_context(struct inode *, struct inode *);
143144 extern int fscrypt_inherit_context(struct inode *, struct inode *,
144145 void *, bool);
@@ -300,6 +301,11 @@ static inline int fscrypt_ioctl_get_policy_ex(struct file *filp, · 155 unmodified lines
300301 return -EOPNOTSUPP;
301302 }
302303
304+static inline int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg)
305+{
306+ return -EOPNOTSUPP;
307+}
308+
303309 static inline int fscrypt_has_permitted_context(struct inode *parent,
304310 struct inode *child)
305311 {
include/linux/fsl/mc.h+16−0
@@ -381,6 +381,22 @@ int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver, · 380 unmodified lines
381381
382382 void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
383383
384+/**
385+ * struct fsl_mc_version
386+ * @major: Major version number: incremented on API compatibility changes
387+ * @minor: Minor version number: incremented on API additions (that are
388+ * backward compatible); reset when major version is incremented
389+ * @revision: Internal revision number: incremented on implementation changes
390+ * and/or bug fixes that have no impact on API
391+ */
392+struct fsl_mc_version {
393+ u32 major;
394+ u32 minor;
395+ u32 revision;
396+};
397+
398+struct fsl_mc_version *fsl_mc_get_version(void);
399+
384400 int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
385401 u16 mc_io_flags,
386402 struct fsl_mc_io **new_mc_io);
include/linux/fsl/ptp_qoriq.h+0−2
@@ -149,8 +149,6 @@ struct ptp_qoriq { · 148 unmodified lines
149149 bool extts_fifo_support;
150150 int irq;
151151 int phc_index;
152− u64 alarm_interval; /* for periodic alarm */
153− u64 alarm_value;
154152 u32 tclk_period; /* nanoseconds */
155153 u32 tmr_prsc;
156154 u32 tmr_add;
include/linux/fsnotify.h+58−80
@@ -18,39 +18,63 @@ · 17 unmodified lines
1818 #include <linux/bug.h>
1919
2020 /*
21− * Notify this @dir inode about a change in the directory entry @dentry.
21+ * Notify this @dir inode about a change in a child directory entry.
22+ * The directory entry may have turned positive or negative or its inode may
23+ * have changed (i.e. renamed over).
2224 *
2325 * Unlike fsnotify_parent(), the event will be reported regardless of the
2426 * FS_EVENT_ON_CHILD mask on the parent inode.
2527 */
26−static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry,
27− __u32 mask)
28+static inline void fsnotify_name(struct inode *dir, __u32 mask,
29+ struct inode *child,
30+ const struct qstr *name, u32 cookie)
2831 {
29− return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE,
30− &dentry->d_name, 0);
32+ fsnotify(dir, mask, child, FSNOTIFY_EVENT_INODE, name, cookie);
33+ /*
34+ * Send another flavor of the event without child inode data and
35+ * without the specific event type (e.g. FS_CREATE|FS_IS_DIR).
36+ * The name is relative to the dir inode the event is reported to.
37+ */
38+ fsnotify(dir, FS_DIR_MODIFY, dir, FSNOTIFY_EVENT_INODE, name, 0);
3139 }
3240
33−/* Notify this dentry's parent about a child's events. */
34−static inline int fsnotify_parent(const struct path *path,
35− struct dentry *dentry, __u32 mask)
41+static inline void fsnotify_dirent(struct inode *dir, struct dentry *dentry,
42+ __u32 mask)
3643 {
37− if (!dentry)
38− dentry = path->dentry;
39−
40− return __fsnotify_parent(path, dentry, mask);
44+ fsnotify_name(dir, mask, d_inode(dentry), &dentry->d_name, 0);
4145 }
4246
4347 /*
44− * Simple wrapper to consolidate calls fsnotify_parent()/fsnotify() when
45− * an event is on a path.
48+ * Simple wrappers to consolidate calls fsnotify_parent()/fsnotify() when
49+ * an event is on a file/dentry.
4650 */
47−static inline int fsnotify_path(struct inode *inode, const struct path *path,
48− __u32 mask)
51+static inline void fsnotify_dentry(struct dentry *dentry, __u32 mask)
52+{
53+ struct inode *inode = d_inode(dentry);
54+
55+ if (S_ISDIR(inode->i_mode))
56+ mask |= FS_ISDIR;
57+
58+ fsnotify_parent(dentry, mask, inode, FSNOTIFY_EVENT_INODE);
59+ fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
60+}
61+
62+static inline int fsnotify_file(struct file *file, __u32 mask)
4963 {
50− int ret = fsnotify_parent(path, NULL, mask);
64+ const struct path *path = &file->f_path;
65+ struct inode *inode = file_inode(file);
66+ int ret;
67+
68+ if (file->f_mode & FMODE_NONOTIFY)
69+ return 0;
70+
71+ if (S_ISDIR(inode->i_mode))
72+ mask |= FS_ISDIR;
5173
74+ ret = fsnotify_parent(path->dentry, mask, path, FSNOTIFY_EVENT_PATH);
5275 if (ret)
5376 return ret;
77+
5478 return fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
5579 }
5680
@@ -58,19 +82,16 @@ static inline int fsnotify_path(struct inode *inode, const struct path *path, · 1 unmodified line
5882 static inline int fsnotify_perm(struct file *file, int mask)
5983 {
6084 int ret;
61− const struct path *path = &file->f_path;
62− struct inode *inode = file_inode(file);
6385 __u32 fsnotify_mask = 0;
6486
65− if (file->f_mode & FMODE_NONOTIFY)
66− return 0;
6787 if (!(mask & (MAY_READ | MAY_OPEN)))
6888 return 0;
89+
6990 if (mask & MAY_OPEN) {
7091 fsnotify_mask = FS_OPEN_PERM;
7192
7293 if (file->f_flags & __FMODE_EXEC) {
73− ret = fsnotify_path(inode, path, FS_OPEN_EXEC_PERM);
94+ ret = fsnotify_file(file, FS_OPEN_EXEC_PERM);
7495
7596 if (ret)
7697 return ret;
@@ -79,10 +100,7 @@ static inline int fsnotify_perm(struct file *file, int mask) · 2 unmodified lines
79100 fsnotify_mask = FS_ACCESS_PERM;
80101 }
81102
82− if (S_ISDIR(inode->i_mode))
83− fsnotify_mask |= FS_ISDIR;
84−
85− return fsnotify_path(inode, path, fsnotify_mask);
103+ return fsnotify_file(file, fsnotify_mask);
86104 }
87105
88106 /*
@@ -122,10 +140,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, · 33 unmodified lines
122140 mask |= FS_ISDIR;
123141 }
124142
125− fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name,
126− fs_cookie);
127− fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name,
128− fs_cookie);
143+ fsnotify_name(old_dir, old_dir_mask, source, old_name, fs_cookie);
144+ fsnotify_name(new_dir, new_dir_mask, source, new_name, fs_cookie);
129145
130146 if (target)
131147 fsnotify_link_count(target);
@@ -180,12 +196,13 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) · 48 unmodified lines
180196 * Note: We have to pass also the linked inode ptr as some filesystems leave
181197 * new_dentry->d_inode NULL and instantiate inode pointer later
182198 */
183−static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
199+static inline void fsnotify_link(struct inode *dir, struct inode *inode,
200+ struct dentry *new_dentry)
184201 {
185202 fsnotify_link_count(inode);
186203 audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE);
187204
188− fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0);
205+ fsnotify_name(dir, FS_CREATE, inode, &new_dentry->d_name, 0);
189206 }
190207
191208 /*
@@ -229,15 +246,7 @@ static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) · 37 unmodified lines
229246 */
230247 static inline void fsnotify_access(struct file *file)
231248 {
232− const struct path *path = &file->f_path;
233− struct inode *inode = file_inode(file);
234− __u32 mask = FS_ACCESS;
235−
236− if (S_ISDIR(inode->i_mode))
237− mask |= FS_ISDIR;
238−
239− if (!(file->f_mode & FMODE_NONOTIFY))
240− fsnotify_path(inode, path, mask);
249+ fsnotify_file(file, FS_ACCESS);
241250 }
242251
243252 /*
@@ -245,15 +254,7 @@ static inline void fsnotify_access(struct file *file) · 1 unmodified line
245254 */
246255 static inline void fsnotify_modify(struct file *file)
247256 {
248− const struct path *path = &file->f_path;
249− struct inode *inode = file_inode(file);
250− __u32 mask = FS_MODIFY;
251−
252− if (S_ISDIR(inode->i_mode))
253− mask |= FS_ISDIR;
254−
255− if (!(file->f_mode & FMODE_NONOTIFY))
256− fsnotify_path(inode, path, mask);
257+ fsnotify_file(file, FS_MODIFY);
257258 }
258259
259260 /*
@@ -261,16 +262,12 @@ static inline void fsnotify_modify(struct file *file) · 1 unmodified line
261262 */
262263 static inline void fsnotify_open(struct file *file)
263264 {
264− const struct path *path = &file->f_path;
265− struct inode *inode = file_inode(file);
266265 __u32 mask = FS_OPEN;
267266
268− if (S_ISDIR(inode->i_mode))
269− mask |= FS_ISDIR;
270267 if (file->f_flags & __FMODE_EXEC)
271268 mask |= FS_OPEN_EXEC;
272269
273− fsnotify_path(inode, path, mask);
270+ fsnotify_file(file, mask);
274271 }
275272
276273 /*
@@ -278,16 +275,10 @@ static inline void fsnotify_open(struct file *file) · 1 unmodified line
278275 */
279276 static inline void fsnotify_close(struct file *file)
280277 {
281− const struct path *path = &file->f_path;
282− struct inode *inode = file_inode(file);
283− fmode_t mode = file->f_mode;
284− __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
278+ __u32 mask = (file->f_mode & FMODE_WRITE) ? FS_CLOSE_WRITE :
279+ FS_CLOSE_NOWRITE;
285280
286− if (S_ISDIR(inode->i_mode))
287− mask |= FS_ISDIR;
288−
289− if (!(file->f_mode & FMODE_NONOTIFY))
290− fsnotify_path(inode, path, mask);
281+ fsnotify_file(file, mask);
291282 }
292283
293284 /*
@@ -295,14 +286,7 @@ static inline void fsnotify_close(struct file *file) · 1 unmodified line
295286 */
296287 static inline void fsnotify_xattr(struct dentry *dentry)
297288 {
298− struct inode *inode = dentry->d_inode;
299− __u32 mask = FS_ATTRIB;
300−
301− if (S_ISDIR(inode->i_mode))
302− mask |= FS_ISDIR;
303−
304− fsnotify_parent(NULL, dentry, mask);
305− fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
289+ fsnotify_dentry(dentry, FS_ATTRIB);
306290 }
307291
308292 /*
@@ -311,7 +295,6 @@ static inline void fsnotify_xattr(struct dentry *dentry) · 2 unmodified lines
311295 */
312296 static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
313297 {
314− struct inode *inode = dentry->d_inode;
315298 __u32 mask = 0;
316299
317300 if (ia_valid & ATTR_UID)
@@ -332,13 +315,8 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) · 14 unmodified lines
332315 if (ia_valid & ATTR_MODE)
333316 mask |= FS_ATTRIB;
334317
335− if (mask) {
336− if (S_ISDIR(inode->i_mode))
337− mask |= FS_ISDIR;
338−
339− fsnotify_parent(NULL, dentry, mask);
340− fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
341− }
318+ if (mask)
319+ fsnotify_dentry(dentry, mask);
342320 }
343321
344322 #endif /* _LINUX_FS_NOTIFY_H */
include/linux/fsnotify_backend.h+49−21
@@ -47,18 +47,18 @@ · 46 unmodified lines
4747 #define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */
4848 #define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */
4949 #define FS_OPEN_EXEC_PERM 0x00040000 /* open/exec event in a permission hook */
50+#define FS_DIR_MODIFY 0x00080000 /* Directory entry was modified */
5051
5152 #define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */
52−#define FS_ISDIR 0x40000000 /* event occurred against dir */
53−#define FS_IN_ONESHOT 0x80000000 /* only send event once */
54−
55−#define FS_DN_RENAME 0x10000000 /* file renamed */
56−#define FS_DN_MULTISHOT 0x20000000 /* dnotify multishot */
57−
5853 /* This inode cares about things that happen to its children. Always set for
5954 * dnotify and inotify. */
6055 #define FS_EVENT_ON_CHILD 0x08000000
6156
57+#define FS_DN_RENAME 0x10000000 /* file renamed */
58+#define FS_DN_MULTISHOT 0x20000000 /* dnotify multishot */
59+#define FS_ISDIR 0x40000000 /* event occurred against dir */
60+#define FS_IN_ONESHOT 0x80000000 /* only send event once */
61+
6262 #define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO)
6363
6464 /*
@@ -67,7 +67,8 @@ · 2 unmodified lines
6767 * The watching parent may get an FS_ATTRIB|FS_EVENT_ON_CHILD event
6868 * when a directory entry inside a child subdir changes.
6969 */
70−#define ALL_FSNOTIFY_DIRENT_EVENTS (FS_CREATE | FS_DELETE | FS_MOVE)
70+#define ALL_FSNOTIFY_DIRENT_EVENTS (FS_CREATE | FS_DELETE | FS_MOVE | \
71+ FS_DIR_MODIFY)
7172
7273 #define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM | \
7374 FS_OPEN_EXEC_PERM)
@@ -133,8 +134,7 @@ struct fsnotify_ops { · 59 unmodified lines
133134 */
134135 struct fsnotify_event {
135136 struct list_head list;
136− /* inode may ONLY be dereferenced during handle_event(). */
137− struct inode *inode; /* either the inode the event happened to or its parent */
137+ unsigned long objectid; /* identifier for queue merges */
138138 };
139139
140140 /*
@@ -213,10 +213,36 @@ struct fsnotify_group { · 72 unmodified lines
213213 };
214214 };
215215
216−/* when calling fsnotify tell it if the data is a path or inode */
217−#define FSNOTIFY_EVENT_NONE 0
218−#define FSNOTIFY_EVENT_PATH 1
219−#define FSNOTIFY_EVENT_INODE 2
216+/* When calling fsnotify tell it if the data is a path or inode */
217+enum fsnotify_data_type {
218+ FSNOTIFY_EVENT_NONE,
219+ FSNOTIFY_EVENT_PATH,
220+ FSNOTIFY_EVENT_INODE,
221+};
222+
223+static inline const struct inode *fsnotify_data_inode(const void *data,
224+ int data_type)
225+{
226+ switch (data_type) {
227+ case FSNOTIFY_EVENT_INODE:
228+ return data;
229+ case FSNOTIFY_EVENT_PATH:
230+ return d_inode(((const struct path *)data)->dentry);
231+ default:
232+ return NULL;
233+ }
234+}
235+
236+static inline const struct path *fsnotify_data_path(const void *data,
237+ int data_type)
238+{
239+ switch (data_type) {
240+ case FSNOTIFY_EVENT_PATH:
241+ return data;
242+ default:
243+ return NULL;
244+ }
245+}
220246
221247 enum fsnotify_obj_type {
222248 FSNOTIFY_OBJ_TYPE_INODE,
@@ -351,9 +377,10 @@ struct fsnotify_mark { · 128 unmodified lines
351377 /* called from the vfs helpers */
352378
353379 /* main fsnotify call to send events */
354−extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
355− const struct qstr *name, u32 cookie);
356−extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask);
380+extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data,
381+ int data_type, const struct qstr *name, u32 cookie);
382+extern int fsnotify_parent(struct dentry *dentry, __u32 mask, const void *data,
383+ int data_type);
357384 extern void __fsnotify_inode_delete(struct inode *inode);
358385 extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
359386 extern void fsnotify_sb_delete(struct super_block *sb);
@@ -500,21 +527,22 @@ extern void fsnotify_finish_user_wait(struct fsnotify_iter_info *iter_info); · 140 unmodified lines
500527 extern bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info);
501528
502529 static inline void fsnotify_init_event(struct fsnotify_event *event,
503− struct inode *inode)
530+ unsigned long objectid)
504531 {
505532 INIT_LIST_HEAD(&event->list);
506− event->inode = inode;
533+ event->objectid = objectid;
507534 }
508535
509536 #else
510537
511−static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
512− const struct qstr *name, u32 cookie)
538+static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data,
539+ int data_type, const struct qstr *name, u32 cookie)
513540 {
514541 return 0;
515542 }
516543
517−static inline int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask)
544+static inline int fsnotify_parent(struct dentry *dentry, __u32 mask,
545+ const void *data, int data_type)
518546 {
519547 return 0;
520548 }
include/linux/futex.h+10−7
@@ -31,23 +31,26 @@ struct task_struct; · 30 unmodified lines
3131
3232 union futex_key {
3333 struct {
34+ u64 i_seq;
3435 unsigned long pgoff;
35− struct inode *inode;
36− int offset;
36+ unsigned int offset;
3737 } shared;
3838 struct {
39+ union {
40+ struct mm_struct *mm;
41+ u64 __tmp;
42+ };
3943 unsigned long address;
40− struct mm_struct *mm;
41− int offset;
44+ unsigned int offset;
4245 } private;
4346 struct {
47+ u64 ptr;
4448 unsigned long word;
45− void *ptr;
46− int offset;
49+ unsigned int offset;
4750 } both;
4851 };
4952
50−#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
53+#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = 0ULL } }
5154
5255 #ifdef CONFIG_FUTEX
5356 enum {
include/linux/fwnode.h+2−0
@@ -170,4 +170,6 @@ struct fwnode_operations { · 169 unmodified lines
170170 } while (false)
171171 #define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev)
172172
173+extern u32 fw_devlink_get_flags(void);
174+
173175 #endif
include/linux/genhd.h+61−473
@@ -27,39 +27,8 @@ · 26 unmodified lines
2727 #define part_to_dev(part) (&((part)->__dev))
2828
2929 extern struct device_type part_type;
30−extern struct kobject *block_depr;
3130 extern struct class block_class;
3231
33−enum {
34−/* These three have identical behaviour; use the second one if DOS FDISK gets
35− confused about extended/logical partitions starting past cylinder 1023. */
36− DOS_EXTENDED_PARTITION = 5,
37− LINUX_EXTENDED_PARTITION = 0x85,
38− WIN98_EXTENDED_PARTITION = 0x0f,
39−
40− SUN_WHOLE_DISK = DOS_EXTENDED_PARTITION,
41−
42− LINUX_SWAP_PARTITION = 0x82,
43− LINUX_DATA_PARTITION = 0x83,
44− LINUX_LVM_PARTITION = 0x8e,
45− LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */
46−
47− SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION,
48− NEW_SOLARIS_X86_PARTITION = 0xbf,
49−
50− DM6_AUX1PARTITION = 0x51, /* no DDO: use xlated geom */
51− DM6_AUX3PARTITION = 0x53, /* no DDO: use xlated geom */
52− DM6_PARTITION = 0x54, /* has DDO: use xlated geom & offset */
53− EZD_PARTITION = 0x55, /* EZ-DRIVE */
54−
55− FREEBSD_PARTITION = 0xa5, /* FreeBSD Partition ID */
56− OPENBSD_PARTITION = 0xa6, /* OpenBSD Partition ID */
57− NETBSD_PARTITION = 0xa9, /* NetBSD Partition ID */
58− BSDI_PARTITION = 0xb7, /* BSDI Partition ID */
59− MINIX_PARTITION = 0x81, /* Minix Partition ID */
60− UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */
61−};
62−
6332 #define DISK_MAX_PARTS 256
6433 #define DISK_NAME_LEN 32
6534
@@ -70,26 +39,12 @@ enum { · 4 unmodified lines
7039 #include <linux/fs.h>
7140 #include <linux/workqueue.h>
7241
73−struct partition {
74− unsigned char boot_ind; /* 0x80 - active */
75− unsigned char head; /* starting head */
76− unsigned char sector; /* starting sector */
77− unsigned char cyl; /* starting cylinder */
78− unsigned char sys_ind; /* What partition type */
79− unsigned char end_head; /* end head */
80− unsigned char end_sector; /* end sector */
81− unsigned char end_cyl; /* end cylinder */
82− __le32 start_sect; /* starting sector counting from 0 */
83− __le32 nr_sects; /* nr of sectors in partition */
84−} __attribute__((packed));
85−
8642 struct disk_stats {
8743 u64 nsecs[NR_STAT_GROUPS];
8844 unsigned long sectors[NR_STAT_GROUPS];
8945 unsigned long ios[NR_STAT_GROUPS];
9046 unsigned long merges[NR_STAT_GROUPS];
9147 unsigned long io_ticks;
92− unsigned long time_in_queue;
9348 local_t in_flight[2];
9449 };
9550
@@ -133,17 +88,64 @@ struct hd_struct { · 37 unmodified lines
13388 struct rcu_work rcu_work;
13489 };
13590
136−#define GENHD_FL_REMOVABLE 1
137−/* 2 is unused */
138−#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4
139−#define GENHD_FL_CD 8
140−#define GENHD_FL_UP 16
141−#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
142−#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
143−#define GENHD_FL_NATIVE_CAPACITY 128
144−#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256
145−#define GENHD_FL_NO_PART_SCAN 512
146−#define GENHD_FL_HIDDEN 1024
91+/**
92+ * DOC: genhd capability flags
93+ *
94+ * ``GENHD_FL_REMOVABLE`` (0x0001): indicates that the block device
95+ * gives access to removable media.
96+ * When set, the device remains present even when media is not
97+ * inserted.
98+ * Must not be set for devices which are removed entirely when the
99+ * media is removed.
100+ *
101+ * ``GENHD_FL_CD`` (0x0008): the block device is a CD-ROM-style
102+ * device.
103+ * Affects responses to the ``CDROM_GET_CAPABILITY`` ioctl.
104+ *
105+ * ``GENHD_FL_UP`` (0x0010): indicates that the block device is "up",
106+ * with a similar meaning to network interfaces.
107+ *
108+ * ``GENHD_FL_SUPPRESS_PARTITION_INFO`` (0x0020): don't include
109+ * partition information in ``/proc/partitions`` or in the output of
110+ * printk_all_partitions().
111+ * Used for the null block device and some MMC devices.
112+ *
113+ * ``GENHD_FL_EXT_DEVT`` (0x0040): the driver supports extended
114+ * dynamic ``dev_t``, i.e. it wants extended device numbers
115+ * (``BLOCK_EXT_MAJOR``).
116+ * This affects the maximum number of partitions.
117+ *
118+ * ``GENHD_FL_NATIVE_CAPACITY`` (0x0080): based on information in the
119+ * partition table, the device's capacity has been extended to its
120+ * native capacity; i.e. the device has hidden capacity used by one
121+ * of the partitions (this is a flag used so that native capacity is
122+ * only ever unlocked once).
123+ *
124+ * ``GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE`` (0x0100): event polling is
125+ * blocked whenever a writer holds an exclusive lock.
126+ *
127+ * ``GENHD_FL_NO_PART_SCAN`` (0x0200): partition scanning is disabled.
128+ * Used for loop devices in their default settings and some MMC
129+ * devices.
130+ *
131+ * ``GENHD_FL_HIDDEN`` (0x0400): the block device is hidden; it
132+ * doesn't produce events, doesn't appear in sysfs, and doesn't have
133+ * an associated ``bdev``.
134+ * Implies ``GENHD_FL_SUPPRESS_PARTITION_INFO`` and
135+ * ``GENHD_FL_NO_PART_SCAN``.
136+ * Used for multipath devices.
137+ */
138+#define GENHD_FL_REMOVABLE 0x0001
139+/* 2 is unused (used to be GENHD_FL_DRIVERFS) */
140+/* 4 is unused (used to be GENHD_FL_MEDIA_CHANGE_NOTIFY) */
141+#define GENHD_FL_CD 0x0008
142+#define GENHD_FL_UP 0x0010
143+#define GENHD_FL_SUPPRESS_PARTITION_INFO 0x0020
144+#define GENHD_FL_EXT_DEVT 0x0040
145+#define GENHD_FL_NATIVE_CAPACITY 0x0080
146+#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 0x0100
147+#define GENHD_FL_NO_PART_SCAN 0x0200
148+#define GENHD_FL_HIDDEN 0x0400
147149
148150 enum {
149151 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
@@ -189,7 +191,6 @@ struct gendisk { · 39 unmodified lines
189191 * disks that can't be partitioned. */
190192
191193 char disk_name[DISK_NAME_LEN]; /* name of major driver */
192− char *(*devnode)(struct gendisk *gd, umode_t *mode);
193194
194195 unsigned short events; /* supported events */
195196 unsigned short event_flags; /* flags related to event processing */
@@ -245,18 +246,6 @@ static inline bool disk_part_scan_enabled(struct gendisk *disk) · 49 unmodified lines
245246 !(disk->flags & GENHD_FL_NO_PART_SCAN);
246247 }
247248
248−static inline bool disk_has_partitions(struct gendisk *disk)
249−{
250− bool ret = false;
251−
252− rcu_read_lock();
253− if (rcu_dereference(disk->part_tbl)->len > 1)
254− ret = true;
255− rcu_read_unlock();
256−
257− return ret;
258−}
259−
260249 static inline dev_t disk_devt(struct gendisk *disk)
261250 {
262251 return MKDEV(disk->major, disk->first_minor);
@@ -295,143 +284,7 @@ extern void disk_part_iter_init(struct disk_part_iter *piter, · 32 unmodified lines
295284 struct gendisk *disk, unsigned int flags);
296285 extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter);
297286 extern void disk_part_iter_exit(struct disk_part_iter *piter);
298−
299−extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk,
300− sector_t sector);
301−
302−/*
303− * Macros to operate on percpu disk statistics:
304− *
305− * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters
306− * and should be called between disk_stat_lock() and
307− * disk_stat_unlock().
308− *
309− * part_stat_read() can be called at any time.
310− *
311− * part_stat_{add|set_all}() and {init|free}_part_stats are for
312− * internal use only.
313− */
314−#ifdef CONFIG_SMP
315−#define part_stat_lock() ({ rcu_read_lock(); get_cpu(); })
316−#define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0)
317−
318−#define part_stat_get_cpu(part, field, cpu) \
319− (per_cpu_ptr((part)->dkstats, (cpu))->field)
320−
321−#define part_stat_get(part, field) \
322− part_stat_get_cpu(part, field, smp_processor_id())
323−
324−#define part_stat_read(part, field) \
325−({ \
326− typeof((part)->dkstats->field) res = 0; \
327− unsigned int _cpu; \
328− for_each_possible_cpu(_cpu) \
329− res += per_cpu_ptr((part)->dkstats, _cpu)->field; \
330− res; \
331−})
332−
333−static inline void part_stat_set_all(struct hd_struct *part, int value)
334−{
335− int i;
336−
337− for_each_possible_cpu(i)
338− memset(per_cpu_ptr(part->dkstats, i), value,
339− sizeof(struct disk_stats));
340−}
341−
342−static inline int init_part_stats(struct hd_struct *part)
343−{
344− part->dkstats = alloc_percpu(struct disk_stats);
345− if (!part->dkstats)
346− return 0;
347− return 1;
348−}
349−
350−static inline void free_part_stats(struct hd_struct *part)
351−{
352− free_percpu(part->dkstats);
353−}
354−
355−#else /* !CONFIG_SMP */
356−#define part_stat_lock() ({ rcu_read_lock(); 0; })
357−#define part_stat_unlock() rcu_read_unlock()
358−
359−#define part_stat_get(part, field) ((part)->dkstats.field)
360−#define part_stat_get_cpu(part, field, cpu) part_stat_get(part, field)
361−#define part_stat_read(part, field) part_stat_get(part, field)
362−
363−static inline void part_stat_set_all(struct hd_struct *part, int value)
364−{
365− memset(&part->dkstats, value, sizeof(struct disk_stats));
366−}
367−
368−static inline int init_part_stats(struct hd_struct *part)
369−{
370− return 1;
371−}
372−
373−static inline void free_part_stats(struct hd_struct *part)
374−{
375−}
376−
377−#endif /* CONFIG_SMP */
378−
379−#define part_stat_read_msecs(part, which) \
380− div_u64(part_stat_read(part, nsecs[which]), NSEC_PER_MSEC)
381−
382−#define part_stat_read_accum(part, field) \
383− (part_stat_read(part, field[STAT_READ]) + \
384− part_stat_read(part, field[STAT_WRITE]) + \
385− part_stat_read(part, field[STAT_DISCARD]))
386−
387−#define __part_stat_add(part, field, addnd) \
388− (part_stat_get(part, field) += (addnd))
389−
390−#define part_stat_add(part, field, addnd) do { \
391− __part_stat_add((part), field, addnd); \
392− if ((part)->partno) \
393− __part_stat_add(&part_to_disk((part))->part0, \
394− field, addnd); \
395−} while (0)
396−
397−#define part_stat_dec(gendiskp, field) \
398− part_stat_add(gendiskp, field, -1)
399−#define part_stat_inc(gendiskp, field) \
400− part_stat_add(gendiskp, field, 1)
401−#define part_stat_sub(gendiskp, field, subnd) \
402− part_stat_add(gendiskp, field, -subnd)
403−
404−#define part_stat_local_dec(gendiskp, field) \
405− local_dec(&(part_stat_get(gendiskp, field)))
406−#define part_stat_local_inc(gendiskp, field) \
407− local_inc(&(part_stat_get(gendiskp, field)))
408−#define part_stat_local_read(gendiskp, field) \
409− local_read(&(part_stat_get(gendiskp, field)))
410−#define part_stat_local_read_cpu(gendiskp, field, cpu) \
411− local_read(&(part_stat_get_cpu(gendiskp, field, cpu)))
412−
413−unsigned int part_in_flight(struct request_queue *q, struct hd_struct *part);
414−void part_in_flight_rw(struct request_queue *q, struct hd_struct *part,
415− unsigned int inflight[2]);
416−void part_dec_in_flight(struct request_queue *q, struct hd_struct *part,
417− int rw);
418−void part_inc_in_flight(struct request_queue *q, struct hd_struct *part,
419− int rw);
420−
421−static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk)
422−{
423− if (disk)
424− return kzalloc_node(sizeof(struct partition_meta_info),
425− GFP_KERNEL, disk->node_id);
426− return kzalloc(sizeof(struct partition_meta_info), GFP_KERNEL);
427−}
428−
429−static inline void free_part_info(struct hd_struct *part)
430−{
431− kfree(part->info);
432−}
433−
434−void update_io_ticks(struct hd_struct *part, unsigned long now);
287+extern bool disk_has_partitions(struct gendisk *disk);
435288
436289 /* block/genhd.c */
437290 extern void device_add_disk(struct device *parent, struct gendisk *disk,
@@ -461,6 +314,8 @@ static inline int get_disk_ro(struct gendisk *disk) · 23 unmodified lines
461314 extern void disk_block_events(struct gendisk *disk);
462315 extern void disk_unblock_events(struct gendisk *disk);
463316 extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
317+extern void set_capacity_revalidate_and_notify(struct gendisk *disk,
318+ sector_t size, bool revalidate);
464319 extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);
465320
466321 /* drivers/char/random.c */
@@ -480,170 +335,11 @@ static inline void set_capacity(struct gendisk *disk, sector_t size) · 13 unmodified lines
480335 disk->part0.nr_sects = size;
481336 }
482337
483−#ifdef CONFIG_SOLARIS_X86_PARTITION
484−
485−#define SOLARIS_X86_NUMSLICE 16
486−#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL)
487−
488−struct solaris_x86_slice {
489− __le16 s_tag; /* ID tag of partition */
490− __le16 s_flag; /* permission flags */
491− __le32 s_start; /* start sector no of partition */
492− __le32 s_size; /* # of blocks in partition */
493−};
494−
495−struct solaris_x86_vtoc {
496− unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */
497− __le32 v_sanity; /* to verify vtoc sanity */
498− __le32 v_version; /* layout version */
499− char v_volume[8]; /* volume name */
500− __le16 v_sectorsz; /* sector size in bytes */
501− __le16 v_nparts; /* number of partitions */
502− unsigned int v_reserved[10]; /* free space */
503− struct solaris_x86_slice
504− v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */
505− unsigned int timestamp[SOLARIS_X86_NUMSLICE]; /* timestamp (unsupported) */
506− char v_asciilabel[128]; /* for compatibility */
507−};
508−
509−#endif /* CONFIG_SOLARIS_X86_PARTITION */
510−
511−#ifdef CONFIG_BSD_DISKLABEL
512−/*
513− * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il>
514− * updated by Marc Espie <Marc.Espie@openbsd.org>
515− */
516−
517−/* check against BSD src/sys/sys/disklabel.h for consistency */
518−
519−#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */
520−#define BSD_MAXPARTITIONS 16
521−#define OPENBSD_MAXPARTITIONS 16
522−#define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */
523−struct bsd_disklabel {
524− __le32 d_magic; /* the magic number */
525− __s16 d_type; /* drive type */
526− __s16 d_subtype; /* controller/d_type specific */
527− char d_typename[16]; /* type name, e.g. "eagle" */
528− char d_packname[16]; /* pack identifier */
529− __u32 d_secsize; /* # of bytes per sector */
530− __u32 d_nsectors; /* # of data sectors per track */
531− __u32 d_ntracks; /* # of tracks per cylinder */
532− __u32 d_ncylinders; /* # of data cylinders per unit */
533− __u32 d_secpercyl; /* # of data sectors per cylinder */
534− __u32 d_secperunit; /* # of data sectors per unit */
535− __u16 d_sparespertrack; /* # of spare sectors per track */
536− __u16 d_sparespercyl; /* # of spare sectors per cylinder */
537− __u32 d_acylinders; /* # of alt. cylinders per unit */
538− __u16 d_rpm; /* rotational speed */
539− __u16 d_interleave; /* hardware sector interleave */
540− __u16 d_trackskew; /* sector 0 skew, per track */
541− __u16 d_cylskew; /* sector 0 skew, per cylinder */
542− __u32 d_headswitch; /* head switch time, usec */
543− __u32 d_trkseek; /* track-to-track seek, usec */
544− __u32 d_flags; /* generic flags */
545−#define NDDATA 5
546− __u32 d_drivedata[NDDATA]; /* drive-type specific information */
547−#define NSPARE 5
548− __u32 d_spare[NSPARE]; /* reserved for future use */
549− __le32 d_magic2; /* the magic number (again) */
550− __le16 d_checksum; /* xor of data incl. partitions */
551−
552− /* filesystem and partition information: */
553− __le16 d_npartitions; /* number of partitions in following */
554− __le32 d_bbsize; /* size of boot area at sn0, bytes */
555− __le32 d_sbsize; /* max size of fs superblock, bytes */
556− struct bsd_partition { /* the partition table */
557− __le32 p_size; /* number of sectors in partition */
558− __le32 p_offset; /* starting sector */
559− __le32 p_fsize; /* filesystem basic fragment size */
560− __u8 p_fstype; /* filesystem type, see below */
561− __u8 p_frag; /* filesystem fragments per block */
562− __le16 p_cpg; /* filesystem cylinders per group */
563− } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */
564−};
565−
566−#endif /* CONFIG_BSD_DISKLABEL */
567−
568−#ifdef CONFIG_UNIXWARE_DISKLABEL
569−/*
570− * Unixware slices support by Andrzej Krzysztofowicz <ankry@mif.pg.gda.pl>
571− * and Krzysztof G. Baranowski <kgb@knm.org.pl>
572− */
573−
574−#define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */
575−#define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */
576−#define UNIXWARE_NUMSLICE 16
577−#define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */
578−
579−struct unixware_slice {
580− __le16 s_label; /* label */
581− __le16 s_flags; /* permission flags */
582− __le32 start_sect; /* starting sector */
583− __le32 nr_sects; /* number of sectors in slice */
584−};
585−
586−struct unixware_disklabel {
587− __le32 d_type; /* drive type */
588− __le32 d_magic; /* the magic number */
589− __le32 d_version; /* version number */
590− char d_serial[12]; /* serial number of the device */
591− __le32 d_ncylinders; /* # of data cylinders per device */
592− __le32 d_ntracks; /* # of tracks per cylinder */
593− __le32 d_nsectors; /* # of data sectors per track */
594− __le32 d_secsize; /* # of bytes per sector */
595− __le32 d_part_start; /* # of first sector of this partition */
596− __le32 d_unknown1[12]; /* ? */
597− __le32 d_alt_tbl; /* byte offset of alternate table */
598− __le32 d_alt_len; /* byte length of alternate table */
599− __le32 d_phys_cyl; /* # of physical cylinders per device */
600− __le32 d_phys_trk; /* # of physical tracks per cylinder */
601− __le32 d_phys_sec; /* # of physical sectors per track */
602− __le32 d_phys_bytes; /* # of physical bytes per sector */
603− __le32 d_unknown2; /* ? */
604− __le32 d_unknown3; /* ? */
605− __le32 d_pad[8]; /* pad */
606−
607− struct unixware_vtoc {
608− __le32 v_magic; /* the magic number */
609− __le32 v_version; /* version number */
610− char v_name[8]; /* volume name */
611− __le16 v_nslices; /* # of slices */
612− __le16 v_unknown1; /* ? */
613− __le32 v_reserved[10]; /* reserved */
614− struct unixware_slice
615− v_slice[UNIXWARE_NUMSLICE]; /* slice headers */
616− } vtoc;
617−
618−}; /* 408 */
619−
620−#endif /* CONFIG_UNIXWARE_DISKLABEL */
621−
622−#ifdef CONFIG_MINIX_SUBPARTITION
623−# define MINIX_NR_SUBPARTITIONS 4
624−#endif /* CONFIG_MINIX_SUBPARTITION */
625−
626−#define ADDPART_FLAG_NONE 0
627−#define ADDPART_FLAG_RAID 1
628−#define ADDPART_FLAG_WHOLEDISK 2
629−
630−extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt);
631−extern void blk_free_devt(dev_t devt);
632−extern void blk_invalidate_devt(dev_t devt);
633338 extern dev_t blk_lookup_devt(const char *name, int partno);
634−extern char *disk_name (struct gendisk *hd, int partno, char *buf);
635339
636340 int bdev_disk_changed(struct block_device *bdev, bool invalidate);
637341 int blk_add_partitions(struct gendisk *disk, struct block_device *bdev);
638342 int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev);
639−extern int disk_expand_part_tbl(struct gendisk *disk, int target);
640−extern struct hd_struct * __must_check add_partition(struct gendisk *disk,
641− int partno, sector_t start,
642− sector_t len, int flags,
643− struct partition_meta_info
644− *info);
645−extern void __delete_partition(struct percpu_ref *);
646−extern void delete_partition(struct gendisk *, int);
647343 extern void printk_all_partitions(void);
648344
649345 extern struct gendisk *__alloc_disk_node(int minors, int node_id);
@@ -657,20 +353,6 @@ extern void blk_register_region(dev_t devt, unsigned long range, · 7 unmodified lines
657353 void *data);
658354 extern void blk_unregister_region(dev_t devt, unsigned long range);
659355
660−extern ssize_t part_size_show(struct device *dev,
661− struct device_attribute *attr, char *buf);
662−extern ssize_t part_stat_show(struct device *dev,
663− struct device_attribute *attr, char *buf);
664−extern ssize_t part_inflight_show(struct device *dev,
665− struct device_attribute *attr, char *buf);
666−#ifdef CONFIG_FAIL_MAKE_REQUEST
667−extern ssize_t part_fail_show(struct device *dev,
668− struct device_attribute *attr, char *buf);
669−extern ssize_t part_fail_store(struct device *dev,
670− struct device_attribute *attr,
671− const char *buf, size_t count);
672−#endif /* CONFIG_FAIL_MAKE_REQUEST */
673−
674356 #define alloc_disk_node(minors, node_id) \
675357 ({ \
676358 static struct lock_class_key __key; \
@@ -689,100 +371,6 @@ extern ssize_t part_fail_store(struct device *dev, · 12 unmodified lines
689371
690372 #define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE)
691373
692−static inline int hd_ref_init(struct hd_struct *part)
693−{
694− if (percpu_ref_init(&part->ref, __delete_partition, 0,
695− GFP_KERNEL))
696− return -ENOMEM;
697− return 0;
698−}
699−
700−static inline void hd_struct_get(struct hd_struct *part)
701−{
702− percpu_ref_get(&part->ref);
703−}
704−
705−static inline int hd_struct_try_get(struct hd_struct *part)
706−{
707− return percpu_ref_tryget_live(&part->ref);
708−}
709−
710−static inline void hd_struct_put(struct hd_struct *part)
711−{
712− percpu_ref_put(&part->ref);
713−}
714−
715−static inline void hd_struct_kill(struct hd_struct *part)
716−{
717− percpu_ref_kill(&part->ref);
718−}
719−
720−static inline void hd_free_part(struct hd_struct *part)
721−{
722− free_part_stats(part);
723− free_part_info(part);
724− percpu_ref_exit(&part->ref);
725−}
726−
727−/*
728− * Any access of part->nr_sects which is not protected by partition
729− * bd_mutex or gendisk bdev bd_mutex, should be done using this
730− * accessor function.
731− *
732− * Code written along the lines of i_size_read() and i_size_write().
733− * CONFIG_PREEMPTION case optimizes the case of UP kernel with preemption
734− * on.
735− */
736−static inline sector_t part_nr_sects_read(struct hd_struct *part)
737−{
738−#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
739− sector_t nr_sects;
740− unsigned seq;
741− do {
742− seq = read_seqcount_begin(&part->nr_sects_seq);
743− nr_sects = part->nr_sects;
744− } while (read_seqcount_retry(&part->nr_sects_seq, seq));
745− return nr_sects;
746−#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPTION)
747− sector_t nr_sects;
748−
749− preempt_disable();
750− nr_sects = part->nr_sects;
751− preempt_enable();
752− return nr_sects;
753−#else
754− return part->nr_sects;
755−#endif
756−}
757−
758−/*
759− * Should be called with mutex lock held (typically bd_mutex) of partition
760− * to provide mutual exlusion among writers otherwise seqcount might be
761− * left in wrong state leaving the readers spinning infinitely.
762− */
763−static inline void part_nr_sects_write(struct hd_struct *part, sector_t size)
764−{
765−#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
766− write_seqcount_begin(&part->nr_sects_seq);
767− part->nr_sects = size;
768− write_seqcount_end(&part->nr_sects_seq);
769−#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPTION)
770− preempt_disable();
771− part->nr_sects = size;
772− preempt_enable();
773−#else
774− part->nr_sects = size;
775−#endif
776−}
777−
778−#if defined(CONFIG_BLK_DEV_INTEGRITY)
779−extern void blk_integrity_add(struct gendisk *);
780−extern void blk_integrity_del(struct gendisk *);
781−#else /* CONFIG_BLK_DEV_INTEGRITY */
782−static inline void blk_integrity_add(struct gendisk *disk) { }
783−static inline void blk_integrity_del(struct gendisk *disk) { }
784−#endif /* CONFIG_BLK_DEV_INTEGRITY */
785−
786374 #else /* CONFIG_BLOCK */
787375
788376 static inline void printk_all_partitions(void) { }
include/linux/gfp.h+8−0
@@ -124,6 +124,8 @@ struct vm_area_struct; · 123 unmodified lines
124124 *
125125 * Reclaim modifiers
126126 * ~~~~~~~~~~~~~~~~~
127+ * Please note that all the following flags are only applicable to sleepable
128+ * allocations (e.g. %GFP_NOWAIT and %GFP_ATOMIC will ignore them).
127129 *
128130 * %__GFP_IO can start physical IO.
129131 *
@@ -485,6 +487,12 @@ static inline void arch_free_page(struct page *page, int order) { } · 355 unmodified lines
485487 #ifndef HAVE_ARCH_ALLOC_PAGE
486488 static inline void arch_alloc_page(struct page *page, int order) { }
487489 #endif
490+#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE
491+static inline int arch_make_page_accessible(struct page *page)
492+{
493+ return 0;
494+}
495+#endif
488496
489497 struct page *
490498 __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid,
include/linux/gpio.h+0−2
@@ -102,11 +102,9 @@ void devm_gpio_free(struct device *dev, unsigned int gpio); · 101 unmodified lines
102102 #include <linux/kernel.h>
103103 #include <linux/types.h>
104104 #include <linux/bug.h>
105−#include <linux/pinctrl/pinctrl.h>
106105
107106 struct device;
108107 struct gpio_chip;
109−struct pinctrl_dev;
110108
111109 static inline bool gpio_is_valid(int number)
112110 {
include/linux/gpio/consumer.h+12−1
@@ -2,9 +2,10 @@ · 1 unmodified line
22 #ifndef __LINUX_GPIO_CONSUMER_H
33 #define __LINUX_GPIO_CONSUMER_H
44
5+#include <linux/bits.h>
56 #include <linux/bug.h>
7+#include <linux/compiler_types.h>
68 #include <linux/err.h>
7−#include <linux/kernel.h>
89
910 struct device;
1011
@@ -156,6 +157,7 @@ int gpiod_set_raw_array_value_cansleep(unsigned int array_size, · 145 unmodified lines
156157 struct gpio_array *array_info,
157158 unsigned long *value_bitmap);
158159
160+int gpiod_set_config(struct gpio_desc *desc, unsigned long config);
159161 int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);
160162 int gpiod_set_transitory(struct gpio_desc *desc, bool transitory);
161163 void gpiod_toggle_active_low(struct gpio_desc *desc);
@@ -189,6 +191,8 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, · 27 unmodified lines
189191
190192 #else /* CONFIG_GPIOLIB */
191193
194+#include <linux/kernel.h>
195+
192196 static inline int gpiod_count(struct device *dev, const char *con_id)
193197 {
194198 return 0;
@@ -470,6 +474,13 @@ static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size, · 275 unmodified lines
470474 return 0;
471475 }
472476
477+static inline int gpiod_set_config(struct gpio_desc *desc, unsigned long config)
478+{
479+ /* GPIO can never have been requested */
480+ WARN_ON(desc);
481+ return -ENOSYS;
482+}
483+
473484 static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
474485 {
475486 /* GPIO can never have been requested */
include/linux/gpio/driver.h+70−69
@@ -87,7 +87,7 @@ struct gpio_irq_chip { · 86 unmodified lines
8787 * @need_valid_mask to make these GPIO lines unavailable for
8888 * translation.
8989 */
90− int (*child_to_parent_hwirq)(struct gpio_chip *chip,
90+ int (*child_to_parent_hwirq)(struct gpio_chip *gc,
9191 unsigned int child_hwirq,
9292 unsigned int child_type,
9393 unsigned int *parent_hwirq,
@@ -102,7 +102,7 @@ struct gpio_irq_chip { · 8 unmodified lines
102102 * variant named &gpiochip_populate_parent_fwspec_fourcell is also
103103 * available.
104104 */
105− void *(*populate_parent_alloc_arg)(struct gpio_chip *chip,
105+ void *(*populate_parent_alloc_arg)(struct gpio_chip *gc,
106106 unsigned int parent_hwirq,
107107 unsigned int parent_type);
108108
@@ -114,7 +114,7 @@ struct gpio_irq_chip { · 5 unmodified lines
114114 * callback. If this is not specified, then a default callback will be
115115 * provided that returns the line offset.
116116 */
117− unsigned int (*child_offset_to_irq)(struct gpio_chip *chip,
117+ unsigned int (*child_offset_to_irq)(struct gpio_chip *gc,
118118 unsigned int pin);
119119
120120 /**
@@ -209,7 +209,7 @@ struct gpio_irq_chip { · 88 unmodified lines
209209 * a particular driver wants to clear IRQ related registers
210210 * in order to avoid undesired events.
211211 */
212− int (*init_hw)(struct gpio_chip *chip);
212+ int (*init_hw)(struct gpio_chip *gc);
213213
214214 /**
215215 * @init_valid_mask: optional routine to initialize @valid_mask, to be
@@ -220,7 +220,7 @@ struct gpio_irq_chip { · 4 unmodified lines
220220 * then directly set some bits to "0" if they cannot be used for
221221 * interrupts.
222222 */
223− void (*init_valid_mask)(struct gpio_chip *chip,
223+ void (*init_valid_mask)(struct gpio_chip *gc,
224224 unsigned long *valid_mask,
225225 unsigned int ngpios);
226226
@@ -348,40 +348,40 @@ struct gpio_chip { · 121 unmodified lines
348348 struct device *parent;
349349 struct module *owner;
350350
351− int (*request)(struct gpio_chip *chip,
351+ int (*request)(struct gpio_chip *gc,
352352 unsigned offset);
353− void (*free)(struct gpio_chip *chip,
353+ void (*free)(struct gpio_chip *gc,
354354 unsigned offset);
355− int (*get_direction)(struct gpio_chip *chip,
355+ int (*get_direction)(struct gpio_chip *gc,
356356 unsigned offset);
357− int (*direction_input)(struct gpio_chip *chip,
357+ int (*direction_input)(struct gpio_chip *gc,
358358 unsigned offset);
359− int (*direction_output)(struct gpio_chip *chip,
359+ int (*direction_output)(struct gpio_chip *gc,
360360 unsigned offset, int value);
361− int (*get)(struct gpio_chip *chip,
361+ int (*get)(struct gpio_chip *gc,
362362 unsigned offset);
363− int (*get_multiple)(struct gpio_chip *chip,
363+ int (*get_multiple)(struct gpio_chip *gc,
364364 unsigned long *mask,
365365 unsigned long *bits);
366− void (*set)(struct gpio_chip *chip,
366+ void (*set)(struct gpio_chip *gc,
367367 unsigned offset, int value);
368− void (*set_multiple)(struct gpio_chip *chip,
368+ void (*set_multiple)(struct gpio_chip *gc,
369369 unsigned long *mask,
370370 unsigned long *bits);
371− int (*set_config)(struct gpio_chip *chip,
371+ int (*set_config)(struct gpio_chip *gc,
372372 unsigned offset,
373373 unsigned long config);
374− int (*to_irq)(struct gpio_chip *chip,
374+ int (*to_irq)(struct gpio_chip *gc,
375375 unsigned offset);
376376
377377 void (*dbg_show)(struct seq_file *s,
378− struct gpio_chip *chip);
378+ struct gpio_chip *gc);
379379
380− int (*init_valid_mask)(struct gpio_chip *chip,
380+ int (*init_valid_mask)(struct gpio_chip *gc,
381381 unsigned long *valid_mask,
382382 unsigned int ngpios);
383383
384− int (*add_pin_ranges)(struct gpio_chip *chip);
384+ int (*add_pin_ranges)(struct gpio_chip *gc);
385385
386386 int base;
387387 u16 ngpio;
@@ -458,11 +458,11 @@ struct gpio_chip { · 70 unmodified lines
458458 #endif /* CONFIG_OF_GPIO */
459459 };
460460
461−extern const char *gpiochip_is_requested(struct gpio_chip *chip,
461+extern const char *gpiochip_is_requested(struct gpio_chip *gc,
462462 unsigned offset);
463463
464464 /* add/remove chips */
465−extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
465+extern int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
466466 struct lock_class_key *lock_key,
467467 struct lock_class_key *request_key);
468468
@@ -490,43 +490,43 @@ extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 21 unmodified lines
490490 * Otherwise it returns zero as a success code.
491491 */
492492 #ifdef CONFIG_LOCKDEP
493−#define gpiochip_add_data(chip, data) ({ \
493+#define gpiochip_add_data(gc, data) ({ \
494494 static struct lock_class_key lock_key; \
495495 static struct lock_class_key request_key; \
496− gpiochip_add_data_with_key(chip, data, &lock_key, \
496+ gpiochip_add_data_with_key(gc, data, &lock_key, \
497497 &request_key); \
498498 })
499499 #else
500−#define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL, NULL)
500+#define gpiochip_add_data(gc, data) gpiochip_add_data_with_key(gc, data, NULL, NULL)
501501 #endif /* CONFIG_LOCKDEP */
502502
503−static inline int gpiochip_add(struct gpio_chip *chip)
503+static inline int gpiochip_add(struct gpio_chip *gc)
504504 {
505− return gpiochip_add_data(chip, NULL);
505+ return gpiochip_add_data(gc, NULL);
506506 }
507−extern void gpiochip_remove(struct gpio_chip *chip);
508−extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *chip,
507+extern void gpiochip_remove(struct gpio_chip *gc);
508+extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc,
509509 void *data);
510510
511511 extern struct gpio_chip *gpiochip_find(void *data,
512− int (*match)(struct gpio_chip *chip, void *data));
512+ int (*match)(struct gpio_chip *gc, void *data));
513513
514−bool gpiochip_line_is_irq(struct gpio_chip *chip, unsigned int offset);
515−int gpiochip_reqres_irq(struct gpio_chip *chip, unsigned int offset);
516−void gpiochip_relres_irq(struct gpio_chip *chip, unsigned int offset);
517−void gpiochip_disable_irq(struct gpio_chip *chip, unsigned int offset);
518−void gpiochip_enable_irq(struct gpio_chip *chip, unsigned int offset);
514+bool gpiochip_line_is_irq(struct gpio_chip *gc, unsigned int offset);
515+int gpiochip_reqres_irq(struct gpio_chip *gc, unsigned int offset);
516+void gpiochip_relres_irq(struct gpio_chip *gc, unsigned int offset);
517+void gpiochip_disable_irq(struct gpio_chip *gc, unsigned int offset);
518+void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset);
519519
520520 /* Line status inquiry for drivers */
521−bool gpiochip_line_is_open_drain(struct gpio_chip *chip, unsigned int offset);
522−bool gpiochip_line_is_open_source(struct gpio_chip *chip, unsigned int offset);
521+bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset);
522+bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset);
523523
524524 /* Sleep persistence inquiry for drivers */
525−bool gpiochip_line_is_persistent(struct gpio_chip *chip, unsigned int offset);
526−bool gpiochip_line_is_valid(const struct gpio_chip *chip, unsigned int offset);
525+bool gpiochip_line_is_persistent(struct gpio_chip *gc, unsigned int offset);
526+bool gpiochip_line_is_valid(const struct gpio_chip *gc, unsigned int offset);
527527
528528 /* get driver data */
529−void *gpiochip_get_data(struct gpio_chip *chip);
529+void *gpiochip_get_data(struct gpio_chip *gc);
530530
531531 struct bgpio_pdata {
532532 const char *label;
@@ -536,23 +536,23 @@ struct bgpio_pdata { · 3 unmodified lines
536536
537537 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
538538
539−void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip,
539+void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *gc,
540540 unsigned int parent_hwirq,
541541 unsigned int parent_type);
542−void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip,
542+void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *gc,
543543 unsigned int parent_hwirq,
544544 unsigned int parent_type);
545545
546546 #else
547547
548−static inline void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip,
548+static inline void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *gc,
549549 unsigned int parent_hwirq,
550550 unsigned int parent_type)
551551 {
552552 return NULL;
553553 }
554554
555−static inline void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip,
555+static inline void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *gc,
556556 unsigned int parent_hwirq,
557557 unsigned int parent_type)
558558 {
@@ -572,6 +572,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev, · 13 unmodified lines
572572 #define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3)
573573 #define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */
574574 #define BGPIOF_NO_OUTPUT BIT(5) /* only input */
575+#define BGPIOF_NO_SET_ON_INPUT BIT(6)
575576
576577 int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
577578 irq_hw_number_t hwirq);
@@ -582,11 +583,11 @@ int gpiochip_irq_domain_activate(struct irq_domain *domain, · 4 unmodified lines
582583 void gpiochip_irq_domain_deactivate(struct irq_domain *domain,
583584 struct irq_data *data);
584585
585−void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip,
586+void gpiochip_set_nested_irqchip(struct gpio_chip *gc,
586587 struct irq_chip *irqchip,
587588 unsigned int parent_irq);
588589
589−int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
590+int gpiochip_irqchip_add_key(struct gpio_chip *gc,
590591 struct irq_chip *irqchip,
591592 unsigned int first_irq,
592593 irq_flow_handler_t handler,
@@ -595,7 +596,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, · 2 unmodified lines
595596 struct lock_class_key *lock_key,
596597 struct lock_class_key *request_key);
597598
598−bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
599+bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc,
599600 unsigned int offset);
600601
601602 #ifdef CONFIG_LOCKDEP
@@ -606,7 +607,7 @@ bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip, · 4 unmodified lines
606607 * boilerplate static inlines provides such a key for each
607608 * unique instance.
608609 */
609−static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
610+static inline int gpiochip_irqchip_add(struct gpio_chip *gc,
610611 struct irq_chip *irqchip,
611612 unsigned int first_irq,
612613 irq_flow_handler_t handler,
@@ -615,12 +616,12 @@ static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip, · 2 unmodified lines
615616 static struct lock_class_key lock_key;
616617 static struct lock_class_key request_key;
617618
618− return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
619+ return gpiochip_irqchip_add_key(gc, irqchip, first_irq,
619620 handler, type, false,
620621 &lock_key, &request_key);
621622 }
622623
623−static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,
624+static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gc,
624625 struct irq_chip *irqchip,
625626 unsigned int first_irq,
626627 irq_flow_handler_t handler,
@@ -630,35 +631,35 @@ static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip, · 3 unmodified lines
630631 static struct lock_class_key lock_key;
631632 static struct lock_class_key request_key;
632633
633− return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
634+ return gpiochip_irqchip_add_key(gc, irqchip, first_irq,
634635 handler, type, true,
635636 &lock_key, &request_key);
636637 }
637638 #else /* ! CONFIG_LOCKDEP */
638−static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
639+static inline int gpiochip_irqchip_add(struct gpio_chip *gc,
639640 struct irq_chip *irqchip,
640641 unsigned int first_irq,
641642 irq_flow_handler_t handler,
642643 unsigned int type)
643644 {
644− return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
645+ return gpiochip_irqchip_add_key(gc, irqchip, first_irq,
645646 handler, type, false, NULL, NULL);
646647 }
647648
648−static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,
649+static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gc,
649650 struct irq_chip *irqchip,
650651 unsigned int first_irq,
651652 irq_flow_handler_t handler,
652653 unsigned int type)
653654 {
654− return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
655+ return gpiochip_irqchip_add_key(gc, irqchip, first_irq,
655656 handler, type, true, NULL, NULL);
656657 }
657658 #endif /* CONFIG_LOCKDEP */
658659
659−int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset);
660−void gpiochip_generic_free(struct gpio_chip *chip, unsigned offset);
661−int gpiochip_generic_config(struct gpio_chip *chip, unsigned offset,
660+int gpiochip_generic_request(struct gpio_chip *gc, unsigned offset);
661+void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset);
662+int gpiochip_generic_config(struct gpio_chip *gc, unsigned offset,
662663 unsigned long config);
663664
664665 /**
@@ -675,25 +676,25 @@ struct gpio_pin_range { · 10 unmodified lines
675676
676677 #ifdef CONFIG_PINCTRL
677678
678−int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
679+int gpiochip_add_pin_range(struct gpio_chip *gc, const char *pinctl_name,
679680 unsigned int gpio_offset, unsigned int pin_offset,
680681 unsigned int npins);
681−int gpiochip_add_pingroup_range(struct gpio_chip *chip,
682+int gpiochip_add_pingroup_range(struct gpio_chip *gc,
682683 struct pinctrl_dev *pctldev,
683684 unsigned int gpio_offset, const char *pin_group);
684−void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
685+void gpiochip_remove_pin_ranges(struct gpio_chip *gc);
685686
686687 #else /* ! CONFIG_PINCTRL */
687688
688689 static inline int
689−gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
690+gpiochip_add_pin_range(struct gpio_chip *gc, const char *pinctl_name,
690691 unsigned int gpio_offset, unsigned int pin_offset,
691692 unsigned int npins)
692693 {
693694 return 0;
694695 }
695696 static inline int
696−gpiochip_add_pingroup_range(struct gpio_chip *chip,
697+gpiochip_add_pingroup_range(struct gpio_chip *gc,
697698 struct pinctrl_dev *pctldev,
698699 unsigned int gpio_offset, const char *pin_group)
699700 {
@@ -701,27 +702,27 @@ gpiochip_add_pingroup_range(struct gpio_chip *chip, · 1 unmodified line
701702 }
702703
703704 static inline void
704−gpiochip_remove_pin_ranges(struct gpio_chip *chip)
705+gpiochip_remove_pin_ranges(struct gpio_chip *gc)
705706 {
706707 }
707708
708709 #endif /* CONFIG_PINCTRL */
709710
710−struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip,
711+struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc,
711712 unsigned int hwnum,
712713 const char *label,
713714 enum gpio_lookup_flags lflags,
714715 enum gpiod_flags dflags);
715716 void gpiochip_free_own_desc(struct gpio_desc *desc);
716717
717−void devprop_gpiochip_set_names(struct gpio_chip *chip,
718+void devprop_gpiochip_set_names(struct gpio_chip *gc,
718719 const struct fwnode_handle *fwnode);
719720
720721 #ifdef CONFIG_GPIOLIB
721722
722723 /* lock/unlock as IRQ */
723−int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
724−void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
724+int gpiochip_lock_as_irq(struct gpio_chip *gc, unsigned int offset);
725+void gpiochip_unlock_as_irq(struct gpio_chip *gc, unsigned int offset);
725726
726727
727728 struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
@@ -735,14 +736,14 @@ static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) · 7 unmodified lines
735736 return ERR_PTR(-ENODEV);
736737 }
737738
738−static inline int gpiochip_lock_as_irq(struct gpio_chip *chip,
739+static inline int gpiochip_lock_as_irq(struct gpio_chip *gc,
739740 unsigned int offset)
740741 {
741742 WARN_ON(1);
742743 return -EINVAL;
743744 }
744745
745−static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip,
746+static inline void gpiochip_unlock_as_irq(struct gpio_chip *gc,
746747 unsigned int offset)
747748 {
748749 WARN_ON(1);
include/linux/hardirq.h+4−4
@@ -37,7 +37,7 @@ extern void rcu_nmi_exit(void); · 36 unmodified lines
3737 do { \
3838 account_irq_enter_time(current); \
3939 preempt_count_add(HARDIRQ_OFFSET); \
40− trace_hardirq_enter(); \
40+ lockdep_hardirq_enter(); \
4141 } while (0)
4242
4343 /*
@@ -50,7 +50,7 @@ extern void irq_enter(void); · 6 unmodified lines
5050 */
5151 #define __irq_exit() \
5252 do { \
53− trace_hardirq_exit(); \
53+ lockdep_hardirq_exit(); \
5454 account_irq_exit_time(current); \
5555 preempt_count_sub(HARDIRQ_OFFSET); \
5656 } while (0)
@@ -74,12 +74,12 @@ extern void irq_exit(void); · 17 unmodified lines
7474 BUG_ON(in_nmi()); \
7575 preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
7676 rcu_nmi_enter(); \
77− trace_hardirq_enter(); \
77+ lockdep_hardirq_enter(); \
7878 } while (0)
7979
8080 #define nmi_exit() \
8181 do { \
82− trace_hardirq_exit(); \
82+ lockdep_hardirq_exit(); \
8383 rcu_nmi_exit(); \
8484 BUG_ON(!in_nmi()); \
8585 preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
include/linux/hashtable.h+2−2
@@ -145,7 +145,7 @@ static inline void hash_del_rcu(struct hlist_node *node) · 144 unmodified lines
145145 * hash entry
146146 * @name: hashtable to iterate
147147 * @bkt: integer to use as bucket loop cursor
148− * @tmp: a &struct used for temporary storage
148+ * @tmp: a &struct hlist_node used for temporary storage
149149 * @obj: the type * to use as a loop cursor for each entry
150150 * @member: the name of the hlist_node within the struct
151151 */
@@ -197,7 +197,7 @@ static inline void hash_del_rcu(struct hlist_node *node) · 45 unmodified lines
197197 * same bucket safe against removals
198198 * @name: hashtable to iterate
199199 * @obj: the type * to use as a loop cursor for each entry
200− * @tmp: a &struct used for temporary storage
200+ * @tmp: a &struct hlist_node used for temporary storage
201201 * @member: the name of the hlist_node within the struct
202202 * @key: the key of the objects to iterate over
203203 */
include/linux/hmm.h+5−120
@@ -3,58 +3,8 @@ · 2 unmodified lines
33 * Copyright 2013 Red Hat Inc.
44 *
55 * Authors: Jérôme Glisse <jglisse@redhat.com>
6− */
7−/*
8− * Heterogeneous Memory Management (HMM)
9− *
10− * See Documentation/vm/hmm.rst for reasons and overview of what HMM is and it
11− * is for. Here we focus on the HMM API description, with some explanation of
12− * the underlying implementation.
13− *
14− * Short description: HMM provides a set of helpers to share a virtual address
15− * space between CPU and a device, so that the device can access any valid
16− * address of the process (while still obeying memory protection). HMM also
17− * provides helpers to migrate process memory to device memory, and back. Each
18− * set of functionality (address space mirroring, and migration to and from
19− * device memory) can be used independently of the other.
20− *
21− *
22− * HMM address space mirroring API:
23− *
24− * Use HMM address space mirroring if you want to mirror a range of the CPU
25− * page tables of a process into a device page table. Here, "mirror" means "keep
26− * synchronized". Prerequisites: the device must provide the ability to write-
27− * protect its page tables (at PAGE_SIZE granularity), and must be able to
28− * recover from the resulting potential page faults.
29− *
30− * HMM guarantees that at any point in time, a given virtual address points to
31− * either the same memory in both CPU and device page tables (that is: CPU and
32− * device page tables each point to the same pages), or that one page table (CPU
33− * or device) points to no entry, while the other still points to the old page
34− * for the address. The latter case happens when the CPU page table update
35− * happens first, and then the update is mirrored over to the device page table.
36− * This does not cause any issue, because the CPU page table cannot start
37− * pointing to a new page until the device page table is invalidated.
38− *
39− * HMM uses mmu_notifiers to monitor the CPU page tables, and forwards any
40− * updates to each device driver that has registered a mirror. It also provides
41− * some API calls to help with taking a snapshot of the CPU page table, and to
42− * synchronize with any updates that might happen concurrently.
436 *
44− *
45− * HMM migration to and from device memory:
46− *
47− * HMM provides a set of helpers to hotplug device memory as ZONE_DEVICE, with
48− * a new MEMORY_DEVICE_PRIVATE type. This provides a struct page for each page
49− * of the device memory, and allows the device driver to manage its memory
50− * using those struct pages. Having struct pages for device memory makes
51− * migration easier. Because that memory is not addressable by the CPU it must
52− * never be pinned to the device; in other words, any CPU page fault can always
53− * cause the device memory to be migrated (copied/moved) back to regular memory.
54− *
55− * A new migrate helper (migrate_vma()) has been added (see mm/migrate.c) that
56− * allows use of a device DMA engine to perform the copy operation between
57− * regular system memory and device memory.
7+ * See Documentation/vm/hmm.rst for reasons and overview of what HMM is.
588 */
599 #ifndef LINUX_HMM_H
6010 #define LINUX_HMM_H
@@ -74,7 +24,6 @@ · 13 unmodified lines
7424 * Flags:
7525 * HMM_PFN_VALID: pfn is valid. It has, at least, read permission.
7626 * HMM_PFN_WRITE: CPU page table has write permission set
77− * HMM_PFN_DEVICE_PRIVATE: private device memory (ZONE_DEVICE)
7827 *
7928 * The driver provides a flags array for mapping page protections to device
8029 * PTE bits. If the driver valid bit for an entry is bit 3,
@@ -86,7 +35,6 @@ · 5 unmodified lines
8635 enum hmm_pfn_flag_e {
8736 HMM_PFN_VALID = 0,
8837 HMM_PFN_WRITE,
89− HMM_PFN_DEVICE_PRIVATE,
9038 HMM_PFN_FLAG_MAX
9139 };
9240
@@ -122,9 +70,6 @@ enum hmm_pfn_value_e { · 29 unmodified lines
12270 *
12371 * @notifier: a mmu_interval_notifier that includes the start/end
12472 * @notifier_seq: result of mmu_interval_read_begin()
125− * @hmm: the core HMM structure this range is active against
126− * @vma: the vm area struct for the range
127− * @list: all range lock are on a list
12873 * @start: range virtual start address (inclusive)
12974 * @end: range virtual end address (exclusive)
13075 * @pfns: array of pfns (big enough for the range)
@@ -132,8 +77,8 @@ enum hmm_pfn_value_e { · 1 unmodified line
13277 * @values: pfn value for some special case (none, special, error, ...)
13378 * @default_flags: default flags for the range (write, read, ... see hmm doc)
13479 * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter
135− * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT)
136− * @valid: pfns array did not change since it has been fill by an HMM function
80+ * @pfn_shift: pfn shift value (should be <= PAGE_SHIFT)
81+ * @dev_private_owner: owner of device private pages
13782 */
13883 struct hmm_range {
13984 struct mmu_interval_notifier *notifier;
@@ -146,6 +91,7 @@ struct hmm_range { · 6 unmodified lines
14691 uint64_t default_flags;
14792 uint64_t pfn_flags_mask;
14893 uint8_t pfn_shift;
94+ void *dev_private_owner;
14995 };
15096
15197 /*
@@ -171,71 +117,10 @@ static inline struct page *hmm_device_entry_to_page(const struct hmm_range *rang · 19 unmodified lines
171117 return pfn_to_page(entry >> range->pfn_shift);
172118 }
173119
174−/*
175− * hmm_device_entry_to_pfn() - return pfn value store in a device entry
176− * @range: range use to decode device entry value
177− * @entry: device entry to extract pfn from
178− * Return: pfn value if device entry is valid, -1UL otherwise
179− */
180−static inline unsigned long
181−hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn)
182−{
183− if (pfn == range->values[HMM_PFN_NONE])
184− return -1UL;
185− if (pfn == range->values[HMM_PFN_ERROR])
186− return -1UL;
187− if (pfn == range->values[HMM_PFN_SPECIAL])
188− return -1UL;
189− if (!(pfn & range->flags[HMM_PFN_VALID]))
190− return -1UL;
191− return (pfn >> range->pfn_shift);
192−}
193−
194−/*
195− * hmm_device_entry_from_page() - create a valid device entry for a page
196− * @range: range use to encode HMM pfn value
197− * @page: page for which to create the device entry
198− * Return: valid device entry for the page
199− */
200−static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range,
201− struct page *page)
202−{
203− return (page_to_pfn(page) << range->pfn_shift) |
204− range->flags[HMM_PFN_VALID];
205−}
206−
207−/*
208− * hmm_device_entry_from_pfn() - create a valid device entry value from pfn
209− * @range: range use to encode HMM pfn value
210− * @pfn: pfn value for which to create the device entry
211− * Return: valid device entry for the pfn
212− */
213−static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range,
214− unsigned long pfn)
215−{
216− return (pfn << range->pfn_shift) |
217− range->flags[HMM_PFN_VALID];
218−}
219−
220−/*
221− * Retry fault if non-blocking, drop mmap_sem and return -EAGAIN in that case.
222− */
223−#define HMM_FAULT_ALLOW_RETRY (1 << 0)
224−
225−/* Don't fault in missing PTEs, just snapshot the current state. */
226−#define HMM_FAULT_SNAPSHOT (1 << 1)
227−
228−#ifdef CONFIG_HMM_MIRROR
229120 /*
230121 * Please see Documentation/vm/hmm.rst for how to use the range API.
231122 */
232−long hmm_range_fault(struct hmm_range *range, unsigned int flags);
233−#else
234−static inline long hmm_range_fault(struct hmm_range *range, unsigned int flags)
235−{
236− return -EOPNOTSUPP;
237−}
238−#endif
123+long hmm_range_fault(struct hmm_range *range);
239124
240125 /*
241126 * HMM_RANGE_DEFAULT_TIMEOUT - default timeout (ms) when waiting for a range
include/linux/huge_mm.h+46−7
@@ -46,9 +46,46 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, · 45 unmodified lines
4646 pmd_t *old_pmd, pmd_t *new_pmd);
4747 extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
4848 unsigned long addr, pgprot_t newprot,
49− int prot_numa);
50−vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write);
51−vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write);
49+ unsigned long cp_flags);
50+vm_fault_t vmf_insert_pfn_pmd_prot(struct vm_fault *vmf, pfn_t pfn,
51+ pgprot_t pgprot, bool write);
52+
53+/**
54+ * vmf_insert_pfn_pmd - insert a pmd size pfn
55+ * @vmf: Structure describing the fault
56+ * @pfn: pfn to insert
57+ * @pgprot: page protection to use
58+ * @write: whether it's a write fault
59+ *
60+ * Insert a pmd size pfn. See vmf_insert_pfn() for additional info.
61+ *
62+ * Return: vm_fault_t value.
63+ */
64+static inline vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn,
65+ bool write)
66+{
67+ return vmf_insert_pfn_pmd_prot(vmf, pfn, vmf->vma->vm_page_prot, write);
68+}
69+vm_fault_t vmf_insert_pfn_pud_prot(struct vm_fault *vmf, pfn_t pfn,
70+ pgprot_t pgprot, bool write);
71+
72+/**
73+ * vmf_insert_pfn_pud - insert a pud size pfn
74+ * @vmf: Structure describing the fault
75+ * @pfn: pfn to insert
76+ * @pgprot: page protection to use
77+ * @write: whether it's a write fault
78+ *
79+ * Insert a pud size pfn. See vmf_insert_pfn() for additional info.
80+ *
81+ * Return: vm_fault_t value.
82+ */
83+static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn,
84+ bool write)
85+{
86+ return vmf_insert_pfn_pud_prot(vmf, pfn, vmf->vma->vm_page_prot, write);
87+}
88+
5289 enum transparent_hugepage_flag {
5390 TRANSPARENT_HUGEPAGE_FLAG,
5491 TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
@@ -87,8 +124,6 @@ extern struct kobj_attribute shmem_enabled_attr; · 32 unmodified lines
87124 #define HPAGE_PUD_SIZE ((1UL) << HPAGE_PUD_SHIFT)
88125 #define HPAGE_PUD_MASK (~(HPAGE_PUD_SIZE - 1))
89126
90−extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
91−
92127 extern unsigned long transparent_hugepage_flags;
93128
94129 /*
@@ -100,7 +135,7 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) · 5 unmodified lines
100135 if (vma->vm_flags & VM_NOHUGEPAGE)
101136 return false;
102137
103− if (is_vma_temporary_stack(vma))
138+ if (vma_is_temporary_stack(vma))
104139 return false;
105140
106141 if (test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags))
@@ -289,7 +324,11 @@ static inline struct list_head *page_deferred_list(struct page *page) · 182 unmodified lines
289324 #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; })
290325 #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; })
291326
292−#define hpage_nr_pages(x) 1
327+static inline int hpage_nr_pages(struct page *page)
328+{
329+ VM_BUG_ON_PAGE(PageTail(page), page);
330+ return 1;
331+}
293332
294333 static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)
295334 {
include/linux/hugetlb.h+75−13
@@ -46,7 +46,52 @@ struct resv_map { · 45 unmodified lines
4646 long adds_in_progress;
4747 struct list_head region_cache;
4848 long region_cache_count;
49+#ifdef CONFIG_CGROUP_HUGETLB
50+ /*
51+ * On private mappings, the counter to uncharge reservations is stored
52+ * here. If these fields are 0, then either the mapping is shared, or
53+ * cgroup accounting is disabled for this resv_map.
54+ */
55+ struct page_counter *reservation_counter;
56+ unsigned long pages_per_hpage;
57+ struct cgroup_subsys_state *css;
58+#endif
59+};
60+
61+/*
62+ * Region tracking -- allows tracking of reservations and instantiated pages
63+ * across the pages in a mapping.
64+ *
65+ * The region data structures are embedded into a resv_map and protected
66+ * by a resv_map's lock. The set of regions within the resv_map represent
67+ * reservations for huge pages, or huge pages that have already been
68+ * instantiated within the map. The from and to elements are huge page
69+ * indicies into the associated mapping. from indicates the starting index
70+ * of the region. to represents the first index past the end of the region.
71+ *
72+ * For example, a file region structure with from == 0 and to == 4 represents
73+ * four huge pages in a mapping. It is important to note that the to element
74+ * represents the first element past the end of the region. This is used in
75+ * arithmetic as 4(to) - 0(from) = 4 huge pages in the region.
76+ *
77+ * Interval notation of the form [from, to) will be used to indicate that
78+ * the endpoint from is inclusive and to is exclusive.
79+ */
80+struct file_region {
81+ struct list_head link;
82+ long from;
83+ long to;
84+#ifdef CONFIG_CGROUP_HUGETLB
85+ /*
86+ * On shared mappings, each reserved region appears as a struct
87+ * file_region in resv_map. These fields hold the info needed to
88+ * uncharge each reservation.
89+ */
90+ struct page_counter *reservation_counter;
91+ struct cgroup_subsys_state *css;
92+#endif
4993 };
94+
5095 extern struct resv_map *resv_map_alloc(void);
5196 void resv_map_release(struct kref *ref);
5297
@@ -109,6 +154,8 @@ u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx); · 56 unmodified lines
109154
110155 pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
111156
157+struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage);
158+
112159 extern int sysctl_hugetlb_shm_group;
113160 extern struct list_head huge_boot_pages;
114161
@@ -151,6 +198,12 @@ static inline unsigned long hugetlb_total_pages(void) · 36 unmodified lines
151198 return 0;
152199 }
153200
201+static inline struct address_space *hugetlb_page_mapping_lock_write(
202+ struct page *hpage)
203+{
204+ return NULL;
205+}
206+
154207 static inline int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr,
155208 pte_t *ptep)
156209 {
@@ -390,7 +443,10 @@ static inline bool is_file_hugepages(struct file *file) · 233 unmodified lines
390443 return is_file_shm_hugepages(file);
391444 }
392445
393−
446+static inline struct hstate *hstate_inode(struct inode *i)
447+{
448+ return HUGETLBFS_SB(i->i_sb)->hstate;
449+}
394450 #else /* !CONFIG_HUGETLBFS */
395451
396452 #define is_file_hugepages(file) false
@@ -402,6 +458,10 @@ hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, · 5 unmodified lines
402458 return ERR_PTR(-ENOSYS);
403459 }
404460
461+static inline struct hstate *hstate_inode(struct inode *i)
462+{
463+ return NULL;
464+}
405465 #endif /* !CONFIG_HUGETLBFS */
406466
407467 #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
@@ -432,8 +492,8 @@ struct hstate { · 24 unmodified lines
432492 unsigned int surplus_huge_pages_node[MAX_NUMNODES];
433493 #ifdef CONFIG_CGROUP_HUGETLB
434494 /* cgroup control files */
435− struct cftype cgroup_files_dfl[5];
436− struct cftype cgroup_files_legacy[5];
495+ struct cftype cgroup_files_dfl[7];
496+ struct cftype cgroup_files_legacy[9];
437497 #endif
438498 char name[HSTATE_NAME_LEN];
439499 };
@@ -472,11 +532,6 @@ extern unsigned int default_hstate_idx; · 32 unmodified lines
472532
473533 #define default_hstate (hstates[default_hstate_idx])
474534
475−static inline struct hstate *hstate_inode(struct inode *i)
476−{
477− return HUGETLBFS_SB(i->i_sb)->hstate;
478−}
479−
480535 static inline struct hstate *hstate_file(struct file *f)
481536 {
482537 return hstate_inode(file_inode(f));
@@ -729,11 +784,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) · 246 unmodified lines
729784 return NULL;
730785 }
731786
732−static inline struct hstate *hstate_inode(struct inode *i)
733−{
734− return NULL;
735−}
736−
737787 static inline struct hstate *page_hstate(struct page *page)
738788 {
739789 return NULL;
@@ -845,4 +895,16 @@ static inline spinlock_t *huge_pte_lock(struct hstate *h, · 105 unmodified lines
845895 return ptl;
846896 }
847897
898+#if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_CMA)
899+extern void __init hugetlb_cma_reserve(int order);
900+extern void __init hugetlb_cma_check(void);
901+#else
902+static inline __init void hugetlb_cma_reserve(int order)
903+{
904+}
905+static inline __init void hugetlb_cma_check(void)
906+{
907+}
908+#endif
909+
848910 #endif /* _LINUX_HUGETLB_H */
include/linux/hugetlb_cgroup.h+151−18
@@ -18,34 +18,96 @@ · 17 unmodified lines
1818 #include <linux/mmdebug.h>
1919
2020 struct hugetlb_cgroup;
21+struct resv_map;
22+struct file_region;
23+
2124 /*
2225 * Minimum page order trackable by hugetlb cgroup.
23− * At least 3 pages are necessary for all the tracking information.
26+ * At least 4 pages are necessary for all the tracking information.
27+ * The second tail page (hpage[2]) is the fault usage cgroup.
28+ * The third tail page (hpage[3]) is the reservation usage cgroup.
2429 */
2530 #define HUGETLB_CGROUP_MIN_ORDER 2
2631
2732 #ifdef CONFIG_CGROUP_HUGETLB
33+enum hugetlb_memory_event {
34+ HUGETLB_MAX,
35+ HUGETLB_NR_MEMORY_EVENTS,
36+};
2837
29−static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)
38+struct hugetlb_cgroup {
39+ struct cgroup_subsys_state css;
40+
41+ /*
42+ * the counter to account for hugepages from hugetlb.
43+ */
44+ struct page_counter hugepage[HUGE_MAX_HSTATE];
45+
46+ /*
47+ * the counter to account for hugepage reservations from hugetlb.
48+ */
49+ struct page_counter rsvd_hugepage[HUGE_MAX_HSTATE];
50+
51+ atomic_long_t events[HUGE_MAX_HSTATE][HUGETLB_NR_MEMORY_EVENTS];
52+ atomic_long_t events_local[HUGE_MAX_HSTATE][HUGETLB_NR_MEMORY_EVENTS];
53+
54+ /* Handle for "hugetlb.events" */
55+ struct cgroup_file events_file[HUGE_MAX_HSTATE];
56+
57+ /* Handle for "hugetlb.events.local" */
58+ struct cgroup_file events_local_file[HUGE_MAX_HSTATE];
59+};
60+
61+static inline struct hugetlb_cgroup *
62+__hugetlb_cgroup_from_page(struct page *page, bool rsvd)
3063 {
3164 VM_BUG_ON_PAGE(!PageHuge(page), page);
3265
3366 if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
3467 return NULL;
35− return (struct hugetlb_cgroup *)page[2].private;
68+ if (rsvd)
69+ return (struct hugetlb_cgroup *)page[3].private;
70+ else
71+ return (struct hugetlb_cgroup *)page[2].private;
72+}
73+
74+static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)
75+{
76+ return __hugetlb_cgroup_from_page(page, false);
77+}
78+
79+static inline struct hugetlb_cgroup *
80+hugetlb_cgroup_from_page_rsvd(struct page *page)
81+{
82+ return __hugetlb_cgroup_from_page(page, true);
3683 }
3784
38−static inline
39−int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg)
85+static inline int __set_hugetlb_cgroup(struct page *page,
86+ struct hugetlb_cgroup *h_cg, bool rsvd)
4087 {
4188 VM_BUG_ON_PAGE(!PageHuge(page), page);
4289
4390 if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
4491 return -1;
45− page[2].private = (unsigned long)h_cg;
92+ if (rsvd)
93+ page[3].private = (unsigned long)h_cg;
94+ else
95+ page[2].private = (unsigned long)h_cg;
4696 return 0;
4797 }
4898
99+static inline int set_hugetlb_cgroup(struct page *page,
100+ struct hugetlb_cgroup *h_cg)
101+{
102+ return __set_hugetlb_cgroup(page, h_cg, false);
103+}
104+
105+static inline int set_hugetlb_cgroup_rsvd(struct page *page,
106+ struct hugetlb_cgroup *h_cg)
107+{
108+ return __set_hugetlb_cgroup(page, h_cg, true);
109+}
110+
49111 static inline bool hugetlb_cgroup_disabled(void)
50112 {
51113 return !cgroup_subsys_enabled(hugetlb_cgrp_subsys);
@@ -53,25 +115,67 @@ static inline bool hugetlb_cgroup_disabled(void) · 1 unmodified line
53115
54116 extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
55117 struct hugetlb_cgroup **ptr);
118+extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages,
119+ struct hugetlb_cgroup **ptr);
56120 extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
57121 struct hugetlb_cgroup *h_cg,
58122 struct page *page);
123+extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
124+ struct hugetlb_cgroup *h_cg,
125+ struct page *page);
59126 extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
60127 struct page *page);
128+extern void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages,
129+ struct page *page);
130+
61131 extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
62132 struct hugetlb_cgroup *h_cg);
133+extern void hugetlb_cgroup_uncharge_cgroup_rsvd(int idx, unsigned long nr_pages,
134+ struct hugetlb_cgroup *h_cg);
135+extern void hugetlb_cgroup_uncharge_counter(struct resv_map *resv,
136+ unsigned long start,
137+ unsigned long end);
138+
139+extern void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
140+ struct file_region *rg,
141+ unsigned long nr_pages);
142+
63143 extern void hugetlb_cgroup_file_init(void) __init;
64144 extern void hugetlb_cgroup_migrate(struct page *oldhpage,
65145 struct page *newhpage);
66146
67147 #else
148+static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
149+ struct file_region *rg,
150+ unsigned long nr_pages)
151+{
152+}
153+
68154 static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)
69155 {
70156 return NULL;
71157 }
72158
73−static inline
74−int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg)
159+static inline struct hugetlb_cgroup *
160+hugetlb_cgroup_from_page_resv(struct page *page)
161+{
162+ return NULL;
163+}
164+
165+static inline struct hugetlb_cgroup *
166+hugetlb_cgroup_from_page_rsvd(struct page *page)
167+{
168+ return NULL;
169+}
170+
171+static inline int set_hugetlb_cgroup(struct page *page,
172+ struct hugetlb_cgroup *h_cg)
173+{
174+ return 0;
175+}
176+
177+static inline int set_hugetlb_cgroup_rsvd(struct page *page,
178+ struct hugetlb_cgroup *h_cg)
75179 {
76180 return 0;
77181 }
@@ -81,28 +185,57 @@ static inline bool hugetlb_cgroup_disabled(void) · 3 unmodified lines
81185 return true;
82186 }
83187
84−static inline int
85−hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
86− struct hugetlb_cgroup **ptr)
188+static inline int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
189+ struct hugetlb_cgroup **ptr)
87190 {
88191 return 0;
89192 }
90193
91−static inline void
92−hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
93− struct hugetlb_cgroup *h_cg,
94− struct page *page)
194+static inline int hugetlb_cgroup_charge_cgroup_rsvd(int idx,
195+ unsigned long nr_pages,
196+ struct hugetlb_cgroup **ptr)
197+{
198+ return 0;
199+}
200+
201+static inline void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
202+ struct hugetlb_cgroup *h_cg,
203+ struct page *page)
95204 {
96205 }
97206
98207 static inline void
99−hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, struct page *page)
208+hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
209+ struct hugetlb_cgroup *h_cg,
210+ struct page *page)
211+{
212+}
213+
214+static inline void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
215+ struct page *page)
216+{
217+}
218+
219+static inline void hugetlb_cgroup_uncharge_page_rsvd(int idx,
220+ unsigned long nr_pages,
221+ struct page *page)
222+{
223+}
224+static inline void hugetlb_cgroup_uncharge_cgroup(int idx,
225+ unsigned long nr_pages,
226+ struct hugetlb_cgroup *h_cg)
100227 {
101228 }
102229
103230 static inline void
104−hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
105− struct hugetlb_cgroup *h_cg)
231+hugetlb_cgroup_uncharge_cgroup_rsvd(int idx, unsigned long nr_pages,
232+ struct hugetlb_cgroup *h_cg)
233+{
234+}
235+
236+static inline void hugetlb_cgroup_uncharge_counter(struct resv_map *resv,
237+ unsigned long start,
238+ unsigned long end)
106239 {
107240 }
108241
include/linux/i2c-smbus.h+2−7
@@ -15,24 +15,19 @@ · 14 unmodified lines
1515
1616 /**
1717 * i2c_smbus_alert_setup - platform data for the smbus_alert i2c client
18− * @alert_edge_triggered: whether the alert interrupt is edge (1) or level (0)
19− * triggered
2018 * @irq: IRQ number, if the smbus_alert driver should take care of interrupt
2119 * handling
2220 *
2321 * If irq is not specified, the smbus_alert driver doesn't take care of
2422 * interrupt handling. In that case it is up to the I2C bus driver to either
2523 * handle the interrupts or to poll for alerts.
26− *
27− * If irq is specified then it it crucial that alert_edge_triggered is
28− * properly set.
2924 */
3025 struct i2c_smbus_alert_setup {
3126 int irq;
3227 };
3328
34−struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter,
35− struct i2c_smbus_alert_setup *setup);
29+struct i2c_client *i2c_new_smbus_alert_device(struct i2c_adapter *adapter,
30+ struct i2c_smbus_alert_setup *setup);
3631 int i2c_handle_smbus_alert(struct i2c_client *ara);
3732
3833 #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF)
include/linux/i2c.h+10−2
@@ -39,6 +39,14 @@ enum i2c_slave_event; · 38 unmodified lines
3939 typedef int (*i2c_slave_cb_t)(struct i2c_client *client,
4040 enum i2c_slave_event event, u8 *val);
4141
42+/* I2C Frequency Modes */
43+#define I2C_MAX_STANDARD_MODE_FREQ 100000
44+#define I2C_MAX_FAST_MODE_FREQ 400000
45+#define I2C_MAX_FAST_MODE_PLUS_FREQ 1000000
46+#define I2C_MAX_TURBO_MODE_FREQ 1400000
47+#define I2C_MAX_HIGH_SPEED_MODE_FREQ 3400000
48+#define I2C_MAX_ULTRA_FAST_MODE_FREQ 5000000
49+
4250 struct module;
4351 struct property_entry;
4452
@@ -506,7 +514,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info, · 461 unmodified lines
506514 * @smbus_xfer_atomic: same as @smbus_xfer. Yet, only using atomic context
507515 * so e.g. PMICs can be accessed very late before shutdown. Optional.
508516 * @functionality: Return the flags that this algorithm/adapter pair supports
509− * from the I2C_FUNC_* flags.
517+ * from the ``I2C_FUNC_*`` flags.
510518 * @reg_slave: Register given client to I2C slave mode of this adapter
511519 * @unreg_slave: Unregister given client from I2C slave mode of this adapter
512520 *
@@ -515,7 +523,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info, · 2 unmodified lines
515523 * be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
516524 * to name two of the most common.
517525 *
518− * The return codes from the @master_xfer{_atomic} fields should indicate the
526+ * The return codes from the ``master_xfer{_atomic}`` fields should indicate the
519527 * type of error code that occurred during the transfer, as documented in the
520528 * Kernel Documentation file Documentation/i2c/fault-codes.rst.
521529 */
include/linux/ieee80211.h+24−6
@@ -619,6 +619,15 @@ static inline bool ieee80211_is_qos_nullfunc(__le16 fc) · 618 unmodified lines
619619 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
620620 }
621621
622+/**
623+ * ieee80211_is_any_nullfunc - check if frame is regular or QoS nullfunc frame
624+ * @fc: frame control bytes in little-endian byteorder
625+ */
626+static inline bool ieee80211_is_any_nullfunc(__le16 fc)
627+{
628+ return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc));
629+}
630+
622631 /**
623632 * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU
624633 * @fc: frame control field in little-endian byteorder
@@ -2047,13 +2056,13 @@ ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) · 1422 unmodified lines
20472056 #define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000
20482057 #define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x00020000
20492058 #define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000
2050−#define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24
2059+#define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24
20512060 #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000
20522061 #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x80000000
20532062
20542063 /*
20552064 * ieee80211_he_oper_size - calculate 802.11ax HE Operations IE size
2056− * @he_oper_ie: byte data of the He Operations IE, stating from the the byte
2065+ * @he_oper_ie: byte data of the He Operations IE, stating from the byte
20572066 * after the ext ID byte. It is assumed that he_oper_ie has at least
20582067 * sizeof(struct ieee80211_he_operation) bytes, the caller must have
20592068 * validated this.
@@ -2091,7 +2100,7 @@ ieee80211_he_oper_size(const u8 *he_oper_ie) · 31 unmodified lines
20912100
20922101 /*
20932102 * ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size
2094− * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the the byte
2103+ * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the byte
20952104 * after the ext ID byte. It is assumed that he_spr_ie has at least
20962105 * sizeof(struct ieee80211_he_spr) bytes, the caller must have validated
20972106 * this
@@ -2102,14 +2111,14 @@ ieee80211_he_spr_size(const u8 *he_spr_ie) · 4 unmodified lines
21022111 {
21032112 struct ieee80211_he_spr *he_spr = (void *)he_spr_ie;
21042113 u8 spr_len = sizeof(struct ieee80211_he_spr);
2105− u32 he_spr_params;
2114+ u8 he_spr_params;
21062115
21072116 /* Make sure the input is not NULL */
21082117 if (!he_spr_ie)
21092118 return 0;
21102119
21112120 /* Calc required length */
2112− he_spr_params = le32_to_cpu(he_spr->he_sr_control);
2121+ he_spr_params = he_spr->he_sr_control;
21132122 if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
21142123 spr_len++;
21152124 if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT)
@@ -2523,6 +2532,7 @@ enum ieee80211_eid { · 407 unmodified lines
25232532 WLAN_EID_FILS_INDICATION = 240,
25242533 WLAN_EID_DILS = 241,
25252534 WLAN_EID_FRAGMENT = 242,
2535+ WLAN_EID_RSNX = 244,
25262536 WLAN_EID_EXTENSION = 255
25272537 };
25282538
@@ -2734,7 +2744,7 @@ enum ieee80211_tdls_actioncode { · 205 unmodified lines
27342744 */
27352745 #define WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT BIT(6)
27362746
2737−/* TDLS capabilities in the the 4th byte of @WLAN_EID_EXT_CAPABILITY */
2747+/* TDLS capabilities in the 4th byte of @WLAN_EID_EXT_CAPABILITY */
27382748 #define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4)
27392749 #define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5)
27402750 #define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6)
@@ -3034,6 +3044,7 @@ struct ieee80211_multiple_bssid_configuration { · 293 unmodified lines
30343044 #define WLAN_AKM_SUITE_FILS_SHA384 SUITE(0x000FAC, 15)
30353045 #define WLAN_AKM_SUITE_FT_FILS_SHA256 SUITE(0x000FAC, 16)
30363046 #define WLAN_AKM_SUITE_FT_FILS_SHA384 SUITE(0x000FAC, 17)
3047+#define WLAN_AKM_SUITE_OWE SUITE(0x000FAC, 18)
30373048
30383049 #define WLAN_MAX_KEY_LEN 32
30393050
@@ -3412,4 +3423,11 @@ static inline bool for_each_element_completed(const struct element *element, · 372 unmodified lines
34123423 return (const u8 *)element == (const u8 *)data + datalen;
34133424 }
34143425
3426+/**
3427+ * RSNX Capabilities:
3428+ * bits 0-3: Field length (n-1)
3429+ */
3430+#define WLAN_RSNX_CAPA_PROTECTED_TWT BIT(4)
3431+#define WLAN_RSNX_CAPA_SAE_H2E BIT(5)
3432+
34153433 #endif /* LINUX_IEEE80211_H */
include/linux/iio/common/cros_ec_sensors_core.h+14−90
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/irqreturn.h>
1313 #include <linux/platform_data/cros_ec_commands.h>
1414 #include <linux/platform_data/cros_ec_proto.h>
15+#include <linux/platform_data/cros_ec_sensorhub.h>
1516
1617 enum {
1718 CROS_EC_SENSOR_X,
@@ -29,8 +30,7 @@ enum { · 11 unmodified lines
2930 */
3031 #define CROS_EC_SAMPLE_SIZE (sizeof(s64) * 2)
3132
32−/* Minimum sampling period to use when device is suspending */
33−#define CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY 1000 /* 1 second */
33+typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p);
3434
3535 /**
3636 * struct cros_ec_sensors_core_state - state data for EC sensors IIO driver
@@ -50,7 +50,9 @@ enum { · 13 unmodified lines
5050 * the timestamp. The timestamp is always last and
5151 * is always 8-byte aligned.
5252 * @read_ec_sensors_data: function used for accessing sensors values
53− * @cuur_sampl_freq: current sampling period
53+ * @fifo_max_event_count: Size of the EC sensor FIFO
54+ * @frequencies: Table of known available frequencies:
55+ * 0, Min and Max in mHz
5456 */
5557 struct cros_ec_sensors_core_state {
5658 struct cros_ec_device *ec;
@@ -73,101 +75,34 @@ struct cros_ec_sensors_core_state { · 16 unmodified lines
7375 int (*read_ec_sensors_data)(struct iio_dev *indio_dev,
7476 unsigned long scan_mask, s16 *data);
7577
76− int curr_sampl_freq;
77−
78− /* Table of known available frequencies : 0, Min and Max in mHz */
79− int frequencies[3];
78+ u32 fifo_max_event_count;
79+ int frequencies[6];
8080 };
8181
82−/**
83− * cros_ec_sensors_read_lpc() - retrieve data from EC shared memory
84− * @indio_dev: pointer to IIO device
85− * @scan_mask: bitmap of the sensor indices to scan
86− * @data: location to store data
87− *
88− * This is the safe function for reading the EC data. It guarantees that the
89− * data sampled was not modified by the EC while being read.
90− *
91− * Return: 0 on success, -errno on failure.
92− */
9382 int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev, unsigned long scan_mask,
9483 s16 *data);
9584
96−/**
97− * cros_ec_sensors_read_cmd() - retrieve data using the EC command protocol
98− * @indio_dev: pointer to IIO device
99− * @scan_mask: bitmap of the sensor indices to scan
100− * @data: location to store data
101− *
102− * Return: 0 on success, -errno on failure.
103− */
10485 int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask,
10586 s16 *data);
10687
10788 struct platform_device;
108−/**
109− * cros_ec_sensors_core_init() - basic initialization of the core structure
110− * @pdev: platform device created for the sensors
111− * @indio_dev: iio device structure of the device
112− * @physical_device: true if the device refers to a physical device
113− *
114− * Return: 0 on success, -errno on failure.
115− */
11689 int cros_ec_sensors_core_init(struct platform_device *pdev,
117− struct iio_dev *indio_dev, bool physical_device);
90+ struct iio_dev *indio_dev, bool physical_device,
91+ cros_ec_sensors_capture_t trigger_capture,
92+ cros_ec_sensorhub_push_data_cb_t push_data);
11893
119−/**
120− * cros_ec_sensors_capture() - the trigger handler function
121− * @irq: the interrupt number.
122− * @p: a pointer to the poll function.
123− *
124− * On a trigger event occurring, if the pollfunc is attached then this
125− * handler is called as a threaded interrupt (and hence may sleep). It
126− * is responsible for grabbing data from the device and pushing it into
127− * the associated buffer.
128− *
129− * Return: IRQ_HANDLED
130− */
13194 irqreturn_t cros_ec_sensors_capture(int irq, void *p);
95+int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
96+ s16 *data,
97+ s64 timestamp);
13298
133−/**
134− * cros_ec_motion_send_host_cmd() - send motion sense host command
135− * @st: pointer to state information for device
136− * @opt_length: optional length to reduce the response size, useful on the data
137− * path. Otherwise, the maximal allowed response size is used
138− *
139− * When called, the sub-command is assumed to be set in param->cmd.
140− *
141− * Return: 0 on success, -errno on failure.
142− */
14399 int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st,
144100 u16 opt_length);
145101
146−/**
147− * cros_ec_sensors_core_read() - function to request a value from the sensor
148− * @st: pointer to state information for device
149− * @chan: channel specification structure table
150− * @val: will contain one element making up the returned value
151− * @val2: will contain another element making up the returned value
152− * @mask: specifies which values to be requested
153− *
154− * Return: the type of value returned by the device
155− */
156102 int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st,
157103 struct iio_chan_spec const *chan,
158104 int *val, int *val2, long mask);
159105
160−/**
161− * cros_ec_sensors_core_read_avail() - get available values
162− * @indio_dev: pointer to state information for device
163− * @chan: channel specification structure table
164− * @vals: list of available values
165− * @type: type of data returned
166− * @length: number of data returned in the array
167− * @mask: specifies which values to be requested
168− *
169− * Return: an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST
170− */
171106 int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev,
172107 struct iio_chan_spec const *chan,
173108 const int **vals,
@@ -175,23 +110,12 @@ int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev, · 1 unmodified line
175110 int *length,
176111 long mask);
177112
178−/**
179− * cros_ec_sensors_core_write() - function to write a value to the sensor
180− * @st: pointer to state information for device
181− * @chan: channel specification structure table
182− * @val: first part of value to write
183− * @val2: second part of value to write
184− * @mask: specifies which values to write
185− *
186− * Return: the type of value returned by the device
187− */
188113 int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st,
189114 struct iio_chan_spec const *chan,
190115 int val, int val2, long mask);
191116
192−extern const struct dev_pm_ops cros_ec_sensors_pm_ops;
193−
194117 /* List of extended channel specification for all sensors */
195118 extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];
119+extern const struct attribute *cros_ec_sensor_fifo_attributes[];
196120
197121 #endif /* __CROS_EC_SENSORS_CORE_H */
include/linux/iio/iio.h+4−0
@@ -568,6 +568,8 @@ struct iio_dev { · 567 unmodified lines
568568 #if defined(CONFIG_DEBUG_FS)
569569 struct dentry *debugfs_dentry;
570570 unsigned cached_reg_addr;
571+ char read_buf[20];
572+ unsigned int read_buf_len;
571573 #endif
572574 };
573575
@@ -627,6 +629,8 @@ static inline clockid_t iio_device_get_clock(const struct iio_dev *indio_dev) · 53 unmodified lines
627629 return indio_dev->clock_id;
628630 }
629631
632+int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id);
633+
630634 /**
631635 * dev_to_iio_dev() - Get IIO device struct from a device struct
632636 * @dev: The device embedded in the IIO device
include/linux/iio/imu/adis.h+49−2
@@ -41,9 +41,16 @@ struct adis_timeout { · 40 unmodified lines
4141 * @glob_cmd_reg: Register address of the GLOB_CMD register
4242 * @msc_ctrl_reg: Register address of the MSC_CTRL register
4343 * @diag_stat_reg: Register address of the DIAG_STAT register
44+ * @prod_id_reg: Register address of the PROD_ID register
45+ * @prod_id: Product ID code that should be expected when reading @prod_id_reg
46+ * @self_test_mask: Bitmask of supported self-test operations
47+ * @self_test_reg: Register address to request self test command
48+ * @self_test_no_autoclear: True if device's self-test needs clear of ctrl reg
4449 * @status_error_msgs: Array of error messgaes
45− * @status_error_mask:
50+ * @status_error_mask: Bitmask of errors supported by the device
4651 * @timeouts: Chip specific delays
52+ * @enable_irq: Hook for ADIS devices that have a special IRQ enable/disable
53+ * @has_paging: True if ADIS device has paged registers
4754 */
4855 struct adis_data {
4956 unsigned int read_delay;
@@ -53,8 +60,12 @@ struct adis_data { · 3 unmodified lines
5360 unsigned int glob_cmd_reg;
5461 unsigned int msc_ctrl_reg;
5562 unsigned int diag_stat_reg;
63+ unsigned int prod_id_reg;
64+
65+ unsigned int prod_id;
5666
5767 unsigned int self_test_mask;
68+ unsigned int self_test_reg;
5869 bool self_test_no_autoclear;
5970 const struct adis_timeout *timeouts;
6071
@@ -66,6 +77,20 @@ struct adis_data { · 5 unmodified lines
6677 bool has_paging;
6778 };
6879
80+/**
81+ * struct adis - ADIS device instance data
82+ * @spi: Reference to SPI device which owns this ADIS IIO device
83+ * @trig: IIO trigger object data
84+ * @data: ADIS chip variant specific data
85+ * @burst: ADIS burst transfer information
86+ * @state_lock: Lock used by the device to protect state
87+ * @msg: SPI message object
88+ * @xfer: SPI transfer objects to be used for a @msg
89+ * @current_page: Some ADIS devices have registers, this selects current page
90+ * @buffer: Data buffer for information read from the device
91+ * @tx: DMA safe TX buffer for SPI transfers
92+ * @rx: DMA safe RX buffer for SPI transfers
93+ */
6994 struct adis {
7095 struct spi_device *spi;
7196 struct iio_trigger *trig;
@@ -73,6 +98,17 @@ struct adis { · 1 unmodified line
7398 const struct adis_data *data;
7499 struct adis_burst *burst;
75100
101+ /**
102+ * The state_lock is meant to be used during operations that require
103+ * a sequence of SPI R/W in order to protect the SPI transfer
104+ * information (fields 'xfer', 'msg' & 'current_page') between
105+ * potential concurrent accesses.
106+ * This lock is used by all "adis_{functions}" that have to read/write
107+ * registers. These functions also have unlocked variants
108+ * (see "__adis_{functions}"), which don't hold this lock.
109+ * This allows users of the ADIS library to group SPI R/W into
110+ * the drivers, but they also must manage this lock themselves.
111+ */
76112 struct mutex state_lock;
77113 struct spi_message msg;
78114 struct spi_transfer *xfer;
@@ -297,6 +333,7 @@ static inline int adis_read_reg_32(struct adis *adis, unsigned int reg, · 218 unmodified lines
297333
298334 int adis_enable_irq(struct adis *adis, bool enable);
299335 int __adis_check_status(struct adis *adis);
336+int __adis_initial_startup(struct adis *adis);
300337
301338 static inline int adis_check_status(struct adis *adis)
302339 {
@@ -309,7 +346,17 @@ static inline int adis_check_status(struct adis *adis) · 6 unmodified lines
309346 return ret;
310347 }
311348
312−int adis_initial_startup(struct adis *adis);
349+/* locked version of __adis_initial_startup() */
350+static inline int adis_initial_startup(struct adis *adis)
351+{
352+ int ret;
353+
354+ mutex_lock(&adis->state_lock);
355+ ret = __adis_initial_startup(adis);
356+ mutex_unlock(&adis->state_lock);
357+
358+ return ret;
359+}
313360
314361 int adis_single_conversion(struct iio_dev *indio_dev,
315362 const struct iio_chan_spec *chan, unsigned int error_mask,
include/linux/ima.h+1−2
@@ -30,8 +30,7 @@ extern void ima_kexec_cmdline(const void *buf, int size); · 29 unmodified lines
3030 extern void ima_add_kexec_buffer(struct kimage *image);
3131 #endif
3232
33−#if (defined(CONFIG_X86) && defined(CONFIG_EFI)) || defined(CONFIG_S390) \
34− || defined(CONFIG_PPC_SECURE_BOOT)
33+#ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT
3534 extern bool arch_ima_get_secureboot(void);
3635 extern const char * const *arch_get_ima_policy(void);
3736 #else
include/linux/inet_diag.h+28−17
@@ -2,24 +2,17 @@ · 1 unmodified line
22 #ifndef _INET_DIAG_H_
33 #define _INET_DIAG_H_ 1
44
5+#include <net/netlink.h>
56 #include <uapi/linux/inet_diag.h>
67
7−struct net;
8−struct sock;
98 struct inet_hashinfo;
10−struct nlattr;
11−struct nlmsghdr;
12−struct sk_buff;
13−struct netlink_callback;
149
1510 struct inet_diag_handler {
1611 void (*dump)(struct sk_buff *skb,
1712 struct netlink_callback *cb,
18− const struct inet_diag_req_v2 *r,
19− struct nlattr *bc);
13+ const struct inet_diag_req_v2 *r);
2014
21− int (*dump_one)(struct sk_buff *in_skb,
22− const struct nlmsghdr *nlh,
15+ int (*dump_one)(struct netlink_callback *cb,
2316 const struct inet_diag_req_v2 *req);
2417
2518 void (*idiag_get_info)(struct sock *sk,
@@ -40,18 +33,25 @@ struct inet_diag_handler { · 14 unmodified lines
4033 __u16 idiag_info_size;
4134 };
4235
36+struct bpf_sk_storage_diag;
37+struct inet_diag_dump_data {
38+ struct nlattr *req_nlas[__INET_DIAG_REQ_MAX];
39+#define inet_diag_nla_bc req_nlas[INET_DIAG_REQ_BYTECODE]
40+#define inet_diag_nla_bpf_stgs req_nlas[INET_DIAG_REQ_SK_BPF_STORAGES]
41+
42+ struct bpf_sk_storage_diag *bpf_stg_diag;
43+};
44+
4345 struct inet_connection_sock;
4446 int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
45− struct sk_buff *skb, const struct inet_diag_req_v2 *req,
46− struct user_namespace *user_ns,
47− u32 pid, u32 seq, u16 nlmsg_flags,
48− const struct nlmsghdr *unlh, bool net_admin);
47+ struct sk_buff *skb, struct netlink_callback *cb,
48+ const struct inet_diag_req_v2 *req,
49+ u16 nlmsg_flags, bool net_admin);
4950 void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
5051 struct netlink_callback *cb,
51− const struct inet_diag_req_v2 *r,
52− struct nlattr *bc);
52+ const struct inet_diag_req_v2 *r);
5353 int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
54− struct sk_buff *in_skb, const struct nlmsghdr *nlh,
54+ struct netlink_callback *cb,
5555 const struct inet_diag_req_v2 *req);
5656
5757 struct sock *inet_diag_find_one_icsk(struct net *net,
@@ -62,6 +62,17 @@ int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); · 4 unmodified lines
6262
6363 void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock *sk);
6464
65+static inline size_t inet_diag_msg_attrs_size(void)
66+{
67+ return nla_total_size(1) /* INET_DIAG_SHUTDOWN */
68+ + nla_total_size(1) /* INET_DIAG_TOS */
69+#if IS_ENABLED(CONFIG_IPV6)
70+ + nla_total_size(1) /* INET_DIAG_TCLASS */
71+ + nla_total_size(1) /* INET_DIAG_SKV6ONLY */
72+#endif
73+ + nla_total_size(4) /* INET_DIAG_MARK */
74+ + nla_total_size(4); /* INET_DIAG_CLASS_ID */
75+}
6576 int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
6677 struct inet_diag_msg *r, int ext,
6778 struct user_namespace *user_ns, bool net_admin);
include/linux/intel-iommu.h+2−0
@@ -123,6 +123,8 @@ · 122 unmodified lines
123123
124124 #define dmar_readq(a) readq(a)
125125 #define dmar_writeq(a,v) writeq(v,a)
126+#define dmar_readl(a) readl(a)
127+#define dmar_writel(a, v) writel(v, a)
126128
127129 #define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)
128130 #define DMAR_VER_MINOR(v) ((v) & 0x0f)
include/linux/interrupt.h+2−0
@@ -248,6 +248,8 @@ extern void enable_percpu_nmi(unsigned int irq, unsigned int type); · 247 unmodified lines
248248 extern int prepare_percpu_nmi(unsigned int irq);
249249 extern void teardown_percpu_nmi(unsigned int irq);
250250
251+extern int irq_inject_interrupt(unsigned int irq);
252+
251253 /* The following three functions are for the core kernel use only. */
252254 extern void suspend_device_irqs(void);
253255 extern void resume_device_irqs(void);
include/linux/io-mapping.h+1−1
@@ -16,7 +16,7 @@ · 15 unmodified lines
1616 * The io_mapping mechanism provides an abstraction for mapping
1717 * individual pages from an io device to the CPU in an efficient fashion.
1818 *
19− * See Documentation/io-mapping.txt
19+ * See Documentation/driver-api/io-mapping.rst
2020 */
2121
2222 struct io_mapping {
include/linux/io.h+0−2
@@ -77,8 +77,6 @@ void *devm_memremap(struct device *dev, resource_size_t offset, · 76 unmodified lines
7777 size_t size, unsigned long flags);
7878 void devm_memunmap(struct device *dev, void *addr);
7979
80−void *__devm_memremap_pages(struct device *dev, struct resource *res);
81−
8280 #ifdef CONFIG_PCI
8381 /*
8482 * The PCI specifications (Rev 3.0, 3.2.5 "Transaction Ordering and
include/linux/ioc3.h+0−93
@@ -1,93 +0,0 @@
1−/*
2− * This file is subject to the terms and conditions of the GNU General Public
3− * License. See the file "COPYING" in the main directory of this archive
4− * for more details.
5− *
6− * Copyright (c) 2005 Stanislaw Skowronek <skylark@linux-mips.org>
7− */
8−
9−#ifndef _LINUX_IOC3_H
10−#define _LINUX_IOC3_H
11−
12−#include <asm/sn/ioc3.h>
13−
14−#define IOC3_MAX_SUBMODULES 32
15−
16−#define IOC3_CLASS_NONE 0
17−#define IOC3_CLASS_BASE_IP27 1
18−#define IOC3_CLASS_BASE_IP30 2
19−#define IOC3_CLASS_MENET_123 3
20−#define IOC3_CLASS_MENET_4 4
21−#define IOC3_CLASS_CADDUO 5
22−#define IOC3_CLASS_SERIAL 6
23−
24−/* One of these per IOC3 */
25−struct ioc3_driver_data {
26− struct list_head list;
27− int id; /* IOC3 sequence number */
28− /* PCI mapping */
29− unsigned long pma; /* physical address */
30− struct ioc3 __iomem *vma; /* pointer to registers */
31− struct pci_dev *pdev; /* PCI device */
32− /* IRQ stuff */
33− int dual_irq; /* set if separate IRQs are used */
34− int irq_io, irq_eth; /* IRQ numbers */
35− /* GPIO magic */
36− spinlock_t gpio_lock;
37− unsigned int gpdr_shadow;
38− /* NIC identifiers */
39− char nic_part[32];
40− char nic_serial[16];
41− char nic_mac[6];
42− /* submodule set */
43− int class;
44− void *data[IOC3_MAX_SUBMODULES]; /* for submodule use */
45− int active[IOC3_MAX_SUBMODULES]; /* set if probe succeeds */
46− /* is_ir_lock must be held while
47− * modifying sio_ie values, so
48− * we can be sure that sio_ie is
49− * not changing when we read it
50− * along with sio_ir.
51− */
52− spinlock_t ir_lock; /* SIO_IE[SC] mod lock */
53−};
54−
55−/* One per submodule */
56−struct ioc3_submodule {
57− char *name; /* descriptive submodule name */
58− struct module *owner; /* owning kernel module */
59− int ethernet; /* set for ethernet drivers */
60− int (*probe) (struct ioc3_submodule *, struct ioc3_driver_data *);
61− int (*remove) (struct ioc3_submodule *, struct ioc3_driver_data *);
62− int id; /* assigned by IOC3, index for the "data" array */
63− /* IRQ stuff */
64− unsigned int irq_mask; /* IOC3 IRQ mask, leave clear for Ethernet */
65− int reset_mask; /* non-zero if you want the ioc3.c module to reset interrupts */
66− int (*intr) (struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
67− /* private submodule data */
68− void *data; /* assigned by submodule */
69−};
70−
71−/**********************************
72− * Functions needed by submodules *
73− **********************************/
74−
75−#define IOC3_W_IES 0
76−#define IOC3_W_IEC 1
77−
78−/* registers a submodule for all existing and future IOC3 chips */
79−extern int ioc3_register_submodule(struct ioc3_submodule *);
80−/* unregisters a submodule */
81−extern void ioc3_unregister_submodule(struct ioc3_submodule *);
82−/* enables IRQs indicated by irq_mask for a specified IOC3 chip */
83−extern void ioc3_enable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
84−/* ackowledges specified IRQs */
85−extern void ioc3_ack(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
86−/* disables IRQs indicated by irq_mask for a specified IOC3 chip */
87−extern void ioc3_disable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
88−/* atomically sets GPCR bits */
89−extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int);
90−/* general ireg writer */
91−extern void ioc3_write_ireg(struct ioc3_driver_data *idd, uint32_t value, int reg);
92−
93−#endif
include/linux/iocontext.h+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88
99 enum {
1010 ICQ_EXITED = 1 << 2,
11+ ICQ_DESTROYED = 1 << 3,
1112 };
1213
1314 /*
include/linux/iommu.h+27−8
@@ -365,17 +365,20 @@ struct iommu_fault_param { · 364 unmodified lines
365365 };
366366
367367 /**
368− * struct iommu_param - collection of per-device IOMMU data
368+ * struct dev_iommu - Collection of per-device IOMMU data
369369 *
370370 * @fault_param: IOMMU detected device fault reporting data
371+ * @fwspec: IOMMU fwspec data
372+ * @priv: IOMMU Driver private data
371373 *
372374 * TODO: migrate other per device data pointers under iommu_dev_data, e.g.
373375 * struct iommu_group *iommu_group;
374− * struct iommu_fwspec *iommu_fwspec;
375376 */
376−struct iommu_param {
377+struct dev_iommu {
377378 struct mutex lock;
378− struct iommu_fault_param *fault_param;
379+ struct iommu_fault_param *fault_param;
380+ struct iommu_fwspec *fwspec;
381+ void *priv;
379382 };
380383
381384 int iommu_device_register(struct iommu_device *iommu);
@@ -588,11 +591,10 @@ struct iommu_group *fsl_mc_device_group(struct device *dev); · 206 unmodified lines
588591 struct iommu_fwspec {
589592 const struct iommu_ops *ops;
590593 struct fwnode_handle *iommu_fwnode;
591− void *iommu_priv;
592594 u32 flags;
593595 u32 num_pasid_bits;
594596 unsigned int num_ids;
595− u32 ids[1];
597+ u32 ids[];
596598 };
597599
598600 /* ATS is supported */
@@ -614,13 +616,26 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode); · 15 unmodified lines
614616
615617 static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
616618 {
617− return dev->iommu_fwspec;
619+ if (dev->iommu)
620+ return dev->iommu->fwspec;
621+ else
622+ return NULL;
618623 }
619624
620625 static inline void dev_iommu_fwspec_set(struct device *dev,
621626 struct iommu_fwspec *fwspec)
622627 {
623− dev->iommu_fwspec = fwspec;
628+ dev->iommu->fwspec = fwspec;
629+}
630+
631+static inline void *dev_iommu_priv_get(struct device *dev)
632+{
633+ return dev->iommu->priv;
634+}
635+
636+static inline void dev_iommu_priv_set(struct device *dev, void *priv)
637+{
638+ dev->iommu->priv = priv;
624639 }
625640
626641 int iommu_probe_device(struct device *dev);
@@ -1073,6 +1088,10 @@ static inline int iommu_sva_unbind_gpasid(struct iommu_domain *domain, · 446 unmodified lines
10731088 return -ENODEV;
10741089 }
10751090
1091+static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
1092+{
1093+ return NULL;
1094+}
10761095 #endif /* CONFIG_IOMMU_API */
10771096
10781097 #ifdef CONFIG_IOMMU_DEBUGFS
include/linux/iopoll.h+33−7
@@ -14,36 +14,41 @@ · 13 unmodified lines
1414 #include <linux/io.h>
1515
1616 /**
17− * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs
18− * @op: accessor function (takes @addr as its only argument)
19− * @addr: Address to poll
17+ * read_poll_timeout - Periodically poll an address until a condition is
18+ * met or a timeout occurs
19+ * @op: accessor function (takes @args as its arguments)
2020 * @val: Variable to read the value into
2121 * @cond: Break condition (usually involving @val)
2222 * @sleep_us: Maximum time to sleep between reads in us (0
2323 * tight-loops). Should be less than ~20ms since usleep_range
2424 * is used (see Documentation/timers/timers-howto.rst).
2525 * @timeout_us: Timeout in us, 0 means never timeout
26+ * @sleep_before_read: if it is true, sleep @sleep_us before read.
27+ * @args: arguments for @op poll
2628 *
2729 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
28− * case, the last read value at @addr is stored in @val. Must not
30+ * case, the last read value at @args is stored in @val. Must not
2931 * be called from atomic context if sleep_us or timeout_us are used.
3032 *
3133 * When available, you'll probably want to use one of the specialized
3234 * macros defined below rather than this macro directly.
3335 */
34−#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \
36+#define read_poll_timeout(op, val, cond, sleep_us, timeout_us, \
37+ sleep_before_read, args...) \
3538 ({ \
3639 u64 __timeout_us = (timeout_us); \
3740 unsigned long __sleep_us = (sleep_us); \
3841 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
3942 might_sleep_if((__sleep_us) != 0); \
43+ if (sleep_before_read && __sleep_us) \
44+ usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
4045 for (;;) { \
41− (val) = op(addr); \
46+ (val) = op(args); \
4247 if (cond) \
4348 break; \
4449 if (__timeout_us && \
4550 ktime_compare(ktime_get(), __timeout) > 0) { \
46− (val) = op(addr); \
51+ (val) = op(args); \
4752 break; \
4853 } \
4954 if (__sleep_us) \
@@ -52,6 +57,27 @@ · 2 unmodified lines
5257 (cond) ? 0 : -ETIMEDOUT; \
5358 })
5459
60+/**
61+ * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs
62+ * @op: accessor function (takes @addr as its only argument)
63+ * @addr: Address to poll
64+ * @val: Variable to read the value into
65+ * @cond: Break condition (usually involving @val)
66+ * @sleep_us: Maximum time to sleep between reads in us (0
67+ * tight-loops). Should be less than ~20ms since usleep_range
68+ * is used (see Documentation/timers/timers-howto.rst).
69+ * @timeout_us: Timeout in us, 0 means never timeout
70+ *
71+ * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
72+ * case, the last read value at @addr is stored in @val. Must not
73+ * be called from atomic context if sleep_us or timeout_us are used.
74+ *
75+ * When available, you'll probably want to use one of the specialized
76+ * macros defined below rather than this macro directly.
77+ */
78+#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \
79+ read_poll_timeout(op, val, cond, sleep_us, timeout_us, false, addr)
80+
5581 /**
5682 * readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs
5783 * @op: accessor function (takes @addr as its only argument)
include/linux/ipv6.h+1−0
@@ -74,6 +74,7 @@ struct ipv6_devconf { · 73 unmodified lines
7474 __u32 addr_gen_mode;
7575 __s32 disable_policy;
7676 __s32 ndisc_tclass;
77+ __s32 rpl_seg_enabled;
7778
7879 struct ctl_table_header *sysctl_header;
7980 };
include/linux/irq.h+13−0
@@ -211,6 +211,8 @@ struct irq_data { · 210 unmodified lines
211211 * IRQD_CAN_RESERVE - Can use reservation mode
212212 * IRQD_MSI_NOMASK_QUIRK - Non-maskable MSI quirk for affinity change
213213 * required
214+ * IRQD_HANDLE_ENFORCE_IRQCTX - Enforce that handle_irq_*() is only invoked
215+ * from actual interrupt context.
214216 */
215217 enum {
216218 IRQD_TRIGGER_MASK = 0xf,
@@ -234,6 +236,7 @@ enum { · 17 unmodified lines
234236 IRQD_DEFAULT_TRIGGER_SET = (1 << 25),
235237 IRQD_CAN_RESERVE = (1 << 26),
236238 IRQD_MSI_NOMASK_QUIRK = (1 << 27),
239+ IRQD_HANDLE_ENFORCE_IRQCTX = (1 << 28),
237240 };
238241
239242 #define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
@@ -303,6 +306,16 @@ static inline bool irqd_is_single_target(struct irq_data *d) · 63 unmodified lines
303306 return __irqd_to_state(d) & IRQD_SINGLE_TARGET;
304307 }
305308
309+static inline void irqd_set_handle_enforce_irqctx(struct irq_data *d)
310+{
311+ __irqd_to_state(d) |= IRQD_HANDLE_ENFORCE_IRQCTX;
312+}
313+
314+static inline bool irqd_is_handle_enforce_irqctx(struct irq_data *d)
315+{
316+ return __irqd_to_state(d) & IRQD_HANDLE_ENFORCE_IRQCTX;
317+}
318+
306319 static inline bool irqd_is_wakeup_set(struct irq_data *d)
307320 {
308321 return __irqd_to_state(d) & IRQD_WAKEUP_STATE;
include/linux/irq_work.h+2−0
@@ -18,6 +18,8 @@ · 17 unmodified lines
1818
1919 /* Doesn't want IPI, wait for tick: */
2020 #define IRQ_WORK_LAZY BIT(2)
21+/* Run hard IRQ context, even on RT */
22+#define IRQ_WORK_HARD_IRQ BIT(3)
2123
2224 #define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY)
2325
include/linux/irqchip/arm-gic-common.h+2−0
@@ -32,6 +32,8 @@ struct gic_kvm_info { · 31 unmodified lines
3232 struct resource vctrl;
3333 /* vlpi support */
3434 bool has_v4;
35+ /* rvpeid support */
36+ bool has_v4_1;
3537 };
3638
3739 const struct gic_kvm_info *gic_get_kvm_info(void);
include/linux/irqchip/arm-gic-v3.h+22−1
@@ -57,6 +57,7 @@ · 56 unmodified lines
5757 #define GICD_SPENDSGIR 0x0F20
5858
5959 #define GICD_CTLR_RWP (1U << 31)
60+#define GICD_CTLR_nASSGIreq (1U << 8)
6061 #define GICD_CTLR_DS (1U << 6)
6162 #define GICD_CTLR_ARE_NS (1U << 4)
6263 #define GICD_CTLR_ENABLE_G1A (1U << 1)
@@ -90,6 +91,7 @@ · 27 unmodified lines
9091 #define GICD_TYPER_ESPIS(typer) \
9192 (((typer) & GICD_TYPER_ESPI) ? GICD_TYPER_SPIS((typer) >> 27) : 0)
9293
94+#define GICD_TYPER2_nASSGIcap (1U << 8)
9395 #define GICD_TYPER2_VIL (1U << 7)
9496 #define GICD_TYPER2_VID GENMASK(4, 0)
9597
@@ -320,6 +322,9 @@ · 224 unmodified lines
320322 #define GICR_VPENDBASER_NonShareable \
321323 GIC_BASER_SHAREABILITY(GICR_VPENDBASER, NonShareable)
322324
325+#define GICR_VPENDBASER_InnerShareable \
326+ GIC_BASER_SHAREABILITY(GICR_VPENDBASER, InnerShareable)
327+
323328 #define GICR_VPENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nCnB)
324329 #define GICR_VPENDBASER_nC GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nC)
325330 #define GICR_VPENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt)
@@ -343,6 +348,15 @@ · 17 unmodified lines
343348 #define GICR_VPENDBASER_4_1_VGRP1EN (1ULL << 58)
344349 #define GICR_VPENDBASER_4_1_VPEID GENMASK_ULL(15, 0)
345350
351+#define GICR_VSGIR 0x0080
352+
353+#define GICR_VSGIR_VPEID GENMASK(15, 0)
354+
355+#define GICR_VSGIPENDR 0x0088
356+
357+#define GICR_VSGIPENDR_BUSY (1U << 31)
358+#define GICR_VSGIPENDR_PENDING GENMASK(15, 0)
359+
346360 /*
347361 * ITS registers, offsets from ITS_base
348362 */
@@ -366,6 +380,11 @@ · 17 unmodified lines
366380
367381 #define GITS_TRANSLATER 0x10040
368382
383+#define GITS_SGIR 0x20020
384+
385+#define GITS_SGIR_VPEID GENMASK_ULL(47, 32)
386+#define GITS_SGIR_VINTID GENMASK_ULL(3, 0)
387+
369388 #define GITS_CTLR_ENABLE (1U << 0)
370389 #define GITS_CTLR_ImDe (1U << 1)
371390 #define GITS_CTLR_ITS_NUMBER_SHIFT 4
@@ -500,8 +519,9 @@ · 128 unmodified lines
500519 #define GITS_CMD_VMAPTI GITS_CMD_GICv4(GITS_CMD_MAPTI)
501520 #define GITS_CMD_VMOVI GITS_CMD_GICv4(GITS_CMD_MOVI)
502521 #define GITS_CMD_VSYNC GITS_CMD_GICv4(GITS_CMD_SYNC)
503−/* VMOVP and INVDB are the odd ones, as they dont have a physical counterpart */
522+/* VMOVP, VSGI and INVDB are the odd ones, as they dont have a physical counterpart */
504523 #define GITS_CMD_VMOVP GITS_CMD_GICv4(2)
524+#define GITS_CMD_VSGI GITS_CMD_GICv4(3)
505525 #define GITS_CMD_INVDB GITS_CMD_GICv4(0xe)
506526
507527 /*
@@ -650,6 +670,7 @@ · 142 unmodified lines
650670
651671 struct rdists {
652672 struct {
673+ raw_spinlock_t rd_lock;
653674 void __iomem *rd_base;
654675 struct page *pend_page;
655676 phys_addr_t phys_base;
include/linux/irqchip/arm-gic-v4.h+23−2
@@ -49,10 +49,22 @@ struct its_vpe { · 48 unmodified lines
4949 };
5050 /* GICv4.1 implementations */
5151 struct {
52+ struct fwnode_handle *fwnode;
53+ struct irq_domain *sgi_domain;
54+ struct {
55+ u8 priority;
56+ bool enabled;
57+ bool group;
58+ } sgi_config[16];
5259 atomic_t vmapp_count;
5360 };
5461 };
5562
63+ /*
64+ * Ensures mutual exclusion between affinity setting of the
65+ * vPE and vLPI operations using vpe->col_idx.
66+ */
67+ raw_spinlock_t vpe_lock;
5668 /*
5769 * This collection ID is used to indirect the target
5870 * redistributor for this VPE. The ID itself isn't involved in
@@ -93,6 +105,7 @@ enum its_vcpu_info_cmd_type { · 34 unmodified lines
93105 SCHEDULE_VPE,
94106 DESCHEDULE_VPE,
95107 INVALL_VPE,
108+ PROP_UPDATE_VSGI,
96109 };
97110
98111 struct its_cmd_info {
@@ -105,19 +118,27 @@ struct its_cmd_info { · 6 unmodified lines
105118 bool g0en;
106119 bool g1en;
107120 };
121+ struct {
122+ u8 priority;
123+ bool group;
124+ };
108125 };
109126 };
110127
111128 int its_alloc_vcpu_irqs(struct its_vm *vm);
112129 void its_free_vcpu_irqs(struct its_vm *vm);
113−int its_schedule_vpe(struct its_vpe *vpe, bool on);
130+int its_make_vpe_resident(struct its_vpe *vpe, bool g0en, bool g1en);
131+int its_make_vpe_non_resident(struct its_vpe *vpe, bool db);
114132 int its_invall_vpe(struct its_vpe *vpe);
115133 int its_map_vlpi(int irq, struct its_vlpi_map *map);
116134 int its_get_vlpi(int irq, struct its_vlpi_map *map);
117135 int its_unmap_vlpi(int irq);
118136 int its_prop_update_vlpi(int irq, u8 config, bool inv);
137+int its_prop_update_vsgi(int irq, u8 priority, bool group);
119138
120139 struct irq_domain_ops;
121−int its_init_v4(struct irq_domain *domain, const struct irq_domain_ops *ops);
140+int its_init_v4(struct irq_domain *domain,
141+ const struct irq_domain_ops *vpe_ops,
142+ const struct irq_domain_ops *sgi_ops);
122143
123144 #endif
include/linux/irqdesc.h+1−1
@@ -24,7 +24,7 @@ struct pt_regs; · 23 unmodified lines
2424 * @handle_irq: highlevel irq-events handler
2525 * @preflow_handler: handler called before the flow handler (currently used by sparc)
2626 * @action: the irq action chain
27− * @status: status information
27+ * @status_use_accessors: status information
2828 * @core_internal_state__do_not_mess_with_it: core internal status information
2929 * @depth: disable-depth, for nested irq_disable() calls
3030 * @wake_depth: enable depth, for multiple irq_set_irq_wake() callers
include/linux/irqflags.h+69−18
@@ -15,15 +15,15 @@ · 14 unmodified lines
1515 #include <linux/typecheck.h>
1616 #include <asm/irqflags.h>
1717
18−/* Currently trace_softirqs_on/off is used only by lockdep */
18+/* Currently lockdep_softirqs_on/off is used only by lockdep */
1919 #ifdef CONFIG_PROVE_LOCKING
20− extern void trace_softirqs_on(unsigned long ip);
21− extern void trace_softirqs_off(unsigned long ip);
20+ extern void lockdep_softirqs_on(unsigned long ip);
21+ extern void lockdep_softirqs_off(unsigned long ip);
2222 extern void lockdep_hardirqs_on(unsigned long ip);
2323 extern void lockdep_hardirqs_off(unsigned long ip);
2424 #else
25− static inline void trace_softirqs_on(unsigned long ip) { }
26− static inline void trace_softirqs_off(unsigned long ip) { }
25+ static inline void lockdep_softirqs_on(unsigned long ip) { }
26+ static inline void lockdep_softirqs_off(unsigned long ip) { }
2727 static inline void lockdep_hardirqs_on(unsigned long ip) { }
2828 static inline void lockdep_hardirqs_off(unsigned long ip) { }
2929 #endif
@@ -31,15 +31,20 @@ · 1 unmodified line
3131 #ifdef CONFIG_TRACE_IRQFLAGS
3232 extern void trace_hardirqs_on(void);
3333 extern void trace_hardirqs_off(void);
34−# define trace_hardirq_context(p) ((p)->hardirq_context)
35−# define trace_softirq_context(p) ((p)->softirq_context)
36−# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)
37−# define trace_softirqs_enabled(p) ((p)->softirqs_enabled)
38−# define trace_hardirq_enter() \
34+# define lockdep_hardirq_context(p) ((p)->hardirq_context)
35+# define lockdep_softirq_context(p) ((p)->softirq_context)
36+# define lockdep_hardirqs_enabled(p) ((p)->hardirqs_enabled)
37+# define lockdep_softirqs_enabled(p) ((p)->softirqs_enabled)
38+# define lockdep_hardirq_enter() \
3939 do { \
40− current->hardirq_context++; \
40+ if (!current->hardirq_context++) \
41+ current->hardirq_threaded = 0; \
4142 } while (0)
42−# define trace_hardirq_exit() \
43+# define lockdep_hardirq_threaded() \
44+do { \
45+ current->hardirq_threaded = 1; \
46+} while (0)
47+# define lockdep_hardirq_exit() \
4348 do { \
4449 current->hardirq_context--; \
4550 } while (0)
@@ -51,17 +56,63 @@ do { \ · 5 unmodified lines
5156 do { \
5257 current->softirq_context--; \
5358 } while (0)
59+
60+# define lockdep_hrtimer_enter(__hrtimer) \
61+({ \
62+ bool __expires_hardirq = true; \
63+ \
64+ if (!__hrtimer->is_hard) { \
65+ current->irq_config = 1; \
66+ __expires_hardirq = false; \
67+ } \
68+ __expires_hardirq; \
69+})
70+
71+# define lockdep_hrtimer_exit(__expires_hardirq) \
72+ do { \
73+ if (!__expires_hardirq) \
74+ current->irq_config = 0; \
75+ } while (0)
76+
77+# define lockdep_posixtimer_enter() \
78+ do { \
79+ current->irq_config = 1; \
80+ } while (0)
81+
82+# define lockdep_posixtimer_exit() \
83+ do { \
84+ current->irq_config = 0; \
85+ } while (0)
86+
87+# define lockdep_irq_work_enter(__work) \
88+ do { \
89+ if (!(atomic_read(&__work->flags) & IRQ_WORK_HARD_IRQ))\
90+ current->irq_config = 1; \
91+ } while (0)
92+# define lockdep_irq_work_exit(__work) \
93+ do { \
94+ if (!(atomic_read(&__work->flags) & IRQ_WORK_HARD_IRQ))\
95+ current->irq_config = 0; \
96+ } while (0)
97+
5498 #else
5599 # define trace_hardirqs_on() do { } while (0)
56100 # define trace_hardirqs_off() do { } while (0)
57−# define trace_hardirq_context(p) 0
58−# define trace_softirq_context(p) 0
59−# define trace_hardirqs_enabled(p) 0
60−# define trace_softirqs_enabled(p) 0
61−# define trace_hardirq_enter() do { } while (0)
62−# define trace_hardirq_exit() do { } while (0)
101+# define lockdep_hardirq_context(p) 0
102+# define lockdep_softirq_context(p) 0
103+# define lockdep_hardirqs_enabled(p) 0
104+# define lockdep_softirqs_enabled(p) 0
105+# define lockdep_hardirq_enter() do { } while (0)
106+# define lockdep_hardirq_threaded() do { } while (0)
107+# define lockdep_hardirq_exit() do { } while (0)
63108 # define lockdep_softirq_enter() do { } while (0)
64109 # define lockdep_softirq_exit() do { } while (0)
110+# define lockdep_hrtimer_enter(__hrtimer) false
111+# define lockdep_hrtimer_exit(__context) do { } while (0)
112+# define lockdep_posixtimer_enter() do { } while (0)
113+# define lockdep_posixtimer_exit() do { } while (0)
114+# define lockdep_irq_work_enter(__work) do { } while (0)
115+# define lockdep_irq_work_exit(__work) do { } while (0)
65116 #endif
66117
67118 #if defined(CONFIG_IRQSOFF_TRACER) || \
include/linux/jiffies.h+1−3
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/types.h>
99 #include <linux/time.h>
1010 #include <linux/timex.h>
11+#include <vdso/jiffies.h>
1112 #include <asm/param.h> /* for HZ */
1213 #include <generated/timeconst.h>
1314
@@ -59,9 +60,6 @@ · 45 unmodified lines
5960
6061 extern int register_refined_jiffies(long clock_tick_rate);
6162
62−/* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */
63−#define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ)
64−
6563 /* TICK_USEC is the time between ticks in usec assuming SHIFTED_HZ */
6664 #define TICK_USEC ((USEC_PER_SEC + HZ/2) / HZ)
6765
include/linux/kasan.h+1−1
@@ -190,7 +190,7 @@ void kasan_init_tags(void); · 189 unmodified lines
190190
191191 void *kasan_reset_tag(const void *addr);
192192
193−void kasan_report(unsigned long addr, size_t size,
193+bool kasan_report(unsigned long addr, size_t size,
194194 bool is_write, unsigned long ip);
195195
196196 #else /* CONFIG_KASAN_SW_TAGS */
include/linux/kernel.h+7−0
@@ -257,6 +257,13 @@ extern void __cant_sleep(const char *file, int line, int preempt_offset); · 256 unmodified lines
257257
258258 #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
259259
260+#ifndef CONFIG_PREEMPT_RT
261+# define cant_migrate() cant_sleep()
262+#else
263+ /* Placeholder for now */
264+# define cant_migrate() do { } while (0)
265+#endif
266+
260267 /**
261268 * abs - return absolute value of an argument
262269 * @x: the value. If it is unsigned type, it is converted to signed type first.
include/linux/kernfs.h+9−2
@@ -37,8 +37,10 @@ enum kernfs_node_type { · 36 unmodified lines
3737 KERNFS_LINK = 0x0004,
3838 };
3939
40−#define KERNFS_TYPE_MASK 0x000f
41−#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK
40+#define KERNFS_TYPE_MASK 0x000f
41+#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK
42+#define KERNFS_MAX_USER_XATTRS 128
43+#define KERNFS_USER_XATTR_SIZE_LIMIT (128 << 10)
4244
4345 enum kernfs_node_flag {
4446 KERNFS_ACTIVATED = 0x0010,
@@ -78,6 +80,11 @@ enum kernfs_root_flag { · 33 unmodified lines
7880 * fhandle to access nodes of the fs.
7981 */
8082 KERNFS_ROOT_SUPPORT_EXPORTOP = 0x0004,
83+
84+ /*
85+ * Support user xattrs to be written to nodes rooted at this root.
86+ */
87+ KERNFS_ROOT_SUPPORT_USER_XATTR = 0x0008,
8188 };
8289
8390 /* type-specific structures for kernfs_node union members */
include/linux/key-type.h+1−1
@@ -127,7 +127,7 @@ struct key_type { · 126 unmodified lines
127127 * much is copied into the buffer
128128 * - shouldn't do the copy if the buffer is NULL
129129 */
130− long (*read)(const struct key *key, char __user *buffer, size_t buflen);
130+ long (*read)(const struct key *key, char *buffer, size_t buflen);
131131
132132 /* handle request_key() for this type instead of invoking
133133 * /sbin/request-key (optional)
include/linux/kfifo.h+73−0
@@ -246,6 +246,37 @@ __kfifo_int_must_check_helper(int val) · 245 unmodified lines
246246 __tmpq->kfifo.in == __tmpq->kfifo.out; \
247247 })
248248
249+/**
250+ * kfifo_is_empty_spinlocked - returns true if the fifo is empty using
251+ * a spinlock for locking
252+ * @fifo: address of the fifo to be used
253+ * @lock: spinlock to be used for locking
254+ */
255+#define kfifo_is_empty_spinlocked(fifo, lock) \
256+({ \
257+ unsigned long __flags; \
258+ bool __ret; \
259+ spin_lock_irqsave(lock, __flags); \
260+ __ret = kfifo_is_empty(fifo); \
261+ spin_unlock_irqrestore(lock, __flags); \
262+ __ret; \
263+})
264+
265+/**
266+ * kfifo_is_empty_spinlocked_noirqsave - returns true if the fifo is empty
267+ * using a spinlock for locking, doesn't disable interrupts
268+ * @fifo: address of the fifo to be used
269+ * @lock: spinlock to be used for locking
270+ */
271+#define kfifo_is_empty_spinlocked_noirqsave(fifo, lock) \
272+({ \
273+ bool __ret; \
274+ spin_lock(lock); \
275+ __ret = kfifo_is_empty(fifo); \
276+ spin_unlock(lock); \
277+ __ret; \
278+})
279+
249280 /**
250281 * kfifo_is_full - returns true if the fifo is full
251282 * @fifo: address of the fifo to be used
@@ -517,6 +548,26 @@ __kfifo_uint_must_check_helper( \ · 265 unmodified lines
517548 __ret; \
518549 })
519550
551+/**
552+ * kfifo_in_spinlocked_noirqsave - put data into fifo using a spinlock for
553+ * locking, don't disable interrupts
554+ * @fifo: address of the fifo to be used
555+ * @buf: the data to be added
556+ * @n: number of elements to be added
557+ * @lock: pointer to the spinlock to use for locking
558+ *
559+ * This is a variant of kfifo_in_spinlocked() but uses spin_lock/unlock()
560+ * for locking and doesn't disable interrupts.
561+ */
562+#define kfifo_in_spinlocked_noirqsave(fifo, buf, n, lock) \
563+({ \
564+ unsigned int __ret; \
565+ spin_lock(lock); \
566+ __ret = kfifo_in(fifo, buf, n); \
567+ spin_unlock(lock); \
568+ __ret; \
569+})
570+
520571 /* alias for kfifo_in_spinlocked, will be removed in a future release */
521572 #define kfifo_in_locked(fifo, buf, n, lock) \
522573 kfifo_in_spinlocked(fifo, buf, n, lock)
@@ -569,6 +620,28 @@ __kfifo_uint_must_check_helper( \ · 46 unmodified lines
569620 }) \
570621 )
571622
623+/**
624+ * kfifo_out_spinlocked_noirqsave - get data from the fifo using a spinlock
625+ * for locking, don't disable interrupts
626+ * @fifo: address of the fifo to be used
627+ * @buf: pointer to the storage buffer
628+ * @n: max. number of elements to get
629+ * @lock: pointer to the spinlock to use for locking
630+ *
631+ * This is a variant of kfifo_out_spinlocked() which uses spin_lock/unlock()
632+ * for locking and doesn't disable interrupts.
633+ */
634+#define kfifo_out_spinlocked_noirqsave(fifo, buf, n, lock) \
635+__kfifo_uint_must_check_helper( \
636+({ \
637+ unsigned int __ret; \
638+ spin_lock(lock); \
639+ __ret = kfifo_out(fifo, buf, n); \
640+ spin_unlock(lock); \
641+ __ret; \
642+}) \
643+)
644+
572645 /* alias for kfifo_out_spinlocked, will be removed in a future release */
573646 #define kfifo_out_locked(fifo, buf, n, lock) \
574647 kfifo_out_spinlocked(fifo, buf, n, lock)
include/linux/kthread.h+2−1
@@ -165,7 +165,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker, · 164 unmodified lines
165165 do { \
166166 kthread_init_work(&(dwork)->work, (fn)); \
167167 timer_setup(&(dwork)->timer, \
168− kthread_delayed_work_timer_fn, 0); \
168+ kthread_delayed_work_timer_fn, \
169+ TIMER_IRQSAFE); \
169170 } while (0)
170171
171172 int kthread_worker_fn(void *worker_ptr);
include/linux/ktime.h+1−8
@@ -216,14 +216,7 @@ static inline __must_check bool ktime_to_timespec64_cond(const ktime_t kt, · 215 unmodified lines
216216 }
217217 }
218218
219−/*
220− * The resolution of the clocks. The resolution value is returned in
221− * the clock_getres() system call to give application programmers an
222− * idea of the (in)accuracy of timers. Timer values are rounded up to
223− * this resolution values.
224− */
225−#define LOW_RES_NSEC TICK_NSEC
226−#define KTIME_LOW_RES (LOW_RES_NSEC)
219+#include <vdso/ktime.h>
227220
228221 static inline ktime_t ns_to_ktime(u64 ns)
229222 {
include/linux/kvm_host.h+40−31
@@ -360,6 +360,10 @@ static inline unsigned long *kvm_second_dirty_bitmap(struct kvm_memory_slot *mem · 359 unmodified lines
360360 return memslot->dirty_bitmap + len / sizeof(*memslot->dirty_bitmap);
361361 }
362362
363+#ifndef KVM_DIRTY_LOG_MANUAL_CAPS
364+#define KVM_DIRTY_LOG_MANUAL_CAPS KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE
365+#endif
366+
363367 struct kvm_s390_adapter_int {
364368 u64 ind_addr;
365369 u64 summary_addr;
@@ -431,11 +435,11 @@ static inline int kvm_arch_vcpu_memslots_id(struct kvm_vcpu *vcpu) · 65 unmodified lines
431435 */
432436 struct kvm_memslots {
433437 u64 generation;
434− struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM];
435438 /* The mapping table from slot id to the index in memslots[]. */
436439 short id_to_index[KVM_MEM_SLOTS_NUM];
437440 atomic_t lru_slot;
438441 int used_slots;
442+ struct kvm_memory_slot memslots[];
439443 };
440444
441445 struct kvm {
@@ -493,7 +497,7 @@ struct kvm { · 51 unmodified lines
493497 #endif
494498 long tlbs_dirty;
495499 struct list_head devices;
496− bool manual_dirty_log_protect;
500+ u64 manual_dirty_log_protect;
497501 struct dentry *debugfs_dentry;
498502 struct kvm_stat_data **debugfs_stat_data;
499503 struct srcu_struct srcu;
@@ -527,6 +531,11 @@ struct kvm { · 27 unmodified lines
527531 #define vcpu_err(vcpu, fmt, ...) \
528532 kvm_err("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)
529533
534+static inline bool kvm_dirty_log_manual_protect_and_init_set(struct kvm *kvm)
535+{
536+ return !!(kvm->manual_dirty_log_protect & KVM_DIRTY_LOG_INITIALLY_SET);
537+}
538+
530539 static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx)
531540 {
532541 return srcu_dereference_check(kvm->buses[idx], &kvm->srcu,
@@ -572,10 +581,11 @@ static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu) · 39 unmodified lines
572581 return vcpu->vcpu_idx;
573582 }
574583
575−#define kvm_for_each_memslot(memslot, slots) \
576− for (memslot = &slots->memslots[0]; \
577− memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\
578− memslot++)
584+#define kvm_for_each_memslot(memslot, slots) \
585+ for (memslot = &slots->memslots[0]; \
586+ memslot < slots->memslots + slots->used_slots; memslot++) \
587+ if (WARN_ON_ONCE(!memslot->npages)) { \
588+ } else
579589
580590 void kvm_vcpu_destroy(struct kvm_vcpu *vcpu);
581591
@@ -635,12 +645,15 @@ static inline struct kvm_memslots *kvm_vcpu_memslots(struct kvm_vcpu *vcpu) · 53 unmodified lines
635645 return __kvm_memslots(vcpu->kvm, as_id);
636646 }
637647
638−static inline struct kvm_memory_slot *
639−id_to_memslot(struct kvm_memslots *slots, int id)
648+static inline
649+struct kvm_memory_slot *id_to_memslot(struct kvm_memslots *slots, int id)
640650 {
641651 int index = slots->id_to_index[id];
642652 struct kvm_memory_slot *slot;
643653
654+ if (index < 0)
655+ return NULL;
656+
644657 slot = &slots->memslots[index];
645658
646659 WARN_ON(slot->id != id);
@@ -669,10 +682,7 @@ int kvm_set_memory_region(struct kvm *kvm, · 22 unmodified lines
669682 const struct kvm_userspace_memory_region *mem);
670683 int __kvm_set_memory_region(struct kvm *kvm,
671684 const struct kvm_userspace_memory_region *mem);
672−void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
673− struct kvm_memory_slot *dont);
674−int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
675− unsigned long npages);
685+void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot);
676686 void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen);
677687 int kvm_arch_prepare_memory_region(struct kvm *kvm,
678688 struct kvm_memory_slot *memslot,
@@ -680,11 +690,9 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, · 1 unmodified line
680690 enum kvm_mr_change change);
681691 void kvm_arch_commit_memory_region(struct kvm *kvm,
682692 const struct kvm_userspace_memory_region *mem,
683− const struct kvm_memory_slot *old,
693+ struct kvm_memory_slot *old,
684694 const struct kvm_memory_slot *new,
685695 enum kvm_mr_change change);
686−bool kvm_largepages_enabled(void);
687−void kvm_disable_largepages(void);
688696 /* flush all memory translations */
689697 void kvm_arch_flush_shadow_all(struct kvm *kvm);
690698 /* flush memory translations pointing to 'slot' */
@@ -704,7 +712,6 @@ void kvm_release_page_clean(struct page *page); · 13 unmodified lines
704712 void kvm_release_page_dirty(struct page *page);
705713 void kvm_set_page_accessed(struct page *page);
706714
707−kvm_pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn);
708715 kvm_pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
709716 kvm_pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault,
710717 bool *writable);
@@ -819,23 +826,20 @@ vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf); · 108 unmodified lines
819826
820827 int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
821828
822−int kvm_get_dirty_log(struct kvm *kvm,
823− struct kvm_dirty_log *log, int *is_dirty);
824−
825−int kvm_get_dirty_log_protect(struct kvm *kvm,
826− struct kvm_dirty_log *log, bool *flush);
827−int kvm_clear_dirty_log_protect(struct kvm *kvm,
828− struct kvm_clear_dirty_log *log, bool *flush);
829−
830829 void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,
831830 struct kvm_memory_slot *slot,
832831 gfn_t gfn_offset,
833832 unsigned long mask);
834−
835−int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
836− struct kvm_dirty_log *log);
837−int kvm_vm_ioctl_clear_dirty_log(struct kvm *kvm,
838− struct kvm_clear_dirty_log *log);
833+void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot);
834+
835+#ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT
836+void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
837+ struct kvm_memory_slot *memslot);
838+#else /* !CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT */
839+int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log);
840+int kvm_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log,
841+ int *is_dirty, struct kvm_memory_slot **memslot);
842+#endif
839843
840844 int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
841845 bool line_status);
@@ -882,9 +886,9 @@ void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu); · 40 unmodified lines
882886
883887 int kvm_arch_hardware_enable(void);
884888 void kvm_arch_hardware_disable(void);
885−int kvm_arch_hardware_setup(void);
889+int kvm_arch_hardware_setup(void *opaque);
886890 void kvm_arch_hardware_unsetup(void);
887−int kvm_arch_check_processor_compat(void);
891+int kvm_arch_check_processor_compat(void *opaque);
888892 int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
889893 bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu);
890894 int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
@@ -1018,6 +1022,8 @@ bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args); · 127 unmodified lines
10181022 * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c.
10191023 * gfn_to_memslot() itself isn't here as an inline because that would
10201024 * bloat other code too much.
1025+ *
1026+ * IMPORTANT: Slots are sorted from highest GFN to lowest GFN!
10211027 */
10221028 static inline struct kvm_memory_slot *
10231029 search_memslots(struct kvm_memslots *slots, gfn_t gfn)
@@ -1026,6 +1032,9 @@ search_memslots(struct kvm_memslots *slots, gfn_t gfn) · 2 unmodified lines
10261032 int slot = atomic_read(&slots->lru_slot);
10271033 struct kvm_memory_slot *memslots = slots->memslots;
10281034
1035+ if (unlikely(!slots->used_slots))
1036+ return NULL;
1037+
10291038 if (gfn >= memslots[slot].base_gfn &&
10301039 gfn < memslots[slot].base_gfn + memslots[slot].npages)
10311040 return &memslots[slot];
include/linux/leds.h+1−0
@@ -25,6 +25,7 @@ struct device_node; · 24 unmodified lines
2525 * LED Core
2626 */
2727
28+/* This is obsolete/useless. We now support variable maximum brightness. */
2829 enum led_brightness {
2930 LED_OFF = 0,
3031 LED_ON = 1,
include/linux/leds_pwm.h+0−22
@@ -1,22 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
2−/*
3− * PWM LED driver data - see drivers/leds/leds-pwm.c
4− */
5−#ifndef __LINUX_LEDS_PWM_H
6−#define __LINUX_LEDS_PWM_H
7−
8−struct led_pwm {
9− const char *name;
10− const char *default_trigger;
11− unsigned pwm_id __deprecated;
12− u8 active_low;
13− unsigned max_brightness;
14− unsigned pwm_period_ns;
15−};
16−
17−struct led_pwm_platform_data {
18− int num_leds;
19− struct led_pwm *leds;
20−};
21−
22−#endif
include/linux/libata.h+116−58
@@ -57,8 +57,6 @@ · 56 unmodified lines
5757 #define VPRINTK(fmt, args...)
5858 #endif /* ATA_DEBUG */
5959
60−#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)
61−
6260 #define ata_print_version_once(dev, version) \
6361 ({ \
6462 static bool __print_once; \
@@ -176,6 +174,7 @@ enum { · 111 unmodified lines
176174 ATA_DEV_NONE = 11, /* no device */
177175
178176 /* struct ata_link flags */
177+ /* NOTE: struct ata_force_param currently stores lflags in u16 */
179178 ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */
180179 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */
181180 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */
@@ -531,12 +530,14 @@ typedef int (*ata_reset_fn_t)(struct ata_link *link, unsigned int *classes, · 349 unmodified lines
531530 unsigned long deadline);
532531 typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);
533532
534−extern struct device_attribute dev_attr_link_power_management_policy;
535533 extern struct device_attribute dev_attr_unload_heads;
534+#ifdef CONFIG_SATA_HOST
535+extern struct device_attribute dev_attr_link_power_management_policy;
536536 extern struct device_attribute dev_attr_ncq_prio_enable;
537537 extern struct device_attribute dev_attr_em_message_type;
538538 extern struct device_attribute dev_attr_em_message;
539539 extern struct device_attribute dev_attr_sw_activity;
540+#endif
540541
541542 enum sw_activity {
542543 OFF,
@@ -1020,10 +1021,6 @@ struct ata_timing { · 477 unmodified lines
10201021 /*
10211022 * Core layer - drivers/ata/libata-core.c
10221023 */
1023−extern const unsigned long sata_deb_timing_normal[];
1024−extern const unsigned long sata_deb_timing_hotplug[];
1025−extern const unsigned long sata_deb_timing_long[];
1026−
10271024 extern struct ata_port_operations ata_dummy_port_ops;
10281025 extern const struct ata_port_info ata_dummy_port_info;
10291026
@@ -1061,33 +1058,14 @@ static inline int is_multi_taskfile(struct ata_taskfile *tf) · 31 unmodified lines
10611058 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
10621059 }
10631060
1064−static inline const unsigned long *
1065−sata_ehc_deb_timing(struct ata_eh_context *ehc)
1066−{
1067− if (ehc->i.flags & ATA_EHI_HOTPLUGGED)
1068− return sata_deb_timing_hotplug;
1069− else
1070− return sata_deb_timing_normal;
1071−}
1072−
10731061 static inline int ata_port_is_dummy(struct ata_port *ap)
10741062 {
10751063 return ap->ops == &ata_dummy_port_ops;
10761064 }
10771065
1078−extern int sata_set_spd(struct ata_link *link);
10791066 extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
10801067 extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
10811068 int (*check_ready)(struct ata_link *link));
1082−extern int sata_link_debounce(struct ata_link *link,
1083− const unsigned long *params, unsigned long deadline);
1084−extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
1085− unsigned long deadline);
1086−extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
1087− bool spm_wakeup);
1088−extern int sata_link_hardreset(struct ata_link *link,
1089− const unsigned long *timing, unsigned long deadline,
1090− bool *online, int (*check_ready)(struct ata_link *));
10911069 extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
10921070 unsigned long deadline);
10931071 extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
@@ -1095,7 +1073,6 @@ extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); · 1 unmodified line
10951073 extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
10961074 extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
10971075 const struct ata_port_info * const * ppi, int n_ports);
1098−extern int ata_slave_link_init(struct ata_port *ap);
10991076 extern void ata_host_get(struct ata_host *host);
11001077 extern void ata_host_put(struct ata_host *host);
11011078 extern int ata_host_start(struct ata_host *host);
@@ -1117,22 +1094,6 @@ extern int ata_scsi_ioctl(struct scsi_device *dev, unsigned int cmd, · 15 unmodified lines
11171094 extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd);
11181095 extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
11191096 unsigned int cmd, void __user *arg);
1120−extern void ata_sas_port_destroy(struct ata_port *);
1121−extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
1122− struct ata_port_info *, struct Scsi_Host *);
1123−extern void ata_sas_async_probe(struct ata_port *ap);
1124−extern int ata_sas_sync_probe(struct ata_port *ap);
1125−extern int ata_sas_port_init(struct ata_port *);
1126−extern int ata_sas_port_start(struct ata_port *ap);
1127−extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap);
1128−extern void ata_sas_tport_delete(struct ata_port *ap);
1129−extern void ata_sas_port_stop(struct ata_port *ap);
1130−extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
1131−extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap);
1132−extern int sata_scr_valid(struct ata_link *link);
1133−extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
1134−extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
1135−extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
11361097 extern bool ata_link_online(struct ata_link *link);
11371098 extern bool ata_link_offline(struct ata_link *link);
11381099 #ifdef CONFIG_PM
@@ -1153,9 +1114,6 @@ extern void ata_msleep(struct ata_port *ap, unsigned int msecs); · 14 unmodified lines
11531114 extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask,
11541115 u32 val, unsigned long interval, unsigned long timeout);
11551116 extern int atapi_cmd_type(u8 opcode);
1156−extern void ata_tf_to_fis(const struct ata_taskfile *tf,
1157− u8 pmp, int is_cmd, u8 *fis);
1158−extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
11591117 extern unsigned long ata_pack_xfermask(unsigned long pio_mask,
11601118 unsigned long mwdma_mask, unsigned long udma_mask);
11611119 extern void ata_unpack_xfermask(unsigned long xfer_mask,
@@ -1179,7 +1137,6 @@ extern void ata_id_c_string(const u16 *id, unsigned char *s, · 17 unmodified lines
11791137 extern unsigned int ata_do_dev_read_id(struct ata_device *dev,
11801138 struct ata_taskfile *tf, u16 *id);
11811139 extern void ata_qc_complete(struct ata_queued_cmd *qc);
1182−extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active);
11831140 extern u64 ata_qc_get_active(struct ata_port *ap);
11841141 extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd);
11851142 extern int ata_std_bios_param(struct scsi_device *sdev,
@@ -1196,7 +1153,96 @@ extern struct ata_device *ata_dev_pair(struct ata_device *adev); · 10 unmodified lines
11961153 extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
11971154 extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap);
11981155 extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q);
1156+
1157+/*
1158+ * SATA specific code - drivers/ata/libata-sata.c
1159+ */
1160+#ifdef CONFIG_SATA_HOST
1161+extern const unsigned long sata_deb_timing_normal[];
1162+extern const unsigned long sata_deb_timing_hotplug[];
1163+extern const unsigned long sata_deb_timing_long[];
1164+
1165+static inline const unsigned long *
1166+sata_ehc_deb_timing(struct ata_eh_context *ehc)
1167+{
1168+ if (ehc->i.flags & ATA_EHI_HOTPLUGGED)
1169+ return sata_deb_timing_hotplug;
1170+ else
1171+ return sata_deb_timing_normal;
1172+}
1173+
1174+extern int sata_scr_valid(struct ata_link *link);
1175+extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
1176+extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
1177+extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
1178+extern int sata_set_spd(struct ata_link *link);
1179+extern int sata_link_hardreset(struct ata_link *link,
1180+ const unsigned long *timing, unsigned long deadline,
1181+ bool *online, int (*check_ready)(struct ata_link *));
1182+extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
1183+ unsigned long deadline);
1184+extern void ata_eh_analyze_ncq_error(struct ata_link *link);
1185+#else
1186+static inline const unsigned long *
1187+sata_ehc_deb_timing(struct ata_eh_context *ehc)
1188+{
1189+ return NULL;
1190+}
1191+static inline int sata_scr_valid(struct ata_link *link) { return 0; }
1192+static inline int sata_scr_read(struct ata_link *link, int reg, u32 *val)
1193+{
1194+ return -EOPNOTSUPP;
1195+}
1196+static inline int sata_scr_write(struct ata_link *link, int reg, u32 val)
1197+{
1198+ return -EOPNOTSUPP;
1199+}
1200+static inline int sata_scr_write_flush(struct ata_link *link, int reg, u32 val)
1201+{
1202+ return -EOPNOTSUPP;
1203+}
1204+static inline int sata_set_spd(struct ata_link *link) { return -EOPNOTSUPP; }
1205+static inline int sata_link_hardreset(struct ata_link *link,
1206+ const unsigned long *timing,
1207+ unsigned long deadline,
1208+ bool *online,
1209+ int (*check_ready)(struct ata_link *))
1210+{
1211+ if (online)
1212+ *online = false;
1213+ return -EOPNOTSUPP;
1214+}
1215+static inline int sata_link_resume(struct ata_link *link,
1216+ const unsigned long *params,
1217+ unsigned long deadline)
1218+{
1219+ return -EOPNOTSUPP;
1220+}
1221+static inline void ata_eh_analyze_ncq_error(struct ata_link *link) { }
1222+#endif
1223+extern int sata_link_debounce(struct ata_link *link,
1224+ const unsigned long *params, unsigned long deadline);
1225+extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
1226+ bool spm_wakeup);
1227+extern int ata_slave_link_init(struct ata_port *ap);
1228+extern void ata_sas_port_destroy(struct ata_port *);
1229+extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
1230+ struct ata_port_info *, struct Scsi_Host *);
1231+extern void ata_sas_async_probe(struct ata_port *ap);
1232+extern int ata_sas_sync_probe(struct ata_port *ap);
1233+extern int ata_sas_port_init(struct ata_port *);
1234+extern int ata_sas_port_start(struct ata_port *ap);
1235+extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap);
1236+extern void ata_sas_tport_delete(struct ata_port *ap);
1237+extern void ata_sas_port_stop(struct ata_port *ap);
1238+extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
1239+extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap);
1240+extern void ata_tf_to_fis(const struct ata_taskfile *tf,
1241+ u8 pmp, int is_cmd, u8 *fis);
1242+extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
1243+extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active);
11991244 extern bool sata_lpm_ignore_phy_events(struct ata_link *link);
1245+extern int sata_async_notification(struct ata_port *ap);
12001246
12011247 extern int ata_cable_40wire(struct ata_port *ap);
12021248 extern int ata_cable_80wire(struct ata_port *ap);
@@ -1206,12 +1252,6 @@ extern int ata_cable_unknown(struct ata_port *ap); · 3 unmodified lines
12061252
12071253 /* Timing helpers */
12081254 extern unsigned int ata_pio_need_iordy(const struct ata_device *);
1209−extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
1210−extern int ata_timing_compute(struct ata_device *, unsigned short,
1211− struct ata_timing *, int, int);
1212−extern void ata_timing_merge(const struct ata_timing *,
1213− const struct ata_timing *, struct ata_timing *,
1214− unsigned int);
12151255 extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle);
12161256
12171257 /* PCI */
@@ -1295,14 +1335,12 @@ extern void ata_port_wait_eh(struct ata_port *ap); · 77 unmodified lines
12951335 extern int ata_link_abort(struct ata_link *link);
12961336 extern int ata_port_abort(struct ata_port *ap);
12971337 extern int ata_port_freeze(struct ata_port *ap);
1298−extern int sata_async_notification(struct ata_port *ap);
12991338
13001339 extern void ata_eh_freeze_port(struct ata_port *ap);
13011340 extern void ata_eh_thaw_port(struct ata_port *ap);
13021341
13031342 extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
13041343 extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
1305−extern void ata_eh_analyze_ncq_error(struct ata_link *link);
13061344
13071345 extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
13081346 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
@@ -1343,7 +1381,7 @@ extern struct device_attribute *ata_common_sdev_attrs[]; · 34 unmodified lines
13431381 * edge driver's module reference, otherwise the driver can be unloaded
13441382 * even if the scsi_device is being accessed.
13451383 */
1346−#define ATA_BASE_SHT(drv_name) \
1384+#define __ATA_BASE_SHT(drv_name) \
13471385 .module = THIS_MODULE, \
13481386 .name = drv_name, \
13491387 .ioctl = ata_scsi_ioctl, \
@@ -1357,12 +1395,20 @@ extern struct device_attribute *ata_common_sdev_attrs[]; · 7 unmodified lines
13571395 .slave_configure = ata_scsi_slave_config, \
13581396 .slave_destroy = ata_scsi_slave_destroy, \
13591397 .bios_param = ata_std_bios_param, \
1360− .unlock_native_capacity = ata_scsi_unlock_native_capacity, \
1398+ .unlock_native_capacity = ata_scsi_unlock_native_capacity
1399+
1400+#define ATA_BASE_SHT(drv_name) \
1401+ __ATA_BASE_SHT(drv_name), \
13611402 .sdev_attrs = ata_common_sdev_attrs
13621403
1404+#ifdef CONFIG_SATA_HOST
1405+extern struct device_attribute *ata_ncq_sdev_attrs[];
1406+
13631407 #define ATA_NCQ_SHT(drv_name) \
1364− ATA_BASE_SHT(drv_name), \
1408+ __ATA_BASE_SHT(drv_name), \
1409+ .sdev_attrs = ata_ncq_sdev_attrs, \
13651410 .change_queue_depth = ata_scsi_change_queue_depth
1411+#endif
13661412
13671413 /*
13681414 * PMP helpers
@@ -1635,6 +1681,8 @@ extern struct ata_device *ata_dev_next(struct ata_device *dev, · 266 unmodified lines
16351681 */
16361682 static inline int ata_ncq_enabled(struct ata_device *dev)
16371683 {
1684+ if (!IS_ENABLED(CONFIG_SATA_HOST))
1685+ return 0;
16381686 return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF |
16391687 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
16401688 }
@@ -1803,6 +1851,16 @@ static inline int ata_dma_enabled(struct ata_device *adev) · 162 unmodified lines
18031851 return (adev->dma_mode == 0xFF ? 0 : 1);
18041852 }
18051853
1854+/**************************************************************************
1855+ * PATA timings - drivers/ata/libata-pata-timings.c
1856+ */
1857+extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
1858+extern int ata_timing_compute(struct ata_device *, unsigned short,
1859+ struct ata_timing *, int, int);
1860+extern void ata_timing_merge(const struct ata_timing *,
1861+ const struct ata_timing *, struct ata_timing *,
1862+ unsigned int);
1863+
18061864 /**************************************************************************
18071865 * PMP - drivers/ata/libata-pmp.c
18081866 */
include/linux/libnvdimm.h+2−0
@@ -37,6 +37,8 @@ enum { · 36 unmodified lines
3737 NDD_WORK_PENDING = 4,
3838 /* ignore / filter NSLABEL_FLAG_LOCAL for this DIMM, i.e. no aliasing */
3939 NDD_NOBLK = 5,
40+ /* dimm supports namespace labels */
41+ NDD_LABELING = 6,
4042
4143 /* need to set a limit somewhere, but yes, this is likely overkill */
4244 ND_IOCTL_MAX_BUFLEN = SZ_4M,
include/linux/limits.h+2−12
@@ -4,19 +4,8 @@ · 3 unmodified lines
44
55 #include <uapi/linux/limits.h>
66 #include <linux/types.h>
7+#include <vdso/limits.h>
78
8−#define USHRT_MAX ((unsigned short)~0U)
9−#define SHRT_MAX ((short)(USHRT_MAX >> 1))
10−#define SHRT_MIN ((short)(-SHRT_MAX - 1))
11−#define INT_MAX ((int)(~0U >> 1))
12−#define INT_MIN (-INT_MAX - 1)
13−#define UINT_MAX (~0U)
14−#define LONG_MAX ((long)(~0UL >> 1))
15−#define LONG_MIN (-LONG_MAX - 1)
16−#define ULONG_MAX (~0UL)
17−#define LLONG_MAX ((long long)(~0ULL >> 1))
18−#define LLONG_MIN (-LLONG_MAX - 1)
19−#define ULLONG_MAX (~0ULL)
209 #define SIZE_MAX (~(size_t)0)
2110 #define PHYS_ADDR_MAX (~(phys_addr_t)0)
2211
@@ -27,6 +16,7 @@ · 4 unmodified lines
2716 #define S16_MAX ((s16)(U16_MAX >> 1))
2817 #define S16_MIN ((s16)(-S16_MAX - 1))
2918 #define U32_MAX ((u32)~0U)
19+#define U32_MIN ((u32)0)
3020 #define S32_MAX ((s32)(U32_MAX >> 1))
3121 #define S32_MIN ((s32)(-S32_MAX - 1))
3222 #define U64_MAX ((u64)~0ULL)
include/linux/linkmode.h+7−1
@@ -71,7 +71,7 @@ static inline void linkmode_change_bit(int nr, volatile unsigned long *addr) · 70 unmodified lines
7171 __change_bit(nr, addr);
7272 }
7373
74−static inline int linkmode_test_bit(int nr, volatile unsigned long *addr)
74+static inline int linkmode_test_bit(int nr, const volatile unsigned long *addr)
7575 {
7676 return test_bit(nr, addr);
7777 }
@@ -88,4 +88,10 @@ static inline int linkmode_subset(const unsigned long *src1, · 10 unmodified lines
8888 return bitmap_subset(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);
8989 }
9090
91+void linkmode_resolve_pause(const unsigned long *local_adv,
92+ const unsigned long *partner_adv,
93+ bool *tx_pause, bool *rx_pause);
94+
95+void linkmode_set_pause(unsigned long *advertisement, bool tx, bool rx);
96+
9197 #endif /* __LINKMODE_H */
include/linux/list.h+1−1
@@ -989,7 +989,7 @@ static inline void hlist_move_list(struct hlist_head *old, · 988 unmodified lines
989989 /**
990990 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
991991 * @pos: the type * to use as a loop cursor.
992− * @n: another &struct hlist_node to use as temporary storage
992+ * @n: a &struct hlist_node to use as temporary storage
993993 * @head: the head for your list.
994994 * @member: the name of the hlist_node within the struct.
995995 */
include/linux/lockdep.h+75−11
@@ -21,6 +21,22 @@ extern int lock_stat; · 20 unmodified lines
2121
2222 #include <linux/types.h>
2323
24+enum lockdep_wait_type {
25+ LD_WAIT_INV = 0, /* not checked, catch all */
26+
27+ LD_WAIT_FREE, /* wait free, rcu etc.. */
28+ LD_WAIT_SPIN, /* spin loops, raw_spinlock_t etc.. */
29+
30+#ifdef CONFIG_PROVE_RAW_LOCK_NESTING
31+ LD_WAIT_CONFIG, /* CONFIG_PREEMPT_LOCK, spinlock_t etc.. */
32+#else
33+ LD_WAIT_CONFIG = LD_WAIT_SPIN,
34+#endif
35+ LD_WAIT_SLEEP, /* sleeping locks, mutex_t etc.. */
36+
37+ LD_WAIT_MAX, /* must be last */
38+};
39+
2440 #ifdef CONFIG_LOCKDEP
2541
2642 #include <linux/linkage.h>
@@ -111,6 +127,9 @@ struct lock_class { · 84 unmodified lines
111127 int name_version;
112128 const char *name;
113129
130+ short wait_type_inner;
131+ short wait_type_outer;
132+
114133 #ifdef CONFIG_LOCK_STAT
115134 unsigned long contention_point[LOCKSTAT_POINTS];
116135 unsigned long contending_point[LOCKSTAT_POINTS];
@@ -158,6 +177,8 @@ struct lockdep_map { · 41 unmodified lines
158177 struct lock_class_key *key;
159178 struct lock_class *class_cache[NR_LOCKDEP_CACHING_CLASSES];
160179 const char *name;
180+ short wait_type_outer; /* can be taken in this context */
181+ short wait_type_inner; /* presents this context */
161182 #ifdef CONFIG_LOCK_STAT
162183 int cpu;
163184 unsigned long ip;
@@ -299,8 +320,21 @@ extern void lockdep_unregister_key(struct lock_class_key *key); · 135 unmodified lines
299320 * to lockdep:
300321 */
301322
302−extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
303− struct lock_class_key *key, int subclass);
323+extern void lockdep_init_map_waits(struct lockdep_map *lock, const char *name,
324+ struct lock_class_key *key, int subclass, short inner, short outer);
325+
326+static inline void
327+lockdep_init_map_wait(struct lockdep_map *lock, const char *name,
328+ struct lock_class_key *key, int subclass, short inner)
329+{
330+ lockdep_init_map_waits(lock, name, key, subclass, inner, LD_WAIT_INV);
331+}
332+
333+static inline void lockdep_init_map(struct lockdep_map *lock, const char *name,
334+ struct lock_class_key *key, int subclass)
335+{
336+ lockdep_init_map_wait(lock, name, key, subclass, LD_WAIT_INV);
337+}
304338
305339 /*
306340 * Reinitialize a lock key - for cases where there is special locking or
@@ -308,18 +342,29 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, · 1 unmodified line
308342 * of dependencies wrong: they are either too broad (they need a class-split)
309343 * or they are too narrow (they suffer from a false class-split):
310344 */
311−#define lockdep_set_class(lock, key) \
312− lockdep_init_map(&(lock)->dep_map, #key, key, 0)
313−#define lockdep_set_class_and_name(lock, key, name) \
314− lockdep_init_map(&(lock)->dep_map, name, key, 0)
315−#define lockdep_set_class_and_subclass(lock, key, sub) \
316− lockdep_init_map(&(lock)->dep_map, #key, key, sub)
317−#define lockdep_set_subclass(lock, sub) \
318− lockdep_init_map(&(lock)->dep_map, #lock, \
319− (lock)->dep_map.key, sub)
345+#define lockdep_set_class(lock, key) \
346+ lockdep_init_map_waits(&(lock)->dep_map, #key, key, 0, \
347+ (lock)->dep_map.wait_type_inner, \
348+ (lock)->dep_map.wait_type_outer)
349+
350+#define lockdep_set_class_and_name(lock, key, name) \
351+ lockdep_init_map_waits(&(lock)->dep_map, name, key, 0, \
352+ (lock)->dep_map.wait_type_inner, \
353+ (lock)->dep_map.wait_type_outer)
354+
355+#define lockdep_set_class_and_subclass(lock, key, sub) \
356+ lockdep_init_map_waits(&(lock)->dep_map, #key, key, sub,\
357+ (lock)->dep_map.wait_type_inner, \
358+ (lock)->dep_map.wait_type_outer)
359+
360+#define lockdep_set_subclass(lock, sub) \
361+ lockdep_init_map_waits(&(lock)->dep_map, #lock, (lock)->dep_map.key, sub,\
362+ (lock)->dep_map.wait_type_inner, \
363+ (lock)->dep_map.wait_type_outer)
320364
321365 #define lockdep_set_novalidate_class(lock) \
322366 lockdep_set_class_and_name(lock, &__lockdep_no_validate__, #lock)
367+
323368 /*
324369 * Compare locking classes
325370 */
@@ -432,6 +477,10 @@ static inline void lockdep_set_selftest_task(struct task_struct *task) · 106 unmodified lines
432477 # define lock_set_class(l, n, k, s, i) do { } while (0)
433478 # define lock_set_subclass(l, s, i) do { } while (0)
434479 # define lockdep_init() do { } while (0)
480+# define lockdep_init_map_waits(lock, name, key, sub, inner, outer) \
481+ do { (void)(name); (void)(key); } while (0)
482+# define lockdep_init_map_wait(lock, name, key, sub, inner) \
483+ do { (void)(name); (void)(key); } while (0)
435484 # define lockdep_init_map(lock, name, key, sub) \
436485 do { (void)(name); (void)(key); } while (0)
437486 # define lockdep_set_class(lock, key) do { (void)(key); } while (0)
@@ -662,6 +711,21 @@ do { \ · 224 unmodified lines
662711 # define lockdep_assert_in_irq() do { } while (0)
663712 #endif
664713
714+#ifdef CONFIG_PROVE_RAW_LOCK_NESTING
715+
716+# define lockdep_assert_RT_in_threaded_ctx() do { \
717+ WARN_ONCE(debug_locks && !current->lockdep_recursion && \
718+ current->hardirq_context && \
719+ !(current->hardirq_threaded || current->irq_config), \
720+ "Not in threaded context on PREEMPT_RT as expected\n"); \
721+} while (0)
722+
723+#else
724+
725+# define lockdep_assert_RT_in_threaded_ctx() do { } while (0)
726+
727+#endif
728+
665729 #ifdef CONFIG_LOCKDEP
666730 void lockdep_rcu_suspicious(const char *file, const int line, const char *s);
667731 #else
include/linux/lsm_hook_defs.h+381−0
@@ -0,0 +1,381 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+
3+/*
4+ * Linux Security Module Hook declarations.
5+ *
6+ * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com>
7+ * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com>
8+ * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com>
9+ * Copyright (C) 2001 James Morris <jmorris@intercode.com.au>
10+ * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group)
11+ * Copyright (C) 2015 Intel Corporation.
12+ * Copyright (C) 2015 Casey Schaufler <casey@schaufler-ca.com>
13+ * Copyright (C) 2016 Mellanox Techonologies
14+ * Copyright (C) 2020 Google LLC.
15+ */
16+
17+/*
18+ * The macro LSM_HOOK is used to define the data structures required by the
19+ * the LSM framework using the pattern:
20+ *
21+ * LSM_HOOK(<return_type>, <default_value>, <hook_name>, args...)
22+ *
23+ * struct security_hook_heads {
24+ * #define LSM_HOOK(RET, DEFAULT, NAME, ...) struct hlist_head NAME;
25+ * #include <linux/lsm_hook_defs.h>
26+ * #undef LSM_HOOK
27+ * };
28+ */
29+LSM_HOOK(int, 0, binder_set_context_mgr, struct task_struct *mgr)
30+LSM_HOOK(int, 0, binder_transaction, struct task_struct *from,
31+ struct task_struct *to)
32+LSM_HOOK(int, 0, binder_transfer_binder, struct task_struct *from,
33+ struct task_struct *to)
34+LSM_HOOK(int, 0, binder_transfer_file, struct task_struct *from,
35+ struct task_struct *to, struct file *file)
36+LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child,
37+ unsigned int mode)
38+LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent)
39+LSM_HOOK(int, 0, capget, struct task_struct *target, kernel_cap_t *effective,
40+ kernel_cap_t *inheritable, kernel_cap_t *permitted)
41+LSM_HOOK(int, 0, capset, struct cred *new, const struct cred *old,
42+ const kernel_cap_t *effective, const kernel_cap_t *inheritable,
43+ const kernel_cap_t *permitted)
44+LSM_HOOK(int, 0, capable, const struct cred *cred, struct user_namespace *ns,
45+ int cap, unsigned int opts)
46+LSM_HOOK(int, 0, quotactl, int cmds, int type, int id, struct super_block *sb)
47+LSM_HOOK(int, 0, quota_on, struct dentry *dentry)
48+LSM_HOOK(int, 0, syslog, int type)
49+LSM_HOOK(int, 0, settime, const struct timespec64 *ts,
50+ const struct timezone *tz)
51+LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages)
52+LSM_HOOK(int, 0, bprm_set_creds, struct linux_binprm *bprm)
53+LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm)
54+LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm)
55+LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm)
56+LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc,
57+ struct fs_context *src_sc)
58+LSM_HOOK(int, 0, fs_context_parse_param, struct fs_context *fc,
59+ struct fs_parameter *param)
60+LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb)
61+LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb)
62+LSM_HOOK(void, LSM_RET_VOID, sb_free_mnt_opts, void *mnt_opts)
63+LSM_HOOK(int, 0, sb_eat_lsm_opts, char *orig, void **mnt_opts)
64+LSM_HOOK(int, 0, sb_remount, struct super_block *sb, void *mnt_opts)
65+LSM_HOOK(int, 0, sb_kern_mount, struct super_block *sb)
66+LSM_HOOK(int, 0, sb_show_options, struct seq_file *m, struct super_block *sb)
67+LSM_HOOK(int, 0, sb_statfs, struct dentry *dentry)
68+LSM_HOOK(int, 0, sb_mount, const char *dev_name, const struct path *path,
69+ const char *type, unsigned long flags, void *data)
70+LSM_HOOK(int, 0, sb_umount, struct vfsmount *mnt, int flags)
71+LSM_HOOK(int, 0, sb_pivotroot, const struct path *old_path,
72+ const struct path *new_path)
73+LSM_HOOK(int, 0, sb_set_mnt_opts, struct super_block *sb, void *mnt_opts,
74+ unsigned long kern_flags, unsigned long *set_kern_flags)
75+LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb,
76+ struct super_block *newsb, unsigned long kern_flags,
77+ unsigned long *set_kern_flags)
78+LSM_HOOK(int, 0, sb_add_mnt_opt, const char *option, const char *val,
79+ int len, void **mnt_opts)
80+LSM_HOOK(int, 0, move_mount, const struct path *from_path,
81+ const struct path *to_path)
82+LSM_HOOK(int, 0, dentry_init_security, struct dentry *dentry,
83+ int mode, const struct qstr *name, void **ctx, u32 *ctxlen)
84+LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode,
85+ struct qstr *name, const struct cred *old, struct cred *new)
86+
87+#ifdef CONFIG_SECURITY_PATH
88+LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry)
89+LSM_HOOK(int, 0, path_mkdir, const struct path *dir, struct dentry *dentry,
90+ umode_t mode)
91+LSM_HOOK(int, 0, path_rmdir, const struct path *dir, struct dentry *dentry)
92+LSM_HOOK(int, 0, path_mknod, const struct path *dir, struct dentry *dentry,
93+ umode_t mode, unsigned int dev)
94+LSM_HOOK(int, 0, path_truncate, const struct path *path)
95+LSM_HOOK(int, 0, path_symlink, const struct path *dir, struct dentry *dentry,
96+ const char *old_name)
97+LSM_HOOK(int, 0, path_link, struct dentry *old_dentry,
98+ const struct path *new_dir, struct dentry *new_dentry)
99+LSM_HOOK(int, 0, path_rename, const struct path *old_dir,
100+ struct dentry *old_dentry, const struct path *new_dir,
101+ struct dentry *new_dentry)
102+LSM_HOOK(int, 0, path_chmod, const struct path *path, umode_t mode)
103+LSM_HOOK(int, 0, path_chown, const struct path *path, kuid_t uid, kgid_t gid)
104+LSM_HOOK(int, 0, path_chroot, const struct path *path)
105+#endif /* CONFIG_SECURITY_PATH */
106+
107+/* Needed for inode based security check */
108+LSM_HOOK(int, 0, path_notify, const struct path *path, u64 mask,
109+ unsigned int obj_type)
110+LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode)
111+LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode)
112+LSM_HOOK(int, 0, inode_init_security, struct inode *inode,
113+ struct inode *dir, const struct qstr *qstr, const char **name,
114+ void **value, size_t *len)
115+LSM_HOOK(int, 0, inode_create, struct inode *dir, struct dentry *dentry,
116+ umode_t mode)
117+LSM_HOOK(int, 0, inode_link, struct dentry *old_dentry, struct inode *dir,
118+ struct dentry *new_dentry)
119+LSM_HOOK(int, 0, inode_unlink, struct inode *dir, struct dentry *dentry)
120+LSM_HOOK(int, 0, inode_symlink, struct inode *dir, struct dentry *dentry,
121+ const char *old_name)
122+LSM_HOOK(int, 0, inode_mkdir, struct inode *dir, struct dentry *dentry,
123+ umode_t mode)
124+LSM_HOOK(int, 0, inode_rmdir, struct inode *dir, struct dentry *dentry)
125+LSM_HOOK(int, 0, inode_mknod, struct inode *dir, struct dentry *dentry,
126+ umode_t mode, dev_t dev)
127+LSM_HOOK(int, 0, inode_rename, struct inode *old_dir, struct dentry *old_dentry,
128+ struct inode *new_dir, struct dentry *new_dentry)
129+LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry)
130+LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode,
131+ bool rcu)
132+LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask)
133+LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr)
134+LSM_HOOK(int, 0, inode_getattr, const struct path *path)
135+LSM_HOOK(int, 0, inode_setxattr, struct dentry *dentry, const char *name,
136+ const void *value, size_t size, int flags)
137+LSM_HOOK(void, LSM_RET_VOID, inode_post_setxattr, struct dentry *dentry,
138+ const char *name, const void *value, size_t size, int flags)
139+LSM_HOOK(int, 0, inode_getxattr, struct dentry *dentry, const char *name)
140+LSM_HOOK(int, 0, inode_listxattr, struct dentry *dentry)
141+LSM_HOOK(int, 0, inode_removexattr, struct dentry *dentry, const char *name)
142+LSM_HOOK(int, 0, inode_need_killpriv, struct dentry *dentry)
143+LSM_HOOK(int, 0, inode_killpriv, struct dentry *dentry)
144+LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct inode *inode,
145+ const char *name, void **buffer, bool alloc)
146+LSM_HOOK(int, -EOPNOTSUPP, inode_setsecurity, struct inode *inode,
147+ const char *name, const void *value, size_t size, int flags)
148+LSM_HOOK(int, 0, inode_listsecurity, struct inode *inode, char *buffer,
149+ size_t buffer_size)
150+LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid)
151+LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new)
152+LSM_HOOK(int, 0, inode_copy_up_xattr, const char *name)
153+LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir,
154+ struct kernfs_node *kn)
155+LSM_HOOK(int, 0, file_permission, struct file *file, int mask)
156+LSM_HOOK(int, 0, file_alloc_security, struct file *file)
157+LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file)
158+LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd,
159+ unsigned long arg)
160+LSM_HOOK(int, 0, mmap_addr, unsigned long addr)
161+LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot,
162+ unsigned long prot, unsigned long flags)
163+LSM_HOOK(int, 0, file_mprotect, struct vm_area_struct *vma,
164+ unsigned long reqprot, unsigned long prot)
165+LSM_HOOK(int, 0, file_lock, struct file *file, unsigned int cmd)
166+LSM_HOOK(int, 0, file_fcntl, struct file *file, unsigned int cmd,
167+ unsigned long arg)
168+LSM_HOOK(void, LSM_RET_VOID, file_set_fowner, struct file *file)
169+LSM_HOOK(int, 0, file_send_sigiotask, struct task_struct *tsk,
170+ struct fown_struct *fown, int sig)
171+LSM_HOOK(int, 0, file_receive, struct file *file)
172+LSM_HOOK(int, 0, file_open, struct file *file)
173+LSM_HOOK(int, 0, task_alloc, struct task_struct *task,
174+ unsigned long clone_flags)
175+LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task)
176+LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp)
177+LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred)
178+LSM_HOOK(int, 0, cred_prepare, struct cred *new, const struct cred *old,
179+ gfp_t gfp)
180+LSM_HOOK(void, LSM_RET_VOID, cred_transfer, struct cred *new,
181+ const struct cred *old)
182+LSM_HOOK(void, LSM_RET_VOID, cred_getsecid, const struct cred *c, u32 *secid)
183+LSM_HOOK(int, 0, kernel_act_as, struct cred *new, u32 secid)
184+LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode)
185+LSM_HOOK(int, 0, kernel_module_request, char *kmod_name)
186+LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id)
187+LSM_HOOK(int, 0, kernel_read_file, struct file *file,
188+ enum kernel_read_file_id id)
189+LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf,
190+ loff_t size, enum kernel_read_file_id id)
191+LSM_HOOK(int, 0, task_fix_setuid, struct cred *new, const struct cred *old,
192+ int flags)
193+LSM_HOOK(int, 0, task_setpgid, struct task_struct *p, pid_t pgid)
194+LSM_HOOK(int, 0, task_getpgid, struct task_struct *p)
195+LSM_HOOK(int, 0, task_getsid, struct task_struct *p)
196+LSM_HOOK(void, LSM_RET_VOID, task_getsecid, struct task_struct *p, u32 *secid)
197+LSM_HOOK(int, 0, task_setnice, struct task_struct *p, int nice)
198+LSM_HOOK(int, 0, task_setioprio, struct task_struct *p, int ioprio)
199+LSM_HOOK(int, 0, task_getioprio, struct task_struct *p)
200+LSM_HOOK(int, 0, task_prlimit, const struct cred *cred,
201+ const struct cred *tcred, unsigned int flags)
202+LSM_HOOK(int, 0, task_setrlimit, struct task_struct *p, unsigned int resource,
203+ struct rlimit *new_rlim)
204+LSM_HOOK(int, 0, task_setscheduler, struct task_struct *p)
205+LSM_HOOK(int, 0, task_getscheduler, struct task_struct *p)
206+LSM_HOOK(int, 0, task_movememory, struct task_struct *p)
207+LSM_HOOK(int, 0, task_kill, struct task_struct *p, struct kernel_siginfo *info,
208+ int sig, const struct cred *cred)
209+LSM_HOOK(int, -ENOSYS, task_prctl, int option, unsigned long arg2,
210+ unsigned long arg3, unsigned long arg4, unsigned long arg5)
211+LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p,
212+ struct inode *inode)
213+LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag)
214+LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp,
215+ u32 *secid)
216+LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg)
217+LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg)
218+LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm)
219+LSM_HOOK(void, LSM_RET_VOID, msg_queue_free_security,
220+ struct kern_ipc_perm *perm)
221+LSM_HOOK(int, 0, msg_queue_associate, struct kern_ipc_perm *perm, int msqflg)
222+LSM_HOOK(int, 0, msg_queue_msgctl, struct kern_ipc_perm *perm, int cmd)
223+LSM_HOOK(int, 0, msg_queue_msgsnd, struct kern_ipc_perm *perm,
224+ struct msg_msg *msg, int msqflg)
225+LSM_HOOK(int, 0, msg_queue_msgrcv, struct kern_ipc_perm *perm,
226+ struct msg_msg *msg, struct task_struct *target, long type, int mode)
227+LSM_HOOK(int, 0, shm_alloc_security, struct kern_ipc_perm *perm)
228+LSM_HOOK(void, LSM_RET_VOID, shm_free_security, struct kern_ipc_perm *perm)
229+LSM_HOOK(int, 0, shm_associate, struct kern_ipc_perm *perm, int shmflg)
230+LSM_HOOK(int, 0, shm_shmctl, struct kern_ipc_perm *perm, int cmd)
231+LSM_HOOK(int, 0, shm_shmat, struct kern_ipc_perm *perm, char __user *shmaddr,
232+ int shmflg)
233+LSM_HOOK(int, 0, sem_alloc_security, struct kern_ipc_perm *perm)
234+LSM_HOOK(void, LSM_RET_VOID, sem_free_security, struct kern_ipc_perm *perm)
235+LSM_HOOK(int, 0, sem_associate, struct kern_ipc_perm *perm, int semflg)
236+LSM_HOOK(int, 0, sem_semctl, struct kern_ipc_perm *perm, int cmd)
237+LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops,
238+ unsigned nsops, int alter)
239+LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb)
240+LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry,
241+ struct inode *inode)
242+LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, char *name,
243+ char **value)
244+LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size)
245+LSM_HOOK(int, 0, ismaclabel, const char *name)
246+LSM_HOOK(int, 0, secid_to_secctx, u32 secid, char **secdata,
247+ u32 *seclen)
248+LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid)
249+LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen)
250+LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode)
251+LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen)
252+LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen)
253+LSM_HOOK(int, 0, inode_getsecctx, struct inode *inode, void **ctx,
254+ u32 *ctxlen)
255+
256+#ifdef CONFIG_SECURITY_NETWORK
257+LSM_HOOK(int, 0, unix_stream_connect, struct sock *sock, struct sock *other,
258+ struct sock *newsk)
259+LSM_HOOK(int, 0, unix_may_send, struct socket *sock, struct socket *other)
260+LSM_HOOK(int, 0, socket_create, int family, int type, int protocol, int kern)
261+LSM_HOOK(int, 0, socket_post_create, struct socket *sock, int family, int type,
262+ int protocol, int kern)
263+LSM_HOOK(int, 0, socket_socketpair, struct socket *socka, struct socket *sockb)
264+LSM_HOOK(int, 0, socket_bind, struct socket *sock, struct sockaddr *address,
265+ int addrlen)
266+LSM_HOOK(int, 0, socket_connect, struct socket *sock, struct sockaddr *address,
267+ int addrlen)
268+LSM_HOOK(int, 0, socket_listen, struct socket *sock, int backlog)
269+LSM_HOOK(int, 0, socket_accept, struct socket *sock, struct socket *newsock)
270+LSM_HOOK(int, 0, socket_sendmsg, struct socket *sock, struct msghdr *msg,
271+ int size)
272+LSM_HOOK(int, 0, socket_recvmsg, struct socket *sock, struct msghdr *msg,
273+ int size, int flags)
274+LSM_HOOK(int, 0, socket_getsockname, struct socket *sock)
275+LSM_HOOK(int, 0, socket_getpeername, struct socket *sock)
276+LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname)
277+LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname)
278+LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how)
279+LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb)
280+LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock,
281+ char __user *optval, int __user *optlen, unsigned len)
282+LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock,
283+ struct sk_buff *skb, u32 *secid)
284+LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority)
285+LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk)
286+LSM_HOOK(void, LSM_RET_VOID, sk_clone_security, const struct sock *sk,
287+ struct sock *newsk)
288+LSM_HOOK(void, LSM_RET_VOID, sk_getsecid, struct sock *sk, u32 *secid)
289+LSM_HOOK(void, LSM_RET_VOID, sock_graft, struct sock *sk, struct socket *parent)
290+LSM_HOOK(int, 0, inet_conn_request, struct sock *sk, struct sk_buff *skb,
291+ struct request_sock *req)
292+LSM_HOOK(void, LSM_RET_VOID, inet_csk_clone, struct sock *newsk,
293+ const struct request_sock *req)
294+LSM_HOOK(void, LSM_RET_VOID, inet_conn_established, struct sock *sk,
295+ struct sk_buff *skb)
296+LSM_HOOK(int, 0, secmark_relabel_packet, u32 secid)
297+LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void)
298+LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void)
299+LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req,
300+ struct flowi *fl)
301+LSM_HOOK(int, 0, tun_dev_alloc_security, void **security)
302+LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security)
303+LSM_HOOK(int, 0, tun_dev_create, void)
304+LSM_HOOK(int, 0, tun_dev_attach_queue, void *security)
305+LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security)
306+LSM_HOOK(int, 0, tun_dev_open, void *security)
307+LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_endpoint *ep,
308+ struct sk_buff *skb)
309+LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname,
310+ struct sockaddr *address, int addrlen)
311+LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_endpoint *ep,
312+ struct sock *sk, struct sock *newsk)
313+#endif /* CONFIG_SECURITY_NETWORK */
314+
315+#ifdef CONFIG_SECURITY_INFINIBAND
316+LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey)
317+LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name,
318+ u8 port_num)
319+LSM_HOOK(int, 0, ib_alloc_security, void **sec)
320+LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec)
321+#endif /* CONFIG_SECURITY_INFINIBAND */
322+
323+#ifdef CONFIG_SECURITY_NETWORK_XFRM
324+LSM_HOOK(int, 0, xfrm_policy_alloc_security, struct xfrm_sec_ctx **ctxp,
325+ struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp)
326+LSM_HOOK(int, 0, xfrm_policy_clone_security, struct xfrm_sec_ctx *old_ctx,
327+ struct xfrm_sec_ctx **new_ctx)
328+LSM_HOOK(void, LSM_RET_VOID, xfrm_policy_free_security,
329+ struct xfrm_sec_ctx *ctx)
330+LSM_HOOK(int, 0, xfrm_policy_delete_security, struct xfrm_sec_ctx *ctx)
331+LSM_HOOK(int, 0, xfrm_state_alloc, struct xfrm_state *x,
332+ struct xfrm_user_sec_ctx *sec_ctx)
333+LSM_HOOK(int, 0, xfrm_state_alloc_acquire, struct xfrm_state *x,
334+ struct xfrm_sec_ctx *polsec, u32 secid)
335+LSM_HOOK(void, LSM_RET_VOID, xfrm_state_free_security, struct xfrm_state *x)
336+LSM_HOOK(int, 0, xfrm_state_delete_security, struct xfrm_state *x)
337+LSM_HOOK(int, 0, xfrm_policy_lookup, struct xfrm_sec_ctx *ctx, u32 fl_secid,
338+ u8 dir)
339+LSM_HOOK(int, 1, xfrm_state_pol_flow_match, struct xfrm_state *x,
340+ struct xfrm_policy *xp, const struct flowi *fl)
341+LSM_HOOK(int, 0, xfrm_decode_session, struct sk_buff *skb, u32 *secid,
342+ int ckall)
343+#endif /* CONFIG_SECURITY_NETWORK_XFRM */
344+
345+/* key management security hooks */
346+#ifdef CONFIG_KEYS
347+LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred,
348+ unsigned long flags)
349+LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key)
350+LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred,
351+ unsigned perm)
352+LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **_buffer)
353+#endif /* CONFIG_KEYS */
354+
355+#ifdef CONFIG_AUDIT
356+LSM_HOOK(int, 0, audit_rule_init, u32 field, u32 op, char *rulestr,
357+ void **lsmrule)
358+LSM_HOOK(int, 0, audit_rule_known, struct audit_krule *krule)
359+LSM_HOOK(int, 0, audit_rule_match, u32 secid, u32 field, u32 op, void *lsmrule)
360+LSM_HOOK(void, LSM_RET_VOID, audit_rule_free, void *lsmrule)
361+#endif /* CONFIG_AUDIT */
362+
363+#ifdef CONFIG_BPF_SYSCALL
364+LSM_HOOK(int, 0, bpf, int cmd, union bpf_attr *attr, unsigned int size)
365+LSM_HOOK(int, 0, bpf_map, struct bpf_map *map, fmode_t fmode)
366+LSM_HOOK(int, 0, bpf_prog, struct bpf_prog *prog)
367+LSM_HOOK(int, 0, bpf_map_alloc_security, struct bpf_map *map)
368+LSM_HOOK(void, LSM_RET_VOID, bpf_map_free_security, struct bpf_map *map)
369+LSM_HOOK(int, 0, bpf_prog_alloc_security, struct bpf_prog_aux *aux)
370+LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux)
371+#endif /* CONFIG_BPF_SYSCALL */
372+
373+LSM_HOOK(int, 0, locked_down, enum lockdown_reason what)
374+
375+#ifdef CONFIG_PERF_EVENTS
376+LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type)
377+LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event)
378+LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event)
379+LSM_HOOK(int, 0, perf_event_read, struct perf_event *event)
380+LSM_HOOK(int, 0, perf_event_write, struct perf_event *event)
381+#endif /* CONFIG_PERF_EVENTS */
include/linux/lsm_hooks.h+47−617
@@ -103,6 +103,10 @@ · 102 unmodified lines
103103 * @sb_free_security:
104104 * Deallocate and clear the sb->s_security field.
105105 * @sb contains the super_block structure to be modified.
106+ * @sb_free_mnt_opts:
107+ * Free memory associated with @mnt_ops.
108+ * @sb_eat_lsm_opts:
109+ * Eat (scan @orig options) and save them in @mnt_opts.
106110 * @sb_statfs:
107111 * Check permission before obtaining filesystem statistics for the @mnt
108112 * mountpoint.
@@ -136,6 +140,10 @@ · 27 unmodified lines
136140 * @sb superblock being remounted
137141 * @data contains the filesystem-specific data.
138142 * Return 0 if permission is granted.
143+ * @sb_kern_mount:
144+ * Mount this @sb if allowed by permissions.
145+ * @sb_show_options:
146+ * Show (print on @m) mount options for this @sb.
139147 * @sb_umount:
140148 * Check permission before the @mnt file system is unmounted.
141149 * @mnt contains the mounted file system.
@@ -155,6 +163,8 @@ · 13 unmodified lines
155163 * Copy all security options from a given superblock to another
156164 * @oldsb old superblock which contain information to clone
157165 * @newsb new superblock which needs filled in
166+ * @sb_add_mnt_opt:
167+ * Add one mount @option to @mnt_opts.
158168 * @sb_parse_opts_str:
159169 * Parse a string of security data filling in the opts structure
160170 * @options string containing all mount options known by the LSM
@@ -451,6 +461,12 @@ · 290 unmodified lines
451461 * security module does not know about attribute or a negative error code
452462 * to abort the copy up. Note that the caller is responsible for reading
453463 * and writing the xattrs as this hook is merely a filter.
464+ * @d_instantiate:
465+ * Fill in @inode security information for a @dentry if allowed.
466+ * @getprocattr:
467+ * Read attribute @name for process @p and store it into @value if allowed.
468+ * @setprocattr:
469+ * Write (set) attribute @name to @value, size @size if allowed.
454470 *
455471 * Security hooks for kernfs node operations
456472 *
@@ -1113,6 +1129,7 @@ · 656 unmodified lines
11131129 * In case of failure, @secid will be set to zero.
11141130 *
11151131 * Security hooks for individual messages held in System V IPC message queues
1132+ *
11161133 * @msg_msg_alloc_security:
11171134 * Allocate and attach a security structure to the msg->security field.
11181135 * The security field is initialized to NULL when the structure is first
@@ -1302,6 +1319,10 @@ · 183 unmodified lines
13021319 * @cap contains the capability <include/linux/capability.h>.
13031320 * @opts contains options for the capable check <include/linux/security.h>
13041321 * Return 0 if the capability is granted for @tsk.
1322+ * @quotactl:
1323+ * Check whether the quotactl syscall is allowed for this @sb.
1324+ * @quota_on:
1325+ * Check whether QUOTAON is allowed for this @dentry.
13051326 * @syslog:
13061327 * Check permission before accessing the kernel message ring or changing
13071328 * logging to the console.
@@ -1449,632 +1470,35 @@ · 141 unmodified lines
14491470 * @bpf_prog_free_security:
14501471 * Clean up the security information stored inside bpf prog.
14511472 *
1452− * @locked_down
1473+ * @locked_down:
14531474 * Determine whether a kernel feature that potentially enables arbitrary
14541475 * code execution in kernel space should be permitted.
14551476 *
14561477 * @what: kernel feature being accessed
1478+ *
1479+ * Security hooks for perf events
1480+ *
1481+ * @perf_event_open:
1482+ * Check whether the @type of perf_event_open syscall is allowed.
1483+ * @perf_event_alloc:
1484+ * Allocate and save perf_event security info.
1485+ * @perf_event_free:
1486+ * Release (free) perf_event security info.
1487+ * @perf_event_read:
1488+ * Read perf_event security info if allowed.
1489+ * @perf_event_write:
1490+ * Write perf_event security info if allowed.
14571491 */
14581492 union security_list_options {
1459− int (*binder_set_context_mgr)(struct task_struct *mgr);
1460− int (*binder_transaction)(struct task_struct *from,
1461− struct task_struct *to);
1462− int (*binder_transfer_binder)(struct task_struct *from,
1463− struct task_struct *to);
1464− int (*binder_transfer_file)(struct task_struct *from,
1465− struct task_struct *to,
1466− struct file *file);
1467−
1468− int (*ptrace_access_check)(struct task_struct *child,
1469− unsigned int mode);
1470− int (*ptrace_traceme)(struct task_struct *parent);
1471− int (*capget)(struct task_struct *target, kernel_cap_t *effective,
1472− kernel_cap_t *inheritable, kernel_cap_t *permitted);
1473− int (*capset)(struct cred *new, const struct cred *old,
1474− const kernel_cap_t *effective,
1475− const kernel_cap_t *inheritable,
1476− const kernel_cap_t *permitted);
1477− int (*capable)(const struct cred *cred,
1478− struct user_namespace *ns,
1479− int cap,
1480− unsigned int opts);
1481− int (*quotactl)(int cmds, int type, int id, struct super_block *sb);
1482− int (*quota_on)(struct dentry *dentry);
1483− int (*syslog)(int type);
1484− int (*settime)(const struct timespec64 *ts, const struct timezone *tz);
1485− int (*vm_enough_memory)(struct mm_struct *mm, long pages);
1486−
1487− int (*bprm_set_creds)(struct linux_binprm *bprm);
1488− int (*bprm_check_security)(struct linux_binprm *bprm);
1489− void (*bprm_committing_creds)(struct linux_binprm *bprm);
1490− void (*bprm_committed_creds)(struct linux_binprm *bprm);
1491−
1492− int (*fs_context_dup)(struct fs_context *fc, struct fs_context *src_sc);
1493− int (*fs_context_parse_param)(struct fs_context *fc, struct fs_parameter *param);
1494−
1495− int (*sb_alloc_security)(struct super_block *sb);
1496− void (*sb_free_security)(struct super_block *sb);
1497− void (*sb_free_mnt_opts)(void *mnt_opts);
1498− int (*sb_eat_lsm_opts)(char *orig, void **mnt_opts);
1499− int (*sb_remount)(struct super_block *sb, void *mnt_opts);
1500− int (*sb_kern_mount)(struct super_block *sb);
1501− int (*sb_show_options)(struct seq_file *m, struct super_block *sb);
1502− int (*sb_statfs)(struct dentry *dentry);
1503− int (*sb_mount)(const char *dev_name, const struct path *path,
1504− const char *type, unsigned long flags, void *data);
1505− int (*sb_umount)(struct vfsmount *mnt, int flags);
1506− int (*sb_pivotroot)(const struct path *old_path, const struct path *new_path);
1507− int (*sb_set_mnt_opts)(struct super_block *sb,
1508− void *mnt_opts,
1509− unsigned long kern_flags,
1510− unsigned long *set_kern_flags);
1511− int (*sb_clone_mnt_opts)(const struct super_block *oldsb,
1512− struct super_block *newsb,
1513− unsigned long kern_flags,
1514− unsigned long *set_kern_flags);
1515− int (*sb_add_mnt_opt)(const char *option, const char *val, int len,
1516− void **mnt_opts);
1517− int (*move_mount)(const struct path *from_path, const struct path *to_path);
1518− int (*dentry_init_security)(struct dentry *dentry, int mode,
1519− const struct qstr *name, void **ctx,
1520− u32 *ctxlen);
1521− int (*dentry_create_files_as)(struct dentry *dentry, int mode,
1522− struct qstr *name,
1523− const struct cred *old,
1524− struct cred *new);
1525−
1526−
1527−#ifdef CONFIG_SECURITY_PATH
1528− int (*path_unlink)(const struct path *dir, struct dentry *dentry);
1529− int (*path_mkdir)(const struct path *dir, struct dentry *dentry,
1530− umode_t mode);
1531− int (*path_rmdir)(const struct path *dir, struct dentry *dentry);
1532− int (*path_mknod)(const struct path *dir, struct dentry *dentry,
1533− umode_t mode, unsigned int dev);
1534− int (*path_truncate)(const struct path *path);
1535− int (*path_symlink)(const struct path *dir, struct dentry *dentry,
1536− const char *old_name);
1537− int (*path_link)(struct dentry *old_dentry, const struct path *new_dir,
1538− struct dentry *new_dentry);
1539− int (*path_rename)(const struct path *old_dir, struct dentry *old_dentry,
1540− const struct path *new_dir,
1541− struct dentry *new_dentry);
1542− int (*path_chmod)(const struct path *path, umode_t mode);
1543− int (*path_chown)(const struct path *path, kuid_t uid, kgid_t gid);
1544− int (*path_chroot)(const struct path *path);
1545−#endif
1546− /* Needed for inode based security check */
1547− int (*path_notify)(const struct path *path, u64 mask,
1548− unsigned int obj_type);
1549− int (*inode_alloc_security)(struct inode *inode);
1550− void (*inode_free_security)(struct inode *inode);
1551− int (*inode_init_security)(struct inode *inode, struct inode *dir,
1552− const struct qstr *qstr,
1553− const char **name, void **value,
1554− size_t *len);
1555− int (*inode_create)(struct inode *dir, struct dentry *dentry,
1556− umode_t mode);
1557− int (*inode_link)(struct dentry *old_dentry, struct inode *dir,
1558− struct dentry *new_dentry);
1559− int (*inode_unlink)(struct inode *dir, struct dentry *dentry);
1560− int (*inode_symlink)(struct inode *dir, struct dentry *dentry,
1561− const char *old_name);
1562− int (*inode_mkdir)(struct inode *dir, struct dentry *dentry,
1563− umode_t mode);
1564− int (*inode_rmdir)(struct inode *dir, struct dentry *dentry);
1565− int (*inode_mknod)(struct inode *dir, struct dentry *dentry,
1566− umode_t mode, dev_t dev);
1567− int (*inode_rename)(struct inode *old_dir, struct dentry *old_dentry,
1568− struct inode *new_dir,
1569− struct dentry *new_dentry);
1570− int (*inode_readlink)(struct dentry *dentry);
1571− int (*inode_follow_link)(struct dentry *dentry, struct inode *inode,
1572− bool rcu);
1573− int (*inode_permission)(struct inode *inode, int mask);
1574− int (*inode_setattr)(struct dentry *dentry, struct iattr *attr);
1575− int (*inode_getattr)(const struct path *path);
1576− int (*inode_setxattr)(struct dentry *dentry, const char *name,
1577− const void *value, size_t size, int flags);
1578− void (*inode_post_setxattr)(struct dentry *dentry, const char *name,
1579− const void *value, size_t size,
1580− int flags);
1581− int (*inode_getxattr)(struct dentry *dentry, const char *name);
1582− int (*inode_listxattr)(struct dentry *dentry);
1583− int (*inode_removexattr)(struct dentry *dentry, const char *name);
1584− int (*inode_need_killpriv)(struct dentry *dentry);
1585− int (*inode_killpriv)(struct dentry *dentry);
1586− int (*inode_getsecurity)(struct inode *inode, const char *name,
1587− void **buffer, bool alloc);
1588− int (*inode_setsecurity)(struct inode *inode, const char *name,
1589− const void *value, size_t size,
1590− int flags);
1591− int (*inode_listsecurity)(struct inode *inode, char *buffer,
1592− size_t buffer_size);
1593− void (*inode_getsecid)(struct inode *inode, u32 *secid);
1594− int (*inode_copy_up)(struct dentry *src, struct cred **new);
1595− int (*inode_copy_up_xattr)(const char *name);
1596−
1597− int (*kernfs_init_security)(struct kernfs_node *kn_dir,
1598− struct kernfs_node *kn);
1599−
1600− int (*file_permission)(struct file *file, int mask);
1601− int (*file_alloc_security)(struct file *file);
1602− void (*file_free_security)(struct file *file);
1603− int (*file_ioctl)(struct file *file, unsigned int cmd,
1604− unsigned long arg);
1605− int (*mmap_addr)(unsigned long addr);
1606− int (*mmap_file)(struct file *file, unsigned long reqprot,
1607− unsigned long prot, unsigned long flags);
1608− int (*file_mprotect)(struct vm_area_struct *vma, unsigned long reqprot,
1609− unsigned long prot);
1610− int (*file_lock)(struct file *file, unsigned int cmd);
1611− int (*file_fcntl)(struct file *file, unsigned int cmd,
1612− unsigned long arg);
1613− void (*file_set_fowner)(struct file *file);
1614− int (*file_send_sigiotask)(struct task_struct *tsk,
1615− struct fown_struct *fown, int sig);
1616− int (*file_receive)(struct file *file);
1617− int (*file_open)(struct file *file);
1618−
1619− int (*task_alloc)(struct task_struct *task, unsigned long clone_flags);
1620− void (*task_free)(struct task_struct *task);
1621− int (*cred_alloc_blank)(struct cred *cred, gfp_t gfp);
1622− void (*cred_free)(struct cred *cred);
1623− int (*cred_prepare)(struct cred *new, const struct cred *old,
1624− gfp_t gfp);
1625− void (*cred_transfer)(struct cred *new, const struct cred *old);
1626− void (*cred_getsecid)(const struct cred *c, u32 *secid);
1627− int (*kernel_act_as)(struct cred *new, u32 secid);
1628− int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1629− int (*kernel_module_request)(char *kmod_name);
1630− int (*kernel_load_data)(enum kernel_load_data_id id);
1631− int (*kernel_read_file)(struct file *file, enum kernel_read_file_id id);
1632− int (*kernel_post_read_file)(struct file *file, char *buf, loff_t size,
1633− enum kernel_read_file_id id);
1634− int (*task_fix_setuid)(struct cred *new, const struct cred *old,
1635− int flags);
1636− int (*task_setpgid)(struct task_struct *p, pid_t pgid);
1637− int (*task_getpgid)(struct task_struct *p);
1638− int (*task_getsid)(struct task_struct *p);
1639− void (*task_getsecid)(struct task_struct *p, u32 *secid);
1640− int (*task_setnice)(struct task_struct *p, int nice);
1641− int (*task_setioprio)(struct task_struct *p, int ioprio);
1642− int (*task_getioprio)(struct task_struct *p);
1643− int (*task_prlimit)(const struct cred *cred, const struct cred *tcred,
1644− unsigned int flags);
1645− int (*task_setrlimit)(struct task_struct *p, unsigned int resource,
1646− struct rlimit *new_rlim);
1647− int (*task_setscheduler)(struct task_struct *p);
1648− int (*task_getscheduler)(struct task_struct *p);
1649− int (*task_movememory)(struct task_struct *p);
1650− int (*task_kill)(struct task_struct *p, struct kernel_siginfo *info,
1651− int sig, const struct cred *cred);
1652− int (*task_prctl)(int option, unsigned long arg2, unsigned long arg3,
1653− unsigned long arg4, unsigned long arg5);
1654− void (*task_to_inode)(struct task_struct *p, struct inode *inode);
1655−
1656− int (*ipc_permission)(struct kern_ipc_perm *ipcp, short flag);
1657− void (*ipc_getsecid)(struct kern_ipc_perm *ipcp, u32 *secid);
1658−
1659− int (*msg_msg_alloc_security)(struct msg_msg *msg);
1660− void (*msg_msg_free_security)(struct msg_msg *msg);
1661−
1662− int (*msg_queue_alloc_security)(struct kern_ipc_perm *perm);
1663− void (*msg_queue_free_security)(struct kern_ipc_perm *perm);
1664− int (*msg_queue_associate)(struct kern_ipc_perm *perm, int msqflg);
1665− int (*msg_queue_msgctl)(struct kern_ipc_perm *perm, int cmd);
1666− int (*msg_queue_msgsnd)(struct kern_ipc_perm *perm, struct msg_msg *msg,
1667− int msqflg);
1668− int (*msg_queue_msgrcv)(struct kern_ipc_perm *perm, struct msg_msg *msg,
1669− struct task_struct *target, long type,
1670− int mode);
1671−
1672− int (*shm_alloc_security)(struct kern_ipc_perm *perm);
1673− void (*shm_free_security)(struct kern_ipc_perm *perm);
1674− int (*shm_associate)(struct kern_ipc_perm *perm, int shmflg);
1675− int (*shm_shmctl)(struct kern_ipc_perm *perm, int cmd);
1676− int (*shm_shmat)(struct kern_ipc_perm *perm, char __user *shmaddr,
1677− int shmflg);
1678−
1679− int (*sem_alloc_security)(struct kern_ipc_perm *perm);
1680− void (*sem_free_security)(struct kern_ipc_perm *perm);
1681− int (*sem_associate)(struct kern_ipc_perm *perm, int semflg);
1682− int (*sem_semctl)(struct kern_ipc_perm *perm, int cmd);
1683− int (*sem_semop)(struct kern_ipc_perm *perm, struct sembuf *sops,
1684− unsigned nsops, int alter);
1685−
1686− int (*netlink_send)(struct sock *sk, struct sk_buff *skb);
1687−
1688− void (*d_instantiate)(struct dentry *dentry, struct inode *inode);
1689−
1690− int (*getprocattr)(struct task_struct *p, char *name, char **value);
1691− int (*setprocattr)(const char *name, void *value, size_t size);
1692− int (*ismaclabel)(const char *name);
1693− int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
1694− int (*secctx_to_secid)(const char *secdata, u32 seclen, u32 *secid);
1695− void (*release_secctx)(char *secdata, u32 seclen);
1696−
1697− void (*inode_invalidate_secctx)(struct inode *inode);
1698− int (*inode_notifysecctx)(struct inode *inode, void *ctx, u32 ctxlen);
1699− int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen);
1700− int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen);
1701−
1702−#ifdef CONFIG_SECURITY_NETWORK
1703− int (*unix_stream_connect)(struct sock *sock, struct sock *other,
1704− struct sock *newsk);
1705− int (*unix_may_send)(struct socket *sock, struct socket *other);
1706−
1707− int (*socket_create)(int family, int type, int protocol, int kern);
1708− int (*socket_post_create)(struct socket *sock, int family, int type,
1709− int protocol, int kern);
1710− int (*socket_socketpair)(struct socket *socka, struct socket *sockb);
1711− int (*socket_bind)(struct socket *sock, struct sockaddr *address,
1712− int addrlen);
1713− int (*socket_connect)(struct socket *sock, struct sockaddr *address,
1714− int addrlen);
1715− int (*socket_listen)(struct socket *sock, int backlog);
1716− int (*socket_accept)(struct socket *sock, struct socket *newsock);
1717− int (*socket_sendmsg)(struct socket *sock, struct msghdr *msg,
1718− int size);
1719− int (*socket_recvmsg)(struct socket *sock, struct msghdr *msg,
1720− int size, int flags);
1721− int (*socket_getsockname)(struct socket *sock);
1722− int (*socket_getpeername)(struct socket *sock);
1723− int (*socket_getsockopt)(struct socket *sock, int level, int optname);
1724− int (*socket_setsockopt)(struct socket *sock, int level, int optname);
1725− int (*socket_shutdown)(struct socket *sock, int how);
1726− int (*socket_sock_rcv_skb)(struct sock *sk, struct sk_buff *skb);
1727− int (*socket_getpeersec_stream)(struct socket *sock,
1728− char __user *optval,
1729− int __user *optlen, unsigned len);
1730− int (*socket_getpeersec_dgram)(struct socket *sock,
1731− struct sk_buff *skb, u32 *secid);
1732− int (*sk_alloc_security)(struct sock *sk, int family, gfp_t priority);
1733− void (*sk_free_security)(struct sock *sk);
1734− void (*sk_clone_security)(const struct sock *sk, struct sock *newsk);
1735− void (*sk_getsecid)(struct sock *sk, u32 *secid);
1736− void (*sock_graft)(struct sock *sk, struct socket *parent);
1737− int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb,
1738− struct request_sock *req);
1739− void (*inet_csk_clone)(struct sock *newsk,
1740− const struct request_sock *req);
1741− void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb);
1742− int (*secmark_relabel_packet)(u32 secid);
1743− void (*secmark_refcount_inc)(void);
1744− void (*secmark_refcount_dec)(void);
1745− void (*req_classify_flow)(const struct request_sock *req,
1746− struct flowi *fl);
1747− int (*tun_dev_alloc_security)(void **security);
1748− void (*tun_dev_free_security)(void *security);
1749− int (*tun_dev_create)(void);
1750− int (*tun_dev_attach_queue)(void *security);
1751− int (*tun_dev_attach)(struct sock *sk, void *security);
1752− int (*tun_dev_open)(void *security);
1753− int (*sctp_assoc_request)(struct sctp_endpoint *ep,
1754− struct sk_buff *skb);
1755− int (*sctp_bind_connect)(struct sock *sk, int optname,
1756− struct sockaddr *address, int addrlen);
1757− void (*sctp_sk_clone)(struct sctp_endpoint *ep, struct sock *sk,
1758− struct sock *newsk);
1759−#endif /* CONFIG_SECURITY_NETWORK */
1760−
1761−#ifdef CONFIG_SECURITY_INFINIBAND
1762− int (*ib_pkey_access)(void *sec, u64 subnet_prefix, u16 pkey);
1763− int (*ib_endport_manage_subnet)(void *sec, const char *dev_name,
1764− u8 port_num);
1765− int (*ib_alloc_security)(void **sec);
1766− void (*ib_free_security)(void *sec);
1767−#endif /* CONFIG_SECURITY_INFINIBAND */
1768−
1769−#ifdef CONFIG_SECURITY_NETWORK_XFRM
1770− int (*xfrm_policy_alloc_security)(struct xfrm_sec_ctx **ctxp,
1771− struct xfrm_user_sec_ctx *sec_ctx,
1772− gfp_t gfp);
1773− int (*xfrm_policy_clone_security)(struct xfrm_sec_ctx *old_ctx,
1774− struct xfrm_sec_ctx **new_ctx);
1775− void (*xfrm_policy_free_security)(struct xfrm_sec_ctx *ctx);
1776− int (*xfrm_policy_delete_security)(struct xfrm_sec_ctx *ctx);
1777− int (*xfrm_state_alloc)(struct xfrm_state *x,
1778− struct xfrm_user_sec_ctx *sec_ctx);
1779− int (*xfrm_state_alloc_acquire)(struct xfrm_state *x,
1780− struct xfrm_sec_ctx *polsec,
1781− u32 secid);
1782− void (*xfrm_state_free_security)(struct xfrm_state *x);
1783− int (*xfrm_state_delete_security)(struct xfrm_state *x);
1784− int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid,
1785− u8 dir);
1786− int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
1787− struct xfrm_policy *xp,
1788− const struct flowi *fl);
1789− int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
1790−#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1791−
1792− /* key management security hooks */
1793−#ifdef CONFIG_KEYS
1794− int (*key_alloc)(struct key *key, const struct cred *cred,
1795− unsigned long flags);
1796− void (*key_free)(struct key *key);
1797− int (*key_permission)(key_ref_t key_ref, const struct cred *cred,
1798− unsigned perm);
1799− int (*key_getsecurity)(struct key *key, char **_buffer);
1800−#endif /* CONFIG_KEYS */
1801−
1802−#ifdef CONFIG_AUDIT
1803− int (*audit_rule_init)(u32 field, u32 op, char *rulestr,
1804− void **lsmrule);
1805− int (*audit_rule_known)(struct audit_krule *krule);
1806− int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule);
1807− void (*audit_rule_free)(void *lsmrule);
1808−#endif /* CONFIG_AUDIT */
1809−
1810−#ifdef CONFIG_BPF_SYSCALL
1811− int (*bpf)(int cmd, union bpf_attr *attr,
1812− unsigned int size);
1813− int (*bpf_map)(struct bpf_map *map, fmode_t fmode);
1814− int (*bpf_prog)(struct bpf_prog *prog);
1815− int (*bpf_map_alloc_security)(struct bpf_map *map);
1816− void (*bpf_map_free_security)(struct bpf_map *map);
1817− int (*bpf_prog_alloc_security)(struct bpf_prog_aux *aux);
1818− void (*bpf_prog_free_security)(struct bpf_prog_aux *aux);
1819−#endif /* CONFIG_BPF_SYSCALL */
1820− int (*locked_down)(enum lockdown_reason what);
1821−#ifdef CONFIG_PERF_EVENTS
1822− int (*perf_event_open)(struct perf_event_attr *attr, int type);
1823− int (*perf_event_alloc)(struct perf_event *event);
1824− void (*perf_event_free)(struct perf_event *event);
1825− int (*perf_event_read)(struct perf_event *event);
1826− int (*perf_event_write)(struct perf_event *event);
1827−
1828−#endif
1493+ #define LSM_HOOK(RET, DEFAULT, NAME, ...) RET (*NAME)(__VA_ARGS__);
1494+ #include "lsm_hook_defs.h"
1495+ #undef LSM_HOOK
18291496 };
18301497
18311498 struct security_hook_heads {
1832− struct hlist_head binder_set_context_mgr;
1833− struct hlist_head binder_transaction;
1834− struct hlist_head binder_transfer_binder;
1835− struct hlist_head binder_transfer_file;
1836− struct hlist_head ptrace_access_check;
1837− struct hlist_head ptrace_traceme;
1838− struct hlist_head capget;
1839− struct hlist_head capset;
1840− struct hlist_head capable;
1841− struct hlist_head quotactl;
1842− struct hlist_head quota_on;
1843− struct hlist_head syslog;
1844− struct hlist_head settime;
1845− struct hlist_head vm_enough_memory;
1846− struct hlist_head bprm_set_creds;
1847− struct hlist_head bprm_check_security;
1848− struct hlist_head bprm_committing_creds;
1849− struct hlist_head bprm_committed_creds;
1850− struct hlist_head fs_context_dup;
1851− struct hlist_head fs_context_parse_param;
1852− struct hlist_head sb_alloc_security;
1853− struct hlist_head sb_free_security;
1854− struct hlist_head sb_free_mnt_opts;
1855− struct hlist_head sb_eat_lsm_opts;
1856− struct hlist_head sb_remount;
1857− struct hlist_head sb_kern_mount;
1858− struct hlist_head sb_show_options;
1859− struct hlist_head sb_statfs;
1860− struct hlist_head sb_mount;
1861− struct hlist_head sb_umount;
1862− struct hlist_head sb_pivotroot;
1863− struct hlist_head sb_set_mnt_opts;
1864− struct hlist_head sb_clone_mnt_opts;
1865− struct hlist_head sb_add_mnt_opt;
1866− struct hlist_head move_mount;
1867− struct hlist_head dentry_init_security;
1868− struct hlist_head dentry_create_files_as;
1869−#ifdef CONFIG_SECURITY_PATH
1870− struct hlist_head path_unlink;
1871− struct hlist_head path_mkdir;
1872− struct hlist_head path_rmdir;
1873− struct hlist_head path_mknod;
1874− struct hlist_head path_truncate;
1875− struct hlist_head path_symlink;
1876− struct hlist_head path_link;
1877− struct hlist_head path_rename;
1878− struct hlist_head path_chmod;
1879− struct hlist_head path_chown;
1880− struct hlist_head path_chroot;
1881−#endif
1882− /* Needed for inode based modules as well */
1883− struct hlist_head path_notify;
1884− struct hlist_head inode_alloc_security;
1885− struct hlist_head inode_free_security;
1886− struct hlist_head inode_init_security;
1887− struct hlist_head inode_create;
1888− struct hlist_head inode_link;
1889− struct hlist_head inode_unlink;
1890− struct hlist_head inode_symlink;
1891− struct hlist_head inode_mkdir;
1892− struct hlist_head inode_rmdir;
1893− struct hlist_head inode_mknod;
1894− struct hlist_head inode_rename;
1895− struct hlist_head inode_readlink;
1896− struct hlist_head inode_follow_link;
1897− struct hlist_head inode_permission;
1898− struct hlist_head inode_setattr;
1899− struct hlist_head inode_getattr;
1900− struct hlist_head inode_setxattr;
1901− struct hlist_head inode_post_setxattr;
1902− struct hlist_head inode_getxattr;
1903− struct hlist_head inode_listxattr;
1904− struct hlist_head inode_removexattr;
1905− struct hlist_head inode_need_killpriv;
1906− struct hlist_head inode_killpriv;
1907− struct hlist_head inode_getsecurity;
1908− struct hlist_head inode_setsecurity;
1909− struct hlist_head inode_listsecurity;
1910− struct hlist_head inode_getsecid;
1911− struct hlist_head inode_copy_up;
1912− struct hlist_head inode_copy_up_xattr;
1913− struct hlist_head kernfs_init_security;
1914− struct hlist_head file_permission;
1915− struct hlist_head file_alloc_security;
1916− struct hlist_head file_free_security;
1917− struct hlist_head file_ioctl;
1918− struct hlist_head mmap_addr;
1919− struct hlist_head mmap_file;
1920− struct hlist_head file_mprotect;
1921− struct hlist_head file_lock;
1922− struct hlist_head file_fcntl;
1923− struct hlist_head file_set_fowner;
1924− struct hlist_head file_send_sigiotask;
1925− struct hlist_head file_receive;
1926− struct hlist_head file_open;
1927− struct hlist_head task_alloc;
1928− struct hlist_head task_free;
1929− struct hlist_head cred_alloc_blank;
1930− struct hlist_head cred_free;
1931− struct hlist_head cred_prepare;
1932− struct hlist_head cred_transfer;
1933− struct hlist_head cred_getsecid;
1934− struct hlist_head kernel_act_as;
1935− struct hlist_head kernel_create_files_as;
1936− struct hlist_head kernel_load_data;
1937− struct hlist_head kernel_read_file;
1938− struct hlist_head kernel_post_read_file;
1939− struct hlist_head kernel_module_request;
1940− struct hlist_head task_fix_setuid;
1941− struct hlist_head task_setpgid;
1942− struct hlist_head task_getpgid;
1943− struct hlist_head task_getsid;
1944− struct hlist_head task_getsecid;
1945− struct hlist_head task_setnice;
1946− struct hlist_head task_setioprio;
1947− struct hlist_head task_getioprio;
1948− struct hlist_head task_prlimit;
1949− struct hlist_head task_setrlimit;
1950− struct hlist_head task_setscheduler;
1951− struct hlist_head task_getscheduler;
1952− struct hlist_head task_movememory;
1953− struct hlist_head task_kill;
1954− struct hlist_head task_prctl;
1955− struct hlist_head task_to_inode;
1956− struct hlist_head ipc_permission;
1957− struct hlist_head ipc_getsecid;
1958− struct hlist_head msg_msg_alloc_security;
1959− struct hlist_head msg_msg_free_security;
1960− struct hlist_head msg_queue_alloc_security;
1961− struct hlist_head msg_queue_free_security;
1962− struct hlist_head msg_queue_associate;
1963− struct hlist_head msg_queue_msgctl;
1964− struct hlist_head msg_queue_msgsnd;
1965− struct hlist_head msg_queue_msgrcv;
1966− struct hlist_head shm_alloc_security;
1967− struct hlist_head shm_free_security;
1968− struct hlist_head shm_associate;
1969− struct hlist_head shm_shmctl;
1970− struct hlist_head shm_shmat;
1971− struct hlist_head sem_alloc_security;
1972− struct hlist_head sem_free_security;
1973− struct hlist_head sem_associate;
1974− struct hlist_head sem_semctl;
1975− struct hlist_head sem_semop;
1976− struct hlist_head netlink_send;
1977− struct hlist_head d_instantiate;
1978− struct hlist_head getprocattr;
1979− struct hlist_head setprocattr;
1980− struct hlist_head ismaclabel;
1981− struct hlist_head secid_to_secctx;
1982− struct hlist_head secctx_to_secid;
1983− struct hlist_head release_secctx;
1984− struct hlist_head inode_invalidate_secctx;
1985− struct hlist_head inode_notifysecctx;
1986− struct hlist_head inode_setsecctx;
1987− struct hlist_head inode_getsecctx;
1988−#ifdef CONFIG_SECURITY_NETWORK
1989− struct hlist_head unix_stream_connect;
1990− struct hlist_head unix_may_send;
1991− struct hlist_head socket_create;
1992− struct hlist_head socket_post_create;
1993− struct hlist_head socket_socketpair;
1994− struct hlist_head socket_bind;
1995− struct hlist_head socket_connect;
1996− struct hlist_head socket_listen;
1997− struct hlist_head socket_accept;
1998− struct hlist_head socket_sendmsg;
1999− struct hlist_head socket_recvmsg;
2000− struct hlist_head socket_getsockname;
2001− struct hlist_head socket_getpeername;
2002− struct hlist_head socket_getsockopt;
2003− struct hlist_head socket_setsockopt;
2004− struct hlist_head socket_shutdown;
2005− struct hlist_head socket_sock_rcv_skb;
2006− struct hlist_head socket_getpeersec_stream;
2007− struct hlist_head socket_getpeersec_dgram;
2008− struct hlist_head sk_alloc_security;
2009− struct hlist_head sk_free_security;
2010− struct hlist_head sk_clone_security;
2011− struct hlist_head sk_getsecid;
2012− struct hlist_head sock_graft;
2013− struct hlist_head inet_conn_request;
2014− struct hlist_head inet_csk_clone;
2015− struct hlist_head inet_conn_established;
2016− struct hlist_head secmark_relabel_packet;
2017− struct hlist_head secmark_refcount_inc;
2018− struct hlist_head secmark_refcount_dec;
2019− struct hlist_head req_classify_flow;
2020− struct hlist_head tun_dev_alloc_security;
2021− struct hlist_head tun_dev_free_security;
2022− struct hlist_head tun_dev_create;
2023− struct hlist_head tun_dev_attach_queue;
2024− struct hlist_head tun_dev_attach;
2025− struct hlist_head tun_dev_open;
2026− struct hlist_head sctp_assoc_request;
2027− struct hlist_head sctp_bind_connect;
2028− struct hlist_head sctp_sk_clone;
2029−#endif /* CONFIG_SECURITY_NETWORK */
2030−#ifdef CONFIG_SECURITY_INFINIBAND
2031− struct hlist_head ib_pkey_access;
2032− struct hlist_head ib_endport_manage_subnet;
2033− struct hlist_head ib_alloc_security;
2034− struct hlist_head ib_free_security;
2035−#endif /* CONFIG_SECURITY_INFINIBAND */
2036−#ifdef CONFIG_SECURITY_NETWORK_XFRM
2037− struct hlist_head xfrm_policy_alloc_security;
2038− struct hlist_head xfrm_policy_clone_security;
2039− struct hlist_head xfrm_policy_free_security;
2040− struct hlist_head xfrm_policy_delete_security;
2041− struct hlist_head xfrm_state_alloc;
2042− struct hlist_head xfrm_state_alloc_acquire;
2043− struct hlist_head xfrm_state_free_security;
2044− struct hlist_head xfrm_state_delete_security;
2045− struct hlist_head xfrm_policy_lookup;
2046− struct hlist_head xfrm_state_pol_flow_match;
2047− struct hlist_head xfrm_decode_session;
2048−#endif /* CONFIG_SECURITY_NETWORK_XFRM */
2049−#ifdef CONFIG_KEYS
2050− struct hlist_head key_alloc;
2051− struct hlist_head key_free;
2052− struct hlist_head key_permission;
2053− struct hlist_head key_getsecurity;
2054−#endif /* CONFIG_KEYS */
2055−#ifdef CONFIG_AUDIT
2056− struct hlist_head audit_rule_init;
2057− struct hlist_head audit_rule_known;
2058− struct hlist_head audit_rule_match;
2059− struct hlist_head audit_rule_free;
2060−#endif /* CONFIG_AUDIT */
2061−#ifdef CONFIG_BPF_SYSCALL
2062− struct hlist_head bpf;
2063− struct hlist_head bpf_map;
2064− struct hlist_head bpf_prog;
2065− struct hlist_head bpf_map_alloc_security;
2066− struct hlist_head bpf_map_free_security;
2067− struct hlist_head bpf_prog_alloc_security;
2068− struct hlist_head bpf_prog_free_security;
2069−#endif /* CONFIG_BPF_SYSCALL */
2070− struct hlist_head locked_down;
2071−#ifdef CONFIG_PERF_EVENTS
2072− struct hlist_head perf_event_open;
2073− struct hlist_head perf_event_alloc;
2074− struct hlist_head perf_event_free;
2075− struct hlist_head perf_event_read;
2076− struct hlist_head perf_event_write;
2077−#endif
1499+ #define LSM_HOOK(RET, DEFAULT, NAME, ...) struct hlist_head NAME;
1500+ #include "lsm_hook_defs.h"
1501+ #undef LSM_HOOK
20781502 } __randomize_layout;
20791503
20801504 /*
@@ -2100,6 +1524,12 @@ struct lsm_blob_sizes { · 19 unmodified lines
21001524 int lbs_task;
21011525 };
21021526
1527+/*
1528+ * LSM_RET_VOID is used as the default value in LSM_HOOK definitions for void
1529+ * LSM hooks (in include/linux/lsm_hook_defs.h).
1530+ */
1531+#define LSM_RET_VOID ((void) 0)
1532+
21031533 /*
21041534 * Initializing a security_hook_list structure takes
21051535 * up a lot of space in a source file. This macro takes
include/linux/math64.h+1−19
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #define _LINUX_MATH64_H
44
55 #include <linux/types.h>
6+#include <vdso/math64.h>
67 #include <asm/div64.h>
78
89 #if BITS_PER_LONG == 64
@@ -142,25 +143,6 @@ static inline s64 div_s64(s64 dividend, s32 divisor) · 133 unmodified lines
142143
143144 u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder);
144145
145−static __always_inline u32
146−__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder)
147−{
148− u32 ret = 0;
149−
150− while (dividend >= divisor) {
151− /* The following asm() prevents the compiler from
152− optimising this loop into a modulo operation. */
153− asm("" : "+rm"(dividend));
154−
155− dividend -= divisor;
156− ret++;
157− }
158−
159− *remainder = dividend;
160−
161− return ret;
162−}
163−
164146 #ifndef mul_u32_u32
165147 /*
166148 * Many a GCC version messes this up and generates a 64x64 mult :-(
include/linux/mdio-xpcs.h+41−0
@@ -0,0 +1,41 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Copyright (c) 2020 Synopsys, Inc. and/or its affiliates.
4+ * Synopsys DesignWare XPCS helpers
5+ */
6+
7+#ifndef __LINUX_MDIO_XPCS_H
8+#define __LINUX_MDIO_XPCS_H
9+
10+#include <linux/phy.h>
11+#include <linux/phylink.h>
12+
13+struct mdio_xpcs_args {
14+ __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
15+ struct mii_bus *bus;
16+ int addr;
17+};
18+
19+struct mdio_xpcs_ops {
20+ int (*validate)(struct mdio_xpcs_args *xpcs,
21+ unsigned long *supported,
22+ struct phylink_link_state *state);
23+ int (*config)(struct mdio_xpcs_args *xpcs,
24+ const struct phylink_link_state *state);
25+ int (*get_state)(struct mdio_xpcs_args *xpcs,
26+ struct phylink_link_state *state);
27+ int (*link_up)(struct mdio_xpcs_args *xpcs, int speed,
28+ phy_interface_t interface);
29+ int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface);
30+};
31+
32+#if IS_ENABLED(CONFIG_MDIO_XPCS)
33+struct mdio_xpcs_ops *mdio_xpcs_get_ops(void);
34+#else
35+static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void)
36+{
37+ return NULL;
38+}
39+#endif
40+
41+#endif /* __LINUX_MDIO_XPCS_H */
include/linux/mdio.h+4−0
@@ -316,11 +316,15 @@ static inline void mii_10gbt_stat_mod_linkmode_lpa_t(unsigned long *advertising, · 315 unmodified lines
316316
317317 int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
318318 int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
319+int __mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum,
320+ u16 mask, u16 set);
319321
320322 int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
321323 int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum);
322324 int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
323325 int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val);
326+int mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask,
327+ u16 set);
324328
325329 int mdiobus_register_device(struct mdio_device *mdiodev);
326330 int mdiobus_unregister_device(struct mdio_device *mdiodev);
include/linux/memblock.h+3−0
@@ -348,6 +348,9 @@ static inline int memblock_get_region_node(const struct memblock_region *r) · 347 unmodified lines
348348
349349 phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align,
350350 phys_addr_t start, phys_addr_t end);
351+phys_addr_t memblock_alloc_range_nid(phys_addr_t size,
352+ phys_addr_t align, phys_addr_t start,
353+ phys_addr_t end, int nid, bool exact_nid);
351354 phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
352355
353356 static inline phys_addr_t memblock_phys_alloc(phys_addr_t size,
include/linux/memcontrol.h+34−20
@@ -695,6 +695,7 @@ static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec, · 694 unmodified lines
695695 void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,
696696 int val);
697697 void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val);
698+void mod_memcg_obj_state(void *p, int idx, int val);
698699
699700 static inline void mod_lruvec_state(struct lruvec *lruvec,
700701 enum node_stat_item idx, int val)
@@ -1123,6 +1124,10 @@ static inline void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, · 422 unmodified lines
11231124 __mod_node_page_state(page_pgdat(page), idx, val);
11241125 }
11251126
1127+static inline void mod_memcg_obj_state(void *p, int idx, int val)
1128+{
1129+}
1130+
11261131 static inline
11271132 unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
11281133 gfp_t gfp_mask,
@@ -1362,12 +1367,11 @@ struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep); · 233 unmodified lines
13621367 void memcg_kmem_put_cache(struct kmem_cache *cachep);
13631368
13641369 #ifdef CONFIG_MEMCG_KMEM
1365−int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order);
1366−void __memcg_kmem_uncharge(struct page *page, int order);
1367−int __memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order,
1368− struct mem_cgroup *memcg);
1369−void __memcg_kmem_uncharge_memcg(struct mem_cgroup *memcg,
1370− unsigned int nr_pages);
1370+int __memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp,
1371+ unsigned int nr_pages);
1372+void __memcg_kmem_uncharge(struct mem_cgroup *memcg, unsigned int nr_pages);
1373+int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order);
1374+void __memcg_kmem_uncharge_page(struct page *page, int order);
13711375
13721376 extern struct static_key_false memcg_kmem_enabled_key;
13731377 extern struct workqueue_struct *memcg_kmem_cache_wq;
@@ -1389,32 +1393,33 @@ static inline bool memcg_kmem_enabled(void) · 15 unmodified lines
13891393 return static_branch_unlikely(&memcg_kmem_enabled_key);
13901394 }
13911395
1392−static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order)
1396+static inline int memcg_kmem_charge_page(struct page *page, gfp_t gfp,
1397+ int order)
13931398 {
13941399 if (memcg_kmem_enabled())
1395− return __memcg_kmem_charge(page, gfp, order);
1400+ return __memcg_kmem_charge_page(page, gfp, order);
13961401 return 0;
13971402 }
13981403
1399−static inline void memcg_kmem_uncharge(struct page *page, int order)
1404+static inline void memcg_kmem_uncharge_page(struct page *page, int order)
14001405 {
14011406 if (memcg_kmem_enabled())
1402− __memcg_kmem_uncharge(page, order);
1407+ __memcg_kmem_uncharge_page(page, order);
14031408 }
14041409
1405−static inline int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp,
1406− int order, struct mem_cgroup *memcg)
1410+static inline int memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp,
1411+ unsigned int nr_pages)
14071412 {
14081413 if (memcg_kmem_enabled())
1409− return __memcg_kmem_charge_memcg(page, gfp, order, memcg);
1414+ return __memcg_kmem_charge(memcg, gfp, nr_pages);
14101415 return 0;
14111416 }
14121417
1413−static inline void memcg_kmem_uncharge_memcg(struct page *page, int order,
1414− struct mem_cgroup *memcg)
1418+static inline void memcg_kmem_uncharge(struct mem_cgroup *memcg,
1419+ unsigned int nr_pages)
14151420 {
14161421 if (memcg_kmem_enabled())
1417− __memcg_kmem_uncharge_memcg(memcg, 1 << order);
1422+ __memcg_kmem_uncharge(memcg, nr_pages);
14181423 }
14191424
14201425 /*
@@ -1427,23 +1432,27 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) · 6 unmodified lines
14271432 return memcg ? memcg->kmemcg_id : -1;
14281433 }
14291434
1435+struct mem_cgroup *mem_cgroup_from_obj(void *p);
1436+
14301437 #else
14311438
1432−static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order)
1439+static inline int memcg_kmem_charge_page(struct page *page, gfp_t gfp,
1440+ int order)
14331441 {
14341442 return 0;
14351443 }
14361444
1437−static inline void memcg_kmem_uncharge(struct page *page, int order)
1445+static inline void memcg_kmem_uncharge_page(struct page *page, int order)
14381446 {
14391447 }
14401448
1441−static inline int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order)
1449+static inline int __memcg_kmem_charge_page(struct page *page, gfp_t gfp,
1450+ int order)
14421451 {
14431452 return 0;
14441453 }
14451454
1446−static inline void __memcg_kmem_uncharge(struct page *page, int order)
1455+static inline void __memcg_kmem_uncharge_page(struct page *page, int order)
14471456 {
14481457 }
14491458
@@ -1468,6 +1477,11 @@ static inline void memcg_put_cache_ids(void) · 18 unmodified lines
14681477 {
14691478 }
14701479
1480+static inline struct mem_cgroup *mem_cgroup_from_obj(void *p)
1481+{
1482+ return NULL;
1483+}
1484+
14711485 #endif /* CONFIG_MEMCG_KMEM */
14721486
14731487 #endif /* _LINUX_MEMCONTROL_H */
include/linux/memory.h+0−1
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626 struct memory_block {
2727 unsigned long start_section_nr;
2828 unsigned long state; /* serialized by the dev->lock */
29− int section_count; /* serialized by mem_sysfs_mutex */
3029 int online_type; /* for passing data to online routine */
3130 int phys_device; /* to which fru does this belong? */
3231 struct device dev;
include/linux/memory_hotplug.h+21−13
@@ -47,20 +47,25 @@ enum { · 46 unmodified lines
4747
4848 /* Types for control the zone type of onlined and offlined memory */
4949 enum {
50− MMOP_OFFLINE = -1,
51− MMOP_ONLINE_KEEP,
50+ /* Offline the memory. */
51+ MMOP_OFFLINE = 0,
52+ /* Online the memory. Zone depends, see default_zone_for_pfn(). */
53+ MMOP_ONLINE,
54+ /* Online the memory to ZONE_NORMAL. */
5255 MMOP_ONLINE_KERNEL,
56+ /* Online the memory to ZONE_MOVABLE. */
5357 MMOP_ONLINE_MOVABLE,
5458 };
5559
5660 /*
57− * Restrictions for the memory hotplug:
58− * flags: MHP_ flags
59− * altmap: alternative allocator for memmap array
61+ * Extended parameters for memory hotplug:
62+ * altmap: alternative allocator for memmap array (optional)
63+ * pgprot: page protection flags to apply to newly created page tables
64+ * (required)
6065 */
61−struct mhp_restrictions {
62− unsigned long flags;
66+struct mhp_params {
6367 struct vmem_altmap *altmap;
68+ pgprot_t pgprot;
6469 };
6570
6671 /*
@@ -110,10 +115,13 @@ extern int restore_online_page_callback(online_page_callback_t callback); · 43 unmodified lines
110115 extern int try_online_node(int nid);
111116
112117 extern int arch_add_memory(int nid, u64 start, u64 size,
113− struct mhp_restrictions *restrictions);
118+ struct mhp_params *params);
114119 extern u64 max_mem_size;
115120
116−extern bool memhp_auto_online;
121+extern int memhp_online_type_from_str(const char *str);
122+
123+/* Default online_type (MMOP_*) when new memory blocks are added. */
124+extern int memhp_default_online_type;
117125 /* If movable_node boot option specified */
118126 extern bool movable_node_enabled;
119127 static inline bool movable_node_is_enabled(void)
@@ -128,17 +136,17 @@ extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages, · 8 unmodified lines
128136
129137 /* reasonably generic interface to expand the physical pages */
130138 extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
131− struct mhp_restrictions *restrictions);
139+ struct mhp_params *params);
132140
133141 #ifndef CONFIG_ARCH_HAS_ADD_PAGES
134142 static inline int add_pages(int nid, unsigned long start_pfn,
135− unsigned long nr_pages, struct mhp_restrictions *restrictions)
143+ unsigned long nr_pages, struct mhp_params *params)
136144 {
137− return __add_pages(nid, start_pfn, nr_pages, restrictions);
145+ return __add_pages(nid, start_pfn, nr_pages, params);
138146 }
139147 #else /* ARCH_HAS_ADD_PAGES */
140148 int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
141− struct mhp_restrictions *restrictions);
149+ struct mhp_params *params);
142150 #endif /* ARCH_HAS_ADD_PAGES */
143151
144152 #ifdef CONFIG_NUMA
include/linux/mempolicy.h+1−28
@@ -173,34 +173,7 @@ extern int mpol_parse_str(char *str, struct mempolicy **mpol); · 172 unmodified lines
173173 extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
174174
175175 /* Check if a vma is migratable */
176−static inline bool vma_migratable(struct vm_area_struct *vma)
177−{
178− if (vma->vm_flags & (VM_IO | VM_PFNMAP))
179− return false;
180−
181− /*
182− * DAX device mappings require predictable access latency, so avoid
183− * incurring periodic faults.
184− */
185− if (vma_is_dax(vma))
186− return false;
187−
188−#ifndef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
189− if (vma->vm_flags & VM_HUGETLB)
190− return false;
191−#endif
192−
193− /*
194− * Migration allocates pages in the highest zone. If we cannot
195− * do so then migration (at least from node to node) is not
196− * possible.
197− */
198− if (vma->vm_file &&
199− gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping))
200− < policy_zone)
201− return false;
202− return true;
203−}
176+extern bool vma_migratable(struct vm_area_struct *vma);
204177
205178 extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long);
206179 extern void mpol_put_task_policy(struct task_struct *);
include/linux/memremap.h+12−2
@@ -98,11 +98,12 @@ struct dev_pagemap_ops { · 97 unmodified lines
9898 * @ref: reference count that pins the devm_memremap_pages() mapping
9999 * @internal_ref: internal reference if @ref is not provided by the caller
100100 * @done: completion for @internal_ref
101− * @dev: host device of the mapping for debug
102− * @data: private data pointer for page_free()
103101 * @type: memory type: see MEMORY_* in memory_hotplug.h
104102 * @flags: PGMAP_* flags to specify defailed behavior
105103 * @ops: method table
104+ * @owner: an opaque pointer identifying the entity that manages this
105+ * instance. Used by various helpers to make sure that no
106+ * foreign ZONE_DEVICE memory is accessed.
106107 */
107108 struct dev_pagemap {
108109 struct vmem_altmap altmap;
@@ -113,6 +114,7 @@ struct dev_pagemap { · 4 unmodified lines
113114 enum memory_type type;
114115 unsigned int flags;
115116 const struct dev_pagemap_ops *ops;
117+ void *owner;
116118 };
117119
118120 static inline struct vmem_altmap *pgmap_altmap(struct dev_pagemap *pgmap)
@@ -132,6 +134,7 @@ struct dev_pagemap *get_dev_pagemap(unsigned long pfn, · 13 unmodified lines
132134
133135 unsigned long vmem_altmap_offset(struct vmem_altmap *altmap);
134136 void vmem_altmap_free(struct vmem_altmap *altmap, unsigned long nr_pfns);
137+unsigned long memremap_compat_align(void);
135138 #else
136139 static inline void *devm_memremap_pages(struct device *dev,
137140 struct dev_pagemap *pgmap)
@@ -165,6 +168,12 @@ static inline void vmem_altmap_free(struct vmem_altmap *altmap, · 27 unmodified lines
165168 unsigned long nr_pfns)
166169 {
167170 }
171+
172+/* when memremap_pages() is disabled all archs can remap a single page */
173+static inline unsigned long memremap_compat_align(void)
174+{
175+ return PAGE_SIZE;
176+}
168177 #endif /* CONFIG_ZONE_DEVICE */
169178
170179 static inline void put_dev_pagemap(struct dev_pagemap *pgmap)
@@ -172,4 +181,5 @@ static inline void put_dev_pagemap(struct dev_pagemap *pgmap) · 1 unmodified line
172181 if (pgmap)
173182 percpu_ref_put(pgmap->ref);
174183 }
184+
175185 #endif /* _LINUX_MEMREMAP_H_ */
include/linux/mfd/iqs62x.h+139−0
@@ -0,0 +1,139 @@
1+/* SPDX-License-Identifier: GPL-2.0+ */
2+/*
3+ * Azoteq IQS620A/621/622/624/625 Multi-Function Sensors
4+ *
5+ * Copyright (C) 2019 Jeff LaBundy <jeff@labundy.com>
6+ */
7+
8+#ifndef __LINUX_MFD_IQS62X_H
9+#define __LINUX_MFD_IQS62X_H
10+
11+#define IQS620_PROD_NUM 0x41
12+#define IQS621_PROD_NUM 0x46
13+#define IQS622_PROD_NUM 0x42
14+#define IQS624_PROD_NUM 0x43
15+#define IQS625_PROD_NUM 0x4E
16+
17+#define IQS621_ALS_FLAGS 0x16
18+#define IQS622_ALS_FLAGS 0x14
19+
20+#define IQS624_HALL_UI 0x70
21+#define IQS624_HALL_UI_WHL_EVENT BIT(4)
22+#define IQS624_HALL_UI_INT_EVENT BIT(3)
23+#define IQS624_HALL_UI_AUTO_CAL BIT(2)
24+
25+#define IQS624_INTERVAL_DIV 0x7D
26+
27+#define IQS620_GLBL_EVENT_MASK 0xD7
28+#define IQS620_GLBL_EVENT_MASK_PMU BIT(6)
29+
30+#define IQS62X_NUM_KEYS 16
31+#define IQS62X_NUM_EVENTS (IQS62X_NUM_KEYS + 5)
32+
33+#define IQS62X_EVENT_SIZE 10
34+
35+enum iqs62x_ui_sel {
36+ IQS62X_UI_PROX,
37+ IQS62X_UI_SAR1,
38+};
39+
40+enum iqs62x_event_reg {
41+ IQS62X_EVENT_NONE,
42+ IQS62X_EVENT_SYS,
43+ IQS62X_EVENT_PROX,
44+ IQS62X_EVENT_HYST,
45+ IQS62X_EVENT_HALL,
46+ IQS62X_EVENT_ALS,
47+ IQS62X_EVENT_IR,
48+ IQS62X_EVENT_WHEEL,
49+ IQS62X_EVENT_INTER,
50+ IQS62X_EVENT_UI_LO,
51+ IQS62X_EVENT_UI_HI,
52+};
53+
54+enum iqs62x_event_flag {
55+ /* keys */
56+ IQS62X_EVENT_PROX_CH0_T,
57+ IQS62X_EVENT_PROX_CH0_P,
58+ IQS62X_EVENT_PROX_CH1_T,
59+ IQS62X_EVENT_PROX_CH1_P,
60+ IQS62X_EVENT_PROX_CH2_T,
61+ IQS62X_EVENT_PROX_CH2_P,
62+ IQS62X_EVENT_HYST_POS_T,
63+ IQS62X_EVENT_HYST_POS_P,
64+ IQS62X_EVENT_HYST_NEG_T,
65+ IQS62X_EVENT_HYST_NEG_P,
66+ IQS62X_EVENT_SAR1_ACT,
67+ IQS62X_EVENT_SAR1_QRD,
68+ IQS62X_EVENT_SAR1_MOVE,
69+ IQS62X_EVENT_SAR1_HALT,
70+ IQS62X_EVENT_WHEEL_UP,
71+ IQS62X_EVENT_WHEEL_DN,
72+
73+ /* switches */
74+ IQS62X_EVENT_HALL_N_T,
75+ IQS62X_EVENT_HALL_N_P,
76+ IQS62X_EVENT_HALL_S_T,
77+ IQS62X_EVENT_HALL_S_P,
78+
79+ /* everything else */
80+ IQS62X_EVENT_SYS_RESET,
81+};
82+
83+struct iqs62x_event_data {
84+ u16 ui_data;
85+ u8 als_flags;
86+ u8 ir_flags;
87+ u8 interval;
88+};
89+
90+struct iqs62x_event_desc {
91+ enum iqs62x_event_reg reg;
92+ u8 mask;
93+ u8 val;
94+};
95+
96+struct iqs62x_dev_desc {
97+ const char *dev_name;
98+ const struct mfd_cell *sub_devs;
99+ int num_sub_devs;
100+
101+ u8 prod_num;
102+ u8 sw_num;
103+ const u8 *cal_regs;
104+ int num_cal_regs;
105+
106+ u8 prox_mask;
107+ u8 sar_mask;
108+ u8 hall_mask;
109+ u8 hyst_mask;
110+ u8 temp_mask;
111+ u8 als_mask;
112+ u8 ir_mask;
113+
114+ u8 prox_settings;
115+ u8 als_flags;
116+ u8 hall_flags;
117+ u8 hyst_shift;
118+
119+ u8 interval;
120+ u8 interval_div;
121+
122+ u8 clk_div;
123+ const char *fw_name;
124+ const enum iqs62x_event_reg (*event_regs)[IQS62X_EVENT_SIZE];
125+};
126+
127+struct iqs62x_core {
128+ const struct iqs62x_dev_desc *dev_desc;
129+ struct i2c_client *client;
130+ struct regmap *regmap;
131+ struct blocking_notifier_head nh;
132+ struct list_head fw_blk_head;
133+ struct completion fw_done;
134+ enum iqs62x_ui_sel ui_sel;
135+};
136+
137+extern const struct iqs62x_event_desc iqs62x_events[IQS62X_NUM_EVENTS];
138+
139+#endif /* __LINUX_MFD_IQS62X_H */
include/linux/mfd/rk808.h+0−2
@@ -620,7 +620,5 @@ struct rk808 { · 619 unmodified lines
620620 long variant;
621621 const struct regmap_config *regmap_cfg;
622622 const struct regmap_irq_chip *regmap_irq_chip;
623− void (*pm_pwroff_fn)(void);
624− void (*pm_pwroff_prep_fn)(void);
625623 };
626624 #endif /* __LINUX_REGULATOR_RK808_H */
include/linux/mfd/rn5t618.h+26−0
@@ -139,6 +139,17 @@ · 138 unmodified lines
139139 #define RN5T618_INTPOL 0x9c
140140 #define RN5T618_INTEN 0x9d
141141 #define RN5T618_INTMON 0x9e
142+
143+#define RN5T618_RTC_SECONDS 0xA0
144+#define RN5T618_RTC_MDAY 0xA4
145+#define RN5T618_RTC_MONTH 0xA5
146+#define RN5T618_RTC_YEAR 0xA6
147+#define RN5T618_RTC_ADJUST 0xA7
148+#define RN5T618_RTC_ALARM_Y_SEC 0xA8
149+#define RN5T618_RTC_DAL_MONTH 0xAC
150+#define RN5T618_RTC_CTRL1 0xAE
151+#define RN5T618_RTC_CTRL2 0xAF
152+
142153 #define RN5T618_PREVINDAC 0xb0
143154 #define RN5T618_BATDAC 0xb1
144155 #define RN5T618_CHGCTL1 0xb3
@@ -242,9 +253,24 @@ enum { · 97 unmodified lines
242253 RC5T619,
243254 };
244255
256+/* RN5T618 IRQ definitions */
257+enum {
258+ RN5T618_IRQ_SYS = 0,
259+ RN5T618_IRQ_DCDC,
260+ RN5T618_IRQ_RTC,
261+ RN5T618_IRQ_ADC,
262+ RN5T618_IRQ_GPIO,
263+ RN5T618_IRQ_CHG,
264+ RN5T618_NR_IRQS,
265+};
266+
245267 struct rn5t618 {
246268 struct regmap *regmap;
269+ struct device *dev;
247270 long variant;
271+
272+ int irq;
273+ struct regmap_irq_chip_data *irq_data;
248274 };
249275
250276 #endif /* __LINUX_MFD_RN5T618_H */
include/linux/mfd/sc27xx-pmic.h+7−0
@@ -0,0 +1,7 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef __LINUX_MFD_SC27XX_PMIC_H
3+#define __LINUX_MFD_SC27XX_PMIC_H
4+
5+extern enum usb_charger_type sprd_pmic_detect_charger_type(struct device *dev);
6+
7+#endif /* __LINUX_MFD_SC27XX_PMIC_H */
include/linux/mfd/wm831x/pdata.h+0−1
@@ -89,7 +89,6 @@ enum wm831x_watchdog_action { · 88 unmodified lines
8989
9090 struct wm831x_watchdog_pdata {
9191 enum wm831x_watchdog_action primary, secondary;
92− int update_gpio;
9392 unsigned int software:1;
9493 };
9594
include/linux/mfd/wm8994/pdata.h+1−1
@@ -33,7 +33,7 @@ struct wm8994_ldo_pdata { · 32 unmodified lines
3333 * DRC configurations are specified with a label and a set of register
3434 * values to write (the enable bits will be ignored). At runtime an
3535 * enumerated control will be presented for each DRC block allowing
36− * the user to choose the configration to use.
36+ * the user to choose the configuration to use.
3737 *
3838 * Configurations may be generated by hand or by using the DRC control
3939 * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
include/linux/mhi.h+700−0
@@ -0,0 +1,700 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
4+ *
5+ */
6+#ifndef _MHI_H_
7+#define _MHI_H_
8+
9+#include <linux/device.h>
10+#include <linux/dma-direction.h>
11+#include <linux/mutex.h>
12+#include <linux/rwlock_types.h>
13+#include <linux/skbuff.h>
14+#include <linux/slab.h>
15+#include <linux/spinlock_types.h>
16+#include <linux/wait.h>
17+#include <linux/workqueue.h>
18+
19+struct mhi_chan;
20+struct mhi_event;
21+struct mhi_ctxt;
22+struct mhi_cmd;
23+struct mhi_buf_info;
24+
25+/**
26+ * enum mhi_callback - MHI callback
27+ * @MHI_CB_IDLE: MHI entered idle state
28+ * @MHI_CB_PENDING_DATA: New data available for client to process
29+ * @MHI_CB_LPM_ENTER: MHI host entered low power mode
30+ * @MHI_CB_LPM_EXIT: MHI host about to exit low power mode
31+ * @MHI_CB_EE_RDDM: MHI device entered RDDM exec env
32+ * @MHI_CB_EE_MISSION_MODE: MHI device entered Mission Mode exec env
33+ * @MHI_CB_SYS_ERROR: MHI device entered error state (may recover)
34+ * @MHI_CB_FATAL_ERROR: MHI device entered fatal error state
35+ * @MHI_CB_BW_REQ: Received a bandwidth switch request from device
36+ */
37+enum mhi_callback {
38+ MHI_CB_IDLE,
39+ MHI_CB_PENDING_DATA,
40+ MHI_CB_LPM_ENTER,
41+ MHI_CB_LPM_EXIT,
42+ MHI_CB_EE_RDDM,
43+ MHI_CB_EE_MISSION_MODE,
44+ MHI_CB_SYS_ERROR,
45+ MHI_CB_FATAL_ERROR,
46+ MHI_CB_BW_REQ,
47+};
48+
49+/**
50+ * enum mhi_flags - Transfer flags
51+ * @MHI_EOB: End of buffer for bulk transfer
52+ * @MHI_EOT: End of transfer
53+ * @MHI_CHAIN: Linked transfer
54+ */
55+enum mhi_flags {
56+ MHI_EOB,
57+ MHI_EOT,
58+ MHI_CHAIN,
59+};
60+
61+/**
62+ * enum mhi_device_type - Device types
63+ * @MHI_DEVICE_XFER: Handles data transfer
64+ * @MHI_DEVICE_CONTROLLER: Control device
65+ */
66+enum mhi_device_type {
67+ MHI_DEVICE_XFER,
68+ MHI_DEVICE_CONTROLLER,
69+};
70+
71+/**
72+ * enum mhi_ch_type - Channel types
73+ * @MHI_CH_TYPE_INVALID: Invalid channel type
74+ * @MHI_CH_TYPE_OUTBOUND: Outbound channel to the device
75+ * @MHI_CH_TYPE_INBOUND: Inbound channel from the device
76+ * @MHI_CH_TYPE_INBOUND_COALESCED: Coalesced channel for the device to combine
77+ * multiple packets and send them as a single
78+ * large packet to reduce CPU consumption
79+ */
80+enum mhi_ch_type {
81+ MHI_CH_TYPE_INVALID = 0,
82+ MHI_CH_TYPE_OUTBOUND = DMA_TO_DEVICE,
83+ MHI_CH_TYPE_INBOUND = DMA_FROM_DEVICE,
84+ MHI_CH_TYPE_INBOUND_COALESCED = 3,
85+};
86+
87+/**
88+ * struct image_info - Firmware and RDDM table table
89+ * @mhi_buf - Buffer for firmware and RDDM table
90+ * @entries - # of entries in table
91+ */
92+struct image_info {
93+ struct mhi_buf *mhi_buf;
94+ struct bhi_vec_entry *bhi_vec;
95+ u32 entries;
96+};
97+
98+/**
99+ * struct mhi_link_info - BW requirement
100+ * target_link_speed - Link speed as defined by TLS bits in LinkControl reg
101+ * target_link_width - Link width as defined by NLW bits in LinkStatus reg
102+ */
103+struct mhi_link_info {
104+ unsigned int target_link_speed;
105+ unsigned int target_link_width;
106+};
107+
108+/**
109+ * enum mhi_ee_type - Execution environment types
110+ * @MHI_EE_PBL: Primary Bootloader
111+ * @MHI_EE_SBL: Secondary Bootloader
112+ * @MHI_EE_AMSS: Modem, aka the primary runtime EE
113+ * @MHI_EE_RDDM: Ram dump download mode
114+ * @MHI_EE_WFW: WLAN firmware mode
115+ * @MHI_EE_PTHRU: Passthrough
116+ * @MHI_EE_EDL: Embedded downloader
117+ */
118+enum mhi_ee_type {
119+ MHI_EE_PBL,
120+ MHI_EE_SBL,
121+ MHI_EE_AMSS,
122+ MHI_EE_RDDM,
123+ MHI_EE_WFW,
124+ MHI_EE_PTHRU,
125+ MHI_EE_EDL,
126+ MHI_EE_MAX_SUPPORTED = MHI_EE_EDL,
127+ MHI_EE_DISABLE_TRANSITION, /* local EE, not related to mhi spec */
128+ MHI_EE_NOT_SUPPORTED,
129+ MHI_EE_MAX,
130+};
131+
132+/**
133+ * enum mhi_state - MHI states
134+ * @MHI_STATE_RESET: Reset state
135+ * @MHI_STATE_READY: Ready state
136+ * @MHI_STATE_M0: M0 state
137+ * @MHI_STATE_M1: M1 state
138+ * @MHI_STATE_M2: M2 state
139+ * @MHI_STATE_M3: M3 state
140+ * @MHI_STATE_M3_FAST: M3 Fast state
141+ * @MHI_STATE_BHI: BHI state
142+ * @MHI_STATE_SYS_ERR: System Error state
143+ */
144+enum mhi_state {
145+ MHI_STATE_RESET = 0x0,
146+ MHI_STATE_READY = 0x1,
147+ MHI_STATE_M0 = 0x2,
148+ MHI_STATE_M1 = 0x3,
149+ MHI_STATE_M2 = 0x4,
150+ MHI_STATE_M3 = 0x5,
151+ MHI_STATE_M3_FAST = 0x6,
152+ MHI_STATE_BHI = 0x7,
153+ MHI_STATE_SYS_ERR = 0xFF,
154+ MHI_STATE_MAX,
155+};
156+
157+/**
158+ * enum mhi_ch_ee_mask - Execution environment mask for channel
159+ * @MHI_CH_EE_PBL: Allow channel to be used in PBL EE
160+ * @MHI_CH_EE_SBL: Allow channel to be used in SBL EE
161+ * @MHI_CH_EE_AMSS: Allow channel to be used in AMSS EE
162+ * @MHI_CH_EE_RDDM: Allow channel to be used in RDDM EE
163+ * @MHI_CH_EE_PTHRU: Allow channel to be used in PTHRU EE
164+ * @MHI_CH_EE_WFW: Allow channel to be used in WFW EE
165+ * @MHI_CH_EE_EDL: Allow channel to be used in EDL EE
166+ */
167+enum mhi_ch_ee_mask {
168+ MHI_CH_EE_PBL = BIT(MHI_EE_PBL),
169+ MHI_CH_EE_SBL = BIT(MHI_EE_SBL),
170+ MHI_CH_EE_AMSS = BIT(MHI_EE_AMSS),
171+ MHI_CH_EE_RDDM = BIT(MHI_EE_RDDM),
172+ MHI_CH_EE_PTHRU = BIT(MHI_EE_PTHRU),
173+ MHI_CH_EE_WFW = BIT(MHI_EE_WFW),
174+ MHI_CH_EE_EDL = BIT(MHI_EE_EDL),
175+};
176+
177+/**
178+ * enum mhi_er_data_type - Event ring data types
179+ * @MHI_ER_DATA: Only client data over this ring
180+ * @MHI_ER_CTRL: MHI control data and client data
181+ */
182+enum mhi_er_data_type {
183+ MHI_ER_DATA,
184+ MHI_ER_CTRL,
185+};
186+
187+/**
188+ * enum mhi_db_brst_mode - Doorbell mode
189+ * @MHI_DB_BRST_DISABLE: Burst mode disable
190+ * @MHI_DB_BRST_ENABLE: Burst mode enable
191+ */
192+enum mhi_db_brst_mode {
193+ MHI_DB_BRST_DISABLE = 0x2,
194+ MHI_DB_BRST_ENABLE = 0x3,
195+};
196+
197+/**
198+ * struct mhi_channel_config - Channel configuration structure for controller
199+ * @name: The name of this channel
200+ * @num: The number assigned to this channel
201+ * @num_elements: The number of elements that can be queued to this channel
202+ * @local_elements: The local ring length of the channel
203+ * @event_ring: The event rung index that services this channel
204+ * @dir: Direction that data may flow on this channel
205+ * @type: Channel type
206+ * @ee_mask: Execution Environment mask for this channel
207+ * @pollcfg: Polling configuration for burst mode. 0 is default. milliseconds
208+ for UL channels, multiple of 8 ring elements for DL channels
209+ * @doorbell: Doorbell mode
210+ * @lpm_notify: The channel master requires low power mode notifications
211+ * @offload_channel: The client manages the channel completely
212+ * @doorbell_mode_switch: Channel switches to doorbell mode on M0 transition
213+ * @auto_queue: Framework will automatically queue buffers for DL traffic
214+ * @auto_start: Automatically start (open) this channel
215+ * @wake-capable: Channel capable of waking up the system
216+ */
217+struct mhi_channel_config {
218+ char *name;
219+ u32 num;
220+ u32 num_elements;
221+ u32 local_elements;
222+ u32 event_ring;
223+ enum dma_data_direction dir;
224+ enum mhi_ch_type type;
225+ u32 ee_mask;
226+ u32 pollcfg;
227+ enum mhi_db_brst_mode doorbell;
228+ bool lpm_notify;
229+ bool offload_channel;
230+ bool doorbell_mode_switch;
231+ bool auto_queue;
232+ bool auto_start;
233+ bool wake_capable;
234+};
235+
236+/**
237+ * struct mhi_event_config - Event ring configuration structure for controller
238+ * @num_elements: The number of elements that can be queued to this ring
239+ * @irq_moderation_ms: Delay irq for additional events to be aggregated
240+ * @irq: IRQ associated with this ring
241+ * @channel: Dedicated channel number. U32_MAX indicates a non-dedicated ring
242+ * @priority: Priority of this ring. Use 1 for now
243+ * @mode: Doorbell mode
244+ * @data_type: Type of data this ring will process
245+ * @hardware_event: This ring is associated with hardware channels
246+ * @client_managed: This ring is client managed
247+ * @offload_channel: This ring is associated with an offloaded channel
248+ */
249+struct mhi_event_config {
250+ u32 num_elements;
251+ u32 irq_moderation_ms;
252+ u32 irq;
253+ u32 channel;
254+ u32 priority;
255+ enum mhi_db_brst_mode mode;
256+ enum mhi_er_data_type data_type;
257+ bool hardware_event;
258+ bool client_managed;
259+ bool offload_channel;
260+};
261+
262+/**
263+ * struct mhi_controller_config - Root MHI controller configuration
264+ * @max_channels: Maximum number of channels supported
265+ * @timeout_ms: Timeout value for operations. 0 means use default
266+ * @buf_len: Size of automatically allocated buffers. 0 means use default
267+ * @num_channels: Number of channels defined in @ch_cfg
268+ * @ch_cfg: Array of defined channels
269+ * @num_events: Number of event rings defined in @event_cfg
270+ * @event_cfg: Array of defined event rings
271+ * @use_bounce_buf: Use a bounce buffer pool due to limited DDR access
272+ * @m2_no_db: Host is not allowed to ring DB in M2 state
273+ */
274+struct mhi_controller_config {
275+ u32 max_channels;
276+ u32 timeout_ms;
277+ u32 buf_len;
278+ u32 num_channels;
279+ struct mhi_channel_config *ch_cfg;
280+ u32 num_events;
281+ struct mhi_event_config *event_cfg;
282+ bool use_bounce_buf;
283+ bool m2_no_db;
284+};
285+
286+/**
287+ * struct mhi_controller - Master MHI controller structure
288+ * @cntrl_dev: Pointer to the struct device of physical bus acting as the MHI
289+ * controller (required)
290+ * @mhi_dev: MHI device instance for the controller
291+ * @regs: Base address of MHI MMIO register space (required)
292+ * @bhi: Points to base of MHI BHI register space
293+ * @bhie: Points to base of MHI BHIe register space
294+ * @wake_db: MHI WAKE doorbell register address
295+ * @iova_start: IOMMU starting address for data (required)
296+ * @iova_stop: IOMMU stop address for data (required)
297+ * @fw_image: Firmware image name for normal booting (required)
298+ * @edl_image: Firmware image name for emergency download mode (optional)
299+ * @rddm_size: RAM dump size that host should allocate for debugging purpose
300+ * @sbl_size: SBL image size downloaded through BHIe (optional)
301+ * @seg_len: BHIe vector size (optional)
302+ * @fbc_image: Points to firmware image buffer
303+ * @rddm_image: Points to RAM dump buffer
304+ * @mhi_chan: Points to the channel configuration table
305+ * @lpm_chans: List of channels that require LPM notifications
306+ * @irq: base irq # to request (required)
307+ * @max_chan: Maximum number of channels the controller supports
308+ * @total_ev_rings: Total # of event rings allocated
309+ * @hw_ev_rings: Number of hardware event rings
310+ * @sw_ev_rings: Number of software event rings
311+ * @nr_irqs_req: Number of IRQs required to operate (optional)
312+ * @nr_irqs: Number of IRQ allocated by bus master (required)
313+ * @family_number: MHI controller family number
314+ * @device_number: MHI controller device number
315+ * @major_version: MHI controller major revision number
316+ * @minor_version: MHI controller minor revision number
317+ * @mhi_event: MHI event ring configurations table
318+ * @mhi_cmd: MHI command ring configurations table
319+ * @mhi_ctxt: MHI device context, shared memory between host and device
320+ * @pm_mutex: Mutex for suspend/resume operation
321+ * @pm_lock: Lock for protecting MHI power management state
322+ * @timeout_ms: Timeout in ms for state transitions
323+ * @pm_state: MHI power management state
324+ * @db_access: DB access states
325+ * @ee: MHI device execution environment
326+ * @dev_state: MHI device state
327+ * @dev_wake: Device wakeup count
328+ * @pending_pkts: Pending packets for the controller
329+ * @transition_list: List of MHI state transitions
330+ * @transition_lock: Lock for protecting MHI state transition list
331+ * @wlock: Lock for protecting device wakeup
332+ * @mhi_link_info: Device bandwidth info
333+ * @st_worker: State transition worker
334+ * @fw_worker: Firmware download worker
335+ * @syserr_worker: System error worker
336+ * @state_event: State change event
337+ * @status_cb: CB function to notify power states of the device (required)
338+ * @link_status: CB function to query link status of the device (required)
339+ * @wake_get: CB function to assert device wake (optional)
340+ * @wake_put: CB function to de-assert device wake (optional)
341+ * @wake_toggle: CB function to assert and de-assert device wake (optional)
342+ * @runtime_get: CB function to controller runtime resume (required)
343+ * @runtimet_put: CB function to decrement pm usage (required)
344+ * @map_single: CB function to create TRE buffer
345+ * @unmap_single: CB function to destroy TRE buffer
346+ * @buffer_len: Bounce buffer length
347+ * @bounce_buf: Use of bounce buffer
348+ * @fbc_download: MHI host needs to do complete image transfer (optional)
349+ * @pre_init: MHI host needs to do pre-initialization before power up
350+ * @wake_set: Device wakeup set flag
351+ *
352+ * Fields marked as (required) need to be populated by the controller driver
353+ * before calling mhi_register_controller(). For the fields marked as (optional)
354+ * they can be populated depending on the usecase.
355+ *
356+ * The following fields are present for the purpose of implementing any device
357+ * specific quirks or customizations for specific MHI revisions used in device
358+ * by the controller drivers. The MHI stack will just populate these fields
359+ * during mhi_register_controller():
360+ * family_number
361+ * device_number
362+ * major_version
363+ * minor_version
364+ */
365+struct mhi_controller {
366+ struct device *cntrl_dev;
367+ struct mhi_device *mhi_dev;
368+ void __iomem *regs;
369+ void __iomem *bhi;
370+ void __iomem *bhie;
371+ void __iomem *wake_db;
372+
373+ dma_addr_t iova_start;
374+ dma_addr_t iova_stop;
375+ const char *fw_image;
376+ const char *edl_image;
377+ size_t rddm_size;
378+ size_t sbl_size;
379+ size_t seg_len;
380+ struct image_info *fbc_image;
381+ struct image_info *rddm_image;
382+ struct mhi_chan *mhi_chan;
383+ struct list_head lpm_chans;
384+ int *irq;
385+ u32 max_chan;
386+ u32 total_ev_rings;
387+ u32 hw_ev_rings;
388+ u32 sw_ev_rings;
389+ u32 nr_irqs_req;
390+ u32 nr_irqs;
391+ u32 family_number;
392+ u32 device_number;
393+ u32 major_version;
394+ u32 minor_version;
395+
396+ struct mhi_event *mhi_event;
397+ struct mhi_cmd *mhi_cmd;
398+ struct mhi_ctxt *mhi_ctxt;
399+
400+ struct mutex pm_mutex;
401+ rwlock_t pm_lock;
402+ u32 timeout_ms;
403+ u32 pm_state;
404+ u32 db_access;
405+ enum mhi_ee_type ee;
406+ enum mhi_state dev_state;
407+ atomic_t dev_wake;
408+ atomic_t pending_pkts;
409+ struct list_head transition_list;
410+ spinlock_t transition_lock;
411+ spinlock_t wlock;
412+ struct mhi_link_info mhi_link_info;
413+ struct work_struct st_worker;
414+ struct work_struct fw_worker;
415+ struct work_struct syserr_worker;
416+ wait_queue_head_t state_event;
417+
418+ void (*status_cb)(struct mhi_controller *mhi_cntrl,
419+ enum mhi_callback cb);
420+ int (*link_status)(struct mhi_controller *mhi_cntrl);
421+ void (*wake_get)(struct mhi_controller *mhi_cntrl, bool override);
422+ void (*wake_put)(struct mhi_controller *mhi_cntrl, bool override);
423+ void (*wake_toggle)(struct mhi_controller *mhi_cntrl);
424+ int (*runtime_get)(struct mhi_controller *mhi_cntrl);
425+ void (*runtime_put)(struct mhi_controller *mhi_cntrl);
426+ int (*map_single)(struct mhi_controller *mhi_cntrl,
427+ struct mhi_buf_info *buf);
428+ void (*unmap_single)(struct mhi_controller *mhi_cntrl,
429+ struct mhi_buf_info *buf);
430+
431+ size_t buffer_len;
432+ bool bounce_buf;
433+ bool fbc_download;
434+ bool pre_init;
435+ bool wake_set;
436+};
437+
438+/**
439+ * struct mhi_device - Structure representing a MHI device which binds
440+ * to channels
441+ * @id: Pointer to MHI device ID struct
442+ * @chan_name: Name of the channel to which the device binds
443+ * @mhi_cntrl: Controller the device belongs to
444+ * @ul_chan: UL channel for the device
445+ * @dl_chan: DL channel for the device
446+ * @dev: Driver model device node for the MHI device
447+ * @dev_type: MHI device type
448+ * @ul_chan_id: MHI channel id for UL transfer
449+ * @dl_chan_id: MHI channel id for DL transfer
450+ * @dev_wake: Device wakeup counter
451+ */
452+struct mhi_device {
453+ const struct mhi_device_id *id;
454+ const char *chan_name;
455+ struct mhi_controller *mhi_cntrl;
456+ struct mhi_chan *ul_chan;
457+ struct mhi_chan *dl_chan;
458+ struct device dev;
459+ enum mhi_device_type dev_type;
460+ int ul_chan_id;
461+ int dl_chan_id;
462+ u32 dev_wake;
463+};
464+
465+/**
466+ * struct mhi_result - Completed buffer information
467+ * @buf_addr: Address of data buffer
468+ * @bytes_xferd: # of bytes transferred
469+ * @dir: Channel direction
470+ * @transaction_status: Status of last transaction
471+ */
472+struct mhi_result {
473+ void *buf_addr;
474+ size_t bytes_xferd;
475+ enum dma_data_direction dir;
476+ int transaction_status;
477+};
478+
479+/**
480+ * struct mhi_buf - MHI Buffer description
481+ * @buf: Virtual address of the buffer
482+ * @name: Buffer label. For offload channel, configurations name must be:
483+ * ECA - Event context array data
484+ * CCA - Channel context array data
485+ * @dma_addr: IOMMU address of the buffer
486+ * @len: # of bytes
487+ */
488+struct mhi_buf {
489+ void *buf;
490+ const char *name;
491+ dma_addr_t dma_addr;
492+ size_t len;
493+};
494+
495+/**
496+ * struct mhi_driver - Structure representing a MHI client driver
497+ * @probe: CB function for client driver probe function
498+ * @remove: CB function for client driver remove function
499+ * @ul_xfer_cb: CB function for UL data transfer
500+ * @dl_xfer_cb: CB function for DL data transfer
501+ * @status_cb: CB functions for asynchronous status
502+ * @driver: Device driver model driver
503+ */
504+struct mhi_driver {
505+ const struct mhi_device_id *id_table;
506+ int (*probe)(struct mhi_device *mhi_dev,
507+ const struct mhi_device_id *id);
508+ void (*remove)(struct mhi_device *mhi_dev);
509+ void (*ul_xfer_cb)(struct mhi_device *mhi_dev,
510+ struct mhi_result *result);
511+ void (*dl_xfer_cb)(struct mhi_device *mhi_dev,
512+ struct mhi_result *result);
513+ void (*status_cb)(struct mhi_device *mhi_dev, enum mhi_callback mhi_cb);
514+ struct device_driver driver;
515+};
516+
517+#define to_mhi_driver(drv) container_of(drv, struct mhi_driver, driver)
518+#define to_mhi_device(dev) container_of(dev, struct mhi_device, dev)
519+
520+/**
521+ * mhi_register_controller - Register MHI controller
522+ * @mhi_cntrl: MHI controller to register
523+ * @config: Configuration to use for the controller
524+ */
525+int mhi_register_controller(struct mhi_controller *mhi_cntrl,
526+ struct mhi_controller_config *config);
527+
528+/**
529+ * mhi_unregister_controller - Unregister MHI controller
530+ * @mhi_cntrl: MHI controller to unregister
531+ */
532+void mhi_unregister_controller(struct mhi_controller *mhi_cntrl);
533+
534+/*
535+ * module_mhi_driver() - Helper macro for drivers that don't do
536+ * anything special other than using default mhi_driver_register() and
537+ * mhi_driver_unregister(). This eliminates a lot of boilerplate.
538+ * Each module may only use this macro once.
539+ */
540+#define module_mhi_driver(mhi_drv) \
541+ module_driver(mhi_drv, mhi_driver_register, \
542+ mhi_driver_unregister)
543+
544+/*
545+ * Macro to avoid include chaining to get THIS_MODULE
546+ */
547+#define mhi_driver_register(mhi_drv) \
548+ __mhi_driver_register(mhi_drv, THIS_MODULE)
549+
550+/**
551+ * __mhi_driver_register - Register driver with MHI framework
552+ * @mhi_drv: Driver associated with the device
553+ * @owner: The module owner
554+ */
555+int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner);
556+
557+/**
558+ * mhi_driver_unregister - Unregister a driver for mhi_devices
559+ * @mhi_drv: Driver associated with the device
560+ */
561+void mhi_driver_unregister(struct mhi_driver *mhi_drv);
562+
563+/**
564+ * mhi_set_mhi_state - Set MHI device state
565+ * @mhi_cntrl: MHI controller
566+ * @state: State to set
567+ */
568+void mhi_set_mhi_state(struct mhi_controller *mhi_cntrl,
569+ enum mhi_state state);
570+
571+/**
572+ * mhi_prepare_for_power_up - Do pre-initialization before power up.
573+ * This is optional, call this before power up if
574+ * the controller does not want bus framework to
575+ * automatically free any allocated memory during
576+ * shutdown process.
577+ * @mhi_cntrl: MHI controller
578+ */
579+int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl);
580+
581+/**
582+ * mhi_async_power_up - Start MHI power up sequence
583+ * @mhi_cntrl: MHI controller
584+ */
585+int mhi_async_power_up(struct mhi_controller *mhi_cntrl);
586+
587+/**
588+ * mhi_sync_power_up - Start MHI power up sequence and wait till the device
589+ * device enters valid EE state
590+ * @mhi_cntrl: MHI controller
591+ */
592+int mhi_sync_power_up(struct mhi_controller *mhi_cntrl);
593+
594+/**
595+ * mhi_power_down - Start MHI power down sequence
596+ * @mhi_cntrl: MHI controller
597+ * @graceful: Link is still accessible, so do a graceful shutdown process
598+ */
599+void mhi_power_down(struct mhi_controller *mhi_cntrl, bool graceful);
600+
601+/**
602+ * mhi_unprepare_after_power_down - Free any allocated memory after power down
603+ * @mhi_cntrl: MHI controller
604+ */
605+void mhi_unprepare_after_power_down(struct mhi_controller *mhi_cntrl);
606+
607+/**
608+ * mhi_download_rddm_img - Download ramdump image from device for
609+ * debugging purpose.
610+ * @mhi_cntrl: MHI controller
611+ * @in_panic: Download rddm image during kernel panic
612+ */
613+int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic);
614+
615+/**
616+ * mhi_force_rddm_mode - Force device into rddm mode
617+ * @mhi_cntrl: MHI controller
618+ */
619+int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl);
620+
621+/**
622+ * mhi_get_mhi_state - Get MHI state of the device
623+ * @mhi_cntrl: MHI controller
624+ */
625+enum mhi_state mhi_get_mhi_state(struct mhi_controller *mhi_cntrl);
626+
627+/**
628+ * mhi_device_get - Disable device low power mode
629+ * @mhi_dev: Device associated with the channel
630+ */
631+void mhi_device_get(struct mhi_device *mhi_dev);
632+
633+/**
634+ * mhi_device_get_sync - Disable device low power mode. Synchronously
635+ * take the controller out of suspended state
636+ * @mhi_dev: Device associated with the channel
637+ */
638+int mhi_device_get_sync(struct mhi_device *mhi_dev);
639+
640+/**
641+ * mhi_device_put - Re-enable device low power mode
642+ * @mhi_dev: Device associated with the channel
643+ */
644+void mhi_device_put(struct mhi_device *mhi_dev);
645+
646+/**
647+ * mhi_prepare_for_transfer - Setup channel for data transfer
648+ * @mhi_dev: Device associated with the channels
649+ */
650+int mhi_prepare_for_transfer(struct mhi_device *mhi_dev);
651+
652+/**
653+ * mhi_unprepare_from_transfer - Unprepare the channels
654+ * @mhi_dev: Device associated with the channels
655+ */
656+void mhi_unprepare_from_transfer(struct mhi_device *mhi_dev);
657+
658+/**
659+ * mhi_poll - Poll for any available data in DL direction
660+ * @mhi_dev: Device associated with the channels
661+ * @budget: # of events to process
662+ */
663+int mhi_poll(struct mhi_device *mhi_dev, u32 budget);
664+
665+/**
666+ * mhi_queue_dma - Send or receive DMA mapped buffers from client device
667+ * over MHI channel
668+ * @mhi_dev: Device associated with the channels
669+ * @dir: DMA direction for the channel
670+ * @mhi_buf: Buffer for holding the DMA mapped data
671+ * @len: Buffer length
672+ * @mflags: MHI transfer flags used for the transfer
673+ */
674+int mhi_queue_dma(struct mhi_device *mhi_dev, enum dma_data_direction dir,
675+ struct mhi_buf *mhi_buf, size_t len, enum mhi_flags mflags);
676+
677+/**
678+ * mhi_queue_buf - Send or receive raw buffers from client device over MHI
679+ * channel
680+ * @mhi_dev: Device associated with the channels
681+ * @dir: DMA direction for the channel
682+ * @buf: Buffer for holding the data
683+ * @len: Buffer length
684+ * @mflags: MHI transfer flags used for the transfer
685+ */
686+int mhi_queue_buf(struct mhi_device *mhi_dev, enum dma_data_direction dir,
687+ void *buf, size_t len, enum mhi_flags mflags);
688+
689+/**
690+ * mhi_queue_skb - Send or receive SKBs from client device over MHI channel
691+ * @mhi_dev: Device associated with the channels
692+ * @dir: DMA direction for the channel
693+ * @skb: Buffer for holding SKBs
694+ * @len: Buffer length
695+ * @mflags: MHI transfer flags used for the transfer
696+ */
697+int mhi_queue_skb(struct mhi_device *mhi_dev, enum dma_data_direction dir,
698+ struct sk_buff *skb, size_t len, enum mhi_flags mflags);
699+
700+#endif /* _MHI_H_ */
include/linux/migrate.h+8−0
@@ -196,6 +196,14 @@ struct migrate_vma { · 195 unmodified lines
196196 unsigned long npages;
197197 unsigned long start;
198198 unsigned long end;
199+
200+ /*
201+ * Set to the owner value also stored in page->pgmap->owner for
202+ * migrating out of device private memory. If set only device
203+ * private pages with this owner are migrated. If not set
204+ * device private pages are not migrated at all.
205+ */
206+ void *src_owner;
199207 };
200208
201209 int migrate_vma_setup(struct migrate_vma *args);
include/linux/mii.h+39−18
@@ -354,24 +354,6 @@ static inline u32 mii_adv_to_ethtool_adv_x(u32 adv) · 353 unmodified lines
354354 return result;
355355 }
356356
357−/**
358− * mii_lpa_to_ethtool_lpa_x
359− * @adv: value of the MII_LPA register
360− *
361− * A small helper function that translates MII_LPA
362− * bits, when in 1000Base-X mode, to ethtool
363− * LP advertisement settings.
364− */
365−static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa)
366−{
367− u32 result = 0;
368−
369− if (lpa & LPA_LPACK)
370− result |= ADVERTISED_Autoneg;
371−
372− return result | mii_adv_to_ethtool_adv_x(lpa);
373−}
374−
375357 /**
376358 * mii_lpa_mod_linkmode_adv_sgmii
377359 * @lp_advertising: pointer to destination link mode.
@@ -535,6 +517,45 @@ static inline u32 linkmode_adv_to_lcl_adv_t(unsigned long *advertising) · 157 unmodified lines
535517 return lcl_adv;
536518 }
537519
520+/**
521+ * mii_lpa_mod_linkmode_x - decode the link partner's config_reg to linkmodes
522+ * @linkmodes: link modes array
523+ * @lpa: config_reg word from link partner
524+ * @fd_bit: link mode for 1000XFULL bit
525+ */
526+static inline void mii_lpa_mod_linkmode_x(unsigned long *linkmodes, u16 lpa,
527+ int fd_bit)
528+{
529+ linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, linkmodes,
530+ lpa & LPA_LPACK);
531+ linkmode_mod_bit(ETHTOOL_LINK_MODE_Pause_BIT, linkmodes,
532+ lpa & LPA_1000XPAUSE);
533+ linkmode_mod_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, linkmodes,
534+ lpa & LPA_1000XPAUSE_ASYM);
535+ linkmode_mod_bit(fd_bit, linkmodes,
536+ lpa & LPA_1000XFULL);
537+}
538+
539+/**
540+ * linkmode_adv_to_mii_adv_x - encode a linkmode to config_reg
541+ * @linkmodes: linkmodes
542+ * @fd_bit: full duplex bit
543+ */
544+static inline u16 linkmode_adv_to_mii_adv_x(const unsigned long *linkmodes,
545+ int fd_bit)
546+{
547+ u16 adv = 0;
548+
549+ if (linkmode_test_bit(fd_bit, linkmodes))
550+ adv |= ADVERTISE_1000XFULL;
551+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, linkmodes))
552+ adv |= ADVERTISE_1000XPAUSE;
553+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, linkmodes))
554+ adv |= ADVERTISE_1000XPSE_ASYM;
555+
556+ return adv;
557+}
558+
538559 /**
539560 * mii_advertise_flowctrl - get flow control advertisement flags
540561 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
include/linux/min_heap.h+134−0
@@ -0,0 +1,134 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_MIN_HEAP_H
3+#define _LINUX_MIN_HEAP_H
4+
5+#include <linux/bug.h>
6+#include <linux/string.h>
7+#include <linux/types.h>
8+
9+/**
10+ * struct min_heap - Data structure to hold a min-heap.
11+ * @data: Start of array holding the heap elements.
12+ * @nr: Number of elements currently in the heap.
13+ * @size: Maximum number of elements that can be held in current storage.
14+ */
15+struct min_heap {
16+ void *data;
17+ int nr;
18+ int size;
19+};
20+
21+/**
22+ * struct min_heap_callbacks - Data/functions to customise the min_heap.
23+ * @elem_size: The nr of each element in bytes.
24+ * @less: Partial order function for this heap.
25+ * @swp: Swap elements function.
26+ */
27+struct min_heap_callbacks {
28+ int elem_size;
29+ bool (*less)(const void *lhs, const void *rhs);
30+ void (*swp)(void *lhs, void *rhs);
31+};
32+
33+/* Sift the element at pos down the heap. */
34+static __always_inline
35+void min_heapify(struct min_heap *heap, int pos,
36+ const struct min_heap_callbacks *func)
37+{
38+ void *left, *right, *parent, *smallest;
39+ void *data = heap->data;
40+
41+ for (;;) {
42+ if (pos * 2 + 1 >= heap->nr)
43+ break;
44+
45+ left = data + ((pos * 2 + 1) * func->elem_size);
46+ parent = data + (pos * func->elem_size);
47+ smallest = parent;
48+ if (func->less(left, smallest))
49+ smallest = left;
50+
51+ if (pos * 2 + 2 < heap->nr) {
52+ right = data + ((pos * 2 + 2) * func->elem_size);
53+ if (func->less(right, smallest))
54+ smallest = right;
55+ }
56+ if (smallest == parent)
57+ break;
58+ func->swp(smallest, parent);
59+ if (smallest == left)
60+ pos = (pos * 2) + 1;
61+ else
62+ pos = (pos * 2) + 2;
63+ }
64+}
65+
66+/* Floyd's approach to heapification that is O(nr). */
67+static __always_inline
68+void min_heapify_all(struct min_heap *heap,
69+ const struct min_heap_callbacks *func)
70+{
71+ int i;
72+
73+ for (i = heap->nr / 2; i >= 0; i--)
74+ min_heapify(heap, i, func);
75+}
76+
77+/* Remove minimum element from the heap, O(log2(nr)). */
78+static __always_inline
79+void min_heap_pop(struct min_heap *heap,
80+ const struct min_heap_callbacks *func)
81+{
82+ void *data = heap->data;
83+
84+ if (WARN_ONCE(heap->nr <= 0, "Popping an empty heap"))
85+ return;
86+
87+ /* Place last element at the root (position 0) and then sift down. */
88+ heap->nr--;
89+ memcpy(data, data + (heap->nr * func->elem_size), func->elem_size);
90+ min_heapify(heap, 0, func);
91+}
92+
93+/*
94+ * Remove the minimum element and then push the given element. The
95+ * implementation performs 1 sift (O(log2(nr))) and is therefore more
96+ * efficient than a pop followed by a push that does 2.
97+ */
98+static __always_inline
99+void min_heap_pop_push(struct min_heap *heap,
100+ const void *element,
101+ const struct min_heap_callbacks *func)
102+{
103+ memcpy(heap->data, element, func->elem_size);
104+ min_heapify(heap, 0, func);
105+}
106+
107+/* Push an element on to the heap, O(log2(nr)). */
108+static __always_inline
109+void min_heap_push(struct min_heap *heap, const void *element,
110+ const struct min_heap_callbacks *func)
111+{
112+ void *data = heap->data;
113+ void *child, *parent;
114+ int pos;
115+
116+ if (WARN_ONCE(heap->nr >= heap->size, "Pushing on a full heap"))
117+ return;
118+
119+ /* Place at the end of data. */
120+ pos = heap->nr;
121+ memcpy(data + (pos * func->elem_size), element, func->elem_size);
122+ heap->nr++;
123+
124+ /* Sift child at pos up. */
125+ for (; pos > 0; pos = (pos - 1) / 2) {
126+ child = data + (pos * func->elem_size);
127+ parent = data + ((pos - 1) / 2) * func->elem_size;
128+ if (func->less(parent, child))
129+ break;
130+ func->swp(parent, child);
131+ }
132+}
133+
134+#endif /* _LINUX_MIN_HEAP_H */
include/linux/miscdevice.h+13−1
@@ -25,20 +25,31 @@ · 24 unmodified lines
2525 #define TEMP_MINOR 131 /* Temperature Sensor */
2626 #define APM_MINOR_DEV 134
2727 #define RTC_MINOR 135
28−#define EFI_RTC_MINOR 136 /* EFI Time services */
28+/*#define EFI_RTC_MINOR 136 was EFI Time services */
2929 #define VHCI_MINOR 137
3030 #define SUN_OPENPROM_MINOR 139
3131 #define DMAPI_MINOR 140 /* unused */
3232 #define NVRAM_MINOR 144
33+#define SBUS_FLASH_MINOR 152
3334 #define SGI_MMTIMER 153
35+#define PMU_MINOR 154
3436 #define STORE_QUEUE_MINOR 155 /* unused */
37+#define LCD_MINOR 156
38+#define AC_MINOR 157
39+#define BUTTON_MINOR 158 /* Major 10, Minor 158, /dev/nwbutton */
40+#define NWFLASH_MINOR 160 /* MAJOR is 10 - miscdevice */
41+#define ENVCTRL_MINOR 162
3542 #define I2O_MINOR 166
43+#define UCTRL_MINOR 174
3644 #define AGPGART_MINOR 175
45+#define TOSH_MINOR_DEV 181
3746 #define HWRNG_MINOR 183
3847 #define MICROCODE_MINOR 184
48+#define KEYPAD_MINOR 185
3949 #define IRNET_MINOR 187
4050 #define D7S_MINOR 193
4151 #define VFIO_MINOR 196
52+#define PXA3XX_GCU_MINOR 197
4253 #define TUN_MINOR 200
4354 #define CUSE_MINOR 203
4455 #define MWAVE_MINOR 219 /* ACP/Mwave Modem */
@@ -49,6 +60,7 @@ · 4 unmodified lines
4960 #define MISC_MCELOG_MINOR 227
5061 #define HPET_MINOR 228
5162 #define FUSE_MINOR 229
63+#define SNAPSHOT_MINOR 231
5264 #define KVM_MINOR 232
5365 #define BTRFS_MINOR 234
5466 #define AUTOFS_MINOR 235
include/linux/mlx5/device.h+6−0
@@ -1211,6 +1211,12 @@ enum mlx5_qcam_feature_groups { · 1210 unmodified lines
12111211 #define MLX5_CAP_FLOWTABLE_RDMA_RX_MAX(mdev, cap) \
12121212 MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive_rdma.cap)
12131213
1214+#define MLX5_CAP_FLOWTABLE_RDMA_TX(mdev, cap) \
1215+ MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_transmit_rdma.cap)
1216+
1217+#define MLX5_CAP_FLOWTABLE_RDMA_TX_MAX(mdev, cap) \
1218+ MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_transmit_rdma.cap)
1219+
12141220 #define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \
12151221 MLX5_GET(flow_table_eswitch_cap, \
12161222 mdev->caps.hca_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
include/linux/mlx5/driver.h+9−30
@@ -213,23 +213,6 @@ enum mlx5_port_status { · 212 unmodified lines
213213 MLX5_PORT_DOWN = 2,
214214 };
215215
216−struct mlx5_bfreg_info {
217− u32 *sys_pages;
218− int num_low_latency_bfregs;
219− unsigned int *count;
220−
221− /*
222− * protect bfreg allocation data structs
223− */
224− struct mutex lock;
225− u32 ver;
226− bool lib_uar_4k;
227− u32 num_sys_pages;
228− u32 num_static_sys_pages;
229− u32 total_num_bfregs;
230− u32 num_dyn_bfregs;
231−};
232−
233216 struct mlx5_cmd_first {
234217 __be32 data[4];
235218 };
@@ -518,9 +501,11 @@ struct mlx5_rate_limit { · 282 unmodified lines
518501 };
519502
520503 struct mlx5_rl_entry {
521− struct mlx5_rate_limit rl;
522− u16 index;
523− u16 refcount;
504+ u8 rl_raw[MLX5_ST_SZ_BYTES(set_pp_rate_limit_context)];
505+ u16 index;
506+ u64 refcount;
507+ u16 uid;
508+ u8 dedicated : 1;
524509 };
525510
526511 struct mlx5_rl_table {
@@ -573,10 +558,6 @@ struct mlx5_priv { · 46 unmodified lines
573558 /* end: alloc staff */
574559 struct dentry *dbg_root;
575560
576− /* protect mkey key part */
577− spinlock_t mkey_lock;
578− u8 mkey_key;
579−
580561 struct list_head dev_list;
581562 struct list_head ctx_list;
582563 spinlock_t ctx_lock;
@@ -722,6 +703,7 @@ struct mlx5_core_dev { · 139 unmodified lines
722703 struct mlx5_clock clock;
723704 struct mlx5_ib_clock_info *clock_info;
724705 struct mlx5_fw_tracer *tracer;
706+ struct mlx5_rsc_dump *rsc_dump;
725707 u32 vsc_addr;
726708 struct mlx5_hv_vhca *hv_vhca;
727709 };
@@ -945,12 +927,6 @@ struct mlx5_cmd_mailbox *mlx5_alloc_cmd_mailbox_chain(struct mlx5_core_dev *dev, · 217 unmodified lines
945927 gfp_t flags, int npages);
946928 void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev,
947929 struct mlx5_cmd_mailbox *head);
948−int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,
949− struct mlx5_core_mkey *mkey,
950− struct mlx5_async_ctx *async_ctx, u32 *in,
951− int inlen, u32 *out, int outlen,
952− mlx5_async_cbk_t callback,
953− struct mlx5_async_work *context);
954930 int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
955931 struct mlx5_core_mkey *mkey,
956932 u32 *in, int inlen);
@@ -1007,6 +983,9 @@ int mlx5_rl_add_rate(struct mlx5_core_dev *dev, u16 *index, · 50 unmodified lines
1007983 struct mlx5_rate_limit *rl);
1008984 void mlx5_rl_remove_rate(struct mlx5_core_dev *dev, struct mlx5_rate_limit *rl);
1009985 bool mlx5_rl_is_in_range(struct mlx5_core_dev *dev, u32 rate);
986+int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid,
987+ bool dedicated_entry, u16 *index);
988+void mlx5_rl_remove_rate_raw(struct mlx5_core_dev *dev, u16 index);
1010989 bool mlx5_rl_are_equal(struct mlx5_rate_limit *rl_0,
1011990 struct mlx5_rate_limit *rl_1);
1012991 int mlx5_alloc_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg,
include/linux/mlx5/eswitch.h+36−2
@@ -70,8 +70,30 @@ u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev); · 69 unmodified lines
7070 enum devlink_eswitch_encap_mode
7171 mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev);
7272
73+bool mlx5_eswitch_reg_c1_loopback_enabled(const struct mlx5_eswitch *esw);
7374 bool mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw);
74−u32 mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw,
75+
76+/* Reg C0 usage:
77+ * Reg C0 = < ESW_VHCA_ID_BITS(8) | ESW_VPORT BITS(8) | ESW_CHAIN_TAG(16) >
78+ *
79+ * Highest 8 bits of the reg c0 is the vhca_id, next 8 bits is vport_num,
80+ * the rest (lowest 16 bits) is left for tc chain tag restoration.
81+ * VHCA_ID + VPORT comprise the SOURCE_PORT matching.
82+ */
83+#define ESW_VHCA_ID_BITS 8
84+#define ESW_VPORT_BITS 8
85+#define ESW_SOURCE_PORT_METADATA_BITS (ESW_VHCA_ID_BITS + ESW_VPORT_BITS)
86+#define ESW_SOURCE_PORT_METADATA_OFFSET (32 - ESW_SOURCE_PORT_METADATA_BITS)
87+#define ESW_CHAIN_TAG_METADATA_BITS (32 - ESW_SOURCE_PORT_METADATA_BITS)
88+#define ESW_CHAIN_TAG_METADATA_MASK GENMASK(ESW_CHAIN_TAG_METADATA_BITS - 1,\
89+ 0)
90+
91+static inline u32 mlx5_eswitch_get_vport_metadata_mask(void)
92+{
93+ return GENMASK(31, 32 - ESW_SOURCE_PORT_METADATA_BITS);
94+}
95+
96+u32 mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw,
7597 u16 vport_num);
7698 u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw);
7799 #else /* CONFIG_MLX5_ESWITCH */
@@ -87,6 +109,12 @@ mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev) · 9 unmodified lines
87109 return DEVLINK_ESWITCH_ENCAP_MODE_NONE;
88110 }
89111
112+static inline bool
113+mlx5_eswitch_reg_c1_loopback_enabled(const struct mlx5_eswitch *esw)
114+{
115+ return false;
116+};
117+
90118 static inline bool
91119 mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw)
92120 {
@@ -94,11 +122,17 @@ mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw) · 1 unmodified line
94122 };
95123
96124 static inline u32
97−mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw,
125+mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw,
98126 int vport_num)
99127 {
100128 return 0;
101129 };
130+
131+static inline u32
132+mlx5_eswitch_get_vport_metadata_mask(void)
133+{
134+ return 0;
135+}
102136 #endif /* CONFIG_MLX5_ESWITCH */
103137
104138 #endif
include/linux/mlx5/fs.h+2−0
@@ -77,6 +77,7 @@ enum mlx5_flow_namespace_type { · 76 unmodified lines
7777 MLX5_FLOW_NAMESPACE_EGRESS,
7878 MLX5_FLOW_NAMESPACE_RDMA_RX,
7979 MLX5_FLOW_NAMESPACE_RDMA_RX_KERNEL,
80+ MLX5_FLOW_NAMESPACE_RDMA_TX,
8081 };
8182
8283 enum {
@@ -84,6 +85,7 @@ enum { · 1 unmodified line
8485 FDB_TC_OFFLOAD,
8586 FDB_FT_OFFLOAD,
8687 FDB_SLOW_PATH,
88+ FDB_PER_VPORT,
8789 };
8890
8991 struct mlx5_pkt_reformat;
include/linux/mlx5/mlx5_ifc.h+31−17
@@ -414,8 +414,10 @@ struct mlx5_ifc_flow_table_prop_layout_bits { · 413 unmodified lines
414414 u8 reserved_at_16[0x1];
415415 u8 table_miss_action_domain[0x1];
416416 u8 termination_table[0x1];
417− u8 reserved_at_19[0x7];
418− u8 reserved_at_20[0x2];
417+ u8 reformat_and_fwd_to_table[0x1];
418+ u8 reserved_at_1a[0x6];
419+ u8 termination_table_raw_traffic[0x1];
420+ u8 reserved_at_21[0x1];
419421 u8 log_max_ft_size[0x6];
420422 u8 log_max_modify_header_context[0x8];
421423 u8 max_modify_header_actions[0x8];
@@ -707,7 +709,7 @@ struct mlx5_ifc_flow_table_nic_cap_bits { · 285 unmodified lines
707709
708710 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit;
709711
710− u8 reserved_at_a00[0x200];
712+ struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit_rdma;
711713
712714 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit_sniffer;
713715
@@ -741,7 +743,7 @@ struct mlx5_ifc_flow_table_eswitch_cap_bits { · 27 unmodified lines
741743 u8 flow_source[0x1];
742744 u8 reserved_at_18[0x2];
743745 u8 multi_fdb_encap[0x1];
744− u8 reserved_at_1b[0x1];
746+ u8 egress_acl_forward_to_vport[0x1];
745747 u8 fdb_multi_path_to_table[0x1];
746748 u8 reserved_at_1d[0x3];
747749
@@ -813,7 +815,9 @@ struct mlx5_ifc_qos_cap_bits { · 65 unmodified lines
813815 u8 reserved_at_4[0x1];
814816 u8 packet_pacing_burst_bound[0x1];
815817 u8 packet_pacing_typical_size[0x1];
816− u8 reserved_at_7[0x19];
818+ u8 reserved_at_7[0x4];
819+ u8 packet_pacing_uid[0x1];
820+ u8 reserved_at_c[0x14];
817821
818822 u8 reserved_at_20[0x20];
819823
@@ -875,7 +879,11 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits { · 55 unmodified lines
875879 u8 swp_csum[0x1];
876880 u8 swp_lso[0x1];
877881 u8 cqe_checksum_full[0x1];
878− u8 reserved_at_24[0x5];
882+ u8 tunnel_stateless_geneve_tx[0x1];
883+ u8 tunnel_stateless_mpls_over_udp[0x1];
884+ u8 tunnel_stateless_mpls_over_gre[0x1];
885+ u8 tunnel_stateless_vxlan_gpe[0x1];
886+ u8 tunnel_stateless_ipv4_over_vxlan[0x1];
879887 u8 tunnel_stateless_ip_over_ip[0x1];
880888 u8 reserved_at_2a[0x6];
881889 u8 max_vxlan_udp_ports[0x8];
@@ -8265,9 +8273,20 @@ struct mlx5_ifc_set_pp_rate_limit_out_bits { · 7383 unmodified lines
82658273 u8 reserved_at_40[0x40];
82668274 };
82678275
8276+struct mlx5_ifc_set_pp_rate_limit_context_bits {
8277+ u8 rate_limit[0x20];
8278+
8279+ u8 burst_upper_bound[0x20];
8280+
8281+ u8 reserved_at_40[0x10];
8282+ u8 typical_packet_size[0x10];
8283+
8284+ u8 reserved_at_60[0x120];
8285+};
8286+
82688287 struct mlx5_ifc_set_pp_rate_limit_in_bits {
82698288 u8 opcode[0x10];
8270− u8 reserved_at_10[0x10];
8289+ u8 uid[0x10];
82718290
82728291 u8 reserved_at_20[0x10];
82738292 u8 op_mod[0x10];
@@ -8277,14 +8296,7 @@ struct mlx5_ifc_set_pp_rate_limit_in_bits { · 3 unmodified lines
82778296
82788297 u8 reserved_at_60[0x20];
82798298
8280− u8 rate_limit[0x20];
8281−
8282− u8 burst_upper_bound[0x20];
8283−
8284− u8 reserved_at_c0[0x10];
8285− u8 typical_packet_size[0x10];
8286−
8287− u8 reserved_at_e0[0x120];
8299+ struct mlx5_ifc_set_pp_rate_limit_context_bits ctx;
82888300 };
82898301
82908302 struct mlx5_ifc_access_register_out_bits {
@@ -8420,7 +8432,8 @@ struct mlx5_ifc_ptys_reg_bits { · 129 unmodified lines
84208432 u8 proto_mask[0x3];
84218433
84228434 u8 an_status[0x4];
8423− u8 reserved_at_24[0x1c];
8435+ u8 reserved_at_24[0xc];
8436+ u8 data_rate_oper[0x10];
84248437
84258438 u8 ext_eth_proto_capability[0x20];
84268439
@@ -10486,7 +10499,8 @@ enum { · 2059 unmodified lines
1048610499 };
1048710500
1048810501 enum {
10489− MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_DEK = 0x1,
10502+ MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_TLS = 0x1,
10503+ MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_IPSEC = 0x2,
1049010504 };
1049110505
1049210506 struct mlx5_ifc_tls_static_params_bits {
include/linux/mlx5/mlx5_ifc_fpga.h+1−1
@@ -608,7 +608,7 @@ struct mlx5_ifc_tls_cmd_bits { · 607 unmodified lines
608608 struct mlx5_ifc_tls_resp_bits {
609609 u8 syndrome[0x20];
610610 u8 stream_id[0x20];
611− u8 reserverd[0x40];
611+ u8 reserved[0x40];
612612 };
613613
614614 #define MLX5_TLS_COMMAND_SIZE (0x100)
include/linux/mm.h+266−47
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/memremap.h>
2828 #include <linux/overflow.h>
2929 #include <linux/sizes.h>
30+#include <linux/sched.h>
3031
3132 struct mempolicy;
3233 struct anon_vma;
@@ -342,6 +343,20 @@ extern unsigned int kobjsize(const void *objp); · 309 unmodified lines
342343 /* Bits set in the VMA until the stack is in its final location */
343344 #define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ)
344345
346+#define TASK_EXEC ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0)
347+
348+/* Common data flag combinations */
349+#define VM_DATA_FLAGS_TSK_EXEC (VM_READ | VM_WRITE | TASK_EXEC | \
350+ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
351+#define VM_DATA_FLAGS_NON_EXEC (VM_READ | VM_WRITE | VM_MAYREAD | \
352+ VM_MAYWRITE | VM_MAYEXEC)
353+#define VM_DATA_FLAGS_EXEC (VM_READ | VM_WRITE | VM_EXEC | \
354+ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
355+
356+#ifndef VM_DATA_DEFAULT_FLAGS /* arch can override this */
357+#define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_EXEC
358+#endif
359+
345360 #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
346361 #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
347362 #endif
@@ -354,12 +369,18 @@ extern unsigned int kobjsize(const void *objp); · 6 unmodified lines
354369
355370 #define VM_STACK_FLAGS (VM_STACK | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
356371
372+/* VMA basic access permission flags */
373+#define VM_ACCESS_FLAGS (VM_READ | VM_WRITE | VM_EXEC)
374+
375+
357376 /*
358377 * Special vmas that are non-mergable, non-mlock()able.
359− * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
360378 */
361379 #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP)
362380
381+/* This mask prevents VMA from being scanned with khugepaged */
382+#define VM_NO_KHUGEPAGED (VM_SPECIAL | VM_HUGETLB)
383+
363384 /* This mask defines which mm->def_flags a process can inherit its parent */
364385 #define VM_INIT_DEF_MASK VM_NOHUGEPAGE
365386
@@ -378,15 +399,75 @@ extern unsigned int kobjsize(const void *objp); · 12 unmodified lines
378399 */
379400 extern pgprot_t protection_map[16];
380401
381−#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
382−#define FAULT_FLAG_MKWRITE 0x02 /* Fault was mkwrite of existing pte */
383−#define FAULT_FLAG_ALLOW_RETRY 0x04 /* Retry fault if blocking */
384−#define FAULT_FLAG_RETRY_NOWAIT 0x08 /* Don't drop mmap_sem and wait when retrying */
385−#define FAULT_FLAG_KILLABLE 0x10 /* The fault task is in SIGKILL killable region */
386−#define FAULT_FLAG_TRIED 0x20 /* Second try */
387−#define FAULT_FLAG_USER 0x40 /* The fault originated in userspace */
388−#define FAULT_FLAG_REMOTE 0x80 /* faulting for non current tsk/mm */
389−#define FAULT_FLAG_INSTRUCTION 0x100 /* The fault was during an instruction fetch */
402+/**
403+ * Fault flag definitions.
404+ *
405+ * @FAULT_FLAG_WRITE: Fault was a write fault.
406+ * @FAULT_FLAG_MKWRITE: Fault was mkwrite of existing PTE.
407+ * @FAULT_FLAG_ALLOW_RETRY: Allow to retry the fault if blocked.
408+ * @FAULT_FLAG_RETRY_NOWAIT: Don't drop mmap_sem and wait when retrying.
409+ * @FAULT_FLAG_KILLABLE: The fault task is in SIGKILL killable region.
410+ * @FAULT_FLAG_TRIED: The fault has been tried once.
411+ * @FAULT_FLAG_USER: The fault originated in userspace.
412+ * @FAULT_FLAG_REMOTE: The fault is not for current task/mm.
413+ * @FAULT_FLAG_INSTRUCTION: The fault was during an instruction fetch.
414+ * @FAULT_FLAG_INTERRUPTIBLE: The fault can be interrupted by non-fatal signals.
415+ *
416+ * About @FAULT_FLAG_ALLOW_RETRY and @FAULT_FLAG_TRIED: we can specify
417+ * whether we would allow page faults to retry by specifying these two
418+ * fault flags correctly. Currently there can be three legal combinations:
419+ *
420+ * (a) ALLOW_RETRY and !TRIED: this means the page fault allows retry, and
421+ * this is the first try
422+ *
423+ * (b) ALLOW_RETRY and TRIED: this means the page fault allows retry, and
424+ * we've already tried at least once
425+ *
426+ * (c) !ALLOW_RETRY and !TRIED: this means the page fault does not allow retry
427+ *
428+ * The unlisted combination (!ALLOW_RETRY && TRIED) is illegal and should never
429+ * be used. Note that page faults can be allowed to retry for multiple times,
430+ * in which case we'll have an initial fault with flags (a) then later on
431+ * continuous faults with flags (b). We should always try to detect pending
432+ * signals before a retry to make sure the continuous page faults can still be
433+ * interrupted if necessary.
434+ */
435+#define FAULT_FLAG_WRITE 0x01
436+#define FAULT_FLAG_MKWRITE 0x02
437+#define FAULT_FLAG_ALLOW_RETRY 0x04
438+#define FAULT_FLAG_RETRY_NOWAIT 0x08
439+#define FAULT_FLAG_KILLABLE 0x10
440+#define FAULT_FLAG_TRIED 0x20
441+#define FAULT_FLAG_USER 0x40
442+#define FAULT_FLAG_REMOTE 0x80
443+#define FAULT_FLAG_INSTRUCTION 0x100
444+#define FAULT_FLAG_INTERRUPTIBLE 0x200
445+
446+/*
447+ * The default fault flags that should be used by most of the
448+ * arch-specific page fault handlers.
449+ */
450+#define FAULT_FLAG_DEFAULT (FAULT_FLAG_ALLOW_RETRY | \
451+ FAULT_FLAG_KILLABLE | \
452+ FAULT_FLAG_INTERRUPTIBLE)
453+
454+/**
455+ * fault_flag_allow_retry_first - check ALLOW_RETRY the first time
456+ *
457+ * This is mostly used for places where we want to try to avoid taking
458+ * the mmap_sem for too long a time when waiting for another condition
459+ * to change, in which case we can try to be polite to release the
460+ * mmap_sem in the first round to avoid potential starvation of other
461+ * processes that would also want the mmap_sem.
462+ *
463+ * Return: true if the page fault allows retry and this is the first
464+ * attempt of the fault handling; false otherwise.
465+ */
466+static inline bool fault_flag_allow_retry_first(unsigned int flags)
467+{
468+ return (flags & FAULT_FLAG_ALLOW_RETRY) &&
469+ (!(flags & FAULT_FLAG_TRIED));
470+}
390471
391472 #define FAULT_FLAG_TRACE \
392473 { FAULT_FLAG_WRITE, "WRITE" }, \
@@ -397,7 +478,8 @@ extern pgprot_t protection_map[16]; · 4 unmodified lines
397478 { FAULT_FLAG_TRIED, "TRIED" }, \
398479 { FAULT_FLAG_USER, "USER" }, \
399480 { FAULT_FLAG_REMOTE, "REMOTE" }, \
400− { FAULT_FLAG_INSTRUCTION, "INSTRUCTION" }
481+ { FAULT_FLAG_INSTRUCTION, "INSTRUCTION" }, \
482+ { FAULT_FLAG_INTERRUPTIBLE, "INTERRUPTIBLE" }
401483
402484 /*
403485 * vm_fault is filled by the the pagefault handler and passed to the vma's
@@ -541,6 +623,36 @@ static inline bool vma_is_anonymous(struct vm_area_struct *vma) · 137 unmodified lines
541623 return !vma->vm_ops;
542624 }
543625
626+static inline bool vma_is_temporary_stack(struct vm_area_struct *vma)
627+{
628+ int maybe_stack = vma->vm_flags & (VM_GROWSDOWN | VM_GROWSUP);
629+
630+ if (!maybe_stack)
631+ return false;
632+
633+ if ((vma->vm_flags & VM_STACK_INCOMPLETE_SETUP) ==
634+ VM_STACK_INCOMPLETE_SETUP)
635+ return true;
636+
637+ return false;
638+}
639+
640+static inline bool vma_is_foreign(struct vm_area_struct *vma)
641+{
642+ if (!current->mm)
643+ return true;
644+
645+ if (current->mm != vma->vm_mm)
646+ return true;
647+
648+ return false;
649+}
650+
651+static inline bool vma_is_accessible(struct vm_area_struct *vma)
652+{
653+ return vma->vm_flags & VM_ACCESS_FLAGS;
654+}
655+
544656 #ifdef CONFIG_SHMEM
545657 /*
546658 * The vma_is_shmem is not inline because it is used only by slow
@@ -770,6 +882,24 @@ static inline unsigned int compound_order(struct page *page) · 223 unmodified lines
770882 return page[1].compound_order;
771883 }
772884
885+static inline bool hpage_pincount_available(struct page *page)
886+{
887+ /*
888+ * Can the page->hpage_pinned_refcount field be used? That field is in
889+ * the 3rd page of the compound page, so the smallest (2-page) compound
890+ * pages cannot support it.
891+ */
892+ page = compound_head(page);
893+ return PageCompound(page) && compound_order(page) > 1;
894+}
895+
896+static inline int compound_pincount(struct page *page)
897+{
898+ VM_BUG_ON_PAGE(!hpage_pincount_available(page), page);
899+ page = compound_head(page);
900+ return atomic_read(compound_pincount_ptr(page));
901+}
902+
773903 static inline void set_compound_order(struct page *page, unsigned int order)
774904 {
775905 page[1].compound_order = order;
@@ -1001,6 +1131,8 @@ static inline void get_page(struct page *page) · 225 unmodified lines
10011131 page_ref_inc(page);
10021132 }
10031133
1134+bool __must_check try_grab_page(struct page *page, unsigned int flags);
1135+
10041136 static inline __must_check bool try_get_page(struct page *page)
10051137 {
10061138 page = compound_head(page);
@@ -1029,29 +1161,87 @@ static inline void put_page(struct page *page) · 22 unmodified lines
10291161 __put_page(page);
10301162 }
10311163
1032−/**
1033− * unpin_user_page() - release a gup-pinned page
1034− * @page: pointer to page to be released
1164+/*
1165+ * GUP_PIN_COUNTING_BIAS, and the associated functions that use it, overload
1166+ * the page's refcount so that two separate items are tracked: the original page
1167+ * reference count, and also a new count of how many pin_user_pages() calls were
1168+ * made against the page. ("gup-pinned" is another term for the latter).
1169+ *
1170+ * With this scheme, pin_user_pages() becomes special: such pages are marked as
1171+ * distinct from normal pages. As such, the unpin_user_page() call (and its
1172+ * variants) must be used in order to release gup-pinned pages.
1173+ *
1174+ * Choice of value:
1175+ *
1176+ * By making GUP_PIN_COUNTING_BIAS a power of two, debugging of page reference
1177+ * counts with respect to pin_user_pages() and unpin_user_page() becomes
1178+ * simpler, due to the fact that adding an even power of two to the page
1179+ * refcount has the effect of using only the upper N bits, for the code that
1180+ * counts up using the bias value. This means that the lower bits are left for
1181+ * the exclusive use of the original code that increments and decrements by one
1182+ * (or at least, by much smaller values than the bias value).
10351183 *
1036− * Pages that were pinned via pin_user_pages*() must be released via either
1037− * unpin_user_page(), or one of the unpin_user_pages*() routines. This is so
1038− * that eventually such pages can be separately tracked and uniquely handled. In
1039− * particular, interactions with RDMA and filesystems need special handling.
1184+ * Of course, once the lower bits overflow into the upper bits (and this is
1185+ * OK, because subtraction recovers the original values), then visual inspection
1186+ * no longer suffices to directly view the separate counts. However, for normal
1187+ * applications that don't have huge page reference counts, this won't be an
1188+ * issue.
10401189 *
1041− * unpin_user_page() and put_page() are not interchangeable, despite this early
1042− * implementation that makes them look the same. unpin_user_page() calls must
1043− * be perfectly matched up with pin*() calls.
1190+ * Locking: the lockless algorithm described in page_cache_get_speculative()
1191+ * and page_cache_gup_pin_speculative() provides safe operation for
1192+ * get_user_pages and page_mkclean and other calls that race to set up page
1193+ * table entries.
10441194 */
1045−static inline void unpin_user_page(struct page *page)
1046−{
1047− put_page(page);
1048−}
1195+#define GUP_PIN_COUNTING_BIAS (1U << 10)
10491196
1197+void unpin_user_page(struct page *page);
10501198 void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages,
10511199 bool make_dirty);
1052−
10531200 void unpin_user_pages(struct page **pages, unsigned long npages);
10541201
1202+/**
1203+ * page_maybe_dma_pinned() - report if a page is pinned for DMA.
1204+ *
1205+ * This function checks if a page has been pinned via a call to
1206+ * pin_user_pages*().
1207+ *
1208+ * For non-huge pages, the return value is partially fuzzy: false is not fuzzy,
1209+ * because it means "definitely not pinned for DMA", but true means "probably
1210+ * pinned for DMA, but possibly a false positive due to having at least
1211+ * GUP_PIN_COUNTING_BIAS worth of normal page references".
1212+ *
1213+ * False positives are OK, because: a) it's unlikely for a page to get that many
1214+ * refcounts, and b) all the callers of this routine are expected to be able to
1215+ * deal gracefully with a false positive.
1216+ *
1217+ * For huge pages, the result will be exactly correct. That's because we have
1218+ * more tracking data available: the 3rd struct page in the compound page is
1219+ * used to track the pincount (instead using of the GUP_PIN_COUNTING_BIAS
1220+ * scheme).
1221+ *
1222+ * For more information, please see Documentation/vm/pin_user_pages.rst.
1223+ *
1224+ * @page: pointer to page to be queried.
1225+ * @Return: True, if it is likely that the page has been "dma-pinned".
1226+ * False, if the page is definitely not dma-pinned.
1227+ */
1228+static inline bool page_maybe_dma_pinned(struct page *page)
1229+{
1230+ if (hpage_pincount_available(page))
1231+ return compound_pincount(page) > 0;
1232+
1233+ /*
1234+ * page_ref_count() is signed. If that refcount overflows, then
1235+ * page_ref_count() returns a negative value, and callers will avoid
1236+ * further incrementing the refcount.
1237+ *
1238+ * Here, for that overflow case, use the signed bit to count a little
1239+ * bit higher via unsigned math, and thus still get an accurate result.
1240+ */
1241+ return ((unsigned int)page_ref_count(compound_head(page))) >=
1242+ GUP_PIN_COUNTING_BIAS;
1243+}
1244+
10551245 #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
10561246 #define SECTION_IN_PAGE_FLAGS
10571247 #endif
@@ -1599,9 +1789,26 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma, · 541 unmodified lines
15991789 unsigned long old_addr, struct vm_area_struct *new_vma,
16001790 unsigned long new_addr, unsigned long len,
16011791 bool need_rmap_locks);
1792+
1793+/*
1794+ * Flags used by change_protection(). For now we make it a bitmap so
1795+ * that we can pass in multiple flags just like parameters. However
1796+ * for now all the callers are only use one of the flags at the same
1797+ * time.
1798+ */
1799+/* Whether we should allow dirty bit accounting */
1800+#define MM_CP_DIRTY_ACCT (1UL << 0)
1801+/* Whether this protection change is for NUMA hints */
1802+#define MM_CP_PROT_NUMA (1UL << 1)
1803+/* Whether this change is for write protecting */
1804+#define MM_CP_UFFD_WP (1UL << 2) /* do wp */
1805+#define MM_CP_UFFD_WP_RESOLVE (1UL << 3) /* Resolve wp */
1806+#define MM_CP_UFFD_WP_ALL (MM_CP_UFFD_WP | \
1807+ MM_CP_UFFD_WP_RESOLVE)
1808+
16021809 extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start,
16031810 unsigned long end, pgprot_t newprot,
1604− int dirty_accountable, int prot_numa);
1811+ unsigned long cp_flags);
16051812 extern int mprotect_fixup(struct vm_area_struct *vma,
16061813 struct vm_area_struct **pprev, unsigned long start,
16071814 unsigned long end, unsigned long newflags);
@@ -1720,6 +1927,18 @@ static inline void sync_mm_rss(struct mm_struct *mm) · 112 unmodified lines
17201927 }
17211928 #endif
17221929
1930+#ifndef CONFIG_ARCH_HAS_PTE_SPECIAL
1931+static inline int pte_special(pte_t pte)
1932+{
1933+ return 0;
1934+}
1935+
1936+static inline pte_t pte_mkspecial(pte_t pte)
1937+{
1938+ return pte;
1939+}
1940+#endif
1941+
17231942 #ifndef CONFIG_ARCH_HAS_PTE_DEVMAP
17241943 static inline int pte_devmap(pte_t pte)
17251944 {
@@ -2364,26 +2583,7 @@ struct vm_unmapped_area_info { · 638 unmodified lines
23642583 unsigned long align_offset;
23652584 };
23662585
2367−extern unsigned long unmapped_area(struct vm_unmapped_area_info *info);
2368−extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
2369−
2370−/*
2371− * Search for an unmapped address range.
2372− *
2373− * We are looking for a range that:
2374− * - does not intersect with any VMA;
2375− * - is contained within the [low_limit, high_limit) interval;
2376− * - is at least the desired size.
2377− * - satisfies (begin_addr & align_mask) == (align_offset & align_mask)
2378− */
2379−static inline unsigned long
2380−vm_unmapped_area(struct vm_unmapped_area_info *info)
2381−{
2382− if (info->flags & VM_UNMAPPED_AREA_TOPDOWN)
2383− return unmapped_area_topdown(info);
2384− else
2385− return unmapped_area(info);
2386−}
2586+extern unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info);
23872587
23882588 /* truncate.c */
23892589 extern void truncate_inode_pages(struct address_space *, loff_t);
@@ -2519,6 +2719,8 @@ struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); · 129 unmodified lines
25192719 int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
25202720 unsigned long pfn, unsigned long size, pgprot_t);
25212721 int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
2722+int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr,
2723+ struct page **pages, unsigned long *num);
25222724 int vm_map_pages(struct vm_area_struct *vma, struct page **pages,
25232725 unsigned long num);
25242726 int vm_map_pages_zero(struct vm_area_struct *vma, struct page **pages,
@@ -2867,6 +3069,23 @@ extern long copy_huge_page_from_user(struct page *dst_page, · 342 unmodified lines
28673069 const void __user *usr_src,
28683070 unsigned int pages_per_huge_page,
28693071 bool allow_pagefault);
3072+
3073+/**
3074+ * vma_is_special_huge - Are transhuge page-table entries considered special?
3075+ * @vma: Pointer to the struct vm_area_struct to consider
3076+ *
3077+ * Whether transhuge page-table entries are considered "special" following
3078+ * the definition in vm_normal_page().
3079+ *
3080+ * Return: true if transhuge page-table entries should be considered special,
3081+ * false otherwise.
3082+ */
3083+static inline bool vma_is_special_huge(const struct vm_area_struct *vma)
3084+{
3085+ return vma_is_dax(vma) || (vma->vm_file &&
3086+ (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)));
3087+}
3088+
28703089 #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
28713090
28723091 #ifdef CONFIG_DEBUG_PAGEALLOC
include/linux/mm_inline.h+8−7
@@ -6,19 +6,20 @@ · 5 unmodified lines
66 #include <linux/swap.h>
77
88 /**
9− * page_is_file_cache - should the page be on a file LRU or anon LRU?
9+ * page_is_file_lru - should the page be on a file LRU or anon LRU?
1010 * @page: the page to test
1111 *
12− * Returns 1 if @page is page cache page backed by a regular filesystem,
13− * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed.
14− * Used by functions that manipulate the LRU lists, to sort a page
15− * onto the right LRU list.
12+ * Returns 1 if @page is a regular filesystem backed page cache page or a lazily
13+ * freed anonymous page (e.g. via MADV_FREE). Returns 0 if @page is a normal
14+ * anonymous page, a tmpfs page or otherwise ram or swap backed page. Used by
15+ * functions that manipulate the LRU lists, to sort a page onto the right LRU
16+ * list.
1617 *
1718 * We would like to get this info without a page flag, but the state
1819 * needs to survive until the page is last deleted from the LRU, which
1920 * could be as far down as __page_cache_release.
2021 */
21−static inline int page_is_file_cache(struct page *page)
22+static inline int page_is_file_lru(struct page *page)
2223 {
2324 return !PageSwapBacked(page);
2425 }
@@ -75,7 +76,7 @@ static __always_inline void del_page_from_lru_list(struct page *page, · 50 unmodified lines
7576 */
7677 static inline enum lru_list page_lru_base_type(struct page *page)
7778 {
78− if (page_is_file_cache(page))
79+ if (page_is_file_lru(page))
7980 return LRU_INACTIVE_FILE;
8081 return LRU_INACTIVE_ANON;
8182 }
include/linux/mm_types.h+8−3
@@ -137,7 +137,7 @@ struct page { · 136 unmodified lines
137137 };
138138 struct { /* Second tail page of compound page */
139139 unsigned long _compound_pad_1; /* compound_head */
140− unsigned long _compound_pad_2;
140+ atomic_t hpage_pinned_refcount;
141141 /* For both global and memcg */
142142 struct list_head deferred_list;
143143 };
@@ -226,6 +226,11 @@ static inline atomic_t *compound_mapcount_ptr(struct page *page) · 82 unmodified lines
226226 return &page[1].compound_mapcount;
227227 }
228228
229+static inline atomic_t *compound_pincount_ptr(struct page *page)
230+{
231+ return &page[2].hpage_pinned_refcount;
232+}
233+
229234 /*
230235 * Used for sizing the vmemmap region on some architectures
231236 */
@@ -284,8 +289,8 @@ struct vm_userfaultfd_ctx {}; · 52 unmodified lines
284289 #endif /* CONFIG_USERFAULTFD */
285290
286291 /*
287− * This struct defines a memory VMM memory area. There is one of these
288− * per VM-area/task. A VM area is any part of the process virtual memory
292+ * This struct describes a virtual memory area. There is one of these
293+ * per VM-area/task. A VM area is any part of the process virtual memory
289294 * space that has a special rule for the page-fault handlers (ie a shared
290295 * library, the executable area etc).
291296 */
include/linux/mmc/core.h+0−3
@@ -107,9 +107,6 @@ struct mmc_command { · 106 unmodified lines
107107 */
108108
109109 unsigned int busy_timeout; /* busy detect timeout in ms */
110− /* Set this flag only for blocking sanitize request */
111− bool sanitize_busy;
112−
113110 struct mmc_data *data; /* data segment associated with cmd */
114111 struct mmc_request *mrq; /* associated request */
115112 };
include/linux/mmc/host.h+7−1
@@ -322,6 +322,8 @@ struct mmc_host { · 321 unmodified lines
322322 #define MMC_CAP_3_3V_DDR (1 << 11) /* Host supports eMMC DDR 3.3V */
323323 #define MMC_CAP_1_8V_DDR (1 << 12) /* Host supports eMMC DDR 1.8V */
324324 #define MMC_CAP_1_2V_DDR (1 << 13) /* Host supports eMMC DDR 1.2V */
325+#define MMC_CAP_DDR (MMC_CAP_3_3V_DDR | MMC_CAP_1_8V_DDR | \
326+ MMC_CAP_1_2V_DDR)
325327 #define MMC_CAP_POWER_OFF_CARD (1 << 14) /* Can power off after boot */
326328 #define MMC_CAP_BUS_WIDTH_TEST (1 << 15) /* CMD14/CMD19 bus width ok */
327329 #define MMC_CAP_UHS_SDR12 (1 << 16) /* Host supports UHS SDR12 mode */
@@ -333,6 +335,7 @@ struct mmc_host { · 5 unmodified lines
333335 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \
334336 MMC_CAP_UHS_DDR50)
335337 #define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */
338+#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */
336339 #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
337340 #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
338341 #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */
@@ -462,7 +465,10 @@ struct mmc_host { · 123 unmodified lines
462465 bool cqe_enabled;
463466 bool cqe_on;
464467
465− unsigned long private[0] ____cacheline_aligned;
468+ /* Host Software Queue support */
469+ bool hsq_enabled;
470+
471+ unsigned long private[] ____cacheline_aligned;
466472 };
467473
468474 struct device_node;
include/linux/mmc/mmc.h+10−0
@@ -161,6 +161,16 @@ static inline bool mmc_op_multi(u32 opcode) · 160 unmodified lines
161161 #define R1_STATE_PRG 7
162162 #define R1_STATE_DIS 8
163163
164+static inline bool mmc_ready_for_data(u32 status)
165+{
166+ /*
167+ * Some cards mishandle the status bits, so make sure to check both the
168+ * busy indication and the card state.
169+ */
170+ return status & R1_READY_FOR_DATA &&
171+ R1_CURRENT_STATE(status) == R1_STATE_TRAN;
172+}
173+
164174 /*
165175 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS
166176 * R1 is the low order byte; R2 is the next highest byte, when present.
include/linux/mmc/sdio_func.h+1−1
@@ -25,7 +25,7 @@ struct sdio_func_tuple { · 24 unmodified lines
2525 struct sdio_func_tuple *next;
2626 unsigned char code;
2727 unsigned char size;
28− unsigned char data[0];
28+ unsigned char data[];
2929 };
3030
3131 /*
include/linux/mmzone.h+7−47
@@ -100,41 +100,6 @@ struct free_area { · 99 unmodified lines
100100 unsigned long nr_free;
101101 };
102102
103−/* Used for pages not on another list */
104−static inline void add_to_free_area(struct page *page, struct free_area *area,
105− int migratetype)
106−{
107− list_add(&page->lru, &area->free_list[migratetype]);
108− area->nr_free++;
109−}
110−
111−/* Used for pages not on another list */
112−static inline void add_to_free_area_tail(struct page *page, struct free_area *area,
113− int migratetype)
114−{
115− list_add_tail(&page->lru, &area->free_list[migratetype]);
116− area->nr_free++;
117−}
118−
119−#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR
120−/* Used to preserve page allocation order entropy */
121−void add_to_free_area_random(struct page *page, struct free_area *area,
122− int migratetype);
123−#else
124−static inline void add_to_free_area_random(struct page *page,
125− struct free_area *area, int migratetype)
126−{
127− add_to_free_area(page, area, migratetype);
128−}
129−#endif
130−
131−/* Used for pages which are on another list */
132−static inline void move_to_free_area(struct page *page, struct free_area *area,
133− int migratetype)
134−{
135− list_move(&page->lru, &area->free_list[migratetype]);
136−}
137−
138103 static inline struct page *get_page_from_free_area(struct free_area *area,
139104 int migratetype)
140105 {
@@ -142,15 +107,6 @@ static inline struct page *get_page_from_free_area(struct free_area *area, · 1 unmodified line
142107 struct page, lru);
143108 }
144109
145−static inline void del_page_from_free_area(struct page *page,
146− struct free_area *area)
147−{
148− list_del(&page->lru);
149− __ClearPageBuddy(page);
150− set_page_private(page, 0);
151− area->nr_free--;
152−}
153−
154110 static inline bool free_area_empty(struct free_area *area, int migratetype)
155111 {
156112 return list_empty(&area->free_list[migratetype]);
@@ -243,6 +199,8 @@ enum node_stat_item { · 86 unmodified lines
243199 NR_DIRTIED, /* page dirtyings since bootup */
244200 NR_WRITTEN, /* page writings since bootup */
245201 NR_KERNEL_MISC_RECLAIMABLE, /* reclaimable non-slab kernel pages */
202+ NR_FOLL_PIN_ACQUIRED, /* via: pin_user_page(), gup flag: FOLL_PIN */
203+ NR_FOLL_PIN_RELEASED, /* pages returned via unpin_user_page() */
246204 NR_VM_NODE_STAT_ITEMS
247205 };
248206
@@ -706,7 +664,6 @@ struct deferred_split { · 457 unmodified lines
706664 * Memory statistics and page replacement data structures are maintained on a
707665 * per-zone basis.
708666 */
709−struct bootmem_data;
710667 typedef struct pglist_data {
711668 struct zone node_zones[MAX_NR_ZONES];
712669 struct zonelist node_zonelists[MAX_ZONELISTS];
@@ -1170,6 +1127,7 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec) · 457 unmodified lines
11701127 #define SECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SECTION_MASK)
11711128
11721129 #define SUBSECTION_SHIFT 21
1130+#define SUBSECTION_SIZE (1UL << SUBSECTION_SHIFT)
11731131
11741132 #define PFN_SUBSECTION_SHIFT (SUBSECTION_SHIFT - PAGE_SHIFT)
11751133 #define PAGES_PER_SUBSECTION (1UL << PFN_SUBSECTION_SHIFT)
@@ -1185,7 +1143,9 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec) · 9 unmodified lines
11851143 #define SUBSECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SUBSECTION_MASK)
11861144
11871145 struct mem_section_usage {
1146+#ifdef CONFIG_SPARSEMEM_VMEMMAP
11881147 DECLARE_BITMAP(subsection_map, SUBSECTIONS_PER_SECTION);
1148+#endif
11891149 /* See declaration of similar field in struct zone */
11901150 unsigned long pageblock_flags[0];
11911151 };
@@ -1372,7 +1332,7 @@ static inline int pfn_valid(unsigned long pfn) · 180 unmodified lines
13721332 }
13731333 #endif
13741334
1375−static inline int pfn_present(unsigned long pfn)
1335+static inline int pfn_in_present_section(unsigned long pfn)
13761336 {
13771337 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
13781338 return 0;
@@ -1409,7 +1369,7 @@ void sparse_init(void); · 30 unmodified lines
14091369 #else
14101370 #define sparse_init() do {} while (0)
14111371 #define sparse_index_init(_sec, _nid) do {} while (0)
1412−#define pfn_present pfn_valid
1372+#define pfn_in_present_section pfn_valid
14131373 #define subsection_map_init(_pfn, _nr_pages) do {} while (0)
14141374 #endif /* CONFIG_SPARSEMEM */
14151375
include/linux/mod_devicetable.h+14−3
@@ -667,9 +667,7 @@ struct x86_cpu_id { · 666 unmodified lines
667667 kernel_ulong_t driver_data;
668668 };
669669
670−#define X86_FEATURE_MATCH(x) \
671− { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x }
672−
670+/* Wild cards for x86_cpu_id::vendor, family, model and feature */
673671 #define X86_VENDOR_ANY 0xffff
674672 #define X86_FAMILY_ANY 0
675673 #define X86_MODEL_ANY 0
@@ -821,4 +819,17 @@ struct wmi_device_id { · 145 unmodified lines
821819 const void *context;
822820 };
823821
822+#define MHI_DEVICE_MODALIAS_FMT "mhi:%s"
823+#define MHI_NAME_SIZE 32
824+
825+/**
826+ * struct mhi_device_id - MHI device identification
827+ * @chan: MHI channel name
828+ * @driver_data: driver data;
829+ */
830+struct mhi_device_id {
831+ const char chan[MHI_NAME_SIZE];
832+ kernel_ulong_t driver_data;
833+};
834+
824835 #endif /* LINUX_MOD_DEVICETABLE_H */
include/linux/most.h+337−0
@@ -0,0 +1,337 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * most.h - API for component and adapter drivers
4+ *
5+ * Copyright (C) 2013-2015, Microchip Technology Germany II GmbH & Co. KG
6+ */
7+
8+#ifndef __MOST_CORE_H__
9+#define __MOST_CORE_H__
10+
11+#include <linux/types.h>
12+#include <linux/device.h>
13+
14+struct module;
15+struct interface_private;
16+
17+/**
18+ * Interface type
19+ */
20+enum most_interface_type {
21+ ITYPE_LOOPBACK = 1,
22+ ITYPE_I2C,
23+ ITYPE_I2S,
24+ ITYPE_TSI,
25+ ITYPE_HBI,
26+ ITYPE_MEDIALB_DIM,
27+ ITYPE_MEDIALB_DIM2,
28+ ITYPE_USB,
29+ ITYPE_PCIE
30+};
31+
32+/**
33+ * Channel direction.
34+ */
35+enum most_channel_direction {
36+ MOST_CH_RX = 1 << 0,
37+ MOST_CH_TX = 1 << 1,
38+};
39+
40+/**
41+ * Channel data type.
42+ */
43+enum most_channel_data_type {
44+ MOST_CH_CONTROL = 1 << 0,
45+ MOST_CH_ASYNC = 1 << 1,
46+ MOST_CH_ISOC = 1 << 2,
47+ MOST_CH_SYNC = 1 << 5,
48+};
49+
50+enum most_status_flags {
51+ /* MBO was processed successfully (data was send or received )*/
52+ MBO_SUCCESS = 0,
53+ /* The MBO contains wrong or missing information. */
54+ MBO_E_INVAL,
55+ /* MBO was completed as HDM Channel will be closed */
56+ MBO_E_CLOSE,
57+};
58+
59+/**
60+ * struct most_channel_capability - Channel capability
61+ * @direction: Supported channel directions.
62+ * The value is bitwise OR-combination of the values from the
63+ * enumeration most_channel_direction. Zero is allowed value and means
64+ * "channel may not be used".
65+ * @data_type: Supported channel data types.
66+ * The value is bitwise OR-combination of the values from the
67+ * enumeration most_channel_data_type. Zero is allowed value and means
68+ * "channel may not be used".
69+ * @num_buffers_packet: Maximum number of buffers supported by this channel
70+ * for packet data types (Async,Control,QoS)
71+ * @buffer_size_packet: Maximum buffer size supported by this channel
72+ * for packet data types (Async,Control,QoS)
73+ * @num_buffers_streaming: Maximum number of buffers supported by this channel
74+ * for streaming data types (Sync,AV Packetized)
75+ * @buffer_size_streaming: Maximum buffer size supported by this channel
76+ * for streaming data types (Sync,AV Packetized)
77+ * @name_suffix: Optional suffix providean by an HDM that is attached to the
78+ * regular channel name.
79+ *
80+ * Describes the capabilities of a MOST channel like supported Data Types
81+ * and directions. This information is provided by an HDM for the MostCore.
82+ *
83+ * The Core creates read only sysfs attribute files in
84+ * /sys/devices/most/mdev#/<channel>/ with the
85+ * following attributes:
86+ * -available_directions
87+ * -available_datatypes
88+ * -number_of_packet_buffers
89+ * -number_of_stream_buffers
90+ * -size_of_packet_buffer
91+ * -size_of_stream_buffer
92+ * where content of each file is a string with all supported properties of this
93+ * very channel attribute.
94+ */
95+struct most_channel_capability {
96+ u16 direction;
97+ u16 data_type;
98+ u16 num_buffers_packet;
99+ u16 buffer_size_packet;
100+ u16 num_buffers_streaming;
101+ u16 buffer_size_streaming;
102+ const char *name_suffix;
103+};
104+
105+/**
106+ * struct most_channel_config - stores channel configuration
107+ * @direction: direction of the channel
108+ * @data_type: data type travelling over this channel
109+ * @num_buffers: number of buffers
110+ * @buffer_size: size of a buffer for AIM.
111+ * Buffer size may be cutted down by HDM in a configure callback
112+ * to match to a given interface and channel type.
113+ * @extra_len: additional buffer space for internal HDM purposes like padding.
114+ * May be set by HDM in a configure callback if needed.
115+ * @subbuffer_size: size of a subbuffer
116+ * @packets_per_xact: number of MOST frames that are packet inside one USB
117+ * packet. This is USB specific
118+ *
119+ * Describes the configuration for a MOST channel. This information is
120+ * provided from the MostCore to a HDM (like the Medusa PCIe Interface) as a
121+ * parameter of the "configure" function call.
122+ */
123+struct most_channel_config {
124+ enum most_channel_direction direction;
125+ enum most_channel_data_type data_type;
126+ u16 num_buffers;
127+ u16 buffer_size;
128+ u16 extra_len;
129+ u16 subbuffer_size;
130+ u16 packets_per_xact;
131+ u16 dbr_size;
132+};
133+
134+/*
135+ * struct mbo - MOST Buffer Object.
136+ * @context: context for core completion handler
137+ * @priv: private data for HDM
138+ *
139+ * public: documented fields that are used for the communications
140+ * between MostCore and HDMs
141+ *
142+ * @list: list head for use by the mbo's current owner
143+ * @ifp: (in) associated interface instance
144+ * @num_buffers_ptr: amount of pool buffers
145+ * @hdm_channel_id: (in) HDM channel instance
146+ * @virt_address: (in) kernel virtual address of the buffer
147+ * @bus_address: (in) bus address of the buffer
148+ * @buffer_length: (in) buffer payload length
149+ * @processed_length: (out) processed length
150+ * @status: (out) transfer status
151+ * @complete: (in) completion routine
152+ *
153+ * The core allocates and initializes the MBO.
154+ *
155+ * The HDM receives MBO for transfer from the core with the call to enqueue().
156+ * The HDM copies the data to- or from the buffer depending on configured
157+ * channel direction, set "processed_length" and "status" and completes
158+ * the transfer procedure by calling the completion routine.
159+ *
160+ * Finally, the MBO is being deallocated or recycled for further
161+ * transfers of the same or a different HDM.
162+ *
163+ * Directions of usage:
164+ * The core driver should never access any MBO fields (even if marked
165+ * as "public") while the MBO is owned by an HDM. The ownership starts with
166+ * the call of enqueue() and ends with the call of its complete() routine.
167+ *
168+ * II.
169+ * Every HDM attached to the core driver _must_ ensure that it returns any MBO
170+ * it owns (due to a previous call to enqueue() by the core driver) before it
171+ * de-registers an interface or gets unloaded from the kernel. If this direction
172+ * is violated memory leaks will occur, since the core driver does _not_ track
173+ * MBOs it is currently not in control of.
174+ *
175+ */
176+struct mbo {
177+ void *context;
178+ void *priv;
179+ struct list_head list;
180+ struct most_interface *ifp;
181+ int *num_buffers_ptr;
182+ u16 hdm_channel_id;
183+ void *virt_address;
184+ dma_addr_t bus_address;
185+ u16 buffer_length;
186+ u16 processed_length;
187+ enum most_status_flags status;
188+ void (*complete)(struct mbo *mbo);
189+};
190+
191+/**
192+ * Interface instance description.
193+ *
194+ * Describes an interface of a MOST device the core driver is bound to.
195+ * This structure is allocated and initialized in the HDM. MostCore may not
196+ * modify this structure.
197+ *
198+ * @dev: the actual device
199+ * @mod: module
200+ * @interface Interface type. \sa most_interface_type.
201+ * @description PRELIMINARY.
202+ * Unique description of the device instance from point of view of the
203+ * interface in free text form (ASCII).
204+ * It may be a hexadecimal presentation of the memory address for the MediaLB
205+ * IP or USB device ID with USB properties for USB interface, etc.
206+ * @num_channels Number of channels and size of the channel_vector.
207+ * @channel_vector Properties of the channels.
208+ * Array index represents channel ID by the driver.
209+ * @configure Callback to change data type for the channel of the
210+ * interface instance. May be zero if the instance of the interface is not
211+ * configurable. Parameter channel_config describes direction and data
212+ * type for the channel, configured by the higher level. The content of
213+ * @enqueue Delivers MBO to the HDM for processing.
214+ * After HDM completes Rx- or Tx- operation the processed MBO shall
215+ * be returned back to the MostCore using completion routine.
216+ * The reason to get the MBO delivered from the MostCore after the channel
217+ * is poisoned is the re-opening of the channel by the application.
218+ * In this case the HDM shall hold MBOs and service the channel as usual.
219+ * The HDM must be able to hold at least one MBO for each channel.
220+ * The callback returns a negative value on error, otherwise 0.
221+ * @poison_channel Informs HDM about closing the channel. The HDM shall
222+ * cancel all transfers and synchronously or asynchronously return
223+ * all enqueued for this channel MBOs using the completion routine.
224+ * The callback returns a negative value on error, otherwise 0.
225+ * @request_netinfo: triggers retrieving of network info from the HDM by
226+ * means of "Message exchange over MDP/MEP"
227+ * The call of the function request_netinfo with the parameter on_netinfo as
228+ * NULL prohibits use of the previously obtained function pointer.
229+ * @priv Private field used by mostcore to store context information.
230+ */
231+struct most_interface {
232+ struct device *dev;
233+ struct device *driver_dev;
234+ struct module *mod;
235+ enum most_interface_type interface;
236+ const char *description;
237+ unsigned int num_channels;
238+ struct most_channel_capability *channel_vector;
239+ void *(*dma_alloc)(struct mbo *mbo, u32 size);
240+ void (*dma_free)(struct mbo *mbo, u32 size);
241+ int (*configure)(struct most_interface *iface, int channel_idx,
242+ struct most_channel_config *channel_config);
243+ int (*enqueue)(struct most_interface *iface, int channel_idx,
244+ struct mbo *mbo);
245+ int (*poison_channel)(struct most_interface *iface, int channel_idx);
246+ void (*request_netinfo)(struct most_interface *iface, int channel_idx,
247+ void (*on_netinfo)(struct most_interface *iface,
248+ unsigned char link_stat,
249+ unsigned char *mac_addr));
250+ void *priv;
251+ struct interface_private *p;
252+};
253+
254+/**
255+ * struct most_component - identifies a loadable component for the mostcore
256+ * @list: list_head
257+ * @name: component name
258+ * @probe_channel: function for core to notify driver about channel connection
259+ * @disconnect_channel: callback function to disconnect a certain channel
260+ * @rx_completion: completion handler for received packets
261+ * @tx_completion: completion handler for transmitted packets
262+ */
263+struct most_component {
264+ struct list_head list;
265+ const char *name;
266+ struct module *mod;
267+ int (*probe_channel)(struct most_interface *iface, int channel_idx,
268+ struct most_channel_config *cfg, char *name,
269+ char *param);
270+ int (*disconnect_channel)(struct most_interface *iface,
271+ int channel_idx);
272+ int (*rx_completion)(struct mbo *mbo);
273+ int (*tx_completion)(struct most_interface *iface, int channel_idx);
274+ int (*cfg_complete)(void);
275+};
276+
277+/**
278+ * most_register_interface - Registers instance of the interface.
279+ * @iface: Pointer to the interface instance description.
280+ *
281+ * Returns a pointer to the kobject of the generated instance.
282+ *
283+ * Note: HDM has to ensure that any reference held on the kobj is
284+ * released before deregistering the interface.
285+ */
286+int most_register_interface(struct most_interface *iface);
287+
288+/**
289+ * Deregisters instance of the interface.
290+ * @intf_instance Pointer to the interface instance description.
291+ */
292+void most_deregister_interface(struct most_interface *iface);
293+void most_submit_mbo(struct mbo *mbo);
294+
295+/**
296+ * most_stop_enqueue - prevents core from enqueing MBOs
297+ * @iface: pointer to interface
298+ * @channel_idx: channel index
299+ */
300+void most_stop_enqueue(struct most_interface *iface, int channel_idx);
301+
302+/**
303+ * most_resume_enqueue - allow core to enqueue MBOs again
304+ * @iface: pointer to interface
305+ * @channel_idx: channel index
306+ *
307+ * This clears the enqueue halt flag and enqueues all MBOs currently
308+ * in wait fifo.
309+ */
310+void most_resume_enqueue(struct most_interface *iface, int channel_idx);
311+int most_register_component(struct most_component *comp);
312+int most_deregister_component(struct most_component *comp);
313+struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx,
314+ struct most_component *comp);
315+void most_put_mbo(struct mbo *mbo);
316+int channel_has_mbo(struct most_interface *iface, int channel_idx,
317+ struct most_component *comp);
318+int most_start_channel(struct most_interface *iface, int channel_idx,
319+ struct most_component *comp);
320+int most_stop_channel(struct most_interface *iface, int channel_idx,
321+ struct most_component *comp);
322+int __init configfs_init(void);
323+int most_register_configfs_subsys(struct most_component *comp);
324+void most_deregister_configfs_subsys(struct most_component *comp);
325+int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name,
326+ char *comp_param);
327+int most_remove_link(char *mdev, char *mdev_ch, char *comp_name);
328+int most_set_cfg_buffer_size(char *mdev, char *mdev_ch, u16 val);
329+int most_set_cfg_subbuffer_size(char *mdev, char *mdev_ch, u16 val);
330+int most_set_cfg_dbr_size(char *mdev, char *mdev_ch, u16 val);
331+int most_set_cfg_num_buffers(char *mdev, char *mdev_ch, u16 val);
332+int most_set_cfg_datatype(char *mdev, char *mdev_ch, char *buf);
333+int most_set_cfg_direction(char *mdev, char *mdev_ch, char *buf);
334+int most_set_cfg_packets_xact(char *mdev, char *mdev_ch, u16 val);
335+int most_cfg_complete(char *comp_name);
336+void most_interface_register_notify(const char *mdev_name);
337+#endif /* MOST_CORE_H_ */
include/linux/msdos_partition.h+50−0
@@ -0,0 +1,50 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_MSDOS_PARTITION_H
3+#define _LINUX_MSDOS_PARTITION_H
4+
5+#define MSDOS_LABEL_MAGIC 0xAA55
6+
7+struct msdos_partition {
8+ u8 boot_ind; /* 0x80 - active */
9+ u8 head; /* starting head */
10+ u8 sector; /* starting sector */
11+ u8 cyl; /* starting cylinder */
12+ u8 sys_ind; /* What partition type */
13+ u8 end_head; /* end head */
14+ u8 end_sector; /* end sector */
15+ u8 end_cyl; /* end cylinder */
16+ __le32 start_sect; /* starting sector counting from 0 */
17+ __le32 nr_sects; /* nr of sectors in partition */
18+} __packed;
19+
20+enum msdos_sys_ind {
21+ /*
22+ * These three have identical behaviour; use the second one if DOS FDISK
23+ * gets confused about extended/logical partitions starting past
24+ * cylinder 1023.
25+ */
26+ DOS_EXTENDED_PARTITION = 5,
27+ LINUX_EXTENDED_PARTITION = 0x85,
28+ WIN98_EXTENDED_PARTITION = 0x0f,
29+
30+ LINUX_DATA_PARTITION = 0x83,
31+ LINUX_LVM_PARTITION = 0x8e,
32+ LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */
33+
34+ SOLARIS_X86_PARTITION = 0x82, /* also Linux swap partitions */
35+ NEW_SOLARIS_X86_PARTITION = 0xbf,
36+
37+ DM6_AUX1PARTITION = 0x51, /* no DDO: use xlated geom */
38+ DM6_AUX3PARTITION = 0x53, /* no DDO: use xlated geom */
39+ DM6_PARTITION = 0x54, /* has DDO: use xlated geom & offset */
40+ EZD_PARTITION = 0x55, /* EZ-DRIVE */
41+
42+ FREEBSD_PARTITION = 0xa5, /* FreeBSD Partition ID */
43+ OPENBSD_PARTITION = 0xa6, /* OpenBSD Partition ID */
44+ NETBSD_PARTITION = 0xa9, /* NetBSD Partition ID */
45+ BSDI_PARTITION = 0xb7, /* BSDI Partition ID */
46+ MINIX_PARTITION = 0x81, /* Minix Partition ID */
47+ UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */
48+};
49+
50+#endif /* LINUX_MSDOS_PARTITION_H */
include/linux/mtd/mtd.h+115−10
@@ -8,6 +8,7 @@ · 7 unmodified lines
88
99 #include <linux/types.h>
1010 #include <linux/uio.h>
11+#include <linux/list.h>
1112 #include <linux/notifier.h>
1213 #include <linux/device.h>
1314 #include <linux/of.h>
@@ -194,10 +195,43 @@ struct mtd_debug_info { · 180 unmodified lines
194195 const char *partid;
195196 };
196197
198+/**
199+ * struct mtd_part - MTD partition specific fields
200+ *
201+ * @node: list node used to add an MTD partition to the parent partition list
202+ * @offset: offset of the partition relatively to the parent offset
203+ * @flags: original flags (before the mtdpart logic decided to tweak them based
204+ * on flash constraints, like eraseblock/pagesize alignment)
205+ *
206+ * This struct is embedded in mtd_info and contains partition-specific
207+ * properties/fields.
208+ */
209+struct mtd_part {
210+ struct list_head node;
211+ u64 offset;
212+ u32 flags;
213+};
214+
215+/**
216+ * struct mtd_master - MTD master specific fields
217+ *
218+ * @partitions_lock: lock protecting accesses to the partition list. Protects
219+ * not only the master partition list, but also all
220+ * sub-partitions.
221+ * @suspended: et to 1 when the device is suspended, 0 otherwise
222+ *
223+ * This struct is embedded in mtd_info and contains master-specific
224+ * properties/fields. The master is the root MTD device from the MTD partition
225+ * point of view.
226+ */
227+struct mtd_master {
228+ struct mutex partitions_lock;
229+ unsigned int suspended : 1;
230+};
231+
197232 struct mtd_info {
198233 u_char type;
199234 uint32_t flags;
200− uint32_t orig_flags; /* Flags as before running mtd checks */
201235 uint64_t size; // Total size of the MTD
202236
203237 /* "Major" erase size for the device. Naïve users may take this
@@ -339,8 +373,52 @@ struct mtd_info { · 135 unmodified lines
339373 int usecount;
340374 struct mtd_debug_info dbg;
341375 struct nvmem_device *nvmem;
376+
377+ /*
378+ * Parent device from the MTD partition point of view.
379+ *
380+ * MTD masters do not have any parent, MTD partitions do. The parent
381+ * MTD device can itself be a partition.
382+ */
383+ struct mtd_info *parent;
384+
385+ /* List of partitions attached to this MTD device */
386+ struct list_head partitions;
387+
388+ union {
389+ struct mtd_part part;
390+ struct mtd_master master;
391+ };
342392 };
343393
394+static inline struct mtd_info *mtd_get_master(struct mtd_info *mtd)
395+{
396+ while (mtd->parent)
397+ mtd = mtd->parent;
398+
399+ return mtd;
400+}
401+
402+static inline u64 mtd_get_master_ofs(struct mtd_info *mtd, u64 ofs)
403+{
404+ while (mtd->parent) {
405+ ofs += mtd->part.offset;
406+ mtd = mtd->parent;
407+ }
408+
409+ return ofs;
410+}
411+
412+static inline bool mtd_is_partition(const struct mtd_info *mtd)
413+{
414+ return mtd->parent;
415+}
416+
417+static inline bool mtd_has_partitions(const struct mtd_info *mtd)
418+{
419+ return !list_empty(&mtd->partitions);
420+}
421+
344422 int mtd_ooblayout_ecc(struct mtd_info *mtd, int section,
345423 struct mtd_oob_region *oobecc);
346424 int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte,
@@ -392,13 +470,16 @@ static inline u32 mtd_oobavail(struct mtd_info *mtd, struct mtd_oob_ops *ops) · 45 unmodified lines
392470 static inline int mtd_max_bad_blocks(struct mtd_info *mtd,
393471 loff_t ofs, size_t len)
394472 {
395− if (!mtd->_max_bad_blocks)
473+ struct mtd_info *master = mtd_get_master(mtd);
474+
475+ if (!master->_max_bad_blocks)
396476 return -ENOTSUPP;
397477
398478 if (mtd->size < (len + ofs) || ofs < 0)
399479 return -EINVAL;
400480
401− return mtd->_max_bad_blocks(mtd, ofs, len);
481+ return master->_max_bad_blocks(master, mtd_get_master_ofs(mtd, ofs),
482+ len);
402483 }
403484
404485 int mtd_wunit_to_pairing_info(struct mtd_info *mtd, int wunit,
@@ -439,8 +520,10 @@ int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, · 34 unmodified lines
439520
440521 static inline void mtd_sync(struct mtd_info *mtd)
441522 {
442− if (mtd->_sync)
443− mtd->_sync(mtd);
523+ struct mtd_info *master = mtd_get_master(mtd);
524+
525+ if (master->_sync)
526+ master->_sync(master);
444527 }
445528
446529 int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
@@ -452,13 +535,31 @@ int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs); · 5 unmodified lines
452535
453536 static inline int mtd_suspend(struct mtd_info *mtd)
454537 {
455− return mtd->_suspend ? mtd->_suspend(mtd) : 0;
538+ struct mtd_info *master = mtd_get_master(mtd);
539+ int ret;
540+
541+ if (master->master.suspended)
542+ return 0;
543+
544+ ret = master->_suspend ? master->_suspend(master) : 0;
545+ if (ret)
546+ return ret;
547+
548+ master->master.suspended = 1;
549+ return 0;
456550 }
457551
458552 static inline void mtd_resume(struct mtd_info *mtd)
459553 {
460− if (mtd->_resume)
461− mtd->_resume(mtd);
554+ struct mtd_info *master = mtd_get_master(mtd);
555+
556+ if (!master->master.suspended)
557+ return;
558+
559+ if (master->_resume)
560+ master->_resume(master);
561+
562+ master->master.suspended = 0;
462563 }
463564
464565 static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
@@ -538,7 +639,9 @@ static inline loff_t mtd_wunit_to_offset(struct mtd_info *mtd, loff_t base, · 73 unmodified lines
538639
539640 static inline int mtd_has_oob(const struct mtd_info *mtd)
540641 {
541− return mtd->_read_oob && mtd->_write_oob;
642+ struct mtd_info *master = mtd_get_master((struct mtd_info *)mtd);
643+
644+ return master->_read_oob && master->_write_oob;
542645 }
543646
544647 static inline int mtd_type_is_nand(const struct mtd_info *mtd)
@@ -548,7 +651,9 @@ static inline int mtd_type_is_nand(const struct mtd_info *mtd) · 3 unmodified lines
548651
549652 static inline int mtd_can_have_bb(const struct mtd_info *mtd)
550653 {
551− return !!mtd->_block_isbad;
654+ struct mtd_info *master = mtd_get_master((struct mtd_info *)mtd);
655+
656+ return !!master->_block_isbad;
552657 }
553658
554659 /* Kernel-side ioctl definitions */
include/linux/mtd/partitions.h+0−1
@@ -105,7 +105,6 @@ extern void deregister_mtd_parser(struct mtd_part_parser *parser); · 104 unmodified lines
105105 module_driver(__mtd_part_parser, register_mtd_parser, \
106106 deregister_mtd_parser)
107107
108−int mtd_is_partition(const struct mtd_info *mtd);
109108 int mtd_add_partition(struct mtd_info *master, const char *name,
110109 long long offset, long long length);
111110 int mtd_del_partition(struct mtd_info *master, int partno);
include/linux/mtd/rawnand.h+10−1
@@ -1064,6 +1064,8 @@ struct nand_legacy { · 1063 unmodified lines
10641064 * @lock: lock protecting the suspended field. Also used to
10651065 * serialize accesses to the NAND device.
10661066 * @suspended: set to 1 when the device is suspended, 0 when it's not.
1067+ * @suspend: [REPLACEABLE] specific NAND device suspend operation
1068+ * @resume: [REPLACEABLE] specific NAND device resume operation
10671069 * @bbt: [INTERN] bad block table pointer
10681070 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
10691071 * lookup.
@@ -1077,6 +1079,8 @@ struct nand_legacy { · 7 unmodified lines
10771079 * @manufacturer: [INTERN] Contains manufacturer information
10781080 * @manufacturer.desc: [INTERN] Contains manufacturer's description
10791081 * @manufacturer.priv: [INTERN] Contains manufacturer private information
1082+ * @lock_area: [REPLACEABLE] specific NAND chip lock operation
1083+ * @unlock_area: [REPLACEABLE] specific NAND chip unlock operation
10801084 */
10811085
10821086 struct nand_chip {
@@ -1117,6 +1121,8 @@ struct nand_chip { · 34 unmodified lines
11171121
11181122 struct mutex lock;
11191123 unsigned int suspended : 1;
1124+ int (*suspend)(struct nand_chip *chip);
1125+ void (*resume)(struct nand_chip *chip);
11201126
11211127 uint8_t *oob_poi;
11221128 struct nand_controller *controller;
@@ -1136,6 +1142,9 @@ struct nand_chip { · 13 unmodified lines
11361142 const struct nand_manufacturer *desc;
11371143 void *priv;
11381144 } manufacturer;
1145+
1146+ int (*lock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len);
1147+ int (*unlock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len);
11391148 };
11401149
11411150 extern const struct mtd_ooblayout_ops nand_ooblayout_sp_ops;
@@ -1215,7 +1224,7 @@ static inline struct device_node *nand_get_flash_node(struct nand_chip *chip) · 73 unmodified lines
12151224 * struct nand_flash_dev - NAND Flash Device ID Structure
12161225 * @name: a human-readable name of the NAND chip
12171226 * @dev_id: the device ID (the second byte of the full chip ID array)
1218− * @mfr_id: manufecturer ID part of the full chip ID array (refers the same
1227+ * @mfr_id: manufacturer ID part of the full chip ID array (refers the same
12191228 * memory address as ``id[0]``)
12201229 * @dev_id: device ID part of the full chip ID array (refers the same memory
12211230 * address as ``id[1]``)
include/linux/mtd/spi-nor.h+19−266
@@ -11,23 +11,6 @@ · 10 unmodified lines
1111 #include <linux/mtd/mtd.h>
1212 #include <linux/spi/spi-mem.h>
1313
14−/*
15− * Manufacturer IDs
16− *
17− * The first byte returned from the flash after sending opcode SPINOR_OP_RDID.
18− * Sometimes these are the same as CFI IDs, but sometimes they aren't.
19− */
20−#define SNOR_MFR_ATMEL CFI_MFR_ATMEL
21−#define SNOR_MFR_GIGADEVICE 0xc8
22−#define SNOR_MFR_INTEL CFI_MFR_INTEL
23−#define SNOR_MFR_ST CFI_MFR_ST /* ST Micro */
24−#define SNOR_MFR_MICRON CFI_MFR_MICRON /* Micron */
25−#define SNOR_MFR_ISSI CFI_MFR_PMC
26−#define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX
27−#define SNOR_MFR_SPANSION CFI_MFR_AMD
28−#define SNOR_MFR_SST CFI_MFR_SST
29−#define SNOR_MFR_WINBOND 0xef /* Also used by some Spansion */
30−
3114 /*
3215 * Note on opcode nomenclature: some opcodes have a format like
3316 * SPINOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number
@@ -128,7 +111,9 @@ · 94 unmodified lines
128111 #define SR_BP0 BIT(2) /* Block protect 0 */
129112 #define SR_BP1 BIT(3) /* Block protect 1 */
130113 #define SR_BP2 BIT(4) /* Block protect 2 */
114+#define SR_BP3 BIT(5) /* Block protect 3 */
131115 #define SR_TB_BIT5 BIT(5) /* Top/Bottom protect */
116+#define SR_BP3_BIT6 BIT(6) /* Block protect 3 */
132117 #define SR_TB_BIT6 BIT(6) /* Top/Bottom protect */
133118 #define SR_SRWD BIT(7) /* SR write protect */
134119 /* Spansion/Cypress specific status bits */
@@ -137,6 +122,8 @@ · 2 unmodified lines
137122
138123 #define SR1_QUAD_EN_BIT6 BIT(6)
139124
125+#define SR_BP_SHIFT 2
126+
140127 /* Enhanced Volatile Configuration Register bits */
141128 #define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */
142129
@@ -225,110 +212,6 @@ static inline u8 spi_nor_get_protocol_width(enum spi_nor_protocol proto) · 82 unmodified lines
225212 return spi_nor_get_protocol_data_nbits(proto);
226213 }
227214
228−enum spi_nor_option_flags {
229− SNOR_F_USE_FSR = BIT(0),
230− SNOR_F_HAS_SR_TB = BIT(1),
231− SNOR_F_NO_OP_CHIP_ERASE = BIT(2),
232− SNOR_F_READY_XSR_RDY = BIT(3),
233− SNOR_F_USE_CLSR = BIT(4),
234− SNOR_F_BROKEN_RESET = BIT(5),
235− SNOR_F_4B_OPCODES = BIT(6),
236− SNOR_F_HAS_4BAIT = BIT(7),
237− SNOR_F_HAS_LOCK = BIT(8),
238− SNOR_F_HAS_16BIT_SR = BIT(9),
239− SNOR_F_NO_READ_CR = BIT(10),
240− SNOR_F_HAS_SR_TB_BIT6 = BIT(11),
241−
242−};
243−
244−/**
245− * struct spi_nor_erase_type - Structure to describe a SPI NOR erase type
246− * @size: the size of the sector/block erased by the erase type.
247− * JEDEC JESD216B imposes erase sizes to be a power of 2.
248− * @size_shift: @size is a power of 2, the shift is stored in
249− * @size_shift.
250− * @size_mask: the size mask based on @size_shift.
251− * @opcode: the SPI command op code to erase the sector/block.
252− * @idx: Erase Type index as sorted in the Basic Flash Parameter
253− * Table. It will be used to synchronize the supported
254− * Erase Types with the ones identified in the SFDP
255− * optional tables.
256− */
257−struct spi_nor_erase_type {
258− u32 size;
259− u32 size_shift;
260− u32 size_mask;
261− u8 opcode;
262− u8 idx;
263−};
264−
265−/**
266− * struct spi_nor_erase_command - Used for non-uniform erases
267− * The structure is used to describe a list of erase commands to be executed
268− * once we validate that the erase can be performed. The elements in the list
269− * are run-length encoded.
270− * @list: for inclusion into the list of erase commands.
271− * @count: how many times the same erase command should be
272− * consecutively used.
273− * @size: the size of the sector/block erased by the command.
274− * @opcode: the SPI command op code to erase the sector/block.
275− */
276−struct spi_nor_erase_command {
277− struct list_head list;
278− u32 count;
279− u32 size;
280− u8 opcode;
281−};
282−
283−/**
284− * struct spi_nor_erase_region - Structure to describe a SPI NOR erase region
285− * @offset: the offset in the data array of erase region start.
286− * LSB bits are used as a bitmask encoding flags to
287− * determine if this region is overlaid, if this region is
288− * the last in the SPI NOR flash memory and to indicate
289− * all the supported erase commands inside this region.
290− * The erase types are sorted in ascending order with the
291− * smallest Erase Type size being at BIT(0).
292− * @size: the size of the region in bytes.
293− */
294−struct spi_nor_erase_region {
295− u64 offset;
296− u64 size;
297−};
298−
299−#define SNOR_ERASE_TYPE_MAX 4
300−#define SNOR_ERASE_TYPE_MASK GENMASK_ULL(SNOR_ERASE_TYPE_MAX - 1, 0)
301−
302−#define SNOR_LAST_REGION BIT(4)
303−#define SNOR_OVERLAID_REGION BIT(5)
304−
305−#define SNOR_ERASE_FLAGS_MAX 6
306−#define SNOR_ERASE_FLAGS_MASK GENMASK_ULL(SNOR_ERASE_FLAGS_MAX - 1, 0)
307−
308−/**
309− * struct spi_nor_erase_map - Structure to describe the SPI NOR erase map
310− * @regions: array of erase regions. The regions are consecutive in
311− * address space. Walking through the regions is done
312− * incrementally.
313− * @uniform_region: a pre-allocated erase region for SPI NOR with a uniform
314− * sector size (legacy implementation).
315− * @erase_type: an array of erase types shared by all the regions.
316− * The erase types are sorted in ascending order, with the
317− * smallest Erase Type size being the first member in the
318− * erase_type array.
319− * @uniform_erase_type: bitmask encoding erase types that can erase the
320− * entire memory. This member is completed at init by
321− * uniform and non-uniform SPI NOR flash memories if they
322− * support at least one erase type that can erase the
323− * entire memory.
324− */
325−struct spi_nor_erase_map {
326− struct spi_nor_erase_region *regions;
327− struct spi_nor_erase_region uniform_region;
328− struct spi_nor_erase_type erase_type[SNOR_ERASE_TYPE_MAX];
329− u8 uniform_erase_type;
330−};
331−
332215 /**
333216 * struct spi_nor_hwcaps - Structure for describing the hardware capabilies
334217 * supported by the SPI controller (bus master).
@@ -404,61 +287,7 @@ struct spi_nor_hwcaps { · 69 unmodified lines
404287 #define SNOR_HWCAPS_ALL (SNOR_HWCAPS_READ_MASK | \
405288 SNOR_HWCAPS_PP_MASK)
406289
407−struct spi_nor_read_command {
408− u8 num_mode_clocks;
409− u8 num_wait_states;
410− u8 opcode;
411− enum spi_nor_protocol proto;
412−};
413−
414−struct spi_nor_pp_command {
415− u8 opcode;
416− enum spi_nor_protocol proto;
417−};
418−
419−enum spi_nor_read_command_index {
420− SNOR_CMD_READ,
421− SNOR_CMD_READ_FAST,
422− SNOR_CMD_READ_1_1_1_DTR,
423−
424− /* Dual SPI */
425− SNOR_CMD_READ_1_1_2,
426− SNOR_CMD_READ_1_2_2,
427− SNOR_CMD_READ_2_2_2,
428− SNOR_CMD_READ_1_2_2_DTR,
429−
430− /* Quad SPI */
431− SNOR_CMD_READ_1_1_4,
432− SNOR_CMD_READ_1_4_4,
433− SNOR_CMD_READ_4_4_4,
434− SNOR_CMD_READ_1_4_4_DTR,
435−
436− /* Octal SPI */
437− SNOR_CMD_READ_1_1_8,
438− SNOR_CMD_READ_1_8_8,
439− SNOR_CMD_READ_8_8_8,
440− SNOR_CMD_READ_1_8_8_DTR,
441−
442− SNOR_CMD_READ_MAX
443−};
444−
445−enum spi_nor_pp_command_index {
446− SNOR_CMD_PP,
447−
448− /* Quad SPI */
449− SNOR_CMD_PP_1_1_4,
450− SNOR_CMD_PP_1_4_4,
451− SNOR_CMD_PP_4_4_4,
452−
453− /* Octal SPI */
454− SNOR_CMD_PP_1_1_8,
455− SNOR_CMD_PP_1_8_8,
456− SNOR_CMD_PP_8_8_8,
457−
458− SNOR_CMD_PP_MAX
459−};
460−
461−/* Forward declaration that will be used in 'struct spi_nor_flash_parameter' */
290+/* Forward declaration that is used in 'struct spi_nor_controller_ops' */
462291 struct spi_nor;
463292
464293 /**
@@ -489,68 +318,13 @@ struct spi_nor_controller_ops { · 24 unmodified lines
489318 int (*erase)(struct spi_nor *nor, loff_t offs);
490319 };
491320
492−/**
493− * struct spi_nor_locking_ops - SPI NOR locking methods
494− * @lock: lock a region of the SPI NOR.
495− * @unlock: unlock a region of the SPI NOR.
496− * @is_locked: check if a region of the SPI NOR is completely locked
497− */
498−struct spi_nor_locking_ops {
499− int (*lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
500− int (*unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
501− int (*is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len);
502−};
503−
504−/**
505− * struct spi_nor_flash_parameter - SPI NOR flash parameters and settings.
506− * Includes legacy flash parameters and settings that can be overwritten
507− * by the spi_nor_fixups hooks, or dynamically when parsing the JESD216
508− * Serial Flash Discoverable Parameters (SFDP) tables.
509− *
510− * @size: the flash memory density in bytes.
511− * @page_size: the page size of the SPI NOR flash memory.
512− * @hwcaps: describes the read and page program hardware
513− * capabilities.
514− * @reads: read capabilities ordered by priority: the higher index
515− * in the array, the higher priority.
516− * @page_programs: page program capabilities ordered by priority: the
517− * higher index in the array, the higher priority.
518− * @erase_map: the erase map parsed from the SFDP Sector Map Parameter
519− * Table.
520− * @quad_enable: enables SPI NOR quad mode.
521− * @set_4byte: puts the SPI NOR in 4 byte addressing mode.
522− * @convert_addr: converts an absolute address into something the flash
523− * will understand. Particularly useful when pagesize is
524− * not a power-of-2.
525− * @setup: configures the SPI NOR memory. Useful for SPI NOR
526− * flashes that have peculiarities to the SPI NOR standard
527− * e.g. different opcodes, specific address calculation,
528− * page size, etc.
529− * @locking_ops: SPI NOR locking methods.
530− */
531−struct spi_nor_flash_parameter {
532− u64 size;
533− u32 page_size;
534−
535− struct spi_nor_hwcaps hwcaps;
536− struct spi_nor_read_command reads[SNOR_CMD_READ_MAX];
537− struct spi_nor_pp_command page_programs[SNOR_CMD_PP_MAX];
538−
539− struct spi_nor_erase_map erase_map;
540−
541− int (*quad_enable)(struct spi_nor *nor);
542− int (*set_4byte)(struct spi_nor *nor, bool enable);
543− u32 (*convert_addr)(struct spi_nor *nor, u32 addr);
544− int (*setup)(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps);
545−
546− const struct spi_nor_locking_ops *locking_ops;
547−};
548−
549−/**
550− * struct flash_info - Forward declaration of a structure used internally by
551− * spi_nor_scan()
321+/*
322+ * Forward declarations that are used internally by the core and manufacturer
323+ * drivers.
552324 */
553325 struct flash_info;
326+struct spi_nor_manufacturer;
327+struct spi_nor_flash_parameter;
554328
555329 /**
556330 * struct spi_nor - Structure for defining a the SPI NOR layer
@@ -562,6 +336,7 @@ struct flash_info; · 5 unmodified lines
562336 * layer is not DMA-able
563337 * @bouncebuf_size: size of the bounce buffer
564338 * @info: spi-nor part JDEC MFR id and other info
339+ * @manufacturer: spi-nor manufacturer
565340 * @page_size: the page size of the SPI NOR
566341 * @addr_width: number of address bytes
567342 * @erase_opcode: the opcode for erasing a sector
@@ -578,6 +353,7 @@ struct flash_info; · 10 unmodified lines
578353 * The structure includes legacy flash parameters and
579354 * settings that can be overwritten by the spi_nor_fixups
580355 * hooks, or dynamically when parsing the SFDP tables.
356+ * @dirmap: pointers to struct spi_mem_dirmap_desc for reads/writes.
581357 * @priv: the private data
582358 */
583359 struct spi_nor {
@@ -588,6 +364,7 @@ struct spi_nor { · 4 unmodified lines
588364 u8 *bouncebuf;
589365 size_t bouncebuf_size;
590366 const struct flash_info *info;
367+ const struct spi_nor_manufacturer *manufacturer;
591368 u32 page_size;
592369 u8 addr_width;
593370 u8 erase_opcode;
@@ -602,40 +379,16 @@ struct spi_nor { · 8 unmodified lines
602379
603380 const struct spi_nor_controller_ops *controller_ops;
604381
605− struct spi_nor_flash_parameter params;
382+ struct spi_nor_flash_parameter *params;
383+
384+ struct {
385+ struct spi_mem_dirmap_desc *rdesc;
386+ struct spi_mem_dirmap_desc *wdesc;
387+ } dirmap;
606388
607389 void *priv;
608390 };
609391
610−static u64 __maybe_unused
611−spi_nor_region_is_last(const struct spi_nor_erase_region *region)
612−{
613− return region->offset & SNOR_LAST_REGION;
614−}
615−
616−static u64 __maybe_unused
617−spi_nor_region_end(const struct spi_nor_erase_region *region)
618−{
619− return (region->offset & ~SNOR_ERASE_FLAGS_MASK) + region->size;
620−}
621−
622−static void __maybe_unused
623−spi_nor_region_mark_end(struct spi_nor_erase_region *region)
624−{
625− region->offset |= SNOR_LAST_REGION;
626−}
627−
628−static void __maybe_unused
629−spi_nor_region_mark_overlay(struct spi_nor_erase_region *region)
630−{
631− region->offset |= SNOR_OVERLAID_REGION;
632−}
633−
634−static bool __maybe_unused spi_nor_has_uniform_erase(const struct spi_nor *nor)
635−{
636− return !!nor->params.erase_map.uniform_erase_type;
637−}
638−
639392 static inline void spi_nor_set_flash_node(struct spi_nor *nor,
640393 struct device_node *np)
641394 {
include/linux/mtd/spinand.h+45−22
@@ -32,9 +32,9 @@ · 31 unmodified lines
3232 SPI_MEM_OP_NO_DUMMY, \
3333 SPI_MEM_OP_NO_DATA)
3434
35−#define SPINAND_READID_OP(ndummy, buf, len) \
35+#define SPINAND_READID_OP(naddr, ndummy, buf, len) \
3636 SPI_MEM_OP(SPI_MEM_OP_CMD(0x9f, 1), \
37− SPI_MEM_OP_NO_ADDR, \
37+ SPI_MEM_OP_ADDR(naddr, 0, 1), \
3838 SPI_MEM_OP_DUMMY(ndummy, 1), \
3939 SPI_MEM_OP_DATA_IN(len, buf, 1))
4040
@@ -176,37 +176,46 @@ struct spinand_device; · 135 unmodified lines
176176 * @data: buffer containing the id bytes. Currently 4 bytes large, but can
177177 * be extended if required
178178 * @len: ID length
179− *
180− * struct_spinand_id->data contains all bytes returned after a READ_ID command,
181− * including dummy bytes if the chip does not emit ID bytes right after the
182− * READ_ID command. The responsibility to extract real ID bytes is left to
183− * struct_manufacurer_ops->detect().
184179 */
185180 struct spinand_id {
186181 u8 data[SPINAND_MAX_ID_LEN];
187182 int len;
188183 };
189184
185+enum spinand_readid_method {
186+ SPINAND_READID_METHOD_OPCODE,
187+ SPINAND_READID_METHOD_OPCODE_ADDR,
188+ SPINAND_READID_METHOD_OPCODE_DUMMY,
189+};
190+
191+/**
192+ * struct spinand_devid - SPI NAND device id structure
193+ * @id: device id of current chip
194+ * @len: number of bytes in device id
195+ * @method: method to read chip id
196+ * There are 3 possible variants:
197+ * SPINAND_READID_METHOD_OPCODE: chip id is returned immediately
198+ * after read_id opcode.
199+ * SPINAND_READID_METHOD_OPCODE_ADDR: chip id is returned after
200+ * read_id opcode + 1-byte address.
201+ * SPINAND_READID_METHOD_OPCODE_DUMMY: chip id is returned after
202+ * read_id opcode + 1 dummy byte.
203+ */
204+struct spinand_devid {
205+ const u8 *id;
206+ const u8 len;
207+ const enum spinand_readid_method method;
208+};
209+
190210 /**
191211 * struct manufacurer_ops - SPI NAND manufacturer specific operations
192− * @detect: detect a SPI NAND device. Every time a SPI NAND device is probed
193− * the core calls the struct_manufacurer_ops->detect() hook of each
194− * registered manufacturer until one of them return 1. Note that
195− * the first thing to check in this hook is that the manufacturer ID
196− * in struct_spinand_device->id matches the manufacturer whose
197− * ->detect() hook has been called. Should return 1 if there's a
198− * match, 0 if the manufacturer ID does not match and a negative
199− * error code otherwise. When true is returned, the core assumes
200− * that properties of the NAND chip (spinand->base.memorg and
201− * spinand->base.eccreq) have been filled
202212 * @init: initialize a SPI NAND device
203213 * @cleanup: cleanup a SPI NAND device
204214 *
205215 * Each SPI NAND manufacturer driver should implement this interface so that
206− * NAND chips coming from this vendor can be detected and initialized properly.
216+ * NAND chips coming from this vendor can be initialized properly.
207217 */
208218 struct spinand_manufacturer_ops {
209− int (*detect)(struct spinand_device *spinand);
210219 int (*init)(struct spinand_device *spinand);
211220 void (*cleanup)(struct spinand_device *spinand);
212221 };
@@ -215,11 +224,16 @@ struct spinand_manufacturer_ops { · 2 unmodified lines
215224 * struct spinand_manufacturer - SPI NAND manufacturer instance
216225 * @id: manufacturer ID
217226 * @name: manufacturer name
227+ * @devid_len: number of bytes in device ID
228+ * @chips: supported SPI NANDs under current manufacturer
229+ * @nchips: number of SPI NANDs available in chips array
218230 * @ops: manufacturer operations
219231 */
220232 struct spinand_manufacturer {
221233 u8 id;
222234 char *name;
235+ const struct spinand_info *chips;
236+ const size_t nchips;
223237 const struct spinand_manufacturer_ops *ops;
224238 };
225239
@@ -270,6 +284,7 @@ struct spinand_ecc_info { · 44 unmodified lines
270284 };
271285
272286 #define SPINAND_HAS_QE_BIT BIT(0)
287+#define SPINAND_HAS_CR_FEAT_BIT BIT(1)
273288
274289 /**
275290 * struct spinand_info - Structure used to describe SPI NAND chips
@@ -291,7 +306,7 @@ struct spinand_ecc_info { · 15 unmodified lines
291306 */
292307 struct spinand_info {
293308 const char *model;
294− u16 devid;
309+ struct spinand_devid devid;
295310 u32 flags;
296311 struct nand_memory_organization memorg;
297312 struct nand_ecc_req eccreq;
@@ -305,6 +320,13 @@ struct spinand_info { · 7 unmodified lines
305320 unsigned int target);
306321 };
307322
323+#define SPINAND_ID(__method, ...) \
324+ { \
325+ .id = (const u8[]){ __VA_ARGS__ }, \
326+ .len = sizeof((u8[]){ __VA_ARGS__ }), \
327+ .method = __method, \
328+ }
329+
308330 #define SPINAND_INFO_OP_VARIANTS(__read, __write, __update) \
309331 { \
310332 .read_cache = __read, \
@@ -451,9 +473,10 @@ static inline void spinand_set_of_node(struct spinand_device *spinand, · 140 unmodified lines
451473 nanddev_set_of_node(&spinand->base, np);
452474 }
453475
454−int spinand_match_and_init(struct spinand_device *dev,
476+int spinand_match_and_init(struct spinand_device *spinand,
455477 const struct spinand_info *table,
456− unsigned int table_size, u16 devid);
478+ unsigned int table_size,
479+ enum spinand_readid_method rdid_method);
457480
458481 int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);
459482 int spinand_select_target(struct spinand_device *spinand, unsigned int target);
include/linux/mutex.h+5−2
@@ -109,8 +109,11 @@ do { \ · 108 unmodified lines
109109 } while (0)
110110
111111 #ifdef CONFIG_DEBUG_LOCK_ALLOC
112−# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \
113− , .dep_map = { .name = #lockname }
112+# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \
113+ , .dep_map = { \
114+ .name = #lockname, \
115+ .wait_type_inner = LD_WAIT_SLEEP, \
116+ }
114117 #else
115118 # define __DEP_MAP_MUTEX_INITIALIZER(lockname)
116119 #endif
include/linux/namei.h+2−2
@@ -15,7 +15,7 @@ enum { MAX_NESTED_LINKS = 8 }; · 14 unmodified lines
1515 /*
1616 * Type of the last component on LOOKUP_PARENT
1717 */
18−enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
18+enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT};
1919
2020 /* pathwalk mode */
2121 #define LOOKUP_FOLLOW 0x0001 /* follow links at the end */
@@ -23,6 +23,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; · 1 unmodified line
2323 #define LOOKUP_AUTOMOUNT 0x0004 /* force terminal automount */
2424 #define LOOKUP_EMPTY 0x4000 /* accept empty path [user_... only] */
2525 #define LOOKUP_DOWN 0x8000 /* follow mounts in the starting point */
26+#define LOOKUP_MOUNTPOINT 0x0080 /* follow mounts in the end */
2627
2728 #define LOOKUP_REVAL 0x0020 /* tell ->d_revalidate() to trust no cache */
2829 #define LOOKUP_RCU 0x0040 /* RCU pathwalk mode; semi-internal */
@@ -64,7 +65,6 @@ extern struct dentry *kern_path_create(int, const char *, struct path *, unsigne · 35 unmodified lines
6465 extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
6566 extern void done_path_create(struct path *, struct dentry *);
6667 extern struct dentry *kern_path_locked(const char *, struct path *);
67−extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int);
6868
6969 extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int);
7070 extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
include/linux/netdev_features.h+3−0
@@ -83,6 +83,8 @@ enum { · 82 unmodified lines
8383 NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */
8484 NETIF_F_GRO_FRAGLIST_BIT, /* Fraglist GRO */
8585
86+ NETIF_F_HW_MACSEC_BIT, /* Offload MACsec operations */
87+
8688 /*
8789 * Add your fresh new feature above and remember to update
8890 * netdev_features_strings[] in net/core/ethtool.c and maybe
@@ -154,6 +156,7 @@ enum { · 65 unmodified lines
154156 #define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX)
155157 #define NETIF_F_GRO_FRAGLIST __NETIF_F(GRO_FRAGLIST)
156158 #define NETIF_F_GSO_FRAGLIST __NETIF_F(GSO_FRAGLIST)
159+#define NETIF_F_HW_MACSEC __NETIF_F(HW_MACSEC)
157160
158161 /* Finds the next feature with the highest number of the range of start till 0.
159162 */
include/linux/netdevice.h+16−6
@@ -53,6 +53,8 @@ struct netpoll_info; · 52 unmodified lines
5353 struct device;
5454 struct phy_device;
5555 struct dsa_port;
56+struct macsec_context;
57+struct macsec_ops;
5658
5759 struct sfp_bus;
5860 /* 802.11 specific */
@@ -664,7 +666,7 @@ static inline void netdev_queue_numa_node_write(struct netdev_queue *q, int node · 605 unmodified lines
664666 struct rps_map {
665667 unsigned int len;
666668 struct rcu_head rcu;
667− u16 cpus[0];
669+ u16 cpus[];
668670 };
669671 #define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16)))
670672
@@ -686,7 +688,7 @@ struct rps_dev_flow { · 15 unmodified lines
686688 struct rps_dev_flow_table {
687689 unsigned int mask;
688690 struct rcu_head rcu;
689− struct rps_dev_flow flows[0];
691+ struct rps_dev_flow flows[];
690692 };
691693 #define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
692694 ((_num) * sizeof(struct rps_dev_flow)))
@@ -704,7 +706,7 @@ struct rps_dev_flow_table { · 11 unmodified lines
704706 struct rps_sock_flow_table {
705707 u32 mask;
706708
707− u32 ents[0] ____cacheline_aligned_in_smp;
709+ u32 ents[] ____cacheline_aligned_in_smp;
708710 };
709711 #define RPS_SOCK_FLOW_TABLE_SIZE(_num) (offsetof(struct rps_sock_flow_table, ents[_num]))
710712
@@ -767,7 +769,7 @@ struct xps_map { · 56 unmodified lines
767769 unsigned int len;
768770 unsigned int alloc_len;
769771 struct rcu_head rcu;
770− u16 queues[0];
772+ u16 queues[];
771773 };
772774 #define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
773775 #define XPS_MIN_MAP_ALLOC ((L1_CACHE_ALIGN(offsetof(struct xps_map, queues[1])) \
@@ -778,7 +780,7 @@ struct xps_map { · 4 unmodified lines
778780 */
779781 struct xps_dev_maps {
780782 struct rcu_head rcu;
781− struct xps_map __rcu *attr_map[0]; /* Either CPUs map or RXQs map */
783+ struct xps_map __rcu *attr_map[]; /* Either CPUs map or RXQs map */
782784 };
783785
784786 #define XPS_CPU_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \
@@ -853,6 +855,7 @@ enum tc_setup_type { · 68 unmodified lines
853855 TC_SETUP_FT,
854856 TC_SETUP_QDISC_ETS,
855857 TC_SETUP_QDISC_TBF,
858+ TC_SETUP_QDISC_FIFO,
856859 };
857860
858861 /* These structures hold the attributes of bpf state that are being passed
@@ -1818,6 +1821,8 @@ enum netdev_priv_flags { · 959 unmodified lines
18181821 * that follow this device when it is moved
18191822 * to another network namespace.
18201823 *
1824+ * @macsec_ops: MACsec offloading ops
1825+ *
18211826 * FIXME: cleanup struct net_device such that network protocol info
18221827 * moves out.
18231828 */
@@ -2112,6 +2117,11 @@ struct net_device { · 288 unmodified lines
21122117 unsigned wol_enabled:1;
21132118
21142119 struct list_head net_notifier_list;
2120+
2121+#if IS_ENABLED(CONFIG_MACSEC)
2122+ /* MACsec management functions */
2123+ const struct macsec_ops *macsec_ops;
2124+#endif
21152125 };
21162126 #define to_net_dev(d) container_of(d, struct net_device, dev)
21172127
@@ -3767,7 +3777,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, · 1649 unmodified lines
37673777
37683778 typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf);
37693779 int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
3770− int fd, u32 flags);
3780+ int fd, int expected_fd, u32 flags);
37713781 u32 __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op,
37723782 enum bpf_netdev_command cmd);
37733783 int xdp_umem_query(struct net_device *dev, u16 queue_id);
include/linux/netfilter/ipset/ip_set.h+1−1
@@ -98,7 +98,7 @@ struct ip_set_counter { · 97 unmodified lines
9898
9999 struct ip_set_comment_rcu {
100100 struct rcu_head rcu;
101− char str[0];
101+ char str[];
102102 };
103103
104104 struct ip_set_comment {
include/linux/netfilter/x_tables.h+4−4
@@ -264,7 +264,7 @@ struct xt_table_info { · 263 unmodified lines
264264 unsigned int stacksize;
265265 void ***jumpstack;
266266
267− unsigned char entries[0] __aligned(8);
267+ unsigned char entries[] __aligned(8);
268268 };
269269
270270 int xt_register_target(struct xt_target *target);
@@ -464,7 +464,7 @@ struct compat_xt_entry_match { · 193 unmodified lines
464464 } kernel;
465465 u_int16_t match_size;
466466 } u;
467− unsigned char data[0];
467+ unsigned char data[];
468468 };
469469
470470 struct compat_xt_entry_target {
@@ -480,7 +480,7 @@ struct compat_xt_entry_target { · 9 unmodified lines
480480 } kernel;
481481 u_int16_t target_size;
482482 } u;
483− unsigned char data[0];
483+ unsigned char data[];
484484 };
485485
486486 /* FIXME: this works only on 32 bit tasks
@@ -494,7 +494,7 @@ struct compat_xt_counters { · 7 unmodified lines
494494 struct compat_xt_counters_info {
495495 char name[XT_TABLE_MAXNAMELEN];
496496 compat_uint_t num_counters;
497− struct compat_xt_counters counters[0];
497+ struct compat_xt_counters counters[];
498498 };
499499
500500 struct _compat_xt_align {
include/linux/netfilter_arp/arp_tables.h+1−1
@@ -67,7 +67,7 @@ struct compat_arpt_entry { · 66 unmodified lines
6767 __u16 next_offset;
6868 compat_uint_t comefrom;
6969 struct compat_xt_counters counters;
70− unsigned char elems[0];
70+ unsigned char elems[];
7171 };
7272
7373 static inline struct xt_entry_target *
include/linux/netfilter_bridge/ebtables.h+1−1
@@ -85,7 +85,7 @@ struct ebt_table_info { · 84 unmodified lines
8585 /* room to maintain the stack used for jumping from and into udc */
8686 struct ebt_chainstack **chainstack;
8787 char *entries;
88− struct ebt_counter counters[0] ____cacheline_aligned;
88+ struct ebt_counter counters[] ____cacheline_aligned;
8989 };
9090
9191 struct ebt_table {
include/linux/netfilter_ipv4/ip_tables.h+1−1
@@ -76,7 +76,7 @@ struct compat_ipt_entry { · 75 unmodified lines
7676 __u16 next_offset;
7777 compat_uint_t comefrom;
7878 struct compat_xt_counters counters;
79− unsigned char elems[0];
79+ unsigned char elems[];
8080 };
8181
8282 /* Helper functions */
include/linux/netfilter_ipv6/ip6_tables.h+1−1
@@ -43,7 +43,7 @@ struct compat_ip6t_entry { · 42 unmodified lines
4343 __u16 next_offset;
4444 compat_uint_t comefrom;
4545 struct compat_xt_counters counters;
46− unsigned char elems[0];
46+ unsigned char elems[];
4747 };
4848
4949 static inline struct xt_entry_target *
include/linux/netlink.h+15−2
@@ -115,6 +115,19 @@ static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack, · 114 unmodified lines
115115 {
116116 u64 __cookie = cookie;
117117
118+ if (!extack)
119+ return;
120+ memcpy(extack->cookie, &__cookie, sizeof(__cookie));
121+ extack->cookie_len = sizeof(__cookie);
122+}
123+
124+static inline void nl_set_extack_cookie_u32(struct netlink_ext_ack *extack,
125+ u32 cookie)
126+{
127+ u32 __cookie = cookie;
128+
129+ if (!extack)
130+ return;
118131 memcpy(extack->cookie, &__cookie, sizeof(__cookie));
119132 extack->cookie_len = sizeof(__cookie);
120133 }
@@ -188,10 +201,10 @@ struct netlink_callback { · 67 unmodified lines
188201 struct module *module;
189202 struct netlink_ext_ack *extack;
190203 u16 family;
191− u16 min_dump_alloc;
192− bool strict_check;
193204 u16 answer_flags;
205+ u32 min_dump_alloc;
194206 unsigned int prev_seq, seq;
207+ bool strict_check;
195208 union {
196209 u8 ctx[48];
197210
include/linux/nfs_fs.h+1−0
@@ -354,6 +354,7 @@ static inline unsigned long nfs_save_change_attribute(struct inode *dir) · 353 unmodified lines
354354 extern int nfs_sync_mapping(struct address_space *mapping);
355355 extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
356356 extern void nfs_zap_caches(struct inode *);
357+extern void nfs_set_inode_stale(struct inode *inode);
357358 extern void nfs_invalidate_atime(struct inode *);
358359 extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
359360 struct nfs_fattr *, struct nfs4_label *);
include/linux/nfs_page.h+5−0
@@ -139,9 +139,14 @@ extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, · 138 unmodified lines
139139 extern int nfs_wait_on_request(struct nfs_page *);
140140 extern void nfs_unlock_request(struct nfs_page *req);
141141 extern void nfs_unlock_and_release_request(struct nfs_page *);
142+extern struct nfs_page *nfs_page_group_lock_head(struct nfs_page *req);
143+extern int nfs_page_group_lock_subrequests(struct nfs_page *head);
144+extern void nfs_join_page_group(struct nfs_page *head, struct inode *inode);
142145 extern int nfs_page_group_lock(struct nfs_page *);
143146 extern void nfs_page_group_unlock(struct nfs_page *);
144147 extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
148+extern int nfs_page_set_headlock(struct nfs_page *req);
149+extern void nfs_page_clear_headlock(struct nfs_page *req);
145150 extern bool nfs_async_iocounter_wait(struct rpc_task *, struct nfs_lock_context *);
146151
147152 /*
include/linux/nfs_xdr.h+16−17
@@ -75,6 +75,7 @@ struct nfs_fattr { · 74 unmodified lines
7575 struct nfs4_string *owner_name;
7676 struct nfs4_string *group_name;
7777 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
78+ struct nfs4_label *label;
7879 };
7980
8081 #define NFS_ATTR_FATTR_TYPE (1U << 0)
@@ -1265,16 +1266,25 @@ struct nfstime4 { · 1184 unmodified lines
12651266 struct pnfs_commit_bucket {
12661267 struct list_head written;
12671268 struct list_head committing;
1268− struct pnfs_layout_segment *wlseg;
1269− struct pnfs_layout_segment *clseg;
1269+ struct pnfs_layout_segment *lseg;
12701270 struct nfs_writeverf direct_verf;
12711271 };
12721272
1273+struct pnfs_commit_array {
1274+ struct list_head cinfo_list;
1275+ struct list_head lseg_list;
1276+ struct pnfs_layout_segment *lseg;
1277+ struct rcu_head rcu;
1278+ refcount_t refcount;
1279+ unsigned int nbuckets;
1280+ struct pnfs_commit_bucket buckets[];
1281+};
1282+
12731283 struct pnfs_ds_commit_info {
1274− int nwritten;
1275− int ncommitting;
1276− int nbuckets;
1277− struct pnfs_commit_bucket *buckets;
1284+ struct list_head commits;
1285+ unsigned int nwritten;
1286+ unsigned int ncommitting;
1287+ const struct pnfs_commit_ops *ops;
12781288 };
12791289
12801290 struct nfs41_state_protection {
@@ -1385,22 +1395,11 @@ struct nfs41_free_stateid_res { · 104 unmodified lines
13851395 unsigned int status;
13861396 };
13871397
1388−static inline void
1389−nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1390−{
1391− kfree(cinfo->buckets);
1392−}
1393−
13941398 #else
13951399
13961400 struct pnfs_ds_commit_info {
13971401 };
13981402
1399−static inline void
1400−nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1401−{
1402−}
1403−
14041403 #endif /* CONFIG_NFS_V4_1 */
14051404
14061405 #ifdef CONFIG_NFS_V4_2
include/linux/numa.h+29−1
@@ -1,7 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 #ifndef _LINUX_NUMA_H
33 #define _LINUX_NUMA_H
4−
4+#include <linux/types.h>
55
66 #ifdef CONFIG_NODES_SHIFT
77 #define NODES_SHIFT CONFIG_NODES_SHIFT
@@ -13,4 +13,32 @@ · 5 unmodified lines
1313
1414 #define NUMA_NO_NODE (-1)
1515
16+/* optionally keep NUMA memory info available post init */
17+#ifdef CONFIG_NUMA_KEEP_MEMINFO
18+#define __initdata_or_meminfo
19+#else
20+#define __initdata_or_meminfo __initdata
21+#endif
22+
23+#ifdef CONFIG_NUMA
24+/* Generic implementation available */
25+int numa_map_to_online_node(int node);
26+
27+/*
28+ * Optional architecture specific implementation, users need a "depends
29+ * on $ARCH"
30+ */
31+int phys_to_target_node(phys_addr_t addr);
32+#else
33+static inline int numa_map_to_online_node(int node)
34+{
35+ return NUMA_NO_NODE;
36+}
37+
38+static inline int phys_to_target_node(phys_addr_t addr)
39+{
40+ return NUMA_NO_NODE;
41+}
42+#endif
43+
1644 #endif /* _LINUX_NUMA_H */
include/linux/nvme-fc-driver.h+0−4
@@ -270,8 +270,6 @@ struct nvme_fc_remote_port { · 269 unmodified lines
270270 *
271271 * Host/Initiator Transport Entrypoints/Parameters:
272272 *
273− * @module: The LLDD module using the interface
274− *
275273 * @localport_delete: The LLDD initiates deletion of a localport via
276274 * nvme_fc_deregister_localport(). However, the teardown is
277275 * asynchronous. This routine is called upon the completion of the
@@ -385,8 +383,6 @@ struct nvme_fc_remote_port { · 107 unmodified lines
385383 * Value is Mandatory. Allowed to be zero.
386384 */
387385 struct nvme_fc_port_template {
388− struct module *module;
389−
390386 /* initiator-based functions */
391387 void (*localport_delete)(struct nvme_fc_local_port *);
392388 void (*remoteport_delete)(struct nvme_fc_remote_port *);
include/linux/nvmem-consumer.h+7−0
@@ -63,6 +63,7 @@ void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); · 62 unmodified lines
6363 int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len);
6464 int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val);
6565 int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val);
66+int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val);
6667
6768 /* direct nvmem device read/write interface */
6869 struct nvmem_device *nvmem_device_get(struct device *dev, const char *name);
@@ -138,6 +139,12 @@ static inline int nvmem_cell_read_u32(struct device *dev, · 69 unmodified lines
138139 return -EOPNOTSUPP;
139140 }
140141
142+static inline int nvmem_cell_read_u64(struct device *dev,
143+ const char *cell_id, u64 *val)
144+{
145+ return -EOPNOTSUPP;
146+}
147+
141148 static inline struct nvmem_device *nvmem_device_get(struct device *dev,
142149 const char *name)
143150 {
include/linux/of_address.h+9−4
@@ -10,21 +10,27 @@ struct of_pci_range_parser { · 9 unmodified lines
1010 struct device_node *node;
1111 const __be32 *range;
1212 const __be32 *end;
13− int np;
13+ int na;
14+ int ns;
1415 int pna;
1516 bool dma;
1617 };
18+#define of_range_parser of_pci_range_parser
1719
1820 struct of_pci_range {
19− u32 pci_space;
20− u64 pci_addr;
21+ union {
22+ u64 pci_addr;
23+ u64 bus_addr;
24+ };
2125 u64 cpu_addr;
2226 u64 size;
2327 u32 flags;
2428 };
29+#define of_range of_pci_range
2530
2631 #define for_each_of_pci_range(parser, range) \
2732 for (; of_pci_range_parser_one(parser, range);)
33+#define for_each_of_range for_each_of_pci_range
2834
2935 /* Translate a DMA address from device space to CPU space */
3036 extern u64 of_translate_dma_address(struct device_node *dev,
@@ -143,4 +149,3 @@ static inline int of_pci_range_to_resource(struct of_pci_range *range, · 112 unmodified lines
143149 #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
144150
145151 #endif /* __OF_ADDRESS_H */
146−
include/linux/of_clk.h+4−4
@@ -11,17 +11,17 @@ struct of_device_id; · 10 unmodified lines
1111
1212 #if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF)
1313
14−unsigned int of_clk_get_parent_count(struct device_node *np);
15−const char *of_clk_get_parent_name(struct device_node *np, int index);
14+unsigned int of_clk_get_parent_count(const struct device_node *np);
15+const char *of_clk_get_parent_name(const struct device_node *np, int index);
1616 void of_clk_init(const struct of_device_id *matches);
1717
1818 #else /* !CONFIG_COMMON_CLK || !CONFIG_OF */
1919
20−static inline unsigned int of_clk_get_parent_count(struct device_node *np)
20+static inline unsigned int of_clk_get_parent_count(const struct device_node *np)
2121 {
2222 return 0;
2323 }
24−static inline const char *of_clk_get_parent_name(struct device_node *np,
24+static inline const char *of_clk_get_parent_name(const struct device_node *np,
2525 int index)
2626 {
2727 return NULL;
include/linux/of_gpio.h+6−3
@@ -11,9 +11,8 @@ · 10 unmodified lines
1111 #define __LINUX_OF_GPIO_H
1212
1313 #include <linux/compiler.h>
14−#include <linux/kernel.h>
15−#include <linux/errno.h>
16−#include <linux/gpio.h>
14+#include <linux/gpio/driver.h>
15+#include <linux/gpio.h> /* FIXME: Shouldn't be here */
1716 #include <linux/of.h>
1817
1918 struct device_node;
@@ -34,6 +33,8 @@ enum of_gpio_flags { · 14 unmodified lines
3433
3534 #ifdef CONFIG_OF_GPIO
3635
36+#include <linux/kernel.h>
37+
3738 /*
3839 * OF GPIO chip for memory mapped banks
3940 */
@@ -63,6 +64,8 @@ extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc); · 23 unmodified lines
6364
6465 #else /* CONFIG_OF_GPIO */
6566
67+#include <linux/errno.h>
68+
6669 /* Drivers may not strictly depend on the GPIO support, so let them link. */
6770 static inline int of_get_named_gpio_flags(struct device_node *np,
6871 const char *list_name, int index, enum of_gpio_flags *flags)
include/linux/page-flags.h+17−1
@@ -63,6 +63,11 @@ · 62 unmodified lines
6363 * page_waitqueue(page) is a wait queue of all tasks waiting for the page
6464 * to become unlocked.
6565 *
66+ * PG_swapbacked is set when a page uses swap as a backing storage. This are
67+ * usually PageAnon or shmem pages but please note that even anonymous pages
68+ * might lose their PG_swapbacked flag when they simply can be dropped (e.g. as
69+ * a result of MADV_FREE).
70+ *
6671 * PG_uptodate tells whether the page's contents is valid. When a read
6772 * completes, the page becomes uptodate, unless a disk I/O error happened.
6873 *
@@ -163,6 +168,9 @@ enum pageflags { · 94 unmodified lines
163168
164169 /* non-lru isolated movable page */
165170 PG_isolated = PG_reclaim,
171+
172+ /* Only valid for buddy pages. Used to track pages that are reported */
173+ PG_reported = PG_uptodate,
166174 };
167175
168176 #ifndef __GENERATING_BOUNDS_H
@@ -311,7 +319,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } · 142 unmodified lines
311319
312320 __PAGEFLAG(Locked, locked, PF_NO_TAIL)
313321 PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD)
314−PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, PF_NO_COMPOUND)
322+PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL)
315323 PAGEFLAG(Referenced, referenced, PF_HEAD)
316324 TESTCLEARFLAG(Referenced, referenced, PF_HEAD)
317325 __SETPAGEFLAG(Referenced, referenced, PF_HEAD)
@@ -431,6 +439,14 @@ TESTCLEARFLAG(Young, young, PF_ANY) · 113 unmodified lines
431439 PAGEFLAG(Idle, idle, PF_ANY)
432440 #endif
433441
442+/*
443+ * PageReported() is used to track reported free pages within the Buddy
444+ * allocator. We can use the non-atomic version of the test and set
445+ * operations as both should be shielded with the zone lock to prevent
446+ * any possible races on the setting or clearing of the bit.
447+ */
448+__PAGEFLAG(Reported, reported, PF_NO_COMPOUND)
449+
434450 /*
435451 * On an anonymous page mapped into a user virtual memory area,
436452 * page->mapping points to its anon_vma, not to a struct address_space;
include/linux/page_ref.h+9−0
@@ -102,6 +102,15 @@ static inline void page_ref_sub(struct page *page, int nr) · 101 unmodified lines
102102 __page_ref_mod(page, -nr);
103103 }
104104
105+static inline int page_ref_sub_return(struct page *page, int nr)
106+{
107+ int ret = atomic_sub_return(nr, &page->_refcount);
108+
109+ if (page_ref_tracepoint_active(__tracepoint_page_ref_mod_and_return))
110+ __page_ref_mod_and_return(page, -nr, ret);
111+ return ret;
112+}
113+
105114 static inline void page_ref_inc(struct page *page)
106115 {
107116 atomic_inc(&page->_refcount);
include/linux/page_reporting.h+26−0
@@ -0,0 +1,26 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_PAGE_REPORTING_H
3+#define _LINUX_PAGE_REPORTING_H
4+
5+#include <linux/mmzone.h>
6+#include <linux/scatterlist.h>
7+
8+/* This value should always be a power of 2, see page_reporting_cycle() */
9+#define PAGE_REPORTING_CAPACITY 32
10+
11+struct page_reporting_dev_info {
12+ /* function that alters pages to make them "reported" */
13+ int (*report)(struct page_reporting_dev_info *prdev,
14+ struct scatterlist *sg, unsigned int nents);
15+
16+ /* work struct for processing reports */
17+ struct delayed_work work;
18+
19+ /* Current state of page reporting */
20+ atomic_t state;
21+};
22+
23+/* Tear-down and bring-up for page reporting devices */
24+void page_reporting_unregister(struct page_reporting_dev_info *prdev);
25+int page_reporting_register(struct page_reporting_dev_info *prdev);
26+#endif /*_LINUX_PAGE_REPORTING_H */
include/linux/pagemap.h+15−14
@@ -33,8 +33,8 @@ enum mapping_flags { · 32 unmodified lines
3333
3434 /**
3535 * mapping_set_error - record a writeback error in the address_space
36− * @mapping - the mapping in which an error should be set
37− * @error - the error to set in the mapping
36+ * @mapping: the mapping in which an error should be set
37+ * @error: the error to set in the mapping
3838 *
3939 * When writeback fails in some way, we must record that error so that
4040 * userspace can be informed when fsync and the like are called. We endeavor
@@ -70,11 +70,9 @@ static inline void mapping_clear_unevictable(struct address_space *mapping) · 29 unmodified lines
7070 clear_bit(AS_UNEVICTABLE, &mapping->flags);
7171 }
7272
73−static inline int mapping_unevictable(struct address_space *mapping)
73+static inline bool mapping_unevictable(struct address_space *mapping)
7474 {
75− if (mapping)
76− return test_bit(AS_UNEVICTABLE, &mapping->flags);
77− return !!mapping;
75+ return mapping && test_bit(AS_UNEVICTABLE, &mapping->flags);
7876 }
7977
8078 static inline void mapping_set_exiting(struct address_space *mapping)
@@ -305,9 +303,9 @@ static inline struct page *find_lock_page(struct address_space *mapping, · 224 unmodified lines
305303 * atomic allocation!
306304 */
307305 static inline struct page *find_or_create_page(struct address_space *mapping,
308− pgoff_t offset, gfp_t gfp_mask)
306+ pgoff_t index, gfp_t gfp_mask)
309307 {
310− return pagecache_get_page(mapping, offset,
308+ return pagecache_get_page(mapping, index,
311309 FGP_LOCK|FGP_ACCESSED|FGP_CREAT,
312310 gfp_mask);
313311 }
@@ -333,14 +331,17 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, · 19 unmodified lines
333331 mapping_gfp_mask(mapping));
334332 }
335333
336−static inline struct page *find_subpage(struct page *page, pgoff_t offset)
334+/*
335+ * Given the page we found in the page cache, return the page corresponding
336+ * to this index in the file
337+ */
338+static inline struct page *find_subpage(struct page *head, pgoff_t index)
337339 {
338− if (PageHuge(page))
339− return page;
340−
341− VM_BUG_ON_PAGE(PageTail(page), page);
340+ /* HugeTLBfs wants the head page regardless */
341+ if (PageHuge(head))
342+ return head;
342343
343− return page + (offset & (compound_nr(page) - 1));
344+ return head + (index & (hpage_nr_pages(head) - 1));
344345 }
345346
346347 struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);
include/linux/part_stat.h+115−0
@@ -0,0 +1,115 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_PART_STAT_H
3+#define _LINUX_PART_STAT_H
4+
5+#include <linux/genhd.h>
6+
7+/*
8+ * Macros to operate on percpu disk statistics:
9+ *
10+ * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters
11+ * and should be called between disk_stat_lock() and
12+ * disk_stat_unlock().
13+ *
14+ * part_stat_read() can be called at any time.
15+ *
16+ * part_stat_{add|set_all}() and {init|free}_part_stats are for
17+ * internal use only.
18+ */
19+#ifdef CONFIG_SMP
20+#define part_stat_lock() ({ rcu_read_lock(); get_cpu(); })
21+#define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0)
22+
23+#define part_stat_get_cpu(part, field, cpu) \
24+ (per_cpu_ptr((part)->dkstats, (cpu))->field)
25+
26+#define part_stat_get(part, field) \
27+ part_stat_get_cpu(part, field, smp_processor_id())
28+
29+#define part_stat_read(part, field) \
30+({ \
31+ typeof((part)->dkstats->field) res = 0; \
32+ unsigned int _cpu; \
33+ for_each_possible_cpu(_cpu) \
34+ res += per_cpu_ptr((part)->dkstats, _cpu)->field; \
35+ res; \
36+})
37+
38+static inline void part_stat_set_all(struct hd_struct *part, int value)
39+{
40+ int i;
41+
42+ for_each_possible_cpu(i)
43+ memset(per_cpu_ptr(part->dkstats, i), value,
44+ sizeof(struct disk_stats));
45+}
46+
47+static inline int init_part_stats(struct hd_struct *part)
48+{
49+ part->dkstats = alloc_percpu(struct disk_stats);
50+ if (!part->dkstats)
51+ return 0;
52+ return 1;
53+}
54+
55+static inline void free_part_stats(struct hd_struct *part)
56+{
57+ free_percpu(part->dkstats);
58+}
59+
60+#else /* !CONFIG_SMP */
61+#define part_stat_lock() ({ rcu_read_lock(); 0; })
62+#define part_stat_unlock() rcu_read_unlock()
63+
64+#define part_stat_get(part, field) ((part)->dkstats.field)
65+#define part_stat_get_cpu(part, field, cpu) part_stat_get(part, field)
66+#define part_stat_read(part, field) part_stat_get(part, field)
67+
68+static inline void part_stat_set_all(struct hd_struct *part, int value)
69+{
70+ memset(&part->dkstats, value, sizeof(struct disk_stats));
71+}
72+
73+static inline int init_part_stats(struct hd_struct *part)
74+{
75+ return 1;
76+}
77+
78+static inline void free_part_stats(struct hd_struct *part)
79+{
80+}
81+
82+#endif /* CONFIG_SMP */
83+
84+#define part_stat_read_accum(part, field) \
85+ (part_stat_read(part, field[STAT_READ]) + \
86+ part_stat_read(part, field[STAT_WRITE]) + \
87+ part_stat_read(part, field[STAT_DISCARD]))
88+
89+#define __part_stat_add(part, field, addnd) \
90+ (part_stat_get(part, field) += (addnd))
91+
92+#define part_stat_add(part, field, addnd) do { \
93+ __part_stat_add((part), field, addnd); \
94+ if ((part)->partno) \
95+ __part_stat_add(&part_to_disk((part))->part0, \
96+ field, addnd); \
97+} while (0)
98+
99+#define part_stat_dec(gendiskp, field) \
100+ part_stat_add(gendiskp, field, -1)
101+#define part_stat_inc(gendiskp, field) \
102+ part_stat_add(gendiskp, field, 1)
103+#define part_stat_sub(gendiskp, field, subnd) \
104+ part_stat_add(gendiskp, field, -subnd)
105+
106+#define part_stat_local_dec(gendiskp, field) \
107+ local_dec(&(part_stat_get(gendiskp, field)))
108+#define part_stat_local_inc(gendiskp, field) \
109+ local_inc(&(part_stat_get(gendiskp, field)))
110+#define part_stat_local_read(gendiskp, field) \
111+ local_read(&(part_stat_get(gendiskp, field)))
112+#define part_stat_local_read_cpu(gendiskp, field, cpu) \
113+ local_read(&(part_stat_get_cpu(gendiskp, field, cpu)))
114+
115+#endif /* _LINUX_PART_STAT_H */
include/linux/pci-acpi.h+8−0
@@ -112,6 +112,14 @@ extern const guid_t pci_acpi_dsm_guid; · 111 unmodified lines
112112 #define RESET_DELAY_DSM 0x08
113113 #define FUNCTION_DELAY_DSM 0x09
114114
115+#ifdef CONFIG_PCIE_EDR
116+void pci_acpi_add_edr_notifier(struct pci_dev *pdev);
117+void pci_acpi_remove_edr_notifier(struct pci_dev *pdev);
118+#else
119+static inline void pci_acpi_add_edr_notifier(struct pci_dev *pdev) { }
120+static inline void pci_acpi_remove_edr_notifier(struct pci_dev *pdev) { }
121+#endif /* CONFIG_PCIE_EDR */
122+
115123 #else /* CONFIG_ACPI */
116124 static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
117125 static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }
include/linux/pci-epc.h+22−5
@@ -53,7 +53,8 @@ struct pci_epc_ops { · 52 unmodified lines
5353 phys_addr_t addr);
5454 int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts);
5555 int (*get_msi)(struct pci_epc *epc, u8 func_no);
56− int (*set_msix)(struct pci_epc *epc, u8 func_no, u16 interrupts);
56+ int (*set_msix)(struct pci_epc *epc, u8 func_no, u16 interrupts,
57+ enum pci_barno, u32 offset);
5758 int (*get_msix)(struct pci_epc *epc, u8 func_no);
5859 int (*raise_irq)(struct pci_epc *epc, u8 func_no,
5960 enum pci_epc_irq_type type, u16 interrupt_num);
@@ -71,6 +72,7 @@ struct pci_epc_ops { · 11 unmodified lines
7172 * @bitmap: bitmap to manage the PCI address space
7273 * @pages: number of bits representing the address region
7374 * @page_size: size of each page
75+ * @lock: mutex to protect bitmap
7476 */
7577 struct pci_epc_mem {
7678 phys_addr_t phys_base;
@@ -78,6 +80,8 @@ struct pci_epc_mem { · 1 unmodified line
7880 unsigned long *bitmap;
7981 size_t page_size;
8082 int pages;
83+ /* mutex to protect against concurrent access for memory allocation*/
84+ struct mutex lock;
8185 };
8286
8387 /**
@@ -88,7 +92,9 @@ struct pci_epc_mem { · 4 unmodified lines
8892 * @mem: address space of the endpoint controller
8993 * @max_functions: max number of functions that can be configured in this EPC
9094 * @group: configfs group representing the PCI EPC device
91− * @lock: spinlock to protect pci_epc ops
95+ * @lock: mutex to protect pci_epc ops
96+ * @function_num_map: bitmap to manage physical function number
97+ * @notifier: used to notify EPF of any EPC events (like linkup)
9298 */
9399 struct pci_epc {
94100 struct device dev;
@@ -97,8 +103,10 @@ struct pci_epc { · 2 unmodified lines
97103 struct pci_epc_mem *mem;
98104 u8 max_functions;
99105 struct config_group *group;
100− /* spinlock to protect against concurrent access of EP controller */
101− spinlock_t lock;
106+ /* mutex to protect against concurrent access of EP controller */
107+ struct mutex lock;
108+ unsigned long function_num_map;
109+ struct atomic_notifier_head notifier;
102110 };
103111
104112 /**
@@ -113,6 +121,7 @@ struct pci_epc { · 8 unmodified lines
113121 */
114122 struct pci_epc_features {
115123 unsigned int linkup_notifier : 1;
124+ unsigned int core_init_notifier : 1;
116125 unsigned int msi_capable : 1;
117126 unsigned int msix_capable : 1;
118127 u8 reserved_bar;
@@ -141,6 +150,12 @@ static inline void *epc_get_drvdata(struct pci_epc *epc) · 22 unmodified lines
141150 return dev_get_drvdata(&epc->dev);
142151 }
143152
153+static inline int
154+pci_epc_register_notifier(struct pci_epc *epc, struct notifier_block *nb)
155+{
156+ return atomic_notifier_chain_register(&epc->notifier, nb);
157+}
158+
144159 struct pci_epc *
145160 __devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
146161 struct module *owner);
@@ -151,6 +166,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc); · 4 unmodified lines
151166 void pci_epc_destroy(struct pci_epc *epc);
152167 int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf);
153168 void pci_epc_linkup(struct pci_epc *epc);
169+void pci_epc_init_notify(struct pci_epc *epc);
154170 void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf);
155171 int pci_epc_write_header(struct pci_epc *epc, u8 func_no,
156172 struct pci_epf_header *hdr);
@@ -165,7 +181,8 @@ void pci_epc_unmap_addr(struct pci_epc *epc, u8 func_no, · 8 unmodified lines
165181 phys_addr_t phys_addr);
166182 int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts);
167183 int pci_epc_get_msi(struct pci_epc *epc, u8 func_no);
168−int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts);
184+int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts,
185+ enum pci_barno, u32 offset);
169186 int pci_epc_get_msix(struct pci_epc *epc, u8 func_no);
170187 int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no,
171188 enum pci_epc_irq_type type, u16 interrupt_num);
include/linux/pci-epf.h+25−4
@@ -15,6 +15,11 @@ · 14 unmodified lines
1515
1616 struct pci_epf;
1717
18+enum pci_notify_event {
19+ CORE_INIT,
20+ LINK_UP,
21+};
22+
1823 enum pci_barno {
1924 BAR_0,
2025 BAR_1,
@@ -55,13 +60,10 @@ struct pci_epf_header { · 34 unmodified lines
5560 * @bind: ops to perform when a EPC device has been bound to EPF device
5661 * @unbind: ops to perform when a binding has been lost between a EPC device
5762 * and EPF device
58− * @linkup: ops to perform when the EPC device has established a connection with
59− * a host system
6063 */
6164 struct pci_epf_ops {
6265 int (*bind)(struct pci_epf *epf);
6366 void (*unbind)(struct pci_epf *epf);
64− void (*linkup)(struct pci_epf *epf);
6567 };
6668
6769 /**
@@ -92,10 +94,12 @@ struct pci_epf_driver { · 24 unmodified lines
9294 /**
9395 * struct pci_epf_bar - represents the BAR of EPF device
9496 * @phys_addr: physical address that should be mapped to the BAR
97+ * @addr: virtual address corresponding to the @phys_addr
9598 * @size: the size of the address space present in BAR
9699 */
97100 struct pci_epf_bar {
98101 dma_addr_t phys_addr;
102+ void *addr;
99103 size_t size;
100104 enum pci_barno barno;
101105 int flags;
@@ -112,6 +116,8 @@ struct pci_epf_bar { · 10 unmodified lines
112116 * @epc: the EPC device to which this EPF device is bound
113117 * @driver: the EPF driver to which this EPF device is bound
114118 * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc
119+ * @nb: notifier block to notify EPF of any EPC events (like linkup)
120+ * @lock: mutex to protect pci_epf_ops
115121 */
116122 struct pci_epf {
117123 struct device dev;
@@ -125,6 +131,22 @@ struct pci_epf { · 7 unmodified lines
125131 struct pci_epc *epc;
126132 struct pci_epf_driver *driver;
127133 struct list_head list;
134+ struct notifier_block nb;
135+ /* mutex to protect against concurrent access of pci_epf_ops */
136+ struct mutex lock;
137+};
138+
139+/**
140+ * struct pci_epf_msix_tbl - represents the MSIX table entry structure
141+ * @msg_addr: Writes to this address will trigger MSIX interrupt in host
142+ * @msg_data: Data that should be written to @msg_addr to trigger MSIX interrupt
143+ * @vector_ctrl: Identifies if the function is prohibited from sending a message
144+ * using this MSIX table entry
145+ */
146+struct pci_epf_msix_tbl {
147+ u64 msg_addr;
148+ u32 msg_data;
149+ u32 vector_ctrl;
128150 };
129151
130152 #define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev)
@@ -154,5 +176,4 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, · 23 unmodified lines
154176 void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);
155177 int pci_epf_bind(struct pci_epf *epf);
156178 void pci_epf_unbind(struct pci_epf *epf);
157−void pci_epf_linkup(struct pci_epf *epf);
158179 #endif /* __LINUX_PCI_EPF_H */
include/linux/pci.h+22−2
@@ -42,6 +42,13 @@ · 41 unmodified lines
4242
4343 #include <linux/pci_ids.h>
4444
45+#define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \
46+ PCI_STATUS_SIG_SYSTEM_ERROR | \
47+ PCI_STATUS_REC_MASTER_ABORT | \
48+ PCI_STATUS_REC_TARGET_ABORT | \
49+ PCI_STATUS_SIG_TARGET_ABORT | \
50+ PCI_STATUS_PARITY)
51+
4552 /*
4653 * The PCI interface treats multi-function devices as independent
4754 * devices. The slot/function address of each device is encoded
@@ -236,7 +243,7 @@ enum pcie_link_width { · 188 unmodified lines
236243 PCIE_LNK_WIDTH_UNKNOWN = 0xff,
237244 };
238245
239−/* Based on the PCI Hotplug Spec, but some values are made up by us */
246+/* See matching string table in pci_speed_string() */
240247 enum pci_bus_speed {
241248 PCI_SPEED_33MHz = 0x00,
242249 PCI_SPEED_66MHz = 0x01,
@@ -444,6 +451,11 @@ struct pci_dev { · 201 unmodified lines
444451 const struct attribute_group **msi_irq_groups;
445452 #endif
446453 struct pci_vpd *vpd;
454+#ifdef CONFIG_PCIE_DPC
455+ u16 dpc_cap;
456+ unsigned int dpc_rp_extensions:1;
457+ u8 dpc_rp_log_size;
458+#endif
447459 #ifdef CONFIG_PCI_ATS
448460 union {
449461 struct pci_sriov *sriov; /* PF: SR-IOV info */
@@ -510,7 +522,9 @@ struct pci_host_bridge { · 60 unmodified lines
510522 unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */
511523 unsigned int native_pme:1; /* OS may use PCIe PME */
512524 unsigned int native_ltr:1; /* OS may use PCIe LTR */
525+ unsigned int native_dpc:1; /* OS may use PCIe DPC */
513526 unsigned int preserve_config:1; /* Preserve FW resource setup */
527+ unsigned int size_windows:1; /* Enable root bus sizing */
514528
515529 /* Resource alignment requirements */
516530 resource_size_t (*align_resource)(struct pci_dev *dev,
@@ -1045,6 +1059,8 @@ int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); · 528 unmodified lines
10451059 int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
10461060 struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
10471061
1062+u64 pci_get_dsn(struct pci_dev *dev);
1063+
10481064 struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
10491065 struct pci_dev *from);
10501066 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
@@ -1203,6 +1219,7 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags); · 152 unmodified lines
12031219 bool pci_device_is_present(struct pci_dev *pdev);
12041220 void pci_ignore_hotplug(struct pci_dev *dev);
12051221 struct pci_dev *pci_real_dma_dev(struct pci_dev *dev);
1222+int pci_status_get_and_clear_errors(struct pci_dev *pdev);
12061223
12071224 int __printf(6, 7) pci_request_irq(struct pci_dev *dev, unsigned int nr,
12081225 irq_handler_t handler, irq_handler_t thread_fn, void *dev_id,
@@ -1214,7 +1231,6 @@ int pci_enable_rom(struct pci_dev *pdev); · 5 unmodified lines
12141231 void pci_disable_rom(struct pci_dev *pdev);
12151232 void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
12161233 void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
1217−void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size);
12181234
12191235 /* Power management related routines */
12201236 int pci_save_state(struct pci_dev *dev);
@@ -1699,6 +1715,9 @@ static inline int pci_find_next_capability(struct pci_dev *dev, u8 post, · 478 unmodified lines
16991715 static inline int pci_find_ext_capability(struct pci_dev *dev, int cap)
17001716 { return 0; }
17011717
1718+static inline u64 pci_get_dsn(struct pci_dev *dev)
1719+{ return 0; }
1720+
17021721 /* Power management related routines */
17031722 static inline int pci_save_state(struct pci_dev *dev) { return 0; }
17041723 static inline void pci_restore_state(struct pci_dev *dev) { }
@@ -2171,6 +2190,7 @@ int pci_enable_atomic_ops_to_root(struct pci_dev *dev, u32 cap_mask); · 466 unmodified lines
21712190 #define PCI_VPD_INFO_FLD_HDR_SIZE 3
21722191
21732192 #define PCI_VPD_RO_KEYWORD_PARTNO "PN"
2193+#define PCI_VPD_RO_KEYWORD_SERIALNO "SN"
21742194 #define PCI_VPD_RO_KEYWORD_MFR_ID "MN"
21752195 #define PCI_VPD_RO_KEYWORD_VENDOR0 "V0"
21762196 #define PCI_VPD_RO_KEYWORD_CHKSUM "RV"
include/linux/pci_ids.h+4−0
@@ -148,6 +148,8 @@ · 147 unmodified lines
148148
149149 /* Vendors and devices. Sort key: vendor first, device next. */
150150
151+#define PCI_VENDOR_ID_LOONGSON 0x0014
152+
151153 #define PCI_VENDOR_ID_TTTECH 0x0357
152154 #define PCI_DEVICE_ID_TTTECH_MC322 0x000a
153155
@@ -2583,6 +2585,8 @@ · 2429 unmodified lines
25832585
25842586 #define PCI_VENDOR_ID_AMAZON 0x1d0f
25852587
2588+#define PCI_VENDOR_ID_ZHAOXIN 0x1d17
2589+
25862590 #define PCI_VENDOR_ID_HYGON 0x1d94
25872591
25882592 #define PCI_VENDOR_ID_HXT 0x1dbf
include/linux/pe.h+21−0
@@ -10,6 +10,27 @@ · 9 unmodified lines
1010
1111 #include <linux/types.h>
1212
13+/*
14+ * Linux EFI stub v1.0 adds the following functionality:
15+ * - Loading initrd from the LINUX_EFI_INITRD_MEDIA_GUID device path,
16+ * - Loading/starting the kernel from firmware that targets a different
17+ * machine type, via the entrypoint exposed in the .compat PE/COFF section.
18+ *
19+ * The recommended way of loading and starting v1.0 or later kernels is to use
20+ * the LoadImage() and StartImage() EFI boot services, and expose the initrd
21+ * via the LINUX_EFI_INITRD_MEDIA_GUID device path.
22+ *
23+ * Versions older than v1.0 support initrd loading via the image load options
24+ * (using initrd=, limited to the volume from which the kernel itself was
25+ * loaded), or via arch specific means (bootparams, DT, etc).
26+ *
27+ * On x86, LoadImage() and StartImage() can be omitted if the EFI handover
28+ * protocol is implemented, which can be inferred from the version,
29+ * handover_offset and xloadflags fields in the bootparams structure.
30+ */
31+#define LINUX_EFISTUB_MAJOR_VERSION 0x1
32+#define LINUX_EFISTUB_MINOR_VERSION 0x0
33+
1334 #define MZ_MAGIC 0x5a4d /* "MZ" */
1435
1536 #define PE_MAGIC 0x00004550 /* "PE\0\0" */
include/linux/percpu-rwsem.h+49−34
@@ -3,41 +3,52 @@ · 2 unmodified lines
33 #define _LINUX_PERCPU_RWSEM_H
44
55 #include <linux/atomic.h>
6−#include <linux/rwsem.h>
76 #include <linux/percpu.h>
87 #include <linux/rcuwait.h>
8+#include <linux/wait.h>
99 #include <linux/rcu_sync.h>
1010 #include <linux/lockdep.h>
1111
1212 struct percpu_rw_semaphore {
1313 struct rcu_sync rss;
1414 unsigned int __percpu *read_count;
15− struct rw_semaphore rw_sem; /* slowpath */
16− struct rcuwait writer; /* blocked writer */
17− int readers_block;
15+ struct rcuwait writer;
16+ wait_queue_head_t waiters;
17+ atomic_t block;
18+#ifdef CONFIG_DEBUG_LOCK_ALLOC
19+ struct lockdep_map dep_map;
20+#endif
1821 };
1922
23+#ifdef CONFIG_DEBUG_LOCK_ALLOC
24+#define __PERCPU_RWSEM_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname },
25+#else
26+#define __PERCPU_RWSEM_DEP_MAP_INIT(lockname)
27+#endif
28+
2029 #define __DEFINE_PERCPU_RWSEM(name, is_static) \
2130 static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_rc_##name); \
2231 is_static struct percpu_rw_semaphore name = { \
2332 .rss = __RCU_SYNC_INITIALIZER(name.rss), \
2433 .read_count = &__percpu_rwsem_rc_##name, \
25− .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \
2634 .writer = __RCUWAIT_INITIALIZER(name.writer), \
35+ .waiters = __WAIT_QUEUE_HEAD_INITIALIZER(name.waiters), \
36+ .block = ATOMIC_INIT(0), \
37+ __PERCPU_RWSEM_DEP_MAP_INIT(name) \
2738 }
39+
2840 #define DEFINE_PERCPU_RWSEM(name) \
2941 __DEFINE_PERCPU_RWSEM(name, /* not static */)
3042 #define DEFINE_STATIC_PERCPU_RWSEM(name) \
3143 __DEFINE_PERCPU_RWSEM(name, static)
3244
33−extern int __percpu_down_read(struct percpu_rw_semaphore *, int);
34−extern void __percpu_up_read(struct percpu_rw_semaphore *);
45+extern bool __percpu_down_read(struct percpu_rw_semaphore *, bool);
3546
3647 static inline void percpu_down_read(struct percpu_rw_semaphore *sem)
3748 {
3849 might_sleep();
3950
40− rwsem_acquire_read(&sem->rw_sem.dep_map, 0, 0, _RET_IP_);
51+ rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_);
4152
4253 preempt_disable();
4354 /*
@@ -48,8 +59,9 @@ static inline void percpu_down_read(struct percpu_rw_semaphore *sem) · 4 unmodified lines
4859 * and that once the synchronize_rcu() is done, the writer will see
4960 * anything we did within this RCU-sched read-size critical section.
5061 */
51− __this_cpu_inc(*sem->read_count);
52− if (unlikely(!rcu_sync_is_idle(&sem->rss)))
62+ if (likely(rcu_sync_is_idle(&sem->rss)))
63+ __this_cpu_inc(*sem->read_count);
64+ else
5365 __percpu_down_read(sem, false); /* Unconditional memory barrier */
5466 /*
5567 * The preempt_enable() prevents the compiler from
@@ -58,16 +70,17 @@ static inline void percpu_down_read(struct percpu_rw_semaphore *sem) · 2 unmodified lines
5870 preempt_enable();
5971 }
6072
61−static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
73+static inline bool percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
6274 {
63− int ret = 1;
75+ bool ret = true;
6476
6577 preempt_disable();
6678 /*
6779 * Same as in percpu_down_read().
6880 */
69− __this_cpu_inc(*sem->read_count);
70− if (unlikely(!rcu_sync_is_idle(&sem->rss)))
81+ if (likely(rcu_sync_is_idle(&sem->rss)))
82+ __this_cpu_inc(*sem->read_count);
83+ else
7184 ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */
7285 preempt_enable();
7386 /*
@@ -76,24 +89,36 @@ static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem) · 2 unmodified lines
7689 */
7790
7891 if (ret)
79− rwsem_acquire_read(&sem->rw_sem.dep_map, 0, 1, _RET_IP_);
92+ rwsem_acquire_read(&sem->dep_map, 0, 1, _RET_IP_);
8093
8194 return ret;
8295 }
8396
8497 static inline void percpu_up_read(struct percpu_rw_semaphore *sem)
8598 {
99+ rwsem_release(&sem->dep_map, _RET_IP_);
100+
86101 preempt_disable();
87102 /*
88103 * Same as in percpu_down_read().
89104 */
90− if (likely(rcu_sync_is_idle(&sem->rss)))
105+ if (likely(rcu_sync_is_idle(&sem->rss))) {
91106 __this_cpu_dec(*sem->read_count);
92− else
93− __percpu_up_read(sem); /* Unconditional memory barrier */
107+ } else {
108+ /*
109+ * slowpath; reader will only ever wake a single blocked
110+ * writer.
111+ */
112+ smp_mb(); /* B matches C */
113+ /*
114+ * In other words, if they see our decrement (presumably to
115+ * aggregate zero, as that is the only time it matters) they
116+ * will also see our critical section.
117+ */
118+ __this_cpu_dec(*sem->read_count);
119+ rcuwait_wake_up(&sem->writer);
120+ }
94121 preempt_enable();
95−
96− rwsem_release(&sem->rw_sem.dep_map, _RET_IP_);
97122 }
98123
99124 extern void percpu_down_write(struct percpu_rw_semaphore *);
@@ -110,29 +135,19 @@ extern void percpu_free_rwsem(struct percpu_rw_semaphore *); · 10 unmodified lines
110135 __percpu_init_rwsem(sem, #sem, &rwsem_key); \
111136 })
112137
113−#define percpu_rwsem_is_held(sem) lockdep_is_held(&(sem)->rw_sem)
114−
115−#define percpu_rwsem_assert_held(sem) \
116− lockdep_assert_held(&(sem)->rw_sem)
138+#define percpu_rwsem_is_held(sem) lockdep_is_held(sem)
139+#define percpu_rwsem_assert_held(sem) lockdep_assert_held(sem)
117140
118141 static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem,
119142 bool read, unsigned long ip)
120143 {
121− lock_release(&sem->rw_sem.dep_map, ip);
122−#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
123− if (!read)
124− atomic_long_set(&sem->rw_sem.owner, RWSEM_OWNER_UNKNOWN);
125−#endif
144+ lock_release(&sem->dep_map, ip);
126145 }
127146
128147 static inline void percpu_rwsem_acquire(struct percpu_rw_semaphore *sem,
129148 bool read, unsigned long ip)
130149 {
131− lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip);
132−#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
133− if (!read)
134− atomic_long_set(&sem->rw_sem.owner, (long)current);
135−#endif
150+ lock_acquire(&sem->dep_map, 0, 1, read, 1, NULL, ip);
136151 }
137152
138153 #endif
include/linux/percpu_counter.h+2−2
@@ -78,9 +78,9 @@ static inline s64 percpu_counter_read(struct percpu_counter *fbc) · 77 unmodified lines
7878 */
7979 static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)
8080 {
81− s64 ret = fbc->count;
81+ /* Prevent reloads of fbc->count */
82+ s64 ret = READ_ONCE(fbc->count);
8283
83− barrier(); /* Prevent reloads of fbc->count */
8484 if (ret >= 0)
8585 return ret;
8686 return 0;
include/linux/perf/arm_pmu.h+1−0
@@ -80,6 +80,7 @@ struct arm_pmu { · 79 unmodified lines
8080 struct pmu pmu;
8181 cpumask_t supported_cpus;
8282 char *name;
83+ int pmuver;
8384 irqreturn_t (*handle_irq)(struct arm_pmu *pmu);
8485 void (*enable)(struct perf_event *event);
8586 void (*disable)(struct perf_event *event);
include/linux/perf_event.h+20−0
@@ -93,14 +93,26 @@ struct perf_raw_record { · 92 unmodified lines
9393 /*
9494 * branch stack layout:
9595 * nr: number of taken branches stored in entries[]
96+ * hw_idx: The low level index of raw branch records
97+ * for the most recent branch.
98+ * -1ULL means invalid/unknown.
9699 *
97100 * Note that nr can vary from sample to sample
98101 * branches (to, from) are stored from most recent
99102 * to least recent, i.e., entries[0] contains the most
100103 * recent branch.
104+ * The entries[] is an abstraction of raw branch records,
105+ * which may not be stored in age order in HW, e.g. Intel LBR.
106+ * The hw_idx is to expose the low level index of raw
107+ * branch record for the most recent branch aka entries[0].
108+ * The hw_idx index is between -1 (unknown) and max depth,
109+ * which can be retrieved in /sys/devices/cpu/caps/branches.
110+ * For the architectures whose raw branch records are
111+ * already stored in age order, the hw_idx should be 0.
101112 */
102113 struct perf_branch_stack {
103114 __u64 nr;
115+ __u64 hw_idx;
104116 struct perf_branch_entry entries[0];
105117 };
106118
@@ -850,6 +862,13 @@ struct perf_cpu_context { · 743 unmodified lines
850862 int sched_cb_usage;
851863
852864 int online;
865+ /*
866+ * Per-CPU storage for iterators used in visit_groups_merge. The default
867+ * storage is of size 2 to hold the CPU and any CPU event iterators.
868+ */
869+ int heap_size;
870+ struct perf_event **heap;
871+ struct perf_event *heap_default[2];
853872 };
854873
855874 struct perf_output_handle {
@@ -1001,6 +1020,7 @@ struct perf_sample_data { · 145 unmodified lines
10011020 u64 stack_user_size;
10021021
10031022 u64 phys_addr;
1023+ u64 cgroup;
10041024 } ____cacheline_aligned;
10051025
10061026 /* default value for data source */
include/linux/phy.h+61−1
@@ -23,6 +23,8 @@ · 22 unmodified lines
2323 #include <linux/workqueue.h>
2424 #include <linux/mod_devicetable.h>
2525 #include <linux/u64_stats_sync.h>
26+#include <linux/irqreturn.h>
27+#include <linux/iopoll.h>
2628
2729 #include <linux/atomic.h>
2830
@@ -94,6 +96,7 @@ typedef enum { · 65 unmodified lines
9496 PHY_INTERFACE_MODE_RTBI,
9597 PHY_INTERFACE_MODE_SMII,
9698 PHY_INTERFACE_MODE_XGMII,
99+ PHY_INTERFACE_MODE_XLGMII,
97100 PHY_INTERFACE_MODE_MOCA,
98101 PHY_INTERFACE_MODE_QSGMII,
99102 PHY_INTERFACE_MODE_TRGMII,
@@ -165,6 +168,8 @@ static inline const char *phy_modes(phy_interface_t interface) · 65 unmodified lines
165168 return "smii";
166169 case PHY_INTERFACE_MODE_XGMII:
167170 return "xgmii";
171+ case PHY_INTERFACE_MODE_XLGMII:
172+ return "xlgmii";
168173 case PHY_INTERFACE_MODE_MOCA:
169174 return "moca";
170175 case PHY_INTERFACE_MODE_QSGMII:
@@ -289,6 +294,7 @@ static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev) · 118 unmodified lines
289294 return devm_mdiobus_alloc_size(dev, 0);
290295 }
291296
297+struct mii_bus *mdio_find_bus(const char *mdio_name);
292298 void devm_mdiobus_free(struct device *dev, struct mii_bus *bus);
293299 struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
294300
@@ -357,8 +363,10 @@ struct macsec_ops; · 62 unmodified lines
357363 * is_gigabit_capable: Set to true if PHY supports 1000Mbps
358364 * has_fixups: Set to true if this phy has fixups/quirks.
359365 * suspended: Set to true if this phy has been suspended successfully.
366+ * suspended_by_mdio_bus: Set to true if this phy was suspended by MDIO bus.
360367 * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal.
361368 * loopback_enabled: Set true if this phy has been loopbacked successfully.
369+ * downshifted_rate: Set true if link speed has been downshifted.
362370 * state: state of the PHY for management purposes
363371 * dev_flags: Device-specific flags used by the PHY driver.
364372 * irq: IRQ number of the PHY's interrupt (-1 if none)
@@ -396,8 +404,10 @@ struct phy_device { · 31 unmodified lines
396404 unsigned is_gigabit_capable:1;
397405 unsigned has_fixups:1;
398406 unsigned suspended:1;
407+ unsigned suspended_by_mdio_bus:1;
399408 unsigned sysfs_links:1;
400409 unsigned loopback_enabled:1;
410+ unsigned downshifted_rate:1;
401411
402412 unsigned autoneg:1;
403413 /* The most recently read link state */
@@ -557,11 +567,12 @@ struct phy_driver { · 153 unmodified lines
557567 /*
558568 * Checks if the PHY generated an interrupt.
559569 * For multi-PHY devices with shared PHY interrupt pin
570+ * Set interrupt bits have to be cleared.
560571 */
561572 int (*did_interrupt)(struct phy_device *phydev);
562573
563574 /* Override default interrupt handling */
564− int (*handle_interrupt)(struct phy_device *phydev);
575+ irqreturn_t (*handle_interrupt)(struct phy_device *phydev);
565576
566577 /* Clears up any memory if needed */
567578 void (*remove)(struct phy_device *phydev);
@@ -690,6 +701,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 122 unmodified lines
690701
691702 void phy_resolve_aneg_pause(struct phy_device *phydev);
692703 void phy_resolve_aneg_linkmode(struct phy_device *phydev);
704+void phy_check_downshift(struct phy_device *phydev);
693705
694706 /**
695707 * phy_read - Convenience function for reading a given PHY register
@@ -705,6 +717,19 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum) · 9 unmodified lines
705717 return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum);
706718 }
707719
720+#define phy_read_poll_timeout(phydev, regnum, val, cond, sleep_us, \
721+ timeout_us, sleep_before_read) \
722+({ \
723+ int __ret = read_poll_timeout(phy_read, val, (cond) || val < 0, \
724+ sleep_us, timeout_us, sleep_before_read, phydev, regnum); \
725+ if (val < 0) \
726+ __ret = val; \
727+ if (__ret) \
728+ phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \
729+ __ret; \
730+})
731+
732+
708733 /**
709734 * __phy_read - convenience function for reading a given PHY register
710735 * @phydev: the phy_device struct
@@ -746,6 +771,25 @@ static inline int __phy_write(struct phy_device *phydev, u32 regnum, u16 val) · 35 unmodified lines
746771 val);
747772 }
748773
774+/**
775+ * __phy_modify_changed() - Convenience function for modifying a PHY register
776+ * @phydev: a pointer to a &struct phy_device
777+ * @regnum: register number
778+ * @mask: bit mask of bits to clear
779+ * @set: bit mask of bits to set
780+ *
781+ * Unlocked helper function which allows a PHY register to be modified as
782+ * new register value = (old register value & ~mask) | set
783+ *
784+ * Returns negative errno, 0 if there was no change, and 1 in case of change
785+ */
786+static inline int __phy_modify_changed(struct phy_device *phydev, u32 regnum,
787+ u16 mask, u16 set)
788+{
789+ return __mdiobus_modify_changed(phydev->mdio.bus, phydev->mdio.addr,
790+ regnum, mask, set);
791+}
792+
749793 /**
750794 * phy_read_mmd - Convenience function for reading a register
751795 * from an MMD on a given PHY.
@@ -757,6 +801,19 @@ static inline int __phy_write(struct phy_device *phydev, u32 regnum, u16 val) · 5 unmodified lines
757801 */
758802 int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
759803
804+#define phy_read_mmd_poll_timeout(phydev, devaddr, regnum, val, cond, \
805+ sleep_us, timeout_us, sleep_before_read) \
806+({ \
807+ int __ret = read_poll_timeout(phy_read_mmd, val, (cond) || val < 0, \
808+ sleep_us, timeout_us, sleep_before_read, \
809+ phydev, devaddr, regnum); \
810+ if (val < 0) \
811+ __ret = val; \
812+ if (__ret) \
813+ phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \
814+ __ret; \
815+})
816+
760817 /**
761818 * __phy_read_mmd - Convenience function for reading a register
762819 * from an MMD on a given PHY.
@@ -1257,6 +1314,9 @@ void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx, · 494 unmodified lines
12571314 void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);
12581315 bool phy_validate_pause(struct phy_device *phydev,
12591316 struct ethtool_pauseparam *pp);
1317+void phy_get_pause(struct phy_device *phydev, bool *tx_pause, bool *rx_pause);
1318+void phy_resolve_pause(unsigned long *local_adv, unsigned long *partner_adv,
1319+ bool *tx_pause, bool *rx_pause);
12601320
12611321 int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
12621322 int (*run)(struct phy_device *));
include/linux/phy/tegra/xusb.h+2−0
@@ -21,4 +21,6 @@ int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl, · 20 unmodified lines
2121 int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl,
2222 bool val);
2323 int tegra_phy_xusb_utmi_port_reset(struct phy *phy);
24+int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl,
25+ unsigned int port);
2426 #endif /* PHY_TEGRA_XUSB_H */
include/linux/phylink.h+157−25
@@ -12,12 +12,10 @@ struct net_device; · 11 unmodified lines
1212
1313 enum {
1414 MLO_PAUSE_NONE,
15− MLO_PAUSE_ASYM = BIT(0),
16− MLO_PAUSE_SYM = BIT(1),
17− MLO_PAUSE_RX = BIT(2),
18− MLO_PAUSE_TX = BIT(3),
15+ MLO_PAUSE_RX = BIT(0),
16+ MLO_PAUSE_TX = BIT(1),
1917 MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX,
20− MLO_PAUSE_AN = BIT(4),
18+ MLO_PAUSE_AN = BIT(2),
2119
2220 MLO_AN_PHY = 0, /* Conventional PHY */
2321 MLO_AN_FIXED, /* Fixed-link mode */
@@ -93,9 +91,10 @@ struct phylink_mac_ops { · 69 unmodified lines
9391 void (*mac_an_restart)(struct phylink_config *config);
9492 void (*mac_link_down)(struct phylink_config *config, unsigned int mode,
9593 phy_interface_t interface);
96− void (*mac_link_up)(struct phylink_config *config, unsigned int mode,
97− phy_interface_t interface,
98− struct phy_device *phy);
94+ void (*mac_link_up)(struct phylink_config *config,
95+ struct phy_device *phy, unsigned int mode,
96+ phy_interface_t interface, int speed, int duplex,
97+ bool tx_pause, bool rx_pause);
9998 };
10099
101100 #if 0 /* For kernel-doc purposes only. */
@@ -154,15 +153,33 @@ void mac_pcs_get_state(struct phylink_config *config, · 52 unmodified lines
154153 * guaranteed to be correct, and so any mac_config() implementation must
155154 * never reference these fields.
156155 *
156+ * (this requires a rewrite - please refer to mac_link_up() for situations
157+ * where the PCS and MAC are not tightly integrated.)
158+ *
159+ * In all negotiation modes, as defined by @mode, @state->pause indicates the
160+ * pause settings which should be applied as follows. If %MLO_PAUSE_AN is not
161+ * set, %MLO_PAUSE_TX and %MLO_PAUSE_RX indicate whether the MAC should send
162+ * pause frames and/or act on received pause frames respectively. Otherwise,
163+ * the results of in-band negotiation/status from the MAC PCS should be used
164+ * to control the MAC pause mode settings.
165+ *
157166 * The action performed depends on the currently selected mode:
158167 *
159168 * %MLO_AN_FIXED, %MLO_AN_PHY:
160− * Configure the specified @state->speed, @state->duplex and
161− * @state->pause (%MLO_PAUSE_TX / %MLO_PAUSE_RX) modes over a link
162− * specified by @state->interface. @state->advertising may be used,
163− * but is not required. Other members of @state must be ignored.
169+ * Configure for non-inband negotiation mode, where the link settings
170+ * are completely communicated via mac_link_up(). The physical link
171+ * protocol from the MAC is specified by @state->interface.
172+ *
173+ * @state->advertising may be used, but is not required.
174+ *
175+ * Older drivers (prior to the mac_link_up() change) may use @state->speed,
176+ * @state->duplex and @state->pause to configure the MAC, but this is
177+ * deprecated; such drivers should be converted to use mac_link_up().
164178 *
165− * Valid state members: interface, speed, duplex, pause, advertising.
179+ * Other members of @state must be ignored.
180+ *
181+ * Valid state members: interface, advertising.
182+ * Deprecated state members: speed, duplex, pause.
166183 *
167184 * %MLO_AN_INBAND:
168185 * place the link in an inband negotiation mode (such as 802.3z
@@ -172,11 +189,14 @@ void mac_pcs_get_state(struct phylink_config *config, · 3 unmodified lines
172189 * mac_pcs_get_state() callback. Changes in link state must be made
173190 * by calling phylink_mac_change().
174191 *
192+ * Interface mode specific details are mentioned below.
193+ *
175194 * If in 802.3z mode, the link speed is fixed, dependent on the
176− * @state->interface. Duplex is negotiated, and pause is advertised
177− * according to @state->an_enabled, @state->pause and
178− * @state->advertising flags. Beware of MACs which only support full
179− * duplex at gigabit and higher speeds.
195+ * @state->interface. Duplex and pause modes are negotiated via
196+ * the in-band configuration word. Advertised pause modes are set
197+ * according to the @state->an_enabled and @state->advertising
198+ * flags. Beware of MACs which only support full duplex at gigabit
199+ * and higher speeds.
180200 *
181201 * If in Cisco SGMII mode, the link speed and duplex mode are passed
182202 * in the serial bitstream 16-bit configuration word, and the MAC
@@ -220,24 +240,127 @@ void mac_link_down(struct phylink_config *config, unsigned int mode, · 37 unmodified lines
220240 /**
221241 * mac_link_up() - allow the link to come up
222242 * @config: a pointer to a &struct phylink_config.
243+ * @phy: any attached phy
223244 * @mode: link autonegotiation mode
224245 * @interface: link &typedef phy_interface_t mode
225− * @phy: any attached phy
246+ * @speed: link speed
247+ * @duplex: link duplex
248+ * @tx_pause: link transmit pause enablement status
249+ * @rx_pause: link receive pause enablement status
226250 *
227− * If @mode is not an in-band negotiation mode (as defined by
228− * phylink_autoneg_inband()), allow the link to come up. If @phy
229− * is non-%NULL, configure Energy Efficient Ethernet by calling
251+ * Configure the MAC for an established link.
252+ *
253+ * @speed, @duplex, @tx_pause and @rx_pause indicate the finalised link
254+ * settings, and should be used to configure the MAC block appropriately
255+ * where these settings are not automatically conveyed from the PCS block,
256+ * or if in-band negotiation (as defined by phylink_autoneg_inband(@mode))
257+ * is disabled.
258+ *
259+ * Note that when 802.3z in-band negotiation is in use, it is possible
260+ * that the user wishes to override the pause settings, and this should
261+ * be allowed when considering the implementation of this method.
262+ *
263+ * If in-band negotiation mode is disabled, allow the link to come up. If
264+ * @phy is non-%NULL, configure Energy Efficient Ethernet by calling
230265 * phy_init_eee() and perform appropriate MAC configuration for EEE.
231266 * Interface type selection must be done in mac_config().
232267 */
233−void mac_link_up(struct phylink_config *config, unsigned int mode,
234− phy_interface_t interface,
235− struct phy_device *phy);
268+void mac_link_up(struct phylink_config *config, struct phy_device *phy,
269+ unsigned int mode, phy_interface_t interface,
270+ int speed, int duplex, bool tx_pause, bool rx_pause);
271+#endif
272+
273+/**
274+ * struct phylink_pcs_ops - MAC PCS operations structure.
275+ * @pcs_get_state: read the current MAC PCS link state from the hardware.
276+ * @pcs_config: configure the MAC PCS for the selected mode and state.
277+ * @pcs_an_restart: restart 802.3z BaseX autonegotiation.
278+ * @pcs_link_up: program the PCS for the resolved link configuration
279+ * (where necessary).
280+ */
281+struct phylink_pcs_ops {
282+ void (*pcs_get_state)(struct phylink_config *config,
283+ struct phylink_link_state *state);
284+ int (*pcs_config)(struct phylink_config *config, unsigned int mode,
285+ phy_interface_t interface,
286+ const unsigned long *advertising);
287+ void (*pcs_an_restart)(struct phylink_config *config);
288+ void (*pcs_link_up)(struct phylink_config *config, unsigned int mode,
289+ phy_interface_t interface, int speed, int duplex);
290+};
291+
292+#if 0 /* For kernel-doc purposes only. */
293+/**
294+ * pcs_get_state() - Read the current inband link state from the hardware
295+ * @config: a pointer to a &struct phylink_config.
296+ * @state: a pointer to a &struct phylink_link_state.
297+ *
298+ * Read the current inband link state from the MAC PCS, reporting the
299+ * current speed in @state->speed, duplex mode in @state->duplex, pause
300+ * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits,
301+ * negotiation completion state in @state->an_complete, and link up state
302+ * in @state->link. If possible, @state->lp_advertising should also be
303+ * populated.
304+ *
305+ * When present, this overrides mac_pcs_get_state() in &struct
306+ * phylink_mac_ops.
307+ */
308+void pcs_get_state(struct phylink_config *config,
309+ struct phylink_link_state *state);
310+
311+/**
312+ * pcs_config() - Configure the PCS mode and advertisement
313+ * @config: a pointer to a &struct phylink_config.
314+ * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
315+ * @interface: interface mode to be used
316+ * @advertising: adertisement ethtool link mode mask
317+ *
318+ * Configure the PCS for the operating mode, the interface mode, and set
319+ * the advertisement mask.
320+ *
321+ * When operating in %MLO_AN_INBAND, inband should always be enabled,
322+ * otherwise inband should be disabled.
323+ *
324+ * For SGMII, there is no advertisement from the MAC side, the PCS should
325+ * be programmed to acknowledge the inband word from the PHY.
326+ *
327+ * For 1000BASE-X, the advertisement should be programmed into the PCS.
328+ *
329+ * For most 10GBASE-R, there is no advertisement.
330+ */
331+int (*pcs_config)(struct phylink_config *config, unsigned int mode,
332+ phy_interface_t interface, const unsigned long *advertising);
333+
334+/**
335+ * pcs_an_restart() - restart 802.3z BaseX autonegotiation
336+ * @config: a pointer to a &struct phylink_config.
337+ *
338+ * When PCS ops are present, this overrides mac_an_restart() in &struct
339+ * phylink_mac_ops.
340+ */
341+void (*pcs_an_restart)(struct phylink_config *config);
342+
343+/**
344+ * pcs_link_up() - program the PCS for the resolved link configuration
345+ * @config: a pointer to a &struct phylink_config.
346+ * @mode: link autonegotiation mode
347+ * @interface: link &typedef phy_interface_t mode
348+ * @speed: link speed
349+ * @duplex: link duplex
350+ *
351+ * This call will be made just before mac_link_up() to inform the PCS of
352+ * the resolved link parameters. For example, a PCS operating in SGMII
353+ * mode without in-band AN needs to be manually configured for the link
354+ * and duplex setting. Otherwise, this should be a no-op.
355+ */
356+void (*pcs_link_up)(struct phylink_config *config, unsigned int mode,
357+ phy_interface_t interface, int speed, int duplex);
236358 #endif
237359
238360 struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *,
239361 phy_interface_t iface,
240− const struct phylink_mac_ops *ops);
362+ const struct phylink_mac_ops *mac_ops);
363+void phylink_add_pcs(struct phylink *, const struct phylink_pcs_ops *ops);
241364 void phylink_destroy(struct phylink *);
242365
243366 int phylink_connect_phy(struct phylink *, struct phy_device *);
@@ -282,4 +405,13 @@ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int); · 38 unmodified lines
282405 void phylink_set_port_modes(unsigned long *bits);
283406 void phylink_helper_basex_speed(struct phylink_link_state *state);
284407
408+void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,
409+ struct phylink_link_state *state);
410+int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs,
411+ phy_interface_t interface,
412+ const unsigned long *advertising);
413+void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs);
414+
415+void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs,
416+ struct phylink_link_state *state);
285417 #endif
include/linux/pid.h+2−0
@@ -60,8 +60,10 @@ struct pid · 59 unmodified lines
6060 {
6161 refcount_t count;
6262 unsigned int level;
63+ spinlock_t lock;
6364 /* lists of tasks that use this pid */
6465 struct hlist_head tasks[PIDTYPE_MAX];
66+ struct hlist_head inodes;
6567 /* wait queue for pidfd notifications */
6668 wait_queue_head_t wait_pidfd;
6769 struct rcu_head rcu;
include/linux/pid_namespace.h+0−2
@@ -33,7 +33,6 @@ struct pid_namespace { · 32 unmodified lines
3333 unsigned int level;
3434 struct pid_namespace *parent;
3535 #ifdef CONFIG_PROC_FS
36− struct vfsmount *proc_mnt;
3736 struct dentry *proc_self;
3837 struct dentry *proc_thread_self;
3938 #endif
@@ -42,7 +41,6 @@ struct pid_namespace { · 2 unmodified lines
4241 #endif
4342 struct user_namespace *user_ns;
4443 struct ucounts *ucounts;
45− struct work_struct proc_work;
4644 kgid_t pid_gid;
4745 int hide_pid;
4846 int reboot; /* group exit code if this pidns was rebooted */
include/linux/pinctrl/pinctrl.h+1−1
@@ -186,7 +186,7 @@ extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev, · 185 unmodified lines
186186 const char *pin_group, const unsigned **pins,
187187 unsigned *num_pins);
188188
189−#ifdef CONFIG_OF
189+#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL)
190190 extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
191191 #else
192192 static inline
include/linux/platform_data/cros_ec_proto.h+4−0
@@ -125,6 +125,9 @@ struct cros_ec_command { · 124 unmodified lines
125125 * @host_event_wake_mask: Mask of host events that cause wake from suspend.
126126 * @last_event_time: exact time from the hard irq when we got notified of
127127 * a new event.
128+ * @notifier_ready: The notifier_block to let the kernel re-query EC
129+ * communication protocol when the EC sends
130+ * EC_HOST_EVENT_INTERFACE_READY.
128131 * @ec: The platform_device used by the mfd driver to interface with the
129132 * main EC.
130133 * @pd: The platform_device used by the mfd driver to interface with the
@@ -166,6 +169,7 @@ struct cros_ec_device { · 35 unmodified lines
166169 u32 host_event_wake_mask;
167170 u32 last_resume_result;
168171 ktime_t last_event_time;
172+ struct notifier_block notifier_ready;
169173
170174 /* The platform devices used by the mfd driver */
171175 struct platform_device *ec;
include/linux/platform_data/cros_ec_sensorhub.h+163−0
@@ -8,8 +8,13 @@ · 7 unmodified lines
88 #ifndef __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H
99 #define __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H
1010
11+#include <linux/ktime.h>
12+#include <linux/mutex.h>
13+#include <linux/notifier.h>
1114 #include <linux/platform_data/cros_ec_commands.h>
1215
16+struct iio_dev;
17+
1318 /**
1419 * struct cros_ec_sensor_platform - ChromeOS EC sensor platform information.
1520 * @sensor_num: Id of the sensor, as reported by the EC.
@@ -19,12 +24,170 @@ struct cros_ec_sensor_platform { · 3 unmodified lines
1924 };
2025
2126 /**
27+ * typedef cros_ec_sensorhub_push_data_cb_t - Callback function to send datum
28+ * to specific sensors.
29+ *
30+ * @indio_dev: The IIO device that will process the sample.
31+ * @data: Vector array of the ring sample.
32+ * @timestamp: Timestamp in host timespace when the sample was acquired by
33+ * the EC.
34+ */
35+typedef int (*cros_ec_sensorhub_push_data_cb_t)(struct iio_dev *indio_dev,
36+ s16 *data,
37+ s64 timestamp);
38+
39+struct cros_ec_sensorhub_sensor_push_data {
40+ struct iio_dev *indio_dev;
41+ cros_ec_sensorhub_push_data_cb_t push_data_cb;
42+};
43+
44+enum {
45+ CROS_EC_SENSOR_LAST_TS,
46+ CROS_EC_SENSOR_NEW_TS,
47+ CROS_EC_SENSOR_ALL_TS
48+};
49+
50+struct cros_ec_sensors_ring_sample {
51+ u8 sensor_id;
52+ u8 flag;
53+ s16 vector[3];
54+ s64 timestamp;
55+} __packed;
56+
57+/* State used for cros_ec_ring_fix_overflow */
58+struct cros_ec_sensors_ec_overflow_state {
59+ s64 offset;
60+ s64 last;
61+};
62+
63+/* Length of the filter, how long to remember entries for */
64+#define CROS_EC_SENSORHUB_TS_HISTORY_SIZE 64
65+
66+/**
67+ * struct cros_ec_sensors_ts_filter_state - Timestamp filetr state.
68+ *
69+ * @x_offset: x is EC interrupt time. x_offset its last value.
70+ * @y_offset: y is the difference between AP and EC time, y_offset its last
71+ * value.
72+ * @x_history: The past history of x, relative to x_offset.
73+ * @y_history: The past history of y, relative to y_offset.
74+ * @m_history: rate between y and x.
75+ * @history_len: Amount of valid historic data in the arrays.
76+ * @temp_buf: Temporary buffer used when updating the filter.
77+ * @median_m: median value of m_history
78+ * @median_error: final error to apply to AP interrupt timestamp to get the
79+ * "true timestamp" the event occurred.
80+ */
81+struct cros_ec_sensors_ts_filter_state {
82+ s64 x_offset, y_offset;
83+ s64 x_history[CROS_EC_SENSORHUB_TS_HISTORY_SIZE];
84+ s64 y_history[CROS_EC_SENSORHUB_TS_HISTORY_SIZE];
85+ s64 m_history[CROS_EC_SENSORHUB_TS_HISTORY_SIZE];
86+ int history_len;
87+
88+ s64 temp_buf[CROS_EC_SENSORHUB_TS_HISTORY_SIZE];
89+
90+ s64 median_m;
91+ s64 median_error;
92+};
93+
94+/* struct cros_ec_sensors_ts_batch_state - State of batch of a single sensor.
95+ *
96+ * Use to store information to batch data using median fileter information.
97+ *
98+ * @penul_ts: last but one batch timestamp (penultimate timestamp).
99+ * Used for timestamp spreading calculations
100+ * when a batch shows up.
101+ * @penul_len: last but one batch length.
102+ * @last_ts: Last batch timestam.
103+ * @last_len: Last batch length.
104+ * @newest_sensor_event: Last sensor timestamp.
105+ */
106+struct cros_ec_sensors_ts_batch_state {
107+ s64 penul_ts;
108+ int penul_len;
109+ s64 last_ts;
110+ int last_len;
111+ s64 newest_sensor_event;
112+};
113+
114+/*
22115 * struct cros_ec_sensorhub - Sensor Hub device data.
23116 *
117+ * @dev: Device object, mostly used for logging.
24118 * @ec: Embedded Controller where the hub is located.
119+ * @sensor_num: Number of MEMS sensors present in the EC.
120+ * @msg: Structure to send FIFO requests.
121+ * @params: Pointer to parameters in msg.
122+ * @resp: Pointer to responses in msg.
123+ * @cmd_lock : Lock for sending msg.
124+ * @notifier: Notifier to kick the FIFO interrupt.
125+ * @ring: Preprocessed ring to store events.
126+ * @fifo_timestamp: Array for event timestamp and spreading.
127+ * @fifo_info: Copy of FIFO information coming from the EC.
128+ * @fifo_size: Size of the ring.
129+ * @batch_state: Per sensor information of the last batches received.
130+ * @overflow_a: For handling timestamp overflow for a time (sensor events)
131+ * @overflow_b: For handling timestamp overflow for b time (ec interrupts)
132+ * @filter: Medium fileter structure.
133+ * @tight_timestamps: Set to truen when EC support tight timestamping:
134+ * The timestamps reported from the EC have low jitter.
135+ * Timestamps also come before every sample. Set either
136+ * by feature bits coming from the EC or userspace.
137+ * @future_timestamp_count: Statistics used to compute shaved time.
138+ * This occurs when timestamp interpolation from EC
139+ * time to AP time accidentally puts timestamps in
140+ * the future. These timestamps are clamped to
141+ * `now` and these count/total_ns maintain the
142+ * statistics for how much time was removed in a
143+ * given period.
144+ * @future_timestamp_total_ns: Total amount of time shaved.
145+ * @push_data: Array of callback to send datums to iio sensor object.
25146 */
26147 struct cros_ec_sensorhub {
148+ struct device *dev;
27149 struct cros_ec_dev *ec;
150+ int sensor_num;
151+
152+ struct cros_ec_command *msg;
153+ struct ec_params_motion_sense *params;
154+ struct ec_response_motion_sense *resp;
155+ struct mutex cmd_lock; /* Lock for protecting msg structure. */
156+
157+ struct notifier_block notifier;
158+
159+ struct cros_ec_sensors_ring_sample *ring;
160+
161+ ktime_t fifo_timestamp[CROS_EC_SENSOR_ALL_TS];
162+ struct ec_response_motion_sense_fifo_info *fifo_info;
163+ int fifo_size;
164+
165+ struct cros_ec_sensors_ts_batch_state *batch_state;
166+
167+ struct cros_ec_sensors_ec_overflow_state overflow_a;
168+ struct cros_ec_sensors_ec_overflow_state overflow_b;
169+
170+ struct cros_ec_sensors_ts_filter_state filter;
171+
172+ int tight_timestamps;
173+
174+ s32 future_timestamp_count;
175+ s64 future_timestamp_total_ns;
176+
177+ struct cros_ec_sensorhub_sensor_push_data *push_data;
28178 };
29179
180+int cros_ec_sensorhub_register_push_data(struct cros_ec_sensorhub *sensorhub,
181+ u8 sensor_num,
182+ struct iio_dev *indio_dev,
183+ cros_ec_sensorhub_push_data_cb_t cb);
184+
185+void cros_ec_sensorhub_unregister_push_data(struct cros_ec_sensorhub *sensorhub,
186+ u8 sensor_num);
187+
188+int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub);
189+void cros_ec_sensorhub_ring_remove(void *arg);
190+int cros_ec_sensorhub_ring_fifo_enable(struct cros_ec_sensorhub *sensorhub,
191+ bool on);
192+
30193 #endif /* __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H */
include/linux/platform_data/cros_usbpd_notify.h+17−0
@@ -0,0 +1,17 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * ChromeOS EC Power Delivery Notifier Driver
4+ *
5+ * Copyright 2020 Google LLC
6+ */
7+
8+#ifndef __LINUX_PLATFORM_DATA_CROS_USBPD_NOTIFY_H
9+#define __LINUX_PLATFORM_DATA_CROS_USBPD_NOTIFY_H
10+
11+#include <linux/notifier.h>
12+
13+int cros_usbpd_register_notify(struct notifier_block *nb);
14+
15+void cros_usbpd_unregister_notify(struct notifier_block *nb);
16+
17+#endif /* __LINUX_PLATFORM_DATA_CROS_USBPD_NOTIFY_H */
include/linux/platform_data/dmtimer-omap.h+3−3
@@ -30,12 +30,12 @@ struct omap_dm_timer_ops { · 29 unmodified lines
3030 int (*stop)(struct omap_dm_timer *timer);
3131 int (*set_source)(struct omap_dm_timer *timer, int source);
3232
33− int (*set_load)(struct omap_dm_timer *timer, int autoreload,
34− unsigned int value);
33+ int (*set_load)(struct omap_dm_timer *timer, unsigned int value);
3534 int (*set_match)(struct omap_dm_timer *timer, int enable,
3635 unsigned int match);
3736 int (*set_pwm)(struct omap_dm_timer *timer, int def_on,
38− int toggle, int trigger);
37+ int toggle, int trigger, int autoreload);
38+ int (*get_pwm_status)(struct omap_dm_timer *timer);
3939 int (*set_prescaler)(struct omap_dm_timer *timer, int prescaler);
4040
4141 unsigned int (*read_counter)(struct omap_dm_timer *timer);
include/linux/platform_data/leds-kirkwood-ns2.h+0−38
@@ -1,38 +0,0 @@
1−/*
2− * Platform data structure for Network Space v2 LED driver
3− *
4− * This file is licensed under the terms of the GNU General Public
5− * License version 2. This program is licensed "as is" without any
6− * warranty of any kind, whether express or implied.
7− */
8−
9−#ifndef __LEDS_KIRKWOOD_NS2_H
10−#define __LEDS_KIRKWOOD_NS2_H
11−
12−enum ns2_led_modes {
13− NS_V2_LED_OFF,
14− NS_V2_LED_ON,
15− NS_V2_LED_SATA,
16−};
17−
18−struct ns2_led_modval {
19− enum ns2_led_modes mode;
20− int cmd_level;
21− int slow_level;
22−};
23−
24−struct ns2_led {
25− const char *name;
26− const char *default_trigger;
27− unsigned cmd;
28− unsigned slow;
29− int num_modes;
30− struct ns2_led_modval *modval;
31−};
32−
33−struct ns2_led_platform_data {
34− int num_leds;
35− struct ns2_led *leds;
36−};
37−
38−#endif /* __LEDS_KIRKWOOD_NS2_H */
include/linux/platform_data/mmc-esdhc-imx.h+1−0
@@ -37,5 +37,6 @@ struct esdhc_platform_data { · 36 unmodified lines
3737 unsigned int delay_line;
3838 unsigned int tuning_step; /* The delay cell steps in tuning procedure */
3939 unsigned int tuning_start_tap; /* The start delay cell point in tuning procedure */
40+ unsigned int strobe_dll_delay_target; /* The delay cell for strobe pad (read clock) */
4041 };
4142 #endif /* __ASM_ARCH_IMX_ESDHC_H */
include/linux/platform_data/pm33xx.h+5−1
@@ -46,9 +46,13 @@ struct am33xx_pm_sram_addr { · 45 unmodified lines
4646 };
4747
4848 struct am33xx_pm_platform_data {
49− int (*init)(void);
49+ int (*init)(int (*idle)(u32 wfi_flags));
50+ int (*deinit)(void);
5051 int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long),
5152 unsigned long args);
53+ int (*cpu_suspend)(int (*fn)(unsigned long), unsigned long args);
54+ void (*begin_suspend)(void);
55+ void (*finish_suspend)(void);
5256 struct am33xx_pm_sram_addr *(*get_sram_addrs)(void);
5357 void __iomem *(*get_rtc_base_addr)(void);
5458 void (*save_context)(void);
include/linux/platform_data/pwm_omap_dmtimer.h+0−90
@@ -1,90 +0,0 @@
1−/*
2− * include/linux/platform_data/pwm_omap_dmtimer.h
3− *
4− * OMAP Dual-Mode Timer PWM platform data
5− *
6− * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
7− * Tarun Kanti DebBarma <tarun.kanti@ti.com>
8− * Thara Gopinath <thara@ti.com>
9− *
10− * Platform device conversion and hwmod support.
11− *
12− * Copyright (C) 2005 Nokia Corporation
13− * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com>
14− * PWM and clock framework support by Timo Teras.
15− *
16− * This program is free software; you can redistribute it and/or modify it
17− * under the terms of the GNU General Public License as published by the
18− * Free Software Foundation; either version 2 of the License, or (at your
19− * option) any later version.
20− *
21− * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
22− * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23− * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24− * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25− * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26− * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27− * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28− * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29− *
30− * You should have received a copy of the GNU General Public License along
31− * with this program; if not, write to the Free Software Foundation, Inc.,
32− * 675 Mass Ave, Cambridge, MA 02139, USA.
33− */
34−
35−#ifndef __PWM_OMAP_DMTIMER_PDATA_H
36−#define __PWM_OMAP_DMTIMER_PDATA_H
37−
38−/* clock sources */
39−#define PWM_OMAP_DMTIMER_SRC_SYS_CLK 0x00
40−#define PWM_OMAP_DMTIMER_SRC_32_KHZ 0x01
41−#define PWM_OMAP_DMTIMER_SRC_EXT_CLK 0x02
42−
43−/* timer interrupt enable bits */
44−#define PWM_OMAP_DMTIMER_INT_CAPTURE (1 << 2)
45−#define PWM_OMAP_DMTIMER_INT_OVERFLOW (1 << 1)
46−#define PWM_OMAP_DMTIMER_INT_MATCH (1 << 0)
47−
48−/* trigger types */
49−#define PWM_OMAP_DMTIMER_TRIGGER_NONE 0x00
50−#define PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW 0x01
51−#define PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02
52−
53−struct omap_dm_timer;
54−typedef struct omap_dm_timer pwm_omap_dmtimer;
55−
56−struct pwm_omap_dmtimer_pdata {
57− pwm_omap_dmtimer *(*request_by_node)(struct device_node *np);
58− pwm_omap_dmtimer *(*request_specific)(int timer_id);
59− pwm_omap_dmtimer *(*request)(void);
60−
61− int (*free)(pwm_omap_dmtimer *timer);
62−
63− void (*enable)(pwm_omap_dmtimer *timer);
64− void (*disable)(pwm_omap_dmtimer *timer);
65−
66− int (*get_irq)(pwm_omap_dmtimer *timer);
67− int (*set_int_enable)(pwm_omap_dmtimer *timer, unsigned int value);
68− int (*set_int_disable)(pwm_omap_dmtimer *timer, u32 mask);
69−
70− struct clk *(*get_fclk)(pwm_omap_dmtimer *timer);
71−
72− int (*start)(pwm_omap_dmtimer *timer);
73− int (*stop)(pwm_omap_dmtimer *timer);
74− int (*set_source)(pwm_omap_dmtimer *timer, int source);
75−
76− int (*set_load)(pwm_omap_dmtimer *timer, int autoreload,
77− unsigned int value);
78− int (*set_match)(pwm_omap_dmtimer *timer, int enable,
79− unsigned int match);
80− int (*set_pwm)(pwm_omap_dmtimer *timer, int def_on,
81− int toggle, int trigger);
82− int (*set_prescaler)(pwm_omap_dmtimer *timer, int prescaler);
83−
84− unsigned int (*read_counter)(pwm_omap_dmtimer *timer);
85− int (*write_counter)(pwm_omap_dmtimer *timer, unsigned int value);
86− unsigned int (*read_status)(pwm_omap_dmtimer *timer);
87− int (*write_status)(pwm_omap_dmtimer *timer, unsigned int value);
88−};
89−
90−#endif /* __PWM_OMAP_DMTIMER_PDATA_H */
include/linux/platform_data/remoteproc-omap.h+0−51
@@ -1,51 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0-only */
2−/*
3− * Remote Processor - omap-specific bits
4− *
5− * Copyright (C) 2011 Texas Instruments, Inc.
6− * Copyright (C) 2011 Google, Inc.
7− */
8−
9−#ifndef _PLAT_REMOTEPROC_H
10−#define _PLAT_REMOTEPROC_H
11−
12−struct rproc_ops;
13−struct platform_device;
14−
15−/*
16− * struct omap_rproc_pdata - omap remoteproc's platform data
17− * @name: the remoteproc's name
18− * @oh_name: omap hwmod device
19− * @oh_name_opt: optional, secondary omap hwmod device
20− * @firmware: name of firmware file to load
21− * @mbox_name: name of omap mailbox device to use with this rproc
22− * @ops: start/stop rproc handlers
23− * @device_enable: omap-specific handler for enabling a device
24− * @device_shutdown: omap-specific handler for shutting down a device
25− * @set_bootaddr: omap-specific handler for setting the rproc boot address
26− */
27−struct omap_rproc_pdata {
28− const char *name;
29− const char *oh_name;
30− const char *oh_name_opt;
31− const char *firmware;
32− const char *mbox_name;
33− const struct rproc_ops *ops;
34− int (*device_enable)(struct platform_device *pdev);
35− int (*device_shutdown)(struct platform_device *pdev);
36− void (*set_bootaddr)(u32);
37−};
38−
39−#if defined(CONFIG_OMAP_REMOTEPROC) || defined(CONFIG_OMAP_REMOTEPROC_MODULE)
40−
41−void __init omap_rproc_reserve_cma(void);
42−
43−#else
44−
45−static inline void __init omap_rproc_reserve_cma(void)
46−{
47−}
48−
49−#endif
50−
51−#endif /* _PLAT_REMOTEPROC_H */
include/linux/platform_data/ti-sysc.h+5−0
@@ -17,6 +17,7 @@ enum ti_sysc_module_type { · 16 unmodified lines
1717 TI_SYSC_OMAP4_MCASP,
1818 TI_SYSC_OMAP4_USB_HOST_FS,
1919 TI_SYSC_DRA7_MCAN,
20+ TI_SYSC_PRUSS,
2021 };
2122
2223 struct ti_sysc_cookie {
@@ -49,6 +50,9 @@ struct sysc_regbits { · 26 unmodified lines
4950 s8 emufree_shift;
5051 };
5152
53+#define SYSC_MODULE_QUIRK_PRUSS BIT(24)
54+#define SYSC_MODULE_QUIRK_DSS_RESET BIT(23)
55+#define SYSC_MODULE_QUIRK_RTC_UNLOCK BIT(22)
5256 #define SYSC_QUIRK_CLKDM_NOAUTO BIT(21)
5357 #define SYSC_QUIRK_FORCE_MSTANDBY BIT(20)
5458 #define SYSC_MODULE_QUIRK_AESS BIT(19)
@@ -141,6 +145,7 @@ struct clk; · 86 unmodified lines
141145
142146 struct ti_sysc_platform_data {
143147 struct of_dev_auxdata *auxdata;
148+ bool (*soc_type_gp)(void);
144149 int (*init_clockdomain)(struct device *dev, struct clk *fck,
145150 struct clk *ick, struct ti_sysc_cookie *cookie);
146151 void (*clkdm_deny_idle)(struct device *dev,
include/linux/platform_data/wilco-ec.h+6−2
@@ -8,8 +8,8 @@ · 7 unmodified lines
88 #ifndef WILCO_EC_H
99 #define WILCO_EC_H
1010
11−#include <linux/device.h>
12−#include <linux/kernel.h>
11+#include <linux/mutex.h>
12+#include <linux/types.h>
1313
1414 /* Message flags for using the mailbox() interface */
1515 #define WILCO_EC_FLAG_NO_RESPONSE BIT(0) /* EC does not respond */
@@ -17,6 +17,10 @@ · 1 unmodified line
1717 /* Normal commands have a maximum 32 bytes of data */
1818 #define EC_MAILBOX_DATA_SIZE 32
1919
20+struct device;
21+struct resource;
22+struct platform_device;
23+
2024 /**
2125 * struct wilco_ec_device - Wilco Embedded Controller handle.
2226 * @dev: Device handle.
include/linux/platform_device.h+5−2
@@ -24,7 +24,7 @@ struct platform_device { · 23 unmodified lines
2424 int id;
2525 bool id_auto;
2626 struct device dev;
27− u64 dma_mask;
27+ u64 platform_dma_mask;
2828 u32 num_resources;
2929 struct resource *resource;
3030
@@ -55,6 +55,9 @@ extern struct device * · 24 unmodified lines
5555 platform_find_device_by_driver(struct device *start,
5656 const struct device_driver *drv);
5757 extern void __iomem *
58+devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
59+ unsigned int index, struct resource **res);
60+extern void __iomem *
5861 devm_platform_ioremap_resource(struct platform_device *pdev,
5962 unsigned int index);
6063 extern void __iomem *
@@ -89,7 +92,7 @@ struct platform_device_info { · 28 unmodified lines
8992 size_t size_data;
9093 u64 dma_mask;
9194
92− struct property_entry *properties;
95+ const struct property_entry *properties;
9396 };
9497 extern struct platform_device *platform_device_register_full(
9598 const struct platform_device_info *pdevinfo);
include/linux/pm_qos.h+42−39
@@ -1,22 +1,20 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2−#ifndef _LINUX_PM_QOS_H
3−#define _LINUX_PM_QOS_H
4−/* interface for the pm_qos_power infrastructure of the linux kernel.
2+/*
3+ * Definitions related to Power Management Quality of Service (PM QoS).
54 *
6− * Mark Gross <mgross@linux.intel.com>
5+ * Copyright (C) 2020 Intel Corporation
6+ *
7+ * Authors:
8+ * Mark Gross <mgross@linux.intel.com>
9+ * Rafael J. Wysocki <rafael.j.wysocki@intel.com>
710 */
11+
12+#ifndef _LINUX_PM_QOS_H
13+#define _LINUX_PM_QOS_H
14+
815 #include <linux/plist.h>
916 #include <linux/notifier.h>
1017 #include <linux/device.h>
11−#include <linux/workqueue.h>
12−
13−enum {
14− PM_QOS_RESERVED = 0,
15− PM_QOS_CPU_DMA_LATENCY,
16−
17− /* insert new class ID */
18− PM_QOS_NUM_CLASSES,
19−};
2018
2119 enum pm_qos_flags_status {
2220 PM_QOS_FLAGS_UNDEFINED = -1,
@@ -29,7 +27,7 @@ enum pm_qos_flags_status { · 6 unmodified lines
2927 #define PM_QOS_LATENCY_ANY S32_MAX
3028 #define PM_QOS_LATENCY_ANY_NS ((s64)PM_QOS_LATENCY_ANY * NSEC_PER_USEC)
3129
32−#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
30+#define PM_QOS_CPU_LATENCY_DEFAULT_VALUE (2000 * USEC_PER_SEC)
3331 #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE PM_QOS_LATENCY_ANY
3432 #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY
3533 #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS
@@ -40,22 +38,10 @@ enum pm_qos_flags_status { · 4 unmodified lines
4038
4139 #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)
4240
43−struct pm_qos_request {
44− struct plist_node node;
45− int pm_qos_class;
46− struct delayed_work work; /* for pm_qos_update_request_timeout */
47−};
48−
49−struct pm_qos_flags_request {
50− struct list_head node;
51− s32 flags; /* Do not change to 64 bit */
52−};
53−
5441 enum pm_qos_type {
5542 PM_QOS_UNITIALIZED,
5643 PM_QOS_MAX, /* return the largest value */
5744 PM_QOS_MIN, /* return the smallest value */
58− PM_QOS_SUM /* return the sum */
5945 };
6046
6147 /*
@@ -72,6 +58,16 @@ struct pm_qos_constraints { · 10 unmodified lines
7258 struct blocking_notifier_head *notifiers;
7359 };
7460
61+struct pm_qos_request {
62+ struct plist_node node;
63+ struct pm_qos_constraints *qos;
64+};
65+
66+struct pm_qos_flags_request {
67+ struct list_head node;
68+ s32 flags; /* Do not change to 64 bit */
69+};
70+
7571 struct pm_qos_flags {
7672 struct list_head list;
7773 s32 effective_flags; /* Do not change to 64 bit */
@@ -140,24 +136,31 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req) · 62 unmodified lines
140136 return req->dev != NULL;
141137 }
142138
139+s32 pm_qos_read_value(struct pm_qos_constraints *c);
143140 int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
144141 enum pm_qos_req_action action, int value);
145142 bool pm_qos_update_flags(struct pm_qos_flags *pqf,
146143 struct pm_qos_flags_request *req,
147144 enum pm_qos_req_action action, s32 val);
148−void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
149− s32 value);
150−void pm_qos_update_request(struct pm_qos_request *req,
151− s32 new_value);
152−void pm_qos_update_request_timeout(struct pm_qos_request *req,
153− s32 new_value, unsigned long timeout_us);
154−void pm_qos_remove_request(struct pm_qos_request *req);
155−
156−int pm_qos_request(int pm_qos_class);
157−int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
158−int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
159−int pm_qos_request_active(struct pm_qos_request *req);
160−s32 pm_qos_read_value(struct pm_qos_constraints *c);
145+
146+#ifdef CONFIG_CPU_IDLE
147+s32 cpu_latency_qos_limit(void);
148+bool cpu_latency_qos_request_active(struct pm_qos_request *req);
149+void cpu_latency_qos_add_request(struct pm_qos_request *req, s32 value);
150+void cpu_latency_qos_update_request(struct pm_qos_request *req, s32 new_value);
151+void cpu_latency_qos_remove_request(struct pm_qos_request *req);
152+#else
153+static inline s32 cpu_latency_qos_limit(void) { return INT_MAX; }
154+static inline bool cpu_latency_qos_request_active(struct pm_qos_request *req)
155+{
156+ return false;
157+}
158+static inline void cpu_latency_qos_add_request(struct pm_qos_request *req,
159+ s32 value) {}
160+static inline void cpu_latency_qos_update_request(struct pm_qos_request *req,
161+ s32 new_value) {}
162+static inline void cpu_latency_qos_remove_request(struct pm_qos_request *req) {}
163+#endif
161164
162165 #ifdef CONFIG_PM
163166 enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask);
include/linux/pm_runtime.h+11−1
@@ -38,7 +38,7 @@ extern int pm_runtime_force_resume(struct device *dev); · 37 unmodified lines
3838 extern int __pm_runtime_idle(struct device *dev, int rpmflags);
3939 extern int __pm_runtime_suspend(struct device *dev, int rpmflags);
4040 extern int __pm_runtime_resume(struct device *dev, int rpmflags);
41−extern int pm_runtime_get_if_in_use(struct device *dev);
41+extern int pm_runtime_get_if_active(struct device *dev, bool ign_usage_count);
4242 extern int pm_schedule_suspend(struct device *dev, unsigned int delay);
4343 extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
4444 extern int pm_runtime_barrier(struct device *dev);
@@ -60,6 +60,11 @@ extern void pm_runtime_put_suppliers(struct device *dev); · 15 unmodified lines
6060 extern void pm_runtime_new_link(struct device *dev);
6161 extern void pm_runtime_drop_link(struct device *dev);
6262
63+static inline int pm_runtime_get_if_in_use(struct device *dev)
64+{
65+ return pm_runtime_get_if_active(dev, false);
66+}
67+
6368 static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
6469 {
6570 dev->power.ignore_children = enable;
@@ -143,6 +148,11 @@ static inline int pm_runtime_get_if_in_use(struct device *dev) · 77 unmodified lines
143148 {
144149 return -EINVAL;
145150 }
151+static inline int pm_runtime_get_if_active(struct device *dev,
152+ bool ign_usage_count)
153+{
154+ return -EINVAL;
155+}
146156 static inline int __pm_runtime_set_status(struct device *dev,
147157 unsigned int status) { return 0; }
148158 static inline int pm_runtime_barrier(struct device *dev) { return 0; }
include/linux/pnp.h+1−1
@@ -379,7 +379,7 @@ struct pnp_id { · 378 unmodified lines
379379 };
380380
381381 struct pnp_driver {
382− char *name;
382+ const char *name;
383383 const struct pnp_device_id *id_table;
384384 unsigned int flags;
385385 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
include/linux/posix-timers.h+1−1
@@ -69,7 +69,7 @@ static inline int clockid_to_fd(const clockid_t clk) · 68 unmodified lines
6969 struct cpu_timer {
7070 struct timerqueue_node node;
7171 struct timerqueue_head *head;
72− struct task_struct *task;
72+ struct pid *pid;
7373 struct list_head elist;
7474 int firing;
7575 };
include/linux/power/bq2415x_charger.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 /*
33 * bq2415x charger driver
44 *
5− * Copyright (C) 2011-2013 Pali Rohár <pali.rohar@gmail.com>
5+ * Copyright (C) 2011-2013 Pali Rohár <pali@kernel.org>
66 */
77
88 #ifndef BQ2415X_CHARGER_H
include/linux/power/charger-manager.h+1−1
@@ -248,7 +248,7 @@ struct charger_manager { · 247 unmodified lines
248248 u64 charging_end_time;
249249 };
250250
251−#ifdef CONFIG_CHARGER_MANAGER
251+#if IS_ENABLED(CONFIG_CHARGER_MANAGER)
252252 extern void cm_notify_event(struct power_supply *psy,
253253 enum cm_event_types type, char *msg);
254254 #else
include/linux/preempt.h+30−0
@@ -322,4 +322,34 @@ static inline void preempt_notifier_init(struct preempt_notifier *notifier, · 321 unmodified lines
322322
323323 #endif
324324
325+/**
326+ * migrate_disable - Prevent migration of the current task
327+ *
328+ * Maps to preempt_disable() which also disables preemption. Use
329+ * migrate_disable() to annotate that the intent is to prevent migration,
330+ * but not necessarily preemption.
331+ *
332+ * Can be invoked nested like preempt_disable() and needs the corresponding
333+ * number of migrate_enable() invocations.
334+ */
335+static __always_inline void migrate_disable(void)
336+{
337+ preempt_disable();
338+}
339+
340+/**
341+ * migrate_enable - Allow migration of the current task
342+ *
343+ * Counterpart to migrate_disable().
344+ *
345+ * As migrate_disable() can be invoked nested, only the outermost invocation
346+ * reenables migration.
347+ *
348+ * Currently mapped to preempt_enable().
349+ */
350+static __always_inline void migrate_enable(void)
351+{
352+ preempt_enable();
353+}
354+
325355 #endif /* __LINUX_PREEMPT_H */
include/linux/printk.h+0−5
@@ -202,7 +202,6 @@ __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...); · 201 unmodified lines
202202 void dump_stack_print_info(const char *log_lvl);
203203 void show_regs_print_info(const char *log_lvl);
204204 extern asmlinkage void dump_stack(void) __cold;
205−extern void printk_safe_init(void);
206205 extern void printk_safe_flush(void);
207206 extern void printk_safe_flush_on_panic(void);
208207 #else
@@ -269,10 +268,6 @@ static inline void dump_stack(void) · 60 unmodified lines
269268 {
270269 }
271270
272−static inline void printk_safe_init(void)
273−{
274−}
275−
276271 static inline void printk_safe_flush(void)
277272 {
278273 }
include/linux/proc_fs.h+18−3
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #ifndef _LINUX_PROC_FS_H
66 #define _LINUX_PROC_FS_H
77
8+#include <linux/compiler.h>
89 #include <linux/types.h>
910 #include <linux/fs.h>
1011
@@ -12,7 +13,21 @@ struct proc_dir_entry; · 1 unmodified line
1213 struct seq_file;
1314 struct seq_operations;
1415
16+enum {
17+ /*
18+ * All /proc entries using this ->proc_ops instance are never removed.
19+ *
20+ * If in doubt, ignore this flag.
21+ */
22+#ifdef MODULE
23+ PROC_ENTRY_PERMANENT = 0U,
24+#else
25+ PROC_ENTRY_PERMANENT = 1U << 0,
26+#endif
27+};
28+
1529 struct proc_ops {
30+ unsigned int proc_flags;
1631 int (*proc_open)(struct inode *, struct file *);
1732 ssize_t (*proc_read)(struct file *, char __user *, size_t, loff_t *);
1833 ssize_t (*proc_write)(struct file *, const char __user *, size_t, loff_t *);
@@ -25,14 +40,14 @@ struct proc_ops { · 6 unmodified lines
2540 #endif
2641 int (*proc_mmap)(struct file *, struct vm_area_struct *);
2742 unsigned long (*proc_get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
28−};
43+} __randomize_layout;
2944
3045 #ifdef CONFIG_PROC_FS
3146
3247 typedef int (*proc_write_t)(struct file *, char *, size_t);
3348
3449 extern void proc_root_init(void);
35−extern void proc_flush_task(struct task_struct *);
50+extern void proc_flush_pid(struct pid *);
3651
3752 extern struct proc_dir_entry *proc_symlink(const char *,
3853 struct proc_dir_entry *, const char *);
@@ -105,7 +120,7 @@ static inline void proc_root_init(void) · 66 unmodified lines
105120 {
106121 }
107122
108−static inline void proc_flush_task(struct task_struct *task)
123+static inline void proc_flush_pid(struct pid *pid)
109124 {
110125 }
111126
include/linux/proc_ns.h+2−5
@@ -50,16 +50,11 @@ enum { · 49 unmodified lines
5050
5151 #ifdef CONFIG_PROC_FS
5252
53−extern int pid_ns_prepare_proc(struct pid_namespace *ns);
54−extern void pid_ns_release_proc(struct pid_namespace *ns);
5553 extern int proc_alloc_inum(unsigned int *pino);
5654 extern void proc_free_inum(unsigned int inum);
5755
5856 #else /* CONFIG_PROC_FS */
5957
60−static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; }
61−static inline void pid_ns_release_proc(struct pid_namespace *ns) {}
62−
6358 static inline int proc_alloc_inum(unsigned int *inum)
6459 {
6560 *inum = 1;
@@ -85,6 +80,8 @@ typedef struct ns_common *ns_get_path_helper_t(void *); · 19 unmodified lines
8580 extern int ns_get_path_cb(struct path *path, ns_get_path_helper_t ns_get_cb,
8681 void *private_data);
8782
83+extern bool ns_match(const struct ns_common *ns, dev_t dev, ino_t ino);
84+
8885 extern int ns_get_name(char *buf, size_t size, struct task_struct *task,
8986 const struct proc_ns_operations *ns_ops);
9087 extern void nsfs_init(void);
include/linux/psi.h+2−0
@@ -17,6 +17,8 @@ extern struct psi_group psi_system; · 16 unmodified lines
1717 void psi_init(void);
1818
1919 void psi_task_change(struct task_struct *task, int clear, int set);
20+void psi_task_switch(struct task_struct *prev, struct task_struct *next,
21+ bool sleep);
2022
2123 void psi_memstall_tick(struct task_struct *task, int cpu);
2224 void psi_memstall_enter(unsigned long *flags);
include/linux/psi_types.h+9−1
@@ -14,13 +14,21 @@ enum psi_task_count { · 13 unmodified lines
1414 NR_IOWAIT,
1515 NR_MEMSTALL,
1616 NR_RUNNING,
17− NR_PSI_TASK_COUNTS = 3,
17+ /*
18+ * This can't have values other than 0 or 1 and could be
19+ * implemented as a bit flag. But for now we still have room
20+ * in the first cacheline of psi_group_cpu, and this way we
21+ * don't have to special case any state tracking for it.
22+ */
23+ NR_ONCPU,
24+ NR_PSI_TASK_COUNTS = 4,
1825 };
1926
2027 /* Task state bitmasks */
2128 #define TSK_IOWAIT (1 << NR_IOWAIT)
2229 #define TSK_MEMSTALL (1 << NR_MEMSTALL)
2330 #define TSK_RUNNING (1 << NR_RUNNING)
31+#define TSK_ONCPU (1 << NR_ONCPU)
2432
2533 /* Resources that workloads could be stalled on */
2634 enum psi_res {
include/linux/ptp_clock_kernel.h+19−0
@@ -223,6 +223,12 @@ extern s32 scaled_ppm_to_ppb(long ppm); · 222 unmodified lines
223223 /**
224224 * ptp_find_pin() - obtain the pin index of a given auxiliary function
225225 *
226+ * The caller must hold ptp_clock::pincfg_mux. Drivers do not have
227+ * access to that mutex as ptp_clock is an opaque type. However, the
228+ * core code acquires the mutex before invoking the driver's
229+ * ptp_clock_info::enable() callback, and so drivers may call this
230+ * function from that context.
231+ *
226232 * @ptp: The clock obtained from ptp_clock_register().
227233 * @func: One of the ptp_pin_function enumerated values.
228234 * @chan: The particular functional channel to find.
@@ -233,6 +239,19 @@ extern s32 scaled_ppm_to_ppb(long ppm); · 4 unmodified lines
233239 int ptp_find_pin(struct ptp_clock *ptp,
234240 enum ptp_pin_function func, unsigned int chan);
235241
242+/**
243+ * ptp_find_pin_unlocked() - wrapper for ptp_find_pin()
244+ *
245+ * This function acquires the ptp_clock::pincfg_mux mutex before
246+ * invoking ptp_find_pin(). Instead of using this function, drivers
247+ * should most likely call ptp_find_pin() directly from their
248+ * ptp_clock_info::enable() method.
249+ *
250+ */
251+
252+int ptp_find_pin_unlocked(struct ptp_clock *ptp,
253+ enum ptp_pin_function func, unsigned int chan);
254+
236255 /**
237256 * ptp_schedule_worker() - schedule ptp auxiliary work
238257 *
include/linux/pwm.h+3−1
@@ -71,7 +71,8 @@ struct pwm_state { · 70 unmodified lines
7171 * @chip: PWM chip providing this PWM device
7272 * @chip_data: chip-private data associated with the PWM device
7373 * @args: PWM arguments
74− * @state: curent PWM channel state
74+ * @state: last applied state
75+ * @last: last implemented state (for PWM_DEBUG)
7576 */
7677 struct pwm_device {
7778 const char *label;
@@ -83,6 +84,7 @@ struct pwm_device { · 5 unmodified lines
8384
8485 struct pwm_args args;
8586 struct pwm_state state;
87+ struct pwm_state last;
8688 };
8789
8890 /**
include/linux/pwm_backlight.h+0−2
@@ -16,8 +16,6 @@ struct platform_pwm_backlight_data { · 15 unmodified lines
1616 unsigned int *levels;
1717 unsigned int post_pwm_on_delay;
1818 unsigned int pwm_off_delay;
19− /* TODO remove once all users are switched to gpiod_* API */
20− int enable_gpio;
2119 int (*init)(struct device *dev);
2220 int (*notify)(struct device *dev, int brightness);
2321 void (*notify_after)(struct device *dev, int brightness);
include/linux/qed/qed_chain.h+15−9
@@ -97,6 +97,11 @@ struct qed_chain_u32 { · 96 unmodified lines
9797 u32 cons_idx;
9898 };
9999
100+struct addr_tbl_entry {
101+ void *virt_addr;
102+ dma_addr_t dma_map;
103+};
104+
100105 struct qed_chain {
101106 /* fastpath portion of the chain - required for commands such
102107 * as produce / consume.
@@ -107,10 +112,11 @@ struct qed_chain { · 4 unmodified lines
107112
108113 /* Fastpath portions of the PBL [if exists] */
109114 struct {
110− /* Table for keeping the virtual addresses of the chain pages,
111− * respectively to the physical addresses in the pbl table.
115+ /* Table for keeping the virtual and physical addresses of the
116+ * chain pages, respectively to the physical addresses
117+ * in the pbl table.
112118 */
113− void **pp_virt_addr_tbl;
119+ struct addr_tbl_entry *pp_addr_tbl;
114120
115121 union {
116122 struct qed_chain_pbl_u16 u16;
@@ -287,7 +293,7 @@ qed_chain_advance_page(struct qed_chain *p_chain, · 170 unmodified lines
287293 *(u32 *)page_to_inc = 0;
288294 page_index = *(u32 *)page_to_inc;
289295 }
290− *p_next_elem = p_chain->pbl.pp_virt_addr_tbl[page_index];
296+ *p_next_elem = p_chain->pbl.pp_addr_tbl[page_index].virt_addr;
291297 }
292298 }
293299
@@ -537,7 +543,7 @@ static inline void qed_chain_init_params(struct qed_chain *p_chain, · 243 unmodified lines
537543
538544 p_chain->pbl_sp.p_phys_table = 0;
539545 p_chain->pbl_sp.p_virt_table = NULL;
540− p_chain->pbl.pp_virt_addr_tbl = NULL;
546+ p_chain->pbl.pp_addr_tbl = NULL;
541547 }
542548
543549 /**
@@ -575,11 +581,11 @@ static inline void qed_chain_init_mem(struct qed_chain *p_chain, · 31 unmodified lines
575581 static inline void qed_chain_init_pbl_mem(struct qed_chain *p_chain,
576582 void *p_virt_pbl,
577583 dma_addr_t p_phys_pbl,
578− void **pp_virt_addr_tbl)
584+ struct addr_tbl_entry *pp_addr_tbl)
579585 {
580586 p_chain->pbl_sp.p_phys_table = p_phys_pbl;
581587 p_chain->pbl_sp.p_virt_table = p_virt_pbl;
582− p_chain->pbl.pp_virt_addr_tbl = pp_virt_addr_tbl;
588+ p_chain->pbl.pp_addr_tbl = pp_addr_tbl;
583589 }
584590
585591 /**
@@ -644,7 +650,7 @@ static inline void *qed_chain_get_last_elem(struct qed_chain *p_chain) · 58 unmodified lines
644650 break;
645651 case QED_CHAIN_MODE_PBL:
646652 last_page_idx = p_chain->page_cnt - 1;
647− p_virt_addr = p_chain->pbl.pp_virt_addr_tbl[last_page_idx];
653+ p_virt_addr = p_chain->pbl.pp_addr_tbl[last_page_idx].virt_addr;
648654 break;
649655 }
650656 /* p_virt_addr points at this stage to the last page of the chain */
@@ -716,7 +722,7 @@ static inline void qed_chain_pbl_zero_mem(struct qed_chain *p_chain) · 65 unmodified lines
716722 page_cnt = qed_chain_get_page_cnt(p_chain);
717723
718724 for (i = 0; i < page_cnt; i++)
719− memset(p_chain->pbl.pp_virt_addr_tbl[i], 0,
725+ memset(p_chain->pbl.pp_addr_tbl[i].virt_addr, 0,
720726 QED_CHAIN_PAGE_SIZE);
721727 }
722728
include/linux/raid/detect.h+3−0
@@ -0,0 +1,3 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+
3+void md_autodetect_dev(dev_t dev);
include/linux/random.h+22−0
@@ -7,6 +7,8 @@ · 6 unmodified lines
77 #ifndef _LINUX_RANDOM_H
88 #define _LINUX_RANDOM_H
99
10+#include <linux/bug.h>
11+#include <linux/kernel.h>
1012 #include <linux/list.h>
1113 #include <linux/once.h>
1214
@@ -185,6 +187,26 @@ static inline bool __must_check arch_get_random_seed_int(unsigned int *v) · 172 unmodified lines
185187 }
186188 #endif
187189
190+/*
191+ * Called from the boot CPU during startup; not valid to call once
192+ * secondary CPUs are up and preemption is possible.
193+ */
194+#ifndef arch_get_random_seed_long_early
195+static inline bool __init arch_get_random_seed_long_early(unsigned long *v)
196+{
197+ WARN_ON(system_state != SYSTEM_BOOTING);
198+ return arch_get_random_seed_long(v);
199+}
200+#endif
201+
202+#ifndef arch_get_random_long_early
203+static inline bool __init arch_get_random_long_early(unsigned long *v)
204+{
205+ WARN_ON(system_state != SYSTEM_BOOTING);
206+ return arch_get_random_long(v);
207+}
208+#endif
209+
188210 /* Pseudo random number generator from numerical recipes. */
189211 static inline u32 next_pseudo_random32(u32 seed)
190212 {
include/linux/rculist.h+2−2
@@ -60,9 +60,9 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list) · 59 unmodified lines
6060 #define __list_check_rcu(dummy, cond, extra...) \
6161 ({ \
6262 check_arg_count_one(extra); \
63− RCU_LOCKDEP_WARN(!cond && !rcu_read_lock_any_held(), \
63+ RCU_LOCKDEP_WARN(!(cond) && !rcu_read_lock_any_held(), \
6464 "RCU-list traversed in non-reader section!"); \
65− })
65+ })
6666 #else
6767 #define __list_check_rcu(dummy, cond, extra...) \
6868 ({ check_arg_count_one(extra); })
include/linux/rcutiny.h+1−0
@@ -83,6 +83,7 @@ void rcu_scheduler_starting(void); · 82 unmodified lines
8383 static inline void rcu_scheduler_starting(void) { }
8484 #endif /* #else #ifndef CONFIG_SRCU */
8585 static inline void rcu_end_inkernel_boot(void) { }
86+static inline bool rcu_inkernel_boot_has_ended(void) { return true; }
8687 static inline bool rcu_is_watching(void) { return true; }
8788 static inline void rcu_momentary_dyntick_idle(void) { }
8889 static inline void kfree_rcu_scheduler_running(void) { }
include/linux/rcutree.h+1−0
@@ -54,6 +54,7 @@ void exit_rcu(void); · 53 unmodified lines
5454 void rcu_scheduler_starting(void);
5555 extern int rcu_scheduler_active __read_mostly;
5656 void rcu_end_inkernel_boot(void);
57+bool rcu_inkernel_boot_has_ended(void);
5758 bool rcu_is_watching(void);
5859 #ifndef CONFIG_PREEMPTION
5960 void rcu_all_qs(void);
include/linux/rcuwait.h+10−2
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #define _LINUX_RCUWAIT_H_
44
55 #include <linux/rcupdate.h>
6+#include <linux/sched/signal.h>
67
78 /*
89 * rcuwait provides a way of blocking and waking up a single
@@ -30,23 +31,30 @@ extern void rcuwait_wake_up(struct rcuwait *w); · 21 unmodified lines
3031 * The caller is responsible for locking around rcuwait_wait_event(),
3132 * such that writes to @task are properly serialized.
3233 */
33−#define rcuwait_wait_event(w, condition) \
34+#define rcuwait_wait_event(w, condition, state) \
3435 ({ \
36+ int __ret = 0; \
3537 rcu_assign_pointer((w)->task, current); \
3638 for (;;) { \
3739 /* \
3840 * Implicit barrier (A) pairs with (B) in \
3941 * rcuwait_wake_up(). \
4042 */ \
41− set_current_state(TASK_UNINTERRUPTIBLE); \
43+ set_current_state(state); \
4244 if (condition) \
4345 break; \
4446 \
47+ if (signal_pending_state(state, current)) { \
48+ __ret = -EINTR; \
49+ break; \
50+ } \
51+ \
4552 schedule(); \
4653 } \
4754 \
4855 WRITE_ONCE((w)->task, NULL); \
4956 __set_current_state(TASK_RUNNING); \
57+ __ret; \
5058 })
5159
5260 #endif /* _LINUX_RCUWAIT_H_ */
include/linux/refcount.h+18−5
@@ -38,11 +38,24 @@ · 37 unmodified lines
3838 * atomic operations, then the count will continue to edge closer to 0. If it
3939 * reaches a value of 1 before /any/ of the threads reset it to the saturated
4040 * value, then a concurrent refcount_dec_and_test() may erroneously free the
41− * underlying object. Given the precise timing details involved with the
42− * round-robin scheduling of each thread manipulating the refcount and the need
43− * to hit the race multiple times in succession, there doesn't appear to be a
44− * practical avenue of attack even if using refcount_add() operations with
45− * larger increments.
41+ * underlying object.
42+ * Linux limits the maximum number of tasks to PID_MAX_LIMIT, which is currently
43+ * 0x400000 (and can't easily be raised in the future beyond FUTEX_TID_MASK).
44+ * With the current PID limit, if no batched refcounting operations are used and
45+ * the attacker can't repeatedly trigger kernel oopses in the middle of refcount
46+ * operations, this makes it impossible for a saturated refcount to leave the
47+ * saturation range, even if it is possible for multiple uses of the same
48+ * refcount to nest in the context of a single task:
49+ *
50+ * (UINT_MAX+1-REFCOUNT_SATURATED) / PID_MAX_LIMIT =
51+ * 0x40000000 / 0x400000 = 0x100 = 256
52+ *
53+ * If hundreds of references are added/removed with a single refcounting
54+ * operation, it may potentially be possible to leave the saturation range; but
55+ * given the precise timing details involved with the round-robin scheduling of
56+ * each thread manipulating the refcount and the need to hit the race multiple
57+ * times in succession, there doesn't appear to be a practical avenue of attack
58+ * even if using refcount_add() operations with larger increments.
4659 *
4760 * Memory ordering
4861 * ===============
include/linux/regmap.h+2−2
@@ -461,8 +461,8 @@ struct regmap_config { · 460 unmodified lines
461461 * @range_max: Address of the highest register in virtual range.
462462 *
463463 * @selector_reg: Register with selector field.
464− * @selector_mask: Bit shift for selector value.
465− * @selector_shift: Bit mask for selector value.
464+ * @selector_mask: Bit mask for selector value.
465+ * @selector_shift: Bit shift for selector value.
466466 *
467467 * @window_start: Address of first (lowest) register in data window.
468468 * @window_len: Number of registers in data window.
include/linux/regulator/driver.h+2−2
@@ -277,9 +277,9 @@ enum regulator_type { · 276 unmodified lines
277277 * @curr_table: Current limit mapping table (if table based mapping)
278278 *
279279 * @vsel_range_reg: Register for range selector when using pickable ranges
280− * and regulator_regmap_X_voltage_X_pickable functions.
280+ * and ``regulator_map_*_voltage_*_pickable`` functions.
281281 * @vsel_range_mask: Mask for register bitfield used for range selector
282− * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
282+ * @vsel_reg: Register for selector when using ``regulator_map_*_voltage_*``
283283 * @vsel_mask: Mask for register bitfield used for selector
284284 * @vsel_step: Specify the resolution of selector stepping when setting
285285 * voltage. If 0, then no stepping is done (requested selector is
include/linux/remoteproc.h+10−6
@@ -329,7 +329,7 @@ struct rproc; · 328 unmodified lines
329329 struct rproc_mem_entry {
330330 void *va;
331331 dma_addr_t dma;
332− int len;
332+ size_t len;
333333 u32 da;
334334 void *priv;
335335 char name[32];
@@ -369,12 +369,14 @@ enum rsc_handling_status { · 33 unmodified lines
369369 * expects to find it
370370 * @sanity_check: sanity check the fw image
371371 * @get_boot_addr: get boot address to entry point specified in firmware
372+ * @panic: optional callback to react to system panic, core will delay
373+ * panic at least the returned number of milliseconds
372374 */
373375 struct rproc_ops {
374376 int (*start)(struct rproc *rproc);
375377 int (*stop)(struct rproc *rproc);
376378 void (*kick)(struct rproc *rproc, int vqid);
377− void * (*da_to_va)(struct rproc *rproc, u64 da, int len);
379+ void * (*da_to_va)(struct rproc *rproc, u64 da, size_t len);
378380 int (*parse_fw)(struct rproc *rproc, const struct firmware *fw);
379381 int (*handle_rsc)(struct rproc *rproc, u32 rsc_type, void *rsc,
380382 int offset, int avail);
@@ -382,7 +384,8 @@ struct rproc_ops { · 1 unmodified line
382384 struct rproc *rproc, const struct firmware *fw);
383385 int (*load)(struct rproc *rproc, const struct firmware *fw);
384386 int (*sanity_check)(struct rproc *rproc, const struct firmware *fw);
385− u32 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw);
387+ u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw);
388+ unsigned long (*panic)(struct rproc *rproc);
386389 };
387390
388391 /**
@@ -498,7 +501,7 @@ struct rproc { · 109 unmodified lines
498501 int num_traces;
499502 struct list_head carveouts;
500503 struct list_head mappings;
501− u32 bootaddr;
504+ u64 bootaddr;
502505 struct list_head rvdevs;
503506 struct list_head subdevs;
504507 struct idr notifyids;
@@ -514,6 +517,7 @@ struct rproc { · 9 unmodified lines
514517 bool auto_boot;
515518 struct list_head dump_segments;
516519 int nb_vdev;
520+ u8 elf_class;
517521 };
518522
519523 /**
@@ -599,13 +603,13 @@ void rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem); · 79 unmodified lines
599603
600604 struct rproc_mem_entry *
601605 rproc_mem_entry_init(struct device *dev,
602− void *va, dma_addr_t dma, int len, u32 da,
606+ void *va, dma_addr_t dma, size_t len, u32 da,
603607 int (*alloc)(struct rproc *, struct rproc_mem_entry *),
604608 int (*release)(struct rproc *, struct rproc_mem_entry *),
605609 const char *name, ...);
606610
607611 struct rproc_mem_entry *
608−rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len,
612+rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len,
609613 u32 da, const char *name, ...);
610614
611615 int rproc_boot(struct rproc *rproc);
include/linux/remoteproc/qcom_q6v5_ipa_notify.h+82−0
@@ -0,0 +1,82 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+
3+/* Copyright (C) 2019 Linaro Ltd. */
4+
5+#ifndef __QCOM_Q6V5_IPA_NOTIFY_H__
6+#define __QCOM_Q6V5_IPA_NOTIFY_H__
7+
8+#if IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY)
9+
10+#include <linux/remoteproc.h>
11+
12+enum qcom_rproc_event {
13+ MODEM_STARTING = 0, /* Modem is about to be started */
14+ MODEM_RUNNING = 1, /* Startup complete; modem is operational */
15+ MODEM_STOPPING = 2, /* Modem is about to shut down */
16+ MODEM_CRASHED = 3, /* Modem has crashed (implies stopping) */
17+ MODEM_OFFLINE = 4, /* Modem is now offline */
18+ MODEM_REMOVING = 5, /* Modem is about to be removed */
19+};
20+
21+typedef void (*qcom_ipa_notify_t)(void *data, enum qcom_rproc_event event);
22+
23+struct qcom_rproc_ipa_notify {
24+ struct rproc_subdev subdev;
25+
26+ qcom_ipa_notify_t notify;
27+ void *data;
28+};
29+
30+/**
31+ * qcom_add_ipa_notify_subdev() - Register IPA notification subdevice
32+ * @rproc: rproc handle
33+ * @ipa_notify: IPA notification subdevice handle
34+ *
35+ * Register the @ipa_notify subdevice with the @rproc so modem events
36+ * can be sent to IPA when they occur.
37+ *
38+ * This is defined in "qcom_q6v5_ipa_notify.c".
39+ */
40+void qcom_add_ipa_notify_subdev(struct rproc *rproc,
41+ struct qcom_rproc_ipa_notify *ipa_notify);
42+
43+/**
44+ * qcom_remove_ipa_notify_subdev() - Remove IPA SSR subdevice
45+ * @rproc: rproc handle
46+ * @ipa_notify: IPA notification subdevice handle
47+ *
48+ * This is defined in "qcom_q6v5_ipa_notify.c".
49+ */
50+void qcom_remove_ipa_notify_subdev(struct rproc *rproc,
51+ struct qcom_rproc_ipa_notify *ipa_notify);
52+
53+/**
54+ * qcom_register_ipa_notify() - Register IPA notification function
55+ * @rproc: Remote processor handle
56+ * @notify: Non-null IPA notification callback function pointer
57+ * @data: Data supplied to IPA notification callback function
58+ *
59+ * @Return: 0 if successful, or a negative error code otherwise
60+ *
61+ * This is defined in "qcom_q6v5_mss.c".
62+ */
63+int qcom_register_ipa_notify(struct rproc *rproc, qcom_ipa_notify_t notify,
64+ void *data);
65+/**
66+ * qcom_deregister_ipa_notify() - Deregister IPA notification function
67+ * @rproc: Remote processor handle
68+ *
69+ * This is defined in "qcom_q6v5_mss.c".
70+ */
71+void qcom_deregister_ipa_notify(struct rproc *rproc);
72+
73+#else /* !IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY) */
74+
75+struct qcom_rproc_ipa_notify { /* empty */ };
76+
77+#define qcom_add_ipa_notify_subdev(rproc, ipa_notify) /* no-op */
78+#define qcom_remove_ipa_notify_subdev(rproc, ipa_notify) /* no-op */
79+
80+#endif /* !IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY) */
81+
82+#endif /* !__QCOM_Q6V5_IPA_NOTIFY_H__ */
include/linux/rhashtable.h+1−1
@@ -972,9 +972,9 @@ static inline int rhashtable_lookup_insert_key( · 971 unmodified lines
972972 /**
973973 * rhashtable_lookup_get_insert_key - lookup and insert object into hash table
974974 * @ht: hash table
975+ * @key: key
975976 * @obj: pointer to hash head inside object
976977 * @params: hash table parameters
977− * @data: pointer to element data already in hashes
978978 *
979979 * Just like rhashtable_lookup_insert_key(), but this function returns the
980980 * object if it exists, NULL if it does not and the insertion was successful,
include/linux/ring_buffer.h+2−2
@@ -135,10 +135,10 @@ void ring_buffer_read_finish(struct ring_buffer_iter *iter); · 134 unmodified lines
135135
136136 struct ring_buffer_event *
137137 ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts);
138−struct ring_buffer_event *
139−ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts);
138+void ring_buffer_iter_advance(struct ring_buffer_iter *iter);
140139 void ring_buffer_iter_reset(struct ring_buffer_iter *iter);
141140 int ring_buffer_iter_empty(struct ring_buffer_iter *iter);
141+bool ring_buffer_iter_dropped(struct ring_buffer_iter *iter);
142142
143143 unsigned long ring_buffer_size(struct trace_buffer *buffer, int cpu);
144144
include/linux/rtc.h+0−12
@@ -34,18 +34,6 @@ static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs) · 33 unmodified lines
3434 return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);
3535 }
3636
37−static inline void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
38−{
39− rtc_time64_to_tm(time, tm);
40−}
41−
42−static inline int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
43−{
44− *time = rtc_tm_to_time64(tm);
45−
46− return 0;
47−}
48−
4937 #include <linux/device.h>
5038 #include <linux/seq_file.h>
5139 #include <linux/cdev.h>
include/linux/rwlock_types.h+5−1
@@ -22,7 +22,11 @@ typedef struct { · 21 unmodified lines
2222 #define RWLOCK_MAGIC 0xdeaf1eed
2323
2424 #ifdef CONFIG_DEBUG_LOCK_ALLOC
25−# define RW_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }
25+# define RW_DEP_MAP_INIT(lockname) \
26+ .dep_map = { \
27+ .name = #lockname, \
28+ .wait_type_inner = LD_WAIT_CONFIG, \
29+ }
2630 #else
2731 # define RW_DEP_MAP_INIT(lockname)
2832 #endif
include/linux/rwsem.h+5−7
@@ -53,12 +53,6 @@ struct rw_semaphore { · 52 unmodified lines
5353 #endif
5454 };
5555
56−/*
57− * Setting all bits of the owner field except bit 0 will indicate
58− * that the rwsem is writer-owned with an unknown owner.
59− */
60−#define RWSEM_OWNER_UNKNOWN (-2L)
61−
6256 /* In all implementations count != 0 means locked */
6357 static inline int rwsem_is_locked(struct rw_semaphore *sem)
6458 {
@@ -71,7 +65,11 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) · 6 unmodified lines
7165 /* Common initializer macros and functions */
7266
7367 #ifdef CONFIG_DEBUG_LOCK_ALLOC
74−# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
68+# define __RWSEM_DEP_MAP_INIT(lockname) \
69+ , .dep_map = { \
70+ .name = #lockname, \
71+ .wait_type_inner = LD_WAIT_SLEEP, \
72+ }
7573 #else
7674 # define __RWSEM_DEP_MAP_INIT(lockname)
7775 #endif
include/linux/sched.h+25−18
@@ -356,28 +356,30 @@ struct util_est { · 355 unmodified lines
356356 } __attribute__((__aligned__(sizeof(u64))));
357357
358358 /*
359− * The load_avg/util_avg accumulates an infinite geometric series
360− * (see __update_load_avg() in kernel/sched/fair.c).
359+ * The load/runnable/util_avg accumulates an infinite geometric series
360+ * (see __update_load_avg_cfs_rq() in kernel/sched/pelt.c).
361361 *
362362 * [load_avg definition]
363363 *
364364 * load_avg = runnable% * scale_load_down(load)
365365 *
366− * where runnable% is the time ratio that a sched_entity is runnable.
367− * For cfs_rq, it is the aggregated load_avg of all runnable and
368− * blocked sched_entities.
366+ * [runnable_avg definition]
367+ *
368+ * runnable_avg = runnable% * SCHED_CAPACITY_SCALE
369369 *
370370 * [util_avg definition]
371371 *
372372 * util_avg = running% * SCHED_CAPACITY_SCALE
373373 *
374− * where running% is the time ratio that a sched_entity is running on
375− * a CPU. For cfs_rq, it is the aggregated util_avg of all runnable
376− * and blocked sched_entities.
374+ * where runnable% is the time ratio that a sched_entity is runnable and
375+ * running% the time ratio that a sched_entity is running.
376+ *
377+ * For cfs_rq, they are the aggregated values of all runnable and blocked
378+ * sched_entities.
377379 *
378− * load_avg and util_avg don't direcly factor frequency scaling and CPU
379− * capacity scaling. The scaling is done through the rq_clock_pelt that
380− * is used for computing those signals (see update_rq_clock_pelt())
380+ * The load/runnable/util_avg doesn't direcly factor frequency scaling and CPU
381+ * capacity scaling. The scaling is done through the rq_clock_pelt that is used
382+ * for computing those signals (see update_rq_clock_pelt())
381383 *
382384 * N.B., the above ratios (runnable% and running%) themselves are in the
383385 * range of [0, 1]. To do fixed point arithmetics, we therefore scale them
@@ -401,11 +403,11 @@ struct util_est { · 17 unmodified lines
401403 struct sched_avg {
402404 u64 last_update_time;
403405 u64 load_sum;
404− u64 runnable_load_sum;
406+ u64 runnable_sum;
405407 u32 util_sum;
406408 u32 period_contrib;
407409 unsigned long load_avg;
408− unsigned long runnable_load_avg;
410+ unsigned long runnable_avg;
409411 unsigned long util_avg;
410412 struct util_est util_est;
411413 } ____cacheline_aligned;
@@ -449,7 +451,6 @@ struct sched_statistics { · 37 unmodified lines
449451 struct sched_entity {
450452 /* For load-balancing: */
451453 struct load_weight load;
452− unsigned long runnable_weight;
453454 struct rb_node run_node;
454455 struct list_head group_node;
455456 unsigned int on_rq;
@@ -470,6 +471,8 @@ struct sched_entity { · 14 unmodified lines
470471 struct cfs_rq *cfs_rq;
471472 /* rq "owned" by this entity/group: */
472473 struct cfs_rq *my_q;
474+ /* cached value of my_q->h_nr_running */
475+ unsigned long runnable_weight;
473476 #endif
474477
475478 #ifdef CONFIG_SMP
@@ -782,9 +785,12 @@ struct task_struct { · 306 unmodified lines
782785 unsigned frozen:1;
783786 #endif
784787 #ifdef CONFIG_BLK_CGROUP
785− /* to be used once the psi infrastructure lands upstream. */
786788 unsigned use_memdelay:1;
787789 #endif
790+#ifdef CONFIG_PSI
791+ /* Stalled due to lack of memory */
792+ unsigned in_memstall:1;
793+#endif
788794
789795 unsigned long atomic_flags; /* Flags requiring atomic access. */
790796
@@ -939,8 +945,8 @@ struct task_struct { · 148 unmodified lines
939945 struct seccomp seccomp;
940946
941947 /* Thread group tracking: */
942− u32 parent_exec_id;
943− u32 self_exec_id;
948+ u64 parent_exec_id;
949+ u64 self_exec_id;
944950
945951 /* Protection against (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, mempolicy: */
946952 spinlock_t alloc_lock;
@@ -970,6 +976,7 @@ struct task_struct { · 23 unmodified lines
970976
971977 #ifdef CONFIG_TRACE_IRQFLAGS
972978 unsigned int irq_events;
979+ unsigned int hardirq_threaded;
973980 unsigned long hardirq_enable_ip;
974981 unsigned long hardirq_disable_ip;
975982 unsigned int hardirq_enable_event;
@@ -982,6 +989,7 @@ struct task_struct { · 6 unmodified lines
982989 unsigned int softirq_enable_event;
983990 int softirqs_enabled;
984991 int softirq_context;
992+ int irq_config;
985993 #endif
986994
987995 #ifdef CONFIG_LOCKDEP
@@ -1477,7 +1485,6 @@ extern struct pid *cad_pid; · 489 unmodified lines
14771485 #define PF_KTHREAD 0x00200000 /* I am a kernel thread */
14781486 #define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */
14791487 #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1480−#define PF_MEMSTALL 0x01000000 /* Stalled due to lack of memory */
14811488 #define PF_UMH 0x02000000 /* I'm an Usermodehelper process */
14821489 #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */
14831490 #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
include/linux/sched/signal.h+24−1
@@ -10,6 +10,8 @@ · 9 unmodified lines
1010 #include <linux/cred.h>
1111 #include <linux/refcount.h>
1212 #include <linux/posix-timers.h>
13+#include <linux/mm_types.h>
14+#include <asm/ptrace.h>
1315
1416 /*
1517 * Types defining task->signal and task->sighand and APIs using them:
@@ -224,7 +226,14 @@ struct signal_struct { · 208 unmodified lines
224226
225227 struct mutex cred_guard_mutex; /* guard against foreign influences on
226228 * credential calculations
227− * (notably. ptrace) */
229+ * (notably. ptrace)
230+ * Deprecated do not use in new code.
231+ * Use exec_update_mutex instead.
232+ */
233+ struct mutex exec_update_mutex; /* Held while task_struct is being
234+ * updated during exec, and may have
235+ * inconsistent permissions.
236+ */
228237 } __randomize_layout;
229238
230239 /*
@@ -369,6 +378,20 @@ static inline int signal_pending_state(long state, struct task_struct *p) · 138 unmodified lines
369378 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
370379 }
371380
381+/*
382+ * This should only be used in fault handlers to decide whether we
383+ * should stop the current fault routine to handle the signals
384+ * instead, especially with the case where we've got interrupted with
385+ * a VM_FAULT_RETRY.
386+ */
387+static inline bool fault_signal_pending(vm_fault_t fault_flags,
388+ struct pt_regs *regs)
389+{
390+ return unlikely((fault_flags & VM_FAULT_RETRY) &&
391+ (fatal_signal_pending(current) ||
392+ (user_mode(regs) && signal_pending(current))));
393+}
394+
372395 /*
373396 * Reevaluate whether the task has signals pending delivery.
374397 * Wake the task if so.
include/linux/sched/task.h+4−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 struct task_struct;
1414 struct rusage;
1515 union thread_union;
16+struct css_set;
1617
1718 /* All the bits taken by the old clone syscall. */
1819 #define CLONE_LEGACY_FLAGS 0xffffffffULL
@@ -29,6 +30,9 @@ struct kernel_clone_args { · 10 unmodified lines
2930 pid_t *set_tid;
3031 /* Number of elements in *set_tid */
3132 size_t set_tid_size;
33+ int cgroup;
34+ struct cgroup *cgrp;
35+ struct css_set *cset;
3236 };
3337
3438 /*
include/linux/sched/topology.h+8−0
@@ -225,6 +225,14 @@ unsigned long arch_scale_cpu_capacity(int cpu) · 224 unmodified lines
225225 }
226226 #endif
227227
228+#ifndef arch_scale_thermal_pressure
229+static __always_inline
230+unsigned long arch_scale_thermal_pressure(int cpu)
231+{
232+ return 0;
233+}
234+#endif
235+
228236 static inline int task_node(const struct task_struct *p)
229237 {
230238 return cpu_to_node(task_cpu(p));
include/linux/seccomp.h+2−1
@@ -7,7 +7,8 @@ · 6 unmodified lines
77 #define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \
88 SECCOMP_FILTER_FLAG_LOG | \
99 SECCOMP_FILTER_FLAG_SPEC_ALLOW | \
10− SECCOMP_FILTER_FLAG_NEW_LISTENER)
10+ SECCOMP_FILTER_FLAG_NEW_LISTENER | \
11+ SECCOMP_FILTER_FLAG_TSYNC_ESRCH)
1112
1213 #ifdef CONFIG_SECCOMP
1314
include/linux/security.h+0−1
@@ -30,7 +30,6 @@ · 29 unmodified lines
3030 #include <linux/err.h>
3131 #include <linux/string.h>
3232 #include <linux/mm.h>
33−#include <linux/fs.h>
3433
3534 struct linux_binprm;
3635 struct cred;
include/linux/selection.h+3−1
@@ -11,8 +11,8 @@ · 10 unmodified lines
1111 #include <linux/tiocl.h>
1212 #include <linux/vt_buffer.h>
1313
14−extern struct vc_data *sel_cons;
1514 struct tty_struct;
15+struct vc_data;
1616
1717 extern void clear_selection(void);
1818 extern int set_selection_user(const struct tiocl_selection __user *sel,
@@ -24,6 +24,8 @@ extern int sel_loadlut(char __user *p); · 5 unmodified lines
2424 extern int mouse_reporting(void);
2525 extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry);
2626
27+bool vc_is_sel(struct vc_data *vc);
28+
2729 extern int console_blanked;
2830
2931 extern const unsigned char color_table[];
include/linux/seq_file.h+0−1
@@ -21,7 +21,6 @@ struct seq_file { · 20 unmodified lines
2121 size_t pad_until;
2222 loff_t index;
2323 loff_t read_pos;
24− u64 version;
2524 struct mutex lock;
2625 const struct seq_operations *op;
2726 int poll_event;
include/linux/serial_8250.h+4−0
@@ -81,6 +81,7 @@ struct uart_8250_em485 { · 80 unmodified lines
8181 struct hrtimer stop_tx_timer; /* "rs485 stop tx" timer */
8282 struct hrtimer *active_timer; /* pointer to active timer */
8383 struct uart_8250_port *port; /* for hrtimer callbacks */
84+ unsigned int tx_stopped:1; /* tx is currently stopped */
8485 };
8586
8687 /*
@@ -132,6 +133,8 @@ struct uart_8250_port { · 45 unmodified lines
132133 void (*dl_write)(struct uart_8250_port *, int);
133134
134135 struct uart_8250_em485 *em485;
136+ void (*rs485_start_tx)(struct uart_8250_port *);
137+ void (*rs485_stop_tx)(struct uart_8250_port *);
135138
136139 /* Serial port overrun backoff */
137140 struct delayed_work overrun_backoff;
@@ -176,6 +179,7 @@ void serial8250_set_defaults(struct uart_8250_port *up); · 38 unmodified lines
176179 void serial8250_console_write(struct uart_8250_port *up, const char *s,
177180 unsigned int count);
178181 int serial8250_console_setup(struct uart_port *port, char *options, bool probe);
182+int serial8250_console_exit(struct uart_port *port);
179183
180184 extern void serial8250_set_isa_configurator(void (*v)
181185 (int port, struct uart_port *up,
include/linux/serial_core.h+2−2
@@ -243,6 +243,7 @@ struct uart_port { · 242 unmodified lines
243243 unsigned long sysrq; /* sysrq timeout */
244244 unsigned int sysrq_ch; /* char for sysrq */
245245 unsigned char has_sysrq;
246+ unsigned char sysrq_seq; /* index in sysrq_toggle_seq */
246247
247248 unsigned char hub6; /* this should be in the 8250 driver */
248249 unsigned char suspended;
@@ -461,8 +462,7 @@ extern void uart_insert_char(struct uart_port *port, unsigned int status, · 212 unmodified lines
461462
462463 extern int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch);
463464 extern int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch);
464−extern void uart_unlock_and_check_sysrq(struct uart_port *port,
465− unsigned long irqflags);
465+extern void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long flags);
466466 extern int uart_handle_break(struct uart_port *port);
467467
468468 /*
include/linux/shmem_fs.h+1−9
@@ -78,6 +78,7 @@ extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); · 77 unmodified lines
7878 extern int shmem_unuse(unsigned int type, bool frontswap,
7979 unsigned long *fs_pages_to_unuse);
8080
81+extern bool shmem_huge_enabled(struct vm_area_struct *vma);
8182 extern unsigned long shmem_swap_usage(struct vm_area_struct *vma);
8283 extern unsigned long shmem_partial_swap_usage(struct address_space *mapping,
8384 pgoff_t start, pgoff_t end);
@@ -114,15 +115,6 @@ static inline bool shmem_file(struct file *file) · 30 unmodified lines
114115 extern bool shmem_charge(struct inode *inode, long pages);
115116 extern void shmem_uncharge(struct inode *inode, long pages);
116117
117−#ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
118−extern bool shmem_huge_enabled(struct vm_area_struct *vma);
119−#else
120−static inline bool shmem_huge_enabled(struct vm_area_struct *vma)
121−{
122− return false;
123−}
124−#endif
125−
126118 #ifdef CONFIG_SHMEM
127119 extern int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
128120 struct vm_area_struct *dst_vma,
include/linux/signal.h+4−4
@@ -444,12 +444,12 @@ void signals_init(void); · 443 unmodified lines
444444 int restore_altstack(const stack_t __user *);
445445 int __save_altstack(stack_t __user *, unsigned long);
446446
447−#define save_altstack_ex(uss, sp) do { \
447+#define unsafe_save_altstack(uss, sp, label) do { \
448448 stack_t __user *__uss = uss; \
449449 struct task_struct *t = current; \
450− put_user_ex((void __user *)t->sas_ss_sp, &__uss->ss_sp); \
451− put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \
452− put_user_ex(t->sas_ss_size, &__uss->ss_size); \
450+ unsafe_put_user((void __user *)t->sas_ss_sp, &__uss->ss_sp, label); \
451+ unsafe_put_user(t->sas_ss_flags, &__uss->ss_flags, label); \
452+ unsafe_put_user(t->sas_ss_size, &__uss->ss_size, label); \
453453 if (t->sas_ss_flags & SS_AUTODISARM) \
454454 sas_ss_reset(t); \
455455 } while (0);
include/linux/skbuff.h+55−35
@@ -47,8 +47,8 @@ · 46 unmodified lines
4747 * A. IP checksum related features
4848 *
4949 * Drivers advertise checksum offload capabilities in the features of a device.
50− * From the stack's point of view these are capabilities offered by the driver,
51− * a driver typically only advertises features that it is capable of offloading
50+ * From the stack's point of view these are capabilities offered by the driver.
51+ * A driver typically only advertises features that it is capable of offloading
5252 * to its device.
5353 *
5454 * The checksum related features are:
@@ -63,7 +63,7 @@ · 8 unmodified lines
6363 * TCP or UDP packets over IPv4. These are specifically
6464 * unencapsulated packets of the form IPv4|TCP or
6565 * IPv4|UDP where the Protocol field in the IPv4 header
66− * is TCP or UDP. The IPv4 header may contain IP options
66+ * is TCP or UDP. The IPv4 header may contain IP options.
6767 * This feature cannot be set in features for a device
6868 * with NETIF_F_HW_CSUM also set. This feature is being
6969 * DEPRECATED (see below).
@@ -79,13 +79,13 @@ · 9 unmodified lines
7979 * DEPRECATED (see below).
8080 *
8181 * NETIF_F_RXCSUM - Driver (device) performs receive checksum offload.
82− * This flag is used only used to disable the RX checksum
82+ * This flag is only used to disable the RX checksum
8383 * feature for a device. The stack will accept receive
8484 * checksum indication in packets received on a device
8585 * regardless of whether NETIF_F_RXCSUM is set.
8686 *
8787 * B. Checksumming of received packets by device. Indication of checksum
88− * verification is in set skb->ip_summed. Possible values are:
88+ * verification is set in skb->ip_summed. Possible values are:
8989 *
9090 * CHECKSUM_NONE:
9191 *
@@ -115,16 +115,16 @@ · 23 unmodified lines
115115 * the packet minus one that have been verified as CHECKSUM_UNNECESSARY.
116116 * For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet
117117 * and a device is able to verify the checksums for UDP (possibly zero),
118− * GRE (checksum flag is set), and TCP-- skb->csum_level would be set to
118+ * GRE (checksum flag is set) and TCP, skb->csum_level would be set to
119119 * two. If the device were only able to verify the UDP checksum and not
120− * GRE, either because it doesn't support GRE checksum of because GRE
120+ * GRE, either because it doesn't support GRE checksum or because GRE
121121 * checksum is bad, skb->csum_level would be set to zero (TCP checksum is
122122 * not considered in this case).
123123 *
124124 * CHECKSUM_COMPLETE:
125125 *
126126 * This is the most generic way. The device supplied checksum of the _whole_
127− * packet as seen by netif_rx() and fills out in skb->csum. Meaning, the
127+ * packet as seen by netif_rx() and fills in skb->csum. This means the
128128 * hardware doesn't need to parse L3/L4 headers to implement this.
129129 *
130130 * Notes:
@@ -153,8 +153,8 @@ · 22 unmodified lines
153153 * from skb->csum_start up to the end, and to record/write the checksum at
154154 * offset skb->csum_start + skb->csum_offset. A driver may verify that the
155155 * csum_start and csum_offset values are valid values given the length and
156− * offset of the packet, however they should not attempt to validate that the
157− * checksum refers to a legitimate transport layer checksum-- it is the
156+ * offset of the packet, but it should not attempt to validate that the
157+ * checksum refers to a legitimate transport layer checksum -- it is the
158158 * purview of the stack to validate that csum_start and csum_offset are set
159159 * correctly.
160160 *
@@ -178,18 +178,18 @@ · 17 unmodified lines
178178 *
179179 * CHECKSUM_UNNECESSARY:
180180 *
181− * This has the same meaning on as CHECKSUM_NONE for checksum offload on
181+ * This has the same meaning as CHECKSUM_NONE for checksum offload on
182182 * output.
183183 *
184184 * CHECKSUM_COMPLETE:
185185 * Not used in checksum output. If a driver observes a packet with this value
186− * set in skbuff, if should treat as CHECKSUM_NONE being set.
186+ * set in skbuff, it should treat the packet as if CHECKSUM_NONE were set.
187187 *
188188 * D. Non-IP checksum (CRC) offloads
189189 *
190190 * NETIF_F_SCTP_CRC - This feature indicates that a device is capable of
191191 * offloading the SCTP CRC in a packet. To perform this offload the stack
192− * will set set csum_start and csum_offset accordingly, set ip_summed to
192+ * will set csum_start and csum_offset accordingly, set ip_summed to
193193 * CHECKSUM_PARTIAL and set csum_not_inet to 1, to provide an indication in
194194 * the skbuff that the CHECKSUM_PARTIAL refers to CRC32c.
195195 * A driver that supports both IP checksum offload and SCTP CRC32c offload
@@ -200,10 +200,10 @@ · 4 unmodified lines
200200 * NETIF_F_FCOE_CRC - This feature indicates that a device is capable of
201201 * offloading the FCOE CRC in a packet. To perform this offload the stack
202202 * will set ip_summed to CHECKSUM_PARTIAL and set csum_start and csum_offset
203− * accordingly. Note the there is no indication in the skbuff that the
204− * CHECKSUM_PARTIAL refers to an FCOE checksum, a driver that supports
203+ * accordingly. Note that there is no indication in the skbuff that the
204+ * CHECKSUM_PARTIAL refers to an FCOE checksum, so a driver that supports
205205 * both IP checksum offload and FCOE CRC offload must verify which offload
206− * is configured for a packet presumably by inspecting packet headers.
206+ * is configured for a packet, presumably by inspecting packet headers.
207207 *
208208 * E. Checksumming on output with GSO.
209209 *
@@ -211,9 +211,9 @@ · 1 unmodified line
211211 * is implied by the SKB_GSO_* flags in gso_type. Most obviously, if the
212212 * gso_type is SKB_GSO_TCPV4 or SKB_GSO_TCPV6, TCP checksum offload as
213213 * part of the GSO operation is implied. If a checksum is being offloaded
214− * with GSO then ip_summed is CHECKSUM_PARTIAL, csum_start and csum_offset
215− * are set to refer to the outermost checksum being offload (two offloaded
216− * checksums are possible with UDP encapsulation).
214+ * with GSO then ip_summed is CHECKSUM_PARTIAL, and both csum_start and
215+ * csum_offset are set to refer to the outermost checksum being offloaded
216+ * (two offloaded checksums are possible with UDP encapsulation).
217217 */
218218
219219 /* Don't change this without changing skb_csum_unnecessary! */
@@ -645,8 +645,8 @@ typedef unsigned char *sk_buff_data_t; · 425 unmodified lines
645645 * @offload_l3_fwd_mark: Packet was L3-forwarded in hardware
646646 * @tc_skip_classify: do not classify packet. set by IFB device
647647 * @tc_at_ingress: used within tc_classify to distinguish in/egress
648− * @tc_redirected: packet was redirected by a tc action
649− * @tc_from_ingress: if tc_redirected, tc_at_ingress at time of redirect
648+ * @redirected: packet was redirected by packet classifier
649+ * @from_ingress: packet was redirected from the ingress path
650650 * @peeked: this packet has been seen already, so stats have been
651651 * done for it, don't do them again
652652 * @nf_trace: netfilter packet trace flag
@@ -848,8 +848,10 @@ struct sk_buff { · 195 unmodified lines
848848 #ifdef CONFIG_NET_CLS_ACT
849849 __u8 tc_skip_classify:1;
850850 __u8 tc_at_ingress:1;
851− __u8 tc_redirected:1;
852− __u8 tc_from_ingress:1;
851+#endif
852+#ifdef CONFIG_NET_REDIRECT
853+ __u8 redirected:1;
854+ __u8 from_ingress:1;
853855 #endif
854856 #ifdef CONFIG_TLS_DEVICE
855857 __u8 decrypted:1;
@@ -3514,23 +3516,15 @@ int __skb_wait_for_more_packets(struct sock *sk, struct sk_buff_head *queue, · 2658 unmodified lines
35143516 struct sk_buff *__skb_try_recv_from_queue(struct sock *sk,
35153517 struct sk_buff_head *queue,
35163518 unsigned int flags,
3517− void (*destructor)(struct sock *sk,
3518− struct sk_buff *skb),
35193519 int *off, int *err,
35203520 struct sk_buff **last);
35213521 struct sk_buff *__skb_try_recv_datagram(struct sock *sk,
35223522 struct sk_buff_head *queue,
3523− unsigned int flags,
3524− void (*destructor)(struct sock *sk,
3525− struct sk_buff *skb),
3526− int *off, int *err,
3523+ unsigned int flags, int *off, int *err,
35273524 struct sk_buff **last);
35283525 struct sk_buff *__skb_recv_datagram(struct sock *sk,
35293526 struct sk_buff_head *sk_queue,
3530− unsigned int flags,
3531− void (*destructor)(struct sock *sk,
3532− struct sk_buff *skb),
3533− int *off, int *err);
3527+ unsigned int flags, int *off, int *err);
35343528 struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,
35353529 int *err);
35363530 __poll_t datagram_poll(struct file *file, struct socket *sock,
@@ -4395,8 +4389,8 @@ struct skb_gso_cb { · 858 unmodified lines
43954389 __wsum csum;
43964390 __u16 csum_start;
43974391 };
4398−#define SKB_SGO_CB_OFFSET 32
4399−#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_SGO_CB_OFFSET))
4392+#define SKB_GSO_CB_OFFSET 32
4393+#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_GSO_CB_OFFSET))
44004394
44014395 static inline int skb_tnl_header_len(const struct sk_buff *inner_skb)
44024396 {
@@ -4579,5 +4573,31 @@ static inline __wsum lco_csum(struct sk_buff *skb) · 176 unmodified lines
45794573 return csum_partial(l4_hdr, csum_start - l4_hdr, partial);
45804574 }
45814575
4576+static inline bool skb_is_redirected(const struct sk_buff *skb)
4577+{
4578+#ifdef CONFIG_NET_REDIRECT
4579+ return skb->redirected;
4580+#else
4581+ return false;
4582+#endif
4583+}
4584+
4585+static inline void skb_set_redirected(struct sk_buff *skb, bool from_ingress)
4586+{
4587+#ifdef CONFIG_NET_REDIRECT
4588+ skb->redirected = 1;
4589+ skb->from_ingress = from_ingress;
4590+ if (skb->from_ingress)
4591+ skb->tstamp = 0;
4592+#endif
4593+}
4594+
4595+static inline void skb_reset_redirect(struct sk_buff *skb)
4596+{
4597+#ifdef CONFIG_NET_REDIRECT
4598+ skb->redirected = 0;
4599+#endif
4600+}
4601+
45824602 #endif /* __KERNEL__ */
45834603 #endif /* _LINUX_SKBUFF_H */
include/linux/skmsg.h+22−46
@@ -323,14 +323,6 @@ static inline void sk_psock_free_link(struct sk_psock_link *link) · 322 unmodified lines
323323 }
324324
325325 struct sk_psock_link *sk_psock_link_pop(struct sk_psock *psock);
326−#if defined(CONFIG_BPF_STREAM_PARSER)
327−void sk_psock_unlink(struct sock *sk, struct sk_psock_link *link);
328−#else
329−static inline void sk_psock_unlink(struct sock *sk,
330− struct sk_psock_link *link)
331−{
332−}
333−#endif
334326
335327 void __sk_psock_purge_ingress_msg(struct sk_psock *psock);
336328
@@ -347,33 +339,37 @@ static inline void sk_psock_update_proto(struct sock *sk, · 10 unmodified lines
347339 struct sk_psock *psock,
348340 struct proto *ops)
349341 {
350− psock->saved_unhash = sk->sk_prot->unhash;
351− psock->saved_close = sk->sk_prot->close;
352− psock->saved_write_space = sk->sk_write_space;
342+ /* Initialize saved callbacks and original proto only once, since this
343+ * function may be called multiple times for a psock, e.g. when
344+ * psock->progs.msg_parser is updated.
345+ *
346+ * Since we've not installed the new proto, psock is not yet in use and
347+ * we can initialize it without synchronization.
348+ */
349+ if (!psock->sk_proto) {
350+ struct proto *orig = READ_ONCE(sk->sk_prot);
353351
354− psock->sk_proto = sk->sk_prot;
355− sk->sk_prot = ops;
352+ psock->saved_unhash = orig->unhash;
353+ psock->saved_close = orig->close;
354+ psock->saved_write_space = sk->sk_write_space;
355+
356+ psock->sk_proto = orig;
357+ }
358+
359+ /* Pairs with lockless read in sk_clone_lock() */
360+ WRITE_ONCE(sk->sk_prot, ops);
356361 }
357362
358363 static inline void sk_psock_restore_proto(struct sock *sk,
359364 struct sk_psock *psock)
360365 {
361366 sk->sk_prot->unhash = psock->saved_unhash;
362−
363− if (psock->sk_proto) {
364− struct inet_connection_sock *icsk = inet_csk(sk);
365− bool has_ulp = !!icsk->icsk_ulp_data;
366−
367− if (has_ulp) {
368− tcp_update_ulp(sk, psock->sk_proto,
369− psock->saved_write_space);
370− } else {
371− sk->sk_prot = psock->sk_proto;
372− sk->sk_write_space = psock->saved_write_space;
373− }
374− psock->sk_proto = NULL;
367+ if (inet_csk_has_ulp(sk)) {
368+ tcp_update_ulp(sk, psock->sk_proto, psock->saved_write_space);
375369 } else {
376370 sk->sk_write_space = psock->saved_write_space;
371+ /* Pairs with lockless read in sk_clone_lock() */
372+ WRITE_ONCE(sk->sk_prot, psock->sk_proto);
377373 }
378374 }
379375
@@ -395,26 +391,6 @@ static inline bool sk_psock_test_state(const struct sk_psock *psock, · 15 unmodified lines
395391 return test_bit(bit, &psock->state);
396392 }
397393
398−static inline struct sk_psock *sk_psock_get_checked(struct sock *sk)
399−{
400− struct sk_psock *psock;
401−
402− rcu_read_lock();
403− psock = sk_psock(sk);
404− if (psock) {
405− if (sk->sk_prot->recvmsg != tcp_bpf_recvmsg) {
406− psock = ERR_PTR(-EBUSY);
407− goto out;
408− }
409−
410− if (!refcount_inc_not_zero(&psock->refcnt))
411− psock = ERR_PTR(-EBUSY);
412− }
413−out:
414− rcu_read_unlock();
415− return psock;
416−}
417−
418394 static inline struct sk_psock *sk_psock_get(struct sock *sk)
419395 {
420396 struct sk_psock *psock;
include/linux/slab.h+1−1
@@ -501,7 +501,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) · 500 unmodified lines
501501 * :ref:`Documentation/core-api/mm-api.rst <mm-api-gfp-flags>`
502502 *
503503 * The recommended usage of the @flags is described at
504− * :ref:`Documentation/core-api/memory-allocation.rst <memory-allocation>`
504+ * :ref:`Documentation/core-api/memory-allocation.rst <memory_allocation>`
505505 *
506506 * Below is a brief outline of the most useful GFP flags
507507 *
include/linux/soc/qcom/apr.h+1−0
@@ -85,6 +85,7 @@ struct apr_device { · 84 unmodified lines
8585 uint16_t domain_id;
8686 uint32_t version;
8787 char name[APR_NAME_SIZE];
88+ const char *service_path;
8889 spinlock_t lock;
8990 struct list_head node;
9091 };
include/linux/soc/qcom/pdr.h+29−0
@@ -0,0 +1,29 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef __QCOM_PDR_HELPER__
3+#define __QCOM_PDR_HELPER__
4+
5+#include <linux/soc/qcom/qmi.h>
6+
7+#define SERVREG_NAME_LENGTH 64
8+
9+struct pdr_service;
10+struct pdr_handle;
11+
12+enum servreg_service_state {
13+ SERVREG_LOCATOR_ERR = 0x1,
14+ SERVREG_SERVICE_STATE_DOWN = 0x0FFFFFFF,
15+ SERVREG_SERVICE_STATE_UP = 0x1FFFFFFF,
16+ SERVREG_SERVICE_STATE_EARLY_DOWN = 0x2FFFFFFF,
17+ SERVREG_SERVICE_STATE_UNINIT = 0x7FFFFFFF,
18+};
19+
20+struct pdr_handle *pdr_handle_alloc(void (*status)(int state,
21+ char *service_path,
22+ void *priv), void *priv);
23+struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr,
24+ const char *service_name,
25+ const char *service_path);
26+int pdr_restart_pd(struct pdr_handle *pdr, struct pdr_service *pds);
27+void pdr_handle_release(struct pdr_handle *pdr);
28+
29+#endif
include/linux/soc/qcom/qmi.h+1−0
@@ -88,6 +88,7 @@ struct qmi_elem_info { · 87 unmodified lines
8888 #define QMI_ERR_CLIENT_IDS_EXHAUSTED_V01 5
8989 #define QMI_ERR_INVALID_ID_V01 41
9090 #define QMI_ERR_ENCODING_V01 58
91+#define QMI_ERR_DISABLED_V01 69
9192 #define QMI_ERR_INCOMPATIBLE_STATE_V01 90
9293 #define QMI_ERR_NOT_SUPPORTED_V01 94
9394
include/linux/soc/qcom/smd-rpm.h+1−0
@@ -10,6 +10,7 @@ struct qcom_smd_rpm; · 9 unmodified lines
1010 /*
1111 * Constants used for addressing resources in the RPM.
1212 */
13+#define QCOM_SMD_RPM_BBYB 0x62796262
1314 #define QCOM_SMD_RPM_BOBB 0x62626f62
1415 #define QCOM_SMD_RPM_BOOST 0x61747362
1516 #define QCOM_SMD_RPM_BUS_CLK 0x316b6c63
include/linux/socket.h+6−1
@@ -391,6 +391,10 @@ extern int recvmsg_copy_msghdr(struct msghdr *msg, · 390 unmodified lines
391391 struct user_msghdr __user *umsg, unsigned flags,
392392 struct sockaddr __user **uaddr,
393393 struct iovec **iov);
394+extern int __copy_msghdr_from_user(struct msghdr *kmsg,
395+ struct user_msghdr __user *umsg,
396+ struct sockaddr __user **save_addr,
397+ struct iovec __user **uiov, size_t *nsegs);
394398
395399 /* helpers which do the actual work for syscalls */
396400 extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size,
@@ -401,7 +405,8 @@ extern int __sys_sendto(int fd, void __user *buff, size_t len, · 4 unmodified lines
401405 int addr_len);
402406 extern int __sys_accept4_file(struct file *file, unsigned file_flags,
403407 struct sockaddr __user *upeer_sockaddr,
404− int __user *upeer_addrlen, int flags);
408+ int __user *upeer_addrlen, int flags,
409+ unsigned long nofile);
405410 extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
406411 int __user *upeer_addrlen, int flags);
407412 extern int __sys_socket(int family, int type, int protocol);
include/linux/soundwire/sdw.h+49−0
@@ -79,6 +79,21 @@ enum sdw_slave_status { · 78 unmodified lines
7979 SDW_SLAVE_RESERVED = 3,
8080 };
8181
82+/**
83+ * enum sdw_clk_stop_type: clock stop operations
84+ *
85+ * @SDW_CLK_PRE_PREPARE: pre clock stop prepare
86+ * @SDW_CLK_POST_PREPARE: post clock stop prepare
87+ * @SDW_CLK_PRE_DEPREPARE: pre clock stop de-prepare
88+ * @SDW_CLK_POST_DEPREPARE: post clock stop de-prepare
89+ */
90+enum sdw_clk_stop_type {
91+ SDW_CLK_PRE_PREPARE = 0,
92+ SDW_CLK_POST_PREPARE,
93+ SDW_CLK_PRE_DEPREPARE,
94+ SDW_CLK_POST_DEPREPARE,
95+};
96+
8297 /**
8398 * enum sdw_command_response - Command response as defined by SDW spec
8499 * @SDW_CMD_OK: cmd was successful
@@ -284,6 +299,7 @@ struct sdw_dpn_audio_mode { · 199 unmodified lines
284299 * @max_async_buffer: Number of samples that this port can buffer in
285300 * asynchronous modes
286301 * @block_pack_mode: Type of block port mode supported
302+ * @read_only_wordlength: Read Only wordlength field in DPN_BlockCtrl1 register
287303 * @port_encoding: Payload Channel Sample encoding schemes supported
288304 * @audio_modes: Audio modes supported
289305 */
@@ -307,6 +323,7 @@ struct sdw_dpn_prop { · 17 unmodified lines
307323 u32 modes;
308324 u32 max_async_buffer;
309325 bool block_pack_mode;
326+ bool read_only_wordlength;
310327 u32 port_encoding;
311328 struct sdw_dpn_audio_mode *audio_modes;
312329 };
@@ -424,6 +441,29 @@ struct sdw_slave_id { · 111 unmodified lines
424441 __u8 sdw_version:4;
425442 };
426443
444+/*
445+ * Helper macros to extract the MIPI-defined IDs
446+ *
447+ * Spec definition
448+ * Register Bit Contents
449+ * DevId_0 [7:4] 47:44 sdw_version
450+ * DevId_0 [3:0] 43:40 unique_id
451+ * DevId_1 39:32 mfg_id [15:8]
452+ * DevId_2 31:24 mfg_id [7:0]
453+ * DevId_3 23:16 part_id [15:8]
454+ * DevId_4 15:08 part_id [7:0]
455+ * DevId_5 07:00 class_id
456+ *
457+ * The MIPI DisCo for SoundWire defines in addition the link_id as bits 51:48
458+ */
459+
460+#define SDW_DISCO_LINK_ID(adr) (((adr) >> 48) & GENMASK(3, 0))
461+#define SDW_VERSION(adr) (((adr) >> 44) & GENMASK(3, 0))
462+#define SDW_UNIQUE_ID(adr) (((adr) >> 40) & GENMASK(3, 0))
463+#define SDW_MFG_ID(adr) (((adr) >> 24) & GENMASK(15, 0))
464+#define SDW_PART_ID(adr) (((adr) >> 8) & GENMASK(15, 0))
465+#define SDW_CLASS_ID(adr) ((adr) & GENMASK(7, 0))
466+
427467 /**
428468 * struct sdw_slave_intr_status - Slave interrupt status
429469 * @control_port: control port status
@@ -533,6 +573,11 @@ struct sdw_slave_ops { · 103 unmodified lines
533573 int (*port_prep)(struct sdw_slave *slave,
534574 struct sdw_prepare_ch *prepare_ch,
535575 enum sdw_port_prep_ops pre_ops);
576+ int (*get_clk_stop_mode)(struct sdw_slave *slave);
577+ int (*clk_stop)(struct sdw_slave *slave,
578+ enum sdw_clk_stop_mode mode,
579+ enum sdw_clk_stop_type type);
580+
536581 };
537582
538583 /**
@@ -575,6 +620,7 @@ struct sdw_slave { · 36 unmodified lines
575620 #endif
576621 struct list_head node;
577622 struct completion *port_ready;
623+ enum sdw_clk_stop_mode curr_clk_stop_mode;
578624 u16 dev_num;
579625 u16 dev_num_sticky;
580626 bool probed;
@@ -892,6 +938,9 @@ int sdw_prepare_stream(struct sdw_stream_runtime *stream); · 311 unmodified lines
892938 int sdw_enable_stream(struct sdw_stream_runtime *stream);
893939 int sdw_disable_stream(struct sdw_stream_runtime *stream);
894940 int sdw_deprepare_stream(struct sdw_stream_runtime *stream);
941+int sdw_bus_prep_clk_stop(struct sdw_bus *bus);
942+int sdw_bus_clk_stop(struct sdw_bus *bus);
943+int sdw_bus_exit_clk_stop(struct sdw_bus *bus);
895944
896945 /* messaging and data APIs */
897946
include/linux/spi/corgi_lcd.h+0−3
@@ -11,9 +11,6 @@ struct corgi_lcd_platform_data { · 10 unmodified lines
1111 int default_intensity;
1212 int limit_mask;
1313
14− int gpio_backlight_on; /* -1 if n/a */
15− int gpio_backlight_cont; /* -1 if n/a */
16−
1714 void (*notify)(int intensity);
1815 void (*kick_battery)(void);
1916 };
include/linux/spi/ifx_modem.h+0−5
@@ -3,12 +3,7 @@ · 2 unmodified lines
33 #define LINUX_IFX_MODEM_H
44
55 struct ifx_modem_platform_data {
6− unsigned short rst_out; /* modem reset out */
7− unsigned short pwr_on; /* power on */
8− unsigned short rst_pmu; /* reset modem */
96 unsigned short tx_pwr; /* modem power threshold */
10− unsigned short srdy; /* SRDY */
11− unsigned short mrdy; /* MRDY */
127 unsigned char modem_type; /* Modem type */
138 unsigned long max_hz; /* max SPI frequency */
149 unsigned short use_dma:1; /* spi protocol driver supplies
include/linux/spi/spi.h+7−2
@@ -135,6 +135,8 @@ extern int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer); · 134 unmodified lines
135135 * @modalias: Name of the driver to use with this device, or an alias
136136 * for that name. This appears in the sysfs "modalias" attribute
137137 * for driver coldplugging, and in uevents used for hotplugging
138+ * @driver_override: If the name of a driver is written to this attribute, then
139+ * the device will bind to the named driver and only the named driver.
138140 * @cs_gpio: LEGACY: gpio number of the chipselect line (optional, -ENOENT when
139141 * not using a GPIO line) use cs_gpiod in new drivers by opting in on
140142 * the spi_master.
@@ -443,6 +445,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 302 unmodified lines
443445 * @spi_transfer->ptp_sts_word_post were transmitted.
444446 * If the driver does not set this, the SPI core takes the snapshot as
445447 * close to the driver hand-over as possible.
448+ * @irq_flags: Interrupt enable state during PTP system timestamping
446449 *
447450 * Each SPI controller can communicate with one or more @spi_device
448451 * children. These make a small bus, sharing MOSI, MISO and SCK signals
@@ -481,6 +484,9 @@ struct spi_controller { · 32 unmodified lines
481484 /* spi_device.mode flags understood by this controller driver */
482485 u32 mode_bits;
483486
487+ /* spi_device.mode flags override flags for this controller */
488+ u32 buswidth_override_bits;
489+
484490 /* bitmask of supported bits_per_word for transfers */
485491 u32 bits_per_word_mask;
486492 #define SPI_BPW_MASK(bits) BIT((bits) - 1)
@@ -930,8 +936,7 @@ struct spi_transfer { · 443 unmodified lines
930936
931937 struct ptp_system_timestamp *ptp_sts;
932938
933− bool timestamped_pre;
934− bool timestamped_post;
939+ bool timestamped;
935940
936941 struct list_head transfer_list;
937942 };
include/linux/spinlock.h+25−10
@@ -93,12 +93,13 @@ · 92 unmodified lines
9393
9494 #ifdef CONFIG_DEBUG_SPINLOCK
9595 extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
96− struct lock_class_key *key);
97−# define raw_spin_lock_init(lock) \
98−do { \
99− static struct lock_class_key __key; \
100− \
101− __raw_spin_lock_init((lock), #lock, &__key); \
96+ struct lock_class_key *key, short inner);
97+
98+# define raw_spin_lock_init(lock) \
99+do { \
100+ static struct lock_class_key __key; \
101+ \
102+ __raw_spin_lock_init((lock), #lock, &__key, LD_WAIT_SPIN); \
102103 } while (0)
103104
104105 #else
@@ -327,12 +328,26 @@ static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) · 222 unmodified lines
327328 return &lock->rlock;
328329 }
329330
330−#define spin_lock_init(_lock) \
331−do { \
332− spinlock_check(_lock); \
333− raw_spin_lock_init(&(_lock)->rlock); \
331+#ifdef CONFIG_DEBUG_SPINLOCK
332+
333+# define spin_lock_init(lock) \
334+do { \
335+ static struct lock_class_key __key; \
336+ \
337+ __raw_spin_lock_init(spinlock_check(lock), \
338+ #lock, &__key, LD_WAIT_CONFIG); \
339+} while (0)
340+
341+#else
342+
343+# define spin_lock_init(_lock) \
344+do { \
345+ spinlock_check(_lock); \
346+ *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \
334347 } while (0)
335348
349+#endif
350+
336351 static __always_inline void spin_lock(spinlock_t *lock)
337352 {
338353 raw_spin_lock(&lock->rlock);
include/linux/spinlock_types.h+20−4
@@ -33,8 +33,18 @@ typedef struct raw_spinlock { · 32 unmodified lines
3333 #define SPINLOCK_OWNER_INIT ((void *)-1L)
3434
3535 #ifdef CONFIG_DEBUG_LOCK_ALLOC
36−# define SPIN_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }
36+# define RAW_SPIN_DEP_MAP_INIT(lockname) \
37+ .dep_map = { \
38+ .name = #lockname, \
39+ .wait_type_inner = LD_WAIT_SPIN, \
40+ }
41+# define SPIN_DEP_MAP_INIT(lockname) \
42+ .dep_map = { \
43+ .name = #lockname, \
44+ .wait_type_inner = LD_WAIT_CONFIG, \
45+ }
3746 #else
47+# define RAW_SPIN_DEP_MAP_INIT(lockname)
3848 # define SPIN_DEP_MAP_INIT(lockname)
3949 #endif
4050
@@ -51,7 +61,7 @@ typedef struct raw_spinlock { · 10 unmodified lines
5161 { \
5262 .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
5363 SPIN_DEBUG_INIT(lockname) \
54− SPIN_DEP_MAP_INIT(lockname) }
64+ RAW_SPIN_DEP_MAP_INIT(lockname) }
5565
5666 #define __RAW_SPIN_LOCK_UNLOCKED(lockname) \
5767 (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname)
@@ -72,11 +82,17 @@ typedef struct spinlock { · 14 unmodified lines
7282 };
7383 } spinlock_t;
7484
85+#define ___SPIN_LOCK_INITIALIZER(lockname) \
86+ { \
87+ .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
88+ SPIN_DEBUG_INIT(lockname) \
89+ SPIN_DEP_MAP_INIT(lockname) }
90+
7591 #define __SPIN_LOCK_INITIALIZER(lockname) \
76− { { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } }
92+ { { .rlock = ___SPIN_LOCK_INITIALIZER(lockname) } }
7793
7894 #define __SPIN_LOCK_UNLOCKED(lockname) \
79− (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
95+ (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname)
8096
8197 #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
8298
include/linux/splice.h+3−0
@@ -78,6 +78,9 @@ extern ssize_t add_to_pipe(struct pipe_inode_info *, · 77 unmodified lines
7878 struct pipe_buffer *);
7979 extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
8080 splice_direct_actor *);
81+extern long do_splice(struct file *in, loff_t __user *off_in,
82+ struct file *out, loff_t __user *off_out,
83+ size_t len, unsigned int flags);
8184
8285 /*
8386 * for dynamic pipe sizing
include/linux/stackdepot.h+2−0
@@ -19,4 +19,6 @@ depot_stack_handle_t stack_depot_save(unsigned long *entries, · 18 unmodified lines
1919 unsigned int stack_depot_fetch(depot_stack_handle_t handle,
2020 unsigned long **entries);
2121
22+unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries);
23+
2224 #endif
include/linux/stackprotector.h+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 #include <linux/sched.h>
77 #include <linux/random.h>
88
9−#ifdef CONFIG_STACKPROTECTOR
9+#if defined(CONFIG_STACKPROTECTOR) || defined(CONFIG_ARM64_PTR_AUTH)
1010 # include <asm/stackprotector.h>
1111 #else
1212 static inline void boot_init_stack_canary(void)
include/linux/stmmac.h+1−0
@@ -80,6 +80,7 @@ · 79 unmodified lines
8080
8181 struct stmmac_mdio_bus_data {
8282 unsigned int phy_mask;
83+ unsigned int has_xpcs;
8384 int *irqs;
8485 int probed_phy_irq;
8586 bool needs_reset;
include/linux/sunrpc/cache.h+6−3
@@ -179,6 +179,9 @@ sunrpc_cache_update(struct cache_detail *detail, · 178 unmodified lines
179179
180180 extern int
181181 sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h);
182+extern int
183+sunrpc_cache_pipe_upcall_timeout(struct cache_detail *detail,
184+ struct cache_head *h);
182185
183186
184187 extern void cache_clean_deferred(void *owner);
@@ -206,11 +209,11 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd) · 21 unmodified lines
206209
207210 static inline bool cache_is_expired(struct cache_detail *detail, struct cache_head *h)
208211 {
212+ if (h->expiry_time < seconds_since_boot())
213+ return true;
209214 if (!test_bit(CACHE_VALID, &h->flags))
210215 return false;
211−
212− return (h->expiry_time < seconds_since_boot()) ||
213− (detail->flush_time >= h->last_refresh);
216+ return detail->flush_time >= h->last_refresh;
214217 }
215218
216219 extern int cache_check(struct cache_detail *detail,
include/linux/sunrpc/rpc_rdma.h+2−1
@@ -58,7 +58,8 @@ enum { · 57 unmodified lines
5858 enum {
5959 rpcrdma_fixed_maxsz = 4,
6060 rpcrdma_segment_maxsz = 4,
61− rpcrdma_readchunk_maxsz = 2 + rpcrdma_segment_maxsz,
61+ rpcrdma_readseg_maxsz = 1 + rpcrdma_segment_maxsz,
62+ rpcrdma_readchunk_maxsz = 1 + rpcrdma_readseg_maxsz,
6263 };
6364
6465 /*
include/linux/sunrpc/sched.h+1−0
@@ -132,6 +132,7 @@ struct rpc_task_setup { · 131 unmodified lines
132132 #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
133133 #define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
134134 #define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */
135+#define RPC_TASK_CRED_NOREF 0x8000 /* No refcount on the credential */
135136
136137 #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
137138 #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
include/linux/sunrpc/svc.h+4−1
@@ -380,7 +380,7 @@ struct svc_deferred_req { · 379 unmodified lines
380380 struct cache_deferred_req handle;
381381 size_t xprt_hlen;
382382 int argslen;
383− __be32 args[0];
383+ __be32 args[];
384384 };
385385
386386 struct svc_process_info {
@@ -517,6 +517,9 @@ void svc_wake_up(struct svc_serv *); · 130 unmodified lines
517517 void svc_reserve(struct svc_rqst *rqstp, int space);
518518 struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);
519519 char * svc_print_addr(struct svc_rqst *, char *, size_t);
520+int svc_encode_read_payload(struct svc_rqst *rqstp,
521+ unsigned int offset,
522+ unsigned int length);
520523 unsigned int svc_fill_write_vector(struct svc_rqst *rqstp,
521524 struct page **pages,
522525 struct kvec *first, size_t total);
include/linux/sunrpc/svc_rdma.h+17−7
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252
5353 /* Default and maximum inline threshold sizes */
5454 enum {
55+ RPCRDMA_PULLUP_THRESH = RPCRDMA_V1_DEF_INLINE_SIZE >> 1,
5556 RPCRDMA_DEF_INLINE_THRESH = 4096,
5657 RPCRDMA_MAX_INLINE_THRESH = 65536
5758 };
@@ -132,11 +133,16 @@ struct svc_rdma_recv_ctxt { · 74 unmodified lines
132133 struct ib_sge rc_recv_sge;
133134 void *rc_recv_buf;
134135 struct xdr_buf rc_arg;
136+ struct xdr_stream rc_stream;
135137 bool rc_temp;
136138 u32 rc_byte_len;
137139 unsigned int rc_page_count;
138140 unsigned int rc_hdr_count;
139141 u32 rc_inv_rkey;
142+ __be32 *rc_write_list;
143+ __be32 *rc_reply_chunk;
144+ unsigned int rc_read_payload_offset;
145+ unsigned int rc_read_payload_length;
140146 struct page *rc_pages[RPCSVC_MAXPAGES];
141147 };
142148
@@ -144,6 +150,8 @@ struct svc_rdma_send_ctxt { · 1 unmodified line
144150 struct list_head sc_list;
145151 struct ib_send_wr sc_send_wr;
146152 struct ib_cqe sc_cqe;
153+ struct xdr_buf sc_hdrbuf;
154+ struct xdr_stream sc_stream;
147155 void *sc_xprt_buf;
148156 int sc_page_count;
149157 int sc_cur_sge_no;
@@ -170,9 +178,11 @@ extern int svc_rdma_recv_read_chunk(struct svcxprt_rdma *rdma, · 20 unmodified lines
170178 struct svc_rqst *rqstp,
171179 struct svc_rdma_recv_ctxt *head, __be32 *p);
172180 extern int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma,
173− __be32 *wr_ch, struct xdr_buf *xdr);
181+ __be32 *wr_ch, struct xdr_buf *xdr,
182+ unsigned int offset,
183+ unsigned long length);
174184 extern int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
175− __be32 *rp_ch, bool writelist,
185+ const struct svc_rdma_recv_ctxt *rctxt,
176186 struct xdr_buf *xdr);
177187
178188 /* svc_rdma_sendto.c */
@@ -182,13 +192,13 @@ extern struct svc_rdma_send_ctxt * · 3 unmodified lines
182192 extern void svc_rdma_send_ctxt_put(struct svcxprt_rdma *rdma,
183193 struct svc_rdma_send_ctxt *ctxt);
184194 extern int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr);
185−extern void svc_rdma_sync_reply_hdr(struct svcxprt_rdma *rdma,
186− struct svc_rdma_send_ctxt *ctxt,
187− unsigned int len);
188195 extern int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma,
189− struct svc_rdma_send_ctxt *ctxt,
190− struct xdr_buf *xdr, __be32 *wr_lst);
196+ struct svc_rdma_send_ctxt *sctxt,
197+ const struct svc_rdma_recv_ctxt *rctxt,
198+ struct xdr_buf *xdr);
191199 extern int svc_rdma_sendto(struct svc_rqst *);
200+extern int svc_rdma_read_payload(struct svc_rqst *rqstp, unsigned int offset,
201+ unsigned int length);
192202
193203 /* svc_rdma_transport.c */
194204 extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
include/linux/sunrpc/svc_xprt.h+2−0
@@ -21,6 +21,8 @@ struct svc_xprt_ops { · 20 unmodified lines
2121 int (*xpo_has_wspace)(struct svc_xprt *);
2222 int (*xpo_recvfrom)(struct svc_rqst *);
2323 int (*xpo_sendto)(struct svc_rqst *);
24+ int (*xpo_read_payload)(struct svc_rqst *, unsigned int,
25+ unsigned int);
2426 void (*xpo_release_rqst)(struct svc_rqst *);
2527 void (*xpo_detach)(struct svc_xprt *);
2628 void (*xpo_free)(struct svc_xprt *);
include/linux/sunrpc/xdr.h+53−15
@@ -184,24 +184,9 @@ xdr_adjust_iovec(struct kvec *iov, __be32 *p) · 183 unmodified lines
184184 extern void xdr_shift_buf(struct xdr_buf *, size_t);
185185 extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *);
186186 extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int);
187−extern int xdr_buf_read_mic(struct xdr_buf *, struct xdr_netobj *, unsigned int);
188187 extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
189188 extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
190189
191−/*
192− * Helper structure for copying from an sk_buff.
193− */
194−struct xdr_skb_reader {
195− struct sk_buff *skb;
196− unsigned int offset;
197− size_t count;
198− __wsum csum;
199−};
200−
201−typedef size_t (*xdr_skb_read_actor)(struct xdr_skb_reader *desc, void *to, size_t len);
202−
203−extern int csum_partial_copy_to_xdr(struct xdr_buf *, struct sk_buff *);
204−
205190 extern int xdr_encode_word(struct xdr_buf *, unsigned int, u32);
206191 extern int xdr_decode_word(struct xdr_buf *, unsigned int, u32 *);
207192
@@ -300,6 +285,59 @@ xdr_align_size(size_t n) · 92 unmodified lines
300285 return (n + mask) & ~mask;
301286 }
302287
288+/**
289+ * xdr_pad_size - Calculate size of an object's pad
290+ * @n: Size of an object being XDR encoded (in bytes)
291+ *
292+ * This implementation avoids the need for conditional
293+ * branches or modulo division.
294+ *
295+ * Return value:
296+ * Size (in bytes) of the needed XDR pad
297+ */
298+static inline size_t xdr_pad_size(size_t n)
299+{
300+ return xdr_align_size(n) - n;
301+}
302+
303+/**
304+ * xdr_stream_encode_item_present - Encode a "present" list item
305+ * @xdr: pointer to xdr_stream
306+ *
307+ * Return values:
308+ * On success, returns length in bytes of XDR buffer consumed
309+ * %-EMSGSIZE on XDR buffer overflow
310+ */
311+static inline ssize_t xdr_stream_encode_item_present(struct xdr_stream *xdr)
312+{
313+ const size_t len = sizeof(__be32);
314+ __be32 *p = xdr_reserve_space(xdr, len);
315+
316+ if (unlikely(!p))
317+ return -EMSGSIZE;
318+ *p = xdr_one;
319+ return len;
320+}
321+
322+/**
323+ * xdr_stream_encode_item_absent - Encode a "not present" list item
324+ * @xdr: pointer to xdr_stream
325+ *
326+ * Return values:
327+ * On success, returns length in bytes of XDR buffer consumed
328+ * %-EMSGSIZE on XDR buffer overflow
329+ */
330+static inline int xdr_stream_encode_item_absent(struct xdr_stream *xdr)
331+{
332+ const size_t len = sizeof(__be32);
333+ __be32 *p = xdr_reserve_space(xdr, len);
334+
335+ if (unlikely(!p))
336+ return -EMSGSIZE;
337+ *p = xdr_zero;
338+ return len;
339+}
340+
303341 /**
304342 * xdr_stream_encode_u32 - Encode a 32-bit integer
305343 * @xdr: pointer to xdr_stream
include/linux/suspend.h+0−34
@@ -566,38 +566,4 @@ static inline void queue_up_suspend_work(void) {} · 565 unmodified lines
566566
567567 #endif /* !CONFIG_PM_AUTOSLEEP */
568568
569−#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS
570−/*
571− * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture
572− * to save/restore additional information to/from the array of page
573− * frame numbers in the hibernation image. For s390 this is used to
574− * save and restore the storage key for each page that is included
575− * in the hibernation image.
576− */
577−unsigned long page_key_additional_pages(unsigned long pages);
578−int page_key_alloc(unsigned long pages);
579−void page_key_free(void);
580−void page_key_read(unsigned long *pfn);
581−void page_key_memorize(unsigned long *pfn);
582−void page_key_write(void *address);
583−
584−#else /* !CONFIG_ARCH_SAVE_PAGE_KEYS */
585−
586−static inline unsigned long page_key_additional_pages(unsigned long pages)
587−{
588− return 0;
589−}
590−
591−static inline int page_key_alloc(unsigned long pages)
592−{
593− return 0;
594−}
595−
596−static inline void page_key_free(void) {}
597−static inline void page_key_read(unsigned long *pfn) {}
598−static inline void page_key_memorize(unsigned long *pfn) {}
599−static inline void page_key_write(void *address) {}
600−
601−#endif /* !CONFIG_ARCH_SAVE_PAGE_KEYS */
602−
603569 #endif /* _LINUX_SUSPEND_H */
include/linux/swap.h+0−1
@@ -374,7 +374,6 @@ extern int sysctl_min_slab_ratio; · 373 unmodified lines
374374 #define node_reclaim_mode 0
375375 #endif
376376
377−extern int page_evictable(struct page *page);
378377 extern void check_move_unevictable_pages(struct pagevec *pvec);
379378
380379 extern int kswapd_run(int nid);
include/linux/swapops.h+4−1
@@ -68,6 +68,8 @@ static inline swp_entry_t pte_to_swp_entry(pte_t pte) · 67 unmodified lines
6868
6969 if (pte_swp_soft_dirty(pte))
7070 pte = pte_swp_clear_soft_dirty(pte);
71+ if (pte_swp_uffd_wp(pte))
72+ pte = pte_swp_clear_uffd_wp(pte);
7173 arch_entry = __pte_to_swp_entry(pte);
7274 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry));
7375 }
@@ -348,7 +350,8 @@ static inline void num_poisoned_pages_inc(void) · 274 unmodified lines
348350 }
349351 #endif
350352
351−#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION)
353+#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) || \
354+ defined(CONFIG_DEVICE_PRIVATE)
352355 static inline int non_swap_entry(swp_entry_t entry)
353356 {
354357 return swp_type(entry) >= MAX_SWAPFILES;
include/linux/sysfs.h+54−7
@@ -297,9 +297,10 @@ int sysfs_add_link_to_group(struct kobject *kobj, const char *group_name, · 296 unmodified lines
297297 struct kobject *target, const char *link_name);
298298 void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
299299 const char *link_name);
300−int __compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
301− struct kobject *target_kobj,
302− const char *target_name);
300+int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
301+ struct kobject *target_kobj,
302+ const char *target_name,
303+ const char *symlink_name);
303304
304305 void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
305306
@@ -310,6 +311,18 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) · 4 unmodified lines
310311 return kernfs_enable_ns(kn);
311312 }
312313
314+int sysfs_file_change_owner(struct kobject *kobj, const char *name, kuid_t kuid,
315+ kgid_t kgid);
316+int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid);
317+int sysfs_link_change_owner(struct kobject *kobj, struct kobject *targ,
318+ const char *name, kuid_t kuid, kgid_t kgid);
319+int sysfs_groups_change_owner(struct kobject *kobj,
320+ const struct attribute_group **groups,
321+ kuid_t kuid, kgid_t kgid);
322+int sysfs_group_change_owner(struct kobject *kobj,
323+ const struct attribute_group *groups, kuid_t kuid,
324+ kgid_t kgid);
325+
313326 #else /* CONFIG_SYSFS */
314327
315328 static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
@@ -500,10 +513,10 @@ static inline void sysfs_remove_link_from_group(struct kobject *kobj, · 184 unmodified lines
500513 {
501514 }
502515
503−static inline int __compat_only_sysfs_link_entry_to_kobj(
504− struct kobject *kobj,
505− struct kobject *target_kobj,
506− const char *target_name)
516+static inline int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
517+ struct kobject *target_kobj,
518+ const char *target_name,
519+ const char *symlink_name)
507520 {
508521 return 0;
509522 }
@@ -522,6 +535,40 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) · 12 unmodified lines
522535 {
523536 }
524537
538+static inline int sysfs_file_change_owner(struct kobject *kobj,
539+ const char *name, kuid_t kuid,
540+ kgid_t kgid)
541+{
542+ return 0;
543+}
544+
545+static inline int sysfs_link_change_owner(struct kobject *kobj,
546+ struct kobject *targ,
547+ const char *name, kuid_t kuid,
548+ kgid_t kgid)
549+{
550+ return 0;
551+}
552+
553+static inline int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid)
554+{
555+ return 0;
556+}
557+
558+static inline int sysfs_groups_change_owner(struct kobject *kobj,
559+ const struct attribute_group **groups,
560+ kuid_t kuid, kgid_t kgid)
561+{
562+ return 0;
563+}
564+
565+static inline int sysfs_group_change_owner(struct kobject *kobj,
566+ const struct attribute_group *groups,
567+ kuid_t kuid, kgid_t kgid)
568+{
569+ return 0;
570+}
571+
525572 #endif /* CONFIG_SYSFS */
526573
527574 static inline int __must_check sysfs_create_file(struct kobject *kobj,
include/linux/sysrq.h+7−0
@@ -50,6 +50,7 @@ int unregister_sysrq_key(int key, struct sysrq_key_op *op); · 49 unmodified lines
5050 struct sysrq_key_op *__sysrq_get_key_op(int key);
5151
5252 int sysrq_toggle_support(int enable_mask);
53+int sysrq_mask(void);
5354
5455 #else
5556
@@ -71,6 +72,12 @@ static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op) · 15 unmodified lines
7172 return -EINVAL;
7273 }
7374
75+static inline int sysrq_mask(void)
76+{
77+ /* Magic SysRq disabled mask */
78+ return 0;
79+}
80+
7481 #endif
7582
7683 #endif /* _LINUX_SYSRQ_H */
include/linux/tcp.h+24−2
@@ -86,9 +86,19 @@ struct mptcp_options_received { · 85 unmodified lines
8686 u64 data_seq;
8787 u32 subflow_seq;
8888 u16 data_len;
89− u8 mp_capable : 1,
89+ u16 mp_capable : 1,
9090 mp_join : 1,
91− dss : 1;
91+ dss : 1,
92+ add_addr : 1,
93+ rm_addr : 1,
94+ family : 4,
95+ echo : 1,
96+ backup : 1;
97+ u32 token;
98+ u32 nonce;
99+ u64 thmac;
100+ u8 hmac[20];
101+ u8 join_id;
92102 u8 use_map:1,
93103 dsn64:1,
94104 data_fin:1,
@@ -96,6 +106,16 @@ struct mptcp_options_received { · 1 unmodified line
96106 ack64:1,
97107 mpc_map:1,
98108 __unused:2;
109+ u8 addr_id;
110+ u8 rm_id;
111+ union {
112+ struct in_addr addr;
113+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
114+ struct in6_addr addr6;
115+#endif
116+ };
117+ u64 ahmac;
118+ u16 port;
99119 };
100120 #endif
101121
@@ -131,6 +151,8 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt) · 29 unmodified lines
131151 #if IS_ENABLED(CONFIG_MPTCP)
132152 rx_opt->mptcp.mp_capable = 0;
133153 rx_opt->mptcp.mp_join = 0;
154+ rx_opt->mptcp.add_addr = 0;
155+ rx_opt->mptcp.rm_addr = 0;
134156 rx_opt->mptcp.dss = 0;
135157 #endif
136158 }
include/linux/tee_drv.h+1−18
@@ -49,7 +49,6 @@ struct tee_shm_pool; · 48 unmodified lines
4949 */
5050 struct tee_context {
5151 struct tee_device *teedev;
52− struct list_head list_shm;
5352 void *data;
5453 struct kref refcount;
5554 bool releasing;
@@ -168,9 +167,7 @@ void tee_device_unregister(struct tee_device *teedev); · 112 unmodified lines
168167
169168 /**
170169 * struct tee_shm - shared memory object
171− * @teedev: device used to allocate the object
172− * @ctx: context using the object, if NULL the context is gone
173− * @link link element
170+ * @ctx: context using the object
174171 * @paddr: physical address of the shared memory
175172 * @kaddr: virtual address of the shared memory
176173 * @size: size of shared memory
@@ -185,9 +182,7 @@ void tee_device_unregister(struct tee_device *teedev); · 8 unmodified lines
185182 * subsystem and from drivers that implements their own shm pool manager.
186183 */
187184 struct tee_shm {
188− struct tee_device *teedev;
189185 struct tee_context *ctx;
190− struct list_head link;
191186 phys_addr_t paddr;
192187 void *kaddr;
193188 size_t size;
@@ -318,18 +313,6 @@ void *tee_get_drvdata(struct tee_device *teedev); · 124 unmodified lines
318313 */
319314 struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags);
320315
321−/**
322− * tee_shm_priv_alloc() - Allocate shared memory privately
323− * @dev: Device that allocates the shared memory
324− * @size: Requested size of shared memory
325− *
326− * Allocates shared memory buffer that is not associated with any client
327− * context. Such buffers are owned by TEE driver and used for internal calls.
328− *
329− * @returns a pointer to 'struct tee_shm'
330− */
331−struct tee_shm *tee_shm_priv_alloc(struct tee_device *teedev, size_t size);
332−
333316 /**
334317 * tee_shm_register() - Register shared memory buffer
335318 * @ctx: Context that registers the shared memory
include/linux/thermal.h+10−0
@@ -364,6 +364,9 @@ struct thermal_trip { · 363 unmodified lines
364364
365365 /* Function declarations */
366366 #ifdef CONFIG_THERMAL_OF
367+int thermal_zone_of_get_sensor_id(struct device_node *tz_np,
368+ struct device_node *sensor_np,
369+ u32 *id);
367370 struct thermal_zone_device *
368371 thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
369372 const struct thermal_zone_of_device_ops *ops);
@@ -375,6 +378,13 @@ struct thermal_zone_device *devm_thermal_zone_of_sensor_register( · 5 unmodified lines
375378 void devm_thermal_zone_of_sensor_unregister(struct device *dev,
376379 struct thermal_zone_device *tz);
377380 #else
381+
382+static inline int thermal_zone_of_get_sensor_id(struct device_node *tz_np,
383+ struct device_node *sensor_np,
384+ u32 *id)
385+{
386+ return -ENOENT;
387+}
378388 static inline struct thermal_zone_device *
379389 thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
380390 const struct thermal_zone_of_device_ops *ops)
include/linux/threads.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929
3030 /*
3131 * A maximum of 4 million PIDs should be enough for a while.
32− * [NOTE: PID/TIDs are limited to 2^29 ~= 500+ million, see futex.h.]
32+ * [NOTE: PID/TIDs are limited to 2^30 ~= 1 billion, see FUTEX_TID_MASK.]
3333 */
3434 #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
3535 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
include/linux/time.h+1−4
@@ -111,9 +111,6 @@ static inline bool itimerspec64_valid(const struct itimerspec64 *its) · 110 unmodified lines
111111 */
112112 #define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l))
113113
114−struct timens_offset {
115− s64 sec;
116− u64 nsec;
117−};
114+# include <vdso/time.h>
118115
119116 #endif
include/linux/time32.h+1−11
@@ -12,17 +12,7 @@ · 11 unmodified lines
1212 #include <linux/time64.h>
1313 #include <linux/timex.h>
1414
15−typedef s32 old_time32_t;
16−
17−struct old_timespec32 {
18− old_time32_t tv_sec;
19− s32 tv_nsec;
20−};
21−
22−struct old_timeval32 {
23− old_time32_t tv_sec;
24− s32 tv_usec;
25−};
15+#include <vdso/time32.h>
2616
2717 struct old_itimerspec32 {
2818 struct old_timespec32 it_interval;
include/linux/time64.h+1−9
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #define _LINUX_TIME64_H
44
55 #include <linux/math64.h>
6+#include <vdso/time64.h>
67
78 typedef __s64 time64_t;
89 typedef __u64 timeu64_t;
@@ -19,15 +20,6 @@ struct itimerspec64 { · 10 unmodified lines
1920 struct timespec64 it_value;
2021 };
2122
22−/* Parameters used to convert the timespec values: */
23−#define MSEC_PER_SEC 1000L
24−#define USEC_PER_MSEC 1000L
25−#define NSEC_PER_USEC 1000L
26−#define NSEC_PER_MSEC 1000000L
27−#define USEC_PER_SEC 1000000L
28−#define NSEC_PER_SEC 1000000000L
29−#define FSEC_PER_SEC 1000000000000000LL
30−
3123 /* Located here for timespec[64]_valid_strict */
3224 #define TIME64_MAX ((s64)~((u64)1 << 63))
3325 #define TIME64_MIN (-TIME64_MAX - 1)
include/linux/timer.h+1−1
@@ -164,7 +164,7 @@ static inline void destroy_timer_on_stack(struct timer_list *timer) { } · 163 unmodified lines
164164 */
165165 static inline int timer_pending(const struct timer_list * timer)
166166 {
167− return timer->entry.pprev != NULL;
167+ return !hlist_unhashed_lockless(&timer->entry);
168168 }
169169
170170 extern void add_timer_on(struct timer_list *timer, int cpu);
include/linux/tnum.h+12−0
@@ -86,4 +86,16 @@ int tnum_strn(char *str, size_t size, struct tnum a); · 85 unmodified lines
8686 /* Format a tnum as tristate binary expansion */
8787 int tnum_sbin(char *str, size_t size, struct tnum a);
8888
89+/* Returns the 32-bit subreg */
90+struct tnum tnum_subreg(struct tnum a);
91+/* Returns the tnum with the lower 32-bit subreg cleared */
92+struct tnum tnum_clear_subreg(struct tnum a);
93+/* Returns the tnum with the lower 32-bit subreg set to value */
94+struct tnum tnum_const_subreg(struct tnum a, u32 value);
95+/* Returns true if 32-bit subreg @a is a known constant*/
96+static inline bool tnum_subreg_is_const(struct tnum a)
97+{
98+ return !(tnum_subreg(a)).mask;
99+}
100+
89101 #endif /* _LINUX_TNUM_H */
include/linux/topology.h+0−17
@@ -130,20 +130,11 @@ static inline int numa_node_id(void) · 129 unmodified lines
130130 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
131131 */
132132 DECLARE_PER_CPU(int, _numa_mem_);
133−extern int _node_numa_mem_[MAX_NUMNODES];
134133
135134 #ifndef set_numa_mem
136135 static inline void set_numa_mem(int node)
137136 {
138137 this_cpu_write(_numa_mem_, node);
139− _node_numa_mem_[numa_node_id()] = node;
140−}
141−#endif
142−
143−#ifndef node_to_mem_node
144−static inline int node_to_mem_node(int node)
145−{
146− return _node_numa_mem_[node];
147138 }
148139 #endif
149140
@@ -166,7 +157,6 @@ static inline int cpu_to_mem(int cpu) · 16 unmodified lines
166157 static inline void set_cpu_numa_mem(int cpu, int node)
167158 {
168159 per_cpu(_numa_mem_, cpu) = node;
169− _node_numa_mem_[cpu_to_node(cpu)] = node;
170160 }
171161 #endif
172162
@@ -180,13 +170,6 @@ static inline int numa_mem_id(void) · 7 unmodified lines
180170 }
181171 #endif
182172
183−#ifndef node_to_mem_node
184−static inline int node_to_mem_node(int node)
185−{
186− return node;
187−}
188−#endif
189−
190173 #ifndef cpu_to_mem
191174 static inline int cpu_to_mem(int cpu)
192175 {
include/linux/trace_events.h+2−0
@@ -85,6 +85,8 @@ struct trace_iterator { · 84 unmodified lines
8585 struct mutex mutex;
8686 struct ring_buffer_iter **buffer_iter;
8787 unsigned long iter_flags;
88+ void *temp; /* temp holder */
89+ unsigned int temp_size;
8890
8991 /* trace_seq for __print_flags() and __print_symbolic() etc. */
9092 struct trace_seq tmp_seq;
include/linux/uacce.h+163−0
@@ -0,0 +1,163 @@
1+/* SPDX-License-Identifier: GPL-2.0-or-later */
2+#ifndef _LINUX_UACCE_H
3+#define _LINUX_UACCE_H
4+
5+#include <linux/cdev.h>
6+#include <uapi/misc/uacce/uacce.h>
7+
8+#define UACCE_NAME "uacce"
9+#define UACCE_MAX_REGION 2
10+#define UACCE_MAX_NAME_SIZE 64
11+
12+struct uacce_queue;
13+struct uacce_device;
14+
15+/**
16+ * struct uacce_qfile_region - structure of queue file region
17+ * @type: type of the region
18+ */
19+struct uacce_qfile_region {
20+ enum uacce_qfrt type;
21+};
22+
23+/**
24+ * struct uacce_ops - uacce device operations
25+ * @get_available_instances: get available instances left of the device
26+ * @get_queue: get a queue from the device
27+ * @put_queue: free a queue to the device
28+ * @start_queue: make the queue start work after get_queue
29+ * @stop_queue: make the queue stop work before put_queue
30+ * @is_q_updated: check whether the task is finished
31+ * @mmap: mmap addresses of queue to user space
32+ * @ioctl: ioctl for user space users of the queue
33+ */
34+struct uacce_ops {
35+ int (*get_available_instances)(struct uacce_device *uacce);
36+ int (*get_queue)(struct uacce_device *uacce, unsigned long arg,
37+ struct uacce_queue *q);
38+ void (*put_queue)(struct uacce_queue *q);
39+ int (*start_queue)(struct uacce_queue *q);
40+ void (*stop_queue)(struct uacce_queue *q);
41+ int (*is_q_updated)(struct uacce_queue *q);
42+ int (*mmap)(struct uacce_queue *q, struct vm_area_struct *vma,
43+ struct uacce_qfile_region *qfr);
44+ long (*ioctl)(struct uacce_queue *q, unsigned int cmd,
45+ unsigned long arg);
46+};
47+
48+/**
49+ * struct uacce_interface - interface required for uacce_register()
50+ * @name: the uacce device name. Will show up in sysfs
51+ * @flags: uacce device attributes
52+ * @ops: pointer to the struct uacce_ops
53+ */
54+struct uacce_interface {
55+ char name[UACCE_MAX_NAME_SIZE];
56+ unsigned int flags;
57+ const struct uacce_ops *ops;
58+};
59+
60+enum uacce_q_state {
61+ UACCE_Q_ZOMBIE = 0,
62+ UACCE_Q_INIT,
63+ UACCE_Q_STARTED,
64+};
65+
66+/**
67+ * struct uacce_queue
68+ * @uacce: pointer to uacce
69+ * @priv: private pointer
70+ * @wait: wait queue head
71+ * @list: index into uacce_mm
72+ * @uacce_mm: the corresponding mm
73+ * @qfrs: pointer of qfr regions
74+ * @state: queue state machine
75+ */
76+struct uacce_queue {
77+ struct uacce_device *uacce;
78+ void *priv;
79+ wait_queue_head_t wait;
80+ struct list_head list;
81+ struct uacce_mm *uacce_mm;
82+ struct uacce_qfile_region *qfrs[UACCE_MAX_REGION];
83+ enum uacce_q_state state;
84+};
85+
86+/**
87+ * struct uacce_device
88+ * @algs: supported algorithms
89+ * @api_ver: api version
90+ * @ops: pointer to the struct uacce_ops
91+ * @qf_pg_num: page numbers of the queue file regions
92+ * @parent: pointer to the parent device
93+ * @is_vf: whether virtual function
94+ * @flags: uacce attributes
95+ * @dev_id: id of the uacce device
96+ * @cdev: cdev of the uacce
97+ * @dev: dev of the uacce
98+ * @priv: private pointer of the uacce
99+ * @mm_list: list head of uacce_mm->list
100+ * @mm_lock: lock for mm_list
101+ * @inode: core vfs
102+ */
103+struct uacce_device {
104+ const char *algs;
105+ const char *api_ver;
106+ const struct uacce_ops *ops;
107+ unsigned long qf_pg_num[UACCE_MAX_REGION];
108+ struct device *parent;
109+ bool is_vf;
110+ u32 flags;
111+ u32 dev_id;
112+ struct cdev *cdev;
113+ struct device dev;
114+ void *priv;
115+ struct list_head mm_list;
116+ struct mutex mm_lock;
117+ struct inode *inode;
118+};
119+
120+/**
121+ * struct uacce_mm - keep track of queues bound to a process
122+ * @list: index into uacce_device
123+ * @queues: list of queues
124+ * @mm: the mm struct
125+ * @lock: protects the list of queues
126+ * @pasid: pasid of the uacce_mm
127+ * @handle: iommu_sva handle return from iommu_sva_bind_device
128+ */
129+struct uacce_mm {
130+ struct list_head list;
131+ struct list_head queues;
132+ struct mm_struct *mm;
133+ struct mutex lock;
134+ int pasid;
135+ struct iommu_sva *handle;
136+};
137+
138+#if IS_ENABLED(CONFIG_UACCE)
139+
140+struct uacce_device *uacce_alloc(struct device *parent,
141+ struct uacce_interface *interface);
142+int uacce_register(struct uacce_device *uacce);
143+void uacce_remove(struct uacce_device *uacce);
144+
145+#else /* CONFIG_UACCE */
146+
147+static inline
148+struct uacce_device *uacce_alloc(struct device *parent,
149+ struct uacce_interface *interface)
150+{
151+ return ERR_PTR(-ENODEV);
152+}
153+
154+static inline int uacce_register(struct uacce_device *uacce)
155+{
156+ return -EINVAL;
157+}
158+
159+static inline void uacce_remove(struct uacce_device *uacce) {}
160+
161+#endif /* CONFIG_UACCE */
162+
163+#endif /* _LINUX_UACCE_H */
include/linux/uio_driver.h+21−12
@@ -24,10 +24,10 @@ struct uio_map; · 23 unmodified lines
2424 * struct uio_mem - description of a UIO memory region
2525 * @name: name of the memory region for identification
2626 * @addr: address of the device's memory rounded to page
27− * size (phys_addr is used since addr can be
28− * logical, virtual, or physical & phys_addr_t
29− * should always be large enough to handle any of
30− * the address types)
27+ * size (phys_addr is used since addr can be
28+ * logical, virtual, or physical & phys_addr_t
29+ * should always be large enough to handle any of
30+ * the address types)
3131 * @offs: offset of device memory within the page
3232 * @size: size of IO (multiple of page size)
3333 * @memtype: type of memory addr points to
@@ -67,16 +67,16 @@ struct uio_port { · 33 unmodified lines
6767 #define MAX_UIO_PORT_REGIONS 5
6868
6969 struct uio_device {
70− struct module *owner;
70+ struct module *owner;
7171 struct device dev;
72− int minor;
73− atomic_t event;
74− struct fasync_struct *async_queue;
75− wait_queue_head_t wait;
76− struct uio_info *info;
72+ int minor;
73+ atomic_t event;
74+ struct fasync_struct *async_queue;
75+ wait_queue_head_t wait;
76+ struct uio_info *info;
7777 struct mutex info_lock;
78− struct kobject *map_dir;
79− struct kobject *portio_dir;
78+ struct kobject *map_dir;
79+ struct kobject *portio_dir;
8080 };
8181
8282 /**
@@ -123,6 +123,15 @@ extern int __must_check · 40 unmodified lines
123123 extern void uio_unregister_device(struct uio_info *info);
124124 extern void uio_event_notify(struct uio_info *info);
125125
126+extern int __must_check
127+ __devm_uio_register_device(struct module *owner,
128+ struct device *parent,
129+ struct uio_info *info);
130+
131+/* use a define to avoid include chaining to get THIS_MODULE */
132+#define devm_uio_register_device(parent, info) \
133+ __devm_uio_register_device(THIS_MODULE, parent, info)
134+
126135 /* defines for uio_info->irq */
127136 #define UIO_IRQ_CUSTOM -1
128137 #define UIO_IRQ_NONE 0
include/linux/unaligned/be_byteshift.h+3−3
@@ -40,17 +40,17 @@ static inline void __put_unaligned_be64(u64 val, u8 *p) · 39 unmodified lines
4040
4141 static inline u16 get_unaligned_be16(const void *p)
4242 {
43− return __get_unaligned_be16((const u8 *)p);
43+ return __get_unaligned_be16(p);
4444 }
4545
4646 static inline u32 get_unaligned_be32(const void *p)
4747 {
48− return __get_unaligned_be32((const u8 *)p);
48+ return __get_unaligned_be32(p);
4949 }
5050
5151 static inline u64 get_unaligned_be64(const void *p)
5252 {
53− return __get_unaligned_be64((const u8 *)p);
53+ return __get_unaligned_be64(p);
5454 }
5555
5656 static inline void put_unaligned_be16(u16 val, void *p)
include/linux/unaligned/generic.h+46−0
@@ -2,6 +2,8 @@ · 1 unmodified line
22 #ifndef _LINUX_UNALIGNED_GENERIC_H
33 #define _LINUX_UNALIGNED_GENERIC_H
44
5+#include <linux/types.h>
6+
57 /*
68 * Cause a link-time error if we try an unaligned access other than
79 * 1,2,4 or 8 bytes long
@@ -66,4 +68,48 @@ extern void __bad_unaligned_access_size(void); · 58 unmodified lines
6668 } \
6769 (void)0; })
6870
71+static inline u32 __get_unaligned_be24(const u8 *p)
72+{
73+ return p[0] << 16 | p[1] << 8 | p[2];
74+}
75+
76+static inline u32 get_unaligned_be24(const void *p)
77+{
78+ return __get_unaligned_be24(p);
79+}
80+
81+static inline u32 __get_unaligned_le24(const u8 *p)
82+{
83+ return p[0] | p[1] << 8 | p[2] << 16;
84+}
85+
86+static inline u32 get_unaligned_le24(const void *p)
87+{
88+ return __get_unaligned_le24(p);
89+}
90+
91+static inline void __put_unaligned_be24(const u32 val, u8 *p)
92+{
93+ *p++ = val >> 16;
94+ *p++ = val >> 8;
95+ *p++ = val;
96+}
97+
98+static inline void put_unaligned_be24(const u32 val, void *p)
99+{
100+ __put_unaligned_be24(val, p);
101+}
102+
103+static inline void __put_unaligned_le24(const u32 val, u8 *p)
104+{
105+ *p++ = val;
106+ *p++ = val >> 8;
107+ *p++ = val >> 16;
108+}
109+
110+static inline void put_unaligned_le24(const u32 val, void *p)
111+{
112+ __put_unaligned_le24(val, p);
113+}
114+
69115 #endif /* _LINUX_UNALIGNED_GENERIC_H */
include/linux/unaligned/le_byteshift.h+3−3
@@ -40,17 +40,17 @@ static inline void __put_unaligned_le64(u64 val, u8 *p) · 39 unmodified lines
4040
4141 static inline u16 get_unaligned_le16(const void *p)
4242 {
43− return __get_unaligned_le16((const u8 *)p);
43+ return __get_unaligned_le16(p);
4444 }
4545
4646 static inline u32 get_unaligned_le32(const void *p)
4747 {
48− return __get_unaligned_le32((const u8 *)p);
48+ return __get_unaligned_le32(p);
4949 }
5050
5151 static inline u64 get_unaligned_le64(const void *p)
5252 {
53− return __get_unaligned_le64((const u8 *)p);
53+ return __get_unaligned_le64(p);
5454 }
5555
5656 static inline void put_unaligned_le16(u16 val, void *p)
include/linux/usb.h+9−2
@@ -325,7 +325,7 @@ struct usb_interface_cache { · 324 unmodified lines
325325
326326 /* variable-length array of alternate settings for this interface,
327327 * stored in no particular order */
328− struct usb_host_interface altsetting[0];
328+ struct usb_host_interface altsetting[];
329329 };
330330 #define ref_to_usb_interface_cache(r) \
331331 container_of(r, struct usb_interface_cache, ref)
@@ -708,6 +708,7 @@ struct usb_device { · 376 unmodified lines
708708 unsigned lpm_disable_count;
709709
710710 u16 hub_delay;
711+ unsigned use_generic_driver:1;
711712 };
712713 #define to_usb_device(d) container_of(d, struct usb_device, dev)
713714
@@ -1228,12 +1229,16 @@ struct usb_driver { · 514 unmodified lines
12281229 * @drvwrap: Driver-model core structure wrapper.
12291230 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
12301231 * for devices bound to this driver.
1232+ * @generic_subclass: if set to 1, the generic USB driver's probe, disconnect,
1233+ * resume and suspend functions will be called in addition to the driver's
1234+ * own, so this part of the setup does not need to be replicated.
12311235 *
12321236 * USB drivers must provide all the fields listed above except drvwrap.
12331237 */
12341238 struct usb_device_driver {
12351239 const char *name;
12361240
1241+ bool (*match) (struct usb_device *udev);
12371242 int (*probe) (struct usb_device *udev);
12381243 void (*disconnect) (struct usb_device *udev);
12391244
@@ -1241,7 +1246,9 @@ struct usb_device_driver { · 1 unmodified line
12411246 int (*resume) (struct usb_device *udev, pm_message_t message);
12421247 const struct attribute_group **dev_groups;
12431248 struct usbdrv_wrap drvwrap;
1249+ const struct usb_device_id *id_table;
12441250 unsigned int supports_autosuspend:1;
1251+ unsigned int generic_subclass:1;
12451252 };
12461253 #define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \
12471254 drvwrap.driver)
@@ -1582,7 +1589,7 @@ struct urb { · 334 unmodified lines
15821589 int error_count; /* (return) number of ISO errors */
15831590 void *context; /* (in) context for completion */
15841591 usb_complete_t complete; /* (in) completion routine */
1585− struct usb_iso_packet_descriptor iso_frame_desc[0];
1592+ struct usb_iso_packet_descriptor iso_frame_desc[];
15861593 /* (in) ISO ONLY */
15871594 };
15881595
include/linux/usb/audio-v2.h+13−1
@@ -153,7 +153,19 @@ struct uac2_feature_unit_descriptor { · 152 unmodified lines
153153 __u8 bSourceID;
154154 /* bmaControls is actually u32,
155155 * but u8 is needed for the hybrid parser */
156− __u8 bmaControls[0]; /* variable length */
156+ __u8 bmaControls[]; /* variable length */
157+} __attribute__((packed));
158+
159+/* 4.7.2.10 Effect Unit Descriptor */
160+
161+struct uac2_effect_unit_descriptor {
162+ __u8 bLength;
163+ __u8 bDescriptorType;
164+ __u8 bDescriptorSubtype;
165+ __u8 bUnitID;
166+ __le16 wEffectType;
167+ __u8 bSourceID;
168+ __u8 bmaControls[]; /* variable length */
157169 } __attribute__((packed));
158170
159171 /* 4.9.2 Class-Specific AS Interface Descriptor */
include/linux/usb/audio-v3.h+1−1
@@ -109,7 +109,7 @@ struct uac3_feature_unit_descriptor { · 108 unmodified lines
109109 __u8 bSourceID;
110110 /* bmaControls is actually u32,
111111 * but u8 is needed for the hybrid parser */
112− __u8 bmaControls[0]; /* variable length */
112+ __u8 bmaControls[]; /* variable length */
113113 /* wFeatureDescrStr omitted */
114114 } __attribute__((packed));
115115
include/linux/usb/cdc_ncm.h+12−3
@@ -46,9 +46,12 @@ · 45 unmodified lines
4646 #define CDC_NCM_DATA_ALTSETTING_NCM 1
4747 #define CDC_NCM_DATA_ALTSETTING_MBIM 2
4848
49−/* CDC NCM subclass 3.2.1 */
49+/* CDC NCM subclass 3.3.1 */
5050 #define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
5151
52+/* CDC NCM subclass 3.3.2 */
53+#define USB_CDC_NCM_NDP32_LENGTH_MIN 0x20
54+
5255 /* Maximum NTB length */
5356 #define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */
5457 #define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */
@@ -84,7 +87,7 @@ · 29 unmodified lines
8487 /* Driver flags */
8588 #define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */
8689 #define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */
87−#define CDC_NCM_FLAG_RESET_NTB16 0x08 /* set NDP16 one more time after altsetting switch */
90+#define CDC_NCM_FLAG_PREFER_NTB32 0x08 /* prefer NDP32 over NDP16 */
8891
8992 #define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
9093 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
@@ -113,7 +116,11 @@ struct cdc_ncm_ctx { · 22 unmodified lines
113116
114117 u32 timer_interval;
115118 u32 max_ndp_size;
116− struct usb_cdc_ncm_ndp16 *delayed_ndp16;
119+ u8 is_ndp16;
120+ union {
121+ struct usb_cdc_ncm_ndp16 *delayed_ndp16;
122+ struct usb_cdc_ncm_ndp32 *delayed_ndp32;
123+ };
117124
118125 u32 tx_timer_pending;
119126 u32 tx_curr_frame_num;
@@ -150,6 +157,8 @@ void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); · 30 unmodified lines
150157 struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign);
151158 int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
152159 int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset);
160+int cdc_ncm_rx_verify_nth32(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
161+int cdc_ncm_rx_verify_ndp32(struct sk_buff *skb_in, int ndpoffset);
153162 struct sk_buff *
154163 cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
155164 int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in);
include/linux/usb/ehci_def.h+1−1
@@ -151,7 +151,7 @@ struct ehci_regs { · 150 unmodified lines
151151 #define PORT_OWNER (1<<13) /* true: companion hc owns this port */
152152 #define PORT_POWER (1<<12) /* true: has power (see PPC) */
153153 #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
154−/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
154+#define PORT_LS_MASK (3<<10) /* Link status (SE0, K or J */
155155 /* 9 reserved */
156156 #define PORT_LPM (1<<9) /* LPM transaction */
157157 #define PORT_RESET (1<<8) /* reset port */
include/linux/usb/gadget.h+1−1
@@ -767,7 +767,7 @@ struct usb_gadget_strings { · 766 unmodified lines
767767
768768 struct usb_gadget_string_container {
769769 struct list_head list;
770− u8 *stash[0];
770+ u8 *stash[];
771771 };
772772
773773 /* put descriptor for string with that id into buf (buflen >= 256) */
include/linux/usb/hcd.h+1−1
@@ -228,7 +228,7 @@ struct usb_hcd { · 227 unmodified lines
228228 /* The HC driver's private data is stored at the end of
229229 * this structure.
230230 */
231− unsigned long hcd_priv[0]
231+ unsigned long hcd_priv[]
232232 __attribute__ ((aligned(sizeof(s64))));
233233 };
234234
include/linux/usb/role.h+21−2
@@ -13,8 +13,9 @@ enum usb_role { · 12 unmodified lines
1313 USB_ROLE_DEVICE,
1414 };
1515
16−typedef int (*usb_role_switch_set_t)(struct device *dev, enum usb_role role);
17−typedef enum usb_role (*usb_role_switch_get_t)(struct device *dev);
16+typedef int (*usb_role_switch_set_t)(struct usb_role_switch *sw,
17+ enum usb_role role);
18+typedef enum usb_role (*usb_role_switch_get_t)(struct usb_role_switch *sw);
1819
1920 /**
2021 * struct usb_role_switch_desc - USB Role Switch Descriptor
@@ -25,6 +26,8 @@ typedef enum usb_role (*usb_role_switch_get_t)(struct device *dev); · 4 unmodified lines
2526 * @set: Callback for setting the role
2627 * @get: Callback for getting the role (optional)
2728 * @allow_userspace_control: If true userspace may change the role through sysfs
29+ * @driver_data: Private data pointer
30+ * @name: Name for the switch (optional)
2831 *
2932 * @usb2_port and @usb3_port will point to the USB host port and @udc to the USB
3033 * device controller behind the USB connector with the role switch. If
@@ -40,6 +43,8 @@ struct usb_role_switch_desc { · 9 unmodified lines
4043 usb_role_switch_set_t set;
4144 usb_role_switch_get_t get;
4245 bool allow_userspace_control;
46+ void *driver_data;
47+ const char *name;
4348 };
4449
4550
@@ -57,6 +62,9 @@ struct usb_role_switch * · 11 unmodified lines
5762 usb_role_switch_register(struct device *parent,
5863 const struct usb_role_switch_desc *desc);
5964 void usb_role_switch_unregister(struct usb_role_switch *sw);
65+
66+void usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data);
67+void *usb_role_switch_get_drvdata(struct usb_role_switch *sw);
6068 #else
6169 static inline int usb_role_switch_set_role(struct usb_role_switch *sw,
6270 enum usb_role role)
@@ -90,6 +98,17 @@ usb_role_switch_register(struct device *parent, · 27 unmodified lines
9098 }
9199
92100 static inline void usb_role_switch_unregister(struct usb_role_switch *sw) { }
101+
102+static inline void
103+usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data)
104+{
105+}
106+
107+static inline void *usb_role_switch_get_drvdata(struct usb_role_switch *sw)
108+{
109+ return NULL;
110+}
111+
93112 #endif
94113
95114 #endif /* __LINUX_USB_ROLE_H */
include/linux/usb/typec.h+1−2
@@ -198,8 +198,6 @@ struct typec_operations { · 197 unmodified lines
198198 * @pd_revision: USB Power Delivery Specification revision if supported
199199 * @prefer_role: Initial role preference (DRP ports).
200200 * @accessory: Supported Accessory Modes
201− * @sw: Cable plug orientation switch
202− * @mux: Multiplexer switch for Alternate/Accessory Modes
203201 * @fwnode: Optional fwnode of the port
204202 * @driver_data: Private pointer for driver specific info
205203 * @ops: Port operations vector
@@ -213,6 +211,7 @@ struct typec_capability { · 7 unmodified lines
213211 u16 pd_revision; /* 0300H = "3.0" */
214212 int prefer_role;
215213 enum typec_accessory accessory[TYPEC_MAX_ACCESSORY];
214+ unsigned int orientation_aware:1;
216215
217216 struct fwnode_handle *fwnode;
218217 void *driver_data;
include/linux/usb/typec_altmode.h+0−7
@@ -126,13 +126,6 @@ void typec_altmode_put_plug(struct typec_altmode *plug); · 125 unmodified lines
126126 struct typec_altmode *typec_match_altmode(struct typec_altmode **altmodes,
127127 size_t n, u16 svid, u8 mode);
128128
129−struct typec_altmode *
130−typec_altmode_register_notifier(struct device *dev, u16 svid, u8 mode,
131− struct notifier_block *nb);
132−
133−void typec_altmode_unregister_notifier(struct typec_altmode *adev,
134− struct notifier_block *nb);
135−
136129 /**
137130 * typec_altmode_get_orientation - Get cable plug orientation
138131 * altmode: Handle to the alternate mode
include/linux/usb/typec_mux.h+22−3
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #ifndef __USB_TYPEC_MUX
44 #define __USB_TYPEC_MUX
55
6+#include <linux/property.h>
67 #include <linux/usb/typec.h>
78
89 struct device;
@@ -17,11 +18,20 @@ typedef int (*typec_switch_set_fn_t)(struct typec_switch *sw, · 8 unmodified lines
1718 struct typec_switch_desc {
1819 struct fwnode_handle *fwnode;
1920 typec_switch_set_fn_t set;
21+ const char *name;
2022 void *drvdata;
2123 };
2224
23−struct typec_switch *typec_switch_get(struct device *dev);
25+struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode);
2426 void typec_switch_put(struct typec_switch *sw);
27+int typec_switch_set(struct typec_switch *sw,
28+ enum typec_orientation orientation);
29+
30+static inline struct typec_switch *typec_switch_get(struct device *dev)
31+{
32+ return fwnode_typec_switch_get(dev_fwnode(dev));
33+}
34+
2535 struct typec_switch *
2636 typec_switch_register(struct device *parent,
2737 const struct typec_switch_desc *desc);
@@ -42,12 +52,21 @@ typedef int (*typec_mux_set_fn_t)(struct typec_mux *mux, · 14 unmodified lines
4252 struct typec_mux_desc {
4353 struct fwnode_handle *fwnode;
4454 typec_mux_set_fn_t set;
55+ const char *name;
4556 void *drvdata;
4657 };
4758
48−struct typec_mux *
49−typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc);
59+struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode,
60+ const struct typec_altmode_desc *desc);
5061 void typec_mux_put(struct typec_mux *mux);
62+int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state);
63+
64+static inline struct typec_mux *
65+typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc)
66+{
67+ return fwnode_typec_mux_get(dev_fwnode(dev), desc);
68+}
69+
5170 struct typec_mux *
5271 typec_mux_register(struct device *parent, const struct typec_mux_desc *desc);
5372 void typec_mux_unregister(struct typec_mux *mux);
include/linux/usb/typec_tbt.h+53−0
@@ -0,0 +1,53 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef __USB_TYPEC_TBT_H
3+#define __USB_TYPEC_TBT_H
4+
5+#include <linux/usb/typec_altmode.h>
6+
7+#define USB_TYPEC_VENDOR_INTEL 0x8087
8+/* Alias for convenience */
9+#define USB_TYPEC_TBT_SID USB_TYPEC_VENDOR_INTEL
10+
11+/* Connector state for Thunderbolt3 */
12+#define TYPEC_TBT_MODE TYPEC_STATE_MODAL
13+
14+/**
15+ * struct typec_thunderbolt_data - Thundebolt3 Alt Mode specific data
16+ * @device_mode: Device Discover Mode VDO
17+ * @cable_mode: Cable Discover Mode VDO
18+ * @enter_vdo: Enter Mode VDO
19+ */
20+struct typec_thunderbolt_data {
21+ u32 device_mode;
22+ u32 cable_mode;
23+ u32 enter_vdo;
24+};
25+
26+/* TBT3 Device Discover Mode VDO bits */
27+#define TBT_MODE BIT(0)
28+#define TBT_ADAPTER(_vdo_) (((_vdo_) & BIT(16)) >> 16)
29+#define TBT_ADAPTER_LEGACY 0
30+#define TBT_ADAPTER_TBT3 1
31+#define TBT_INTEL_SPECIFIC_B0 BIT(26)
32+#define TBT_VENDOR_SPECIFIC_B0 BIT(30)
33+#define TBT_VENDOR_SPECIFIC_B1 BIT(31)
34+
35+#define TBT_SET_ADAPTER(a) (((a) & 1) << 16)
36+
37+/* TBT3 Cable Discover Mode VDO bits */
38+#define TBT_CABLE_SPEED(_vdo_) (((_vdo_) & GENMASK(18, 16)) >> 16)
39+#define TBT_CABLE_USB3_GEN1 1
40+#define TBT_CABLE_USB3_PASSIVE 2
41+#define TBT_CABLE_10_AND_20GBPS 3
42+#define TBT_CABLE_ROUNDED BIT(19)
43+#define TBT_CABLE_OPTICAL BIT(21)
44+#define TBT_CABLE_RETIMER BIT(22)
45+#define TBT_CABLE_LINK_TRAINING BIT(23)
46+
47+#define TBT_SET_CABLE_SPEED(_s_) (((_s_) & GENMASK(2, 0)) << 16)
48+
49+/* TBT3 Device Enter Mode VDO bits */
50+#define TBT_ENTER_MODE_CABLE_SPEED(s) TBT_SET_CABLE_SPEED(s)
51+#define TBT_ENTER_MODE_ACTIVE_CABLE BIT(24)
52+
53+#endif /* __USB_TYPEC_TBT_H */
include/linux/usb_usual.h+1−1
@@ -92,6 +92,6 @@ enum { US_DO_ALL_FLAGS }; · 91 unmodified lines
9292 #include <linux/usb/storage.h>
9393
9494 extern int usb_usual_ignore_device(struct usb_interface *intf);
95−extern struct usb_device_id usb_storage_usb_ids[];
95+extern const struct usb_device_id usb_storage_usb_ids[];
9696
9797 #endif /* __LINUX_USB_USUAL_H */
include/linux/usbdevice_fs.h+1−1
@@ -69,7 +69,7 @@ struct usbdevfs_urb32 { · 68 unmodified lines
6969 compat_int_t error_count;
7070 compat_uint_t signr;
7171 compat_caddr_t usercontext; /* unused */
72− struct usbdevfs_iso_packet_desc iso_frame_desc[0];
72+ struct usbdevfs_iso_packet_desc iso_frame_desc[];
7373 };
7474
7575 struct usbdevfs_ioctl32 {
include/linux/userfaultfd_k.h+41−1
@@ -14,6 +14,8 @@ · 13 unmodified lines
1414 #include <linux/userfaultfd.h> /* linux/include/uapi/linux/userfaultfd.h */
1515
1616 #include <linux/fcntl.h>
17+#include <linux/mm.h>
18+#include <asm-generic/pgtable_uffd.h>
1719
1820 /*
1921 * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining
@@ -34,11 +36,14 @@ extern vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason); · 14 unmodified lines
3436
3537 extern ssize_t mcopy_atomic(struct mm_struct *dst_mm, unsigned long dst_start,
3638 unsigned long src_start, unsigned long len,
37− bool *mmap_changing);
39+ bool *mmap_changing, __u64 mode);
3840 extern ssize_t mfill_zeropage(struct mm_struct *dst_mm,
3941 unsigned long dst_start,
4042 unsigned long len,
4143 bool *mmap_changing);
44+extern int mwriteprotect_range(struct mm_struct *dst_mm,
45+ unsigned long start, unsigned long len,
46+ bool enable_wp, bool *mmap_changing);
4247
4348 /* mm helpers */
4449 static inline bool is_mergeable_vm_userfaultfd_ctx(struct vm_area_struct *vma,
@@ -52,6 +57,23 @@ static inline bool userfaultfd_missing(struct vm_area_struct *vma) · 7 unmodified lines
5257 return vma->vm_flags & VM_UFFD_MISSING;
5358 }
5459
60+static inline bool userfaultfd_wp(struct vm_area_struct *vma)
61+{
62+ return vma->vm_flags & VM_UFFD_WP;
63+}
64+
65+static inline bool userfaultfd_pte_wp(struct vm_area_struct *vma,
66+ pte_t pte)
67+{
68+ return userfaultfd_wp(vma) && pte_uffd_wp(pte);
69+}
70+
71+static inline bool userfaultfd_huge_pmd_wp(struct vm_area_struct *vma,
72+ pmd_t pmd)
73+{
74+ return userfaultfd_wp(vma) && pmd_uffd_wp(pmd);
75+}
76+
5577 static inline bool userfaultfd_armed(struct vm_area_struct *vma)
5678 {
5779 return vma->vm_flags & (VM_UFFD_MISSING | VM_UFFD_WP);
@@ -96,6 +118,24 @@ static inline bool userfaultfd_missing(struct vm_area_struct *vma) · 38 unmodified lines
96118 return false;
97119 }
98120
121+static inline bool userfaultfd_wp(struct vm_area_struct *vma)
122+{
123+ return false;
124+}
125+
126+static inline bool userfaultfd_pte_wp(struct vm_area_struct *vma,
127+ pte_t pte)
128+{
129+ return false;
130+}
131+
132+static inline bool userfaultfd_huge_pmd_wp(struct vm_area_struct *vma,
133+ pmd_t pmd)
134+{
135+ return false;
136+}
137+
138+
99139 static inline bool userfaultfd_armed(struct vm_area_struct *vma)
100140 {
101141 return false;
include/linux/uuid.h+21−1
@@ -43,6 +43,16 @@ static inline void guid_copy(guid_t *dst, const guid_t *src) · 42 unmodified lines
4343 memcpy(dst, src, sizeof(guid_t));
4444 }
4545
46+static inline void import_guid(guid_t *dst, const __u8 *src)
47+{
48+ memcpy(dst, src, sizeof(guid_t));
49+}
50+
51+static inline void export_guid(__u8 *dst, const guid_t *src)
52+{
53+ memcpy(dst, src, sizeof(guid_t));
54+}
55+
4656 static inline bool guid_is_null(const guid_t *guid)
4757 {
4858 return guid_equal(guid, &guid_null);
@@ -58,12 +68,23 @@ static inline void uuid_copy(uuid_t *dst, const uuid_t *src) · 9 unmodified lines
5868 memcpy(dst, src, sizeof(uuid_t));
5969 }
6070
71+static inline void import_uuid(uuid_t *dst, const __u8 *src)
72+{
73+ memcpy(dst, src, sizeof(uuid_t));
74+}
75+
76+static inline void export_uuid(__u8 *dst, const uuid_t *src)
77+{
78+ memcpy(dst, src, sizeof(uuid_t));
79+}
80+
6181 static inline bool uuid_is_null(const uuid_t *uuid)
6282 {
6383 return uuid_equal(uuid, &uuid_null);
6484 }
6585
6686 void generate_random_uuid(unsigned char uuid[16]);
87+void generate_random_guid(unsigned char guid[16]);
6788
6889 extern void guid_gen(guid_t *u);
6990 extern void uuid_gen(uuid_t *u);
@@ -77,7 +98,6 @@ int guid_parse(const char *uuid, guid_t *u); · 7 unmodified lines
7798 int uuid_parse(const char *uuid, uuid_t *u);
7899
79100 /* backwards compatibility, don't use in new code */
80−#define uuid_le_gen(u) guid_gen(u)
81101 #define uuid_le_to_bin(guid, u) guid_parse(guid, u)
82102
83103 static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
include/linux/vdpa.h+253−0
@@ -0,0 +1,253 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_VDPA_H
3+#define _LINUX_VDPA_H
4+
5+#include <linux/kernel.h>
6+#include <linux/device.h>
7+#include <linux/interrupt.h>
8+#include <linux/vhost_iotlb.h>
9+
10+/**
11+ * vDPA callback definition.
12+ * @callback: interrupt callback function
13+ * @private: the data passed to the callback function
14+ */
15+struct vdpa_callback {
16+ irqreturn_t (*callback)(void *data);
17+ void *private;
18+};
19+
20+/**
21+ * vDPA device - representation of a vDPA device
22+ * @dev: underlying device
23+ * @dma_dev: the actual device that is performing DMA
24+ * @config: the configuration ops for this device.
25+ * @index: device index
26+ */
27+struct vdpa_device {
28+ struct device dev;
29+ struct device *dma_dev;
30+ const struct vdpa_config_ops *config;
31+ unsigned int index;
32+};
33+
34+/**
35+ * vDPA_config_ops - operations for configuring a vDPA device.
36+ * Note: vDPA device drivers are required to implement all of the
37+ * operations unless it is mentioned to be optional in the following
38+ * list.
39+ *
40+ * @set_vq_address: Set the address of virtqueue
41+ * @vdev: vdpa device
42+ * @idx: virtqueue index
43+ * @desc_area: address of desc area
44+ * @driver_area: address of driver area
45+ * @device_area: address of device area
46+ * Returns integer: success (0) or error (< 0)
47+ * @set_vq_num: Set the size of virtqueue
48+ * @vdev: vdpa device
49+ * @idx: virtqueue index
50+ * @num: the size of virtqueue
51+ * @kick_vq: Kick the virtqueue
52+ * @vdev: vdpa device
53+ * @idx: virtqueue index
54+ * @set_vq_cb: Set the interrupt callback function for
55+ * a virtqueue
56+ * @vdev: vdpa device
57+ * @idx: virtqueue index
58+ * @cb: virtio-vdev interrupt callback structure
59+ * @set_vq_ready: Set ready status for a virtqueue
60+ * @vdev: vdpa device
61+ * @idx: virtqueue index
62+ * @ready: ready (true) not ready(false)
63+ * @get_vq_ready: Get ready status for a virtqueue
64+ * @vdev: vdpa device
65+ * @idx: virtqueue index
66+ * Returns boolean: ready (true) or not (false)
67+ * @set_vq_state: Set the state for a virtqueue
68+ * @vdev: vdpa device
69+ * @idx: virtqueue index
70+ * @state: virtqueue state (last_avail_idx)
71+ * Returns integer: success (0) or error (< 0)
72+ * @get_vq_state: Get the state for a virtqueue
73+ * @vdev: vdpa device
74+ * @idx: virtqueue index
75+ * Returns virtqueue state (last_avail_idx)
76+ * @get_vq_align: Get the virtqueue align requirement
77+ * for the device
78+ * @vdev: vdpa device
79+ * Returns virtqueue algin requirement
80+ * @get_features: Get virtio features supported by the device
81+ * @vdev: vdpa device
82+ * Returns the virtio features support by the
83+ * device
84+ * @set_features: Set virtio features supported by the driver
85+ * @vdev: vdpa device
86+ * @features: feature support by the driver
87+ * Returns integer: success (0) or error (< 0)
88+ * @set_config_cb: Set the config interrupt callback
89+ * @vdev: vdpa device
90+ * @cb: virtio-vdev interrupt callback structure
91+ * @get_vq_num_max: Get the max size of virtqueue
92+ * @vdev: vdpa device
93+ * Returns u16: max size of virtqueue
94+ * @get_device_id: Get virtio device id
95+ * @vdev: vdpa device
96+ * Returns u32: virtio device id
97+ * @get_vendor_id: Get id for the vendor that provides this device
98+ * @vdev: vdpa device
99+ * Returns u32: virtio vendor id
100+ * @get_status: Get the device status
101+ * @vdev: vdpa device
102+ * Returns u8: virtio device status
103+ * @set_status: Set the device status
104+ * @vdev: vdpa device
105+ * @status: virtio device status
106+ * @get_config: Read from device specific configuration space
107+ * @vdev: vdpa device
108+ * @offset: offset from the beginning of
109+ * configuration space
110+ * @buf: buffer used to read to
111+ * @len: the length to read from
112+ * configuration space
113+ * @set_config: Write to device specific configuration space
114+ * @vdev: vdpa device
115+ * @offset: offset from the beginning of
116+ * configuration space
117+ * @buf: buffer used to write from
118+ * @len: the length to write to
119+ * configuration space
120+ * @get_generation: Get device config generation (optional)
121+ * @vdev: vdpa device
122+ * Returns u32: device generation
123+ * @set_map: Set device memory mapping (optional)
124+ * Needed for device that using device
125+ * specific DMA translation (on-chip IOMMU)
126+ * @vdev: vdpa device
127+ * @iotlb: vhost memory mapping to be
128+ * used by the vDPA
129+ * Returns integer: success (0) or error (< 0)
130+ * @dma_map: Map an area of PA to IOVA (optional)
131+ * Needed for device that using device
132+ * specific DMA translation (on-chip IOMMU)
133+ * and preferring incremental map.
134+ * @vdev: vdpa device
135+ * @iova: iova to be mapped
136+ * @size: size of the area
137+ * @pa: physical address for the map
138+ * @perm: device access permission (VHOST_MAP_XX)
139+ * Returns integer: success (0) or error (< 0)
140+ * @dma_unmap: Unmap an area of IOVA (optional but
141+ * must be implemented with dma_map)
142+ * Needed for device that using device
143+ * specific DMA translation (on-chip IOMMU)
144+ * and preferring incremental unmap.
145+ * @vdev: vdpa device
146+ * @iova: iova to be unmapped
147+ * @size: size of the area
148+ * Returns integer: success (0) or error (< 0)
149+ * @free: Free resources that belongs to vDPA (optional)
150+ * @vdev: vdpa device
151+ */
152+struct vdpa_config_ops {
153+ /* Virtqueue ops */
154+ int (*set_vq_address)(struct vdpa_device *vdev,
155+ u16 idx, u64 desc_area, u64 driver_area,
156+ u64 device_area);
157+ void (*set_vq_num)(struct vdpa_device *vdev, u16 idx, u32 num);
158+ void (*kick_vq)(struct vdpa_device *vdev, u16 idx);
159+ void (*set_vq_cb)(struct vdpa_device *vdev, u16 idx,
160+ struct vdpa_callback *cb);
161+ void (*set_vq_ready)(struct vdpa_device *vdev, u16 idx, bool ready);
162+ bool (*get_vq_ready)(struct vdpa_device *vdev, u16 idx);
163+ int (*set_vq_state)(struct vdpa_device *vdev, u16 idx, u64 state);
164+ u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx);
165+
166+ /* Device ops */
167+ u16 (*get_vq_align)(struct vdpa_device *vdev);
168+ u64 (*get_features)(struct vdpa_device *vdev);
169+ int (*set_features)(struct vdpa_device *vdev, u64 features);
170+ void (*set_config_cb)(struct vdpa_device *vdev,
171+ struct vdpa_callback *cb);
172+ u16 (*get_vq_num_max)(struct vdpa_device *vdev);
173+ u32 (*get_device_id)(struct vdpa_device *vdev);
174+ u32 (*get_vendor_id)(struct vdpa_device *vdev);
175+ u8 (*get_status)(struct vdpa_device *vdev);
176+ void (*set_status)(struct vdpa_device *vdev, u8 status);
177+ void (*get_config)(struct vdpa_device *vdev, unsigned int offset,
178+ void *buf, unsigned int len);
179+ void (*set_config)(struct vdpa_device *vdev, unsigned int offset,
180+ const void *buf, unsigned int len);
181+ u32 (*get_generation)(struct vdpa_device *vdev);
182+
183+ /* DMA ops */
184+ int (*set_map)(struct vdpa_device *vdev, struct vhost_iotlb *iotlb);
185+ int (*dma_map)(struct vdpa_device *vdev, u64 iova, u64 size,
186+ u64 pa, u32 perm);
187+ int (*dma_unmap)(struct vdpa_device *vdev, u64 iova, u64 size);
188+
189+ /* Free device resources */
190+ void (*free)(struct vdpa_device *vdev);
191+};
192+
193+struct vdpa_device *__vdpa_alloc_device(struct device *parent,
194+ const struct vdpa_config_ops *config,
195+ size_t size);
196+
197+#define vdpa_alloc_device(dev_struct, member, parent, config) \
198+ container_of(__vdpa_alloc_device( \
199+ parent, config, \
200+ sizeof(dev_struct) + \
201+ BUILD_BUG_ON_ZERO(offsetof( \
202+ dev_struct, member))), \
203+ dev_struct, member)
204+
205+int vdpa_register_device(struct vdpa_device *vdev);
206+void vdpa_unregister_device(struct vdpa_device *vdev);
207+
208+/**
209+ * vdpa_driver - operations for a vDPA driver
210+ * @driver: underlying device driver
211+ * @probe: the function to call when a device is found. Returns 0 or -errno.
212+ * @remove: the function to call when a device is removed.
213+ */
214+struct vdpa_driver {
215+ struct device_driver driver;
216+ int (*probe)(struct vdpa_device *vdev);
217+ void (*remove)(struct vdpa_device *vdev);
218+};
219+
220+#define vdpa_register_driver(drv) \
221+ __vdpa_register_driver(drv, THIS_MODULE)
222+int __vdpa_register_driver(struct vdpa_driver *drv, struct module *owner);
223+void vdpa_unregister_driver(struct vdpa_driver *drv);
224+
225+#define module_vdpa_driver(__vdpa_driver) \
226+ module_driver(__vdpa_driver, vdpa_register_driver, \
227+ vdpa_unregister_driver)
228+
229+static inline struct vdpa_driver *drv_to_vdpa(struct device_driver *driver)
230+{
231+ return container_of(driver, struct vdpa_driver, driver);
232+}
233+
234+static inline struct vdpa_device *dev_to_vdpa(struct device *_dev)
235+{
236+ return container_of(_dev, struct vdpa_device, dev);
237+}
238+
239+static inline void *vdpa_get_drvdata(const struct vdpa_device *vdev)
240+{
241+ return dev_get_drvdata(&vdev->dev);
242+}
243+
244+static inline void vdpa_set_drvdata(struct vdpa_device *vdev, void *data)
245+{
246+ dev_set_drvdata(&vdev->dev, data);
247+}
248+
249+static inline struct device *vdpa_get_dma_dev(struct vdpa_device *vdev)
250+{
251+ return vdev->dma_dev;
252+}
253+#endif /* _LINUX_VDPA_H */
include/linux/vfio.h+17−0
@@ -26,6 +26,9 @@ · 25 unmodified lines
2626 * operations documented below
2727 * @mmap: Perform mmap(2) on a region of the device file descriptor
2828 * @request: Request for the bus driver to release the device
29+ * @match: Optional device name match callback (return: 0 for no-match, >0 for
30+ * match, -errno for abort (ex. match with insufficient or incorrect
31+ * additional args)
2932 */
3033 struct vfio_device_ops {
3134 char *name;
@@ -39,6 +42,7 @@ struct vfio_device_ops { · 7 unmodified lines
3942 unsigned long arg);
4043 int (*mmap)(void *device_data, struct vm_area_struct *vma);
4144 void (*request)(void *device_data, unsigned int count);
45+ int (*match)(void *device_data, char *buf);
4246 };
4347
4448 extern struct iommu_group *vfio_iommu_group_get(struct device *dev);
@@ -82,6 +86,8 @@ struct vfio_iommu_driver_ops { · 37 unmodified lines
8286 struct notifier_block *nb);
8387 int (*unregister_notifier)(void *iommu_data,
8488 struct notifier_block *nb);
89+ int (*dma_rw)(void *iommu_data, dma_addr_t user_iova,
90+ void *data, size_t count, bool write);
8591 };
8692
8793 extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
@@ -94,6 +100,8 @@ extern void vfio_unregister_iommu_driver( · 6 unmodified lines
94100 */
95101 extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
96102 extern void vfio_group_put_external_user(struct vfio_group *group);
103+extern struct vfio_group *vfio_group_get_external_user_from_dev(struct device
104+ *dev);
97105 extern bool vfio_external_group_match_file(struct vfio_group *group,
98106 struct file *filep);
99107 extern int vfio_external_user_iommu_id(struct vfio_group *group);
@@ -107,6 +115,15 @@ extern int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, · 7 unmodified lines
107115 extern int vfio_unpin_pages(struct device *dev, unsigned long *user_pfn,
108116 int npage);
109117
118+extern int vfio_group_pin_pages(struct vfio_group *group,
119+ unsigned long *user_iova_pfn, int npage,
120+ int prot, unsigned long *phys_pfn);
121+extern int vfio_group_unpin_pages(struct vfio_group *group,
122+ unsigned long *user_iova_pfn, int npage);
123+
124+extern int vfio_dma_rw(struct vfio_group *group, dma_addr_t user_iova,
125+ void *data, size_t len, bool write);
126+
110127 /* each type has independent events */
111128 enum vfio_notify_type {
112129 VFIO_IOMMU_NOTIFY = 0,
include/linux/vhost_iotlb.h+47−0
@@ -0,0 +1,47 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_VHOST_IOTLB_H
3+#define _LINUX_VHOST_IOTLB_H
4+
5+#include <linux/interval_tree_generic.h>
6+
7+struct vhost_iotlb_map {
8+ struct rb_node rb;
9+ struct list_head link;
10+ u64 start;
11+ u64 last;
12+ u64 size;
13+ u64 addr;
14+#define VHOST_MAP_RO 0x1
15+#define VHOST_MAP_WO 0x2
16+#define VHOST_MAP_RW 0x3
17+ u32 perm;
18+ u32 flags_padding;
19+ u64 __subtree_last;
20+};
21+
22+#define VHOST_IOTLB_FLAG_RETIRE 0x1
23+
24+struct vhost_iotlb {
25+ struct rb_root_cached root;
26+ struct list_head list;
27+ unsigned int limit;
28+ unsigned int nmaps;
29+ unsigned int flags;
30+};
31+
32+int vhost_iotlb_add_range(struct vhost_iotlb *iotlb, u64 start, u64 last,
33+ u64 addr, unsigned int perm);
34+void vhost_iotlb_del_range(struct vhost_iotlb *iotlb, u64 start, u64 last);
35+
36+struct vhost_iotlb *vhost_iotlb_alloc(unsigned int limit, unsigned int flags);
37+void vhost_iotlb_free(struct vhost_iotlb *iotlb);
38+void vhost_iotlb_reset(struct vhost_iotlb *iotlb);
39+
40+struct vhost_iotlb_map *
41+vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last);
42+struct vhost_iotlb_map *
43+vhost_iotlb_itree_next(struct vhost_iotlb_map *map, u64 start, u64 last);
44+
45+void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
46+ struct vhost_iotlb_map *map);
47+#endif
include/linux/vm_event_item.h+5−0
@@ -73,9 +73,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 72 unmodified lines
7373 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
7474 THP_FAULT_ALLOC,
7575 THP_FAULT_FALLBACK,
76+ THP_FAULT_FALLBACK_CHARGE,
7677 THP_COLLAPSE_ALLOC,
7778 THP_COLLAPSE_ALLOC_FAILED,
7879 THP_FILE_ALLOC,
80+ THP_FILE_FALLBACK,
81+ THP_FILE_FALLBACK_CHARGE,
7982 THP_FILE_MAPPED,
8083 THP_SPLIT_PAGE,
8184 THP_SPLIT_PAGE_FAILED,
@@ -115,6 +118,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 33 unmodified lines
115118
116119 #ifndef CONFIG_TRANSPARENT_HUGEPAGE
117120 #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; })
121+#define THP_FILE_FALLBACK ({ BUILD_BUG(); 0; })
122+#define THP_FILE_FALLBACK_CHARGE ({ BUILD_BUG(); 0; })
118123 #define THP_FILE_MAPPED ({ BUILD_BUG(); 0; })
119124 #endif
120125
include/linux/vmalloc.h+3−2
@@ -141,8 +141,9 @@ extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, · 140 unmodified lines
141141
142142 extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
143143 unsigned long pgoff);
144−void vmalloc_sync_all(void);
145−
144+void vmalloc_sync_mappings(void);
145+void vmalloc_sync_unmappings(void);
146+
146147 /*
147148 * Lowlevel-APIs (not for driver use!)
148149 */
include/linux/vringh.h+36−0
@@ -14,6 +14,8 @@ · 13 unmodified lines
1414 #include <linux/virtio_byteorder.h>
1515 #include <linux/uio.h>
1616 #include <linux/slab.h>
17+#include <linux/dma-direction.h>
18+#include <linux/vhost_iotlb.h>
1719 #include <asm/barrier.h>
1820
1921 /* virtio_ring with information needed for host access. */
@@ -39,6 +41,9 @@ struct vringh { · 19 unmodified lines
3941 /* The vring (note: it may contain user pointers!) */
4042 struct vring vring;
4143
44+ /* IOTLB for this vring */
45+ struct vhost_iotlb *iotlb;
46+
4247 /* The function to call to notify the guest about added buffers */
4348 void (*notify)(struct vringh *);
4449 };
@@ -248,4 +253,35 @@ static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val) · 203 unmodified lines
248253 {
249254 return __cpu_to_virtio64(vringh_is_little_endian(vrh), val);
250255 }
256+
257+void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb);
258+
259+int vringh_init_iotlb(struct vringh *vrh, u64 features,
260+ unsigned int num, bool weak_barriers,
261+ struct vring_desc *desc,
262+ struct vring_avail *avail,
263+ struct vring_used *used);
264+
265+int vringh_getdesc_iotlb(struct vringh *vrh,
266+ struct vringh_kiov *riov,
267+ struct vringh_kiov *wiov,
268+ u16 *head,
269+ gfp_t gfp);
270+
271+ssize_t vringh_iov_pull_iotlb(struct vringh *vrh,
272+ struct vringh_kiov *riov,
273+ void *dst, size_t len);
274+ssize_t vringh_iov_push_iotlb(struct vringh *vrh,
275+ struct vringh_kiov *wiov,
276+ const void *src, size_t len);
277+
278+void vringh_abandon_iotlb(struct vringh *vrh, unsigned int num);
279+
280+int vringh_complete_iotlb(struct vringh *vrh, u16 head, u32 len);
281+
282+bool vringh_notify_enable_iotlb(struct vringh *vrh);
283+void vringh_notify_disable_iotlb(struct vringh *vrh);
284+
285+int vringh_need_notify_iotlb(struct vringh *vrh);
286+
251287 #endif /* _LINUX_VRINGH_H */
include/linux/vt_kern.h+32−32
@@ -28,8 +28,9 @@ · 27 unmodified lines
2828 #define BROKEN_GRAPHICS_PROGRAMS 1
2929 #endif
3030
31−extern void kd_mksound(unsigned int hz, unsigned int ticks);
32−extern int kbd_rate(struct kbd_repeat *rep);
31+void kd_mksound(unsigned int hz, unsigned int ticks);
32+int kbd_rate(struct kbd_repeat *rep);
33+
3334 extern int fg_console, last_console, want_console;
3435
3536 /* console.c */
@@ -131,11 +132,11 @@ void vt_event_post(unsigned int event, unsigned int old, unsigned int new); · 95 unmodified lines
131132 int vt_waitactive(int n);
132133 void change_console(struct vc_data *new_vc);
133134 void reset_vc(struct vc_data *vc);
134−extern int do_unbind_con_driver(const struct consw *csw, int first, int last,
135− int deflt);
135+int do_unbind_con_driver(const struct consw *csw, int first, int last,
136+ int deflt);
136137 int vty_init(const struct file_operations *console_fops);
137138
138−extern char vt_dont_switch;
139+extern bool vt_dont_switch;
139140 extern int default_utf8;
140141 extern int global_cursor_default;
141142
@@ -146,7 +147,7 @@ struct vt_spawn_console { · 4 unmodified lines
146147 };
147148 extern struct vt_spawn_console vt_spawn_con;
148149
149−extern int vt_move_to_console(unsigned int vt, int alloc);
150+int vt_move_to_console(unsigned int vt, int alloc);
150151
151152 /* Interfaces for VC notification of character events (for accessibility etc) */
152153
@@ -155,35 +156,34 @@ struct vt_notifier_param { · 2 unmodified lines
155156 unsigned int c; /* Printed char */
156157 };
157158
158−extern int register_vt_notifier(struct notifier_block *nb);
159−extern int unregister_vt_notifier(struct notifier_block *nb);
159+int register_vt_notifier(struct notifier_block *nb);
160+int unregister_vt_notifier(struct notifier_block *nb);
160161
161−extern void hide_boot_cursor(bool hide);
162+void hide_boot_cursor(bool hide);
162163
163164 /* keyboard provided interfaces */
164−extern int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm);
165−extern int vt_do_kdskbmode(int console, unsigned int arg);
166−extern int vt_do_kdskbmeta(int console, unsigned int arg);
167−extern int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc,
168− int perm);
169−extern int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe,
170− int perm, int console);
171−extern int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb,
172− int perm);
173−extern int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm);
174−extern int vt_do_kdgkbmode(int console);
175−extern int vt_do_kdgkbmeta(int console);
176−extern void vt_reset_unicode(int console);
177−extern int vt_get_shift_state(void);
178−extern void vt_reset_keyboard(int console);
179−extern int vt_get_leds(int console, int flag);
180−extern int vt_get_kbd_mode_bit(int console, int bit);
181−extern void vt_set_kbd_mode_bit(int console, int bit);
182−extern void vt_clr_kbd_mode_bit(int console, int bit);
183−extern void vt_set_led_state(int console, int leds);
184−extern void vt_set_led_state(int console, int leds);
185−extern void vt_kbd_con_start(int console);
186−extern void vt_kbd_con_stop(int console);
165+int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm);
166+int vt_do_kdskbmode(int console, unsigned int arg);
167+int vt_do_kdskbmeta(int console, unsigned int arg);
168+int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc,
169+ int perm);
170+int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm,
171+ int console);
172+int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm);
173+int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm);
174+int vt_do_kdgkbmode(int console);
175+int vt_do_kdgkbmeta(int console);
176+void vt_reset_unicode(int console);
177+int vt_get_shift_state(void);
178+void vt_reset_keyboard(int console);
179+int vt_get_leds(int console, int flag);
180+int vt_get_kbd_mode_bit(int console, int bit);
181+void vt_set_kbd_mode_bit(int console, int bit);
182+void vt_clr_kbd_mode_bit(int console, int bit);
183+void vt_set_led_state(int console, int leds);
184+void vt_set_led_state(int console, int leds);
185+void vt_kbd_con_start(int console);
186+void vt_kbd_con_stop(int console);
187187
188188 void vc_scrolldelta_helper(struct vc_data *c, int lines,
189189 unsigned int rolled_over, void *_base, unsigned int size);
include/linux/wait.h+1−0
@@ -20,6 +20,7 @@ int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int · 19 unmodified lines
2020 #define WQ_FLAG_EXCLUSIVE 0x01
2121 #define WQ_FLAG_WOKEN 0x02
2222 #define WQ_FLAG_BOOKMARK 0x04
23+#define WQ_FLAG_CUSTOM 0x08
2324
2425 /*
2526 * A single wait-queue entry structure:
include/linux/workqueue.h+18−2
@@ -487,6 +487,19 @@ extern void wq_worker_comm(char *buf, size_t size, struct task_struct *task); · 486 unmodified lines
487487 *
488488 * We queue the work to the CPU on which it was submitted, but if the CPU dies
489489 * it can be processed by another CPU.
490+ *
491+ * Memory-ordering properties: If it returns %true, guarantees that all stores
492+ * preceding the call to queue_work() in the program order will be visible from
493+ * the CPU which will execute @work by the time such work executes, e.g.,
494+ *
495+ * { x is initially 0 }
496+ *
497+ * CPU0 CPU1
498+ *
499+ * WRITE_ONCE(x, 1); [ @work is being executed ]
500+ * r0 = queue_work(wq, work); r1 = READ_ONCE(x);
501+ *
502+ * Forbids: r0 == true && r1 == 0
490503 */
491504 static inline bool queue_work(struct workqueue_struct *wq,
492505 struct work_struct *work)
@@ -546,6 +559,9 @@ static inline bool schedule_work_on(int cpu, struct work_struct *work) · 53 unmodified lines
546559 * This puts a job in the kernel-global workqueue if it was not already
547560 * queued and leaves it in the same position on the kernel-global
548561 * workqueue otherwise.
562+ *
563+ * Shares the same memory-ordering properties of queue_work(), cf. the
564+ * DocBook header of queue_work().
549565 */
550566 static inline bool schedule_work(struct work_struct *work)
551567 {
@@ -649,7 +665,7 @@ int workqueue_online_cpu(unsigned int cpu); · 97 unmodified lines
649665 int workqueue_offline_cpu(unsigned int cpu);
650666 #endif
651667
652−int __init workqueue_init_early(void);
653−int __init workqueue_init(void);
668+void __init workqueue_init_early(void);
669+void __init workqueue_init(void);
654670
655671 #endif
include/linux/xarray.h+7−3
@@ -32,8 +32,8 @@ · 31 unmodified lines
3232 * The following internal entries have a special meaning:
3333 *
3434 * 0-62: Sibling entries
35− * 256: Zero entry
36− * 257: Retry entry
35+ * 256: Retry entry
36+ * 257: Zero entry
3737 *
3838 * Errors are also represented as internal entries, but use the negative
3939 * space (-4094 to -2). They're never stored in the slots array; only
@@ -1648,6 +1648,7 @@ static inline void *xas_next_marked(struct xa_state *xas, unsigned long max, · 1608 unmodified lines
16481648 xa_mark_t mark)
16491649 {
16501650 struct xa_node *node = xas->xa_node;
1651+ void *entry;
16511652 unsigned int offset;
16521653
16531654 if (unlikely(xas_not_node(node) || node->shift))
@@ -1659,7 +1660,10 @@ static inline void *xas_next_marked(struct xa_state *xas, unsigned long max, · 5 unmodified lines
16591660 return NULL;
16601661 if (offset == XA_CHUNK_SIZE)
16611662 return xas_find_marked(xas, max, mark);
1662− return xa_entry(xas->xa, node, offset);
1663+ entry = xa_entry(xas->xa, node, offset);
1664+ if (!entry)
1665+ return xas_find_marked(xas, max, mark);
1666+ return entry;
16631667 }
16641668
16651669 /*
include/linux/xattr.h+2−1
@@ -102,7 +102,8 @@ struct simple_xattr *simple_xattr_alloc(const void *value, size_t size); · 101 unmodified lines
102102 int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,
103103 void *buffer, size_t size);
104104 int simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
105− const void *value, size_t size, int flags);
105+ const void *value, size_t size, int flags,
106+ ssize_t *removed_size);
106107 ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs, char *buffer,
107108 size_t size);
108109 void simple_xattr_list_add(struct simple_xattrs *xattrs,
include/linux/zorro.h+0−12
@@ -40,13 +40,6 @@ struct zorro_dev { · 39 unmodified lines
4040 #define to_zorro_dev(n) container_of(n, struct zorro_dev, dev)
4141
4242
43− /*
44− * Zorro bus
45− */
46−
47−extern struct bus_type zorro_bus_type;
48−
49−
5043 /*
5144 * Zorro device drivers
5245 */
@@ -70,11 +63,6 @@ struct zorro_driver { · 17 unmodified lines
7063 /* New-style probing */
7164 extern int zorro_register_driver(struct zorro_driver *);
7265 extern void zorro_unregister_driver(struct zorro_driver *);
73−extern const struct zorro_device_id *zorro_match_device(const struct zorro_device_id *ids, const struct zorro_dev *z);
74−static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
75−{
76− return z->driver;
77−}
7866
7967
8068 extern unsigned int zorro_num_autocon; /* # of autoconfig devices found */