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
416extern bool acpi_osi_is_win8(void);416extern bool acpi_osi_is_win8(void);
417 417
418#ifdef CONFIG_ACPI_NUMA418#ifdef CONFIG_ACPI_NUMA
419int acpi_map_pxm_to_online_node(int pxm);
420int acpi_map_pxm_to_node(int pxm);419int acpi_map_pxm_to_node(int pxm);
421int acpi_get_node(acpi_handle handle);420int 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 */
437static 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}
422#else443#else
423static inline int acpi_map_pxm_to_online_node(int pxm)444static inline int acpi_map_pxm_to_online_node(int pxm)
424{445{
@@ -488,6 +509,11 @@ void __init acpi_nvs_nosave_s3(void); · 63 unmodified lines
488void __init acpi_sleep_no_blacklist(void);509void __init acpi_sleep_no_blacklist(void);
489#endif /* CONFIG_PM_SLEEP */510#endif /* CONFIG_PM_SLEEP */
490 511
512int acpi_register_wakeup_handler(
513 int wake_irq, bool (*wakeup)(void *context), void *context);
514void acpi_unregister_wakeup_handler(
515 bool (*wakeup)(void *context), void *context);
516
491struct acpi_osc_context {517struct acpi_osc_context {
492 char *uuid_str; /* UUID string */518 char *uuid_str; /* UUID string */
493 int rev;519 int rev;
@@ -530,8 +556,9 @@ extern bool osc_pc_lpi_support_confirmed; · 36 unmodified lines
530#define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004556#define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004
531#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008557#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008
532#define OSC_PCI_MSI_SUPPORT 0x00000010558#define OSC_PCI_MSI_SUPPORT 0x00000010
559#define OSC_PCI_EDR_SUPPORT 0x00000080
533#define OSC_PCI_HPX_TYPE_3_SUPPORT 0x00000100560#define OSC_PCI_HPX_TYPE_3_SUPPORT 0x00000100
534#define OSC_PCI_SUPPORT_MASKS 0x0000011f561#define OSC_PCI_SUPPORT_MASKS 0x0000019f
535 562
536/* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */563/* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */
537#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001564#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001
@@ -540,7 +567,8 @@ extern bool osc_pc_lpi_support_confirmed; · 2 unmodified lines
540#define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008567#define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008
541#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010568#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
542#define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020569#define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020
543#define OSC_PCI_CONTROL_MASKS 0x0000003f570#define OSC_PCI_EXPRESS_DPC_CONTROL 0x00000080
571#define OSC_PCI_CONTROL_MASKS 0x000000bf
544 572
545#define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002573#define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002
546#define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004574#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
44/* PCIe port driver needs this function to enable AER */44/* PCIe port driver needs this function to enable AER */
45int pci_enable_pcie_error_reporting(struct pci_dev *dev);45int pci_enable_pcie_error_reporting(struct pci_dev *dev);
46int pci_disable_pcie_error_reporting(struct pci_dev *dev);46int pci_disable_pcie_error_reporting(struct pci_dev *dev);
47int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);47int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
48int pci_cleanup_aer_error_status_regs(struct pci_dev *dev);
49void pci_save_aer_state(struct pci_dev *dev);48void pci_save_aer_state(struct pci_dev *dev);
50void pci_restore_aer_state(struct pci_dev *dev);49void pci_restore_aer_state(struct pci_dev *dev);
51#else50#else
@@ -57,11 +56,7 @@ static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) · 5 unmodified lines
57{56{
58 return -EINVAL;57 return -EINVAL;
59}58}
60static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)59static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
61{
62 return -EINVAL;
63}
64static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev)
65{60{
66 return -EINVAL;61 return -EINVAL;
67}62}
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
16 16
17DECLARE_PER_CPU(unsigned long, cpu_scale);17DECLARE_PER_CPU(unsigned long, cpu_scale);
18 18
19struct sched_domain;19static inline unsigned long topology_get_cpu_scale(int cpu)
20static inline
21unsigned long topology_get_cpu_scale(int cpu)
22{20{
23 return per_cpu(cpu_scale, cpu);21 return per_cpu(cpu_scale, cpu);
24}22}
@@ -27,12 +25,23 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity); · 2 unmodified lines
27 25
28DECLARE_PER_CPU(unsigned long, freq_scale);26DECLARE_PER_CPU(unsigned long, freq_scale);
29 27
30static inline28static inline unsigned long topology_get_freq_scale(int cpu)
31unsigned long topology_get_freq_scale(int cpu)
32{29{
33 return per_cpu(freq_scale, cpu);30 return per_cpu(freq_scale, cpu);
34}31}
35 32
33bool arch_freq_counters_available(struct cpumask *cpus);
34
35DECLARE_PER_CPU(unsigned long, thermal_pressure);
36
37static inline unsigned long topology_get_thermal_pressure(int cpu)
38{
39 return per_cpu(thermal_pressure, cpu);
40}
41
42void arch_set_thermal_pressure(struct cpumask *cpus,
43 unsigned long th_pressure);
44
36struct cpu_topology {45struct cpu_topology {
37 int thread_id;46 int thread_id;
38 int core_id;47 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
39enum 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
44 * exec has happened. Used to sanitize execution environment44 * exec has happened. Used to sanitize execution environment
45 * and to set AT_SECURE auxv for glibc.45 * and to set AT_SECURE auxv for glibc.
46 */46 */
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;
48#ifdef __alpha__54#ifdef __alpha__
49 unsigned int taso:1;55 unsigned int taso:1;
50#endif56#endif
include/linux/bio.h+1−14
@@ -441,14 +441,6 @@ void __bio_add_page(struct bio *bio, struct page *page, · 440 unmodified lines
441 unsigned int len, unsigned int off);441 unsigned int len, unsigned int off);
442int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);442int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);
443void bio_release_pages(struct bio *bio, bool mark_dirty);443void bio_release_pages(struct bio *bio, bool mark_dirty);
444struct rq_map_data;
445extern struct bio *bio_map_user_iov(struct request_queue *,
446 struct iov_iter *, gfp_t);
447extern void bio_unmap_user(struct bio *);
448extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
449 gfp_t);
450extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
451 gfp_t, int);
452extern void bio_set_pages_dirty(struct bio *bio);444extern void bio_set_pages_dirty(struct bio *bio);
453extern void bio_check_pages_dirty(struct bio *bio);445extern void bio_check_pages_dirty(struct bio *bio);
454 446
@@ -463,14 +455,9 @@ extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, · 8 unmodified lines
463extern void bio_copy_data(struct bio *dst, struct bio *src);455extern void bio_copy_data(struct bio *dst, struct bio *src);
464extern void bio_list_copy_data(struct bio *dst, struct bio *src);456extern void bio_list_copy_data(struct bio *dst, struct bio *src);
465extern void bio_free_pages(struct bio *bio);457extern void bio_free_pages(struct bio *bio);
466
467extern struct bio *bio_copy_user_iov(struct request_queue *,
468 struct rq_map_data *,
469 struct iov_iter *,
470 gfp_t);
471extern int bio_uncopy_user(struct bio *);
472void zero_fill_bio_iter(struct bio *bio, struct bvec_iter iter);458void zero_fill_bio_iter(struct bio *bio, struct bvec_iter iter);
473void bio_truncate(struct bio *bio, unsigned new_size);459void bio_truncate(struct bio *bio, unsigned new_size);
460void guard_bio_eod(struct bio *bio);
474 461
475static inline void zero_fill_bio(struct bio *bio)462static inline void zero_fill_bio(struct bio *bio)
476{463{
include/linux/bitfield.h+14−0
@@ -55,6 +55,19 @@ · 54 unmodified lines
55 (1ULL << __bf_shf(_mask))); \55 (1ULL << __bf_shf(_mask))); \
56 })56 })
57 57
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
58/**71/**
59 * FIELD_FIT() - check if value fits in the field72 * FIELD_FIT() - check if value fits in the field
60 * @_mask: shifted mask defining the field's length and position73 * @_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
110{123{
111 return field / field_multiplier(field);124 return field / field_multiplier(field);
112}125}
126#define field_max(field) ((typeof(field))field_mask(field))
113#define ____MAKE_OP(type,base,to,from) \127#define ____MAKE_OP(type,base,to,from) \
114static __always_inline __##type type##_encode_bits(base v, base field) \128static __always_inline __##type type##_encode_bits(base v, base field) \
115{ \129{ \
include/linux/bitmap.h+7−1
@@ -50,7 +50,13 @@ · 49 unmodified lines
50 * bitmap_set(dst, pos, nbits) Set specified bit area50 * bitmap_set(dst, pos, nbits) Set specified bit area
51 * bitmap_clear(dst, pos, nbits) Clear specified bit area51 * bitmap_clear(dst, pos, nbits) Clear specified bit area
52 * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area52 * 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 above53 * 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
54 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n60 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
55 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n61 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
56 * bitmap_cut(dst, src, first, n, nbits) Cut n bits from first, copy rest62 * 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
162 *162 *
163 * This is safe to use for 16- and 8-bit types as well.163 * This is safe to use for 16- and 8-bit types as well.
164 */164 */
165static inline __s32 sign_extend32(__u32 value, int index)165static __always_inline __s32 sign_extend32(__u32 value, int index)
166{166{
167 __u8 shift = 31 - index;167 __u8 shift = 31 - index;
168 return (__s32)(value << shift) >> shift;168 return (__s32)(value << shift) >> shift;
@@ -173,7 +173,7 @@ static inline __s32 sign_extend32(__u32 value, int index) · 4 unmodified lines
173 * @value: value to sign extend173 * @value: value to sign extend
174 * @index: 0 based bit index (0<=index<64) to sign bit174 * @index: 0 based bit index (0<=index<64) to sign bit
175 */175 */
176static inline __s64 sign_extend64(__u64 value, int index)176static __always_inline __s64 sign_extend64(__u64 value, int index)
177{177{
178 __u8 shift = 63 - index;178 __u8 shift = 63 - index;
179 return (__s64)(value << shift) >> shift;179 return (__s64)(value << shift) >> shift;
include/linux/bits.h+21−3
@@ -3,9 +3,9 @@ · 2 unmodified lines
3#define __LINUX_BITS_H3#define __LINUX_BITS_H
4 4
5#include <linux/const.h>5#include <linux/const.h>
6#include <vdso/bits.h>
6#include <asm/bitsperlong.h>7#include <asm/bitsperlong.h>
7 8
8#define BIT(nr) (UL(1) << (nr))
9#define BIT_ULL(nr) (ULL(1) << (nr))9#define BIT_ULL(nr) (ULL(1) << (nr))
10#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))10#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
11#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)11#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
@@ -18,12 +18,30 @@ · 6 unmodified lines
18 * position @h. For example18 * position @h. For example
19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
20 */20 */
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) \
22 (((~UL(0)) - (UL(1) << (l)) + 1) & \36 (((~UL(0)) - (UL(1) << (l)) + 1) & \
23 (~UL(0) >> (BITS_PER_LONG - 1 - (h))))37 (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
38#define GENMASK(h, l) \
39 (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
24 40
25#define GENMASK_ULL(h, l) \41#define __GENMASK_ULL(h, l) \
26 (((~ULL(0)) - (ULL(1) << (l)) + 1) & \42 (((~ULL(0)) - (ULL(1) << (l)) + 1) & \
27 (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))43 (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
44#define GENMASK_ULL(h, l) \
45 (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
28 46
29#endif /* __LINUX_BITS_H */47#endif /* __LINUX_BITS_H */
include/linux/blk-cgroup.h+17−26
@@ -46,6 +46,7 @@ struct blkcg_gq; · 45 unmodified lines
46struct blkcg {46struct blkcg {
47 struct cgroup_subsys_state css;47 struct cgroup_subsys_state css;
48 spinlock_t lock;48 spinlock_t lock;
49 refcount_t online_pin;
49 50
50 struct radix_tree_root blkg_tree;51 struct radix_tree_root blkg_tree;
51 struct blkcg_gq __rcu *blkg_hint;52 struct blkcg_gq __rcu *blkg_hint;
@@ -56,7 +57,6 @@ struct blkcg { · 4 unmodified lines
56 struct list_head all_blkcgs_node;57 struct list_head all_blkcgs_node;
57#ifdef CONFIG_CGROUP_WRITEBACK58#ifdef CONFIG_CGROUP_WRITEBACK
58 struct list_head cgwb_list;59 struct list_head cgwb_list;
59 refcount_t cgwb_refcnt;
60#endif60#endif
61};61};
62 62
@@ -412,47 +412,38 @@ static inline struct blkcg *cpd_to_blkcg(struct blkcg_policy_data *cpd) · 349 unmodified lines
412 412
413extern void blkcg_destroy_blkgs(struct blkcg *blkcg);413extern void blkcg_destroy_blkgs(struct blkcg *blkcg);
414 414
415#ifdef CONFIG_CGROUP_WRITEBACK
416
417/**415/**
418 * blkcg_cgwb_get - get a reference for blkcg->cgwb_list416 * blkcg_pin_online - pin online state
419 * @blkcg: blkcg of interest417 * @blkcg: blkcg of interest
420 *418 *
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.
422 */422 */
423static inline void blkcg_cgwb_get(struct blkcg *blkcg)423static inline void blkcg_pin_online(struct blkcg *blkcg)
424{424{
425 refcount_inc(&blkcg->cgwb_refcnt);425 refcount_inc(&blkcg->online_pin);
426}426}
427 427
428/**428/**
429 * blkcg_cgwb_put - put a reference for @blkcg->cgwb_list429 * blkcg_unpin_online - unpin online state
430 * @blkcg: blkcg of interest430 * @blkcg: blkcg of interest
431 *431 *
432 * This is used to track the number of active wb's related to a blkcg.432 * This is primarily used to impedance-match blkg and cgwb lifetimes so
433 * When this count goes to zero, all active wb has finished so the433 * 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
434 * blkcg can continue destruction by calling blkcg_destroy_blkgs().435 * blkcg can continue destruction by calling blkcg_destroy_blkgs().
435 * This work may occur in cgwb_release_workfn() on the cgwb_release
436 * workqueue.
437 */436 */
438static inline void blkcg_cgwb_put(struct blkcg *blkcg)437static inline void blkcg_unpin_online(struct blkcg *blkcg)
439{438{
440 if (refcount_dec_and_test(&blkcg->cgwb_refcnt))439 do {
440 if (!refcount_dec_and_test(&blkcg->online_pin))
441 break;
441 blkcg_destroy_blkgs(blkcg);442 blkcg_destroy_blkgs(blkcg);
443 blkcg = blkcg_parent(blkcg);
444 } while (blkcg);
442}445}
443 446
444#else
445
446static inline void blkcg_cgwb_get(struct blkcg *blkcg) { }
447
448static 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
456/**447/**
457 * blkg_path - format cgroup path of blkg448 * blkg_path - format cgroup path of blkg
458 * @blkg: blkg of interest449 * @blkg: blkg of interest
include/linux/blk-mq.h+6−1
@@ -162,7 +162,10 @@ struct blk_mq_hw_ctx { · 161 unmodified lines
162 struct dentry *sched_debugfs_dir;162 struct dentry *sched_debugfs_dir;
163#endif163#endif
164 164
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 */
166 struct list_head hctx_list;169 struct list_head hctx_list;
167 170
168 /**171 /**
@@ -409,6 +412,8 @@ enum { · 240 unmodified lines
409 << BLK_MQ_F_ALLOC_POLICY_START_BIT)412 << BLK_MQ_F_ALLOC_POLICY_START_BIT)
410 413
411struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);414struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
415struct request_queue *blk_mq_init_queue_data(struct blk_mq_tag_set *set,
416 void *queuedata);
412struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,417struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
413 struct request_queue *q,418 struct request_queue *q,
414 bool elevator_init);419 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
952}952}
953 953
954#ifdef CONFIG_BLK_DEV_ZONED954#ifdef CONFIG_BLK_DEV_ZONED
955
956/* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
957const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);
958
955static inline unsigned int blk_rq_zone_no(struct request *rq)959static inline unsigned int blk_rq_zone_no(struct request *rq)
956{960{
957 return blk_queue_zone_no(rq->q, blk_rq_pos(rq));961 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
1063 * Access functions for manipulating queue properties1067 * Access functions for manipulating queue properties
1064 */1068 */
1065extern void blk_cleanup_queue(struct request_queue *);1069extern void blk_cleanup_queue(struct request_queue *);
1066extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
1067extern void blk_queue_bounce_limit(struct request_queue *, u64);1070extern void blk_queue_bounce_limit(struct request_queue *, u64);
1068extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);1071extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
1069extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int);1072extern 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
1140extern long nr_blockdev_pages(void);1143extern long nr_blockdev_pages(void);
1141 1144
1142bool __must_check blk_get_queue(struct request_queue *);1145bool __must_check blk_get_queue(struct request_queue *);
1143struct request_queue *blk_alloc_queue(gfp_t);1146struct request_queue *blk_alloc_queue(make_request_fn make_request, int node_id);
1144struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id);
1145extern void blk_put_queue(struct request_queue *);1147extern void blk_put_queue(struct request_queue *);
1146extern void blk_set_queue_dying(struct request_queue *);1148extern void blk_set_queue_dying(struct request_queue *);
1147 1149
@@ -1484,15 +1486,6 @@ static inline unsigned int block_size(struct block_device *bdev) · 336 unmodified lines
1484 return bdev->bd_block_size;1486 return bdev->bd_block_size;
1485}1487}
1486 1488
1487typedef struct {struct page *v;} Sector;
1488
1489unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *);
1490
1491static inline void put_dev_sector(Sector p)
1492{
1493 put_page(p.v);
1494}
1495
1496int kblockd_schedule_work(struct work_struct *work);1489int kblockd_schedule_work(struct work_struct *work);
1497int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);1490int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
1498 1491
@@ -1706,6 +1699,7 @@ struct block_device_operations { · 207 unmodified lines
1706 void (*swap_slot_free_notify) (struct block_device *, unsigned long);1699 void (*swap_slot_free_notify) (struct block_device *, unsigned long);
1707 int (*report_zones)(struct gendisk *, sector_t sector,1700 int (*report_zones)(struct gendisk *, sector_t sector,
1708 unsigned int nr_zones, report_zones_cb cb, void *data);1701 unsigned int nr_zones, report_zones_cb cb, void *data);
1702 char *(*devnode)(struct gendisk *disk, umode_t *mode);
1709 struct module *owner;1703 struct module *owner;
1710 const struct pr_ops *pr_ops;1704 const struct pr_ops *pr_ops;
1711};1705};
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
216}216}
217 217
218/* XBC node initializer */218/* XBC node initializer */
219int __init xbc_init(char *buf);219int __init xbc_init(char *buf, const char **emsg, int *epos);
220
220 221
221/* XBC cleanup data structures */222/* XBC cleanup data structures */
222void __init xbc_destroy_all(void);223void __init xbc_destroy_all(void);
include/linux/bpf-cgroup.h+37−6
@@ -36,7 +36,7 @@ struct bpf_cgroup_storage_map; · 35 unmodified lines
36 36
37struct bpf_storage_buffer {37struct bpf_storage_buffer {
38 struct rcu_head rcu;38 struct rcu_head rcu;
39 char data[0];39 char data[];
40};40};
41 41
42struct bpf_cgroup_storage {42struct bpf_cgroup_storage {
@@ -51,9 +51,18 @@ struct bpf_cgroup_storage { · 8 unmodified lines
51 struct rcu_head rcu;51 struct rcu_head rcu;
52};52};
53 53
54struct bpf_cgroup_link {
55 struct bpf_link link;
56 struct cgroup *cgroup;
57 enum bpf_attach_type type;
58};
59
60extern const struct bpf_link_ops bpf_cgroup_link_lops;
61
54struct bpf_prog_list {62struct bpf_prog_list {
55 struct list_head node;63 struct list_head node;
56 struct bpf_prog *prog;64 struct bpf_prog *prog;
65 struct bpf_cgroup_link *link;
57 struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE];66 struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE];
58};67};
59 68
@@ -84,20 +93,27 @@ struct cgroup_bpf { · 24 unmodified lines
84int cgroup_bpf_inherit(struct cgroup *cgrp);93int cgroup_bpf_inherit(struct cgroup *cgrp);
85void cgroup_bpf_offline(struct cgroup *cgrp);94void cgroup_bpf_offline(struct cgroup *cgrp);
86 95
87int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog,96int __cgroup_bpf_attach(struct cgroup *cgrp,
88 struct bpf_prog *replace_prog,97 struct bpf_prog *prog, struct bpf_prog *replace_prog,
98 struct bpf_cgroup_link *link,
89 enum bpf_attach_type type, u32 flags);99 enum bpf_attach_type type, u32 flags);
90int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog,100int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog,
101 struct bpf_cgroup_link *link,
91 enum bpf_attach_type type);102 enum bpf_attach_type type);
103int __cgroup_bpf_replace(struct cgroup *cgrp, struct bpf_cgroup_link *link,
104 struct bpf_prog *new_prog);
92int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,105int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,
93 union bpf_attr __user *uattr);106 union bpf_attr __user *uattr);
94 107
95/* Wrapper for __cgroup_bpf_*() protected by cgroup_mutex */108/* Wrapper for __cgroup_bpf_*() protected by cgroup_mutex */
96int cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog,109int cgroup_bpf_attach(struct cgroup *cgrp,
97 struct bpf_prog *replace_prog, enum bpf_attach_type type,110 struct bpf_prog *prog, struct bpf_prog *replace_prog,
111 struct bpf_cgroup_link *link, enum bpf_attach_type type,
98 u32 flags);112 u32 flags);
99int cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog,113int cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog,
100 enum bpf_attach_type type, u32 flags);114 enum bpf_attach_type type);
115int cgroup_bpf_replace(struct bpf_link *link, struct bpf_prog *old_prog,
116 struct bpf_prog *new_prog);
101int cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,117int cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,
102 union bpf_attr __user *uattr);118 union bpf_attr __user *uattr);
103 119
@@ -332,11 +348,13 @@ int cgroup_bpf_prog_attach(const union bpf_attr *attr, · 228 unmodified lines
332 enum bpf_prog_type ptype, struct bpf_prog *prog);348 enum bpf_prog_type ptype, struct bpf_prog *prog);
333int cgroup_bpf_prog_detach(const union bpf_attr *attr,349int cgroup_bpf_prog_detach(const union bpf_attr *attr,
334 enum bpf_prog_type ptype);350 enum bpf_prog_type ptype);
351int cgroup_bpf_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);
335int cgroup_bpf_prog_query(const union bpf_attr *attr,352int cgroup_bpf_prog_query(const union bpf_attr *attr,
336 union bpf_attr __user *uattr);353 union bpf_attr __user *uattr);
337#else354#else
338 355
339struct bpf_prog;356struct bpf_prog;
357struct bpf_link;
340struct cgroup_bpf {};358struct cgroup_bpf {};
341static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; }359static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; }
342static inline void cgroup_bpf_offline(struct cgroup *cgrp) {}360static 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
354 return -EINVAL;372 return -EINVAL;
355}373}
356 374
375static inline int cgroup_bpf_link_attach(const union bpf_attr *attr,
376 struct bpf_prog *prog)
377{
378 return -EINVAL;
379}
380
381static 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
357static inline int cgroup_bpf_prog_query(const union bpf_attr *attr,388static inline int cgroup_bpf_prog_query(const union bpf_attr *attr,
358 union bpf_attr __user *uattr)389 union bpf_attr __user *uattr)
359{390{
include/linux/bpf.h+131−33
@@ -18,6 +18,7 @@ · 17 unmodified lines
18#include <linux/refcount.h>18#include <linux/refcount.h>
19#include <linux/mutex.h>19#include <linux/mutex.h>
20#include <linux/module.h>20#include <linux/module.h>
21#include <linux/kallsyms.h>
21 22
22struct bpf_verifier_env;23struct bpf_verifier_env;
23struct bpf_verifier_log;24struct bpf_verifier_log;
@@ -160,6 +161,7 @@ static inline void copy_map_value(struct bpf_map *map, void *dst, void *src) · 136 unmodified lines
160}161}
161void copy_map_value_locked(struct bpf_map *map, void *dst, void *src,162void copy_map_value_locked(struct bpf_map *map, void *dst, void *src,
162 bool lock_src);163 bool lock_src);
164int bpf_obj_name_cpy(char *dst, const char *src, unsigned int size);
163 165
164struct bpf_offload_dev;166struct bpf_offload_dev;
165struct bpf_offloaded_map;167struct bpf_offloaded_map;
@@ -232,6 +234,7 @@ enum bpf_arg_type { · 66 unmodified lines
232 ARG_CONST_SIZE_OR_ZERO, /* number of bytes accessed from memory or 0 */234 ARG_CONST_SIZE_OR_ZERO, /* number of bytes accessed from memory or 0 */
233 235
234 ARG_PTR_TO_CTX, /* pointer to context */236 ARG_PTR_TO_CTX, /* pointer to context */
237 ARG_PTR_TO_CTX_OR_NULL, /* pointer to context or NULL */
235 ARG_ANYTHING, /* any (initialized) argument is ok */238 ARG_ANYTHING, /* any (initialized) argument is ok */
236 ARG_PTR_TO_SPIN_LOCK, /* pointer to bpf_spin_lock */239 ARG_PTR_TO_SPIN_LOCK, /* pointer to bpf_spin_lock */
237 ARG_PTR_TO_SOCK_COMMON, /* pointer to sock_common */240 ARG_PTR_TO_SOCK_COMMON, /* pointer to sock_common */
@@ -433,6 +436,16 @@ struct btf_func_model { · 195 unmodified lines
433 */436 */
434#define BPF_TRAMP_F_SKIP_FRAME BIT(2)437#define BPF_TRAMP_F_SKIP_FRAME BIT(2)
435 438
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
444struct bpf_tramp_progs {
445 struct bpf_prog *progs[BPF_MAX_TRAMP_PROGS];
446 int nr_progs;
447};
448
436/* Different use cases for BPF trampoline:449/* Different use cases for BPF trampoline:
437 * 1. replace nop at the function entry (kprobe equivalent)450 * 1. replace nop at the function entry (kprobe equivalent)
438 * flags = BPF_TRAMP_F_RESTORE_REGS451 * flags = BPF_TRAMP_F_RESTORE_REGS
@@ -455,16 +468,25 @@ struct btf_func_model { · 16 unmodified lines
455 */468 */
456int arch_prepare_bpf_trampoline(void *image, void *image_end,469int arch_prepare_bpf_trampoline(void *image, void *image_end,
457 const struct btf_func_model *m, u32 flags,470 const struct btf_func_model *m, u32 flags,
458 struct bpf_prog **fentry_progs, int fentry_cnt,471 struct bpf_tramp_progs *tprogs,
459 struct bpf_prog **fexit_progs, int fexit_cnt,
460 void *orig_call);472 void *orig_call);
461/* these two functions are called from generated trampoline */473/* these two functions are called from generated trampoline */
462u64 notrace __bpf_prog_enter(void);474u64 notrace __bpf_prog_enter(void);
463void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start);475void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start);
464 476
477struct 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
465enum bpf_tramp_prog_type {486enum bpf_tramp_prog_type {
466 BPF_TRAMP_FENTRY,487 BPF_TRAMP_FENTRY,
467 BPF_TRAMP_FEXIT,488 BPF_TRAMP_FEXIT,
489 BPF_TRAMP_MODIFY_RETURN,
468 BPF_TRAMP_MAX,490 BPF_TRAMP_MAX,
469 BPF_TRAMP_REPLACE, /* more than MAX */491 BPF_TRAMP_REPLACE, /* more than MAX */
470};492};
@@ -493,6 +515,7 @@ struct bpf_trampoline { · 22 unmodified lines
493 /* Executable image of trampoline */515 /* Executable image of trampoline */
494 void *image;516 void *image;
495 u64 selector;517 u64 selector;
518 struct bpf_ksym ksym;
496};519};
497 520
498#define BPF_DISPATCHER_MAX 48 /* Fits in 2048B */521#define BPF_DISPATCHER_MAX 48 /* Fits in 2048B */
@@ -510,9 +533,10 @@ struct bpf_dispatcher { · 11 unmodified lines
510 int num_progs;533 int num_progs;
511 void *image;534 void *image;
512 u32 image_off;535 u32 image_off;
536 struct bpf_ksym ksym;
513};537};
514 538
515static __always_inline unsigned int bpf_dispatcher_nopfunc(539static __always_inline unsigned int bpf_dispatcher_nop_func(
516 const void *ctx,540 const void *ctx,
517 const struct bpf_insn *insnsi,541 const struct bpf_insn *insnsi,
518 unsigned int (*bpf_func)(const void *,542 unsigned int (*bpf_func)(const void *,
@@ -525,17 +549,21 @@ struct bpf_trampoline *bpf_trampoline_lookup(u64 key); · 6 unmodified lines
525int bpf_trampoline_link_prog(struct bpf_prog *prog);549int bpf_trampoline_link_prog(struct bpf_prog *prog);
526int bpf_trampoline_unlink_prog(struct bpf_prog *prog);550int bpf_trampoline_unlink_prog(struct bpf_prog *prog);
527void bpf_trampoline_put(struct bpf_trampoline *tr);551void bpf_trampoline_put(struct bpf_trampoline *tr);
528#define BPF_DISPATCHER_INIT(name) { \552#define BPF_DISPATCHER_INIT(_name) { \
529 .mutex = __MUTEX_INITIALIZER(name.mutex), \553 .mutex = __MUTEX_INITIALIZER(_name.mutex), \
530 .func = &name##func, \554 .func = &_name##_func, \
531 .progs = {}, \555 .progs = {}, \
532 .num_progs = 0, \556 .num_progs = 0, \
533 .image = NULL, \557 .image = NULL, \
534 .image_off = 0 \558 .image_off = 0, \
559 .ksym = { \
560 .name = #_name, \
561 .lnode = LIST_HEAD_INIT(_name.ksym.lnode), \
562 }, \
535}563}
536 564
537#define DEFINE_BPF_DISPATCHER(name) \565#define DEFINE_BPF_DISPATCHER(name) \
538 noinline unsigned int name##func( \566 noinline unsigned int bpf_dispatcher_##name##_func( \
539 const void *ctx, \567 const void *ctx, \
540 const struct bpf_insn *insnsi, \568 const struct bpf_insn *insnsi, \
541 unsigned int (*bpf_func)(const void *, \569 unsigned int (*bpf_func)(const void *, \
@@ -543,26 +571,26 @@ void bpf_trampoline_put(struct bpf_trampoline *tr); · 1 unmodified line
543 { \571 { \
544 return bpf_func(ctx, insnsi); \572 return bpf_func(ctx, insnsi); \
545 } \573 } \
546 EXPORT_SYMBOL(name##func); \574 EXPORT_SYMBOL(bpf_dispatcher_##name##_func); \
547 struct bpf_dispatcher name = BPF_DISPATCHER_INIT(name);575 struct bpf_dispatcher bpf_dispatcher_##name = \
576 BPF_DISPATCHER_INIT(bpf_dispatcher_##name);
548#define DECLARE_BPF_DISPATCHER(name) \577#define DECLARE_BPF_DISPATCHER(name) \
549 unsigned int name##func( \578 unsigned int bpf_dispatcher_##name##_func( \
550 const void *ctx, \579 const void *ctx, \
551 const struct bpf_insn *insnsi, \580 const struct bpf_insn *insnsi, \
552 unsigned int (*bpf_func)(const void *, \581 unsigned int (*bpf_func)(const void *, \
553 const struct bpf_insn *)); \582 const struct bpf_insn *)); \
554 extern struct bpf_dispatcher name;583 extern struct bpf_dispatcher bpf_dispatcher_##name;
555#define BPF_DISPATCHER_FUNC(name) name##func584#define BPF_DISPATCHER_FUNC(name) bpf_dispatcher_##name##_func
556#define BPF_DISPATCHER_PTR(name) (&name)585#define BPF_DISPATCHER_PTR(name) (&bpf_dispatcher_##name)
557void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from,586void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from,
558 struct bpf_prog *to);587 struct bpf_prog *to);
559struct bpf_image {588/* Called only from JIT-enabled code, so there's no need for stubs. */
560 struct latch_tree_node tnode;589void *bpf_jit_alloc_exec_page(void);
561 unsigned char data[];590void bpf_image_ksym_add(void *data, struct bpf_ksym *ksym);
562};591void bpf_image_ksym_del(struct bpf_ksym *ksym);
563#define BPF_IMAGE_SIZE (PAGE_SIZE - sizeof(struct bpf_image))592void bpf_ksym_add(struct bpf_ksym *ksym);
564bool is_bpf_image_address(unsigned long address);593void bpf_ksym_del(struct bpf_ksym *ksym);
565void *bpf_image_alloc(void);
566#else594#else
567static inline struct bpf_trampoline *bpf_trampoline_lookup(u64 key)595static inline struct bpf_trampoline *bpf_trampoline_lookup(u64 key)
568{596{
@@ -579,7 +607,7 @@ static inline int bpf_trampoline_unlink_prog(struct bpf_prog *prog) · 10 unmodified lines
579static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {}607static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {}
580#define DEFINE_BPF_DISPATCHER(name)608#define DEFINE_BPF_DISPATCHER(name)
581#define DECLARE_BPF_DISPATCHER(name)609#define DECLARE_BPF_DISPATCHER(name)
582#define BPF_DISPATCHER_FUNC(name) bpf_dispatcher_nopfunc610#define BPF_DISPATCHER_FUNC(name) bpf_dispatcher_nop_func
583#define BPF_DISPATCHER_PTR(name) NULL611#define BPF_DISPATCHER_PTR(name) NULL
584static inline void bpf_dispatcher_change_prog(struct bpf_dispatcher *d,612static inline void bpf_dispatcher_change_prog(struct bpf_dispatcher *d,
585 struct bpf_prog *from,613 struct bpf_prog *from,
@@ -640,8 +668,7 @@ struct bpf_prog_aux { · 54 unmodified lines
640 void *jit_data; /* JIT specific data. arch dependent */668 void *jit_data; /* JIT specific data. arch dependent */
641 struct bpf_jit_poke_descriptor *poke_tab;669 struct bpf_jit_poke_descriptor *poke_tab;
642 u32 size_poke_tab;670 u32 size_poke_tab;
643 struct latch_tree_node ksym_tnode;671 struct bpf_ksym ksym;
644 struct list_head ksym_lnode;
645 const struct bpf_prog_ops *ops;672 const struct bpf_prog_ops *ops;
646 struct bpf_map **used_maps;673 struct bpf_map **used_maps;
647 struct bpf_prog *prog;674 struct bpf_prog *prog;
@@ -859,7 +886,7 @@ struct bpf_prog_array_item { · 211 unmodified lines
859 886
860struct bpf_prog_array {887struct bpf_prog_array {
861 struct rcu_head rcu;888 struct rcu_head rcu;
862 struct bpf_prog_array_item items[0];889 struct bpf_prog_array_item items[];
863};890};
864 891
865struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags);892struct 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
885 struct bpf_prog *_prog; \912 struct bpf_prog *_prog; \
886 struct bpf_prog_array *_array; \913 struct bpf_prog_array *_array; \
887 u32 _ret = 1; \914 u32 _ret = 1; \
888 preempt_disable(); \915 migrate_disable(); \
889 rcu_read_lock(); \916 rcu_read_lock(); \
890 _array = rcu_dereference(array); \917 _array = rcu_dereference(array); \
891 if (unlikely(check_non_null && !_array))\918 if (unlikely(check_non_null && !_array))\
@@ -898,7 +925,7 @@ int bpf_prog_array_copy(struct bpf_prog_array *old_array, · 6 unmodified lines
898 } \925 } \
899_out: \926_out: \
900 rcu_read_unlock(); \927 rcu_read_unlock(); \
901 preempt_enable(); \928 migrate_enable(); \
902 _ret; \929 _ret; \
903 })930 })
904 931
@@ -932,7 +959,7 @@ _out: \ · 27 unmodified lines
932 u32 ret; \959 u32 ret; \
933 u32 _ret = 1; \960 u32 _ret = 1; \
934 u32 _cn = 0; \961 u32 _cn = 0; \
935 preempt_disable(); \962 migrate_disable(); \
936 rcu_read_lock(); \963 rcu_read_lock(); \
937 _array = rcu_dereference(array); \964 _array = rcu_dereference(array); \
938 _item = &_array->items[0]; \965 _item = &_array->items[0]; \
@@ -944,7 +971,7 @@ _out: \ · 5 unmodified lines
944 _item++; \971 _item++; \
945 } \972 } \
946 rcu_read_unlock(); \973 rcu_read_unlock(); \
947 preempt_enable(); \974 migrate_enable(); \
948 if (_ret) \975 if (_ret) \
949 _ret = (_cn ? NET_XMIT_CN : NET_XMIT_SUCCESS); \976 _ret = (_cn ? NET_XMIT_CN : NET_XMIT_SUCCESS); \
950 else \977 else \
@@ -961,6 +988,36 @@ _out: \ · 10 unmodified lines
961#ifdef CONFIG_BPF_SYSCALL988#ifdef CONFIG_BPF_SYSCALL
962DECLARE_PER_CPU(int, bpf_prog_active);989DECLARE_PER_CPU(int, bpf_prog_active);
963 990
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 */
1003static 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
1012static 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
964extern const struct file_operations bpf_map_fops;1021extern const struct file_operations bpf_map_fops;
965extern const struct file_operations bpf_prog_fops;1022extern const struct file_operations bpf_prog_fops;
966 1023
@@ -993,6 +1050,7 @@ void __bpf_free_used_maps(struct bpf_prog_aux *aux, · 26 unmodified lines
993void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock);1050void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock);
994void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock);1051void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock);
995 1052
1053struct bpf_map *bpf_map_get(u32 ufd);
996struct bpf_map *bpf_map_get_with_uref(u32 ufd);1054struct bpf_map *bpf_map_get_with_uref(u32 ufd);
997struct bpf_map *__bpf_map_get(struct fd f);1055struct bpf_map *__bpf_map_get(struct fd f);
998void bpf_map_inc(struct bpf_map *map);1056void bpf_map_inc(struct bpf_map *map);
@@ -1025,6 +1083,29 @@ extern int sysctl_unprivileged_bpf_disabled; · 26 unmodified lines
1025int bpf_map_new_fd(struct bpf_map *map, int flags);1083int bpf_map_new_fd(struct bpf_map *map, int flags);
1026int bpf_prog_new_fd(struct bpf_prog *prog);1084int bpf_prog_new_fd(struct bpf_prog *prog);
1027 1085
1086struct 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
1093struct bpf_link_ops {
1094 void (*release)(struct bpf_link *link);
1095 void (*dealloc)(struct bpf_link *link);
1096
1097};
1098
1099void bpf_link_init(struct bpf_link *link, const struct bpf_link_ops *ops,
1100 struct bpf_prog *prog);
1101void bpf_link_cleanup(struct bpf_link *link, struct file *link_file,
1102 int link_fd);
1103void bpf_link_inc(struct bpf_link *link);
1104void bpf_link_put(struct bpf_link *link);
1105int bpf_link_new_fd(struct bpf_link *link);
1106struct file *bpf_link_new_file(struct bpf_link *link, int *reserved_fd);
1107struct bpf_link *bpf_link_get_from_fd(u32 ufd);
1108
1028int bpf_obj_pin_user(u32 ufd, const char __user *pathname);1109int bpf_obj_pin_user(u32 ufd, const char __user *pathname);
1029int bpf_obj_get_user(const char __user *pathname, int flags);1110int bpf_obj_get_user(const char __user *pathname, int flags);
1030 1111
@@ -1102,6 +1183,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, · 71 unmodified lines
1102 union bpf_attr __user *uattr);1183 union bpf_attr __user *uattr);
1103int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,1184int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
1104 union bpf_attr __user *uattr);1185 union bpf_attr __user *uattr);
1186int bpf_prog_test_run_tracing(struct bpf_prog *prog,
1187 const union bpf_attr *kattr,
1188 union bpf_attr __user *uattr);
1105int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,1189int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
1106 const union bpf_attr *kattr,1190 const union bpf_attr *kattr,
1107 union bpf_attr __user *uattr);1191 union bpf_attr __user *uattr);
@@ -1259,6 +1343,13 @@ static inline int bpf_prog_test_run_skb(struct bpf_prog *prog, · 151 unmodified lines
1259 return -ENOTSUPP;1343 return -ENOTSUPP;
1260}1344}
1261 1345
1346static 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
1262static inline int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,1353static inline int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
1263 const union bpf_attr *kattr,1354 const union bpf_attr *kattr,
1264 union bpf_attr __user *uattr)1355 union bpf_attr __user *uattr)
@@ -1355,6 +1446,8 @@ static inline void bpf_map_offload_map_free(struct bpf_map *map) · 90 unmodified lines
1355#if defined(CONFIG_BPF_STREAM_PARSER)1446#if defined(CONFIG_BPF_STREAM_PARSER)
1356int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, u32 which);1447int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, u32 which);
1357int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog);1448int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog);
1449void sock_map_unhash(struct sock *sk);
1450void sock_map_close(struct sock *sk, long timeout);
1358#else1451#else
1359static inline int sock_map_prog_update(struct bpf_map *map,1452static inline int sock_map_prog_update(struct bpf_map *map,
1360 struct bpf_prog *prog, u32 which)1453 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
1367{1460{
1368 return -EINVAL;1461 return -EINVAL;
1369}1462}
1370#endif1463#endif /* CONFIG_BPF_STREAM_PARSER */
1371 1464
1372#if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL)1465#if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL)
1373void bpf_sk_reuseport_detach(struct sock *sk);1466void bpf_sk_reuseport_detach(struct sock *sk);
@@ -1417,6 +1510,7 @@ extern const struct bpf_func_proto bpf_get_stack_proto; · 43 unmodified lines
1417extern const struct bpf_func_proto bpf_sock_map_update_proto;1510extern const struct bpf_func_proto bpf_sock_map_update_proto;
1418extern const struct bpf_func_proto bpf_sock_hash_update_proto;1511extern const struct bpf_func_proto bpf_sock_hash_update_proto;
1419extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto;1512extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto;
1513extern const struct bpf_func_proto bpf_get_current_ancestor_cgroup_id_proto;
1420extern const struct bpf_func_proto bpf_msg_redirect_hash_proto;1514extern const struct bpf_func_proto bpf_msg_redirect_hash_proto;
1421extern const struct bpf_func_proto bpf_msg_redirect_map_proto;1515extern const struct bpf_func_proto bpf_msg_redirect_map_proto;
1422extern const struct bpf_func_proto bpf_sk_redirect_hash_proto;1516extern 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
1428extern const struct bpf_func_proto bpf_strtoul_proto;1522extern const struct bpf_func_proto bpf_strtoul_proto;
1429extern const struct bpf_func_proto bpf_tcp_sock_proto;1523extern const struct bpf_func_proto bpf_tcp_sock_proto;
1430extern const struct bpf_func_proto bpf_jiffies64_proto;1524extern const struct bpf_func_proto bpf_jiffies64_proto;
1525extern const struct bpf_func_proto bpf_get_ns_current_pid_tgid_proto;
1526
1527const struct bpf_func_proto *bpf_tracing_func_proto(
1528 enum bpf_func_id func_id, const struct bpf_prog *prog);
1431 1529
1432/* Shared helpers among cBPF and eBPF. */1530/* Shared helpers among cBPF and eBPF. */
1433void bpf_user_rnd_init_once(void);1531void 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
20int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog,
21 const struct bpf_prog *prog);
22
23#else /* !CONFIG_BPF_LSM */
24
25static 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
70 void *, void *)70 void *, void *)
71BPF_PROG_TYPE(BPF_PROG_TYPE_EXT, bpf_extension,71BPF_PROG_TYPE(BPF_PROG_TYPE_EXT, bpf_extension,
72 void *, void *)72 void *, void *)
73#ifdef CONFIG_BPF_LSM
74BPF_PROG_TYPE(BPF_PROG_TYPE_LSM, lsm,
75 void *, void *)
76#endif /* CONFIG_BPF_LSM */
73#endif77#endif
74 78
75BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops)79BPF_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
123 s64 smax_value; /* maximum possible (s64)value */123 s64 smax_value; /* maximum possible (s64)value */
124 u64 umin_value; /* minimum possible (u64)value */124 u64 umin_value; /* minimum possible (u64)value */
125 u64 umax_value; /* maximum possible (u64)value */125 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 */
126 /* parentage chain for liveness checking */130 /* parentage chain for liveness checking */
127 struct bpf_reg_state *parent;131 struct bpf_reg_state *parent;
128 /* Inside the callee two registers can be both PTR_TO_STACK like132 /* 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
79#define MII_BCM54XX_ECR 0x10 /* BCM54xx extended control register */79#define MII_BCM54XX_ECR 0x10 /* BCM54xx extended control register */
80#define MII_BCM54XX_ECR_IM 0x1000 /* Interrupt mask */80#define MII_BCM54XX_ECR_IM 0x1000 /* Interrupt mask */
81#define MII_BCM54XX_ECR_IF 0x0800 /* Interrupt force */81#define MII_BCM54XX_ECR_IF 0x0800 /* Interrupt force */
82#define MII_BCM54XX_ECR_FIFOE 0x0001 /* FIFO elasticity */
82 83
83#define MII_BCM54XX_ESR 0x11 /* BCM54xx extended status register */84#define MII_BCM54XX_ESR 0x11 /* BCM54xx extended status register */
84#define MII_BCM54XX_ESR_IS 0x1000 /* Interrupt status */85#define MII_BCM54XX_ESR_IS 0x1000 /* Interrupt status */
@@ -119,6 +120,7 @@ · 34 unmodified lines
119#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x00120#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x00
120#define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400121#define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400
121#define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800122#define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800
123#define MII_BCM54XX_AUXCTL_ACTL_EXT_PKT_LEN 0x4000
122 124
123#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x07125#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x07
124#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN 0x0010126#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
22 BH_Dirty, /* Is dirty */22 BH_Dirty, /* Is dirty */
23 BH_Lock, /* Is locked */23 BH_Lock, /* Is locked */
24 BH_Req, /* Has been submitted for I/O */24 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 */
28 25
29 BH_Mapped, /* Has a disk mapping */26 BH_Mapped, /* Has a disk mapping */
30 BH_New, /* Disk mapping was newly created by get_block */27 BH_New, /* Disk mapping was newly created by get_block */
@@ -76,6 +73,9 @@ struct buffer_head { · 45 unmodified lines
76 struct address_space *b_assoc_map; /* mapping this buffer is73 struct address_space *b_assoc_map; /* mapping this buffer is
77 associated with */74 associated with */
78 atomic_t b_count; /* users using this buffer_head */75 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 */
79};79};
80 80
81/*81/*
include/linux/ceph/ceph_fs.h+16−2
@@ -444,8 +444,9 @@ union ceph_mds_request_args { · 443 unmodified lines
444 } __attribute__ ((packed)) lookupino;444 } __attribute__ ((packed)) lookupino;
445} __attribute__ ((packed));445} __attribute__ ((packed));
446 446
447#define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */447#define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
448#define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */448#define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */
449#define CEPH_MDS_FLAG_ASYNC 4 /* request is asynchronous */
449 450
450struct ceph_mds_request_head {451struct ceph_mds_request_head {
451 __le64 oldest_client_tid;452 __le64 oldest_client_tid;
@@ -530,6 +531,9 @@ struct ceph_mds_reply_lease { · 78 unmodified lines
530 __le32 seq;531 __le32 seq;
531} __attribute__ ((packed));532} __attribute__ ((packed));
532 533
534#define CEPH_LEASE_VALID (1 | 2) /* old and new bit values */
535#define CEPH_LEASE_PRIMARY_LINK 4 /* primary linkage */
536
533struct ceph_mds_reply_dirfrag {537struct ceph_mds_reply_dirfrag {
534 __le32 frag; /* fragment */538 __le32 frag; /* fragment */
535 __le32 auth; /* auth mds, if this is a delegation point */539 __le32 auth; /* auth mds, if this is a delegation point */
@@ -564,6 +568,7 @@ struct ceph_filelock { · 28 unmodified lines
564#define CEPH_FILE_MODE_RDWR 3 /* RD | WR */568#define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
565#define CEPH_FILE_MODE_LAZY 4 /* lazy io */569#define CEPH_FILE_MODE_LAZY 4 /* lazy io */
566#define CEPH_FILE_MODE_BITS 4570#define CEPH_FILE_MODE_BITS 4
571#define CEPH_FILE_MODE_MASK ((1 << CEPH_FILE_MODE_BITS) - 1)
567 572
568int ceph_flags_to_mode(int flags);573int ceph_flags_to_mode(int flags);
569 574
@@ -655,10 +660,19 @@ int ceph_flags_to_mode(int flags); · 85 unmodified lines
655#define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \660#define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \
656 CEPH_CAP_ANY_FILE_WR | CEPH_CAP_FILE_LAZYIO | \661 CEPH_CAP_ANY_FILE_WR | CEPH_CAP_FILE_LAZYIO | \
657 CEPH_CAP_PIN)662 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)
658 666
659#define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \667#define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
660 CEPH_LOCK_IXATTR)668 CEPH_LOCK_IXATTR)
661 669
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
662int ceph_caps_for_mode(int mode);676int ceph_caps_for_mode(int mode);
663 677
664enum {678enum {
include/linux/ceph/debugfs.h+0−14
@@ -2,22 +2,8 @@ · 1 unmodified line
2#ifndef _FS_CEPH_DEBUGFS_H2#ifndef _FS_CEPH_DEBUGFS_H
3#define _FS_CEPH_DEBUGFS_H3#define _FS_CEPH_DEBUGFS_H
4 4
5#include <linux/ceph/ceph_debug.h>
6#include <linux/ceph/types.h>5#include <linux/ceph/types.h>
7 6
8#define CEPH_DEFINE_SHOW_FUNC(name) \
9static int name##_open(struct inode *inode, struct file *file) \
10{ \
11 return single_open(file, name, inode->i_private); \
12} \
13 \
14static const struct file_operations name##_fops = { \
15 .open = name##_open, \
16 .read = seq_read, \
17 .llseek = seq_lseek, \
18 .release = single_release, \
19};
20
21/* debugfs.c */7/* debugfs.c */
22extern void ceph_debugfs_init(void);8extern void ceph_debugfs_init(void);
23extern void ceph_debugfs_cleanup(void);9extern 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
272extern struct kmem_cache *ceph_dentry_cachep;272extern struct kmem_cache *ceph_dentry_cachep;
273extern struct kmem_cache *ceph_file_cachep;273extern struct kmem_cache *ceph_file_cachep;
274extern struct kmem_cache *ceph_dir_file_cachep;274extern struct kmem_cache *ceph_dir_file_cachep;
275extern struct kmem_cache *ceph_mds_request_cachep;
275 276
276/* ceph_common.c */277/* ceph_common.c */
277extern bool libceph_compatible(void *data);278extern bool libceph_compatible(void *data);
include/linux/ceph/messenger.h+4−3
@@ -175,9 +175,10 @@ struct ceph_msg_data { · 174 unmodified lines
175#endif /* CONFIG_BLOCK */175#endif /* CONFIG_BLOCK */
176 struct ceph_bvec_iter bvec_pos;176 struct ceph_bvec_iter bvec_pos;
177 struct {177 struct {
178 struct page **pages; /* NOT OWNER. */178 struct page **pages;
179 size_t length; /* total # bytes */179 size_t length; /* total # bytes */
180 unsigned int alignment; /* first page */180 unsigned int alignment; /* first page */
181 bool own_pages;
181 };182 };
182 struct ceph_pagelist *pagelist;183 struct ceph_pagelist *pagelist;
183 };184 };
@@ -356,8 +357,8 @@ extern void ceph_con_keepalive(struct ceph_connection *con); · 172 unmodified lines
356extern bool ceph_con_keepalive_expired(struct ceph_connection *con,357extern bool ceph_con_keepalive_expired(struct ceph_connection *con,
357 unsigned long interval);358 unsigned long interval);
358 359
359extern void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,360void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
360 size_t length, size_t alignment);361 size_t length, size_t alignment, bool own_pages);
361extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg,362extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg,
362 struct ceph_pagelist *pagelist);363 struct ceph_pagelist *pagelist);
363#ifdef CONFIG_BLOCK364#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
509 struct page *req_page, size_t req_len,509 struct page *req_page, size_t req_len,
510 struct page **resp_pages, size_t *resp_len);510 struct page **resp_pages, size_t *resp_len);
511 511
512extern 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
520extern 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
529int ceph_osdc_copy_from(struct ceph_osd_client *osdc,512int ceph_osdc_copy_from(struct ceph_osd_client *osdc,
530 u64 src_snapid, u64 src_version,513 u64 src_snapid, u64 src_version,
531 struct ceph_object_id *src_oid,514 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
37#define CEPH_POOL_FLAG_HASHPSPOOL (1ULL << 0) /* hash pg seed and pool id37#define CEPH_POOL_FLAG_HASHPSPOOL (1ULL << 0) /* hash pg seed and pool id
38 together */38 together */
39#define CEPH_POOL_FLAG_FULL (1ULL << 1) /* pool is full */39#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 */
40 43
41struct ceph_pg_pool_info {44struct ceph_pg_pool_info {
42 struct rb_node node;45 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
304 307
305extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id);308extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id);
306extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name);309extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name);
310u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id);
307 311
308#endif312#endif
include/linux/ceph/rados.h+4−2
@@ -143,8 +143,10 @@ extern const char *ceph_osd_state_name(int s); · 142 unmodified lines
143/*143/*
144 * osd map flag bits144 * osd map flag bits
145 */145 */
146#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */146#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC),
147#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */147 not set since ~luminous */
148#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC),
149 not set since ~luminous */
148#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */150#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
149#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */151#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
150#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */152#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
include/linux/cgroup-defs.h+8−2
@@ -94,6 +94,11 @@ enum { · 93 unmodified lines
94 * Enable legacy local memory.events.94 * Enable legacy local memory.events.
95 */95 */
96 CGRP_ROOT_MEMORY_LOCAL_EVENTS = (1 << 5),96 CGRP_ROOT_MEMORY_LOCAL_EVENTS = (1 << 5),
97
98 /*
99 * Enable recursive subtree protection
100 */
101 CGRP_ROOT_MEMORY_RECURSIVE_PROT = (1 << 6),
97};102};
98 103
99/* cftype->flags */104/* cftype->flags */
@@ -628,8 +633,9 @@ struct cgroup_subsys { · 528 unmodified lines
628 void (*cancel_attach)(struct cgroup_taskset *tset);633 void (*cancel_attach)(struct cgroup_taskset *tset);
629 void (*attach)(struct cgroup_taskset *tset);634 void (*attach)(struct cgroup_taskset *tset);
630 void (*post_attach)(void);635 void (*post_attach)(void);
631 int (*can_fork)(struct task_struct *task);636 int (*can_fork)(struct task_struct *task,
632 void (*cancel_fork)(struct task_struct *task);637 struct css_set *cset);
638 void (*cancel_fork)(struct task_struct *task, struct css_set *cset);
633 void (*fork)(struct task_struct *task);639 void (*fork)(struct task_struct *task);
634 void (*exit)(struct task_struct *task);640 void (*exit)(struct task_struct *task);
635 void (*release)(struct task_struct *task);641 void (*release)(struct task_struct *task);
include/linux/cgroup.h+15−9
@@ -27,6 +27,8 @@ · 26 unmodified lines
27 27
28#include <linux/cgroup-defs.h>28#include <linux/cgroup-defs.h>
29 29
30struct kernel_clone_args;
31
30#ifdef CONFIG_CGROUPS32#ifdef CONFIG_CGROUPS
31 33
32/*34/*
@@ -58,10 +60,8 @@ struct css_task_iter { · 25 unmodified lines
58 struct list_head *tcset_head;60 struct list_head *tcset_head;
59 61
60 struct list_head *task_pos;62 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;
64 63
64 struct list_head *cur_tasks_head;
65 struct css_set *cur_cset;65 struct css_set *cur_cset;
66 struct css_set *cur_dcset;66 struct css_set *cur_dcset;
67 struct task_struct *cur_task;67 struct task_struct *cur_task;
@@ -121,9 +121,12 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns, · 53 unmodified lines
121 struct pid *pid, struct task_struct *tsk);121 struct pid *pid, struct task_struct *tsk);
122 122
123void cgroup_fork(struct task_struct *p);123void cgroup_fork(struct task_struct *p);
124extern int cgroup_can_fork(struct task_struct *p);124extern int cgroup_can_fork(struct task_struct *p,
125extern void cgroup_cancel_fork(struct task_struct *p);125 struct kernel_clone_args *kargs);
126extern void cgroup_post_fork(struct task_struct *p);126extern void cgroup_cancel_fork(struct task_struct *p,
127 struct kernel_clone_args *kargs);
128extern void cgroup_post_fork(struct task_struct *p,
129 struct kernel_clone_args *kargs);
127void cgroup_exit(struct task_struct *p);130void cgroup_exit(struct task_struct *p);
128void cgroup_release(struct task_struct *p);131void cgroup_release(struct task_struct *p);
129void cgroup_free(struct task_struct *p);132void cgroup_free(struct task_struct *p);
@@ -707,9 +710,12 @@ static inline int cgroupstats_build(struct cgroupstats *stats, · 577 unmodified lines
707 struct dentry *dentry) { return -EINVAL; }710 struct dentry *dentry) { return -EINVAL; }
708 711
709static inline void cgroup_fork(struct task_struct *p) {}712static inline void cgroup_fork(struct task_struct *p) {}
710static inline int cgroup_can_fork(struct task_struct *p) { return 0; }713static inline int cgroup_can_fork(struct task_struct *p,
711static inline void cgroup_cancel_fork(struct task_struct *p) {}714 struct kernel_clone_args *kargs) { return 0; }
712static inline void cgroup_post_fork(struct task_struct *p) {}715static inline void cgroup_cancel_fork(struct task_struct *p,
716 struct kernel_clone_args *kargs) {}
717static inline void cgroup_post_fork(struct task_struct *p,
718 struct kernel_clone_args *kargs) {}
713static inline void cgroup_exit(struct task_struct *p) {}719static inline void cgroup_exit(struct task_struct *p) {}
714static inline void cgroup_release(struct task_struct *p) {}720static inline void cgroup_release(struct task_struct *p) {}
715static inline void cgroup_free(struct task_struct *p) {}721static 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
522 * @clk_gate_flags: gate-specific flags for this clock522 * @clk_gate_flags: gate-specific flags for this clock
523 * @lock: shared register lock for this clock523 * @lock: shared register lock for this clock
524 */524 */
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, \
526 bit_idx, clk_gate_flags, lock) \526 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), \
528 NULL, (flags), (reg), (bit_idx), \528 NULL, (flags), (reg), (bit_idx), \
529 (clk_gate_flags), (lock))529 (clk_gate_flags), (lock))
530/**530/**
@@ -539,10 +539,10 @@ struct clk *clk_register_gate(struct device *dev, const char *name, · 8 unmodified lines
539 * @clk_gate_flags: gate-specific flags for this clock539 * @clk_gate_flags: gate-specific flags for this clock
540 * @lock: shared register lock for this clock540 * @lock: shared register lock for this clock
541 */541 */
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, \
543 bit_idx, clk_gate_flags, lock) \543 bit_idx, clk_gate_flags, lock) \
544 __clk_hw_register_gate((dev), NULL, (name), (parent_name), NULL, \544 __clk_hw_register_gate((dev), NULL, (name), NULL, NULL, (parent_data), \
545 NULL, (flags), (reg), (bit_idx), \545 (flags), (reg), (bit_idx), \
546 (clk_gate_flags), (lock))546 (clk_gate_flags), (lock))
547void clk_unregister_gate(struct clk *clk);547void clk_unregister_gate(struct clk *clk);
548void clk_hw_unregister_gate(struct clk_hw *hw);548void clk_hw_unregister_gate(struct clk_hw *hw);
include/linux/clk/at91_pmc.h+23−0
@@ -12,6 +12,9 @@ · 11 unmodified lines
12#ifndef AT91_PMC_H12#ifndef AT91_PMC_H
13#define AT91_PMC_H13#define AT91_PMC_H
14 14
15#define AT91_PMC_V1 (1) /* PMC version 1 */
16#define AT91_PMC_V2 (2) /* PMC version 2 [SAM9X60] */
17
15#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */18#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
16#define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */19#define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */
17 20
@@ -30,16 +33,34 @@ · 12 unmodified lines
30#define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */33#define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */
31#define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */34#define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */
32 35
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
33#define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */43#define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */
34#define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */44#define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */
35#define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */45#define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */
36 46
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
37#define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */53#define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */
38#define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */54#define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */
39#define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */55#define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */
40#define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */56#define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */
41#define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */57#define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */
42 58
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
43#define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */64#define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */
44#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */65#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
45#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */66#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */
@@ -180,6 +201,8 @@ · 134 unmodified lines
180#define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */201#define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */
181#define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */202#define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */
182 203
204#define AT91_PMC_PLL_ISR0 0xEC /* PLL Interrupt Status Register 0 [SAM9X60 only] */
205
183#define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/206#define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/
184#define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */207#define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */
185#define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */208#define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */
include/linux/clocksource.h+52−41
@@ -23,18 +23,31 @@ · 22 unmodified lines
23struct clocksource;23struct clocksource;
24struct module;24struct module;
25 25
26#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA26#if defined(CONFIG_ARCH_CLOCKSOURCE_DATA) || \
27 defined(CONFIG_GENERIC_GETTIMEOFDAY)
27#include <asm/clocksource.h>28#include <asm/clocksource.h>
28#endif29#endif
29 30
31#include <vdso/clocksource.h>
32
30/**33/**
31 * struct clocksource - hardware abstraction for a free running counter34 * struct clocksource - hardware abstraction for a free running counter
32 * Provides mostly state-free accessors to the underlying hardware.35 * Provides mostly state-free accessors to the underlying hardware.
33 * This is the structure used for system time.36 * This is the structure used for system time.
34 *37 *
35 * @name: ptr to clocksource name38 * @read: Returns a cycle value, passes clocksource as argument
36 * @list: list head for registration39 * @mask: Bitmask for two's complement
37 * @rating: rating value for selection (higher is better)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)
38 * To avoid rating inflation the following51 * To avoid rating inflation the following
39 * list should give you a guide as to how52 * list should give you a guide as to how
40 * to assign your clocksource a rating53 * to assign your clocksource a rating
@@ -49,27 +62,23 @@ struct module; · 8 unmodified lines
49 * 400-499: Perfect62 * 400-499: Perfect
50 * The ideal clocksource. A must-use where63 * The ideal clocksource. A must-use where
51 * available.64 * available.
52 * @read: returns a cycle value, passes clocksource as argument65 * @flags: Flags describing special properties
53 * @enable: optional function to enable the clocksource66 * @enable: Optional function to enable the clocksource
54 * @disable: optional function to disable the clocksource67 * @disable: Optional function to disable the clocksource
55 * @mask: bitmask for two's complement68 * @suspend: Optional suspend function for the clocksource
56 * subtraction of non 64 bit counters69 * @resume: Optional resume function for the clocksource
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
66 * @mark_unstable: Optional function to inform the clocksource driver that70 * @mark_unstable: Optional function to inform the clocksource driver that
67 * the watchdog marked the clocksource unstable71 * the watchdog marked the clocksource unstable
68 * @owner: module reference, must be set by clocksource in modules72 * @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
69 *78 *
70 * Note: This struct is not used in hotpathes of the timekeeping code79 * Note: This struct is not used in hotpathes of the timekeeping code
71 * because the timekeeper caches the hot path fields in its own data80 * 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,
73 *82 *
74 * The pointer to the clocksource itself is handed to the read83 * The pointer to the clocksource itself is handed to the read
75 * callback. If you need extra information there you can wrap struct84 * callback. If you need extra information there you can wrap struct
@@ -78,35 +87,37 @@ struct module; · 2 unmodified lines
78 * structure.87 * structure.
79 */88 */
80struct clocksource {89struct clocksource {
81 u64 (*read)(struct clocksource *cs);90 u64 (*read)(struct clocksource *cs);
82 u64 mask;91 u64 mask;
83 u32 mult;92 u32 mult;
84 u32 shift;93 u32 shift;
85 u64 max_idle_ns;94 u64 max_idle_ns;
86 u32 maxadj;95 u32 maxadj;
87#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA96#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
88 struct arch_clocksource_data archdata;97 struct arch_clocksource_data archdata;
89#endif98#endif
90 u64 max_cycles;99 u64 max_cycles;
91 const char *name;100 const char *name;
92 struct list_head list;101 struct list_head list;
93 int rating;102 int rating;
94 int (*enable)(struct clocksource *cs);103 enum vdso_clock_mode vdso_clock_mode;
95 void (*disable)(struct clocksource *cs);104 unsigned long flags;
96 unsigned long flags;105
97 void (*suspend)(struct clocksource *cs);106 int (*enable)(struct clocksource *cs);
98 void (*resume)(struct clocksource *cs);107 void (*disable)(struct clocksource *cs);
99 void (*mark_unstable)(struct clocksource *cs);108 void (*suspend)(struct clocksource *cs);
100 void (*tick_stable)(struct clocksource *cs);109 void (*resume)(struct clocksource *cs);
110 void (*mark_unstable)(struct clocksource *cs);
111 void (*tick_stable)(struct clocksource *cs);
101 112
102 /* private: */113 /* private: */
103#ifdef CONFIG_CLOCKSOURCE_WATCHDOG114#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
104 /* Watchdog related data, used by the framework */115 /* Watchdog related data, used by the framework */
105 struct list_head wd_list;116 struct list_head wd_list;
106 u64 cs_last;117 u64 cs_last;
107 u64 wd_last;118 u64 wd_last;
108#endif119#endif
109 struct module *owner;120 struct module *owner;
110};121};
111 122
112/*123/*
include/linux/cma.h+12−2
@@ -4,6 +4,7 @@ · 3 unmodified lines
4 4
5#include <linux/init.h>5#include <linux/init.h>
6#include <linux/types.h>6#include <linux/types.h>
7#include <linux/numa.h>
7 8
8/*9/*
9 * There is always at least global CMA area and a few optional10 * 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
24extern unsigned long cma_get_size(const struct cma *cma);25extern unsigned long cma_get_size(const struct cma *cma);
25extern const char *cma_get_name(const struct cma *cma);26extern const char *cma_get_name(const struct cma *cma);
26 27
27extern int __init cma_declare_contiguous(phys_addr_t base,28extern int __init cma_declare_contiguous_nid(phys_addr_t base,
28 phys_addr_t size, phys_addr_t limit,29 phys_addr_t size, phys_addr_t limit,
29 phys_addr_t alignment, unsigned int order_per_bit,30 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);
33static 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}
31extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,41extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
32 unsigned int order_per_bit,42 unsigned int order_per_bit,
33 const char *name,43 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
454 454
455int compat_restore_altstack(const compat_stack_t __user *uss);455int compat_restore_altstack(const compat_stack_t __user *uss);
456int __compat_save_altstack(compat_stack_t __user *, unsigned long);456int __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 { \
458 compat_stack_t __user *__uss = uss; \458 compat_stack_t __user *__uss = uss; \
459 struct task_struct *t = current; \459 struct task_struct *t = current; \
460 put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \460 unsafe_put_user(ptr_to_compat((void __user *)t->sas_ss_sp), \
461 put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \461 &__uss->ss_sp, label); \
462 put_user_ex(t->sas_ss_size, &__uss->ss_size); \462 unsafe_put_user(t->sas_ss_flags, &__uss->ss_flags, label); \
463 unsafe_put_user(t->sas_ss_size, &__uss->ss_size, label); \
463 if (t->sas_ss_flags & SS_AUTODISARM) \464 if (t->sas_ss_flags & SS_AUTODISARM) \
464 sas_ss_reset(t); \465 sas_ss_reset(t); \
465} while (0);466} while (0);
include/linux/compiler.h+1−1
@@ -347,7 +347,7 @@ static inline void *offset_to_ptr(const int *off) · 346 unmodified lines
347 * compiler has support to do so.347 * compiler has support to do so.
348 */348 */
349#define compiletime_assert(condition, msg) \349#define compiletime_assert(condition, msg) \
350 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)350 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
351 351
352#define compiletime_assert_atomic_type(t) \352#define compiletime_assert_atomic_type(t) \
353 compiletime_assert(__native_word(t), \353 compiletime_assert(__native_word(t), \
include/linux/compiler_types.h+1−10
@@ -129,22 +129,13 @@ struct ftrace_likely_data { · 128 unmodified lines
129#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)129#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
130 130
131/*131/*
132 * Force always-inline if the user requests it so via the .config.
133 * Prefer gnu_inline, so that extern inline functions do not emit an132 * Prefer gnu_inline, so that extern inline functions do not emit an
134 * externally visible function. This makes extern inline behave as per gnu89133 * externally visible function. This makes extern inline behave as per gnu89
135 * semantics rather than c99. This prevents multiple symbol definition errors134 * semantics rather than c99. This prevents multiple symbol definition errors
136 * of extern inline functions at link time.135 * of extern inline functions at link time.
137 * A lot of inline functions can cause havoc with function tracing.136 * 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).
140 */137 */
141#if !defined(CONFIG_OPTIMIZE_INLINING)138#define inline inline __gnu_inline __inline_maybe_unused notrace
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
148 139
149/*140/*
150 * gcc provides both __inline__ and __inline as alternate spellings of141 * gcc provides both __inline__ and __inline as alternate spellings of
include/linux/completion.h+4−4
@@ -9,7 +9,7 @@ · 8 unmodified lines
9 * See kernel/sched/completion.c for details.9 * See kernel/sched/completion.c for details.
10 */10 */
11 11
12#include <linux/wait.h>12#include <linux/swait.h>
13 13
14/*14/*
15 * struct completion - structure used to maintain state for a "completion"15 * struct completion - structure used to maintain state for a "completion"
@@ -25,7 +25,7 @@ · 9 unmodified lines
25 */25 */
26struct completion {26struct completion {
27 unsigned int done;27 unsigned int done;
28 wait_queue_head_t wait;28 struct swait_queue_head wait;
29};29};
30 30
31#define init_completion_map(x, m) __init_completion(x)31#define init_completion_map(x, m) __init_completion(x)
@@ -34,7 +34,7 @@ static inline void complete_acquire(struct completion *x) {} · 2 unmodified lines
34static inline void complete_release(struct completion *x) {}34static inline void complete_release(struct completion *x) {}
35 35
36#define COMPLETION_INITIALIZER(work) \36#define COMPLETION_INITIALIZER(work) \
37 { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }37 { 0, __SWAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
38 38
39#define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \39#define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \
40 (*({ init_completion_map(&(work), &(map)); &(work); }))40 (*({ init_completion_map(&(work), &(map)); &(work); }))
@@ -85,7 +85,7 @@ static inline void complete_release(struct completion *x) {} · 44 unmodified lines
85static inline void __init_completion(struct completion *x)85static inline void __init_completion(struct completion *x)
86{86{
87 x->done = 0;87 x->done = 0;
88 init_waitqueue_head(&x->wait);88 init_swait_queue_head(&x->wait);
89}89}
90 90
91/**91/**
include/linux/console.h+1−0
@@ -148,6 +148,7 @@ struct console { · 147 unmodified lines
148 struct tty_driver *(*device)(struct console *, int *);148 struct tty_driver *(*device)(struct console *, int *);
149 void (*unblank)(void);149 void (*unblank)(void);
150 int (*setup)(struct console *, char *);150 int (*setup)(struct console *, char *);
151 int (*exit)(struct console *);
151 int (*match)(struct console *, char *name, int idx, char *options);152 int (*match)(struct console *, char *name, int idx, char *options);
152 short flags;153 short flags;
153 short index;154 short index;
include/linux/const.h+1−4
@@ -1,9 +1,6 @@
1#ifndef _LINUX_CONST_H1#ifndef _LINUX_CONST_H
2#define _LINUX_CONST_H2#define _LINUX_CONST_H
3 3
4#include <uapi/linux/const.h>4#include <vdso/const.h>
5
6#define UL(x) (_UL(x))
7#define ULL(x) (_ULL(x))
8 5
9#endif /* _LINUX_CONST_H */6#endif /* _LINUX_CONST_H */
include/linux/coresight.h+27−0
@@ -41,6 +41,7 @@ enum coresight_dev_type { · 40 unmodified lines
41 CORESIGHT_DEV_TYPE_LINKSINK,41 CORESIGHT_DEV_TYPE_LINKSINK,
42 CORESIGHT_DEV_TYPE_SOURCE,42 CORESIGHT_DEV_TYPE_SOURCE,
43 CORESIGHT_DEV_TYPE_HELPER,43 CORESIGHT_DEV_TYPE_HELPER,
44 CORESIGHT_DEV_TYPE_ECT,
44};45};
45 46
46enum coresight_dev_subtype_sink {47enum coresight_dev_subtype_sink {
@@ -68,6 +69,12 @@ enum coresight_dev_subtype_helper { · 21 unmodified lines
68 CORESIGHT_DEV_SUBTYPE_HELPER_CATU,69 CORESIGHT_DEV_SUBTYPE_HELPER_CATU,
69};70};
70 71
72/* Embedded Cross Trigger (ECT) sub-types */
73enum coresight_dev_subtype_ect {
74 CORESIGHT_DEV_SUBTYPE_ECT_NONE,
75 CORESIGHT_DEV_SUBTYPE_ECT_CTI,
76};
77
71/**78/**
72 * union coresight_dev_subtype - further characterisation of a type79 * union coresight_dev_subtype - further characterisation of a type
73 * @sink_subtype: type of sink this component is, as defined80 * @sink_subtype: type of sink this component is, as defined
@@ -78,6 +85,8 @@ enum coresight_dev_subtype_helper { · 4 unmodified lines
78 * by @coresight_dev_subtype_source.85 * by @coresight_dev_subtype_source.
79 * @helper_subtype: type of helper this component is, as defined86 * @helper_subtype: type of helper this component is, as defined
80 * by @coresight_dev_subtype_helper.87 * by @coresight_dev_subtype_helper.
88 * @ect_subtype: type of cross trigger this component is, as
89 * defined by @coresight_dev_subtype_ect
81 */90 */
82union coresight_dev_subtype {91union coresight_dev_subtype {
83 /* We have some devices which acts as LINK and SINK */92 /* We have some devices which acts as LINK and SINK */
@@ -87,6 +96,7 @@ union coresight_dev_subtype { · 3 unmodified lines
87 };96 };
88 enum coresight_dev_subtype_source source_subtype;97 enum coresight_dev_subtype_source source_subtype;
89 enum coresight_dev_subtype_helper helper_subtype;98 enum coresight_dev_subtype_helper helper_subtype;
99 enum coresight_dev_subtype_ect ect_subtype;
90};100};
91 101
92/**102/**
@@ -153,6 +163,8 @@ struct coresight_connection { · 60 unmodified lines
153 * activated but not yet enabled. Enabling for a _sink_163 * activated but not yet enabled. Enabling for a _sink_
154 * appens when a source has been selected for that it.164 * appens when a source has been selected for that it.
155 * @ea: Device attribute for sink representation under PMU directory.165 * @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.
156 */168 */
157struct coresight_device {169struct coresight_device {
158 struct coresight_platform_data *pdata;170 struct coresight_platform_data *pdata;
@@ -166,6 +178,8 @@ struct coresight_device { · 7 unmodified lines
166 /* sink specific fields */178 /* sink specific fields */
167 bool activated; /* true only if a sink is part of a path */179 bool activated; /* true only if a sink is part of a path */
168 struct dev_ext_attribute *ea;180 struct dev_ext_attribute *ea;
181 /* cross trigger handling */
182 struct coresight_device *ect_dev;
169};183};
170 184
171/*185/*
@@ -196,6 +210,7 @@ static struct coresight_dev_list (var) = { \ · 24 unmodified lines
196#define sink_ops(csdev) csdev->ops->sink_ops210#define sink_ops(csdev) csdev->ops->sink_ops
197#define link_ops(csdev) csdev->ops->link_ops211#define link_ops(csdev) csdev->ops->link_ops
198#define helper_ops(csdev) csdev->ops->helper_ops212#define helper_ops(csdev) csdev->ops->helper_ops
213#define ect_ops(csdev) csdev->ops->ect_ops
199 214
200/**215/**
201 * struct coresight_ops_sink - basic operations for a sink216 * struct coresight_ops_sink - basic operations for a sink
@@ -262,11 +277,23 @@ struct coresight_ops_helper { · 60 unmodified lines
262 int (*disable)(struct coresight_device *csdev, void *data);277 int (*disable)(struct coresight_device *csdev, void *data);
263};278};
264 279
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 */
286struct coresight_ops_ect {
287 int (*enable)(struct coresight_device *csdev);
288 int (*disable)(struct coresight_device *csdev);
289};
290
265struct coresight_ops {291struct coresight_ops {
266 const struct coresight_ops_sink *sink_ops;292 const struct coresight_ops_sink *sink_ops;
267 const struct coresight_ops_link *link_ops;293 const struct coresight_ops_link *link_ops;
268 const struct coresight_ops_source *source_ops;294 const struct coresight_ops_source *source_ops;
269 const struct coresight_ops_helper *helper_ops;295 const struct coresight_ops_helper *helper_ops;
296 const struct coresight_ops_ect *ect_ops;
270};297};
271 298
272#ifdef CONFIG_CORESIGHT299#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
88 88
89#ifdef CONFIG_SMP89#ifdef CONFIG_SMP
90extern bool cpuhp_tasks_frozen;90extern bool cpuhp_tasks_frozen;
91int cpu_up(unsigned int cpu);91int add_cpu(unsigned int cpu);
92int cpu_device_up(struct device *dev);
92void notify_cpu_starting(unsigned int cpu);93void notify_cpu_starting(unsigned int cpu);
93extern void cpu_maps_update_begin(void);94extern void cpu_maps_update_begin(void);
94extern void cpu_maps_update_done(void);95extern void cpu_maps_update_done(void);
96int bringup_hibernate_cpu(unsigned int sleep_cpu);
97void bringup_nonboot_cpus(unsigned int setup_max_cpus);
95 98
96#else /* CONFIG_SMP */99#else /* CONFIG_SMP */
97#define cpuhp_tasks_frozen 0100#define cpuhp_tasks_frozen 0
@@ -117,7 +120,9 @@ extern void lockdep_assert_cpus_held(void); · 19 unmodified lines
117extern void cpu_hotplug_disable(void);120extern void cpu_hotplug_disable(void);
118extern void cpu_hotplug_enable(void);121extern void cpu_hotplug_enable(void);
119void clear_tasks_mm_cpumask(int cpu);122void clear_tasks_mm_cpumask(int cpu);
120int cpu_down(unsigned int cpu);123int remove_cpu(unsigned int cpu);
124int cpu_device_down(struct device *dev);
125extern void smp_shutdown_nonboot_cpus(unsigned int primary_cpu);
121 126
122#else /* CONFIG_HOTPLUG_CPU */127#else /* CONFIG_HOTPLUG_CPU */
123 128
@@ -129,6 +134,7 @@ static inline int cpus_read_trylock(void) { return true; } · 5 unmodified lines
129static inline void lockdep_assert_cpus_held(void) { }134static inline void lockdep_assert_cpus_held(void) { }
130static inline void cpu_hotplug_disable(void) { }135static inline void cpu_hotplug_disable(void) { }
131static inline void cpu_hotplug_enable(void) { }136static inline void cpu_hotplug_enable(void) { }
137static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { }
132#endif /* !CONFIG_HOTPLUG_CPU */138#endif /* !CONFIG_HOTPLUG_CPU */
133 139
134/* Wrappers which go away once all code is converted */140/* 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
138static inline void put_online_cpus(void) { cpus_read_unlock(); }144static inline void put_online_cpus(void) { cpus_read_unlock(); }
139 145
140#ifdef CONFIG_PM_SLEEP_SMP146#ifdef CONFIG_PM_SLEEP_SMP
141extern int freeze_secondary_cpus(int primary);147int __freeze_secondary_cpus(int primary, bool suspend);
148static inline int freeze_secondary_cpus(int primary)
149{
150 return __freeze_secondary_cpus(primary, true);
151}
152
142static inline int disable_nonboot_cpus(void)153static inline int disable_nonboot_cpus(void)
143{154{
144 return freeze_secondary_cpus(0);155 return __freeze_secondary_cpus(0, false);
145}156}
146extern void enable_nonboot_cpus(void);157
158void enable_nonboot_cpus(void);
147 159
148static inline int suspend_disable_secondary_cpus(void)160static inline int suspend_disable_secondary_cpus(void)
149{161{
include/linux/cpufreq.h+5−0
@@ -205,6 +205,7 @@ static inline bool policy_is_shared(struct cpufreq_policy *policy) · 204 unmodified lines
205unsigned int cpufreq_get(unsigned int cpu);205unsigned int cpufreq_get(unsigned int cpu);
206unsigned int cpufreq_quick_get(unsigned int cpu);206unsigned int cpufreq_quick_get(unsigned int cpu);
207unsigned int cpufreq_quick_get_max(unsigned int cpu);207unsigned int cpufreq_quick_get_max(unsigned int cpu);
208unsigned int cpufreq_get_hw_max_freq(unsigned int cpu);
208void disable_cpufreq(void);209void disable_cpufreq(void);
209 210
210u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);211u64 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
232{233{
233 return 0;234 return 0;
234}235}
236static inline unsigned int cpufreq_get_hw_max_freq(unsigned int cpu)
237{
238 return 0;
239}
235static inline void disable_cpufreq(void) { }240static inline void disable_cpufreq(void) { }
236#endif241#endif
237 242
include/linux/cpuhotplug.h+1−0
@@ -102,6 +102,7 @@ enum cpuhp_state { · 101 unmodified lines
102 CPUHP_AP_IRQ_ARMADA_XP_STARTING,102 CPUHP_AP_IRQ_ARMADA_XP_STARTING,
103 CPUHP_AP_IRQ_BCM2836_STARTING,103 CPUHP_AP_IRQ_BCM2836_STARTING,
104 CPUHP_AP_IRQ_MIPS_GIC_STARTING,104 CPUHP_AP_IRQ_MIPS_GIC_STARTING,
105 CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING,
105 CPUHP_AP_ARM_MVEBU_COHERENCY,106 CPUHP_AP_ARM_MVEBU_COHERENCY,
106 CPUHP_AP_MICROCODE_LOADER,107 CPUHP_AP_MICROCODE_LOADER,
107 CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,108 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
194 return 0;194 return 0;
195}195}
196 196
197static 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
197#define for_each_cpu(cpu, mask) \202#define for_each_cpu(cpu, mask) \
198 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)203 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
199#define for_each_cpu_not(cpu, mask) \204#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
245int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *);250int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *);
246int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);251int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
247unsigned int cpumask_local_spread(unsigned int i, int node);252unsigned int cpumask_local_spread(unsigned int i, int node);
253int cpumask_any_and_distribute(const struct cpumask *src1p,
254 const struct cpumask *src2p);
248 255
249/**256/**
250 * for_each_cpu - iterate over every cpu in a mask257 * for_each_cpu - iterate over every cpu in a mask
include/linux/dax.h+7−14
@@ -13,6 +13,7 @@ · 12 unmodified lines
13typedef unsigned long dax_entry_t;13typedef unsigned long dax_entry_t;
14 14
15struct iomap_ops;15struct iomap_ops;
16struct iomap;
16struct dax_device;17struct dax_device;
17struct dax_operations {18struct dax_operations {
18 /*19 /*
@@ -34,6 +35,8 @@ struct dax_operations { · 15 unmodified lines
34 /* copy_to_iter: required operation for fs-dax direct-i/o */35 /* copy_to_iter: required operation for fs-dax direct-i/o */
35 size_t (*copy_to_iter)(struct dax_device *, pgoff_t, void *, size_t,36 size_t (*copy_to_iter)(struct dax_device *, pgoff_t, void *, size_t,
36 struct iov_iter *);37 struct iov_iter *);
38 /* zero_page_range: required operation. Zero page range */
39 int (*zero_page_range)(struct dax_device *, pgoff_t, size_t);
37};40};
38 41
39extern struct attribute_group dax_attribute_group;42extern 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
199 size_t bytes, struct iov_iter *i);202 size_t bytes, struct iov_iter *i);
200size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,203size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
201 size_t bytes, struct iov_iter *i);204 size_t bytes, struct iov_iter *i);
205int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff,
206 size_t nr_pages);
202void dax_flush(struct dax_device *dax_dev, void *addr, size_t size);207void dax_flush(struct dax_device *dax_dev, void *addr, size_t size);
203 208
204ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,209ssize_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
210int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);215int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
211int dax_invalidate_mapping_entry_sync(struct address_space *mapping,216int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
212 pgoff_t index);217 pgoff_t index);
213 218int dax_iomap_zero(loff_t pos, unsigned offset, unsigned size,
214#ifdef CONFIG_FS_DAX219 struct iomap *iomap);
215int __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
219static 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
227static inline bool dax_mapping(struct address_space *mapping)220static inline bool dax_mapping(struct address_space *mapping)
228{221{
229 return mapping->host && IS_DAX(mapping->host);222 return mapping->host && IS_DAX(mapping->host);
include/linux/dccp.h+1−1
@@ -198,7 +198,7 @@ enum dccp_role { · 197 unmodified lines
198 198
199struct dccp_service_list {199struct dccp_service_list {
200 __u32 dccpsl_nr;200 __u32 dccpsl_nr;
201 __be32 dccpsl_list[0];201 __be32 dccpsl_list[];
202};202};
203 203
204#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)204#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
include/linux/debugfs.h+10−11
@@ -35,6 +35,7 @@ struct debugfs_regset32 { · 34 unmodified lines
35 const struct debugfs_reg32 *regs;35 const struct debugfs_reg32 *regs;
36 int nregs;36 int nregs;
37 void __iomem *base;37 void __iomem *base;
38 struct device *dev; /* Optional device for Runtime PM */
38};39};
39 40
40extern struct dentry *arch_debugfs_dir;41extern struct dentry *arch_debugfs_dir;
@@ -67,10 +68,10 @@ struct dentry *debugfs_create_file_unsafe(const char *name, umode_t mode, · 26 unmodified lines
67 struct dentry *parent, void *data,68 struct dentry *parent, void *data,
68 const struct file_operations *fops);69 const struct file_operations *fops);
69 70
70struct dentry *debugfs_create_file_size(const char *name, umode_t mode,71void debugfs_create_file_size(const char *name, umode_t mode,
71 struct dentry *parent, void *data,72 struct dentry *parent, void *data,
72 const struct file_operations *fops,73 const struct file_operations *fops,
73 loff_t file_size);74 loff_t file_size);
74 75
75struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);76struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
76 77
@@ -181,13 +182,11 @@ static inline struct dentry *debugfs_create_file_unsafe(const char *name, · 104 unmodified lines
181 return ERR_PTR(-ENODEV);182 return ERR_PTR(-ENODEV);
182}183}
183 184
184static inline struct dentry *debugfs_create_file_size(const char *name, umode_t mode,185static inline void debugfs_create_file_size(const char *name, umode_t mode,
185 struct dentry *parent, void *data,186 struct dentry *parent, void *data,
186 const struct file_operations *fops,187 const struct file_operations *fops,
187 loff_t file_size)188 loff_t file_size)
188{189{ }
189 return ERR_PTR(-ENODEV);
190}
191 190
192static inline struct dentry *debugfs_create_dir(const char *name,191static inline struct dentry *debugfs_create_dir(const char *name,
193 struct dentry *parent)192 struct dentry *parent)
include/linux/devfreq.h+52−54
@@ -158,7 +158,7 @@ struct devfreq_stats { · 157 unmodified lines
158 * functions except for the context of callbacks defined in struct158 * functions except for the context of callbacks defined in struct
159 * devfreq_governor, the governor should protect its access with the159 * devfreq_governor, the governor should protect its access with the
160 * struct mutex lock in struct devfreq. A governor may use this mutex160 * 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.
162 */162 */
163struct devfreq {163struct devfreq {
164 struct list_head node;164 struct list_head node;
@@ -201,24 +201,23 @@ struct devfreq_freqs { · 36 unmodified lines
201};201};
202 202
203#if defined(CONFIG_PM_DEVFREQ)203#if defined(CONFIG_PM_DEVFREQ)
204extern struct devfreq *devfreq_add_device(struct device *dev,204struct devfreq *devfreq_add_device(struct device *dev,
205 struct devfreq_dev_profile *profile,205 struct devfreq_dev_profile *profile,
206 const char *governor_name,206 const char *governor_name,
207 void *data);207 void *data);
208extern int devfreq_remove_device(struct devfreq *devfreq);208int devfreq_remove_device(struct devfreq *devfreq);
209extern struct devfreq *devm_devfreq_add_device(struct device *dev,209struct devfreq *devm_devfreq_add_device(struct device *dev,
210 struct devfreq_dev_profile *profile,210 struct devfreq_dev_profile *profile,
211 const char *governor_name,211 const char *governor_name,
212 void *data);212 void *data);
213extern void devm_devfreq_remove_device(struct device *dev,213void devm_devfreq_remove_device(struct device *dev, struct devfreq *devfreq);
214 struct devfreq *devfreq);
215 214
216/* Supposed to be called by PM callbacks */215/* Supposed to be called by PM callbacks */
217extern int devfreq_suspend_device(struct devfreq *devfreq);216int devfreq_suspend_device(struct devfreq *devfreq);
218extern int devfreq_resume_device(struct devfreq *devfreq);217int devfreq_resume_device(struct devfreq *devfreq);
219 218
220extern void devfreq_suspend(void);219void devfreq_suspend(void);
221extern void devfreq_resume(void);220void devfreq_resume(void);
222 221
223/**222/**
224 * update_devfreq() - Reevaluate the device and configure frequency223 * update_devfreq() - Reevaluate the device and configure frequency
@@ -226,39 +225,38 @@ extern void devfreq_resume(void); · 1 unmodified line
226 *225 *
227 * Note: devfreq->lock must be held226 * Note: devfreq->lock must be held
228 */227 */
229extern int update_devfreq(struct devfreq *devfreq);228int update_devfreq(struct devfreq *devfreq);
230 229
231/* Helper functions for devfreq user device driver with OPP. */230/* Helper functions for devfreq user device driver with OPP. */
232extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,231struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
233 unsigned long *freq, u32 flags);232 unsigned long *freq, u32 flags);
234extern int devfreq_register_opp_notifier(struct device *dev,233int devfreq_register_opp_notifier(struct device *dev,
235 struct devfreq *devfreq);234 struct devfreq *devfreq);
236extern int devfreq_unregister_opp_notifier(struct device *dev,235int devfreq_unregister_opp_notifier(struct device *dev,
237 struct devfreq *devfreq);236 struct devfreq *devfreq);
238extern int devm_devfreq_register_opp_notifier(struct device *dev,237int devm_devfreq_register_opp_notifier(struct device *dev,
239 struct devfreq *devfreq);238 struct devfreq *devfreq);
240extern void devm_devfreq_unregister_opp_notifier(struct device *dev,239void devm_devfreq_unregister_opp_notifier(struct device *dev,
241 struct devfreq *devfreq);240 struct devfreq *devfreq);
242extern int devfreq_register_notifier(struct devfreq *devfreq,241int devfreq_register_notifier(struct devfreq *devfreq,
243 struct notifier_block *nb,242 struct notifier_block *nb,
244 unsigned int list);243 unsigned int list);
245extern int devfreq_unregister_notifier(struct devfreq *devfreq,244int devfreq_unregister_notifier(struct devfreq *devfreq,
246 struct notifier_block *nb,245 struct notifier_block *nb,
247 unsigned int list);246 unsigned int list);
248extern int devm_devfreq_register_notifier(struct device *dev,247int devm_devfreq_register_notifier(struct device *dev,
249 struct devfreq *devfreq,248 struct devfreq *devfreq,
250 struct notifier_block *nb,249 struct notifier_block *nb,
251 unsigned int list);250 unsigned int list);
252extern void devm_devfreq_unregister_notifier(struct device *dev,251void devm_devfreq_unregister_notifier(struct device *dev,
253 struct devfreq *devfreq,252 struct devfreq *devfreq,
254 struct notifier_block *nb,253 struct notifier_block *nb,
255 unsigned int list);254 unsigned int list);
256extern struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,255struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index);
257 int index);
258 256
259#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)257#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
260/**258/**
261 * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq259 * struct devfreq_simple_ondemand_data - ``void *data`` fed to struct devfreq
262 * and devfreq_add_device260 * and devfreq_add_device
263 * @upthreshold: If the load is over this value, the frequency jumps.261 * @upthreshold: If the load is over this value, the frequency jumps.
264 * Specify 0 to use the default. Valid value = 0 to 100.262 * Specify 0 to use the default. Valid value = 0 to 100.
@@ -278,7 +276,7 @@ struct devfreq_simple_ondemand_data { · 13 unmodified lines
278 276
279#if IS_ENABLED(CONFIG_DEVFREQ_GOV_PASSIVE)277#if IS_ENABLED(CONFIG_DEVFREQ_GOV_PASSIVE)
280/**278/**
281 * struct devfreq_passive_data - void *data fed to struct devfreq279 * struct devfreq_passive_data - ``void *data`` fed to struct devfreq
282 * and devfreq_add_device280 * and devfreq_add_device
283 * @parent: the devfreq instance of parent device.281 * @parent: the devfreq instance of parent device.
284 * @get_target_freq: Optional callback, Returns desired operating frequency282 * @get_target_freq: Optional callback, Returns desired operating frequency
@@ -311,9 +309,9 @@ struct devfreq_passive_data { · 26 unmodified lines
311 309
312#else /* !CONFIG_PM_DEVFREQ */310#else /* !CONFIG_PM_DEVFREQ */
313static inline struct devfreq *devfreq_add_device(struct device *dev,311static inline struct devfreq *devfreq_add_device(struct device *dev,
314 struct devfreq_dev_profile *profile,312 struct devfreq_dev_profile *profile,
315 const char *governor_name,313 const char *governor_name,
316 void *data)314 void *data)
317{315{
318 return ERR_PTR(-ENOSYS);316 return ERR_PTR(-ENOSYS);
319}317}
@@ -350,31 +348,31 @@ static inline void devfreq_suspend(void) {} · 30 unmodified lines
350static inline void devfreq_resume(void) {}348static inline void devfreq_resume(void) {}
351 349
352static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,350static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
353 unsigned long *freq, u32 flags)351 unsigned long *freq, u32 flags)
354{352{
355 return ERR_PTR(-EINVAL);353 return ERR_PTR(-EINVAL);
356}354}
357 355
358static inline int devfreq_register_opp_notifier(struct device *dev,356static inline int devfreq_register_opp_notifier(struct device *dev,
359 struct devfreq *devfreq)357 struct devfreq *devfreq)
360{358{
361 return -EINVAL;359 return -EINVAL;
362}360}
363 361
364static inline int devfreq_unregister_opp_notifier(struct device *dev,362static inline int devfreq_unregister_opp_notifier(struct device *dev,
365 struct devfreq *devfreq)363 struct devfreq *devfreq)
366{364{
367 return -EINVAL;365 return -EINVAL;
368}366}
369 367
370static inline int devm_devfreq_register_opp_notifier(struct device *dev,368static inline int devm_devfreq_register_opp_notifier(struct device *dev,
371 struct devfreq *devfreq)369 struct devfreq *devfreq)
372{370{
373 return -EINVAL;371 return -EINVAL;
374}372}
375 373
376static inline void devm_devfreq_unregister_opp_notifier(struct device *dev,374static inline void devm_devfreq_unregister_opp_notifier(struct device *dev,
377 struct devfreq *devfreq)375 struct devfreq *devfreq)
378{376{
379}377}
380 378
@@ -393,22 +391,22 @@ static inline int devfreq_unregister_notifier(struct devfreq *devfreq, · 12 unmodified lines
393}391}
394 392
395static inline int devm_devfreq_register_notifier(struct device *dev,393static inline int devm_devfreq_register_notifier(struct device *dev,
396 struct devfreq *devfreq,394 struct devfreq *devfreq,
397 struct notifier_block *nb,395 struct notifier_block *nb,
398 unsigned int list)396 unsigned int list)
399{397{
400 return 0;398 return 0;
401}399}
402 400
403static inline void devm_devfreq_unregister_notifier(struct device *dev,401static inline void devm_devfreq_unregister_notifier(struct device *dev,
404 struct devfreq *devfreq,402 struct devfreq *devfreq,
405 struct notifier_block *nb,403 struct notifier_block *nb,
406 unsigned int list)404 unsigned int list)
407{405{
408}406}
409 407
410static inline struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,408static inline struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
411 int index)409 int index)
412{410{
413 return ERR_PTR(-ENODEV);411 return ERR_PTR(-ENODEV);
414}412}
include/linux/devfreq_cooling.h+1−1
@@ -75,7 +75,7 @@ void devfreq_cooling_unregister(struct thermal_cooling_device *dfc); · 74 unmodified lines
75 75
76#else /* !CONFIG_DEVFREQ_THERMAL */76#else /* !CONFIG_DEVFREQ_THERMAL */
77 77
78struct thermal_cooling_device *78static inline struct thermal_cooling_device *
79of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,79of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
80 struct devfreq_cooling_power *dfc_power)80 struct devfreq_cooling_power *dfc_power)
81{81{
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
141 long nr_pages, void **kaddr, pfn_t *pfn);141 long nr_pages, void **kaddr, pfn_t *pfn);
142typedef size_t (*dm_dax_copy_iter_fn)(struct dm_target *ti, pgoff_t pgoff,142typedef size_t (*dm_dax_copy_iter_fn)(struct dm_target *ti, pgoff_t pgoff,
143 void *addr, size_t bytes, struct iov_iter *i);143 void *addr, size_t bytes, struct iov_iter *i);
144typedef int (*dm_dax_zero_page_range_fn)(struct dm_target *ti, pgoff_t pgoff,
145 size_t nr_pages);
144#define PAGE_SECTORS (PAGE_SIZE / 512)146#define PAGE_SECTORS (PAGE_SIZE / 512)
145 147
146void dm_error(const char *message);148void dm_error(const char *message);
@@ -195,6 +197,7 @@ struct target_type { · 48 unmodified lines
195 dm_dax_direct_access_fn direct_access;197 dm_dax_direct_access_fn direct_access;
196 dm_dax_copy_iter_fn dax_copy_from_iter;198 dm_dax_copy_iter_fn dax_copy_from_iter;
197 dm_dax_copy_iter_fn dax_copy_to_iter;199 dm_dax_copy_iter_fn dax_copy_to_iter;
200 dm_dax_zero_page_range_fn dax_zero_page_range;
198 201
199 /* For internal device-mapper use. */202 /* For internal device-mapper use. */
200 struct list_head list;203 struct list_head list;
include/linux/device.h+4−6
@@ -42,9 +42,8 @@ struct device_node; · 41 unmodified lines
42struct fwnode_handle;42struct fwnode_handle;
43struct iommu_ops;43struct iommu_ops;
44struct iommu_group;44struct iommu_group;
45struct iommu_fwspec;
46struct dev_pin_info;45struct dev_pin_info;
47struct iommu_param;46struct dev_iommu;
48 47
49/**48/**
50 * struct subsys_interface - interfaces to device functions49 * struct subsys_interface - interfaces to device functions
@@ -513,8 +512,7 @@ struct dev_links_info { · 462 unmodified lines
513 * gone away. This should be set by the allocator of the512 * gone away. This should be set by the allocator of the
514 * device (i.e. the bus driver that discovered the device).513 * device (i.e. the bus driver that discovered the device).
515 * @iommu_group: IOMMU group the device belongs to.514 * @iommu_group: IOMMU group the device belongs to.
516 * @iommu_fwspec: IOMMU-specific properties supplied by firmware.515 * @iommu: Per device generic IOMMU runtime data
517 * @iommu_param: Per device generic IOMMU runtime data
518 *516 *
519 * @offline_disabled: If set, the device is permanently online.517 * @offline_disabled: If set, the device is permanently online.
520 * @offline: Set after successful invocation of bus type's .offline().518 * @offline: Set after successful invocation of bus type's .offline().
@@ -613,8 +611,7 @@ struct device { · 92 unmodified lines
613 611
614 void (*release)(struct device *dev);612 void (*release)(struct device *dev);
615 struct iommu_group *iommu_group;613 struct iommu_group *iommu_group;
616 struct iommu_fwspec *iommu_fwspec;614 struct dev_iommu *iommu;
617 struct iommu_param *iommu_param;
618 615
619 bool offline_disabled:1;616 bool offline_disabled:1;
620 bool offline:1;617 bool offline:1;
@@ -828,6 +825,7 @@ extern struct device *device_find_child_by_name(struct device *parent, · 207 unmodified lines
828extern int device_rename(struct device *dev, const char *new_name);825extern int device_rename(struct device *dev, const char *new_name);
829extern int device_move(struct device *dev, struct device *new_parent,826extern int device_move(struct device *dev, struct device *new_parent,
830 enum dpm_order dpm_order);827 enum dpm_order dpm_order);
828extern int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid);
831extern const char *device_get_devnode(struct device *dev,829extern const char *device_get_devnode(struct device *dev,
832 umode_t *mode, kuid_t *uid, kgid_t *gid,830 umode_t *mode, kuid_t *uid, kgid_t *gid,
833 const char **tmp);831 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
236}236}
237#endif237#endif
238 238
239extern int driver_deferred_probe_timeout;
239void driver_deferred_probe_add(struct device *dev);240void driver_deferred_probe_add(struct device *dev);
240int driver_deferred_probe_check_state(struct device *dev);241int driver_deferred_probe_check_state(struct device *dev);
241int driver_deferred_probe_check_state_continue(struct device *dev);
242void driver_init(void);242void driver_init(void);
243 243
244/**244/**
include/linux/dio.h+0−5
@@ -247,11 +247,6 @@ extern int dio_create_sysfs_dev_files(struct dio_dev *); · 246 unmodified lines
247/* New-style probing */247/* New-style probing */
248extern int dio_register_driver(struct dio_driver *);248extern int dio_register_driver(struct dio_driver *);
249extern void dio_unregister_driver(struct dio_driver *);249extern void dio_unregister_driver(struct dio_driver *);
250extern const struct dio_device_id *dio_match_device(const struct dio_device_id *ids, const struct dio_dev *z);
251static inline struct dio_driver *dio_dev_driver(const struct dio_dev *d)
252{
253 return d->driver;
254}
255 250
256#define dio_resource_start(d) ((d)->resource.start)251#define dio_resource_start(d) ((d)->resource.start)
257#define dio_resource_end(d) ((d)->resource.end)252#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
108}108}
109#endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */109#endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */
110 110
111void *uncached_kernel_address(void *addr);111void *arch_dma_set_uncached(void *addr, size_t size);
112void *cached_kernel_address(void *addr);112void arch_dma_clear_uncached(void *addr, size_t size);
113 113
114#endif /* _LINUX_DMA_NONCOHERENT_H */114#endif /* _LINUX_DMA_NONCOHERENT_H */
include/linux/dmaengine.h+36−32
@@ -300,6 +300,8 @@ struct dma_router { · 299 unmodified lines
300 * @chan_id: channel ID for sysfs300 * @chan_id: channel ID for sysfs
301 * @dev: class device for sysfs301 * @dev: class device for sysfs
302 * @name: backlink name for sysfs302 * @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"
303 * @device_node: used to add this to the device chan list305 * @device_node: used to add this to the device chan list
304 * @local: per-cpu pointer to a struct dma_chan_percpu306 * @local: per-cpu pointer to a struct dma_chan_percpu
305 * @client_count: how many clients are using this channel307 * @client_count: how many clients are using this channel
@@ -318,6 +320,9 @@ struct dma_chan { · 12 unmodified lines
318 int chan_id;320 int chan_id;
319 struct dma_chan_dev *dev;321 struct dma_chan_dev *dev;
320 const char *name;322 const char *name;
323#ifdef CONFIG_DEBUG_FS
324 char *dbg_client_name;
325#endif
321 326
322 struct list_head device_node;327 struct list_head device_node;
323 struct dma_chan_percpu __percpu *local;328 struct dma_chan_percpu __percpu *local;
@@ -618,10 +623,11 @@ static inline void dmaengine_unmap_put(struct dmaengine_unmap_data *unmap) · 294 unmodified lines
618 623
619static inline void dma_descriptor_unmap(struct dma_async_tx_descriptor *tx)624static inline void dma_descriptor_unmap(struct dma_async_tx_descriptor *tx)
620{625{
621 if (tx->unmap) {626 if (!tx->unmap)
622 dmaengine_unmap_put(tx->unmap);627 return;
623 tx->unmap = NULL;628
624 }629 dmaengine_unmap_put(tx->unmap);
630 tx->unmap = NULL;
625}631}
626 632
627#ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH633#ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
@@ -805,7 +811,9 @@ struct dma_filter { · 177 unmodified lines
805 * called and there are no further references to this structure. This811 * called and there are no further references to this structure. This
806 * must be implemented to free resources however many existing drivers812 * must be implemented to free resources however many existing drivers
807 * do not and are therefore not safe to unbind while in use.813 * 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.
809 */817 */
810struct dma_device {818struct dma_device {
811 struct kref ref;819 struct kref ref;
@@ -891,6 +899,11 @@ struct dma_device { · 79 unmodified lines
891 struct dma_tx_state *txstate);899 struct dma_tx_state *txstate);
892 void (*device_issue_pending)(struct dma_chan *chan);900 void (*device_issue_pending)(struct dma_chan *chan);
893 void (*device_release)(struct dma_device *dev);901 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
894};907};
895 908
896static inline int dmaengine_slave_config(struct dma_chan *chan,909static 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
1155static inline bool dmaengine_check_align(enum dmaengine_alignment align,1168static inline bool dmaengine_check_align(enum dmaengine_alignment align,
1156 size_t off1, size_t off2, size_t len)1169 size_t off1, size_t off2, size_t len)
1157{1170{
1158 size_t mask;1171 return !(((1 << align) - 1) & (off1 | off2 | len));
1159
1160 if (!align)
1161 return true;
1162 mask = (1 << align) - 1;
1163 if (mask & (off1 | off2 | len))
1164 return false;
1165 return true;
1166}1172}
1167 1173
1168static inline bool is_dma_copy_aligned(struct dma_device *dev, size_t off1,1174static 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
1236{1242{
1237 if (dma_dev_has_pq_continue(dma) || !dmaf_continue(flags))1243 if (dma_dev_has_pq_continue(dma) || !dmaf_continue(flags))
1238 return dma_dev_to_maxpq(dma);1244 return dma_dev_to_maxpq(dma);
1239 else if (dmaf_p_disabled_continue(flags))1245 if (dmaf_p_disabled_continue(flags))
1240 return dma_dev_to_maxpq(dma) - 1;1246 return dma_dev_to_maxpq(dma) - 1;
1241 else if (dmaf_continue(flags))1247 if (dmaf_continue(flags))
1242 return dma_dev_to_maxpq(dma) - 3;1248 return dma_dev_to_maxpq(dma) - 3;
1243 BUG();1249 BUG();
1244}1250}
@@ -1249,7 +1255,7 @@ static inline size_t dmaengine_get_icg(bool inc, bool sgl, size_t icg, · 4 unmodified lines
1249 if (inc) {1255 if (inc) {
1250 if (dir_icg)1256 if (dir_icg)
1251 return dir_icg;1257 return dir_icg;
1252 else if (sgl)1258 if (sgl)
1253 return icg;1259 return icg;
1254 }1260 }
1255 1261
@@ -1415,11 +1421,12 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie, · 159 unmodified lines
1415static inline void1421static inline void
1416dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used, u32 residue)1422dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used, u32 residue)
1417{1423{
1418 if (st) {1424 if (!st)
1419 st->last = last;1425 return;
1420 st->used = used;1426
1421 st->residue = residue;1427 st->last = last;
1422 }1428 st->used = used;
1429 st->residue = residue;
1423}1430}
1424 1431
1425#ifdef CONFIG_DMA_ENGINE1432#ifdef CONFIG_DMA_ENGINE
@@ -1496,12 +1503,11 @@ static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx) · 70 unmodified lines
1496 if (ret)1503 if (ret)
1497 return ret;1504 return ret;
1498 1505
1499 if (caps.descriptor_reuse) {1506 if (!caps.descriptor_reuse)
1500 tx->flags |= DMA_CTRL_REUSE;
1501 return 0;
1502 } else {
1503 return -EPERM;1507 return -EPERM;
1504 }1508
1509 tx->flags |= DMA_CTRL_REUSE;
1510 return 0;
1505}1511}
1506 1512
1507static inline void dmaengine_desc_clear_reuse(struct dma_async_tx_descriptor *tx)1513static 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
1517static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)1523static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
1518{1524{
1519 /* this is supported for reusable desc, so check that */1525 /* this is supported for reusable desc, so check that */
1520 if (dmaengine_desc_test_reuse(desc))1526 if (!dmaengine_desc_test_reuse(desc))
1521 return desc->desc_free(desc);
1522 else
1523 return -EPERM;1527 return -EPERM;
1528
1529 return desc->desc_free(desc);
1524}1530}
1525 1531
1526/* --- DMA device --- */1532/* --- DMA device --- */
@@ -1566,9 +1572,7 @@ dmaengine_get_direction_text(enum dma_transfer_direction dir) · 39 unmodified lines
1566 case DMA_DEV_TO_DEV:1572 case DMA_DEV_TO_DEV:
1567 return "DEV_TO_DEV";1573 return "DEV_TO_DEV";
1568 default:1574 default:
1569 break;1575 return "invalid";
1570 }1576 }
1571
1572 return "invalid";
1573}1577}
1574#endif /* DMAENGINE_H */1578#endif /* DMAENGINE_H */
include/linux/dmar.h+9−5
@@ -69,19 +69,23 @@ struct dmar_pci_notify_info { · 68 unmodified lines
69extern struct rw_semaphore dmar_global_lock;69extern struct rw_semaphore dmar_global_lock;
70extern struct list_head dmar_drhd_units;70extern struct list_head dmar_drhd_units;
71 71
72#define for_each_drhd_unit(drhd) \72#define for_each_drhd_unit(drhd) \
73 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list)73 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
74 dmar_rcu_check())
74 75
75#define for_each_active_drhd_unit(drhd) \76#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()) \
77 if (drhd->ignored) {} else79 if (drhd->ignored) {} else
78 80
79#define for_each_active_iommu(i, drhd) \81#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()) \
81 if (i=drhd->iommu, drhd->ignored) {} else84 if (i=drhd->iommu, drhd->ignored) {} else
82 85
83#define for_each_iommu(i, drhd) \86#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()) \
85 if (i=drhd->iommu, 0) {} else 89 if (i=drhd->iommu, 0) {} else
86 90
87static inline bool dmar_rcu_check(void)91static 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
28 28
29int dsa_8021q_rx_source_port(u16 vid);29int dsa_8021q_rx_source_port(u16 vid);
30 30
31struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb);
32
33#else31#else
34 32
35int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,33int 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
64 return 0;62 return 0;
65}63}
66 64
67struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb)
68{
69 return NULL;
70}
71
72#endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */65#endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */
73 66
74#endif /* _NET_DSA_8021Q_H */67#endif /* _NET_DSA_8021Q_H */
include/linux/dw_apb_timer.h+0−1
@@ -25,7 +25,6 @@ struct dw_apb_timer { · 24 unmodified lines
25struct dw_apb_clock_event_device {25struct dw_apb_clock_event_device {
26 struct clock_event_device ced;26 struct clock_event_device ced;
27 struct dw_apb_timer timer;27 struct dw_apb_timer timer;
28 struct irqaction irqaction;
29 void (*eoi)(struct dw_apb_timer *);28 void (*eoi)(struct dw_apb_timer *);
30};29};
31 30
include/linux/edac.h+5−4
@@ -383,6 +383,9 @@ struct dimm_info { · 382 unmodified lines
383 unsigned int csrow, cschannel; /* Points to the old API data */383 unsigned int csrow, cschannel; /* Points to the old API data */
384 384
385 u16 smbios_handle; /* Handle for SMBIOS type 17 */385 u16 smbios_handle; /* Handle for SMBIOS type 17 */
386
387 u32 ce_count;
388 u32 ue_count;
386};389};
387 390
388/**391/**
@@ -442,6 +445,7 @@ struct errcount_attribute_data { · 53 unmodified lines
442 * struct edac_raw_error_desc - Raw error report structure445 * struct edac_raw_error_desc - Raw error report structure
443 * @grain: minimum granularity for an error report, in bytes446 * @grain: minimum granularity for an error report, in bytes
444 * @error_count: number of errors of the same type447 * @error_count: number of errors of the same type
448 * @type: severity of the error (CE/UE/Fatal)
445 * @top_layer: top layer of the error (layer[0])449 * @top_layer: top layer of the error (layer[0])
446 * @mid_layer: middle layer of the error (layer[1])450 * @mid_layer: middle layer of the error (layer[1])
447 * @low_layer: low layer of the error (layer[2])451 * @low_layer: low layer of the error (layer[2])
@@ -453,8 +457,6 @@ struct errcount_attribute_data { · 5 unmodified lines
453 * @location: location of the error457 * @location: location of the error
454 * @label: label of the affected DIMM(s)458 * @label: label of the affected DIMM(s)
455 * @other_detail: other driver-specific detail about the error459 * @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)
458 */460 */
459struct edac_raw_error_desc {461struct edac_raw_error_desc {
460 char location[LOCATION_SIZE];462 char location[LOCATION_SIZE];
@@ -462,6 +464,7 @@ struct edac_raw_error_desc { · 1 unmodified line
462 long grain;464 long grain;
463 465
464 u16 error_count;466 u16 error_count;
467 enum hw_event_mc_err_type type;
465 int top_layer;468 int top_layer;
466 int mid_layer;469 int mid_layer;
467 int low_layer;470 int low_layer;
@@ -470,7 +473,6 @@ struct edac_raw_error_desc { · 2 unmodified lines
470 unsigned long syndrome;473 unsigned long syndrome;
471 const char *msg;474 const char *msg;
472 const char *other_detail;475 const char *other_detail;
473 bool enable_per_layer_report;
474};476};
475 477
476/* MEMORY controller information structure478/* MEMORY controller information structure
@@ -560,7 +562,6 @@ struct mem_ctl_info { · 83 unmodified lines
560 */562 */
561 u32 ce_noinfo_count, ue_noinfo_count;563 u32 ce_noinfo_count, ue_noinfo_count;
562 u32 ue_mc, ce_mc;564 u32 ue_mc, ce_mc;
563 u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS];
564 565
565 struct completion complete;566 struct completion complete;
566 567
include/linux/efi.h+121−579
@@ -56,19 +56,6 @@ typedef void *efi_handle_t; · 55 unmodified lines
56#define __efiapi56#define __efiapi
57#endif57#endif
58 58
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
72/*59/*
73 * The UEFI spec and EDK2 reference implementation both define EFI_GUID as60 * The UEFI spec and EDK2 reference implementation both define EFI_GUID as
74 * struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied alignment61 * struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied alignment
@@ -157,15 +144,6 @@ typedef struct { · 82 unmodified lines
157 u32 imagesize;144 u32 imagesize;
158} efi_capsule_header_t;145} efi_capsule_header_t;
159 146
160struct 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
169/*147/*
170 * EFI capsule flags148 * EFI capsule flags
171 */149 */
@@ -187,14 +165,6 @@ struct capsule_info { · 15 unmodified lines
187 165
188int __efi_capsule_setup_info(struct capsule_info *cap_info);166int __efi_capsule_setup_info(struct capsule_info *cap_info);
189 167
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
198typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);168typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
199 169
200/*170/*
@@ -224,291 +194,7 @@ typedef struct { · 23 unmodified lines
224 u8 sets_to_zero;194 u8 sets_to_zero;
225} efi_time_cap_t;195} efi_time_cap_t;
226 196
227typedef struct {197typedef union efi_boot_services efi_boot_services_t;
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 */
278typedef 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
342typedef 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
358typedef enum {
359 EfiPciIoAttributeOperationGet,
360 EfiPciIoAttributeOperationSet,
361 EfiPciIoAttributeOperationEnable,
362 EfiPciIoAttributeOperationDisable,
363 EfiPciIoAttributeOperationSupported,
364 EfiPciIoAttributeOperationMaximum
365} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
366
367typedef struct {
368 u32 read;
369 u32 write;
370} efi_pci_io_protocol_access_32_t;
371
372typedef union efi_pci_io_protocol efi_pci_io_protocol_t;
373
374typedef
375efi_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
381typedef struct {
382 void *read;
383 void *write;
384} efi_pci_io_protocol_access_t;
385
386typedef 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
391union 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
456struct efi_dev_path;
457
458typedef union apple_properties_protocol apple_properties_protocol_t;
459
460union 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
484typedef u32 efi_tcg2_event_log_format;
485
486typedef union efi_tcg2_protocol efi_tcg2_protocol_t;
487
488union 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};
512 198
513/*199/*
514 * Types and defines for EFI ResetSystem200 * Types and defines for EFI ResetSystem
@@ -646,6 +332,9 @@ void efi_native_runtime_setup(void); · 131 unmodified lines
646#define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)332#define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
647#define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0)333#define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0)
648#define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f)334#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)
649 338
650#define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f)339#define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f)
651#define EFI_SHIM_LOCK_GUID EFI_GUID(0x605dab50, 0xe046, 0x4300, 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23)340#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
665#define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa)354#define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa)
666#define LINUX_EFI_TPM_FINAL_LOG_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25)355#define LINUX_EFI_TPM_FINAL_LOG_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25)
667#define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2)356#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)
668 358
669/* OEM GUIDs */359/* OEM GUIDs */
670#define DELLEMC_EFI_RCI2_TABLE_GUID EFI_GUID(0x2d9f28a2, 0xa886, 0x456a, 0x97, 0xa8, 0xf1, 0x1e, 0xf2, 0x4f, 0xf4, 0x55)360#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
788 u64 attribute;478 u64 attribute;
789};479};
790 480
791struct efi_fdt_params {
792 u64 system_table;
793 u64 mmap;
794 u32 mmap_size;
795 u32 desc_size;
796 u32 desc_ver;
797};
798
799typedef 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
815typedef 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
826typedef struct efi_file_handle efi_file_handle_t;
827
828struct 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
847typedef struct efi_file_io_interface efi_file_io_interface_t;
848
849struct 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
859typedef struct {481typedef struct {
860 u32 version;482 u32 version;
861 u32 length;483 u32 length;
@@ -865,6 +487,14 @@ typedef struct { · 3 unmodified lines
865#define EFI_PROPERTIES_TABLE_VERSION 0x00010000487#define EFI_PROPERTIES_TABLE_VERSION 0x00010000
866#define EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA 0x1488#define EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA 0x1
867 489
490typedef 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
868#define EFI_INVALID_TABLE_ADDR (~0UL)498#define EFI_INVALID_TABLE_ADDR (~0UL)
869 499
870typedef struct {500typedef struct {
@@ -896,48 +526,63 @@ typedef struct { · 25 unmodified lines
896 efi_time_t time_of_revocation;526 efi_time_t time_of_revocation;
897} efi_cert_x509_sha256_t;527} efi_cert_x509_sha256_t;
898 528
529extern unsigned long __ro_after_init efi_rng_seed; /* RNG Seed table */
530
899/*531/*
900 * All runtime access to EFI goes through this structure:532 * All runtime access to EFI goes through this structure:
901 */533 */
902extern struct efi {534extern struct efi {
903 efi_system_table_t *systab; /* EFI system table */535 const efi_runtime_services_t *runtime; /* EFI runtime services table */
904 unsigned int runtime_version; /* Runtime services version */536 unsigned int runtime_version; /* Runtime services version */
905 unsigned long mps; /* MPS table */537 unsigned int runtime_supported_mask;
906 unsigned long acpi; /* ACPI table (IA64 ext 0.71) */538
907 unsigned long acpi20; /* ACPI table (ACPI 2.0) */539 unsigned long acpi; /* ACPI table (IA64 ext 0.71) */
908 unsigned long smbios; /* SMBIOS table (32 bit entry point) */540 unsigned long acpi20; /* ACPI table (ACPI 2.0) */
909 unsigned long smbios3; /* SMBIOS table (64 bit entry point) */541 unsigned long smbios; /* SMBIOS table (32 bit entry point) */
910 unsigned long boot_info; /* boot info table */542 unsigned long smbios3; /* SMBIOS table (64 bit entry point) */
911 unsigned long hcdp; /* HCDP table */543 unsigned long esrt; /* ESRT table */
912 unsigned long uga; /* UGA table */544 unsigned long tpm_log; /* TPM2 Event Log table */
913 unsigned long fw_vendor; /* fw_vendor */545 unsigned long tpm_final_log; /* TPM2 Final Events Log table */
914 unsigned long runtime; /* runtime table */546
915 unsigned long config_table; /* config tables */547 efi_get_time_t *get_time;
916 unsigned long esrt; /* ESRT table */548 efi_set_time_t *set_time;
917 unsigned long properties_table; /* properties table */549 efi_get_wakeup_time_t *get_wakeup_time;
918 unsigned long mem_attr_table; /* memory attributes table */550 efi_set_wakeup_time_t *set_wakeup_time;
919 unsigned long rng_seed; /* UEFI firmware random seed */551 efi_get_variable_t *get_variable;
920 unsigned long tpm_log; /* TPM2 Event Log table */552 efi_get_next_variable_t *get_next_variable;
921 unsigned long tpm_final_log; /* TPM2 Final Events Log table */553 efi_set_variable_t *set_variable;
922 unsigned long mem_reserve; /* Linux EFI memreserve table */554 efi_set_variable_t *set_variable_nonblocking;
923 efi_get_time_t *get_time;555 efi_query_variable_info_t *query_variable_info;
924 efi_set_time_t *set_time;556 efi_query_variable_info_t *query_variable_info_nonblocking;
925 efi_get_wakeup_time_t *get_wakeup_time;557 efi_update_capsule_t *update_capsule;
926 efi_set_wakeup_time_t *set_wakeup_time;558 efi_query_capsule_caps_t *query_capsule_caps;
927 efi_get_variable_t *get_variable;559 efi_get_next_high_mono_count_t *get_next_high_mono_count;
928 efi_get_next_variable_t *get_next_variable;560 efi_reset_system_t *reset_system;
929 efi_set_variable_t *set_variable;561
930 efi_set_variable_t *set_variable_nonblocking;562 struct efi_memory_map memmap;
931 efi_query_variable_info_t *query_variable_info;563 unsigned long flags;
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;
939} efi;564} efi;
940 565
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
941extern struct mm_struct efi_mm;586extern struct mm_struct efi_mm;
942 587
943static inline int588static inline int
@@ -987,14 +632,18 @@ extern int __init efi_memmap_split_count(efi_memory_desc_t *md, · 43 unmodified lines
987extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap,632extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap,
988 void *buf, struct efi_mem_range *mem);633 void *buf, struct efi_mem_range *mem);
989 634
990extern int efi_config_init(efi_config_table_type_t *arch_tables);
991#ifdef CONFIG_EFI_ESRT635#ifdef CONFIG_EFI_ESRT
992extern void __init efi_esrt_init(void);636extern void __init efi_esrt_init(void);
993#else637#else
994static inline void efi_esrt_init(void) { }638static inline void efi_esrt_init(void) { }
995#endif639#endif
996extern int efi_config_parse_tables(void *config_tables, int count, int sz,640extern int efi_config_parse_tables(const efi_config_table_t *config_tables,
997 efi_config_table_type_t *arch_tables);641 int count,
642 const efi_config_table_type_t *arch_tables);
643extern int efi_systab_check_header(const efi_table_hdr_t *systab_hdr,
644 int min_major_version);
645extern void efi_systab_report_header(const efi_table_hdr_t *systab_hdr,
646 unsigned long fw_vendor);
998extern u64 efi_get_iobase (void);647extern u64 efi_get_iobase (void);
999extern int efi_mem_type(unsigned long phys_addr);648extern int efi_mem_type(unsigned long phys_addr);
1000extern u64 efi_mem_attributes (unsigned long phys_addr);649extern 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
1006extern int efi_mem_reserve_persistent(phys_addr_t addr, u64 size);655extern int efi_mem_reserve_persistent(phys_addr_t addr, u64 size);
1007extern void efi_initialize_iomem_resources(struct resource *code_resource,656extern void efi_initialize_iomem_resources(struct resource *code_resource,
1008 struct resource *data_resource, struct resource *bss_resource);657 struct resource *data_resource, struct resource *bss_resource);
1009extern int efi_get_fdt_params(struct efi_fdt_params *params);658extern u64 efi_get_fdt_params(struct efi_memory_map_data *data);
1010extern struct kobject *efi_kobj;659extern struct kobject *efi_kobj;
1011 660
1012extern int efi_reboot_quirk_mode;661extern int efi_reboot_quirk_mode;
@@ -1018,6 +667,8 @@ extern void __init efi_fake_memmap(void); · 5 unmodified lines
1018static inline void efi_fake_memmap(void) { }667static inline void efi_fake_memmap(void) { }
1019#endif668#endif
1020 669
670extern unsigned long efi_mem_attr_table;
671
1021/*672/*
1022 * efi_memattr_perm_setter - arch specific callback function passed into673 * efi_memattr_perm_setter - arch specific callback function passed into
1023 * efi_memattr_apply_permissions() that updates the674 * efi_memattr_apply_permissions() that updates the
@@ -1124,6 +775,7 @@ extern int __init efi_setup_pcdp_console(char *); · 100 unmodified lines
1124#define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */775#define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */
1125#define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */776#define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */
1126#define EFI_MEM_NO_SOFT_RESERVE 11 /* Is the kernel configured to ignore soft reservations? */777#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? */
1127 779
1128#ifdef CONFIG_EFI780#ifdef CONFIG_EFI
1129/*781/*
@@ -1142,6 +794,11 @@ static inline bool __pure efi_soft_reserve_enabled(void) · 12 unmodified lines
1142 return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE)794 return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE)
1143 && __efi_soft_reserve_enabled();795 && __efi_soft_reserve_enabled();
1144}796}
797
798static inline bool efi_rt_services_supported(unsigned int mask)
799{
800 return (efi.runtime_supported_mask & mask) == mask;
801}
1145#else802#else
1146static inline bool efi_enabled(int feature)803static inline bool efi_enabled(int feature)
1147{804{
@@ -1160,6 +817,11 @@ static inline bool efi_soft_reserve_enabled(void) · 12 unmodified lines
1160{817{
1161 return false;818 return false;
1162}819}
820
821static inline bool efi_rt_services_supported(unsigned int mask)
822{
823 return false;
824}
1163#endif825#endif
1164 826
1165extern int efi_status_to_err(efi_status_t status);827extern 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
1188 */850 */
1189#define EFI_VARIABLE_GUID_LEN UUID_STRING_LEN851#define EFI_VARIABLE_GUID_LEN UUID_STRING_LEN
1190 852
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
1198/*853/*
1199 * EFI Device Path information854 * EFI Device Path information
1200 */855 */
@@ -1234,30 +889,40 @@ extern int efi_status_to_err(efi_status_t status); · 33 unmodified lines
1234#define EFI_DEV_END_ENTIRE 0xFF889#define EFI_DEV_END_ENTIRE 0xFF
1235 890
1236struct efi_generic_dev_path {891struct efi_generic_dev_path {
1237 u8 type;892 u8 type;
1238 u8 sub_type;893 u8 sub_type;
1239 u16 length;894 u16 length;
1240} __attribute ((packed));895} __packed;
896
897struct efi_acpi_dev_path {
898 struct efi_generic_dev_path header;
899 u32 hid;
900 u32 uid;
901} __packed;
902
903struct efi_pci_dev_path {
904 struct efi_generic_dev_path header;
905 u8 fn;
906 u8 dev;
907} __packed;
908
909struct efi_vendor_dev_path {
910 struct efi_generic_dev_path header;
911 efi_guid_t vendorguid;
912 u8 vendordata[];
913} __packed;
1241 914
1242struct efi_dev_path {915struct 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 */
1246 union {916 union {
1247 struct {917 struct efi_generic_dev_path header;
1248 u32 hid;918 struct efi_acpi_dev_path acpi;
1249 u32 uid;919 struct efi_pci_dev_path pci;
1250 } acpi;920 struct efi_vendor_dev_path vendor;
1251 struct {
1252 u8 fn;
1253 u8 dev;
1254 } pci;
1255 };921 };
1256} __attribute ((packed));922} __packed;
1257 923
1258#if IS_ENABLED(CONFIG_EFI_DEV_PATH_PARSER)924struct device *efi_get_device_by_path(const struct efi_dev_path **node,
1259struct device *efi_get_device_by_path(struct efi_dev_path **node, size_t *len);925 size_t *len);
1260#endif
1261 926
1262static inline void memrange_efi_to_native(u64 *addr, u64 *npages)927static inline void memrange_efi_to_native(u64 *addr, u64 *npages)
1263{928{
@@ -1312,80 +977,6 @@ struct efivar_entry { · 48 unmodified lines
1312 bool deleting;977 bool deleting;
1313};978};
1314 979
1315union 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
1335typedef struct {
1336 u32 red_mask;
1337 u32 green_mask;
1338 u32 blue_mask;
1339 u32 reserved_mask;
1340} efi_pixel_bitmask_t;
1341
1342typedef 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
1351typedef union efi_graphics_output_protocol_mode efi_graphics_output_protocol_mode_t;
1352
1353union 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
1372typedef union efi_graphics_output_protocol efi_graphics_output_protocol_t;
1373
1374union 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
1389extern struct list_head efivar_sysfs_list;980extern struct list_head efivar_sysfs_list;
1390 981
1391static inline void982static inline void
@@ -1483,52 +1074,6 @@ static inline int efi_runtime_map_copy(void *buf, size_t bufsz) · 91 unmodified lines
1483 1074
1484#endif1075#endif
1485 1076
1486/* prototypes shared between arch specific and generic stub code */
1487
1488void efi_printk(char *str);
1489
1490void efi_free(unsigned long size, unsigned long addr);
1491
1492char *efi_convert_cmdline(efi_loaded_image_t *image, int *cmd_line_len);
1493
1494efi_status_t efi_get_memory_map(struct efi_boot_memmap *map);
1495
1496efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align,
1497 unsigned long *addr, unsigned long min);
1498
1499static inline
1500efi_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
1511efi_status_t efi_high_alloc(unsigned long size, unsigned long align,
1512 unsigned long *addr, unsigned long max);
1513
1514efi_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
1521efi_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
1527efi_status_t efi_parse_options(char const *cmdline);
1528
1529efi_status_t efi_setup_gop(struct screen_info *si, efi_guid_t *proto,
1530 unsigned long size);
1531
1532#ifdef CONFIG_EFI1077#ifdef CONFIG_EFI
1533extern bool efi_runtime_disabled(void);1078extern bool efi_runtime_disabled(void);
1534#else1079#else
@@ -1553,6 +1098,12 @@ static inline void · 18 unmodified lines
1553efi_enable_reset_attack_mitigation(void) { }1098efi_enable_reset_attack_mitigation(void) { }
1554#endif1099#endif
1555 1100
1101#ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
1102void efi_check_for_embedded_firmwares(void);
1103#else
1104static inline void efi_check_for_embedded_firmwares(void) { }
1105#endif
1106
1556efi_status_t efi_random_get_seed(void);1107efi_status_t efi_random_get_seed(void);
1557 1108
1558void efi_retrieve_tpm2_eventlog(void);1109void efi_retrieve_tpm2_eventlog(void);
@@ -1606,15 +1157,6 @@ void efi_retrieve_tpm2_eventlog(void); · 47 unmodified lines
1606 arch_efi_call_virt_teardown(); \1157 arch_efi_call_virt_teardown(); \
1607})1158})
1608 1159
1609typedef efi_status_t (*efi_exit_boot_map_processing)(
1610 struct efi_boot_memmap *map,
1611 void *priv);
1612
1613efi_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
1618#define EFI_RANDOM_SEED_SIZE 64U1160#define EFI_RANDOM_SEED_SIZE 64U
1619 1161
1620struct linux_efi_random_seed {1162struct linux_efi_random_seed {
@@ -1701,6 +1243,6 @@ struct linux_efi_memreserve { · 80 unmodified lines
1701#define EFI_MEMRESERVE_COUNT(size) (((size) - sizeof(struct linux_efi_memreserve)) \1243#define EFI_MEMRESERVE_COUNT(size) (((size) - sizeof(struct linux_efi_memreserve)) \
1702 / sizeof(((struct linux_efi_memreserve *)0)->entry[0]))1244 / sizeof(((struct linux_efi_memreserve *)0)->entry[0]))
1703 1245
1704void efi_pci_disable_bridge_busmaster(void);1246void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size);
1705 1247
1706#endif /* _LINUX_EFI_H */1248#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 */
14struct efi_embedded_fw {
15 struct list_head list;
16 const char *name;
17 const u8 *data;
18 size_t length;
19};
20
21extern 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 */
32struct 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
39extern const struct dmi_system_id touchscreen_dmi_table[];
40
41int 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
59 ELFNOTE_END59 ELFNOTE_END
60 60
61#else /* !__ASSEMBLER__ */61#else /* !__ASSEMBLER__ */
62#include <linux/elf.h>62#include <uapi/linux/elf.h>
63/*63/*
64 * Use an anonymous structure which matches the shape of64 * Use an anonymous structure which matches the shape of
65 * Elf{32,64}_Nhdr, but includes the name and desc data. The size and65 * 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
62 return 0;62 return 0;
63}63}
64 64
65/* Deprecated */
66#define PTR_RET(p) PTR_ERR_OR_ZERO(p)
67
68#endif65#endif
69 66
70#endif /* _LINUX_ERR_H */67#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
177bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,177bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
178 const unsigned long *src);178 const unsigned long *src);
179 179
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
180/**228/**
181 * struct ethtool_ops - optional netdev operations229 * struct ethtool_ops - optional netdev operations
230 * @supported_coalesce_params: supported types of interrupt coalescing.
182 * @get_drvinfo: Report driver/device information. Should only set the231 * @get_drvinfo: Report driver/device information. Should only set the
183 * @driver, @version, @fw_version and @bus_info fields. If not232 * @driver, @version, @fw_version and @bus_info fields. If not
184 * implemented, the @driver and @bus_info fields will be filled in233 * 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
207 * or zero.256 * or zero.
208 * @get_coalesce: Get interrupt coalescing parameters. Returns a negative257 * @get_coalesce: Get interrupt coalescing parameters. Returns a negative
209 * error code or zero.258 * error code or zero.
210 * @set_coalesce: Set interrupt coalescing parameters. Returns a negative259 * @set_coalesce: Set interrupt coalescing parameters. Supported coalescing
211 * error code or zero.260 * types should be set in @supported_coalesce_params.
261 * Returns a negative error code or zero.
212 * @get_ringparam: Report ring sizes262 * @get_ringparam: Report ring sizes
213 * @set_ringparam: Set ring sizes. Returns a negative error code or zero.263 * @set_ringparam: Set ring sizes. Returns a negative error code or zero.
214 * @get_pauseparam: Report pause parameters264 * @get_pauseparam: Report pause parameters
@@ -292,7 +342,8 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 77 unmodified lines
292 * @set_per_queue_coalesce: Set interrupt coalescing parameters per queue.342 * @set_per_queue_coalesce: Set interrupt coalescing parameters per queue.
293 * It must check that the given queue number is valid. If neither a RX nor343 * It must check that the given queue number is valid. If neither a RX nor
294 * a TX queue has this number, return -EINVAL. If only a RX queue or a TX344 * 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.
296 * Returns a negative error code or zero.347 * Returns a negative error code or zero.
297 * @get_link_ksettings: Get various device settings including Ethernet link348 * @get_link_ksettings: Get various device settings including Ethernet link
298 * settings. The %cmd and %link_mode_masks_nwords fields should be349 * 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
323 * of the generic netdev features interface.374 * of the generic netdev features interface.
324 */375 */
325struct ethtool_ops {376struct ethtool_ops {
377 u32 supported_coalesce_params;
326 void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);378 void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
327 int (*get_regs_len)(struct net_device *);379 int (*get_regs_len)(struct net_device *);
328 void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);380 void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
@@ -406,6 +458,8 @@ struct ethtool_ops { · 77 unmodified lines
406 struct ethtool_stats *, u64 *);458 struct ethtool_stats *, u64 *);
407};459};
408 460
461int ethtool_check_ops(const struct ethtool_ops *ops);
462
409struct ethtool_rx_flow_rule {463struct ethtool_rx_flow_rule {
410 struct flow_rule *rule;464 struct flow_rule *rule;
411 unsigned long priv[0];465 unsigned long priv[0];
@@ -420,4 +474,10 @@ struct ethtool_rx_flow_rule * · 8 unmodified lines
420ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input);474ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input);
421void ethtool_rx_flow_rule_destroy(struct ethtool_rx_flow_rule *rule);475void ethtool_rx_flow_rule_destroy(struct ethtool_rx_flow_rule *rule);
422 476
477bool ethtool_virtdev_validate_cmd(const struct ethtool_link_ksettings *cmd);
478int 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
423#endif /* _LINUX_ETHTOOL_H */483#endif /* _LINUX_ETHTOOL_H */
include/linux/extcon-provider.h+14−14
@@ -17,30 +17,30 @@ struct extcon_dev; · 16 unmodified lines
17#if IS_ENABLED(CONFIG_EXTCON)17#if IS_ENABLED(CONFIG_EXTCON)
18 18
19/* Following APIs register/unregister the extcon device. */19/* Following APIs register/unregister the extcon device. */
20extern int extcon_dev_register(struct extcon_dev *edev);20int extcon_dev_register(struct extcon_dev *edev);
21extern void extcon_dev_unregister(struct extcon_dev *edev);21void extcon_dev_unregister(struct extcon_dev *edev);
22extern int devm_extcon_dev_register(struct device *dev,22int devm_extcon_dev_register(struct device *dev,
23 struct extcon_dev *edev);23 struct extcon_dev *edev);
24extern void devm_extcon_dev_unregister(struct device *dev,24void devm_extcon_dev_unregister(struct device *dev,
25 struct extcon_dev *edev);25 struct extcon_dev *edev);
26 26
27/* Following APIs allocate/free the memory of the extcon device. */27/* Following APIs allocate/free the memory of the extcon device. */
28extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);28struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
29extern void extcon_dev_free(struct extcon_dev *edev);29void extcon_dev_free(struct extcon_dev *edev);
30extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,30struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
31 const unsigned int *cable);31 const unsigned int *cable);
32extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);32void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
33 33
34/* Synchronize the state and property value for each external connector. */34/* Synchronize the state and property value for each external connector. */
35extern int extcon_sync(struct extcon_dev *edev, unsigned int id);35int extcon_sync(struct extcon_dev *edev, unsigned int id);
36 36
37/*37/*
38 * Following APIs set the connected state of each external connector.38 * Following APIs set the connected state of each external connector.
39 * The 'id' argument indicates the defined external connector.39 * The 'id' argument indicates the defined external connector.
40 */40 */
41extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,41int extcon_set_state(struct extcon_dev *edev, unsigned int id,
42 bool state);42 bool state);
43extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,43int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
44 bool state);44 bool state);
45 45
46/*46/*
@@ -52,13 +52,13 @@ extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, · 5 unmodified lines
52 * for each external connector. They are used to set the capability of the52 * for each external connector. They are used to set the capability of the
53 * property of each external connector based on the id and property.53 * property of each external connector based on the id and property.
54 */54 */
55extern int extcon_set_property(struct extcon_dev *edev, unsigned int id,55int extcon_set_property(struct extcon_dev *edev, unsigned int id,
56 unsigned int prop,56 unsigned int prop,
57 union extcon_property_value prop_val);57 union extcon_property_value prop_val);
58extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,58int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
59 unsigned int prop,59 unsigned int prop,
60 union extcon_property_value prop_val);60 union extcon_property_value prop_val);
61extern int extcon_set_property_capability(struct extcon_dev *edev,61int extcon_set_property_capability(struct extcon_dev *edev,
62 unsigned int id, unsigned int prop);62 unsigned int id, unsigned int prop);
63 63
64#else /* CONFIG_EXTCON */64#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
286{286{
287 return ERR_PTR(-ENODEV);287 return ERR_PTR(-ENODEV);
288}288}
289
290static inline const char *extcon_get_edev_name(struct extcon_dev *edev)
291{
292 return NULL;
293}
289#endif /* CONFIG_EXTCON */294#endif /* CONFIG_EXTCON */
290 295
291/*296/*
include/linux/f2fs_fs.h+1−0
@@ -125,6 +125,7 @@ struct f2fs_super_block { · 124 unmodified lines
125/*125/*
126 * For checkpoint126 * For checkpoint
127 */127 */
128#define CP_RESIZEFS_FLAG 0x00004000
128#define CP_DISABLED_QUICK_FLAG 0x00002000129#define CP_DISABLED_QUICK_FLAG 0x00002000
129#define CP_DISABLED_FLAG 0x00001000130#define CP_DISABLED_FLAG 0x00001000
130#define CP_QUOTA_NEED_FSCK_FLAG 0x00000800131#define CP_QUOTA_NEED_FSCK_FLAG 0x00000800
include/linux/fanotify.h+2−1
@@ -47,7 +47,8 @@ · 46 unmodified lines
47 * Directory entry modification events - reported only to directory47 * Directory entry modification events - reported only to directory
48 * where entry is modified and not to a watching parent.48 * where entry is modified and not to a watching parent.
49 */49 */
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)
51 52
52/* Events that can only be reported with data type FSNOTIFY_EVENT_INODE */53/* Events that can only be reported with data type FSNOTIFY_EVENT_INODE */
53#define FANOTIFY_INODE_EVENTS (FANOTIFY_DIRENT_EVENTS | \54#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
85extern int replace_fd(unsigned fd, struct file *file, unsigned flags);85extern int replace_fd(unsigned fd, struct file *file, unsigned flags);
86extern void set_close_on_exec(unsigned int fd, int flag);86extern void set_close_on_exec(unsigned int fd, int flag);
87extern bool get_close_on_exec(unsigned int fd);87extern bool get_close_on_exec(unsigned int fd);
88extern int __get_unused_fd_flags(unsigned flags, unsigned long nofile);
88extern int get_unused_fd_flags(unsigned flags);89extern int get_unused_fd_flags(unsigned flags);
89extern void put_unused_fd(unsigned int fd);90extern void put_unused_fd(unsigned int fd);
90 91
include/linux/filter.h+31−17
@@ -561,7 +561,7 @@ DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key); · 560 unmodified lines
561 561
562#define __BPF_PROG_RUN(prog, ctx, dfunc) ({ \562#define __BPF_PROG_RUN(prog, ctx, dfunc) ({ \
563 u32 ret; \563 u32 ret; \
564 cant_sleep(); \564 cant_migrate(); \
565 if (static_branch_unlikely(&bpf_stats_enabled_key)) { \565 if (static_branch_unlikely(&bpf_stats_enabled_key)) { \
566 struct bpf_prog_stats *stats; \566 struct bpf_prog_stats *stats; \
567 u64 start = sched_clock(); \567 u64 start = sched_clock(); \
@@ -576,8 +576,30 @@ DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key); · 8 unmodified lines
576 } \576 } \
577 ret; })577 ret; })
578 578
579#define BPF_PROG_RUN(prog, ctx) __BPF_PROG_RUN(prog, ctx, \579#define BPF_PROG_RUN(prog, ctx) \
580 bpf_dispatcher_nopfunc)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 */
593static 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}
581 603
582#define BPF_SKB_CB_LEN QDISC_CB_PRIV_LEN604#define BPF_SKB_CB_LEN QDISC_CB_PRIV_LEN
583 605
@@ -655,6 +677,7 @@ static inline u8 *bpf_skb_cb(struct sk_buff *skb) · 71 unmodified lines
655 return qdisc_skb_cb(skb)->data;677 return qdisc_skb_cb(skb)->data;
656}678}
657 679
680/* Must be invoked with migration disabled */
658static inline u32 __bpf_prog_run_save_cb(const struct bpf_prog *prog,681static inline u32 __bpf_prog_run_save_cb(const struct bpf_prog *prog,
659 struct sk_buff *skb)682 struct sk_buff *skb)
660{683{
@@ -680,9 +703,9 @@ static inline u32 bpf_prog_run_save_cb(const struct bpf_prog *prog, · 19 unmodified lines
680{703{
681 u32 res;704 u32 res;
682 705
683 preempt_disable();706 migrate_disable();
684 res = __bpf_prog_run_save_cb(prog, skb);707 res = __bpf_prog_run_save_cb(prog, skb);
685 preempt_enable();708 migrate_enable();
686 return res;709 return res;
687}710}
688 711
@@ -695,13 +718,11 @@ static inline u32 bpf_prog_run_clear_cb(const struct bpf_prog *prog, · 6 unmodified lines
695 if (unlikely(prog->cb_access))718 if (unlikely(prog->cb_access))
696 memset(cb_data, 0, BPF_SKB_CB_LEN);719 memset(cb_data, 0, BPF_SKB_CB_LEN);
697 720
698 preempt_disable();721 res = bpf_prog_run_pin_on_cpu(prog, skb);
699 res = BPF_PROG_RUN(prog, skb);
700 preempt_enable();
701 return res;722 return res;
702}723}
703 724
704DECLARE_BPF_DISPATCHER(bpf_dispatcher_xdp)725DECLARE_BPF_DISPATCHER(xdp)
705 726
706static __always_inline u32 bpf_prog_run_xdp(const struct bpf_prog *prog,727static __always_inline u32 bpf_prog_run_xdp(const struct bpf_prog *prog,
707 struct xdp_buff *xdp)728 struct xdp_buff *xdp)
@@ -712,8 +733,7 @@ static __always_inline u32 bpf_prog_run_xdp(const struct bpf_prog *prog, · 4 unmodified lines
712 * already takes rcu_read_lock() when fetching the program, so733 * already takes rcu_read_lock() when fetching the program, so
713 * it's not necessary here anymore.734 * it's not necessary here anymore.
714 */735 */
715 return __BPF_PROG_RUN(prog, xdp,736 return __BPF_PROG_RUN(prog, xdp, BPF_DISPATCHER_FUNC(xdp));
716 BPF_DISPATCHER_FUNC(bpf_dispatcher_xdp));
717}737}
718 738
719void bpf_prog_change_xdp(struct bpf_prog *prev_prog, struct bpf_prog *prog);739void 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
1063 1083
1064void bpf_prog_kallsyms_add(struct bpf_prog *fp);1084void bpf_prog_kallsyms_add(struct bpf_prog *fp);
1065void bpf_prog_kallsyms_del(struct bpf_prog *fp);1085void bpf_prog_kallsyms_del(struct bpf_prog *fp);
1066void bpf_get_prog_name(const struct bpf_prog *prog, char *sym);
1067 1086
1068#else /* CONFIG_BPF_JIT */1087#else /* CONFIG_BPF_JIT */
1069 1088
@@ -1132,11 +1151,6 @@ static inline void bpf_prog_kallsyms_del(struct bpf_prog *fp) · 62 unmodified lines
1132{1151{
1133}1152}
1134 1153
1135static inline void bpf_get_prog_name(const struct bpf_prog *prog, char *sym)
1136{
1137 sym[0] = '\0';
1138}
1139
1140#endif /* CONFIG_BPF_JIT */1154#endif /* CONFIG_BPF_JIT */
1141 1155
1142void bpf_prog_kallsyms_del_all(struct bpf_prog *fp);1156void 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
44 struct device *device);44 struct device *device);
45int firmware_request_nowarn(const struct firmware **fw, const char *name,45int firmware_request_nowarn(const struct firmware **fw, const char *name,
46 struct device *device);46 struct device *device);
47int firmware_request_platform(const struct firmware **fw, const char *name,
48 struct device *device);
47int request_firmware_nowait(49int request_firmware_nowait(
48 struct module *module, bool uevent,50 struct module *module, bool uevent,
49 const char *name, struct device *device, gfp_t gfp, void *context,51 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
69 return -EINVAL;71 return -EINVAL;
70}72}
71 73
74static inline int firmware_request_platform(const struct firmware **fw,
75 const char *name,
76 struct device *device)
77{
78 return -EINVAL;
79}
80
72static inline int request_firmware_nowait(81static inline int request_firmware_nowait(
73 struct module *module, bool uevent,82 struct module *module, bool uevent,
74 const char *name, struct device *device, gfp_t gfp, void *context,83 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
25 IMX_SC_RPC_SVC_PAD = 6,25 IMX_SC_RPC_SVC_PAD = 6,
26 IMX_SC_RPC_SVC_MISC = 7,26 IMX_SC_RPC_SVC_MISC = 7,
27 IMX_SC_RPC_SVC_IRQ = 8,27 IMX_SC_RPC_SVC_IRQ = 8,
28 IMX_SC_RPC_SVC_ABORT = 9
29};28};
30 29
31struct imx_sc_rpc_msg {30struct imx_sc_rpc_msg {
include/linux/firmware/meson/meson_sm.h+2−0
@@ -12,6 +12,8 @@ enum { · 11 unmodified lines
12 SM_EFUSE_WRITE,12 SM_EFUSE_WRITE,
13 SM_EFUSE_USER_MAX,13 SM_EFUSE_USER_MAX,
14 SM_GET_CHIP_ID,14 SM_GET_CHIP_ID,
15 SM_A1_PWRC_SET,
16 SM_A1_PWRC_GET,
15};17};
16 18
17struct meson_sm_firmware;19struct meson_sm_firmware;
include/linux/firmware/xlnx-zynqmp.h+11−2
@@ -82,6 +82,7 @@ enum pm_api_id { · 81 unmodified lines
82 PM_CLOCK_GETRATE,82 PM_CLOCK_GETRATE,
83 PM_CLOCK_SETPARENT,83 PM_CLOCK_SETPARENT,
84 PM_CLOCK_GETPARENT,84 PM_CLOCK_GETPARENT,
85 PM_SECURE_AES = 47,
85 PM_FEATURE_CHECK = 63,86 PM_FEATURE_CHECK = 63,
86 PM_API_MAX,87 PM_API_MAX,
87};88};
@@ -100,7 +101,8 @@ enum pm_ret_status { · 12 unmodified lines
100};101};
101 102
102enum pm_ioctl_id {103enum pm_ioctl_id {
103 IOCTL_SET_SD_TAPDELAY = 7,104 IOCTL_SD_DLL_RESET = 6,
105 IOCTL_SET_SD_TAPDELAY,
104 IOCTL_SET_PLL_FRAC_MODE,106 IOCTL_SET_PLL_FRAC_MODE,
105 IOCTL_GET_PLL_FRAC_MODE,107 IOCTL_GET_PLL_FRAC_MODE,
106 IOCTL_SET_PLL_FRAC_DATA,108 IOCTL_SET_PLL_FRAC_DATA,
@@ -271,6 +273,12 @@ enum tap_delay_type { · 164 unmodified lines
271 PM_TAPDELAY_OUTPUT,273 PM_TAPDELAY_OUTPUT,
272};274};
273 275
276enum dll_reset_type {
277 PM_DLL_RESET_ASSERT,
278 PM_DLL_RESET_RELEASE,
279 PM_DLL_RESET_PULSE,
280};
281
274/**282/**
275 * struct zynqmp_pm_query_data - PM query data283 * struct zynqmp_pm_query_data - PM query data
276 * @qid: query ID284 * @qid: query ID
@@ -315,12 +323,13 @@ struct zynqmp_eemi_ops { · 38 unmodified lines
315 const u32 capabilities,323 const u32 capabilities,
316 const u32 qos,324 const u32 qos,
317 const enum zynqmp_pm_request_ack ack);325 const enum zynqmp_pm_request_ack ack);
326 int (*aes)(const u64 address, u32 *out);
318};327};
319 328
320int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1,329int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1,
321 u32 arg2, u32 arg3, u32 *ret_payload);330 u32 arg2, u32 arg3, u32 *ret_payload);
322 331
323#if IS_REACHABLE(CONFIG_ARCH_ZYNQMP)332#if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE)
324const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void);333const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void);
325#else334#else
326static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)335static 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
526 down_write(&mapping->i_mmap_rwsem);526 down_write(&mapping->i_mmap_rwsem);
527}527}
528 528
529static inline int i_mmap_trylock_write(struct address_space *mapping)
530{
531 return down_write_trylock(&mapping->i_mmap_rwsem);
532}
533
529static inline void i_mmap_unlock_write(struct address_space *mapping)534static inline void i_mmap_unlock_write(struct address_space *mapping)
530{535{
531 up_write(&mapping->i_mmap_rwsem);536 up_write(&mapping->i_mmap_rwsem);
@@ -698,6 +703,7 @@ struct inode { · 166 unmodified lines
698 struct rcu_head i_rcu;703 struct rcu_head i_rcu;
699 };704 };
700 atomic64_t i_version;705 atomic64_t i_version;
706 atomic64_t i_sequence; /* see futex */
701 atomic_t i_count;707 atomic_t i_count;
702 atomic_t i_dio_count;708 atomic_t i_dio_count;
703 atomic_t i_writecount;709 atomic_t i_writecount;
@@ -2699,7 +2705,6 @@ static inline void unregister_chrdev(unsigned int major, const char *name) · 1995 unmodified lines
2699 2705
2700#ifdef CONFIG_BLOCK2706#ifdef CONFIG_BLOCK
2701#define BLKDEV_MAJOR_MAX 5122707#define BLKDEV_MAJOR_MAX 512
2702extern const char *__bdevname(dev_t, char *buffer);
2703extern const char *bdevname(struct block_device *bdev, char *buffer);2708extern const char *bdevname(struct block_device *bdev, char *buffer);
2704extern struct block_device *lookup_bdev(const char *);2709extern struct block_device *lookup_bdev(const char *);
2705extern void blkdev_show(struct seq_file *,off_t);2710extern void blkdev_show(struct seq_file *,off_t);
@@ -2982,6 +2987,7 @@ extern int do_pipe_flags(int *, int); · 276 unmodified lines
2982 id(UNKNOWN, unknown) \2987 id(UNKNOWN, unknown) \
2983 id(FIRMWARE, firmware) \2988 id(FIRMWARE, firmware) \
2984 id(FIRMWARE_PREALLOC_BUFFER, firmware) \2989 id(FIRMWARE_PREALLOC_BUFFER, firmware) \
2990 id(FIRMWARE_EFI_EMBEDDED, firmware) \
2985 id(MODULE, kernel-module) \2991 id(MODULE, kernel-module) \
2986 id(KEXEC_IMAGE, kexec-image) \2992 id(KEXEC_IMAGE, kexec-image) \
2987 id(KEXEC_INITRAMFS, kexec-initramfs) \2993 id(KEXEC_INITRAMFS, kexec-initramfs) \
@@ -3012,6 +3018,8 @@ extern int kernel_read_file(struct file *, void **, loff_t *, loff_t, · 24 unmodified lines
3012 enum kernel_read_file_id);3018 enum kernel_read_file_id);
3013extern int kernel_read_file_from_path(const char *, void **, loff_t *, loff_t,3019extern int kernel_read_file_from_path(const char *, void **, loff_t *, loff_t,
3014 enum kernel_read_file_id);3020 enum kernel_read_file_id);
3021extern int kernel_read_file_from_path_initns(const char *, void **, loff_t *, loff_t,
3022 enum kernel_read_file_id);
3015extern int kernel_read_file_from_fd(int, void **, loff_t *, loff_t,3023extern int kernel_read_file_from_fd(int, void **, loff_t *, loff_t,
3016 enum kernel_read_file_id);3024 enum kernel_read_file_id);
3017extern ssize_t kernel_read(struct file *, void *, size_t, loff_t *);3025extern 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
3391 return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host);3399 return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host);
3392}3400}
3393 3401
3394static inline bool vma_is_dax(struct vm_area_struct *vma)3402static inline bool vma_is_dax(const struct vm_area_struct *vma)
3395{3403{
3396 return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host);3404 return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host);
3397}3405}
include/linux/fscrypt.h+6−0
@@ -139,6 +139,7 @@ extern void fscrypt_free_bounce_page(struct page *bounce_page); · 138 unmodified lines
139extern int fscrypt_ioctl_set_policy(struct file *, const void __user *);139extern int fscrypt_ioctl_set_policy(struct file *, const void __user *);
140extern int fscrypt_ioctl_get_policy(struct file *, void __user *);140extern int fscrypt_ioctl_get_policy(struct file *, void __user *);
141extern int fscrypt_ioctl_get_policy_ex(struct file *, void __user *);141extern int fscrypt_ioctl_get_policy_ex(struct file *, void __user *);
142extern int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg);
142extern int fscrypt_has_permitted_context(struct inode *, struct inode *);143extern int fscrypt_has_permitted_context(struct inode *, struct inode *);
143extern int fscrypt_inherit_context(struct inode *, struct inode *,144extern int fscrypt_inherit_context(struct inode *, struct inode *,
144 void *, bool);145 void *, bool);
@@ -300,6 +301,11 @@ static inline int fscrypt_ioctl_get_policy_ex(struct file *filp, · 155 unmodified lines
300 return -EOPNOTSUPP;301 return -EOPNOTSUPP;
301}302}
302 303
304static inline int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg)
305{
306 return -EOPNOTSUPP;
307}
308
303static inline int fscrypt_has_permitted_context(struct inode *parent,309static inline int fscrypt_has_permitted_context(struct inode *parent,
304 struct inode *child)310 struct inode *child)
305{311{
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
381 381
382void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);382void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
383 383
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 */
392struct fsl_mc_version {
393 u32 major;
394 u32 minor;
395 u32 revision;
396};
397
398struct fsl_mc_version *fsl_mc_get_version(void);
399
384int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,400int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
385 u16 mc_io_flags,401 u16 mc_io_flags,
386 struct fsl_mc_io **new_mc_io);402 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
149 bool extts_fifo_support;149 bool extts_fifo_support;
150 int irq;150 int irq;
151 int phc_index;151 int phc_index;
152 u64 alarm_interval; /* for periodic alarm */
153 u64 alarm_value;
154 u32 tclk_period; /* nanoseconds */152 u32 tclk_period; /* nanoseconds */
155 u32 tmr_prsc;153 u32 tmr_prsc;
156 u32 tmr_add;154 u32 tmr_add;
include/linux/fsnotify.h+58−80
@@ -18,39 +18,63 @@ · 17 unmodified lines
18#include <linux/bug.h>18#include <linux/bug.h>
19 19
20/*20/*
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).
22 *24 *
23 * Unlike fsnotify_parent(), the event will be reported regardless of the25 * Unlike fsnotify_parent(), the event will be reported regardless of the
24 * FS_EVENT_ON_CHILD mask on the parent inode.26 * FS_EVENT_ON_CHILD mask on the parent inode.
25 */27 */
26static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry,28static inline void fsnotify_name(struct inode *dir, __u32 mask,
27 __u32 mask)29 struct inode *child,
30 const struct qstr *name, u32 cookie)
28{31{
29 return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE,32 fsnotify(dir, mask, child, FSNOTIFY_EVENT_INODE, name, cookie);
30 &dentry->d_name, 0);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);
31}39}
32 40
33/* Notify this dentry's parent about a child's events. */41static inline void fsnotify_dirent(struct inode *dir, struct dentry *dentry,
34static inline int fsnotify_parent(const struct path *path,42 __u32 mask)
35 struct dentry *dentry, __u32 mask)
36{43{
37 if (!dentry)44 fsnotify_name(dir, mask, d_inode(dentry), &dentry->d_name, 0);
38 dentry = path->dentry;
39
40 return __fsnotify_parent(path, dentry, mask);
41}45}
42 46
43/*47/*
44 * Simple wrapper to consolidate calls fsnotify_parent()/fsnotify() when48 * Simple wrappers to consolidate calls fsnotify_parent()/fsnotify() when
45 * an event is on a path.49 * an event is on a file/dentry.
46 */50 */
47static inline int fsnotify_path(struct inode *inode, const struct path *path,51static inline void fsnotify_dentry(struct dentry *dentry, __u32 mask)
48 __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
62static inline int fsnotify_file(struct file *file, __u32 mask)
49{63{
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;
51 73
74 ret = fsnotify_parent(path->dentry, mask, path, FSNOTIFY_EVENT_PATH);
52 if (ret)75 if (ret)
53 return ret;76 return ret;
77
54 return fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);78 return fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
55}79}
56 80
@@ -58,19 +82,16 @@ static inline int fsnotify_path(struct inode *inode, const struct path *path, · 1 unmodified line
58static inline int fsnotify_perm(struct file *file, int mask)82static inline int fsnotify_perm(struct file *file, int mask)
59{83{
60 int ret;84 int ret;
61 const struct path *path = &file->f_path;
62 struct inode *inode = file_inode(file);
63 __u32 fsnotify_mask = 0;85 __u32 fsnotify_mask = 0;
64 86
65 if (file->f_mode & FMODE_NONOTIFY)
66 return 0;
67 if (!(mask & (MAY_READ | MAY_OPEN)))87 if (!(mask & (MAY_READ | MAY_OPEN)))
68 return 0;88 return 0;
89
69 if (mask & MAY_OPEN) {90 if (mask & MAY_OPEN) {
70 fsnotify_mask = FS_OPEN_PERM;91 fsnotify_mask = FS_OPEN_PERM;
71 92
72 if (file->f_flags & __FMODE_EXEC) {93 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);
74 95
75 if (ret)96 if (ret)
76 return ret;97 return ret;
@@ -79,10 +100,7 @@ static inline int fsnotify_perm(struct file *file, int mask) · 2 unmodified lines
79 fsnotify_mask = FS_ACCESS_PERM;100 fsnotify_mask = FS_ACCESS_PERM;
80 }101 }
81 102
82 if (S_ISDIR(inode->i_mode))103 return fsnotify_file(file, fsnotify_mask);
83 fsnotify_mask |= FS_ISDIR;
84
85 return fsnotify_path(inode, path, fsnotify_mask);
86}104}
87 105
88/*106/*
@@ -122,10 +140,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, · 33 unmodified lines
122 mask |= FS_ISDIR;140 mask |= FS_ISDIR;
123 }141 }
124 142
125 fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name,143 fsnotify_name(old_dir, old_dir_mask, source, old_name, fs_cookie);
126 fs_cookie);144 fsnotify_name(new_dir, new_dir_mask, source, new_name, fs_cookie);
127 fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name,
128 fs_cookie);
129 145
130 if (target)146 if (target)
131 fsnotify_link_count(target);147 fsnotify_link_count(target);
@@ -180,12 +196,13 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) · 48 unmodified lines
180 * Note: We have to pass also the linked inode ptr as some filesystems leave196 * Note: We have to pass also the linked inode ptr as some filesystems leave
181 * new_dentry->d_inode NULL and instantiate inode pointer later197 * new_dentry->d_inode NULL and instantiate inode pointer later
182 */198 */
183static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)199static inline void fsnotify_link(struct inode *dir, struct inode *inode,
200 struct dentry *new_dentry)
184{201{
185 fsnotify_link_count(inode);202 fsnotify_link_count(inode);
186 audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE);203 audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE);
187 204
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);
189}206}
190 207
191/*208/*
@@ -229,15 +246,7 @@ static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) · 37 unmodified lines
229 */246 */
230static inline void fsnotify_access(struct file *file)247static inline void fsnotify_access(struct file *file)
231{248{
232 const struct path *path = &file->f_path;249 fsnotify_file(file, FS_ACCESS);
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);
241}250}
242 251
243/*252/*
@@ -245,15 +254,7 @@ static inline void fsnotify_access(struct file *file) · 1 unmodified line
245 */254 */
246static inline void fsnotify_modify(struct file *file)255static inline void fsnotify_modify(struct file *file)
247{256{
248 const struct path *path = &file->f_path;257 fsnotify_file(file, FS_MODIFY);
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}258}
258 259
259/*260/*
@@ -261,16 +262,12 @@ static inline void fsnotify_modify(struct file *file) · 1 unmodified line
261 */262 */
262static inline void fsnotify_open(struct file *file)263static inline void fsnotify_open(struct file *file)
263{264{
264 const struct path *path = &file->f_path;
265 struct inode *inode = file_inode(file);
266 __u32 mask = FS_OPEN;265 __u32 mask = FS_OPEN;
267 266
268 if (S_ISDIR(inode->i_mode))
269 mask |= FS_ISDIR;
270 if (file->f_flags & __FMODE_EXEC)267 if (file->f_flags & __FMODE_EXEC)
271 mask |= FS_OPEN_EXEC;268 mask |= FS_OPEN_EXEC;
272 269
273 fsnotify_path(inode, path, mask);270 fsnotify_file(file, mask);
274}271}
275 272
276/*273/*
@@ -278,16 +275,10 @@ static inline void fsnotify_open(struct file *file) · 1 unmodified line
278 */275 */
279static inline void fsnotify_close(struct file *file)276static inline void fsnotify_close(struct file *file)
280{277{
281 const struct path *path = &file->f_path;278 __u32 mask = (file->f_mode & FMODE_WRITE) ? FS_CLOSE_WRITE :
282 struct inode *inode = file_inode(file);279 FS_CLOSE_NOWRITE;
283 fmode_t mode = file->f_mode;
284 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
285 280
286 if (S_ISDIR(inode->i_mode))281 fsnotify_file(file, mask);
287 mask |= FS_ISDIR;
288
289 if (!(file->f_mode & FMODE_NONOTIFY))
290 fsnotify_path(inode, path, mask);
291}282}
292 283
293/*284/*
@@ -295,14 +286,7 @@ static inline void fsnotify_close(struct file *file) · 1 unmodified line
295 */286 */
296static inline void fsnotify_xattr(struct dentry *dentry)287static inline void fsnotify_xattr(struct dentry *dentry)
297{288{
298 struct inode *inode = dentry->d_inode;289 fsnotify_dentry(dentry, FS_ATTRIB);
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);
306}290}
307 291
308/*292/*
@@ -311,7 +295,6 @@ static inline void fsnotify_xattr(struct dentry *dentry) · 2 unmodified lines
311 */295 */
312static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)296static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
313{297{
314 struct inode *inode = dentry->d_inode;
315 __u32 mask = 0;298 __u32 mask = 0;
316 299
317 if (ia_valid & ATTR_UID)300 if (ia_valid & ATTR_UID)
@@ -332,13 +315,8 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) · 14 unmodified lines
332 if (ia_valid & ATTR_MODE)315 if (ia_valid & ATTR_MODE)
333 mask |= FS_ATTRIB;316 mask |= FS_ATTRIB;
334 317
335 if (mask) {318 if (mask)
336 if (S_ISDIR(inode->i_mode))319 fsnotify_dentry(dentry, mask);
337 mask |= FS_ISDIR;
338
339 fsnotify_parent(NULL, dentry, mask);
340 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
341 }
342}320}
343 321
344#endif /* _LINUX_FS_NOTIFY_H */322#endif /* _LINUX_FS_NOTIFY_H */
include/linux/fsnotify_backend.h+49−21
@@ -47,18 +47,18 @@ · 46 unmodified lines
47#define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */47#define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */
48#define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */48#define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */
49#define FS_OPEN_EXEC_PERM 0x00040000 /* open/exec event in a permission hook */49#define FS_OPEN_EXEC_PERM 0x00040000 /* open/exec event in a permission hook */
50#define FS_DIR_MODIFY 0x00080000 /* Directory entry was modified */
50 51
51#define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */52#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
58/* This inode cares about things that happen to its children. Always set for53/* This inode cares about things that happen to its children. Always set for
59 * dnotify and inotify. */54 * dnotify and inotify. */
60#define FS_EVENT_ON_CHILD 0x0800000055#define FS_EVENT_ON_CHILD 0x08000000
61 56
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
62#define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO)62#define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO)
63 63
64/*64/*
@@ -67,7 +67,8 @@ · 2 unmodified lines
67 * The watching parent may get an FS_ATTRIB|FS_EVENT_ON_CHILD event67 * The watching parent may get an FS_ATTRIB|FS_EVENT_ON_CHILD event
68 * when a directory entry inside a child subdir changes.68 * when a directory entry inside a child subdir changes.
69 */69 */
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)
71 72
72#define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM | \73#define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM | \
73 FS_OPEN_EXEC_PERM)74 FS_OPEN_EXEC_PERM)
@@ -133,8 +134,7 @@ struct fsnotify_ops { · 59 unmodified lines
133 */134 */
134struct fsnotify_event {135struct fsnotify_event {
135 struct list_head list;136 struct list_head list;
136 /* inode may ONLY be dereferenced during handle_event(). */137 unsigned long objectid; /* identifier for queue merges */
137 struct inode *inode; /* either the inode the event happened to or its parent */
138};138};
139 139
140/*140/*
@@ -213,10 +213,36 @@ struct fsnotify_group { · 72 unmodified lines
213 };213 };
214};214};
215 215
216/* when calling fsnotify tell it if the data is a path or inode */216/* When calling fsnotify tell it if the data is a path or inode */
217#define FSNOTIFY_EVENT_NONE 0217enum fsnotify_data_type {
218#define FSNOTIFY_EVENT_PATH 1218 FSNOTIFY_EVENT_NONE,
219#define FSNOTIFY_EVENT_INODE 2219 FSNOTIFY_EVENT_PATH,
220 FSNOTIFY_EVENT_INODE,
221};
222
223static 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
236static 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}
220 246
221enum fsnotify_obj_type {247enum fsnotify_obj_type {
222 FSNOTIFY_OBJ_TYPE_INODE,248 FSNOTIFY_OBJ_TYPE_INODE,
@@ -351,9 +377,10 @@ struct fsnotify_mark { · 128 unmodified lines
351/* called from the vfs helpers */377/* called from the vfs helpers */
352 378
353/* main fsnotify call to send events */379/* main fsnotify call to send events */
354extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,380extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data,
355 const struct qstr *name, u32 cookie);381 int data_type, const struct qstr *name, u32 cookie);
356extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask);382extern int fsnotify_parent(struct dentry *dentry, __u32 mask, const void *data,
383 int data_type);
357extern void __fsnotify_inode_delete(struct inode *inode);384extern void __fsnotify_inode_delete(struct inode *inode);
358extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);385extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
359extern void fsnotify_sb_delete(struct super_block *sb);386extern 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
500extern bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info);527extern bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info);
501 528
502static inline void fsnotify_init_event(struct fsnotify_event *event,529static inline void fsnotify_init_event(struct fsnotify_event *event,
503 struct inode *inode)530 unsigned long objectid)
504{531{
505 INIT_LIST_HEAD(&event->list);532 INIT_LIST_HEAD(&event->list);
506 event->inode = inode;533 event->objectid = objectid;
507}534}
508 535
509#else536#else
510 537
511static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,538static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data,
512 const struct qstr *name, u32 cookie)539 int data_type, const struct qstr *name, u32 cookie)
513{540{
514 return 0;541 return 0;
515}542}
516 543
517static inline int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask)544static inline int fsnotify_parent(struct dentry *dentry, __u32 mask,
545 const void *data, int data_type)
518{546{
519 return 0;547 return 0;
520}548}
include/linux/futex.h+10−7
@@ -31,23 +31,26 @@ struct task_struct; · 30 unmodified lines
31 31
32union futex_key {32union futex_key {
33 struct {33 struct {
34 u64 i_seq;
34 unsigned long pgoff;35 unsigned long pgoff;
35 struct inode *inode;36 unsigned int offset;
36 int offset;
37 } shared;37 } shared;
38 struct {38 struct {
39 union {
40 struct mm_struct *mm;
41 u64 __tmp;
42 };
39 unsigned long address;43 unsigned long address;
40 struct mm_struct *mm;44 unsigned int offset;
41 int offset;
42 } private;45 } private;
43 struct {46 struct {
47 u64 ptr;
44 unsigned long word;48 unsigned long word;
45 void *ptr;49 unsigned int offset;
46 int offset;
47 } both;50 } both;
48};51};
49 52
50#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }53#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = 0ULL } }
51 54
52#ifdef CONFIG_FUTEX55#ifdef CONFIG_FUTEX
53enum {56enum {
include/linux/fwnode.h+2−0
@@ -170,4 +170,6 @@ struct fwnode_operations { · 169 unmodified lines
170 } while (false)170 } while (false)
171#define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev)171#define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev)
172 172
173extern u32 fw_devlink_get_flags(void);
174
173#endif175#endif
include/linux/genhd.h+61−473
@@ -27,39 +27,8 @@ · 26 unmodified lines
27#define part_to_dev(part) (&((part)->__dev))27#define part_to_dev(part) (&((part)->__dev))
28 28
29extern struct device_type part_type;29extern struct device_type part_type;
30extern struct kobject *block_depr;
31extern struct class block_class;30extern struct class block_class;
32 31
33enum {
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
63#define DISK_MAX_PARTS 25632#define DISK_MAX_PARTS 256
64#define DISK_NAME_LEN 3233#define DISK_NAME_LEN 32
65 34
@@ -70,26 +39,12 @@ enum { · 4 unmodified lines
70#include <linux/fs.h>39#include <linux/fs.h>
71#include <linux/workqueue.h>40#include <linux/workqueue.h>
72 41
73struct 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
86struct disk_stats {42struct disk_stats {
87 u64 nsecs[NR_STAT_GROUPS];43 u64 nsecs[NR_STAT_GROUPS];
88 unsigned long sectors[NR_STAT_GROUPS];44 unsigned long sectors[NR_STAT_GROUPS];
89 unsigned long ios[NR_STAT_GROUPS];45 unsigned long ios[NR_STAT_GROUPS];
90 unsigned long merges[NR_STAT_GROUPS];46 unsigned long merges[NR_STAT_GROUPS];
91 unsigned long io_ticks;47 unsigned long io_ticks;
92 unsigned long time_in_queue;
93 local_t in_flight[2];48 local_t in_flight[2];
94};49};
95 50
@@ -133,17 +88,64 @@ struct hd_struct { · 37 unmodified lines
133 struct rcu_work rcu_work;88 struct rcu_work rcu_work;
134};89};
135 90
136#define GENHD_FL_REMOVABLE 191/**
137/* 2 is unused */92 * DOC: genhd capability flags
138#define GENHD_FL_MEDIA_CHANGE_NOTIFY 493 *
139#define GENHD_FL_CD 894 * ``GENHD_FL_REMOVABLE`` (0x0001): indicates that the block device
140#define GENHD_FL_UP 1695 * gives access to removable media.
141#define GENHD_FL_SUPPRESS_PARTITION_INFO 3296 * When set, the device remains present even when media is not
142#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */97 * inserted.
143#define GENHD_FL_NATIVE_CAPACITY 12898 * Must not be set for devices which are removed entirely when the
144#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 25699 * media is removed.
145#define GENHD_FL_NO_PART_SCAN 512100 *
146#define GENHD_FL_HIDDEN 1024101 * ``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
147 149
148enum {150enum {
149 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */151 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
@@ -189,7 +191,6 @@ struct gendisk { · 39 unmodified lines
189 * disks that can't be partitioned. */191 * disks that can't be partitioned. */
190 192
191 char disk_name[DISK_NAME_LEN]; /* name of major driver */193 char disk_name[DISK_NAME_LEN]; /* name of major driver */
192 char *(*devnode)(struct gendisk *gd, umode_t *mode);
193 194
194 unsigned short events; /* supported events */195 unsigned short events; /* supported events */
195 unsigned short event_flags; /* flags related to event processing */196 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
245 !(disk->flags & GENHD_FL_NO_PART_SCAN);246 !(disk->flags & GENHD_FL_NO_PART_SCAN);
246}247}
247 248
248static 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
260static inline dev_t disk_devt(struct gendisk *disk)249static inline dev_t disk_devt(struct gendisk *disk)
261{250{
262 return MKDEV(disk->major, disk->first_minor);251 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
295 struct gendisk *disk, unsigned int flags);284 struct gendisk *disk, unsigned int flags);
296extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter);285extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter);
297extern void disk_part_iter_exit(struct disk_part_iter *piter);286extern void disk_part_iter_exit(struct disk_part_iter *piter);
298 287extern bool disk_has_partitions(struct gendisk *disk);
299extern 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
333static 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
342static 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
350static 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
363static inline void part_stat_set_all(struct hd_struct *part, int value)
364{
365 memset(&part->dkstats, value, sizeof(struct disk_stats));
366}
367
368static inline int init_part_stats(struct hd_struct *part)
369{
370 return 1;
371}
372
373static 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
413unsigned int part_in_flight(struct request_queue *q, struct hd_struct *part);
414void part_in_flight_rw(struct request_queue *q, struct hd_struct *part,
415 unsigned int inflight[2]);
416void part_dec_in_flight(struct request_queue *q, struct hd_struct *part,
417 int rw);
418void part_inc_in_flight(struct request_queue *q, struct hd_struct *part,
419 int rw);
420
421static 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
429static inline void free_part_info(struct hd_struct *part)
430{
431 kfree(part->info);
432}
433
434void update_io_ticks(struct hd_struct *part, unsigned long now);
435 288
436/* block/genhd.c */289/* block/genhd.c */
437extern void device_add_disk(struct device *parent, struct gendisk *disk,290extern 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
461extern void disk_block_events(struct gendisk *disk);314extern void disk_block_events(struct gendisk *disk);
462extern void disk_unblock_events(struct gendisk *disk);315extern void disk_unblock_events(struct gendisk *disk);
463extern void disk_flush_events(struct gendisk *disk, unsigned int mask);316extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
317extern void set_capacity_revalidate_and_notify(struct gendisk *disk,
318 sector_t size, bool revalidate);
464extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);319extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);
465 320
466/* drivers/char/random.c */321/* drivers/char/random.c */
@@ -480,170 +335,11 @@ static inline void set_capacity(struct gendisk *disk, sector_t size) · 13 unmodified lines
480 disk->part0.nr_sects = size;335 disk->part0.nr_sects = size;
481}336}
482 337
483#ifdef CONFIG_SOLARIS_X86_PARTITION
484
485#define SOLARIS_X86_NUMSLICE 16
486#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL)
487
488struct 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
495struct 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 */
523struct 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
579struct 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
586struct 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
630extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt);
631extern void blk_free_devt(dev_t devt);
632extern void blk_invalidate_devt(dev_t devt);
633extern dev_t blk_lookup_devt(const char *name, int partno);338extern dev_t blk_lookup_devt(const char *name, int partno);
634extern char *disk_name (struct gendisk *hd, int partno, char *buf);
635 339
636int bdev_disk_changed(struct block_device *bdev, bool invalidate);340int bdev_disk_changed(struct block_device *bdev, bool invalidate);
637int blk_add_partitions(struct gendisk *disk, struct block_device *bdev);341int blk_add_partitions(struct gendisk *disk, struct block_device *bdev);
638int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev);342int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev);
639extern int disk_expand_part_tbl(struct gendisk *disk, int target);
640extern 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);
645extern void __delete_partition(struct percpu_ref *);
646extern void delete_partition(struct gendisk *, int);
647extern void printk_all_partitions(void);343extern void printk_all_partitions(void);
648 344
649extern struct gendisk *__alloc_disk_node(int minors, int node_id);345extern 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
657 void *data);353 void *data);
658extern void blk_unregister_region(dev_t devt, unsigned long range);354extern void blk_unregister_region(dev_t devt, unsigned long range);
659 355
660extern ssize_t part_size_show(struct device *dev,
661 struct device_attribute *attr, char *buf);
662extern ssize_t part_stat_show(struct device *dev,
663 struct device_attribute *attr, char *buf);
664extern ssize_t part_inflight_show(struct device *dev,
665 struct device_attribute *attr, char *buf);
666#ifdef CONFIG_FAIL_MAKE_REQUEST
667extern ssize_t part_fail_show(struct device *dev,
668 struct device_attribute *attr, char *buf);
669extern 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
674#define alloc_disk_node(minors, node_id) \356#define alloc_disk_node(minors, node_id) \
675({ \357({ \
676 static struct lock_class_key __key; \358 static struct lock_class_key __key; \
@@ -689,100 +371,6 @@ extern ssize_t part_fail_store(struct device *dev, · 12 unmodified lines
689 371
690#define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE)372#define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE)
691 373
692static 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
700static inline void hd_struct_get(struct hd_struct *part)
701{
702 percpu_ref_get(&part->ref);
703}
704
705static inline int hd_struct_try_get(struct hd_struct *part)
706{
707 return percpu_ref_tryget_live(&part->ref);
708}
709
710static inline void hd_struct_put(struct hd_struct *part)
711{
712 percpu_ref_put(&part->ref);
713}
714
715static inline void hd_struct_kill(struct hd_struct *part)
716{
717 percpu_ref_kill(&part->ref);
718}
719
720static 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 */
736static 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 */
763static 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)
779extern void blk_integrity_add(struct gendisk *);
780extern void blk_integrity_del(struct gendisk *);
781#else /* CONFIG_BLK_DEV_INTEGRITY */
782static inline void blk_integrity_add(struct gendisk *disk) { }
783static inline void blk_integrity_del(struct gendisk *disk) { }
784#endif /* CONFIG_BLK_DEV_INTEGRITY */
785
786#else /* CONFIG_BLOCK */374#else /* CONFIG_BLOCK */
787 375
788static inline void printk_all_partitions(void) { }376static inline void printk_all_partitions(void) { }
include/linux/gfp.h+8−0
@@ -124,6 +124,8 @@ struct vm_area_struct; · 123 unmodified lines
124 *124 *
125 * Reclaim modifiers125 * Reclaim modifiers
126 * ~~~~~~~~~~~~~~~~~126 * ~~~~~~~~~~~~~~~~~
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).
127 *129 *
128 * %__GFP_IO can start physical IO.130 * %__GFP_IO can start physical IO.
129 *131 *
@@ -485,6 +487,12 @@ static inline void arch_free_page(struct page *page, int order) { } · 355 unmodified lines
485#ifndef HAVE_ARCH_ALLOC_PAGE487#ifndef HAVE_ARCH_ALLOC_PAGE
486static inline void arch_alloc_page(struct page *page, int order) { }488static inline void arch_alloc_page(struct page *page, int order) { }
487#endif489#endif
490#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE
491static inline int arch_make_page_accessible(struct page *page)
492{
493 return 0;
494}
495#endif
488 496
489struct page *497struct page *
490__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid,498__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
102#include <linux/kernel.h>102#include <linux/kernel.h>
103#include <linux/types.h>103#include <linux/types.h>
104#include <linux/bug.h>104#include <linux/bug.h>
105#include <linux/pinctrl/pinctrl.h>
106 105
107struct device;106struct device;
108struct gpio_chip;107struct gpio_chip;
109struct pinctrl_dev;
110 108
111static inline bool gpio_is_valid(int number)109static inline bool gpio_is_valid(int number)
112{110{
include/linux/gpio/consumer.h+12−1
@@ -2,9 +2,10 @@ · 1 unmodified line
2#ifndef __LINUX_GPIO_CONSUMER_H2#ifndef __LINUX_GPIO_CONSUMER_H
3#define __LINUX_GPIO_CONSUMER_H3#define __LINUX_GPIO_CONSUMER_H
4 4
5#include <linux/bits.h>
5#include <linux/bug.h>6#include <linux/bug.h>
7#include <linux/compiler_types.h>
6#include <linux/err.h>8#include <linux/err.h>
7#include <linux/kernel.h>
8 9
9struct device;10struct device;
10 11
@@ -156,6 +157,7 @@ int gpiod_set_raw_array_value_cansleep(unsigned int array_size, · 145 unmodified lines
156 struct gpio_array *array_info,157 struct gpio_array *array_info,
157 unsigned long *value_bitmap);158 unsigned long *value_bitmap);
158 159
160int gpiod_set_config(struct gpio_desc *desc, unsigned long config);
159int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);161int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);
160int gpiod_set_transitory(struct gpio_desc *desc, bool transitory);162int gpiod_set_transitory(struct gpio_desc *desc, bool transitory);
161void gpiod_toggle_active_low(struct gpio_desc *desc);163void 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
189 191
190#else /* CONFIG_GPIOLIB */192#else /* CONFIG_GPIOLIB */
191 193
194#include <linux/kernel.h>
195
192static inline int gpiod_count(struct device *dev, const char *con_id)196static inline int gpiod_count(struct device *dev, const char *con_id)
193{197{
194 return 0;198 return 0;
@@ -470,6 +474,13 @@ static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size, · 275 unmodified lines
470 return 0;474 return 0;
471}475}
472 476
477static 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
473static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)484static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
474{485{
475 /* GPIO can never have been requested */486 /* GPIO can never have been requested */
include/linux/gpio/driver.h+70−69
@@ -87,7 +87,7 @@ struct gpio_irq_chip { · 86 unmodified lines
87 * @need_valid_mask to make these GPIO lines unavailable for87 * @need_valid_mask to make these GPIO lines unavailable for
88 * translation.88 * translation.
89 */89 */
90 int (*child_to_parent_hwirq)(struct gpio_chip *chip,90 int (*child_to_parent_hwirq)(struct gpio_chip *gc,
91 unsigned int child_hwirq,91 unsigned int child_hwirq,
92 unsigned int child_type,92 unsigned int child_type,
93 unsigned int *parent_hwirq,93 unsigned int *parent_hwirq,
@@ -102,7 +102,7 @@ struct gpio_irq_chip { · 8 unmodified lines
102 * variant named &gpiochip_populate_parent_fwspec_fourcell is also102 * variant named &gpiochip_populate_parent_fwspec_fourcell is also
103 * available.103 * available.
104 */104 */
105 void *(*populate_parent_alloc_arg)(struct gpio_chip *chip,105 void *(*populate_parent_alloc_arg)(struct gpio_chip *gc,
106 unsigned int parent_hwirq,106 unsigned int parent_hwirq,
107 unsigned int parent_type);107 unsigned int parent_type);
108 108
@@ -114,7 +114,7 @@ struct gpio_irq_chip { · 5 unmodified lines
114 * callback. If this is not specified, then a default callback will be114 * callback. If this is not specified, then a default callback will be
115 * provided that returns the line offset.115 * provided that returns the line offset.
116 */116 */
117 unsigned int (*child_offset_to_irq)(struct gpio_chip *chip,117 unsigned int (*child_offset_to_irq)(struct gpio_chip *gc,
118 unsigned int pin);118 unsigned int pin);
119 119
120 /**120 /**
@@ -209,7 +209,7 @@ struct gpio_irq_chip { · 88 unmodified lines
209 * a particular driver wants to clear IRQ related registers209 * a particular driver wants to clear IRQ related registers
210 * in order to avoid undesired events.210 * in order to avoid undesired events.
211 */211 */
212 int (*init_hw)(struct gpio_chip *chip);212 int (*init_hw)(struct gpio_chip *gc);
213 213
214 /**214 /**
215 * @init_valid_mask: optional routine to initialize @valid_mask, to be215 * @init_valid_mask: optional routine to initialize @valid_mask, to be
@@ -220,7 +220,7 @@ struct gpio_irq_chip { · 4 unmodified lines
220 * then directly set some bits to "0" if they cannot be used for220 * then directly set some bits to "0" if they cannot be used for
221 * interrupts.221 * interrupts.
222 */222 */
223 void (*init_valid_mask)(struct gpio_chip *chip,223 void (*init_valid_mask)(struct gpio_chip *gc,
224 unsigned long *valid_mask,224 unsigned long *valid_mask,
225 unsigned int ngpios);225 unsigned int ngpios);
226 226
@@ -348,40 +348,40 @@ struct gpio_chip { · 121 unmodified lines
348 struct device *parent;348 struct device *parent;
349 struct module *owner;349 struct module *owner;
350 350
351 int (*request)(struct gpio_chip *chip,351 int (*request)(struct gpio_chip *gc,
352 unsigned offset);352 unsigned offset);
353 void (*free)(struct gpio_chip *chip,353 void (*free)(struct gpio_chip *gc,
354 unsigned offset);354 unsigned offset);
355 int (*get_direction)(struct gpio_chip *chip,355 int (*get_direction)(struct gpio_chip *gc,
356 unsigned offset);356 unsigned offset);
357 int (*direction_input)(struct gpio_chip *chip,357 int (*direction_input)(struct gpio_chip *gc,
358 unsigned offset);358 unsigned offset);
359 int (*direction_output)(struct gpio_chip *chip,359 int (*direction_output)(struct gpio_chip *gc,
360 unsigned offset, int value);360 unsigned offset, int value);
361 int (*get)(struct gpio_chip *chip,361 int (*get)(struct gpio_chip *gc,
362 unsigned offset);362 unsigned offset);
363 int (*get_multiple)(struct gpio_chip *chip,363 int (*get_multiple)(struct gpio_chip *gc,
364 unsigned long *mask,364 unsigned long *mask,
365 unsigned long *bits);365 unsigned long *bits);
366 void (*set)(struct gpio_chip *chip,366 void (*set)(struct gpio_chip *gc,
367 unsigned offset, int value);367 unsigned offset, int value);
368 void (*set_multiple)(struct gpio_chip *chip,368 void (*set_multiple)(struct gpio_chip *gc,
369 unsigned long *mask,369 unsigned long *mask,
370 unsigned long *bits);370 unsigned long *bits);
371 int (*set_config)(struct gpio_chip *chip,371 int (*set_config)(struct gpio_chip *gc,
372 unsigned offset,372 unsigned offset,
373 unsigned long config);373 unsigned long config);
374 int (*to_irq)(struct gpio_chip *chip,374 int (*to_irq)(struct gpio_chip *gc,
375 unsigned offset);375 unsigned offset);
376 376
377 void (*dbg_show)(struct seq_file *s,377 void (*dbg_show)(struct seq_file *s,
378 struct gpio_chip *chip);378 struct gpio_chip *gc);
379 379
380 int (*init_valid_mask)(struct gpio_chip *chip,380 int (*init_valid_mask)(struct gpio_chip *gc,
381 unsigned long *valid_mask,381 unsigned long *valid_mask,
382 unsigned int ngpios);382 unsigned int ngpios);
383 383
384 int (*add_pin_ranges)(struct gpio_chip *chip);384 int (*add_pin_ranges)(struct gpio_chip *gc);
385 385
386 int base;386 int base;
387 u16 ngpio;387 u16 ngpio;
@@ -458,11 +458,11 @@ struct gpio_chip { · 70 unmodified lines
458#endif /* CONFIG_OF_GPIO */458#endif /* CONFIG_OF_GPIO */
459};459};
460 460
461extern const char *gpiochip_is_requested(struct gpio_chip *chip,461extern const char *gpiochip_is_requested(struct gpio_chip *gc,
462 unsigned offset);462 unsigned offset);
463 463
464/* add/remove chips */464/* add/remove chips */
465extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,465extern int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
466 struct lock_class_key *lock_key,466 struct lock_class_key *lock_key,
467 struct lock_class_key *request_key);467 struct lock_class_key *request_key);
468 468
@@ -490,43 +490,43 @@ extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 21 unmodified lines
490 * Otherwise it returns zero as a success code.490 * Otherwise it returns zero as a success code.
491 */491 */
492#ifdef CONFIG_LOCKDEP492#ifdef CONFIG_LOCKDEP
493#define gpiochip_add_data(chip, data) ({ \493#define gpiochip_add_data(gc, data) ({ \
494 static struct lock_class_key lock_key; \494 static struct lock_class_key lock_key; \
495 static struct lock_class_key request_key; \495 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, \
497 &request_key); \497 &request_key); \
498 })498 })
499#else499#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)
501#endif /* CONFIG_LOCKDEP */501#endif /* CONFIG_LOCKDEP */
502 502
503static inline int gpiochip_add(struct gpio_chip *chip)503static inline int gpiochip_add(struct gpio_chip *gc)
504{504{
505 return gpiochip_add_data(chip, NULL);505 return gpiochip_add_data(gc, NULL);
506}506}
507extern void gpiochip_remove(struct gpio_chip *chip);507extern void gpiochip_remove(struct gpio_chip *gc);
508extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *chip,508extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc,
509 void *data);509 void *data);
510 510
511extern struct gpio_chip *gpiochip_find(void *data,511extern 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));
513 513
514bool gpiochip_line_is_irq(struct gpio_chip *chip, unsigned int offset);514bool gpiochip_line_is_irq(struct gpio_chip *gc, unsigned int offset);
515int gpiochip_reqres_irq(struct gpio_chip *chip, unsigned int offset);515int gpiochip_reqres_irq(struct gpio_chip *gc, unsigned int offset);
516void gpiochip_relres_irq(struct gpio_chip *chip, unsigned int offset);516void gpiochip_relres_irq(struct gpio_chip *gc, unsigned int offset);
517void gpiochip_disable_irq(struct gpio_chip *chip, unsigned int offset);517void gpiochip_disable_irq(struct gpio_chip *gc, unsigned int offset);
518void gpiochip_enable_irq(struct gpio_chip *chip, unsigned int offset);518void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset);
519 519
520/* Line status inquiry for drivers */520/* Line status inquiry for drivers */
521bool gpiochip_line_is_open_drain(struct gpio_chip *chip, unsigned int offset);521bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset);
522bool gpiochip_line_is_open_source(struct gpio_chip *chip, unsigned int offset);522bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset);
523 523
524/* Sleep persistence inquiry for drivers */524/* Sleep persistence inquiry for drivers */
525bool gpiochip_line_is_persistent(struct gpio_chip *chip, unsigned int offset);525bool gpiochip_line_is_persistent(struct gpio_chip *gc, unsigned int offset);
526bool gpiochip_line_is_valid(const struct gpio_chip *chip, unsigned int offset);526bool gpiochip_line_is_valid(const struct gpio_chip *gc, unsigned int offset);
527 527
528/* get driver data */528/* get driver data */
529void *gpiochip_get_data(struct gpio_chip *chip);529void *gpiochip_get_data(struct gpio_chip *gc);
530 530
531struct bgpio_pdata {531struct bgpio_pdata {
532 const char *label;532 const char *label;
@@ -536,23 +536,23 @@ struct bgpio_pdata { · 3 unmodified lines
536 536
537#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY537#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
538 538
539void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip,539void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *gc,
540 unsigned int parent_hwirq,540 unsigned int parent_hwirq,
541 unsigned int parent_type);541 unsigned int parent_type);
542void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip,542void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *gc,
543 unsigned int parent_hwirq,543 unsigned int parent_hwirq,
544 unsigned int parent_type);544 unsigned int parent_type);
545 545
546#else546#else
547 547
548static inline void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip,548static inline void *gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *gc,
549 unsigned int parent_hwirq,549 unsigned int parent_hwirq,
550 unsigned int parent_type)550 unsigned int parent_type)
551{551{
552 return NULL;552 return NULL;
553}553}
554 554
555static inline void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip,555static inline void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *gc,
556 unsigned int parent_hwirq,556 unsigned int parent_hwirq,
557 unsigned int parent_type)557 unsigned int parent_type)
558{558{
@@ -572,6 +572,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev, · 13 unmodified lines
572#define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3)572#define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3)
573#define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */573#define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */
574#define BGPIOF_NO_OUTPUT BIT(5) /* only input */574#define BGPIOF_NO_OUTPUT BIT(5) /* only input */
575#define BGPIOF_NO_SET_ON_INPUT BIT(6)
575 576
576int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,577int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
577 irq_hw_number_t hwirq);578 irq_hw_number_t hwirq);
@@ -582,11 +583,11 @@ int gpiochip_irq_domain_activate(struct irq_domain *domain, · 4 unmodified lines
582void gpiochip_irq_domain_deactivate(struct irq_domain *domain,583void gpiochip_irq_domain_deactivate(struct irq_domain *domain,
583 struct irq_data *data);584 struct irq_data *data);
584 585
585void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip,586void gpiochip_set_nested_irqchip(struct gpio_chip *gc,
586 struct irq_chip *irqchip,587 struct irq_chip *irqchip,
587 unsigned int parent_irq);588 unsigned int parent_irq);
588 589
589int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,590int gpiochip_irqchip_add_key(struct gpio_chip *gc,
590 struct irq_chip *irqchip,591 struct irq_chip *irqchip,
591 unsigned int first_irq,592 unsigned int first_irq,
592 irq_flow_handler_t handler,593 irq_flow_handler_t handler,
@@ -595,7 +596,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, · 2 unmodified lines
595 struct lock_class_key *lock_key,596 struct lock_class_key *lock_key,
596 struct lock_class_key *request_key);597 struct lock_class_key *request_key);
597 598
598bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,599bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc,
599 unsigned int offset);600 unsigned int offset);
600 601
601#ifdef CONFIG_LOCKDEP602#ifdef CONFIG_LOCKDEP
@@ -606,7 +607,7 @@ bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip, · 4 unmodified lines
606 * boilerplate static inlines provides such a key for each607 * boilerplate static inlines provides such a key for each
607 * unique instance.608 * unique instance.
608 */609 */
609static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,610static inline int gpiochip_irqchip_add(struct gpio_chip *gc,
610 struct irq_chip *irqchip,611 struct irq_chip *irqchip,
611 unsigned int first_irq,612 unsigned int first_irq,
612 irq_flow_handler_t handler,613 irq_flow_handler_t handler,
@@ -615,12 +616,12 @@ static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip, · 2 unmodified lines
615 static struct lock_class_key lock_key;616 static struct lock_class_key lock_key;
616 static struct lock_class_key request_key;617 static struct lock_class_key request_key;
617 618
618 return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,619 return gpiochip_irqchip_add_key(gc, irqchip, first_irq,
619 handler, type, false,620 handler, type, false,
620 &lock_key, &request_key);621 &lock_key, &request_key);
621}622}
622 623
623static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,624static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gc,
624 struct irq_chip *irqchip,625 struct irq_chip *irqchip,
625 unsigned int first_irq,626 unsigned int first_irq,
626 irq_flow_handler_t handler,627 irq_flow_handler_t handler,
@@ -630,35 +631,35 @@ static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip, · 3 unmodified lines
630 static struct lock_class_key lock_key;631 static struct lock_class_key lock_key;
631 static struct lock_class_key request_key;632 static struct lock_class_key request_key;
632 633
633 return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,634 return gpiochip_irqchip_add_key(gc, irqchip, first_irq,
634 handler, type, true,635 handler, type, true,
635 &lock_key, &request_key);636 &lock_key, &request_key);
636}637}
637#else /* ! CONFIG_LOCKDEP */638#else /* ! CONFIG_LOCKDEP */
638static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,639static inline int gpiochip_irqchip_add(struct gpio_chip *gc,
639 struct irq_chip *irqchip,640 struct irq_chip *irqchip,
640 unsigned int first_irq,641 unsigned int first_irq,
641 irq_flow_handler_t handler,642 irq_flow_handler_t handler,
642 unsigned int type)643 unsigned int type)
643{644{
644 return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,645 return gpiochip_irqchip_add_key(gc, irqchip, first_irq,
645 handler, type, false, NULL, NULL);646 handler, type, false, NULL, NULL);
646}647}
647 648
648static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,649static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gc,
649 struct irq_chip *irqchip,650 struct irq_chip *irqchip,
650 unsigned int first_irq,651 unsigned int first_irq,
651 irq_flow_handler_t handler,652 irq_flow_handler_t handler,
652 unsigned int type)653 unsigned int type)
653{654{
654 return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,655 return gpiochip_irqchip_add_key(gc, irqchip, first_irq,
655 handler, type, true, NULL, NULL);656 handler, type, true, NULL, NULL);
656}657}
657#endif /* CONFIG_LOCKDEP */658#endif /* CONFIG_LOCKDEP */
658 659
659int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset);660int gpiochip_generic_request(struct gpio_chip *gc, unsigned offset);
660void gpiochip_generic_free(struct gpio_chip *chip, unsigned offset);661void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset);
661int gpiochip_generic_config(struct gpio_chip *chip, unsigned offset,662int gpiochip_generic_config(struct gpio_chip *gc, unsigned offset,
662 unsigned long config);663 unsigned long config);
663 664
664/**665/**
@@ -675,25 +676,25 @@ struct gpio_pin_range { · 10 unmodified lines
675 676
676#ifdef CONFIG_PINCTRL677#ifdef CONFIG_PINCTRL
677 678
678int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,679int gpiochip_add_pin_range(struct gpio_chip *gc, const char *pinctl_name,
679 unsigned int gpio_offset, unsigned int pin_offset,680 unsigned int gpio_offset, unsigned int pin_offset,
680 unsigned int npins);681 unsigned int npins);
681int gpiochip_add_pingroup_range(struct gpio_chip *chip,682int gpiochip_add_pingroup_range(struct gpio_chip *gc,
682 struct pinctrl_dev *pctldev,683 struct pinctrl_dev *pctldev,
683 unsigned int gpio_offset, const char *pin_group);684 unsigned int gpio_offset, const char *pin_group);
684void gpiochip_remove_pin_ranges(struct gpio_chip *chip);685void gpiochip_remove_pin_ranges(struct gpio_chip *gc);
685 686
686#else /* ! CONFIG_PINCTRL */687#else /* ! CONFIG_PINCTRL */
687 688
688static inline int689static inline int
689gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,690gpiochip_add_pin_range(struct gpio_chip *gc, const char *pinctl_name,
690 unsigned int gpio_offset, unsigned int pin_offset,691 unsigned int gpio_offset, unsigned int pin_offset,
691 unsigned int npins)692 unsigned int npins)
692{693{
693 return 0;694 return 0;
694}695}
695static inline int696static inline int
696gpiochip_add_pingroup_range(struct gpio_chip *chip,697gpiochip_add_pingroup_range(struct gpio_chip *gc,
697 struct pinctrl_dev *pctldev,698 struct pinctrl_dev *pctldev,
698 unsigned int gpio_offset, const char *pin_group)699 unsigned int gpio_offset, const char *pin_group)
699{700{
@@ -701,27 +702,27 @@ gpiochip_add_pingroup_range(struct gpio_chip *chip, · 1 unmodified line
701}702}
702 703
703static inline void704static inline void
704gpiochip_remove_pin_ranges(struct gpio_chip *chip)705gpiochip_remove_pin_ranges(struct gpio_chip *gc)
705{706{
706}707}
707 708
708#endif /* CONFIG_PINCTRL */709#endif /* CONFIG_PINCTRL */
709 710
710struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip,711struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc,
711 unsigned int hwnum,712 unsigned int hwnum,
712 const char *label,713 const char *label,
713 enum gpio_lookup_flags lflags,714 enum gpio_lookup_flags lflags,
714 enum gpiod_flags dflags);715 enum gpiod_flags dflags);
715void gpiochip_free_own_desc(struct gpio_desc *desc);716void gpiochip_free_own_desc(struct gpio_desc *desc);
716 717
717void devprop_gpiochip_set_names(struct gpio_chip *chip,718void devprop_gpiochip_set_names(struct gpio_chip *gc,
718 const struct fwnode_handle *fwnode);719 const struct fwnode_handle *fwnode);
719 720
720#ifdef CONFIG_GPIOLIB721#ifdef CONFIG_GPIOLIB
721 722
722/* lock/unlock as IRQ */723/* lock/unlock as IRQ */
723int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);724int gpiochip_lock_as_irq(struct gpio_chip *gc, unsigned int offset);
724void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);725void gpiochip_unlock_as_irq(struct gpio_chip *gc, unsigned int offset);
725 726
726 727
727struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);728struct 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
735 return ERR_PTR(-ENODEV);736 return ERR_PTR(-ENODEV);
736}737}
737 738
738static inline int gpiochip_lock_as_irq(struct gpio_chip *chip,739static inline int gpiochip_lock_as_irq(struct gpio_chip *gc,
739 unsigned int offset)740 unsigned int offset)
740{741{
741 WARN_ON(1);742 WARN_ON(1);
742 return -EINVAL;743 return -EINVAL;
743}744}
744 745
745static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip,746static inline void gpiochip_unlock_as_irq(struct gpio_chip *gc,
746 unsigned int offset)747 unsigned int offset)
747{748{
748 WARN_ON(1);749 WARN_ON(1);
include/linux/hardirq.h+4−4
@@ -37,7 +37,7 @@ extern void rcu_nmi_exit(void); · 36 unmodified lines
37 do { \37 do { \
38 account_irq_enter_time(current); \38 account_irq_enter_time(current); \
39 preempt_count_add(HARDIRQ_OFFSET); \39 preempt_count_add(HARDIRQ_OFFSET); \
40 trace_hardirq_enter(); \40 lockdep_hardirq_enter(); \
41 } while (0)41 } while (0)
42 42
43/*43/*
@@ -50,7 +50,7 @@ extern void irq_enter(void); · 6 unmodified lines
50 */50 */
51#define __irq_exit() \51#define __irq_exit() \
52 do { \52 do { \
53 trace_hardirq_exit(); \53 lockdep_hardirq_exit(); \
54 account_irq_exit_time(current); \54 account_irq_exit_time(current); \
55 preempt_count_sub(HARDIRQ_OFFSET); \55 preempt_count_sub(HARDIRQ_OFFSET); \
56 } while (0)56 } while (0)
@@ -74,12 +74,12 @@ extern void irq_exit(void); · 17 unmodified lines
74 BUG_ON(in_nmi()); \74 BUG_ON(in_nmi()); \
75 preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \75 preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
76 rcu_nmi_enter(); \76 rcu_nmi_enter(); \
77 trace_hardirq_enter(); \77 lockdep_hardirq_enter(); \
78 } while (0)78 } while (0)
79 79
80#define nmi_exit() \80#define nmi_exit() \
81 do { \81 do { \
82 trace_hardirq_exit(); \82 lockdep_hardirq_exit(); \
83 rcu_nmi_exit(); \83 rcu_nmi_exit(); \
84 BUG_ON(!in_nmi()); \84 BUG_ON(!in_nmi()); \
85 preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \85 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
145 * hash entry145 * hash entry
146 * @name: hashtable to iterate146 * @name: hashtable to iterate
147 * @bkt: integer to use as bucket loop cursor147 * @bkt: integer to use as bucket loop cursor
148 * @tmp: a &struct used for temporary storage148 * @tmp: a &struct hlist_node used for temporary storage
149 * @obj: the type * to use as a loop cursor for each entry149 * @obj: the type * to use as a loop cursor for each entry
150 * @member: the name of the hlist_node within the struct150 * @member: the name of the hlist_node within the struct
151 */151 */
@@ -197,7 +197,7 @@ static inline void hash_del_rcu(struct hlist_node *node) · 45 unmodified lines
197 * same bucket safe against removals197 * same bucket safe against removals
198 * @name: hashtable to iterate198 * @name: hashtable to iterate
199 * @obj: the type * to use as a loop cursor for each entry199 * @obj: the type * to use as a loop cursor for each entry
200 * @tmp: a &struct used for temporary storage200 * @tmp: a &struct hlist_node used for temporary storage
201 * @member: the name of the hlist_node within the struct201 * @member: the name of the hlist_node within the struct
202 * @key: the key of the objects to iterate over202 * @key: the key of the objects to iterate over
203 */203 */
include/linux/hmm.h+5−120
@@ -3,58 +3,8 @@ · 2 unmodified lines
3 * Copyright 2013 Red Hat Inc.3 * Copyright 2013 Red Hat Inc.
4 *4 *
5 * Authors: Jérôme Glisse <jglisse@redhat.com>5 * 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.
43 *6 *
44 *7 * See Documentation/vm/hmm.rst for reasons and overview of what HMM is.
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.
58 */8 */
59#ifndef LINUX_HMM_H9#ifndef LINUX_HMM_H
60#define LINUX_HMM_H10#define LINUX_HMM_H
@@ -74,7 +24,6 @@ · 13 unmodified lines
74 * Flags:24 * Flags:
75 * HMM_PFN_VALID: pfn is valid. It has, at least, read permission.25 * HMM_PFN_VALID: pfn is valid. It has, at least, read permission.
76 * HMM_PFN_WRITE: CPU page table has write permission set26 * HMM_PFN_WRITE: CPU page table has write permission set
77 * HMM_PFN_DEVICE_PRIVATE: private device memory (ZONE_DEVICE)
78 *27 *
79 * The driver provides a flags array for mapping page protections to device28 * The driver provides a flags array for mapping page protections to device
80 * PTE bits. If the driver valid bit for an entry is bit 3,29 * PTE bits. If the driver valid bit for an entry is bit 3,
@@ -86,7 +35,6 @@ · 5 unmodified lines
86enum hmm_pfn_flag_e {35enum hmm_pfn_flag_e {
87 HMM_PFN_VALID = 0,36 HMM_PFN_VALID = 0,
88 HMM_PFN_WRITE,37 HMM_PFN_WRITE,
89 HMM_PFN_DEVICE_PRIVATE,
90 HMM_PFN_FLAG_MAX38 HMM_PFN_FLAG_MAX
91};39};
92 40
@@ -122,9 +70,6 @@ enum hmm_pfn_value_e { · 29 unmodified lines
122 *70 *
123 * @notifier: a mmu_interval_notifier that includes the start/end71 * @notifier: a mmu_interval_notifier that includes the start/end
124 * @notifier_seq: result of mmu_interval_read_begin()72 * @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
128 * @start: range virtual start address (inclusive)73 * @start: range virtual start address (inclusive)
129 * @end: range virtual end address (exclusive)74 * @end: range virtual end address (exclusive)
130 * @pfns: array of pfns (big enough for the range)75 * @pfns: array of pfns (big enough for the range)
@@ -132,8 +77,8 @@ enum hmm_pfn_value_e { · 1 unmodified line
132 * @values: pfn value for some special case (none, special, error, ...)77 * @values: pfn value for some special case (none, special, error, ...)
133 * @default_flags: default flags for the range (write, read, ... see hmm doc)78 * @default_flags: default flags for the range (write, read, ... see hmm doc)
134 * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter79 * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter
135 * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT)80 * @pfn_shift: pfn shift value (should be <= PAGE_SHIFT)
136 * @valid: pfns array did not change since it has been fill by an HMM function81 * @dev_private_owner: owner of device private pages
137 */82 */
138struct hmm_range {83struct hmm_range {
139 struct mmu_interval_notifier *notifier;84 struct mmu_interval_notifier *notifier;
@@ -146,6 +91,7 @@ struct hmm_range { · 6 unmodified lines
146 uint64_t default_flags;91 uint64_t default_flags;
147 uint64_t pfn_flags_mask;92 uint64_t pfn_flags_mask;
148 uint8_t pfn_shift;93 uint8_t pfn_shift;
94 void *dev_private_owner;
149};95};
150 96
151/*97/*
@@ -171,71 +117,10 @@ static inline struct page *hmm_device_entry_to_page(const struct hmm_range *rang · 19 unmodified lines
171 return pfn_to_page(entry >> range->pfn_shift);117 return pfn_to_page(entry >> range->pfn_shift);
172}118}
173 119
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 */
180static inline unsigned long
181hmm_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 */
200static 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 */
213static 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
229/*120/*
230 * Please see Documentation/vm/hmm.rst for how to use the range API.121 * Please see Documentation/vm/hmm.rst for how to use the range API.
231 */122 */
232long hmm_range_fault(struct hmm_range *range, unsigned int flags);123long hmm_range_fault(struct hmm_range *range);
233#else
234static inline long hmm_range_fault(struct hmm_range *range, unsigned int flags)
235{
236 return -EOPNOTSUPP;
237}
238#endif
239 124
240/*125/*
241 * HMM_RANGE_DEFAULT_TIMEOUT - default timeout (ms) when waiting for a range126 * 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
46 pmd_t *old_pmd, pmd_t *new_pmd);46 pmd_t *old_pmd, pmd_t *new_pmd);
47extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,47extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
48 unsigned long addr, pgprot_t newprot,48 unsigned long addr, pgprot_t newprot,
49 int prot_numa);49 unsigned long cp_flags);
50vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write);50vm_fault_t vmf_insert_pfn_pmd_prot(struct vm_fault *vmf, pfn_t pfn,
51vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write);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 */
64static 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}
69vm_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 */
83static 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
52enum transparent_hugepage_flag {89enum transparent_hugepage_flag {
53 TRANSPARENT_HUGEPAGE_FLAG,90 TRANSPARENT_HUGEPAGE_FLAG,
54 TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,91 TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
@@ -87,8 +124,6 @@ extern struct kobj_attribute shmem_enabled_attr; · 32 unmodified lines
87#define HPAGE_PUD_SIZE ((1UL) << HPAGE_PUD_SHIFT)124#define HPAGE_PUD_SIZE ((1UL) << HPAGE_PUD_SHIFT)
88#define HPAGE_PUD_MASK (~(HPAGE_PUD_SIZE - 1))125#define HPAGE_PUD_MASK (~(HPAGE_PUD_SIZE - 1))
89 126
90extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
91
92extern unsigned long transparent_hugepage_flags;127extern unsigned long transparent_hugepage_flags;
93 128
94/*129/*
@@ -100,7 +135,7 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) · 5 unmodified lines
100 if (vma->vm_flags & VM_NOHUGEPAGE)135 if (vma->vm_flags & VM_NOHUGEPAGE)
101 return false;136 return false;
102 137
103 if (is_vma_temporary_stack(vma))138 if (vma_is_temporary_stack(vma))
104 return false;139 return false;
105 140
106 if (test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags))141 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
289#define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; })324#define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; })
290#define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; })325#define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; })
291 326
292#define hpage_nr_pages(x) 1327static inline int hpage_nr_pages(struct page *page)
328{
329 VM_BUG_ON_PAGE(PageTail(page), page);
330 return 1;
331}
293 332
294static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)333static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)
295{334{
include/linux/hugetlb.h+75−13
@@ -46,7 +46,52 @@ struct resv_map { · 45 unmodified lines
46 long adds_in_progress;46 long adds_in_progress;
47 struct list_head region_cache;47 struct list_head region_cache;
48 long region_cache_count;48 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 */
80struct 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
49};93};
94
50extern struct resv_map *resv_map_alloc(void);95extern struct resv_map *resv_map_alloc(void);
51void resv_map_release(struct kref *ref);96void resv_map_release(struct kref *ref);
52 97
@@ -109,6 +154,8 @@ u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx); · 56 unmodified lines
109 154
110pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);155pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
111 156
157struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage);
158
112extern int sysctl_hugetlb_shm_group;159extern int sysctl_hugetlb_shm_group;
113extern struct list_head huge_boot_pages;160extern struct list_head huge_boot_pages;
114 161
@@ -151,6 +198,12 @@ static inline unsigned long hugetlb_total_pages(void) · 36 unmodified lines
151 return 0;198 return 0;
152}199}
153 200
201static inline struct address_space *hugetlb_page_mapping_lock_write(
202 struct page *hpage)
203{
204 return NULL;
205}
206
154static inline int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr,207static inline int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr,
155 pte_t *ptep)208 pte_t *ptep)
156{209{
@@ -390,7 +443,10 @@ static inline bool is_file_hugepages(struct file *file) · 233 unmodified lines
390 return is_file_shm_hugepages(file);443 return is_file_shm_hugepages(file);
391}444}
392 445
393 446static inline struct hstate *hstate_inode(struct inode *i)
447{
448 return HUGETLBFS_SB(i->i_sb)->hstate;
449}
394#else /* !CONFIG_HUGETLBFS */450#else /* !CONFIG_HUGETLBFS */
395 451
396#define is_file_hugepages(file) false452#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
402 return ERR_PTR(-ENOSYS);458 return ERR_PTR(-ENOSYS);
403}459}
404 460
461static inline struct hstate *hstate_inode(struct inode *i)
462{
463 return NULL;
464}
405#endif /* !CONFIG_HUGETLBFS */465#endif /* !CONFIG_HUGETLBFS */
406 466
407#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA467#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
@@ -432,8 +492,8 @@ struct hstate { · 24 unmodified lines
432 unsigned int surplus_huge_pages_node[MAX_NUMNODES];492 unsigned int surplus_huge_pages_node[MAX_NUMNODES];
433#ifdef CONFIG_CGROUP_HUGETLB493#ifdef CONFIG_CGROUP_HUGETLB
434 /* cgroup control files */494 /* cgroup control files */
435 struct cftype cgroup_files_dfl[5];495 struct cftype cgroup_files_dfl[7];
436 struct cftype cgroup_files_legacy[5];496 struct cftype cgroup_files_legacy[9];
437#endif497#endif
438 char name[HSTATE_NAME_LEN];498 char name[HSTATE_NAME_LEN];
439};499};
@@ -472,11 +532,6 @@ extern unsigned int default_hstate_idx; · 32 unmodified lines
472 532
473#define default_hstate (hstates[default_hstate_idx])533#define default_hstate (hstates[default_hstate_idx])
474 534
475static inline struct hstate *hstate_inode(struct inode *i)
476{
477 return HUGETLBFS_SB(i->i_sb)->hstate;
478}
479
480static inline struct hstate *hstate_file(struct file *f)535static inline struct hstate *hstate_file(struct file *f)
481{536{
482 return hstate_inode(file_inode(f));537 return hstate_inode(file_inode(f));
@@ -729,11 +784,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) · 246 unmodified lines
729 return NULL;784 return NULL;
730}785}
731 786
732static inline struct hstate *hstate_inode(struct inode *i)
733{
734 return NULL;
735}
736
737static inline struct hstate *page_hstate(struct page *page)787static inline struct hstate *page_hstate(struct page *page)
738{788{
739 return NULL;789 return NULL;
@@ -845,4 +895,16 @@ static inline spinlock_t *huge_pte_lock(struct hstate *h, · 105 unmodified lines
845 return ptl;895 return ptl;
846}896}
847 897
898#if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_CMA)
899extern void __init hugetlb_cma_reserve(int order);
900extern void __init hugetlb_cma_check(void);
901#else
902static inline __init void hugetlb_cma_reserve(int order)
903{
904}
905static inline __init void hugetlb_cma_check(void)
906{
907}
908#endif
909
848#endif /* _LINUX_HUGETLB_H */910#endif /* _LINUX_HUGETLB_H */
include/linux/hugetlb_cgroup.h+151−18
@@ -18,34 +18,96 @@ · 17 unmodified lines
18#include <linux/mmdebug.h>18#include <linux/mmdebug.h>
19 19
20struct hugetlb_cgroup;20struct hugetlb_cgroup;
21struct resv_map;
22struct file_region;
23
21/*24/*
22 * Minimum page order trackable by hugetlb cgroup.25 * 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.
24 */29 */
25#define HUGETLB_CGROUP_MIN_ORDER 230#define HUGETLB_CGROUP_MIN_ORDER 2
26 31
27#ifdef CONFIG_CGROUP_HUGETLB32#ifdef CONFIG_CGROUP_HUGETLB
33enum hugetlb_memory_event {
34 HUGETLB_MAX,
35 HUGETLB_NR_MEMORY_EVENTS,
36};
28 37
29static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)38struct 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
61static inline struct hugetlb_cgroup *
62__hugetlb_cgroup_from_page(struct page *page, bool rsvd)
30{63{
31 VM_BUG_ON_PAGE(!PageHuge(page), page);64 VM_BUG_ON_PAGE(!PageHuge(page), page);
32 65
33 if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)66 if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
34 return NULL;67 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
74static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)
75{
76 return __hugetlb_cgroup_from_page(page, false);
77}
78
79static inline struct hugetlb_cgroup *
80hugetlb_cgroup_from_page_rsvd(struct page *page)
81{
82 return __hugetlb_cgroup_from_page(page, true);
36}83}
37 84
38static inline85static inline int __set_hugetlb_cgroup(struct page *page,
39int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg)86 struct hugetlb_cgroup *h_cg, bool rsvd)
40{87{
41 VM_BUG_ON_PAGE(!PageHuge(page), page);88 VM_BUG_ON_PAGE(!PageHuge(page), page);
42 89
43 if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)90 if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
44 return -1;91 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;
46 return 0;96 return 0;
47}97}
48 98
99static 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
105static 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
49static inline bool hugetlb_cgroup_disabled(void)111static inline bool hugetlb_cgroup_disabled(void)
50{112{
51 return !cgroup_subsys_enabled(hugetlb_cgrp_subsys);113 return !cgroup_subsys_enabled(hugetlb_cgrp_subsys);
@@ -53,25 +115,67 @@ static inline bool hugetlb_cgroup_disabled(void) · 1 unmodified line
53 115
54extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,116extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
55 struct hugetlb_cgroup **ptr);117 struct hugetlb_cgroup **ptr);
118extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages,
119 struct hugetlb_cgroup **ptr);
56extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,120extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
57 struct hugetlb_cgroup *h_cg,121 struct hugetlb_cgroup *h_cg,
58 struct page *page);122 struct page *page);
123extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
124 struct hugetlb_cgroup *h_cg,
125 struct page *page);
59extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,126extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
60 struct page *page);127 struct page *page);
128extern void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages,
129 struct page *page);
130
61extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,131extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
62 struct hugetlb_cgroup *h_cg);132 struct hugetlb_cgroup *h_cg);
133extern void hugetlb_cgroup_uncharge_cgroup_rsvd(int idx, unsigned long nr_pages,
134 struct hugetlb_cgroup *h_cg);
135extern void hugetlb_cgroup_uncharge_counter(struct resv_map *resv,
136 unsigned long start,
137 unsigned long end);
138
139extern void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
140 struct file_region *rg,
141 unsigned long nr_pages);
142
63extern void hugetlb_cgroup_file_init(void) __init;143extern void hugetlb_cgroup_file_init(void) __init;
64extern void hugetlb_cgroup_migrate(struct page *oldhpage,144extern void hugetlb_cgroup_migrate(struct page *oldhpage,
65 struct page *newhpage);145 struct page *newhpage);
66 146
67#else147#else
148static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
149 struct file_region *rg,
150 unsigned long nr_pages)
151{
152}
153
68static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)154static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page)
69{155{
70 return NULL;156 return NULL;
71}157}
72 158
73static inline159static inline struct hugetlb_cgroup *
74int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg)160hugetlb_cgroup_from_page_resv(struct page *page)
161{
162 return NULL;
163}
164
165static inline struct hugetlb_cgroup *
166hugetlb_cgroup_from_page_rsvd(struct page *page)
167{
168 return NULL;
169}
170
171static inline int set_hugetlb_cgroup(struct page *page,
172 struct hugetlb_cgroup *h_cg)
173{
174 return 0;
175}
176
177static inline int set_hugetlb_cgroup_rsvd(struct page *page,
178 struct hugetlb_cgroup *h_cg)
75{179{
76 return 0;180 return 0;
77}181}
@@ -81,28 +185,57 @@ static inline bool hugetlb_cgroup_disabled(void) · 3 unmodified lines
81 return true;185 return true;
82}186}
83 187
84static inline int188static inline int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
85hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,189 struct hugetlb_cgroup **ptr)
86 struct hugetlb_cgroup **ptr)
87{190{
88 return 0;191 return 0;
89}192}
90 193
91static inline void194static inline int hugetlb_cgroup_charge_cgroup_rsvd(int idx,
92hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,195 unsigned long nr_pages,
93 struct hugetlb_cgroup *h_cg,196 struct hugetlb_cgroup **ptr)
94 struct page *page)197{
198 return 0;
199}
200
201static inline void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
202 struct hugetlb_cgroup *h_cg,
203 struct page *page)
95{204{
96}205}
97 206
98static inline void207static inline void
99hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, struct page *page)208hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
209 struct hugetlb_cgroup *h_cg,
210 struct page *page)
211{
212}
213
214static inline void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
215 struct page *page)
216{
217}
218
219static inline void hugetlb_cgroup_uncharge_page_rsvd(int idx,
220 unsigned long nr_pages,
221 struct page *page)
222{
223}
224static inline void hugetlb_cgroup_uncharge_cgroup(int idx,
225 unsigned long nr_pages,
226 struct hugetlb_cgroup *h_cg)
100{227{
101}228}
102 229
103static inline void230static inline void
104hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,231hugetlb_cgroup_uncharge_cgroup_rsvd(int idx, unsigned long nr_pages,
105 struct hugetlb_cgroup *h_cg)232 struct hugetlb_cgroup *h_cg)
233{
234}
235
236static inline void hugetlb_cgroup_uncharge_counter(struct resv_map *resv,
237 unsigned long start,
238 unsigned long end)
106{239{
107}240}
108 241
include/linux/i2c-smbus.h+2−7
@@ -15,24 +15,19 @@ · 14 unmodified lines
15 15
16/**16/**
17 * i2c_smbus_alert_setup - platform data for the smbus_alert i2c client17 * 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
20 * @irq: IRQ number, if the smbus_alert driver should take care of interrupt18 * @irq: IRQ number, if the smbus_alert driver should take care of interrupt
21 * handling19 * handling
22 *20 *
23 * If irq is not specified, the smbus_alert driver doesn't take care of21 * If irq is not specified, the smbus_alert driver doesn't take care of
24 * interrupt handling. In that case it is up to the I2C bus driver to either22 * interrupt handling. In that case it is up to the I2C bus driver to either
25 * handle the interrupts or to poll for alerts.23 * 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.
29 */24 */
30struct i2c_smbus_alert_setup {25struct i2c_smbus_alert_setup {
31 int irq;26 int irq;
32};27};
33 28
34struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter,29struct i2c_client *i2c_new_smbus_alert_device(struct i2c_adapter *adapter,
35 struct i2c_smbus_alert_setup *setup);30 struct i2c_smbus_alert_setup *setup);
36int i2c_handle_smbus_alert(struct i2c_client *ara);31int i2c_handle_smbus_alert(struct i2c_client *ara);
37 32
38#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF)33#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
39typedef int (*i2c_slave_cb_t)(struct i2c_client *client,39typedef int (*i2c_slave_cb_t)(struct i2c_client *client,
40 enum i2c_slave_event event, u8 *val);40 enum i2c_slave_event event, u8 *val);
41 41
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
42struct module;50struct module;
43struct property_entry;51struct property_entry;
44 52
@@ -506,7 +514,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info, · 461 unmodified lines
506 * @smbus_xfer_atomic: same as @smbus_xfer. Yet, only using atomic context514 * @smbus_xfer_atomic: same as @smbus_xfer. Yet, only using atomic context
507 * so e.g. PMICs can be accessed very late before shutdown. Optional.515 * so e.g. PMICs can be accessed very late before shutdown. Optional.
508 * @functionality: Return the flags that this algorithm/adapter pair supports516 * @functionality: Return the flags that this algorithm/adapter pair supports
509 * from the I2C_FUNC_* flags.517 * from the ``I2C_FUNC_*`` flags.
510 * @reg_slave: Register given client to I2C slave mode of this adapter518 * @reg_slave: Register given client to I2C slave mode of this adapter
511 * @unreg_slave: Unregister given client from I2C slave mode of this adapter519 * @unreg_slave: Unregister given client from I2C slave mode of this adapter
512 *520 *
@@ -515,7 +523,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info, · 2 unmodified lines
515 * be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584523 * be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
516 * to name two of the most common.524 * to name two of the most common.
517 *525 *
518 * The return codes from the @master_xfer{_atomic} fields should indicate the526 * The return codes from the ``master_xfer{_atomic}`` fields should indicate the
519 * type of error code that occurred during the transfer, as documented in the527 * type of error code that occurred during the transfer, as documented in the
520 * Kernel Documentation file Documentation/i2c/fault-codes.rst.528 * Kernel Documentation file Documentation/i2c/fault-codes.rst.
521 */529 */
include/linux/ieee80211.h+24−6
@@ -619,6 +619,15 @@ static inline bool ieee80211_is_qos_nullfunc(__le16 fc) · 618 unmodified lines
619 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);619 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
620}620}
621 621
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 */
626static inline bool ieee80211_is_any_nullfunc(__le16 fc)
627{
628 return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc));
629}
630
622/**631/**
623 * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU632 * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU
624 * @fc: frame control field in little-endian byteorder633 * @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
2047#define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x000100002056#define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000
2048#define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x000200002057#define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x00020000
2049#define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f0000002058#define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000
2050#define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 242059#define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24
2051#define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x400000002060#define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000
2052#define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x800000002061#define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x80000000
2053 2062
2054/*2063/*
2055 * ieee80211_he_oper_size - calculate 802.11ax HE Operations IE size2064 * 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 byte2065 * @he_oper_ie: byte data of the He Operations IE, stating from the byte
2057 * after the ext ID byte. It is assumed that he_oper_ie has at least2066 * after the ext ID byte. It is assumed that he_oper_ie has at least
2058 * sizeof(struct ieee80211_he_operation) bytes, the caller must have2067 * sizeof(struct ieee80211_he_operation) bytes, the caller must have
2059 * validated this.2068 * validated this.
@@ -2091,7 +2100,7 @@ ieee80211_he_oper_size(const u8 *he_oper_ie) · 31 unmodified lines
2091 2100
2092/*2101/*
2093 * ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size2102 * 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 byte2103 * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the byte
2095 * after the ext ID byte. It is assumed that he_spr_ie has at least2104 * after the ext ID byte. It is assumed that he_spr_ie has at least
2096 * sizeof(struct ieee80211_he_spr) bytes, the caller must have validated2105 * sizeof(struct ieee80211_he_spr) bytes, the caller must have validated
2097 * this2106 * this
@@ -2102,14 +2111,14 @@ ieee80211_he_spr_size(const u8 *he_spr_ie) · 4 unmodified lines
2102{2111{
2103 struct ieee80211_he_spr *he_spr = (void *)he_spr_ie;2112 struct ieee80211_he_spr *he_spr = (void *)he_spr_ie;
2104 u8 spr_len = sizeof(struct ieee80211_he_spr);2113 u8 spr_len = sizeof(struct ieee80211_he_spr);
2105 u32 he_spr_params;2114 u8 he_spr_params;
2106 2115
2107 /* Make sure the input is not NULL */2116 /* Make sure the input is not NULL */
2108 if (!he_spr_ie)2117 if (!he_spr_ie)
2109 return 0;2118 return 0;
2110 2119
2111 /* Calc required length */2120 /* Calc required length */
2112 he_spr_params = le32_to_cpu(he_spr->he_sr_control);2121 he_spr_params = he_spr->he_sr_control;
2113 if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)2122 if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
2114 spr_len++;2123 spr_len++;
2115 if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT)2124 if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT)
@@ -2523,6 +2532,7 @@ enum ieee80211_eid { · 407 unmodified lines
2523 WLAN_EID_FILS_INDICATION = 240,2532 WLAN_EID_FILS_INDICATION = 240,
2524 WLAN_EID_DILS = 241,2533 WLAN_EID_DILS = 241,
2525 WLAN_EID_FRAGMENT = 242,2534 WLAN_EID_FRAGMENT = 242,
2535 WLAN_EID_RSNX = 244,
2526 WLAN_EID_EXTENSION = 2552536 WLAN_EID_EXTENSION = 255
2527};2537};
2528 2538
@@ -2734,7 +2744,7 @@ enum ieee80211_tdls_actioncode { · 205 unmodified lines
2734 */2744 */
2735#define WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT BIT(6)2745#define WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT BIT(6)
2736 2746
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 */
2738#define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4)2748#define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4)
2739#define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5)2749#define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5)
2740#define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6)2750#define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6)
@@ -3034,6 +3044,7 @@ struct ieee80211_multiple_bssid_configuration { · 293 unmodified lines
3034#define WLAN_AKM_SUITE_FILS_SHA384 SUITE(0x000FAC, 15)3044#define WLAN_AKM_SUITE_FILS_SHA384 SUITE(0x000FAC, 15)
3035#define WLAN_AKM_SUITE_FT_FILS_SHA256 SUITE(0x000FAC, 16)3045#define WLAN_AKM_SUITE_FT_FILS_SHA256 SUITE(0x000FAC, 16)
3036#define WLAN_AKM_SUITE_FT_FILS_SHA384 SUITE(0x000FAC, 17)3046#define WLAN_AKM_SUITE_FT_FILS_SHA384 SUITE(0x000FAC, 17)
3047#define WLAN_AKM_SUITE_OWE SUITE(0x000FAC, 18)
3037 3048
3038#define WLAN_MAX_KEY_LEN 323049#define WLAN_MAX_KEY_LEN 32
3039 3050
@@ -3412,4 +3423,11 @@ static inline bool for_each_element_completed(const struct element *element, · 372 unmodified lines
3412 return (const u8 *)element == (const u8 *)data + datalen;3423 return (const u8 *)element == (const u8 *)data + datalen;
3413}3424}
3414 3425
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
3415#endif /* LINUX_IEEE80211_H */3433#endif /* LINUX_IEEE80211_H */
include/linux/iio/common/cros_ec_sensors_core.h+14−90
@@ -12,6 +12,7 @@ · 11 unmodified lines
12#include <linux/irqreturn.h>12#include <linux/irqreturn.h>
13#include <linux/platform_data/cros_ec_commands.h>13#include <linux/platform_data/cros_ec_commands.h>
14#include <linux/platform_data/cros_ec_proto.h>14#include <linux/platform_data/cros_ec_proto.h>
15#include <linux/platform_data/cros_ec_sensorhub.h>
15 16
16enum {17enum {
17 CROS_EC_SENSOR_X,18 CROS_EC_SENSOR_X,
@@ -29,8 +30,7 @@ enum { · 11 unmodified lines
29 */30 */
30#define CROS_EC_SAMPLE_SIZE (sizeof(s64) * 2)31#define CROS_EC_SAMPLE_SIZE (sizeof(s64) * 2)
31 32
32/* Minimum sampling period to use when device is suspending */33typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p);
33#define CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY 1000 /* 1 second */
34 34
35/**35/**
36 * struct cros_ec_sensors_core_state - state data for EC sensors IIO driver36 * struct cros_ec_sensors_core_state - state data for EC sensors IIO driver
@@ -50,7 +50,9 @@ enum { · 13 unmodified lines
50 * the timestamp. The timestamp is always last and50 * the timestamp. The timestamp is always last and
51 * is always 8-byte aligned.51 * is always 8-byte aligned.
52 * @read_ec_sensors_data: function used for accessing sensors values52 * @read_ec_sensors_data: function used for accessing sensors values
53 * @cuur_sampl_freq: current sampling period53 * @fifo_max_event_count: Size of the EC sensor FIFO
54 * @frequencies: Table of known available frequencies:
55 * 0, Min and Max in mHz
54 */56 */
55struct cros_ec_sensors_core_state {57struct cros_ec_sensors_core_state {
56 struct cros_ec_device *ec;58 struct cros_ec_device *ec;
@@ -73,101 +75,34 @@ struct cros_ec_sensors_core_state { · 16 unmodified lines
73 int (*read_ec_sensors_data)(struct iio_dev *indio_dev,75 int (*read_ec_sensors_data)(struct iio_dev *indio_dev,
74 unsigned long scan_mask, s16 *data);76 unsigned long scan_mask, s16 *data);
75 77
76 int curr_sampl_freq;78 u32 fifo_max_event_count;
77 79 int frequencies[6];
78 /* Table of known available frequencies : 0, Min and Max in mHz */
79 int frequencies[3];
80};80};
81 81
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 */
93int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev, unsigned long scan_mask,82int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev, unsigned long scan_mask,
94 s16 *data);83 s16 *data);
95 84
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 */
104int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask,85int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask,
105 s16 *data);86 s16 *data);
106 87
107struct platform_device;88struct 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 */
116int cros_ec_sensors_core_init(struct platform_device *pdev,89int 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);
118 93
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 */
131irqreturn_t cros_ec_sensors_capture(int irq, void *p);94irqreturn_t cros_ec_sensors_capture(int irq, void *p);
95int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
96 s16 *data,
97 s64 timestamp);
132 98
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 */
143int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st,99int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st,
144 u16 opt_length);100 u16 opt_length);
145 101
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 */
156int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st,102int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st,
157 struct iio_chan_spec const *chan,103 struct iio_chan_spec const *chan,
158 int *val, int *val2, long mask);104 int *val, int *val2, long mask);
159 105
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 */
171int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev,106int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev,
172 struct iio_chan_spec const *chan,107 struct iio_chan_spec const *chan,
173 const int **vals,108 const int **vals,
@@ -175,23 +110,12 @@ int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev, · 1 unmodified line
175 int *length,110 int *length,
176 long mask);111 long mask);
177 112
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 */
188int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st,113int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st,
189 struct iio_chan_spec const *chan,114 struct iio_chan_spec const *chan,
190 int val, int val2, long mask);115 int val, int val2, long mask);
191 116
192extern const struct dev_pm_ops cros_ec_sensors_pm_ops;
193
194/* List of extended channel specification for all sensors */117/* List of extended channel specification for all sensors */
195extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];118extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];
119extern const struct attribute *cros_ec_sensor_fifo_attributes[];
196 120
197#endif /* __CROS_EC_SENSORS_CORE_H */121#endif /* __CROS_EC_SENSORS_CORE_H */
include/linux/iio/iio.h+4−0
@@ -568,6 +568,8 @@ struct iio_dev { · 567 unmodified lines
568#if defined(CONFIG_DEBUG_FS)568#if defined(CONFIG_DEBUG_FS)
569 struct dentry *debugfs_dentry;569 struct dentry *debugfs_dentry;
570 unsigned cached_reg_addr;570 unsigned cached_reg_addr;
571 char read_buf[20];
572 unsigned int read_buf_len;
571#endif573#endif
572};574};
573 575
@@ -627,6 +629,8 @@ static inline clockid_t iio_device_get_clock(const struct iio_dev *indio_dev) · 53 unmodified lines
627 return indio_dev->clock_id;629 return indio_dev->clock_id;
628}630}
629 631
632int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id);
633
630/**634/**
631 * dev_to_iio_dev() - Get IIO device struct from a device struct635 * dev_to_iio_dev() - Get IIO device struct from a device struct
632 * @dev: The device embedded in the IIO device636 * @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
41 * @glob_cmd_reg: Register address of the GLOB_CMD register41 * @glob_cmd_reg: Register address of the GLOB_CMD register
42 * @msc_ctrl_reg: Register address of the MSC_CTRL register42 * @msc_ctrl_reg: Register address of the MSC_CTRL register
43 * @diag_stat_reg: Register address of the DIAG_STAT register43 * @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
44 * @status_error_msgs: Array of error messgaes49 * @status_error_msgs: Array of error messgaes
45 * @status_error_mask:50 * @status_error_mask: Bitmask of errors supported by the device
46 * @timeouts: Chip specific delays51 * @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
47 */54 */
48struct adis_data {55struct adis_data {
49 unsigned int read_delay;56 unsigned int read_delay;
@@ -53,8 +60,12 @@ struct adis_data { · 3 unmodified lines
53 unsigned int glob_cmd_reg;60 unsigned int glob_cmd_reg;
54 unsigned int msc_ctrl_reg;61 unsigned int msc_ctrl_reg;
55 unsigned int diag_stat_reg;62 unsigned int diag_stat_reg;
63 unsigned int prod_id_reg;
64
65 unsigned int prod_id;
56 66
57 unsigned int self_test_mask;67 unsigned int self_test_mask;
68 unsigned int self_test_reg;
58 bool self_test_no_autoclear;69 bool self_test_no_autoclear;
59 const struct adis_timeout *timeouts;70 const struct adis_timeout *timeouts;
60 71
@@ -66,6 +77,20 @@ struct adis_data { · 5 unmodified lines
66 bool has_paging;77 bool has_paging;
67};78};
68 79
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 */
69struct adis {94struct adis {
70 struct spi_device *spi;95 struct spi_device *spi;
71 struct iio_trigger *trig;96 struct iio_trigger *trig;
@@ -73,6 +98,17 @@ struct adis { · 1 unmodified line
73 const struct adis_data *data;98 const struct adis_data *data;
74 struct adis_burst *burst;99 struct adis_burst *burst;
75 100
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 */
76 struct mutex state_lock;112 struct mutex state_lock;
77 struct spi_message msg;113 struct spi_message msg;
78 struct spi_transfer *xfer;114 struct spi_transfer *xfer;
@@ -297,6 +333,7 @@ static inline int adis_read_reg_32(struct adis *adis, unsigned int reg, · 218 unmodified lines
297 333
298int adis_enable_irq(struct adis *adis, bool enable);334int adis_enable_irq(struct adis *adis, bool enable);
299int __adis_check_status(struct adis *adis);335int __adis_check_status(struct adis *adis);
336int __adis_initial_startup(struct adis *adis);
300 337
301static inline int adis_check_status(struct adis *adis)338static inline int adis_check_status(struct adis *adis)
302{339{
@@ -309,7 +346,17 @@ static inline int adis_check_status(struct adis *adis) · 6 unmodified lines
309 return ret;346 return ret;
310}347}
311 348
312int adis_initial_startup(struct adis *adis);349/* locked version of __adis_initial_startup() */
350static 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}
313 360
314int adis_single_conversion(struct iio_dev *indio_dev,361int adis_single_conversion(struct iio_dev *indio_dev,
315 const struct iio_chan_spec *chan, unsigned int error_mask,362 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
30extern void ima_add_kexec_buffer(struct kimage *image);30extern void ima_add_kexec_buffer(struct kimage *image);
31#endif31#endif
32 32
33#if (defined(CONFIG_X86) && defined(CONFIG_EFI)) || defined(CONFIG_S390) \33#ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT
34 || defined(CONFIG_PPC_SECURE_BOOT)
35extern bool arch_ima_get_secureboot(void);34extern bool arch_ima_get_secureboot(void);
36extern const char * const *arch_get_ima_policy(void);35extern const char * const *arch_get_ima_policy(void);
37#else36#else
include/linux/inet_diag.h+28−17
@@ -2,24 +2,17 @@ · 1 unmodified line
2#ifndef _INET_DIAG_H_2#ifndef _INET_DIAG_H_
3#define _INET_DIAG_H_ 13#define _INET_DIAG_H_ 1
4 4
5#include <net/netlink.h>
5#include <uapi/linux/inet_diag.h>6#include <uapi/linux/inet_diag.h>
6 7
7struct net;
8struct sock;
9struct inet_hashinfo;8struct inet_hashinfo;
10struct nlattr;
11struct nlmsghdr;
12struct sk_buff;
13struct netlink_callback;
14 9
15struct inet_diag_handler {10struct inet_diag_handler {
16 void (*dump)(struct sk_buff *skb,11 void (*dump)(struct sk_buff *skb,
17 struct netlink_callback *cb,12 struct netlink_callback *cb,
18 const struct inet_diag_req_v2 *r,13 const struct inet_diag_req_v2 *r);
19 struct nlattr *bc);
20 14
21 int (*dump_one)(struct sk_buff *in_skb,15 int (*dump_one)(struct netlink_callback *cb,
22 const struct nlmsghdr *nlh,
23 const struct inet_diag_req_v2 *req);16 const struct inet_diag_req_v2 *req);
24 17
25 void (*idiag_get_info)(struct sock *sk,18 void (*idiag_get_info)(struct sock *sk,
@@ -40,18 +33,25 @@ struct inet_diag_handler { · 14 unmodified lines
40 __u16 idiag_info_size;33 __u16 idiag_info_size;
41};34};
42 35
36struct bpf_sk_storage_diag;
37struct 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
43struct inet_connection_sock;45struct inet_connection_sock;
44int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,46int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
45 struct sk_buff *skb, const struct inet_diag_req_v2 *req,47 struct sk_buff *skb, struct netlink_callback *cb,
46 struct user_namespace *user_ns,48 const struct inet_diag_req_v2 *req,
47 u32 pid, u32 seq, u16 nlmsg_flags,49 u16 nlmsg_flags, bool net_admin);
48 const struct nlmsghdr *unlh, bool net_admin);
49void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,50void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
50 struct netlink_callback *cb,51 struct netlink_callback *cb,
51 const struct inet_diag_req_v2 *r,52 const struct inet_diag_req_v2 *r);
52 struct nlattr *bc);
53int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,53int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
54 struct sk_buff *in_skb, const struct nlmsghdr *nlh,54 struct netlink_callback *cb,
55 const struct inet_diag_req_v2 *req);55 const struct inet_diag_req_v2 *req);
56 56
57struct sock *inet_diag_find_one_icsk(struct net *net,57struct 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
62 62
63void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock *sk);63void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock *sk);
64 64
65static 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}
65int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,76int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
66 struct inet_diag_msg *r, int ext,77 struct inet_diag_msg *r, int ext,
67 struct user_namespace *user_ns, bool net_admin);78 struct user_namespace *user_ns, bool net_admin);
include/linux/intel-iommu.h+2−0
@@ -123,6 +123,8 @@ · 122 unmodified lines
123 123
124#define dmar_readq(a) readq(a)124#define dmar_readq(a) readq(a)
125#define dmar_writeq(a,v) writeq(v,a)125#define dmar_writeq(a,v) writeq(v,a)
126#define dmar_readl(a) readl(a)
127#define dmar_writel(a, v) writel(v, a)
126 128
127#define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)129#define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)
128#define DMAR_VER_MINOR(v) ((v) & 0x0f)130#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
248extern int prepare_percpu_nmi(unsigned int irq);248extern int prepare_percpu_nmi(unsigned int irq);
249extern void teardown_percpu_nmi(unsigned int irq);249extern void teardown_percpu_nmi(unsigned int irq);
250 250
251extern int irq_inject_interrupt(unsigned int irq);
252
251/* The following three functions are for the core kernel use only. */253/* The following three functions are for the core kernel use only. */
252extern void suspend_device_irqs(void);254extern void suspend_device_irqs(void);
253extern void resume_device_irqs(void);255extern void resume_device_irqs(void);
include/linux/io-mapping.h+1−1
@@ -16,7 +16,7 @@ · 15 unmodified lines
16 * The io_mapping mechanism provides an abstraction for mapping16 * The io_mapping mechanism provides an abstraction for mapping
17 * individual pages from an io device to the CPU in an efficient fashion.17 * individual pages from an io device to the CPU in an efficient fashion.
18 *18 *
19 * See Documentation/io-mapping.txt19 * See Documentation/driver-api/io-mapping.rst
20 */20 */
21 21
22struct io_mapping {22struct 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
77 size_t size, unsigned long flags);77 size_t size, unsigned long flags);
78void devm_memunmap(struct device *dev, void *addr);78void devm_memunmap(struct device *dev, void *addr);
79 79
80void *__devm_memremap_pages(struct device *dev, struct resource *res);
81
82#ifdef CONFIG_PCI80#ifdef CONFIG_PCI
83/*81/*
84 * The PCI specifications (Rev 3.0, 3.2.5 "Transaction Ordering and82 * 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 */
25struct 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 */
56struct 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 */
79extern int ioc3_register_submodule(struct ioc3_submodule *);
80/* unregisters a submodule */
81extern void ioc3_unregister_submodule(struct ioc3_submodule *);
82/* enables IRQs indicated by irq_mask for a specified IOC3 chip */
83extern void ioc3_enable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
84/* ackowledges specified IRQs */
85extern void ioc3_ack(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
86/* disables IRQs indicated by irq_mask for a specified IOC3 chip */
87extern void ioc3_disable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
88/* atomically sets GPCR bits */
89extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int);
90/* general ireg writer */
91extern 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
8 8
9enum {9enum {
10 ICQ_EXITED = 1 << 2,10 ICQ_EXITED = 1 << 2,
11 ICQ_DESTROYED = 1 << 3,
11};12};
12 13
13/*14/*
include/linux/iommu.h+27−8
@@ -365,17 +365,20 @@ struct iommu_fault_param { · 364 unmodified lines
365};365};
366 366
367/**367/**
368 * struct iommu_param - collection of per-device IOMMU data368 * struct dev_iommu - Collection of per-device IOMMU data
369 *369 *
370 * @fault_param: IOMMU detected device fault reporting data370 * @fault_param: IOMMU detected device fault reporting data
371 * @fwspec: IOMMU fwspec data
372 * @priv: IOMMU Driver private data
371 *373 *
372 * TODO: migrate other per device data pointers under iommu_dev_data, e.g.374 * TODO: migrate other per device data pointers under iommu_dev_data, e.g.
373 * struct iommu_group *iommu_group;375 * struct iommu_group *iommu_group;
374 * struct iommu_fwspec *iommu_fwspec;
375 */376 */
376struct iommu_param {377struct dev_iommu {
377 struct mutex lock;378 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;
379};382};
380 383
381int iommu_device_register(struct iommu_device *iommu);384int iommu_device_register(struct iommu_device *iommu);
@@ -588,11 +591,10 @@ struct iommu_group *fsl_mc_device_group(struct device *dev); · 206 unmodified lines
588struct iommu_fwspec {591struct iommu_fwspec {
589 const struct iommu_ops *ops;592 const struct iommu_ops *ops;
590 struct fwnode_handle *iommu_fwnode;593 struct fwnode_handle *iommu_fwnode;
591 void *iommu_priv;
592 u32 flags;594 u32 flags;
593 u32 num_pasid_bits;595 u32 num_pasid_bits;
594 unsigned int num_ids;596 unsigned int num_ids;
595 u32 ids[1];597 u32 ids[];
596};598};
597 599
598/* ATS is supported */600/* ATS is supported */
@@ -614,13 +616,26 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode); · 15 unmodified lines
614 616
615static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)617static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
616{618{
617 return dev->iommu_fwspec;619 if (dev->iommu)
620 return dev->iommu->fwspec;
621 else
622 return NULL;
618}623}
619 624
620static inline void dev_iommu_fwspec_set(struct device *dev,625static inline void dev_iommu_fwspec_set(struct device *dev,
621 struct iommu_fwspec *fwspec)626 struct iommu_fwspec *fwspec)
622{627{
623 dev->iommu_fwspec = fwspec;628 dev->iommu->fwspec = fwspec;
629}
630
631static inline void *dev_iommu_priv_get(struct device *dev)
632{
633 return dev->iommu->priv;
634}
635
636static inline void dev_iommu_priv_set(struct device *dev, void *priv)
637{
638 dev->iommu->priv = priv;
624}639}
625 640
626int iommu_probe_device(struct device *dev);641int iommu_probe_device(struct device *dev);
@@ -1073,6 +1088,10 @@ static inline int iommu_sva_unbind_gpasid(struct iommu_domain *domain, · 446 unmodified lines
1073 return -ENODEV;1088 return -ENODEV;
1074}1089}
1075 1090
1091static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
1092{
1093 return NULL;
1094}
1076#endif /* CONFIG_IOMMU_API */1095#endif /* CONFIG_IOMMU_API */
1077 1096
1078#ifdef CONFIG_IOMMU_DEBUGFS1097#ifdef CONFIG_IOMMU_DEBUGFS
include/linux/iopoll.h+33−7
@@ -14,36 +14,41 @@ · 13 unmodified lines
14#include <linux/io.h>14#include <linux/io.h>
15 15
16/**16/**
17 * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs17 * read_poll_timeout - Periodically poll an address until a condition is
18 * @op: accessor function (takes @addr as its only argument)18 * met or a timeout occurs
19 * @addr: Address to poll19 * @op: accessor function (takes @args as its arguments)
20 * @val: Variable to read the value into20 * @val: Variable to read the value into
21 * @cond: Break condition (usually involving @val)21 * @cond: Break condition (usually involving @val)
22 * @sleep_us: Maximum time to sleep between reads in us (022 * @sleep_us: Maximum time to sleep between reads in us (0
23 * tight-loops). Should be less than ~20ms since usleep_range23 * tight-loops). Should be less than ~20ms since usleep_range
24 * is used (see Documentation/timers/timers-howto.rst).24 * is used (see Documentation/timers/timers-howto.rst).
25 * @timeout_us: Timeout in us, 0 means never timeout25 * @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
26 *28 *
27 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either29 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
28 * case, the last read value at @addr is stored in @val. Must not30 * case, the last read value at @args is stored in @val. Must not
29 * be called from atomic context if sleep_us or timeout_us are used.31 * be called from atomic context if sleep_us or timeout_us are used.
30 *32 *
31 * When available, you'll probably want to use one of the specialized33 * When available, you'll probably want to use one of the specialized
32 * macros defined below rather than this macro directly.34 * macros defined below rather than this macro directly.
33 */35 */
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...) \
35({ \38({ \
36 u64 __timeout_us = (timeout_us); \39 u64 __timeout_us = (timeout_us); \
37 unsigned long __sleep_us = (sleep_us); \40 unsigned long __sleep_us = (sleep_us); \
38 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \41 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
39 might_sleep_if((__sleep_us) != 0); \42 might_sleep_if((__sleep_us) != 0); \
43 if (sleep_before_read && __sleep_us) \
44 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
40 for (;;) { \45 for (;;) { \
41 (val) = op(addr); \46 (val) = op(args); \
42 if (cond) \47 if (cond) \
43 break; \48 break; \
44 if (__timeout_us && \49 if (__timeout_us && \
45 ktime_compare(ktime_get(), __timeout) > 0) { \50 ktime_compare(ktime_get(), __timeout) > 0) { \
46 (val) = op(addr); \51 (val) = op(args); \
47 break; \52 break; \
48 } \53 } \
49 if (__sleep_us) \54 if (__sleep_us) \
@@ -52,6 +57,27 @@ · 2 unmodified lines
52 (cond) ? 0 : -ETIMEDOUT; \57 (cond) ? 0 : -ETIMEDOUT; \
53})58})
54 59
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
55/**81/**
56 * readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs82 * readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs
57 * @op: accessor function (takes @addr as its only argument)83 * @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
74 __u32 addr_gen_mode;74 __u32 addr_gen_mode;
75 __s32 disable_policy;75 __s32 disable_policy;
76 __s32 ndisc_tclass;76 __s32 ndisc_tclass;
77 __s32 rpl_seg_enabled;
77 78
78 struct ctl_table_header *sysctl_header;79 struct ctl_table_header *sysctl_header;
79};80};
include/linux/irq.h+13−0
@@ -211,6 +211,8 @@ struct irq_data { · 210 unmodified lines
211 * IRQD_CAN_RESERVE - Can use reservation mode211 * IRQD_CAN_RESERVE - Can use reservation mode
212 * IRQD_MSI_NOMASK_QUIRK - Non-maskable MSI quirk for affinity change212 * IRQD_MSI_NOMASK_QUIRK - Non-maskable MSI quirk for affinity change
213 * required213 * required
214 * IRQD_HANDLE_ENFORCE_IRQCTX - Enforce that handle_irq_*() is only invoked
215 * from actual interrupt context.
214 */216 */
215enum {217enum {
216 IRQD_TRIGGER_MASK = 0xf,218 IRQD_TRIGGER_MASK = 0xf,
@@ -234,6 +236,7 @@ enum { · 17 unmodified lines
234 IRQD_DEFAULT_TRIGGER_SET = (1 << 25),236 IRQD_DEFAULT_TRIGGER_SET = (1 << 25),
235 IRQD_CAN_RESERVE = (1 << 26),237 IRQD_CAN_RESERVE = (1 << 26),
236 IRQD_MSI_NOMASK_QUIRK = (1 << 27),238 IRQD_MSI_NOMASK_QUIRK = (1 << 27),
239 IRQD_HANDLE_ENFORCE_IRQCTX = (1 << 28),
237};240};
238 241
239#define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)242#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
303 return __irqd_to_state(d) & IRQD_SINGLE_TARGET;306 return __irqd_to_state(d) & IRQD_SINGLE_TARGET;
304}307}
305 308
309static inline void irqd_set_handle_enforce_irqctx(struct irq_data *d)
310{
311 __irqd_to_state(d) |= IRQD_HANDLE_ENFORCE_IRQCTX;
312}
313
314static inline bool irqd_is_handle_enforce_irqctx(struct irq_data *d)
315{
316 return __irqd_to_state(d) & IRQD_HANDLE_ENFORCE_IRQCTX;
317}
318
306static inline bool irqd_is_wakeup_set(struct irq_data *d)319static inline bool irqd_is_wakeup_set(struct irq_data *d)
307{320{
308 return __irqd_to_state(d) & IRQD_WAKEUP_STATE;321 return __irqd_to_state(d) & IRQD_WAKEUP_STATE;
include/linux/irq_work.h+2−0
@@ -18,6 +18,8 @@ · 17 unmodified lines
18 18
19/* Doesn't want IPI, wait for tick: */19/* Doesn't want IPI, wait for tick: */
20#define IRQ_WORK_LAZY BIT(2)20#define IRQ_WORK_LAZY BIT(2)
21/* Run hard IRQ context, even on RT */
22#define IRQ_WORK_HARD_IRQ BIT(3)
21 23
22#define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY)24#define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY)
23 25
include/linux/irqchip/arm-gic-common.h+2−0
@@ -32,6 +32,8 @@ struct gic_kvm_info { · 31 unmodified lines
32 struct resource vctrl;32 struct resource vctrl;
33 /* vlpi support */33 /* vlpi support */
34 bool has_v4;34 bool has_v4;
35 /* rvpeid support */
36 bool has_v4_1;
35};37};
36 38
37const struct gic_kvm_info *gic_get_kvm_info(void);39const 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
57#define GICD_SPENDSGIR 0x0F2057#define GICD_SPENDSGIR 0x0F20
58 58
59#define GICD_CTLR_RWP (1U << 31)59#define GICD_CTLR_RWP (1U << 31)
60#define GICD_CTLR_nASSGIreq (1U << 8)
60#define GICD_CTLR_DS (1U << 6)61#define GICD_CTLR_DS (1U << 6)
61#define GICD_CTLR_ARE_NS (1U << 4)62#define GICD_CTLR_ARE_NS (1U << 4)
62#define GICD_CTLR_ENABLE_G1A (1U << 1)63#define GICD_CTLR_ENABLE_G1A (1U << 1)
@@ -90,6 +91,7 @@ · 27 unmodified lines
90#define GICD_TYPER_ESPIS(typer) \91#define GICD_TYPER_ESPIS(typer) \
91 (((typer) & GICD_TYPER_ESPI) ? GICD_TYPER_SPIS((typer) >> 27) : 0)92 (((typer) & GICD_TYPER_ESPI) ? GICD_TYPER_SPIS((typer) >> 27) : 0)
92 93
94#define GICD_TYPER2_nASSGIcap (1U << 8)
93#define GICD_TYPER2_VIL (1U << 7)95#define GICD_TYPER2_VIL (1U << 7)
94#define GICD_TYPER2_VID GENMASK(4, 0)96#define GICD_TYPER2_VID GENMASK(4, 0)
95 97
@@ -320,6 +322,9 @@ · 224 unmodified lines
320#define GICR_VPENDBASER_NonShareable \322#define GICR_VPENDBASER_NonShareable \
321 GIC_BASER_SHAREABILITY(GICR_VPENDBASER, NonShareable)323 GIC_BASER_SHAREABILITY(GICR_VPENDBASER, NonShareable)
322 324
325#define GICR_VPENDBASER_InnerShareable \
326 GIC_BASER_SHAREABILITY(GICR_VPENDBASER, InnerShareable)
327
323#define GICR_VPENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nCnB)328#define GICR_VPENDBASER_nCnB GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nCnB)
324#define GICR_VPENDBASER_nC GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nC)329#define GICR_VPENDBASER_nC GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nC)
325#define GICR_VPENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt)330#define GICR_VPENDBASER_RaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt)
@@ -343,6 +348,15 @@ · 17 unmodified lines
343#define GICR_VPENDBASER_4_1_VGRP1EN (1ULL << 58)348#define GICR_VPENDBASER_4_1_VGRP1EN (1ULL << 58)
344#define GICR_VPENDBASER_4_1_VPEID GENMASK_ULL(15, 0)349#define GICR_VPENDBASER_4_1_VPEID GENMASK_ULL(15, 0)
345 350
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
346/*360/*
347 * ITS registers, offsets from ITS_base361 * ITS registers, offsets from ITS_base
348 */362 */
@@ -366,6 +380,11 @@ · 17 unmodified lines
366 380
367#define GITS_TRANSLATER 0x10040381#define GITS_TRANSLATER 0x10040
368 382
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
369#define GITS_CTLR_ENABLE (1U << 0)388#define GITS_CTLR_ENABLE (1U << 0)
370#define GITS_CTLR_ImDe (1U << 1)389#define GITS_CTLR_ImDe (1U << 1)
371#define GITS_CTLR_ITS_NUMBER_SHIFT 4390#define GITS_CTLR_ITS_NUMBER_SHIFT 4
@@ -500,8 +519,9 @@ · 128 unmodified lines
500#define GITS_CMD_VMAPTI GITS_CMD_GICv4(GITS_CMD_MAPTI)519#define GITS_CMD_VMAPTI GITS_CMD_GICv4(GITS_CMD_MAPTI)
501#define GITS_CMD_VMOVI GITS_CMD_GICv4(GITS_CMD_MOVI)520#define GITS_CMD_VMOVI GITS_CMD_GICv4(GITS_CMD_MOVI)
502#define GITS_CMD_VSYNC GITS_CMD_GICv4(GITS_CMD_SYNC)521#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 */
504#define GITS_CMD_VMOVP GITS_CMD_GICv4(2)523#define GITS_CMD_VMOVP GITS_CMD_GICv4(2)
524#define GITS_CMD_VSGI GITS_CMD_GICv4(3)
505#define GITS_CMD_INVDB GITS_CMD_GICv4(0xe)525#define GITS_CMD_INVDB GITS_CMD_GICv4(0xe)
506 526
507/*527/*
@@ -650,6 +670,7 @@ · 142 unmodified lines
650 670
651struct rdists {671struct rdists {
652 struct {672 struct {
673 raw_spinlock_t rd_lock;
653 void __iomem *rd_base;674 void __iomem *rd_base;
654 struct page *pend_page;675 struct page *pend_page;
655 phys_addr_t phys_base;676 phys_addr_t phys_base;
include/linux/irqchip/arm-gic-v4.h+23−2
@@ -49,10 +49,22 @@ struct its_vpe { · 48 unmodified lines
49 };49 };
50 /* GICv4.1 implementations */50 /* GICv4.1 implementations */
51 struct {51 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];
52 atomic_t vmapp_count;59 atomic_t vmapp_count;
53 };60 };
54 };61 };
55 62
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;
56 /*68 /*
57 * This collection ID is used to indirect the target69 * This collection ID is used to indirect the target
58 * redistributor for this VPE. The ID itself isn't involved in70 * redistributor for this VPE. The ID itself isn't involved in
@@ -93,6 +105,7 @@ enum its_vcpu_info_cmd_type { · 34 unmodified lines
93 SCHEDULE_VPE,105 SCHEDULE_VPE,
94 DESCHEDULE_VPE,106 DESCHEDULE_VPE,
95 INVALL_VPE,107 INVALL_VPE,
108 PROP_UPDATE_VSGI,
96};109};
97 110
98struct its_cmd_info {111struct its_cmd_info {
@@ -105,19 +118,27 @@ struct its_cmd_info { · 6 unmodified lines
105 bool g0en;118 bool g0en;
106 bool g1en;119 bool g1en;
107 };120 };
121 struct {
122 u8 priority;
123 bool group;
124 };
108 };125 };
109};126};
110 127
111int its_alloc_vcpu_irqs(struct its_vm *vm);128int its_alloc_vcpu_irqs(struct its_vm *vm);
112void its_free_vcpu_irqs(struct its_vm *vm);129void its_free_vcpu_irqs(struct its_vm *vm);
113int its_schedule_vpe(struct its_vpe *vpe, bool on);130int its_make_vpe_resident(struct its_vpe *vpe, bool g0en, bool g1en);
131int its_make_vpe_non_resident(struct its_vpe *vpe, bool db);
114int its_invall_vpe(struct its_vpe *vpe);132int its_invall_vpe(struct its_vpe *vpe);
115int its_map_vlpi(int irq, struct its_vlpi_map *map);133int its_map_vlpi(int irq, struct its_vlpi_map *map);
116int its_get_vlpi(int irq, struct its_vlpi_map *map);134int its_get_vlpi(int irq, struct its_vlpi_map *map);
117int its_unmap_vlpi(int irq);135int its_unmap_vlpi(int irq);
118int its_prop_update_vlpi(int irq, u8 config, bool inv);136int its_prop_update_vlpi(int irq, u8 config, bool inv);
137int its_prop_update_vsgi(int irq, u8 priority, bool group);
119 138
120struct irq_domain_ops;139struct irq_domain_ops;
121int its_init_v4(struct irq_domain *domain, const struct irq_domain_ops *ops);140int its_init_v4(struct irq_domain *domain,
141 const struct irq_domain_ops *vpe_ops,
142 const struct irq_domain_ops *sgi_ops);
122 143
123#endif144#endif
include/linux/irqdesc.h+1−1
@@ -24,7 +24,7 @@ struct pt_regs; · 23 unmodified lines
24 * @handle_irq: highlevel irq-events handler24 * @handle_irq: highlevel irq-events handler
25 * @preflow_handler: handler called before the flow handler (currently used by sparc)25 * @preflow_handler: handler called before the flow handler (currently used by sparc)
26 * @action: the irq action chain26 * @action: the irq action chain
27 * @status: status information27 * @status_use_accessors: status information
28 * @core_internal_state__do_not_mess_with_it: core internal status information28 * @core_internal_state__do_not_mess_with_it: core internal status information
29 * @depth: disable-depth, for nested irq_disable() calls29 * @depth: disable-depth, for nested irq_disable() calls
30 * @wake_depth: enable depth, for multiple irq_set_irq_wake() callers30 * @wake_depth: enable depth, for multiple irq_set_irq_wake() callers
include/linux/irqflags.h+69−18
@@ -15,15 +15,15 @@ · 14 unmodified lines
15#include <linux/typecheck.h>15#include <linux/typecheck.h>
16#include <asm/irqflags.h>16#include <asm/irqflags.h>
17 17
18/* Currently trace_softirqs_on/off is used only by lockdep */18/* Currently lockdep_softirqs_on/off is used only by lockdep */
19#ifdef CONFIG_PROVE_LOCKING19#ifdef CONFIG_PROVE_LOCKING
20 extern void trace_softirqs_on(unsigned long ip);20 extern void lockdep_softirqs_on(unsigned long ip);
21 extern void trace_softirqs_off(unsigned long ip);21 extern void lockdep_softirqs_off(unsigned long ip);
22 extern void lockdep_hardirqs_on(unsigned long ip);22 extern void lockdep_hardirqs_on(unsigned long ip);
23 extern void lockdep_hardirqs_off(unsigned long ip);23 extern void lockdep_hardirqs_off(unsigned long ip);
24#else24#else
25 static inline void trace_softirqs_on(unsigned long ip) { }25 static inline void lockdep_softirqs_on(unsigned long ip) { }
26 static inline void trace_softirqs_off(unsigned long ip) { }26 static inline void lockdep_softirqs_off(unsigned long ip) { }
27 static inline void lockdep_hardirqs_on(unsigned long ip) { }27 static inline void lockdep_hardirqs_on(unsigned long ip) { }
28 static inline void lockdep_hardirqs_off(unsigned long ip) { }28 static inline void lockdep_hardirqs_off(unsigned long ip) { }
29#endif29#endif
@@ -31,15 +31,20 @@ · 1 unmodified line
31#ifdef CONFIG_TRACE_IRQFLAGS31#ifdef CONFIG_TRACE_IRQFLAGS
32 extern void trace_hardirqs_on(void);32 extern void trace_hardirqs_on(void);
33 extern void trace_hardirqs_off(void);33 extern void trace_hardirqs_off(void);
34# define trace_hardirq_context(p) ((p)->hardirq_context)34# define lockdep_hardirq_context(p) ((p)->hardirq_context)
35# define trace_softirq_context(p) ((p)->softirq_context)35# define lockdep_softirq_context(p) ((p)->softirq_context)
36# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)36# define lockdep_hardirqs_enabled(p) ((p)->hardirqs_enabled)
37# define trace_softirqs_enabled(p) ((p)->softirqs_enabled)37# define lockdep_softirqs_enabled(p) ((p)->softirqs_enabled)
38# define trace_hardirq_enter() \38# define lockdep_hardirq_enter() \
39do { \39do { \
40 current->hardirq_context++; \40 if (!current->hardirq_context++) \
41 current->hardirq_threaded = 0; \
41} while (0)42} while (0)
42# define trace_hardirq_exit() \43# define lockdep_hardirq_threaded() \
44do { \
45 current->hardirq_threaded = 1; \
46} while (0)
47# define lockdep_hardirq_exit() \
43do { \48do { \
44 current->hardirq_context--; \49 current->hardirq_context--; \
45} while (0)50} while (0)
@@ -51,17 +56,63 @@ do { \ · 5 unmodified lines
51do { \56do { \
52 current->softirq_context--; \57 current->softirq_context--; \
53} while (0)58} 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
54#else98#else
55# define trace_hardirqs_on() do { } while (0)99# define trace_hardirqs_on() do { } while (0)
56# define trace_hardirqs_off() do { } while (0)100# define trace_hardirqs_off() do { } while (0)
57# define trace_hardirq_context(p) 0101# define lockdep_hardirq_context(p) 0
58# define trace_softirq_context(p) 0102# define lockdep_softirq_context(p) 0
59# define trace_hardirqs_enabled(p) 0103# define lockdep_hardirqs_enabled(p) 0
60# define trace_softirqs_enabled(p) 0104# define lockdep_softirqs_enabled(p) 0
61# define trace_hardirq_enter() do { } while (0)105# define lockdep_hardirq_enter() do { } while (0)
62# define trace_hardirq_exit() do { } while (0)106# define lockdep_hardirq_threaded() do { } while (0)
107# define lockdep_hardirq_exit() do { } while (0)
63# define lockdep_softirq_enter() do { } while (0)108# define lockdep_softirq_enter() do { } while (0)
64# define lockdep_softirq_exit() do { } while (0)109# 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)
65#endif116#endif
66 117
67#if defined(CONFIG_IRQSOFF_TRACER) || \118#if defined(CONFIG_IRQSOFF_TRACER) || \
include/linux/jiffies.h+1−3
@@ -8,6 +8,7 @@ · 7 unmodified lines
8#include <linux/types.h>8#include <linux/types.h>
9#include <linux/time.h>9#include <linux/time.h>
10#include <linux/timex.h>10#include <linux/timex.h>
11#include <vdso/jiffies.h>
11#include <asm/param.h> /* for HZ */12#include <asm/param.h> /* for HZ */
12#include <generated/timeconst.h>13#include <generated/timeconst.h>
13 14
@@ -59,9 +60,6 @@ · 45 unmodified lines
59 60
60extern int register_refined_jiffies(long clock_tick_rate);61extern int register_refined_jiffies(long clock_tick_rate);
61 62
62/* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */
63#define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ)
64
65/* TICK_USEC is the time between ticks in usec assuming SHIFTED_HZ */63/* TICK_USEC is the time between ticks in usec assuming SHIFTED_HZ */
66#define TICK_USEC ((USEC_PER_SEC + HZ/2) / HZ)64#define TICK_USEC ((USEC_PER_SEC + HZ/2) / HZ)
67 65
include/linux/kasan.h+1−1
@@ -190,7 +190,7 @@ void kasan_init_tags(void); · 189 unmodified lines
190 190
191void *kasan_reset_tag(const void *addr);191void *kasan_reset_tag(const void *addr);
192 192
193void kasan_report(unsigned long addr, size_t size,193bool kasan_report(unsigned long addr, size_t size,
194 bool is_write, unsigned long ip);194 bool is_write, unsigned long ip);
195 195
196#else /* CONFIG_KASAN_SW_TAGS */196#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
257 257
258#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)258#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
259 259
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
260/**267/**
261 * abs - return absolute value of an argument268 * abs - return absolute value of an argument
262 * @x: the value. If it is unsigned type, it is converted to signed type first.269 * @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
37 KERNFS_LINK = 0x0004,37 KERNFS_LINK = 0x0004,
38};38};
39 39
40#define KERNFS_TYPE_MASK 0x000f40#define KERNFS_TYPE_MASK 0x000f
41#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK41#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK
42#define KERNFS_MAX_USER_XATTRS 128
43#define KERNFS_USER_XATTR_SIZE_LIMIT (128 << 10)
42 44
43enum kernfs_node_flag {45enum kernfs_node_flag {
44 KERNFS_ACTIVATED = 0x0010,46 KERNFS_ACTIVATED = 0x0010,
@@ -78,6 +80,11 @@ enum kernfs_root_flag { · 33 unmodified lines
78 * fhandle to access nodes of the fs.80 * fhandle to access nodes of the fs.
79 */81 */
80 KERNFS_ROOT_SUPPORT_EXPORTOP = 0x0004,82 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,
81};88};
82 89
83/* type-specific structures for kernfs_node union members */90/* 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
127 * much is copied into the buffer127 * much is copied into the buffer
128 * - shouldn't do the copy if the buffer is NULL128 * - shouldn't do the copy if the buffer is NULL
129 */129 */
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);
131 131
132 /* handle request_key() for this type instead of invoking132 /* handle request_key() for this type instead of invoking
133 * /sbin/request-key (optional)133 * /sbin/request-key (optional)
include/linux/kfifo.h+73−0
@@ -246,6 +246,37 @@ __kfifo_int_must_check_helper(int val) · 245 unmodified lines
246 __tmpq->kfifo.in == __tmpq->kfifo.out; \246 __tmpq->kfifo.in == __tmpq->kfifo.out; \
247})247})
248 248
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
249/**280/**
250 * kfifo_is_full - returns true if the fifo is full281 * kfifo_is_full - returns true if the fifo is full
251 * @fifo: address of the fifo to be used282 * @fifo: address of the fifo to be used
@@ -517,6 +548,26 @@ __kfifo_uint_must_check_helper( \ · 265 unmodified lines
517 __ret; \548 __ret; \
518})549})
519 550
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
520/* alias for kfifo_in_spinlocked, will be removed in a future release */571/* alias for kfifo_in_spinlocked, will be removed in a future release */
521#define kfifo_in_locked(fifo, buf, n, lock) \572#define kfifo_in_locked(fifo, buf, n, lock) \
522 kfifo_in_spinlocked(fifo, buf, n, lock)573 kfifo_in_spinlocked(fifo, buf, n, lock)
@@ -569,6 +620,28 @@ __kfifo_uint_must_check_helper( \ · 46 unmodified lines
569}) \620}) \
570)621)
571 622
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
572/* alias for kfifo_out_spinlocked, will be removed in a future release */645/* alias for kfifo_out_spinlocked, will be removed in a future release */
573#define kfifo_out_locked(fifo, buf, n, lock) \646#define kfifo_out_locked(fifo, buf, n, lock) \
574 kfifo_out_spinlocked(fifo, buf, n, lock)647 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
165 do { \165 do { \
166 kthread_init_work(&(dwork)->work, (fn)); \166 kthread_init_work(&(dwork)->work, (fn)); \
167 timer_setup(&(dwork)->timer, \167 timer_setup(&(dwork)->timer, \
168 kthread_delayed_work_timer_fn, 0); \168 kthread_delayed_work_timer_fn, \
169 TIMER_IRQSAFE); \
169 } while (0)170 } while (0)
170 171
171int kthread_worker_fn(void *worker_ptr);172int 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
216 }216 }
217}217}
218 218
219/*219#include <vdso/ktime.h>
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)
227 220
228static inline ktime_t ns_to_ktime(u64 ns)221static inline ktime_t ns_to_ktime(u64 ns)
229{222{
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
360 return memslot->dirty_bitmap + len / sizeof(*memslot->dirty_bitmap);360 return memslot->dirty_bitmap + len / sizeof(*memslot->dirty_bitmap);
361}361}
362 362
363#ifndef KVM_DIRTY_LOG_MANUAL_CAPS
364#define KVM_DIRTY_LOG_MANUAL_CAPS KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE
365#endif
366
363struct kvm_s390_adapter_int {367struct kvm_s390_adapter_int {
364 u64 ind_addr;368 u64 ind_addr;
365 u64 summary_addr;369 u64 summary_addr;
@@ -431,11 +435,11 @@ static inline int kvm_arch_vcpu_memslots_id(struct kvm_vcpu *vcpu) · 65 unmodified lines
431 */435 */
432struct kvm_memslots {436struct kvm_memslots {
433 u64 generation;437 u64 generation;
434 struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM];
435 /* The mapping table from slot id to the index in memslots[]. */438 /* The mapping table from slot id to the index in memslots[]. */
436 short id_to_index[KVM_MEM_SLOTS_NUM];439 short id_to_index[KVM_MEM_SLOTS_NUM];
437 atomic_t lru_slot;440 atomic_t lru_slot;
438 int used_slots;441 int used_slots;
442 struct kvm_memory_slot memslots[];
439};443};
440 444
441struct kvm {445struct kvm {
@@ -493,7 +497,7 @@ struct kvm { · 51 unmodified lines
493#endif497#endif
494 long tlbs_dirty;498 long tlbs_dirty;
495 struct list_head devices;499 struct list_head devices;
496 bool manual_dirty_log_protect;500 u64 manual_dirty_log_protect;
497 struct dentry *debugfs_dentry;501 struct dentry *debugfs_dentry;
498 struct kvm_stat_data **debugfs_stat_data;502 struct kvm_stat_data **debugfs_stat_data;
499 struct srcu_struct srcu;503 struct srcu_struct srcu;
@@ -527,6 +531,11 @@ struct kvm { · 27 unmodified lines
527#define vcpu_err(vcpu, fmt, ...) \531#define vcpu_err(vcpu, fmt, ...) \
528 kvm_err("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)532 kvm_err("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)
529 533
534static 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
530static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx)539static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx)
531{540{
532 return srcu_dereference_check(kvm->buses[idx], &kvm->srcu,541 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
572 return vcpu->vcpu_idx;581 return vcpu->vcpu_idx;
573}582}
574 583
575#define kvm_for_each_memslot(memslot, slots) \584#define kvm_for_each_memslot(memslot, slots) \
576 for (memslot = &slots->memslots[0]; \585 for (memslot = &slots->memslots[0]; \
577 memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\586 memslot < slots->memslots + slots->used_slots; memslot++) \
578 memslot++)587 if (WARN_ON_ONCE(!memslot->npages)) { \
588 } else
579 589
580void kvm_vcpu_destroy(struct kvm_vcpu *vcpu);590void kvm_vcpu_destroy(struct kvm_vcpu *vcpu);
581 591
@@ -635,12 +645,15 @@ static inline struct kvm_memslots *kvm_vcpu_memslots(struct kvm_vcpu *vcpu) · 53 unmodified lines
635 return __kvm_memslots(vcpu->kvm, as_id);645 return __kvm_memslots(vcpu->kvm, as_id);
636}646}
637 647
638static inline struct kvm_memory_slot *648static inline
639id_to_memslot(struct kvm_memslots *slots, int id)649struct kvm_memory_slot *id_to_memslot(struct kvm_memslots *slots, int id)
640{650{
641 int index = slots->id_to_index[id];651 int index = slots->id_to_index[id];
642 struct kvm_memory_slot *slot;652 struct kvm_memory_slot *slot;
643 653
654 if (index < 0)
655 return NULL;
656
644 slot = &slots->memslots[index];657 slot = &slots->memslots[index];
645 658
646 WARN_ON(slot->id != id);659 WARN_ON(slot->id != id);
@@ -669,10 +682,7 @@ int kvm_set_memory_region(struct kvm *kvm, · 22 unmodified lines
669 const struct kvm_userspace_memory_region *mem);682 const struct kvm_userspace_memory_region *mem);
670int __kvm_set_memory_region(struct kvm *kvm,683int __kvm_set_memory_region(struct kvm *kvm,
671 const struct kvm_userspace_memory_region *mem);684 const struct kvm_userspace_memory_region *mem);
672void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,685void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot);
673 struct kvm_memory_slot *dont);
674int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
675 unsigned long npages);
676void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen);686void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen);
677int kvm_arch_prepare_memory_region(struct kvm *kvm,687int kvm_arch_prepare_memory_region(struct kvm *kvm,
678 struct kvm_memory_slot *memslot,688 struct kvm_memory_slot *memslot,
@@ -680,11 +690,9 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, · 1 unmodified line
680 enum kvm_mr_change change);690 enum kvm_mr_change change);
681void kvm_arch_commit_memory_region(struct kvm *kvm,691void kvm_arch_commit_memory_region(struct kvm *kvm,
682 const struct kvm_userspace_memory_region *mem,692 const struct kvm_userspace_memory_region *mem,
683 const struct kvm_memory_slot *old,693 struct kvm_memory_slot *old,
684 const struct kvm_memory_slot *new,694 const struct kvm_memory_slot *new,
685 enum kvm_mr_change change);695 enum kvm_mr_change change);
686bool kvm_largepages_enabled(void);
687void kvm_disable_largepages(void);
688/* flush all memory translations */696/* flush all memory translations */
689void kvm_arch_flush_shadow_all(struct kvm *kvm);697void kvm_arch_flush_shadow_all(struct kvm *kvm);
690/* flush memory translations pointing to 'slot' */698/* flush memory translations pointing to 'slot' */
@@ -704,7 +712,6 @@ void kvm_release_page_clean(struct page *page); · 13 unmodified lines
704void kvm_release_page_dirty(struct page *page);712void kvm_release_page_dirty(struct page *page);
705void kvm_set_page_accessed(struct page *page);713void kvm_set_page_accessed(struct page *page);
706 714
707kvm_pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn);
708kvm_pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);715kvm_pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
709kvm_pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault,716kvm_pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault,
710 bool *writable);717 bool *writable);
@@ -819,23 +826,20 @@ vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf); · 108 unmodified lines
819 826
820int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);827int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
821 828
822int kvm_get_dirty_log(struct kvm *kvm,
823 struct kvm_dirty_log *log, int *is_dirty);
824
825int kvm_get_dirty_log_protect(struct kvm *kvm,
826 struct kvm_dirty_log *log, bool *flush);
827int kvm_clear_dirty_log_protect(struct kvm *kvm,
828 struct kvm_clear_dirty_log *log, bool *flush);
829
830void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,829void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,
831 struct kvm_memory_slot *slot,830 struct kvm_memory_slot *slot,
832 gfn_t gfn_offset,831 gfn_t gfn_offset,
833 unsigned long mask);832 unsigned long mask);
834 833void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot);
835int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,834
836 struct kvm_dirty_log *log);835#ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT
837int kvm_vm_ioctl_clear_dirty_log(struct kvm *kvm,836void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
838 struct kvm_clear_dirty_log *log);837 struct kvm_memory_slot *memslot);
838#else /* !CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT */
839int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log);
840int kvm_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log,
841 int *is_dirty, struct kvm_memory_slot **memslot);
842#endif
839 843
840int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,844int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
841 bool line_status);845 bool line_status);
@@ -882,9 +886,9 @@ void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu); · 40 unmodified lines
882 886
883int kvm_arch_hardware_enable(void);887int kvm_arch_hardware_enable(void);
884void kvm_arch_hardware_disable(void);888void kvm_arch_hardware_disable(void);
885int kvm_arch_hardware_setup(void);889int kvm_arch_hardware_setup(void *opaque);
886void kvm_arch_hardware_unsetup(void);890void kvm_arch_hardware_unsetup(void);
887int kvm_arch_check_processor_compat(void);891int kvm_arch_check_processor_compat(void *opaque);
888int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);892int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
889bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu);893bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu);
890int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);894int 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
1018 * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c.1022 * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c.
1019 * gfn_to_memslot() itself isn't here as an inline because that would1023 * gfn_to_memslot() itself isn't here as an inline because that would
1020 * bloat other code too much.1024 * bloat other code too much.
1025 *
1026 * IMPORTANT: Slots are sorted from highest GFN to lowest GFN!
1021 */1027 */
1022static inline struct kvm_memory_slot *1028static inline struct kvm_memory_slot *
1023search_memslots(struct kvm_memslots *slots, gfn_t gfn)1029search_memslots(struct kvm_memslots *slots, gfn_t gfn)
@@ -1026,6 +1032,9 @@ search_memslots(struct kvm_memslots *slots, gfn_t gfn) · 2 unmodified lines
1026 int slot = atomic_read(&slots->lru_slot);1032 int slot = atomic_read(&slots->lru_slot);
1027 struct kvm_memory_slot *memslots = slots->memslots;1033 struct kvm_memory_slot *memslots = slots->memslots;
1028 1034
1035 if (unlikely(!slots->used_slots))
1036 return NULL;
1037
1029 if (gfn >= memslots[slot].base_gfn &&1038 if (gfn >= memslots[slot].base_gfn &&
1030 gfn < memslots[slot].base_gfn + memslots[slot].npages)1039 gfn < memslots[slot].base_gfn + memslots[slot].npages)
1031 return &memslots[slot];1040 return &memslots[slot];
include/linux/leds.h+1−0
@@ -25,6 +25,7 @@ struct device_node; · 24 unmodified lines
25 * LED Core25 * LED Core
26 */26 */
27 27
28/* This is obsolete/useless. We now support variable maximum brightness. */
28enum led_brightness {29enum led_brightness {
29 LED_OFF = 0,30 LED_OFF = 0,
30 LED_ON = 1,31 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
8struct 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
17struct 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
57#define VPRINTK(fmt, args...)57#define VPRINTK(fmt, args...)
58#endif /* ATA_DEBUG */58#endif /* ATA_DEBUG */
59 59
60#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)
61
62#define ata_print_version_once(dev, version) \60#define ata_print_version_once(dev, version) \
63({ \61({ \
64 static bool __print_once; \62 static bool __print_once; \
@@ -176,6 +174,7 @@ enum { · 111 unmodified lines
176 ATA_DEV_NONE = 11, /* no device */174 ATA_DEV_NONE = 11, /* no device */
177 175
178 /* struct ata_link flags */176 /* struct ata_link flags */
177 /* NOTE: struct ata_force_param currently stores lflags in u16 */
179 ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */178 ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */
180 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */179 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */
181 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */180 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
531 unsigned long deadline);530 unsigned long deadline);
532typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);531typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);
533 532
534extern struct device_attribute dev_attr_link_power_management_policy;
535extern struct device_attribute dev_attr_unload_heads;533extern struct device_attribute dev_attr_unload_heads;
534#ifdef CONFIG_SATA_HOST
535extern struct device_attribute dev_attr_link_power_management_policy;
536extern struct device_attribute dev_attr_ncq_prio_enable;536extern struct device_attribute dev_attr_ncq_prio_enable;
537extern struct device_attribute dev_attr_em_message_type;537extern struct device_attribute dev_attr_em_message_type;
538extern struct device_attribute dev_attr_em_message;538extern struct device_attribute dev_attr_em_message;
539extern struct device_attribute dev_attr_sw_activity;539extern struct device_attribute dev_attr_sw_activity;
540#endif
540 541
541enum sw_activity {542enum sw_activity {
542 OFF,543 OFF,
@@ -1020,10 +1021,6 @@ struct ata_timing { · 477 unmodified lines
1020/*1021/*
1021 * Core layer - drivers/ata/libata-core.c1022 * Core layer - drivers/ata/libata-core.c
1022 */1023 */
1023extern const unsigned long sata_deb_timing_normal[];
1024extern const unsigned long sata_deb_timing_hotplug[];
1025extern const unsigned long sata_deb_timing_long[];
1026
1027extern struct ata_port_operations ata_dummy_port_ops;1024extern struct ata_port_operations ata_dummy_port_ops;
1028extern const struct ata_port_info ata_dummy_port_info;1025extern const struct ata_port_info ata_dummy_port_info;
1029 1026
@@ -1061,33 +1058,14 @@ static inline int is_multi_taskfile(struct ata_taskfile *tf) · 31 unmodified lines
1061 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);1058 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
1062}1059}
1063 1060
1064static inline const unsigned long *
1065sata_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
1073static inline int ata_port_is_dummy(struct ata_port *ap)1061static inline int ata_port_is_dummy(struct ata_port *ap)
1074{1062{
1075 return ap->ops == &ata_dummy_port_ops;1063 return ap->ops == &ata_dummy_port_ops;
1076}1064}
1077 1065
1078extern int sata_set_spd(struct ata_link *link);
1079extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);1066extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
1080extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,1067extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
1081 int (*check_ready)(struct ata_link *link));1068 int (*check_ready)(struct ata_link *link));
1082extern int sata_link_debounce(struct ata_link *link,
1083 const unsigned long *params, unsigned long deadline);
1084extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
1085 unsigned long deadline);
1086extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
1087 bool spm_wakeup);
1088extern 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 *));
1091extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,1069extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
1092 unsigned long deadline);1070 unsigned long deadline);
1093extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);1071extern 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
1095extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);1073extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
1096extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,1074extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
1097 const struct ata_port_info * const * ppi, int n_ports);1075 const struct ata_port_info * const * ppi, int n_ports);
1098extern int ata_slave_link_init(struct ata_port *ap);
1099extern void ata_host_get(struct ata_host *host);1076extern void ata_host_get(struct ata_host *host);
1100extern void ata_host_put(struct ata_host *host);1077extern void ata_host_put(struct ata_host *host);
1101extern int ata_host_start(struct ata_host *host);1078extern 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
1117extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd);1094extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd);
1118extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,1095extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
1119 unsigned int cmd, void __user *arg);1096 unsigned int cmd, void __user *arg);
1120extern void ata_sas_port_destroy(struct ata_port *);
1121extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
1122 struct ata_port_info *, struct Scsi_Host *);
1123extern void ata_sas_async_probe(struct ata_port *ap);
1124extern int ata_sas_sync_probe(struct ata_port *ap);
1125extern int ata_sas_port_init(struct ata_port *);
1126extern int ata_sas_port_start(struct ata_port *ap);
1127extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap);
1128extern void ata_sas_tport_delete(struct ata_port *ap);
1129extern void ata_sas_port_stop(struct ata_port *ap);
1130extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
1131extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap);
1132extern int sata_scr_valid(struct ata_link *link);
1133extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
1134extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
1135extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
1136extern bool ata_link_online(struct ata_link *link);1097extern bool ata_link_online(struct ata_link *link);
1137extern bool ata_link_offline(struct ata_link *link);1098extern bool ata_link_offline(struct ata_link *link);
1138#ifdef CONFIG_PM1099#ifdef CONFIG_PM
@@ -1153,9 +1114,6 @@ extern void ata_msleep(struct ata_port *ap, unsigned int msecs); · 14 unmodified lines
1153extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask,1114extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask,
1154 u32 val, unsigned long interval, unsigned long timeout);1115 u32 val, unsigned long interval, unsigned long timeout);
1155extern int atapi_cmd_type(u8 opcode);1116extern int atapi_cmd_type(u8 opcode);
1156extern void ata_tf_to_fis(const struct ata_taskfile *tf,
1157 u8 pmp, int is_cmd, u8 *fis);
1158extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
1159extern unsigned long ata_pack_xfermask(unsigned long pio_mask,1117extern unsigned long ata_pack_xfermask(unsigned long pio_mask,
1160 unsigned long mwdma_mask, unsigned long udma_mask);1118 unsigned long mwdma_mask, unsigned long udma_mask);
1161extern void ata_unpack_xfermask(unsigned long xfer_mask,1119extern 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
1179extern unsigned int ata_do_dev_read_id(struct ata_device *dev,1137extern unsigned int ata_do_dev_read_id(struct ata_device *dev,
1180 struct ata_taskfile *tf, u16 *id);1138 struct ata_taskfile *tf, u16 *id);
1181extern void ata_qc_complete(struct ata_queued_cmd *qc);1139extern void ata_qc_complete(struct ata_queued_cmd *qc);
1182extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active);
1183extern u64 ata_qc_get_active(struct ata_port *ap);1140extern u64 ata_qc_get_active(struct ata_port *ap);
1184extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd);1141extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd);
1185extern int ata_std_bios_param(struct scsi_device *sdev,1142extern 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
1196extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);1153extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
1197extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap);1154extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap);
1198extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q);1155extern 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
1161extern const unsigned long sata_deb_timing_normal[];
1162extern const unsigned long sata_deb_timing_hotplug[];
1163extern const unsigned long sata_deb_timing_long[];
1164
1165static inline const unsigned long *
1166sata_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
1174extern int sata_scr_valid(struct ata_link *link);
1175extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
1176extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
1177extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
1178extern int sata_set_spd(struct ata_link *link);
1179extern 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 *));
1182extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
1183 unsigned long deadline);
1184extern void ata_eh_analyze_ncq_error(struct ata_link *link);
1185#else
1186static inline const unsigned long *
1187sata_ehc_deb_timing(struct ata_eh_context *ehc)
1188{
1189 return NULL;
1190}
1191static inline int sata_scr_valid(struct ata_link *link) { return 0; }
1192static inline int sata_scr_read(struct ata_link *link, int reg, u32 *val)
1193{
1194 return -EOPNOTSUPP;
1195}
1196static inline int sata_scr_write(struct ata_link *link, int reg, u32 val)
1197{
1198 return -EOPNOTSUPP;
1199}
1200static inline int sata_scr_write_flush(struct ata_link *link, int reg, u32 val)
1201{
1202 return -EOPNOTSUPP;
1203}
1204static inline int sata_set_spd(struct ata_link *link) { return -EOPNOTSUPP; }
1205static 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}
1215static inline int sata_link_resume(struct ata_link *link,
1216 const unsigned long *params,
1217 unsigned long deadline)
1218{
1219 return -EOPNOTSUPP;
1220}
1221static inline void ata_eh_analyze_ncq_error(struct ata_link *link) { }
1222#endif
1223extern int sata_link_debounce(struct ata_link *link,
1224 const unsigned long *params, unsigned long deadline);
1225extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
1226 bool spm_wakeup);
1227extern int ata_slave_link_init(struct ata_port *ap);
1228extern void ata_sas_port_destroy(struct ata_port *);
1229extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
1230 struct ata_port_info *, struct Scsi_Host *);
1231extern void ata_sas_async_probe(struct ata_port *ap);
1232extern int ata_sas_sync_probe(struct ata_port *ap);
1233extern int ata_sas_port_init(struct ata_port *);
1234extern int ata_sas_port_start(struct ata_port *ap);
1235extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap);
1236extern void ata_sas_tport_delete(struct ata_port *ap);
1237extern void ata_sas_port_stop(struct ata_port *ap);
1238extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
1239extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap);
1240extern void ata_tf_to_fis(const struct ata_taskfile *tf,
1241 u8 pmp, int is_cmd, u8 *fis);
1242extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
1243extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active);
1199extern bool sata_lpm_ignore_phy_events(struct ata_link *link);1244extern bool sata_lpm_ignore_phy_events(struct ata_link *link);
1245extern int sata_async_notification(struct ata_port *ap);
1200 1246
1201extern int ata_cable_40wire(struct ata_port *ap);1247extern int ata_cable_40wire(struct ata_port *ap);
1202extern int ata_cable_80wire(struct ata_port *ap);1248extern int ata_cable_80wire(struct ata_port *ap);
@@ -1206,12 +1252,6 @@ extern int ata_cable_unknown(struct ata_port *ap); · 3 unmodified lines
1206 1252
1207/* Timing helpers */1253/* Timing helpers */
1208extern unsigned int ata_pio_need_iordy(const struct ata_device *);1254extern unsigned int ata_pio_need_iordy(const struct ata_device *);
1209extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
1210extern int ata_timing_compute(struct ata_device *, unsigned short,
1211 struct ata_timing *, int, int);
1212extern void ata_timing_merge(const struct ata_timing *,
1213 const struct ata_timing *, struct ata_timing *,
1214 unsigned int);
1215extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle);1255extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle);
1216 1256
1217/* PCI */1257/* PCI */
@@ -1295,14 +1335,12 @@ extern void ata_port_wait_eh(struct ata_port *ap); · 77 unmodified lines
1295extern int ata_link_abort(struct ata_link *link);1335extern int ata_link_abort(struct ata_link *link);
1296extern int ata_port_abort(struct ata_port *ap);1336extern int ata_port_abort(struct ata_port *ap);
1297extern int ata_port_freeze(struct ata_port *ap);1337extern int ata_port_freeze(struct ata_port *ap);
1298extern int sata_async_notification(struct ata_port *ap);
1299 1338
1300extern void ata_eh_freeze_port(struct ata_port *ap);1339extern void ata_eh_freeze_port(struct ata_port *ap);
1301extern void ata_eh_thaw_port(struct ata_port *ap);1340extern void ata_eh_thaw_port(struct ata_port *ap);
1302 1341
1303extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);1342extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
1304extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);1343extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
1305extern void ata_eh_analyze_ncq_error(struct ata_link *link);
1306 1344
1307extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,1345extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
1308 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,1346 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
1343 * edge driver's module reference, otherwise the driver can be unloaded1381 * edge driver's module reference, otherwise the driver can be unloaded
1344 * even if the scsi_device is being accessed.1382 * even if the scsi_device is being accessed.
1345 */1383 */
1346#define ATA_BASE_SHT(drv_name) \1384#define __ATA_BASE_SHT(drv_name) \
1347 .module = THIS_MODULE, \1385 .module = THIS_MODULE, \
1348 .name = drv_name, \1386 .name = drv_name, \
1349 .ioctl = ata_scsi_ioctl, \1387 .ioctl = ata_scsi_ioctl, \
@@ -1357,12 +1395,20 @@ extern struct device_attribute *ata_common_sdev_attrs[]; · 7 unmodified lines
1357 .slave_configure = ata_scsi_slave_config, \1395 .slave_configure = ata_scsi_slave_config, \
1358 .slave_destroy = ata_scsi_slave_destroy, \1396 .slave_destroy = ata_scsi_slave_destroy, \
1359 .bios_param = ata_std_bios_param, \1397 .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), \
1361 .sdev_attrs = ata_common_sdev_attrs1402 .sdev_attrs = ata_common_sdev_attrs
1362 1403
1404#ifdef CONFIG_SATA_HOST
1405extern struct device_attribute *ata_ncq_sdev_attrs[];
1406
1363#define ATA_NCQ_SHT(drv_name) \1407#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, \
1365 .change_queue_depth = ata_scsi_change_queue_depth1410 .change_queue_depth = ata_scsi_change_queue_depth
1411#endif
1366 1412
1367/*1413/*
1368 * PMP helpers1414 * PMP helpers
@@ -1635,6 +1681,8 @@ extern struct ata_device *ata_dev_next(struct ata_device *dev, · 266 unmodified lines
1635 */1681 */
1636static inline int ata_ncq_enabled(struct ata_device *dev)1682static inline int ata_ncq_enabled(struct ata_device *dev)
1637{1683{
1684 if (!IS_ENABLED(CONFIG_SATA_HOST))
1685 return 0;
1638 return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF |1686 return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF |
1639 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;1687 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
1640}1688}
@@ -1803,6 +1851,16 @@ static inline int ata_dma_enabled(struct ata_device *adev) · 162 unmodified lines
1803 return (adev->dma_mode == 0xFF ? 0 : 1);1851 return (adev->dma_mode == 0xFF ? 0 : 1);
1804}1852}
1805 1853
1854/**************************************************************************
1855 * PATA timings - drivers/ata/libata-pata-timings.c
1856 */
1857extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
1858extern int ata_timing_compute(struct ata_device *, unsigned short,
1859 struct ata_timing *, int, int);
1860extern void ata_timing_merge(const struct ata_timing *,
1861 const struct ata_timing *, struct ata_timing *,
1862 unsigned int);
1863
1806/**************************************************************************1864/**************************************************************************
1807 * PMP - drivers/ata/libata-pmp.c1865 * PMP - drivers/ata/libata-pmp.c
1808 */1866 */
include/linux/libnvdimm.h+2−0
@@ -37,6 +37,8 @@ enum { · 36 unmodified lines
37 NDD_WORK_PENDING = 4,37 NDD_WORK_PENDING = 4,
38 /* ignore / filter NSLABEL_FLAG_LOCAL for this DIMM, i.e. no aliasing */38 /* ignore / filter NSLABEL_FLAG_LOCAL for this DIMM, i.e. no aliasing */
39 NDD_NOBLK = 5,39 NDD_NOBLK = 5,
40 /* dimm supports namespace labels */
41 NDD_LABELING = 6,
40 42
41 /* need to set a limit somewhere, but yes, this is likely overkill */43 /* need to set a limit somewhere, but yes, this is likely overkill */
42 ND_IOCTL_MAX_BUFLEN = SZ_4M,44 ND_IOCTL_MAX_BUFLEN = SZ_4M,
include/linux/limits.h+2−12
@@ -4,19 +4,8 @@ · 3 unmodified lines
4 4
5#include <uapi/linux/limits.h>5#include <uapi/linux/limits.h>
6#include <linux/types.h>6#include <linux/types.h>
7#include <vdso/limits.h>
7 8
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)
20#define SIZE_MAX (~(size_t)0)9#define SIZE_MAX (~(size_t)0)
21#define PHYS_ADDR_MAX (~(phys_addr_t)0)10#define PHYS_ADDR_MAX (~(phys_addr_t)0)
22 11
@@ -27,6 +16,7 @@ · 4 unmodified lines
27#define S16_MAX ((s16)(U16_MAX >> 1))16#define S16_MAX ((s16)(U16_MAX >> 1))
28#define S16_MIN ((s16)(-S16_MAX - 1))17#define S16_MIN ((s16)(-S16_MAX - 1))
29#define U32_MAX ((u32)~0U)18#define U32_MAX ((u32)~0U)
19#define U32_MIN ((u32)0)
30#define S32_MAX ((s32)(U32_MAX >> 1))20#define S32_MAX ((s32)(U32_MAX >> 1))
31#define S32_MIN ((s32)(-S32_MAX - 1))21#define S32_MIN ((s32)(-S32_MAX - 1))
32#define U64_MAX ((u64)~0ULL)22#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
71 __change_bit(nr, addr);71 __change_bit(nr, addr);
72}72}
73 73
74static inline int linkmode_test_bit(int nr, volatile unsigned long *addr)74static inline int linkmode_test_bit(int nr, const volatile unsigned long *addr)
75{75{
76 return test_bit(nr, addr);76 return test_bit(nr, addr);
77}77}
@@ -88,4 +88,10 @@ static inline int linkmode_subset(const unsigned long *src1, · 10 unmodified lines
88 return bitmap_subset(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);88 return bitmap_subset(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);
89}89}
90 90
91void linkmode_resolve_pause(const unsigned long *local_adv,
92 const unsigned long *partner_adv,
93 bool *tx_pause, bool *rx_pause);
94
95void linkmode_set_pause(unsigned long *advertisement, bool tx, bool rx);
96
91#endif /* __LINKMODE_H */97#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
989/**989/**
990 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry990 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
991 * @pos: the type * to use as a loop cursor.991 * @pos: the type * to use as a loop cursor.
992 * @n: another &struct hlist_node to use as temporary storage992 * @n: a &struct hlist_node to use as temporary storage
993 * @head: the head for your list.993 * @head: the head for your list.
994 * @member: the name of the hlist_node within the struct.994 * @member: the name of the hlist_node within the struct.
995 */995 */
include/linux/lockdep.h+75−11
@@ -21,6 +21,22 @@ extern int lock_stat; · 20 unmodified lines
21 21
22#include <linux/types.h>22#include <linux/types.h>
23 23
24enum 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
24#ifdef CONFIG_LOCKDEP40#ifdef CONFIG_LOCKDEP
25 41
26#include <linux/linkage.h>42#include <linux/linkage.h>
@@ -111,6 +127,9 @@ struct lock_class { · 84 unmodified lines
111 int name_version;127 int name_version;
112 const char *name;128 const char *name;
113 129
130 short wait_type_inner;
131 short wait_type_outer;
132
114#ifdef CONFIG_LOCK_STAT133#ifdef CONFIG_LOCK_STAT
115 unsigned long contention_point[LOCKSTAT_POINTS];134 unsigned long contention_point[LOCKSTAT_POINTS];
116 unsigned long contending_point[LOCKSTAT_POINTS];135 unsigned long contending_point[LOCKSTAT_POINTS];
@@ -158,6 +177,8 @@ struct lockdep_map { · 41 unmodified lines
158 struct lock_class_key *key;177 struct lock_class_key *key;
159 struct lock_class *class_cache[NR_LOCKDEP_CACHING_CLASSES];178 struct lock_class *class_cache[NR_LOCKDEP_CACHING_CLASSES];
160 const char *name;179 const char *name;
180 short wait_type_outer; /* can be taken in this context */
181 short wait_type_inner; /* presents this context */
161#ifdef CONFIG_LOCK_STAT182#ifdef CONFIG_LOCK_STAT
162 int cpu;183 int cpu;
163 unsigned long ip;184 unsigned long ip;
@@ -299,8 +320,21 @@ extern void lockdep_unregister_key(struct lock_class_key *key); · 135 unmodified lines
299 * to lockdep:320 * to lockdep:
300 */321 */
301 322
302extern void lockdep_init_map(struct lockdep_map *lock, const char *name,323extern void lockdep_init_map_waits(struct lockdep_map *lock, const char *name,
303 struct lock_class_key *key, int subclass);324 struct lock_class_key *key, int subclass, short inner, short outer);
325
326static inline void
327lockdep_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
333static 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}
304 338
305/*339/*
306 * Reinitialize a lock key - for cases where there is special locking or340 * 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
308 * of dependencies wrong: they are either too broad (they need a class-split)342 * of dependencies wrong: they are either too broad (they need a class-split)
309 * or they are too narrow (they suffer from a false class-split):343 * or they are too narrow (they suffer from a false class-split):
310 */344 */
311#define lockdep_set_class(lock, key) \345#define lockdep_set_class(lock, key) \
312 lockdep_init_map(&(lock)->dep_map, #key, key, 0)346 lockdep_init_map_waits(&(lock)->dep_map, #key, key, 0, \
313#define lockdep_set_class_and_name(lock, key, name) \347 (lock)->dep_map.wait_type_inner, \
314 lockdep_init_map(&(lock)->dep_map, name, key, 0)348 (lock)->dep_map.wait_type_outer)
315#define lockdep_set_class_and_subclass(lock, key, sub) \349
316 lockdep_init_map(&(lock)->dep_map, #key, key, sub)350#define lockdep_set_class_and_name(lock, key, name) \
317#define lockdep_set_subclass(lock, sub) \351 lockdep_init_map_waits(&(lock)->dep_map, name, key, 0, \
318 lockdep_init_map(&(lock)->dep_map, #lock, \352 (lock)->dep_map.wait_type_inner, \
319 (lock)->dep_map.key, sub)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)
320 364
321#define lockdep_set_novalidate_class(lock) \365#define lockdep_set_novalidate_class(lock) \
322 lockdep_set_class_and_name(lock, &__lockdep_no_validate__, #lock)366 lockdep_set_class_and_name(lock, &__lockdep_no_validate__, #lock)
367
323/*368/*
324 * Compare locking classes369 * Compare locking classes
325 */370 */
@@ -432,6 +477,10 @@ static inline void lockdep_set_selftest_task(struct task_struct *task) · 106 unmodified lines
432# define lock_set_class(l, n, k, s, i) do { } while (0)477# define lock_set_class(l, n, k, s, i) do { } while (0)
433# define lock_set_subclass(l, s, i) do { } while (0)478# define lock_set_subclass(l, s, i) do { } while (0)
434# define lockdep_init() do { } while (0)479# 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)
435# define lockdep_init_map(lock, name, key, sub) \484# define lockdep_init_map(lock, name, key, sub) \
436 do { (void)(name); (void)(key); } while (0)485 do { (void)(name); (void)(key); } while (0)
437# define lockdep_set_class(lock, key) do { (void)(key); } while (0)486# define lockdep_set_class(lock, key) do { (void)(key); } while (0)
@@ -662,6 +711,21 @@ do { \ · 224 unmodified lines
662# define lockdep_assert_in_irq() do { } while (0)711# define lockdep_assert_in_irq() do { } while (0)
663#endif712#endif
664 713
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
665#ifdef CONFIG_LOCKDEP729#ifdef CONFIG_LOCKDEP
666void lockdep_rcu_suspicious(const char *file, const int line, const char *s);730void lockdep_rcu_suspicious(const char *file, const int line, const char *s);
667#else731#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 */
29LSM_HOOK(int, 0, binder_set_context_mgr, struct task_struct *mgr)
30LSM_HOOK(int, 0, binder_transaction, struct task_struct *from,
31 struct task_struct *to)
32LSM_HOOK(int, 0, binder_transfer_binder, struct task_struct *from,
33 struct task_struct *to)
34LSM_HOOK(int, 0, binder_transfer_file, struct task_struct *from,
35 struct task_struct *to, struct file *file)
36LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child,
37 unsigned int mode)
38LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent)
39LSM_HOOK(int, 0, capget, struct task_struct *target, kernel_cap_t *effective,
40 kernel_cap_t *inheritable, kernel_cap_t *permitted)
41LSM_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)
44LSM_HOOK(int, 0, capable, const struct cred *cred, struct user_namespace *ns,
45 int cap, unsigned int opts)
46LSM_HOOK(int, 0, quotactl, int cmds, int type, int id, struct super_block *sb)
47LSM_HOOK(int, 0, quota_on, struct dentry *dentry)
48LSM_HOOK(int, 0, syslog, int type)
49LSM_HOOK(int, 0, settime, const struct timespec64 *ts,
50 const struct timezone *tz)
51LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages)
52LSM_HOOK(int, 0, bprm_set_creds, struct linux_binprm *bprm)
53LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm)
54LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm)
55LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm)
56LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc,
57 struct fs_context *src_sc)
58LSM_HOOK(int, 0, fs_context_parse_param, struct fs_context *fc,
59 struct fs_parameter *param)
60LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb)
61LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb)
62LSM_HOOK(void, LSM_RET_VOID, sb_free_mnt_opts, void *mnt_opts)
63LSM_HOOK(int, 0, sb_eat_lsm_opts, char *orig, void **mnt_opts)
64LSM_HOOK(int, 0, sb_remount, struct super_block *sb, void *mnt_opts)
65LSM_HOOK(int, 0, sb_kern_mount, struct super_block *sb)
66LSM_HOOK(int, 0, sb_show_options, struct seq_file *m, struct super_block *sb)
67LSM_HOOK(int, 0, sb_statfs, struct dentry *dentry)
68LSM_HOOK(int, 0, sb_mount, const char *dev_name, const struct path *path,
69 const char *type, unsigned long flags, void *data)
70LSM_HOOK(int, 0, sb_umount, struct vfsmount *mnt, int flags)
71LSM_HOOK(int, 0, sb_pivotroot, const struct path *old_path,
72 const struct path *new_path)
73LSM_HOOK(int, 0, sb_set_mnt_opts, struct super_block *sb, void *mnt_opts,
74 unsigned long kern_flags, unsigned long *set_kern_flags)
75LSM_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)
78LSM_HOOK(int, 0, sb_add_mnt_opt, const char *option, const char *val,
79 int len, void **mnt_opts)
80LSM_HOOK(int, 0, move_mount, const struct path *from_path,
81 const struct path *to_path)
82LSM_HOOK(int, 0, dentry_init_security, struct dentry *dentry,
83 int mode, const struct qstr *name, void **ctx, u32 *ctxlen)
84LSM_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
88LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry)
89LSM_HOOK(int, 0, path_mkdir, const struct path *dir, struct dentry *dentry,
90 umode_t mode)
91LSM_HOOK(int, 0, path_rmdir, const struct path *dir, struct dentry *dentry)
92LSM_HOOK(int, 0, path_mknod, const struct path *dir, struct dentry *dentry,
93 umode_t mode, unsigned int dev)
94LSM_HOOK(int, 0, path_truncate, const struct path *path)
95LSM_HOOK(int, 0, path_symlink, const struct path *dir, struct dentry *dentry,
96 const char *old_name)
97LSM_HOOK(int, 0, path_link, struct dentry *old_dentry,
98 const struct path *new_dir, struct dentry *new_dentry)
99LSM_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)
102LSM_HOOK(int, 0, path_chmod, const struct path *path, umode_t mode)
103LSM_HOOK(int, 0, path_chown, const struct path *path, kuid_t uid, kgid_t gid)
104LSM_HOOK(int, 0, path_chroot, const struct path *path)
105#endif /* CONFIG_SECURITY_PATH */
106
107/* Needed for inode based security check */
108LSM_HOOK(int, 0, path_notify, const struct path *path, u64 mask,
109 unsigned int obj_type)
110LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode)
111LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode)
112LSM_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)
115LSM_HOOK(int, 0, inode_create, struct inode *dir, struct dentry *dentry,
116 umode_t mode)
117LSM_HOOK(int, 0, inode_link, struct dentry *old_dentry, struct inode *dir,
118 struct dentry *new_dentry)
119LSM_HOOK(int, 0, inode_unlink, struct inode *dir, struct dentry *dentry)
120LSM_HOOK(int, 0, inode_symlink, struct inode *dir, struct dentry *dentry,
121 const char *old_name)
122LSM_HOOK(int, 0, inode_mkdir, struct inode *dir, struct dentry *dentry,
123 umode_t mode)
124LSM_HOOK(int, 0, inode_rmdir, struct inode *dir, struct dentry *dentry)
125LSM_HOOK(int, 0, inode_mknod, struct inode *dir, struct dentry *dentry,
126 umode_t mode, dev_t dev)
127LSM_HOOK(int, 0, inode_rename, struct inode *old_dir, struct dentry *old_dentry,
128 struct inode *new_dir, struct dentry *new_dentry)
129LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry)
130LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode,
131 bool rcu)
132LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask)
133LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr)
134LSM_HOOK(int, 0, inode_getattr, const struct path *path)
135LSM_HOOK(int, 0, inode_setxattr, struct dentry *dentry, const char *name,
136 const void *value, size_t size, int flags)
137LSM_HOOK(void, LSM_RET_VOID, inode_post_setxattr, struct dentry *dentry,
138 const char *name, const void *value, size_t size, int flags)
139LSM_HOOK(int, 0, inode_getxattr, struct dentry *dentry, const char *name)
140LSM_HOOK(int, 0, inode_listxattr, struct dentry *dentry)
141LSM_HOOK(int, 0, inode_removexattr, struct dentry *dentry, const char *name)
142LSM_HOOK(int, 0, inode_need_killpriv, struct dentry *dentry)
143LSM_HOOK(int, 0, inode_killpriv, struct dentry *dentry)
144LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct inode *inode,
145 const char *name, void **buffer, bool alloc)
146LSM_HOOK(int, -EOPNOTSUPP, inode_setsecurity, struct inode *inode,
147 const char *name, const void *value, size_t size, int flags)
148LSM_HOOK(int, 0, inode_listsecurity, struct inode *inode, char *buffer,
149 size_t buffer_size)
150LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid)
151LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new)
152LSM_HOOK(int, 0, inode_copy_up_xattr, const char *name)
153LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir,
154 struct kernfs_node *kn)
155LSM_HOOK(int, 0, file_permission, struct file *file, int mask)
156LSM_HOOK(int, 0, file_alloc_security, struct file *file)
157LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file)
158LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd,
159 unsigned long arg)
160LSM_HOOK(int, 0, mmap_addr, unsigned long addr)
161LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot,
162 unsigned long prot, unsigned long flags)
163LSM_HOOK(int, 0, file_mprotect, struct vm_area_struct *vma,
164 unsigned long reqprot, unsigned long prot)
165LSM_HOOK(int, 0, file_lock, struct file *file, unsigned int cmd)
166LSM_HOOK(int, 0, file_fcntl, struct file *file, unsigned int cmd,
167 unsigned long arg)
168LSM_HOOK(void, LSM_RET_VOID, file_set_fowner, struct file *file)
169LSM_HOOK(int, 0, file_send_sigiotask, struct task_struct *tsk,
170 struct fown_struct *fown, int sig)
171LSM_HOOK(int, 0, file_receive, struct file *file)
172LSM_HOOK(int, 0, file_open, struct file *file)
173LSM_HOOK(int, 0, task_alloc, struct task_struct *task,
174 unsigned long clone_flags)
175LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task)
176LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp)
177LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred)
178LSM_HOOK(int, 0, cred_prepare, struct cred *new, const struct cred *old,
179 gfp_t gfp)
180LSM_HOOK(void, LSM_RET_VOID, cred_transfer, struct cred *new,
181 const struct cred *old)
182LSM_HOOK(void, LSM_RET_VOID, cred_getsecid, const struct cred *c, u32 *secid)
183LSM_HOOK(int, 0, kernel_act_as, struct cred *new, u32 secid)
184LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode)
185LSM_HOOK(int, 0, kernel_module_request, char *kmod_name)
186LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id)
187LSM_HOOK(int, 0, kernel_read_file, struct file *file,
188 enum kernel_read_file_id id)
189LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf,
190 loff_t size, enum kernel_read_file_id id)
191LSM_HOOK(int, 0, task_fix_setuid, struct cred *new, const struct cred *old,
192 int flags)
193LSM_HOOK(int, 0, task_setpgid, struct task_struct *p, pid_t pgid)
194LSM_HOOK(int, 0, task_getpgid, struct task_struct *p)
195LSM_HOOK(int, 0, task_getsid, struct task_struct *p)
196LSM_HOOK(void, LSM_RET_VOID, task_getsecid, struct task_struct *p, u32 *secid)
197LSM_HOOK(int, 0, task_setnice, struct task_struct *p, int nice)
198LSM_HOOK(int, 0, task_setioprio, struct task_struct *p, int ioprio)
199LSM_HOOK(int, 0, task_getioprio, struct task_struct *p)
200LSM_HOOK(int, 0, task_prlimit, const struct cred *cred,
201 const struct cred *tcred, unsigned int flags)
202LSM_HOOK(int, 0, task_setrlimit, struct task_struct *p, unsigned int resource,
203 struct rlimit *new_rlim)
204LSM_HOOK(int, 0, task_setscheduler, struct task_struct *p)
205LSM_HOOK(int, 0, task_getscheduler, struct task_struct *p)
206LSM_HOOK(int, 0, task_movememory, struct task_struct *p)
207LSM_HOOK(int, 0, task_kill, struct task_struct *p, struct kernel_siginfo *info,
208 int sig, const struct cred *cred)
209LSM_HOOK(int, -ENOSYS, task_prctl, int option, unsigned long arg2,
210 unsigned long arg3, unsigned long arg4, unsigned long arg5)
211LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p,
212 struct inode *inode)
213LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag)
214LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp,
215 u32 *secid)
216LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg)
217LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg)
218LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm)
219LSM_HOOK(void, LSM_RET_VOID, msg_queue_free_security,
220 struct kern_ipc_perm *perm)
221LSM_HOOK(int, 0, msg_queue_associate, struct kern_ipc_perm *perm, int msqflg)
222LSM_HOOK(int, 0, msg_queue_msgctl, struct kern_ipc_perm *perm, int cmd)
223LSM_HOOK(int, 0, msg_queue_msgsnd, struct kern_ipc_perm *perm,
224 struct msg_msg *msg, int msqflg)
225LSM_HOOK(int, 0, msg_queue_msgrcv, struct kern_ipc_perm *perm,
226 struct msg_msg *msg, struct task_struct *target, long type, int mode)
227LSM_HOOK(int, 0, shm_alloc_security, struct kern_ipc_perm *perm)
228LSM_HOOK(void, LSM_RET_VOID, shm_free_security, struct kern_ipc_perm *perm)
229LSM_HOOK(int, 0, shm_associate, struct kern_ipc_perm *perm, int shmflg)
230LSM_HOOK(int, 0, shm_shmctl, struct kern_ipc_perm *perm, int cmd)
231LSM_HOOK(int, 0, shm_shmat, struct kern_ipc_perm *perm, char __user *shmaddr,
232 int shmflg)
233LSM_HOOK(int, 0, sem_alloc_security, struct kern_ipc_perm *perm)
234LSM_HOOK(void, LSM_RET_VOID, sem_free_security, struct kern_ipc_perm *perm)
235LSM_HOOK(int, 0, sem_associate, struct kern_ipc_perm *perm, int semflg)
236LSM_HOOK(int, 0, sem_semctl, struct kern_ipc_perm *perm, int cmd)
237LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops,
238 unsigned nsops, int alter)
239LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb)
240LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry,
241 struct inode *inode)
242LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, char *name,
243 char **value)
244LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size)
245LSM_HOOK(int, 0, ismaclabel, const char *name)
246LSM_HOOK(int, 0, secid_to_secctx, u32 secid, char **secdata,
247 u32 *seclen)
248LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid)
249LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen)
250LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode)
251LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen)
252LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen)
253LSM_HOOK(int, 0, inode_getsecctx, struct inode *inode, void **ctx,
254 u32 *ctxlen)
255
256#ifdef CONFIG_SECURITY_NETWORK
257LSM_HOOK(int, 0, unix_stream_connect, struct sock *sock, struct sock *other,
258 struct sock *newsk)
259LSM_HOOK(int, 0, unix_may_send, struct socket *sock, struct socket *other)
260LSM_HOOK(int, 0, socket_create, int family, int type, int protocol, int kern)
261LSM_HOOK(int, 0, socket_post_create, struct socket *sock, int family, int type,
262 int protocol, int kern)
263LSM_HOOK(int, 0, socket_socketpair, struct socket *socka, struct socket *sockb)
264LSM_HOOK(int, 0, socket_bind, struct socket *sock, struct sockaddr *address,
265 int addrlen)
266LSM_HOOK(int, 0, socket_connect, struct socket *sock, struct sockaddr *address,
267 int addrlen)
268LSM_HOOK(int, 0, socket_listen, struct socket *sock, int backlog)
269LSM_HOOK(int, 0, socket_accept, struct socket *sock, struct socket *newsock)
270LSM_HOOK(int, 0, socket_sendmsg, struct socket *sock, struct msghdr *msg,
271 int size)
272LSM_HOOK(int, 0, socket_recvmsg, struct socket *sock, struct msghdr *msg,
273 int size, int flags)
274LSM_HOOK(int, 0, socket_getsockname, struct socket *sock)
275LSM_HOOK(int, 0, socket_getpeername, struct socket *sock)
276LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname)
277LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname)
278LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how)
279LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb)
280LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock,
281 char __user *optval, int __user *optlen, unsigned len)
282LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock,
283 struct sk_buff *skb, u32 *secid)
284LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority)
285LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk)
286LSM_HOOK(void, LSM_RET_VOID, sk_clone_security, const struct sock *sk,
287 struct sock *newsk)
288LSM_HOOK(void, LSM_RET_VOID, sk_getsecid, struct sock *sk, u32 *secid)
289LSM_HOOK(void, LSM_RET_VOID, sock_graft, struct sock *sk, struct socket *parent)
290LSM_HOOK(int, 0, inet_conn_request, struct sock *sk, struct sk_buff *skb,
291 struct request_sock *req)
292LSM_HOOK(void, LSM_RET_VOID, inet_csk_clone, struct sock *newsk,
293 const struct request_sock *req)
294LSM_HOOK(void, LSM_RET_VOID, inet_conn_established, struct sock *sk,
295 struct sk_buff *skb)
296LSM_HOOK(int, 0, secmark_relabel_packet, u32 secid)
297LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void)
298LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void)
299LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req,
300 struct flowi *fl)
301LSM_HOOK(int, 0, tun_dev_alloc_security, void **security)
302LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security)
303LSM_HOOK(int, 0, tun_dev_create, void)
304LSM_HOOK(int, 0, tun_dev_attach_queue, void *security)
305LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security)
306LSM_HOOK(int, 0, tun_dev_open, void *security)
307LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_endpoint *ep,
308 struct sk_buff *skb)
309LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname,
310 struct sockaddr *address, int addrlen)
311LSM_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
316LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey)
317LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name,
318 u8 port_num)
319LSM_HOOK(int, 0, ib_alloc_security, void **sec)
320LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec)
321#endif /* CONFIG_SECURITY_INFINIBAND */
322
323#ifdef CONFIG_SECURITY_NETWORK_XFRM
324LSM_HOOK(int, 0, xfrm_policy_alloc_security, struct xfrm_sec_ctx **ctxp,
325 struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp)
326LSM_HOOK(int, 0, xfrm_policy_clone_security, struct xfrm_sec_ctx *old_ctx,
327 struct xfrm_sec_ctx **new_ctx)
328LSM_HOOK(void, LSM_RET_VOID, xfrm_policy_free_security,
329 struct xfrm_sec_ctx *ctx)
330LSM_HOOK(int, 0, xfrm_policy_delete_security, struct xfrm_sec_ctx *ctx)
331LSM_HOOK(int, 0, xfrm_state_alloc, struct xfrm_state *x,
332 struct xfrm_user_sec_ctx *sec_ctx)
333LSM_HOOK(int, 0, xfrm_state_alloc_acquire, struct xfrm_state *x,
334 struct xfrm_sec_ctx *polsec, u32 secid)
335LSM_HOOK(void, LSM_RET_VOID, xfrm_state_free_security, struct xfrm_state *x)
336LSM_HOOK(int, 0, xfrm_state_delete_security, struct xfrm_state *x)
337LSM_HOOK(int, 0, xfrm_policy_lookup, struct xfrm_sec_ctx *ctx, u32 fl_secid,
338 u8 dir)
339LSM_HOOK(int, 1, xfrm_state_pol_flow_match, struct xfrm_state *x,
340 struct xfrm_policy *xp, const struct flowi *fl)
341LSM_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
347LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred,
348 unsigned long flags)
349LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key)
350LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred,
351 unsigned perm)
352LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **_buffer)
353#endif /* CONFIG_KEYS */
354
355#ifdef CONFIG_AUDIT
356LSM_HOOK(int, 0, audit_rule_init, u32 field, u32 op, char *rulestr,
357 void **lsmrule)
358LSM_HOOK(int, 0, audit_rule_known, struct audit_krule *krule)
359LSM_HOOK(int, 0, audit_rule_match, u32 secid, u32 field, u32 op, void *lsmrule)
360LSM_HOOK(void, LSM_RET_VOID, audit_rule_free, void *lsmrule)
361#endif /* CONFIG_AUDIT */
362
363#ifdef CONFIG_BPF_SYSCALL
364LSM_HOOK(int, 0, bpf, int cmd, union bpf_attr *attr, unsigned int size)
365LSM_HOOK(int, 0, bpf_map, struct bpf_map *map, fmode_t fmode)
366LSM_HOOK(int, 0, bpf_prog, struct bpf_prog *prog)
367LSM_HOOK(int, 0, bpf_map_alloc_security, struct bpf_map *map)
368LSM_HOOK(void, LSM_RET_VOID, bpf_map_free_security, struct bpf_map *map)
369LSM_HOOK(int, 0, bpf_prog_alloc_security, struct bpf_prog_aux *aux)
370LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux)
371#endif /* CONFIG_BPF_SYSCALL */
372
373LSM_HOOK(int, 0, locked_down, enum lockdown_reason what)
374
375#ifdef CONFIG_PERF_EVENTS
376LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type)
377LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event)
378LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event)
379LSM_HOOK(int, 0, perf_event_read, struct perf_event *event)
380LSM_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
103 * @sb_free_security:103 * @sb_free_security:
104 * Deallocate and clear the sb->s_security field.104 * Deallocate and clear the sb->s_security field.
105 * @sb contains the super_block structure to be modified.105 * @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.
106 * @sb_statfs:110 * @sb_statfs:
107 * Check permission before obtaining filesystem statistics for the @mnt111 * Check permission before obtaining filesystem statistics for the @mnt
108 * mountpoint.112 * mountpoint.
@@ -136,6 +140,10 @@ · 27 unmodified lines
136 * @sb superblock being remounted140 * @sb superblock being remounted
137 * @data contains the filesystem-specific data.141 * @data contains the filesystem-specific data.
138 * Return 0 if permission is granted.142 * 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.
139 * @sb_umount:147 * @sb_umount:
140 * Check permission before the @mnt file system is unmounted.148 * Check permission before the @mnt file system is unmounted.
141 * @mnt contains the mounted file system.149 * @mnt contains the mounted file system.
@@ -155,6 +163,8 @@ · 13 unmodified lines
155 * Copy all security options from a given superblock to another163 * Copy all security options from a given superblock to another
156 * @oldsb old superblock which contain information to clone164 * @oldsb old superblock which contain information to clone
157 * @newsb new superblock which needs filled in165 * @newsb new superblock which needs filled in
166 * @sb_add_mnt_opt:
167 * Add one mount @option to @mnt_opts.
158 * @sb_parse_opts_str:168 * @sb_parse_opts_str:
159 * Parse a string of security data filling in the opts structure169 * Parse a string of security data filling in the opts structure
160 * @options string containing all mount options known by the LSM170 * @options string containing all mount options known by the LSM
@@ -451,6 +461,12 @@ · 290 unmodified lines
451 * security module does not know about attribute or a negative error code461 * security module does not know about attribute or a negative error code
452 * to abort the copy up. Note that the caller is responsible for reading462 * to abort the copy up. Note that the caller is responsible for reading
453 * and writing the xattrs as this hook is merely a filter.463 * 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.
454 *470 *
455 * Security hooks for kernfs node operations471 * Security hooks for kernfs node operations
456 *472 *
@@ -1113,6 +1129,7 @@ · 656 unmodified lines
1113 * In case of failure, @secid will be set to zero.1129 * In case of failure, @secid will be set to zero.
1114 *1130 *
1115 * Security hooks for individual messages held in System V IPC message queues1131 * Security hooks for individual messages held in System V IPC message queues
1132 *
1116 * @msg_msg_alloc_security:1133 * @msg_msg_alloc_security:
1117 * Allocate and attach a security structure to the msg->security field.1134 * Allocate and attach a security structure to the msg->security field.
1118 * The security field is initialized to NULL when the structure is first1135 * The security field is initialized to NULL when the structure is first
@@ -1302,6 +1319,10 @@ · 183 unmodified lines
1302 * @cap contains the capability <include/linux/capability.h>.1319 * @cap contains the capability <include/linux/capability.h>.
1303 * @opts contains options for the capable check <include/linux/security.h>1320 * @opts contains options for the capable check <include/linux/security.h>
1304 * Return 0 if the capability is granted for @tsk.1321 * 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.
1305 * @syslog:1326 * @syslog:
1306 * Check permission before accessing the kernel message ring or changing1327 * Check permission before accessing the kernel message ring or changing
1307 * logging to the console.1328 * logging to the console.
@@ -1449,632 +1470,35 @@ · 141 unmodified lines
1449 * @bpf_prog_free_security:1470 * @bpf_prog_free_security:
1450 * Clean up the security information stored inside bpf prog.1471 * Clean up the security information stored inside bpf prog.
1451 *1472 *
1452 * @locked_down1473 * @locked_down:
1453 * Determine whether a kernel feature that potentially enables arbitrary1474 * Determine whether a kernel feature that potentially enables arbitrary
1454 * code execution in kernel space should be permitted.1475 * code execution in kernel space should be permitted.
1455 *1476 *
1456 * @what: kernel feature being accessed1477 * @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.
1457 */1491 */
1458union security_list_options {1492union security_list_options {
1459 int (*binder_set_context_mgr)(struct task_struct *mgr);1493 #define LSM_HOOK(RET, DEFAULT, NAME, ...) RET (*NAME)(__VA_ARGS__);
1460 int (*binder_transaction)(struct task_struct *from,1494 #include "lsm_hook_defs.h"
1461 struct task_struct *to);1495 #undef LSM_HOOK
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
1829};1496};
1830 1497
1831struct security_hook_heads {1498struct security_hook_heads {
1832 struct hlist_head binder_set_context_mgr;1499 #define LSM_HOOK(RET, DEFAULT, NAME, ...) struct hlist_head NAME;
1833 struct hlist_head binder_transaction;1500 #include "lsm_hook_defs.h"
1834 struct hlist_head binder_transfer_binder;1501 #undef LSM_HOOK
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
2078} __randomize_layout;1502} __randomize_layout;
2079 1503
2080/*1504/*
@@ -2100,6 +1524,12 @@ struct lsm_blob_sizes { · 19 unmodified lines
2100 int lbs_task;1524 int lbs_task;
2101};1525};
2102 1526
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
2103/*1533/*
2104 * Initializing a security_hook_list structure takes1534 * Initializing a security_hook_list structure takes
2105 * up a lot of space in a source file. This macro takes1535 * 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
3#define _LINUX_MATH64_H3#define _LINUX_MATH64_H
4 4
5#include <linux/types.h>5#include <linux/types.h>
6#include <vdso/math64.h>
6#include <asm/div64.h>7#include <asm/div64.h>
7 8
8#if BITS_PER_LONG == 649#if BITS_PER_LONG == 64
@@ -142,25 +143,6 @@ static inline s64 div_s64(s64 dividend, s32 divisor) · 133 unmodified lines
142 143
143u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder);144u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder);
144 145
145static __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
164#ifndef mul_u32_u32146#ifndef mul_u32_u32
165/*147/*
166 * Many a GCC version messes this up and generates a 64x64 mult :-(148 * 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
13struct mdio_xpcs_args {
14 __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
15 struct mii_bus *bus;
16 int addr;
17};
18
19struct 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)
33struct mdio_xpcs_ops *mdio_xpcs_get_ops(void);
34#else
35static 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
316 316
317int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);317int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
318int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);318int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
319int __mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum,
320 u16 mask, u16 set);
319 321
320int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);322int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
321int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum);323int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum);
322int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);324int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
323int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val);325int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val);
326int mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask,
327 u16 set);
324 328
325int mdiobus_register_device(struct mdio_device *mdiodev);329int mdiobus_register_device(struct mdio_device *mdiodev);
326int mdiobus_unregister_device(struct mdio_device *mdiodev);330int 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
348 348
349phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align,349phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align,
350 phys_addr_t start, phys_addr_t end);350 phys_addr_t start, phys_addr_t end);
351phys_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);
351phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);354phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
352 355
353static inline phys_addr_t memblock_phys_alloc(phys_addr_t size,356static 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
695void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,695void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,
696 int val);696 int val);
697void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val);697void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val);
698void mod_memcg_obj_state(void *p, int idx, int val);
698 699
699static inline void mod_lruvec_state(struct lruvec *lruvec,700static inline void mod_lruvec_state(struct lruvec *lruvec,
700 enum node_stat_item idx, int val)701 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
1123 __mod_node_page_state(page_pgdat(page), idx, val);1124 __mod_node_page_state(page_pgdat(page), idx, val);
1124}1125}
1125 1126
1127static inline void mod_memcg_obj_state(void *p, int idx, int val)
1128{
1129}
1130
1126static inline1131static inline
1127unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,1132unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
1128 gfp_t gfp_mask,1133 gfp_t gfp_mask,
@@ -1362,12 +1367,11 @@ struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep); · 233 unmodified lines
1362void memcg_kmem_put_cache(struct kmem_cache *cachep);1367void memcg_kmem_put_cache(struct kmem_cache *cachep);
1363 1368
1364#ifdef CONFIG_MEMCG_KMEM1369#ifdef CONFIG_MEMCG_KMEM
1365int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order);1370int __memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp,
1366void __memcg_kmem_uncharge(struct page *page, int order);1371 unsigned int nr_pages);
1367int __memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order,1372void __memcg_kmem_uncharge(struct mem_cgroup *memcg, unsigned int nr_pages);
1368 struct mem_cgroup *memcg);1373int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order);
1369void __memcg_kmem_uncharge_memcg(struct mem_cgroup *memcg,1374void __memcg_kmem_uncharge_page(struct page *page, int order);
1370 unsigned int nr_pages);
1371 1375
1372extern struct static_key_false memcg_kmem_enabled_key;1376extern struct static_key_false memcg_kmem_enabled_key;
1373extern struct workqueue_struct *memcg_kmem_cache_wq;1377extern struct workqueue_struct *memcg_kmem_cache_wq;
@@ -1389,32 +1393,33 @@ static inline bool memcg_kmem_enabled(void) · 15 unmodified lines
1389 return static_branch_unlikely(&memcg_kmem_enabled_key);1393 return static_branch_unlikely(&memcg_kmem_enabled_key);
1390}1394}
1391 1395
1392static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order)1396static inline int memcg_kmem_charge_page(struct page *page, gfp_t gfp,
1397 int order)
1393{1398{
1394 if (memcg_kmem_enabled())1399 if (memcg_kmem_enabled())
1395 return __memcg_kmem_charge(page, gfp, order);1400 return __memcg_kmem_charge_page(page, gfp, order);
1396 return 0;1401 return 0;
1397}1402}
1398 1403
1399static inline void memcg_kmem_uncharge(struct page *page, int order)1404static inline void memcg_kmem_uncharge_page(struct page *page, int order)
1400{1405{
1401 if (memcg_kmem_enabled())1406 if (memcg_kmem_enabled())
1402 __memcg_kmem_uncharge(page, order);1407 __memcg_kmem_uncharge_page(page, order);
1403}1408}
1404 1409
1405static inline int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp,1410static inline int memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp,
1406 int order, struct mem_cgroup *memcg)1411 unsigned int nr_pages)
1407{1412{
1408 if (memcg_kmem_enabled())1413 if (memcg_kmem_enabled())
1409 return __memcg_kmem_charge_memcg(page, gfp, order, memcg);1414 return __memcg_kmem_charge(memcg, gfp, nr_pages);
1410 return 0;1415 return 0;
1411}1416}
1412 1417
1413static inline void memcg_kmem_uncharge_memcg(struct page *page, int order,1418static inline void memcg_kmem_uncharge(struct mem_cgroup *memcg,
1414 struct mem_cgroup *memcg)1419 unsigned int nr_pages)
1415{1420{
1416 if (memcg_kmem_enabled())1421 if (memcg_kmem_enabled())
1417 __memcg_kmem_uncharge_memcg(memcg, 1 << order);1422 __memcg_kmem_uncharge(memcg, nr_pages);
1418}1423}
1419 1424
1420/*1425/*
@@ -1427,23 +1432,27 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) · 6 unmodified lines
1427 return memcg ? memcg->kmemcg_id : -1;1432 return memcg ? memcg->kmemcg_id : -1;
1428}1433}
1429 1434
1435struct mem_cgroup *mem_cgroup_from_obj(void *p);
1436
1430#else1437#else
1431 1438
1432static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order)1439static inline int memcg_kmem_charge_page(struct page *page, gfp_t gfp,
1440 int order)
1433{1441{
1434 return 0;1442 return 0;
1435}1443}
1436 1444
1437static inline void memcg_kmem_uncharge(struct page *page, int order)1445static inline void memcg_kmem_uncharge_page(struct page *page, int order)
1438{1446{
1439}1447}
1440 1448
1441static inline int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order)1449static inline int __memcg_kmem_charge_page(struct page *page, gfp_t gfp,
1450 int order)
1442{1451{
1443 return 0;1452 return 0;
1444}1453}
1445 1454
1446static inline void __memcg_kmem_uncharge(struct page *page, int order)1455static inline void __memcg_kmem_uncharge_page(struct page *page, int order)
1447{1456{
1448}1457}
1449 1458
@@ -1468,6 +1477,11 @@ static inline void memcg_put_cache_ids(void) · 18 unmodified lines
1468{1477{
1469}1478}
1470 1479
1480static inline struct mem_cgroup *mem_cgroup_from_obj(void *p)
1481{
1482 return NULL;
1483}
1484
1471#endif /* CONFIG_MEMCG_KMEM */1485#endif /* CONFIG_MEMCG_KMEM */
1472 1486
1473#endif /* _LINUX_MEMCONTROL_H */1487#endif /* _LINUX_MEMCONTROL_H */
include/linux/memory.h+0−1
@@ -26,7 +26,6 @@ · 25 unmodified lines
26struct memory_block {26struct memory_block {
27 unsigned long start_section_nr;27 unsigned long start_section_nr;
28 unsigned long state; /* serialized by the dev->lock */28 unsigned long state; /* serialized by the dev->lock */
29 int section_count; /* serialized by mem_sysfs_mutex */
30 int online_type; /* for passing data to online routine */29 int online_type; /* for passing data to online routine */
31 int phys_device; /* to which fru does this belong? */30 int phys_device; /* to which fru does this belong? */
32 struct device dev;31 struct device dev;
include/linux/memory_hotplug.h+21−13
@@ -47,20 +47,25 @@ enum { · 46 unmodified lines
47 47
48/* Types for control the zone type of onlined and offlined memory */48/* Types for control the zone type of onlined and offlined memory */
49enum {49enum {
50 MMOP_OFFLINE = -1,50 /* Offline the memory. */
51 MMOP_ONLINE_KEEP,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. */
52 MMOP_ONLINE_KERNEL,55 MMOP_ONLINE_KERNEL,
56 /* Online the memory to ZONE_MOVABLE. */
53 MMOP_ONLINE_MOVABLE,57 MMOP_ONLINE_MOVABLE,
54};58};
55 59
56/*60/*
57 * Restrictions for the memory hotplug:61 * Extended parameters for memory hotplug:
58 * flags: MHP_ flags62 * altmap: alternative allocator for memmap array (optional)
59 * altmap: alternative allocator for memmap array63 * pgprot: page protection flags to apply to newly created page tables
64 * (required)
60 */65 */
61struct mhp_restrictions {66struct mhp_params {
62 unsigned long flags;
63 struct vmem_altmap *altmap;67 struct vmem_altmap *altmap;
68 pgprot_t pgprot;
64};69};
65 70
66/*71/*
@@ -110,10 +115,13 @@ extern int restore_online_page_callback(online_page_callback_t callback); · 43 unmodified lines
110extern int try_online_node(int nid);115extern int try_online_node(int nid);
111 116
112extern int arch_add_memory(int nid, u64 start, u64 size,117extern int arch_add_memory(int nid, u64 start, u64 size,
113 struct mhp_restrictions *restrictions);118 struct mhp_params *params);
114extern u64 max_mem_size;119extern u64 max_mem_size;
115 120
116extern bool memhp_auto_online;121extern int memhp_online_type_from_str(const char *str);
122
123/* Default online_type (MMOP_*) when new memory blocks are added. */
124extern int memhp_default_online_type;
117/* If movable_node boot option specified */125/* If movable_node boot option specified */
118extern bool movable_node_enabled;126extern bool movable_node_enabled;
119static inline bool movable_node_is_enabled(void)127static 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
128 136
129/* reasonably generic interface to expand the physical pages */137/* reasonably generic interface to expand the physical pages */
130extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,138extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
131 struct mhp_restrictions *restrictions);139 struct mhp_params *params);
132 140
133#ifndef CONFIG_ARCH_HAS_ADD_PAGES141#ifndef CONFIG_ARCH_HAS_ADD_PAGES
134static inline int add_pages(int nid, unsigned long start_pfn,142static 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)
136{144{
137 return __add_pages(nid, start_pfn, nr_pages, restrictions);145 return __add_pages(nid, start_pfn, nr_pages, params);
138}146}
139#else /* ARCH_HAS_ADD_PAGES */147#else /* ARCH_HAS_ADD_PAGES */
140int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,148int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
141 struct mhp_restrictions *restrictions);149 struct mhp_params *params);
142#endif /* ARCH_HAS_ADD_PAGES */150#endif /* ARCH_HAS_ADD_PAGES */
143 151
144#ifdef CONFIG_NUMA152#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
173extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);173extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
174 174
175/* Check if a vma is migratable */175/* Check if a vma is migratable */
176static inline bool vma_migratable(struct vm_area_struct *vma)176extern 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}
204 177
205extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long);178extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long);
206extern void mpol_put_task_policy(struct task_struct *);179extern 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
98 * @ref: reference count that pins the devm_memremap_pages() mapping98 * @ref: reference count that pins the devm_memremap_pages() mapping
99 * @internal_ref: internal reference if @ref is not provided by the caller99 * @internal_ref: internal reference if @ref is not provided by the caller
100 * @done: completion for @internal_ref100 * @done: completion for @internal_ref
101 * @dev: host device of the mapping for debug
102 * @data: private data pointer for page_free()
103 * @type: memory type: see MEMORY_* in memory_hotplug.h101 * @type: memory type: see MEMORY_* in memory_hotplug.h
104 * @flags: PGMAP_* flags to specify defailed behavior102 * @flags: PGMAP_* flags to specify defailed behavior
105 * @ops: method table103 * @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.
106 */107 */
107struct dev_pagemap {108struct dev_pagemap {
108 struct vmem_altmap altmap;109 struct vmem_altmap altmap;
@@ -113,6 +114,7 @@ struct dev_pagemap { · 4 unmodified lines
113 enum memory_type type;114 enum memory_type type;
114 unsigned int flags;115 unsigned int flags;
115 const struct dev_pagemap_ops *ops;116 const struct dev_pagemap_ops *ops;
117 void *owner;
116};118};
117 119
118static inline struct vmem_altmap *pgmap_altmap(struct dev_pagemap *pgmap)120static 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
132 134
133unsigned long vmem_altmap_offset(struct vmem_altmap *altmap);135unsigned long vmem_altmap_offset(struct vmem_altmap *altmap);
134void vmem_altmap_free(struct vmem_altmap *altmap, unsigned long nr_pfns);136void vmem_altmap_free(struct vmem_altmap *altmap, unsigned long nr_pfns);
137unsigned long memremap_compat_align(void);
135#else138#else
136static inline void *devm_memremap_pages(struct device *dev,139static inline void *devm_memremap_pages(struct device *dev,
137 struct dev_pagemap *pgmap)140 struct dev_pagemap *pgmap)
@@ -165,6 +168,12 @@ static inline void vmem_altmap_free(struct vmem_altmap *altmap, · 27 unmodified lines
165 unsigned long nr_pfns)168 unsigned long nr_pfns)
166{169{
167}170}
171
172/* when memremap_pages() is disabled all archs can remap a single page */
173static inline unsigned long memremap_compat_align(void)
174{
175 return PAGE_SIZE;
176}
168#endif /* CONFIG_ZONE_DEVICE */177#endif /* CONFIG_ZONE_DEVICE */
169 178
170static inline void put_dev_pagemap(struct dev_pagemap *pgmap)179static 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
172 if (pgmap)181 if (pgmap)
173 percpu_ref_put(pgmap->ref);182 percpu_ref_put(pgmap->ref);
174}183}
184
175#endif /* _LINUX_MEMREMAP_H_ */185#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
35enum iqs62x_ui_sel {
36 IQS62X_UI_PROX,
37 IQS62X_UI_SAR1,
38};
39
40enum 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
54enum 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
83struct iqs62x_event_data {
84 u16 ui_data;
85 u8 als_flags;
86 u8 ir_flags;
87 u8 interval;
88};
89
90struct iqs62x_event_desc {
91 enum iqs62x_event_reg reg;
92 u8 mask;
93 u8 val;
94};
95
96struct 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
127struct 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
137extern 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
620 long variant;620 long variant;
621 const struct regmap_config *regmap_cfg;621 const struct regmap_config *regmap_cfg;
622 const struct regmap_irq_chip *regmap_irq_chip;622 const struct regmap_irq_chip *regmap_irq_chip;
623 void (*pm_pwroff_fn)(void);
624 void (*pm_pwroff_prep_fn)(void);
625};623};
626#endif /* __LINUX_REGULATOR_RK808_H */624#endif /* __LINUX_REGULATOR_RK808_H */
include/linux/mfd/rn5t618.h+26−0
@@ -139,6 +139,17 @@ · 138 unmodified lines
139#define RN5T618_INTPOL 0x9c139#define RN5T618_INTPOL 0x9c
140#define RN5T618_INTEN 0x9d140#define RN5T618_INTEN 0x9d
141#define RN5T618_INTMON 0x9e141#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
142#define RN5T618_PREVINDAC 0xb0153#define RN5T618_PREVINDAC 0xb0
143#define RN5T618_BATDAC 0xb1154#define RN5T618_BATDAC 0xb1
144#define RN5T618_CHGCTL1 0xb3155#define RN5T618_CHGCTL1 0xb3
@@ -242,9 +253,24 @@ enum { · 97 unmodified lines
242 RC5T619,253 RC5T619,
243};254};
244 255
256/* RN5T618 IRQ definitions */
257enum {
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
245struct rn5t618 {267struct rn5t618 {
246 struct regmap *regmap;268 struct regmap *regmap;
269 struct device *dev;
247 long variant;270 long variant;
271
272 int irq;
273 struct regmap_irq_chip_data *irq_data;
248};274};
249 275
250#endif /* __LINUX_MFD_RN5T618_H */276#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
5extern 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
89 89
90struct wm831x_watchdog_pdata {90struct wm831x_watchdog_pdata {
91 enum wm831x_watchdog_action primary, secondary;91 enum wm831x_watchdog_action primary, secondary;
92 int update_gpio;
93 unsigned int software:1;92 unsigned int software:1;
94};93};
95 94
include/linux/mfd/wm8994/pdata.h+1−1
@@ -33,7 +33,7 @@ struct wm8994_ldo_pdata { · 32 unmodified lines
33 * DRC configurations are specified with a label and a set of register33 * DRC configurations are specified with a label and a set of register
34 * values to write (the enable bits will be ignored). At runtime an34 * values to write (the enable bits will be ignored). At runtime an
35 * enumerated control will be presented for each DRC block allowing35 * 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.
37 *37 *
38 * Configurations may be generated by hand or by using the DRC control38 * Configurations may be generated by hand or by using the DRC control
39 * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/39 * 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
19struct mhi_chan;
20struct mhi_event;
21struct mhi_ctxt;
22struct mhi_cmd;
23struct 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 */
37enum 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 */
55enum 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 */
66enum 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 */
80enum 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 */
92struct 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 */
103struct 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 */
118enum 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 */
144enum 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 */
167enum 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 */
182enum 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 */
192enum 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 */
217struct 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 */
249struct 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 */
274struct 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 */
365struct 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 */
452struct 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 */
472struct 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 */
488struct 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 */
504struct 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 */
525int 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 */
532void 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 */
555int __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 */
561void 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 */
568void 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 */
579int 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 */
585int 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 */
592int 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 */
599void 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 */
605void 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 */
613int 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 */
619int 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 */
625enum 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 */
631void 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 */
638int 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 */
644void 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 */
650int 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 */
656void 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 */
663int 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 */
674int 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 */
686int 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 */
697int 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
196 unsigned long npages;196 unsigned long npages;
197 unsigned long start;197 unsigned long start;
198 unsigned long end;198 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;
199};207};
200 208
201int migrate_vma_setup(struct migrate_vma *args);209int 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
354 return result;354 return result;
355}355}
356 356
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 */
365static 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
375/**357/**
376 * mii_lpa_mod_linkmode_adv_sgmii358 * mii_lpa_mod_linkmode_adv_sgmii
377 * @lp_advertising: pointer to destination link mode.359 * @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
535 return lcl_adv;517 return lcl_adv;
536}518}
537 519
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 */
526static 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 */
544static 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
538/**559/**
539 * mii_advertise_flowctrl - get flow control advertisement flags560 * mii_advertise_flowctrl - get flow control advertisement flags
540 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)561 * @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 */
15struct 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 */
27struct 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. */
34static __always_inline
35void 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). */
67static __always_inline
68void 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)). */
78static __always_inline
79void 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 */
98static __always_inline
99void 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)). */
108static __always_inline
109void 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
25#define TEMP_MINOR 131 /* Temperature Sensor */25#define TEMP_MINOR 131 /* Temperature Sensor */
26#define APM_MINOR_DEV 13426#define APM_MINOR_DEV 134
27#define RTC_MINOR 13527#define RTC_MINOR 135
28#define EFI_RTC_MINOR 136 /* EFI Time services */28/*#define EFI_RTC_MINOR 136 was EFI Time services */
29#define VHCI_MINOR 13729#define VHCI_MINOR 137
30#define SUN_OPENPROM_MINOR 13930#define SUN_OPENPROM_MINOR 139
31#define DMAPI_MINOR 140 /* unused */31#define DMAPI_MINOR 140 /* unused */
32#define NVRAM_MINOR 14432#define NVRAM_MINOR 144
33#define SBUS_FLASH_MINOR 152
33#define SGI_MMTIMER 15334#define SGI_MMTIMER 153
35#define PMU_MINOR 154
34#define STORE_QUEUE_MINOR 155 /* unused */36#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
35#define I2O_MINOR 16642#define I2O_MINOR 166
43#define UCTRL_MINOR 174
36#define AGPGART_MINOR 17544#define AGPGART_MINOR 175
45#define TOSH_MINOR_DEV 181
37#define HWRNG_MINOR 18346#define HWRNG_MINOR 183
38#define MICROCODE_MINOR 18447#define MICROCODE_MINOR 184
48#define KEYPAD_MINOR 185
39#define IRNET_MINOR 18749#define IRNET_MINOR 187
40#define D7S_MINOR 19350#define D7S_MINOR 193
41#define VFIO_MINOR 19651#define VFIO_MINOR 196
52#define PXA3XX_GCU_MINOR 197
42#define TUN_MINOR 20053#define TUN_MINOR 200
43#define CUSE_MINOR 20354#define CUSE_MINOR 203
44#define MWAVE_MINOR 219 /* ACP/Mwave Modem */55#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
@@ -49,6 +60,7 @@ · 4 unmodified lines
49#define MISC_MCELOG_MINOR 22760#define MISC_MCELOG_MINOR 227
50#define HPET_MINOR 22861#define HPET_MINOR 228
51#define FUSE_MINOR 22962#define FUSE_MINOR 229
63#define SNAPSHOT_MINOR 231
52#define KVM_MINOR 23264#define KVM_MINOR 232
53#define BTRFS_MINOR 23465#define BTRFS_MINOR 234
54#define AUTOFS_MINOR 23566#define AUTOFS_MINOR 235
include/linux/mlx5/device.h+6−0
@@ -1211,6 +1211,12 @@ enum mlx5_qcam_feature_groups { · 1210 unmodified lines
1211#define MLX5_CAP_FLOWTABLE_RDMA_RX_MAX(mdev, cap) \1211#define MLX5_CAP_FLOWTABLE_RDMA_RX_MAX(mdev, cap) \
1212 MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive_rdma.cap)1212 MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive_rdma.cap)
1213 1213
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
1214#define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \1220#define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \
1215 MLX5_GET(flow_table_eswitch_cap, \1221 MLX5_GET(flow_table_eswitch_cap, \
1216 mdev->caps.hca_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)1222 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
213 MLX5_PORT_DOWN = 2,213 MLX5_PORT_DOWN = 2,
214};214};
215 215
216struct 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
233struct mlx5_cmd_first {216struct mlx5_cmd_first {
234 __be32 data[4];217 __be32 data[4];
235};218};
@@ -518,9 +501,11 @@ struct mlx5_rate_limit { · 282 unmodified lines
518};501};
519 502
520struct mlx5_rl_entry {503struct mlx5_rl_entry {
521 struct mlx5_rate_limit rl;504 u8 rl_raw[MLX5_ST_SZ_BYTES(set_pp_rate_limit_context)];
522 u16 index;505 u16 index;
523 u16 refcount;506 u64 refcount;
507 u16 uid;
508 u8 dedicated : 1;
524};509};
525 510
526struct mlx5_rl_table {511struct mlx5_rl_table {
@@ -573,10 +558,6 @@ struct mlx5_priv { · 46 unmodified lines
573 /* end: alloc staff */558 /* end: alloc staff */
574 struct dentry *dbg_root;559 struct dentry *dbg_root;
575 560
576 /* protect mkey key part */
577 spinlock_t mkey_lock;
578 u8 mkey_key;
579
580 struct list_head dev_list;561 struct list_head dev_list;
581 struct list_head ctx_list;562 struct list_head ctx_list;
582 spinlock_t ctx_lock;563 spinlock_t ctx_lock;
@@ -722,6 +703,7 @@ struct mlx5_core_dev { · 139 unmodified lines
722 struct mlx5_clock clock;703 struct mlx5_clock clock;
723 struct mlx5_ib_clock_info *clock_info;704 struct mlx5_ib_clock_info *clock_info;
724 struct mlx5_fw_tracer *tracer;705 struct mlx5_fw_tracer *tracer;
706 struct mlx5_rsc_dump *rsc_dump;
725 u32 vsc_addr;707 u32 vsc_addr;
726 struct mlx5_hv_vhca *hv_vhca;708 struct mlx5_hv_vhca *hv_vhca;
727};709};
@@ -945,12 +927,6 @@ struct mlx5_cmd_mailbox *mlx5_alloc_cmd_mailbox_chain(struct mlx5_core_dev *dev, · 217 unmodified lines
945 gfp_t flags, int npages);927 gfp_t flags, int npages);
946void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev,928void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev,
947 struct mlx5_cmd_mailbox *head);929 struct mlx5_cmd_mailbox *head);
948int 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);
954int mlx5_core_create_mkey(struct mlx5_core_dev *dev,930int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
955 struct mlx5_core_mkey *mkey,931 struct mlx5_core_mkey *mkey,
956 u32 *in, int inlen);932 u32 *in, int inlen);
@@ -1007,6 +983,9 @@ int mlx5_rl_add_rate(struct mlx5_core_dev *dev, u16 *index, · 50 unmodified lines
1007 struct mlx5_rate_limit *rl);983 struct mlx5_rate_limit *rl);
1008void mlx5_rl_remove_rate(struct mlx5_core_dev *dev, struct mlx5_rate_limit *rl);984void mlx5_rl_remove_rate(struct mlx5_core_dev *dev, struct mlx5_rate_limit *rl);
1009bool mlx5_rl_is_in_range(struct mlx5_core_dev *dev, u32 rate);985bool mlx5_rl_is_in_range(struct mlx5_core_dev *dev, u32 rate);
986int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid,
987 bool dedicated_entry, u16 *index);
988void mlx5_rl_remove_rate_raw(struct mlx5_core_dev *dev, u16 index);
1010bool mlx5_rl_are_equal(struct mlx5_rate_limit *rl_0,989bool mlx5_rl_are_equal(struct mlx5_rate_limit *rl_0,
1011 struct mlx5_rate_limit *rl_1);990 struct mlx5_rate_limit *rl_1);
1012int mlx5_alloc_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg,991int 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
70enum devlink_eswitch_encap_mode70enum devlink_eswitch_encap_mode
71mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev);71mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev);
72 72
73bool mlx5_eswitch_reg_c1_loopback_enabled(const struct mlx5_eswitch *esw);
73bool mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw);74bool mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw);
74u32 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
91static inline u32 mlx5_eswitch_get_vport_metadata_mask(void)
92{
93 return GENMASK(31, 32 - ESW_SOURCE_PORT_METADATA_BITS);
94}
95
96u32 mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw,
75 u16 vport_num);97 u16 vport_num);
76u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw);98u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw);
77#else /* CONFIG_MLX5_ESWITCH */99#else /* CONFIG_MLX5_ESWITCH */
@@ -87,6 +109,12 @@ mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev) · 9 unmodified lines
87 return DEVLINK_ESWITCH_ENCAP_MODE_NONE;109 return DEVLINK_ESWITCH_ENCAP_MODE_NONE;
88}110}
89 111
112static inline bool
113mlx5_eswitch_reg_c1_loopback_enabled(const struct mlx5_eswitch *esw)
114{
115 return false;
116};
117
90static inline bool118static inline bool
91mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw)119mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw)
92{120{
@@ -94,11 +122,17 @@ mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw) · 1 unmodified line
94};122};
95 123
96static inline u32124static inline u32
97mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw,125mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw,
98 int vport_num)126 int vport_num)
99{127{
100 return 0;128 return 0;
101};129};
130
131static inline u32
132mlx5_eswitch_get_vport_metadata_mask(void)
133{
134 return 0;
135}
102#endif /* CONFIG_MLX5_ESWITCH */136#endif /* CONFIG_MLX5_ESWITCH */
103 137
104#endif138#endif
include/linux/mlx5/fs.h+2−0
@@ -77,6 +77,7 @@ enum mlx5_flow_namespace_type { · 76 unmodified lines
77 MLX5_FLOW_NAMESPACE_EGRESS,77 MLX5_FLOW_NAMESPACE_EGRESS,
78 MLX5_FLOW_NAMESPACE_RDMA_RX,78 MLX5_FLOW_NAMESPACE_RDMA_RX,
79 MLX5_FLOW_NAMESPACE_RDMA_RX_KERNEL,79 MLX5_FLOW_NAMESPACE_RDMA_RX_KERNEL,
80 MLX5_FLOW_NAMESPACE_RDMA_TX,
80};81};
81 82
82enum {83enum {
@@ -84,6 +85,7 @@ enum { · 1 unmodified line
84 FDB_TC_OFFLOAD,85 FDB_TC_OFFLOAD,
85 FDB_FT_OFFLOAD,86 FDB_FT_OFFLOAD,
86 FDB_SLOW_PATH,87 FDB_SLOW_PATH,
88 FDB_PER_VPORT,
87};89};
88 90
89struct mlx5_pkt_reformat;91struct 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
414 u8 reserved_at_16[0x1];414 u8 reserved_at_16[0x1];
415 u8 table_miss_action_domain[0x1];415 u8 table_miss_action_domain[0x1];
416 u8 termination_table[0x1];416 u8 termination_table[0x1];
417 u8 reserved_at_19[0x7];417 u8 reformat_and_fwd_to_table[0x1];
418 u8 reserved_at_20[0x2];418 u8 reserved_at_1a[0x6];
419 u8 termination_table_raw_traffic[0x1];
420 u8 reserved_at_21[0x1];
419 u8 log_max_ft_size[0x6];421 u8 log_max_ft_size[0x6];
420 u8 log_max_modify_header_context[0x8];422 u8 log_max_modify_header_context[0x8];
421 u8 max_modify_header_actions[0x8];423 u8 max_modify_header_actions[0x8];
@@ -707,7 +709,7 @@ struct mlx5_ifc_flow_table_nic_cap_bits { · 285 unmodified lines
707 709
708 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit;710 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit;
709 711
710 u8 reserved_at_a00[0x200];712 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit_rdma;
711 713
712 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit_sniffer;714 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_transmit_sniffer;
713 715
@@ -741,7 +743,7 @@ struct mlx5_ifc_flow_table_eswitch_cap_bits { · 27 unmodified lines
741 u8 flow_source[0x1];743 u8 flow_source[0x1];
742 u8 reserved_at_18[0x2];744 u8 reserved_at_18[0x2];
743 u8 multi_fdb_encap[0x1];745 u8 multi_fdb_encap[0x1];
744 u8 reserved_at_1b[0x1];746 u8 egress_acl_forward_to_vport[0x1];
745 u8 fdb_multi_path_to_table[0x1];747 u8 fdb_multi_path_to_table[0x1];
746 u8 reserved_at_1d[0x3];748 u8 reserved_at_1d[0x3];
747 749
@@ -813,7 +815,9 @@ struct mlx5_ifc_qos_cap_bits { · 65 unmodified lines
813 u8 reserved_at_4[0x1];815 u8 reserved_at_4[0x1];
814 u8 packet_pacing_burst_bound[0x1];816 u8 packet_pacing_burst_bound[0x1];
815 u8 packet_pacing_typical_size[0x1];817 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];
817 821
818 u8 reserved_at_20[0x20];822 u8 reserved_at_20[0x20];
819 823
@@ -875,7 +879,11 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits { · 55 unmodified lines
875 u8 swp_csum[0x1];879 u8 swp_csum[0x1];
876 u8 swp_lso[0x1];880 u8 swp_lso[0x1];
877 u8 cqe_checksum_full[0x1];881 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];
879 u8 tunnel_stateless_ip_over_ip[0x1];887 u8 tunnel_stateless_ip_over_ip[0x1];
880 u8 reserved_at_2a[0x6];888 u8 reserved_at_2a[0x6];
881 u8 max_vxlan_udp_ports[0x8];889 u8 max_vxlan_udp_ports[0x8];
@@ -8265,9 +8273,20 @@ struct mlx5_ifc_set_pp_rate_limit_out_bits { · 7383 unmodified lines
8265 u8 reserved_at_40[0x40];8273 u8 reserved_at_40[0x40];
8266};8274};
8267 8275
8276struct 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
8268struct mlx5_ifc_set_pp_rate_limit_in_bits {8287struct mlx5_ifc_set_pp_rate_limit_in_bits {
8269 u8 opcode[0x10];8288 u8 opcode[0x10];
8270 u8 reserved_at_10[0x10];8289 u8 uid[0x10];
8271 8290
8272 u8 reserved_at_20[0x10];8291 u8 reserved_at_20[0x10];
8273 u8 op_mod[0x10];8292 u8 op_mod[0x10];
@@ -8277,14 +8296,7 @@ struct mlx5_ifc_set_pp_rate_limit_in_bits { · 3 unmodified lines
8277 8296
8278 u8 reserved_at_60[0x20];8297 u8 reserved_at_60[0x20];
8279 8298
8280 u8 rate_limit[0x20];8299 struct mlx5_ifc_set_pp_rate_limit_context_bits ctx;
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];
8288};8300};
8289 8301
8290struct mlx5_ifc_access_register_out_bits {8302struct mlx5_ifc_access_register_out_bits {
@@ -8420,7 +8432,8 @@ struct mlx5_ifc_ptys_reg_bits { · 129 unmodified lines
8420 u8 proto_mask[0x3];8432 u8 proto_mask[0x3];
8421 8433
8422 u8 an_status[0x4];8434 u8 an_status[0x4];
8423 u8 reserved_at_24[0x1c];8435 u8 reserved_at_24[0xc];
8436 u8 data_rate_oper[0x10];
8424 8437
8425 u8 ext_eth_proto_capability[0x20];8438 u8 ext_eth_proto_capability[0x20];
8426 8439
@@ -10486,7 +10499,8 @@ enum { · 2059 unmodified lines
10486};10499};
10487 10500
10488enum {10501enum {
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,
10490};10504};
10491 10505
10492struct mlx5_ifc_tls_static_params_bits {10506struct 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
608struct mlx5_ifc_tls_resp_bits {608struct mlx5_ifc_tls_resp_bits {
609 u8 syndrome[0x20];609 u8 syndrome[0x20];
610 u8 stream_id[0x20];610 u8 stream_id[0x20];
611 u8 reserverd[0x40];611 u8 reserved[0x40];
612};612};
613 613
614#define MLX5_TLS_COMMAND_SIZE (0x100)614#define MLX5_TLS_COMMAND_SIZE (0x100)
include/linux/mm.h+266−47
@@ -27,6 +27,7 @@ · 26 unmodified lines
27#include <linux/memremap.h>27#include <linux/memremap.h>
28#include <linux/overflow.h>28#include <linux/overflow.h>
29#include <linux/sizes.h>29#include <linux/sizes.h>
30#include <linux/sched.h>
30 31
31struct mempolicy;32struct mempolicy;
32struct anon_vma;33struct anon_vma;
@@ -342,6 +343,20 @@ extern unsigned int kobjsize(const void *objp); · 309 unmodified lines
342/* Bits set in the VMA until the stack is in its final location */343/* Bits set in the VMA until the stack is in its final location */
343#define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ)344#define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ)
344 345
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
345#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */360#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
346#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS361#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
347#endif362#endif
@@ -354,12 +369,18 @@ extern unsigned int kobjsize(const void *objp); · 6 unmodified lines
354 369
355#define VM_STACK_FLAGS (VM_STACK | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)370#define VM_STACK_FLAGS (VM_STACK | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
356 371
372/* VMA basic access permission flags */
373#define VM_ACCESS_FLAGS (VM_READ | VM_WRITE | VM_EXEC)
374
375
357/*376/*
358 * Special vmas that are non-mergable, non-mlock()able.377 * Special vmas that are non-mergable, non-mlock()able.
359 * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
360 */378 */
361#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP)379#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP)
362 380
381/* This mask prevents VMA from being scanned with khugepaged */
382#define VM_NO_KHUGEPAGED (VM_SPECIAL | VM_HUGETLB)
383
363/* This mask defines which mm->def_flags a process can inherit its parent */384/* This mask defines which mm->def_flags a process can inherit its parent */
364#define VM_INIT_DEF_MASK VM_NOHUGEPAGE385#define VM_INIT_DEF_MASK VM_NOHUGEPAGE
365 386
@@ -378,15 +399,75 @@ extern unsigned int kobjsize(const void *objp); · 12 unmodified lines
378 */399 */
379extern pgprot_t protection_map[16];400extern pgprot_t protection_map[16];
380 401
381#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */402/**
382#define FAULT_FLAG_MKWRITE 0x02 /* Fault was mkwrite of existing pte */403 * Fault flag definitions.
383#define FAULT_FLAG_ALLOW_RETRY 0x04 /* Retry fault if blocking */404 *
384#define FAULT_FLAG_RETRY_NOWAIT 0x08 /* Don't drop mmap_sem and wait when retrying */405 * @FAULT_FLAG_WRITE: Fault was a write fault.
385#define FAULT_FLAG_KILLABLE 0x10 /* The fault task is in SIGKILL killable region */406 * @FAULT_FLAG_MKWRITE: Fault was mkwrite of existing PTE.
386#define FAULT_FLAG_TRIED 0x20 /* Second try */407 * @FAULT_FLAG_ALLOW_RETRY: Allow to retry the fault if blocked.
387#define FAULT_FLAG_USER 0x40 /* The fault originated in userspace */408 * @FAULT_FLAG_RETRY_NOWAIT: Don't drop mmap_sem and wait when retrying.
388#define FAULT_FLAG_REMOTE 0x80 /* faulting for non current tsk/mm */409 * @FAULT_FLAG_KILLABLE: The fault task is in SIGKILL killable region.
389#define FAULT_FLAG_INSTRUCTION 0x100 /* The fault was during an instruction fetch */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 */
466static inline bool fault_flag_allow_retry_first(unsigned int flags)
467{
468 return (flags & FAULT_FLAG_ALLOW_RETRY) &&
469 (!(flags & FAULT_FLAG_TRIED));
470}
390 471
391#define FAULT_FLAG_TRACE \472#define FAULT_FLAG_TRACE \
392 { FAULT_FLAG_WRITE, "WRITE" }, \473 { FAULT_FLAG_WRITE, "WRITE" }, \
@@ -397,7 +478,8 @@ extern pgprot_t protection_map[16]; · 4 unmodified lines
397 { FAULT_FLAG_TRIED, "TRIED" }, \478 { FAULT_FLAG_TRIED, "TRIED" }, \
398 { FAULT_FLAG_USER, "USER" }, \479 { FAULT_FLAG_USER, "USER" }, \
399 { FAULT_FLAG_REMOTE, "REMOTE" }, \480 { FAULT_FLAG_REMOTE, "REMOTE" }, \
400 { FAULT_FLAG_INSTRUCTION, "INSTRUCTION" }481 { FAULT_FLAG_INSTRUCTION, "INSTRUCTION" }, \
482 { FAULT_FLAG_INTERRUPTIBLE, "INTERRUPTIBLE" }
401 483
402/*484/*
403 * vm_fault is filled by the the pagefault handler and passed to the vma's485 * 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
541 return !vma->vm_ops;623 return !vma->vm_ops;
542}624}
543 625
626static 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
640static 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
651static inline bool vma_is_accessible(struct vm_area_struct *vma)
652{
653 return vma->vm_flags & VM_ACCESS_FLAGS;
654}
655
544#ifdef CONFIG_SHMEM656#ifdef CONFIG_SHMEM
545/*657/*
546 * The vma_is_shmem is not inline because it is used only by slow658 * 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
770 return page[1].compound_order;882 return page[1].compound_order;
771}883}
772 884
885static 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
896static 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
773static inline void set_compound_order(struct page *page, unsigned int order)903static inline void set_compound_order(struct page *page, unsigned int order)
774{904{
775 page[1].compound_order = order;905 page[1].compound_order = order;
@@ -1001,6 +1131,8 @@ static inline void get_page(struct page *page) · 225 unmodified lines
1001 page_ref_inc(page);1131 page_ref_inc(page);
1002}1132}
1003 1133
1134bool __must_check try_grab_page(struct page *page, unsigned int flags);
1135
1004static inline __must_check bool try_get_page(struct page *page)1136static inline __must_check bool try_get_page(struct page *page)
1005{1137{
1006 page = compound_head(page);1138 page = compound_head(page);
@@ -1029,29 +1161,87 @@ static inline void put_page(struct page *page) · 22 unmodified lines
1029 __put_page(page);1161 __put_page(page);
1030}1162}
1031 1163
1032/**1164/*
1033 * unpin_user_page() - release a gup-pinned page1165 * GUP_PIN_COUNTING_BIAS, and the associated functions that use it, overload
1034 * @page: pointer to page to be released1166 * 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).
1035 *1183 *
1036 * Pages that were pinned via pin_user_pages*() must be released via either1184 * Of course, once the lower bits overflow into the upper bits (and this is
1037 * unpin_user_page(), or one of the unpin_user_pages*() routines. This is so1185 * OK, because subtraction recovers the original values), then visual inspection
1038 * that eventually such pages can be separately tracked and uniquely handled. In1186 * no longer suffices to directly view the separate counts. However, for normal
1039 * particular, interactions with RDMA and filesystems need special handling.1187 * applications that don't have huge page reference counts, this won't be an
1188 * issue.
1040 *1189 *
1041 * unpin_user_page() and put_page() are not interchangeable, despite this early1190 * Locking: the lockless algorithm described in page_cache_get_speculative()
1042 * implementation that makes them look the same. unpin_user_page() calls must1191 * and page_cache_gup_pin_speculative() provides safe operation for
1043 * be perfectly matched up with pin*() calls.1192 * get_user_pages and page_mkclean and other calls that race to set up page
1193 * table entries.
1044 */1194 */
1045static inline void unpin_user_page(struct page *page)1195#define GUP_PIN_COUNTING_BIAS (1U << 10)
1046{
1047 put_page(page);
1048}
1049 1196
1197void unpin_user_page(struct page *page);
1050void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages,1198void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages,
1051 bool make_dirty);1199 bool make_dirty);
1052
1053void unpin_user_pages(struct page **pages, unsigned long npages);1200void unpin_user_pages(struct page **pages, unsigned long npages);
1054 1201
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 */
1228static 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
1055#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)1245#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
1056#define SECTION_IN_PAGE_FLAGS1246#define SECTION_IN_PAGE_FLAGS
1057#endif1247#endif
@@ -1599,9 +1789,26 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma, · 541 unmodified lines
1599 unsigned long old_addr, struct vm_area_struct *new_vma,1789 unsigned long old_addr, struct vm_area_struct *new_vma,
1600 unsigned long new_addr, unsigned long len,1790 unsigned long new_addr, unsigned long len,
1601 bool need_rmap_locks);1791 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
1602extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start,1809extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start,
1603 unsigned long end, pgprot_t newprot,1810 unsigned long end, pgprot_t newprot,
1604 int dirty_accountable, int prot_numa);1811 unsigned long cp_flags);
1605extern int mprotect_fixup(struct vm_area_struct *vma,1812extern int mprotect_fixup(struct vm_area_struct *vma,
1606 struct vm_area_struct **pprev, unsigned long start,1813 struct vm_area_struct **pprev, unsigned long start,
1607 unsigned long end, unsigned long newflags);1814 unsigned long end, unsigned long newflags);
@@ -1720,6 +1927,18 @@ static inline void sync_mm_rss(struct mm_struct *mm) · 112 unmodified lines
1720}1927}
1721#endif1928#endif
1722 1929
1930#ifndef CONFIG_ARCH_HAS_PTE_SPECIAL
1931static inline int pte_special(pte_t pte)
1932{
1933 return 0;
1934}
1935
1936static inline pte_t pte_mkspecial(pte_t pte)
1937{
1938 return pte;
1939}
1940#endif
1941
1723#ifndef CONFIG_ARCH_HAS_PTE_DEVMAP1942#ifndef CONFIG_ARCH_HAS_PTE_DEVMAP
1724static inline int pte_devmap(pte_t pte)1943static inline int pte_devmap(pte_t pte)
1725{1944{
@@ -2364,26 +2583,7 @@ struct vm_unmapped_area_info { · 638 unmodified lines
2364 unsigned long align_offset;2583 unsigned long align_offset;
2365};2584};
2366 2585
2367extern unsigned long unmapped_area(struct vm_unmapped_area_info *info);2586extern unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info);
2368extern 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 */
2379static inline unsigned long
2380vm_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}
2387 2587
2388/* truncate.c */2588/* truncate.c */
2389extern void truncate_inode_pages(struct address_space *, loff_t);2589extern 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
2519int remap_pfn_range(struct vm_area_struct *, unsigned long addr,2719int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
2520 unsigned long pfn, unsigned long size, pgprot_t);2720 unsigned long pfn, unsigned long size, pgprot_t);
2521int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);2721int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
2722int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr,
2723 struct page **pages, unsigned long *num);
2522int vm_map_pages(struct vm_area_struct *vma, struct page **pages,2724int vm_map_pages(struct vm_area_struct *vma, struct page **pages,
2523 unsigned long num);2725 unsigned long num);
2524int vm_map_pages_zero(struct vm_area_struct *vma, struct page **pages,2726int 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
2867 const void __user *usr_src,3069 const void __user *usr_src,
2868 unsigned int pages_per_huge_page,3070 unsigned int pages_per_huge_page,
2869 bool allow_pagefault);3071 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 */
3083static 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
2870#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */3089#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
2871 3090
2872#ifdef CONFIG_DEBUG_PAGEALLOC3091#ifdef CONFIG_DEBUG_PAGEALLOC
include/linux/mm_inline.h+8−7
@@ -6,19 +6,20 @@ · 5 unmodified lines
6#include <linux/swap.h>6#include <linux/swap.h>
7 7
8/**8/**
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?
10 * @page: the page to test10 * @page: the page to test
11 *11 *
12 * Returns 1 if @page is page cache page backed by a regular filesystem,12 * Returns 1 if @page is a regular filesystem backed page cache page or a lazily
13 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed.13 * freed anonymous page (e.g. via MADV_FREE). Returns 0 if @page is a normal
14 * Used by functions that manipulate the LRU lists, to sort a page14 * anonymous page, a tmpfs page or otherwise ram or swap backed page. Used by
15 * onto the right LRU list.15 * functions that manipulate the LRU lists, to sort a page onto the right LRU
16 * list.
16 *17 *
17 * We would like to get this info without a page flag, but the state18 * We would like to get this info without a page flag, but the state
18 * needs to survive until the page is last deleted from the LRU, which19 * needs to survive until the page is last deleted from the LRU, which
19 * could be as far down as __page_cache_release.20 * could be as far down as __page_cache_release.
20 */21 */
21static inline int page_is_file_cache(struct page *page)22static inline int page_is_file_lru(struct page *page)
22{23{
23 return !PageSwapBacked(page);24 return !PageSwapBacked(page);
24}25}
@@ -75,7 +76,7 @@ static __always_inline void del_page_from_lru_list(struct page *page, · 50 unmodified lines
75 */76 */
76static inline enum lru_list page_lru_base_type(struct page *page)77static inline enum lru_list page_lru_base_type(struct page *page)
77{78{
78 if (page_is_file_cache(page))79 if (page_is_file_lru(page))
79 return LRU_INACTIVE_FILE;80 return LRU_INACTIVE_FILE;
80 return LRU_INACTIVE_ANON;81 return LRU_INACTIVE_ANON;
81}82}
include/linux/mm_types.h+8−3
@@ -137,7 +137,7 @@ struct page { · 136 unmodified lines
137 };137 };
138 struct { /* Second tail page of compound page */138 struct { /* Second tail page of compound page */
139 unsigned long _compound_pad_1; /* compound_head */139 unsigned long _compound_pad_1; /* compound_head */
140 unsigned long _compound_pad_2;140 atomic_t hpage_pinned_refcount;
141 /* For both global and memcg */141 /* For both global and memcg */
142 struct list_head deferred_list;142 struct list_head deferred_list;
143 };143 };
@@ -226,6 +226,11 @@ static inline atomic_t *compound_mapcount_ptr(struct page *page) · 82 unmodified lines
226 return &page[1].compound_mapcount;226 return &page[1].compound_mapcount;
227}227}
228 228
229static inline atomic_t *compound_pincount_ptr(struct page *page)
230{
231 return &page[2].hpage_pinned_refcount;
232}
233
229/*234/*
230 * Used for sizing the vmemmap region on some architectures235 * Used for sizing the vmemmap region on some architectures
231 */236 */
@@ -284,8 +289,8 @@ struct vm_userfaultfd_ctx {}; · 52 unmodified lines
284#endif /* CONFIG_USERFAULTFD */289#endif /* CONFIG_USERFAULTFD */
285 290
286/*291/*
287 * This struct defines a memory VMM memory area. There is one of these292 * This struct describes a virtual memory area. There is one of these
288 * per VM-area/task. A VM area is any part of the process virtual memory293 * per VM-area/task. A VM area is any part of the process virtual memory
289 * space that has a special rule for the page-fault handlers (ie a shared294 * space that has a special rule for the page-fault handlers (ie a shared
290 * library, the executable area etc).295 * library, the executable area etc).
291 */296 */
include/linux/mmc/core.h+0−3
@@ -107,9 +107,6 @@ struct mmc_command { · 106 unmodified lines
107 */107 */
108 108
109 unsigned int busy_timeout; /* busy detect timeout in ms */109 unsigned int busy_timeout; /* busy detect timeout in ms */
110 /* Set this flag only for blocking sanitize request */
111 bool sanitize_busy;
112
113 struct mmc_data *data; /* data segment associated with cmd */110 struct mmc_data *data; /* data segment associated with cmd */
114 struct mmc_request *mrq; /* associated request */111 struct mmc_request *mrq; /* associated request */
115};112};
include/linux/mmc/host.h+7−1
@@ -322,6 +322,8 @@ struct mmc_host { · 321 unmodified lines
322#define MMC_CAP_3_3V_DDR (1 << 11) /* Host supports eMMC DDR 3.3V */322#define MMC_CAP_3_3V_DDR (1 << 11) /* Host supports eMMC DDR 3.3V */
323#define MMC_CAP_1_8V_DDR (1 << 12) /* Host supports eMMC DDR 1.8V */323#define MMC_CAP_1_8V_DDR (1 << 12) /* Host supports eMMC DDR 1.8V */
324#define MMC_CAP_1_2V_DDR (1 << 13) /* Host supports eMMC DDR 1.2V */324#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)
325#define MMC_CAP_POWER_OFF_CARD (1 << 14) /* Can power off after boot */327#define MMC_CAP_POWER_OFF_CARD (1 << 14) /* Can power off after boot */
326#define MMC_CAP_BUS_WIDTH_TEST (1 << 15) /* CMD14/CMD19 bus width ok */328#define MMC_CAP_BUS_WIDTH_TEST (1 << 15) /* CMD14/CMD19 bus width ok */
327#define MMC_CAP_UHS_SDR12 (1 << 16) /* Host supports UHS SDR12 mode */329#define MMC_CAP_UHS_SDR12 (1 << 16) /* Host supports UHS SDR12 mode */
@@ -333,6 +335,7 @@ struct mmc_host { · 5 unmodified lines
333 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \335 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \
334 MMC_CAP_UHS_DDR50)336 MMC_CAP_UHS_DDR50)
335#define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */337#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. */
336#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */339#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
337#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */340#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
338#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */341#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */
@@ -462,7 +465,10 @@ struct mmc_host { · 123 unmodified lines
462 bool cqe_enabled;465 bool cqe_enabled;
463 bool cqe_on;466 bool cqe_on;
464 467
465 unsigned long private[0] ____cacheline_aligned;468 /* Host Software Queue support */
469 bool hsq_enabled;
470
471 unsigned long private[] ____cacheline_aligned;
466};472};
467 473
468struct device_node;474struct device_node;
include/linux/mmc/mmc.h+10−0
@@ -161,6 +161,16 @@ static inline bool mmc_op_multi(u32 opcode) · 160 unmodified lines
161#define R1_STATE_PRG 7161#define R1_STATE_PRG 7
162#define R1_STATE_DIS 8162#define R1_STATE_DIS 8
163 163
164static 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
164/*174/*
165 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS175 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS
166 * R1 is the low order byte; R2 is the next highest byte, when present.176 * 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
25 struct sdio_func_tuple *next;25 struct sdio_func_tuple *next;
26 unsigned char code;26 unsigned char code;
27 unsigned char size;27 unsigned char size;
28 unsigned char data[0];28 unsigned char data[];
29};29};
30 30
31/*31/*
include/linux/mmzone.h+7−47
@@ -100,41 +100,6 @@ struct free_area { · 99 unmodified lines
100 unsigned long nr_free;100 unsigned long nr_free;
101};101};
102 102
103/* Used for pages not on another list */
104static 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 */
112static 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 */
121void add_to_free_area_random(struct page *page, struct free_area *area,
122 int migratetype);
123#else
124static 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 */
132static 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
138static inline struct page *get_page_from_free_area(struct free_area *area,103static inline struct page *get_page_from_free_area(struct free_area *area,
139 int migratetype)104 int migratetype)
140{105{
@@ -142,15 +107,6 @@ static inline struct page *get_page_from_free_area(struct free_area *area, · 1 unmodified line
142 struct page, lru);107 struct page, lru);
143}108}
144 109
145static 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
154static inline bool free_area_empty(struct free_area *area, int migratetype)110static inline bool free_area_empty(struct free_area *area, int migratetype)
155{111{
156 return list_empty(&area->free_list[migratetype]);112 return list_empty(&area->free_list[migratetype]);
@@ -243,6 +199,8 @@ enum node_stat_item { · 86 unmodified lines
243 NR_DIRTIED, /* page dirtyings since bootup */199 NR_DIRTIED, /* page dirtyings since bootup */
244 NR_WRITTEN, /* page writings since bootup */200 NR_WRITTEN, /* page writings since bootup */
245 NR_KERNEL_MISC_RECLAIMABLE, /* reclaimable non-slab kernel pages */201 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() */
246 NR_VM_NODE_STAT_ITEMS204 NR_VM_NODE_STAT_ITEMS
247};205};
248 206
@@ -706,7 +664,6 @@ struct deferred_split { · 457 unmodified lines
706 * Memory statistics and page replacement data structures are maintained on a664 * Memory statistics and page replacement data structures are maintained on a
707 * per-zone basis.665 * per-zone basis.
708 */666 */
709struct bootmem_data;
710typedef struct pglist_data {667typedef struct pglist_data {
711 struct zone node_zones[MAX_NR_ZONES];668 struct zone node_zones[MAX_NR_ZONES];
712 struct zonelist node_zonelists[MAX_ZONELISTS];669 struct zonelist node_zonelists[MAX_ZONELISTS];
@@ -1170,6 +1127,7 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec) · 457 unmodified lines
1170#define SECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SECTION_MASK)1127#define SECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SECTION_MASK)
1171 1128
1172#define SUBSECTION_SHIFT 211129#define SUBSECTION_SHIFT 21
1130#define SUBSECTION_SIZE (1UL << SUBSECTION_SHIFT)
1173 1131
1174#define PFN_SUBSECTION_SHIFT (SUBSECTION_SHIFT - PAGE_SHIFT)1132#define PFN_SUBSECTION_SHIFT (SUBSECTION_SHIFT - PAGE_SHIFT)
1175#define PAGES_PER_SUBSECTION (1UL << PFN_SUBSECTION_SHIFT)1133#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
1185#define SUBSECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SUBSECTION_MASK)1143#define SUBSECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SUBSECTION_MASK)
1186 1144
1187struct mem_section_usage {1145struct mem_section_usage {
1146#ifdef CONFIG_SPARSEMEM_VMEMMAP
1188 DECLARE_BITMAP(subsection_map, SUBSECTIONS_PER_SECTION);1147 DECLARE_BITMAP(subsection_map, SUBSECTIONS_PER_SECTION);
1148#endif
1189 /* See declaration of similar field in struct zone */1149 /* See declaration of similar field in struct zone */
1190 unsigned long pageblock_flags[0];1150 unsigned long pageblock_flags[0];
1191};1151};
@@ -1372,7 +1332,7 @@ static inline int pfn_valid(unsigned long pfn) · 180 unmodified lines
1372}1332}
1373#endif1333#endif
1374 1334
1375static inline int pfn_present(unsigned long pfn)1335static inline int pfn_in_present_section(unsigned long pfn)
1376{1336{
1377 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)1337 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
1378 return 0;1338 return 0;
@@ -1409,7 +1369,7 @@ void sparse_init(void); · 30 unmodified lines
1409#else1369#else
1410#define sparse_init() do {} while (0)1370#define sparse_init() do {} while (0)
1411#define sparse_index_init(_sec, _nid) do {} while (0)1371#define sparse_index_init(_sec, _nid) do {} while (0)
1412#define pfn_present pfn_valid1372#define pfn_in_present_section pfn_valid
1413#define subsection_map_init(_pfn, _nr_pages) do {} while (0)1373#define subsection_map_init(_pfn, _nr_pages) do {} while (0)
1414#endif /* CONFIG_SPARSEMEM */1374#endif /* CONFIG_SPARSEMEM */
1415 1375
include/linux/mod_devicetable.h+14−3
@@ -667,9 +667,7 @@ struct x86_cpu_id { · 666 unmodified lines
667 kernel_ulong_t driver_data;667 kernel_ulong_t driver_data;
668};668};
669 669
670#define X86_FEATURE_MATCH(x) \670/* Wild cards for x86_cpu_id::vendor, family, model and feature */
671 { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x }
672
673#define X86_VENDOR_ANY 0xffff671#define X86_VENDOR_ANY 0xffff
674#define X86_FAMILY_ANY 0672#define X86_FAMILY_ANY 0
675#define X86_MODEL_ANY 0673#define X86_MODEL_ANY 0
@@ -821,4 +819,17 @@ struct wmi_device_id { · 145 unmodified lines
821 const void *context;819 const void *context;
822};820};
823 821
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 */
830struct mhi_device_id {
831 const char chan[MHI_NAME_SIZE];
832 kernel_ulong_t driver_data;
833};
834
824#endif /* LINUX_MOD_DEVICETABLE_H */835#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
14struct module;
15struct interface_private;
16
17/**
18 * Interface type
19 */
20enum 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 */
35enum most_channel_direction {
36 MOST_CH_RX = 1 << 0,
37 MOST_CH_TX = 1 << 1,
38};
39
40/**
41 * Channel data type.
42 */
43enum 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
50enum 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 */
95struct 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 */
123struct 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 */
176struct 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 */
231struct 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 */
263struct 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 */
286int 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 */
292void most_deregister_interface(struct most_interface *iface);
293void 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 */
300void 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 */
310void most_resume_enqueue(struct most_interface *iface, int channel_idx);
311int most_register_component(struct most_component *comp);
312int most_deregister_component(struct most_component *comp);
313struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx,
314 struct most_component *comp);
315void most_put_mbo(struct mbo *mbo);
316int channel_has_mbo(struct most_interface *iface, int channel_idx,
317 struct most_component *comp);
318int most_start_channel(struct most_interface *iface, int channel_idx,
319 struct most_component *comp);
320int most_stop_channel(struct most_interface *iface, int channel_idx,
321 struct most_component *comp);
322int __init configfs_init(void);
323int most_register_configfs_subsys(struct most_component *comp);
324void most_deregister_configfs_subsys(struct most_component *comp);
325int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name,
326 char *comp_param);
327int most_remove_link(char *mdev, char *mdev_ch, char *comp_name);
328int most_set_cfg_buffer_size(char *mdev, char *mdev_ch, u16 val);
329int most_set_cfg_subbuffer_size(char *mdev, char *mdev_ch, u16 val);
330int most_set_cfg_dbr_size(char *mdev, char *mdev_ch, u16 val);
331int most_set_cfg_num_buffers(char *mdev, char *mdev_ch, u16 val);
332int most_set_cfg_datatype(char *mdev, char *mdev_ch, char *buf);
333int most_set_cfg_direction(char *mdev, char *mdev_ch, char *buf);
334int most_set_cfg_packets_xact(char *mdev, char *mdev_ch, u16 val);
335int most_cfg_complete(char *comp_name);
336void 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
7struct 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
20enum 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
8 8
9#include <linux/types.h>9#include <linux/types.h>
10#include <linux/uio.h>10#include <linux/uio.h>
11#include <linux/list.h>
11#include <linux/notifier.h>12#include <linux/notifier.h>
12#include <linux/device.h>13#include <linux/device.h>
13#include <linux/of.h>14#include <linux/of.h>
@@ -194,10 +195,43 @@ struct mtd_debug_info { · 180 unmodified lines
194 const char *partid;195 const char *partid;
195};196};
196 197
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 */
209struct 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 */
227struct mtd_master {
228 struct mutex partitions_lock;
229 unsigned int suspended : 1;
230};
231
197struct mtd_info {232struct mtd_info {
198 u_char type;233 u_char type;
199 uint32_t flags;234 uint32_t flags;
200 uint32_t orig_flags; /* Flags as before running mtd checks */
201 uint64_t size; // Total size of the MTD235 uint64_t size; // Total size of the MTD
202 236
203 /* "Major" erase size for the device. Naïve users may take this237 /* "Major" erase size for the device. Naïve users may take this
@@ -339,8 +373,52 @@ struct mtd_info { · 135 unmodified lines
339 int usecount;373 int usecount;
340 struct mtd_debug_info dbg;374 struct mtd_debug_info dbg;
341 struct nvmem_device *nvmem;375 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 };
342};392};
343 393
394static 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
402static 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
412static inline bool mtd_is_partition(const struct mtd_info *mtd)
413{
414 return mtd->parent;
415}
416
417static inline bool mtd_has_partitions(const struct mtd_info *mtd)
418{
419 return !list_empty(&mtd->partitions);
420}
421
344int mtd_ooblayout_ecc(struct mtd_info *mtd, int section,422int mtd_ooblayout_ecc(struct mtd_info *mtd, int section,
345 struct mtd_oob_region *oobecc);423 struct mtd_oob_region *oobecc);
346int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte,424int 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
392static inline int mtd_max_bad_blocks(struct mtd_info *mtd,470static inline int mtd_max_bad_blocks(struct mtd_info *mtd,
393 loff_t ofs, size_t len)471 loff_t ofs, size_t len)
394{472{
395 if (!mtd->_max_bad_blocks)473 struct mtd_info *master = mtd_get_master(mtd);
474
475 if (!master->_max_bad_blocks)
396 return -ENOTSUPP;476 return -ENOTSUPP;
397 477
398 if (mtd->size < (len + ofs) || ofs < 0)478 if (mtd->size < (len + ofs) || ofs < 0)
399 return -EINVAL;479 return -EINVAL;
400 480
401 return mtd->_max_bad_blocks(mtd, ofs, len);481 return master->_max_bad_blocks(master, mtd_get_master_ofs(mtd, ofs),
482 len);
402}483}
403 484
404int mtd_wunit_to_pairing_info(struct mtd_info *mtd, int wunit,485int 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
439 520
440static inline void mtd_sync(struct mtd_info *mtd)521static inline void mtd_sync(struct mtd_info *mtd)
441{522{
442 if (mtd->_sync)523 struct mtd_info *master = mtd_get_master(mtd);
443 mtd->_sync(mtd);524
525 if (master->_sync)
526 master->_sync(master);
444}527}
445 528
446int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);529int 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
452 535
453static inline int mtd_suspend(struct mtd_info *mtd)536static inline int mtd_suspend(struct mtd_info *mtd)
454{537{
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;
456}550}
457 551
458static inline void mtd_resume(struct mtd_info *mtd)552static inline void mtd_resume(struct mtd_info *mtd)
459{553{
460 if (mtd->_resume)554 struct mtd_info *master = mtd_get_master(mtd);
461 mtd->_resume(mtd);555
556 if (!master->master.suspended)
557 return;
558
559 if (master->_resume)
560 master->_resume(master);
561
562 master->master.suspended = 0;
462}563}
463 564
464static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)565static 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
538 639
539static inline int mtd_has_oob(const struct mtd_info *mtd)640static inline int mtd_has_oob(const struct mtd_info *mtd)
540{641{
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;
542}645}
543 646
544static inline int mtd_type_is_nand(const struct mtd_info *mtd)647static 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
548 651
549static inline int mtd_can_have_bb(const struct mtd_info *mtd)652static inline int mtd_can_have_bb(const struct mtd_info *mtd)
550{653{
551 return !!mtd->_block_isbad;654 struct mtd_info *master = mtd_get_master((struct mtd_info *)mtd);
655
656 return !!master->_block_isbad;
552}657}
553 658
554 /* Kernel-side ioctl definitions */659 /* 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
105 module_driver(__mtd_part_parser, register_mtd_parser, \105 module_driver(__mtd_part_parser, register_mtd_parser, \
106 deregister_mtd_parser)106 deregister_mtd_parser)
107 107
108int mtd_is_partition(const struct mtd_info *mtd);
109int mtd_add_partition(struct mtd_info *master, const char *name,108int mtd_add_partition(struct mtd_info *master, const char *name,
110 long long offset, long long length);109 long long offset, long long length);
111int mtd_del_partition(struct mtd_info *master, int partno);110int 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
1064 * @lock: lock protecting the suspended field. Also used to1064 * @lock: lock protecting the suspended field. Also used to
1065 * serialize accesses to the NAND device.1065 * serialize accesses to the NAND device.
1066 * @suspended: set to 1 when the device is suspended, 0 when it's not.1066 * @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
1067 * @bbt: [INTERN] bad block table pointer1069 * @bbt: [INTERN] bad block table pointer
1068 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash1070 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
1069 * lookup.1071 * lookup.
@@ -1077,6 +1079,8 @@ struct nand_legacy { · 7 unmodified lines
1077 * @manufacturer: [INTERN] Contains manufacturer information1079 * @manufacturer: [INTERN] Contains manufacturer information
1078 * @manufacturer.desc: [INTERN] Contains manufacturer's description1080 * @manufacturer.desc: [INTERN] Contains manufacturer's description
1079 * @manufacturer.priv: [INTERN] Contains manufacturer private information1081 * @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
1080 */1084 */
1081 1085
1082struct nand_chip {1086struct nand_chip {
@@ -1117,6 +1121,8 @@ struct nand_chip { · 34 unmodified lines
1117 1121
1118 struct mutex lock;1122 struct mutex lock;
1119 unsigned int suspended : 1;1123 unsigned int suspended : 1;
1124 int (*suspend)(struct nand_chip *chip);
1125 void (*resume)(struct nand_chip *chip);
1120 1126
1121 uint8_t *oob_poi;1127 uint8_t *oob_poi;
1122 struct nand_controller *controller;1128 struct nand_controller *controller;
@@ -1136,6 +1142,9 @@ struct nand_chip { · 13 unmodified lines
1136 const struct nand_manufacturer *desc;1142 const struct nand_manufacturer *desc;
1137 void *priv;1143 void *priv;
1138 } manufacturer;1144 } 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);
1139};1148};
1140 1149
1141extern const struct mtd_ooblayout_ops nand_ooblayout_sp_ops;1150extern 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
1215 * struct nand_flash_dev - NAND Flash Device ID Structure1224 * struct nand_flash_dev - NAND Flash Device ID Structure
1216 * @name: a human-readable name of the NAND chip1225 * @name: a human-readable name of the NAND chip
1217 * @dev_id: the device ID (the second byte of the full chip ID array)1226 * @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 same1227 * @mfr_id: manufacturer ID part of the full chip ID array (refers the same
1219 * memory address as ``id[0]``)1228 * memory address as ``id[0]``)
1220 * @dev_id: device ID part of the full chip ID array (refers the same memory1229 * @dev_id: device ID part of the full chip ID array (refers the same memory
1221 * address as ``id[1]``)1230 * address as ``id[1]``)
include/linux/mtd/spi-nor.h+19−266
@@ -11,23 +11,6 @@ · 10 unmodified lines
11#include <linux/mtd/mtd.h>11#include <linux/mtd/mtd.h>
12#include <linux/spi/spi-mem.h>12#include <linux/spi/spi-mem.h>
13 13
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
31/*14/*
32 * Note on opcode nomenclature: some opcodes have a format like15 * Note on opcode nomenclature: some opcodes have a format like
33 * SPINOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number16 * SPINOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number
@@ -128,7 +111,9 @@ · 94 unmodified lines
128#define SR_BP0 BIT(2) /* Block protect 0 */111#define SR_BP0 BIT(2) /* Block protect 0 */
129#define SR_BP1 BIT(3) /* Block protect 1 */112#define SR_BP1 BIT(3) /* Block protect 1 */
130#define SR_BP2 BIT(4) /* Block protect 2 */113#define SR_BP2 BIT(4) /* Block protect 2 */
114#define SR_BP3 BIT(5) /* Block protect 3 */
131#define SR_TB_BIT5 BIT(5) /* Top/Bottom protect */115#define SR_TB_BIT5 BIT(5) /* Top/Bottom protect */
116#define SR_BP3_BIT6 BIT(6) /* Block protect 3 */
132#define SR_TB_BIT6 BIT(6) /* Top/Bottom protect */117#define SR_TB_BIT6 BIT(6) /* Top/Bottom protect */
133#define SR_SRWD BIT(7) /* SR write protect */118#define SR_SRWD BIT(7) /* SR write protect */
134/* Spansion/Cypress specific status bits */119/* Spansion/Cypress specific status bits */
@@ -137,6 +122,8 @@ · 2 unmodified lines
137 122
138#define SR1_QUAD_EN_BIT6 BIT(6)123#define SR1_QUAD_EN_BIT6 BIT(6)
139 124
125#define SR_BP_SHIFT 2
126
140/* Enhanced Volatile Configuration Register bits */127/* Enhanced Volatile Configuration Register bits */
141#define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */128#define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */
142 129
@@ -225,110 +212,6 @@ static inline u8 spi_nor_get_protocol_width(enum spi_nor_protocol proto) · 82 unmodified lines
225 return spi_nor_get_protocol_data_nbits(proto);212 return spi_nor_get_protocol_data_nbits(proto);
226}213}
227 214
228enum 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 */
257struct 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 */
276struct 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 */
294struct 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 */
325struct 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
332/**215/**
333 * struct spi_nor_hwcaps - Structure for describing the hardware capabilies216 * struct spi_nor_hwcaps - Structure for describing the hardware capabilies
334 * supported by the SPI controller (bus master).217 * supported by the SPI controller (bus master).
@@ -404,61 +287,7 @@ struct spi_nor_hwcaps { · 69 unmodified lines
404#define SNOR_HWCAPS_ALL (SNOR_HWCAPS_READ_MASK | \287#define SNOR_HWCAPS_ALL (SNOR_HWCAPS_READ_MASK | \
405 SNOR_HWCAPS_PP_MASK)288 SNOR_HWCAPS_PP_MASK)
406 289
407struct spi_nor_read_command {290/* Forward declaration that is used in 'struct spi_nor_controller_ops' */
408 u8 num_mode_clocks;
409 u8 num_wait_states;
410 u8 opcode;
411 enum spi_nor_protocol proto;
412};
413
414struct spi_nor_pp_command {
415 u8 opcode;
416 enum spi_nor_protocol proto;
417};
418
419enum 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
445enum 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' */
462struct spi_nor;291struct spi_nor;
463 292
464/**293/**
@@ -489,68 +318,13 @@ struct spi_nor_controller_ops { · 24 unmodified lines
489 int (*erase)(struct spi_nor *nor, loff_t offs);318 int (*erase)(struct spi_nor *nor, loff_t offs);
490};319};
491 320
492/**321/*
493 * struct spi_nor_locking_ops - SPI NOR locking methods322 * Forward declarations that are used internally by the core and manufacturer
494 * @lock: lock a region of the SPI NOR.323 * drivers.
495 * @unlock: unlock a region of the SPI NOR.
496 * @is_locked: check if a region of the SPI NOR is completely locked
497 */
498struct 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 */
531struct 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()
552 */324 */
553struct flash_info;325struct flash_info;
326struct spi_nor_manufacturer;
327struct spi_nor_flash_parameter;
554 328
555/**329/**
556 * struct spi_nor - Structure for defining a the SPI NOR layer330 * struct spi_nor - Structure for defining a the SPI NOR layer
@@ -562,6 +336,7 @@ struct flash_info; · 5 unmodified lines
562 * layer is not DMA-able336 * layer is not DMA-able
563 * @bouncebuf_size: size of the bounce buffer337 * @bouncebuf_size: size of the bounce buffer
564 * @info: spi-nor part JDEC MFR id and other info338 * @info: spi-nor part JDEC MFR id and other info
339 * @manufacturer: spi-nor manufacturer
565 * @page_size: the page size of the SPI NOR340 * @page_size: the page size of the SPI NOR
566 * @addr_width: number of address bytes341 * @addr_width: number of address bytes
567 * @erase_opcode: the opcode for erasing a sector342 * @erase_opcode: the opcode for erasing a sector
@@ -578,6 +353,7 @@ struct flash_info; · 10 unmodified lines
578 * The structure includes legacy flash parameters and353 * The structure includes legacy flash parameters and
579 * settings that can be overwritten by the spi_nor_fixups354 * settings that can be overwritten by the spi_nor_fixups
580 * hooks, or dynamically when parsing the SFDP tables.355 * hooks, or dynamically when parsing the SFDP tables.
356 * @dirmap: pointers to struct spi_mem_dirmap_desc for reads/writes.
581 * @priv: the private data357 * @priv: the private data
582 */358 */
583struct spi_nor {359struct spi_nor {
@@ -588,6 +364,7 @@ struct spi_nor { · 4 unmodified lines
588 u8 *bouncebuf;364 u8 *bouncebuf;
589 size_t bouncebuf_size;365 size_t bouncebuf_size;
590 const struct flash_info *info;366 const struct flash_info *info;
367 const struct spi_nor_manufacturer *manufacturer;
591 u32 page_size;368 u32 page_size;
592 u8 addr_width;369 u8 addr_width;
593 u8 erase_opcode;370 u8 erase_opcode;
@@ -602,40 +379,16 @@ struct spi_nor { · 8 unmodified lines
602 379
603 const struct spi_nor_controller_ops *controller_ops;380 const struct spi_nor_controller_ops *controller_ops;
604 381
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;
606 388
607 void *priv;389 void *priv;
608};390};
609 391
610static u64 __maybe_unused
611spi_nor_region_is_last(const struct spi_nor_erase_region *region)
612{
613 return region->offset & SNOR_LAST_REGION;
614}
615
616static u64 __maybe_unused
617spi_nor_region_end(const struct spi_nor_erase_region *region)
618{
619 return (region->offset & ~SNOR_ERASE_FLAGS_MASK) + region->size;
620}
621
622static void __maybe_unused
623spi_nor_region_mark_end(struct spi_nor_erase_region *region)
624{
625 region->offset |= SNOR_LAST_REGION;
626}
627
628static void __maybe_unused
629spi_nor_region_mark_overlay(struct spi_nor_erase_region *region)
630{
631 region->offset |= SNOR_OVERLAID_REGION;
632}
633
634static 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
639static inline void spi_nor_set_flash_node(struct spi_nor *nor,392static inline void spi_nor_set_flash_node(struct spi_nor *nor,
640 struct device_node *np)393 struct device_node *np)
641{394{
include/linux/mtd/spinand.h+45−22
@@ -32,9 +32,9 @@ · 31 unmodified lines
32 SPI_MEM_OP_NO_DUMMY, \32 SPI_MEM_OP_NO_DUMMY, \
33 SPI_MEM_OP_NO_DATA)33 SPI_MEM_OP_NO_DATA)
34 34
35#define SPINAND_READID_OP(ndummy, buf, len) \35#define SPINAND_READID_OP(naddr, ndummy, buf, len) \
36 SPI_MEM_OP(SPI_MEM_OP_CMD(0x9f, 1), \36 SPI_MEM_OP(SPI_MEM_OP_CMD(0x9f, 1), \
37 SPI_MEM_OP_NO_ADDR, \37 SPI_MEM_OP_ADDR(naddr, 0, 1), \
38 SPI_MEM_OP_DUMMY(ndummy, 1), \38 SPI_MEM_OP_DUMMY(ndummy, 1), \
39 SPI_MEM_OP_DATA_IN(len, buf, 1))39 SPI_MEM_OP_DATA_IN(len, buf, 1))
40 40
@@ -176,37 +176,46 @@ struct spinand_device; · 135 unmodified lines
176 * @data: buffer containing the id bytes. Currently 4 bytes large, but can176 * @data: buffer containing the id bytes. Currently 4 bytes large, but can
177 * be extended if required177 * be extended if required
178 * @len: ID length178 * @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().
184 */179 */
185struct spinand_id {180struct spinand_id {
186 u8 data[SPINAND_MAX_ID_LEN];181 u8 data[SPINAND_MAX_ID_LEN];
187 int len;182 int len;
188};183};
189 184
185enum 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 */
204struct spinand_devid {
205 const u8 *id;
206 const u8 len;
207 const enum spinand_readid_method method;
208};
209
190/**210/**
191 * struct manufacurer_ops - SPI NAND manufacturer specific operations211 * 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
202 * @init: initialize a SPI NAND device212 * @init: initialize a SPI NAND device
203 * @cleanup: cleanup a SPI NAND device213 * @cleanup: cleanup a SPI NAND device
204 *214 *
205 * Each SPI NAND manufacturer driver should implement this interface so that215 * 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.
207 */217 */
208struct spinand_manufacturer_ops {218struct spinand_manufacturer_ops {
209 int (*detect)(struct spinand_device *spinand);
210 int (*init)(struct spinand_device *spinand);219 int (*init)(struct spinand_device *spinand);
211 void (*cleanup)(struct spinand_device *spinand);220 void (*cleanup)(struct spinand_device *spinand);
212};221};
@@ -215,11 +224,16 @@ struct spinand_manufacturer_ops { · 2 unmodified lines
215 * struct spinand_manufacturer - SPI NAND manufacturer instance224 * struct spinand_manufacturer - SPI NAND manufacturer instance
216 * @id: manufacturer ID225 * @id: manufacturer ID
217 * @name: manufacturer name226 * @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
218 * @ops: manufacturer operations230 * @ops: manufacturer operations
219 */231 */
220struct spinand_manufacturer {232struct spinand_manufacturer {
221 u8 id;233 u8 id;
222 char *name;234 char *name;
235 const struct spinand_info *chips;
236 const size_t nchips;
223 const struct spinand_manufacturer_ops *ops;237 const struct spinand_manufacturer_ops *ops;
224};238};
225 239
@@ -270,6 +284,7 @@ struct spinand_ecc_info { · 44 unmodified lines
270};284};
271 285
272#define SPINAND_HAS_QE_BIT BIT(0)286#define SPINAND_HAS_QE_BIT BIT(0)
287#define SPINAND_HAS_CR_FEAT_BIT BIT(1)
273 288
274/**289/**
275 * struct spinand_info - Structure used to describe SPI NAND chips290 * struct spinand_info - Structure used to describe SPI NAND chips
@@ -291,7 +306,7 @@ struct spinand_ecc_info { · 15 unmodified lines
291 */306 */
292struct spinand_info {307struct spinand_info {
293 const char *model;308 const char *model;
294 u16 devid;309 struct spinand_devid devid;
295 u32 flags;310 u32 flags;
296 struct nand_memory_organization memorg;311 struct nand_memory_organization memorg;
297 struct nand_ecc_req eccreq;312 struct nand_ecc_req eccreq;
@@ -305,6 +320,13 @@ struct spinand_info { · 7 unmodified lines
305 unsigned int target);320 unsigned int target);
306};321};
307 322
323#define SPINAND_ID(__method, ...) \
324 { \
325 .id = (const u8[]){ __VA_ARGS__ }, \
326 .len = sizeof((u8[]){ __VA_ARGS__ }), \
327 .method = __method, \
328 }
329
308#define SPINAND_INFO_OP_VARIANTS(__read, __write, __update) \330#define SPINAND_INFO_OP_VARIANTS(__read, __write, __update) \
309 { \331 { \
310 .read_cache = __read, \332 .read_cache = __read, \
@@ -451,9 +473,10 @@ static inline void spinand_set_of_node(struct spinand_device *spinand, · 140 unmodified lines
451 nanddev_set_of_node(&spinand->base, np);473 nanddev_set_of_node(&spinand->base, np);
452}474}
453 475
454int spinand_match_and_init(struct spinand_device *dev,476int spinand_match_and_init(struct spinand_device *spinand,
455 const struct spinand_info *table,477 const struct spinand_info *table,
456 unsigned int table_size, u16 devid);478 unsigned int table_size,
479 enum spinand_readid_method rdid_method);
457 480
458int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);481int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);
459int spinand_select_target(struct spinand_device *spinand, unsigned int target);482int spinand_select_target(struct spinand_device *spinand, unsigned int target);
include/linux/mutex.h+5−2
@@ -109,8 +109,11 @@ do { \ · 108 unmodified lines
109} while (0)109} while (0)
110 110
111#ifdef CONFIG_DEBUG_LOCK_ALLOC111#ifdef CONFIG_DEBUG_LOCK_ALLOC
112# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \112# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \
113 , .dep_map = { .name = #lockname }113 , .dep_map = { \
114 .name = #lockname, \
115 .wait_type_inner = LD_WAIT_SLEEP, \
116 }
114#else117#else
115# define __DEP_MAP_MUTEX_INITIALIZER(lockname)118# define __DEP_MAP_MUTEX_INITIALIZER(lockname)
116#endif119#endif
include/linux/namei.h+2−2
@@ -15,7 +15,7 @@ enum { MAX_NESTED_LINKS = 8 }; · 14 unmodified lines
15/*15/*
16 * Type of the last component on LOOKUP_PARENT16 * Type of the last component on LOOKUP_PARENT
17 */17 */
18enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};18enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT};
19 19
20/* pathwalk mode */20/* pathwalk mode */
21#define LOOKUP_FOLLOW 0x0001 /* follow links at the end */21#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
23#define LOOKUP_AUTOMOUNT 0x0004 /* force terminal automount */23#define LOOKUP_AUTOMOUNT 0x0004 /* force terminal automount */
24#define LOOKUP_EMPTY 0x4000 /* accept empty path [user_... only] */24#define LOOKUP_EMPTY 0x4000 /* accept empty path [user_... only] */
25#define LOOKUP_DOWN 0x8000 /* follow mounts in the starting point */25#define LOOKUP_DOWN 0x8000 /* follow mounts in the starting point */
26#define LOOKUP_MOUNTPOINT 0x0080 /* follow mounts in the end */
26 27
27#define LOOKUP_REVAL 0x0020 /* tell ->d_revalidate() to trust no cache */28#define LOOKUP_REVAL 0x0020 /* tell ->d_revalidate() to trust no cache */
28#define LOOKUP_RCU 0x0040 /* RCU pathwalk mode; semi-internal */29#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
64extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);65extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
65extern void done_path_create(struct path *, struct dentry *);66extern void done_path_create(struct path *, struct dentry *);
66extern struct dentry *kern_path_locked(const char *, struct path *);67extern struct dentry *kern_path_locked(const char *, struct path *);
67extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int);
68 68
69extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int);69extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int);
70extern struct dentry *lookup_one_len(const char *, struct dentry *, int);70extern 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
83 NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */83 NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */
84 NETIF_F_GRO_FRAGLIST_BIT, /* Fraglist GRO */84 NETIF_F_GRO_FRAGLIST_BIT, /* Fraglist GRO */
85 85
86 NETIF_F_HW_MACSEC_BIT, /* Offload MACsec operations */
87
86 /*88 /*
87 * Add your fresh new feature above and remember to update89 * Add your fresh new feature above and remember to update
88 * netdev_features_strings[] in net/core/ethtool.c and maybe90 * netdev_features_strings[] in net/core/ethtool.c and maybe
@@ -154,6 +156,7 @@ enum { · 65 unmodified lines
154#define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX)156#define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX)
155#define NETIF_F_GRO_FRAGLIST __NETIF_F(GRO_FRAGLIST)157#define NETIF_F_GRO_FRAGLIST __NETIF_F(GRO_FRAGLIST)
156#define NETIF_F_GSO_FRAGLIST __NETIF_F(GSO_FRAGLIST)158#define NETIF_F_GSO_FRAGLIST __NETIF_F(GSO_FRAGLIST)
159#define NETIF_F_HW_MACSEC __NETIF_F(HW_MACSEC)
157 160
158/* Finds the next feature with the highest number of the range of start till 0.161/* Finds the next feature with the highest number of the range of start till 0.
159 */162 */
include/linux/netdevice.h+16−6
@@ -53,6 +53,8 @@ struct netpoll_info; · 52 unmodified lines
53struct device;53struct device;
54struct phy_device;54struct phy_device;
55struct dsa_port;55struct dsa_port;
56struct macsec_context;
57struct macsec_ops;
56 58
57struct sfp_bus;59struct sfp_bus;
58/* 802.11 specific */60/* 802.11 specific */
@@ -664,7 +666,7 @@ static inline void netdev_queue_numa_node_write(struct netdev_queue *q, int node · 605 unmodified lines
664struct rps_map {666struct rps_map {
665 unsigned int len;667 unsigned int len;
666 struct rcu_head rcu;668 struct rcu_head rcu;
667 u16 cpus[0];669 u16 cpus[];
668};670};
669#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16)))671#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16)))
670 672
@@ -686,7 +688,7 @@ struct rps_dev_flow { · 15 unmodified lines
686struct rps_dev_flow_table {688struct rps_dev_flow_table {
687 unsigned int mask;689 unsigned int mask;
688 struct rcu_head rcu;690 struct rcu_head rcu;
689 struct rps_dev_flow flows[0];691 struct rps_dev_flow flows[];
690};692};
691#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \693#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
692 ((_num) * sizeof(struct rps_dev_flow)))694 ((_num) * sizeof(struct rps_dev_flow)))
@@ -704,7 +706,7 @@ struct rps_dev_flow_table { · 11 unmodified lines
704struct rps_sock_flow_table {706struct rps_sock_flow_table {
705 u32 mask;707 u32 mask;
706 708
707 u32 ents[0] ____cacheline_aligned_in_smp;709 u32 ents[] ____cacheline_aligned_in_smp;
708};710};
709#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (offsetof(struct rps_sock_flow_table, ents[_num]))711#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (offsetof(struct rps_sock_flow_table, ents[_num]))
710 712
@@ -767,7 +769,7 @@ struct xps_map { · 56 unmodified lines
767 unsigned int len;769 unsigned int len;
768 unsigned int alloc_len;770 unsigned int alloc_len;
769 struct rcu_head rcu;771 struct rcu_head rcu;
770 u16 queues[0];772 u16 queues[];
771};773};
772#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))774#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
773#define XPS_MIN_MAP_ALLOC ((L1_CACHE_ALIGN(offsetof(struct xps_map, queues[1])) \775#define XPS_MIN_MAP_ALLOC ((L1_CACHE_ALIGN(offsetof(struct xps_map, queues[1])) \
@@ -778,7 +780,7 @@ struct xps_map { · 4 unmodified lines
778 */780 */
779struct xps_dev_maps {781struct xps_dev_maps {
780 struct rcu_head rcu;782 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 */
782};784};
783 785
784#define XPS_CPU_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \786#define XPS_CPU_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \
@@ -853,6 +855,7 @@ enum tc_setup_type { · 68 unmodified lines
853 TC_SETUP_FT,855 TC_SETUP_FT,
854 TC_SETUP_QDISC_ETS,856 TC_SETUP_QDISC_ETS,
855 TC_SETUP_QDISC_TBF,857 TC_SETUP_QDISC_TBF,
858 TC_SETUP_QDISC_FIFO,
856};859};
857 860
858/* These structures hold the attributes of bpf state that are being passed861/* These structures hold the attributes of bpf state that are being passed
@@ -1818,6 +1821,8 @@ enum netdev_priv_flags { · 959 unmodified lines
1818 * that follow this device when it is moved1821 * that follow this device when it is moved
1819 * to another network namespace.1822 * to another network namespace.
1820 *1823 *
1824 * @macsec_ops: MACsec offloading ops
1825 *
1821 * FIXME: cleanup struct net_device such that network protocol info1826 * FIXME: cleanup struct net_device such that network protocol info
1822 * moves out.1827 * moves out.
1823 */1828 */
@@ -2112,6 +2117,11 @@ struct net_device { · 288 unmodified lines
2112 unsigned wol_enabled:1;2117 unsigned wol_enabled:1;
2113 2118
2114 struct list_head net_notifier_list;2119 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
2115};2125};
2116#define to_net_dev(d) container_of(d, struct net_device, dev)2126#define to_net_dev(d) container_of(d, struct net_device, dev)
2117 2127
@@ -3767,7 +3777,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, · 1649 unmodified lines
3767 3777
3768typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf);3778typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf);
3769int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,3779int 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);
3771u32 __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op,3781u32 __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op,
3772 enum bpf_netdev_command cmd);3782 enum bpf_netdev_command cmd);
3773int xdp_umem_query(struct net_device *dev, u16 queue_id);3783int 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
98 98
99struct ip_set_comment_rcu {99struct ip_set_comment_rcu {
100 struct rcu_head rcu;100 struct rcu_head rcu;
101 char str[0];101 char str[];
102};102};
103 103
104struct ip_set_comment {104struct ip_set_comment {
include/linux/netfilter/x_tables.h+4−4
@@ -264,7 +264,7 @@ struct xt_table_info { · 263 unmodified lines
264 unsigned int stacksize;264 unsigned int stacksize;
265 void ***jumpstack;265 void ***jumpstack;
266 266
267 unsigned char entries[0] __aligned(8);267 unsigned char entries[] __aligned(8);
268};268};
269 269
270int xt_register_target(struct xt_target *target);270int xt_register_target(struct xt_target *target);
@@ -464,7 +464,7 @@ struct compat_xt_entry_match { · 193 unmodified lines
464 } kernel;464 } kernel;
465 u_int16_t match_size;465 u_int16_t match_size;
466 } u;466 } u;
467 unsigned char data[0];467 unsigned char data[];
468};468};
469 469
470struct compat_xt_entry_target {470struct compat_xt_entry_target {
@@ -480,7 +480,7 @@ struct compat_xt_entry_target { · 9 unmodified lines
480 } kernel;480 } kernel;
481 u_int16_t target_size;481 u_int16_t target_size;
482 } u;482 } u;
483 unsigned char data[0];483 unsigned char data[];
484};484};
485 485
486/* FIXME: this works only on 32 bit tasks486/* FIXME: this works only on 32 bit tasks
@@ -494,7 +494,7 @@ struct compat_xt_counters { · 7 unmodified lines
494struct compat_xt_counters_info {494struct compat_xt_counters_info {
495 char name[XT_TABLE_MAXNAMELEN];495 char name[XT_TABLE_MAXNAMELEN];
496 compat_uint_t num_counters;496 compat_uint_t num_counters;
497 struct compat_xt_counters counters[0];497 struct compat_xt_counters counters[];
498};498};
499 499
500struct _compat_xt_align {500struct _compat_xt_align {
include/linux/netfilter_arp/arp_tables.h+1−1
@@ -67,7 +67,7 @@ struct compat_arpt_entry { · 66 unmodified lines
67 __u16 next_offset;67 __u16 next_offset;
68 compat_uint_t comefrom;68 compat_uint_t comefrom;
69 struct compat_xt_counters counters;69 struct compat_xt_counters counters;
70 unsigned char elems[0];70 unsigned char elems[];
71};71};
72 72
73static inline struct xt_entry_target *73static inline struct xt_entry_target *
include/linux/netfilter_bridge/ebtables.h+1−1
@@ -85,7 +85,7 @@ struct ebt_table_info { · 84 unmodified lines
85 /* room to maintain the stack used for jumping from and into udc */85 /* room to maintain the stack used for jumping from and into udc */
86 struct ebt_chainstack **chainstack;86 struct ebt_chainstack **chainstack;
87 char *entries;87 char *entries;
88 struct ebt_counter counters[0] ____cacheline_aligned;88 struct ebt_counter counters[] ____cacheline_aligned;
89};89};
90 90
91struct ebt_table {91struct ebt_table {
include/linux/netfilter_ipv4/ip_tables.h+1−1
@@ -76,7 +76,7 @@ struct compat_ipt_entry { · 75 unmodified lines
76 __u16 next_offset;76 __u16 next_offset;
77 compat_uint_t comefrom;77 compat_uint_t comefrom;
78 struct compat_xt_counters counters;78 struct compat_xt_counters counters;
79 unsigned char elems[0];79 unsigned char elems[];
80};80};
81 81
82/* Helper functions */82/* Helper functions */
include/linux/netfilter_ipv6/ip6_tables.h+1−1
@@ -43,7 +43,7 @@ struct compat_ip6t_entry { · 42 unmodified lines
43 __u16 next_offset;43 __u16 next_offset;
44 compat_uint_t comefrom;44 compat_uint_t comefrom;
45 struct compat_xt_counters counters;45 struct compat_xt_counters counters;
46 unsigned char elems[0];46 unsigned char elems[];
47};47};
48 48
49static inline struct xt_entry_target *49static 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
115{115{
116 u64 __cookie = cookie;116 u64 __cookie = cookie;
117 117
118 if (!extack)
119 return;
120 memcpy(extack->cookie, &__cookie, sizeof(__cookie));
121 extack->cookie_len = sizeof(__cookie);
122}
123
124static 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;
118 memcpy(extack->cookie, &__cookie, sizeof(__cookie));131 memcpy(extack->cookie, &__cookie, sizeof(__cookie));
119 extack->cookie_len = sizeof(__cookie);132 extack->cookie_len = sizeof(__cookie);
120}133}
@@ -188,10 +201,10 @@ struct netlink_callback { · 67 unmodified lines
188 struct module *module;201 struct module *module;
189 struct netlink_ext_ack *extack;202 struct netlink_ext_ack *extack;
190 u16 family;203 u16 family;
191 u16 min_dump_alloc;
192 bool strict_check;
193 u16 answer_flags;204 u16 answer_flags;
205 u32 min_dump_alloc;
194 unsigned int prev_seq, seq;206 unsigned int prev_seq, seq;
207 bool strict_check;
195 union {208 union {
196 u8 ctx[48];209 u8 ctx[48];
197 210
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
354extern int nfs_sync_mapping(struct address_space *mapping);354extern int nfs_sync_mapping(struct address_space *mapping);
355extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);355extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
356extern void nfs_zap_caches(struct inode *);356extern void nfs_zap_caches(struct inode *);
357extern void nfs_set_inode_stale(struct inode *inode);
357extern void nfs_invalidate_atime(struct inode *);358extern void nfs_invalidate_atime(struct inode *);
358extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,359extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
359 struct nfs_fattr *, struct nfs4_label *);360 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
139extern int nfs_wait_on_request(struct nfs_page *);139extern int nfs_wait_on_request(struct nfs_page *);
140extern void nfs_unlock_request(struct nfs_page *req);140extern void nfs_unlock_request(struct nfs_page *req);
141extern void nfs_unlock_and_release_request(struct nfs_page *);141extern void nfs_unlock_and_release_request(struct nfs_page *);
142extern struct nfs_page *nfs_page_group_lock_head(struct nfs_page *req);
143extern int nfs_page_group_lock_subrequests(struct nfs_page *head);
144extern void nfs_join_page_group(struct nfs_page *head, struct inode *inode);
142extern int nfs_page_group_lock(struct nfs_page *);145extern int nfs_page_group_lock(struct nfs_page *);
143extern void nfs_page_group_unlock(struct nfs_page *);146extern void nfs_page_group_unlock(struct nfs_page *);
144extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);147extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
148extern int nfs_page_set_headlock(struct nfs_page *req);
149extern void nfs_page_clear_headlock(struct nfs_page *req);
145extern bool nfs_async_iocounter_wait(struct rpc_task *, struct nfs_lock_context *);150extern bool nfs_async_iocounter_wait(struct rpc_task *, struct nfs_lock_context *);
146 151
147/*152/*
include/linux/nfs_xdr.h+16−17
@@ -75,6 +75,7 @@ struct nfs_fattr { · 74 unmodified lines
75 struct nfs4_string *owner_name;75 struct nfs4_string *owner_name;
76 struct nfs4_string *group_name;76 struct nfs4_string *group_name;
77 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */77 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
78 struct nfs4_label *label;
78};79};
79 80
80#define NFS_ATTR_FATTR_TYPE (1U << 0)81#define NFS_ATTR_FATTR_TYPE (1U << 0)
@@ -1265,16 +1266,25 @@ struct nfstime4 { · 1184 unmodified lines
1265struct pnfs_commit_bucket {1266struct pnfs_commit_bucket {
1266 struct list_head written;1267 struct list_head written;
1267 struct list_head committing;1268 struct list_head committing;
1268 struct pnfs_layout_segment *wlseg;1269 struct pnfs_layout_segment *lseg;
1269 struct pnfs_layout_segment *clseg;
1270 struct nfs_writeverf direct_verf;1270 struct nfs_writeverf direct_verf;
1271};1271};
1272 1272
1273struct 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
1273struct pnfs_ds_commit_info {1283struct pnfs_ds_commit_info {
1274 int nwritten;1284 struct list_head commits;
1275 int ncommitting;1285 unsigned int nwritten;
1276 int nbuckets;1286 unsigned int ncommitting;
1277 struct pnfs_commit_bucket *buckets;1287 const struct pnfs_commit_ops *ops;
1278};1288};
1279 1289
1280struct nfs41_state_protection {1290struct nfs41_state_protection {
@@ -1385,22 +1395,11 @@ struct nfs41_free_stateid_res { · 104 unmodified lines
1385 unsigned int status;1395 unsigned int status;
1386};1396};
1387 1397
1388static inline void
1389nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1390{
1391 kfree(cinfo->buckets);
1392}
1393
1394#else1398#else
1395 1399
1396struct pnfs_ds_commit_info {1400struct pnfs_ds_commit_info {
1397};1401};
1398 1402
1399static inline void
1400nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1401{
1402}
1403
1404#endif /* CONFIG_NFS_V4_1 */1403#endif /* CONFIG_NFS_V4_1 */
1405 1404
1406#ifdef CONFIG_NFS_V4_21405#ifdef CONFIG_NFS_V4_2
include/linux/numa.h+29−1
@@ -1,7 +1,7 @@
1/* SPDX-License-Identifier: GPL-2.0 */1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_NUMA_H2#ifndef _LINUX_NUMA_H
3#define _LINUX_NUMA_H3#define _LINUX_NUMA_H
4 4#include <linux/types.h>
5 5
6#ifdef CONFIG_NODES_SHIFT6#ifdef CONFIG_NODES_SHIFT
7#define NODES_SHIFT CONFIG_NODES_SHIFT7#define NODES_SHIFT CONFIG_NODES_SHIFT
@@ -13,4 +13,32 @@ · 5 unmodified lines
13 13
14#define NUMA_NO_NODE (-1)14#define NUMA_NO_NODE (-1)
15 15
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 */
25int numa_map_to_online_node(int node);
26
27/*
28 * Optional architecture specific implementation, users need a "depends
29 * on $ARCH"
30 */
31int phys_to_target_node(phys_addr_t addr);
32#else
33static inline int numa_map_to_online_node(int node)
34{
35 return NUMA_NO_NODE;
36}
37
38static inline int phys_to_target_node(phys_addr_t addr)
39{
40 return NUMA_NO_NODE;
41}
42#endif
43
16#endif /* _LINUX_NUMA_H */44#endif /* _LINUX_NUMA_H */
include/linux/nvme-fc-driver.h+0−4
@@ -270,8 +270,6 @@ struct nvme_fc_remote_port { · 269 unmodified lines
270 *270 *
271 * Host/Initiator Transport Entrypoints/Parameters:271 * Host/Initiator Transport Entrypoints/Parameters:
272 *272 *
273 * @module: The LLDD module using the interface
274 *
275 * @localport_delete: The LLDD initiates deletion of a localport via273 * @localport_delete: The LLDD initiates deletion of a localport via
276 * nvme_fc_deregister_localport(). However, the teardown is274 * nvme_fc_deregister_localport(). However, the teardown is
277 * asynchronous. This routine is called upon the completion of the275 * asynchronous. This routine is called upon the completion of the
@@ -385,8 +383,6 @@ struct nvme_fc_remote_port { · 107 unmodified lines
385 * Value is Mandatory. Allowed to be zero.383 * Value is Mandatory. Allowed to be zero.
386 */384 */
387struct nvme_fc_port_template {385struct nvme_fc_port_template {
388 struct module *module;
389
390 /* initiator-based functions */386 /* initiator-based functions */
391 void (*localport_delete)(struct nvme_fc_local_port *);387 void (*localport_delete)(struct nvme_fc_local_port *);
392 void (*remoteport_delete)(struct nvme_fc_remote_port *);388 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
63int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len);63int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len);
64int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val);64int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val);
65int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val);65int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val);
66int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val);
66 67
67/* direct nvmem device read/write interface */68/* direct nvmem device read/write interface */
68struct nvmem_device *nvmem_device_get(struct device *dev, const char *name);69struct 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
138 return -EOPNOTSUPP;139 return -EOPNOTSUPP;
139}140}
140 141
142static inline int nvmem_cell_read_u64(struct device *dev,
143 const char *cell_id, u64 *val)
144{
145 return -EOPNOTSUPP;
146}
147
141static inline struct nvmem_device *nvmem_device_get(struct device *dev,148static inline struct nvmem_device *nvmem_device_get(struct device *dev,
142 const char *name)149 const char *name)
143{150{
include/linux/of_address.h+9−4
@@ -10,21 +10,27 @@ struct of_pci_range_parser { · 9 unmodified lines
10 struct device_node *node;10 struct device_node *node;
11 const __be32 *range;11 const __be32 *range;
12 const __be32 *end;12 const __be32 *end;
13 int np;13 int na;
14 int ns;
14 int pna;15 int pna;
15 bool dma;16 bool dma;
16};17};
18#define of_range_parser of_pci_range_parser
17 19
18struct of_pci_range {20struct of_pci_range {
19 u32 pci_space;21 union {
20 u64 pci_addr;22 u64 pci_addr;
23 u64 bus_addr;
24 };
21 u64 cpu_addr;25 u64 cpu_addr;
22 u64 size;26 u64 size;
23 u32 flags;27 u32 flags;
24};28};
29#define of_range of_pci_range
25 30
26#define for_each_of_pci_range(parser, range) \31#define for_each_of_pci_range(parser, range) \
27 for (; of_pci_range_parser_one(parser, range);)32 for (; of_pci_range_parser_one(parser, range);)
33#define for_each_of_range for_each_of_pci_range
28 34
29/* Translate a DMA address from device space to CPU space */35/* Translate a DMA address from device space to CPU space */
30extern u64 of_translate_dma_address(struct device_node *dev,36extern 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
143#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */149#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
144 150
145#endif /* __OF_ADDRESS_H */151#endif /* __OF_ADDRESS_H */
146
include/linux/of_clk.h+4−4
@@ -11,17 +11,17 @@ struct of_device_id; · 10 unmodified lines
11 11
12#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF)12#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF)
13 13
14unsigned int of_clk_get_parent_count(struct device_node *np);14unsigned int of_clk_get_parent_count(const struct device_node *np);
15const char *of_clk_get_parent_name(struct device_node *np, int index);15const char *of_clk_get_parent_name(const struct device_node *np, int index);
16void of_clk_init(const struct of_device_id *matches);16void of_clk_init(const struct of_device_id *matches);
17 17
18#else /* !CONFIG_COMMON_CLK || !CONFIG_OF */18#else /* !CONFIG_COMMON_CLK || !CONFIG_OF */
19 19
20static inline unsigned int of_clk_get_parent_count(struct device_node *np)20static inline unsigned int of_clk_get_parent_count(const struct device_node *np)
21{21{
22 return 0;22 return 0;
23}23}
24static inline const char *of_clk_get_parent_name(struct device_node *np,24static inline const char *of_clk_get_parent_name(const struct device_node *np,
25 int index)25 int index)
26{26{
27 return NULL;27 return NULL;
include/linux/of_gpio.h+6−3
@@ -11,9 +11,8 @@ · 10 unmodified lines
11#define __LINUX_OF_GPIO_H11#define __LINUX_OF_GPIO_H
12 12
13#include <linux/compiler.h>13#include <linux/compiler.h>
14#include <linux/kernel.h>14#include <linux/gpio/driver.h>
15#include <linux/errno.h>15#include <linux/gpio.h> /* FIXME: Shouldn't be here */
16#include <linux/gpio.h>
17#include <linux/of.h>16#include <linux/of.h>
18 17
19struct device_node;18struct device_node;
@@ -34,6 +33,8 @@ enum of_gpio_flags { · 14 unmodified lines
34 33
35#ifdef CONFIG_OF_GPIO34#ifdef CONFIG_OF_GPIO
36 35
36#include <linux/kernel.h>
37
37/*38/*
38 * OF GPIO chip for memory mapped banks39 * OF GPIO chip for memory mapped banks
39 */40 */
@@ -63,6 +64,8 @@ extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc); · 23 unmodified lines
63 64
64#else /* CONFIG_OF_GPIO */65#else /* CONFIG_OF_GPIO */
65 66
67#include <linux/errno.h>
68
66/* Drivers may not strictly depend on the GPIO support, so let them link. */69/* Drivers may not strictly depend on the GPIO support, so let them link. */
67static inline int of_get_named_gpio_flags(struct device_node *np,70static inline int of_get_named_gpio_flags(struct device_node *np,
68 const char *list_name, int index, enum of_gpio_flags *flags)71 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
63 * page_waitqueue(page) is a wait queue of all tasks waiting for the page63 * page_waitqueue(page) is a wait queue of all tasks waiting for the page
64 * to become unlocked.64 * to become unlocked.
65 *65 *
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 *
66 * PG_uptodate tells whether the page's contents is valid. When a read71 * PG_uptodate tells whether the page's contents is valid. When a read
67 * completes, the page becomes uptodate, unless a disk I/O error happened.72 * completes, the page becomes uptodate, unless a disk I/O error happened.
68 *73 *
@@ -163,6 +168,9 @@ enum pageflags { · 94 unmodified lines
163 168
164 /* non-lru isolated movable page */169 /* non-lru isolated movable page */
165 PG_isolated = PG_reclaim,170 PG_isolated = PG_reclaim,
171
172 /* Only valid for buddy pages. Used to track pages that are reported */
173 PG_reported = PG_uptodate,
166};174};
167 175
168#ifndef __GENERATING_BOUNDS_H176#ifndef __GENERATING_BOUNDS_H
@@ -311,7 +319,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } · 142 unmodified lines
311 319
312__PAGEFLAG(Locked, locked, PF_NO_TAIL)320__PAGEFLAG(Locked, locked, PF_NO_TAIL)
313PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD)321PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD)
314PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, PF_NO_COMPOUND)322PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL)
315PAGEFLAG(Referenced, referenced, PF_HEAD)323PAGEFLAG(Referenced, referenced, PF_HEAD)
316 TESTCLEARFLAG(Referenced, referenced, PF_HEAD)324 TESTCLEARFLAG(Referenced, referenced, PF_HEAD)
317 __SETPAGEFLAG(Referenced, referenced, PF_HEAD)325 __SETPAGEFLAG(Referenced, referenced, PF_HEAD)
@@ -431,6 +439,14 @@ TESTCLEARFLAG(Young, young, PF_ANY) · 113 unmodified lines
431PAGEFLAG(Idle, idle, PF_ANY)439PAGEFLAG(Idle, idle, PF_ANY)
432#endif440#endif
433 441
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
434/*450/*
435 * On an anonymous page mapped into a user virtual memory area,451 * On an anonymous page mapped into a user virtual memory area,
436 * page->mapping points to its anon_vma, not to a struct address_space;452 * 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
102 __page_ref_mod(page, -nr);102 __page_ref_mod(page, -nr);
103}103}
104 104
105static 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
105static inline void page_ref_inc(struct page *page)114static inline void page_ref_inc(struct page *page)
106{115{
107 atomic_inc(&page->_refcount);116 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
11struct 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 */
24void page_reporting_unregister(struct page_reporting_dev_info *prdev);
25int 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
33 33
34/**34/**
35 * mapping_set_error - record a writeback error in the address_space35 * mapping_set_error - record a writeback error in the address_space
36 * @mapping - the mapping in which an error should be set36 * @mapping: the mapping in which an error should be set
37 * @error - the error to set in the mapping37 * @error: the error to set in the mapping
38 *38 *
39 * When writeback fails in some way, we must record that error so that39 * When writeback fails in some way, we must record that error so that
40 * userspace can be informed when fsync and the like are called. We endeavor40 * 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
70 clear_bit(AS_UNEVICTABLE, &mapping->flags);70 clear_bit(AS_UNEVICTABLE, &mapping->flags);
71}71}
72 72
73static inline int mapping_unevictable(struct address_space *mapping)73static inline bool mapping_unevictable(struct address_space *mapping)
74{74{
75 if (mapping)75 return mapping && test_bit(AS_UNEVICTABLE, &mapping->flags);
76 return test_bit(AS_UNEVICTABLE, &mapping->flags);
77 return !!mapping;
78}76}
79 77
80static inline void mapping_set_exiting(struct address_space *mapping)78static 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
305 * atomic allocation!303 * atomic allocation!
306 */304 */
307static inline struct page *find_or_create_page(struct address_space *mapping,305static 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)
309{307{
310 return pagecache_get_page(mapping, offset,308 return pagecache_get_page(mapping, index,
311 FGP_LOCK|FGP_ACCESSED|FGP_CREAT,309 FGP_LOCK|FGP_ACCESSED|FGP_CREAT,
312 gfp_mask);310 gfp_mask);
313}311}
@@ -333,14 +331,17 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, · 19 unmodified lines
333 mapping_gfp_mask(mapping));331 mapping_gfp_mask(mapping));
334}332}
335 333
336static 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 */
338static inline struct page *find_subpage(struct page *head, pgoff_t index)
337{339{
338 if (PageHuge(page))340 /* HugeTLBfs wants the head page regardless */
339 return page;341 if (PageHuge(head))
340 342 return head;
341 VM_BUG_ON_PAGE(PageTail(page), page);
342 343
343 return page + (offset & (compound_nr(page) - 1));344 return head + (index & (hpage_nr_pages(head) - 1));
344}345}
345 346
346struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);347struct 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
38static 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
47static 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
55static 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
68static inline void part_stat_set_all(struct hd_struct *part, int value)
69{
70 memset(&part->dkstats, value, sizeof(struct disk_stats));
71}
72
73static inline int init_part_stats(struct hd_struct *part)
74{
75 return 1;
76}
77
78static 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
112#define RESET_DELAY_DSM 0x08112#define RESET_DELAY_DSM 0x08
113#define FUNCTION_DELAY_DSM 0x09113#define FUNCTION_DELAY_DSM 0x09
114 114
115#ifdef CONFIG_PCIE_EDR
116void pci_acpi_add_edr_notifier(struct pci_dev *pdev);
117void pci_acpi_remove_edr_notifier(struct pci_dev *pdev);
118#else
119static inline void pci_acpi_add_edr_notifier(struct pci_dev *pdev) { }
120static inline void pci_acpi_remove_edr_notifier(struct pci_dev *pdev) { }
121#endif /* CONFIG_PCIE_EDR */
122
115#else /* CONFIG_ACPI */123#else /* CONFIG_ACPI */
116static inline void acpi_pci_add_bus(struct pci_bus *bus) { }124static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
117static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }125static 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
53 phys_addr_t addr);53 phys_addr_t addr);
54 int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts);54 int (*set_msi)(struct pci_epc *epc, u8 func_no, u8 interrupts);
55 int (*get_msi)(struct pci_epc *epc, u8 func_no);55 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);
57 int (*get_msix)(struct pci_epc *epc, u8 func_no);58 int (*get_msix)(struct pci_epc *epc, u8 func_no);
58 int (*raise_irq)(struct pci_epc *epc, u8 func_no,59 int (*raise_irq)(struct pci_epc *epc, u8 func_no,
59 enum pci_epc_irq_type type, u16 interrupt_num);60 enum pci_epc_irq_type type, u16 interrupt_num);
@@ -71,6 +72,7 @@ struct pci_epc_ops { · 11 unmodified lines
71 * @bitmap: bitmap to manage the PCI address space72 * @bitmap: bitmap to manage the PCI address space
72 * @pages: number of bits representing the address region73 * @pages: number of bits representing the address region
73 * @page_size: size of each page74 * @page_size: size of each page
75 * @lock: mutex to protect bitmap
74 */76 */
75struct pci_epc_mem {77struct pci_epc_mem {
76 phys_addr_t phys_base;78 phys_addr_t phys_base;
@@ -78,6 +80,8 @@ struct pci_epc_mem { · 1 unmodified line
78 unsigned long *bitmap;80 unsigned long *bitmap;
79 size_t page_size;81 size_t page_size;
80 int pages;82 int pages;
83 /* mutex to protect against concurrent access for memory allocation*/
84 struct mutex lock;
81};85};
82 86
83/**87/**
@@ -88,7 +92,9 @@ struct pci_epc_mem { · 4 unmodified lines
88 * @mem: address space of the endpoint controller92 * @mem: address space of the endpoint controller
89 * @max_functions: max number of functions that can be configured in this EPC93 * @max_functions: max number of functions that can be configured in this EPC
90 * @group: configfs group representing the PCI EPC device94 * @group: configfs group representing the PCI EPC device
91 * @lock: spinlock to protect pci_epc ops95 * @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)
92 */98 */
93struct pci_epc {99struct pci_epc {
94 struct device dev;100 struct device dev;
@@ -97,8 +103,10 @@ struct pci_epc { · 2 unmodified lines
97 struct pci_epc_mem *mem;103 struct pci_epc_mem *mem;
98 u8 max_functions;104 u8 max_functions;
99 struct config_group *group;105 struct config_group *group;
100 /* spinlock to protect against concurrent access of EP controller */106 /* mutex to protect against concurrent access of EP controller */
101 spinlock_t lock;107 struct mutex lock;
108 unsigned long function_num_map;
109 struct atomic_notifier_head notifier;
102};110};
103 111
104/**112/**
@@ -113,6 +121,7 @@ struct pci_epc { · 8 unmodified lines
113 */121 */
114struct pci_epc_features {122struct pci_epc_features {
115 unsigned int linkup_notifier : 1;123 unsigned int linkup_notifier : 1;
124 unsigned int core_init_notifier : 1;
116 unsigned int msi_capable : 1;125 unsigned int msi_capable : 1;
117 unsigned int msix_capable : 1;126 unsigned int msix_capable : 1;
118 u8 reserved_bar;127 u8 reserved_bar;
@@ -141,6 +150,12 @@ static inline void *epc_get_drvdata(struct pci_epc *epc) · 22 unmodified lines
141 return dev_get_drvdata(&epc->dev);150 return dev_get_drvdata(&epc->dev);
142}151}
143 152
153static inline int
154pci_epc_register_notifier(struct pci_epc *epc, struct notifier_block *nb)
155{
156 return atomic_notifier_chain_register(&epc->notifier, nb);
157}
158
144struct pci_epc *159struct pci_epc *
145__devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,160__devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
146 struct module *owner);161 struct module *owner);
@@ -151,6 +166,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc); · 4 unmodified lines
151void pci_epc_destroy(struct pci_epc *epc);166void pci_epc_destroy(struct pci_epc *epc);
152int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf);167int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf);
153void pci_epc_linkup(struct pci_epc *epc);168void pci_epc_linkup(struct pci_epc *epc);
169void pci_epc_init_notify(struct pci_epc *epc);
154void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf);170void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf);
155int pci_epc_write_header(struct pci_epc *epc, u8 func_no,171int pci_epc_write_header(struct pci_epc *epc, u8 func_no,
156 struct pci_epf_header *hdr);172 struct pci_epf_header *hdr);
@@ -165,7 +181,8 @@ void pci_epc_unmap_addr(struct pci_epc *epc, u8 func_no, · 8 unmodified lines
165 phys_addr_t phys_addr);181 phys_addr_t phys_addr);
166int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts);182int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts);
167int pci_epc_get_msi(struct pci_epc *epc, u8 func_no);183int pci_epc_get_msi(struct pci_epc *epc, u8 func_no);
168int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts);184int pci_epc_set_msix(struct pci_epc *epc, u8 func_no, u16 interrupts,
185 enum pci_barno, u32 offset);
169int pci_epc_get_msix(struct pci_epc *epc, u8 func_no);186int pci_epc_get_msix(struct pci_epc *epc, u8 func_no);
170int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no,187int pci_epc_raise_irq(struct pci_epc *epc, u8 func_no,
171 enum pci_epc_irq_type type, u16 interrupt_num);188 enum pci_epc_irq_type type, u16 interrupt_num);
include/linux/pci-epf.h+25−4
@@ -15,6 +15,11 @@ · 14 unmodified lines
15 15
16struct pci_epf;16struct pci_epf;
17 17
18enum pci_notify_event {
19 CORE_INIT,
20 LINK_UP,
21};
22
18enum pci_barno {23enum pci_barno {
19 BAR_0,24 BAR_0,
20 BAR_1,25 BAR_1,
@@ -55,13 +60,10 @@ struct pci_epf_header { · 34 unmodified lines
55 * @bind: ops to perform when a EPC device has been bound to EPF device60 * @bind: ops to perform when a EPC device has been bound to EPF device
56 * @unbind: ops to perform when a binding has been lost between a EPC device61 * @unbind: ops to perform when a binding has been lost between a EPC device
57 * and EPF device62 * and EPF device
58 * @linkup: ops to perform when the EPC device has established a connection with
59 * a host system
60 */63 */
61struct pci_epf_ops {64struct pci_epf_ops {
62 int (*bind)(struct pci_epf *epf);65 int (*bind)(struct pci_epf *epf);
63 void (*unbind)(struct pci_epf *epf);66 void (*unbind)(struct pci_epf *epf);
64 void (*linkup)(struct pci_epf *epf);
65};67};
66 68
67/**69/**
@@ -92,10 +94,12 @@ struct pci_epf_driver { · 24 unmodified lines
92/**94/**
93 * struct pci_epf_bar - represents the BAR of EPF device95 * struct pci_epf_bar - represents the BAR of EPF device
94 * @phys_addr: physical address that should be mapped to the BAR96 * @phys_addr: physical address that should be mapped to the BAR
97 * @addr: virtual address corresponding to the @phys_addr
95 * @size: the size of the address space present in BAR98 * @size: the size of the address space present in BAR
96 */99 */
97struct pci_epf_bar {100struct pci_epf_bar {
98 dma_addr_t phys_addr;101 dma_addr_t phys_addr;
102 void *addr;
99 size_t size;103 size_t size;
100 enum pci_barno barno;104 enum pci_barno barno;
101 int flags;105 int flags;
@@ -112,6 +116,8 @@ struct pci_epf_bar { · 10 unmodified lines
112 * @epc: the EPC device to which this EPF device is bound116 * @epc: the EPC device to which this EPF device is bound
113 * @driver: the EPF driver to which this EPF device is bound117 * @driver: the EPF driver to which this EPF device is bound
114 * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc118 * @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
115 */121 */
116struct pci_epf {122struct pci_epf {
117 struct device dev;123 struct device dev;
@@ -125,6 +131,22 @@ struct pci_epf { · 7 unmodified lines
125 struct pci_epc *epc;131 struct pci_epc *epc;
126 struct pci_epf_driver *driver;132 struct pci_epf_driver *driver;
127 struct list_head list;133 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 */
146struct pci_epf_msix_tbl {
147 u64 msg_addr;
148 u32 msg_data;
149 u32 vector_ctrl;
128};150};
129 151
130#define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev)152#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
154void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);176void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);
155int pci_epf_bind(struct pci_epf *epf);177int pci_epf_bind(struct pci_epf *epf);
156void pci_epf_unbind(struct pci_epf *epf);178void pci_epf_unbind(struct pci_epf *epf);
157void pci_epf_linkup(struct pci_epf *epf);
158#endif /* __LINUX_PCI_EPF_H */179#endif /* __LINUX_PCI_EPF_H */
include/linux/pci.h+22−2
@@ -42,6 +42,13 @@ · 41 unmodified lines
42 42
43#include <linux/pci_ids.h>43#include <linux/pci_ids.h>
44 44
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
45/*52/*
46 * The PCI interface treats multi-function devices as independent53 * The PCI interface treats multi-function devices as independent
47 * devices. The slot/function address of each device is encoded54 * devices. The slot/function address of each device is encoded
@@ -236,7 +243,7 @@ enum pcie_link_width { · 188 unmodified lines
236 PCIE_LNK_WIDTH_UNKNOWN = 0xff,243 PCIE_LNK_WIDTH_UNKNOWN = 0xff,
237};244};
238 245
239/* Based on the PCI Hotplug Spec, but some values are made up by us */246/* See matching string table in pci_speed_string() */
240enum pci_bus_speed {247enum pci_bus_speed {
241 PCI_SPEED_33MHz = 0x00,248 PCI_SPEED_33MHz = 0x00,
242 PCI_SPEED_66MHz = 0x01,249 PCI_SPEED_66MHz = 0x01,
@@ -444,6 +451,11 @@ struct pci_dev { · 201 unmodified lines
444 const struct attribute_group **msi_irq_groups;451 const struct attribute_group **msi_irq_groups;
445#endif452#endif
446 struct pci_vpd *vpd;453 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
447#ifdef CONFIG_PCI_ATS459#ifdef CONFIG_PCI_ATS
448 union {460 union {
449 struct pci_sriov *sriov; /* PF: SR-IOV info */461 struct pci_sriov *sriov; /* PF: SR-IOV info */
@@ -510,7 +522,9 @@ struct pci_host_bridge { · 60 unmodified lines
510 unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */522 unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */
511 unsigned int native_pme:1; /* OS may use PCIe PME */523 unsigned int native_pme:1; /* OS may use PCIe PME */
512 unsigned int native_ltr:1; /* OS may use PCIe LTR */524 unsigned int native_ltr:1; /* OS may use PCIe LTR */
525 unsigned int native_dpc:1; /* OS may use PCIe DPC */
513 unsigned int preserve_config:1; /* Preserve FW resource setup */526 unsigned int preserve_config:1; /* Preserve FW resource setup */
527 unsigned int size_windows:1; /* Enable root bus sizing */
514 528
515 /* Resource alignment requirements */529 /* Resource alignment requirements */
516 resource_size_t (*align_resource)(struct pci_dev *dev,530 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
1045int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);1059int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
1046struct pci_bus *pci_find_next_bus(const struct pci_bus *from);1060struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
1047 1061
1062u64 pci_get_dsn(struct pci_dev *dev);
1063
1048struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,1064struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
1049 struct pci_dev *from);1065 struct pci_dev *from);
1050struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,1066struct 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
1203bool pci_device_is_present(struct pci_dev *pdev);1219bool pci_device_is_present(struct pci_dev *pdev);
1204void pci_ignore_hotplug(struct pci_dev *dev);1220void pci_ignore_hotplug(struct pci_dev *dev);
1205struct pci_dev *pci_real_dma_dev(struct pci_dev *dev);1221struct pci_dev *pci_real_dma_dev(struct pci_dev *dev);
1222int pci_status_get_and_clear_errors(struct pci_dev *pdev);
1206 1223
1207int __printf(6, 7) pci_request_irq(struct pci_dev *dev, unsigned int nr,1224int __printf(6, 7) pci_request_irq(struct pci_dev *dev, unsigned int nr,
1208 irq_handler_t handler, irq_handler_t thread_fn, void *dev_id,1225 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
1214void pci_disable_rom(struct pci_dev *pdev);1231void pci_disable_rom(struct pci_dev *pdev);
1215void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);1232void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
1216void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);1233void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
1217void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size);
1218 1234
1219/* Power management related routines */1235/* Power management related routines */
1220int pci_save_state(struct pci_dev *dev);1236int 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
1699static inline int pci_find_ext_capability(struct pci_dev *dev, int cap)1715static inline int pci_find_ext_capability(struct pci_dev *dev, int cap)
1700{ return 0; }1716{ return 0; }
1701 1717
1718static inline u64 pci_get_dsn(struct pci_dev *dev)
1719{ return 0; }
1720
1702/* Power management related routines */1721/* Power management related routines */
1703static inline int pci_save_state(struct pci_dev *dev) { return 0; }1722static inline int pci_save_state(struct pci_dev *dev) { return 0; }
1704static inline void pci_restore_state(struct pci_dev *dev) { }1723static 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
2171#define PCI_VPD_INFO_FLD_HDR_SIZE 32190#define PCI_VPD_INFO_FLD_HDR_SIZE 3
2172 2191
2173#define PCI_VPD_RO_KEYWORD_PARTNO "PN"2192#define PCI_VPD_RO_KEYWORD_PARTNO "PN"
2193#define PCI_VPD_RO_KEYWORD_SERIALNO "SN"
2174#define PCI_VPD_RO_KEYWORD_MFR_ID "MN"2194#define PCI_VPD_RO_KEYWORD_MFR_ID "MN"
2175#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0"2195#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0"
2176#define PCI_VPD_RO_KEYWORD_CHKSUM "RV"2196#define PCI_VPD_RO_KEYWORD_CHKSUM "RV"
include/linux/pci_ids.h+4−0
@@ -148,6 +148,8 @@ · 147 unmodified lines
148 148
149/* Vendors and devices. Sort key: vendor first, device next. */149/* Vendors and devices. Sort key: vendor first, device next. */
150 150
151#define PCI_VENDOR_ID_LOONGSON 0x0014
152
151#define PCI_VENDOR_ID_TTTECH 0x0357153#define PCI_VENDOR_ID_TTTECH 0x0357
152#define PCI_DEVICE_ID_TTTECH_MC322 0x000a154#define PCI_DEVICE_ID_TTTECH_MC322 0x000a
153 155
@@ -2583,6 +2585,8 @@ · 2429 unmodified lines
2583 2585
2584#define PCI_VENDOR_ID_AMAZON 0x1d0f2586#define PCI_VENDOR_ID_AMAZON 0x1d0f
2585 2587
2588#define PCI_VENDOR_ID_ZHAOXIN 0x1d17
2589
2586#define PCI_VENDOR_ID_HYGON 0x1d942590#define PCI_VENDOR_ID_HYGON 0x1d94
2587 2591
2588#define PCI_VENDOR_ID_HXT 0x1dbf2592#define PCI_VENDOR_ID_HXT 0x1dbf
include/linux/pe.h+21−0
@@ -10,6 +10,27 @@ · 9 unmodified lines
10 10
11#include <linux/types.h>11#include <linux/types.h>
12 12
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
13#define MZ_MAGIC 0x5a4d /* "MZ" */34#define MZ_MAGIC 0x5a4d /* "MZ" */
14 35
15#define PE_MAGIC 0x00004550 /* "PE\0\0" */36#define PE_MAGIC 0x00004550 /* "PE\0\0" */
include/linux/percpu-rwsem.h+49−34
@@ -3,41 +3,52 @@ · 2 unmodified lines
3#define _LINUX_PERCPU_RWSEM_H3#define _LINUX_PERCPU_RWSEM_H
4 4
5#include <linux/atomic.h>5#include <linux/atomic.h>
6#include <linux/rwsem.h>
7#include <linux/percpu.h>6#include <linux/percpu.h>
8#include <linux/rcuwait.h>7#include <linux/rcuwait.h>
8#include <linux/wait.h>
9#include <linux/rcu_sync.h>9#include <linux/rcu_sync.h>
10#include <linux/lockdep.h>10#include <linux/lockdep.h>
11 11
12struct percpu_rw_semaphore {12struct percpu_rw_semaphore {
13 struct rcu_sync rss;13 struct rcu_sync rss;
14 unsigned int __percpu *read_count;14 unsigned int __percpu *read_count;
15 struct rw_semaphore rw_sem; /* slowpath */15 struct rcuwait writer;
16 struct rcuwait writer; /* blocked writer */16 wait_queue_head_t waiters;
17 int readers_block;17 atomic_t block;
18#ifdef CONFIG_DEBUG_LOCK_ALLOC
19 struct lockdep_map dep_map;
20#endif
18};21};
19 22
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
20#define __DEFINE_PERCPU_RWSEM(name, is_static) \29#define __DEFINE_PERCPU_RWSEM(name, is_static) \
21static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_rc_##name); \30static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_rc_##name); \
22is_static struct percpu_rw_semaphore name = { \31is_static struct percpu_rw_semaphore name = { \
23 .rss = __RCU_SYNC_INITIALIZER(name.rss), \32 .rss = __RCU_SYNC_INITIALIZER(name.rss), \
24 .read_count = &__percpu_rwsem_rc_##name, \33 .read_count = &__percpu_rwsem_rc_##name, \
25 .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \
26 .writer = __RCUWAIT_INITIALIZER(name.writer), \34 .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) \
27}38}
39
28#define DEFINE_PERCPU_RWSEM(name) \40#define DEFINE_PERCPU_RWSEM(name) \
29 __DEFINE_PERCPU_RWSEM(name, /* not static */)41 __DEFINE_PERCPU_RWSEM(name, /* not static */)
30#define DEFINE_STATIC_PERCPU_RWSEM(name) \42#define DEFINE_STATIC_PERCPU_RWSEM(name) \
31 __DEFINE_PERCPU_RWSEM(name, static)43 __DEFINE_PERCPU_RWSEM(name, static)
32 44
33extern int __percpu_down_read(struct percpu_rw_semaphore *, int);45extern bool __percpu_down_read(struct percpu_rw_semaphore *, bool);
34extern void __percpu_up_read(struct percpu_rw_semaphore *);
35 46
36static inline void percpu_down_read(struct percpu_rw_semaphore *sem)47static inline void percpu_down_read(struct percpu_rw_semaphore *sem)
37{48{
38 might_sleep();49 might_sleep();
39 50
40 rwsem_acquire_read(&sem->rw_sem.dep_map, 0, 0, _RET_IP_);51 rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_);
41 52
42 preempt_disable();53 preempt_disable();
43 /*54 /*
@@ -48,8 +59,9 @@ static inline void percpu_down_read(struct percpu_rw_semaphore *sem) · 4 unmodified lines
48 * and that once the synchronize_rcu() is done, the writer will see59 * and that once the synchronize_rcu() is done, the writer will see
49 * anything we did within this RCU-sched read-size critical section.60 * anything we did within this RCU-sched read-size critical section.
50 */61 */
51 __this_cpu_inc(*sem->read_count);62 if (likely(rcu_sync_is_idle(&sem->rss)))
52 if (unlikely(!rcu_sync_is_idle(&sem->rss)))63 __this_cpu_inc(*sem->read_count);
64 else
53 __percpu_down_read(sem, false); /* Unconditional memory barrier */65 __percpu_down_read(sem, false); /* Unconditional memory barrier */
54 /*66 /*
55 * The preempt_enable() prevents the compiler from67 * 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
58 preempt_enable();70 preempt_enable();
59}71}
60 72
61static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem)73static inline bool percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
62{74{
63 int ret = 1;75 bool ret = true;
64 76
65 preempt_disable();77 preempt_disable();
66 /*78 /*
67 * Same as in percpu_down_read().79 * Same as in percpu_down_read().
68 */80 */
69 __this_cpu_inc(*sem->read_count);81 if (likely(rcu_sync_is_idle(&sem->rss)))
70 if (unlikely(!rcu_sync_is_idle(&sem->rss)))82 __this_cpu_inc(*sem->read_count);
83 else
71 ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */84 ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */
72 preempt_enable();85 preempt_enable();
73 /*86 /*
@@ -76,24 +89,36 @@ static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem) · 2 unmodified lines
76 */89 */
77 90
78 if (ret)91 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_);
80 93
81 return ret;94 return ret;
82}95}
83 96
84static inline void percpu_up_read(struct percpu_rw_semaphore *sem)97static inline void percpu_up_read(struct percpu_rw_semaphore *sem)
85{98{
99 rwsem_release(&sem->dep_map, _RET_IP_);
100
86 preempt_disable();101 preempt_disable();
87 /*102 /*
88 * Same as in percpu_down_read().103 * Same as in percpu_down_read().
89 */104 */
90 if (likely(rcu_sync_is_idle(&sem->rss)))105 if (likely(rcu_sync_is_idle(&sem->rss))) {
91 __this_cpu_dec(*sem->read_count);106 __this_cpu_dec(*sem->read_count);
92 else107 } else {
93 __percpu_up_read(sem); /* Unconditional memory barrier */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 }
94 preempt_enable();121 preempt_enable();
95
96 rwsem_release(&sem->rw_sem.dep_map, _RET_IP_);
97}122}
98 123
99extern void percpu_down_write(struct percpu_rw_semaphore *);124extern void percpu_down_write(struct percpu_rw_semaphore *);
@@ -110,29 +135,19 @@ extern void percpu_free_rwsem(struct percpu_rw_semaphore *); · 10 unmodified lines
110 __percpu_init_rwsem(sem, #sem, &rwsem_key); \135 __percpu_init_rwsem(sem, #sem, &rwsem_key); \
111})136})
112 137
113#define percpu_rwsem_is_held(sem) lockdep_is_held(&(sem)->rw_sem)138#define percpu_rwsem_is_held(sem) lockdep_is_held(sem)
114 139#define percpu_rwsem_assert_held(sem) lockdep_assert_held(sem)
115#define percpu_rwsem_assert_held(sem) \
116 lockdep_assert_held(&(sem)->rw_sem)
117 140
118static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem,141static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem,
119 bool read, unsigned long ip)142 bool read, unsigned long ip)
120{143{
121 lock_release(&sem->rw_sem.dep_map, ip);144 lock_release(&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
126}145}
127 146
128static inline void percpu_rwsem_acquire(struct percpu_rw_semaphore *sem,147static inline void percpu_rwsem_acquire(struct percpu_rw_semaphore *sem,
129 bool read, unsigned long ip)148 bool read, unsigned long ip)
130{149{
131 lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip);150 lock_acquire(&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
136}151}
137 152
138#endif153#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
78 */78 */
79static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)79static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)
80{80{
81 s64 ret = fbc->count;81 /* Prevent reloads of fbc->count */
82 s64 ret = READ_ONCE(fbc->count);
82 83
83 barrier(); /* Prevent reloads of fbc->count */
84 if (ret >= 0)84 if (ret >= 0)
85 return ret;85 return ret;
86 return 0;86 return 0;
include/linux/perf/arm_pmu.h+1−0
@@ -80,6 +80,7 @@ struct arm_pmu { · 79 unmodified lines
80 struct pmu pmu;80 struct pmu pmu;
81 cpumask_t supported_cpus;81 cpumask_t supported_cpus;
82 char *name;82 char *name;
83 int pmuver;
83 irqreturn_t (*handle_irq)(struct arm_pmu *pmu);84 irqreturn_t (*handle_irq)(struct arm_pmu *pmu);
84 void (*enable)(struct perf_event *event);85 void (*enable)(struct perf_event *event);
85 void (*disable)(struct perf_event *event);86 void (*disable)(struct perf_event *event);
include/linux/perf_event.h+20−0
@@ -93,14 +93,26 @@ struct perf_raw_record { · 92 unmodified lines
93/*93/*
94 * branch stack layout:94 * branch stack layout:
95 * nr: number of taken branches stored in entries[]95 * 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.
96 *99 *
97 * Note that nr can vary from sample to sample100 * Note that nr can vary from sample to sample
98 * branches (to, from) are stored from most recent101 * branches (to, from) are stored from most recent
99 * to least recent, i.e., entries[0] contains the most102 * to least recent, i.e., entries[0] contains the most
100 * recent branch.103 * 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.
101 */112 */
102struct perf_branch_stack {113struct perf_branch_stack {
103 __u64 nr;114 __u64 nr;
115 __u64 hw_idx;
104 struct perf_branch_entry entries[0];116 struct perf_branch_entry entries[0];
105};117};
106 118
@@ -850,6 +862,13 @@ struct perf_cpu_context { · 743 unmodified lines
850 int sched_cb_usage;862 int sched_cb_usage;
851 863
852 int online;864 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];
853};872};
854 873
855struct perf_output_handle {874struct perf_output_handle {
@@ -1001,6 +1020,7 @@ struct perf_sample_data { · 145 unmodified lines
1001 u64 stack_user_size;1020 u64 stack_user_size;
1002 1021
1003 u64 phys_addr;1022 u64 phys_addr;
1023 u64 cgroup;
1004} ____cacheline_aligned;1024} ____cacheline_aligned;
1005 1025
1006/* default value for data source */1026/* default value for data source */
include/linux/phy.h+61−1
@@ -23,6 +23,8 @@ · 22 unmodified lines
23#include <linux/workqueue.h>23#include <linux/workqueue.h>
24#include <linux/mod_devicetable.h>24#include <linux/mod_devicetable.h>
25#include <linux/u64_stats_sync.h>25#include <linux/u64_stats_sync.h>
26#include <linux/irqreturn.h>
27#include <linux/iopoll.h>
26 28
27#include <linux/atomic.h>29#include <linux/atomic.h>
28 30
@@ -94,6 +96,7 @@ typedef enum { · 65 unmodified lines
94 PHY_INTERFACE_MODE_RTBI,96 PHY_INTERFACE_MODE_RTBI,
95 PHY_INTERFACE_MODE_SMII,97 PHY_INTERFACE_MODE_SMII,
96 PHY_INTERFACE_MODE_XGMII,98 PHY_INTERFACE_MODE_XGMII,
99 PHY_INTERFACE_MODE_XLGMII,
97 PHY_INTERFACE_MODE_MOCA,100 PHY_INTERFACE_MODE_MOCA,
98 PHY_INTERFACE_MODE_QSGMII,101 PHY_INTERFACE_MODE_QSGMII,
99 PHY_INTERFACE_MODE_TRGMII,102 PHY_INTERFACE_MODE_TRGMII,
@@ -165,6 +168,8 @@ static inline const char *phy_modes(phy_interface_t interface) · 65 unmodified lines
165 return "smii";168 return "smii";
166 case PHY_INTERFACE_MODE_XGMII:169 case PHY_INTERFACE_MODE_XGMII:
167 return "xgmii";170 return "xgmii";
171 case PHY_INTERFACE_MODE_XLGMII:
172 return "xlgmii";
168 case PHY_INTERFACE_MODE_MOCA:173 case PHY_INTERFACE_MODE_MOCA:
169 return "moca";174 return "moca";
170 case PHY_INTERFACE_MODE_QSGMII:175 case PHY_INTERFACE_MODE_QSGMII:
@@ -289,6 +294,7 @@ static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev) · 118 unmodified lines
289 return devm_mdiobus_alloc_size(dev, 0);294 return devm_mdiobus_alloc_size(dev, 0);
290}295}
291 296
297struct mii_bus *mdio_find_bus(const char *mdio_name);
292void devm_mdiobus_free(struct device *dev, struct mii_bus *bus);298void devm_mdiobus_free(struct device *dev, struct mii_bus *bus);
293struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);299struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
294 300
@@ -357,8 +363,10 @@ struct macsec_ops; · 62 unmodified lines
357 * is_gigabit_capable: Set to true if PHY supports 1000Mbps363 * is_gigabit_capable: Set to true if PHY supports 1000Mbps
358 * has_fixups: Set to true if this phy has fixups/quirks.364 * has_fixups: Set to true if this phy has fixups/quirks.
359 * suspended: Set to true if this phy has been suspended successfully.365 * 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.
360 * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal.367 * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal.
361 * loopback_enabled: Set true if this phy has been loopbacked successfully.368 * loopback_enabled: Set true if this phy has been loopbacked successfully.
369 * downshifted_rate: Set true if link speed has been downshifted.
362 * state: state of the PHY for management purposes370 * state: state of the PHY for management purposes
363 * dev_flags: Device-specific flags used by the PHY driver.371 * dev_flags: Device-specific flags used by the PHY driver.
364 * irq: IRQ number of the PHY's interrupt (-1 if none)372 * irq: IRQ number of the PHY's interrupt (-1 if none)
@@ -396,8 +404,10 @@ struct phy_device { · 31 unmodified lines
396 unsigned is_gigabit_capable:1;404 unsigned is_gigabit_capable:1;
397 unsigned has_fixups:1;405 unsigned has_fixups:1;
398 unsigned suspended:1;406 unsigned suspended:1;
407 unsigned suspended_by_mdio_bus:1;
399 unsigned sysfs_links:1;408 unsigned sysfs_links:1;
400 unsigned loopback_enabled:1;409 unsigned loopback_enabled:1;
410 unsigned downshifted_rate:1;
401 411
402 unsigned autoneg:1;412 unsigned autoneg:1;
403 /* The most recently read link state */413 /* The most recently read link state */
@@ -557,11 +567,12 @@ struct phy_driver { · 153 unmodified lines
557 /*567 /*
558 * Checks if the PHY generated an interrupt.568 * Checks if the PHY generated an interrupt.
559 * For multi-PHY devices with shared PHY interrupt pin569 * For multi-PHY devices with shared PHY interrupt pin
570 * Set interrupt bits have to be cleared.
560 */571 */
561 int (*did_interrupt)(struct phy_device *phydev);572 int (*did_interrupt)(struct phy_device *phydev);
562 573
563 /* Override default interrupt handling */574 /* Override default interrupt handling */
564 int (*handle_interrupt)(struct phy_device *phydev);575 irqreturn_t (*handle_interrupt)(struct phy_device *phydev);
565 576
566 /* Clears up any memory if needed */577 /* Clears up any memory if needed */
567 void (*remove)(struct phy_device *phydev);578 void (*remove)(struct phy_device *phydev);
@@ -690,6 +701,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 122 unmodified lines
690 701
691void phy_resolve_aneg_pause(struct phy_device *phydev);702void phy_resolve_aneg_pause(struct phy_device *phydev);
692void phy_resolve_aneg_linkmode(struct phy_device *phydev);703void phy_resolve_aneg_linkmode(struct phy_device *phydev);
704void phy_check_downshift(struct phy_device *phydev);
693 705
694/**706/**
695 * phy_read - Convenience function for reading a given PHY register707 * 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
705 return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum);717 return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum);
706}718}
707 719
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
708/**733/**
709 * __phy_read - convenience function for reading a given PHY register734 * __phy_read - convenience function for reading a given PHY register
710 * @phydev: the phy_device struct735 * @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
746 val);771 val);
747}772}
748 773
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 */
786static 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
749/**793/**
750 * phy_read_mmd - Convenience function for reading a register794 * phy_read_mmd - Convenience function for reading a register
751 * from an MMD on a given PHY.795 * 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
757 */801 */
758int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);802int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
759 803
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
760/**817/**
761 * __phy_read_mmd - Convenience function for reading a register818 * __phy_read_mmd - Convenience function for reading a register
762 * from an MMD on a given PHY.819 * 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
1257void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);1314void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);
1258bool phy_validate_pause(struct phy_device *phydev,1315bool phy_validate_pause(struct phy_device *phydev,
1259 struct ethtool_pauseparam *pp);1316 struct ethtool_pauseparam *pp);
1317void phy_get_pause(struct phy_device *phydev, bool *tx_pause, bool *rx_pause);
1318void phy_resolve_pause(unsigned long *local_adv, unsigned long *partner_adv,
1319 bool *tx_pause, bool *rx_pause);
1260 1320
1261int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,1321int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
1262 int (*run)(struct phy_device *));1322 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
21int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl,21int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl,
22 bool val);22 bool val);
23int tegra_phy_xusb_utmi_port_reset(struct phy *phy);23int tegra_phy_xusb_utmi_port_reset(struct phy *phy);
24int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl,
25 unsigned int port);
24#endif /* PHY_TEGRA_XUSB_H */26#endif /* PHY_TEGRA_XUSB_H */
include/linux/phylink.h+157−25
@@ -12,12 +12,10 @@ struct net_device; · 11 unmodified lines
12 12
13enum {13enum {
14 MLO_PAUSE_NONE,14 MLO_PAUSE_NONE,
15 MLO_PAUSE_ASYM = BIT(0),15 MLO_PAUSE_RX = BIT(0),
16 MLO_PAUSE_SYM = BIT(1),16 MLO_PAUSE_TX = BIT(1),
17 MLO_PAUSE_RX = BIT(2),
18 MLO_PAUSE_TX = BIT(3),
19 MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX,17 MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX,
20 MLO_PAUSE_AN = BIT(4),18 MLO_PAUSE_AN = BIT(2),
21 19
22 MLO_AN_PHY = 0, /* Conventional PHY */20 MLO_AN_PHY = 0, /* Conventional PHY */
23 MLO_AN_FIXED, /* Fixed-link mode */21 MLO_AN_FIXED, /* Fixed-link mode */
@@ -93,9 +91,10 @@ struct phylink_mac_ops { · 69 unmodified lines
93 void (*mac_an_restart)(struct phylink_config *config);91 void (*mac_an_restart)(struct phylink_config *config);
94 void (*mac_link_down)(struct phylink_config *config, unsigned int mode,92 void (*mac_link_down)(struct phylink_config *config, unsigned int mode,
95 phy_interface_t interface);93 phy_interface_t interface);
96 void (*mac_link_up)(struct phylink_config *config, unsigned int mode,94 void (*mac_link_up)(struct phylink_config *config,
97 phy_interface_t interface,95 struct phy_device *phy, unsigned int mode,
98 struct phy_device *phy);96 phy_interface_t interface, int speed, int duplex,
97 bool tx_pause, bool rx_pause);
99};98};
100 99
101#if 0 /* For kernel-doc purposes only. */100#if 0 /* For kernel-doc purposes only. */
@@ -154,15 +153,33 @@ void mac_pcs_get_state(struct phylink_config *config, · 52 unmodified lines
154 * guaranteed to be correct, and so any mac_config() implementation must153 * guaranteed to be correct, and so any mac_config() implementation must
155 * never reference these fields.154 * never reference these fields.
156 *155 *
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 *
157 * The action performed depends on the currently selected mode:166 * The action performed depends on the currently selected mode:
158 *167 *
159 * %MLO_AN_FIXED, %MLO_AN_PHY:168 * %MLO_AN_FIXED, %MLO_AN_PHY:
160 * Configure the specified @state->speed, @state->duplex and169 * Configure for non-inband negotiation mode, where the link settings
161 * @state->pause (%MLO_PAUSE_TX / %MLO_PAUSE_RX) modes over a link170 * are completely communicated via mac_link_up(). The physical link
162 * specified by @state->interface. @state->advertising may be used,171 * protocol from the MAC is specified by @state->interface.
163 * but is not required. Other members of @state must be ignored.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().
164 *178 *
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.
166 *183 *
167 * %MLO_AN_INBAND:184 * %MLO_AN_INBAND:
168 * place the link in an inband negotiation mode (such as 802.3z185 * 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
172 * mac_pcs_get_state() callback. Changes in link state must be made189 * mac_pcs_get_state() callback. Changes in link state must be made
173 * by calling phylink_mac_change().190 * by calling phylink_mac_change().
174 *191 *
192 * Interface mode specific details are mentioned below.
193 *
175 * If in 802.3z mode, the link speed is fixed, dependent on the194 * If in 802.3z mode, the link speed is fixed, dependent on the
176 * @state->interface. Duplex is negotiated, and pause is advertised195 * @state->interface. Duplex and pause modes are negotiated via
177 * according to @state->an_enabled, @state->pause and196 * the in-band configuration word. Advertised pause modes are set
178 * @state->advertising flags. Beware of MACs which only support full197 * according to the @state->an_enabled and @state->advertising
179 * duplex at gigabit and higher speeds.198 * flags. Beware of MACs which only support full duplex at gigabit
199 * and higher speeds.
180 *200 *
181 * If in Cisco SGMII mode, the link speed and duplex mode are passed201 * If in Cisco SGMII mode, the link speed and duplex mode are passed
182 * in the serial bitstream 16-bit configuration word, and the MAC202 * 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
220/**240/**
221 * mac_link_up() - allow the link to come up241 * mac_link_up() - allow the link to come up
222 * @config: a pointer to a &struct phylink_config.242 * @config: a pointer to a &struct phylink_config.
243 * @phy: any attached phy
223 * @mode: link autonegotiation mode244 * @mode: link autonegotiation mode
224 * @interface: link &typedef phy_interface_t mode245 * @interface: link &typedef phy_interface_t mode
225 * @phy: any attached phy246 * @speed: link speed
247 * @duplex: link duplex
248 * @tx_pause: link transmit pause enablement status
249 * @rx_pause: link receive pause enablement status
226 *250 *
227 * If @mode is not an in-band negotiation mode (as defined by251 * Configure the MAC for an established link.
228 * phylink_autoneg_inband()), allow the link to come up. If @phy252 *
229 * is non-%NULL, configure Energy Efficient Ethernet by calling253 * @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
230 * phy_init_eee() and perform appropriate MAC configuration for EEE.265 * phy_init_eee() and perform appropriate MAC configuration for EEE.
231 * Interface type selection must be done in mac_config().266 * Interface type selection must be done in mac_config().
232 */267 */
233void mac_link_up(struct phylink_config *config, unsigned int mode,268void mac_link_up(struct phylink_config *config, struct phy_device *phy,
234 phy_interface_t interface,269 unsigned int mode, phy_interface_t interface,
235 struct phy_device *phy);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 */
281struct 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 */
308void 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 */
331int (*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 */
341void (*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 */
356void (*pcs_link_up)(struct phylink_config *config, unsigned int mode,
357 phy_interface_t interface, int speed, int duplex);
236#endif358#endif
237 359
238struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *,360struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *,
239 phy_interface_t iface,361 phy_interface_t iface,
240 const struct phylink_mac_ops *ops);362 const struct phylink_mac_ops *mac_ops);
363void phylink_add_pcs(struct phylink *, const struct phylink_pcs_ops *ops);
241void phylink_destroy(struct phylink *);364void phylink_destroy(struct phylink *);
242 365
243int phylink_connect_phy(struct phylink *, struct phy_device *);366int phylink_connect_phy(struct phylink *, struct phy_device *);
@@ -282,4 +405,13 @@ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int); · 38 unmodified lines
282void phylink_set_port_modes(unsigned long *bits);405void phylink_set_port_modes(unsigned long *bits);
283void phylink_helper_basex_speed(struct phylink_link_state *state);406void phylink_helper_basex_speed(struct phylink_link_state *state);
284 407
408void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,
409 struct phylink_link_state *state);
410int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs,
411 phy_interface_t interface,
412 const unsigned long *advertising);
413void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs);
414
415void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs,
416 struct phylink_link_state *state);
285#endif417#endif
include/linux/pid.h+2−0
@@ -60,8 +60,10 @@ struct pid · 59 unmodified lines
60{60{
61 refcount_t count;61 refcount_t count;
62 unsigned int level;62 unsigned int level;
63 spinlock_t lock;
63 /* lists of tasks that use this pid */64 /* lists of tasks that use this pid */
64 struct hlist_head tasks[PIDTYPE_MAX];65 struct hlist_head tasks[PIDTYPE_MAX];
66 struct hlist_head inodes;
65 /* wait queue for pidfd notifications */67 /* wait queue for pidfd notifications */
66 wait_queue_head_t wait_pidfd;68 wait_queue_head_t wait_pidfd;
67 struct rcu_head rcu;69 struct rcu_head rcu;
include/linux/pid_namespace.h+0−2
@@ -33,7 +33,6 @@ struct pid_namespace { · 32 unmodified lines
33 unsigned int level;33 unsigned int level;
34 struct pid_namespace *parent;34 struct pid_namespace *parent;
35#ifdef CONFIG_PROC_FS35#ifdef CONFIG_PROC_FS
36 struct vfsmount *proc_mnt;
37 struct dentry *proc_self;36 struct dentry *proc_self;
38 struct dentry *proc_thread_self;37 struct dentry *proc_thread_self;
39#endif38#endif
@@ -42,7 +41,6 @@ struct pid_namespace { · 2 unmodified lines
42#endif41#endif
43 struct user_namespace *user_ns;42 struct user_namespace *user_ns;
44 struct ucounts *ucounts;43 struct ucounts *ucounts;
45 struct work_struct proc_work;
46 kgid_t pid_gid;44 kgid_t pid_gid;
47 int hide_pid;45 int hide_pid;
48 int reboot; /* group exit code if this pidns was rebooted */46 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
186 const char *pin_group, const unsigned **pins,186 const char *pin_group, const unsigned **pins,
187 unsigned *num_pins);187 unsigned *num_pins);
188 188
189#ifdef CONFIG_OF189#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL)
190extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);190extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
191#else191#else
192static inline192static inline
include/linux/platform_data/cros_ec_proto.h+4−0
@@ -125,6 +125,9 @@ struct cros_ec_command { · 124 unmodified lines
125 * @host_event_wake_mask: Mask of host events that cause wake from suspend.125 * @host_event_wake_mask: Mask of host events that cause wake from suspend.
126 * @last_event_time: exact time from the hard irq when we got notified of126 * @last_event_time: exact time from the hard irq when we got notified of
127 * a new event.127 * 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.
128 * @ec: The platform_device used by the mfd driver to interface with the131 * @ec: The platform_device used by the mfd driver to interface with the
129 * main EC.132 * main EC.
130 * @pd: The platform_device used by the mfd driver to interface with the133 * @pd: The platform_device used by the mfd driver to interface with the
@@ -166,6 +169,7 @@ struct cros_ec_device { · 35 unmodified lines
166 u32 host_event_wake_mask;169 u32 host_event_wake_mask;
167 u32 last_resume_result;170 u32 last_resume_result;
168 ktime_t last_event_time;171 ktime_t last_event_time;
172 struct notifier_block notifier_ready;
169 173
170 /* The platform devices used by the mfd driver */174 /* The platform devices used by the mfd driver */
171 struct platform_device *ec;175 struct platform_device *ec;
include/linux/platform_data/cros_ec_sensorhub.h+163−0
@@ -8,8 +8,13 @@ · 7 unmodified lines
8#ifndef __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H8#ifndef __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H
9#define __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H9#define __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H
10 10
11#include <linux/ktime.h>
12#include <linux/mutex.h>
13#include <linux/notifier.h>
11#include <linux/platform_data/cros_ec_commands.h>14#include <linux/platform_data/cros_ec_commands.h>
12 15
16struct iio_dev;
17
13/**18/**
14 * struct cros_ec_sensor_platform - ChromeOS EC sensor platform information.19 * struct cros_ec_sensor_platform - ChromeOS EC sensor platform information.
15 * @sensor_num: Id of the sensor, as reported by the EC.20 * @sensor_num: Id of the sensor, as reported by the EC.
@@ -19,12 +24,170 @@ struct cros_ec_sensor_platform { · 3 unmodified lines
19};24};
20 25
21/**26/**
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 */
35typedef int (*cros_ec_sensorhub_push_data_cb_t)(struct iio_dev *indio_dev,
36 s16 *data,
37 s64 timestamp);
38
39struct 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
44enum {
45 CROS_EC_SENSOR_LAST_TS,
46 CROS_EC_SENSOR_NEW_TS,
47 CROS_EC_SENSOR_ALL_TS
48};
49
50struct 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 */
58struct 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 */
81struct 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 */
106struct 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/*
22 * struct cros_ec_sensorhub - Sensor Hub device data.115 * struct cros_ec_sensorhub - Sensor Hub device data.
23 *116 *
117 * @dev: Device object, mostly used for logging.
24 * @ec: Embedded Controller where the hub is located.118 * @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.
25 */146 */
26struct cros_ec_sensorhub {147struct cros_ec_sensorhub {
148 struct device *dev;
27 struct cros_ec_dev *ec;149 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;
28};178};
29 179
180int 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
185void cros_ec_sensorhub_unregister_push_data(struct cros_ec_sensorhub *sensorhub,
186 u8 sensor_num);
187
188int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub);
189void cros_ec_sensorhub_ring_remove(void *arg);
190int cros_ec_sensorhub_ring_fifo_enable(struct cros_ec_sensorhub *sensorhub,
191 bool on);
192
30#endif /* __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H */193#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
13int cros_usbpd_register_notify(struct notifier_block *nb);
14
15void 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
30 int (*stop)(struct omap_dm_timer *timer);30 int (*stop)(struct omap_dm_timer *timer);
31 int (*set_source)(struct omap_dm_timer *timer, int source);31 int (*set_source)(struct omap_dm_timer *timer, int source);
32 32
33 int (*set_load)(struct omap_dm_timer *timer, int autoreload,33 int (*set_load)(struct omap_dm_timer *timer, unsigned int value);
34 unsigned int value);
35 int (*set_match)(struct omap_dm_timer *timer, int enable,34 int (*set_match)(struct omap_dm_timer *timer, int enable,
36 unsigned int match);35 unsigned int match);
37 int (*set_pwm)(struct omap_dm_timer *timer, int def_on,36 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);
39 int (*set_prescaler)(struct omap_dm_timer *timer, int prescaler);39 int (*set_prescaler)(struct omap_dm_timer *timer, int prescaler);
40 40
41 unsigned int (*read_counter)(struct omap_dm_timer *timer);41 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
12enum ns2_led_modes {
13 NS_V2_LED_OFF,
14 NS_V2_LED_ON,
15 NS_V2_LED_SATA,
16};
17
18struct ns2_led_modval {
19 enum ns2_led_modes mode;
20 int cmd_level;
21 int slow_level;
22};
23
24struct 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
33struct 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
37 unsigned int delay_line;37 unsigned int delay_line;
38 unsigned int tuning_step; /* The delay cell steps in tuning procedure */38 unsigned int tuning_step; /* The delay cell steps in tuning procedure */
39 unsigned int tuning_start_tap; /* The start delay cell point in tuning procedure */39 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) */
40};41};
41#endif /* __ASM_ARCH_IMX_ESDHC_H */42#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
46};46};
47 47
48struct am33xx_pm_platform_data {48struct am33xx_pm_platform_data {
49 int (*init)(void);49 int (*init)(int (*idle)(u32 wfi_flags));
50 int (*deinit)(void);
50 int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long),51 int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long),
51 unsigned long args);52 unsigned long args);
53 int (*cpu_suspend)(int (*fn)(unsigned long), unsigned long args);
54 void (*begin_suspend)(void);
55 void (*finish_suspend)(void);
52 struct am33xx_pm_sram_addr *(*get_sram_addrs)(void);56 struct am33xx_pm_sram_addr *(*get_sram_addrs)(void);
53 void __iomem *(*get_rtc_base_addr)(void);57 void __iomem *(*get_rtc_base_addr)(void);
54 void (*save_context)(void);58 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
53struct omap_dm_timer;
54typedef struct omap_dm_timer pwm_omap_dmtimer;
55
56struct 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
12struct rproc_ops;
13struct 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 */
27struct 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
41void __init omap_rproc_reserve_cma(void);
42
43#else
44
45static 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
17 TI_SYSC_OMAP4_MCASP,17 TI_SYSC_OMAP4_MCASP,
18 TI_SYSC_OMAP4_USB_HOST_FS,18 TI_SYSC_OMAP4_USB_HOST_FS,
19 TI_SYSC_DRA7_MCAN,19 TI_SYSC_DRA7_MCAN,
20 TI_SYSC_PRUSS,
20};21};
21 22
22struct ti_sysc_cookie {23struct ti_sysc_cookie {
@@ -49,6 +50,9 @@ struct sysc_regbits { · 26 unmodified lines
49 s8 emufree_shift;50 s8 emufree_shift;
50};51};
51 52
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)
52#define SYSC_QUIRK_CLKDM_NOAUTO BIT(21)56#define SYSC_QUIRK_CLKDM_NOAUTO BIT(21)
53#define SYSC_QUIRK_FORCE_MSTANDBY BIT(20)57#define SYSC_QUIRK_FORCE_MSTANDBY BIT(20)
54#define SYSC_MODULE_QUIRK_AESS BIT(19)58#define SYSC_MODULE_QUIRK_AESS BIT(19)
@@ -141,6 +145,7 @@ struct clk; · 86 unmodified lines
141 145
142struct ti_sysc_platform_data {146struct ti_sysc_platform_data {
143 struct of_dev_auxdata *auxdata;147 struct of_dev_auxdata *auxdata;
148 bool (*soc_type_gp)(void);
144 int (*init_clockdomain)(struct device *dev, struct clk *fck,149 int (*init_clockdomain)(struct device *dev, struct clk *fck,
145 struct clk *ick, struct ti_sysc_cookie *cookie);150 struct clk *ick, struct ti_sysc_cookie *cookie);
146 void (*clkdm_deny_idle)(struct device *dev,151 void (*clkdm_deny_idle)(struct device *dev,
include/linux/platform_data/wilco-ec.h+6−2
@@ -8,8 +8,8 @@ · 7 unmodified lines
8#ifndef WILCO_EC_H8#ifndef WILCO_EC_H
9#define WILCO_EC_H9#define WILCO_EC_H
10 10
11#include <linux/device.h>11#include <linux/mutex.h>
12#include <linux/kernel.h>12#include <linux/types.h>
13 13
14/* Message flags for using the mailbox() interface */14/* Message flags for using the mailbox() interface */
15#define WILCO_EC_FLAG_NO_RESPONSE BIT(0) /* EC does not respond */15#define WILCO_EC_FLAG_NO_RESPONSE BIT(0) /* EC does not respond */
@@ -17,6 +17,10 @@ · 1 unmodified line
17/* Normal commands have a maximum 32 bytes of data */17/* Normal commands have a maximum 32 bytes of data */
18#define EC_MAILBOX_DATA_SIZE 3218#define EC_MAILBOX_DATA_SIZE 32
19 19
20struct device;
21struct resource;
22struct platform_device;
23
20/**24/**
21 * struct wilco_ec_device - Wilco Embedded Controller handle.25 * struct wilco_ec_device - Wilco Embedded Controller handle.
22 * @dev: Device handle.26 * @dev: Device handle.
include/linux/platform_device.h+5−2
@@ -24,7 +24,7 @@ struct platform_device { · 23 unmodified lines
24 int id;24 int id;
25 bool id_auto;25 bool id_auto;
26 struct device dev;26 struct device dev;
27 u64 dma_mask;27 u64 platform_dma_mask;
28 u32 num_resources;28 u32 num_resources;
29 struct resource *resource;29 struct resource *resource;
30 30
@@ -55,6 +55,9 @@ extern struct device * · 24 unmodified lines
55platform_find_device_by_driver(struct device *start,55platform_find_device_by_driver(struct device *start,
56 const struct device_driver *drv);56 const struct device_driver *drv);
57extern void __iomem *57extern void __iomem *
58devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
59 unsigned int index, struct resource **res);
60extern void __iomem *
58devm_platform_ioremap_resource(struct platform_device *pdev,61devm_platform_ioremap_resource(struct platform_device *pdev,
59 unsigned int index);62 unsigned int index);
60extern void __iomem *63extern void __iomem *
@@ -89,7 +92,7 @@ struct platform_device_info { · 28 unmodified lines
89 size_t size_data;92 size_t size_data;
90 u64 dma_mask;93 u64 dma_mask;
91 94
92 struct property_entry *properties;95 const struct property_entry *properties;
93};96};
94extern struct platform_device *platform_device_register_full(97extern struct platform_device *platform_device_register_full(
95 const struct platform_device_info *pdevinfo);98 const struct platform_device_info *pdevinfo);
include/linux/pm_qos.h+42−39
@@ -1,22 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0 */1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_PM_QOS_H2/*
3#define _LINUX_PM_QOS_H3 * Definitions related to Power Management Quality of Service (PM QoS).
4/* interface for the pm_qos_power infrastructure of the linux kernel.
5 *4 *
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>
7 */10 */
11
12#ifndef _LINUX_PM_QOS_H
13#define _LINUX_PM_QOS_H
14
8#include <linux/plist.h>15#include <linux/plist.h>
9#include <linux/notifier.h>16#include <linux/notifier.h>
10#include <linux/device.h>17#include <linux/device.h>
11#include <linux/workqueue.h>
12
13enum {
14 PM_QOS_RESERVED = 0,
15 PM_QOS_CPU_DMA_LATENCY,
16
17 /* insert new class ID */
18 PM_QOS_NUM_CLASSES,
19};
20 18
21enum pm_qos_flags_status {19enum pm_qos_flags_status {
22 PM_QOS_FLAGS_UNDEFINED = -1,20 PM_QOS_FLAGS_UNDEFINED = -1,
@@ -29,7 +27,7 @@ enum pm_qos_flags_status { · 6 unmodified lines
29#define PM_QOS_LATENCY_ANY S32_MAX27#define PM_QOS_LATENCY_ANY S32_MAX
30#define PM_QOS_LATENCY_ANY_NS ((s64)PM_QOS_LATENCY_ANY * NSEC_PER_USEC)28#define PM_QOS_LATENCY_ANY_NS ((s64)PM_QOS_LATENCY_ANY * NSEC_PER_USEC)
31 29
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)
33#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE PM_QOS_LATENCY_ANY31#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE PM_QOS_LATENCY_ANY
34#define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY32#define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY
35#define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS33#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
40 38
41#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)39#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)
42 40
43struct 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
49struct pm_qos_flags_request {
50 struct list_head node;
51 s32 flags; /* Do not change to 64 bit */
52};
53
54enum pm_qos_type {41enum pm_qos_type {
55 PM_QOS_UNITIALIZED,42 PM_QOS_UNITIALIZED,
56 PM_QOS_MAX, /* return the largest value */43 PM_QOS_MAX, /* return the largest value */
57 PM_QOS_MIN, /* return the smallest value */44 PM_QOS_MIN, /* return the smallest value */
58 PM_QOS_SUM /* return the sum */
59};45};
60 46
61/*47/*
@@ -72,6 +58,16 @@ struct pm_qos_constraints { · 10 unmodified lines
72 struct blocking_notifier_head *notifiers;58 struct blocking_notifier_head *notifiers;
73};59};
74 60
61struct pm_qos_request {
62 struct plist_node node;
63 struct pm_qos_constraints *qos;
64};
65
66struct pm_qos_flags_request {
67 struct list_head node;
68 s32 flags; /* Do not change to 64 bit */
69};
70
75struct pm_qos_flags {71struct pm_qos_flags {
76 struct list_head list;72 struct list_head list;
77 s32 effective_flags; /* Do not change to 64 bit */73 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
140 return req->dev != NULL;136 return req->dev != NULL;
141}137}
142 138
139s32 pm_qos_read_value(struct pm_qos_constraints *c);
143int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,140int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
144 enum pm_qos_req_action action, int value);141 enum pm_qos_req_action action, int value);
145bool pm_qos_update_flags(struct pm_qos_flags *pqf,142bool pm_qos_update_flags(struct pm_qos_flags *pqf,
146 struct pm_qos_flags_request *req,143 struct pm_qos_flags_request *req,
147 enum pm_qos_req_action action, s32 val);144 enum pm_qos_req_action action, s32 val);
148void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,145
149 s32 value);146#ifdef CONFIG_CPU_IDLE
150void pm_qos_update_request(struct pm_qos_request *req,147s32 cpu_latency_qos_limit(void);
151 s32 new_value);148bool cpu_latency_qos_request_active(struct pm_qos_request *req);
152void pm_qos_update_request_timeout(struct pm_qos_request *req,149void cpu_latency_qos_add_request(struct pm_qos_request *req, s32 value);
153 s32 new_value, unsigned long timeout_us);150void cpu_latency_qos_update_request(struct pm_qos_request *req, s32 new_value);
154void pm_qos_remove_request(struct pm_qos_request *req);151void cpu_latency_qos_remove_request(struct pm_qos_request *req);
155 152#else
156int pm_qos_request(int pm_qos_class);153static inline s32 cpu_latency_qos_limit(void) { return INT_MAX; }
157int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);154static inline bool cpu_latency_qos_request_active(struct pm_qos_request *req)
158int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);155{
159int pm_qos_request_active(struct pm_qos_request *req);156 return false;
160s32 pm_qos_read_value(struct pm_qos_constraints *c);157}
158static inline void cpu_latency_qos_add_request(struct pm_qos_request *req,
159 s32 value) {}
160static inline void cpu_latency_qos_update_request(struct pm_qos_request *req,
161 s32 new_value) {}
162static inline void cpu_latency_qos_remove_request(struct pm_qos_request *req) {}
163#endif
161 164
162#ifdef CONFIG_PM165#ifdef CONFIG_PM
163enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask);166enum 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
38extern int __pm_runtime_idle(struct device *dev, int rpmflags);38extern int __pm_runtime_idle(struct device *dev, int rpmflags);
39extern int __pm_runtime_suspend(struct device *dev, int rpmflags);39extern int __pm_runtime_suspend(struct device *dev, int rpmflags);
40extern int __pm_runtime_resume(struct device *dev, int rpmflags);40extern int __pm_runtime_resume(struct device *dev, int rpmflags);
41extern int pm_runtime_get_if_in_use(struct device *dev);41extern int pm_runtime_get_if_active(struct device *dev, bool ign_usage_count);
42extern int pm_schedule_suspend(struct device *dev, unsigned int delay);42extern int pm_schedule_suspend(struct device *dev, unsigned int delay);
43extern int __pm_runtime_set_status(struct device *dev, unsigned int status);43extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
44extern int pm_runtime_barrier(struct device *dev);44extern int pm_runtime_barrier(struct device *dev);
@@ -60,6 +60,11 @@ extern void pm_runtime_put_suppliers(struct device *dev); · 15 unmodified lines
60extern void pm_runtime_new_link(struct device *dev);60extern void pm_runtime_new_link(struct device *dev);
61extern void pm_runtime_drop_link(struct device *dev);61extern void pm_runtime_drop_link(struct device *dev);
62 62
63static inline int pm_runtime_get_if_in_use(struct device *dev)
64{
65 return pm_runtime_get_if_active(dev, false);
66}
67
63static inline void pm_suspend_ignore_children(struct device *dev, bool enable)68static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
64{69{
65 dev->power.ignore_children = enable;70 dev->power.ignore_children = enable;
@@ -143,6 +148,11 @@ static inline int pm_runtime_get_if_in_use(struct device *dev) · 77 unmodified lines
143{148{
144 return -EINVAL;149 return -EINVAL;
145}150}
151static inline int pm_runtime_get_if_active(struct device *dev,
152 bool ign_usage_count)
153{
154 return -EINVAL;
155}
146static inline int __pm_runtime_set_status(struct device *dev,156static inline int __pm_runtime_set_status(struct device *dev,
147 unsigned int status) { return 0; }157 unsigned int status) { return 0; }
148static inline int pm_runtime_barrier(struct device *dev) { return 0; }158static 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
379};379};
380 380
381struct pnp_driver {381struct pnp_driver {
382 char *name;382 const char *name;
383 const struct pnp_device_id *id_table;383 const struct pnp_device_id *id_table;
384 unsigned int flags;384 unsigned int flags;
385 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);385 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
69struct cpu_timer {69struct cpu_timer {
70 struct timerqueue_node node;70 struct timerqueue_node node;
71 struct timerqueue_head *head;71 struct timerqueue_head *head;
72 struct task_struct *task;72 struct pid *pid;
73 struct list_head elist;73 struct list_head elist;
74 int firing;74 int firing;
75};75};
include/linux/power/bq2415x_charger.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
2/*2/*
3 * bq2415x charger driver3 * bq2415x charger driver
4 *4 *
5 * Copyright (C) 2011-2013 Pali Rohár <pali.rohar@gmail.com>5 * Copyright (C) 2011-2013 Pali Rohár <pali@kernel.org>
6 */6 */
7 7
8#ifndef BQ2415X_CHARGER_H8#ifndef BQ2415X_CHARGER_H
include/linux/power/charger-manager.h+1−1
@@ -248,7 +248,7 @@ struct charger_manager { · 247 unmodified lines
248 u64 charging_end_time;248 u64 charging_end_time;
249};249};
250 250
251#ifdef CONFIG_CHARGER_MANAGER251#if IS_ENABLED(CONFIG_CHARGER_MANAGER)
252extern void cm_notify_event(struct power_supply *psy,252extern void cm_notify_event(struct power_supply *psy,
253 enum cm_event_types type, char *msg);253 enum cm_event_types type, char *msg);
254#else254#else
include/linux/preempt.h+30−0
@@ -322,4 +322,34 @@ static inline void preempt_notifier_init(struct preempt_notifier *notifier, · 321 unmodified lines
322 322
323#endif323#endif
324 324
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 */
335static __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 */
350static __always_inline void migrate_enable(void)
351{
352 preempt_enable();
353}
354
325#endif /* __LINUX_PREEMPT_H */355#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
202void dump_stack_print_info(const char *log_lvl);202void dump_stack_print_info(const char *log_lvl);
203void show_regs_print_info(const char *log_lvl);203void show_regs_print_info(const char *log_lvl);
204extern asmlinkage void dump_stack(void) __cold;204extern asmlinkage void dump_stack(void) __cold;
205extern void printk_safe_init(void);
206extern void printk_safe_flush(void);205extern void printk_safe_flush(void);
207extern void printk_safe_flush_on_panic(void);206extern void printk_safe_flush_on_panic(void);
208#else207#else
@@ -269,10 +268,6 @@ static inline void dump_stack(void) · 60 unmodified lines
269{268{
270}269}
271 270
272static inline void printk_safe_init(void)
273{
274}
275
276static inline void printk_safe_flush(void)271static inline void printk_safe_flush(void)
277{272{
278}273}
include/linux/proc_fs.h+18−3
@@ -5,6 +5,7 @@ · 4 unmodified lines
5#ifndef _LINUX_PROC_FS_H5#ifndef _LINUX_PROC_FS_H
6#define _LINUX_PROC_FS_H6#define _LINUX_PROC_FS_H
7 7
8#include <linux/compiler.h>
8#include <linux/types.h>9#include <linux/types.h>
9#include <linux/fs.h>10#include <linux/fs.h>
10 11
@@ -12,7 +13,21 @@ struct proc_dir_entry; · 1 unmodified line
12struct seq_file;13struct seq_file;
13struct seq_operations;14struct seq_operations;
14 15
16enum {
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
15struct proc_ops {29struct proc_ops {
30 unsigned int proc_flags;
16 int (*proc_open)(struct inode *, struct file *);31 int (*proc_open)(struct inode *, struct file *);
17 ssize_t (*proc_read)(struct file *, char __user *, size_t, loff_t *);32 ssize_t (*proc_read)(struct file *, char __user *, size_t, loff_t *);
18 ssize_t (*proc_write)(struct file *, const char __user *, size_t, loff_t *);33 ssize_t (*proc_write)(struct file *, const char __user *, size_t, loff_t *);
@@ -25,14 +40,14 @@ struct proc_ops { · 6 unmodified lines
25#endif40#endif
26 int (*proc_mmap)(struct file *, struct vm_area_struct *);41 int (*proc_mmap)(struct file *, struct vm_area_struct *);
27 unsigned long (*proc_get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);42 unsigned long (*proc_get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
28};43} __randomize_layout;
29 44
30#ifdef CONFIG_PROC_FS45#ifdef CONFIG_PROC_FS
31 46
32typedef int (*proc_write_t)(struct file *, char *, size_t);47typedef int (*proc_write_t)(struct file *, char *, size_t);
33 48
34extern void proc_root_init(void);49extern void proc_root_init(void);
35extern void proc_flush_task(struct task_struct *);50extern void proc_flush_pid(struct pid *);
36 51
37extern struct proc_dir_entry *proc_symlink(const char *,52extern struct proc_dir_entry *proc_symlink(const char *,
38 struct proc_dir_entry *, const char *);53 struct proc_dir_entry *, const char *);
@@ -105,7 +120,7 @@ static inline void proc_root_init(void) · 66 unmodified lines
105{120{
106}121}
107 122
108static inline void proc_flush_task(struct task_struct *task)123static inline void proc_flush_pid(struct pid *pid)
109{124{
110}125}
111 126
include/linux/proc_ns.h+2−5
@@ -50,16 +50,11 @@ enum { · 49 unmodified lines
50 50
51#ifdef CONFIG_PROC_FS51#ifdef CONFIG_PROC_FS
52 52
53extern int pid_ns_prepare_proc(struct pid_namespace *ns);
54extern void pid_ns_release_proc(struct pid_namespace *ns);
55extern int proc_alloc_inum(unsigned int *pino);53extern int proc_alloc_inum(unsigned int *pino);
56extern void proc_free_inum(unsigned int inum);54extern void proc_free_inum(unsigned int inum);
57 55
58#else /* CONFIG_PROC_FS */56#else /* CONFIG_PROC_FS */
59 57
60static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; }
61static inline void pid_ns_release_proc(struct pid_namespace *ns) {}
62
63static inline int proc_alloc_inum(unsigned int *inum)58static inline int proc_alloc_inum(unsigned int *inum)
64{59{
65 *inum = 1;60 *inum = 1;
@@ -85,6 +80,8 @@ typedef struct ns_common *ns_get_path_helper_t(void *); · 19 unmodified lines
85extern int ns_get_path_cb(struct path *path, ns_get_path_helper_t ns_get_cb,80extern int ns_get_path_cb(struct path *path, ns_get_path_helper_t ns_get_cb,
86 void *private_data);81 void *private_data);
87 82
83extern bool ns_match(const struct ns_common *ns, dev_t dev, ino_t ino);
84
88extern int ns_get_name(char *buf, size_t size, struct task_struct *task,85extern int ns_get_name(char *buf, size_t size, struct task_struct *task,
89 const struct proc_ns_operations *ns_ops);86 const struct proc_ns_operations *ns_ops);
90extern void nsfs_init(void);87extern void nsfs_init(void);
include/linux/psi.h+2−0
@@ -17,6 +17,8 @@ extern struct psi_group psi_system; · 16 unmodified lines
17void psi_init(void);17void psi_init(void);
18 18
19void psi_task_change(struct task_struct *task, int clear, int set);19void psi_task_change(struct task_struct *task, int clear, int set);
20void psi_task_switch(struct task_struct *prev, struct task_struct *next,
21 bool sleep);
20 22
21void psi_memstall_tick(struct task_struct *task, int cpu);23void psi_memstall_tick(struct task_struct *task, int cpu);
22void psi_memstall_enter(unsigned long *flags);24void psi_memstall_enter(unsigned long *flags);
include/linux/psi_types.h+9−1
@@ -14,13 +14,21 @@ enum psi_task_count { · 13 unmodified lines
14 NR_IOWAIT,14 NR_IOWAIT,
15 NR_MEMSTALL,15 NR_MEMSTALL,
16 NR_RUNNING,16 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,
18};25};
19 26
20/* Task state bitmasks */27/* Task state bitmasks */
21#define TSK_IOWAIT (1 << NR_IOWAIT)28#define TSK_IOWAIT (1 << NR_IOWAIT)
22#define TSK_MEMSTALL (1 << NR_MEMSTALL)29#define TSK_MEMSTALL (1 << NR_MEMSTALL)
23#define TSK_RUNNING (1 << NR_RUNNING)30#define TSK_RUNNING (1 << NR_RUNNING)
31#define TSK_ONCPU (1 << NR_ONCPU)
24 32
25/* Resources that workloads could be stalled on */33/* Resources that workloads could be stalled on */
26enum psi_res {34enum 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
223/**223/**
224 * ptp_find_pin() - obtain the pin index of a given auxiliary function224 * ptp_find_pin() - obtain the pin index of a given auxiliary function
225 *225 *
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 *
226 * @ptp: The clock obtained from ptp_clock_register().232 * @ptp: The clock obtained from ptp_clock_register().
227 * @func: One of the ptp_pin_function enumerated values.233 * @func: One of the ptp_pin_function enumerated values.
228 * @chan: The particular functional channel to find.234 * @chan: The particular functional channel to find.
@@ -233,6 +239,19 @@ extern s32 scaled_ppm_to_ppb(long ppm); · 4 unmodified lines
233int ptp_find_pin(struct ptp_clock *ptp,239int ptp_find_pin(struct ptp_clock *ptp,
234 enum ptp_pin_function func, unsigned int chan);240 enum ptp_pin_function func, unsigned int chan);
235 241
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
252int ptp_find_pin_unlocked(struct ptp_clock *ptp,
253 enum ptp_pin_function func, unsigned int chan);
254
236/**255/**
237 * ptp_schedule_worker() - schedule ptp auxiliary work256 * ptp_schedule_worker() - schedule ptp auxiliary work
238 *257 *
include/linux/pwm.h+3−1
@@ -71,7 +71,8 @@ struct pwm_state { · 70 unmodified lines
71 * @chip: PWM chip providing this PWM device71 * @chip: PWM chip providing this PWM device
72 * @chip_data: chip-private data associated with the PWM device72 * @chip_data: chip-private data associated with the PWM device
73 * @args: PWM arguments73 * @args: PWM arguments
74 * @state: curent PWM channel state74 * @state: last applied state
75 * @last: last implemented state (for PWM_DEBUG)
75 */76 */
76struct pwm_device {77struct pwm_device {
77 const char *label;78 const char *label;
@@ -83,6 +84,7 @@ struct pwm_device { · 5 unmodified lines
83 84
84 struct pwm_args args;85 struct pwm_args args;
85 struct pwm_state state;86 struct pwm_state state;
87 struct pwm_state last;
86};88};
87 89
88/**90/**
include/linux/pwm_backlight.h+0−2
@@ -16,8 +16,6 @@ struct platform_pwm_backlight_data { · 15 unmodified lines
16 unsigned int *levels;16 unsigned int *levels;
17 unsigned int post_pwm_on_delay;17 unsigned int post_pwm_on_delay;
18 unsigned int pwm_off_delay;18 unsigned int pwm_off_delay;
19 /* TODO remove once all users are switched to gpiod_* API */
20 int enable_gpio;
21 int (*init)(struct device *dev);19 int (*init)(struct device *dev);
22 int (*notify)(struct device *dev, int brightness);20 int (*notify)(struct device *dev, int brightness);
23 void (*notify_after)(struct device *dev, int brightness);21 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
97 u32 cons_idx;97 u32 cons_idx;
98};98};
99 99
100struct addr_tbl_entry {
101 void *virt_addr;
102 dma_addr_t dma_map;
103};
104
100struct qed_chain {105struct qed_chain {
101 /* fastpath portion of the chain - required for commands such106 /* fastpath portion of the chain - required for commands such
102 * as produce / consume.107 * as produce / consume.
@@ -107,10 +112,11 @@ struct qed_chain { · 4 unmodified lines
107 112
108 /* Fastpath portions of the PBL [if exists] */113 /* Fastpath portions of the PBL [if exists] */
109 struct {114 struct {
110 /* Table for keeping the virtual addresses of the chain pages,115 /* Table for keeping the virtual and physical addresses of the
111 * respectively to the physical addresses in the pbl table.116 * chain pages, respectively to the physical addresses
117 * in the pbl table.
112 */118 */
113 void **pp_virt_addr_tbl;119 struct addr_tbl_entry *pp_addr_tbl;
114 120
115 union {121 union {
116 struct qed_chain_pbl_u16 u16;122 struct qed_chain_pbl_u16 u16;
@@ -287,7 +293,7 @@ qed_chain_advance_page(struct qed_chain *p_chain, · 170 unmodified lines
287 *(u32 *)page_to_inc = 0;293 *(u32 *)page_to_inc = 0;
288 page_index = *(u32 *)page_to_inc;294 page_index = *(u32 *)page_to_inc;
289 }295 }
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;
291 }297 }
292}298}
293 299
@@ -537,7 +543,7 @@ static inline void qed_chain_init_params(struct qed_chain *p_chain, · 243 unmodified lines
537 543
538 p_chain->pbl_sp.p_phys_table = 0;544 p_chain->pbl_sp.p_phys_table = 0;
539 p_chain->pbl_sp.p_virt_table = NULL;545 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;
541}547}
542 548
543/**549/**
@@ -575,11 +581,11 @@ static inline void qed_chain_init_mem(struct qed_chain *p_chain, · 31 unmodified lines
575static inline void qed_chain_init_pbl_mem(struct qed_chain *p_chain,581static inline void qed_chain_init_pbl_mem(struct qed_chain *p_chain,
576 void *p_virt_pbl,582 void *p_virt_pbl,
577 dma_addr_t p_phys_pbl,583 dma_addr_t p_phys_pbl,
578 void **pp_virt_addr_tbl)584 struct addr_tbl_entry *pp_addr_tbl)
579{585{
580 p_chain->pbl_sp.p_phys_table = p_phys_pbl;586 p_chain->pbl_sp.p_phys_table = p_phys_pbl;
581 p_chain->pbl_sp.p_virt_table = p_virt_pbl;587 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;
583}589}
584 590
585/**591/**
@@ -644,7 +650,7 @@ static inline void *qed_chain_get_last_elem(struct qed_chain *p_chain) · 58 unmodified lines
644 break;650 break;
645 case QED_CHAIN_MODE_PBL:651 case QED_CHAIN_MODE_PBL:
646 last_page_idx = p_chain->page_cnt - 1;652 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;
648 break;654 break;
649 }655 }
650 /* p_virt_addr points at this stage to the last page of the chain */656 /* 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
716 page_cnt = qed_chain_get_page_cnt(p_chain);722 page_cnt = qed_chain_get_page_cnt(p_chain);
717 723
718 for (i = 0; i < page_cnt; i++)724 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,
720 QED_CHAIN_PAGE_SIZE);726 QED_CHAIN_PAGE_SIZE);
721}727}
722 728
include/linux/raid/detect.h+3−0
@@ -0,0 +1,3 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2
3void md_autodetect_dev(dev_t dev);
include/linux/random.h+22−0
@@ -7,6 +7,8 @@ · 6 unmodified lines
7#ifndef _LINUX_RANDOM_H7#ifndef _LINUX_RANDOM_H
8#define _LINUX_RANDOM_H8#define _LINUX_RANDOM_H
9 9
10#include <linux/bug.h>
11#include <linux/kernel.h>
10#include <linux/list.h>12#include <linux/list.h>
11#include <linux/once.h>13#include <linux/once.h>
12 14
@@ -185,6 +187,26 @@ static inline bool __must_check arch_get_random_seed_int(unsigned int *v) · 172 unmodified lines
185}187}
186#endif188#endif
187 189
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
195static 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
203static 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
188/* Pseudo random number generator from numerical recipes. */210/* Pseudo random number generator from numerical recipes. */
189static inline u32 next_pseudo_random32(u32 seed)211static inline u32 next_pseudo_random32(u32 seed)
190{212{
include/linux/rculist.h+2−2
@@ -60,9 +60,9 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list) · 59 unmodified lines
60#define __list_check_rcu(dummy, cond, extra...) \60#define __list_check_rcu(dummy, cond, extra...) \
61 ({ \61 ({ \
62 check_arg_count_one(extra); \62 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(), \
64 "RCU-list traversed in non-reader section!"); \64 "RCU-list traversed in non-reader section!"); \
65 })65 })
66#else66#else
67#define __list_check_rcu(dummy, cond, extra...) \67#define __list_check_rcu(dummy, cond, extra...) \
68 ({ check_arg_count_one(extra); })68 ({ check_arg_count_one(extra); })
include/linux/rcutiny.h+1−0
@@ -83,6 +83,7 @@ void rcu_scheduler_starting(void); · 82 unmodified lines
83static inline void rcu_scheduler_starting(void) { }83static inline void rcu_scheduler_starting(void) { }
84#endif /* #else #ifndef CONFIG_SRCU */84#endif /* #else #ifndef CONFIG_SRCU */
85static inline void rcu_end_inkernel_boot(void) { }85static inline void rcu_end_inkernel_boot(void) { }
86static inline bool rcu_inkernel_boot_has_ended(void) { return true; }
86static inline bool rcu_is_watching(void) { return true; }87static inline bool rcu_is_watching(void) { return true; }
87static inline void rcu_momentary_dyntick_idle(void) { }88static inline void rcu_momentary_dyntick_idle(void) { }
88static inline void kfree_rcu_scheduler_running(void) { }89static inline void kfree_rcu_scheduler_running(void) { }
include/linux/rcutree.h+1−0
@@ -54,6 +54,7 @@ void exit_rcu(void); · 53 unmodified lines
54void rcu_scheduler_starting(void);54void rcu_scheduler_starting(void);
55extern int rcu_scheduler_active __read_mostly;55extern int rcu_scheduler_active __read_mostly;
56void rcu_end_inkernel_boot(void);56void rcu_end_inkernel_boot(void);
57bool rcu_inkernel_boot_has_ended(void);
57bool rcu_is_watching(void);58bool rcu_is_watching(void);
58#ifndef CONFIG_PREEMPTION59#ifndef CONFIG_PREEMPTION
59void rcu_all_qs(void);60void rcu_all_qs(void);
include/linux/rcuwait.h+10−2
@@ -3,6 +3,7 @@ · 2 unmodified lines
3#define _LINUX_RCUWAIT_H_3#define _LINUX_RCUWAIT_H_
4 4
5#include <linux/rcupdate.h>5#include <linux/rcupdate.h>
6#include <linux/sched/signal.h>
6 7
7/*8/*
8 * rcuwait provides a way of blocking and waking up a single9 * 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
30 * The caller is responsible for locking around rcuwait_wait_event(),31 * The caller is responsible for locking around rcuwait_wait_event(),
31 * such that writes to @task are properly serialized.32 * such that writes to @task are properly serialized.
32 */33 */
33#define rcuwait_wait_event(w, condition) \34#define rcuwait_wait_event(w, condition, state) \
34({ \35({ \
36 int __ret = 0; \
35 rcu_assign_pointer((w)->task, current); \37 rcu_assign_pointer((w)->task, current); \
36 for (;;) { \38 for (;;) { \
37 /* \39 /* \
38 * Implicit barrier (A) pairs with (B) in \40 * Implicit barrier (A) pairs with (B) in \
39 * rcuwait_wake_up(). \41 * rcuwait_wake_up(). \
40 */ \42 */ \
41 set_current_state(TASK_UNINTERRUPTIBLE); \43 set_current_state(state); \
42 if (condition) \44 if (condition) \
43 break; \45 break; \
44 \46 \
47 if (signal_pending_state(state, current)) { \
48 __ret = -EINTR; \
49 break; \
50 } \
51 \
45 schedule(); \52 schedule(); \
46 } \53 } \
47 \54 \
48 WRITE_ONCE((w)->task, NULL); \55 WRITE_ONCE((w)->task, NULL); \
49 __set_current_state(TASK_RUNNING); \56 __set_current_state(TASK_RUNNING); \
57 __ret; \
50})58})
51 59
52#endif /* _LINUX_RCUWAIT_H_ */60#endif /* _LINUX_RCUWAIT_H_ */
include/linux/refcount.h+18−5
@@ -38,11 +38,24 @@ · 37 unmodified lines
38 * atomic operations, then the count will continue to edge closer to 0. If it38 * atomic operations, then the count will continue to edge closer to 0. If it
39 * reaches a value of 1 before /any/ of the threads reset it to the saturated39 * reaches a value of 1 before /any/ of the threads reset it to the saturated
40 * value, then a concurrent refcount_dec_and_test() may erroneously free the40 * value, then a concurrent refcount_dec_and_test() may erroneously free the
41 * underlying object. Given the precise timing details involved with the41 * underlying object.
42 * round-robin scheduling of each thread manipulating the refcount and the need42 * Linux limits the maximum number of tasks to PID_MAX_LIMIT, which is currently
43 * to hit the race multiple times in succession, there doesn't appear to be a43 * 0x400000 (and can't easily be raised in the future beyond FUTEX_TID_MASK).
44 * practical avenue of attack even if using refcount_add() operations with44 * With the current PID limit, if no batched refcounting operations are used and
45 * larger increments.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.
46 *59 *
47 * Memory ordering60 * Memory ordering
48 * ===============61 * ===============
include/linux/regmap.h+2−2
@@ -461,8 +461,8 @@ struct regmap_config { · 460 unmodified lines
461 * @range_max: Address of the highest register in virtual range.461 * @range_max: Address of the highest register in virtual range.
462 *462 *
463 * @selector_reg: Register with selector field.463 * @selector_reg: Register with selector field.
464 * @selector_mask: Bit shift for selector value.464 * @selector_mask: Bit mask for selector value.
465 * @selector_shift: Bit mask for selector value.465 * @selector_shift: Bit shift for selector value.
466 *466 *
467 * @window_start: Address of first (lowest) register in data window.467 * @window_start: Address of first (lowest) register in data window.
468 * @window_len: Number of registers in data window.468 * @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
277 * @curr_table: Current limit mapping table (if table based mapping)277 * @curr_table: Current limit mapping table (if table based mapping)
278 *278 *
279 * @vsel_range_reg: Register for range selector when using pickable ranges279 * @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.
281 * @vsel_range_mask: Mask for register bitfield used for range selector281 * @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_*``
283 * @vsel_mask: Mask for register bitfield used for selector283 * @vsel_mask: Mask for register bitfield used for selector
284 * @vsel_step: Specify the resolution of selector stepping when setting284 * @vsel_step: Specify the resolution of selector stepping when setting
285 * voltage. If 0, then no stepping is done (requested selector is285 * 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
329struct rproc_mem_entry {329struct rproc_mem_entry {
330 void *va;330 void *va;
331 dma_addr_t dma;331 dma_addr_t dma;
332 int len;332 size_t len;
333 u32 da;333 u32 da;
334 void *priv;334 void *priv;
335 char name[32];335 char name[32];
@@ -369,12 +369,14 @@ enum rsc_handling_status { · 33 unmodified lines
369 * expects to find it369 * expects to find it
370 * @sanity_check: sanity check the fw image370 * @sanity_check: sanity check the fw image
371 * @get_boot_addr: get boot address to entry point specified in firmware371 * @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
372 */374 */
373struct rproc_ops {375struct rproc_ops {
374 int (*start)(struct rproc *rproc);376 int (*start)(struct rproc *rproc);
375 int (*stop)(struct rproc *rproc);377 int (*stop)(struct rproc *rproc);
376 void (*kick)(struct rproc *rproc, int vqid);378 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);
378 int (*parse_fw)(struct rproc *rproc, const struct firmware *fw);380 int (*parse_fw)(struct rproc *rproc, const struct firmware *fw);
379 int (*handle_rsc)(struct rproc *rproc, u32 rsc_type, void *rsc,381 int (*handle_rsc)(struct rproc *rproc, u32 rsc_type, void *rsc,
380 int offset, int avail);382 int offset, int avail);
@@ -382,7 +384,8 @@ struct rproc_ops { · 1 unmodified line
382 struct rproc *rproc, const struct firmware *fw);384 struct rproc *rproc, const struct firmware *fw);
383 int (*load)(struct rproc *rproc, const struct firmware *fw);385 int (*load)(struct rproc *rproc, const struct firmware *fw);
384 int (*sanity_check)(struct rproc *rproc, const struct firmware *fw);386 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);
386};389};
387 390
388/**391/**
@@ -498,7 +501,7 @@ struct rproc { · 109 unmodified lines
498 int num_traces;501 int num_traces;
499 struct list_head carveouts;502 struct list_head carveouts;
500 struct list_head mappings;503 struct list_head mappings;
501 u32 bootaddr;504 u64 bootaddr;
502 struct list_head rvdevs;505 struct list_head rvdevs;
503 struct list_head subdevs;506 struct list_head subdevs;
504 struct idr notifyids;507 struct idr notifyids;
@@ -514,6 +517,7 @@ struct rproc { · 9 unmodified lines
514 bool auto_boot;517 bool auto_boot;
515 struct list_head dump_segments;518 struct list_head dump_segments;
516 int nb_vdev;519 int nb_vdev;
520 u8 elf_class;
517};521};
518 522
519/**523/**
@@ -599,13 +603,13 @@ void rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem); · 79 unmodified lines
599 603
600struct rproc_mem_entry *604struct rproc_mem_entry *
601rproc_mem_entry_init(struct device *dev,605rproc_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,
603 int (*alloc)(struct rproc *, struct rproc_mem_entry *),607 int (*alloc)(struct rproc *, struct rproc_mem_entry *),
604 int (*release)(struct rproc *, struct rproc_mem_entry *),608 int (*release)(struct rproc *, struct rproc_mem_entry *),
605 const char *name, ...);609 const char *name, ...);
606 610
607struct rproc_mem_entry *611struct rproc_mem_entry *
608rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len,612rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len,
609 u32 da, const char *name, ...);613 u32 da, const char *name, ...);
610 614
611int rproc_boot(struct rproc *rproc);615int 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
12enum 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
21typedef void (*qcom_ipa_notify_t)(void *data, enum qcom_rproc_event event);
22
23struct 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 */
40void 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 */
50void 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 */
63int 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 */
71void qcom_deregister_ipa_notify(struct rproc *rproc);
72
73#else /* !IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY) */
74
75struct 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
972/**972/**
973 * rhashtable_lookup_get_insert_key - lookup and insert object into hash table973 * rhashtable_lookup_get_insert_key - lookup and insert object into hash table
974 * @ht: hash table974 * @ht: hash table
975 * @key: key
975 * @obj: pointer to hash head inside object976 * @obj: pointer to hash head inside object
976 * @params: hash table parameters977 * @params: hash table parameters
977 * @data: pointer to element data already in hashes
978 *978 *
979 * Just like rhashtable_lookup_insert_key(), but this function returns the979 * Just like rhashtable_lookup_insert_key(), but this function returns the
980 * object if it exists, NULL if it does not and the insertion was successful,980 * 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
135 135
136struct ring_buffer_event *136struct ring_buffer_event *
137ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts);137ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts);
138struct ring_buffer_event *138void ring_buffer_iter_advance(struct ring_buffer_iter *iter);
139ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts);
140void ring_buffer_iter_reset(struct ring_buffer_iter *iter);139void ring_buffer_iter_reset(struct ring_buffer_iter *iter);
141int ring_buffer_iter_empty(struct ring_buffer_iter *iter);140int ring_buffer_iter_empty(struct ring_buffer_iter *iter);
141bool ring_buffer_iter_dropped(struct ring_buffer_iter *iter);
142 142
143unsigned long ring_buffer_size(struct trace_buffer *buffer, int cpu);143unsigned long ring_buffer_size(struct trace_buffer *buffer, int cpu);
144 144
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
34 return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);34 return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);
35}35}
36 36
37static inline void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
38{
39 rtc_time64_to_tm(time, tm);
40}
41
42static 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
49#include <linux/device.h>37#include <linux/device.h>
50#include <linux/seq_file.h>38#include <linux/seq_file.h>
51#include <linux/cdev.h>39#include <linux/cdev.h>
include/linux/rwlock_types.h+5−1
@@ -22,7 +22,11 @@ typedef struct { · 21 unmodified lines
22#define RWLOCK_MAGIC 0xdeaf1eed22#define RWLOCK_MAGIC 0xdeaf1eed
23 23
24#ifdef CONFIG_DEBUG_LOCK_ALLOC24#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 }
26#else30#else
27# define RW_DEP_MAP_INIT(lockname)31# define RW_DEP_MAP_INIT(lockname)
28#endif32#endif
include/linux/rwsem.h+5−7
@@ -53,12 +53,6 @@ struct rw_semaphore { · 52 unmodified lines
53#endif53#endif
54};54};
55 55
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
62/* In all implementations count != 0 means locked */56/* In all implementations count != 0 means locked */
63static inline int rwsem_is_locked(struct rw_semaphore *sem)57static inline int rwsem_is_locked(struct rw_semaphore *sem)
64{58{
@@ -71,7 +65,11 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) · 6 unmodified lines
71/* Common initializer macros and functions */65/* Common initializer macros and functions */
72 66
73#ifdef CONFIG_DEBUG_LOCK_ALLOC67#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 }
75#else73#else
76# define __RWSEM_DEP_MAP_INIT(lockname)74# define __RWSEM_DEP_MAP_INIT(lockname)
77#endif75#endif
include/linux/sched.h+25−18
@@ -356,28 +356,30 @@ struct util_est { · 355 unmodified lines
356} __attribute__((__aligned__(sizeof(u64))));356} __attribute__((__aligned__(sizeof(u64))));
357 357
358/*358/*
359 * The load_avg/util_avg accumulates an infinite geometric series359 * The load/runnable/util_avg accumulates an infinite geometric series
360 * (see __update_load_avg() in kernel/sched/fair.c).360 * (see __update_load_avg_cfs_rq() in kernel/sched/pelt.c).
361 *361 *
362 * [load_avg definition]362 * [load_avg definition]
363 *363 *
364 * load_avg = runnable% * scale_load_down(load)364 * load_avg = runnable% * scale_load_down(load)
365 *365 *
366 * where runnable% is the time ratio that a sched_entity is runnable.366 * [runnable_avg definition]
367 * For cfs_rq, it is the aggregated load_avg of all runnable and367 *
368 * blocked sched_entities.368 * runnable_avg = runnable% * SCHED_CAPACITY_SCALE
369 *369 *
370 * [util_avg definition]370 * [util_avg definition]
371 *371 *
372 * util_avg = running% * SCHED_CAPACITY_SCALE372 * util_avg = running% * SCHED_CAPACITY_SCALE
373 *373 *
374 * where running% is the time ratio that a sched_entity is running on374 * where runnable% is the time ratio that a sched_entity is runnable and
375 * a CPU. For cfs_rq, it is the aggregated util_avg of all runnable375 * running% the time ratio that a sched_entity is running.
376 * and blocked sched_entities.376 *
377 * For cfs_rq, they are the aggregated values of all runnable and blocked
378 * sched_entities.
377 *379 *
378 * load_avg and util_avg don't direcly factor frequency scaling and CPU380 * The load/runnable/util_avg doesn't direcly factor frequency scaling and CPU
379 * capacity scaling. The scaling is done through the rq_clock_pelt that381 * capacity scaling. The scaling is done through the rq_clock_pelt that is used
380 * is used for computing those signals (see update_rq_clock_pelt())382 * for computing those signals (see update_rq_clock_pelt())
381 *383 *
382 * N.B., the above ratios (runnable% and running%) themselves are in the384 * N.B., the above ratios (runnable% and running%) themselves are in the
383 * range of [0, 1]. To do fixed point arithmetics, we therefore scale them385 * range of [0, 1]. To do fixed point arithmetics, we therefore scale them
@@ -401,11 +403,11 @@ struct util_est { · 17 unmodified lines
401struct sched_avg {403struct sched_avg {
402 u64 last_update_time;404 u64 last_update_time;
403 u64 load_sum;405 u64 load_sum;
404 u64 runnable_load_sum;406 u64 runnable_sum;
405 u32 util_sum;407 u32 util_sum;
406 u32 period_contrib;408 u32 period_contrib;
407 unsigned long load_avg;409 unsigned long load_avg;
408 unsigned long runnable_load_avg;410 unsigned long runnable_avg;
409 unsigned long util_avg;411 unsigned long util_avg;
410 struct util_est util_est;412 struct util_est util_est;
411} ____cacheline_aligned;413} ____cacheline_aligned;
@@ -449,7 +451,6 @@ struct sched_statistics { · 37 unmodified lines
449struct sched_entity {451struct sched_entity {
450 /* For load-balancing: */452 /* For load-balancing: */
451 struct load_weight load;453 struct load_weight load;
452 unsigned long runnable_weight;
453 struct rb_node run_node;454 struct rb_node run_node;
454 struct list_head group_node;455 struct list_head group_node;
455 unsigned int on_rq;456 unsigned int on_rq;
@@ -470,6 +471,8 @@ struct sched_entity { · 14 unmodified lines
470 struct cfs_rq *cfs_rq;471 struct cfs_rq *cfs_rq;
471 /* rq "owned" by this entity/group: */472 /* rq "owned" by this entity/group: */
472 struct cfs_rq *my_q;473 struct cfs_rq *my_q;
474 /* cached value of my_q->h_nr_running */
475 unsigned long runnable_weight;
473#endif476#endif
474 477
475#ifdef CONFIG_SMP478#ifdef CONFIG_SMP
@@ -782,9 +785,12 @@ struct task_struct { · 306 unmodified lines
782 unsigned frozen:1;785 unsigned frozen:1;
783#endif786#endif
784#ifdef CONFIG_BLK_CGROUP787#ifdef CONFIG_BLK_CGROUP
785 /* to be used once the psi infrastructure lands upstream. */
786 unsigned use_memdelay:1;788 unsigned use_memdelay:1;
787#endif789#endif
790#ifdef CONFIG_PSI
791 /* Stalled due to lack of memory */
792 unsigned in_memstall:1;
793#endif
788 794
789 unsigned long atomic_flags; /* Flags requiring atomic access. */795 unsigned long atomic_flags; /* Flags requiring atomic access. */
790 796
@@ -939,8 +945,8 @@ struct task_struct { · 148 unmodified lines
939 struct seccomp seccomp;945 struct seccomp seccomp;
940 946
941 /* Thread group tracking: */947 /* Thread group tracking: */
942 u32 parent_exec_id;948 u64 parent_exec_id;
943 u32 self_exec_id;949 u64 self_exec_id;
944 950
945 /* Protection against (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, mempolicy: */951 /* Protection against (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, mempolicy: */
946 spinlock_t alloc_lock;952 spinlock_t alloc_lock;
@@ -970,6 +976,7 @@ struct task_struct { · 23 unmodified lines
970 976
971#ifdef CONFIG_TRACE_IRQFLAGS977#ifdef CONFIG_TRACE_IRQFLAGS
972 unsigned int irq_events;978 unsigned int irq_events;
979 unsigned int hardirq_threaded;
973 unsigned long hardirq_enable_ip;980 unsigned long hardirq_enable_ip;
974 unsigned long hardirq_disable_ip;981 unsigned long hardirq_disable_ip;
975 unsigned int hardirq_enable_event;982 unsigned int hardirq_enable_event;
@@ -982,6 +989,7 @@ struct task_struct { · 6 unmodified lines
982 unsigned int softirq_enable_event;989 unsigned int softirq_enable_event;
983 int softirqs_enabled;990 int softirqs_enabled;
984 int softirq_context;991 int softirq_context;
992 int irq_config;
985#endif993#endif
986 994
987#ifdef CONFIG_LOCKDEP995#ifdef CONFIG_LOCKDEP
@@ -1477,7 +1485,6 @@ extern struct pid *cad_pid; · 489 unmodified lines
1477#define PF_KTHREAD 0x00200000 /* I am a kernel thread */1485#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1478#define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */1486#define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */
1479#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */1487#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1480#define PF_MEMSTALL 0x01000000 /* Stalled due to lack of memory */
1481#define PF_UMH 0x02000000 /* I'm an Usermodehelper process */1488#define PF_UMH 0x02000000 /* I'm an Usermodehelper process */
1482#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */1489#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */
1483#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */1490#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
10#include <linux/cred.h>10#include <linux/cred.h>
11#include <linux/refcount.h>11#include <linux/refcount.h>
12#include <linux/posix-timers.h>12#include <linux/posix-timers.h>
13#include <linux/mm_types.h>
14#include <asm/ptrace.h>
13 15
14/*16/*
15 * Types defining task->signal and task->sighand and APIs using them:17 * Types defining task->signal and task->sighand and APIs using them:
@@ -224,7 +226,14 @@ struct signal_struct { · 208 unmodified lines
224 226
225 struct mutex cred_guard_mutex; /* guard against foreign influences on227 struct mutex cred_guard_mutex; /* guard against foreign influences on
226 * credential calculations228 * 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 */
228} __randomize_layout;237} __randomize_layout;
229 238
230/*239/*
@@ -369,6 +378,20 @@ static inline int signal_pending_state(long state, struct task_struct *p) · 138 unmodified lines
369 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);378 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
370}379}
371 380
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 */
387static 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
372/*395/*
373 * Reevaluate whether the task has signals pending delivery.396 * Reevaluate whether the task has signals pending delivery.
374 * Wake the task if so.397 * Wake the task if so.
include/linux/sched/task.h+4−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
13struct task_struct;13struct task_struct;
14struct rusage;14struct rusage;
15union thread_union;15union thread_union;
16struct css_set;
16 17
17/* All the bits taken by the old clone syscall. */18/* All the bits taken by the old clone syscall. */
18#define CLONE_LEGACY_FLAGS 0xffffffffULL19#define CLONE_LEGACY_FLAGS 0xffffffffULL
@@ -29,6 +30,9 @@ struct kernel_clone_args { · 10 unmodified lines
29 pid_t *set_tid;30 pid_t *set_tid;
30 /* Number of elements in *set_tid */31 /* Number of elements in *set_tid */
31 size_t set_tid_size;32 size_t set_tid_size;
33 int cgroup;
34 struct cgroup *cgrp;
35 struct css_set *cset;
32};36};
33 37
34/*38/*
include/linux/sched/topology.h+8−0
@@ -225,6 +225,14 @@ unsigned long arch_scale_cpu_capacity(int cpu) · 224 unmodified lines
225}225}
226#endif226#endif
227 227
228#ifndef arch_scale_thermal_pressure
229static __always_inline
230unsigned long arch_scale_thermal_pressure(int cpu)
231{
232 return 0;
233}
234#endif
235
228static inline int task_node(const struct task_struct *p)236static inline int task_node(const struct task_struct *p)
229{237{
230 return cpu_to_node(task_cpu(p));238 return cpu_to_node(task_cpu(p));
include/linux/seccomp.h+2−1
@@ -7,7 +7,8 @@ · 6 unmodified lines
7#define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \7#define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \
8 SECCOMP_FILTER_FLAG_LOG | \8 SECCOMP_FILTER_FLAG_LOG | \
9 SECCOMP_FILTER_FLAG_SPEC_ALLOW | \9 SECCOMP_FILTER_FLAG_SPEC_ALLOW | \
10 SECCOMP_FILTER_FLAG_NEW_LISTENER)10 SECCOMP_FILTER_FLAG_NEW_LISTENER | \
11 SECCOMP_FILTER_FLAG_TSYNC_ESRCH)
11 12
12#ifdef CONFIG_SECCOMP13#ifdef CONFIG_SECCOMP
13 14
include/linux/security.h+0−1
@@ -30,7 +30,6 @@ · 29 unmodified lines
30#include <linux/err.h>30#include <linux/err.h>
31#include <linux/string.h>31#include <linux/string.h>
32#include <linux/mm.h>32#include <linux/mm.h>
33#include <linux/fs.h>
34 33
35struct linux_binprm;34struct linux_binprm;
36struct cred;35struct cred;
include/linux/selection.h+3−1
@@ -11,8 +11,8 @@ · 10 unmodified lines
11#include <linux/tiocl.h>11#include <linux/tiocl.h>
12#include <linux/vt_buffer.h>12#include <linux/vt_buffer.h>
13 13
14extern struct vc_data *sel_cons;
15struct tty_struct;14struct tty_struct;
15struct vc_data;
16 16
17extern void clear_selection(void);17extern void clear_selection(void);
18extern int set_selection_user(const struct tiocl_selection __user *sel,18extern int set_selection_user(const struct tiocl_selection __user *sel,
@@ -24,6 +24,8 @@ extern int sel_loadlut(char __user *p); · 5 unmodified lines
24extern int mouse_reporting(void);24extern int mouse_reporting(void);
25extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry);25extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry);
26 26
27bool vc_is_sel(struct vc_data *vc);
28
27extern int console_blanked;29extern int console_blanked;
28 30
29extern const unsigned char color_table[];31extern const unsigned char color_table[];
include/linux/seq_file.h+0−1
@@ -21,7 +21,6 @@ struct seq_file { · 20 unmodified lines
21 size_t pad_until;21 size_t pad_until;
22 loff_t index;22 loff_t index;
23 loff_t read_pos;23 loff_t read_pos;
24 u64 version;
25 struct mutex lock;24 struct mutex lock;
26 const struct seq_operations *op;25 const struct seq_operations *op;
27 int poll_event;26 int poll_event;
include/linux/serial_8250.h+4−0
@@ -81,6 +81,7 @@ struct uart_8250_em485 { · 80 unmodified lines
81 struct hrtimer stop_tx_timer; /* "rs485 stop tx" timer */81 struct hrtimer stop_tx_timer; /* "rs485 stop tx" timer */
82 struct hrtimer *active_timer; /* pointer to active timer */82 struct hrtimer *active_timer; /* pointer to active timer */
83 struct uart_8250_port *port; /* for hrtimer callbacks */83 struct uart_8250_port *port; /* for hrtimer callbacks */
84 unsigned int tx_stopped:1; /* tx is currently stopped */
84};85};
85 86
86/*87/*
@@ -132,6 +133,8 @@ struct uart_8250_port { · 45 unmodified lines
132 void (*dl_write)(struct uart_8250_port *, int);133 void (*dl_write)(struct uart_8250_port *, int);
133 134
134 struct uart_8250_em485 *em485;135 struct uart_8250_em485 *em485;
136 void (*rs485_start_tx)(struct uart_8250_port *);
137 void (*rs485_stop_tx)(struct uart_8250_port *);
135 138
136 /* Serial port overrun backoff */139 /* Serial port overrun backoff */
137 struct delayed_work overrun_backoff;140 struct delayed_work overrun_backoff;
@@ -176,6 +179,7 @@ void serial8250_set_defaults(struct uart_8250_port *up); · 38 unmodified lines
176void serial8250_console_write(struct uart_8250_port *up, const char *s,179void serial8250_console_write(struct uart_8250_port *up, const char *s,
177 unsigned int count);180 unsigned int count);
178int serial8250_console_setup(struct uart_port *port, char *options, bool probe);181int serial8250_console_setup(struct uart_port *port, char *options, bool probe);
182int serial8250_console_exit(struct uart_port *port);
179 183
180extern void serial8250_set_isa_configurator(void (*v)184extern void serial8250_set_isa_configurator(void (*v)
181 (int port, struct uart_port *up,185 (int port, struct uart_port *up,
include/linux/serial_core.h+2−2
@@ -243,6 +243,7 @@ struct uart_port { · 242 unmodified lines
243 unsigned long sysrq; /* sysrq timeout */243 unsigned long sysrq; /* sysrq timeout */
244 unsigned int sysrq_ch; /* char for sysrq */244 unsigned int sysrq_ch; /* char for sysrq */
245 unsigned char has_sysrq;245 unsigned char has_sysrq;
246 unsigned char sysrq_seq; /* index in sysrq_toggle_seq */
246 247
247 unsigned char hub6; /* this should be in the 8250 driver */248 unsigned char hub6; /* this should be in the 8250 driver */
248 unsigned char suspended;249 unsigned char suspended;
@@ -461,8 +462,7 @@ extern void uart_insert_char(struct uart_port *port, unsigned int status, · 212 unmodified lines
461 462
462extern int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch);463extern int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch);
463extern int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch);464extern int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch);
464extern void uart_unlock_and_check_sysrq(struct uart_port *port,465extern void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long flags);
465 unsigned long irqflags);
466extern int uart_handle_break(struct uart_port *port);466extern int uart_handle_break(struct uart_port *port);
467 467
468/*468/*
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
78extern int shmem_unuse(unsigned int type, bool frontswap,78extern int shmem_unuse(unsigned int type, bool frontswap,
79 unsigned long *fs_pages_to_unuse);79 unsigned long *fs_pages_to_unuse);
80 80
81extern bool shmem_huge_enabled(struct vm_area_struct *vma);
81extern unsigned long shmem_swap_usage(struct vm_area_struct *vma);82extern unsigned long shmem_swap_usage(struct vm_area_struct *vma);
82extern unsigned long shmem_partial_swap_usage(struct address_space *mapping,83extern unsigned long shmem_partial_swap_usage(struct address_space *mapping,
83 pgoff_t start, pgoff_t end);84 pgoff_t start, pgoff_t end);
@@ -114,15 +115,6 @@ static inline bool shmem_file(struct file *file) · 30 unmodified lines
114extern bool shmem_charge(struct inode *inode, long pages);115extern bool shmem_charge(struct inode *inode, long pages);
115extern void shmem_uncharge(struct inode *inode, long pages);116extern void shmem_uncharge(struct inode *inode, long pages);
116 117
117#ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
118extern bool shmem_huge_enabled(struct vm_area_struct *vma);
119#else
120static inline bool shmem_huge_enabled(struct vm_area_struct *vma)
121{
122 return false;
123}
124#endif
125
126#ifdef CONFIG_SHMEM118#ifdef CONFIG_SHMEM
127extern int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,119extern int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
128 struct vm_area_struct *dst_vma,120 struct vm_area_struct *dst_vma,
include/linux/signal.h+4−4
@@ -444,12 +444,12 @@ void signals_init(void); · 443 unmodified lines
444int restore_altstack(const stack_t __user *);444int restore_altstack(const stack_t __user *);
445int __save_altstack(stack_t __user *, unsigned long);445int __save_altstack(stack_t __user *, unsigned long);
446 446
447#define save_altstack_ex(uss, sp) do { \447#define unsafe_save_altstack(uss, sp, label) do { \
448 stack_t __user *__uss = uss; \448 stack_t __user *__uss = uss; \
449 struct task_struct *t = current; \449 struct task_struct *t = current; \
450 put_user_ex((void __user *)t->sas_ss_sp, &__uss->ss_sp); \450 unsafe_put_user((void __user *)t->sas_ss_sp, &__uss->ss_sp, label); \
451 put_user_ex(t->sas_ss_flags, &__uss->ss_flags); \451 unsafe_put_user(t->sas_ss_flags, &__uss->ss_flags, label); \
452 put_user_ex(t->sas_ss_size, &__uss->ss_size); \452 unsafe_put_user(t->sas_ss_size, &__uss->ss_size, label); \
453 if (t->sas_ss_flags & SS_AUTODISARM) \453 if (t->sas_ss_flags & SS_AUTODISARM) \
454 sas_ss_reset(t); \454 sas_ss_reset(t); \
455} while (0);455} while (0);
include/linux/skbuff.h+55−35
@@ -47,8 +47,8 @@ · 46 unmodified lines
47 * A. IP checksum related features47 * A. IP checksum related features
48 *48 *
49 * Drivers advertise checksum offload capabilities in the features of a device.49 * 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,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 offloading51 * A driver typically only advertises features that it is capable of offloading
52 * to its device.52 * to its device.
53 *53 *
54 * The checksum related features are:54 * The checksum related features are:
@@ -63,7 +63,7 @@ · 8 unmodified lines
63 * TCP or UDP packets over IPv4. These are specifically63 * TCP or UDP packets over IPv4. These are specifically
64 * unencapsulated packets of the form IPv4|TCP or64 * unencapsulated packets of the form IPv4|TCP or
65 * IPv4|UDP where the Protocol field in the IPv4 header65 * IPv4|UDP where the Protocol field in the IPv4 header
66 * is TCP or UDP. The IPv4 header may contain IP options66 * is TCP or UDP. The IPv4 header may contain IP options.
67 * This feature cannot be set in features for a device67 * This feature cannot be set in features for a device
68 * with NETIF_F_HW_CSUM also set. This feature is being68 * with NETIF_F_HW_CSUM also set. This feature is being
69 * DEPRECATED (see below).69 * DEPRECATED (see below).
@@ -79,13 +79,13 @@ · 9 unmodified lines
79 * DEPRECATED (see below).79 * DEPRECATED (see below).
80 *80 *
81 * NETIF_F_RXCSUM - Driver (device) performs receive checksum offload.81 * NETIF_F_RXCSUM - Driver (device) performs receive checksum offload.
82 * This flag is used only used to disable the RX checksum82 * This flag is only used to disable the RX checksum
83 * feature for a device. The stack will accept receive83 * feature for a device. The stack will accept receive
84 * checksum indication in packets received on a device84 * checksum indication in packets received on a device
85 * regardless of whether NETIF_F_RXCSUM is set.85 * regardless of whether NETIF_F_RXCSUM is set.
86 *86 *
87 * B. Checksumming of received packets by device. Indication of checksum87 * 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:
89 *89 *
90 * CHECKSUM_NONE:90 * CHECKSUM_NONE:
91 *91 *
@@ -115,16 +115,16 @@ · 23 unmodified lines
115 * the packet minus one that have been verified as CHECKSUM_UNNECESSARY.115 * the packet minus one that have been verified as CHECKSUM_UNNECESSARY.
116 * For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet116 * For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet
117 * and a device is able to verify the checksums for UDP (possibly zero),117 * 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 to118 * GRE (checksum flag is set) and TCP, skb->csum_level would be set to
119 * two. If the device were only able to verify the UDP checksum and not119 * 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 GRE120 * GRE, either because it doesn't support GRE checksum or because GRE
121 * checksum is bad, skb->csum_level would be set to zero (TCP checksum is121 * checksum is bad, skb->csum_level would be set to zero (TCP checksum is
122 * not considered in this case).122 * not considered in this case).
123 *123 *
124 * CHECKSUM_COMPLETE:124 * CHECKSUM_COMPLETE:
125 *125 *
126 * This is the most generic way. The device supplied checksum of the _whole_126 * 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, the127 * packet as seen by netif_rx() and fills in skb->csum. This means the
128 * hardware doesn't need to parse L3/L4 headers to implement this.128 * hardware doesn't need to parse L3/L4 headers to implement this.
129 *129 *
130 * Notes:130 * Notes:
@@ -153,8 +153,8 @@ · 22 unmodified lines
153 * from skb->csum_start up to the end, and to record/write the checksum at153 * from skb->csum_start up to the end, and to record/write the checksum at
154 * offset skb->csum_start + skb->csum_offset. A driver may verify that the154 * offset skb->csum_start + skb->csum_offset. A driver may verify that the
155 * csum_start and csum_offset values are valid values given the length and155 * 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 the156 * offset of the packet, but it should not attempt to validate that the
157 * checksum refers to a legitimate transport layer checksum-- it is the157 * checksum refers to a legitimate transport layer checksum -- it is the
158 * purview of the stack to validate that csum_start and csum_offset are set158 * purview of the stack to validate that csum_start and csum_offset are set
159 * correctly.159 * correctly.
160 *160 *
@@ -178,18 +178,18 @@ · 17 unmodified lines
178 *178 *
179 * CHECKSUM_UNNECESSARY:179 * CHECKSUM_UNNECESSARY:
180 *180 *
181 * This has the same meaning on as CHECKSUM_NONE for checksum offload on181 * This has the same meaning as CHECKSUM_NONE for checksum offload on
182 * output.182 * output.
183 *183 *
184 * CHECKSUM_COMPLETE:184 * CHECKSUM_COMPLETE:
185 * Not used in checksum output. If a driver observes a packet with this value185 * 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.
187 *187 *
188 * D. Non-IP checksum (CRC) offloads188 * D. Non-IP checksum (CRC) offloads
189 *189 *
190 * NETIF_F_SCTP_CRC - This feature indicates that a device is capable of190 * NETIF_F_SCTP_CRC - This feature indicates that a device is capable of
191 * offloading the SCTP CRC in a packet. To perform this offload the stack191 * 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 to192 * will set csum_start and csum_offset accordingly, set ip_summed to
193 * CHECKSUM_PARTIAL and set csum_not_inet to 1, to provide an indication in193 * CHECKSUM_PARTIAL and set csum_not_inet to 1, to provide an indication in
194 * the skbuff that the CHECKSUM_PARTIAL refers to CRC32c.194 * the skbuff that the CHECKSUM_PARTIAL refers to CRC32c.
195 * A driver that supports both IP checksum offload and SCTP CRC32c offload195 * A driver that supports both IP checksum offload and SCTP CRC32c offload
@@ -200,10 +200,10 @@ · 4 unmodified lines
200 * NETIF_F_FCOE_CRC - This feature indicates that a device is capable of200 * NETIF_F_FCOE_CRC - This feature indicates that a device is capable of
201 * offloading the FCOE CRC in a packet. To perform this offload the stack201 * offloading the FCOE CRC in a packet. To perform this offload the stack
202 * will set ip_summed to CHECKSUM_PARTIAL and set csum_start and csum_offset202 * 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 the203 * accordingly. Note that there is no indication in the skbuff that the
204 * CHECKSUM_PARTIAL refers to an FCOE checksum, a driver that supports204 * CHECKSUM_PARTIAL refers to an FCOE checksum, so a driver that supports
205 * both IP checksum offload and FCOE CRC offload must verify which offload205 * 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.
207 *207 *
208 * E. Checksumming on output with GSO.208 * E. Checksumming on output with GSO.
209 *209 *
@@ -211,9 +211,9 @@ · 1 unmodified line
211 * is implied by the SKB_GSO_* flags in gso_type. Most obviously, if the211 * is implied by the SKB_GSO_* flags in gso_type. Most obviously, if the
212 * gso_type is SKB_GSO_TCPV4 or SKB_GSO_TCPV6, TCP checksum offload as212 * gso_type is SKB_GSO_TCPV4 or SKB_GSO_TCPV6, TCP checksum offload as
213 * part of the GSO operation is implied. If a checksum is being offloaded213 * 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_offset214 * with GSO then ip_summed is CHECKSUM_PARTIAL, and both csum_start and
215 * are set to refer to the outermost checksum being offload (two offloaded215 * csum_offset are set to refer to the outermost checksum being offloaded
216 * checksums are possible with UDP encapsulation).216 * (two offloaded checksums are possible with UDP encapsulation).
217 */217 */
218 218
219/* Don't change this without changing skb_csum_unnecessary! */219/* Don't change this without changing skb_csum_unnecessary! */
@@ -645,8 +645,8 @@ typedef unsigned char *sk_buff_data_t; · 425 unmodified lines
645 * @offload_l3_fwd_mark: Packet was L3-forwarded in hardware645 * @offload_l3_fwd_mark: Packet was L3-forwarded in hardware
646 * @tc_skip_classify: do not classify packet. set by IFB device646 * @tc_skip_classify: do not classify packet. set by IFB device
647 * @tc_at_ingress: used within tc_classify to distinguish in/egress647 * @tc_at_ingress: used within tc_classify to distinguish in/egress
648 * @tc_redirected: packet was redirected by a tc action648 * @redirected: packet was redirected by packet classifier
649 * @tc_from_ingress: if tc_redirected, tc_at_ingress at time of redirect649 * @from_ingress: packet was redirected from the ingress path
650 * @peeked: this packet has been seen already, so stats have been650 * @peeked: this packet has been seen already, so stats have been
651 * done for it, don't do them again651 * done for it, don't do them again
652 * @nf_trace: netfilter packet trace flag652 * @nf_trace: netfilter packet trace flag
@@ -848,8 +848,10 @@ struct sk_buff { · 195 unmodified lines
848#ifdef CONFIG_NET_CLS_ACT848#ifdef CONFIG_NET_CLS_ACT
849 __u8 tc_skip_classify:1;849 __u8 tc_skip_classify:1;
850 __u8 tc_at_ingress:1;850 __u8 tc_at_ingress:1;
851 __u8 tc_redirected:1;851#endif
852 __u8 tc_from_ingress:1;852#ifdef CONFIG_NET_REDIRECT
853 __u8 redirected:1;
854 __u8 from_ingress:1;
853#endif855#endif
854#ifdef CONFIG_TLS_DEVICE856#ifdef CONFIG_TLS_DEVICE
855 __u8 decrypted:1;857 __u8 decrypted:1;
@@ -3514,23 +3516,15 @@ int __skb_wait_for_more_packets(struct sock *sk, struct sk_buff_head *queue, · 2658 unmodified lines
3514struct sk_buff *__skb_try_recv_from_queue(struct sock *sk,3516struct sk_buff *__skb_try_recv_from_queue(struct sock *sk,
3515 struct sk_buff_head *queue,3517 struct sk_buff_head *queue,
3516 unsigned int flags,3518 unsigned int flags,
3517 void (*destructor)(struct sock *sk,
3518 struct sk_buff *skb),
3519 int *off, int *err,3519 int *off, int *err,
3520 struct sk_buff **last);3520 struct sk_buff **last);
3521struct sk_buff *__skb_try_recv_datagram(struct sock *sk,3521struct sk_buff *__skb_try_recv_datagram(struct sock *sk,
3522 struct sk_buff_head *queue,3522 struct sk_buff_head *queue,
3523 unsigned int flags,3523 unsigned int flags, int *off, int *err,
3524 void (*destructor)(struct sock *sk,
3525 struct sk_buff *skb),
3526 int *off, int *err,
3527 struct sk_buff **last);3524 struct sk_buff **last);
3528struct sk_buff *__skb_recv_datagram(struct sock *sk,3525struct sk_buff *__skb_recv_datagram(struct sock *sk,
3529 struct sk_buff_head *sk_queue,3526 struct sk_buff_head *sk_queue,
3530 unsigned int flags,3527 unsigned int flags, int *off, int *err);
3531 void (*destructor)(struct sock *sk,
3532 struct sk_buff *skb),
3533 int *off, int *err);
3534struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,3528struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,
3535 int *err);3529 int *err);
3536__poll_t datagram_poll(struct file *file, struct socket *sock,3530__poll_t datagram_poll(struct file *file, struct socket *sock,
@@ -4395,8 +4389,8 @@ struct skb_gso_cb { · 858 unmodified lines
4395 __wsum csum;4389 __wsum csum;
4396 __u16 csum_start;4390 __u16 csum_start;
4397};4391};
4398#define SKB_SGO_CB_OFFSET 324392#define SKB_GSO_CB_OFFSET 32
4399#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_SGO_CB_OFFSET))4393#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_GSO_CB_OFFSET))
4400 4394
4401static inline int skb_tnl_header_len(const struct sk_buff *inner_skb)4395static inline int skb_tnl_header_len(const struct sk_buff *inner_skb)
4402{4396{
@@ -4579,5 +4573,31 @@ static inline __wsum lco_csum(struct sk_buff *skb) · 176 unmodified lines
4579 return csum_partial(l4_hdr, csum_start - l4_hdr, partial);4573 return csum_partial(l4_hdr, csum_start - l4_hdr, partial);
4580}4574}
4581 4575
4576static 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
4585static 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
4595static inline void skb_reset_redirect(struct sk_buff *skb)
4596{
4597#ifdef CONFIG_NET_REDIRECT
4598 skb->redirected = 0;
4599#endif
4600}
4601
4582#endif /* __KERNEL__ */4602#endif /* __KERNEL__ */
4583#endif /* _LINUX_SKBUFF_H */4603#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
323}323}
324 324
325struct sk_psock_link *sk_psock_link_pop(struct sk_psock *psock);325struct sk_psock_link *sk_psock_link_pop(struct sk_psock *psock);
326#if defined(CONFIG_BPF_STREAM_PARSER)
327void sk_psock_unlink(struct sock *sk, struct sk_psock_link *link);
328#else
329static inline void sk_psock_unlink(struct sock *sk,
330 struct sk_psock_link *link)
331{
332}
333#endif
334 326
335void __sk_psock_purge_ingress_msg(struct sk_psock *psock);327void __sk_psock_purge_ingress_msg(struct sk_psock *psock);
336 328
@@ -347,33 +339,37 @@ static inline void sk_psock_update_proto(struct sock *sk, · 10 unmodified lines
347 struct sk_psock *psock,339 struct sk_psock *psock,
348 struct proto *ops)340 struct proto *ops)
349{341{
350 psock->saved_unhash = sk->sk_prot->unhash;342 /* Initialize saved callbacks and original proto only once, since this
351 psock->saved_close = sk->sk_prot->close;343 * function may be called multiple times for a psock, e.g. when
352 psock->saved_write_space = sk->sk_write_space;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);
353 351
354 psock->sk_proto = sk->sk_prot;352 psock->saved_unhash = orig->unhash;
355 sk->sk_prot = ops;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);
356}361}
357 362
358static inline void sk_psock_restore_proto(struct sock *sk,363static inline void sk_psock_restore_proto(struct sock *sk,
359 struct sk_psock *psock)364 struct sk_psock *psock)
360{365{
361 sk->sk_prot->unhash = psock->saved_unhash;366 sk->sk_prot->unhash = psock->saved_unhash;
362 367 if (inet_csk_has_ulp(sk)) {
363 if (psock->sk_proto) {368 tcp_update_ulp(sk, psock->sk_proto, psock->saved_write_space);
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;
375 } else {369 } else {
376 sk->sk_write_space = psock->saved_write_space;370 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);
377 }373 }
378}374}
379 375
@@ -395,26 +391,6 @@ static inline bool sk_psock_test_state(const struct sk_psock *psock, · 15 unmodified lines
395 return test_bit(bit, &psock->state);391 return test_bit(bit, &psock->state);
396}392}
397 393
398static 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 }
413out:
414 rcu_read_unlock();
415 return psock;
416}
417
418static inline struct sk_psock *sk_psock_get(struct sock *sk)394static inline struct sk_psock *sk_psock_get(struct sock *sk)
419{395{
420 struct sk_psock *psock;396 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
501 * :ref:`Documentation/core-api/mm-api.rst <mm-api-gfp-flags>`501 * :ref:`Documentation/core-api/mm-api.rst <mm-api-gfp-flags>`
502 *502 *
503 * The recommended usage of the @flags is described at503 * 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>`
505 *505 *
506 * Below is a brief outline of the most useful GFP flags506 * Below is a brief outline of the most useful GFP flags
507 *507 *
include/linux/soc/qcom/apr.h+1−0
@@ -85,6 +85,7 @@ struct apr_device { · 84 unmodified lines
85 uint16_t domain_id;85 uint16_t domain_id;
86 uint32_t version;86 uint32_t version;
87 char name[APR_NAME_SIZE];87 char name[APR_NAME_SIZE];
88 const char *service_path;
88 spinlock_t lock;89 spinlock_t lock;
89 struct list_head node;90 struct list_head node;
90};91};
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
9struct pdr_service;
10struct pdr_handle;
11
12enum 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
20struct pdr_handle *pdr_handle_alloc(void (*status)(int state,
21 char *service_path,
22 void *priv), void *priv);
23struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr,
24 const char *service_name,
25 const char *service_path);
26int pdr_restart_pd(struct pdr_handle *pdr, struct pdr_service *pds);
27void 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
88#define QMI_ERR_CLIENT_IDS_EXHAUSTED_V01 588#define QMI_ERR_CLIENT_IDS_EXHAUSTED_V01 5
89#define QMI_ERR_INVALID_ID_V01 4189#define QMI_ERR_INVALID_ID_V01 41
90#define QMI_ERR_ENCODING_V01 5890#define QMI_ERR_ENCODING_V01 58
91#define QMI_ERR_DISABLED_V01 69
91#define QMI_ERR_INCOMPATIBLE_STATE_V01 9092#define QMI_ERR_INCOMPATIBLE_STATE_V01 90
92#define QMI_ERR_NOT_SUPPORTED_V01 9493#define QMI_ERR_NOT_SUPPORTED_V01 94
93 94
include/linux/soc/qcom/smd-rpm.h+1−0
@@ -10,6 +10,7 @@ struct qcom_smd_rpm; · 9 unmodified lines
10/*10/*
11 * Constants used for addressing resources in the RPM.11 * Constants used for addressing resources in the RPM.
12 */12 */
13#define QCOM_SMD_RPM_BBYB 0x62796262
13#define QCOM_SMD_RPM_BOBB 0x62626f6214#define QCOM_SMD_RPM_BOBB 0x62626f62
14#define QCOM_SMD_RPM_BOOST 0x6174736215#define QCOM_SMD_RPM_BOOST 0x61747362
15#define QCOM_SMD_RPM_BUS_CLK 0x316b6c6316#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
391 struct user_msghdr __user *umsg, unsigned flags,391 struct user_msghdr __user *umsg, unsigned flags,
392 struct sockaddr __user **uaddr,392 struct sockaddr __user **uaddr,
393 struct iovec **iov);393 struct iovec **iov);
394extern 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);
394 398
395/* helpers which do the actual work for syscalls */399/* helpers which do the actual work for syscalls */
396extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size,400extern 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
401 int addr_len);405 int addr_len);
402extern int __sys_accept4_file(struct file *file, unsigned file_flags,406extern int __sys_accept4_file(struct file *file, unsigned file_flags,
403 struct sockaddr __user *upeer_sockaddr,407 struct sockaddr __user *upeer_sockaddr,
404 int __user *upeer_addrlen, int flags);408 int __user *upeer_addrlen, int flags,
409 unsigned long nofile);
405extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,410extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
406 int __user *upeer_addrlen, int flags);411 int __user *upeer_addrlen, int flags);
407extern int __sys_socket(int family, int type, int protocol);412extern 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
79 SDW_SLAVE_RESERVED = 3,79 SDW_SLAVE_RESERVED = 3,
80};80};
81 81
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 */
90enum 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
82/**97/**
83 * enum sdw_command_response - Command response as defined by SDW spec98 * enum sdw_command_response - Command response as defined by SDW spec
84 * @SDW_CMD_OK: cmd was successful99 * @SDW_CMD_OK: cmd was successful
@@ -284,6 +299,7 @@ struct sdw_dpn_audio_mode { · 199 unmodified lines
284 * @max_async_buffer: Number of samples that this port can buffer in299 * @max_async_buffer: Number of samples that this port can buffer in
285 * asynchronous modes300 * asynchronous modes
286 * @block_pack_mode: Type of block port mode supported301 * @block_pack_mode: Type of block port mode supported
302 * @read_only_wordlength: Read Only wordlength field in DPN_BlockCtrl1 register
287 * @port_encoding: Payload Channel Sample encoding schemes supported303 * @port_encoding: Payload Channel Sample encoding schemes supported
288 * @audio_modes: Audio modes supported304 * @audio_modes: Audio modes supported
289 */305 */
@@ -307,6 +323,7 @@ struct sdw_dpn_prop { · 17 unmodified lines
307 u32 modes;323 u32 modes;
308 u32 max_async_buffer;324 u32 max_async_buffer;
309 bool block_pack_mode;325 bool block_pack_mode;
326 bool read_only_wordlength;
310 u32 port_encoding;327 u32 port_encoding;
311 struct sdw_dpn_audio_mode *audio_modes;328 struct sdw_dpn_audio_mode *audio_modes;
312};329};
@@ -424,6 +441,29 @@ struct sdw_slave_id { · 111 unmodified lines
424 __u8 sdw_version:4;441 __u8 sdw_version:4;
425};442};
426 443
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
427/**467/**
428 * struct sdw_slave_intr_status - Slave interrupt status468 * struct sdw_slave_intr_status - Slave interrupt status
429 * @control_port: control port status469 * @control_port: control port status
@@ -533,6 +573,11 @@ struct sdw_slave_ops { · 103 unmodified lines
533 int (*port_prep)(struct sdw_slave *slave,573 int (*port_prep)(struct sdw_slave *slave,
534 struct sdw_prepare_ch *prepare_ch,574 struct sdw_prepare_ch *prepare_ch,
535 enum sdw_port_prep_ops pre_ops);575 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
536};581};
537 582
538/**583/**
@@ -575,6 +620,7 @@ struct sdw_slave { · 36 unmodified lines
575#endif620#endif
576 struct list_head node;621 struct list_head node;
577 struct completion *port_ready;622 struct completion *port_ready;
623 enum sdw_clk_stop_mode curr_clk_stop_mode;
578 u16 dev_num;624 u16 dev_num;
579 u16 dev_num_sticky;625 u16 dev_num_sticky;
580 bool probed;626 bool probed;
@@ -892,6 +938,9 @@ int sdw_prepare_stream(struct sdw_stream_runtime *stream); · 311 unmodified lines
892int sdw_enable_stream(struct sdw_stream_runtime *stream);938int sdw_enable_stream(struct sdw_stream_runtime *stream);
893int sdw_disable_stream(struct sdw_stream_runtime *stream);939int sdw_disable_stream(struct sdw_stream_runtime *stream);
894int sdw_deprepare_stream(struct sdw_stream_runtime *stream);940int sdw_deprepare_stream(struct sdw_stream_runtime *stream);
941int sdw_bus_prep_clk_stop(struct sdw_bus *bus);
942int sdw_bus_clk_stop(struct sdw_bus *bus);
943int sdw_bus_exit_clk_stop(struct sdw_bus *bus);
895 944
896/* messaging and data APIs */945/* messaging and data APIs */
897 946
include/linux/spi/corgi_lcd.h+0−3
@@ -11,9 +11,6 @@ struct corgi_lcd_platform_data { · 10 unmodified lines
11 int default_intensity;11 int default_intensity;
12 int limit_mask;12 int limit_mask;
13 13
14 int gpio_backlight_on; /* -1 if n/a */
15 int gpio_backlight_cont; /* -1 if n/a */
16
17 void (*notify)(int intensity);14 void (*notify)(int intensity);
18 void (*kick_battery)(void);15 void (*kick_battery)(void);
19};16};
include/linux/spi/ifx_modem.h+0−5
@@ -3,12 +3,7 @@ · 2 unmodified lines
3#define LINUX_IFX_MODEM_H3#define LINUX_IFX_MODEM_H
4 4
5struct ifx_modem_platform_data {5struct 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 */
9 unsigned short tx_pwr; /* modem power threshold */6 unsigned short tx_pwr; /* modem power threshold */
10 unsigned short srdy; /* SRDY */
11 unsigned short mrdy; /* MRDY */
12 unsigned char modem_type; /* Modem type */7 unsigned char modem_type; /* Modem type */
13 unsigned long max_hz; /* max SPI frequency */8 unsigned long max_hz; /* max SPI frequency */
14 unsigned short use_dma:1; /* spi protocol driver supplies9 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
135 * @modalias: Name of the driver to use with this device, or an alias135 * @modalias: Name of the driver to use with this device, or an alias
136 * for that name. This appears in the sysfs "modalias" attribute136 * for that name. This appears in the sysfs "modalias" attribute
137 * for driver coldplugging, and in uevents used for hotplugging137 * 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.
138 * @cs_gpio: LEGACY: gpio number of the chipselect line (optional, -ENOENT when140 * @cs_gpio: LEGACY: gpio number of the chipselect line (optional, -ENOENT when
139 * not using a GPIO line) use cs_gpiod in new drivers by opting in on141 * not using a GPIO line) use cs_gpiod in new drivers by opting in on
140 * the spi_master.142 * the spi_master.
@@ -443,6 +445,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 302 unmodified lines
443 * @spi_transfer->ptp_sts_word_post were transmitted.445 * @spi_transfer->ptp_sts_word_post were transmitted.
444 * If the driver does not set this, the SPI core takes the snapshot as446 * If the driver does not set this, the SPI core takes the snapshot as
445 * close to the driver hand-over as possible.447 * close to the driver hand-over as possible.
448 * @irq_flags: Interrupt enable state during PTP system timestamping
446 *449 *
447 * Each SPI controller can communicate with one or more @spi_device450 * Each SPI controller can communicate with one or more @spi_device
448 * children. These make a small bus, sharing MOSI, MISO and SCK signals451 * children. These make a small bus, sharing MOSI, MISO and SCK signals
@@ -481,6 +484,9 @@ struct spi_controller { · 32 unmodified lines
481 /* spi_device.mode flags understood by this controller driver */484 /* spi_device.mode flags understood by this controller driver */
482 u32 mode_bits;485 u32 mode_bits;
483 486
487 /* spi_device.mode flags override flags for this controller */
488 u32 buswidth_override_bits;
489
484 /* bitmask of supported bits_per_word for transfers */490 /* bitmask of supported bits_per_word for transfers */
485 u32 bits_per_word_mask;491 u32 bits_per_word_mask;
486#define SPI_BPW_MASK(bits) BIT((bits) - 1)492#define SPI_BPW_MASK(bits) BIT((bits) - 1)
@@ -930,8 +936,7 @@ struct spi_transfer { · 443 unmodified lines
930 936
931 struct ptp_system_timestamp *ptp_sts;937 struct ptp_system_timestamp *ptp_sts;
932 938
933 bool timestamped_pre;939 bool timestamped;
934 bool timestamped_post;
935 940
936 struct list_head transfer_list;941 struct list_head transfer_list;
937};942};
include/linux/spinlock.h+25−10
@@ -93,12 +93,13 @@ · 92 unmodified lines
93 93
94#ifdef CONFIG_DEBUG_SPINLOCK94#ifdef CONFIG_DEBUG_SPINLOCK
95 extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,95 extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
96 struct lock_class_key *key);96 struct lock_class_key *key, short inner);
97# define raw_spin_lock_init(lock) \97
98do { \98# define raw_spin_lock_init(lock) \
99 static struct lock_class_key __key; \99do { \
100 \100 static struct lock_class_key __key; \
101 __raw_spin_lock_init((lock), #lock, &__key); \101 \
102 __raw_spin_lock_init((lock), #lock, &__key, LD_WAIT_SPIN); \
102} while (0)103} while (0)
103 104
104#else105#else
@@ -327,12 +328,26 @@ static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) · 222 unmodified lines
327 return &lock->rlock;328 return &lock->rlock;
328}329}
329 330
330#define spin_lock_init(_lock) \331#ifdef CONFIG_DEBUG_SPINLOCK
331do { \332
332 spinlock_check(_lock); \333# define spin_lock_init(lock) \
333 raw_spin_lock_init(&(_lock)->rlock); \334do { \
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) \
344do { \
345 spinlock_check(_lock); \
346 *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \
334} while (0)347} while (0)
335 348
349#endif
350
336static __always_inline void spin_lock(spinlock_t *lock)351static __always_inline void spin_lock(spinlock_t *lock)
337{352{
338 raw_spin_lock(&lock->rlock);353 raw_spin_lock(&lock->rlock);
include/linux/spinlock_types.h+20−4
@@ -33,8 +33,18 @@ typedef struct raw_spinlock { · 32 unmodified lines
33#define SPINLOCK_OWNER_INIT ((void *)-1L)33#define SPINLOCK_OWNER_INIT ((void *)-1L)
34 34
35#ifdef CONFIG_DEBUG_LOCK_ALLOC35#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 }
37#else46#else
47# define RAW_SPIN_DEP_MAP_INIT(lockname)
38# define SPIN_DEP_MAP_INIT(lockname)48# define SPIN_DEP_MAP_INIT(lockname)
39#endif49#endif
40 50
@@ -51,7 +61,7 @@ typedef struct raw_spinlock { · 10 unmodified lines
51 { \61 { \
52 .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \62 .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
53 SPIN_DEBUG_INIT(lockname) \63 SPIN_DEBUG_INIT(lockname) \
54 SPIN_DEP_MAP_INIT(lockname) }64 RAW_SPIN_DEP_MAP_INIT(lockname) }
55 65
56#define __RAW_SPIN_LOCK_UNLOCKED(lockname) \66#define __RAW_SPIN_LOCK_UNLOCKED(lockname) \
57 (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname)67 (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname)
@@ -72,11 +82,17 @@ typedef struct spinlock { · 14 unmodified lines
72 };82 };
73} spinlock_t;83} spinlock_t;
74 84
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
75#define __SPIN_LOCK_INITIALIZER(lockname) \91#define __SPIN_LOCK_INITIALIZER(lockname) \
76 { { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } }92 { { .rlock = ___SPIN_LOCK_INITIALIZER(lockname) } }
77 93
78#define __SPIN_LOCK_UNLOCKED(lockname) \94#define __SPIN_LOCK_UNLOCKED(lockname) \
79 (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)95 (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname)
80 96
81#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)97#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
82 98
include/linux/splice.h+3−0
@@ -78,6 +78,9 @@ extern ssize_t add_to_pipe(struct pipe_inode_info *, · 77 unmodified lines
78 struct pipe_buffer *);78 struct pipe_buffer *);
79extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,79extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
80 splice_direct_actor *);80 splice_direct_actor *);
81extern 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);
81 84
82/*85/*
83 * for dynamic pipe sizing86 * 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
19unsigned int stack_depot_fetch(depot_stack_handle_t handle,19unsigned int stack_depot_fetch(depot_stack_handle_t handle,
20 unsigned long **entries);20 unsigned long **entries);
21 21
22unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries);
23
22#endif24#endif
include/linux/stackprotector.h+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
6#include <linux/sched.h>6#include <linux/sched.h>
7#include <linux/random.h>7#include <linux/random.h>
8 8
9#ifdef CONFIG_STACKPROTECTOR9#if defined(CONFIG_STACKPROTECTOR) || defined(CONFIG_ARM64_PTR_AUTH)
10# include <asm/stackprotector.h>10# include <asm/stackprotector.h>
11#else11#else
12static inline void boot_init_stack_canary(void)12static inline void boot_init_stack_canary(void)
include/linux/stmmac.h+1−0
@@ -80,6 +80,7 @@ · 79 unmodified lines
80 80
81struct stmmac_mdio_bus_data {81struct stmmac_mdio_bus_data {
82 unsigned int phy_mask;82 unsigned int phy_mask;
83 unsigned int has_xpcs;
83 int *irqs;84 int *irqs;
84 int probed_phy_irq;85 int probed_phy_irq;
85 bool needs_reset;86 bool needs_reset;
include/linux/sunrpc/cache.h+6−3
@@ -179,6 +179,9 @@ sunrpc_cache_update(struct cache_detail *detail, · 178 unmodified lines
179 179
180extern int180extern int
181sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h);181sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h);
182extern int
183sunrpc_cache_pipe_upcall_timeout(struct cache_detail *detail,
184 struct cache_head *h);
182 185
183 186
184extern void cache_clean_deferred(void *owner);187extern 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
206 209
207static inline bool cache_is_expired(struct cache_detail *detail, struct cache_head *h)210static inline bool cache_is_expired(struct cache_detail *detail, struct cache_head *h)
208{211{
212 if (h->expiry_time < seconds_since_boot())
213 return true;
209 if (!test_bit(CACHE_VALID, &h->flags))214 if (!test_bit(CACHE_VALID, &h->flags))
210 return false;215 return false;
211 216 return detail->flush_time >= h->last_refresh;
212 return (h->expiry_time < seconds_since_boot()) ||
213 (detail->flush_time >= h->last_refresh);
214}217}
215 218
216extern int cache_check(struct cache_detail *detail,219extern int cache_check(struct cache_detail *detail,
include/linux/sunrpc/rpc_rdma.h+2−1
@@ -58,7 +58,8 @@ enum { · 57 unmodified lines
58enum {58enum {
59 rpcrdma_fixed_maxsz = 4,59 rpcrdma_fixed_maxsz = 4,
60 rpcrdma_segment_maxsz = 4,60 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,
62};63};
63 64
64/*65/*
include/linux/sunrpc/sched.h+1−0
@@ -132,6 +132,7 @@ struct rpc_task_setup { · 131 unmodified lines
132#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */132#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
133#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */133#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
134#define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */134#define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */
135#define RPC_TASK_CRED_NOREF 0x8000 /* No refcount on the credential */
135 136
136#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)137#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
137#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)138#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
380 struct cache_deferred_req handle;380 struct cache_deferred_req handle;
381 size_t xprt_hlen;381 size_t xprt_hlen;
382 int argslen;382 int argslen;
383 __be32 args[0];383 __be32 args[];
384};384};
385 385
386struct svc_process_info {386struct svc_process_info {
@@ -517,6 +517,9 @@ void svc_wake_up(struct svc_serv *); · 130 unmodified lines
517void svc_reserve(struct svc_rqst *rqstp, int space);517void svc_reserve(struct svc_rqst *rqstp, int space);
518struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);518struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);
519char * svc_print_addr(struct svc_rqst *, char *, size_t);519char * svc_print_addr(struct svc_rqst *, char *, size_t);
520int svc_encode_read_payload(struct svc_rqst *rqstp,
521 unsigned int offset,
522 unsigned int length);
520unsigned int svc_fill_write_vector(struct svc_rqst *rqstp,523unsigned int svc_fill_write_vector(struct svc_rqst *rqstp,
521 struct page **pages,524 struct page **pages,
522 struct kvec *first, size_t total);525 struct kvec *first, size_t total);
include/linux/sunrpc/svc_rdma.h+17−7
@@ -52,6 +52,7 @@ · 51 unmodified lines
52 52
53/* Default and maximum inline threshold sizes */53/* Default and maximum inline threshold sizes */
54enum {54enum {
55 RPCRDMA_PULLUP_THRESH = RPCRDMA_V1_DEF_INLINE_SIZE >> 1,
55 RPCRDMA_DEF_INLINE_THRESH = 4096,56 RPCRDMA_DEF_INLINE_THRESH = 4096,
56 RPCRDMA_MAX_INLINE_THRESH = 6553657 RPCRDMA_MAX_INLINE_THRESH = 65536
57};58};
@@ -132,11 +133,16 @@ struct svc_rdma_recv_ctxt { · 74 unmodified lines
132 struct ib_sge rc_recv_sge;133 struct ib_sge rc_recv_sge;
133 void *rc_recv_buf;134 void *rc_recv_buf;
134 struct xdr_buf rc_arg;135 struct xdr_buf rc_arg;
136 struct xdr_stream rc_stream;
135 bool rc_temp;137 bool rc_temp;
136 u32 rc_byte_len;138 u32 rc_byte_len;
137 unsigned int rc_page_count;139 unsigned int rc_page_count;
138 unsigned int rc_hdr_count;140 unsigned int rc_hdr_count;
139 u32 rc_inv_rkey;141 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;
140 struct page *rc_pages[RPCSVC_MAXPAGES];146 struct page *rc_pages[RPCSVC_MAXPAGES];
141};147};
142 148
@@ -144,6 +150,8 @@ struct svc_rdma_send_ctxt { · 1 unmodified line
144 struct list_head sc_list;150 struct list_head sc_list;
145 struct ib_send_wr sc_send_wr;151 struct ib_send_wr sc_send_wr;
146 struct ib_cqe sc_cqe;152 struct ib_cqe sc_cqe;
153 struct xdr_buf sc_hdrbuf;
154 struct xdr_stream sc_stream;
147 void *sc_xprt_buf;155 void *sc_xprt_buf;
148 int sc_page_count;156 int sc_page_count;
149 int sc_cur_sge_no;157 int sc_cur_sge_no;
@@ -170,9 +178,11 @@ extern int svc_rdma_recv_read_chunk(struct svcxprt_rdma *rdma, · 20 unmodified lines
170 struct svc_rqst *rqstp,178 struct svc_rqst *rqstp,
171 struct svc_rdma_recv_ctxt *head, __be32 *p);179 struct svc_rdma_recv_ctxt *head, __be32 *p);
172extern int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma,180extern 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);
174extern int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,184extern int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
175 __be32 *rp_ch, bool writelist,185 const struct svc_rdma_recv_ctxt *rctxt,
176 struct xdr_buf *xdr);186 struct xdr_buf *xdr);
177 187
178/* svc_rdma_sendto.c */188/* svc_rdma_sendto.c */
@@ -182,13 +192,13 @@ extern struct svc_rdma_send_ctxt * · 3 unmodified lines
182extern void svc_rdma_send_ctxt_put(struct svcxprt_rdma *rdma,192extern void svc_rdma_send_ctxt_put(struct svcxprt_rdma *rdma,
183 struct svc_rdma_send_ctxt *ctxt);193 struct svc_rdma_send_ctxt *ctxt);
184extern int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr);194extern int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr);
185extern void svc_rdma_sync_reply_hdr(struct svcxprt_rdma *rdma,
186 struct svc_rdma_send_ctxt *ctxt,
187 unsigned int len);
188extern int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma,195extern int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma,
189 struct svc_rdma_send_ctxt *ctxt,196 struct svc_rdma_send_ctxt *sctxt,
190 struct xdr_buf *xdr, __be32 *wr_lst);197 const struct svc_rdma_recv_ctxt *rctxt,
198 struct xdr_buf *xdr);
191extern int svc_rdma_sendto(struct svc_rqst *);199extern int svc_rdma_sendto(struct svc_rqst *);
200extern int svc_rdma_read_payload(struct svc_rqst *rqstp, unsigned int offset,
201 unsigned int length);
192 202
193/* svc_rdma_transport.c */203/* svc_rdma_transport.c */
194extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);204extern 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
21 int (*xpo_has_wspace)(struct svc_xprt *);21 int (*xpo_has_wspace)(struct svc_xprt *);
22 int (*xpo_recvfrom)(struct svc_rqst *);22 int (*xpo_recvfrom)(struct svc_rqst *);
23 int (*xpo_sendto)(struct svc_rqst *);23 int (*xpo_sendto)(struct svc_rqst *);
24 int (*xpo_read_payload)(struct svc_rqst *, unsigned int,
25 unsigned int);
24 void (*xpo_release_rqst)(struct svc_rqst *);26 void (*xpo_release_rqst)(struct svc_rqst *);
25 void (*xpo_detach)(struct svc_xprt *);27 void (*xpo_detach)(struct svc_xprt *);
26 void (*xpo_free)(struct svc_xprt *);28 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
184extern void xdr_shift_buf(struct xdr_buf *, size_t);184extern void xdr_shift_buf(struct xdr_buf *, size_t);
185extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *);185extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *);
186extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int);186extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int);
187extern int xdr_buf_read_mic(struct xdr_buf *, struct xdr_netobj *, unsigned int);
188extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);187extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
189extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);188extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
190 189
191/*
192 * Helper structure for copying from an sk_buff.
193 */
194struct xdr_skb_reader {
195 struct sk_buff *skb;
196 unsigned int offset;
197 size_t count;
198 __wsum csum;
199};
200
201typedef size_t (*xdr_skb_read_actor)(struct xdr_skb_reader *desc, void *to, size_t len);
202
203extern int csum_partial_copy_to_xdr(struct xdr_buf *, struct sk_buff *);
204
205extern int xdr_encode_word(struct xdr_buf *, unsigned int, u32);190extern int xdr_encode_word(struct xdr_buf *, unsigned int, u32);
206extern int xdr_decode_word(struct xdr_buf *, unsigned int, u32 *);191extern int xdr_decode_word(struct xdr_buf *, unsigned int, u32 *);
207 192
@@ -300,6 +285,59 @@ xdr_align_size(size_t n) · 92 unmodified lines
300 return (n + mask) & ~mask;285 return (n + mask) & ~mask;
301}286}
302 287
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 */
298static 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 */
311static 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 */
330static 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
303/**341/**
304 * xdr_stream_encode_u32 - Encode a 32-bit integer342 * xdr_stream_encode_u32 - Encode a 32-bit integer
305 * @xdr: pointer to xdr_stream343 * @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
566 566
567#endif /* !CONFIG_PM_AUTOSLEEP */567#endif /* !CONFIG_PM_AUTOSLEEP */
568 568
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 */
577unsigned long page_key_additional_pages(unsigned long pages);
578int page_key_alloc(unsigned long pages);
579void page_key_free(void);
580void page_key_read(unsigned long *pfn);
581void page_key_memorize(unsigned long *pfn);
582void page_key_write(void *address);
583
584#else /* !CONFIG_ARCH_SAVE_PAGE_KEYS */
585
586static inline unsigned long page_key_additional_pages(unsigned long pages)
587{
588 return 0;
589}
590
591static inline int page_key_alloc(unsigned long pages)
592{
593 return 0;
594}
595
596static inline void page_key_free(void) {}
597static inline void page_key_read(unsigned long *pfn) {}
598static inline void page_key_memorize(unsigned long *pfn) {}
599static inline void page_key_write(void *address) {}
600
601#endif /* !CONFIG_ARCH_SAVE_PAGE_KEYS */
602
603#endif /* _LINUX_SUSPEND_H */569#endif /* _LINUX_SUSPEND_H */
include/linux/swap.h+0−1
@@ -374,7 +374,6 @@ extern int sysctl_min_slab_ratio; · 373 unmodified lines
374#define node_reclaim_mode 0374#define node_reclaim_mode 0
375#endif375#endif
376 376
377extern int page_evictable(struct page *page);
378extern void check_move_unevictable_pages(struct pagevec *pvec);377extern void check_move_unevictable_pages(struct pagevec *pvec);
379 378
380extern int kswapd_run(int nid);379extern 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
68 68
69 if (pte_swp_soft_dirty(pte))69 if (pte_swp_soft_dirty(pte))
70 pte = pte_swp_clear_soft_dirty(pte);70 pte = pte_swp_clear_soft_dirty(pte);
71 if (pte_swp_uffd_wp(pte))
72 pte = pte_swp_clear_uffd_wp(pte);
71 arch_entry = __pte_to_swp_entry(pte);73 arch_entry = __pte_to_swp_entry(pte);
72 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry));74 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry));
73}75}
@@ -348,7 +350,8 @@ static inline void num_poisoned_pages_inc(void) · 274 unmodified lines
348}350}
349#endif351#endif
350 352
351#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION)353#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) || \
354 defined(CONFIG_DEVICE_PRIVATE)
352static inline int non_swap_entry(swp_entry_t entry)355static inline int non_swap_entry(swp_entry_t entry)
353{356{
354 return swp_type(entry) >= MAX_SWAPFILES;357 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
297 struct kobject *target, const char *link_name);297 struct kobject *target, const char *link_name);
298void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,298void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
299 const char *link_name);299 const char *link_name);
300int __compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,300int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
301 struct kobject *target_kobj,301 struct kobject *target_kobj,
302 const char *target_name);302 const char *target_name,
303 const char *symlink_name);
303 304
304void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);305void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
305 306
@@ -310,6 +311,18 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) · 4 unmodified lines
310 return kernfs_enable_ns(kn);311 return kernfs_enable_ns(kn);
311}312}
312 313
314int sysfs_file_change_owner(struct kobject *kobj, const char *name, kuid_t kuid,
315 kgid_t kgid);
316int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid);
317int sysfs_link_change_owner(struct kobject *kobj, struct kobject *targ,
318 const char *name, kuid_t kuid, kgid_t kgid);
319int sysfs_groups_change_owner(struct kobject *kobj,
320 const struct attribute_group **groups,
321 kuid_t kuid, kgid_t kgid);
322int sysfs_group_change_owner(struct kobject *kobj,
323 const struct attribute_group *groups, kuid_t kuid,
324 kgid_t kgid);
325
313#else /* CONFIG_SYSFS */326#else /* CONFIG_SYSFS */
314 327
315static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)328static 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
500{513{
501}514}
502 515
503static inline int __compat_only_sysfs_link_entry_to_kobj(516static inline int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
504 struct kobject *kobj,517 struct kobject *target_kobj,
505 struct kobject *target_kobj,518 const char *target_name,
506 const char *target_name)519 const char *symlink_name)
507{520{
508 return 0;521 return 0;
509}522}
@@ -522,6 +535,40 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) · 12 unmodified lines
522{535{
523}536}
524 537
538static 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
545static 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
553static inline int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid)
554{
555 return 0;
556}
557
558static 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
565static 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
525#endif /* CONFIG_SYSFS */572#endif /* CONFIG_SYSFS */
526 573
527static inline int __must_check sysfs_create_file(struct kobject *kobj,574static 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
50struct sysrq_key_op *__sysrq_get_key_op(int key);50struct sysrq_key_op *__sysrq_get_key_op(int key);
51 51
52int sysrq_toggle_support(int enable_mask);52int sysrq_toggle_support(int enable_mask);
53int sysrq_mask(void);
53 54
54#else55#else
55 56
@@ -71,6 +72,12 @@ static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op) · 15 unmodified lines
71 return -EINVAL;72 return -EINVAL;
72}73}
73 74
75static inline int sysrq_mask(void)
76{
77 /* Magic SysRq disabled mask */
78 return 0;
79}
80
74#endif81#endif
75 82
76#endif /* _LINUX_SYSRQ_H */83#endif /* _LINUX_SYSRQ_H */
include/linux/tcp.h+24−2
@@ -86,9 +86,19 @@ struct mptcp_options_received { · 85 unmodified lines
86 u64 data_seq;86 u64 data_seq;
87 u32 subflow_seq;87 u32 subflow_seq;
88 u16 data_len;88 u16 data_len;
89 u8 mp_capable : 1,89 u16 mp_capable : 1,
90 mp_join : 1,90 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;
92 u8 use_map:1,102 u8 use_map:1,
93 dsn64:1,103 dsn64:1,
94 data_fin:1,104 data_fin:1,
@@ -96,6 +106,16 @@ struct mptcp_options_received { · 1 unmodified line
96 ack64:1,106 ack64:1,
97 mpc_map:1,107 mpc_map:1,
98 __unused:2;108 __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;
99};119};
100#endif120#endif
101 121
@@ -131,6 +151,8 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt) · 29 unmodified lines
131#if IS_ENABLED(CONFIG_MPTCP)151#if IS_ENABLED(CONFIG_MPTCP)
132 rx_opt->mptcp.mp_capable = 0;152 rx_opt->mptcp.mp_capable = 0;
133 rx_opt->mptcp.mp_join = 0;153 rx_opt->mptcp.mp_join = 0;
154 rx_opt->mptcp.add_addr = 0;
155 rx_opt->mptcp.rm_addr = 0;
134 rx_opt->mptcp.dss = 0;156 rx_opt->mptcp.dss = 0;
135#endif157#endif
136}158}
include/linux/tee_drv.h+1−18
@@ -49,7 +49,6 @@ struct tee_shm_pool; · 48 unmodified lines
49 */49 */
50struct tee_context {50struct tee_context {
51 struct tee_device *teedev;51 struct tee_device *teedev;
52 struct list_head list_shm;
53 void *data;52 void *data;
54 struct kref refcount;53 struct kref refcount;
55 bool releasing;54 bool releasing;
@@ -168,9 +167,7 @@ void tee_device_unregister(struct tee_device *teedev); · 112 unmodified lines
168 167
169/**168/**
170 * struct tee_shm - shared memory object169 * struct tee_shm - shared memory object
171 * @teedev: device used to allocate the object170 * @ctx: context using the object
172 * @ctx: context using the object, if NULL the context is gone
173 * @link link element
174 * @paddr: physical address of the shared memory171 * @paddr: physical address of the shared memory
175 * @kaddr: virtual address of the shared memory172 * @kaddr: virtual address of the shared memory
176 * @size: size of shared memory173 * @size: size of shared memory
@@ -185,9 +182,7 @@ void tee_device_unregister(struct tee_device *teedev); · 8 unmodified lines
185 * subsystem and from drivers that implements their own shm pool manager.182 * subsystem and from drivers that implements their own shm pool manager.
186 */183 */
187struct tee_shm {184struct tee_shm {
188 struct tee_device *teedev;
189 struct tee_context *ctx;185 struct tee_context *ctx;
190 struct list_head link;
191 phys_addr_t paddr;186 phys_addr_t paddr;
192 void *kaddr;187 void *kaddr;
193 size_t size;188 size_t size;
@@ -318,18 +313,6 @@ void *tee_get_drvdata(struct tee_device *teedev); · 124 unmodified lines
318 */313 */
319struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags);314struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags);
320 315
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 */
331struct tee_shm *tee_shm_priv_alloc(struct tee_device *teedev, size_t size);
332
333/**316/**
334 * tee_shm_register() - Register shared memory buffer317 * tee_shm_register() - Register shared memory buffer
335 * @ctx: Context that registers the shared memory318 * @ctx: Context that registers the shared memory
include/linux/thermal.h+10−0
@@ -364,6 +364,9 @@ struct thermal_trip { · 363 unmodified lines
364 364
365/* Function declarations */365/* Function declarations */
366#ifdef CONFIG_THERMAL_OF366#ifdef CONFIG_THERMAL_OF
367int thermal_zone_of_get_sensor_id(struct device_node *tz_np,
368 struct device_node *sensor_np,
369 u32 *id);
367struct thermal_zone_device *370struct thermal_zone_device *
368thermal_zone_of_sensor_register(struct device *dev, int id, void *data,371thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
369 const struct thermal_zone_of_device_ops *ops);372 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
375void devm_thermal_zone_of_sensor_unregister(struct device *dev,378void devm_thermal_zone_of_sensor_unregister(struct device *dev,
376 struct thermal_zone_device *tz);379 struct thermal_zone_device *tz);
377#else380#else
381
382static 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}
378static inline struct thermal_zone_device *388static inline struct thermal_zone_device *
379thermal_zone_of_sensor_register(struct device *dev, int id, void *data,389thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
380 const struct thermal_zone_of_device_ops *ops)390 const struct thermal_zone_of_device_ops *ops)
include/linux/threads.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29 29
30/*30/*
31 * A maximum of 4 million PIDs should be enough for a while.31 * 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.]
33 */33 */
34#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \34#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
35 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))35 (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
111 */111 */
112#define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l))112#define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l))
113 113
114struct timens_offset {114# include <vdso/time.h>
115 s64 sec;
116 u64 nsec;
117};
118 115
119#endif116#endif
include/linux/time32.h+1−11
@@ -12,17 +12,7 @@ · 11 unmodified lines
12#include <linux/time64.h>12#include <linux/time64.h>
13#include <linux/timex.h>13#include <linux/timex.h>
14 14
15typedef s32 old_time32_t;15#include <vdso/time32.h>
16
17struct old_timespec32 {
18 old_time32_t tv_sec;
19 s32 tv_nsec;
20};
21
22struct old_timeval32 {
23 old_time32_t tv_sec;
24 s32 tv_usec;
25};
26 16
27struct old_itimerspec32 {17struct old_itimerspec32 {
28 struct old_timespec32 it_interval;18 struct old_timespec32 it_interval;
include/linux/time64.h+1−9
@@ -3,6 +3,7 @@ · 2 unmodified lines
3#define _LINUX_TIME64_H3#define _LINUX_TIME64_H
4 4
5#include <linux/math64.h>5#include <linux/math64.h>
6#include <vdso/time64.h>
6 7
7typedef __s64 time64_t;8typedef __s64 time64_t;
8typedef __u64 timeu64_t;9typedef __u64 timeu64_t;
@@ -19,15 +20,6 @@ struct itimerspec64 { · 10 unmodified lines
19 struct timespec64 it_value;20 struct timespec64 it_value;
20};21};
21 22
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
31/* Located here for timespec[64]_valid_strict */23/* Located here for timespec[64]_valid_strict */
32#define TIME64_MAX ((s64)~((u64)1 << 63))24#define TIME64_MAX ((s64)~((u64)1 << 63))
33#define TIME64_MIN (-TIME64_MAX - 1)25#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
164 */164 */
165static inline int timer_pending(const struct timer_list * timer)165static inline int timer_pending(const struct timer_list * timer)
166{166{
167 return timer->entry.pprev != NULL;167 return !hlist_unhashed_lockless(&timer->entry);
168}168}
169 169
170extern void add_timer_on(struct timer_list *timer, int cpu);170extern 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
86/* Format a tnum as tristate binary expansion */86/* Format a tnum as tristate binary expansion */
87int tnum_sbin(char *str, size_t size, struct tnum a);87int tnum_sbin(char *str, size_t size, struct tnum a);
88 88
89/* Returns the 32-bit subreg */
90struct tnum tnum_subreg(struct tnum a);
91/* Returns the tnum with the lower 32-bit subreg cleared */
92struct tnum tnum_clear_subreg(struct tnum a);
93/* Returns the tnum with the lower 32-bit subreg set to value */
94struct tnum tnum_const_subreg(struct tnum a, u32 value);
95/* Returns true if 32-bit subreg @a is a known constant*/
96static inline bool tnum_subreg_is_const(struct tnum a)
97{
98 return !(tnum_subreg(a)).mask;
99}
100
89#endif /* _LINUX_TNUM_H */101#endif /* _LINUX_TNUM_H */
include/linux/topology.h+0−17
@@ -130,20 +130,11 @@ static inline int numa_node_id(void) · 129 unmodified lines
130 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().130 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
131 */131 */
132DECLARE_PER_CPU(int, _numa_mem_);132DECLARE_PER_CPU(int, _numa_mem_);
133extern int _node_numa_mem_[MAX_NUMNODES];
134 133
135#ifndef set_numa_mem134#ifndef set_numa_mem
136static inline void set_numa_mem(int node)135static inline void set_numa_mem(int node)
137{136{
138 this_cpu_write(_numa_mem_, node);137 this_cpu_write(_numa_mem_, node);
139 _node_numa_mem_[numa_node_id()] = node;
140}
141#endif
142
143#ifndef node_to_mem_node
144static inline int node_to_mem_node(int node)
145{
146 return _node_numa_mem_[node];
147}138}
148#endif139#endif
149 140
@@ -166,7 +157,6 @@ static inline int cpu_to_mem(int cpu) · 16 unmodified lines
166static inline void set_cpu_numa_mem(int cpu, int node)157static inline void set_cpu_numa_mem(int cpu, int node)
167{158{
168 per_cpu(_numa_mem_, cpu) = node;159 per_cpu(_numa_mem_, cpu) = node;
169 _node_numa_mem_[cpu_to_node(cpu)] = node;
170}160}
171#endif161#endif
172 162
@@ -180,13 +170,6 @@ static inline int numa_mem_id(void) · 7 unmodified lines
180}170}
181#endif171#endif
182 172
183#ifndef node_to_mem_node
184static inline int node_to_mem_node(int node)
185{
186 return node;
187}
188#endif
189
190#ifndef cpu_to_mem173#ifndef cpu_to_mem
191static inline int cpu_to_mem(int cpu)174static inline int cpu_to_mem(int cpu)
192{175{
include/linux/trace_events.h+2−0
@@ -85,6 +85,8 @@ struct trace_iterator { · 84 unmodified lines
85 struct mutex mutex;85 struct mutex mutex;
86 struct ring_buffer_iter **buffer_iter;86 struct ring_buffer_iter **buffer_iter;
87 unsigned long iter_flags;87 unsigned long iter_flags;
88 void *temp; /* temp holder */
89 unsigned int temp_size;
88 90
89 /* trace_seq for __print_flags() and __print_symbolic() etc. */91 /* trace_seq for __print_flags() and __print_symbolic() etc. */
90 struct trace_seq tmp_seq;92 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
12struct uacce_queue;
13struct uacce_device;
14
15/**
16 * struct uacce_qfile_region - structure of queue file region
17 * @type: type of the region
18 */
19struct 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 */
34struct 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 */
54struct uacce_interface {
55 char name[UACCE_MAX_NAME_SIZE];
56 unsigned int flags;
57 const struct uacce_ops *ops;
58};
59
60enum 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 */
76struct 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 */
103struct 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 */
129struct 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
140struct uacce_device *uacce_alloc(struct device *parent,
141 struct uacce_interface *interface);
142int uacce_register(struct uacce_device *uacce);
143void uacce_remove(struct uacce_device *uacce);
144
145#else /* CONFIG_UACCE */
146
147static inline
148struct uacce_device *uacce_alloc(struct device *parent,
149 struct uacce_interface *interface)
150{
151 return ERR_PTR(-ENODEV);
152}
153
154static inline int uacce_register(struct uacce_device *uacce)
155{
156 return -EINVAL;
157}
158
159static 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
24 * struct uio_mem - description of a UIO memory region24 * struct uio_mem - description of a UIO memory region
25 * @name: name of the memory region for identification25 * @name: name of the memory region for identification
26 * @addr: address of the device's memory rounded to page26 * @addr: address of the device's memory rounded to page
27 * size (phys_addr is used since addr can be27 * size (phys_addr is used since addr can be
28 * logical, virtual, or physical & phys_addr_t28 * logical, virtual, or physical & phys_addr_t
29 * should always be large enough to handle any of29 * should always be large enough to handle any of
30 * the address types)30 * the address types)
31 * @offs: offset of device memory within the page31 * @offs: offset of device memory within the page
32 * @size: size of IO (multiple of page size)32 * @size: size of IO (multiple of page size)
33 * @memtype: type of memory addr points to33 * @memtype: type of memory addr points to
@@ -67,16 +67,16 @@ struct uio_port { · 33 unmodified lines
67#define MAX_UIO_PORT_REGIONS 567#define MAX_UIO_PORT_REGIONS 5
68 68
69struct uio_device {69struct uio_device {
70 struct module *owner;70 struct module *owner;
71 struct device dev;71 struct device dev;
72 int minor;72 int minor;
73 atomic_t event;73 atomic_t event;
74 struct fasync_struct *async_queue;74 struct fasync_struct *async_queue;
75 wait_queue_head_t wait;75 wait_queue_head_t wait;
76 struct uio_info *info;76 struct uio_info *info;
77 struct mutex info_lock;77 struct mutex info_lock;
78 struct kobject *map_dir;78 struct kobject *map_dir;
79 struct kobject *portio_dir;79 struct kobject *portio_dir;
80};80};
81 81
82/**82/**
@@ -123,6 +123,15 @@ extern int __must_check · 40 unmodified lines
123extern void uio_unregister_device(struct uio_info *info);123extern void uio_unregister_device(struct uio_info *info);
124extern void uio_event_notify(struct uio_info *info);124extern void uio_event_notify(struct uio_info *info);
125 125
126extern 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
126/* defines for uio_info->irq */135/* defines for uio_info->irq */
127#define UIO_IRQ_CUSTOM -1136#define UIO_IRQ_CUSTOM -1
128#define UIO_IRQ_NONE 0137#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
40 40
41static inline u16 get_unaligned_be16(const void *p)41static inline u16 get_unaligned_be16(const void *p)
42{42{
43 return __get_unaligned_be16((const u8 *)p);43 return __get_unaligned_be16(p);
44}44}
45 45
46static inline u32 get_unaligned_be32(const void *p)46static inline u32 get_unaligned_be32(const void *p)
47{47{
48 return __get_unaligned_be32((const u8 *)p);48 return __get_unaligned_be32(p);
49}49}
50 50
51static inline u64 get_unaligned_be64(const void *p)51static inline u64 get_unaligned_be64(const void *p)
52{52{
53 return __get_unaligned_be64((const u8 *)p);53 return __get_unaligned_be64(p);
54}54}
55 55
56static inline void put_unaligned_be16(u16 val, void *p)56static inline void put_unaligned_be16(u16 val, void *p)
include/linux/unaligned/generic.h+46−0
@@ -2,6 +2,8 @@ · 1 unmodified line
2#ifndef _LINUX_UNALIGNED_GENERIC_H2#ifndef _LINUX_UNALIGNED_GENERIC_H
3#define _LINUX_UNALIGNED_GENERIC_H3#define _LINUX_UNALIGNED_GENERIC_H
4 4
5#include <linux/types.h>
6
5/*7/*
6 * Cause a link-time error if we try an unaligned access other than8 * Cause a link-time error if we try an unaligned access other than
7 * 1,2,4 or 8 bytes long9 * 1,2,4 or 8 bytes long
@@ -66,4 +68,48 @@ extern void __bad_unaligned_access_size(void); · 58 unmodified lines
66 } \68 } \
67 (void)0; })69 (void)0; })
68 70
71static inline u32 __get_unaligned_be24(const u8 *p)
72{
73 return p[0] << 16 | p[1] << 8 | p[2];
74}
75
76static inline u32 get_unaligned_be24(const void *p)
77{
78 return __get_unaligned_be24(p);
79}
80
81static inline u32 __get_unaligned_le24(const u8 *p)
82{
83 return p[0] | p[1] << 8 | p[2] << 16;
84}
85
86static inline u32 get_unaligned_le24(const void *p)
87{
88 return __get_unaligned_le24(p);
89}
90
91static inline void __put_unaligned_be24(const u32 val, u8 *p)
92{
93 *p++ = val >> 16;
94 *p++ = val >> 8;
95 *p++ = val;
96}
97
98static inline void put_unaligned_be24(const u32 val, void *p)
99{
100 __put_unaligned_be24(val, p);
101}
102
103static inline void __put_unaligned_le24(const u32 val, u8 *p)
104{
105 *p++ = val;
106 *p++ = val >> 8;
107 *p++ = val >> 16;
108}
109
110static inline void put_unaligned_le24(const u32 val, void *p)
111{
112 __put_unaligned_le24(val, p);
113}
114
69#endif /* _LINUX_UNALIGNED_GENERIC_H */115#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
40 40
41static inline u16 get_unaligned_le16(const void *p)41static inline u16 get_unaligned_le16(const void *p)
42{42{
43 return __get_unaligned_le16((const u8 *)p);43 return __get_unaligned_le16(p);
44}44}
45 45
46static inline u32 get_unaligned_le32(const void *p)46static inline u32 get_unaligned_le32(const void *p)
47{47{
48 return __get_unaligned_le32((const u8 *)p);48 return __get_unaligned_le32(p);
49}49}
50 50
51static inline u64 get_unaligned_le64(const void *p)51static inline u64 get_unaligned_le64(const void *p)
52{52{
53 return __get_unaligned_le64((const u8 *)p);53 return __get_unaligned_le64(p);
54}54}
55 55
56static inline void put_unaligned_le16(u16 val, void *p)56static 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
325 325
326 /* variable-length array of alternate settings for this interface,326 /* variable-length array of alternate settings for this interface,
327 * stored in no particular order */327 * stored in no particular order */
328 struct usb_host_interface altsetting[0];328 struct usb_host_interface altsetting[];
329};329};
330#define ref_to_usb_interface_cache(r) \330#define ref_to_usb_interface_cache(r) \
331 container_of(r, struct usb_interface_cache, ref)331 container_of(r, struct usb_interface_cache, ref)
@@ -708,6 +708,7 @@ struct usb_device { · 376 unmodified lines
708 unsigned lpm_disable_count;708 unsigned lpm_disable_count;
709 709
710 u16 hub_delay;710 u16 hub_delay;
711 unsigned use_generic_driver:1;
711};712};
712#define to_usb_device(d) container_of(d, struct usb_device, dev)713#define to_usb_device(d) container_of(d, struct usb_device, dev)
713 714
@@ -1228,12 +1229,16 @@ struct usb_driver { · 514 unmodified lines
1228 * @drvwrap: Driver-model core structure wrapper.1229 * @drvwrap: Driver-model core structure wrapper.
1229 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend1230 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
1230 * for devices bound to this driver.1231 * 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.
1231 *1235 *
1232 * USB drivers must provide all the fields listed above except drvwrap.1236 * USB drivers must provide all the fields listed above except drvwrap.
1233 */1237 */
1234struct usb_device_driver {1238struct usb_device_driver {
1235 const char *name;1239 const char *name;
1236 1240
1241 bool (*match) (struct usb_device *udev);
1237 int (*probe) (struct usb_device *udev);1242 int (*probe) (struct usb_device *udev);
1238 void (*disconnect) (struct usb_device *udev);1243 void (*disconnect) (struct usb_device *udev);
1239 1244
@@ -1241,7 +1246,9 @@ struct usb_device_driver { · 1 unmodified line
1241 int (*resume) (struct usb_device *udev, pm_message_t message);1246 int (*resume) (struct usb_device *udev, pm_message_t message);
1242 const struct attribute_group **dev_groups;1247 const struct attribute_group **dev_groups;
1243 struct usbdrv_wrap drvwrap;1248 struct usbdrv_wrap drvwrap;
1249 const struct usb_device_id *id_table;
1244 unsigned int supports_autosuspend:1;1250 unsigned int supports_autosuspend:1;
1251 unsigned int generic_subclass:1;
1245};1252};
1246#define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \1253#define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \
1247 drvwrap.driver)1254 drvwrap.driver)
@@ -1582,7 +1589,7 @@ struct urb { · 334 unmodified lines
1582 int error_count; /* (return) number of ISO errors */1589 int error_count; /* (return) number of ISO errors */
1583 void *context; /* (in) context for completion */1590 void *context; /* (in) context for completion */
1584 usb_complete_t complete; /* (in) completion routine */1591 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[];
1586 /* (in) ISO ONLY */1593 /* (in) ISO ONLY */
1587};1594};
1588 1595
include/linux/usb/audio-v2.h+13−1
@@ -153,7 +153,19 @@ struct uac2_feature_unit_descriptor { · 152 unmodified lines
153 __u8 bSourceID;153 __u8 bSourceID;
154 /* bmaControls is actually u32,154 /* bmaControls is actually u32,
155 * but u8 is needed for the hybrid parser */155 * 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
161struct 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 */
157} __attribute__((packed));169} __attribute__((packed));
158 170
159/* 4.9.2 Class-Specific AS Interface Descriptor */171/* 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
109 __u8 bSourceID;109 __u8 bSourceID;
110 /* bmaControls is actually u32,110 /* bmaControls is actually u32,
111 * but u8 is needed for the hybrid parser */111 * but u8 is needed for the hybrid parser */
112 __u8 bmaControls[0]; /* variable length */112 __u8 bmaControls[]; /* variable length */
113 /* wFeatureDescrStr omitted */113 /* wFeatureDescrStr omitted */
114} __attribute__((packed));114} __attribute__((packed));
115 115
include/linux/usb/cdc_ncm.h+12−3
@@ -46,9 +46,12 @@ · 45 unmodified lines
46#define CDC_NCM_DATA_ALTSETTING_NCM 146#define CDC_NCM_DATA_ALTSETTING_NCM 1
47#define CDC_NCM_DATA_ALTSETTING_MBIM 247#define CDC_NCM_DATA_ALTSETTING_MBIM 2
48 48
49/* CDC NCM subclass 3.2.1 */49/* CDC NCM subclass 3.3.1 */
50#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x1050#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
51 51
52/* CDC NCM subclass 3.3.2 */
53#define USB_CDC_NCM_NDP32_LENGTH_MIN 0x20
54
52/* Maximum NTB length */55/* Maximum NTB length */
53#define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */56#define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */
54#define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */57#define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */
@@ -84,7 +87,7 @@ · 29 unmodified lines
84/* Driver flags */87/* Driver flags */
85#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */88#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */
86#define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */89#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 */
88 91
89#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \92#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
90 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)93 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
@@ -113,7 +116,11 @@ struct cdc_ncm_ctx { · 22 unmodified lines
113 116
114 u32 timer_interval;117 u32 timer_interval;
115 u32 max_ndp_size;118 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 };
117 124
118 u32 tx_timer_pending;125 u32 tx_timer_pending;
119 u32 tx_curr_frame_num;126 u32 tx_curr_frame_num;
@@ -150,6 +157,8 @@ void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); · 30 unmodified lines
150struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign);157struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign);
151int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);158int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
152int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset);159int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset);
160int cdc_ncm_rx_verify_nth32(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
161int cdc_ncm_rx_verify_ndp32(struct sk_buff *skb_in, int ndpoffset);
153struct sk_buff *162struct sk_buff *
154cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);163cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
155int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in);164int 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
151#define PORT_OWNER (1<<13) /* true: companion hc owns this port */151#define PORT_OWNER (1<<13) /* true: companion hc owns this port */
152#define PORT_POWER (1<<12) /* true: has power (see PPC) */152#define PORT_POWER (1<<12) /* true: has power (see PPC) */
153#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */153#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 */
155/* 9 reserved */155/* 9 reserved */
156#define PORT_LPM (1<<9) /* LPM transaction */156#define PORT_LPM (1<<9) /* LPM transaction */
157#define PORT_RESET (1<<8) /* reset port */157#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
767 767
768struct usb_gadget_string_container {768struct usb_gadget_string_container {
769 struct list_head list;769 struct list_head list;
770 u8 *stash[0];770 u8 *stash[];
771};771};
772 772
773/* put descriptor for string with that id into buf (buflen >= 256) */773/* 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
228 /* The HC driver's private data is stored at the end of228 /* The HC driver's private data is stored at the end of
229 * this structure.229 * this structure.
230 */230 */
231 unsigned long hcd_priv[0]231 unsigned long hcd_priv[]
232 __attribute__ ((aligned(sizeof(s64))));232 __attribute__ ((aligned(sizeof(s64))));
233};233};
234 234
include/linux/usb/role.h+21−2
@@ -13,8 +13,9 @@ enum usb_role { · 12 unmodified lines
13 USB_ROLE_DEVICE,13 USB_ROLE_DEVICE,
14};14};
15 15
16typedef int (*usb_role_switch_set_t)(struct device *dev, enum usb_role role);16typedef int (*usb_role_switch_set_t)(struct usb_role_switch *sw,
17typedef enum usb_role (*usb_role_switch_get_t)(struct device *dev);17 enum usb_role role);
18typedef enum usb_role (*usb_role_switch_get_t)(struct usb_role_switch *sw);
18 19
19/**20/**
20 * struct usb_role_switch_desc - USB Role Switch Descriptor21 * 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
25 * @set: Callback for setting the role26 * @set: Callback for setting the role
26 * @get: Callback for getting the role (optional)27 * @get: Callback for getting the role (optional)
27 * @allow_userspace_control: If true userspace may change the role through sysfs28 * @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)
28 *31 *
29 * @usb2_port and @usb3_port will point to the USB host port and @udc to the USB32 * @usb2_port and @usb3_port will point to the USB host port and @udc to the USB
30 * device controller behind the USB connector with the role switch. If33 * device controller behind the USB connector with the role switch. If
@@ -40,6 +43,8 @@ struct usb_role_switch_desc { · 9 unmodified lines
40 usb_role_switch_set_t set;43 usb_role_switch_set_t set;
41 usb_role_switch_get_t get;44 usb_role_switch_get_t get;
42 bool allow_userspace_control;45 bool allow_userspace_control;
46 void *driver_data;
47 const char *name;
43};48};
44 49
45 50
@@ -57,6 +62,9 @@ struct usb_role_switch * · 11 unmodified lines
57usb_role_switch_register(struct device *parent,62usb_role_switch_register(struct device *parent,
58 const struct usb_role_switch_desc *desc);63 const struct usb_role_switch_desc *desc);
59void usb_role_switch_unregister(struct usb_role_switch *sw);64void usb_role_switch_unregister(struct usb_role_switch *sw);
65
66void usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data);
67void *usb_role_switch_get_drvdata(struct usb_role_switch *sw);
60#else68#else
61static inline int usb_role_switch_set_role(struct usb_role_switch *sw,69static inline int usb_role_switch_set_role(struct usb_role_switch *sw,
62 enum usb_role role)70 enum usb_role role)
@@ -90,6 +98,17 @@ usb_role_switch_register(struct device *parent, · 27 unmodified lines
90}98}
91 99
92static inline void usb_role_switch_unregister(struct usb_role_switch *sw) { }100static inline void usb_role_switch_unregister(struct usb_role_switch *sw) { }
101
102static inline void
103usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data)
104{
105}
106
107static inline void *usb_role_switch_get_drvdata(struct usb_role_switch *sw)
108{
109 return NULL;
110}
111
93#endif112#endif
94 113
95#endif /* __LINUX_USB_ROLE_H */114#endif /* __LINUX_USB_ROLE_H */
include/linux/usb/typec.h+1−2
@@ -198,8 +198,6 @@ struct typec_operations { · 197 unmodified lines
198 * @pd_revision: USB Power Delivery Specification revision if supported198 * @pd_revision: USB Power Delivery Specification revision if supported
199 * @prefer_role: Initial role preference (DRP ports).199 * @prefer_role: Initial role preference (DRP ports).
200 * @accessory: Supported Accessory Modes200 * @accessory: Supported Accessory Modes
201 * @sw: Cable plug orientation switch
202 * @mux: Multiplexer switch for Alternate/Accessory Modes
203 * @fwnode: Optional fwnode of the port201 * @fwnode: Optional fwnode of the port
204 * @driver_data: Private pointer for driver specific info202 * @driver_data: Private pointer for driver specific info
205 * @ops: Port operations vector203 * @ops: Port operations vector
@@ -213,6 +211,7 @@ struct typec_capability { · 7 unmodified lines
213 u16 pd_revision; /* 0300H = "3.0" */211 u16 pd_revision; /* 0300H = "3.0" */
214 int prefer_role;212 int prefer_role;
215 enum typec_accessory accessory[TYPEC_MAX_ACCESSORY];213 enum typec_accessory accessory[TYPEC_MAX_ACCESSORY];
214 unsigned int orientation_aware:1;
216 215
217 struct fwnode_handle *fwnode;216 struct fwnode_handle *fwnode;
218 void *driver_data;217 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
126struct typec_altmode *typec_match_altmode(struct typec_altmode **altmodes,126struct typec_altmode *typec_match_altmode(struct typec_altmode **altmodes,
127 size_t n, u16 svid, u8 mode);127 size_t n, u16 svid, u8 mode);
128 128
129struct typec_altmode *
130typec_altmode_register_notifier(struct device *dev, u16 svid, u8 mode,
131 struct notifier_block *nb);
132
133void typec_altmode_unregister_notifier(struct typec_altmode *adev,
134 struct notifier_block *nb);
135
136/**129/**
137 * typec_altmode_get_orientation - Get cable plug orientation130 * typec_altmode_get_orientation - Get cable plug orientation
138 * altmode: Handle to the alternate mode131 * altmode: Handle to the alternate mode
include/linux/usb/typec_mux.h+22−3
@@ -3,6 +3,7 @@ · 2 unmodified lines
3#ifndef __USB_TYPEC_MUX3#ifndef __USB_TYPEC_MUX
4#define __USB_TYPEC_MUX4#define __USB_TYPEC_MUX
5 5
6#include <linux/property.h>
6#include <linux/usb/typec.h>7#include <linux/usb/typec.h>
7 8
8struct device;9struct device;
@@ -17,11 +18,20 @@ typedef int (*typec_switch_set_fn_t)(struct typec_switch *sw, · 8 unmodified lines
17struct typec_switch_desc {18struct typec_switch_desc {
18 struct fwnode_handle *fwnode;19 struct fwnode_handle *fwnode;
19 typec_switch_set_fn_t set;20 typec_switch_set_fn_t set;
21 const char *name;
20 void *drvdata;22 void *drvdata;
21};23};
22 24
23struct typec_switch *typec_switch_get(struct device *dev);25struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode);
24void typec_switch_put(struct typec_switch *sw);26void typec_switch_put(struct typec_switch *sw);
27int typec_switch_set(struct typec_switch *sw,
28 enum typec_orientation orientation);
29
30static inline struct typec_switch *typec_switch_get(struct device *dev)
31{
32 return fwnode_typec_switch_get(dev_fwnode(dev));
33}
34
25struct typec_switch *35struct typec_switch *
26typec_switch_register(struct device *parent,36typec_switch_register(struct device *parent,
27 const struct typec_switch_desc *desc);37 const struct typec_switch_desc *desc);
@@ -42,12 +52,21 @@ typedef int (*typec_mux_set_fn_t)(struct typec_mux *mux, · 14 unmodified lines
42struct typec_mux_desc {52struct typec_mux_desc {
43 struct fwnode_handle *fwnode;53 struct fwnode_handle *fwnode;
44 typec_mux_set_fn_t set;54 typec_mux_set_fn_t set;
55 const char *name;
45 void *drvdata;56 void *drvdata;
46};57};
47 58
48struct typec_mux *59struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode,
49typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc);60 const struct typec_altmode_desc *desc);
50void typec_mux_put(struct typec_mux *mux);61void typec_mux_put(struct typec_mux *mux);
62int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state);
63
64static inline struct typec_mux *
65typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc)
66{
67 return fwnode_typec_mux_get(dev_fwnode(dev), desc);
68}
69
51struct typec_mux *70struct typec_mux *
52typec_mux_register(struct device *parent, const struct typec_mux_desc *desc);71typec_mux_register(struct device *parent, const struct typec_mux_desc *desc);
53void typec_mux_unregister(struct typec_mux *mux);72void 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 */
20struct 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
92#include <linux/usb/storage.h>92#include <linux/usb/storage.h>
93 93
94extern int usb_usual_ignore_device(struct usb_interface *intf);94extern int usb_usual_ignore_device(struct usb_interface *intf);
95extern struct usb_device_id usb_storage_usb_ids[];95extern const struct usb_device_id usb_storage_usb_ids[];
96 96
97#endif /* __LINUX_USB_USUAL_H */97#endif /* __LINUX_USB_USUAL_H */
include/linux/usbdevice_fs.h+1−1
@@ -69,7 +69,7 @@ struct usbdevfs_urb32 { · 68 unmodified lines
69 compat_int_t error_count;69 compat_int_t error_count;
70 compat_uint_t signr;70 compat_uint_t signr;
71 compat_caddr_t usercontext; /* unused */71 compat_caddr_t usercontext; /* unused */
72 struct usbdevfs_iso_packet_desc iso_frame_desc[0];72 struct usbdevfs_iso_packet_desc iso_frame_desc[];
73};73};
74 74
75struct usbdevfs_ioctl32 {75struct usbdevfs_ioctl32 {
include/linux/userfaultfd_k.h+41−1
@@ -14,6 +14,8 @@ · 13 unmodified lines
14#include <linux/userfaultfd.h> /* linux/include/uapi/linux/userfaultfd.h */14#include <linux/userfaultfd.h> /* linux/include/uapi/linux/userfaultfd.h */
15 15
16#include <linux/fcntl.h>16#include <linux/fcntl.h>
17#include <linux/mm.h>
18#include <asm-generic/pgtable_uffd.h>
17 19
18/*20/*
19 * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining21 * 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
34 36
35extern ssize_t mcopy_atomic(struct mm_struct *dst_mm, unsigned long dst_start,37extern ssize_t mcopy_atomic(struct mm_struct *dst_mm, unsigned long dst_start,
36 unsigned long src_start, unsigned long len,38 unsigned long src_start, unsigned long len,
37 bool *mmap_changing);39 bool *mmap_changing, __u64 mode);
38extern ssize_t mfill_zeropage(struct mm_struct *dst_mm,40extern ssize_t mfill_zeropage(struct mm_struct *dst_mm,
39 unsigned long dst_start,41 unsigned long dst_start,
40 unsigned long len,42 unsigned long len,
41 bool *mmap_changing);43 bool *mmap_changing);
44extern int mwriteprotect_range(struct mm_struct *dst_mm,
45 unsigned long start, unsigned long len,
46 bool enable_wp, bool *mmap_changing);
42 47
43/* mm helpers */48/* mm helpers */
44static inline bool is_mergeable_vm_userfaultfd_ctx(struct vm_area_struct *vma,49static 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
52 return vma->vm_flags & VM_UFFD_MISSING;57 return vma->vm_flags & VM_UFFD_MISSING;
53}58}
54 59
60static inline bool userfaultfd_wp(struct vm_area_struct *vma)
61{
62 return vma->vm_flags & VM_UFFD_WP;
63}
64
65static 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
71static 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
55static inline bool userfaultfd_armed(struct vm_area_struct *vma)77static inline bool userfaultfd_armed(struct vm_area_struct *vma)
56{78{
57 return vma->vm_flags & (VM_UFFD_MISSING | VM_UFFD_WP);79 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
96 return false;118 return false;
97}119}
98 120
121static inline bool userfaultfd_wp(struct vm_area_struct *vma)
122{
123 return false;
124}
125
126static inline bool userfaultfd_pte_wp(struct vm_area_struct *vma,
127 pte_t pte)
128{
129 return false;
130}
131
132static inline bool userfaultfd_huge_pmd_wp(struct vm_area_struct *vma,
133 pmd_t pmd)
134{
135 return false;
136}
137
138
99static inline bool userfaultfd_armed(struct vm_area_struct *vma)139static inline bool userfaultfd_armed(struct vm_area_struct *vma)
100{140{
101 return false;141 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
43 memcpy(dst, src, sizeof(guid_t));43 memcpy(dst, src, sizeof(guid_t));
44}44}
45 45
46static inline void import_guid(guid_t *dst, const __u8 *src)
47{
48 memcpy(dst, src, sizeof(guid_t));
49}
50
51static inline void export_guid(__u8 *dst, const guid_t *src)
52{
53 memcpy(dst, src, sizeof(guid_t));
54}
55
46static inline bool guid_is_null(const guid_t *guid)56static inline bool guid_is_null(const guid_t *guid)
47{57{
48 return guid_equal(guid, &guid_null);58 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
58 memcpy(dst, src, sizeof(uuid_t));68 memcpy(dst, src, sizeof(uuid_t));
59}69}
60 70
71static inline void import_uuid(uuid_t *dst, const __u8 *src)
72{
73 memcpy(dst, src, sizeof(uuid_t));
74}
75
76static inline void export_uuid(__u8 *dst, const uuid_t *src)
77{
78 memcpy(dst, src, sizeof(uuid_t));
79}
80
61static inline bool uuid_is_null(const uuid_t *uuid)81static inline bool uuid_is_null(const uuid_t *uuid)
62{82{
63 return uuid_equal(uuid, &uuid_null);83 return uuid_equal(uuid, &uuid_null);
64}84}
65 85
66void generate_random_uuid(unsigned char uuid[16]);86void generate_random_uuid(unsigned char uuid[16]);
87void generate_random_guid(unsigned char guid[16]);
67 88
68extern void guid_gen(guid_t *u);89extern void guid_gen(guid_t *u);
69extern void uuid_gen(uuid_t *u);90extern void uuid_gen(uuid_t *u);
@@ -77,7 +98,6 @@ int guid_parse(const char *uuid, guid_t *u); · 7 unmodified lines
77int uuid_parse(const char *uuid, uuid_t *u);98int uuid_parse(const char *uuid, uuid_t *u);
78 99
79/* backwards compatibility, don't use in new code */100/* backwards compatibility, don't use in new code */
80#define uuid_le_gen(u) guid_gen(u)
81#define uuid_le_to_bin(guid, u) guid_parse(guid, u)101#define uuid_le_to_bin(guid, u) guid_parse(guid, u)
82 102
83static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)103static 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 */
15struct 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 */
27struct 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 */
152struct 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
193struct 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
205int vdpa_register_device(struct vdpa_device *vdev);
206void 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 */
214struct 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)
222int __vdpa_register_driver(struct vdpa_driver *drv, struct module *owner);
223void 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
229static inline struct vdpa_driver *drv_to_vdpa(struct device_driver *driver)
230{
231 return container_of(driver, struct vdpa_driver, driver);
232}
233
234static inline struct vdpa_device *dev_to_vdpa(struct device *_dev)
235{
236 return container_of(_dev, struct vdpa_device, dev);
237}
238
239static inline void *vdpa_get_drvdata(const struct vdpa_device *vdev)
240{
241 return dev_get_drvdata(&vdev->dev);
242}
243
244static inline void vdpa_set_drvdata(struct vdpa_device *vdev, void *data)
245{
246 dev_set_drvdata(&vdev->dev, data);
247}
248
249static 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
26 * operations documented below26 * operations documented below
27 * @mmap: Perform mmap(2) on a region of the device file descriptor27 * @mmap: Perform mmap(2) on a region of the device file descriptor
28 * @request: Request for the bus driver to release the device28 * @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)
29 */32 */
30struct vfio_device_ops {33struct vfio_device_ops {
31 char *name;34 char *name;
@@ -39,6 +42,7 @@ struct vfio_device_ops { · 7 unmodified lines
39 unsigned long arg);42 unsigned long arg);
40 int (*mmap)(void *device_data, struct vm_area_struct *vma);43 int (*mmap)(void *device_data, struct vm_area_struct *vma);
41 void (*request)(void *device_data, unsigned int count);44 void (*request)(void *device_data, unsigned int count);
45 int (*match)(void *device_data, char *buf);
42};46};
43 47
44extern struct iommu_group *vfio_iommu_group_get(struct device *dev);48extern struct iommu_group *vfio_iommu_group_get(struct device *dev);
@@ -82,6 +86,8 @@ struct vfio_iommu_driver_ops { · 37 unmodified lines
82 struct notifier_block *nb);86 struct notifier_block *nb);
83 int (*unregister_notifier)(void *iommu_data,87 int (*unregister_notifier)(void *iommu_data,
84 struct notifier_block *nb);88 struct notifier_block *nb);
89 int (*dma_rw)(void *iommu_data, dma_addr_t user_iova,
90 void *data, size_t count, bool write);
85};91};
86 92
87extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);93extern 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
94 */100 */
95extern struct vfio_group *vfio_group_get_external_user(struct file *filep);101extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
96extern void vfio_group_put_external_user(struct vfio_group *group);102extern void vfio_group_put_external_user(struct vfio_group *group);
103extern struct vfio_group *vfio_group_get_external_user_from_dev(struct device
104 *dev);
97extern bool vfio_external_group_match_file(struct vfio_group *group,105extern bool vfio_external_group_match_file(struct vfio_group *group,
98 struct file *filep);106 struct file *filep);
99extern int vfio_external_user_iommu_id(struct vfio_group *group);107extern 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
107extern int vfio_unpin_pages(struct device *dev, unsigned long *user_pfn,115extern int vfio_unpin_pages(struct device *dev, unsigned long *user_pfn,
108 int npage);116 int npage);
109 117
118extern int vfio_group_pin_pages(struct vfio_group *group,
119 unsigned long *user_iova_pfn, int npage,
120 int prot, unsigned long *phys_pfn);
121extern int vfio_group_unpin_pages(struct vfio_group *group,
122 unsigned long *user_iova_pfn, int npage);
123
124extern int vfio_dma_rw(struct vfio_group *group, dma_addr_t user_iova,
125 void *data, size_t len, bool write);
126
110/* each type has independent events */127/* each type has independent events */
111enum vfio_notify_type {128enum vfio_notify_type {
112 VFIO_IOMMU_NOTIFY = 0,129 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
7struct 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
24struct 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
32int vhost_iotlb_add_range(struct vhost_iotlb *iotlb, u64 start, u64 last,
33 u64 addr, unsigned int perm);
34void vhost_iotlb_del_range(struct vhost_iotlb *iotlb, u64 start, u64 last);
35
36struct vhost_iotlb *vhost_iotlb_alloc(unsigned int limit, unsigned int flags);
37void vhost_iotlb_free(struct vhost_iotlb *iotlb);
38void vhost_iotlb_reset(struct vhost_iotlb *iotlb);
39
40struct vhost_iotlb_map *
41vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last);
42struct vhost_iotlb_map *
43vhost_iotlb_itree_next(struct vhost_iotlb_map *map, u64 start, u64 last);
44
45void 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
73#ifdef CONFIG_TRANSPARENT_HUGEPAGE73#ifdef CONFIG_TRANSPARENT_HUGEPAGE
74 THP_FAULT_ALLOC,74 THP_FAULT_ALLOC,
75 THP_FAULT_FALLBACK,75 THP_FAULT_FALLBACK,
76 THP_FAULT_FALLBACK_CHARGE,
76 THP_COLLAPSE_ALLOC,77 THP_COLLAPSE_ALLOC,
77 THP_COLLAPSE_ALLOC_FAILED,78 THP_COLLAPSE_ALLOC_FAILED,
78 THP_FILE_ALLOC,79 THP_FILE_ALLOC,
80 THP_FILE_FALLBACK,
81 THP_FILE_FALLBACK_CHARGE,
79 THP_FILE_MAPPED,82 THP_FILE_MAPPED,
80 THP_SPLIT_PAGE,83 THP_SPLIT_PAGE,
81 THP_SPLIT_PAGE_FAILED,84 THP_SPLIT_PAGE_FAILED,
@@ -115,6 +118,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 33 unmodified lines
115 118
116#ifndef CONFIG_TRANSPARENT_HUGEPAGE119#ifndef CONFIG_TRANSPARENT_HUGEPAGE
117#define THP_FILE_ALLOC ({ BUILD_BUG(); 0; })120#define THP_FILE_ALLOC ({ BUILD_BUG(); 0; })
121#define THP_FILE_FALLBACK ({ BUILD_BUG(); 0; })
122#define THP_FILE_FALLBACK_CHARGE ({ BUILD_BUG(); 0; })
118#define THP_FILE_MAPPED ({ BUILD_BUG(); 0; })123#define THP_FILE_MAPPED ({ BUILD_BUG(); 0; })
119#endif124#endif
120 125
include/linux/vmalloc.h+3−2
@@ -141,8 +141,9 @@ extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, · 140 unmodified lines
141 141
142extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,142extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
143 unsigned long pgoff);143 unsigned long pgoff);
144void vmalloc_sync_all(void);144void vmalloc_sync_mappings(void);
145 145void vmalloc_sync_unmappings(void);
146
146/*147/*
147 * Lowlevel-APIs (not for driver use!)148 * Lowlevel-APIs (not for driver use!)
148 */149 */
include/linux/vringh.h+36−0
@@ -14,6 +14,8 @@ · 13 unmodified lines
14#include <linux/virtio_byteorder.h>14#include <linux/virtio_byteorder.h>
15#include <linux/uio.h>15#include <linux/uio.h>
16#include <linux/slab.h>16#include <linux/slab.h>
17#include <linux/dma-direction.h>
18#include <linux/vhost_iotlb.h>
17#include <asm/barrier.h>19#include <asm/barrier.h>
18 20
19/* virtio_ring with information needed for host access. */21/* virtio_ring with information needed for host access. */
@@ -39,6 +41,9 @@ struct vringh { · 19 unmodified lines
39 /* The vring (note: it may contain user pointers!) */41 /* The vring (note: it may contain user pointers!) */
40 struct vring vring;42 struct vring vring;
41 43
44 /* IOTLB for this vring */
45 struct vhost_iotlb *iotlb;
46
42 /* The function to call to notify the guest about added buffers */47 /* The function to call to notify the guest about added buffers */
43 void (*notify)(struct vringh *);48 void (*notify)(struct vringh *);
44};49};
@@ -248,4 +253,35 @@ static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val) · 203 unmodified lines
248{253{
249 return __cpu_to_virtio64(vringh_is_little_endian(vrh), val);254 return __cpu_to_virtio64(vringh_is_little_endian(vrh), val);
250}255}
256
257void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb);
258
259int 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
265int vringh_getdesc_iotlb(struct vringh *vrh,
266 struct vringh_kiov *riov,
267 struct vringh_kiov *wiov,
268 u16 *head,
269 gfp_t gfp);
270
271ssize_t vringh_iov_pull_iotlb(struct vringh *vrh,
272 struct vringh_kiov *riov,
273 void *dst, size_t len);
274ssize_t vringh_iov_push_iotlb(struct vringh *vrh,
275 struct vringh_kiov *wiov,
276 const void *src, size_t len);
277
278void vringh_abandon_iotlb(struct vringh *vrh, unsigned int num);
279
280int vringh_complete_iotlb(struct vringh *vrh, u16 head, u32 len);
281
282bool vringh_notify_enable_iotlb(struct vringh *vrh);
283void vringh_notify_disable_iotlb(struct vringh *vrh);
284
285int vringh_need_notify_iotlb(struct vringh *vrh);
286
251#endif /* _LINUX_VRINGH_H */287#endif /* _LINUX_VRINGH_H */
include/linux/vt_kern.h+32−32
@@ -28,8 +28,9 @@ · 27 unmodified lines
28#define BROKEN_GRAPHICS_PROGRAMS 128#define BROKEN_GRAPHICS_PROGRAMS 1
29#endif29#endif
30 30
31extern void kd_mksound(unsigned int hz, unsigned int ticks);31void kd_mksound(unsigned int hz, unsigned int ticks);
32extern int kbd_rate(struct kbd_repeat *rep);32int kbd_rate(struct kbd_repeat *rep);
33
33extern int fg_console, last_console, want_console;34extern int fg_console, last_console, want_console;
34 35
35/* console.c */36/* console.c */
@@ -131,11 +132,11 @@ void vt_event_post(unsigned int event, unsigned int old, unsigned int new); · 95 unmodified lines
131int vt_waitactive(int n);132int vt_waitactive(int n);
132void change_console(struct vc_data *new_vc);133void change_console(struct vc_data *new_vc);
133void reset_vc(struct vc_data *vc);134void reset_vc(struct vc_data *vc);
134extern int do_unbind_con_driver(const struct consw *csw, int first, int last,135int do_unbind_con_driver(const struct consw *csw, int first, int last,
135 int deflt);136 int deflt);
136int vty_init(const struct file_operations *console_fops);137int vty_init(const struct file_operations *console_fops);
137 138
138extern char vt_dont_switch;139extern bool vt_dont_switch;
139extern int default_utf8;140extern int default_utf8;
140extern int global_cursor_default;141extern int global_cursor_default;
141 142
@@ -146,7 +147,7 @@ struct vt_spawn_console { · 4 unmodified lines
146};147};
147extern struct vt_spawn_console vt_spawn_con;148extern struct vt_spawn_console vt_spawn_con;
148 149
149extern int vt_move_to_console(unsigned int vt, int alloc);150int vt_move_to_console(unsigned int vt, int alloc);
150 151
151/* Interfaces for VC notification of character events (for accessibility etc) */152/* Interfaces for VC notification of character events (for accessibility etc) */
152 153
@@ -155,35 +156,34 @@ struct vt_notifier_param { · 2 unmodified lines
155 unsigned int c; /* Printed char */156 unsigned int c; /* Printed char */
156};157};
157 158
158extern int register_vt_notifier(struct notifier_block *nb);159int register_vt_notifier(struct notifier_block *nb);
159extern int unregister_vt_notifier(struct notifier_block *nb);160int unregister_vt_notifier(struct notifier_block *nb);
160 161
161extern void hide_boot_cursor(bool hide);162void hide_boot_cursor(bool hide);
162 163
163/* keyboard provided interfaces */164/* keyboard provided interfaces */
164extern int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm);165int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm);
165extern int vt_do_kdskbmode(int console, unsigned int arg);166int vt_do_kdskbmode(int console, unsigned int arg);
166extern int vt_do_kdskbmeta(int console, unsigned int arg);167int vt_do_kdskbmeta(int console, unsigned int arg);
167extern int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc,168int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc,
168 int perm);169 int perm);
169extern int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe,170int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm,
170 int perm, int console);171 int console);
171extern int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb,172int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm);
172 int perm);173int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm);
173extern int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm);174int vt_do_kdgkbmode(int console);
174extern int vt_do_kdgkbmode(int console);175int vt_do_kdgkbmeta(int console);
175extern int vt_do_kdgkbmeta(int console);176void vt_reset_unicode(int console);
176extern void vt_reset_unicode(int console);177int vt_get_shift_state(void);
177extern int vt_get_shift_state(void);178void vt_reset_keyboard(int console);
178extern void vt_reset_keyboard(int console);179int vt_get_leds(int console, int flag);
179extern int vt_get_leds(int console, int flag);180int vt_get_kbd_mode_bit(int console, int bit);
180extern int vt_get_kbd_mode_bit(int console, int bit);181void vt_set_kbd_mode_bit(int console, int bit);
181extern void vt_set_kbd_mode_bit(int console, int bit);182void vt_clr_kbd_mode_bit(int console, int bit);
182extern void vt_clr_kbd_mode_bit(int console, int bit);183void vt_set_led_state(int console, int leds);
183extern void vt_set_led_state(int console, int leds);184void vt_set_led_state(int console, int leds);
184extern void vt_set_led_state(int console, int leds);185void vt_kbd_con_start(int console);
185extern void vt_kbd_con_start(int console);186void vt_kbd_con_stop(int console);
186extern void vt_kbd_con_stop(int console);
187 187
188void vc_scrolldelta_helper(struct vc_data *c, int lines,188void vc_scrolldelta_helper(struct vc_data *c, int lines,
189 unsigned int rolled_over, void *_base, unsigned int size);189 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
20#define WQ_FLAG_EXCLUSIVE 0x0120#define WQ_FLAG_EXCLUSIVE 0x01
21#define WQ_FLAG_WOKEN 0x0221#define WQ_FLAG_WOKEN 0x02
22#define WQ_FLAG_BOOKMARK 0x0422#define WQ_FLAG_BOOKMARK 0x04
23#define WQ_FLAG_CUSTOM 0x08
23 24
24/*25/*
25 * A single wait-queue entry structure:26 * 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
487 *487 *
488 * We queue the work to the CPU on which it was submitted, but if the CPU dies488 * We queue the work to the CPU on which it was submitted, but if the CPU dies
489 * it can be processed by another CPU.489 * 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
490 */503 */
491static inline bool queue_work(struct workqueue_struct *wq,504static inline bool queue_work(struct workqueue_struct *wq,
492 struct work_struct *work)505 struct work_struct *work)
@@ -546,6 +559,9 @@ static inline bool schedule_work_on(int cpu, struct work_struct *work) · 53 unmodified lines
546 * This puts a job in the kernel-global workqueue if it was not already559 * This puts a job in the kernel-global workqueue if it was not already
547 * queued and leaves it in the same position on the kernel-global560 * queued and leaves it in the same position on the kernel-global
548 * workqueue otherwise.561 * workqueue otherwise.
562 *
563 * Shares the same memory-ordering properties of queue_work(), cf. the
564 * DocBook header of queue_work().
549 */565 */
550static inline bool schedule_work(struct work_struct *work)566static inline bool schedule_work(struct work_struct *work)
551{567{
@@ -649,7 +665,7 @@ int workqueue_online_cpu(unsigned int cpu); · 97 unmodified lines
649int workqueue_offline_cpu(unsigned int cpu);665int workqueue_offline_cpu(unsigned int cpu);
650#endif666#endif
651 667
652int __init workqueue_init_early(void);668void __init workqueue_init_early(void);
653int __init workqueue_init(void);669void __init workqueue_init(void);
654 670
655#endif671#endif
include/linux/xarray.h+7−3
@@ -32,8 +32,8 @@ · 31 unmodified lines
32 * The following internal entries have a special meaning:32 * The following internal entries have a special meaning:
33 *33 *
34 * 0-62: Sibling entries34 * 0-62: Sibling entries
35 * 256: Zero entry35 * 256: Retry entry
36 * 257: Retry entry36 * 257: Zero entry
37 *37 *
38 * Errors are also represented as internal entries, but use the negative38 * Errors are also represented as internal entries, but use the negative
39 * space (-4094 to -2). They're never stored in the slots array; only39 * 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
1648 xa_mark_t mark)1648 xa_mark_t mark)
1649{1649{
1650 struct xa_node *node = xas->xa_node;1650 struct xa_node *node = xas->xa_node;
1651 void *entry;
1651 unsigned int offset;1652 unsigned int offset;
1652 1653
1653 if (unlikely(xas_not_node(node) || node->shift))1654 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
1659 return NULL;1660 return NULL;
1660 if (offset == XA_CHUNK_SIZE)1661 if (offset == XA_CHUNK_SIZE)
1661 return xas_find_marked(xas, max, mark);1662 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;
1663}1667}
1664 1668
1665/*1669/*
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
102int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,102int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,
103 void *buffer, size_t size);103 void *buffer, size_t size);
104int simple_xattr_set(struct simple_xattrs *xattrs, const char *name,104int 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);
106ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs, char *buffer,107ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs, char *buffer,
107 size_t size);108 size_t size);
108void simple_xattr_list_add(struct simple_xattrs *xattrs,109void simple_xattr_list_add(struct simple_xattrs *xattrs,
include/linux/zorro.h+0−12
@@ -40,13 +40,6 @@ struct zorro_dev { · 39 unmodified lines
40#define to_zorro_dev(n) container_of(n, struct zorro_dev, dev)40#define to_zorro_dev(n) container_of(n, struct zorro_dev, dev)
41 41
42 42
43 /*
44 * Zorro bus
45 */
46
47extern struct bus_type zorro_bus_type;
48
49
50 /*43 /*
51 * Zorro device drivers44 * Zorro device drivers
52 */45 */
@@ -70,11 +63,6 @@ struct zorro_driver { · 17 unmodified lines
70/* New-style probing */63/* New-style probing */
71extern int zorro_register_driver(struct zorro_driver *);64extern int zorro_register_driver(struct zorro_driver *);
72extern void zorro_unregister_driver(struct zorro_driver *);65extern void zorro_unregister_driver(struct zorro_driver *);
73extern const struct zorro_device_id *zorro_match_device(const struct zorro_device_id *ids, const struct zorro_dev *z);
74static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
75{
76 return z->driver;
77}
78 66
79 67
80extern unsigned int zorro_num_autocon; /* # of autoconfig devices found */68extern unsigned int zorro_num_autocon; /* # of autoconfig devices found */