History

Merge branch 'next' into for-linus

Prepare input updates for 5.4 merge window.

Dmitry Torokhov committed 7 years ago

Commit 08987822 parents 0c043d7 410f25d13457 files · +1035069 −452311Browse files

Showing the changes to include/linux (370 of 13457 files). Show all

Unified · Split

370 files
  1. include/linux/acpi.h +19 −13
  2. include/linux/arch_topology.h +1 −1
  3. include/linux/audit.h +9 −0
  4. include/linux/avf/virtchnl.h +4 −0
  5. include/linux/backing-dev-defs.h +0 −1
  6. include/linux/backing-dev.h +1 −0
  7. include/linux/balloon_compaction.h +4 −0
  8. include/linux/bio.h +17 −14
  9. include/linux/bits.h +10 −7
  10. include/linux/blk-cgroup.h +38 −85
  11. include/linux/blk-mq.h +1 −1
  12. include/linux/blk_types.h +14 −7
  13. include/linux/blkdev.h +13 −20
  14. include/linux/bpf-cgroup.h +55 −3
  15. include/linux/bpf.h +95 −10
  16. include/linux/bpf_types.h +1 −0
  17. include/linux/bpf_verifier.h +81 −4
  18. include/linux/cacheinfo.h +2 −0
  19. include/linux/ccp.h +2 −0
  20. include/linux/ceph/ceph_features.h +1 −0
  21. include/linux/ceph/ceph_fs.h +1 −1
  22. include/linux/ceph/cls_lock_client.h +3 −0
  23. include/linux/ceph/debugfs.h +2 −2
  24. include/linux/ceph/decode.h +11 −2
  25. include/linux/ceph/libceph.h +4 −6
  26. include/linux/ceph/mon_client.h +0 −1
  27. include/linux/ceph/osd_client.h +10 −2
  28. include/linux/ceph/striper.h +2 −0
  29. include/linux/cgroup-defs.h +1 −1
  30. include/linux/cgroup.h +21 −0
  31. include/linux/clk-provider.h +96 −7
  32. include/linux/clk.h +48 −0
  33. include/linux/coda.h +1 −2
  34. include/linux/coda_psdev.h +0 −72
  35. include/linux/compat.h +1 −2
  36. include/linux/compiler-gcc.h +2 −0
  37. include/linux/compiler.h +5 −0
  38. include/linux/compiler_types.h +6 −0
  39. include/linux/concap.h +0 −112
  40. include/linux/connector.h +62 −2
  41. include/linux/console_struct.h +1 −4
  42. include/linux/coresight.h +35 −26
  43. include/linux/cpufreq.h +13 −7
  44. include/linux/cpuhotplug.h +2 −1
  45. include/linux/cred.h +7 −1
  46. include/linux/crypto.h +11 −1
  47. include/linux/dax.h +39 −2
  48. include/linux/dcache.h +2 −3
  49. include/linux/debugfs.h +5 −7
  50. include/linux/device-mapper.h +5 −15
  51. include/linux/device.h +22 −5
  52. include/linux/dim.h +333 −0
  53. include/linux/dma-buf.h +42 −10
  54. include/linux/dma-contiguous.h +19 −0
  55. include/linux/dma-direct.h +9 −0
  56. include/linux/dma-iommu.h +5 −44
  57. include/linux/dma-mapping.h +14 −7
  58. include/linux/dma-noncoherent.h +19 −0
  59. include/linux/dma/edma.h +47 −0
  60. include/linux/dma/mxs-dma.h +24 −0
  61. include/linux/dmaengine.h +8 −4
  62. include/linux/dmar.h +8 −6
  63. include/linux/dns_resolver.h +2 −1
  64. include/linux/dsa/8021q.h +7 −9
  65. include/linux/dsa/sja1105.h +34 −0
  66. include/linux/efi.h +10 −0
  67. include/linux/elevator.h +2 −12
  68. include/linux/energy_model.h +1 −1
  69. include/linux/fault-inject.h +1 −1
  70. include/linux/fb.h +12 −33
  71. include/linux/fbcon.h +30 −0
  72. include/linux/filter.h +48 −2
  73. include/linux/firmware/xlnx-zynqmp.h +0 −1
  74. include/linux/flat.h +42 −16
  75. include/linux/fmc-sdb.h +0 −39
  76. include/linux/fmc.h +0 −269
  77. include/linux/fpga/adi-axi-common.h +19 −0
  78. include/linux/fs.h +33 −26
  79. include/linux/fs_context.h +8 −1
  80. include/linux/fs_pin.h +0 −1
  81. include/linux/fscrypt.h +66 −30
  82. include/linux/fsl_devices.h +1 −0
  83. include/linux/fsnotify.h +26 −0
  84. include/linux/fsnotify_backend.h +0 −4
  85. include/linux/ftrace.h +2 −2
  86. include/linux/genalloc.h +9 −0
  87. include/linux/gpio.h +1 −0
  88. include/linux/gpio/consumer.h +32 −32
  89. include/linux/gpio/driver.h +15 −16
  90. include/linux/gpio/gpio-reg.h +1 −1
  91. include/linux/gpio/machine.h +2 −2
  92. include/linux/hdmi.h +67 −0
  93. include/linux/hmm.h +32 −316
  94. include/linux/host1x.h +2 −0
  95. include/linux/hrtimer.h +1 −15
  96. include/linux/hrtimer_defs.h +27 −0
  97. include/linux/huge_mm.h +23 −0
  98. include/linux/hugetlb.h +86 −34
  99. include/linux/hw_random.h +1 −1
  100. include/linux/hwspinlock.h +58 −3
  101. include/linux/i2c.h +53 −46
  102. include/linux/i3c/master.h +6 −4
  103. include/linux/ide.h +136 −136
  104. include/linux/idr.h +19 −2
  105. include/linux/ieee80211.h +8 −0
  106. include/linux/if_bridge.h +12 −0
  107. include/linux/if_pppox.h +3 −0
  108. include/linux/if_rmnet.h +55 −0
  109. include/linux/if_tap.h +0 −1
  110. include/linux/igmp.h +1 −1
  111. include/linux/ima.h +2 −0
  112. include/linux/in.h +1 −1
  113. include/linux/inetdevice.h +9 −10
  114. include/linux/init.h +4 −1
  115. include/linux/input.h +26 −0
  116. include/linux/input/bu21013.h +0 −34
  117. include/linux/intel-iommu.h +6 −1
  118. include/linux/intel-svm.h +1 −1
  119. include/linux/intel_rapl.h +155 −0
  120. include/linux/interrupt.h +1 −1
  121. include/linux/io-pgtable.h +4 −7
  122. include/linux/io.h +1 −0
  123. include/linux/iomap.h +18 −0
  124. include/linux/iommu.h +105 −0
  125. include/linux/iopoll.h +2 −2
  126. include/linux/ioport.h +12 −1
  127. include/linux/iova.h +6 −0
  128. include/linux/irqchip/arm-gic-common.h +5 −0
  129. include/linux/irqchip/arm-gic.h +0 −3
  130. include/linux/isdn.h +0 −473
  131. include/linux/isdn/hdlc.h +0 −69
  132. include/linux/isdn_divertif.h +0 −35
  133. include/linux/isdn_ppp.h +0 −194
  134. include/linux/isdnif.h +0 −505
  135. include/linux/iversion.h +24 −0
  136. include/linux/jbd2.h +22 −1
  137. include/linux/jhash.h +1 −1
  138. include/linux/jump_label.h +3 −0
  139. include/linux/jump_label_ratelimit.h +3 −2
  140. include/linux/kasan-checks.h +36 −7
  141. include/linux/kasan.h +5 −2
  142. include/linux/kernel.h +2 −0
  143. include/linux/key-type.h +3 −0
  144. include/linux/key.h +84 −18
  145. include/linux/kprobes.h +19 −0
  146. include/linux/kvm_host.h +8 −4
  147. include/linux/leds-ti-lmu-common.h +47 −0
  148. include/linux/libnvdimm.h +9 −1
  149. include/linux/list.h +14 −0
  150. include/linux/livepatch.h +0 −3
  151. include/linux/lockd/lockd.h +2 −0
  152. include/linux/lockdep.h +32 −13
  153. include/linux/log2.h +34 −0
  154. include/linux/lsm_hooks.h +1 −1
  155. include/linux/lz4.h +9 −9
  156. include/linux/memcontrol.h +16 −8
  157. include/linux/memory.h +5 −6
  158. include/linux/memory_hotplug.h +10 −17
  159. include/linux/memremap.h +49 −26
  160. include/linux/mfd/cros_ec.h +2 −0
  161. include/linux/mfd/cros_ec_commands.h +2911 −739
  162. include/linux/mfd/da9062/registers.h +3 −0
  163. include/linux/mfd/da9063/pdata.h +0 −49
  164. include/linux/mfd/lp87565.h +2 −0
  165. include/linux/mfd/madera/core.h +7 −5
  166. include/linux/mfd/madera/pdata.h +7 −6
  167. include/linux/mfd/madera/registers.h +201 −85
  168. include/linux/mfd/rk808.h +177 −0
  169. include/linux/mfd/rohm-bd70528.h +408 −0
  170. include/linux/mfd/rohm-bd718x7.h +8 −14
  171. include/linux/mfd/rohm-generic.h +20 −0
  172. include/linux/mfd/samsung/core.h +1 −0
  173. include/linux/mfd/samsung/s2mps11.h +8 −1
  174. include/linux/mfd/stmfx.h +1 −1
  175. include/linux/mfd/syscon.h +0 −6
  176. include/linux/mfd/ti-lmu-register.h +21 −42
  177. include/linux/mfd/ti-lmu.h +4 −1
  178. include/linux/mfd/wm831x/pdata.h +0 −1
  179. include/linux/migrate.h +1 −2
  180. include/linux/mlx5/accel.h +1 −1
  181. include/linux/mlx5/cq.h +3 −3
  182. include/linux/mlx5/device.h +29 −3
  183. include/linux/mlx5/driver.h +35 −26
  184. include/linux/mlx5/eq.h +8 −17
  185. include/linux/mlx5/eswitch.h +48 −12
  186. include/linux/mlx5/fs.h +15 −5
  187. include/linux/mlx5/mlx5_ifc.h +373 −32
  188. include/linux/mlx5/qp.h +9 −7
  189. include/linux/mlx5/vport.h +3 −4
  190. include/linux/mm.h +84 −84
  191. include/linux/mm_types.h +4 −2
  192. include/linux/mmc/host.h +0 −1
  193. include/linux/mmzone.h +69 −19
  194. include/linux/mod_devicetable.h +26 −5
  195. include/linux/module.h +5 −0
  196. include/linux/moduleloader.h +5 −0
  197. include/linux/msi.h +8 −0
  198. include/linux/mtd/cfi.h +7 −0
  199. include/linux/mtd/hyperbus.h +84 −0
  200. include/linux/mtd/mtd.h +6 −0
  201. include/linux/mtd/onenand_regs.h +1 −0
  202. include/linux/mtd/rawnand.h +36 −0
  203. include/linux/mtd/spinand.h +33 −2
  204. include/linux/mutex.h +1 −1
  205. include/linux/mv643xx.h +0 −46
  206. include/linux/net.h +2 −2
  207. include/linux/net_dim.h +0 −418
  208. include/linux/netdevice.h +2 −0
  209. include/linux/netfilter.h +0 −5
  210. include/linux/netfilter/ipset/ip_set.h +1 −1
  211. include/linux/netfilter/ipset/ip_set_counter.h +1 −2
  212. include/linux/netfilter/ipset/ip_set_skbinfo.h +1 −2
  213. include/linux/netfilter/ipset/ip_set_timeout.h +1 −2
  214. include/linux/netfilter/nf_conntrack_h323_asn1.h +1 −2
  215. include/linux/netfilter_ipv6.h +100 −2
  216. include/linux/netlink.h +8 −1
  217. include/linux/nfs4.h +1 −0
  218. include/linux/nfs_fs.h +2 −0
  219. include/linux/nfs_fs_sb.h +1 −0
  220. include/linux/node.h +2 −12
  221. include/linux/ntb.h +197 −3
  222. include/linux/nvme-fc-driver.h +6 −0
  223. include/linux/nvme.h +74 −4
  224. include/linux/of.h +1 −1
  225. include/linux/of_fdt.h +0 −11
  226. include/linux/olpc-ec.h +34 −3
  227. include/linux/omap-mailbox.h +3 −1
  228. include/linux/oom.h +0 −1
  229. include/linux/page-flags-layout.h +11 −7
  230. include/linux/page-flags.h +10 −0
  231. include/linux/page-isolation.h +1 −1
  232. include/linux/page_ext.h +0 −1
  233. include/linux/pagemap.h +4 −2
  234. include/linux/pci-acpi.h +4 −3
  235. include/linux/pci-aspm.h +4 −3
  236. include/linux/pci.h +60 −2
  237. include/linux/pci_ids.h +5 −3
  238. include/linux/percpu-refcount.h +9 −1
  239. include/linux/percpu-rwsem.h +9 −5
  240. include/linux/perf/arm_pmu.h +2 −0
  241. include/linux/perf_event.h +11 −0
  242. include/linux/pfn_t.h +2 −9
  243. include/linux/phy.h +13 −12
  244. include/linux/phylink.h +46 −22
  245. include/linux/pid.h +6 −2
  246. include/linux/pinctrl/pinconf-generic.h +9 −14
  247. include/linux/pinctrl/pinconf.h +1 −3
  248. include/linux/pinctrl/pinctrl-state.h +5 −0
  249. include/linux/pinctrl/pinctrl.h +5 −14
  250. include/linux/pinctrl/pinmux.h +0 −4
  251. include/linux/platform_data/dma-imx.h +0 −1
  252. include/linux/platform_data/fsa9480.h +0 −24
  253. include/linux/platform_data/gpio-omap.h +1 −1
  254. include/linux/platform_data/i2c-mux-gpio.h +0 −7
  255. include/linux/platform_data/keypad-w90p910.h +0 −16
  256. include/linux/platform_data/media/mmp-camera.h +0 −4
  257. include/linux/platform_data/spi-mt65xx.h +0 −2
  258. include/linux/platform_data/ti-sysc.h +12 −0
  259. include/linux/platform_data/video-clcd-versatile.h +0 −28
  260. include/linux/platform_data/wilco-ec.h +87 −7
  261. include/linux/platform_data/x86/asus-wmi.h +3 −2
  262. include/linux/platform_data/xilinx-ll-temac.h +2 −1
  263. include/linux/platform_device.h +1 −1
  264. include/linux/pm.h +1 −2
  265. include/linux/pm_opp.h +4 −4
  266. include/linux/pm_qos.h +37 −11
  267. include/linux/pm_wakeup.h +1 −1
  268. include/linux/poison.h +1 −1
  269. include/linux/power_supply.h +15 −0
  270. include/linux/proc_fs.h +9 −0
  271. include/linux/processor.h +0 −9
  272. include/linux/property.h +95 −0
  273. include/linux/pseudo_fs.h +16 −0
  274. include/linux/ptp_clock_kernel.h +8 −0
  275. include/linux/ptrace.h +1 −1
  276. include/linux/pwm.h +14 −2
  277. include/linux/qed/qed_if.h +9 −1
  278. include/linux/qed/qed_rdma_if.h +2 −0
  279. include/linux/ramfs.h +0 −1
  280. include/linux/rbtree.h +46 −24
  281. include/linux/rbtree_augmented.h +10 −17
  282. include/linux/rcu_sync.h +11 −29
  283. include/linux/rcupdate.h +12 −9
  284. include/linux/regmap.h +22 −2
  285. include/linux/regulator/coupler.h +97 −0
  286. include/linux/regulator/driver.h +9 −3
  287. include/linux/regulator/machine.h +1 −1
  288. include/linux/regulator/max8952.h +0 −3
  289. include/linux/remoteproc.h +26 −6
  290. include/linux/reservation.h +6 −2
  291. include/linux/rhashtable.h +18 −18
  292. include/linux/rwsem.h +10 −8
  293. include/linux/scatterlist.h +7 −4
  294. include/linux/sched.h +91 −9
  295. include/linux/sched/isolation.h +6 −0
  296. include/linux/sched/nohz.h +0 −8
  297. include/linux/sched/numa_balancing.h +2 −2
  298. include/linux/sched/signal.h +21 −10
  299. include/linux/sched/sysctl.h +11 −0
  300. include/linux/sched/task.h +17 −1
  301. include/linux/sched/topology.h +3 −22
  302. include/linux/sched/user.h +0 −14
  303. include/linux/sched/wake_q.h +5 −0
  304. include/linux/scmi_protocol.h +1 −0
  305. include/linux/security.h +6 −6
  306. include/linux/sed-opal.h +3 −0
  307. include/linux/seq_file.h +1 −0
  308. include/linux/serial_8250.h +1 −0
  309. include/linux/serial_core.h +1 −1
  310. include/linux/sfp.h +8 −4
  311. include/linux/signal.h +0 −4
  312. include/linux/siox.h +10 −0
  313. include/linux/sizes.h +1 −0
  314. include/linux/skbuff.h +23 −5
  315. include/linux/skmsg.h +7 −1
  316. include/linux/slab.h +11 −5
  317. include/linux/smp.h +34 −18
  318. include/linux/soc/qcom/mdt_loader.h +2 −0
  319. include/linux/soc/ti/ti_sci_protocol.h +260 −14
  320. include/linux/socket.h +7 −0
  321. include/linux/soundwire/sdw.h +69 −19
  322. include/linux/soundwire/sdw_type.h +11 −0
  323. include/linux/spi/spi.h +37 −0
  324. include/linux/srcutree.h +11 −3
  325. include/linux/stmmac.h +1 −5
  326. include/linux/stop_machine.h +1 −0
  327. include/linux/string_helpers.h +3 −0
  328. include/linux/sudmac.h +0 −49
  329. include/linux/sunrpc/bc_xprt.h +1 −0
  330. include/linux/sunrpc/clnt.h +4 −0
  331. include/linux/sunrpc/metrics.h +6 −1
  332. include/linux/sunrpc/sched.h +3 −1
  333. include/linux/sunrpc/xdr.h +7 −0
  334. include/linux/sunrpc/xprt.h +8 −2
  335. include/linux/sunrpc/xprtmultipath.h +2 −0
  336. include/linux/sunrpc/xprtsock.h +5 −0
  337. include/linux/suspend.h +3 −2
  338. include/linux/swap.h +12 −6
  339. include/linux/swapops.h +3 −17
  340. include/linux/syscalls.h +8 −3
  341. include/linux/sysctl.h +7 −0
  342. include/linux/sysfs.h +8 −0
  343. include/linux/tcp.h +3 −6
  344. include/linux/thermal.h +2 −2
  345. include/linux/timekeeping.h +30 −2
  346. include/linux/timer.h +19 −8
  347. include/linux/topology.h +6 −0
  348. include/linux/torture.h +1 −1
  349. include/linux/tpm_eventlog.h +152 −0
  350. include/linux/trace_events.h +9 −0
  351. include/linux/tracehook.h +13 −3
  352. include/linux/types.h +1 −1
  353. include/linux/uaccess.h +19 −1
  354. include/linux/uio.h +3 −11
  355. include/linux/unicode.h +3 −0
  356. include/linux/usb.h +2 −0
  357. include/linux/usb/chipidea.h +1 −0
  358. include/linux/usb/gadget.h +2 −1
  359. include/linux/usb/hcd.h +5 −1
  360. include/linux/usb/renesas_usbhs.h +6 −33
  361. include/linux/usb/typec_mux.h +28 −34
  362. include/linux/user_namespace.h +11 −1
  363. include/linux/vmalloc.h +2 −0
  364. include/linux/vmpressure.h +1 −1
  365. include/linux/vmw_vmci_defs.h +20 −21
  366. include/linux/wait.h +13 −0
  367. include/linux/wanrouter.h +0 −11
  368. include/linux/wmi.h +1 −1
  369. include/linux/workqueue.h +0 −4
  370. include/linux/writeback.h +34 −7
include/linux/acpi.h+19−13
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010
1111 #include <linux/errno.h>
1212 #include <linux/ioport.h> /* for struct resource */
13+#include <linux/irqdomain.h>
1314 #include <linux/resource_ext.h>
1415 #include <linux/device.h>
1516 #include <linux/property.h>
@@ -314,10 +315,19 @@ int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); · 298 unmodified lines
314315 void acpi_set_irq_model(enum acpi_irq_model_id model,
315316 struct fwnode_handle *fwnode);
316317
318+struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags,
319+ unsigned int size,
320+ struct fwnode_handle *fwnode,
321+ const struct irq_domain_ops *ops,
322+ void *host_data);
323+
317324 #ifdef CONFIG_X86_IO_APIC
318325 extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity);
319326 #else
320−#define acpi_get_override_irq(gsi, trigger, polarity) (-1)
327+static inline int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity)
328+{
329+ return -1;
330+}
321331 #endif
322332 /*
323333 * This function undoes the effect of one call to acpi_register_gsi().
@@ -367,6 +377,7 @@ extern acpi_status wmi_install_notify_handler(const char *guid, · 43 unmodified lines
367377 extern acpi_status wmi_remove_notify_handler(const char *guid);
368378 extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out);
369379 extern bool wmi_has_guid(const char *guid);
380+extern char *wmi_get_acpi_device_uid(const char *guid);
370381
371382 #endif /* CONFIG_ACPI_WMI */
372383
@@ -913,31 +924,21 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) · 540 unmodified lines
913924 #endif
914925
915926 #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
916−int acpi_dev_suspend_late(struct device *dev);
917927 int acpi_subsys_prepare(struct device *dev);
918928 void acpi_subsys_complete(struct device *dev);
919929 int acpi_subsys_suspend_late(struct device *dev);
920930 int acpi_subsys_suspend_noirq(struct device *dev);
921−int acpi_subsys_resume_noirq(struct device *dev);
922−int acpi_subsys_resume_early(struct device *dev);
923931 int acpi_subsys_suspend(struct device *dev);
924932 int acpi_subsys_freeze(struct device *dev);
925−int acpi_subsys_freeze_late(struct device *dev);
926−int acpi_subsys_freeze_noirq(struct device *dev);
927−int acpi_subsys_thaw_noirq(struct device *dev);
933+int acpi_subsys_poweroff(struct device *dev);
928934 #else
929−static inline int acpi_dev_resume_early(struct device *dev) { return 0; }
930935 static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
931936 static inline void acpi_subsys_complete(struct device *dev) {}
932937 static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
933938 static inline int acpi_subsys_suspend_noirq(struct device *dev) { return 0; }
934−static inline int acpi_subsys_resume_noirq(struct device *dev) { return 0; }
935−static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
936939 static inline int acpi_subsys_suspend(struct device *dev) { return 0; }
937940 static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
938−static inline int acpi_subsys_freeze_late(struct device *dev) { return 0; }
939−static inline int acpi_subsys_freeze_noirq(struct device *dev) { return 0; }
940−static inline int acpi_subsys_thaw_noirq(struct device *dev) { return 0; }
941+static inline int acpi_subsys_poweroff(struct device *dev) { return 0; }
941942 #endif
942943
943944 #ifdef CONFIG_ACPI
@@ -1303,6 +1304,7 @@ static inline int lpit_read_residency_count_address(u64 *address) · 359 unmodified lines
13031304 #ifdef CONFIG_ACPI_PPTT
13041305 int find_acpi_cpu_topology(unsigned int cpu, int level);
13051306 int find_acpi_cpu_topology_package(unsigned int cpu);
1307+int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
13061308 int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
13071309 #else
13081310 static inline int find_acpi_cpu_topology(unsigned int cpu, int level)
@@ -1313,6 +1315,10 @@ static inline int find_acpi_cpu_topology_package(unsigned int cpu) · 4 unmodified lines
13131315 {
13141316 return -EINVAL;
13151317 }
1318+static inline int find_acpi_cpu_topology_hetero_id(unsigned int cpu)
1319+{
1320+ return -EINVAL;
1321+}
13161322 static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
13171323 {
13181324 return -EINVAL;
include/linux/arch_topology.h+1−1
@@ -18,7 +18,7 @@ DECLARE_PER_CPU(unsigned long, cpu_scale); · 17 unmodified lines
1818
1919 struct sched_domain;
2020 static inline
21−unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu)
21+unsigned long topology_get_cpu_scale(int cpu)
2222 {
2323 return per_cpu(cpu_scale, cpu);
2424 }
include/linux/audit.h+9−0
@@ -182,6 +182,9 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk) · 181 unmodified lines
182182 }
183183
184184 extern u32 audit_enabled;
185+
186+extern int audit_signal_info(int sig, struct task_struct *t);
187+
185188 #else /* CONFIG_AUDIT */
186189 static inline __printf(4, 5)
187190 void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
@@ -235,6 +238,12 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk) · 47 unmodified lines
235238 }
236239
237240 #define audit_enabled AUDIT_OFF
241+
242+static inline int audit_signal_info(int sig, struct task_struct *t)
243+{
244+ return 0;
245+}
246+
238247 #endif /* CONFIG_AUDIT */
239248
240249 #ifdef CONFIG_AUDIT_COMPAT_GENERIC
include/linux/avf/virtchnl.h+4−0
@@ -61,12 +61,14 @@ enum virtchnl_status_code { · 60 unmodified lines
6161 #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
6262 #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
6363
64+#define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT 0x0
6465 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1
6566 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2
6667 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3
6768 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4
6869 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5
6970 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6
71+#define VIRTCHNL_LINK_SPEED_5GB_SHIFT 0x7
7072
7173 enum virtchnl_link_speed {
7274 VIRTCHNL_LINK_SPEED_UNKNOWN = 0,
@@ -76,6 +78,8 @@ enum virtchnl_link_speed { · 3 unmodified lines
7678 VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
7779 VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
7880 VIRTCHNL_LINK_SPEED_25GB = BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
81+ VIRTCHNL_LINK_SPEED_2_5GB = BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
82+ VIRTCHNL_LINK_SPEED_5GB = BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
7983 };
8084
8185 /* for hsplit_0 field of Rx HMC context */
include/linux/backing-dev-defs.h+0−1
@@ -203,7 +203,6 @@ struct backing_dev_info { · 202 unmodified lines
203203
204204 #ifdef CONFIG_DEBUG_FS
205205 struct dentry *debug_dir;
206− struct dentry *debug_stats;
207206 #endif
208207 };
209208
include/linux/backing-dev.h+1−0
@@ -48,6 +48,7 @@ extern spinlock_t bdi_lock; · 47 unmodified lines
4848 extern struct list_head bdi_list;
4949
5050 extern struct workqueue_struct *bdi_wq;
51+extern struct workqueue_struct *bdi_async_bio_wq;
5152
5253 static inline bool wb_has_dirty_io(struct bdi_writeback *wb)
5354 {
include/linux/balloon_compaction.h+4−0
@@ -64,6 +64,10 @@ extern struct page *balloon_page_alloc(void); · 63 unmodified lines
6464 extern void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
6565 struct page *page);
6666 extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
67+extern size_t balloon_page_list_enqueue(struct balloon_dev_info *b_dev_info,
68+ struct list_head *pages);
69+extern size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
70+ struct list_head *pages, size_t n_req_pages);
6771
6872 static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
6973 {
include/linux/bio.h+17−14
@@ -102,9 +102,23 @@ static inline void *bio_data(struct bio *bio) · 101 unmodified lines
102102 return NULL;
103103 }
104104
105−static inline bool bio_full(struct bio *bio)
105+/**
106+ * bio_full - check if the bio is full
107+ * @bio: bio to check
108+ * @len: length of one segment to be added
109+ *
110+ * Return true if @bio is full and one segment with @len bytes can't be
111+ * added to the bio, otherwise return false
112+ */
113+static inline bool bio_full(struct bio *bio, unsigned len)
106114 {
107− return bio->bi_vcnt >= bio->bi_max_vecs;
115+ if (bio->bi_vcnt >= bio->bi_max_vecs)
116+ return true;
117+
118+ if (bio->bi_iter.bi_size > UINT_MAX - len)
119+ return true;
120+
121+ return false;
108122 }
109123
110124 static inline bool bio_next_segment(const struct bio *bio,
@@ -408,7 +422,6 @@ static inline void bio_wouldblock_error(struct bio *bio) · 297 unmodified lines
408422 }
409423
410424 struct request_queue;
411−extern int bio_phys_segments(struct request_queue *, struct bio *);
412425
413426 extern int submit_bio_wait(struct bio *bio);
414427 extern void bio_advance(struct bio *, unsigned);
@@ -427,6 +440,7 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page, · 12 unmodified lines
427440 void __bio_add_page(struct bio *bio, struct page *page,
428441 unsigned int len, unsigned int off);
429442 int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter);
443+void bio_release_pages(struct bio *bio, bool mark_dirty);
430444 struct rq_map_data;
431445 extern struct bio *bio_map_user_iov(struct request_queue *,
432446 struct iov_iter *, gfp_t);
@@ -444,17 +458,6 @@ void generic_end_io_acct(struct request_queue *q, int op, · 11 unmodified lines
444458 struct hd_struct *part,
445459 unsigned long start_time);
446460
447−#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
448−# error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform"
449−#endif
450−#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
451−extern void bio_flush_dcache_pages(struct bio *bi);
452−#else
453−static inline void bio_flush_dcache_pages(struct bio *bi)
454−{
455−}
456−#endif
457−
458461 extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter,
459462 struct bio *src, struct bvec_iter *src_iter);
460463 extern void bio_copy_data(struct bio *dst, struct bio *src);
include/linux/bits.h+10−7
@@ -1,13 +1,15 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 #ifndef __LINUX_BITS_H
33 #define __LINUX_BITS_H
4+
5+#include <linux/const.h>
46 #include <asm/bitsperlong.h>
57
6−#define BIT(nr) (1UL << (nr))
7−#define BIT_ULL(nr) (1ULL << (nr))
8−#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
8+#define BIT(nr) (UL(1) << (nr))
9+#define BIT_ULL(nr) (ULL(1) << (nr))
10+#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
911 #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
10−#define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG))
12+#define BIT_ULL_MASK(nr) (ULL(1) << ((nr) % BITS_PER_LONG_LONG))
1113 #define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG)
1214 #define BITS_PER_BYTE 8
1315
@@ -17,10 +19,11 @@ · 3 unmodified lines
1719 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
1820 */
1921 #define GENMASK(h, l) \
20− (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
22+ (((~UL(0)) - (UL(1) << (l)) + 1) & \
23+ (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
2124
2225 #define GENMASK_ULL(h, l) \
23− (((~0ULL) - (1ULL << (l)) + 1) & \
24− (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
26+ (((~ULL(0)) - (ULL(1) << (l)) + 1) & \
27+ (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
2528
2629 #endif /* __LINUX_BITS_H */
include/linux/blk-cgroup.h+38−85
@@ -63,19 +63,17 @@ struct blkcg { · 62 unmodified lines
6363
6464 /*
6565 * blkg_[rw]stat->aux_cnt is excluded for local stats but included for
66− * recursive. Used to carry stats of dead children, and, for blkg_rwstat,
67− * to carry result values from read and sum operations.
66+ * recursive. Used to carry stats of dead children.
6867 */
69−struct blkg_stat {
70− struct percpu_counter cpu_cnt;
71− atomic64_t aux_cnt;
72−};
73−
7468 struct blkg_rwstat {
7569 struct percpu_counter cpu_cnt[BLKG_RWSTAT_NR];
7670 atomic64_t aux_cnt[BLKG_RWSTAT_NR];
7771 };
7872
73+struct blkg_rwstat_sample {
74+ u64 cnt[BLKG_RWSTAT_NR];
75+};
76+
7977 /*
8078 * A blkcg_gq (blkg) is association between a block cgroup (blkcg) and a
8179 * request_queue (q). This is used by blkcg policies which need to track
@@ -134,13 +132,17 @@ struct blkcg_gq { · 52 unmodified lines
134132
135133 struct blkg_policy_data *pd[BLKCG_MAX_POLS];
136134
137− struct rcu_head rcu_head;
135+ spinlock_t async_bio_lock;
136+ struct bio_list async_bios;
137+ struct work_struct async_bio_work;
138138
139139 atomic_t use_delay;
140140 atomic64_t delay_nsec;
141141 atomic64_t delay_start;
142142 u64 last_delay;
143143 int last_use;
144+
145+ struct rcu_head rcu_head;
144146 };
145147
146148 typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp);
@@ -179,6 +181,7 @@ struct blkcg_policy { · 32 unmodified lines
179181
180182 extern struct blkcg blkcg_root;
181183 extern struct cgroup_subsys_state * const blkcg_root_css;
184+extern bool blkcg_debug_stats;
182185
183186 struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg,
184187 struct request_queue *q, bool update_hint);
@@ -198,6 +201,13 @@ int blkcg_activate_policy(struct request_queue *q, · 13 unmodified lines
198201 void blkcg_deactivate_policy(struct request_queue *q,
199202 const struct blkcg_policy *pol);
200203
204+static inline u64 blkg_rwstat_read_counter(struct blkg_rwstat *rwstat,
205+ unsigned int idx)
206+{
207+ return atomic64_read(&rwstat->aux_cnt[idx]) +
208+ percpu_counter_sum_positive(&rwstat->cpu_cnt[idx]);
209+}
210+
201211 const char *blkg_dev_name(struct blkcg_gq *blkg);
202212 void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg,
203213 u64 (*prfill)(struct seq_file *,
@@ -206,8 +216,7 @@ void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, · 2 unmodified lines
206216 bool show_total);
207217 u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v);
208218 u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd,
209− const struct blkg_rwstat *rwstat);
210−u64 blkg_prfill_stat(struct seq_file *sf, struct blkg_policy_data *pd, int off);
219+ const struct blkg_rwstat_sample *rwstat);
211220 u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd,
212221 int off);
213222 int blkg_print_stat_bytes(struct seq_file *sf, void *v);
@@ -215,10 +224,8 @@ int blkg_print_stat_ios(struct seq_file *sf, void *v); · 1 unmodified line
215224 int blkg_print_stat_bytes_recursive(struct seq_file *sf, void *v);
216225 int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v);
217226
218−u64 blkg_stat_recursive_sum(struct blkcg_gq *blkg,
219− struct blkcg_policy *pol, int off);
220−struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg,
221− struct blkcg_policy *pol, int off);
227+void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol,
228+ int off, struct blkg_rwstat_sample *sum);
222229
223230 struct blkg_conf_ctx {
224231 struct gendisk *disk;
@@ -569,69 +576,6 @@ static inline void blkg_put(struct blkcg_gq *blkg) · 344 unmodified lines
569576 if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \
570577 (p_blkg)->q, false)))
571578
572−static inline int blkg_stat_init(struct blkg_stat *stat, gfp_t gfp)
573−{
574− int ret;
575−
576− ret = percpu_counter_init(&stat->cpu_cnt, 0, gfp);
577− if (ret)
578− return ret;
579−
580− atomic64_set(&stat->aux_cnt, 0);
581− return 0;
582−}
583−
584−static inline void blkg_stat_exit(struct blkg_stat *stat)
585−{
586− percpu_counter_destroy(&stat->cpu_cnt);
587−}
588−
589−/**
590− * blkg_stat_add - add a value to a blkg_stat
591− * @stat: target blkg_stat
592− * @val: value to add
593− *
594− * Add @val to @stat. The caller must ensure that IRQ on the same CPU
595− * don't re-enter this function for the same counter.
596− */
597−static inline void blkg_stat_add(struct blkg_stat *stat, uint64_t val)
598−{
599− percpu_counter_add_batch(&stat->cpu_cnt, val, BLKG_STAT_CPU_BATCH);
600−}
601−
602−/**
603− * blkg_stat_read - read the current value of a blkg_stat
604− * @stat: blkg_stat to read
605− */
606−static inline uint64_t blkg_stat_read(struct blkg_stat *stat)
607−{
608− return percpu_counter_sum_positive(&stat->cpu_cnt);
609−}
610−
611−/**
612− * blkg_stat_reset - reset a blkg_stat
613− * @stat: blkg_stat to reset
614− */
615−static inline void blkg_stat_reset(struct blkg_stat *stat)
616−{
617− percpu_counter_set(&stat->cpu_cnt, 0);
618− atomic64_set(&stat->aux_cnt, 0);
619−}
620−
621−/**
622− * blkg_stat_add_aux - add a blkg_stat into another's aux count
623− * @to: the destination blkg_stat
624− * @from: the source
625− *
626− * Add @from's count including the aux one to @to's aux count.
627− */
628−static inline void blkg_stat_add_aux(struct blkg_stat *to,
629− struct blkg_stat *from)
630−{
631− atomic64_add(blkg_stat_read(from) + atomic64_read(&from->aux_cnt),
632− &to->aux_cnt);
633−}
634−
635579 static inline int blkg_rwstat_init(struct blkg_rwstat *rwstat, gfp_t gfp)
636580 {
637581 int i, ret;
@@ -693,15 +637,14 @@ static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat, · 55 unmodified lines
693637 *
694638 * Read the current snapshot of @rwstat and return it in the aux counts.
695639 */
696−static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat)
640+static inline void blkg_rwstat_read(struct blkg_rwstat *rwstat,
641+ struct blkg_rwstat_sample *result)
697642 {
698− struct blkg_rwstat result;
699643 int i;
700644
701645 for (i = 0; i < BLKG_RWSTAT_NR; i++)
702− atomic64_set(&result.aux_cnt[i],
703− percpu_counter_sum_positive(&rwstat->cpu_cnt[i]));
704− return result;
646+ result->cnt[i] =
647+ percpu_counter_sum_positive(&rwstat->cpu_cnt[i]);
705648 }
706649
707650 /**
@@ -714,10 +657,10 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat) · 6 unmodified lines
714657 */
715658 static inline uint64_t blkg_rwstat_total(struct blkg_rwstat *rwstat)
716659 {
717− struct blkg_rwstat tmp = blkg_rwstat_read(rwstat);
660+ struct blkg_rwstat_sample tmp = { };
718661
719− return atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_READ]) +
720− atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_WRITE]);
662+ blkg_rwstat_read(rwstat, &tmp);
663+ return tmp.cnt[BLKG_RWSTAT_READ] + tmp.cnt[BLKG_RWSTAT_WRITE];
721664 }
722665
723666 /**
@@ -763,6 +706,15 @@ static inline bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg · 39 unmodified lines
763706 struct bio *bio) { return false; }
764707 #endif
765708
709+bool __blkcg_punt_bio_submit(struct bio *bio);
710+
711+static inline bool blkcg_punt_bio_submit(struct bio *bio)
712+{
713+ if (bio->bi_opf & REQ_CGROUP_PUNT)
714+ return __blkcg_punt_bio_submit(bio);
715+ else
716+ return false;
717+}
766718
767719 static inline void blkcg_bio_issue_init(struct bio *bio)
768720 {
@@ -910,6 +862,7 @@ static inline char *blkg_path(struct blkcg_gq *blkg) { return NULL; } · 141 unmodified lines
910862 static inline void blkg_get(struct blkcg_gq *blkg) { }
911863 static inline void blkg_put(struct blkcg_gq *blkg) { }
912864
865+static inline bool blkcg_punt_bio_submit(struct bio *bio) { return false; }
913866 static inline void blkcg_bio_issue_init(struct bio *bio) { }
914867 static inline bool blkcg_bio_issue_check(struct request_queue *q,
915868 struct bio *bio) { return true; }
include/linux/blk-mq.h+1−1
@@ -306,7 +306,7 @@ void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs · 305 unmodified lines
306306 bool blk_mq_complete_request(struct request *rq);
307307 void blk_mq_complete_request_sync(struct request *rq);
308308 bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
309− struct bio *bio);
309+ struct bio *bio, unsigned int nr_segs);
310310 bool blk_mq_queue_stopped(struct request_queue *q);
311311 void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx);
312312 void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx);
include/linux/blk_types.h+14−7
@@ -154,11 +154,6 @@ struct bio { · 153 unmodified lines
154154 blk_status_t bi_status;
155155 u8 bi_partno;
156156
157− /* Number of segments in this BIO after
158− * physical address coalescing is performed.
159− */
160− unsigned int bi_phys_segments;
161−
162157 struct bvec_iter bi_iter;
163158
164159 atomic_t __bi_remaining;
@@ -210,7 +205,6 @@ struct bio { · 45 unmodified lines
210205 */
211206 enum {
212207 BIO_NO_PAGE_REF, /* don't put release vec pages */
213− BIO_SEG_VALID, /* bi_phys_segments valid */
214208 BIO_CLONED, /* doesn't own data */
215209 BIO_BOUNCED, /* bio is a bounce bio */
216210 BIO_USER_MAPPED, /* contains user pages */
@@ -317,6 +311,15 @@ enum req_flag_bits { · 100 unmodified lines
317311 __REQ_RAHEAD, /* read ahead, can fail anytime */
318312 __REQ_BACKGROUND, /* background IO */
319313 __REQ_NOWAIT, /* Don't wait if request will block */
314+ __REQ_NOWAIT_INLINE, /* Return would-block error inline */
315+ /*
316+ * When a shared kthread needs to issue a bio for a cgroup, doing
317+ * so synchronously can lead to priority inversions as the kthread
318+ * can be trapped waiting for that cgroup. CGROUP_PUNT flag makes
319+ * submit_bio() punt the actual issuing to a dedicated per-blkcg
320+ * work item to avoid such priority inversions.
321+ */
322+ __REQ_CGROUP_PUNT,
320323
321324 /* command specific flags for REQ_OP_WRITE_ZEROES: */
322325 __REQ_NOUNMAP, /* do not free blocks when zeroing */
@@ -343,6 +346,9 @@ enum req_flag_bits { · 20 unmodified lines
343346 #define REQ_RAHEAD (1ULL << __REQ_RAHEAD)
344347 #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND)
345348 #define REQ_NOWAIT (1ULL << __REQ_NOWAIT)
349+#define REQ_NOWAIT_INLINE (1ULL << __REQ_NOWAIT_INLINE)
350+#define REQ_CGROUP_PUNT (1ULL << __REQ_CGROUP_PUNT)
351+
346352 #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP)
347353 #define REQ_HIPRI (1ULL << __REQ_HIPRI)
348354
@@ -414,12 +420,13 @@ static inline int op_stat_group(unsigned int op) · 65 unmodified lines
414420
415421 typedef unsigned int blk_qc_t;
416422 #define BLK_QC_T_NONE -1U
423+#define BLK_QC_T_EAGAIN -2U
417424 #define BLK_QC_T_SHIFT 16
418425 #define BLK_QC_T_INTERNAL (1U << 31)
419426
420427 static inline bool blk_qc_t_valid(blk_qc_t cookie)
421428 {
422− return cookie != BLK_QC_T_NONE;
429+ return cookie != BLK_QC_T_NONE && cookie != BLK_QC_T_EAGAIN;
423430 }
424431
425432 static inline unsigned int blk_qc_t_to_queue_num(blk_qc_t cookie)
include/linux/blkdev.h+13−20
@@ -137,11 +137,11 @@ struct request { · 136 unmodified lines
137137 unsigned int cmd_flags; /* op and common flags */
138138 req_flags_t rq_flags;
139139
140+ int tag;
140141 int internal_tag;
141142
142143 /* the following two fields are internal, NEVER access directly */
143144 unsigned int __data_len; /* total data len */
144− int tag;
145145 sector_t __sector; /* sector cursor */
146146
147147 struct bio *bio;
@@ -344,10 +344,15 @@ struct queue_limits { · 196 unmodified lines
344344
345345 #ifdef CONFIG_BLK_DEV_ZONED
346346
347+/*
348+ * Maximum number of zones to report with a single report zones command.
349+ */
350+#define BLK_ZONED_REPORT_MAX_ZONES 8192U
351+
347352 extern unsigned int blkdev_nr_zones(struct block_device *bdev);
348353 extern int blkdev_report_zones(struct block_device *bdev,
349354 sector_t sector, struct blk_zone *zones,
350− unsigned int *nr_zones, gfp_t gfp_mask);
355+ unsigned int *nr_zones);
351356 extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors,
352357 sector_t nr_sectors, gfp_t gfp_mask);
353358 extern int blk_revalidate_disk_zones(struct gendisk *disk);
@@ -681,7 +686,7 @@ static inline bool blk_queue_is_zoned(struct request_queue *q) · 327 unmodified lines
681686 }
682687 }
683688
684−static inline unsigned int blk_queue_zone_sectors(struct request_queue *q)
689+static inline sector_t blk_queue_zone_sectors(struct request_queue *q)
685690 {
686691 return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0;
687692 }
@@ -828,7 +833,6 @@ extern void blk_unregister_queue(struct gendisk *disk); · 140 unmodified lines
828833 extern blk_qc_t generic_make_request(struct bio *bio);
829834 extern blk_qc_t direct_make_request(struct bio *bio);
830835 extern void blk_rq_init(struct request_queue *q, struct request *rq);
831−extern void blk_init_request_from_bio(struct request *req, struct bio *bio);
832836 extern void blk_put_request(struct request *);
833837 extern struct request *blk_get_request(struct request_queue *, unsigned int op,
834838 blk_mq_req_flags_t flags);
@@ -842,7 +846,6 @@ extern blk_status_t blk_insert_cloned_request(struct request_queue *q, · 7 unmodified lines
842846 struct request *rq);
843847 extern int blk_rq_append_bio(struct request *rq, struct bio **bio);
844848 extern void blk_queue_split(struct request_queue *, struct bio **);
845−extern void blk_recount_segments(struct request_queue *, struct bio *);
846849 extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int);
847850 extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t,
848851 unsigned int, void __user *);
@@ -867,6 +870,9 @@ extern void blk_execute_rq(struct request_queue *, struct gendisk *, · 18 unmodified lines
867870 extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
868871 struct request *, int, rq_end_io_fn *);
869872
873+/* Helper to convert REQ_OP_XXX to its string format XXX */
874+extern const char *blk_op_str(unsigned int op);
875+
870876 int blk_status_to_errno(blk_status_t status);
871877 blk_status_t errno_to_blk_status(int errno);
872878
@@ -1026,21 +1032,9 @@ void blk_steal_bios(struct bio_list *list, struct request *rq); · 153 unmodified lines
10261032 *
10271033 * blk_update_request() completes given number of bytes and updates
10281034 * the request without completing it.
1029− *
1030− * blk_end_request() and friends. __blk_end_request() must be called
1031− * with the request queue spinlock acquired.
1032− *
1033− * Several drivers define their own end_request and call
1034− * blk_end_request() for parts of the original function.
1035− * This prevents code duplication in drivers.
10361035 */
10371036 extern bool blk_update_request(struct request *rq, blk_status_t error,
10381037 unsigned int nr_bytes);
1039−extern void blk_end_request_all(struct request *rq, blk_status_t error);
1040−extern bool __blk_end_request(struct request *rq, blk_status_t error,
1041− unsigned int nr_bytes);
1042−extern void __blk_end_request_all(struct request *rq, blk_status_t error);
1043−extern bool __blk_end_request_cur(struct request *rq, blk_status_t error);
10441038
10451039 extern void __blk_complete_request(struct request *);
10461040 extern void blk_abort_request(struct request *);
@@ -1429,7 +1423,7 @@ static inline bool bdev_is_zoned(struct block_device *bdev) · 382 unmodified lines
14291423 return false;
14301424 }
14311425
1432−static inline unsigned int bdev_zone_sectors(struct block_device *bdev)
1426+static inline sector_t bdev_zone_sectors(struct block_device *bdev)
14331427 {
14341428 struct request_queue *q = bdev_get_queue(bdev);
14351429
@@ -1684,8 +1678,7 @@ struct block_device_operations { · 248 unmodified lines
16841678 /* this callback is with swap_lock and sometimes page table lock held */
16851679 void (*swap_slot_free_notify) (struct block_device *, unsigned long);
16861680 int (*report_zones)(struct gendisk *, sector_t sector,
1687− struct blk_zone *zones, unsigned int *nr_zones,
1688− gfp_t gfp_mask);
1681+ struct blk_zone *zones, unsigned int *nr_zones);
16891682 struct module *owner;
16901683 const struct pr_ops *pr_ops;
16911684 };
include/linux/bpf-cgroup.h+55−3
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/errno.h>
77 #include <linux/jump_label.h>
88 #include <linux/percpu.h>
9+#include <linux/percpu-refcount.h>
910 #include <linux/rbtree.h>
1011 #include <uapi/linux/bpf.h>
1112
@@ -71,11 +72,17 @@ struct cgroup_bpf { · 59 unmodified lines
7172 u32 flags[MAX_BPF_ATTACH_TYPE];
7273
7374 /* temp storage for effective prog array used by prog_attach/detach */
74− struct bpf_prog_array __rcu *inactive;
75+ struct bpf_prog_array *inactive;
76+
77+ /* reference counter used to detach bpf programs after cgroup removal */
78+ struct percpu_ref refcnt;
79+
80+ /* cgroup_bpf is released using a work queue */
81+ struct work_struct release_work;
7582 };
7683
77−void cgroup_bpf_put(struct cgroup *cgrp);
7884 int cgroup_bpf_inherit(struct cgroup *cgrp);
85+void cgroup_bpf_offline(struct cgroup *cgrp);
7986
8087 int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog,
8188 enum bpf_attach_type type, u32 flags);
@@ -117,6 +124,14 @@ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, · 35 unmodified lines
117124 loff_t *ppos, void **new_buf,
118125 enum bpf_attach_type type);
119126
127+int __cgroup_bpf_run_filter_setsockopt(struct sock *sock, int *level,
128+ int *optname, char __user *optval,
129+ int *optlen, char **kernel_optval);
130+int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,
131+ int optname, char __user *optval,
132+ int __user *optlen, int max_optlen,
133+ int retval);
134+
120135 static inline enum bpf_cgroup_storage_type cgroup_storage_type(
121136 struct bpf_map *map)
122137 {
@@ -279,6 +294,38 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, · 156 unmodified lines
279294 __ret; \
280295 })
281296
297+#define BPF_CGROUP_RUN_PROG_SETSOCKOPT(sock, level, optname, optval, optlen, \
298+ kernel_optval) \
299+({ \
300+ int __ret = 0; \
301+ if (cgroup_bpf_enabled) \
302+ __ret = __cgroup_bpf_run_filter_setsockopt(sock, level, \
303+ optname, optval, \
304+ optlen, \
305+ kernel_optval); \
306+ __ret; \
307+})
308+
309+#define BPF_CGROUP_GETSOCKOPT_MAX_OPTLEN(optlen) \
310+({ \
311+ int __ret = 0; \
312+ if (cgroup_bpf_enabled) \
313+ get_user(__ret, optlen); \
314+ __ret; \
315+})
316+
317+#define BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock, level, optname, optval, optlen, \
318+ max_optlen, retval) \
319+({ \
320+ int __ret = retval; \
321+ if (cgroup_bpf_enabled) \
322+ __ret = __cgroup_bpf_run_filter_getsockopt(sock, level, \
323+ optname, optval, \
324+ optlen, max_optlen, \
325+ retval); \
326+ __ret; \
327+})
328+
282329 int cgroup_bpf_prog_attach(const union bpf_attr *attr,
283330 enum bpf_prog_type ptype, struct bpf_prog *prog);
284331 int cgroup_bpf_prog_detach(const union bpf_attr *attr,
@@ -289,8 +336,8 @@ int cgroup_bpf_prog_query(const union bpf_attr *attr, · 4 unmodified lines
289336
290337 struct bpf_prog;
291338 struct cgroup_bpf {};
292−static inline void cgroup_bpf_put(struct cgroup *cgrp) {}
293339 static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; }
340+static inline void cgroup_bpf_offline(struct cgroup *cgrp) {}
294341
295342 static inline int cgroup_bpf_prog_attach(const union bpf_attr *attr,
296343 enum bpf_prog_type ptype,
@@ -350,6 +397,11 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, · 53 unmodified lines
350397 #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; })
351398 #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; })
352399 #define BPF_CGROUP_RUN_PROG_SYSCTL(head,table,write,buf,count,pos,nbuf) ({ 0; })
400+#define BPF_CGROUP_GETSOCKOPT_MAX_OPTLEN(optlen) ({ 0; })
401+#define BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock, level, optname, optval, \
402+ optlen, max_optlen, retval) ({ retval; })
403+#define BPF_CGROUP_RUN_PROG_SETSOCKOPT(sock, level, optname, optval, optlen, \
404+ kernel_optval) ({ 0; })
353405
354406 #define for_each_cgroup_storage_type(stype) for (; false; )
355407
include/linux/bpf.h+95−10
@@ -63,6 +63,11 @@ struct bpf_map_ops { · 62 unmodified lines
6363 u64 imm, u32 *off);
6464 };
6565
66+struct bpf_map_memory {
67+ u32 pages;
68+ struct user_struct *user;
69+};
70+
6671 struct bpf_map {
6772 /* The first two cachelines with read-mostly members of which some
6873 * are also accessed in fast-path (e.g. ops, max_entries).
@@ -83,7 +88,7 @@ struct bpf_map { · 14 unmodified lines
8388 u32 btf_key_type_id;
8489 u32 btf_value_type_id;
8590 struct btf *btf;
86− u32 pages;
91+ struct bpf_map_memory memory;
8792 bool unpriv_array;
8893 bool frozen; /* write-once */
8994 /* 48 bytes hole */
@@ -91,8 +96,7 @@ struct bpf_map { · 1 unmodified line
9196 /* The 3rd and 4th cacheline with misc members to avoid false sharing
9297 * particularly with refcounting.
9398 */
94− struct user_struct *user ____cacheline_aligned;
95− atomic_t refcnt;
99+ atomic_t refcnt ____cacheline_aligned;
96100 atomic_t usercnt;
97101 struct work_struct work;
98102 char name[BPF_OBJ_NAME_LEN];
@@ -273,6 +277,7 @@ enum bpf_reg_type { · 174 unmodified lines
273277 PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */
274278 PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */
275279 PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */
280+ PTR_TO_XDP_SOCK, /* reg points to struct xdp_sock */
276281 };
277282
278283 /* The information passed from prog-specific *_is_valid_access
@@ -367,6 +372,7 @@ struct bpf_prog_aux { · 88 unmodified lines
367372 u32 id;
368373 u32 func_cnt; /* used by non-func prog as the number of func progs */
369374 u32 func_idx; /* 0 for non-func prog, the index in func array for func prog */
375+ bool verifier_zext; /* Zero extensions has been inserted by verifier. */
370376 bool offload_requested;
371377 struct bpf_prog **func;
372378 void *jit_data; /* JIT specific data. arch dependent */
@@ -510,17 +516,18 @@ struct bpf_prog_array { · 137 unmodified lines
510516 };
511517
512518 struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags);
513−void bpf_prog_array_free(struct bpf_prog_array __rcu *progs);
514−int bpf_prog_array_length(struct bpf_prog_array __rcu *progs);
515−int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs,
519+void bpf_prog_array_free(struct bpf_prog_array *progs);
520+int bpf_prog_array_length(struct bpf_prog_array *progs);
521+bool bpf_prog_array_is_empty(struct bpf_prog_array *array);
522+int bpf_prog_array_copy_to_user(struct bpf_prog_array *progs,
516523 __u32 __user *prog_ids, u32 cnt);
517524
518−void bpf_prog_array_delete_safe(struct bpf_prog_array __rcu *progs,
525+void bpf_prog_array_delete_safe(struct bpf_prog_array *progs,
519526 struct bpf_prog *old_prog);
520−int bpf_prog_array_copy_info(struct bpf_prog_array __rcu *array,
527+int bpf_prog_array_copy_info(struct bpf_prog_array *array,
521528 u32 *prog_ids, u32 request_cnt,
522529 u32 *prog_cnt);
523−int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array,
530+int bpf_prog_array_copy(struct bpf_prog_array *old_array,
524531 struct bpf_prog *exclude_prog,
525532 struct bpf_prog *include_prog,
526533 struct bpf_prog_array **new_array);
@@ -548,6 +555,56 @@ _out: \ · 21 unmodified lines
548555 _ret; \
549556 })
550557
558+/* To be used by __cgroup_bpf_run_filter_skb for EGRESS BPF progs
559+ * so BPF programs can request cwr for TCP packets.
560+ *
561+ * Current cgroup skb programs can only return 0 or 1 (0 to drop the
562+ * packet. This macro changes the behavior so the low order bit
563+ * indicates whether the packet should be dropped (0) or not (1)
564+ * and the next bit is a congestion notification bit. This could be
565+ * used by TCP to call tcp_enter_cwr()
566+ *
567+ * Hence, new allowed return values of CGROUP EGRESS BPF programs are:
568+ * 0: drop packet
569+ * 1: keep packet
570+ * 2: drop packet and cn
571+ * 3: keep packet and cn
572+ *
573+ * This macro then converts it to one of the NET_XMIT or an error
574+ * code that is then interpreted as drop packet (and no cn):
575+ * 0: NET_XMIT_SUCCESS skb should be transmitted
576+ * 1: NET_XMIT_DROP skb should be dropped and cn
577+ * 2: NET_XMIT_CN skb should be transmitted and cn
578+ * 3: -EPERM skb should be dropped
579+ */
580+#define BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY(array, ctx, func) \
581+ ({ \
582+ struct bpf_prog_array_item *_item; \
583+ struct bpf_prog *_prog; \
584+ struct bpf_prog_array *_array; \
585+ u32 ret; \
586+ u32 _ret = 1; \
587+ u32 _cn = 0; \
588+ preempt_disable(); \
589+ rcu_read_lock(); \
590+ _array = rcu_dereference(array); \
591+ _item = &_array->items[0]; \
592+ while ((_prog = READ_ONCE(_item->prog))) { \
593+ bpf_cgroup_storage_set(_item->cgroup_storage); \
594+ ret = func(_prog, ctx); \
595+ _ret &= (ret & 1); \
596+ _cn |= (ret & 2); \
597+ _item++; \
598+ } \
599+ rcu_read_unlock(); \
600+ preempt_enable(); \
601+ if (_ret) \
602+ _ret = (_cn ? NET_XMIT_CN : NET_XMIT_SUCCESS); \
603+ else \
604+ _ret = (_cn ? NET_XMIT_DROP : -EPERM); \
605+ _ret; \
606+ })
607+
551608 #define BPF_PROG_RUN_ARRAY(array, ctx, func) \
552609 __BPF_PROG_RUN_ARRAY(array, ctx, func, false)
553610
@@ -592,9 +649,12 @@ struct bpf_map *__bpf_map_get(struct fd f); · 38 unmodified lines
592649 struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref);
593650 void bpf_map_put_with_uref(struct bpf_map *map);
594651 void bpf_map_put(struct bpf_map *map);
595−int bpf_map_precharge_memlock(u32 pages);
596652 int bpf_map_charge_memlock(struct bpf_map *map, u32 pages);
597653 void bpf_map_uncharge_memlock(struct bpf_map *map, u32 pages);
654+int bpf_map_charge_init(struct bpf_map_memory *mem, size_t size);
655+void bpf_map_charge_finish(struct bpf_map_memory *mem);
656+void bpf_map_charge_move(struct bpf_map_memory *dst,
657+ struct bpf_map_memory *src);
598658 void *bpf_map_area_alloc(size_t size, int numa_node);
599659 void bpf_map_area_free(void *base);
600660 void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr);
@@ -992,6 +1052,7 @@ extern const struct bpf_func_proto bpf_spin_unlock_proto; · 391 unmodified lines
9921052 extern const struct bpf_func_proto bpf_get_local_storage_proto;
9931053 extern const struct bpf_func_proto bpf_strtol_proto;
9941054 extern const struct bpf_func_proto bpf_strtoul_proto;
1055+extern const struct bpf_func_proto bpf_tcp_sock_proto;
9951056
9961057 /* Shared helpers among cBPF and eBPF. */
9971058 void bpf_user_rnd_init_once(void);
@@ -1040,6 +1101,15 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, · 42 unmodified lines
10401101 struct bpf_insn *insn_buf,
10411102 struct bpf_prog *prog,
10421103 u32 *target_size);
1104+
1105+bool bpf_xdp_sock_is_valid_access(int off, int size, enum bpf_access_type type,
1106+ struct bpf_insn_access_aux *info);
1107+
1108+u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
1109+ const struct bpf_insn *si,
1110+ struct bpf_insn *insn_buf,
1111+ struct bpf_prog *prog,
1112+ u32 *target_size);
10431113 #else
10441114 static inline bool bpf_tcp_sock_is_valid_access(int off, int size,
10451115 enum bpf_access_type type,
@@ -1056,6 +1126,21 @@ static inline u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, · 10 unmodified lines
10561126 {
10571127 return 0;
10581128 }
1129+static inline bool bpf_xdp_sock_is_valid_access(int off, int size,
1130+ enum bpf_access_type type,
1131+ struct bpf_insn_access_aux *info)
1132+{
1133+ return false;
1134+}
1135+
1136+static inline u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
1137+ const struct bpf_insn *si,
1138+ struct bpf_insn *insn_buf,
1139+ struct bpf_prog *prog,
1140+ u32 *target_size)
1141+{
1142+ return 0;
1143+}
10591144 #endif /* CONFIG_INET */
10601145
10611146 #endif /* _LINUX_BPF_H */
include/linux/bpf_types.h+1−0
@@ -30,6 +30,7 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable) · 29 unmodified lines
3030 #ifdef CONFIG_CGROUP_BPF
3131 BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev)
3232 BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl)
33+BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCKOPT, cg_sockopt)
3334 #endif
3435 #ifdef CONFIG_BPF_LIRC_MODE2
3536 BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2)
include/linux/bpf_verifier.h+81−4
@@ -33,9 +33,11 @@ · 32 unmodified lines
3333 */
3434 enum bpf_reg_liveness {
3535 REG_LIVE_NONE = 0, /* reg hasn't been read or written this branch */
36− REG_LIVE_READ, /* reg was read, so we're sensitive to initial value */
37− REG_LIVE_WRITTEN, /* reg was written first, screening off later reads */
38− REG_LIVE_DONE = 4, /* liveness won't be updating this register anymore */
36+ REG_LIVE_READ32 = 0x1, /* reg was read, so we're sensitive to initial value */
37+ REG_LIVE_READ64 = 0x2, /* likewise, but full 64-bit content matters */
38+ REG_LIVE_READ = REG_LIVE_READ32 | REG_LIVE_READ64,
39+ REG_LIVE_WRITTEN = 0x4, /* reg was written first, screening off later reads */
40+ REG_LIVE_DONE = 0x8, /* liveness won't be updating this register anymore */
3941 };
4042
4143 struct bpf_reg_state {
@@ -128,7 +130,14 @@ struct bpf_reg_state { · 86 unmodified lines
128130 * pointing to bpf_func_state.
129131 */
130132 u32 frameno;
133+ /* Tracks subreg definition. The stored value is the insn_idx of the
134+ * writing insn. This is safe because subreg_def is used before any insn
135+ * patching which only happens after main verification finished.
136+ */
137+ s32 subreg_def;
131138 enum bpf_reg_liveness live;
139+ /* if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety */
140+ bool precise;
132141 };
133142
134143 enum bpf_stack_slot_type {
@@ -180,13 +189,77 @@ struct bpf_func_state { · 45 unmodified lines
180189 struct bpf_stack_state *stack;
181190 };
182191
192+struct bpf_idx_pair {
193+ u32 prev_idx;
194+ u32 idx;
195+};
196+
183197 #define MAX_CALL_FRAMES 8
184198 struct bpf_verifier_state {
185199 /* call stack tracking */
186200 struct bpf_func_state *frame[MAX_CALL_FRAMES];
201+ struct bpf_verifier_state *parent;
202+ /*
203+ * 'branches' field is the number of branches left to explore:
204+ * 0 - all possible paths from this state reached bpf_exit or
205+ * were safely pruned
206+ * 1 - at least one path is being explored.
207+ * This state hasn't reached bpf_exit
208+ * 2 - at least two paths are being explored.
209+ * This state is an immediate parent of two children.
210+ * One is fallthrough branch with branches==1 and another
211+ * state is pushed into stack (to be explored later) also with
212+ * branches==1. The parent of this state has branches==1.
213+ * The verifier state tree connected via 'parent' pointer looks like:
214+ * 1
215+ * 1
216+ * 2 -> 1 (first 'if' pushed into stack)
217+ * 1
218+ * 2 -> 1 (second 'if' pushed into stack)
219+ * 1
220+ * 1
221+ * 1 bpf_exit.
222+ *
223+ * Once do_check() reaches bpf_exit, it calls update_branch_counts()
224+ * and the verifier state tree will look:
225+ * 1
226+ * 1
227+ * 2 -> 1 (first 'if' pushed into stack)
228+ * 1
229+ * 1 -> 1 (second 'if' pushed into stack)
230+ * 0
231+ * 0
232+ * 0 bpf_exit.
233+ * After pop_stack() the do_check() will resume at second 'if'.
234+ *
235+ * If is_state_visited() sees a state with branches > 0 it means
236+ * there is a loop. If such state is exactly equal to the current state
237+ * it's an infinite loop. Note states_equal() checks for states
238+ * equvalency, so two states being 'states_equal' does not mean
239+ * infinite loop. The exact comparison is provided by
240+ * states_maybe_looping() function. It's a stronger pre-check and
241+ * much faster than states_equal().
242+ *
243+ * This algorithm may not find all possible infinite loops or
244+ * loop iteration count may be too high.
245+ * In such cases BPF_COMPLEXITY_LIMIT_INSNS limit kicks in.
246+ */
247+ u32 branches;
248+ u32 insn_idx;
187249 u32 curframe;
188250 u32 active_spin_lock;
189251 bool speculative;
252+
253+ /* first and last insn idx of this verifier state */
254+ u32 first_insn_idx;
255+ u32 last_insn_idx;
256+ /* jmp history recorded from first to last.
257+ * backtracking is using it to go from last to first.
258+ * For most states jmp_history_cnt is [0-3].
259+ * For loops can go up to ~40.
260+ */
261+ struct bpf_idx_pair *jmp_history;
262+ u32 jmp_history_cnt;
190263 };
191264
192265 #define bpf_get_spilled_reg(slot, frame) \
@@ -229,7 +302,9 @@ struct bpf_insn_aux_data { · 36 unmodified lines
229302 int ctx_field_size; /* the ctx field size for load insn, maybe 0 */
230303 int sanitize_stack_off; /* stack slot to be cleared */
231304 bool seen; /* this insn was processed by the verifier */
305+ bool zext_dst; /* this insn zero extends dst reg */
232306 u8 alu_state; /* used in combination with alu_limit */
307+ bool prune_point;
233308 unsigned int orig_idx; /* original instruction index */
234309 };
235310
@@ -299,7 +374,9 @@ struct bpf_verifier_env { · 63 unmodified lines
299374 } cfg;
300375 u32 subprog_cnt;
301376 /* number of instructions analyzed by the verifier */
302− u32 insn_processed;
377+ u32 prev_insn_processed, insn_processed;
378+ /* number of jmps, calls, exits analyzed so far */
379+ u32 prev_jmps_processed, jmps_processed;
303380 /* total verification time */
304381 u64 verification_time;
305382 /* maximum number of verifier states kept in 'branching' instructions */
include/linux/cacheinfo.h+2−0
@@ -17,6 +17,8 @@ enum cache_type { · 16 unmodified lines
1717 CACHE_TYPE_UNIFIED = BIT(2),
1818 };
1919
20+extern unsigned int coherency_max_size;
21+
2022 /**
2123 * struct cacheinfo - represent a cache leaf node
2224 * @id: This cache's id. It is unique among caches with the same (type, level).
include/linux/ccp.h+2−0
@@ -170,6 +170,8 @@ struct ccp_aes_engine { · 169 unmodified lines
170170 enum ccp_aes_mode mode;
171171 enum ccp_aes_action action;
172172
173+ u32 authsize;
174+
173175 struct scatterlist *key;
174176 u32 key_len; /* In bytes */
175177
include/linux/ceph/ceph_features.h+1−0
@@ -211,6 +211,7 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facin · 210 unmodified lines
211211 CEPH_FEATURE_MON_STATEFUL_SUB | \
212212 CEPH_FEATURE_CRUSH_TUNABLES5 | \
213213 CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING | \
214+ CEPH_FEATURE_MSG_ADDR2 | \
214215 CEPH_FEATURE_CEPHX_V2)
215216
216217 #define CEPH_FEATURES_REQUIRED_DEFAULT 0
include/linux/ceph/ceph_fs.h+1−1
@@ -682,7 +682,7 @@ extern const char *ceph_cap_op_name(int op); · 681 unmodified lines
682682 /* flags field in client cap messages (version >= 10) */
683683 #define CEPH_CLIENT_CAPS_SYNC (1<<0)
684684 #define CEPH_CLIENT_CAPS_NO_CAPSNAP (1<<1)
685−#define CEPH_CLIENT_CAPS_PENDING_CAPSNAP (1<<2);
685+#define CEPH_CLIENT_CAPS_PENDING_CAPSNAP (1<<2)
686686
687687 /*
688688 * caps message, used for capability callbacks, acks, requests, etc.
include/linux/ceph/cls_lock_client.h+3−0
@@ -52,4 +52,7 @@ int ceph_cls_lock_info(struct ceph_osd_client *osdc, · 51 unmodified lines
5252 char *lock_name, u8 *type, char **tag,
5353 struct ceph_locker **lockers, u32 *num_lockers);
5454
55+int ceph_cls_assert_locked(struct ceph_osd_request *req, int which,
56+ char *lock_name, u8 type, char *cookie, char *tag);
57+
5558 #endif
include/linux/ceph/debugfs.h+2−2
@@ -19,9 +19,9 @@ static const struct file_operations name##_fops = { \ · 18 unmodified lines
1919 };
2020
2121 /* debugfs.c */
22−extern int ceph_debugfs_init(void);
22+extern void ceph_debugfs_init(void);
2323 extern void ceph_debugfs_cleanup(void);
24−extern int ceph_debugfs_client_init(struct ceph_client *client);
24+extern void ceph_debugfs_client_init(struct ceph_client *client);
2525 extern void ceph_debugfs_client_cleanup(struct ceph_client *client);
2626
2727 #endif
include/linux/ceph/decode.h+11−2
@@ -218,18 +218,27 @@ static inline void ceph_encode_timespec64(struct ceph_timespec *tv, · 217 unmodified lines
218218 /*
219219 * sockaddr_storage <-> ceph_sockaddr
220220 */
221−static inline void ceph_encode_addr(struct ceph_entity_addr *a)
221+#define CEPH_ENTITY_ADDR_TYPE_NONE 0
222+#define CEPH_ENTITY_ADDR_TYPE_LEGACY __cpu_to_le32(1)
223+
224+static inline void ceph_encode_banner_addr(struct ceph_entity_addr *a)
222225 {
223226 __be16 ss_family = htons(a->in_addr.ss_family);
224227 a->in_addr.ss_family = *(__u16 *)&ss_family;
228+
229+ /* Banner addresses require TYPE_NONE */
230+ a->type = CEPH_ENTITY_ADDR_TYPE_NONE;
225231 }
226−static inline void ceph_decode_addr(struct ceph_entity_addr *a)
232+static inline void ceph_decode_banner_addr(struct ceph_entity_addr *a)
227233 {
228234 __be16 ss_family = *(__be16 *)&a->in_addr.ss_family;
229235 a->in_addr.ss_family = ntohs(ss_family);
230236 WARN_ON(a->in_addr.ss_family == 512);
237+ a->type = CEPH_ENTITY_ADDR_TYPE_LEGACY;
231238 }
232239
240+extern int ceph_decode_entity_addr(void **p, void *end,
241+ struct ceph_entity_addr *addr);
233242 /*
234243 * encoders
235244 */
include/linux/ceph/libceph.h+4−6
@@ -84,11 +84,13 @@ struct ceph_options { · 83 unmodified lines
8484 #define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024)
8585
8686 /*
87− * Handle the largest possible rbd object in one message.
87+ * The largest possible rbd data object is 32M.
88+ * The largest possible rbd object map object is 64M.
89+ *
8890 * There is no limit on the size of cephfs objects, but it has to obey
8991 * rsize and wsize mount options anyway.
9092 */
91−#define CEPH_MSG_MAX_DATA_LEN (32*1024*1024)
93+#define CEPH_MSG_MAX_DATA_LEN (64*1024*1024)
9294
9395 #define CEPH_AUTH_NAME_DEFAULT "guest"
9496
@@ -299,10 +301,6 @@ int ceph_wait_for_latest_osdmap(struct ceph_client *client, · 204 unmodified lines
299301
300302 /* pagevec.c */
301303 extern void ceph_release_page_vector(struct page **pages, int num_pages);
302−
303−extern struct page **ceph_get_direct_page_vector(const void __user *data,
304− int num_pages,
305− bool write_page);
306304 extern void ceph_put_page_vector(struct page **pages, int num_pages,
307305 bool dirty);
308306 extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
include/linux/ceph/mon_client.h+0−1
@@ -104,7 +104,6 @@ struct ceph_mon_client { · 103 unmodified lines
104104 #endif
105105 };
106106
107−extern struct ceph_monmap *ceph_monmap_decode(void *p, void *end);
108107 extern int ceph_monmap_contains(struct ceph_monmap *m,
109108 struct ceph_entity_addr *addr);
110109
include/linux/ceph/osd_client.h+10−2
@@ -198,9 +198,9 @@ struct ceph_osd_request { · 197 unmodified lines
198198 bool r_mempool;
199199 struct completion r_completion; /* private to osd_client.c */
200200 ceph_osdc_callback_t r_callback;
201− struct list_head r_unsafe_item;
202201
203202 struct inode *r_inode; /* for use by callbacks */
203+ struct list_head r_private_item; /* ditto */
204204 void *r_priv; /* ditto */
205205
206206 /* set by submitter */
@@ -389,6 +389,14 @@ extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, · 182 unmodified lines
389389 void ceph_osdc_update_epoch_barrier(struct ceph_osd_client *osdc, u32 eb);
390390 void ceph_osdc_abort_requests(struct ceph_osd_client *osdc, int err);
391391
392+#define osd_req_op_data(oreq, whch, typ, fld) \
393+({ \
394+ struct ceph_osd_request *__oreq = (oreq); \
395+ unsigned int __whch = (whch); \
396+ BUG_ON(__whch >= __oreq->r_num_ops); \
397+ &__oreq->r_ops[__whch].typ.fld; \
398+})
399+
392400 extern void osd_req_op_init(struct ceph_osd_request *osd_req,
393401 unsigned int which, u16 opcode, u32 flags);
394402
@@ -497,7 +505,7 @@ int ceph_osdc_call(struct ceph_osd_client *osdc, · 102 unmodified lines
497505 const char *class, const char *method,
498506 unsigned int flags,
499507 struct page *req_page, size_t req_len,
500− struct page *resp_page, size_t *resp_len);
508+ struct page **resp_pages, size_t *resp_len);
501509
502510 extern int ceph_osdc_readpages(struct ceph_osd_client *osdc,
503511 struct ceph_vino vino,
include/linux/ceph/striper.h+2−0
@@ -66,4 +66,6 @@ int ceph_extent_to_file(struct ceph_file_layout *l, · 65 unmodified lines
6666 struct ceph_file_extent **file_extents,
6767 u32 *num_file_extents);
6868
69+u64 ceph_get_num_objects(struct ceph_file_layout *l, u64 size);
70+
6971 #endif
include/linux/cgroup-defs.h+1−1
@@ -624,7 +624,7 @@ struct cftype { · 623 unmodified lines
624624
625625 /*
626626 * Control Group subsystem type.
627− * See Documentation/cgroup-v1/cgroups.txt for details
627+ * See Documentation/admin-guide/cgroup-v1/cgroups.rst for details
628628 */
629629 struct cgroup_subsys {
630630 struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css);
include/linux/cgroup.h+21−0
@@ -131,6 +131,8 @@ void cgroup_free(struct task_struct *p); · 130 unmodified lines
131131 int cgroup_init_early(void);
132132 int cgroup_init(void);
133133
134+int cgroup_parse_float(const char *input, unsigned dec_shift, s64 *v);
135+
134136 /*
135137 * Iteration helpers and macros.
136138 */
@@ -697,6 +699,7 @@ void cgroup_path_from_kernfs_id(const union kernfs_node_id *id, · 560 unmodified lines
697699 struct cgroup_subsys_state;
698700 struct cgroup;
699701
702+static inline void css_get(struct cgroup_subsys_state *css) {}
700703 static inline void css_put(struct cgroup_subsys_state *css) {}
701704 static inline int cgroup_attach_task_all(struct task_struct *from,
702705 struct task_struct *t) { return 0; }
@@ -934,4 +937,22 @@ static inline bool cgroup_task_frozen(struct task_struct *task) · 231 unmodified lines
934937
935938 #endif /* !CONFIG_CGROUPS */
936939
940+#ifdef CONFIG_CGROUP_BPF
941+static inline void cgroup_bpf_get(struct cgroup *cgrp)
942+{
943+ percpu_ref_get(&cgrp->bpf.refcnt);
944+}
945+
946+static inline void cgroup_bpf_put(struct cgroup *cgrp)
947+{
948+ percpu_ref_put(&cgrp->bpf.refcnt);
949+}
950+
951+#else /* CONFIG_CGROUP_BPF */
952+
953+static inline void cgroup_bpf_get(struct cgroup *cgrp) {}
954+static inline void cgroup_bpf_put(struct cgroup *cgrp) {}
955+
956+#endif /* CONFIG_CGROUP_BPF */
957+
937958 #endif /* _LINUX_CGROUP_H */
include/linux/clk-provider.h+96−7
@@ -9,8 +9,6 @@ · 8 unmodified lines
99 #include <linux/of.h>
1010 #include <linux/of_clk.h>
1111
12−#ifdef CONFIG_COMMON_CLK
13−
1412 /*
1513 * flags used across common struct clk. these flags should only affect the
1614 * top-level framework. custom flags for dealing with hardware specifics
@@ -807,7 +805,14 @@ void devm_clk_hw_unregister(struct device *dev, struct clk_hw *hw); · 790 unmodified lines
807805 /* helper functions */
808806 const char *__clk_get_name(const struct clk *clk);
809807 const char *clk_hw_get_name(const struct clk_hw *hw);
808+#ifdef CONFIG_COMMON_CLK
810809 struct clk_hw *__clk_get_hw(struct clk *clk);
810+#else
811+static inline struct clk_hw *__clk_get_hw(struct clk *clk)
812+{
813+ return (struct clk_hw *)clk;
814+}
815+#endif
811816 unsigned int clk_hw_get_num_parents(const struct clk_hw *hw);
812817 struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw);
813818 struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw,
@@ -867,8 +872,6 @@ static inline long divider_ro_round_rate(struct clk_hw *hw, unsigned long rate, · 53 unmodified lines
867872 */
868873 unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate);
869874
870−struct of_device_id;
871−
872875 struct clk_onecell_data {
873876 struct clk **clks;
874877 unsigned int clk_num;
@@ -879,8 +882,6 @@ struct clk_hw_onecell_data { · 4 unmodified lines
879882 struct clk_hw *hws[];
880883 };
881884
882−extern struct of_device_id __clk_of_table;
883−
884885 #define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn)
885886
886887 /*
@@ -904,6 +905,40 @@ extern struct of_device_id __clk_of_table; · 17 unmodified lines
904905 .ops = _ops, \
905906 })
906907
908+#define CLK_HW_INIT_HW(_name, _parent, _ops, _flags) \
909+ (&(struct clk_init_data) { \
910+ .flags = _flags, \
911+ .name = _name, \
912+ .parent_hws = (const struct clk_hw*[]) { _parent }, \
913+ .num_parents = 1, \
914+ .ops = _ops, \
915+ })
916+
917+/*
918+ * This macro is intended for drivers to be able to share the otherwise
919+ * individual struct clk_hw[] compound literals created by the compiler
920+ * when using CLK_HW_INIT_HW. It does NOT support multiple parents.
921+ */
922+#define CLK_HW_INIT_HWS(_name, _parent, _ops, _flags) \
923+ (&(struct clk_init_data) { \
924+ .flags = _flags, \
925+ .name = _name, \
926+ .parent_hws = _parent, \
927+ .num_parents = 1, \
928+ .ops = _ops, \
929+ })
930+
931+#define CLK_HW_INIT_FW_NAME(_name, _parent, _ops, _flags) \
932+ (&(struct clk_init_data) { \
933+ .flags = _flags, \
934+ .name = _name, \
935+ .parent_data = (const struct clk_parent_data[]) { \
936+ { .fw_name = _parent }, \
937+ }, \
938+ .num_parents = 1, \
939+ .ops = _ops, \
940+ })
941+
907942 #define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags) \
908943 (&(struct clk_init_data) { \
909944 .flags = _flags, \
@@ -913,6 +948,24 @@ extern struct of_device_id __clk_of_table; · 3 unmodified lines
913948 .ops = _ops, \
914949 })
915950
951+#define CLK_HW_INIT_PARENTS_HW(_name, _parents, _ops, _flags) \
952+ (&(struct clk_init_data) { \
953+ .flags = _flags, \
954+ .name = _name, \
955+ .parent_hws = _parents, \
956+ .num_parents = ARRAY_SIZE(_parents), \
957+ .ops = _ops, \
958+ })
959+
960+#define CLK_HW_INIT_PARENTS_DATA(_name, _parents, _ops, _flags) \
961+ (&(struct clk_init_data) { \
962+ .flags = _flags, \
963+ .name = _name, \
964+ .parent_data = _parents, \
965+ .num_parents = ARRAY_SIZE(_parents), \
966+ .ops = _ops, \
967+ })
968+
916969 #define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags) \
917970 (&(struct clk_init_data) { \
918971 .flags = _flags, \
@@ -933,6 +986,43 @@ extern struct of_device_id __clk_of_table; · 14 unmodified lines
933986 _flags), \
934987 }
935988
989+#define CLK_FIXED_FACTOR_HW(_struct, _name, _parent, \
990+ _div, _mult, _flags) \
991+ struct clk_fixed_factor _struct = { \
992+ .div = _div, \
993+ .mult = _mult, \
994+ .hw.init = CLK_HW_INIT_HW(_name, \
995+ _parent, \
996+ &clk_fixed_factor_ops, \
997+ _flags), \
998+ }
999+
1000+/*
1001+ * This macro allows the driver to reuse the _parent array for multiple
1002+ * fixed factor clk declarations.
1003+ */
1004+#define CLK_FIXED_FACTOR_HWS(_struct, _name, _parent, \
1005+ _div, _mult, _flags) \
1006+ struct clk_fixed_factor _struct = { \
1007+ .div = _div, \
1008+ .mult = _mult, \
1009+ .hw.init = CLK_HW_INIT_HWS(_name, \
1010+ _parent, \
1011+ &clk_fixed_factor_ops, \
1012+ _flags), \
1013+ }
1014+
1015+#define CLK_FIXED_FACTOR_FW_NAME(_struct, _name, _parent, \
1016+ _div, _mult, _flags) \
1017+ struct clk_fixed_factor _struct = { \
1018+ .div = _div, \
1019+ .mult = _mult, \
1020+ .hw.init = CLK_HW_INIT_FW_NAME(_name, \
1021+ _parent, \
1022+ &clk_fixed_factor_ops, \
1023+ _flags), \
1024+ }
1025+
9361026 #ifdef CONFIG_OF
9371027 int of_clk_add_provider(struct device_node *np,
9381028 struct clk *(*clk_src_get)(struct of_phandle_args *args,
@@ -1019,5 +1109,4 @@ static inline int of_clk_detect_critical(struct device_node *np, int index, · 80 unmodified lines
10191109
10201110 void clk_gate_restore_context(struct clk_hw *hw);
10211111
1022−#endif /* CONFIG_COMMON_CLK */
10231112 #endif /* CLK_PROVIDER_H */
include/linux/clk.h+48−0
@@ -329,6 +329,19 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, · 328 unmodified lines
329329 */
330330 int __must_check clk_bulk_get_all(struct device *dev,
331331 struct clk_bulk_data **clks);
332+
333+/**
334+ * clk_bulk_get_optional - lookup and obtain a number of references to clock producer
335+ * @dev: device for clock "consumer"
336+ * @num_clks: the number of clk_bulk_data
337+ * @clks: the clk_bulk_data table of consumer
338+ *
339+ * Behaves the same as clk_bulk_get() except where there is no clock producer.
340+ * In this case, instead of returning -ENOENT, the function returns 0 and
341+ * NULL for a clk for which a clock producer could not be determined.
342+ */
343+int __must_check clk_bulk_get_optional(struct device *dev, int num_clks,
344+ struct clk_bulk_data *clks);
332345 /**
333346 * devm_clk_bulk_get - managed get multiple clk consumers
334347 * @dev: device for clock "consumer"
@@ -343,6 +356,29 @@ int __must_check clk_bulk_get_all(struct device *dev, · 8 unmodified lines
343356 */
344357 int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
345358 struct clk_bulk_data *clks);
359+/**
360+ * devm_clk_bulk_get_optional - managed get multiple optional consumer clocks
361+ * @dev: device for clock "consumer"
362+ * @num_clks: the number of clk_bulk_data
363+ * @clks: pointer to the clk_bulk_data table of consumer
364+ *
365+ * Behaves the same as devm_clk_bulk_get() except where there is no clock
366+ * producer. In this case, instead of returning -ENOENT, the function returns
367+ * NULL for given clk. It is assumed all clocks in clk_bulk_data are optional.
368+ *
369+ * Returns 0 if all clocks specified in clk_bulk_data table are obtained
370+ * successfully or for any clk there was no clk provider available, otherwise
371+ * returns valid IS_ERR() condition containing errno.
372+ * The implementation uses @dev and @clk_bulk_data.id to determine the
373+ * clock consumer, and thereby the clock producer.
374+ * The clock returned is stored in each @clk_bulk_data.clk field.
375+ *
376+ * Drivers must assume that the clock source is not enabled.
377+ *
378+ * clk_bulk_get should not be called from within interrupt context.
379+ */
380+int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks,
381+ struct clk_bulk_data *clks);
346382 /**
347383 * devm_clk_bulk_get_all - managed get multiple clk consumers
348384 * @dev: device for clock "consumer"
@@ -715,6 +751,12 @@ static inline int __must_check clk_bulk_get(struct device *dev, int num_clks, · 366 unmodified lines
715751 return 0;
716752 }
717753
754+static inline int __must_check clk_bulk_get_optional(struct device *dev,
755+ int num_clks, struct clk_bulk_data *clks)
756+{
757+ return 0;
758+}
759+
718760 static inline int __must_check clk_bulk_get_all(struct device *dev,
719761 struct clk_bulk_data **clks)
720762 {
@@ -738,6 +780,12 @@ static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clk · 17 unmodified lines
738780 return 0;
739781 }
740782
783+static inline int __must_check devm_clk_bulk_get_optional(struct device *dev,
784+ int num_clks, struct clk_bulk_data *clks)
785+{
786+ return 0;
787+}
788+
741789 static inline int __must_check devm_clk_bulk_get_all(struct device *dev,
742790 struct clk_bulk_data **clks)
743791 {
include/linux/coda.h+1−2
@@ -58,8 +58,7 @@ Mellon the rights to redistribute these changes without encumbrance. · 57 unmodified lines
5858 #ifndef _CODA_HEADER_
5959 #define _CODA_HEADER_
6060
61−#if defined(__linux__)
6261 typedef unsigned long long u_quad_t;
63−#endif
62+
6463 #include <uapi/linux/coda.h>
6564 #endif
include/linux/coda_psdev.h+0−72
@@ -1,72 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
2−#ifndef __CODA_PSDEV_H
3−#define __CODA_PSDEV_H
4−
5−#include <linux/backing-dev.h>
6−#include <linux/mutex.h>
7−#include <uapi/linux/coda_psdev.h>
8−
9−struct kstatfs;
10−
11−/* communication pending/processing queues */
12−struct venus_comm {
13− u_long vc_seq;
14− wait_queue_head_t vc_waitq; /* Venus wait queue */
15− struct list_head vc_pending;
16− struct list_head vc_processing;
17− int vc_inuse;
18− struct super_block *vc_sb;
19− struct mutex vc_mutex;
20−};
21−
22−
23−static inline struct venus_comm *coda_vcp(struct super_block *sb)
24−{
25− return (struct venus_comm *)((sb)->s_fs_info);
26−}
27−
28−/* upcalls */
29−int venus_rootfid(struct super_block *sb, struct CodaFid *fidp);
30−int venus_getattr(struct super_block *sb, struct CodaFid *fid,
31− struct coda_vattr *attr);
32−int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *);
33−int venus_lookup(struct super_block *sb, struct CodaFid *fid,
34− const char *name, int length, int *type,
35− struct CodaFid *resfid);
36−int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
37− kuid_t uid);
38−int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
39− struct file **f);
40−int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
41− const char *name, int length,
42− struct CodaFid *newfid, struct coda_vattr *attrs);
43−int venus_create(struct super_block *sb, struct CodaFid *dirfid,
44− const char *name, int length, int excl, int mode,
45− struct CodaFid *newfid, struct coda_vattr *attrs) ;
46−int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid,
47− const char *name, int length);
48−int venus_remove(struct super_block *sb, struct CodaFid *dirfid,
49− const char *name, int length);
50−int venus_readlink(struct super_block *sb, struct CodaFid *fid,
51− char *buffer, int *length);
52−int venus_rename(struct super_block *, struct CodaFid *new_fid,
53− struct CodaFid *old_fid, size_t old_length,
54− size_t new_length, const char *old_name,
55− const char *new_name);
56−int venus_link(struct super_block *sb, struct CodaFid *fid,
57− struct CodaFid *dirfid, const char *name, int len );
58−int venus_symlink(struct super_block *sb, struct CodaFid *fid,
59− const char *name, int len, const char *symname, int symlen);
60−int venus_access(struct super_block *sb, struct CodaFid *fid, int mask);
61−int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
62− unsigned int cmd, struct PioctlData *data);
63−int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out);
64−int venus_fsync(struct super_block *sb, struct CodaFid *fid);
65−int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
66−
67−/*
68− * Statistics
69− */
70−
71−extern struct venus_comm coda_comms[];
72−#endif
include/linux/compat.h+1−2
@@ -138,8 +138,7 @@ typedef struct { · 137 unmodified lines
138138 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
139139 } compat_sigset_t;
140140
141−int set_compat_user_sigmask(const compat_sigset_t __user *usigmask,
142− sigset_t *set, sigset_t *oldset,
141+int set_compat_user_sigmask(const compat_sigset_t __user *umask,
143142 size_t sigsetsize);
144143
145144 struct compat_sigaction {
include/linux/compiler-gcc.h+2−0
@@ -170,3 +170,5 @@ · 169 unmodified lines
170170 #else
171171 #define __diag_GCC_8(s)
172172 #endif
173+
174+#define __no_fgcse __attribute__((optimize("-fno-gcse")))
include/linux/compiler.h+5−0
@@ -116,9 +116,14 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 115 unmodified lines
116116 ".pushsection .discard.unreachable\n\t" \
117117 ".long 999b - .\n\t" \
118118 ".popsection\n\t"
119+
120+/* Annotate a C jump table to allow objtool to follow the code flow */
121+#define __annotate_jump_table __section(".rodata..c_jump_table")
122+
119123 #else
120124 #define annotate_reachable()
121125 #define annotate_unreachable()
126+#define __annotate_jump_table
122127 #endif
123128
124129 #ifndef ASM_UNREACHABLE
include/linux/compiler_types.h+6−0
@@ -112,6 +112,8 @@ struct ftrace_likely_data { · 111 unmodified lines
112112
113113 #if defined(CC_USING_HOTPATCH)
114114 #define notrace __attribute__((hotpatch(0, 0)))
115+#elif defined(CC_USING_PATCHABLE_FUNCTION_ENTRY)
116+#define notrace __attribute__((patchable_function_entry(0, 0)))
115117 #else
116118 #define notrace __attribute__((__no_instrument_function__))
117119 #endif
@@ -187,6 +189,10 @@ struct ftrace_likely_data { · 69 unmodified lines
187189 #define asm_volatile_goto(x...) asm goto(x)
188190 #endif
189191
192+#ifndef __no_fgcse
193+# define __no_fgcse
194+#endif
195+
190196 /* Are two types/vars the same type (ignoring qualifiers)? */
191197 #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
192198
include/linux/concap.h+0−112
@@ -1,112 +0,0 @@
1−/* $Id: concap.h,v 1.3.2.2 2004/01/12 23:08:35 keil Exp $
2− *
3− * Copyright 1997 by Henner Eisen <eis@baty.hanse.de>
4− *
5− * This software may be used and distributed according to the terms
6− * of the GNU General Public License, incorporated herein by reference.
7− */
8−
9−#ifndef _LINUX_CONCAP_H
10−#define _LINUX_CONCAP_H
11−
12−#include <linux/skbuff.h>
13−#include <linux/netdevice.h>
14−
15−/* Stuff to support encapsulation protocols genericly. The encapsulation
16− protocol is processed at the uppermost layer of the network interface.
17−
18− Based on a ideas developed in a 'synchronous device' thread in the
19− linux-x25 mailing list contributed by Alan Cox, Thomasz Motylewski
20− and Jonathan Naylor.
21−
22− For more documetation on this refer to Documentation/isdn/README.concap
23−*/
24−
25−struct concap_proto_ops;
26−struct concap_device_ops;
27−
28−/* this manages all data needed by the encapsulation protocol
29− */
30−struct concap_proto{
31− struct net_device *net_dev; /* net device using our service */
32− struct concap_device_ops *dops; /* callbacks provided by device */
33− struct concap_proto_ops *pops; /* callbacks provided by us */
34− spinlock_t lock;
35− int flags;
36− void *proto_data; /* protocol specific private data, to
37− be accessed via *pops methods only*/
38− /*
39− :
40− whatever
41− :
42− */
43−};
44−
45−/* Operations to be supported by the net device. Called by the encapsulation
46− * protocol entity. No receive method is offered because the encapsulation
47− * protocol directly calls netif_rx().
48− */
49−struct concap_device_ops{
50−
51− /* to request data is submitted by device*/
52− int (*data_req)(struct concap_proto *, struct sk_buff *);
53−
54− /* Control methods must be set to NULL by devices which do not
55− support connection control.*/
56− /* to request a connection is set up */
57− int (*connect_req)(struct concap_proto *);
58−
59− /* to request a connection is released */
60− int (*disconn_req)(struct concap_proto *);
61−};
62−
63−/* Operations to be supported by the encapsulation protocol. Called by
64− * device driver.
65− */
66−struct concap_proto_ops{
67−
68− /* create a new encapsulation protocol instance of same type */
69− struct concap_proto * (*proto_new) (void);
70−
71− /* delete encapsulation protocol instance and free all its resources.
72− cprot may no loger be referenced after calling this */
73− void (*proto_del)(struct concap_proto *cprot);
74−
75− /* initialize the protocol's data. To be called at interface startup
76− or when the device driver resets the interface. All services of the
77− encapsulation protocol may be used after this*/
78− int (*restart)(struct concap_proto *cprot,
79− struct net_device *ndev,
80− struct concap_device_ops *dops);
81−
82− /* inactivate an encapsulation protocol instance. The encapsulation
83− protocol may not call any *dops methods after this. */
84− int (*close)(struct concap_proto *cprot);
85−
86− /* process a frame handed down to us by upper layer */
87− int (*encap_and_xmit)(struct concap_proto *cprot, struct sk_buff *skb);
88−
89− /* to be called for each data entity received from lower layer*/
90− int (*data_ind)(struct concap_proto *cprot, struct sk_buff *skb);
91−
92− /* to be called when a connection was set up/down.
93− Protocols that don't process these primitives might fill in
94− dummy methods here */
95− int (*connect_ind)(struct concap_proto *cprot);
96− int (*disconn_ind)(struct concap_proto *cprot);
97− /*
98− Some network device support functions, like net_header(), rebuild_header(),
99− and others, that depend solely on the encapsulation protocol, might
100− be provided here, too. The net device would just fill them in its
101− corresponding fields when it is opened.
102− */
103−};
104−
105−/* dummy restart/close/connect/reset/disconn methods
106− */
107−extern int concap_nop(struct concap_proto *cprot);
108−
109−/* dummy submit method
110− */
111−extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb);
112−#endif
include/linux/connector.h+62−2
@@ -50,15 +50,75 @@ struct cn_dev { · 49 unmodified lines
5050
5151 u32 seq, groups;
5252 struct sock *nls;
53− void (*input) (struct sk_buff *skb);
5453
5554 struct cn_queue_dev *cbdev;
5655 };
5756
57+/**
58+ * cn_add_callback() - Registers new callback with connector core.
59+ *
60+ * @id: unique connector's user identifier.
61+ * It must be registered in connector.h for legal
62+ * in-kernel users.
63+ * @name: connector's callback symbolic name.
64+ * @callback: connector's callback.
65+ * parameters are %cn_msg and the sender's credentials
66+ */
5867 int cn_add_callback(struct cb_id *id, const char *name,
5968 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
60−void cn_del_callback(struct cb_id *);
69+/**
70+ * cn_del_callback() - Unregisters new callback with connector core.
71+ *
72+ * @id: unique connector's user identifier.
73+ */
74+void cn_del_callback(struct cb_id *id);
75+
76+
77+/**
78+ * cn_netlink_send_mult - Sends message to the specified groups.
79+ *
80+ * @msg: message header(with attached data).
81+ * @len: Number of @msg to be sent.
82+ * @portid: destination port.
83+ * If non-zero the message will be sent to the given port,
84+ * which should be set to the original sender.
85+ * @group: destination group.
86+ * If @portid and @group is zero, then appropriate group will
87+ * be searched through all registered connector users, and
88+ * message will be delivered to the group which was created
89+ * for user with the same ID as in @msg.
90+ * If @group is not zero, then message will be delivered
91+ * to the specified group.
92+ * @gfp_mask: GFP mask.
93+ *
94+ * It can be safely called from softirq context, but may silently
95+ * fail under strong memory pressure.
96+ *
97+ * If there are no listeners for given group %-ESRCH can be returned.
98+ */
6199 int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask);
100+
101+/**
102+ * cn_netlink_send_mult - Sends message to the specified groups.
103+ *
104+ * @msg: message header(with attached data).
105+ * @portid: destination port.
106+ * If non-zero the message will be sent to the given port,
107+ * which should be set to the original sender.
108+ * @group: destination group.
109+ * If @portid and @group is zero, then appropriate group will
110+ * be searched through all registered connector users, and
111+ * message will be delivered to the group which was created
112+ * for user with the same ID as in @msg.
113+ * If @group is not zero, then message will be delivered
114+ * to the specified group.
115+ * @gfp_mask: GFP mask.
116+ *
117+ * It can be safely called from softirq context, but may silently
118+ * fail under strong memory pressure.
119+ *
120+ * If there are no listeners for given group %-ESRCH can be returned.
121+ */
62122 int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask);
63123
64124 int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
include/linux/console_struct.h+1−4
@@ -168,9 +168,6 @@ extern void vc_SAK(struct work_struct *work); · 167 unmodified lines
168168
169169 #define CUR_DEFAULT CUR_UNDERLINE
170170
171−static inline bool con_is_visible(const struct vc_data *vc)
172−{
173− return *vc->vc_display_fg == vc;
174−}
171+bool con_is_visible(const struct vc_data *vc);
175172
176173 #endif /* _LINUX_CONSOLE_STRUCT_H */
include/linux/coresight.h+35−26
@@ -91,15 +91,11 @@ union coresight_dev_subtype { · 90 unmodified lines
9191
9292 /**
9393 * struct coresight_platform_data - data harvested from the DT specification
94− * @cpu: the CPU a source belongs to. Only applicable for ETM/PTMs.
95− * @name: name of the component as shown under sysfs.
9694 * @nr_inport: number of input ports for this component.
9795 * @nr_outport: number of output ports for this component.
9896 * @conns: Array of nr_outport connections from this component
9997 */
10098 struct coresight_platform_data {
101− int cpu;
102− const char *name;
10399 int nr_inport;
104100 int nr_outport;
105101 struct coresight_connection *conns;
@@ -110,11 +106,12 @@ struct coresight_platform_data { · 4 unmodified lines
110106 * @type: as defined by @coresight_dev_type.
111107 * @subtype: as defined by @coresight_dev_subtype.
112108 * @ops: generic operations for this component, as defined
113− by @coresight_ops.
109+ * by @coresight_ops.
114110 * @pdata: platform data collected from DT.
115111 * @dev: The device entity associated to this component.
116112 * @groups: operations specific to this component. These will end up
117− in the component's sysfs sub-directory.
113+ * in the component's sysfs sub-directory.
114+ * @name: name for the coresight device, also shown under sysfs.
118115 */
119116 struct coresight_desc {
120117 enum coresight_dev_type type;
@@ -123,28 +120,27 @@ struct coresight_desc { · 2 unmodified lines
123120 struct coresight_platform_data *pdata;
124121 struct device *dev;
125122 const struct attribute_group **groups;
123+ const char *name;
126124 };
127125
128126 /**
129127 * struct coresight_connection - representation of a single connection
130128 * @outport: a connection's output port number.
131− * @chid_name: remote component's name.
132129 * @child_port: remote component's port number @output is connected to.
130+ * @chid_fwnode: remote component's fwnode handle.
133131 * @child_dev: a @coresight_device representation of the component
134132 connected to @outport.
135133 */
136134 struct coresight_connection {
137135 int outport;
138− const char *child_name;
139136 int child_port;
137+ struct fwnode_handle *child_fwnode;
140138 struct coresight_device *child_dev;
141139 };
142140
143141 /**
144142 * struct coresight_device - representation of a device as used by the framework
145− * @conns: array of coresight_connections associated to this component.
146− * @nr_inport: number of input port associated to this component.
147− * @nr_outport: number of output port associated to this component.
143+ * @pdata: Platform data with device connections associated to this device.
148144 * @type: as defined by @coresight_dev_type.
149145 * @subtype: as defined by @coresight_dev_subtype.
150146 * @ops: generic operations for this component, as defined
@@ -159,9 +155,7 @@ struct coresight_connection { · 8 unmodified lines
159155 * @ea: Device attribute for sink representation under PMU directory.
160156 */
161157 struct coresight_device {
162− struct coresight_connection *conns;
163− int nr_inport;
164− int nr_outport;
158+ struct coresight_platform_data *pdata;
165159 enum coresight_dev_type type;
166160 union coresight_dev_subtype subtype;
167161 const struct coresight_ops *ops;
@@ -174,6 +168,28 @@ struct coresight_device { · 6 unmodified lines
174168 struct dev_ext_attribute *ea;
175169 };
176170
171+/*
172+ * coresight_dev_list - Mapping for devices to "name" index for device
173+ * names.
174+ *
175+ * @nr_idx: Number of entries already allocated.
176+ * @pfx: Prefix pattern for device name.
177+ * @fwnode_list: Array of fwnode_handles associated with each allocated
178+ * index, upto nr_idx entries.
179+ */
180+struct coresight_dev_list {
181+ int nr_idx;
182+ const char *pfx;
183+ struct fwnode_handle **fwnode_list;
184+};
185+
186+#define DEFINE_CORESIGHT_DEVLIST(var, dev_pfx) \
187+static struct coresight_dev_list (var) = { \
188+ .pfx = dev_pfx, \
189+ .nr_idx = 0, \
190+ .fwnode_list = NULL, \
191+}
192+
177193 #define to_coresight_device(d) container_of(d, struct coresight_device, dev)
178194
179195 #define source_ops(csdev) csdev->ops->source_ops
@@ -267,7 +283,8 @@ extern int coresight_claim_device_unlocked(void __iomem *base); · 87 unmodified lines
267283
268284 extern void coresight_disclaim_device(void __iomem *base);
269285 extern void coresight_disclaim_device_unlocked(void __iomem *base);
270−
286+extern char *coresight_alloc_device_name(struct coresight_dev_list *devs,
287+ struct device *dev);
271288 #else
272289 static inline struct coresight_device *
273290 coresight_register(struct coresight_desc *desc) { return NULL; }
@@ -292,16 +309,8 @@ static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} · 18 unmodified lines
292309
293310 #endif
294311
295−#ifdef CONFIG_OF
296−extern int of_coresight_get_cpu(const struct device_node *node);
297−extern struct coresight_platform_data *
298−of_get_coresight_platform_data(struct device *dev,
299− const struct device_node *node);
300−#else
301−static inline int of_coresight_get_cpu(const struct device_node *node)
302−{ return 0; }
303−static inline struct coresight_platform_data *of_get_coresight_platform_data(
304− struct device *dev, const struct device_node *node) { return NULL; }
305−#endif
312+extern int coresight_get_cpu(struct device *dev);
313+
314+struct coresight_platform_data *coresight_get_platform_data(struct device *dev);
306315
307316 #endif
include/linux/cpufreq.h+13−7
@@ -47,11 +47,6 @@ struct cpufreq_cpuinfo { · 46 unmodified lines
4747 unsigned int transition_latency;
4848 };
4949
50−struct cpufreq_user_policy {
51− unsigned int min; /* in kHz */
52− unsigned int max; /* in kHz */
53−};
54−
5550 struct cpufreq_policy {
5651 /* CPUs sharing clock, require sw coordination */
5752 cpumask_var_t cpus; /* Online CPUs only */
@@ -81,7 +76,8 @@ struct cpufreq_policy { · 23 unmodified lines
8176 struct work_struct update; /* if update_policy() needs to be
8277 * called, but you're in IRQ context */
8378
84− struct cpufreq_user_policy user_policy;
79+ struct dev_pm_qos_request *min_freq_req;
80+ struct dev_pm_qos_request *max_freq_req;
8581 struct cpufreq_frequency_table *freq_table;
8682 enum cpufreq_table_sorting freq_table_sorted;
8783
@@ -144,6 +140,9 @@ struct cpufreq_policy { · 56 unmodified lines
144140
145141 /* Pointer to the cooling device if used for thermal mitigation */
146142 struct thermal_cooling_device *cdev;
143+
144+ struct notifier_block nb_min;
145+ struct notifier_block nb_max;
147146 };
148147
149148 struct cpufreq_freqs {
@@ -201,6 +200,7 @@ void cpufreq_cpu_release(struct cpufreq_policy *policy); · 51 unmodified lines
201200 int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
202201 int cpufreq_set_policy(struct cpufreq_policy *policy,
203202 struct cpufreq_policy *new_policy);
203+void refresh_frequency_limits(struct cpufreq_policy *policy);
204204 void cpufreq_update_policy(unsigned int cpu);
205205 void cpufreq_update_limits(unsigned int cpu);
206206 bool have_governor_per_policy(void);
@@ -406,6 +406,12 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); · 199 unmodified lines
406406 const char *cpufreq_get_current_driver(void);
407407 void *cpufreq_get_driver_data(void);
408408
409+static inline int cpufreq_thermal_control_enabled(struct cpufreq_driver *drv)
410+{
411+ return IS_ENABLED(CONFIG_CPU_THERMAL) &&
412+ (drv->flags & CPUFREQ_IS_COOLING_DEV);
413+}
414+
409415 static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
410416 unsigned int min, unsigned int max)
411417 {
@@ -986,7 +992,7 @@ extern struct freq_attr *cpufreq_generic_attr[]; · 574 unmodified lines
986992 int cpufreq_table_validate_and_sort(struct cpufreq_policy *policy);
987993
988994 unsigned int cpufreq_generic_get(unsigned int cpu);
989−int cpufreq_generic_init(struct cpufreq_policy *policy,
995+void cpufreq_generic_init(struct cpufreq_policy *policy,
990996 struct cpufreq_frequency_table *table,
991997 unsigned int transition_latency);
992998 #endif /* _LINUX_CPUFREQ_H */
include/linux/cpuhotplug.h+2−1
@@ -116,10 +116,10 @@ enum cpuhp_state { · 115 unmodified lines
116116 CPUHP_AP_PERF_ARM_ACPI_STARTING,
117117 CPUHP_AP_PERF_ARM_STARTING,
118118 CPUHP_AP_ARM_L2X0_STARTING,
119+ CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING,
119120 CPUHP_AP_ARM_ARCH_TIMER_STARTING,
120121 CPUHP_AP_ARM_GLOBAL_TIMER_STARTING,
121122 CPUHP_AP_JCORE_TIMER_STARTING,
122− CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING,
123123 CPUHP_AP_ARM_TWD_STARTING,
124124 CPUHP_AP_QCOM_TIMER_STARTING,
125125 CPUHP_AP_TEGRA_TIMER_STARTING,
@@ -176,6 +176,7 @@ enum cpuhp_state { · 50 unmodified lines
176176 CPUHP_AP_WATCHDOG_ONLINE,
177177 CPUHP_AP_WORKQUEUE_ONLINE,
178178 CPUHP_AP_RCUTREE_ONLINE,
179+ CPUHP_AP_BASE_CACHEINFO_ONLINE,
179180 CPUHP_AP_ONLINE_DYN,
180181 CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30,
181182 CPUHP_AP_X86_HPET_ONLINE,
include/linux/cred.h+7−1
@@ -145,7 +145,11 @@ struct cred { · 144 unmodified lines
145145 struct user_struct *user; /* real user ID subscription */
146146 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */
147147 struct group_info *group_info; /* supplementary groups for euid/fsgid */
148− struct rcu_head rcu; /* RCU deletion hook */
148+ /* RCU deletion */
149+ union {
150+ int non_rcu; /* Can we skip RCU deletion? */
151+ struct rcu_head rcu; /* RCU deletion hook */
152+ };
149153 } __randomize_layout;
150154
151155 extern void __put_cred(struct cred *);
@@ -246,6 +250,7 @@ static inline const struct cred *get_cred(const struct cred *cred) · 94 unmodified lines
246250 if (!cred)
247251 return cred;
248252 validate_creds(cred);
253+ nonconst_cred->non_rcu = 0;
249254 return get_new_cred(nonconst_cred);
250255 }
251256
@@ -257,6 +262,7 @@ static inline const struct cred *get_cred_rcu(const struct cred *cred) · 5 unmodified lines
257262 if (!atomic_inc_not_zero(&nonconst_cred->usage))
258263 return NULL;
259264 validate_creds(cred);
265+ nonconst_cred->non_rcu = 0;
260266 return cred;
261267 }
262268
include/linux/crypto.h+11−1
@@ -49,7 +49,6 @@ · 48 unmodified lines
4949 #define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b
5050 #define CRYPTO_ALG_TYPE_RNG 0x0000000c
5151 #define CRYPTO_ALG_TYPE_AKCIPHER 0x0000000d
52−#define CRYPTO_ALG_TYPE_DIGEST 0x0000000e
5352 #define CRYPTO_ALG_TYPE_HASH 0x0000000e
5453 #define CRYPTO_ALG_TYPE_SHASH 0x0000000e
5554 #define CRYPTO_ALG_TYPE_AHASH 0x0000000f
@@ -323,6 +322,17 @@ struct cipher_alg { · 267 unmodified lines
323322 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
324323 };
325324
325+/**
326+ * struct compress_alg - compression/decompression algorithm
327+ * @coa_compress: Compress a buffer of specified length, storing the resulting
328+ * data in the specified buffer. Return the length of the
329+ * compressed data in dlen.
330+ * @coa_decompress: Decompress the source buffer, storing the uncompressed
331+ * data in the specified buffer. The length of the data is
332+ * returned in dlen.
333+ *
334+ * All fields are mandatory.
335+ */
326336 struct compress_alg {
327337 int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src,
328338 unsigned int slen, u8 *dst, unsigned int *dlen);
include/linux/dax.h+39−2
@@ -7,6 +7,9 @@ · 6 unmodified lines
77 #include <linux/radix-tree.h>
88 #include <asm/pgtable.h>
99
10+/* Flag for synchronous flush */
11+#define DAXDEV_F_SYNC (1UL << 0)
12+
1013 typedef unsigned long dax_entry_t;
1114
1215 struct iomap_ops;
@@ -38,18 +41,40 @@ extern struct attribute_group dax_attribute_group; · 25 unmodified lines
3841 #if IS_ENABLED(CONFIG_DAX)
3942 struct dax_device *dax_get_by_host(const char *host);
4043 struct dax_device *alloc_dax(void *private, const char *host,
41− const struct dax_operations *ops);
44+ const struct dax_operations *ops, unsigned long flags);
4245 void put_dax(struct dax_device *dax_dev);
4346 void kill_dax(struct dax_device *dax_dev);
4447 void dax_write_cache(struct dax_device *dax_dev, bool wc);
4548 bool dax_write_cache_enabled(struct dax_device *dax_dev);
49+bool __dax_synchronous(struct dax_device *dax_dev);
50+static inline bool dax_synchronous(struct dax_device *dax_dev)
51+{
52+ return __dax_synchronous(dax_dev);
53+}
54+void __set_dax_synchronous(struct dax_device *dax_dev);
55+static inline void set_dax_synchronous(struct dax_device *dax_dev)
56+{
57+ __set_dax_synchronous(dax_dev);
58+}
59+/*
60+ * Check if given mapping is supported by the file / underlying device.
61+ */
62+static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
63+ struct dax_device *dax_dev)
64+{
65+ if (!(vma->vm_flags & VM_SYNC))
66+ return true;
67+ if (!IS_DAX(file_inode(vma->vm_file)))
68+ return false;
69+ return dax_synchronous(dax_dev);
70+}
4671 #else
4772 static inline struct dax_device *dax_get_by_host(const char *host)
4873 {
4974 return NULL;
5075 }
5176 static inline struct dax_device *alloc_dax(void *private, const char *host,
52− const struct dax_operations *ops)
77+ const struct dax_operations *ops, unsigned long flags)
5378 {
5479 /*
5580 * Callers should check IS_ENABLED(CONFIG_DAX) to know if this
@@ -70,6 +95,18 @@ static inline bool dax_write_cache_enabled(struct dax_device *dax_dev) · 14 unmodified lines
7095 {
7196 return false;
7297 }
98+static inline bool dax_synchronous(struct dax_device *dax_dev)
99+{
100+ return true;
101+}
102+static inline void set_dax_synchronous(struct dax_device *dax_dev)
103+{
104+}
105+static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
106+ struct dax_device *dax_dev)
107+{
108+ return !(vma->vm_flags & VM_SYNC);
109+}
73110 #endif
74111
75112 struct writeback_control;
include/linux/dcache.h+2−3
@@ -153,7 +153,7 @@ struct dentry_operations { · 152 unmodified lines
153153 * Locking rules for dentry_operations callbacks are to be found in
154154 * Documentation/filesystems/Locking. Keep it updated!
155155 *
156− * FUrther descriptions are found in Documentation/filesystems/vfs.txt.
156+ * FUrther descriptions are found in Documentation/filesystems/vfs.rst.
157157 * Keep it updated too!
158158 */
159159
@@ -291,7 +291,6 @@ static inline unsigned d_count(const struct dentry *dentry) · 131 unmodified lines
291291 */
292292 extern __printf(4, 5)
293293 char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
294−extern char *simple_dname(struct dentry *, char *, int);
295294
296295 extern char *__d_path(const struct path *, const struct path *, char *, int);
297296 extern char *d_absolute_path(const struct path *, char *, int);
@@ -568,7 +567,7 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper) · 270 unmodified lines
568567 * If dentry is on a union/overlay, then return the underlying, real dentry.
569568 * Otherwise return the dentry itself.
570569 *
571− * See also: Documentation/filesystems/vfs.txt
570+ * See also: Documentation/filesystems/vfs.rst
572571 */
573572 static inline struct dentry *d_real(struct dentry *dentry,
574573 const struct inode *inode)
include/linux/debugfs.h+5−7
@@ -133,9 +133,8 @@ struct dentry *debugfs_create_regset32(const char *name, umode_t mode, · 132 unmodified lines
133133 void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
134134 int nregs, void __iomem *base, char *prefix);
135135
136−struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
137− struct dentry *parent,
138− u32 *array, u32 elements);
136+void debugfs_create_u32_array(const char *name, umode_t mode,
137+ struct dentry *parent, u32 *array, u32 elements);
139138
140139 struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
141140 struct dentry *parent,
@@ -353,11 +352,10 @@ static inline bool debugfs_initialized(void) · 211 unmodified lines
353352 return false;
354353 }
355354
356−static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
357− struct dentry *parent,
358− u32 *array, u32 elements)
355+static inline void debugfs_create_u32_array(const char *name, umode_t mode,
356+ struct dentry *parent, u32 *array,
357+ u32 elements)
359358 {
360− return ERR_PTR(-ENODEV);
361359 }
362360
363361 static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev,
include/linux/device-mapper.h+5−15
@@ -95,8 +95,7 @@ typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, struct block_device ** · 94 unmodified lines
9595
9696 typedef int (*dm_report_zones_fn) (struct dm_target *ti, sector_t sector,
9797 struct blk_zone *zones,
98− unsigned int *nr_zones,
99− gfp_t gfp_mask);
98+ unsigned int *nr_zones);
10099
101100 /*
102101 * These iteration functions are typically used to check (and combine)
@@ -530,29 +529,20 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · 427 unmodified lines
530529 *---------------------------------------------------------------*/
531530 #define DM_NAME "device-mapper"
532531
533−#define DM_RATELIMIT(pr_func, fmt, ...) \
534−do { \
535− static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, \
536− DEFAULT_RATELIMIT_BURST); \
537− \
538− if (__ratelimit(&rs)) \
539− pr_func(DM_FMT(fmt), ##__VA_ARGS__); \
540−} while (0)
541−
542532 #define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n"
543533
544534 #define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__)
545535
546536 #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__)
547−#define DMERR_LIMIT(fmt, ...) DM_RATELIMIT(pr_err, fmt, ##__VA_ARGS__)
537+#define DMERR_LIMIT(fmt, ...) pr_err_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
548538 #define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__)
549−#define DMWARN_LIMIT(fmt, ...) DM_RATELIMIT(pr_warn, fmt, ##__VA_ARGS__)
539+#define DMWARN_LIMIT(fmt, ...) pr_warn_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
550540 #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
551−#define DMINFO_LIMIT(fmt, ...) DM_RATELIMIT(pr_info, fmt, ##__VA_ARGS__)
541+#define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
552542
553543 #ifdef CONFIG_DM_DEBUG
554544 #define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__)
555−#define DMDEBUG_LIMIT(fmt, ...) DM_RATELIMIT(pr_debug, fmt, ##__VA_ARGS__)
545+#define DMDEBUG_LIMIT(fmt, ...) pr_debug_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
556546 #else
557547 #define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
558548 #define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
include/linux/device.h+22−5
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de>
77 * Copyright (c) 2008-2009 Novell Inc.
88 *
9− * See Documentation/driver-model/ for more information.
9+ * See Documentation/driver-api/driver-model/ for more information.
1010 */
1111
1212 #ifndef _DEVICE_H_
@@ -42,6 +42,7 @@ struct iommu_ops; · 29 unmodified lines
4242 struct iommu_group;
4343 struct iommu_fwspec;
4444 struct dev_pin_info;
45+struct iommu_param;
4546
4647 struct bus_attribute {
4748 struct attribute attr;
@@ -163,11 +164,13 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, · 115 unmodified lines
163164 struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
164165 void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
165166
167+int device_match_of_node(struct device *dev, const void *np);
168+
166169 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
167170 int (*fn)(struct device *dev, void *data));
168171 struct device *bus_find_device(struct bus_type *bus, struct device *start,
169− void *data,
170− int (*match)(struct device *dev, void *data));
172+ const void *data,
173+ int (*match)(struct device *dev, const void *data));
171174 struct device *bus_find_device_by_name(struct bus_type *bus,
172175 struct device *start,
173176 const char *name);
@@ -259,6 +262,8 @@ enum probe_type { · 85 unmodified lines
259262 * @resume: Called to bring a device from sleep mode.
260263 * @groups: Default attributes that get created by the driver core
261264 * automatically.
265+ * @dev_groups: Additional attributes attached to device instance once the
266+ * it is bound to the driver.
262267 * @pm: Power management operations of the device which matched
263268 * this driver.
264269 * @coredump: Called when sysfs entry is written to. The device driver
@@ -293,6 +298,7 @@ struct device_driver { · 28 unmodified lines
293298 int (*suspend) (struct device *dev, pm_message_t state);
294299 int (*resume) (struct device *dev);
295300 const struct attribute_group **groups;
301+ const struct attribute_group **dev_groups;
296302
297303 const struct dev_pm_ops *pm;
298304 void (*coredump) (struct device *dev);
@@ -336,11 +342,12 @@ extern int __must_check driver_for_each_device(struct device_driver *drv, · 37 unmodified lines
336342 int (*fn)(struct device *dev,
337343 void *));
338344 struct device *driver_find_device(struct device_driver *drv,
339− struct device *start, void *data,
340− int (*match)(struct device *dev, void *data));
345+ struct device *start, const void *data,
346+ int (*match)(struct device *dev, const void *data));
341347
342348 void driver_deferred_probe_add(struct device *dev);
343349 int driver_deferred_probe_check_state(struct device *dev);
350+int driver_deferred_probe_check_state_continue(struct device *dev);
344351
345352 /**
346353 * struct subsys_interface - interfaces to device functions
@@ -911,6 +918,8 @@ struct dev_links_info { · 564 unmodified lines
911918 * This identifies the device type and carries type-specific
912919 * information.
913920 * @mutex: Mutex to synchronize calls to its driver.
921+ * @lockdep_mutex: An optional debug lock that a subsystem can use as a
922+ * peer lock to gain localized lockdep coverage of the device_lock.
914923 * @bus: Type of bus device is on.
915924 * @driver: Which driver has allocated this
916925 * @platform_data: Platform data specific to the device.
@@ -961,6 +970,7 @@ struct dev_links_info { · 44 unmodified lines
961970 * device (i.e. the bus driver that discovered the device).
962971 * @iommu_group: IOMMU group the device belongs to.
963972 * @iommu_fwspec: IOMMU-specific properties supplied by firmware.
973+ * @iommu_param: Per device generic IOMMU runtime data
964974 *
965975 * @offline_disabled: If set, the device is permanently online.
966976 * @offline: Set after successful invocation of bus type's .offline().
@@ -993,6 +1003,9 @@ struct device { · 26 unmodified lines
9931003 core doesn't touch it */
9941004 void *driver_data; /* Driver data, set and get with
9951005 dev_set_drvdata/dev_get_drvdata */
1006+#ifdef CONFIG_PROVE_LOCKING
1007+ struct mutex lockdep_mutex;
1008+#endif
9961009 struct mutex mutex; /* mutex to synchronize calls to
9971010 * its driver.
9981011 */
@@ -1054,6 +1067,7 @@ struct device { · 55 unmodified lines
10541067 void (*release)(struct device *dev);
10551068 struct iommu_group *iommu_group;
10561069 struct iommu_fwspec *iommu_fwspec;
1070+ struct iommu_param *iommu_param;
10571071
10581072 bool offline_disabled:1;
10591073 bool offline:1;
@@ -1252,6 +1266,8 @@ extern int device_for_each_child_reverse(struct device *dev, void *data, · 192 unmodified lines
12521266 int (*fn)(struct device *dev, void *data));
12531267 extern struct device *device_find_child(struct device *dev, void *data,
12541268 int (*match)(struct device *dev, void *data));
1269+extern struct device *device_find_child_by_name(struct device *parent,
1270+ const char *name);
12551271 extern int device_rename(struct device *dev, const char *new_name);
12561272 extern int device_move(struct device *dev, struct device *new_parent,
12571273 enum dpm_order dpm_order);
@@ -1375,6 +1391,7 @@ extern int (*platform_notify_remove)(struct device *dev); · 117 unmodified lines
13751391 */
13761392 extern struct device *get_device(struct device *dev);
13771393 extern void put_device(struct device *dev);
1394+extern bool kill_device(struct device *dev);
13781395
13791396 #ifdef CONFIG_DEVTMPFS
13801397 extern int devtmpfs_create_node(struct device *dev);
include/linux/dim.h+333−0
@@ -0,0 +1,333 @@
1+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2+/* Copyright (c) 2019 Mellanox Technologies. */
3+
4+#ifndef DIM_H
5+#define DIM_H
6+
7+#include <linux/module.h>
8+
9+/**
10+ * Number of events between DIM iterations.
11+ * Causes a moderation of the algorithm run.
12+ */
13+#define DIM_NEVENTS 64
14+
15+/**
16+ * Is a difference between values justifies taking an action.
17+ * We consider 10% difference as significant.
18+ */
19+#define IS_SIGNIFICANT_DIFF(val, ref) \
20+ (((100UL * abs((val) - (ref))) / (ref)) > 10)
21+
22+/**
23+ * Calculate the gap between two values.
24+ * Take wrap-around and variable size into consideration.
25+ */
26+#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) \
27+ & (BIT_ULL(bits) - 1))
28+
29+/**
30+ * Structure for CQ moderation values.
31+ * Used for communications between DIM and its consumer.
32+ *
33+ * @usec: CQ timer suggestion (by DIM)
34+ * @pkts: CQ packet counter suggestion (by DIM)
35+ * @cq_period_mode: CQ priod count mode (from CQE/EQE)
36+ */
37+struct dim_cq_moder {
38+ u16 usec;
39+ u16 pkts;
40+ u16 comps;
41+ u8 cq_period_mode;
42+};
43+
44+/**
45+ * Structure for DIM sample data.
46+ * Used for communications between DIM and its consumer.
47+ *
48+ * @time: Sample timestamp
49+ * @pkt_ctr: Number of packets
50+ * @byte_ctr: Number of bytes
51+ * @event_ctr: Number of events
52+ */
53+struct dim_sample {
54+ ktime_t time;
55+ u32 pkt_ctr;
56+ u32 byte_ctr;
57+ u16 event_ctr;
58+ u32 comp_ctr;
59+};
60+
61+/**
62+ * Structure for DIM stats.
63+ * Used for holding current measured rates.
64+ *
65+ * @ppms: Packets per msec
66+ * @bpms: Bytes per msec
67+ * @epms: Events per msec
68+ */
69+struct dim_stats {
70+ int ppms; /* packets per msec */
71+ int bpms; /* bytes per msec */
72+ int epms; /* events per msec */
73+ int cpms; /* completions per msec */
74+ int cpe_ratio; /* ratio of completions to events */
75+};
76+
77+/**
78+ * Main structure for dynamic interrupt moderation (DIM).
79+ * Used for holding all information about a specific DIM instance.
80+ *
81+ * @state: Algorithm state (see below)
82+ * @prev_stats: Measured rates from previous iteration (for comparison)
83+ * @start_sample: Sampled data at start of current iteration
84+ * @work: Work to perform on action required
85+ * @priv: A pointer to the struct that points to dim
86+ * @profile_ix: Current moderation profile
87+ * @mode: CQ period count mode
88+ * @tune_state: Algorithm tuning state (see below)
89+ * @steps_right: Number of steps taken towards higher moderation
90+ * @steps_left: Number of steps taken towards lower moderation
91+ * @tired: Parking depth counter
92+ */
93+struct dim {
94+ u8 state;
95+ struct dim_stats prev_stats;
96+ struct dim_sample start_sample;
97+ struct dim_sample measuring_sample;
98+ struct work_struct work;
99+ void *priv;
100+ u8 profile_ix;
101+ u8 mode;
102+ u8 tune_state;
103+ u8 steps_right;
104+ u8 steps_left;
105+ u8 tired;
106+};
107+
108+/**
109+ * enum dim_cq_period_mode
110+ *
111+ * These are the modes for CQ period count.
112+ *
113+ * @DIM_CQ_PERIOD_MODE_START_FROM_EQE: Start counting from EQE
114+ * @DIM_CQ_PERIOD_MODE_START_FROM_CQE: Start counting from CQE (implies timer reset)
115+ * @DIM_CQ_PERIOD_NUM_MODES: Number of modes
116+ */
117+enum {
118+ DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0,
119+ DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1,
120+ DIM_CQ_PERIOD_NUM_MODES
121+};
122+
123+/**
124+ * enum dim_state
125+ *
126+ * These are the DIM algorithm states.
127+ * These will determine if the algorithm is in a valid state to start an iteration.
128+ *
129+ * @DIM_START_MEASURE: This is the first iteration (also after applying a new profile)
130+ * @DIM_MEASURE_IN_PROGRESS: Algorithm is already in progress - check if
131+ * need to perform an action
132+ * @DIM_APPLY_NEW_PROFILE: DIM consumer is currently applying a profile - no need to measure
133+ */
134+enum {
135+ DIM_START_MEASURE,
136+ DIM_MEASURE_IN_PROGRESS,
137+ DIM_APPLY_NEW_PROFILE,
138+};
139+
140+/**
141+ * enum dim_tune_state
142+ *
143+ * These are the DIM algorithm tune states.
144+ * These will determine which action the algorithm should perform.
145+ *
146+ * @DIM_PARKING_ON_TOP: Algorithm found a local top point - exit on significant difference
147+ * @DIM_PARKING_TIRED: Algorithm found a deep top point - don't exit if tired > 0
148+ * @DIM_GOING_RIGHT: Algorithm is currently trying higher moderation levels
149+ * @DIM_GOING_LEFT: Algorithm is currently trying lower moderation levels
150+ */
151+enum {
152+ DIM_PARKING_ON_TOP,
153+ DIM_PARKING_TIRED,
154+ DIM_GOING_RIGHT,
155+ DIM_GOING_LEFT,
156+};
157+
158+/**
159+ * enum dim_stats_state
160+ *
161+ * These are the DIM algorithm statistics states.
162+ * These will determine the verdict of current iteration.
163+ *
164+ * @DIM_STATS_WORSE: Current iteration shows worse performance than before
165+ * @DIM_STATS_WORSE: Current iteration shows same performance than before
166+ * @DIM_STATS_WORSE: Current iteration shows better performance than before
167+ */
168+enum {
169+ DIM_STATS_WORSE,
170+ DIM_STATS_SAME,
171+ DIM_STATS_BETTER,
172+};
173+
174+/**
175+ * enum dim_step_result
176+ *
177+ * These are the DIM algorithm step results.
178+ * These describe the result of a step.
179+ *
180+ * @DIM_STEPPED: Performed a regular step
181+ * @DIM_TOO_TIRED: Same kind of step was done multiple times - should go to
182+ * tired parking
183+ * @DIM_ON_EDGE: Stepped to the most left/right profile
184+ */
185+enum {
186+ DIM_STEPPED,
187+ DIM_TOO_TIRED,
188+ DIM_ON_EDGE,
189+};
190+
191+/**
192+ * dim_on_top - check if current state is a good place to stop (top location)
193+ * @dim: DIM context
194+ *
195+ * Check if current profile is a good place to park at.
196+ * This will result in reducing the DIM checks frequency as we assume we
197+ * shouldn't probably change profiles, unless traffic pattern wasn't changed.
198+ */
199+bool dim_on_top(struct dim *dim);
200+
201+/**
202+ * dim_turn - change profile alterning direction
203+ * @dim: DIM context
204+ *
205+ * Go left if we were going right and vice-versa.
206+ * Do nothing if currently parking.
207+ */
208+void dim_turn(struct dim *dim);
209+
210+/**
211+ * dim_park_on_top - enter a parking state on a top location
212+ * @dim: DIM context
213+ *
214+ * Enter parking state.
215+ * Clear all movement history.
216+ */
217+void dim_park_on_top(struct dim *dim);
218+
219+/**
220+ * dim_park_tired - enter a tired parking state
221+ * @dim: DIM context
222+ *
223+ * Enter parking state.
224+ * Clear all movement history and cause DIM checks frequency to reduce.
225+ */
226+void dim_park_tired(struct dim *dim);
227+
228+/**
229+ * dim_calc_stats - calculate the difference between two samples
230+ * @start: start sample
231+ * @end: end sample
232+ * @curr_stats: delta between samples
233+ *
234+ * Calculate the delta between two samples (in data rates).
235+ * Takes into consideration counter wrap-around.
236+ */
237+void dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
238+ struct dim_stats *curr_stats);
239+
240+/**
241+ * dim_update_sample - set a sample's fields with give values
242+ * @event_ctr: number of events to set
243+ * @packets: number of packets to set
244+ * @bytes: number of bytes to set
245+ * @s: DIM sample
246+ */
247+static inline void
248+dim_update_sample(u16 event_ctr, u64 packets, u64 bytes, struct dim_sample *s)
249+{
250+ s->time = ktime_get();
251+ s->pkt_ctr = packets;
252+ s->byte_ctr = bytes;
253+ s->event_ctr = event_ctr;
254+}
255+
256+/**
257+ * dim_update_sample_with_comps - set a sample's fields with given
258+ * values including the completion parameter
259+ * @event_ctr: number of events to set
260+ * @packets: number of packets to set
261+ * @bytes: number of bytes to set
262+ * @comps: number of completions to set
263+ * @s: DIM sample
264+ */
265+static inline void
266+dim_update_sample_with_comps(u16 event_ctr, u64 packets, u64 bytes, u64 comps,
267+ struct dim_sample *s)
268+{
269+ dim_update_sample(event_ctr, packets, bytes, s);
270+ s->comp_ctr = comps;
271+}
272+
273+/* Net DIM */
274+
275+/**
276+ * net_dim_get_rx_moderation - provide a CQ moderation object for the given RX profile
277+ * @cq_period_mode: CQ period mode
278+ * @ix: Profile index
279+ */
280+struct dim_cq_moder net_dim_get_rx_moderation(u8 cq_period_mode, int ix);
281+
282+/**
283+ * net_dim_get_def_rx_moderation - provide the default RX moderation
284+ * @cq_period_mode: CQ period mode
285+ */
286+struct dim_cq_moder net_dim_get_def_rx_moderation(u8 cq_period_mode);
287+
288+/**
289+ * net_dim_get_tx_moderation - provide a CQ moderation object for the given TX profile
290+ * @cq_period_mode: CQ period mode
291+ * @ix: Profile index
292+ */
293+struct dim_cq_moder net_dim_get_tx_moderation(u8 cq_period_mode, int ix);
294+
295+/**
296+ * net_dim_get_def_tx_moderation - provide the default TX moderation
297+ * @cq_period_mode: CQ period mode
298+ */
299+struct dim_cq_moder net_dim_get_def_tx_moderation(u8 cq_period_mode);
300+
301+/**
302+ * net_dim - main DIM algorithm entry point
303+ * @dim: DIM instance information
304+ * @end_sample: Current data measurement
305+ *
306+ * Called by the consumer.
307+ * This is the main logic of the algorithm, where data is processed in order to decide on next
308+ * required action.
309+ */
310+void net_dim(struct dim *dim, struct dim_sample end_sample);
311+
312+/* RDMA DIM */
313+
314+/*
315+ * RDMA DIM profile:
316+ * profile size must be of RDMA_DIM_PARAMS_NUM_PROFILES.
317+ */
318+#define RDMA_DIM_PARAMS_NUM_PROFILES 9
319+#define RDMA_DIM_START_PROFILE 0
320+
321+/**
322+ * rdma_dim - Runs the adaptive moderation.
323+ * @dim: The moderation struct.
324+ * @completions: The number of completions collected in this round.
325+ *
326+ * Each call to rdma_dim takes the latest amount of completions that
327+ * have been collected and counts them as a new event.
328+ * Once enough events have been collected the algorithm decides a new
329+ * moderation level.
330+ */
331+void rdma_dim(struct dim *dim, u64 completions);
332+
333+#endif /* DIM_H */
include/linux/dma-buf.h+42−10
@@ -28,18 +28,20 @@ struct dma_buf_attachment; · 27 unmodified lines
2828
2929 /**
3030 * struct dma_buf_ops - operations possible on struct dma_buf
31− * @map_atomic: [optional] maps a page from the buffer into kernel address
32− * space, users may not block until the subsequent unmap call.
33− * This callback must not sleep.
34− * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer.
35− * This Callback must not sleep.
36− * @map: [optional] maps a page from the buffer into kernel address space.
37− * @unmap: [optional] unmaps a page from the buffer.
3831 * @vmap: [optional] creates a virtual mapping for the buffer into kernel
3932 * address space. Same restrictions as for vmap and friends apply.
4033 * @vunmap: [optional] unmaps a vmap from the buffer
4134 */
4235 struct dma_buf_ops {
36+ /**
37+ * @cache_sgt_mapping:
38+ *
39+ * If true the framework will cache the first mapping made for each
40+ * attachment. This avoids creating mappings for attachments multiple
41+ * times.
42+ */
43+ bool cache_sgt_mapping;
44+
4345 /**
4446 * @attach:
4547 *
@@ -194,8 +196,6 @@ struct dma_buf_ops { · 148 unmodified lines
194196 * to be restarted.
195197 */
196198 int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction);
197− void *(*map)(struct dma_buf *, unsigned long);
198− void (*unmap)(struct dma_buf *, unsigned long, void *);
199199
200200 /**
201201 * @mmap:
@@ -234,6 +234,31 @@ struct dma_buf_ops { · 32 unmodified lines
234234 */
235235 int (*mmap)(struct dma_buf *, struct vm_area_struct *vma);
236236
237+ /**
238+ * @map:
239+ *
240+ * Maps a page from the buffer into kernel address space. The page is
241+ * specified by offset into the buffer in PAGE_SIZE units.
242+ *
243+ * This callback is optional.
244+ *
245+ * Returns:
246+ *
247+ * Virtual address pointer where requested page can be accessed. NULL
248+ * on error or when this function is unimplemented by the exporter.
249+ */
250+ void *(*map)(struct dma_buf *, unsigned long);
251+
252+ /**
253+ * @unmap:
254+ *
255+ * Unmaps a page from the buffer. Page offset and address pointer should
256+ * be the same as the one passed to and returned by matching call to map.
257+ *
258+ * This callback is optional.
259+ */
260+ void (*unmap)(struct dma_buf *, unsigned long, void *);
261+
237262 void *(*vmap)(struct dma_buf *);
238263 void (*vunmap)(struct dma_buf *, void *vaddr);
239264 };
@@ -244,10 +269,12 @@ struct dma_buf_ops { · 4 unmodified lines
244269 * @file: file pointer used for sharing buffers across, and for refcounting.
245270 * @attachments: list of dma_buf_attachment that denotes all devices attached.
246271 * @ops: dma_buf_ops associated with this buffer object.
247− * @lock: used internally to serialize list manipulation, attach/detach and vmap/unmap
272+ * @lock: used internally to serialize list manipulation, attach/detach and
273+ * vmap/unmap, and accesses to name
248274 * @vmapping_counter: used internally to refcnt the vmaps
249275 * @vmap_ptr: the current vmap ptr if vmapping_counter > 0
250276 * @exp_name: name of the exporter; useful for debugging.
277+ * @name: userspace-provided name; useful for accounting and debugging.
251278 * @owner: pointer to exporter module; used for refcounting when exporter is a
252279 * kernel module.
253280 * @list_node: node for dma_buf accounting and debugging.
@@ -275,6 +302,7 @@ struct dma_buf { · 21 unmodified lines
275302 unsigned vmapping_counter;
276303 void *vmap_ptr;
277304 const char *exp_name;
305+ const char *name;
278306 struct module *owner;
279307 struct list_head list_node;
280308 void *priv;
@@ -296,6 +324,8 @@ struct dma_buf { · 15 unmodified lines
296324 * @dmabuf: buffer for this attachment.
297325 * @dev: device attached to the buffer.
298326 * @node: list of dma_buf_attachment.
327+ * @sgt: cached mapping.
328+ * @dir: direction of cached mapping.
299329 * @priv: exporter specific attachment data.
300330 *
301331 * This structure holds the attachment information between the dma_buf buffer
@@ -311,6 +341,8 @@ struct dma_buf_attachment { · 9 unmodified lines
311341 struct dma_buf *dmabuf;
312342 struct device *dev;
313343 struct list_head node;
344+ struct sg_table *sgt;
345+ enum dma_data_direction dir;
314346 void *priv;
315347 };
316348
include/linux/dma-contiguous.h+19−0
@@ -50,6 +50,7 @@ · 49 unmodified lines
5050 #ifdef __KERNEL__
5151
5252 #include <linux/device.h>
53+#include <linux/mm.h>
5354
5455 struct cma;
5556 struct page;
@@ -111,6 +112,8 @@ struct page *dma_alloc_from_contiguous(struct device *dev, size_t count, · 55 unmodified lines
111112 unsigned int order, bool no_warn);
112113 bool dma_release_from_contiguous(struct device *dev, struct page *pages,
113114 int count);
115+struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp);
116+void dma_free_contiguous(struct device *dev, struct page *page, size_t size);
114117
115118 #else
116119
@@ -153,6 +156,22 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, · 36 unmodified lines
153156 return false;
154157 }
155158
159+/* Use fallback alloc() and free() when CONFIG_DMA_CMA=n */
160+static inline struct page *dma_alloc_contiguous(struct device *dev, size_t size,
161+ gfp_t gfp)
162+{
163+ int node = dev ? dev_to_node(dev) : NUMA_NO_NODE;
164+ size_t align = get_order(PAGE_ALIGN(size));
165+
166+ return alloc_pages_node(node, gfp, align);
167+}
168+
169+static inline void dma_free_contiguous(struct device *dev, struct page *page,
170+ size_t size)
171+{
172+ __free_pages(page, get_order(size));
173+}
174+
156175 #endif
157176
158177 #endif
include/linux/dma-direct.h+9−0
@@ -32,6 +32,15 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) · 31 unmodified lines
3232 }
3333 #endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */
3434
35+#ifdef CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED
36+bool force_dma_unencrypted(struct device *dev);
37+#else
38+static inline bool force_dma_unencrypted(struct device *dev)
39+{
40+ return false;
41+}
42+#endif /* CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED */
43+
3544 /*
3645 * If memory encryption is supported, phys_to_dma will set the memory encryption
3746 * bit in the DMA address, and dma_to_phys will clear it. The raw __phys_to_dma
include/linux/dma-iommu.h+5−44
@@ -5,59 +5,21 @@ · 4 unmodified lines
55 #ifndef __DMA_IOMMU_H
66 #define __DMA_IOMMU_H
77
8−#ifdef __KERNEL__
8+#include <linux/errno.h>
99 #include <linux/types.h>
10−#include <asm/errno.h>
1110
1211 #ifdef CONFIG_IOMMU_DMA
1312 #include <linux/dma-mapping.h>
1413 #include <linux/iommu.h>
1514 #include <linux/msi.h>
1615
17−int iommu_dma_init(void);
18−
1916 /* Domain management interface for IOMMU drivers */
2017 int iommu_get_dma_cookie(struct iommu_domain *domain);
2118 int iommu_get_msi_cookie(struct iommu_domain *domain, dma_addr_t base);
2219 void iommu_put_dma_cookie(struct iommu_domain *domain);
2320
2421 /* Setup call for arch DMA mapping code */
25−int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
26− u64 size, struct device *dev);
27−
28−/* General helpers for DMA-API <-> IOMMU-API interaction */
29−int dma_info_to_prot(enum dma_data_direction dir, bool coherent,
30− unsigned long attrs);
31−
32−/*
33− * These implement the bulk of the relevant DMA mapping callbacks, but require
34− * the arch code to take care of attributes and cache maintenance
35− */
36−struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp,
37− unsigned long attrs, int prot, dma_addr_t *handle,
38− void (*flush_page)(struct device *, const void *, phys_addr_t));
39−void iommu_dma_free(struct device *dev, struct page **pages, size_t size,
40− dma_addr_t *handle);
41−
42−int iommu_dma_mmap(struct page **pages, size_t size, struct vm_area_struct *vma);
43−
44−dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
45− unsigned long offset, size_t size, int prot);
46−int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
47− int nents, int prot);
48−
49−/*
50− * Arch code with no special attribute handling may use these
51− * directly as DMA mapping callbacks for simplicity
52− */
53−void iommu_dma_unmap_page(struct device *dev, dma_addr_t handle, size_t size,
54− enum dma_data_direction dir, unsigned long attrs);
55−void iommu_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
56− enum dma_data_direction dir, unsigned long attrs);
57−dma_addr_t iommu_dma_map_resource(struct device *dev, phys_addr_t phys,
58− size_t size, enum dma_data_direction dir, unsigned long attrs);
59−void iommu_dma_unmap_resource(struct device *dev, dma_addr_t handle,
60− size_t size, enum dma_data_direction dir, unsigned long attrs);
22+void iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size);
6123
6224 /* The DMA API isn't _quite_ the whole story, though... */
6325 /*
@@ -75,16 +37,16 @@ void iommu_dma_compose_msi_msg(struct msi_desc *desc, · 11 unmodified lines
7537
7638 void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list);
7739
78−#else
40+#else /* CONFIG_IOMMU_DMA */
7941
8042 struct iommu_domain;
8143 struct msi_desc;
8244 struct msi_msg;
8345 struct device;
8446
85−static inline int iommu_dma_init(void)
47+static inline void iommu_setup_dma_ops(struct device *dev, u64 dma_base,
48+ u64 size)
8649 {
87− return 0;
8850 }
8951
9052 static inline int iommu_get_dma_cookie(struct iommu_domain *domain)
@@ -117,5 +79,4 @@ static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_he · 26 unmodified lines
11779 }
11880
11981 #endif /* CONFIG_IOMMU_DMA */
120−#endif /* __KERNEL__ */
12182 #endif /* __DMA_IOMMU_H */
include/linux/dma-mapping.h+14−7
@@ -679,6 +679,20 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) · 678 unmodified lines
679679 return dma_set_mask_and_coherent(dev, mask);
680680 }
681681
682+/**
683+ * dma_addressing_limited - return if the device is addressing limited
684+ * @dev: device to check
685+ *
686+ * Return %true if the devices DMA mask is too small to address all memory in
687+ * the system, else %false. Lack of addressing bits is the prime reason for
688+ * bounce buffering, but might not be the only one.
689+ */
690+static inline bool dma_addressing_limited(struct device *dev)
691+{
692+ return min_not_zero(dma_get_mask(dev), dev->bus_dma_mask) <
693+ dma_get_required_mask(dev);
694+}
695+
682696 #ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS
683697 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
684698 const struct iommu_ops *iommu, bool coherent);
@@ -729,13 +743,6 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) · 44 unmodified lines
729743 return -EIO;
730744 }
731745
732−#ifndef dma_max_pfn
733−static inline unsigned long dma_max_pfn(struct device *dev)
734−{
735− return (*dev->dma_mask >> PAGE_SHIFT) + dev->dma_pfn_offset;
736−}
737−#endif
738−
739746 static inline int dma_get_cache_alignment(void)
740747 {
741748 #ifdef ARCH_DMA_MINALIGN
include/linux/dma-noncoherent.h+19−0
@@ -20,6 +20,22 @@ static inline bool dev_is_dma_coherent(struct device *dev) · 19 unmodified lines
2020 }
2121 #endif /* CONFIG_ARCH_HAS_DMA_COHERENCE_H */
2222
23+/*
24+ * Check if an allocation needs to be marked uncached to be coherent.
25+ */
26+static __always_inline bool dma_alloc_need_uncached(struct device *dev,
27+ unsigned long attrs)
28+{
29+ if (dev_is_dma_coherent(dev))
30+ return false;
31+ if (attrs & DMA_ATTR_NO_KERNEL_MAPPING)
32+ return false;
33+ if (IS_ENABLED(CONFIG_DMA_NONCOHERENT_CACHE_SYNC) &&
34+ (attrs & DMA_ATTR_NON_CONSISTENT))
35+ return false;
36+ return true;
37+}
38+
2339 void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
2440 gfp_t gfp, unsigned long attrs);
2541 void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
@@ -80,4 +96,7 @@ static inline void arch_dma_prep_coherent(struct page *page, size_t size) · 54 unmodified lines
8096 }
8197 #endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */
8298
99+void *uncached_kernel_address(void *addr);
100+void *cached_kernel_address(void *addr);
101+
83102 #endif /* _LINUX_DMA_NONCOHERENT_H */
include/linux/dma/edma.h+47−0
@@ -0,0 +1,47 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Copyright (c) 2018-2019 Synopsys, Inc. and/or its affiliates.
4+ * Synopsys DesignWare eDMA core driver
5+ *
6+ * Author: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
7+ */
8+
9+#ifndef _DW_EDMA_H
10+#define _DW_EDMA_H
11+
12+#include <linux/device.h>
13+#include <linux/dmaengine.h>
14+
15+struct dw_edma;
16+
17+/**
18+ * struct dw_edma_chip - representation of DesignWare eDMA controller hardware
19+ * @dev: struct device of the eDMA controller
20+ * @id: instance ID
21+ * @irq: irq line
22+ * @dw: struct dw_edma that is filed by dw_edma_probe()
23+ */
24+struct dw_edma_chip {
25+ struct device *dev;
26+ int id;
27+ int irq;
28+ struct dw_edma *dw;
29+};
30+
31+/* Export to the platform drivers */
32+#if IS_ENABLED(CONFIG_DW_EDMA)
33+int dw_edma_probe(struct dw_edma_chip *chip);
34+int dw_edma_remove(struct dw_edma_chip *chip);
35+#else
36+static inline int dw_edma_probe(struct dw_edma_chip *chip)
37+{
38+ return -ENODEV;
39+}
40+
41+static inline int dw_edma_remove(struct dw_edma_chip *chip)
42+{
43+ return 0;
44+}
45+#endif /* CONFIG_DW_EDMA */
46+
47+#endif /* _DW_EDMA_H */
include/linux/dma/mxs-dma.h+24−0
@@ -0,0 +1,24 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _MXS_DMA_H_
3+#define _MXS_DMA_H_
4+
5+#include <linux/dmaengine.h>
6+
7+#define MXS_DMA_CTRL_WAIT4END BIT(31)
8+#define MXS_DMA_CTRL_WAIT4RDY BIT(30)
9+
10+/*
11+ * The mxs dmaengine can do PIO transfers. We pass a pointer to the PIO words
12+ * in the second argument to dmaengine_prep_slave_sg when the direction is
13+ * set to DMA_TRANS_NONE. To make this clear and to prevent users from doing
14+ * the error prone casting we have this wrapper function
15+ */
16+static inline struct dma_async_tx_descriptor *mxs_dmaengine_prep_pio(
17+ struct dma_chan *chan, u32 *pio, unsigned int npio,
18+ enum dma_transfer_direction dir, unsigned long flags)
19+{
20+ return dmaengine_prep_slave_sg(chan, (struct scatterlist *)pio, npio,
21+ dir, flags);
22+}
23+
24+#endif /* _MXS_DMA_H_ */
include/linux/dmaengine.h+8−4
@@ -1302,7 +1302,8 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); · 1301 unmodified lines
13021302 enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
13031303 void dma_issue_pending_all(void);
13041304 struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
1305− dma_filter_fn fn, void *fn_param);
1305+ dma_filter_fn fn, void *fn_param,
1306+ struct device_node *np);
13061307 struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name);
13071308
13081309 struct dma_chan *dma_request_chan(struct device *dev, const char *name);
@@ -1327,7 +1328,9 @@ static inline void dma_issue_pending_all(void) · 18 unmodified lines
13271328 {
13281329 }
13291330 static inline struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
1330− dma_filter_fn fn, void *fn_param)
1331+ dma_filter_fn fn,
1332+ void *fn_param,
1333+ struct device_node *np)
13311334 {
13321335 return NULL;
13331336 }
@@ -1399,7 +1402,8 @@ void dma_async_device_unregister(struct dma_device *device); · 65 unmodified lines
13991402 void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
14001403 struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
14011404 struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
1402−#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
1405+#define dma_request_channel(mask, x, y) \
1406+ __dma_request_channel(&(mask), x, y, NULL)
14031407 #define dma_request_slave_channel_compat(mask, x, y, dev, name) \
14041408 __dma_request_slave_channel_compat(&(mask), x, y, dev, name)
14051409
@@ -1417,6 +1421,6 @@ static inline struct dma_chan · 11 unmodified lines
14171421 if (!fn || !fn_param)
14181422 return NULL;
14191423
1420− return __dma_request_channel(mask, fn, fn_param);
1424+ return __dma_request_channel(mask, fn, fn_param, NULL);
14211425 }
14221426 #endif /* DMAENGINE_H */
include/linux/dmar.h+8−6
@@ -92,12 +92,14 @@ static inline bool dmar_rcu_check(void) · 91 unmodified lines
9292
9393 #define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check())
9494
95−#define for_each_dev_scope(a, c, p, d) \
96− for ((p) = 0; ((d) = (p) < (c) ? dmar_rcu_dereference((a)[(p)].dev) : \
97− NULL, (p) < (c)); (p)++)
98−
99−#define for_each_active_dev_scope(a, c, p, d) \
100− for_each_dev_scope((a), (c), (p), (d)) if (!(d)) { continue; } else
95+#define for_each_dev_scope(devs, cnt, i, tmp) \
96+ for ((i) = 0; ((tmp) = (i) < (cnt) ? \
97+ dmar_rcu_dereference((devs)[(i)].dev) : NULL, (i) < (cnt)); \
98+ (i)++)
99+
100+#define for_each_active_dev_scope(devs, cnt, i, tmp) \
101+ for_each_dev_scope((devs), (cnt), (i), (tmp)) \
102+ if (!(tmp)) { continue; } else
101103
102104 extern int dmar_table_init(void);
103105 extern int dmar_dev_scope_init(void);
include/linux/dns_resolver.h+2−1
@@ -26,7 +26,8 @@ · 25 unmodified lines
2626
2727 #include <uapi/linux/dns_resolver.h>
2828
29−extern int dns_query(const char *type, const char *name, size_t namelen,
29+struct net;
30+extern int dns_query(struct net *net, const char *type, const char *name, size_t namelen,
3031 const char *options, char **_result, time64_t *_expiry,
3132 bool invalidate);
3233
include/linux/dsa/8021q.h+7−9
@@ -20,9 +20,6 @@ int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, · 19 unmodified lines
2020 struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
2121 u16 tpid, u16 tci);
2222
23−struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev,
24− struct packet_type *pt, u16 *tpid, u16 *tci);
25−
2623 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port);
2724
2825 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port);
@@ -31,6 +28,8 @@ int dsa_8021q_rx_switch_id(u16 vid); · 2 unmodified lines
3128
3229 int dsa_8021q_rx_source_port(u16 vid);
3330
31+struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb);
32+
3433 #else
3534
3635 int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
@@ -45,12 +44,6 @@ struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, · 8 unmodified lines
4544 return NULL;
4645 }
4746
48−struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev,
49− struct packet_type *pt, u16 *tpid, u16 *tci)
50−{
51− return NULL;
52−}
53−
5447 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port)
5548 {
5649 return 0;
@@ -71,6 +64,11 @@ int dsa_8021q_rx_source_port(u16 vid) · 14 unmodified lines
7164 return 0;
7265 }
7366
67+struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb)
68+{
69+ return NULL;
70+}
71+
7472 #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */
7573
7674 #endif /* _NET_DSA_8021Q_H */
include/linux/dsa/sja1105.h+34−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <net/dsa.h>
1313
1414 #define ETH_P_SJA1105 ETH_P_DSA_8021Q
15+#define ETH_P_SJA1105_META 0x0008
1516
1617 /* IEEE 802.3 Annex 57A: Slow Protocols PDUs (01:80:C2:xx:xx:xx) */
1718 #define SJA1105_LINKLOCAL_FILTER_A 0x0180C2000000ull
@@ -20,8 +21,41 @@ · 2 unmodified lines
2021 #define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull
2122 #define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull
2223
24+/* Source and Destination MAC of follow-up meta frames.
25+ * Whereas the choice of SMAC only affects the unique identification of the
26+ * switch as sender of meta frames, the DMAC must be an address that is present
27+ * in the DSA master port's multicast MAC filter.
28+ * 01-80-C2-00-00-0E is a good choice for this, as all profiles of IEEE 1588
29+ * over L2 use this address for some purpose already.
30+ */
31+#define SJA1105_META_SMAC 0x222222222222ull
32+#define SJA1105_META_DMAC 0x0180C200000Eull
33+
34+/* Global tagger data: each struct sja1105_port has a reference to
35+ * the structure defined in struct sja1105_private.
36+ */
37+struct sja1105_tagger_data {
38+ struct sk_buff_head skb_rxtstamp_queue;
39+ struct work_struct rxtstamp_work;
40+ struct sk_buff *stampable_skb;
41+ /* Protects concurrent access to the meta state machine
42+ * from taggers running on multiple ports on SMP systems
43+ */
44+ spinlock_t meta_lock;
45+ bool hwts_rx_en;
46+};
47+
48+struct sja1105_skb_cb {
49+ u32 meta_tstamp;
50+};
51+
52+#define SJA1105_SKB_CB(skb) \
53+ ((struct sja1105_skb_cb *)DSA_SKB_CB_PRIV(skb))
54+
2355 struct sja1105_port {
56+ struct sja1105_tagger_data *data;
2457 struct dsa_port *dp;
58+ bool hwts_tx_en;
2559 int mgmt_slot;
2660 };
2761
include/linux/efi.h+10−0
@@ -689,6 +689,7 @@ void efi_native_runtime_setup(void); · 688 unmodified lines
689689 #define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f)
690690 #define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b)
691691 #define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa)
692+#define LINUX_EFI_TPM_FINAL_LOG_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25)
692693 #define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2)
693694
694695 typedef struct {
@@ -996,6 +997,7 @@ extern struct efi { · 301 unmodified lines
996997 unsigned long mem_attr_table; /* memory attributes table */
997998 unsigned long rng_seed; /* UEFI firmware random seed */
998999 unsigned long tpm_log; /* TPM2 Event Log table */
1000+ unsigned long tpm_final_log; /* TPM2 Final Events Log table */
9991001 unsigned long mem_reserve; /* Linux EFI memreserve table */
10001002 efi_get_time_t *get_time;
10011003 efi_set_time_t *set_time;
@@ -1706,12 +1708,20 @@ struct linux_efi_random_seed { · 704 unmodified lines
17061708
17071709 struct linux_efi_tpm_eventlog {
17081710 u32 size;
1711+ u32 final_events_preboot_size;
17091712 u8 version;
17101713 u8 log[];
17111714 };
17121715
17131716 extern int efi_tpm_eventlog_init(void);
17141717
1718+struct efi_tcg2_final_events_table {
1719+ u64 version;
1720+ u64 nr_events;
1721+ u8 events[];
1722+};
1723+extern int efi_tpm_final_log_size;
1724+
17151725 /*
17161726 * efi_runtime_service() function identifiers.
17171727 * "NONE" is used by efi_recover_from_page_fault() to check if the page
include/linux/elevator.h+2−12
@@ -34,7 +34,7 @@ struct elevator_mq_ops { · 33 unmodified lines
3434 void (*depth_updated)(struct blk_mq_hw_ctx *);
3535
3636 bool (*allow_merge)(struct request_queue *, struct request *, struct bio *);
37− bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *);
37+ bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *, unsigned int);
3838 int (*request_merge)(struct request_queue *q, struct request **, struct bio *);
3939 void (*request_merged)(struct request_queue *, struct request *, enum elv_merge);
4040 void (*requests_merged)(struct request_queue *, struct request *, struct request *);
@@ -45,7 +45,6 @@ struct elevator_mq_ops { · 4 unmodified lines
4545 struct request *(*dispatch_request)(struct blk_mq_hw_ctx *);
4646 bool (*has_work)(struct blk_mq_hw_ctx *);
4747 void (*completed_request)(struct request *, u64);
48− void (*started_request)(struct request *);
4948 void (*requeue_request)(struct request *);
5049 struct request *(*former_request)(struct request_queue *, struct request *);
5150 struct request *(*next_request)(struct request_queue *, struct request *);
@@ -75,7 +74,7 @@ struct elevator_type · 23 unmodified lines
7574 size_t icq_size; /* see iocontext.h */
7675 size_t icq_align; /* ditto */
7776 struct elv_fs_entry *elevator_attrs;
78− char elevator_name[ELV_NAME_MAX];
77+ const char *elevator_name;
7978 const char *elevator_alias;
8079 struct module *elevator_owner;
8180 #ifdef CONFIG_BLK_DEBUG_FS
@@ -160,15 +159,6 @@ extern struct request *elv_rb_find(struct rb_root *, sector_t); · 78 unmodified lines
160159 #define ELEVATOR_INSERT_FLUSH 5
161160 #define ELEVATOR_INSERT_SORT_MERGE 6
162161
163−/*
164− * return values from elevator_may_queue_fn
165− */
166−enum {
167− ELV_MQUEUE_MAY,
168− ELV_MQUEUE_NO,
169− ELV_MQUEUE_MUST,
170−};
171−
172162 #define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq))
173163 #define rb_entry_rq(node) rb_entry((node), struct request, rb_node)
174164
include/linux/energy_model.h+1−1
@@ -89,7 +89,7 @@ static inline unsigned long em_pd_energy(struct em_perf_domain *pd, · 88 unmodified lines
8989 * like schedutil.
9090 */
9191 cpu = cpumask_first(to_cpumask(pd->cpus));
92− scale_cpu = arch_scale_cpu_capacity(NULL, cpu);
92+ scale_cpu = arch_scale_cpu_capacity(cpu);
9393 cs = &pd->table[pd->nr_cap_states - 1];
9494 freq = map_util_freq(max_util, cs->frequency, scale_cpu);
9595
include/linux/fault-inject.h+1−1
@@ -11,7 +11,7 @@ · 10 unmodified lines
1111
1212 /*
1313 * For explanation of the elements of this struct, see
14− * Documentation/fault-injection/fault-injection.txt
14+ * Documentation/fault-injection/fault-injection.rst
1515 */
1616 struct fault_attr {
1717 unsigned long probability;
include/linux/fb.h+12−33
@@ -126,39 +126,15 @@ struct fb_cursor_user { · 125 unmodified lines
126126
127127 /* The resolution of the passed in fb_info about to change */
128128 #define FB_EVENT_MODE_CHANGE 0x01
129−/* The display on this fb_info is being suspended, no access to the
130− * framebuffer is allowed any more after that call returns
131− */
132−#define FB_EVENT_SUSPEND 0x02
133−/* The display on this fb_info was resumed, you can restore the display
134− * if you own it
135− */
136−#define FB_EVENT_RESUME 0x03
137−/* An entry from the modelist was removed */
138−#define FB_EVENT_MODE_DELETE 0x04
139−/* A driver registered itself */
129+
130+#ifdef CONFIG_GUMSTIX_AM200EPD
131+/* only used by mach-pxa/am200epd.c */
140132 #define FB_EVENT_FB_REGISTERED 0x05
141−/* A driver unregistered itself */
142133 #define FB_EVENT_FB_UNREGISTERED 0x06
143−/* CONSOLE-SPECIFIC: get console to framebuffer mapping */
144−#define FB_EVENT_GET_CONSOLE_MAP 0x07
145−/* CONSOLE-SPECIFIC: set console to framebuffer mapping */
146−#define FB_EVENT_SET_CONSOLE_MAP 0x08
147−/* A hardware display blank change occurred */
134+#endif
135+
136+/* A display blank is requested */
148137 #define FB_EVENT_BLANK 0x09
149−/* Private modelist is to be replaced */
150−#define FB_EVENT_NEW_MODELIST 0x0A
151−/* The resolution of the passed in fb_info about to change and
152− all vc's should be changed */
153−#define FB_EVENT_MODE_CHANGE_ALL 0x0B
154−/* A software display blank change occurred */
155−#define FB_EVENT_CONBLANK 0x0C
156−/* Get drawing requirements */
157−#define FB_EVENT_GET_REQ 0x0D
158−/* Unbind from the console if possible */
159−#define FB_EVENT_FB_UNBIND 0x0E
160−/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
161−#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
162138 /* A hardware display blank early change occurred */
163139 #define FB_EARLY_EVENT_BLANK 0x10
164140 /* A hardware display blank revert early change occurred */
@@ -633,8 +609,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, · 468 unmodified lines
633609
634610 /* drivers/video/fbmem.c */
635611 extern int register_framebuffer(struct fb_info *fb_info);
636−extern int unregister_framebuffer(struct fb_info *fb_info);
637−extern int unlink_framebuffer(struct fb_info *fb_info);
612+extern void unregister_framebuffer(struct fb_info *fb_info);
613+extern void unlink_framebuffer(struct fb_info *fb_info);
638614 extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id,
639615 const char *name);
640616 extern int remove_conflicting_framebuffers(struct apertures_struct *a,
@@ -660,7 +636,10 @@ extern struct class *fb_class; · 19 unmodified lines
660636 for (i = 0; i < FB_MAX; i++) \
661637 if (!registered_fb[i]) {} else
662638
663−extern int lock_fb_info(struct fb_info *info);
639+static inline void lock_fb_info(struct fb_info *info)
640+{
641+ mutex_lock(&info->lock);
642+}
664643
665644 static inline void unlock_fb_info(struct fb_info *info)
666645 {
include/linux/fbcon.h+30−0
@@ -4,9 +4,39 @@ · 3 unmodified lines
44 #ifdef CONFIG_FRAMEBUFFER_CONSOLE
55 void __init fb_console_init(void);
66 void __exit fb_console_exit(void);
7+int fbcon_fb_registered(struct fb_info *info);
8+void fbcon_fb_unregistered(struct fb_info *info);
9+void fbcon_fb_unbind(struct fb_info *info);
10+void fbcon_suspended(struct fb_info *info);
11+void fbcon_resumed(struct fb_info *info);
12+int fbcon_mode_deleted(struct fb_info *info,
13+ struct fb_videomode *mode);
14+void fbcon_new_modelist(struct fb_info *info);
15+void fbcon_get_requirement(struct fb_info *info,
16+ struct fb_blit_caps *caps);
17+void fbcon_fb_blanked(struct fb_info *info, int blank);
18+void fbcon_update_vcs(struct fb_info *info, bool all);
19+void fbcon_remap_all(struct fb_info *info);
20+int fbcon_set_con2fb_map_ioctl(void __user *argp);
21+int fbcon_get_con2fb_map_ioctl(void __user *argp);
722 #else
823 static inline void fb_console_init(void) {}
924 static inline void fb_console_exit(void) {}
25+static inline int fbcon_fb_registered(struct fb_info *info) { return 0; }
26+static inline void fbcon_fb_unregistered(struct fb_info *info) {}
27+static inline void fbcon_fb_unbind(struct fb_info *info) {}
28+static inline void fbcon_suspended(struct fb_info *info) {}
29+static inline void fbcon_resumed(struct fb_info *info) {}
30+static inline int fbcon_mode_deleted(struct fb_info *info,
31+ struct fb_videomode *mode) { return 0; }
32+static inline void fbcon_new_modelist(struct fb_info *info) {}
33+static inline void fbcon_get_requirement(struct fb_info *info,
34+ struct fb_blit_caps *caps) {}
35+static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {}
36+static inline void fbcon_update_vcs(struct fb_info *info, bool all) {}
37+static inline void fbcon_remap_all(struct fb_info *info) {}
38+static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; }
39+static inline int fbcon_get_con2fb_map_ioctl(void __user *argp) { return 0; }
1040 #endif
1141
1242 #endif /* _LINUX_FBCON_H */
include/linux/filter.h+48−2
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424
2525 #include <net/sch_generic.h>
2626
27+#include <asm/byteorder.h>
2728 #include <uapi/linux/filter.h>
2829 #include <uapi/linux/bpf.h>
2930
@@ -160,6 +161,20 @@ struct ctl_table_header; · 130 unmodified lines
160161 .off = 0, \
161162 .imm = IMM })
162163
164+/* Special form of mov32, used for doing explicit zero extension on dst. */
165+#define BPF_ZEXT_REG(DST) \
166+ ((struct bpf_insn) { \
167+ .code = BPF_ALU | BPF_MOV | BPF_X, \
168+ .dst_reg = DST, \
169+ .src_reg = DST, \
170+ .off = 0, \
171+ .imm = 1 })
172+
173+static inline bool insn_is_zext(const struct bpf_insn *insn)
174+{
175+ return insn->code == (BPF_ALU | BPF_MOV | BPF_X) && insn->imm == 1;
176+}
177+
163178 /* BPF_LD_IMM64 macro encodes single 'load 64-bit immediate' insn */
164179 #define BPF_LD_IMM64(DST, IMM) \
165180 BPF_LD_IMM64_RAW(DST, 0, IMM)
@@ -512,7 +527,8 @@ struct bpf_prog { · 346 unmodified lines
512527 blinded:1, /* Was blinded */
513528 is_func:1, /* program is a bpf function */
514529 kprobe_override:1, /* Do we override a kprobe? */
515− has_callchain_buf:1; /* callchain buffer allocated? */
530+ has_callchain_buf:1, /* callchain buffer allocated? */
531+ enforce_expected_attach_type:1; /* Enforce expected_attach_type checking at attach time */
516532 enum bpf_prog_type type; /* Type of BPF program */
517533 enum bpf_attach_type expected_attach_type; /* For some prog types */
518534 u32 len; /* Number of filter blocks */
@@ -563,8 +579,9 @@ struct bpf_skb_data_end { · 44 unmodified lines
563579 };
564580
565581 struct bpf_redirect_info {
566− u32 ifindex;
567582 u32 flags;
583+ u32 tgt_index;
584+ void *tgt_value;
568585 struct bpf_map *map;
569586 struct bpf_map *map_to_flush;
570587 u32 kern_flags;
@@ -731,6 +748,24 @@ bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default) · 160 unmodified lines
731748 return size <= size_default && (size & (size - 1)) == 0;
732749 }
733750
751+static inline u8
752+bpf_ctx_narrow_load_shift(u32 off, u32 size, u32 size_default)
753+{
754+ u8 load_off = off & (size_default - 1);
755+
756+#ifdef __LITTLE_ENDIAN
757+ return load_off * 8;
758+#else
759+ return (size_default - (load_off + size)) * 8;
760+#endif
761+}
762+
763+#define bpf_ctx_wide_access_ok(off, size, type, field) \
764+ (size == sizeof(__u64) && \
765+ off >= offsetof(type, field) && \
766+ off + sizeof(__u64) <= offsetofend(type, field) && \
767+ off % sizeof(__u64) == 0)
768+
734769 #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
735770
736771 static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
@@ -811,6 +846,7 @@ u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); · 74 unmodified lines
811846
812847 struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog);
813848 void bpf_jit_compile(struct bpf_prog *prog);
849+bool bpf_jit_needs_zext(void);
814850 bool bpf_helper_changes_pkt_data(void *func);
815851
816852 static inline bool bpf_dump_raw_ok(void)
@@ -1183,4 +1219,14 @@ struct bpf_sysctl_kern { · 366 unmodified lines
11831219 u64 tmp_reg;
11841220 };
11851221
1222+struct bpf_sockopt_kern {
1223+ struct sock *sk;
1224+ u8 *optval;
1225+ u8 *optval_end;
1226+ s32 level;
1227+ s32 optname;
1228+ s32 optlen;
1229+ s32 retval;
1230+};
1231+
11861232 #endif /* __LINUX_FILTER_H__ */
include/linux/firmware/xlnx-zynqmp.h+0−1
@@ -46,7 +46,6 @@ · 45 unmodified lines
4646 #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U
4747 #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U
4848 #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U
49−#define ZYNQMP_PM_CAPABILITY_POWER 0x8U
5049
5150 /*
5251 * Firmware FPGA Manager flags
include/linux/flat.h+42−16
@@ -10,8 +10,41 @@ · 9 unmodified lines
1010 #ifndef _LINUX_FLAT_H
1111 #define _LINUX_FLAT_H
1212
13−#include <uapi/linux/flat.h>
14−#include <asm/flat.h>
13+#define FLAT_VERSION 0x00000004L
14+
15+/*
16+ * To make everything easier to port and manage cross platform
17+ * development, all fields are in network byte order.
18+ */
19+
20+struct flat_hdr {
21+ char magic[4];
22+ __be32 rev; /* version (as above) */
23+ __be32 entry; /* Offset of first executable instruction
24+ with text segment from beginning of file */
25+ __be32 data_start; /* Offset of data segment from beginning of
26+ file */
27+ __be32 data_end; /* Offset of end of data segment from beginning
28+ of file */
29+ __be32 bss_end; /* Offset of end of bss segment from beginning
30+ of file */
31+
32+ /* (It is assumed that data_end through bss_end forms the bss segment.) */
33+
34+ __be32 stack_size; /* Size of stack, in bytes */
35+ __be32 reloc_start; /* Offset of relocation records from beginning of
36+ file */
37+ __be32 reloc_count; /* Number of relocation records */
38+ __be32 flags;
39+ __be32 build_date; /* When the program/library was built */
40+ __u32 filler[5]; /* Reservered, set to zero */
41+};
42+
43+#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */
44+#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
45+#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */
46+#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
47+#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
1548
1649 /*
1750 * While it would be nice to keep this header clean, users of older
@@ -22,28 +55,21 @@ · 4 unmodified lines
2255 * with the format above, except to fix bugs with old format support.
2356 */
2457
25−#include <asm/byteorder.h>
26−
2758 #define OLD_FLAT_VERSION 0x00000002L
2859 #define OLD_FLAT_RELOC_TYPE_TEXT 0
2960 #define OLD_FLAT_RELOC_TYPE_DATA 1
3061 #define OLD_FLAT_RELOC_TYPE_BSS 2
3162
3263 typedef union {
33− unsigned long value;
64+ u32 value;
3465 struct {
35−# if defined(mc68000) && !defined(CONFIG_COLDFIRE)
36− signed long offset : 30;
37− unsigned long type : 2;
38−# define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */
66+#if defined(__LITTLE_ENDIAN_BITFIELD) || \
67+ (defined(mc68000) && !defined(CONFIG_COLDFIRE))
68+ s32 offset : 30;
69+ u32 type : 2;
3970 # elif defined(__BIG_ENDIAN_BITFIELD)
40− unsigned long type : 2;
41− signed long offset : 30;
42−# define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */
43−# elif defined(__LITTLE_ENDIAN_BITFIELD)
44− signed long offset : 30;
45− unsigned long type : 2;
46−# define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */
71+ u32 type : 2;
72+ s32 offset : 30;
4773 # else
4874 # error "Unknown bitfield order for flat files."
4975 # endif
include/linux/fmc-sdb.h+0−39
@@ -1,39 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
2−/*
3− * This file is separate from sdb.h, because I want that one to remain
4− * unchanged (as far as possible) from the official sdb distribution
5− *
6− * This file and associated functionality are a playground for me to
7− * understand stuff which will later be implemented in more generic places.
8− */
9−#include <linux/sdb.h>
10−
11−/* This is the union of all currently defined types */
12−union sdb_record {
13− struct sdb_interconnect ic;
14− struct sdb_device dev;
15− struct sdb_bridge bridge;
16− struct sdb_integration integr;
17− struct sdb_empty empty;
18− struct sdb_synthesis synthesis;
19− struct sdb_repo_url repo_url;
20−};
21−
22−struct fmc_device;
23−
24−/* Every sdb table is turned into this structure */
25−struct sdb_array {
26− int len;
27− int level;
28− unsigned long baseaddr;
29− struct fmc_device *fmc; /* the device that hosts it */
30− struct sdb_array *parent; /* NULL at root */
31− union sdb_record *record; /* copies of the struct */
32− struct sdb_array **subtree; /* only valid for bridge items */
33−};
34−
35−extern int fmc_scan_sdb_tree(struct fmc_device *fmc, unsigned long address);
36−extern void fmc_show_sdb_tree(const struct fmc_device *fmc);
37−extern signed long fmc_find_sdb_device(struct sdb_array *tree, uint64_t vendor,
38− uint32_t device, unsigned long *sz);
39−extern int fmc_free_sdb_tree(struct fmc_device *fmc);
include/linux/fmc.h+0−269
@@ -1,269 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0-or-later */
2−/*
3− * Copyright (C) 2012 CERN (www.cern.ch)
4− * Author: Alessandro Rubini <rubini@gnudd.com>
5− *
6− * This work is part of the White Rabbit project, a research effort led
7− * by CERN, the European Institute for Nuclear Research.
8− */
9−#ifndef __LINUX_FMC_H__
10−#define __LINUX_FMC_H__
11−#include <linux/types.h>
12−#include <linux/moduleparam.h>
13−#include <linux/device.h>
14−#include <linux/list.h>
15−#include <linux/interrupt.h>
16−#include <linux/io.h>
17−
18−struct fmc_device;
19−struct fmc_driver;
20−
21−/*
22− * This bus abstraction is developed separately from drivers, so we need
23− * to check the version of the data structures we receive.
24− */
25−
26−#define FMC_MAJOR 3
27−#define FMC_MINOR 0
28−#define FMC_VERSION ((FMC_MAJOR << 16) | FMC_MINOR)
29−#define __FMC_MAJOR(x) ((x) >> 16)
30−#define __FMC_MINOR(x) ((x) & 0xffff)
31−
32−/*
33− * The device identification, as defined by the IPMI FRU (Field Replaceable
34− * Unit) includes four different strings to describe the device. Here we
35− * only match the "Board Manufacturer" and the "Board Product Name",
36− * ignoring the "Board Serial Number" and "Board Part Number". All 4 are
37− * expected to be strings, so they are treated as zero-terminated C strings.
38− * Unspecified string (NULL) means "any", so if both are unspecified this
39− * is a catch-all driver. So null entries are allowed and we use array
40− * and length. This is unlike pci and usb that use null-terminated arrays
41− */
42−struct fmc_fru_id {
43− char *manufacturer;
44− char *product_name;
45−};
46−
47−/*
48− * If the FPGA is already programmed (think Etherbone or the second
49− * SVEC slot), we can match on SDB devices in the memory image. This
50− * match uses an array of devices that must all be present, and the
51− * match is based on vendor and device only. Further checks are expected
52− * to happen in the probe function. Zero means "any" and catch-all is allowed.
53− */
54−struct fmc_sdb_one_id {
55− uint64_t vendor;
56− uint32_t device;
57−};
58−struct fmc_sdb_id {
59− struct fmc_sdb_one_id *cores;
60− int cores_nr;
61−};
62−
63−struct fmc_device_id {
64− struct fmc_fru_id *fru_id;
65− int fru_id_nr;
66− struct fmc_sdb_id *sdb_id;
67− int sdb_id_nr;
68−};
69−
70−/* This sizes the module_param_array used by generic module parameters */
71−#define FMC_MAX_CARDS 32
72−
73−/* The driver is a pretty simple thing */
74−struct fmc_driver {
75− unsigned long version;
76− struct device_driver driver;
77− int (*probe)(struct fmc_device *);
78− int (*remove)(struct fmc_device *);
79− const struct fmc_device_id id_table;
80− /* What follows is for generic module parameters */
81− int busid_n;
82− int busid_val[FMC_MAX_CARDS];
83− int gw_n;
84− char *gw_val[FMC_MAX_CARDS];
85−};
86−#define to_fmc_driver(x) container_of((x), struct fmc_driver, driver)
87−
88−/* These are the generic parameters, that drivers may instantiate */
89−#define FMC_PARAM_BUSID(_d) \
90− module_param_array_named(busid, _d.busid_val, int, &_d.busid_n, 0444)
91−#define FMC_PARAM_GATEWARE(_d) \
92− module_param_array_named(gateware, _d.gw_val, charp, &_d.gw_n, 0444)
93−
94−/*
95− * Drivers may need to configure gpio pins in the carrier. To read input
96− * (a very uncommon operation, and definitely not in the hot paths), just
97− * configure one gpio only and get 0 or 1 as retval of the config method
98− */
99−struct fmc_gpio {
100− char *carrier_name; /* name or NULL for virtual pins */
101− int gpio;
102− int _gpio; /* internal use by the carrier */
103− int mode; /* GPIOF_DIR_OUT etc, from <linux/gpio.h> */
104− int irqmode; /* IRQF_TRIGGER_LOW and so on */
105−};
106−
107−/* The numbering of gpio pins allows access to raw pins or virtual roles */
108−#define FMC_GPIO_RAW(x) (x) /* 4096 of them */
109−#define __FMC_GPIO_IS_RAW(x) ((x) < 0x1000)
110−#define FMC_GPIO_IRQ(x) ((x) + 0x1000) /* 256 of them */
111−#define FMC_GPIO_LED(x) ((x) + 0x1100) /* 256 of them */
112−#define FMC_GPIO_KEY(x) ((x) + 0x1200) /* 256 of them */
113−#define FMC_GPIO_TP(x) ((x) + 0x1300) /* 256 of them */
114−#define FMC_GPIO_USER(x) ((x) + 0x1400) /* 256 of them */
115−/* We may add SCL and SDA, or other roles if the need arises */
116−
117−/* GPIOF_DIR_IN etc are missing before 3.0. copy from <linux/gpio.h> */
118−#ifndef GPIOF_DIR_IN
119−# define GPIOF_DIR_OUT (0 << 0)
120−# define GPIOF_DIR_IN (1 << 0)
121−# define GPIOF_INIT_LOW (0 << 1)
122−# define GPIOF_INIT_HIGH (1 << 1)
123−#endif
124−
125−/*
126− * The operations are offered by each carrier and should make driver
127− * design completely independent of the carrier. Named GPIO pins may be
128− * the exception.
129− */
130−struct fmc_operations {
131− uint32_t (*read32)(struct fmc_device *fmc, int offset);
132− void (*write32)(struct fmc_device *fmc, uint32_t value, int offset);
133− int (*validate)(struct fmc_device *fmc, struct fmc_driver *drv);
134− int (*reprogram_raw)(struct fmc_device *f, struct fmc_driver *d,
135− void *gw, unsigned long len);
136− int (*reprogram)(struct fmc_device *f, struct fmc_driver *d, char *gw);
137− int (*irq_request)(struct fmc_device *fmc, irq_handler_t h,
138− char *name, int flags);
139− void (*irq_ack)(struct fmc_device *fmc);
140− int (*irq_free)(struct fmc_device *fmc);
141− int (*gpio_config)(struct fmc_device *fmc, struct fmc_gpio *gpio,
142− int ngpio);
143− int (*read_ee)(struct fmc_device *fmc, int pos, void *d, int l);
144− int (*write_ee)(struct fmc_device *fmc, int pos, const void *d, int l);
145−};
146−
147−/* Prefer this helper rather than calling of fmc->reprogram directly */
148−int fmc_reprogram_raw(struct fmc_device *fmc, struct fmc_driver *d,
149− void *gw, unsigned long len, int sdb_entry);
150−extern int fmc_reprogram(struct fmc_device *f, struct fmc_driver *d, char *gw,
151− int sdb_entry);
152−
153−/*
154− * The device reports all information needed to access hw.
155− *
156− * If we have eeprom_len and not contents, the core reads it.
157− * Then, parsing of identifiers is done by the core which fills fmc_fru_id..
158− * Similarly a device that must be matched based on SDB cores must
159− * fill the entry point and the core will scan the bus (FIXME: sdb match)
160− */
161−struct fmc_device {
162− unsigned long version;
163− unsigned long flags;
164− struct module *owner; /* char device must pin it */
165− struct fmc_fru_id id; /* for EEPROM-based match */
166− struct fmc_operations *op; /* carrier-provided */
167− int irq; /* according to host bus. 0 == none */
168− int eeprom_len; /* Usually 8kB, may be less */
169− int eeprom_addr; /* 0x50, 0x52 etc */
170− uint8_t *eeprom; /* Full contents or leading part */
171− char *carrier_name; /* "SPEC" or similar, for special use */
172− void *carrier_data; /* "struct spec *" or equivalent */
173− __iomem void *fpga_base; /* May be NULL (Etherbone) */
174− __iomem void *slot_base; /* Set by the driver */
175− struct fmc_device **devarray; /* Allocated by the bus */
176− int slot_id; /* Index in the slot array */
177− int nr_slots; /* Number of slots in this carrier */
178− unsigned long memlen; /* Used for the char device */
179− struct device dev; /* For Linux use */
180− struct device *hwdev; /* The underlying hardware device */
181− unsigned long sdbfs_entry;
182− struct sdb_array *sdb;
183− uint32_t device_id; /* Filled by the device */
184− char *mezzanine_name; /* Defaults to ``fmc'' */
185− void *mezzanine_data;
186−
187− struct dentry *dbg_dir;
188− struct dentry *dbg_sdb_dump;
189−};
190−#define to_fmc_device(x) container_of((x), struct fmc_device, dev)
191−
192−#define FMC_DEVICE_HAS_GOLDEN 1
193−#define FMC_DEVICE_HAS_CUSTOM 2
194−#define FMC_DEVICE_NO_MEZZANINE 4
195−#define FMC_DEVICE_MATCH_SDB 8 /* fmc-core must scan sdb in fpga */
196−
197−/*
198− * If fpga_base can be used, the carrier offers no readl/writel methods, and
199− * this expands to a single, fast, I/O access.
200− */
201−static inline uint32_t fmc_readl(struct fmc_device *fmc, int offset)
202−{
203− if (unlikely(fmc->op->read32))
204− return fmc->op->read32(fmc, offset);
205− return readl(fmc->fpga_base + offset);
206−}
207−static inline void fmc_writel(struct fmc_device *fmc, uint32_t val, int off)
208−{
209− if (unlikely(fmc->op->write32))
210− fmc->op->write32(fmc, val, off);
211− else
212− writel(val, fmc->fpga_base + off);
213−}
214−
215−/* pci-like naming */
216−static inline void *fmc_get_drvdata(const struct fmc_device *fmc)
217−{
218− return dev_get_drvdata(&fmc->dev);
219−}
220−
221−static inline void fmc_set_drvdata(struct fmc_device *fmc, void *data)
222−{
223− dev_set_drvdata(&fmc->dev, data);
224−}
225−
226−struct fmc_gateware {
227− void *bitstream;
228− unsigned long len;
229−};
230−
231−/* The 5 access points */
232−extern int fmc_driver_register(struct fmc_driver *drv);
233−extern void fmc_driver_unregister(struct fmc_driver *drv);
234−extern int fmc_device_register(struct fmc_device *tdev);
235−extern int fmc_device_register_gw(struct fmc_device *tdev,
236− struct fmc_gateware *gw);
237−extern void fmc_device_unregister(struct fmc_device *tdev);
238−
239−/* Three more for device sets, all driven by the same FPGA */
240−extern int fmc_device_register_n(struct fmc_device **devs, int n);
241−extern int fmc_device_register_n_gw(struct fmc_device **devs, int n,
242− struct fmc_gateware *gw);
243−extern void fmc_device_unregister_n(struct fmc_device **devs, int n);
244−
245−/* Internal cross-calls between files; not exported to other modules */
246−extern int fmc_match(struct device *dev, struct device_driver *drv);
247−extern int fmc_fill_id_info(struct fmc_device *fmc);
248−extern void fmc_free_id_info(struct fmc_device *fmc);
249−extern void fmc_dump_eeprom(const struct fmc_device *fmc);
250−
251−/* helpers for FMC operations */
252−extern int fmc_irq_request(struct fmc_device *fmc, irq_handler_t h,
253− char *name, int flags);
254−extern void fmc_irq_free(struct fmc_device *fmc);
255−extern void fmc_irq_ack(struct fmc_device *fmc);
256−extern int fmc_validate(struct fmc_device *fmc, struct fmc_driver *drv);
257−extern int fmc_gpio_config(struct fmc_device *fmc, struct fmc_gpio *gpio,
258− int ngpio);
259−extern int fmc_read_ee(struct fmc_device *fmc, int pos, void *d, int l);
260−extern int fmc_write_ee(struct fmc_device *fmc, int pos, const void *d, int l);
261−
262−/* helpers for FMC operations */
263−extern int fmc_irq_request(struct fmc_device *fmc, irq_handler_t h,
264− char *name, int flags);
265−extern void fmc_irq_free(struct fmc_device *fmc);
266−extern void fmc_irq_ack(struct fmc_device *fmc);
267−extern int fmc_validate(struct fmc_device *fmc, struct fmc_driver *drv);
268−
269−#endif /* __LINUX_FMC_H__ */
include/linux/fpga/adi-axi-common.h+19−0
@@ -0,0 +1,19 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Analog Devices AXI common registers & definitions
4+ *
5+ * Copyright 2019 Analog Devices Inc.
6+ *
7+ * https://wiki.analog.com/resources/fpga/docs/axi_ip
8+ * https://wiki.analog.com/resources/fpga/docs/hdl/regmap
9+ */
10+
11+#ifndef ADI_AXI_COMMON_H_
12+#define ADI_AXI_COMMON_H_
13+
14+#define ADI_AXI_REG_VERSION 0x0000
15+
16+#define ADI_AXI_PCORE_VER(major, minor, patch) \
17+ (((major) << 16) | ((minor) << 8) | (patch))
18+
19+#endif /* ADI_AXI_COMMON_H_ */
include/linux/fs.h+33−26
@@ -694,7 +694,7 @@ struct inode { · 693 unmodified lines
694694 atomic_t i_count;
695695 atomic_t i_dio_count;
696696 atomic_t i_writecount;
697−#ifdef CONFIG_IMA
697+#if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING)
698698 atomic_t i_readcount; /* struct files open RO */
699699 #endif
700700 union {
@@ -1019,8 +1019,6 @@ struct file_lock_operations { · 318 unmodified lines
10191019 };
10201020
10211021 struct lock_manager_operations {
1022− int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
1023− unsigned long (*lm_owner_key)(struct file_lock *);
10241022 fl_owner_t (*lm_get_owner)(fl_owner_t);
10251023 void (*lm_put_owner)(fl_owner_t);
10261024 void (*lm_notify)(struct file_lock *); /* unblock callback */
@@ -1769,7 +1767,7 @@ struct block_device_operations; · 742 unmodified lines
17691767 /*
17701768 * These flags control the behavior of the remap_file_range function pointer.
17711769 * If it is called with len == 0 that means "remap to end of source file".
1772− * See Documentation/filesystems/vfs.txt for more details about this call.
1770+ * See Documentation/filesystems/vfs.rst for more details about this call.
17731771 *
17741772 * REMAP_FILE_DEDUP: only remap if contents identical (i.e. deduplicate)
17751773 * REMAP_FILE_CAN_SHORTEN: caller can handle a shortened request
@@ -1889,6 +1887,9 @@ extern ssize_t vfs_readv(struct file *, const struct iovec __user *, · 113 unmodified lines
18891887 unsigned long, loff_t *, rwf_t);
18901888 extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *,
18911889 loff_t, size_t, unsigned int);
1890+extern ssize_t generic_copy_file_range(struct file *file_in, loff_t pos_in,
1891+ struct file *file_out, loff_t pos_out,
1892+ size_t len, unsigned int flags);
18921893 extern int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
18931894 struct file *file_out, loff_t pos_out,
18941895 loff_t *count,
@@ -2174,6 +2175,8 @@ static inline void file_accessed(struct file *file) · 279 unmodified lines
21742175 touch_atime(&file->f_path);
21752176 }
21762177
2178+extern int file_modified(struct file *file);
2179+
21772180 int sync_inode(struct inode *inode, struct writeback_control *wbc);
21782181 int sync_inode_metadata(struct inode *inode, int wait);
21792182
@@ -2184,6 +2187,7 @@ struct file_system_type { · 4 unmodified lines
21842187 #define FS_BINARY_MOUNTDATA 2
21852188 #define FS_HAS_SUBTYPE 4
21862189 #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */
2190+#define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */
21872191 #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
21882192 int (*init_fs_context)(struct fs_context *);
21892193 const struct fs_parameter_description *parameters;
@@ -2206,9 +2210,6 @@ struct file_system_type { · 16 unmodified lines
22062210
22072211 #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
22082212
2209−extern struct dentry *mount_ns(struct file_system_type *fs_type,
2210− int flags, void *data, void *ns, struct user_namespace *user_ns,
2211− int (*fill_super)(struct super_block *, void *, int));
22122213 #ifdef CONFIG_BLOCK
22132214 extern struct dentry *mount_bdev(struct file_system_type *fs_type,
22142215 int flags, const char *dev_name, void *data,
@@ -2248,28 +2249,10 @@ void free_anon_bdev(dev_t); · 33 unmodified lines
22482249 struct super_block *sget_fc(struct fs_context *fc,
22492250 int (*test)(struct super_block *, struct fs_context *),
22502251 int (*set)(struct super_block *, struct fs_context *));
2251−struct super_block *sget_userns(struct file_system_type *type,
2252− int (*test)(struct super_block *,void *),
2253− int (*set)(struct super_block *,void *),
2254− int flags, struct user_namespace *user_ns,
2255− void *data);
22562252 struct super_block *sget(struct file_system_type *type,
22572253 int (*test)(struct super_block *,void *),
22582254 int (*set)(struct super_block *,void *),
22592255 int flags, void *data);
2260−extern struct dentry *mount_pseudo_xattr(struct file_system_type *, char *,
2261− const struct super_operations *ops,
2262− const struct xattr_handler **xattr,
2263− const struct dentry_operations *dops,
2264− unsigned long);
2265−
2266−static inline struct dentry *
2267−mount_pseudo(struct file_system_type *fs_type, char *name,
2268− const struct super_operations *ops,
2269− const struct dentry_operations *dops, unsigned long magic)
2270−{
2271− return mount_pseudo_xattr(fs_type, name, ops, NULL, dops, magic);
2272−}
22732256
22742257 /* Alas, no aliases. Too much hassle with bringing module.h everywhere */
22752258 #define fops_get(fops) \
@@ -2615,6 +2598,12 @@ extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, · 339 unmodified lines
26152598 void *holder);
26162599 extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode,
26172600 void *holder);
2601+extern struct block_device *bd_start_claiming(struct block_device *bdev,
2602+ void *holder);
2603+extern void bd_finish_claiming(struct block_device *bdev,
2604+ struct block_device *whole, void *holder);
2605+extern void bd_abort_claiming(struct block_device *bdev,
2606+ struct block_device *whole, void *holder);
26182607 extern void blkdev_put(struct block_device *bdev, fmode_t mode);
26192608 extern int __blkdev_reread_part(struct block_device *bdev);
26202609 extern int blkdev_reread_part(struct block_device *bdev);
@@ -2712,6 +2701,8 @@ extern int filemap_flush(struct address_space *); · 91 unmodified lines
27122701 extern int filemap_fdatawait_keep_errors(struct address_space *mapping);
27132702 extern int filemap_fdatawait_range(struct address_space *, loff_t lstart,
27142703 loff_t lend);
2704+extern int filemap_fdatawait_range_keep_errors(struct address_space *mapping,
2705+ loff_t start_byte, loff_t end_byte);
27152706
27162707 static inline int filemap_fdatawait(struct address_space *mapping)
27172708 {
@@ -2890,7 +2881,7 @@ static inline bool inode_is_open_for_write(const struct inode *inode) · 172 unmodified lines
28902881 return atomic_read(&inode->i_writecount) > 0;
28912882 }
28922883
2893−#ifdef CONFIG_IMA
2884+#if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING)
28942885 static inline void i_readcount_dec(struct inode *inode)
28952886 {
28962887 BUG_ON(!atomic_read(&inode->i_readcount));
@@ -3046,6 +3037,10 @@ extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *); · 149 unmodified lines
30463037 extern int generic_remap_checks(struct file *file_in, loff_t pos_in,
30473038 struct file *file_out, loff_t pos_out,
30483039 loff_t *count, unsigned int remap_flags);
3040+extern int generic_file_rw_checks(struct file *file_in, struct file *file_out);
3041+extern int generic_copy_file_checks(struct file *file_in, loff_t pos_in,
3042+ struct file *file_out, loff_t pos_out,
3043+ size_t *count, unsigned int flags);
30493044 extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);
30503045 extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *);
30513046 extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *);
@@ -3546,4 +3541,16 @@ static inline struct sock *io_uring_get_socket(struct file *file) · 494 unmodified lines
35463541 }
35473542 #endif
35483543
3544+int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags,
3545+ unsigned int flags);
3546+
3547+int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa,
3548+ struct fsxattr *fa);
3549+
3550+static inline void simple_fill_fsxattr(struct fsxattr *fa, __u32 xflags)
3551+{
3552+ memset(fa, 0, sizeof(*fa));
3553+ fa->fsx_xflags = xflags;
3554+}
3555+
35493556 #endif /* _LINUX_FS_H */
include/linux/fs_context.h+8−1
@@ -81,7 +81,7 @@ struct fs_parameter { · 80 unmodified lines
8181 * Superblock creation fills in ->root whereas reconfiguration begins with this
8282 * already set.
8383 *
84− * See Documentation/filesystems/mounting.txt
84+ * See Documentation/filesystems/mount_api.txt
8585 */
8686 struct fs_context {
8787 const struct fs_context_operations *ops;
@@ -99,6 +99,7 @@ struct fs_context { · 11 unmodified lines
9999 void *s_fs_info; /* Proposed s_fs_info */
100100 unsigned int sb_flags; /* Proposed superblock flags (SB_*) */
101101 unsigned int sb_flags_mask; /* Superblock flags that were changed */
102+ unsigned int s_iflags; /* OR'd with sb->s_iflags */
102103 unsigned int lsm_flags; /* Information flags from the fs to the LSM */
103104 enum fs_context_purpose purpose:8;
104105 enum fs_context_phase phase:8; /* The phase the context is in */
@@ -146,6 +147,12 @@ extern int vfs_get_super(struct fs_context *fc, · 41 unmodified lines
146147 enum vfs_get_super_keying keying,
147148 int (*fill_super)(struct super_block *sb,
148149 struct fs_context *fc));
150+extern int get_tree_nodev(struct fs_context *fc,
151+ int (*fill_super)(struct super_block *sb,
152+ struct fs_context *fc));
153+extern int get_tree_single(struct fs_context *fc,
154+ int (*fill_super)(struct super_block *sb,
155+ struct fs_context *fc));
149156
150157 extern const struct file_operations fscontext_fops;
151158
include/linux/fs_pin.h+0−1
@@ -20,6 +20,5 @@ static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *)) · 19 unmodified lines
2020 }
2121
2222 void pin_remove(struct fs_pin *);
23−void pin_insert_group(struct fs_pin *, struct vfsmount *, struct hlist_head *);
2423 void pin_insert(struct fs_pin *, struct vfsmount *);
2524 void pin_kill(struct fs_pin *);
include/linux/fscrypt.h+66−30
@@ -63,16 +63,13 @@ struct fscrypt_operations { · 62 unmodified lines
6363 unsigned int max_namelen;
6464 };
6565
66+/* Decryption work */
6667 struct fscrypt_ctx {
6768 union {
68− struct {
69− struct page *bounce_page; /* Ciphertext page */
70− struct page *control_page; /* Original page */
71− } w;
7269 struct {
7370 struct bio *bio;
7471 struct work_struct work;
75− } r;
72+ };
7673 struct list_head free_list; /* Free list */
7774 };
7875 u8 flags; /* Flags */
@@ -106,18 +103,33 @@ static inline void fscrypt_handle_d_move(struct dentry *dentry) · 27 unmodified lines
106103 extern void fscrypt_enqueue_decrypt_work(struct work_struct *);
107104 extern struct fscrypt_ctx *fscrypt_get_ctx(gfp_t);
108105 extern void fscrypt_release_ctx(struct fscrypt_ctx *);
109−extern struct page *fscrypt_encrypt_page(const struct inode *, struct page *,
110− unsigned int, unsigned int,
111− u64, gfp_t);
112−extern int fscrypt_decrypt_page(const struct inode *, struct page *, unsigned int,
113− unsigned int, u64);
114106
115−static inline struct page *fscrypt_control_page(struct page *page)
107+extern struct page *fscrypt_encrypt_pagecache_blocks(struct page *page,
108+ unsigned int len,
109+ unsigned int offs,
110+ gfp_t gfp_flags);
111+extern int fscrypt_encrypt_block_inplace(const struct inode *inode,
112+ struct page *page, unsigned int len,
113+ unsigned int offs, u64 lblk_num,
114+ gfp_t gfp_flags);
115+
116+extern int fscrypt_decrypt_pagecache_blocks(struct page *page, unsigned int len,
117+ unsigned int offs);
118+extern int fscrypt_decrypt_block_inplace(const struct inode *inode,
119+ struct page *page, unsigned int len,
120+ unsigned int offs, u64 lblk_num);
121+
122+static inline bool fscrypt_is_bounce_page(struct page *page)
123+{
124+ return page->mapping == NULL;
125+}
126+
127+static inline struct page *fscrypt_pagecache_page(struct page *bounce_page)
116128 {
117− return ((struct fscrypt_ctx *)page_private(page))->w.control_page;
129+ return (struct page *)page_private(bounce_page);
118130 }
119131
120−extern void fscrypt_restore_control_page(struct page *);
132+extern void fscrypt_free_bounce_page(struct page *bounce_page);
121133
122134 /* policy.c */
123135 extern int fscrypt_ioctl_set_policy(struct file *, const void __user *);
@@ -223,7 +235,6 @@ static inline bool fscrypt_match_name(const struct fscrypt_name *fname, · 99 unmodified lines
223235 extern void fscrypt_decrypt_bio(struct bio *);
224236 extern void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx,
225237 struct bio *bio);
226−extern void fscrypt_pullback_bio_page(struct page **, bool);
227238 extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t,
228239 unsigned int);
229240
@@ -283,32 +294,51 @@ static inline void fscrypt_release_ctx(struct fscrypt_ctx *ctx) · 53 unmodified lines
283294 return;
284295 }
285296
286−static inline struct page *fscrypt_encrypt_page(const struct inode *inode,
297+static inline struct page *fscrypt_encrypt_pagecache_blocks(struct page *page,
298+ unsigned int len,
299+ unsigned int offs,
300+ gfp_t gfp_flags)
301+{
302+ return ERR_PTR(-EOPNOTSUPP);
303+}
304+
305+static inline int fscrypt_encrypt_block_inplace(const struct inode *inode,
287306 struct page *page,
288307 unsigned int len,
289− unsigned int offs,
290− u64 lblk_num, gfp_t gfp_flags)
308+ unsigned int offs, u64 lblk_num,
309+ gfp_t gfp_flags)
291310 {
292− return ERR_PTR(-EOPNOTSUPP);
311+ return -EOPNOTSUPP;
312+}
313+
314+static inline int fscrypt_decrypt_pagecache_blocks(struct page *page,
315+ unsigned int len,
316+ unsigned int offs)
317+{
318+ return -EOPNOTSUPP;
293319 }
294320
295−static inline int fscrypt_decrypt_page(const struct inode *inode,
296− struct page *page,
297− unsigned int len, unsigned int offs,
298− u64 lblk_num)
321+static inline int fscrypt_decrypt_block_inplace(const struct inode *inode,
322+ struct page *page,
323+ unsigned int len,
324+ unsigned int offs, u64 lblk_num)
299325 {
300326 return -EOPNOTSUPP;
301327 }
302328
303−static inline struct page *fscrypt_control_page(struct page *page)
329+static inline bool fscrypt_is_bounce_page(struct page *page)
330+{
331+ return false;
332+}
333+
334+static inline struct page *fscrypt_pagecache_page(struct page *bounce_page)
304335 {
305336 WARN_ON_ONCE(1);
306337 return ERR_PTR(-EINVAL);
307338 }
308339
309−static inline void fscrypt_restore_control_page(struct page *page)
340+static inline void fscrypt_free_bounce_page(struct page *bounce_page)
310341 {
311− return;
312342 }
313343
314344 /* policy.c */
@@ -410,11 +440,6 @@ static inline void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, · 95 unmodified lines
410440 {
411441 }
412442
413−static inline void fscrypt_pullback_bio_page(struct page **page, bool restore)
414−{
415− return;
416−}
417−
418443 static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
419444 sector_t pblk, unsigned int len)
420445 {
@@ -692,4 +717,15 @@ static inline int fscrypt_encrypt_symlink(struct inode *inode, · 271 unmodified lines
692717 return 0;
693718 }
694719
720+/* If *pagep is a bounce page, free it and set *pagep to the pagecache page */
721+static inline void fscrypt_finalize_bounce_page(struct page **pagep)
722+{
723+ struct page *page = *pagep;
724+
725+ if (fscrypt_is_bounce_page(page)) {
726+ *pagep = fscrypt_pagecache_page(page);
727+ fscrypt_free_bounce_page(page);
728+ }
729+}
730+
695731 #endif /* _LINUX_FSCRYPT_H */
include/linux/fsl_devices.h+1−0
@@ -98,6 +98,7 @@ struct fsl_usb2_platform_data { · 97 unmodified lines
9898 unsigned has_fsl_erratum_14:1;
9999 unsigned has_fsl_erratum_a005275:1;
100100 unsigned has_fsl_erratum_a005697:1;
101+ unsigned has_fsl_erratum_a006918:1;
101102 unsigned check_phy_clk_valid:1;
102103
103104 /* register save area for suspend/resume */
include/linux/fsnotify.h+26−0
@@ -188,6 +188,19 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct · 187 unmodified lines
188188 fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0);
189189 }
190190
191+/*
192+ * fsnotify_unlink - 'name' was unlinked
193+ *
194+ * Caller must make sure that dentry->d_name is stable.
195+ */
196+static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry)
197+{
198+ /* Expected to be called before d_delete() */
199+ WARN_ON_ONCE(d_is_negative(dentry));
200+
201+ fsnotify_dirent(dir, dentry, FS_DELETE);
202+}
203+
191204 /*
192205 * fsnotify_mkdir - directory 'name' was created
193206 */
@@ -198,6 +211,19 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) · 4 unmodified lines
198211 fsnotify_dirent(inode, dentry, FS_CREATE | FS_ISDIR);
199212 }
200213
214+/*
215+ * fsnotify_rmdir - directory 'name' was removed
216+ *
217+ * Caller must make sure that dentry->d_name is stable.
218+ */
219+static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry)
220+{
221+ /* Expected to be called before d_delete() */
222+ WARN_ON_ONCE(d_is_negative(dentry));
223+
224+ fsnotify_dirent(dir, dentry, FS_DELETE | FS_ISDIR);
225+}
226+
201227 /*
202228 * fsnotify_access - file was read
203229 */
include/linux/fsnotify_backend.h+0−4
@@ -357,7 +357,6 @@ extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u · 356 unmodified lines
357357 extern void __fsnotify_inode_delete(struct inode *inode);
358358 extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
359359 extern void fsnotify_sb_delete(struct super_block *sb);
360−extern void fsnotify_nameremove(struct dentry *dentry, int isdir);
361360 extern u32 fsnotify_get_cookie(void);
362361
363362 static inline int fsnotify_inode_watches_children(struct inode *inode)
@@ -527,9 +526,6 @@ static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt) · 163 unmodified lines
527526 static inline void fsnotify_sb_delete(struct super_block *sb)
528527 {}
529528
530−static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
531−{}
532−
533529 static inline void fsnotify_update_flags(struct dentry *dentry)
534530 {}
535531
include/linux/ftrace.h+2−2
@@ -427,8 +427,8 @@ struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter); · 426 unmodified lines
427427 iter = ftrace_rec_iter_next(iter))
428428
429429
430−int ftrace_update_record(struct dyn_ftrace *rec, int enable);
431−int ftrace_test_record(struct dyn_ftrace *rec, int enable);
430+int ftrace_update_record(struct dyn_ftrace *rec, bool enable);
431+int ftrace_test_record(struct dyn_ftrace *rec, bool enable);
432432 void ftrace_run_stop_machine(int command);
433433 unsigned long ftrace_location(unsigned long ip);
434434 unsigned long ftrace_location_range(unsigned long start, unsigned long end);
include/linux/genalloc.h+9−0
@@ -155,6 +155,15 @@ static inline unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size) · 154 unmodified lines
155155
156156 extern void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size,
157157 dma_addr_t *dma);
158+extern void *gen_pool_dma_alloc_algo(struct gen_pool *pool, size_t size,
159+ dma_addr_t *dma, genpool_algo_t algo, void *data);
160+extern void *gen_pool_dma_alloc_align(struct gen_pool *pool, size_t size,
161+ dma_addr_t *dma, int align);
162+extern void *gen_pool_dma_zalloc(struct gen_pool *pool, size_t size, dma_addr_t *dma);
163+extern void *gen_pool_dma_zalloc_algo(struct gen_pool *pool, size_t size,
164+ dma_addr_t *dma, genpool_algo_t algo, void *data);
165+extern void *gen_pool_dma_zalloc_align(struct gen_pool *pool, size_t size,
166+ dma_addr_t *dma, int align);
158167 extern void gen_pool_free_owner(struct gen_pool *pool, unsigned long addr,
159168 size_t size, void **owner);
160169 static inline void gen_pool_free(struct gen_pool *pool, unsigned long addr,
include/linux/gpio.h+1−0
@@ -106,6 +106,7 @@ void devm_gpio_free(struct device *dev, unsigned int gpio); · 105 unmodified lines
106106
107107 struct device;
108108 struct gpio_chip;
109+struct pinctrl_dev;
109110
110111 static inline bool gpio_is_valid(int number)
111112 {
include/linux/gpio/consumer.h+32−32
@@ -247,7 +247,7 @@ static inline void gpiod_put(struct gpio_desc *desc) · 246 unmodified lines
247247 might_sleep();
248248
249249 /* GPIO can never have been requested */
250− WARN_ON(1);
250+ WARN_ON(desc);
251251 }
252252
253253 static inline void devm_gpiod_unhinge(struct device *dev,
@@ -256,7 +256,7 @@ static inline void devm_gpiod_unhinge(struct device *dev, · 2 unmodified lines
256256 might_sleep();
257257
258258 /* GPIO can never have been requested */
259− WARN_ON(1);
259+ WARN_ON(desc);
260260 }
261261
262262 static inline void gpiod_put_array(struct gpio_descs *descs)
@@ -264,7 +264,7 @@ static inline void gpiod_put_array(struct gpio_descs *descs) · 1 unmodified line
264264 might_sleep();
265265
266266 /* GPIO can never have been requested */
267− WARN_ON(1);
267+ WARN_ON(descs);
268268 }
269269
270270 static inline struct gpio_desc *__must_check
@@ -317,7 +317,7 @@ static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) · 46 unmodified lines
317317 might_sleep();
318318
319319 /* GPIO can never have been requested */
320− WARN_ON(1);
320+ WARN_ON(desc);
321321 }
322322
323323 static inline void devm_gpiod_put_array(struct device *dev,
@@ -326,32 +326,32 @@ static inline void devm_gpiod_put_array(struct device *dev, · 2 unmodified lines
326326 might_sleep();
327327
328328 /* GPIO can never have been requested */
329− WARN_ON(1);
329+ WARN_ON(descs);
330330 }
331331
332332
333333 static inline int gpiod_get_direction(const struct gpio_desc *desc)
334334 {
335335 /* GPIO can never have been requested */
336− WARN_ON(1);
336+ WARN_ON(desc);
337337 return -ENOSYS;
338338 }
339339 static inline int gpiod_direction_input(struct gpio_desc *desc)
340340 {
341341 /* GPIO can never have been requested */
342− WARN_ON(1);
342+ WARN_ON(desc);
343343 return -ENOSYS;
344344 }
345345 static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
346346 {
347347 /* GPIO can never have been requested */
348− WARN_ON(1);
348+ WARN_ON(desc);
349349 return -ENOSYS;
350350 }
351351 static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
352352 {
353353 /* GPIO can never have been requested */
354− WARN_ON(1);
354+ WARN_ON(desc);
355355 return -ENOSYS;
356356 }
357357
@@ -359,7 +359,7 @@ static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value) · 1 unmodified line
359359 static inline int gpiod_get_value(const struct gpio_desc *desc)
360360 {
361361 /* GPIO can never have been requested */
362− WARN_ON(1);
362+ WARN_ON(desc);
363363 return 0;
364364 }
365365 static inline int gpiod_get_array_value(unsigned int array_size,
@@ -368,13 +368,13 @@ static inline int gpiod_get_array_value(unsigned int array_size, · 2 unmodified lines
368368 unsigned long *value_bitmap)
369369 {
370370 /* GPIO can never have been requested */
371− WARN_ON(1);
371+ WARN_ON(desc_array);
372372 return 0;
373373 }
374374 static inline void gpiod_set_value(struct gpio_desc *desc, int value)
375375 {
376376 /* GPIO can never have been requested */
377− WARN_ON(1);
377+ WARN_ON(desc);
378378 }
379379 static inline int gpiod_set_array_value(unsigned int array_size,
380380 struct gpio_desc **desc_array,
@@ -382,13 +382,13 @@ static inline int gpiod_set_array_value(unsigned int array_size, · 1 unmodified line
382382 unsigned long *value_bitmap)
383383 {
384384 /* GPIO can never have been requested */
385− WARN_ON(1);
385+ WARN_ON(desc_array);
386386 return 0;
387387 }
388388 static inline int gpiod_get_raw_value(const struct gpio_desc *desc)
389389 {
390390 /* GPIO can never have been requested */
391− WARN_ON(1);
391+ WARN_ON(desc);
392392 return 0;
393393 }
394394 static inline int gpiod_get_raw_array_value(unsigned int array_size,
@@ -397,13 +397,13 @@ static inline int gpiod_get_raw_array_value(unsigned int array_size, · 2 unmodified lines
397397 unsigned long *value_bitmap)
398398 {
399399 /* GPIO can never have been requested */
400− WARN_ON(1);
400+ WARN_ON(desc_array);
401401 return 0;
402402 }
403403 static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value)
404404 {
405405 /* GPIO can never have been requested */
406− WARN_ON(1);
406+ WARN_ON(desc);
407407 }
408408 static inline int gpiod_set_raw_array_value(unsigned int array_size,
409409 struct gpio_desc **desc_array,
@@ -411,14 +411,14 @@ static inline int gpiod_set_raw_array_value(unsigned int array_size, · 1 unmodified line
411411 unsigned long *value_bitmap)
412412 {
413413 /* GPIO can never have been requested */
414− WARN_ON(1);
414+ WARN_ON(desc_array);
415415 return 0;
416416 }
417417
418418 static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc)
419419 {
420420 /* GPIO can never have been requested */
421− WARN_ON(1);
421+ WARN_ON(desc);
422422 return 0;
423423 }
424424 static inline int gpiod_get_array_value_cansleep(unsigned int array_size,
@@ -427,13 +427,13 @@ static inline int gpiod_get_array_value_cansleep(unsigned int array_size, · 2 unmodified lines
427427 unsigned long *value_bitmap)
428428 {
429429 /* GPIO can never have been requested */
430− WARN_ON(1);
430+ WARN_ON(desc_array);
431431 return 0;
432432 }
433433 static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
434434 {
435435 /* GPIO can never have been requested */
436− WARN_ON(1);
436+ WARN_ON(desc);
437437 }
438438 static inline int gpiod_set_array_value_cansleep(unsigned int array_size,
439439 struct gpio_desc **desc_array,
@@ -441,13 +441,13 @@ static inline int gpiod_set_array_value_cansleep(unsigned int array_size, · 1 unmodified line
441441 unsigned long *value_bitmap)
442442 {
443443 /* GPIO can never have been requested */
444− WARN_ON(1);
444+ WARN_ON(desc_array);
445445 return 0;
446446 }
447447 static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)
448448 {
449449 /* GPIO can never have been requested */
450− WARN_ON(1);
450+ WARN_ON(desc);
451451 return 0;
452452 }
453453 static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size,
@@ -456,14 +456,14 @@ static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size, · 2 unmodified lines
456456 unsigned long *value_bitmap)
457457 {
458458 /* GPIO can never have been requested */
459− WARN_ON(1);
459+ WARN_ON(desc_array);
460460 return 0;
461461 }
462462 static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc,
463463 int value)
464464 {
465465 /* GPIO can never have been requested */
466− WARN_ON(1);
466+ WARN_ON(desc);
467467 }
468468 static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size,
469469 struct gpio_desc **desc_array,
@@ -471,41 +471,41 @@ static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size, · 1 unmodified line
471471 unsigned long *value_bitmap)
472472 {
473473 /* GPIO can never have been requested */
474− WARN_ON(1);
474+ WARN_ON(desc_array);
475475 return 0;
476476 }
477477
478478 static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
479479 {
480480 /* GPIO can never have been requested */
481− WARN_ON(1);
481+ WARN_ON(desc);
482482 return -ENOSYS;
483483 }
484484
485485 static inline int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
486486 {
487487 /* GPIO can never have been requested */
488− WARN_ON(1);
488+ WARN_ON(desc);
489489 return -ENOSYS;
490490 }
491491
492492 static inline int gpiod_is_active_low(const struct gpio_desc *desc)
493493 {
494494 /* GPIO can never have been requested */
495− WARN_ON(1);
495+ WARN_ON(desc);
496496 return 0;
497497 }
498498 static inline int gpiod_cansleep(const struct gpio_desc *desc)
499499 {
500500 /* GPIO can never have been requested */
501− WARN_ON(1);
501+ WARN_ON(desc);
502502 return 0;
503503 }
504504
505505 static inline int gpiod_to_irq(const struct gpio_desc *desc)
506506 {
507507 /* GPIO can never have been requested */
508− WARN_ON(1);
508+ WARN_ON(desc);
509509 return -EINVAL;
510510 }
511511
@@ -513,7 +513,7 @@ static inline int gpiod_set_consumer_name(struct gpio_desc *desc, · 1 unmodified line
513513 const char *name)
514514 {
515515 /* GPIO can never have been requested */
516− WARN_ON(1);
516+ WARN_ON(desc);
517517 return -EINVAL;
518518 }
519519
@@ -525,7 +525,7 @@ static inline struct gpio_desc *gpio_to_desc(unsigned gpio) · 5 unmodified lines
525525 static inline int desc_to_gpio(const struct gpio_desc *desc)
526526 {
527527 /* GPIO can never have been requested */
528− WARN_ON(1);
528+ WARN_ON(desc);
529529 return -EINVAL;
530530 }
531531
include/linux/gpio/driver.h+15−16
@@ -18,6 +18,7 @@ struct seq_file; · 17 unmodified lines
1818 struct gpio_device;
1919 struct module;
2020 enum gpiod_flags;
21+enum gpio_lookup_flags;
2122
2223 #ifdef CONFIG_GPIOLIB
2324
@@ -101,13 +102,6 @@ struct gpio_irq_chip { · 77 unmodified lines
101102 */
102103 unsigned int num_parents;
103104
104− /**
105− * @parent_irq:
106− *
107− * For use by gpiochip_set_cascaded_irqchip()
108− */
109− unsigned int parent_irq;
110−
111105 /**
112106 * @parents:
113107 *
@@ -167,7 +161,7 @@ struct gpio_irq_chip { · 53 unmodified lines
167161 */
168162 void (*irq_disable)(struct irq_data *data);
169163 };
170−#endif
164+#endif /* CONFIG_GPIOLIB_IRQCHIP */
171165
172166 /**
173167 * struct gpio_chip - abstract a GPIO controller
@@ -200,6 +194,8 @@ struct gpio_irq_chip { · 26 unmodified lines
200194 * @dbg_show: optional routine to show contents in debugfs; default code
201195 * will be used when this is omitted, but custom code can show extra
202196 * state (such as pullup/pulldown configuration).
197+ * @init_valid_mask: optional routine to initialize @valid_mask, to be used if
198+ * not all GPIOs are valid.
203199 * @base: identifies the first GPIO number handled by this chip;
204200 * or, if negative during registration, requests dynamic ID allocation.
205201 * DEPRECATION: providing anything non-negative and nailing the base
@@ -307,7 +303,7 @@ struct gpio_chip { · 101 unmodified lines
307303 spinlock_t bgpio_lock;
308304 unsigned long bgpio_data;
309305 unsigned long bgpio_dir;
310−#endif
306+#endif /* CONFIG_GPIO_GENERIC */
311307
312308 #ifdef CONFIG_GPIOLIB_IRQCHIP
313309 /*
@@ -322,7 +318,7 @@ struct gpio_chip { · 8 unmodified lines
322318 * used to handle IRQs for most practical cases.
323319 */
324320 struct gpio_irq_chip irq;
325−#endif
321+#endif /* CONFIG_GPIOLIB_IRQCHIP */
326322
327323 /**
328324 * @need_valid_mask:
@@ -369,7 +365,7 @@ struct gpio_chip { · 40 unmodified lines
369365 */
370366 int (*of_xlate)(struct gpio_chip *gc,
371367 const struct of_phandle_args *gpiospec, u32 *flags);
372−#endif
368+#endif /* CONFIG_OF_GPIO */
373369 };
374370
375371 extern const char *gpiochip_is_requested(struct gpio_chip *chip,
@@ -412,7 +408,7 @@ extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 36 unmodified lines
412408 })
413409 #else
414410 #define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL, NULL)
415−#endif
411+#endif /* CONFIG_LOCKDEP */
416412
417413 static inline int gpiochip_add(struct gpio_chip *chip)
418414 {
@@ -467,7 +463,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev, · 48 unmodified lines
467463 #define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */
468464 #define BGPIOF_NO_OUTPUT BIT(5) /* only input */
469465
470−#endif
466+#endif /* CONFIG_GPIO_GENERIC */
471467
472468 #ifdef CONFIG_GPIOLIB_IRQCHIP
473469
@@ -537,7 +533,7 @@ static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip, · 63 unmodified lines
537533 handler, type, true,
538534 &lock_key, &request_key);
539535 }
540−#else
536+#else /* ! CONFIG_LOCKDEP */
541537 static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
542538 struct irq_chip *irqchip,
543539 unsigned int first_irq,
@@ -588,7 +584,9 @@ int gpiochip_add_pingroup_range(struct gpio_chip *chip, · 44 unmodified lines
588584 unsigned int gpio_offset, const char *pin_group);
589585 void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
590586
591−#else
587+#else /* ! CONFIG_PINCTRL */
588+
589+struct pinctrl_dev;
592590
593591 static inline int
594592 gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
@@ -614,7 +612,8 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip) · 19 unmodified lines
614612
615613 struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum,
616614 const char *label,
617− enum gpiod_flags flags);
615+ enum gpio_lookup_flags lflags,
616+ enum gpiod_flags dflags);
618617 void gpiochip_free_own_desc(struct gpio_desc *desc);
619618
620619 void devprop_gpiochip_set_names(struct gpio_chip *chip,
include/linux/gpio/gpio-reg.h+1−1
@@ -11,4 +11,4 @@ struct gpio_chip *gpio_reg_init(struct device *dev, void __iomem *reg, · 10 unmodified lines
1111
1212 int gpio_reg_resume(struct gpio_chip *gc);
1313
14−#endif
14+#endif /* GPIO_REG_H */
include/linux/gpio/machine.h+2−2
@@ -97,7 +97,7 @@ void gpiod_add_lookup_table(struct gpiod_lookup_table *table); · 96 unmodified lines
9797 void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n);
9898 void gpiod_remove_lookup_table(struct gpiod_lookup_table *table);
9999 void gpiod_add_hogs(struct gpiod_hog *hogs);
100−#else
100+#else /* ! CONFIG_GPIOLIB */
101101 static inline
102102 void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {}
103103 static inline
@@ -105,6 +105,6 @@ void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n) {} · 1 unmodified line
105105 static inline
106106 void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {}
107107 static inline void gpiod_add_hogs(struct gpiod_hog *hogs) {}
108−#endif
108+#endif /* CONFIG_GPIOLIB */
109109
110110 #endif /* __LINUX_GPIO_MACHINE_H */
include/linux/hdmi.h+67−0
@@ -47,6 +47,7 @@ enum hdmi_infoframe_type { · 46 unmodified lines
4747 HDMI_INFOFRAME_TYPE_AVI = 0x82,
4848 HDMI_INFOFRAME_TYPE_SPD = 0x83,
4949 HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
50+ HDMI_INFOFRAME_TYPE_DRM = 0x87,
5051 };
5152
5253 #define HDMI_IEEE_OUI 0x000c03
@@ -55,6 +56,7 @@ enum hdmi_infoframe_type { · 2 unmodified lines
5556 #define HDMI_AVI_INFOFRAME_SIZE 13
5657 #define HDMI_SPD_INFOFRAME_SIZE 25
5758 #define HDMI_AUDIO_INFOFRAME_SIZE 10
59+#define HDMI_DRM_INFOFRAME_SIZE 26
5860
5961 #define HDMI_INFOFRAME_SIZE(type) \
6062 (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
@@ -152,6 +154,17 @@ enum hdmi_content_type { · 91 unmodified lines
152154 HDMI_CONTENT_TYPE_GAME,
153155 };
154156
157+enum hdmi_metadata_type {
158+ HDMI_STATIC_METADATA_TYPE1 = 1,
159+};
160+
161+enum hdmi_eotf {
162+ HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
163+ HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
164+ HDMI_EOTF_SMPTE_ST2084,
165+ HDMI_EOTF_BT_2100_HLG,
166+};
167+
155168 struct hdmi_avi_infoframe {
156169 enum hdmi_infoframe_type type;
157170 unsigned char version;
@@ -175,12 +188,37 @@ struct hdmi_avi_infoframe { · 17 unmodified lines
175188 unsigned short right_bar;
176189 };
177190
191+/* DRM Infoframe as per CTA 861.G spec */
192+struct hdmi_drm_infoframe {
193+ enum hdmi_infoframe_type type;
194+ unsigned char version;
195+ unsigned char length;
196+ enum hdmi_eotf eotf;
197+ enum hdmi_metadata_type metadata_type;
198+ struct {
199+ u16 x, y;
200+ } display_primaries[3];
201+ struct {
202+ u16 x, y;
203+ } white_point;
204+ u16 max_display_mastering_luminance;
205+ u16 min_display_mastering_luminance;
206+ u16 max_cll;
207+ u16 max_fall;
208+};
209+
178210 int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
179211 ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
180212 size_t size);
181213 ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame,
182214 void *buffer, size_t size);
183215 int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame);
216+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame);
217+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
218+ size_t size);
219+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
220+ void *buffer, size_t size);
221+int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame);
184222
185223 enum hdmi_spd_sdi {
186224 HDMI_SPD_SDI_UNKNOWN,
@@ -320,6 +358,33 @@ struct hdmi_vendor_infoframe { · 133 unmodified lines
320358 unsigned int s3d_ext_data;
321359 };
322360
361+/* HDR Metadata as per 861.G spec */
362+struct hdr_static_metadata {
363+ __u8 eotf;
364+ __u8 metadata_type;
365+ __u16 max_cll;
366+ __u16 max_fall;
367+ __u16 min_cll;
368+};
369+
370+/**
371+ * struct hdr_sink_metadata - HDR sink metadata
372+ *
373+ * Metadata Information read from Sink's EDID
374+ */
375+struct hdr_sink_metadata {
376+ /**
377+ * @metadata_type: Static_Metadata_Descriptor_ID.
378+ */
379+ __u32 metadata_type;
380+ /**
381+ * @hdmi_type1: HDR Metadata Infoframe.
382+ */
383+ union {
384+ struct hdr_static_metadata hdmi_type1;
385+ };
386+};
387+
323388 int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
324389 ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
325390 void *buffer, size_t size);
@@ -344,6 +409,7 @@ union hdmi_vendor_any_infoframe { · 18 unmodified lines
344409 * @spd: spd infoframe
345410 * @vendor: union of all vendor infoframes
346411 * @audio: audio infoframe
412+ * @drm: Dynamic Range and Mastering infoframe
347413 *
348414 * This is used by the generic pack function. This works since all infoframes
349415 * have the same header which also indicates which type of infoframe should be
@@ -355,6 +421,7 @@ union hdmi_infoframe { · 5 unmodified lines
355421 struct hdmi_spd_infoframe spd;
356422 union hdmi_vendor_any_infoframe vendor;
357423 struct hdmi_audio_infoframe audio;
424+ struct hdmi_drm_infoframe drm;
358425 };
359426
360427 ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer,
include/linux/hmm.h+32−316
@@ -21,8 +21,8 @@ · 20 unmodified lines
2121 *
2222 * HMM address space mirroring API:
2323 *
24− * Use HMM address space mirroring if you want to mirror range of the CPU page
25− * table of a process into a device page table. Here, "mirror" means "keep
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
2626 * synchronized". Prerequisites: the device must provide the ability to write-
2727 * protect its page tables (at PAGE_SIZE granularity), and must be able to
2828 * recover from the resulting potential page faults.
@@ -62,7 +62,7 @@ · 33 unmodified lines
6262 #include <linux/kconfig.h>
6363 #include <asm/pgtable.h>
6464
65−#if IS_ENABLED(CONFIG_HMM)
65+#ifdef CONFIG_HMM_MIRROR
6666
6767 #include <linux/device.h>
6868 #include <linux/migrate.h>
@@ -82,19 +82,18 @@ · 13 unmodified lines
8282 * @mirrors_sem: read/write semaphore protecting the mirrors list
8383 * @wq: wait queue for user waiting on a range invalidation
8484 * @notifiers: count of active mmu notifiers
85− * @dead: is the mm dead ?
8685 */
8786 struct hmm {
8887 struct mm_struct *mm;
8988 struct kref kref;
90− struct mutex lock;
89+ spinlock_t ranges_lock;
9190 struct list_head ranges;
9291 struct list_head mirrors;
9392 struct mmu_notifier mmu_notifier;
9493 struct rw_semaphore mirrors_sem;
9594 wait_queue_head_t wq;
95+ struct rcu_head rcu;
9696 long notifiers;
97− bool dead;
9897 };
9998
10099 /*
@@ -105,10 +104,11 @@ struct hmm { · 4 unmodified lines
105104 * HMM_PFN_WRITE: CPU page table has write permission set
106105 * HMM_PFN_DEVICE_PRIVATE: private device memory (ZONE_DEVICE)
107106 *
108− * The driver provide a flags array, if driver valid bit for an entry is bit
109− * 3 ie (entry & (1 << 3)) is true if entry is valid then driver must provide
107+ * The driver provides a flags array for mapping page protections to device
108+ * PTE bits. If the driver valid bit for an entry is bit 3,
109+ * i.e., (entry & (1 << 3)), then the driver must provide
110110 * an array in hmm_range.flags with hmm_range.flags[HMM_PFN_VALID] == 1 << 3.
111− * Same logic apply to all flags. This is same idea as vm_page_prot in vma
111+ * Same logic apply to all flags. This is the same idea as vm_page_prot in vma
112112 * except that this is per device driver rather than per architecture.
113113 */
114114 enum hmm_pfn_flag_e {
@@ -129,13 +129,13 @@ enum hmm_pfn_flag_e { · 14 unmodified lines
129129 * be mirrored by a device, because the entry will never have HMM_PFN_VALID
130130 * set and the pfn value is undefined.
131131 *
132− * Driver provide entry value for none entry, error entry and special entry,
133− * driver can alias (ie use same value for error and special for instance). It
134− * should not alias none and error or special.
132+ * Driver provides values for none entry, error entry, and special entry.
133+ * Driver can alias (i.e., use same value) error and special, but
134+ * it should not alias none with error or special.
135135 *
136136 * HMM pfn value returned by hmm_vma_get_pfns() or hmm_vma_fault() will be:
137137 * hmm_range.values[HMM_PFN_ERROR] if CPU page table entry is poisonous,
138− * hmm_range.values[HMM_PFN_NONE] if there is no CPU page table
138+ * hmm_range.values[HMM_PFN_NONE] if there is no CPU page table entry,
139139 * hmm_range.values[HMM_PFN_SPECIAL] if CPU page table entry is a special one
140140 */
141141 enum hmm_pfn_value_e {
@@ -158,6 +158,7 @@ enum hmm_pfn_value_e { · 16 unmodified lines
158158 * @values: pfn value for some special case (none, special, error, ...)
159159 * @default_flags: default flags for the range (write, read, ... see hmm doc)
160160 * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter
161+ * @page_shift: device virtual address shift value (should be >= PAGE_SHIFT)
161162 * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT)
162163 * @valid: pfns array did not change since it has been fill by an HMM function
163164 */
@@ -180,7 +181,7 @@ struct hmm_range { · 16 unmodified lines
180181 /*
181182 * hmm_range_page_shift() - return the page shift for the range
182183 * @range: range being queried
183− * Returns: page shift (page size = 1 << page shift) for the range
184+ * Return: page shift (page size = 1 << page shift) for the range
184185 */
185186 static inline unsigned hmm_range_page_shift(const struct hmm_range *range)
186187 {
@@ -190,7 +191,7 @@ static inline unsigned hmm_range_page_shift(const struct hmm_range *range) · 3 unmodified lines
190191 /*
191192 * hmm_range_page_size() - return the page size for the range
192193 * @range: range being queried
193− * Returns: page size for the range in bytes
194+ * Return: page size for the range in bytes
194195 */
195196 static inline unsigned long hmm_range_page_size(const struct hmm_range *range)
196197 {
@@ -201,28 +202,19 @@ static inline unsigned long hmm_range_page_size(const struct hmm_range *range) · 4 unmodified lines
201202 * hmm_range_wait_until_valid() - wait for range to be valid
202203 * @range: range affected by invalidation to wait on
203204 * @timeout: time out for wait in ms (ie abort wait after that period of time)
204− * Returns: true if the range is valid, false otherwise.
205+ * Return: true if the range is valid, false otherwise.
205206 */
206207 static inline bool hmm_range_wait_until_valid(struct hmm_range *range,
207208 unsigned long timeout)
208209 {
209− /* Check if mm is dead ? */
210− if (range->hmm == NULL || range->hmm->dead || range->hmm->mm == NULL) {
211− range->valid = false;
212− return false;
213− }
214− if (range->valid)
215− return true;
216− wait_event_timeout(range->hmm->wq, range->valid || range->hmm->dead,
217− msecs_to_jiffies(timeout));
218− /* Return current valid status just in case we get lucky */
219− return range->valid;
210+ return wait_event_timeout(range->hmm->wq, range->valid,
211+ msecs_to_jiffies(timeout)) != 0;
220212 }
221213
222214 /*
223215 * hmm_range_valid() - test if a range is valid or not
224216 * @range: range
225− * Returns: true if the range is valid, false otherwise.
217+ * Return: true if the range is valid, false otherwise.
226218 */
227219 static inline bool hmm_range_valid(struct hmm_range *range)
228220 {
@@ -233,7 +225,7 @@ static inline bool hmm_range_valid(struct hmm_range *range) · 4 unmodified lines
233225 * hmm_device_entry_to_page() - return struct page pointed to by a device entry
234226 * @range: range use to decode device entry value
235227 * @entry: device entry value to get corresponding struct page from
236− * Returns: struct page pointer if entry is a valid, NULL otherwise
228+ * Return: struct page pointer if entry is a valid, NULL otherwise
237229 *
238230 * If the device entry is valid (ie valid flag set) then return the struct page
239231 * matching the entry value. Otherwise return NULL.
@@ -256,7 +248,7 @@ static inline struct page *hmm_device_entry_to_page(const struct hmm_range *rang · 16 unmodified lines
256248 * hmm_device_entry_to_pfn() - return pfn value store in a device entry
257249 * @range: range use to decode device entry value
258250 * @entry: device entry to extract pfn from
259− * Returns: pfn value if device entry is valid, -1UL otherwise
251+ * Return: pfn value if device entry is valid, -1UL otherwise
260252 */
261253 static inline unsigned long
262254 hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn)
@@ -276,7 +268,7 @@ hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn) · 13 unmodified lines
276268 * hmm_device_entry_from_page() - create a valid device entry for a page
277269 * @range: range use to encode HMM pfn value
278270 * @page: page for which to create the device entry
279− * Returns: valid device entry for the page
271+ * Return: valid device entry for the page
280272 */
281273 static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range,
282274 struct page *page)
@@ -289,7 +281,7 @@ static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, · 6 unmodified lines
289281 * hmm_device_entry_from_pfn() - create a valid device entry value from pfn
290282 * @range: range use to encode HMM pfn value
291283 * @pfn: pfn value for which to create the device entry
292− * Returns: valid device entry for the pfn
284+ * Return: valid device entry for the pfn
293285 */
294286 static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range,
295287 unsigned long pfn)
@@ -332,9 +324,6 @@ static inline uint64_t hmm_pfn_from_pfn(const struct hmm_range *range, · 36 unmodified lines
332324 return hmm_device_entry_from_pfn(range, pfn);
333325 }
334326
335−
336−
337−#if IS_ENABLED(CONFIG_HMM_MIRROR)
338327 /*
339328 * Mirroring: how to synchronize device page table with CPU page table.
340329 *
@@ -394,7 +383,7 @@ enum hmm_update_event { · 53 unmodified lines
394383 };
395384
396385 /*
397− * struct hmm_update - HMM update informations for callback
386+ * struct hmm_update - HMM update information for callback
398387 *
399388 * @start: virtual start address of the range to update
400389 * @end: virtual end address of the range to update
@@ -418,17 +407,18 @@ struct hmm_mirror_ops { · 17 unmodified lines
418407 *
419408 * @mirror: pointer to struct hmm_mirror
420409 *
421− * This is called when the mm_struct is being released.
422− * The callback should make sure no references to the mirror occur
423− * after the callback returns.
410+ * This is called when the mm_struct is being released. The callback
411+ * must ensure that all access to any pages obtained from this mirror
412+ * is halted before the callback returns. All future access should
413+ * fault.
424414 */
425415 void (*release)(struct hmm_mirror *mirror);
426416
427417 /* sync_cpu_device_pagetables() - synchronize page tables
428418 *
429419 * @mirror: pointer to struct hmm_mirror
430− * @update: update informations (see struct hmm_update)
431− * Returns: -EAGAIN if update.blockable false and callback need to
420+ * @update: update information (see struct hmm_update)
421+ * Return: -EAGAIN if update.blockable false and callback need to
432422 * block, 0 otherwise.
433423 *
434424 * This callback ultimately originates from mmu_notifiers when the CPU
@@ -464,36 +454,11 @@ struct hmm_mirror { · 29 unmodified lines
464454 int hmm_mirror_register(struct hmm_mirror *mirror, struct mm_struct *mm);
465455 void hmm_mirror_unregister(struct hmm_mirror *mirror);
466456
467−/*
468− * hmm_mirror_mm_is_alive() - test if mm is still alive
469− * @mirror: the HMM mm mirror for which we want to lock the mmap_sem
470− * Returns: false if the mm is dead, true otherwise
471− *
472− * This is an optimization it will not accurately always return -EINVAL if the
473− * mm is dead ie there can be false negative (process is being kill but HMM is
474− * not yet inform of that). It is only intented to be use to optimize out case
475− * where driver is about to do something time consuming and it would be better
476− * to skip it if the mm is dead.
477− */
478−static inline bool hmm_mirror_mm_is_alive(struct hmm_mirror *mirror)
479−{
480− struct mm_struct *mm;
481−
482− if (!mirror || !mirror->hmm)
483− return false;
484− mm = READ_ONCE(mirror->hmm->mm);
485− if (mirror->hmm->dead || !mm)
486− return false;
487−
488− return true;
489−}
490−
491−
492457 /*
493458 * Please see Documentation/vm/hmm.rst for how to use the range API.
494459 */
495460 int hmm_range_register(struct hmm_range *range,
496− struct mm_struct *mm,
461+ struct hmm_mirror *mirror,
497462 unsigned long start,
498463 unsigned long end,
499464 unsigned page_shift);
@@ -519,262 +484,13 @@ long hmm_range_dma_unmap(struct hmm_range *range, · 19 unmodified lines
519484 */
520485 #define HMM_RANGE_DEFAULT_TIMEOUT 1000
521486
522−/* This is a temporary helper to avoid merge conflict between trees. */
523−static inline bool hmm_vma_range_done(struct hmm_range *range)
524−{
525− bool ret = hmm_range_valid(range);
526−
527− hmm_range_unregister(range);
528− return ret;
529−}
530−
531−/* This is a temporary helper to avoid merge conflict between trees. */
532−static inline int hmm_vma_fault(struct hmm_range *range, bool block)
533−{
534− long ret;
535−
536− /*
537− * With the old API the driver must set each individual entries with
538− * the requested flags (valid, write, ...). So here we set the mask to
539− * keep intact the entries provided by the driver and zero out the
540− * default_flags.
541− */
542− range->default_flags = 0;
543− range->pfn_flags_mask = -1UL;
544−
545− ret = hmm_range_register(range, range->vma->vm_mm,
546− range->start, range->end,
547− PAGE_SHIFT);
548− if (ret)
549− return (int)ret;
550−
551− if (!hmm_range_wait_until_valid(range, HMM_RANGE_DEFAULT_TIMEOUT)) {
552− /*
553− * The mmap_sem was taken by driver we release it here and
554− * returns -EAGAIN which correspond to mmap_sem have been
555− * drop in the old API.
556− */
557− up_read(&range->vma->vm_mm->mmap_sem);
558− return -EAGAIN;
559− }
560−
561− ret = hmm_range_fault(range, block);
562− if (ret <= 0) {
563− if (ret == -EBUSY || !ret) {
564− /* Same as above drop mmap_sem to match old API. */
565− up_read(&range->vma->vm_mm->mmap_sem);
566− ret = -EBUSY;
567− } else if (ret == -EAGAIN)
568− ret = -EBUSY;
569− hmm_range_unregister(range);
570− return ret;
571− }
572− return 0;
573−}
574−
575487 /* Below are for HMM internal use only! Not to be used by device driver! */
576−void hmm_mm_destroy(struct mm_struct *mm);
577−
578488 static inline void hmm_mm_init(struct mm_struct *mm)
579489 {
580490 mm->hmm = NULL;
581491 }
582492 #else /* IS_ENABLED(CONFIG_HMM_MIRROR) */
583−static inline void hmm_mm_destroy(struct mm_struct *mm) {}
584493 static inline void hmm_mm_init(struct mm_struct *mm) {}
585494 #endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */
586495
587−#if IS_ENABLED(CONFIG_DEVICE_PRIVATE) || IS_ENABLED(CONFIG_DEVICE_PUBLIC)
588−struct hmm_devmem;
589−
590−struct page *hmm_vma_alloc_locked_page(struct vm_area_struct *vma,
591− unsigned long addr);
592−
593−/*
594− * struct hmm_devmem_ops - callback for ZONE_DEVICE memory events
595− *
596− * @free: call when refcount on page reach 1 and thus is no longer use
597− * @fault: call when there is a page fault to unaddressable memory
598− *
599− * Both callback happens from page_free() and page_fault() callback of struct
600− * dev_pagemap respectively. See include/linux/memremap.h for more details on
601− * those.
602− *
603− * The hmm_devmem_ops callback are just here to provide a coherent and
604− * uniq API to device driver and device driver should not register their
605− * own page_free() or page_fault() but rely on the hmm_devmem_ops call-
606− * back.
607− */
608−struct hmm_devmem_ops {
609− /*
610− * free() - free a device page
611− * @devmem: device memory structure (see struct hmm_devmem)
612− * @page: pointer to struct page being freed
613− *
614− * Call back occurs whenever a device page refcount reach 1 which
615− * means that no one is holding any reference on the page anymore
616− * (ZONE_DEVICE page have an elevated refcount of 1 as default so
617− * that they are not release to the general page allocator).
618− *
619− * Note that callback has exclusive ownership of the page (as no
620− * one is holding any reference).
621− */
622− void (*free)(struct hmm_devmem *devmem, struct page *page);
623− /*
624− * fault() - CPU page fault or get user page (GUP)
625− * @devmem: device memory structure (see struct hmm_devmem)
626− * @vma: virtual memory area containing the virtual address
627− * @addr: virtual address that faulted or for which there is a GUP
628− * @page: pointer to struct page backing virtual address (unreliable)
629− * @flags: FAULT_FLAG_* (see include/linux/mm.h)
630− * @pmdp: page middle directory
631− * Returns: VM_FAULT_MINOR/MAJOR on success or one of VM_FAULT_ERROR
632− * on error
633− *
634− * The callback occurs whenever there is a CPU page fault or GUP on a
635− * virtual address. This means that the device driver must migrate the
636− * page back to regular memory (CPU accessible).
637− *
638− * The device driver is free to migrate more than one page from the
639− * fault() callback as an optimization. However if device decide to
640− * migrate more than one page it must always priotirize the faulting
641− * address over the others.
642− *
643− * The struct page pointer is only given as an hint to allow quick
644− * lookup of internal device driver data. A concurrent migration
645− * might have already free that page and the virtual address might
646− * not longer be back by it. So it should not be modified by the
647− * callback.
648− *
649− * Note that mmap semaphore is held in read mode at least when this
650− * callback occurs, hence the vma is valid upon callback entry.
651− */
652− vm_fault_t (*fault)(struct hmm_devmem *devmem,
653− struct vm_area_struct *vma,
654− unsigned long addr,
655− const struct page *page,
656− unsigned int flags,
657− pmd_t *pmdp);
658−};
659−
660−/*
661− * struct hmm_devmem - track device memory
662− *
663− * @completion: completion object for device memory
664− * @pfn_first: first pfn for this resource (set by hmm_devmem_add())
665− * @pfn_last: last pfn for this resource (set by hmm_devmem_add())
666− * @resource: IO resource reserved for this chunk of memory
667− * @pagemap: device page map for that chunk
668− * @device: device to bind resource to
669− * @ops: memory operations callback
670− * @ref: per CPU refcount
671− * @page_fault: callback when CPU fault on an unaddressable device page
672− *
673− * This an helper structure for device drivers that do not wish to implement
674− * the gory details related to hotplugging new memoy and allocating struct
675− * pages.
676− *
677− * Device drivers can directly use ZONE_DEVICE memory on their own if they
678− * wish to do so.
679− *
680− * The page_fault() callback must migrate page back, from device memory to
681− * system memory, so that the CPU can access it. This might fail for various
682− * reasons (device issues, device have been unplugged, ...). When such error
683− * conditions happen, the page_fault() callback must return VM_FAULT_SIGBUS and
684− * set the CPU page table entry to "poisoned".
685− *
686− * Note that because memory cgroup charges are transferred to the device memory,
687− * this should never fail due to memory restrictions. However, allocation
688− * of a regular system page might still fail because we are out of memory. If
689− * that happens, the page_fault() callback must return VM_FAULT_OOM.
690− *
691− * The page_fault() callback can also try to migrate back multiple pages in one
692− * chunk, as an optimization. It must, however, prioritize the faulting address
693− * over all the others.
694− */
695−typedef vm_fault_t (*dev_page_fault_t)(struct vm_area_struct *vma,
696− unsigned long addr,
697− const struct page *page,
698− unsigned int flags,
699− pmd_t *pmdp);
700−
701−struct hmm_devmem {
702− struct completion completion;
703− unsigned long pfn_first;
704− unsigned long pfn_last;
705− struct resource *resource;
706− struct device *device;
707− struct dev_pagemap pagemap;
708− const struct hmm_devmem_ops *ops;
709− struct percpu_ref ref;
710− dev_page_fault_t page_fault;
711−};
712−
713−/*
714− * To add (hotplug) device memory, HMM assumes that there is no real resource
715− * that reserves a range in the physical address space (this is intended to be
716− * use by unaddressable device memory). It will reserve a physical range big
717− * enough and allocate struct page for it.
718− *
719− * The device driver can wrap the hmm_devmem struct inside a private device
720− * driver struct.
721− */
722−struct hmm_devmem *hmm_devmem_add(const struct hmm_devmem_ops *ops,
723− struct device *device,
724− unsigned long size);
725−struct hmm_devmem *hmm_devmem_add_resource(const struct hmm_devmem_ops *ops,
726− struct device *device,
727− struct resource *res);
728−
729−/*
730− * hmm_devmem_page_set_drvdata - set per-page driver data field
731− *
732− * @page: pointer to struct page
733− * @data: driver data value to set
734− *
735− * Because page can not be on lru we have an unsigned long that driver can use
736− * to store a per page field. This just a simple helper to do that.
737− */
738−static inline void hmm_devmem_page_set_drvdata(struct page *page,
739− unsigned long data)
740−{
741− page->hmm_data = data;
742−}
743−
744−/*
745− * hmm_devmem_page_get_drvdata - get per page driver data field
746− *
747− * @page: pointer to struct page
748− * Return: driver data value
749− */
750−static inline unsigned long hmm_devmem_page_get_drvdata(const struct page *page)
751−{
752− return page->hmm_data;
753−}
754−
755−
756−/*
757− * struct hmm_device - fake device to hang device memory onto
758− *
759− * @device: device struct
760− * @minor: device minor number
761− */
762−struct hmm_device {
763− struct device device;
764− unsigned int minor;
765−};
766−
767−/*
768− * A device driver that wants to handle multiple devices memory through a
769− * single fake device can use hmm_device to do so. This is purely a helper and
770− * it is not strictly needed, in order to make use of any HMM functionality.
771− */
772−struct hmm_device *hmm_device_new(void *drvdata);
773−void hmm_device_put(struct hmm_device *hmm_device);
774−#endif /* CONFIG_DEVICE_PRIVATE || CONFIG_DEVICE_PUBLIC */
775−#else /* IS_ENABLED(CONFIG_HMM) */
776−static inline void hmm_mm_destroy(struct mm_struct *mm) {}
777−static inline void hmm_mm_init(struct mm_struct *mm) {}
778−#endif /* IS_ENABLED(CONFIG_HMM) */
779−
780496 #endif /* LINUX_HMM_H */
include/linux/host1x.h+2−0
@@ -297,6 +297,8 @@ struct host1x_device { · 296 unmodified lines
297297 struct list_head clients;
298298
299299 bool registered;
300+
301+ struct device_dma_parameters dma_parms;
300302 };
301303
302304 static inline struct host1x_device *to_host1x_device(struct device *dev)
include/linux/hrtimer.h+1−15
@@ -12,8 +12,8 @@ · 11 unmodified lines
1212 #ifndef _LINUX_HRTIMER_H
1313 #define _LINUX_HRTIMER_H
1414
15+#include <linux/hrtimer_defs.h>
1516 #include <linux/rbtree.h>
16−#include <linux/ktime.h>
1717 #include <linux/init.h>
1818 #include <linux/list.h>
1919 #include <linux/percpu.h>
@@ -298,26 +298,12 @@ struct clock_event_device; · 278 unmodified lines
298298
299299 extern void hrtimer_interrupt(struct clock_event_device *dev);
300300
301−/*
302− * The resolution of the clocks. The resolution value is returned in
303− * the clock_getres() system call to give application programmers an
304− * idea of the (in)accuracy of timers. Timer values are rounded up to
305− * this resolution values.
306− */
307−# define HIGH_RES_NSEC 1
308−# define KTIME_HIGH_RES (HIGH_RES_NSEC)
309−# define MONOTONIC_RES_NSEC HIGH_RES_NSEC
310−# define KTIME_MONOTONIC_RES KTIME_HIGH_RES
311−
312301 extern void clock_was_set_delayed(void);
313302
314303 extern unsigned int hrtimer_resolution;
315304
316305 #else
317306
318−# define MONOTONIC_RES_NSEC LOW_RES_NSEC
319−# define KTIME_MONOTONIC_RES KTIME_LOW_RES
320−
321307 #define hrtimer_resolution (unsigned int)LOW_RES_NSEC
322308
323309 static inline void clock_was_set_delayed(void) { }
include/linux/hrtimer_defs.h+27−0
@@ -0,0 +1,27 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef _LINUX_HRTIMER_DEFS_H
3+#define _LINUX_HRTIMER_DEFS_H
4+
5+#include <linux/ktime.h>
6+
7+#ifdef CONFIG_HIGH_RES_TIMERS
8+
9+/*
10+ * The resolution of the clocks. The resolution value is returned in
11+ * the clock_getres() system call to give application programmers an
12+ * idea of the (in)accuracy of timers. Timer values are rounded up to
13+ * this resolution values.
14+ */
15+# define HIGH_RES_NSEC 1
16+# define KTIME_HIGH_RES (HIGH_RES_NSEC)
17+# define MONOTONIC_RES_NSEC HIGH_RES_NSEC
18+# define KTIME_MONOTONIC_RES KTIME_HIGH_RES
19+
20+#else
21+
22+# define MONOTONIC_RES_NSEC LOW_RES_NSEC
23+# define KTIME_MONOTONIC_RES KTIME_LOW_RES
24+
25+#endif
26+
27+#endif
include/linux/huge_mm.h+23−0
@@ -121,6 +121,23 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) · 120 unmodified lines
121121
122122 bool transparent_hugepage_enabled(struct vm_area_struct *vma);
123123
124+#define HPAGE_CACHE_INDEX_MASK (HPAGE_PMD_NR - 1)
125+
126+static inline bool transhuge_vma_suitable(struct vm_area_struct *vma,
127+ unsigned long haddr)
128+{
129+ /* Don't have to check pgoff for anonymous vma */
130+ if (!vma_is_anonymous(vma)) {
131+ if (((vma->vm_start >> PAGE_SHIFT) & HPAGE_CACHE_INDEX_MASK) !=
132+ (vma->vm_pgoff & HPAGE_CACHE_INDEX_MASK))
133+ return false;
134+ }
135+
136+ if (haddr < vma->vm_start || haddr + HPAGE_PMD_SIZE > vma->vm_end)
137+ return false;
138+ return true;
139+}
140+
124141 #define transparent_hugepage_use_zero_page() \
125142 (transparent_hugepage_flags & \
126143 (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG))
@@ -271,6 +288,12 @@ static inline bool transparent_hugepage_enabled(struct vm_area_struct *vma) · 144 unmodified lines
271288 return false;
272289 }
273290
291+static inline bool transhuge_vma_suitable(struct vm_area_struct *vma,
292+ unsigned long haddr)
293+{
294+ return false;
295+}
296+
274297 static inline void prep_transhuge_page(struct page *page) {}
275298
276299 #define transparent_hugepage_flags 0UL
include/linux/hugetlb.h+86−34
@@ -16,29 +16,11 @@ struct user_struct; · 15 unmodified lines
1616 struct mmu_gather;
1717
1818 #ifndef is_hugepd
19−/*
20− * Some architectures requires a hugepage directory format that is
21− * required to support multiple hugepage sizes. For example
22− * a4fe3ce76 "powerpc/mm: Allow more flexible layouts for hugepage pagetables"
23− * introduced the same on powerpc. This allows for a more flexible hugepage
24− * pagetable layout.
25− */
2619 typedef struct { unsigned long pd; } hugepd_t;
2720 #define is_hugepd(hugepd) (0)
2821 #define __hugepd(x) ((hugepd_t) { (x) })
29−static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
30− unsigned pdshift, unsigned long end,
31− int write, struct page **pages, int *nr)
32−{
33− return 0;
34−}
35−#else
36−extern int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
37− unsigned pdshift, unsigned long end,
38− int write, struct page **pages, int *nr);
3922 #endif
4023
41−
4224 #ifdef CONFIG_HUGETLB_PAGE
4325
4426 #include <linux/mempolicy.h>
@@ -608,22 +590,92 @@ static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, · 563 unmodified lines
608590
609591 #else /* CONFIG_HUGETLB_PAGE */
610592 struct hstate {};
611−#define alloc_huge_page(v, a, r) NULL
612−#define alloc_huge_page_node(h, nid) NULL
613−#define alloc_huge_page_nodemask(h, preferred_nid, nmask) NULL
614−#define alloc_huge_page_vma(h, vma, address) NULL
615−#define alloc_bootmem_huge_page(h) NULL
616−#define hstate_file(f) NULL
617−#define hstate_sizelog(s) NULL
618−#define hstate_vma(v) NULL
619−#define hstate_inode(i) NULL
620−#define page_hstate(page) NULL
621−#define huge_page_size(h) PAGE_SIZE
622−#define huge_page_mask(h) PAGE_MASK
623−#define vma_kernel_pagesize(v) PAGE_SIZE
624−#define vma_mmu_pagesize(v) PAGE_SIZE
625−#define huge_page_order(h) 0
626−#define huge_page_shift(h) PAGE_SHIFT
593+
594+static inline struct page *alloc_huge_page(struct vm_area_struct *vma,
595+ unsigned long addr,
596+ int avoid_reserve)
597+{
598+ return NULL;
599+}
600+
601+static inline struct page *alloc_huge_page_node(struct hstate *h, int nid)
602+{
603+ return NULL;
604+}
605+
606+static inline struct page *
607+alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask)
608+{
609+ return NULL;
610+}
611+
612+static inline struct page *alloc_huge_page_vma(struct hstate *h,
613+ struct vm_area_struct *vma,
614+ unsigned long address)
615+{
616+ return NULL;
617+}
618+
619+static inline int __alloc_bootmem_huge_page(struct hstate *h)
620+{
621+ return 0;
622+}
623+
624+static inline struct hstate *hstate_file(struct file *f)
625+{
626+ return NULL;
627+}
628+
629+static inline struct hstate *hstate_sizelog(int page_size_log)
630+{
631+ return NULL;
632+}
633+
634+static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
635+{
636+ return NULL;
637+}
638+
639+static inline struct hstate *hstate_inode(struct inode *i)
640+{
641+ return NULL;
642+}
643+
644+static inline struct hstate *page_hstate(struct page *page)
645+{
646+ return NULL;
647+}
648+
649+static inline unsigned long huge_page_size(struct hstate *h)
650+{
651+ return PAGE_SIZE;
652+}
653+
654+static inline unsigned long huge_page_mask(struct hstate *h)
655+{
656+ return PAGE_MASK;
657+}
658+
659+static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
660+{
661+ return PAGE_SIZE;
662+}
663+
664+static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
665+{
666+ return PAGE_SIZE;
667+}
668+
669+static inline unsigned int huge_page_order(struct hstate *h)
670+{
671+ return 0;
672+}
673+
674+static inline unsigned int huge_page_shift(struct hstate *h)
675+{
676+ return PAGE_SHIFT;
677+}
678+
627679 static inline bool hstate_is_gigantic(struct hstate *h)
628680 {
629681 return false;
include/linux/hw_random.h+1−1
@@ -1,7 +1,7 @@
11 /*
22 Hardware Random Number Generator
33
4− Please read Documentation/hw_random.txt for details on use.
4+ Please read Documentation/admin-guide/hw_random.rst for details on use.
55
66 ----------------------------------------------------------
77 This software may be used and distributed according to the terms
include/linux/hwspinlock.h+58−3
@@ -14,9 +14,10 @@ · 13 unmodified lines
1414 #include <linux/sched.h>
1515
1616 /* hwspinlock mode argument */
17−#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
18−#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
19−#define HWLOCK_RAW 0x03
17+#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
18+#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
19+#define HWLOCK_RAW 0x03
20+#define HWLOCK_IN_ATOMIC 0x04 /* Called while in atomic context */
2021
2122 struct device;
2223 struct device_node;
@@ -222,6 +223,23 @@ static inline int hwspin_trylock_raw(struct hwspinlock *hwlock) · 199 unmodified lines
222223 return __hwspin_trylock(hwlock, HWLOCK_RAW, NULL);
223224 }
224225
226+/**
227+ * hwspin_trylock_in_atomic() - attempt to lock a specific hwspinlock
228+ * @hwlock: an hwspinlock which we want to trylock
229+ *
230+ * This function attempts to lock an hwspinlock, and will immediately fail
231+ * if the hwspinlock is already taken.
232+ *
233+ * This function shall be called only from an atomic context.
234+ *
235+ * Returns 0 if we successfully locked the hwspinlock, -EBUSY if
236+ * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
237+ */
238+static inline int hwspin_trylock_in_atomic(struct hwspinlock *hwlock)
239+{
240+ return __hwspin_trylock(hwlock, HWLOCK_IN_ATOMIC, NULL);
241+}
242+
225243 /**
226244 * hwspin_trylock() - attempt to lock a specific hwspinlock
227245 * @hwlock: an hwspinlock which we want to trylock
@@ -312,6 +330,28 @@ int hwspin_lock_timeout_raw(struct hwspinlock *hwlock, unsigned int to) · 84 unmodified lines
312330 return __hwspin_lock_timeout(hwlock, to, HWLOCK_RAW, NULL);
313331 }
314332
333+/**
334+ * hwspin_lock_timeout_in_atomic() - lock an hwspinlock with timeout limit
335+ * @hwlock: the hwspinlock to be locked
336+ * @to: timeout value in msecs
337+ *
338+ * This function locks the underlying @hwlock. If the @hwlock
339+ * is already taken, the function will busy loop waiting for it to
340+ * be released, but give up when @timeout msecs have elapsed.
341+ *
342+ * This function shall be called only from an atomic context and the timeout
343+ * value shall not exceed a few msecs.
344+ *
345+ * Returns 0 when the @hwlock was successfully taken, and an appropriate
346+ * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
347+ * busy after @timeout msecs). The function will never sleep.
348+ */
349+static inline
350+int hwspin_lock_timeout_in_atomic(struct hwspinlock *hwlock, unsigned int to)
351+{
352+ return __hwspin_lock_timeout(hwlock, to, HWLOCK_IN_ATOMIC, NULL);
353+}
354+
315355 /**
316356 * hwspin_lock_timeout() - lock an hwspinlock with timeout limit
317357 * @hwlock: the hwspinlock to be locked
@@ -386,6 +426,21 @@ static inline void hwspin_unlock_raw(struct hwspinlock *hwlock) · 68 unmodified lines
386426 __hwspin_unlock(hwlock, HWLOCK_RAW, NULL);
387427 }
388428
429+/**
430+ * hwspin_unlock_in_atomic() - unlock hwspinlock
431+ * @hwlock: a previously-acquired hwspinlock which we want to unlock
432+ *
433+ * This function will unlock a specific hwspinlock.
434+ *
435+ * @hwlock must be already locked (e.g. by hwspin_trylock()) before calling
436+ * this function: it is a bug to call unlock on a @hwlock that is already
437+ * unlocked.
438+ */
439+static inline void hwspin_unlock_in_atomic(struct hwspinlock *hwlock)
440+{
441+ __hwspin_unlock(hwlock, HWLOCK_IN_ATOMIC, NULL);
442+}
443+
389444 /**
390445 * hwspin_unlock() - unlock hwspinlock
391446 * @hwlock: a previously-acquired hwspinlock which we want to unlock
include/linux/i2c.h+53−46
@@ -1,19 +1,16 @@
11 /* SPDX-License-Identifier: GPL-2.0-or-later */
2−/* ------------------------------------------------------------------------- */
3−/* */
4−/* i2c.h - definitions for the i2c-bus interface */
5−/* */
6−/* ------------------------------------------------------------------------- */
7−/* Copyright (C) 1995-2000 Simon G. Vogl
8−
2+/*
3+ * i2c.h - definitions for the Linux i2c bus interface
4+ * Copyright (C) 1995-2000 Simon G. Vogl
5+ * Copyright (C) 2013-2019 Wolfram Sang <wsa@the-dreams.de>
6+ *
7+ * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
8+ * Frodo Looijaard <frodol@dds.nl>
99 */
10−/* ------------------------------------------------------------------------- */
11−
12−/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
13− Frodo Looijaard <frodol@dds.nl> */
1410 #ifndef _LINUX_I2C_H
1511 #define _LINUX_I2C_H
1612
13+#include <linux/acpi.h> /* for acpi_handle */
1714 #include <linux/mod_devicetable.h>
1815 #include <linux/device.h> /* for struct device */
1916 #include <linux/sched.h> /* for completion */
@@ -39,7 +36,8 @@ struct i2c_device_identity; · 19 unmodified lines
3936 union i2c_smbus_data;
4037 struct i2c_board_info;
4138 enum i2c_slave_event;
42−typedef int (*i2c_slave_cb_t)(struct i2c_client *, enum i2c_slave_event, u8 *);
39+typedef int (*i2c_slave_cb_t)(struct i2c_client *client,
40+ enum i2c_slave_event event, u8 *val);
4341
4442 struct module;
4543 struct property_entry;
@@ -256,16 +254,16 @@ struct i2c_driver { · 210 unmodified lines
256254 unsigned int class;
257255
258256 /* Standard driver model interfaces */
259− int (*probe)(struct i2c_client *, const struct i2c_device_id *);
260− int (*remove)(struct i2c_client *);
257+ int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
258+ int (*remove)(struct i2c_client *client);
261259
262260 /* New driver model interface to aid the seamless removal of the
263261 * current probe()'s, more commonly unused than used second parameter.
264262 */
265− int (*probe_new)(struct i2c_client *);
263+ int (*probe_new)(struct i2c_client *client);
266264
267265 /* driver model interfaces that don't relate to enumeration */
268− void (*shutdown)(struct i2c_client *);
266+ void (*shutdown)(struct i2c_client *client);
269267
270268 /* Alert callback, for example for the SMBus alert protocol.
271269 * The format and meaning of the data value depends on the protocol.
@@ -274,7 +272,7 @@ struct i2c_driver { · 2 unmodified lines
274272 * For the SMBus Host Notify protocol, the data corresponds to the
275273 * 16-bit payload data reported by the slave device acting as master.
276274 */
277− void (*alert)(struct i2c_client *, enum i2c_alert_protocol protocol,
275+ void (*alert)(struct i2c_client *client, enum i2c_alert_protocol protocol,
278276 unsigned int data);
279277
280278 /* a ioctl like command that can be used to perform specific functions
@@ -286,7 +284,7 @@ struct i2c_driver { · 5 unmodified lines
286284 const struct i2c_device_id *id_table;
287285
288286 /* Device detection callback for automatic device creation */
289− int (*detect)(struct i2c_client *, struct i2c_board_info *);
287+ int (*detect)(struct i2c_client *client, struct i2c_board_info *info);
290288 const unsigned short *address_list;
291289 struct list_head clients;
292290
@@ -296,8 +294,7 @@ struct i2c_driver { · 3 unmodified lines
296294
297295 /**
298296 * struct i2c_client - represent an I2C slave device
299− * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address;
300− * I2C_CLIENT_PEC indicates it uses SMBus Packet Error Checking
297+ * @flags: see I2C_CLIENT_* for possible flags
301298 * @addr: Address used on the I2C bus connected to the parent adapter.
302299 * @name: Indicates the type of the device, usually a chip name that's
303300 * generic enough to hide second-sourcing and compatible revisions.
@@ -315,6 +312,15 @@ struct i2c_driver { · 11 unmodified lines
315312 */
316313 struct i2c_client {
317314 unsigned short flags; /* div., see below */
315+#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
316+#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
317+ /* Must equal I2C_M_TEN below */
318+#define I2C_CLIENT_SLAVE 0x20 /* we are the slave */
319+#define I2C_CLIENT_HOST_NOTIFY 0x40 /* We want to use I2C host notify */
320+#define I2C_CLIENT_WAKE 0x80 /* for board_info; true iff can wake */
321+#define I2C_CLIENT_SCCB 0x9000 /* Use Omnivision SCCB protocol */
322+ /* Must match I2C_M_STOP|IGNORE_NAK */
323+
318324 unsigned short addr; /* chip address - NOTE: 7bit */
319325 /* addresses are stored in the */
320326 /* _LOWER_ 7 bits */
@@ -436,6 +442,9 @@ struct i2c_board_info { · 115 unmodified lines
436442 extern struct i2c_client *
437443 i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info);
438444
445+extern struct i2c_client *
446+i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *info);
447+
439448 /* If you don't know the exact address of an I2C device, use this variant
440449 * instead, which can probe for device presence in a list of possible
441450 * addresses. The "probe" callback function is optional. If it is provided,
@@ -446,10 +455,10 @@ extern struct i2c_client * · 4 unmodified lines
446455 i2c_new_probed_device(struct i2c_adapter *adap,
447456 struct i2c_board_info *info,
448457 unsigned short const *addr_list,
449− int (*probe)(struct i2c_adapter *, unsigned short addr));
458+ int (*probe)(struct i2c_adapter *adap, unsigned short addr));
450459
451460 /* Common custom probe functions */
452−extern int i2c_probe_func_quick_read(struct i2c_adapter *, unsigned short addr);
461+extern int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr);
453462
454463 /* For devices that use several addresses, use i2c_new_dummy() to make
455464 * client handles for the extra addresses.
@@ -457,6 +466,9 @@ extern int i2c_probe_func_quick_read(struct i2c_adapter *, unsigned short addr); · 1 unmodified line
457466 extern struct i2c_client *
458467 i2c_new_dummy(struct i2c_adapter *adap, u16 address);
459468
469+extern struct i2c_client *
470+i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address);
471+
460472 extern struct i2c_client *
461473 devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address);
462474
@@ -465,7 +477,7 @@ i2c_new_secondary_device(struct i2c_client *client, · 2 unmodified lines
465477 const char *name,
466478 u16 default_addr);
467479
468−extern void i2c_unregister_device(struct i2c_client *);
480+extern void i2c_unregister_device(struct i2c_client *client);
469481 #endif /* I2C */
470482
471483 /* Mainboard arch_initcall() code should register all its I2C devices.
@@ -550,9 +562,9 @@ struct i2c_algorithm { · 78 unmodified lines
550562 * The main operations are wrapped by i2c_lock_bus and i2c_unlock_bus.
551563 */
552564 struct i2c_lock_operations {
553− void (*lock_bus)(struct i2c_adapter *, unsigned int flags);
554− int (*trylock_bus)(struct i2c_adapter *, unsigned int flags);
555− void (*unlock_bus)(struct i2c_adapter *, unsigned int flags);
565+ void (*lock_bus)(struct i2c_adapter *adapter, unsigned int flags);
566+ int (*trylock_bus)(struct i2c_adapter *adapter, unsigned int flags);
567+ void (*unlock_bus)(struct i2c_adapter *adapter, unsigned int flags);
556568 };
557569
558570 /**
@@ -702,14 +714,14 @@ struct i2c_adapter { · 143 unmodified lines
702714 };
703715 #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
704716
705−static inline void *i2c_get_adapdata(const struct i2c_adapter *dev)
717+static inline void *i2c_get_adapdata(const struct i2c_adapter *adap)
706718 {
707− return dev_get_drvdata(&dev->dev);
719+ return dev_get_drvdata(&adap->dev);
708720 }
709721
710−static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
722+static inline void i2c_set_adapdata(struct i2c_adapter *adap, void *data)
711723 {
712− dev_set_drvdata(&dev->dev, data);
724+ dev_set_drvdata(&adap->dev, data);
713725 }
714726
715727 static inline struct i2c_adapter *
@@ -725,7 +737,7 @@ i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) · 9 unmodified lines
725737 return NULL;
726738 }
727739
728−int i2c_for_each_dev(void *data, int (*fn)(struct device *, void *));
740+int i2c_for_each_dev(void *data, int (*fn)(struct device *dev, void *data));
729741
730742 /* Adapter locking functions, exported for shared pin cases */
731743 #define I2C_LOCK_ROOT_ADAPTER BIT(0)
@@ -801,16 +813,6 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap) · 69 unmodified lines
801813 i2c_unlock_bus(adap, I2C_LOCK_ROOT_ADAPTER);
802814 }
803815
804−/*flags for the client struct: */
805−#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
806−#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
807− /* Must equal I2C_M_TEN below */
808−#define I2C_CLIENT_SLAVE 0x20 /* we are the slave */
809−#define I2C_CLIENT_HOST_NOTIFY 0x40 /* We want to use I2C host notify */
810−#define I2C_CLIENT_WAKE 0x80 /* for board_info; true iff can wake */
811−#define I2C_CLIENT_SCCB 0x9000 /* Use Omnivision SCCB protocol */
812− /* Must match I2C_M_STOP|IGNORE_NAK */
813−
814816 /* i2c adapter classes (bitmask) */
815817 #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
816818 #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
@@ -831,12 +833,12 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap) · 14 unmodified lines
831833 /* administration...
832834 */
833835 #if IS_ENABLED(CONFIG_I2C)
834−extern int i2c_add_adapter(struct i2c_adapter *);
835−extern void i2c_del_adapter(struct i2c_adapter *);
836−extern int i2c_add_numbered_adapter(struct i2c_adapter *);
836+extern int i2c_add_adapter(struct i2c_adapter *adap);
837+extern void i2c_del_adapter(struct i2c_adapter *adap);
838+extern int i2c_add_numbered_adapter(struct i2c_adapter *adap);
837839
838−extern int i2c_register_driver(struct module *, struct i2c_driver *);
839−extern void i2c_del_driver(struct i2c_driver *);
840+extern int i2c_register_driver(struct module *owner, struct i2c_driver *driver);
841+extern void i2c_del_driver(struct i2c_driver *driver);
840842
841843 /* use a define to avoid include chaining to get THIS_MODULE */
842844 #define i2c_add_driver(driver) \
@@ -981,6 +983,7 @@ bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares, · 138 unmodified lines
981983 u32 i2c_acpi_find_bus_speed(struct device *dev);
982984 struct i2c_client *i2c_acpi_new_device(struct device *dev, int index,
983985 struct i2c_board_info *info);
986+struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle);
984987 #else
985988 static inline bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares,
986989 struct acpi_resource_i2c_serialbus **i2c)
@@ -996,6 +999,10 @@ static inline struct i2c_client *i2c_acpi_new_device(struct device *dev, · 9 unmodified lines
996999 {
9971000 return NULL;
9981001 }
1002+static inline struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
1003+{
1004+ return NULL;
1005+}
9991006 #endif /* CONFIG_ACPI */
10001007
10011008 #endif /* _LINUX_I2C_H */
include/linux/i3c/master.h+6−4
@@ -48,7 +48,7 @@ struct i3c_i2c_dev_desc { · 47 unmodified lines
4848 #define I3C_LVR_I2C_INDEX(x) ((x) << 5)
4949 #define I3C_LVR_I2C_FM_MODE BIT(4)
5050
51−#define I2C_MAX_ADDR GENMASK(9, 0)
51+#define I2C_MAX_ADDR GENMASK(6, 0)
5252
5353 /**
5454 * struct i2c_dev_boardinfo - I2C device board information
@@ -250,12 +250,17 @@ struct i3c_device { · 195 unmodified lines
250250 * the bus. The only impact in this mode is that the
251251 * high SCL pulse has to stay below 50ns to trick I2C
252252 * devices when transmitting I3C frames
253+ * @I3C_BUS_MODE_MIXED_LIMITED: I2C devices without 50ns spike filter are
254+ * present on the bus. However they allow
255+ * compliance up to the maximum SDR SCL clock
256+ * frequency.
253257 * @I3C_BUS_MODE_MIXED_SLOW: I2C devices without 50ns spike filter are present
254258 * on the bus
255259 */
256260 enum i3c_bus_mode {
257261 I3C_BUS_MODE_PURE,
258262 I3C_BUS_MODE_MIXED_FAST,
263+ I3C_BUS_MODE_MIXED_LIMITED,
259264 I3C_BUS_MODE_MIXED_SLOW,
260265 };
261266
@@ -390,8 +395,6 @@ struct i3c_bus { · 128 unmodified lines
390395 * and i2c_put_dma_safe_msg_buf() helpers provided by the I2C
391396 * framework.
392397 * This method is mandatory.
393− * @i2c_funcs: expose the supported I2C functionalities.
394− * This method is mandatory.
395398 * @request_ibi: attach an IBI handler to an I3C device. This implies defining
396399 * an IBI handler and the constraints of the IBI (maximum payload
397400 * length and number of pre-allocated slots).
@@ -437,7 +440,6 @@ struct i3c_master_controller_ops { · 39 unmodified lines
437440 void (*detach_i2c_dev)(struct i2c_dev_desc *dev);
438441 int (*i2c_xfers)(struct i2c_dev_desc *dev,
439442 const struct i2c_msg *xfers, int nxfers);
440− u32 (*i2c_funcs)(struct i3c_master_controller *master);
441443 int (*request_ibi)(struct i3c_dev_desc *dev,
442444 const struct i3c_ibi_setup *req);
443445 void (*free_ibi)(struct i3c_dev_desc *dev);
include/linux/ide.h+136−136
@@ -253,9 +253,9 @@ static inline void ide_std_init_ports(struct ide_hw *hw, · 252 unmodified lines
253253 * Special Driver Flags
254254 */
255255 enum {
256− IDE_SFLAG_SET_GEOMETRY = (1 << 0),
257− IDE_SFLAG_RECALIBRATE = (1 << 1),
258− IDE_SFLAG_SET_MULTMODE = (1 << 2),
256+ IDE_SFLAG_SET_GEOMETRY = BIT(0),
257+ IDE_SFLAG_RECALIBRATE = BIT(1),
258+ IDE_SFLAG_SET_MULTMODE = BIT(2),
259259 };
260260
261261 /*
@@ -267,13 +267,13 @@ typedef enum { · 5 unmodified lines
267267 } ide_startstop_t;
268268
269269 enum {
270− IDE_VALID_ERROR = (1 << 1),
270+ IDE_VALID_ERROR = BIT(1),
271271 IDE_VALID_FEATURE = IDE_VALID_ERROR,
272− IDE_VALID_NSECT = (1 << 2),
273− IDE_VALID_LBAL = (1 << 3),
274− IDE_VALID_LBAM = (1 << 4),
275− IDE_VALID_LBAH = (1 << 5),
276− IDE_VALID_DEVICE = (1 << 6),
272+ IDE_VALID_NSECT = BIT(2),
273+ IDE_VALID_LBAL = BIT(3),
274+ IDE_VALID_LBAM = BIT(4),
275+ IDE_VALID_LBAH = BIT(5),
276+ IDE_VALID_DEVICE = BIT(6),
277277 IDE_VALID_LBA = IDE_VALID_LBAL |
278278 IDE_VALID_LBAM |
279279 IDE_VALID_LBAH,
@@ -289,24 +289,24 @@ enum { · 9 unmodified lines
289289 };
290290
291291 enum {
292− IDE_TFLAG_LBA48 = (1 << 0),
293− IDE_TFLAG_WRITE = (1 << 1),
294− IDE_TFLAG_CUSTOM_HANDLER = (1 << 2),
295− IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 3),
292+ IDE_TFLAG_LBA48 = BIT(0),
293+ IDE_TFLAG_WRITE = BIT(1),
294+ IDE_TFLAG_CUSTOM_HANDLER = BIT(2),
295+ IDE_TFLAG_DMA_PIO_FALLBACK = BIT(3),
296296 /* force 16-bit I/O operations */
297− IDE_TFLAG_IO_16BIT = (1 << 4),
297+ IDE_TFLAG_IO_16BIT = BIT(4),
298298 /* struct ide_cmd was allocated using kmalloc() */
299− IDE_TFLAG_DYN = (1 << 5),
300− IDE_TFLAG_FS = (1 << 6),
301− IDE_TFLAG_MULTI_PIO = (1 << 7),
302− IDE_TFLAG_SET_XFER = (1 << 8),
299+ IDE_TFLAG_DYN = BIT(5),
300+ IDE_TFLAG_FS = BIT(6),
301+ IDE_TFLAG_MULTI_PIO = BIT(7),
302+ IDE_TFLAG_SET_XFER = BIT(8),
303303 };
304304
305305 enum {
306− IDE_FTFLAG_FLAGGED = (1 << 0),
307− IDE_FTFLAG_SET_IN_FLAGS = (1 << 1),
308− IDE_FTFLAG_OUT_DATA = (1 << 2),
309− IDE_FTFLAG_IN_DATA = (1 << 3),
306+ IDE_FTFLAG_FLAGGED = BIT(0),
307+ IDE_FTFLAG_SET_IN_FLAGS = BIT(1),
308+ IDE_FTFLAG_OUT_DATA = BIT(2),
309+ IDE_FTFLAG_IN_DATA = BIT(3),
310310 };
311311
312312 struct ide_taskfile {
@@ -357,13 +357,13 @@ struct ide_cmd { · 44 unmodified lines
357357 /* ATAPI packet command flags */
358358 enum {
359359 /* set when an error is considered normal - no retry (ide-tape) */
360− PC_FLAG_ABORT = (1 << 0),
361− PC_FLAG_SUPPRESS_ERROR = (1 << 1),
362− PC_FLAG_WAIT_FOR_DSC = (1 << 2),
363− PC_FLAG_DMA_OK = (1 << 3),
364− PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
365− PC_FLAG_DMA_ERROR = (1 << 5),
366− PC_FLAG_WRITING = (1 << 6),
360+ PC_FLAG_ABORT = BIT(0),
361+ PC_FLAG_SUPPRESS_ERROR = BIT(1),
362+ PC_FLAG_WAIT_FOR_DSC = BIT(2),
363+ PC_FLAG_DMA_OK = BIT(3),
364+ PC_FLAG_DMA_IN_PROGRESS = BIT(4),
365+ PC_FLAG_DMA_ERROR = BIT(5),
366+ PC_FLAG_WRITING = BIT(6),
367367 };
368368
369369 #define ATAPI_WAIT_PC (60 * HZ)
@@ -417,111 +417,111 @@ struct ide_disk_ops { · 47 unmodified lines
417417
418418 /* ATAPI device flags */
419419 enum {
420− IDE_AFLAG_DRQ_INTERRUPT = (1 << 0),
420+ IDE_AFLAG_DRQ_INTERRUPT = BIT(0),
421421
422422 /* ide-cd */
423423 /* Drive cannot eject the disc. */
424− IDE_AFLAG_NO_EJECT = (1 << 1),
424+ IDE_AFLAG_NO_EJECT = BIT(1),
425425 /* Drive is a pre ATAPI 1.2 drive. */
426− IDE_AFLAG_PRE_ATAPI12 = (1 << 2),
426+ IDE_AFLAG_PRE_ATAPI12 = BIT(2),
427427 /* TOC addresses are in BCD. */
428− IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3),
428+ IDE_AFLAG_TOCADDR_AS_BCD = BIT(3),
429429 /* TOC track numbers are in BCD. */
430− IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4),
430+ IDE_AFLAG_TOCTRACKS_AS_BCD = BIT(4),
431431 /* Saved TOC information is current. */
432− IDE_AFLAG_TOC_VALID = (1 << 6),
432+ IDE_AFLAG_TOC_VALID = BIT(6),
433433 /* We think that the drive door is locked. */
434− IDE_AFLAG_DOOR_LOCKED = (1 << 7),
434+ IDE_AFLAG_DOOR_LOCKED = BIT(7),
435435 /* SET_CD_SPEED command is unsupported. */
436− IDE_AFLAG_NO_SPEED_SELECT = (1 << 8),
437− IDE_AFLAG_VERTOS_300_SSD = (1 << 9),
438− IDE_AFLAG_VERTOS_600_ESD = (1 << 10),
439− IDE_AFLAG_SANYO_3CD = (1 << 11),
440− IDE_AFLAG_FULL_CAPS_PAGE = (1 << 12),
441− IDE_AFLAG_PLAY_AUDIO_OK = (1 << 13),
442− IDE_AFLAG_LE_SPEED_FIELDS = (1 << 14),
436+ IDE_AFLAG_NO_SPEED_SELECT = BIT(8),
437+ IDE_AFLAG_VERTOS_300_SSD = BIT(9),
438+ IDE_AFLAG_VERTOS_600_ESD = BIT(10),
439+ IDE_AFLAG_SANYO_3CD = BIT(11),
440+ IDE_AFLAG_FULL_CAPS_PAGE = BIT(12),
441+ IDE_AFLAG_PLAY_AUDIO_OK = BIT(13),
442+ IDE_AFLAG_LE_SPEED_FIELDS = BIT(14),
443443
444444 /* ide-floppy */
445445 /* Avoid commands not supported in Clik drive */
446− IDE_AFLAG_CLIK_DRIVE = (1 << 15),
446+ IDE_AFLAG_CLIK_DRIVE = BIT(15),
447447 /* Requires BH algorithm for packets */
448− IDE_AFLAG_ZIP_DRIVE = (1 << 16),
448+ IDE_AFLAG_ZIP_DRIVE = BIT(16),
449449 /* Supports format progress report */
450− IDE_AFLAG_SRFP = (1 << 17),
450+ IDE_AFLAG_SRFP = BIT(17),
451451
452452 /* ide-tape */
453− IDE_AFLAG_IGNORE_DSC = (1 << 18),
453+ IDE_AFLAG_IGNORE_DSC = BIT(18),
454454 /* 0 When the tape position is unknown */
455− IDE_AFLAG_ADDRESS_VALID = (1 << 19),
455+ IDE_AFLAG_ADDRESS_VALID = BIT(19),
456456 /* Device already opened */
457− IDE_AFLAG_BUSY = (1 << 20),
457+ IDE_AFLAG_BUSY = BIT(20),
458458 /* Attempt to auto-detect the current user block size */
459− IDE_AFLAG_DETECT_BS = (1 << 21),
459+ IDE_AFLAG_DETECT_BS = BIT(21),
460460 /* Currently on a filemark */
461− IDE_AFLAG_FILEMARK = (1 << 22),
461+ IDE_AFLAG_FILEMARK = BIT(22),
462462 /* 0 = no tape is loaded, so we don't rewind after ejecting */
463− IDE_AFLAG_MEDIUM_PRESENT = (1 << 23),
463+ IDE_AFLAG_MEDIUM_PRESENT = BIT(23),
464464
465− IDE_AFLAG_NO_AUTOCLOSE = (1 << 24),
465+ IDE_AFLAG_NO_AUTOCLOSE = BIT(24),
466466 };
467467
468468 /* device flags */
469469 enum {
470470 /* restore settings after device reset */
471− IDE_DFLAG_KEEP_SETTINGS = (1 << 0),
471+ IDE_DFLAG_KEEP_SETTINGS = BIT(0),
472472 /* device is using DMA for read/write */
473− IDE_DFLAG_USING_DMA = (1 << 1),
473+ IDE_DFLAG_USING_DMA = BIT(1),
474474 /* okay to unmask other IRQs */
475− IDE_DFLAG_UNMASK = (1 << 2),
475+ IDE_DFLAG_UNMASK = BIT(2),
476476 /* don't attempt flushes */
477− IDE_DFLAG_NOFLUSH = (1 << 3),
477+ IDE_DFLAG_NOFLUSH = BIT(3),
478478 /* DSC overlap */
479− IDE_DFLAG_DSC_OVERLAP = (1 << 4),
479+ IDE_DFLAG_DSC_OVERLAP = BIT(4),
480480 /* give potential excess bandwidth */
481− IDE_DFLAG_NICE1 = (1 << 5),
481+ IDE_DFLAG_NICE1 = BIT(5),
482482 /* device is physically present */
483− IDE_DFLAG_PRESENT = (1 << 6),
483+ IDE_DFLAG_PRESENT = BIT(6),
484484 /* disable Host Protected Area */
485− IDE_DFLAG_NOHPA = (1 << 7),
485+ IDE_DFLAG_NOHPA = BIT(7),
486486 /* id read from device (synthetic if not set) */
487− IDE_DFLAG_ID_READ = (1 << 8),
488− IDE_DFLAG_NOPROBE = (1 << 9),
487+ IDE_DFLAG_ID_READ = BIT(8),
488+ IDE_DFLAG_NOPROBE = BIT(9),
489489 /* need to do check_media_change() */
490− IDE_DFLAG_REMOVABLE = (1 << 10),
490+ IDE_DFLAG_REMOVABLE = BIT(10),
491491 /* needed for removable devices */
492− IDE_DFLAG_ATTACH = (1 << 11),
493− IDE_DFLAG_FORCED_GEOM = (1 << 12),
492+ IDE_DFLAG_ATTACH = BIT(11),
493+ IDE_DFLAG_FORCED_GEOM = BIT(12),
494494 /* disallow setting unmask bit */
495− IDE_DFLAG_NO_UNMASK = (1 << 13),
495+ IDE_DFLAG_NO_UNMASK = BIT(13),
496496 /* disallow enabling 32-bit I/O */
497− IDE_DFLAG_NO_IO_32BIT = (1 << 14),
497+ IDE_DFLAG_NO_IO_32BIT = BIT(14),
498498 /* for removable only: door lock/unlock works */
499− IDE_DFLAG_DOORLOCKING = (1 << 15),
499+ IDE_DFLAG_DOORLOCKING = BIT(15),
500500 /* disallow DMA */
501− IDE_DFLAG_NODMA = (1 << 16),
501+ IDE_DFLAG_NODMA = BIT(16),
502502 /* powermanagement told us not to do anything, so sleep nicely */
503− IDE_DFLAG_BLOCKED = (1 << 17),
503+ IDE_DFLAG_BLOCKED = BIT(17),
504504 /* sleeping & sleep field valid */
505− IDE_DFLAG_SLEEPING = (1 << 18),
506− IDE_DFLAG_POST_RESET = (1 << 19),
507− IDE_DFLAG_UDMA33_WARNED = (1 << 20),
508− IDE_DFLAG_LBA48 = (1 << 21),
505+ IDE_DFLAG_SLEEPING = BIT(18),
506+ IDE_DFLAG_POST_RESET = BIT(19),
507+ IDE_DFLAG_UDMA33_WARNED = BIT(20),
508+ IDE_DFLAG_LBA48 = BIT(21),
509509 /* status of write cache */
510− IDE_DFLAG_WCACHE = (1 << 22),
510+ IDE_DFLAG_WCACHE = BIT(22),
511511 /* used for ignoring ATA_DF */
512− IDE_DFLAG_NOWERR = (1 << 23),
512+ IDE_DFLAG_NOWERR = BIT(23),
513513 /* retrying in PIO */
514− IDE_DFLAG_DMA_PIO_RETRY = (1 << 24),
515− IDE_DFLAG_LBA = (1 << 25),
514+ IDE_DFLAG_DMA_PIO_RETRY = BIT(24),
515+ IDE_DFLAG_LBA = BIT(25),
516516 /* don't unload heads */
517− IDE_DFLAG_NO_UNLOAD = (1 << 26),
517+ IDE_DFLAG_NO_UNLOAD = BIT(26),
518518 /* heads unloaded, please don't reset port */
519− IDE_DFLAG_PARKED = (1 << 27),
520− IDE_DFLAG_MEDIA_CHANGED = (1 << 28),
519+ IDE_DFLAG_PARKED = BIT(27),
520+ IDE_DFLAG_MEDIA_CHANGED = BIT(28),
521521 /* write protect */
522− IDE_DFLAG_WP = (1 << 29),
523− IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30),
524− IDE_DFLAG_NIEN_QUIRK = (1 << 31),
522+ IDE_DFLAG_WP = BIT(29),
523+ IDE_DFLAG_FORMAT_IN_PROGRESS = BIT(30),
524+ IDE_DFLAG_NIEN_QUIRK = BIT(31),
525525 };
526526
527527 struct ide_drive_s {
@@ -709,7 +709,7 @@ struct ide_dma_ops { · 181 unmodified lines
709709 };
710710
711711 enum {
712− IDE_PFLAG_PROBING = (1 << 0),
712+ IDE_PFLAG_PROBING = BIT(0),
713713 };
714714
715715 struct ide_host;
@@ -862,7 +862,7 @@ extern struct mutex ide_setting_mtx; · 146 unmodified lines
862862 * configurable drive settings
863863 */
864864
865−#define DS_SYNC (1 << 0)
865+#define DS_SYNC BIT(0)
866866
867867 struct ide_devset {
868868 int (*get)(ide_drive_t *);
@@ -1000,15 +1000,15 @@ static inline void ide_proc_unregister_driver(ide_drive_t *drive, · 131 unmodified lines
10001000
10011001 enum {
10021002 /* enter/exit functions */
1003− IDE_DBG_FUNC = (1 << 0),
1003+ IDE_DBG_FUNC = BIT(0),
10041004 /* sense key/asc handling */
1005− IDE_DBG_SENSE = (1 << 1),
1005+ IDE_DBG_SENSE = BIT(1),
10061006 /* packet commands handling */
1007− IDE_DBG_PC = (1 << 2),
1007+ IDE_DBG_PC = BIT(2),
10081008 /* request handling */
1009− IDE_DBG_RQ = (1 << 3),
1009+ IDE_DBG_RQ = BIT(3),
10101010 /* driver probing/setup */
1011− IDE_DBG_PROBE = (1 << 4),
1011+ IDE_DBG_PROBE = BIT(4),
10121012 };
10131013
10141014 /* DRV_NAME has to be defined in the driver before using the macro below */
@@ -1171,10 +1171,10 @@ ssize_t ide_park_store(struct device *dev, struct device_attribute *attr, · 156 unmodified lines
11711171 * the tail of our block device request queue and wait for their completion.
11721172 */
11731173 enum {
1174− REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */
1175− REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */
1176− REQ_IDETAPE_READ = (1 << 2),
1177− REQ_IDETAPE_WRITE = (1 << 3),
1174+ REQ_IDETAPE_PC1 = BIT(0), /* packet command (first stage) */
1175+ REQ_IDETAPE_PC2 = BIT(1), /* packet command (second stage) */
1176+ REQ_IDETAPE_READ = BIT(2),
1177+ REQ_IDETAPE_WRITE = BIT(3),
11781178 };
11791179
11801180 int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *,
@@ -1264,71 +1264,71 @@ struct ide_pci_enablebit { · 83 unmodified lines
12641264
12651265 enum {
12661266 /* Uses ISA control ports not PCI ones. */
1267− IDE_HFLAG_ISA_PORTS = (1 << 0),
1267+ IDE_HFLAG_ISA_PORTS = BIT(0),
12681268 /* single port device */
1269− IDE_HFLAG_SINGLE = (1 << 1),
1269+ IDE_HFLAG_SINGLE = BIT(1),
12701270 /* don't use legacy PIO blacklist */
1271− IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2),
1271+ IDE_HFLAG_PIO_NO_BLACKLIST = BIT(2),
12721272 /* set for the second port of QD65xx */
1273− IDE_HFLAG_QD_2ND_PORT = (1 << 3),
1273+ IDE_HFLAG_QD_2ND_PORT = BIT(3),
12741274 /* use PIO8/9 for prefetch off/on */
1275− IDE_HFLAG_ABUSE_PREFETCH = (1 << 4),
1275+ IDE_HFLAG_ABUSE_PREFETCH = BIT(4),
12761276 /* use PIO6/7 for fast-devsel off/on */
1277− IDE_HFLAG_ABUSE_FAST_DEVSEL = (1 << 5),
1277+ IDE_HFLAG_ABUSE_FAST_DEVSEL = BIT(5),
12781278 /* use 100-102 and 200-202 PIO values to set DMA modes */
1279− IDE_HFLAG_ABUSE_DMA_MODES = (1 << 6),
1279+ IDE_HFLAG_ABUSE_DMA_MODES = BIT(6),
12801280 /*
12811281 * keep DMA setting when programming PIO mode, may be used only
12821282 * for hosts which have separate PIO and DMA timings (ie. PMAC)
12831283 */
1284− IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = (1 << 7),
1284+ IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = BIT(7),
12851285 /* program host for the transfer mode after programming device */
1286− IDE_HFLAG_POST_SET_MODE = (1 << 8),
1286+ IDE_HFLAG_POST_SET_MODE = BIT(8),
12871287 /* don't program host/device for the transfer mode ("smart" hosts) */
1288− IDE_HFLAG_NO_SET_MODE = (1 << 9),
1288+ IDE_HFLAG_NO_SET_MODE = BIT(9),
12891289 /* trust BIOS for programming chipset/device for DMA */
1290− IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10),
1290+ IDE_HFLAG_TRUST_BIOS_FOR_DMA = BIT(10),
12911291 /* host is CS5510/CS5520 */
1292− IDE_HFLAG_CS5520 = (1 << 11),
1292+ IDE_HFLAG_CS5520 = BIT(11),
12931293 /* ATAPI DMA is unsupported */
1294− IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
1294+ IDE_HFLAG_NO_ATAPI_DMA = BIT(12),
12951295 /* set if host is a "non-bootable" controller */
1296− IDE_HFLAG_NON_BOOTABLE = (1 << 13),
1296+ IDE_HFLAG_NON_BOOTABLE = BIT(13),
12971297 /* host doesn't support DMA */
1298− IDE_HFLAG_NO_DMA = (1 << 14),
1298+ IDE_HFLAG_NO_DMA = BIT(14),
12991299 /* check if host is PCI IDE device before allowing DMA */
1300− IDE_HFLAG_NO_AUTODMA = (1 << 15),
1300+ IDE_HFLAG_NO_AUTODMA = BIT(15),
13011301 /* host uses MMIO */
1302− IDE_HFLAG_MMIO = (1 << 16),
1302+ IDE_HFLAG_MMIO = BIT(16),
13031303 /* no LBA48 */
1304− IDE_HFLAG_NO_LBA48 = (1 << 17),
1304+ IDE_HFLAG_NO_LBA48 = BIT(17),
13051305 /* no LBA48 DMA */
1306− IDE_HFLAG_NO_LBA48_DMA = (1 << 18),
1306+ IDE_HFLAG_NO_LBA48_DMA = BIT(18),
13071307 /* data FIFO is cleared by an error */
1308− IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19),
1308+ IDE_HFLAG_ERROR_STOPS_FIFO = BIT(19),
13091309 /* serialize ports */
1310− IDE_HFLAG_SERIALIZE = (1 << 20),
1310+ IDE_HFLAG_SERIALIZE = BIT(20),
13111311 /* host is DTC2278 */
1312− IDE_HFLAG_DTC2278 = (1 << 21),
1312+ IDE_HFLAG_DTC2278 = BIT(21),
13131313 /* 4 devices on a single set of I/O ports */
1314− IDE_HFLAG_4DRIVES = (1 << 22),
1314+ IDE_HFLAG_4DRIVES = BIT(22),
13151315 /* host is TRM290 */
1316− IDE_HFLAG_TRM290 = (1 << 23),
1316+ IDE_HFLAG_TRM290 = BIT(23),
13171317 /* use 32-bit I/O ops */
1318− IDE_HFLAG_IO_32BIT = (1 << 24),
1318+ IDE_HFLAG_IO_32BIT = BIT(24),
13191319 /* unmask IRQs */
1320− IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1321− IDE_HFLAG_BROKEN_ALTSTATUS = (1 << 26),
1320+ IDE_HFLAG_UNMASK_IRQS = BIT(25),
1321+ IDE_HFLAG_BROKEN_ALTSTATUS = BIT(26),
13221322 /* serialize ports if DMA is possible (for sl82c105) */
1323− IDE_HFLAG_SERIALIZE_DMA = (1 << 27),
1323+ IDE_HFLAG_SERIALIZE_DMA = BIT(27),
13241324 /* force host out of "simplex" mode */
1325− IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28),
1325+ IDE_HFLAG_CLEAR_SIMPLEX = BIT(28),
13261326 /* DSC overlap is unsupported */
1327− IDE_HFLAG_NO_DSC = (1 << 29),
1327+ IDE_HFLAG_NO_DSC = BIT(29),
13281328 /* never use 32-bit I/O ops */
1329− IDE_HFLAG_NO_IO_32BIT = (1 << 30),
1329+ IDE_HFLAG_NO_IO_32BIT = BIT(30),
13301330 /* never unmask IRQs */
1331− IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31),
1331+ IDE_HFLAG_NO_UNMASK_IRQS = BIT(31),
13321332 };
13331333
13341334 #ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1536,16 +1536,16 @@ struct ide_timing { · 201 unmodified lines
15361536 };
15371537
15381538 enum {
1539− IDE_TIMING_SETUP = (1 << 0),
1540− IDE_TIMING_ACT8B = (1 << 1),
1541− IDE_TIMING_REC8B = (1 << 2),
1542− IDE_TIMING_CYC8B = (1 << 3),
1539+ IDE_TIMING_SETUP = BIT(0),
1540+ IDE_TIMING_ACT8B = BIT(1),
1541+ IDE_TIMING_REC8B = BIT(2),
1542+ IDE_TIMING_CYC8B = BIT(3),
15431543 IDE_TIMING_8BIT = IDE_TIMING_ACT8B | IDE_TIMING_REC8B |
15441544 IDE_TIMING_CYC8B,
1545− IDE_TIMING_ACTIVE = (1 << 4),
1546− IDE_TIMING_RECOVER = (1 << 5),
1547− IDE_TIMING_CYCLE = (1 << 6),
1548− IDE_TIMING_UDMA = (1 << 7),
1545+ IDE_TIMING_ACTIVE = BIT(4),
1546+ IDE_TIMING_RECOVER = BIT(5),
1547+ IDE_TIMING_CYCLE = BIT(6),
1548+ IDE_TIMING_UDMA = BIT(7),
15491549 IDE_TIMING_ALL = IDE_TIMING_SETUP | IDE_TIMING_8BIT |
15501550 IDE_TIMING_ACTIVE | IDE_TIMING_RECOVER |
15511551 IDE_TIMING_CYCLE | IDE_TIMING_UDMA,
include/linux/idr.h+19−2
@@ -191,14 +191,17 @@ static inline void idr_preload_end(void) · 190 unmodified lines
191191 * idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type.
192192 * @idr: IDR handle.
193193 * @entry: The type * to use as cursor.
194+ * @tmp: A temporary placeholder for ID.
194195 * @id: Entry ID.
195196 *
196197 * @entry and @id do not need to be initialized before the loop, and
197198 * after normal termination @entry is left with the value NULL. This
198199 * is convenient for a "not found" value.
199200 */
200−#define idr_for_each_entry_ul(idr, entry, id) \
201− for (id = 0; ((entry) = idr_get_next_ul(idr, &(id))) != NULL; ++id)
201+#define idr_for_each_entry_ul(idr, entry, tmp, id) \
202+ for (tmp = 0, id = 0; \
203+ tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \
204+ tmp = id, ++id)
202205
203206 /**
204207 * idr_for_each_entry_continue() - Continue iteration over an IDR's elements of a given type
@@ -213,6 +216,20 @@ static inline void idr_preload_end(void) · 8 unmodified lines
213216 entry; \
214217 ++id, (entry) = idr_get_next((idr), &(id)))
215218
219+/**
220+ * idr_for_each_entry_continue_ul() - Continue iteration over an IDR's elements of a given type
221+ * @idr: IDR handle.
222+ * @entry: The type * to use as a cursor.
223+ * @tmp: A temporary placeholder for ID.
224+ * @id: Entry ID.
225+ *
226+ * Continue to iterate over entries, continuing after the current position.
227+ */
228+#define idr_for_each_entry_continue_ul(idr, entry, tmp, id) \
229+ for (tmp = id; \
230+ tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \
231+ tmp = id, ++id)
232+
216233 /*
217234 * IDA - ID Allocator, use when translation from id to pointer isn't necessary.
218235 */
include/linux/ieee80211.h+8−0
@@ -2609,6 +2609,7 @@ enum ieee80211_key_len { · 2608 unmodified lines
26092609 #define FILS_ERP_MAX_RRK_LEN 64
26102610
26112611 #define PMK_MAX_LEN 64
2612+#define SAE_PASSWORD_MAX_LEN 128
26122613
26132614 /* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */
26142615 enum ieee80211_pub_actioncode {
@@ -2709,6 +2710,13 @@ enum ieee80211_tdls_actioncode { · 94 unmodified lines
27092710 #define WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT BIT(5)
27102711 #define WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT BIT(6)
27112712
2713+/*
2714+ * When set, indicates that the AP is able to tolerate 26-tone RU UL
2715+ * OFDMA transmissions using HE TB PPDU from OBSS (not falsely classify the
2716+ * 26-tone RU UL OFDMA transmissions as radar pulses).
2717+ */
2718+#define WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT BIT(7)
2719+
27122720 /* Defines support for enhanced multi-bssid advertisement*/
27132721 #define WLAN_EXT_CAPA11_EMA_SUPPORT BIT(1)
27142722
include/linux/if_bridge.h+12−0
@@ -88,6 +88,8 @@ static inline bool br_multicast_router(const struct net_device *dev) · 87 unmodified lines
8888 #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING)
8989 bool br_vlan_enabled(const struct net_device *dev);
9090 int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid);
91+int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid);
92+int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto);
9193 int br_vlan_get_info(const struct net_device *dev, u16 vid,
9294 struct bridge_vlan_info *p_vinfo);
9395 #else
@@ -101,6 +103,16 @@ static inline int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid) · 7 unmodified lines
101103 return -EINVAL;
102104 }
103105
106+static inline int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto)
107+{
108+ return -EINVAL;
109+}
110+
111+static inline int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
112+{
113+ return -EINVAL;
114+}
115+
104116 static inline int br_vlan_get_info(const struct net_device *dev, u16 vid,
105117 struct bridge_vlan_info *p_vinfo)
106118 {
include/linux/if_pppox.h+3−0
@@ -80,6 +80,9 @@ extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp); · 79 unmodified lines
8080 extern void unregister_pppox_proto(int proto_num);
8181 extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
8282 extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
83+extern int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
84+
85+#define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t)
8386
8487 /* PPPoX socket states */
8588 enum {
include/linux/if_rmnet.h+55−0
@@ -0,0 +1,55 @@
1+/* SPDX-License-Identifier: GPL-2.0-only
2+ * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
3+ */
4+
5+#ifndef _LINUX_IF_RMNET_H_
6+#define _LINUX_IF_RMNET_H_
7+
8+struct rmnet_map_header {
9+#if defined(__LITTLE_ENDIAN_BITFIELD)
10+ u8 pad_len:6;
11+ u8 reserved_bit:1;
12+ u8 cd_bit:1;
13+#elif defined (__BIG_ENDIAN_BITFIELD)
14+ u8 cd_bit:1;
15+ u8 reserved_bit:1;
16+ u8 pad_len:6;
17+#else
18+#error "Please fix <asm/byteorder.h>"
19+#endif
20+ u8 mux_id;
21+ __be16 pkt_len;
22+} __aligned(1);
23+
24+struct rmnet_map_dl_csum_trailer {
25+ u8 reserved1;
26+#if defined(__LITTLE_ENDIAN_BITFIELD)
27+ u8 valid:1;
28+ u8 reserved2:7;
29+#elif defined (__BIG_ENDIAN_BITFIELD)
30+ u8 reserved2:7;
31+ u8 valid:1;
32+#else
33+#error "Please fix <asm/byteorder.h>"
34+#endif
35+ u16 csum_start_offset;
36+ u16 csum_length;
37+ __be16 csum_value;
38+} __aligned(1);
39+
40+struct rmnet_map_ul_csum_header {
41+ __be16 csum_start_offset;
42+#if defined(__LITTLE_ENDIAN_BITFIELD)
43+ u16 csum_insert_offset:14;
44+ u16 udp_ind:1;
45+ u16 csum_enabled:1;
46+#elif defined (__BIG_ENDIAN_BITFIELD)
47+ u16 csum_enabled:1;
48+ u16 udp_ind:1;
49+ u16 csum_insert_offset:14;
50+#else
51+#error "Please fix <asm/byteorder.h>"
52+#endif
53+} __aligned(1);
54+
55+#endif /* !(_LINUX_IF_RMNET_H_) */
include/linux/if_tap.h+0−1
@@ -62,7 +62,6 @@ struct tap_dev { · 61 unmodified lines
6262 struct tap_queue {
6363 struct sock sk;
6464 struct socket sock;
65− struct socket_wq wq;
6665 int vnet_hdr_sz;
6766 struct tap_dev __rcu *tap;
6867 struct file *file;
include/linux/igmp.h+1−1
@@ -60,8 +60,8 @@ struct ip_mc_socklist { · 59 unmodified lines
6060
6161 struct ip_sf_list {
6262 struct ip_sf_list *sf_next;
63− __be32 sf_inaddr;
6463 unsigned long sf_count[2]; /* include/exclude counts */
64+ __be32 sf_inaddr;
6565 unsigned char sf_gsresp; /* include in g & s response? */
6666 unsigned char sf_oldin; /* change state */
6767 unsigned char sf_crcount; /* retrans. left to send */
include/linux/ima.h+2−0
@@ -23,6 +23,7 @@ extern int ima_read_file(struct file *file, enum kernel_read_file_id id); · 22 unmodified lines
2323 extern int ima_post_read_file(struct file *file, void *buf, loff_t size,
2424 enum kernel_read_file_id id);
2525 extern void ima_post_path_mknod(struct dentry *dentry);
26+extern void ima_kexec_cmdline(const void *buf, int size);
2627
2728 #ifdef CONFIG_IMA_KEXEC
2829 extern void ima_add_kexec_buffer(struct kimage *image);
@@ -89,6 +90,7 @@ static inline void ima_post_path_mknod(struct dentry *dentry) · 60 unmodified lines
8990 return;
9091 }
9192
93+static inline void ima_kexec_cmdline(const void *buf, int size) {}
9294 #endif /* CONFIG_IMA */
9395
9496 #ifndef CONFIG_IMA_KEXEC
include/linux/in.h+1−1
@@ -63,7 +63,7 @@ static inline bool ipv4_is_all_snoopers(__be32 addr) · 62 unmodified lines
6363
6464 static inline bool ipv4_is_zeronet(__be32 addr)
6565 {
66− return (addr & htonl(0xff000000)) == htonl(0x00000000);
66+ return (addr == 0);
6767 }
6868
6969 /* Special-Use IPv4 Addresses (RFC3330) */
include/linux/inetdevice.h+9−10
@@ -26,7 +26,7 @@ struct in_device { · 25 unmodified lines
2626 struct net_device *dev;
2727 refcount_t refcnt;
2828 int dead;
29− struct in_ifaddr *ifa_list; /* IP ifaddr chain */
29+ struct in_ifaddr __rcu *ifa_list;/* IP ifaddr chain */
3030
3131 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */
3232 struct ip_mc_list __rcu * __rcu *mc_hash;
@@ -136,7 +136,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) · 103 unmodified lines
136136
137137 struct in_ifaddr {
138138 struct hlist_node hash;
139− struct in_ifaddr *ifa_next;
139+ struct in_ifaddr __rcu *ifa_next;
140140 struct in_device *ifa_dev;
141141 struct rcu_head rcu_head;
142142 __be32 ifa_local;
@@ -186,7 +186,7 @@ __be32 inet_confirm_addr(struct net *net, struct in_device *in_dev, __be32 dst, · 43 unmodified lines
186186 struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
187187 __be32 mask);
188188 struct in_ifaddr *inet_lookup_ifaddr_rcu(struct net *net, __be32 addr);
189−static __inline__ bool inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
189+static inline bool inet_ifa_match(__be32 addr, const struct in_ifaddr *ifa)
190190 {
191191 return !((addr^ifa->ifa_address)&ifa->ifa_mask);
192192 }
@@ -206,14 +206,13 @@ static __inline__ bool bad_mask(__be32 mask, __be32 addr) · 13 unmodified lines
206206 return false;
207207 }
208208
209−#define for_primary_ifa(in_dev) { struct in_ifaddr *ifa; \
210− for (ifa = (in_dev)->ifa_list; ifa && !(ifa->ifa_flags&IFA_F_SECONDARY); ifa = ifa->ifa_next)
209+#define in_dev_for_each_ifa_rtnl(ifa, in_dev) \
210+ for (ifa = rtnl_dereference((in_dev)->ifa_list); ifa; \
211+ ifa = rtnl_dereference(ifa->ifa_next))
211212
212−#define for_ifa(in_dev) { struct in_ifaddr *ifa; \
213− for (ifa = (in_dev)->ifa_list; ifa; ifa = ifa->ifa_next)
214−
215−
216−#define endfor_ifa(in_dev) }
213+#define in_dev_for_each_ifa_rcu(ifa, in_dev) \
214+ for (ifa = rcu_dereference((in_dev)->ifa_list); ifa; \
215+ ifa = rcu_dereference(ifa->ifa_next))
217216
218217 static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev)
219218 {
include/linux/init.h+4−1
@@ -137,6 +137,8 @@ extern initcall_entry_t __con_initcall_start[], __con_initcall_end[]; · 136 unmodified lines
137137 /* Used for contructor calls. */
138138 typedef void (*ctor_fn_t)(void);
139139
140+struct file_system_type;
141+
140142 /* Defined in init/main.c */
141143 extern int do_one_initcall(initcall_t fn);
142144 extern char __initdata boot_command_line[];
@@ -146,7 +148,8 @@ extern unsigned int reset_devices; · 3 unmodified lines
146148 /* used by init/main.c */
147149 void setup_arch(char **);
148150 void prepare_namespace(void);
149−int __init init_rootfs(void);
151+void __init init_rootfs(void);
152+extern struct file_system_type rootfs_fs_type;
150153
151154 #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
152155 extern bool rodata_enabled;
include/linux/input.h+26−0
@@ -21,6 +21,8 @@ · 20 unmodified lines
2121 #include <linux/timer.h>
2222 #include <linux/mod_devicetable.h>
2323
24+struct input_dev_poller;
25+
2426 /**
2527 * struct input_value - input value representation
2628 * @type: type of value (EV_KEY, EV_ABS, etc)
@@ -33,6 +35,13 @@ struct input_value { · 6 unmodified lines
3335 __s32 value;
3436 };
3537
38+enum input_clock_type {
39+ INPUT_CLK_REAL = 0,
40+ INPUT_CLK_MONO,
41+ INPUT_CLK_BOOT,
42+ INPUT_CLK_MAX
43+};
44+
3645 /**
3746 * struct input_dev - represents an input device
3847 * @name: name of the device
@@ -64,6 +73,8 @@ struct input_value { · 25 unmodified lines
6473 * not sleep
6574 * @ff: force feedback structure associated with the device if device
6675 * supports force feedback effects
76+ * @poller: poller structure associated with the device if device is
77+ * set up to use polling mode
6778 * @repeat_key: stores key code of the last key pressed; used to implement
6879 * software autorepeat
6980 * @timer: timer for software autorepeat
@@ -114,6 +125,8 @@ struct input_value { · 44 unmodified lines
114125 * @vals: array of values queued in the current frame
115126 * @devres_managed: indicates that devices is managed with devres framework
116127 * and needs not be explicitly unregistered or freed.
128+ * @timestamp: storage for a timestamp set by input_set_timestamp called
129+ * by a driver
117130 */
118131 struct input_dev {
119132 const char *name;
@@ -147,6 +160,8 @@ struct input_dev { · 27 unmodified lines
147160
148161 struct ff_device *ff;
149162
163+ struct input_dev_poller *poller;
164+
150165 unsigned int repeat_key;
151166 struct timer_list timer;
152167
@@ -184,6 +199,8 @@ struct input_dev { · 31 unmodified lines
184199 struct input_value *vals;
185200
186201 bool devres_managed;
202+
203+ ktime_t timestamp[INPUT_CLK_MAX];
187204 };
188205 #define to_input_dev(d) container_of(d, struct input_dev, dev)
189206
@@ -361,6 +378,12 @@ void input_unregister_device(struct input_dev *); · 171 unmodified lines
361378
362379 void input_reset_device(struct input_dev *);
363380
381+int input_setup_polling(struct input_dev *dev,
382+ void (*poll_fn)(struct input_dev *dev));
383+void input_set_poll_interval(struct input_dev *dev, unsigned int interval);
384+void input_set_min_poll_interval(struct input_dev *dev, unsigned int interval);
385+void input_set_max_poll_interval(struct input_dev *dev, unsigned int interval);
386+
364387 int __must_check input_register_handler(struct input_handler *);
365388 void input_unregister_handler(struct input_handler *);
366389
@@ -382,6 +405,9 @@ void input_close_device(struct input_handle *); · 15 unmodified lines
382405
383406 int input_flush_device(struct input_handle *handle, struct file *file);
384407
408+void input_set_timestamp(struct input_dev *dev, ktime_t timestamp);
409+ktime_t *input_get_timestamp(struct input_dev *dev);
410+
385411 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
386412 void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);
387413
include/linux/input/bu21013.h+0−34
@@ -1,34 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0-only */
2−/*
3− * Copyright (C) ST-Ericsson SA 2010
4− * Author: Naveen Kumar G <naveen.gaddipati@stericsson.com> for ST-Ericsson
5− */
6−
7−#ifndef _BU21013_H
8−#define _BU21013_H
9−
10−/**
11− * struct bu21013_platform_device - Handle the platform data
12− * @touch_x_max: touch x max
13− * @touch_y_max: touch y max
14− * @cs_pin: chip select pin
15− * @touch_pin: touch gpio pin
16− * @ext_clk: external clock flag
17− * @x_flip: x flip flag
18− * @y_flip: y flip flag
19− * @wakeup: wakeup flag
20− *
21− * This is used to handle the platform data
22− */
23−struct bu21013_platform_device {
24− int touch_x_max;
25− int touch_y_max;
26− unsigned int cs_pin;
27− unsigned int touch_pin;
28− bool ext_clk;
29− bool x_flip;
30− bool y_flip;
31− bool wakeup;
32−};
33−
34−#endif
include/linux/intel-iommu.h+6−1
@@ -435,6 +435,12 @@ enum { · 434 unmodified lines
435435 #define VTD_FLAG_TRANS_PRE_ENABLED (1 << 0)
436436 #define VTD_FLAG_IRQ_REMAP_PRE_ENABLED (1 << 1)
437437
438+extern int intel_iommu_sm;
439+
440+#define sm_supported(iommu) (intel_iommu_sm && ecap_smts((iommu)->ecap))
441+#define pasid_supported(iommu) (sm_supported(iommu) && \
442+ ecap_pasid((iommu)->ecap))
443+
438444 struct pasid_entry;
439445 struct pasid_state_entry;
440446 struct page_req_dsc;
@@ -642,7 +648,6 @@ extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); · 201 unmodified lines
642648
643649 extern int dmar_ir_support(void);
644650
645−struct dmar_domain *get_valid_domain_for_dev(struct device *dev);
646651 void *alloc_pgtable_page(int node);
647652 void free_pgtable_page(void *vaddr);
648653 struct intel_iommu *domain_get_iommu(struct dmar_domain *domain);
include/linux/intel-svm.h+1−1
@@ -49,7 +49,7 @@ struct svm_dev_ops { · 48 unmodified lines
4949
5050 /**
5151 * intel_svm_bind_mm() - Bind the current process to a PASID
52− * @dev: Device to be granted acccess
52+ * @dev: Device to be granted access
5353 * @pasid: Address for allocated PASID
5454 * @flags: Flags. Later for requesting supervisor mode, etc.
5555 * @ops: Callbacks to device driver
include/linux/intel_rapl.h+155−0
@@ -0,0 +1,155 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Data types and headers for RAPL support
4+ *
5+ * Copyright (C) 2019 Intel Corporation.
6+ *
7+ * Author: Zhang Rui <rui.zhang@intel.com>
8+ */
9+
10+#ifndef __INTEL_RAPL_H__
11+#define __INTEL_RAPL_H__
12+
13+#include <linux/types.h>
14+#include <linux/powercap.h>
15+#include <linux/cpuhotplug.h>
16+
17+enum rapl_domain_type {
18+ RAPL_DOMAIN_PACKAGE, /* entire package/socket */
19+ RAPL_DOMAIN_PP0, /* core power plane */
20+ RAPL_DOMAIN_PP1, /* graphics uncore */
21+ RAPL_DOMAIN_DRAM, /* DRAM control_type */
22+ RAPL_DOMAIN_PLATFORM, /* PSys control_type */
23+ RAPL_DOMAIN_MAX,
24+};
25+
26+enum rapl_domain_reg_id {
27+ RAPL_DOMAIN_REG_LIMIT,
28+ RAPL_DOMAIN_REG_STATUS,
29+ RAPL_DOMAIN_REG_PERF,
30+ RAPL_DOMAIN_REG_POLICY,
31+ RAPL_DOMAIN_REG_INFO,
32+ RAPL_DOMAIN_REG_MAX,
33+};
34+
35+struct rapl_package;
36+
37+enum rapl_primitives {
38+ ENERGY_COUNTER,
39+ POWER_LIMIT1,
40+ POWER_LIMIT2,
41+ FW_LOCK,
42+
43+ PL1_ENABLE, /* power limit 1, aka long term */
44+ PL1_CLAMP, /* allow frequency to go below OS request */
45+ PL2_ENABLE, /* power limit 2, aka short term, instantaneous */
46+ PL2_CLAMP,
47+
48+ TIME_WINDOW1, /* long term */
49+ TIME_WINDOW2, /* short term */
50+ THERMAL_SPEC_POWER,
51+ MAX_POWER,
52+
53+ MIN_POWER,
54+ MAX_TIME_WINDOW,
55+ THROTTLED_TIME,
56+ PRIORITY_LEVEL,
57+
58+ /* below are not raw primitive data */
59+ AVERAGE_POWER,
60+ NR_RAPL_PRIMITIVES,
61+};
62+
63+struct rapl_domain_data {
64+ u64 primitives[NR_RAPL_PRIMITIVES];
65+ unsigned long timestamp;
66+};
67+
68+#define NR_POWER_LIMITS (2)
69+struct rapl_power_limit {
70+ struct powercap_zone_constraint *constraint;
71+ int prim_id; /* primitive ID used to enable */
72+ struct rapl_domain *domain;
73+ const char *name;
74+ u64 last_power_limit;
75+};
76+
77+struct rapl_package;
78+
79+struct rapl_domain {
80+ const char *name;
81+ enum rapl_domain_type id;
82+ u64 regs[RAPL_DOMAIN_REG_MAX];
83+ struct powercap_zone power_zone;
84+ struct rapl_domain_data rdd;
85+ struct rapl_power_limit rpl[NR_POWER_LIMITS];
86+ u64 attr_map; /* track capabilities */
87+ unsigned int state;
88+ unsigned int domain_energy_unit;
89+ struct rapl_package *rp;
90+};
91+
92+struct reg_action {
93+ u64 reg;
94+ u64 mask;
95+ u64 value;
96+ int err;
97+};
98+
99+/**
100+ * struct rapl_if_priv: private data for different RAPL interfaces
101+ * @control_type: Each RAPL interface must have its own powercap
102+ * control type.
103+ * @platform_rapl_domain: Optional. Some RAPL interface may have platform
104+ * level RAPL control.
105+ * @pcap_rapl_online: CPU hotplug state for each RAPL interface.
106+ * @reg_unit: Register for getting energy/power/time unit.
107+ * @regs: Register sets for different RAPL Domains.
108+ * @limits: Number of power limits supported by each domain.
109+ * @read_raw: Callback for reading RAPL interface specific
110+ * registers.
111+ * @write_raw: Callback for writing RAPL interface specific
112+ * registers.
113+ */
114+struct rapl_if_priv {
115+ struct powercap_control_type *control_type;
116+ struct rapl_domain *platform_rapl_domain;
117+ enum cpuhp_state pcap_rapl_online;
118+ u64 reg_unit;
119+ u64 regs[RAPL_DOMAIN_MAX][RAPL_DOMAIN_REG_MAX];
120+ int limits[RAPL_DOMAIN_MAX];
121+ int (*read_raw)(int cpu, struct reg_action *ra);
122+ int (*write_raw)(int cpu, struct reg_action *ra);
123+};
124+
125+/* maximum rapl package domain name: package-%d-die-%d */
126+#define PACKAGE_DOMAIN_NAME_LENGTH 30
127+
128+struct rapl_package {
129+ unsigned int id; /* logical die id, equals physical 1-die systems */
130+ unsigned int nr_domains;
131+ unsigned long domain_map; /* bit map of active domains */
132+ unsigned int power_unit;
133+ unsigned int energy_unit;
134+ unsigned int time_unit;
135+ struct rapl_domain *domains; /* array of domains, sized at runtime */
136+ struct powercap_zone *power_zone; /* keep track of parent zone */
137+ unsigned long power_limit_irq; /* keep track of package power limit
138+ * notify interrupt enable status.
139+ */
140+ struct list_head plist;
141+ int lead_cpu; /* one active cpu per package for access */
142+ /* Track active cpus */
143+ struct cpumask cpumask;
144+ char name[PACKAGE_DOMAIN_NAME_LENGTH];
145+ struct rapl_if_priv *priv;
146+};
147+
148+struct rapl_package *rapl_find_package_domain(int cpu, struct rapl_if_priv *priv);
149+struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv);
150+void rapl_remove_package(struct rapl_package *rp);
151+
152+int rapl_add_platform_domain(struct rapl_if_priv *priv);
153+void rapl_remove_platform_domain(struct rapl_if_priv *priv);
154+
155+#endif /* __INTEL_RAPL_H__ */
include/linux/interrupt.h+1−1
@@ -52,7 +52,7 @@ · 51 unmodified lines
5252 * irq line disabled until the threaded handler has been run.
5353 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend. Does not guarantee
5454 * that this interrupt will wake the system from a suspended
55− * state. See Documentation/power/suspend-and-interrupts.txt
55+ * state. See Documentation/power/suspend-and-interrupts.rst
5656 * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
5757 * IRQF_NO_THREAD - Interrupt cannot be threaded
5858 * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device
include/linux/io-pgtable.h+4−7
@@ -44,6 +44,8 @@ struct iommu_gather_ops { · 43 unmodified lines
4444 * tables.
4545 * @ias: Input address (iova) size, in bits.
4646 * @oas: Output address (paddr) size, in bits.
47+ * @coherent_walk A flag to indicate whether or not page table walks made
48+ * by the IOMMU are coherent with the CPU caches.
4749 * @tlb: TLB management callbacks for this set of tables.
4850 * @iommu_dev: The device representing the DMA configuration for the
4951 * page table walker.
@@ -68,11 +70,6 @@ struct io_pgtable_cfg { · 18 unmodified lines
6870 * when the SoC is in "4GB mode" and they can only access the high
6971 * remap of DRAM (0x1_00000000 to 0x1_ffffffff).
7072 *
71− * IO_PGTABLE_QUIRK_NO_DMA: Guarantees that the tables will only ever
72− * be accessed by a fully cache-coherent IOMMU or CPU (e.g. for a
73− * software-emulated IOMMU), such that pagetable updates need not
74− * be treated as explicit DMA data.
75− *
7673 * IO_PGTABLE_QUIRK_NON_STRICT: Skip issuing synchronous leaf TLBIs
7774 * on unmap, for DMA domains using the flush queue mechanism for
7875 * delayed invalidation.
@@ -81,12 +78,12 @@ struct io_pgtable_cfg { · 2 unmodified lines
8178 #define IO_PGTABLE_QUIRK_NO_PERMS BIT(1)
8279 #define IO_PGTABLE_QUIRK_TLBI_ON_MAP BIT(2)
8380 #define IO_PGTABLE_QUIRK_ARM_MTK_4GB BIT(3)
84− #define IO_PGTABLE_QUIRK_NO_DMA BIT(4)
85− #define IO_PGTABLE_QUIRK_NON_STRICT BIT(5)
81+ #define IO_PGTABLE_QUIRK_NON_STRICT BIT(4)
8682 unsigned long quirks;
8783 unsigned long pgsize_bitmap;
8884 unsigned int ias;
8985 unsigned int oas;
86+ bool coherent_walk;
9087 const struct iommu_gather_ops *tlb;
9188 struct device *iommu_dev;
9289
include/linux/io.h+1−0
@@ -33,6 +33,7 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end, · 32 unmodified lines
3333
3434 #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
3535 void __init ioremap_huge_init(void);
36+int arch_ioremap_p4d_supported(void);
3637 int arch_ioremap_pud_supported(void);
3738 int arch_ioremap_pmd_supported(void);
3839 #else
include/linux/iomap.h+18−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <linux/mm.h>
88 #include <linux/types.h>
99 #include <linux/mm_types.h>
10+#include <linux/blkdev.h>
1011
1112 struct address_space;
1213 struct fiemap_extent_info;
@@ -35,6 +36,7 @@ struct vm_fault; · 22 unmodified lines
3536 #define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */
3637 #define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */
3738 #define IOMAP_F_BUFFER_HEAD 0x04 /* file system requires buffer heads */
39+#define IOMAP_F_SIZE_CHANGED 0x08 /* file size has changed */
3840
3941 /*
4042 * Flags that only need to be reported for IOMAP_REPORT requests:
@@ -68,6 +70,12 @@ struct iomap { · 27 unmodified lines
6870 const struct iomap_page_ops *page_ops;
6971 };
7072
73+static inline sector_t
74+iomap_sector(struct iomap *iomap, loff_t pos)
75+{
76+ return (iomap->addr + pos - iomap->offset) >> SECTOR_SHIFT;
77+}
78+
7179 /*
7280 * When a filesystem sets page_ops in an iomap mapping it returns, page_prepare
7381 * and page_done will be called for each page written to. This only applies to
@@ -114,6 +122,16 @@ struct iomap_ops { · 40 unmodified lines
114122 ssize_t written, unsigned flags, struct iomap *iomap);
115123 };
116124
125+/*
126+ * Main iomap iterator function.
127+ */
128+typedef loff_t (*iomap_actor_t)(struct inode *inode, loff_t pos, loff_t len,
129+ void *data, struct iomap *iomap);
130+
131+loff_t iomap_apply(struct inode *inode, loff_t pos, loff_t length,
132+ unsigned flags, const struct iomap_ops *ops, void *data,
133+ iomap_actor_t actor);
134+
117135 /*
118136 * Structure allocate for each page when block size < PAGE_SIZE to track
119137 * sub-page uptodate status and I/O completions.
include/linux/iommu.h+105−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/errno.h>
1414 #include <linux/err.h>
1515 #include <linux/of.h>
16+#include <uapi/linux/iommu.h>
1617
1718 #define IOMMU_READ (1 << 0)
1819 #define IOMMU_WRITE (1 << 1)
@@ -29,6 +30,12 @@ · 10 unmodified lines
2930 * if the IOMMU page table format is equivalent.
3031 */
3132 #define IOMMU_PRIV (1 << 5)
33+/*
34+ * Non-coherent masters on few Qualcomm SoCs can use this page protection flag
35+ * to set correct cacheability attributes to use an outer level of cache -
36+ * last level cache, aka system cache.
37+ */
38+#define IOMMU_QCOM_SYS_CACHE (1 << 6)
3239
3340 struct iommu_ops;
3441 struct iommu_group;
@@ -37,6 +44,7 @@ struct device; · 2 unmodified lines
3744 struct iommu_domain;
3845 struct notifier_block;
3946 struct iommu_sva;
47+struct iommu_fault_event;
4048
4149 /* iommu fault flags */
4250 #define IOMMU_FAULT_READ 0x0
@@ -46,6 +54,7 @@ typedef int (*iommu_fault_handler_t)(struct iommu_domain *, · 3 unmodified lines
4654 struct device *, unsigned long, int, void *);
4755 typedef int (*iommu_mm_exit_handler_t)(struct device *dev, struct iommu_sva *,
4856 void *);
57+typedef int (*iommu_dev_fault_handler_t)(struct iommu_fault *, void *);
4958
5059 struct iommu_domain_geometry {
5160 dma_addr_t aperture_start; /* First address that can be mapped */
@@ -123,6 +132,12 @@ enum iommu_attr { · 71 unmodified lines
123132 enum iommu_resv_type {
124133 /* Memory regions which must be mapped 1:1 at all times */
125134 IOMMU_RESV_DIRECT,
135+ /*
136+ * Memory regions which are advertised to be 1:1 but are
137+ * commonly considered relaxable in some conditions,
138+ * for instance in device assignment use case (USB, Graphics)
139+ */
140+ IOMMU_RESV_DIRECT_RELAXABLE,
126141 /* Arbitrary "never map this or give it to a device" address ranges */
127142 IOMMU_RESV_RESERVED,
128143 /* Hardware MSI region (untranslated) */
@@ -212,6 +227,7 @@ struct iommu_sva_ops { · 83 unmodified lines
212227 * @sva_bind: Bind process address space to device
213228 * @sva_unbind: Unbind process address space from device
214229 * @sva_get_pasid: Get PASID associated to a SVA handle
230+ * @page_response: handle page request response
215231 * @pgsize_bitmap: bitmap of all possible supported page sizes
216232 */
217233 struct iommu_ops {
@@ -272,6 +288,10 @@ struct iommu_ops { · 54 unmodified lines
272288 void (*sva_unbind)(struct iommu_sva *handle);
273289 int (*sva_get_pasid)(struct iommu_sva *handle);
274290
291+ int (*page_response)(struct device *dev,
292+ struct iommu_fault_event *evt,
293+ struct iommu_page_response *msg);
294+
275295 unsigned long pgsize_bitmap;
276296 };
277297
@@ -289,6 +309,48 @@ struct iommu_device { · 11 unmodified lines
289309 struct device *dev;
290310 };
291311
312+/**
313+ * struct iommu_fault_event - Generic fault event
314+ *
315+ * Can represent recoverable faults such as a page requests or
316+ * unrecoverable faults such as DMA or IRQ remapping faults.
317+ *
318+ * @fault: fault descriptor
319+ * @list: pending fault event list, used for tracking responses
320+ */
321+struct iommu_fault_event {
322+ struct iommu_fault fault;
323+ struct list_head list;
324+};
325+
326+/**
327+ * struct iommu_fault_param - per-device IOMMU fault data
328+ * @handler: Callback function to handle IOMMU faults at device level
329+ * @data: handler private data
330+ * @faults: holds the pending faults which needs response
331+ * @lock: protect pending faults list
332+ */
333+struct iommu_fault_param {
334+ iommu_dev_fault_handler_t handler;
335+ void *data;
336+ struct list_head faults;
337+ struct mutex lock;
338+};
339+
340+/**
341+ * struct iommu_param - collection of per-device IOMMU data
342+ *
343+ * @fault_param: IOMMU detected device fault reporting data
344+ *
345+ * TODO: migrate other per device data pointers under iommu_dev_data, e.g.
346+ * struct iommu_group *iommu_group;
347+ * struct iommu_fwspec *iommu_fwspec;
348+ */
349+struct iommu_param {
350+ struct mutex lock;
351+ struct iommu_fault_param *fault_param;
352+};
353+
292354 int iommu_device_register(struct iommu_device *iommu);
293355 void iommu_device_unregister(struct iommu_device *iommu);
294356 int iommu_device_sysfs_add(struct iommu_device *iommu,
@@ -350,6 +412,7 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain, · 55 unmodified lines
350412 extern void iommu_get_resv_regions(struct device *dev, struct list_head *list);
351413 extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
352414 extern int iommu_request_dm_for_dev(struct device *dev);
415+extern int iommu_request_dma_domain_for_dev(struct device *dev);
353416 extern struct iommu_resv_region *
354417 iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot,
355418 enum iommu_resv_type type);
@@ -378,6 +441,17 @@ extern int iommu_group_register_notifier(struct iommu_group *group, · 22 unmodified lines
378441 struct notifier_block *nb);
379442 extern int iommu_group_unregister_notifier(struct iommu_group *group,
380443 struct notifier_block *nb);
444+extern int iommu_register_device_fault_handler(struct device *dev,
445+ iommu_dev_fault_handler_t handler,
446+ void *data);
447+
448+extern int iommu_unregister_device_fault_handler(struct device *dev);
449+
450+extern int iommu_report_device_fault(struct device *dev,
451+ struct iommu_fault_event *evt);
452+extern int iommu_page_response(struct device *dev,
453+ struct iommu_page_response *msg);
454+
381455 extern int iommu_group_id(struct iommu_group *group);
382456 extern struct iommu_group *iommu_group_get_for_dev(struct device *dev);
383457 extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *);
@@ -492,6 +566,7 @@ struct iommu_ops {}; · 108 unmodified lines
492566 struct iommu_group {};
493567 struct iommu_fwspec {};
494568 struct iommu_device {};
569+struct iommu_fault_param {};
495570
496571 static inline bool iommu_present(struct bus_type *bus)
497572 {
@@ -614,6 +689,11 @@ static inline int iommu_request_dm_for_dev(struct device *dev) · 116 unmodified lines
614689 return -ENODEV;
615690 }
616691
692+static inline int iommu_request_dma_domain_for_dev(struct device *dev)
693+{
694+ return -ENODEV;
695+}
696+
617697 static inline int iommu_attach_group(struct iommu_domain *domain,
618698 struct iommu_group *group)
619699 {
@@ -685,6 +765,31 @@ static inline int iommu_group_unregister_notifier(struct iommu_group *group, · 65 unmodified lines
685765 return 0;
686766 }
687767
768+static inline
769+int iommu_register_device_fault_handler(struct device *dev,
770+ iommu_dev_fault_handler_t handler,
771+ void *data)
772+{
773+ return -ENODEV;
774+}
775+
776+static inline int iommu_unregister_device_fault_handler(struct device *dev)
777+{
778+ return 0;
779+}
780+
781+static inline
782+int iommu_report_device_fault(struct device *dev, struct iommu_fault_event *evt)
783+{
784+ return -ENODEV;
785+}
786+
787+static inline int iommu_page_response(struct device *dev,
788+ struct iommu_page_response *msg)
789+{
790+ return -ENODEV;
791+}
792+
688793 static inline int iommu_group_id(struct iommu_group *group)
689794 {
690795 return -ENODEV;
include/linux/iopoll.h+2−2
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 * @cond: Break condition (usually involving @val)
2222 * @sleep_us: Maximum time to sleep between reads in us (0
2323 * tight-loops). Should be less than ~20ms since usleep_range
24− * is used (see Documentation/timers/timers-howto.txt).
24+ * is used (see Documentation/timers/timers-howto.rst).
2525 * @timeout_us: Timeout in us, 0 means never timeout
2626 *
2727 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
@@ -60,7 +60,7 @@ · 32 unmodified lines
6060 * @cond: Break condition (usually involving @val)
6161 * @delay_us: Time to udelay between reads in us (0 tight-loops). Should
6262 * be less than ~10us since udelay is used (see
63− * Documentation/timers/timers-howto.txt).
63+ * Documentation/timers/timers-howto.rst).
6464 * @timeout_us: Timeout in us, 0 means never timeout
6565 *
6666 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
include/linux/ioport.h+12−1
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #ifndef __ASSEMBLY__
1313 #include <linux/compiler.h>
1414 #include <linux/types.h>
15+#include <linux/bits.h>
1516 /*
1617 * Resources are tree-like, allowing
1718 * nesting etc..
@@ -132,7 +133,15 @@ enum { · 114 unmodified lines
132133 IORES_DESC_PERSISTENT_MEMORY = 4,
133134 IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5,
134135 IORES_DESC_DEVICE_PRIVATE_MEMORY = 6,
135− IORES_DESC_DEVICE_PUBLIC_MEMORY = 7,
136+ IORES_DESC_RESERVED = 7,
137+};
138+
139+/*
140+ * Flags controlling ioremap() behavior.
141+ */
142+enum {
143+ IORES_MAP_SYSTEM_RAM = BIT(0),
144+ IORES_MAP_ENCRYPTED = BIT(1),
136145 };
137146
138147 /* helpers to define resources */
@@ -286,6 +295,8 @@ static inline bool resource_overlaps(struct resource *r1, struct resource *r2) · 147 unmodified lines
286295 return (r1->start <= r2->end && r1->end >= r2->start);
287296 }
288297
298+struct resource *devm_request_free_mem_region(struct device *dev,
299+ struct resource *base, unsigned long size);
289300
290301 #endif /* __ASSEMBLY__ */
291302 #endif /* _LINUX_IOPORT_H */
include/linux/iova.h+6−0
@@ -155,6 +155,7 @@ struct iova *reserve_iova(struct iova_domain *iovad, unsigned long pfn_lo, · 154 unmodified lines
155155 void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to);
156156 void init_iova_domain(struct iova_domain *iovad, unsigned long granule,
157157 unsigned long start_pfn);
158+bool has_iova_flush_queue(struct iova_domain *iovad);
158159 int init_iova_flush_queue(struct iova_domain *iovad,
159160 iova_flush_cb flush_cb, iova_entry_dtor entry_dtor);
160161 struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn);
@@ -235,6 +236,11 @@ static inline void init_iova_domain(struct iova_domain *iovad, · 74 unmodified lines
235236 {
236237 }
237238
239+static inline bool has_iova_flush_queue(struct iova_domain *iovad)
240+{
241+ return false;
242+}
243+
238244 static inline int init_iova_flush_queue(struct iova_domain *iovad,
239245 iova_flush_cb flush_cb,
240246 iova_entry_dtor entry_dtor)
include/linux/irqchip/arm-gic-common.h+5−0
@@ -36,4 +36,9 @@ struct gic_kvm_info { · 35 unmodified lines
3636
3737 const struct gic_kvm_info *gic_get_kvm_info(void);
3838
39+struct irq_domain;
40+struct fwnode_handle;
41+int gicv2m_init(struct fwnode_handle *parent_handle,
42+ struct irq_domain *parent);
43+
3944 #endif /* __LINUX_IRQCHIP_ARM_GIC_COMMON_H */
include/linux/irqchip/arm-gic.h+0−3
@@ -157,9 +157,6 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq); · 156 unmodified lines
157157 */
158158 void gic_init(void __iomem *dist , void __iomem *cpu);
159159
160−int gicv2m_init(struct fwnode_handle *parent_handle,
161− struct irq_domain *parent);
162−
163160 void gic_send_sgi(unsigned int cpu_id, unsigned int irq);
164161 int gic_get_cpu_id(unsigned int cpu);
165162 void gic_migrate_target(unsigned int new_cpu_id);
include/linux/isdn.h+0−473
@@ -1,473 +0,0 @@
1−/* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $
2− *
3− * Main header for the Linux ISDN subsystem (linklevel).
4− *
5− * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
6− * Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
7− * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
8− *
9− * This software may be used and distributed according to the terms
10− * of the GNU General Public License, incorporated herein by reference.
11− *
12− */
13−#ifndef __ISDN_H__
14−#define __ISDN_H__
15−
16−
17−#include <linux/errno.h>
18−#include <linux/fs.h>
19−#include <linux/major.h>
20−#include <asm/io.h>
21−#include <linux/kernel.h>
22−#include <linux/signal.h>
23−#include <linux/slab.h>
24−#include <linux/timer.h>
25−#include <linux/wait.h>
26−#include <linux/tty.h>
27−#include <linux/tty_flip.h>
28−#include <linux/serial_reg.h>
29−#include <linux/fcntl.h>
30−#include <linux/types.h>
31−#include <linux/interrupt.h>
32−#include <linux/ip.h>
33−#include <linux/in.h>
34−#include <linux/netdevice.h>
35−#include <linux/etherdevice.h>
36−#include <linux/skbuff.h>
37−#include <linux/tcp.h>
38−#include <linux/mutex.h>
39−#include <uapi/linux/isdn.h>
40−
41−#define ISDN_TTY_MAJOR 43
42−#define ISDN_TTYAUX_MAJOR 44
43−#define ISDN_MAJOR 45
44−
45−/* The minor-devicenumbers for Channel 0 and 1 are used as arguments for
46− * physical Channel-Mapping, so they MUST NOT be changed without changing
47− * the correspondent code in isdn.c
48− */
49−
50−#define ISDN_MINOR_B 0
51−#define ISDN_MINOR_BMAX (ISDN_MAX_CHANNELS-1)
52−#define ISDN_MINOR_CTRL 64
53−#define ISDN_MINOR_CTRLMAX (64 + (ISDN_MAX_CHANNELS-1))
54−#define ISDN_MINOR_PPP 128
55−#define ISDN_MINOR_PPPMAX (128 + (ISDN_MAX_CHANNELS-1))
56−#define ISDN_MINOR_STATUS 255
57−
58−#ifdef CONFIG_ISDN_PPP
59−
60−#ifdef CONFIG_ISDN_PPP_VJ
61−# include <net/slhc_vj.h>
62−#endif
63−
64−#include <linux/ppp_defs.h>
65−#include <linux/ppp-ioctl.h>
66−
67−#include <linux/isdn_ppp.h>
68−#endif
69−
70−#ifdef CONFIG_ISDN_X25
71−# include <linux/concap.h>
72−#endif
73−
74−#include <linux/isdnif.h>
75−
76−#define ISDN_DRVIOCTL_MASK 0x7f /* Mask for Device-ioctl */
77−
78−/* Until now unused */
79−#define ISDN_SERVICE_VOICE 1
80−#define ISDN_SERVICE_AB 1<<1
81−#define ISDN_SERVICE_X21 1<<2
82−#define ISDN_SERVICE_G4 1<<3
83−#define ISDN_SERVICE_BTX 1<<4
84−#define ISDN_SERVICE_DFUE 1<<5
85−#define ISDN_SERVICE_X25 1<<6
86−#define ISDN_SERVICE_TTX 1<<7
87−#define ISDN_SERVICE_MIXED 1<<8
88−#define ISDN_SERVICE_FW 1<<9
89−#define ISDN_SERVICE_GTEL 1<<10
90−#define ISDN_SERVICE_BTXN 1<<11
91−#define ISDN_SERVICE_BTEL 1<<12
92−
93−/* Macros checking plain usage */
94−#define USG_NONE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
95−#define USG_RAW(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
96−#define USG_MODEM(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
97−#define USG_VOICE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
98−#define USG_NET(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
99−#define USG_FAX(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_FAX)
100−#define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
101−#define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
102− ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) )
103−
104−/* Timer-delays and scheduling-flags */
105−#define ISDN_TIMER_RES 4 /* Main Timer-Resolution */
106−#define ISDN_TIMER_02SEC (HZ/ISDN_TIMER_RES/5) /* Slow-Timer1 .2 sec */
107−#define ISDN_TIMER_1SEC (HZ/ISDN_TIMER_RES) /* Slow-Timer2 1 sec */
108−#define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */
109−#define ISDN_TIMER_KEEPINT 10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */
110−#define ISDN_TIMER_MODEMREAD 1
111−#define ISDN_TIMER_MODEMPLUS 2
112−#define ISDN_TIMER_MODEMRING 4
113−#define ISDN_TIMER_MODEMXMIT 8
114−#define ISDN_TIMER_NETDIAL 16
115−#define ISDN_TIMER_NETHANGUP 32
116−#define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */
117−#define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
118− ISDN_TIMER_MODEMXMIT)
119−#define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \
120− ISDN_TIMER_NETDIAL | ISDN_TIMER_CARRIER)
121−
122−/* Timeout-Values for isdn_net_dial() */
123−#define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
124−#define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
125−#define ISDN_TIMER_DTIMEOUT60 (60*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
126−
127−/* GLOBAL_FLAGS */
128−#define ISDN_GLOBAL_STOPPED 1
129−
130−/*=================== Start of ip-over-ISDN stuff =========================*/
131−
132−/* Feature- and status-flags for a net-interface */
133−#define ISDN_NET_CONNECTED 0x01 /* Bound to ISDN-Channel */
134−#define ISDN_NET_SECURE 0x02 /* Accept calls from phonelist only */
135−#define ISDN_NET_CALLBACK 0x04 /* activate callback */
136−#define ISDN_NET_CBHUP 0x08 /* hangup before callback */
137−#define ISDN_NET_CBOUT 0x10 /* remote machine does callback */
138−
139−#define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */
140−
141−/* Phone-list-element */
142−typedef struct {
143− void *next;
144− char num[ISDN_MSNLEN];
145−} isdn_net_phone;
146−
147−/*
148− Principles when extending structures for generic encapsulation protocol
149− ("concap") support:
150− - Stuff which is hardware specific (here i4l-specific) goes in
151− the netdev -> local structure (here: isdn_net_local)
152− - Stuff which is encapsulation protocol specific goes in the structure
153− which holds the linux device structure (here: isdn_net_device)
154−*/
155−
156−/* Local interface-data */
157−typedef struct isdn_net_local_s {
158− ulong magic;
159− struct net_device_stats stats; /* Ethernet Statistics */
160− int isdn_device; /* Index to isdn-device */
161− int isdn_channel; /* Index to isdn-channel */
162− int ppp_slot; /* PPPD device slot number */
163− int pre_device; /* Preselected isdn-device */
164− int pre_channel; /* Preselected isdn-channel */
165− int exclusive; /* If non-zero idx to reserved chan.*/
166− int flags; /* Connection-flags */
167− int dialretry; /* Counter for Dialout-retries */
168− int dialmax; /* Max. Number of Dial-retries */
169− int cbdelay; /* Delay before Callback starts */
170− int dtimer; /* Timeout-counter for dialing */
171− char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
172− u_char cbhup; /* Flag: Reject Call before Callback*/
173− u_char dialstate; /* State for dialing */
174− u_char p_encap; /* Packet encapsulation */
175− /* 0 = Ethernet over ISDN */
176− /* 1 = RAW-IP */
177− /* 2 = IP with type field */
178− u_char l2_proto; /* Layer-2-protocol */
179− /* See ISDN_PROTO_L2..-constants in */
180− /* isdnif.h */
181− /* 0 = X75/LAPB with I-Frames */
182− /* 1 = X75/LAPB with UI-Frames */
183− /* 2 = X75/LAPB with BUI-Frames */
184− /* 3 = HDLC */
185− u_char l3_proto; /* Layer-3-protocol */
186− /* See ISDN_PROTO_L3..-constants in */
187− /* isdnif.h */
188− /* 0 = Transparent */
189− int huptimer; /* Timeout-counter for auto-hangup */
190− int charge; /* Counter for charging units */
191− ulong chargetime; /* Timer for Charging info */
192− int hupflags; /* Flags for charge-unit-hangup: */
193− /* bit0: chargeint is invalid */
194− /* bit1: Getting charge-interval */
195− /* bit2: Do charge-unit-hangup */
196− /* bit3: Do hangup even on incoming */
197− int outgoing; /* Flag: outgoing call */
198− int onhtime; /* Time to keep link up */
199− int chargeint; /* Interval between charge-infos */
200− int onum; /* Flag: at least 1 outgoing number */
201− int cps; /* current speed of this interface */
202− int transcount; /* byte-counter for cps-calculation */
203− int sqfull; /* Flag: netdev-queue overloaded */
204− ulong sqfull_stamp; /* Start-Time of overload */
205− ulong slavedelay; /* Dynamic bundling delaytime */
206− int triggercps; /* BogoCPS needed for trigger slave */
207− isdn_net_phone *phone[2]; /* List of remote-phonenumbers */
208− /* phone[0] = Incoming Numbers */
209− /* phone[1] = Outgoing Numbers */
210− isdn_net_phone *dial; /* Pointer to dialed number */
211− struct net_device *master; /* Ptr to Master device for slaves */
212− struct net_device *slave; /* Ptr to Slave device for masters */
213− struct isdn_net_local_s *next; /* Ptr to next link in bundle */
214− struct isdn_net_local_s *last; /* Ptr to last link in bundle */
215− struct isdn_net_dev_s *netdev; /* Ptr to netdev */
216− struct sk_buff_head super_tx_queue; /* List of supervisory frames to */
217− /* be transmitted asap */
218− atomic_t frame_cnt; /* number of frames currently */
219− /* queued in HL driver */
220− /* Ptr to orig. hard_header_cache */
221− spinlock_t xmit_lock; /* used to protect the xmit path of */
222− /* a particular channel (including */
223− /* the frame_cnt */
224−
225− int pppbind; /* ippp device for bindings */
226− int dialtimeout; /* How long shall we try on dialing? (jiffies) */
227− int dialwait; /* How long shall we wait after failed attempt? (jiffies) */
228− ulong dialstarted; /* jiffies of first dialing-attempt */
229− ulong dialwait_timer; /* jiffies of earliest next dialing-attempt */
230− int huptimeout; /* How long will the connection be up? (seconds) */
231−#ifdef CONFIG_ISDN_X25
232− struct concap_device_ops *dops; /* callbacks used by encapsulator */
233−#endif
234− /* use an own struct for that in later versions */
235− ulong cisco_myseq; /* Local keepalive seq. for Cisco */
236− ulong cisco_mineseen; /* returned keepalive seq. from remote */
237− ulong cisco_yourseq; /* Remote keepalive seq. for Cisco */
238− int cisco_keepalive_period; /* keepalive period */
239− ulong cisco_last_slarp_in; /* jiffie of last keepalive packet we received */
240− char cisco_line_state; /* state of line according to keepalive packets */
241− char cisco_debserint; /* debugging flag of cisco hdlc with slarp */
242− struct timer_list cisco_timer;
243− struct work_struct tqueue;
244−} isdn_net_local;
245−
246−/* the interface itself */
247−typedef struct isdn_net_dev_s {
248− isdn_net_local *local;
249− isdn_net_local *queue; /* circular list of all bundled
250− channels, which are currently
251− online */
252− spinlock_t queue_lock; /* lock to protect queue */
253− void *next; /* Pointer to next isdn-interface */
254− struct net_device *dev; /* interface to upper levels */
255−#ifdef CONFIG_ISDN_PPP
256− ippp_bundle * pb; /* pointer to the common bundle structure
257− * with the per-bundle data */
258−#endif
259−#ifdef CONFIG_ISDN_X25
260− struct concap_proto *cprot; /* connection oriented encapsulation protocol */
261−#endif
262−
263−} isdn_net_dev;
264−
265−/*===================== End of ip-over-ISDN stuff ===========================*/
266−
267−/*======================= Start of ISDN-tty stuff ===========================*/
268−
269−#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
270−#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
271−#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
272−
273−#ifdef CONFIG_ISDN_AUDIO
274−/* For using sk_buffs with audio we need some private variables
275− * within each sk_buff. For this purpose, we declare a struct here,
276− * and put it always at the private skb->cb data array. A few macros help
277− * accessing the variables.
278− */
279−typedef struct _isdn_audio_data {
280− unsigned short dle_count;
281− unsigned char lock;
282−} isdn_audio_data_t;
283−
284−#define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_data_t *)&skb->cb[0])->dle_count)
285−#define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_data_t *)&skb->cb[0])->lock)
286−#endif
287−
288−/* Private data of AT-command-interpreter */
289−typedef struct atemu {
290− u_char profile[ISDN_MODEM_NUMREG]; /* Modem-Regs. Profile 0 */
291− u_char mdmreg[ISDN_MODEM_NUMREG]; /* Modem-Registers */
292− char pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0 */
293− char msn[ISDN_MSNLEN]; /* EAZ/MSN */
294− char plmsn[ISDN_LMSNLEN]; /* Listening MSNs Profile 0 */
295− char lmsn[ISDN_LMSNLEN]; /* Listening MSNs */
296− char cpn[ISDN_MSNLEN]; /* CalledPartyNumber on incoming call */
297− char connmsg[ISDN_CMSGLEN]; /* CONNECT-Msg from HL-Driver */
298−#ifdef CONFIG_ISDN_AUDIO
299− u_char vpar[10]; /* Voice-parameters */
300− int lastDLE; /* Flag for voice-coding: DLE seen */
301−#endif
302− int mdmcmdl; /* Length of Modem-Commandbuffer */
303− int pluscount; /* Counter for +++ sequence */
304− u_long lastplus; /* Timestamp of last + */
305− int carrierwait; /* Seconds of carrier waiting */
306− char mdmcmd[255]; /* Modem-Commandbuffer */
307− unsigned int charge; /* Charge units of current connection */
308−} atemu;
309−
310−/* Private data (similar to async_struct in <linux/serial.h>) */
311−typedef struct modem_info {
312− int magic;
313− struct tty_port port;
314− int x_char; /* xon/xoff character */
315− int mcr; /* Modem control register */
316− int msr; /* Modem status register */
317− int lsr; /* Line status register */
318− int line;
319− int online; /* 1 = B-Channel is up, drop data */
320− /* 2 = B-Channel is up, deliver d.*/
321− int dialing; /* Dial in progress or ATA */
322− int closing;
323− int rcvsched; /* Receive needs schedule */
324− int isdn_driver; /* Index to isdn-driver */
325− int isdn_channel; /* Index to isdn-channel */
326− int drv_index; /* Index to dev->usage */
327− int ncarrier; /* Flag: schedule NO CARRIER */
328− unsigned char last_cause[8]; /* Last cause message */
329− unsigned char last_num[ISDN_MSNLEN];
330− /* Last phone-number */
331− unsigned char last_l2; /* Last layer-2 protocol */
332− unsigned char last_si; /* Last service */
333− unsigned char last_lhup; /* Last hangup local? */
334− unsigned char last_dir; /* Last direction (in or out) */
335− struct timer_list nc_timer; /* Timer for delayed NO CARRIER */
336− int send_outstanding;/* # of outstanding send-requests */
337− int xmit_size; /* max. # of chars in xmit_buf */
338− int xmit_count; /* # of chars in xmit_buf */
339− struct sk_buff_head xmit_queue; /* transmit queue */
340− atomic_t xmit_lock; /* Semaphore for isdn_tty_write */
341−#ifdef CONFIG_ISDN_AUDIO
342− int vonline; /* Voice-channel status */
343− /* Bit 0 = recording */
344− /* Bit 1 = playback */
345− /* Bit 2 = playback, DLE-ETX seen */
346− struct sk_buff_head dtmf_queue; /* queue for dtmf results */
347− void *adpcms; /* state for adpcm decompression */
348− void *adpcmr; /* state for adpcm compression */
349− void *dtmf_state; /* state for dtmf decoder */
350− void *silence_state; /* state for silence detection */
351−#endif
352−#ifdef CONFIG_ISDN_TTY_FAX
353− struct T30_s *fax; /* T30 Fax Group 3 data/interface */
354− int faxonline; /* Fax-channel status */
355−#endif
356− atemu emu; /* AT-emulator data */
357− spinlock_t readlock;
358−} modem_info;
359−
360−#define ISDN_MODEM_WINSIZE 8
361−
362−/* Description of one ISDN-tty */
363−typedef struct _isdn_modem {
364− int refcount; /* Number of opens */
365− struct tty_driver *tty_modem; /* tty-device */
366− struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
367− struct ktermios *modem_termios[ISDN_MAX_CHANNELS];
368− struct ktermios *modem_termios_locked[ISDN_MAX_CHANNELS];
369− modem_info info[ISDN_MAX_CHANNELS]; /* Private data */
370−} isdn_modem_t;
371−
372−/*======================= End of ISDN-tty stuff ============================*/
373−
374−/*======================== Start of V.110 stuff ============================*/
375−#define V110_BUFSIZE 1024
376−
377−typedef struct {
378− int nbytes; /* 1 Matrixbyte -> nbytes in stream */
379− int nbits; /* Number of used bits in streambyte */
380− unsigned char key; /* Bitmask in stream eg. 11 (nbits=2) */
381− int decodelen; /* Amount of data in decodebuf */
382− int SyncInit; /* Number of sync frames to send */
383− unsigned char *OnlineFrame; /* Precalculated V110 idle frame */
384− unsigned char *OfflineFrame; /* Precalculated V110 sync Frame */
385− int framelen; /* Length of frames */
386− int skbuser; /* Number of unacked userdata skbs */
387− int skbidle; /* Number of unacked idle/sync skbs */
388− int introducer; /* Local vars for decoder */
389− int dbit;
390− unsigned char b;
391− int skbres; /* space to reserve in outgoing skb */
392− int maxsize; /* maxbufsize of lowlevel driver */
393− unsigned char *encodebuf; /* temporary buffer for encoding */
394− unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices */
395−} isdn_v110_stream;
396−
397−/*========================= End of V.110 stuff =============================*/
398−
399−/*======================= Start of general stuff ===========================*/
400−
401−typedef struct {
402− char *next;
403− char *private;
404−} infostruct;
405−
406−#define DRV_FLAG_RUNNING 1
407−#define DRV_FLAG_REJBUS 2
408−#define DRV_FLAG_LOADED 4
409−
410−/* Description of hardware-level-driver */
411−typedef struct _isdn_driver {
412− ulong online; /* Channel-Online flags */
413− ulong flags; /* Misc driver Flags */
414− int locks; /* Number of locks for this driver */
415− int channels; /* Number of channels */
416− wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */
417− int maxbufsize; /* Maximum Buffersize supported */
418− unsigned long pktcount; /* Until now: unused */
419− int stavail; /* Chars avail on Status-device */
420− isdn_if *interface; /* Interface to driver */
421− int *rcverr; /* Error-counters for B-Ch.-receive */
422− int *rcvcount; /* Byte-counters for B-Ch.-receive */
423−#ifdef CONFIG_ISDN_AUDIO
424− unsigned long DLEflag; /* Flags: Insert DLE at next read */
425−#endif
426− struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */
427− wait_queue_head_t *rcv_waitq; /* Wait-Queues for B-Channel-Reads */
428− wait_queue_head_t *snd_waitq; /* Wait-Queue for B-Channel-Send's */
429− char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */
430−} isdn_driver_t;
431−
432−/* Main driver-data */
433−typedef struct isdn_devt {
434− struct module *owner;
435− spinlock_t lock;
436− unsigned short flags; /* Bitmapped Flags: */
437− int drivers; /* Current number of drivers */
438− int channels; /* Current number of channels */
439− int net_verbose; /* Verbose-Flag */
440− int modempoll; /* Flag: tty-read active */
441− spinlock_t timerlock;
442− int tflags; /* Timer-Flags: */
443− /* see ISDN_TIMER_..defines */
444− int global_flags;
445− infostruct *infochain; /* List of open info-devs. */
446− wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
447− struct timer_list timer; /* Misc.-function Timer */
448− int chanmap[ISDN_MAX_CHANNELS]; /* Map minor->device-channel */
449− int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */
450− int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */
451− char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
452− /* Remote number of active ch.*/
453− int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */
454− isdn_driver_t *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */
455− isdn_net_dev *netdev; /* Linked list of net-if's */
456− char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */
457− struct task_struct *profd; /* For iprofd */
458− isdn_modem_t mdm; /* tty-driver-data */
459− isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */
460− isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */
461− ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */
462− ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */
463− int v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */
464− atomic_t v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */
465− isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */
466− struct mutex mtx; /* serialize list access*/
467− unsigned long global_features;
468−} isdn_dev;
469−
470−extern isdn_dev *dev;
471−
472−
473−#endif /* __ISDN_H__ */
include/linux/isdn/hdlc.h+0−69
@@ -1,69 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0-or-later */
2−/*
3− * hdlc.h -- General purpose ISDN HDLC decoder.
4− *
5− * Implementation of a HDLC decoder/encoder in software.
6− * Necessary because some ISDN devices don't have HDLC
7− * controllers.
8− *
9− * Copyright (C)
10− * 2009 Karsten Keil <keil@b1-systems.de>
11− * 2002 Wolfgang Mües <wolfgang@iksw-muees.de>
12− * 2001 Frode Isaksen <fisaksen@bewan.com>
13− * 2001 Kai Germaschewski <kai.germaschewski@gmx.de>
14− */
15−
16−#ifndef __ISDNHDLC_H__
17−#define __ISDNHDLC_H__
18−
19−struct isdnhdlc_vars {
20− int bit_shift;
21− int hdlc_bits1;
22− int data_bits;
23− int ffbit_shift; /* encoding only */
24− int state;
25− int dstpos;
26−
27− u16 crc;
28−
29− u8 cbin;
30− u8 shift_reg;
31− u8 ffvalue;
32−
33− /* set if transferring data */
34− u32 data_received:1;
35− /* set if D channel (send idle instead of flags) */
36− u32 dchannel:1;
37− /* set if 56K adaptation */
38− u32 do_adapt56:1;
39− /* set if in closing phase (need to send CRC + flag) */
40− u32 do_closing:1;
41− /* set if data is bitreverse */
42− u32 do_bitreverse:1;
43−};
44−
45−/* Feature Flags */
46−#define HDLC_56KBIT 0x01
47−#define HDLC_DCHANNEL 0x02
48−#define HDLC_BITREVERSE 0x04
49−
50−/*
51− The return value from isdnhdlc_decode is
52− the frame length, 0 if no complete frame was decoded,
53− or a negative error number
54−*/
55−#define HDLC_FRAMING_ERROR 1
56−#define HDLC_CRC_ERROR 2
57−#define HDLC_LENGTH_ERROR 3
58−
59−extern void isdnhdlc_rcv_init(struct isdnhdlc_vars *hdlc, u32 features);
60−
61−extern int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src,
62− int slen, int *count, u8 *dst, int dsize);
63−
64−extern void isdnhdlc_out_init(struct isdnhdlc_vars *hdlc, u32 features);
65−
66−extern int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src,
67− u16 slen, int *count, u8 *dst, int dsize);
68−
69−#endif /* __ISDNHDLC_H__ */
include/linux/isdn_divertif.h+0−35
@@ -1,35 +0,0 @@
1−/* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $
2− *
3− * Header for the diversion supplementary interface for i4l.
4− *
5− * Author Werner Cornelius (werner@titro.de)
6− * Copyright by Werner Cornelius (werner@titro.de)
7− *
8− * This software may be used and distributed according to the terms
9− * of the GNU General Public License, incorporated herein by reference.
10− *
11− */
12−#ifndef _LINUX_ISDN_DIVERTIF_H
13−#define _LINUX_ISDN_DIVERTIF_H
14−
15−#include <linux/isdnif.h>
16−#include <linux/types.h>
17−#include <uapi/linux/isdn_divertif.h>
18−
19−/***************************************************************/
20−/* structure exchanging data between isdn hl and divert module */
21−/***************************************************************/
22−typedef struct
23− { ulong if_magic; /* magic info and version */
24− int cmd; /* command */
25− int (*stat_callback)(isdn_ctrl *); /* supplied by divert module when calling */
26− int (*ll_cmd)(isdn_ctrl *); /* supplied by hl on return */
27− char * (*drv_to_name)(int); /* map a driver id to name, supplied by hl */
28− int (*name_to_drv)(char *); /* map a driver id to name, supplied by hl */
29− } isdn_divert_if;
30−
31−/*********************/
32−/* function register */
33−/*********************/
34−extern int DIVERT_REG_NAME(isdn_divert_if *);
35−#endif /* _LINUX_ISDN_DIVERTIF_H */
include/linux/isdn_ppp.h+0−194
@@ -1,194 +0,0 @@
1−/* Linux ISDN subsystem, sync PPP, interface to ipppd
2− *
3− * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
4− * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
5− * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
6− * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name)
7− *
8− * This software may be used and distributed according to the terms
9− * of the GNU General Public License, incorporated herein by reference.
10− *
11− */
12−#ifndef _LINUX_ISDN_PPP_H
13−#define _LINUX_ISDN_PPP_H
14−
15−
16−
17−
18−#ifdef CONFIG_IPPP_FILTER
19−#include <linux/filter.h>
20−#endif
21−#include <uapi/linux/isdn_ppp.h>
22−
23−#define DECOMP_ERR_NOMEM (-10)
24−
25−#define MP_END_FRAG 0x40
26−#define MP_BEGIN_FRAG 0x80
27−
28−#define MP_MAX_QUEUE_LEN 16
29−
30−/*
31− * We need a way for the decompressor to influence the generation of CCP
32− * Reset-Requests in a variety of ways. The decompressor is already returning
33− * a lot of information (generated skb length, error conditions) so we use
34− * another parameter. This parameter is a pointer to a structure which is
35− * to be marked valid by the decompressor and only in this case is ever used.
36− * Furthermore, the only case where this data is used is when the decom-
37− * pressor returns DECOMP_ERROR.
38− *
39− * We use this same struct for the reset entry of the compressor to commu-
40− * nicate to its caller how to deal with sending of a Reset Ack. In this
41− * case, expra is not used, but other options still apply (suppressing
42− * sending with rsend, appending arbitrary data, etc).
43− */
44−
45−#define IPPP_RESET_MAXDATABYTES 32
46−
47−struct isdn_ppp_resetparams {
48− unsigned char valid:1; /* rw Is this structure filled at all ? */
49− unsigned char rsend:1; /* rw Should we send one at all ? */
50− unsigned char idval:1; /* rw Is the id field valid ? */
51− unsigned char dtval:1; /* rw Is the data field valid ? */
52− unsigned char expra:1; /* rw Is an Ack expected for this Req ? */
53− unsigned char id; /* wo Send CCP ResetReq with this id */
54− unsigned short maxdlen; /* ro Max bytes to be stored in data field */
55− unsigned short dlen; /* rw Bytes stored in data field */
56− unsigned char *data; /* wo Data for ResetReq info field */
57−};
58−
59−/*
60− * this is an 'old friend' from ppp-comp.h under a new name
61− * check the original include for more information
62− */
63−struct isdn_ppp_compressor {
64− struct isdn_ppp_compressor *next, *prev;
65− struct module *owner;
66− int num; /* CCP compression protocol number */
67−
68− void *(*alloc) (struct isdn_ppp_comp_data *);
69− void (*free) (void *state);
70− int (*init) (void *state, struct isdn_ppp_comp_data *,
71− int unit,int debug);
72−
73− /* The reset entry needs to get more exact information about the
74− ResetReq or ResetAck it was called with. The parameters are
75− obvious. If reset is called without a Req or Ack frame which
76− could be handed into it, code MUST be set to 0. Using rsparm,
77− the reset entry can control if and how a ResetAck is returned. */
78−
79− void (*reset) (void *state, unsigned char code, unsigned char id,
80− unsigned char *data, unsigned len,
81− struct isdn_ppp_resetparams *rsparm);
82−
83− int (*compress) (void *state, struct sk_buff *in,
84− struct sk_buff *skb_out, int proto);
85−
86− int (*decompress) (void *state,struct sk_buff *in,
87− struct sk_buff *skb_out,
88− struct isdn_ppp_resetparams *rsparm);
89−
90− void (*incomp) (void *state, struct sk_buff *in,int proto);
91− void (*stat) (void *state, struct compstat *stats);
92−};
93−
94−extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
95−extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
96−extern int isdn_ppp_dial_slave(char *);
97−extern int isdn_ppp_hangup_slave(char *);
98−
99−typedef struct {
100− unsigned long seqerrs;
101− unsigned long frame_drops;
102− unsigned long overflows;
103− unsigned long max_queue_len;
104−} isdn_mppp_stats;
105−
106−typedef struct {
107− int mp_mrru; /* unused */
108− struct sk_buff * frags; /* fragments sl list -- use skb->next */
109− long frames; /* number of frames in the frame list */
110− unsigned int seq; /* last processed packet seq #: any packets
111− * with smaller seq # will be dropped
112− * unconditionally */
113− spinlock_t lock;
114− int ref_ct;
115− /* statistics */
116− isdn_mppp_stats stats;
117−} ippp_bundle;
118−
119−#define NUM_RCV_BUFFS 64
120−
121−struct ippp_buf_queue {
122− struct ippp_buf_queue *next;
123− struct ippp_buf_queue *last;
124− char *buf; /* NULL here indicates end of queue */
125− int len;
126−};
127−
128−/* The data structure for one CCP reset transaction */
129−enum ippp_ccp_reset_states {
130− CCPResetIdle,
131− CCPResetSentReq,
132− CCPResetRcvdReq,
133− CCPResetSentAck,
134− CCPResetRcvdAck
135−};
136−
137−struct ippp_ccp_reset_state {
138− enum ippp_ccp_reset_states state; /* State of this transaction */
139− struct ippp_struct *is; /* Backlink to device stuff */
140− unsigned char id; /* Backlink id index */
141− unsigned char ta:1; /* The timer is active (flag) */
142− unsigned char expra:1; /* We expect a ResetAck at all */
143− int dlen; /* Databytes stored in data */
144− struct timer_list timer; /* For timeouts/retries */
145− /* This is a hack but seems sufficient for the moment. We do not want
146− to have this be yet another allocation for some bytes, it is more
147− memory management overhead than the whole mess is worth. */
148− unsigned char data[IPPP_RESET_MAXDATABYTES];
149−};
150−
151−/* The data structure keeping track of the currently outstanding CCP Reset
152− transactions. */
153−struct ippp_ccp_reset {
154− struct ippp_ccp_reset_state *rs[256]; /* One per possible id */
155− unsigned char lastid; /* Last id allocated by the engine */
156−};
157−
158−struct ippp_struct {
159− struct ippp_struct *next_link;
160− int state;
161− spinlock_t buflock;
162− struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
163− struct ippp_buf_queue *first; /* pointer to (current) first packet */
164− struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
165− wait_queue_head_t wq;
166− struct task_struct *tk;
167− unsigned int mpppcfg;
168− unsigned int pppcfg;
169− unsigned int mru;
170− unsigned int mpmru;
171− unsigned int mpmtu;
172− unsigned int maxcid;
173− struct isdn_net_local_s *lp;
174− int unit;
175− int minor;
176− unsigned int last_link_seqno;
177− long mp_seqno;
178−#ifdef CONFIG_ISDN_PPP_VJ
179− unsigned char *cbuf;
180− struct slcompress *slcomp;
181−#endif
182−#ifdef CONFIG_IPPP_FILTER
183− struct bpf_prog *pass_filter; /* filter for packets to pass */
184− struct bpf_prog *active_filter; /* filter for pkts to reset idle */
185−#endif
186− unsigned long debug;
187− struct isdn_ppp_compressor *compressor,*decompressor;
188− struct isdn_ppp_compressor *link_compressor,*link_decompressor;
189− void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat;
190− struct ippp_ccp_reset *reset; /* Allocated on demand, may never be needed */
191− unsigned long compflags;
192−};
193−
194−#endif /* _LINUX_ISDN_PPP_H */
include/linux/isdnif.h+0−505
@@ -1,505 +0,0 @@
1−/* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $
2− *
3− * Linux ISDN subsystem
4− * Definition of the interface between the subsystem and its low-level drivers.
5− *
6− * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
7− * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
8− *
9− * This software may be used and distributed according to the terms
10− * of the GNU General Public License, incorporated herein by reference.
11− *
12− */
13−#ifndef __ISDNIF_H__
14−#define __ISDNIF_H__
15−
16−
17−#include <linux/skbuff.h>
18−#include <uapi/linux/isdnif.h>
19−
20−/***************************************************************************/
21−/* Extensions made by Werner Cornelius (werner@ikt.de) */
22−/* */
23−/* The proceed command holds a incoming call in a state to leave processes */
24−/* enough time to check whether ist should be accepted. */
25−/* The PROT_IO Command extends the interface to make protocol dependent */
26−/* features available (call diversion, call waiting...). */
27−/* */
28−/* The PROT_IO Command is executed with the desired driver id and the arg */
29−/* parameter coded as follows: */
30−/* The lower 8 bits of arg contain the desired protocol from ISDN_PTYPE */
31−/* definitions. The upper 24 bits represent the protocol specific cmd/stat.*/
32−/* Any additional data is protocol and command specific. */
33−/* This mechanism also applies to the statcallb callback STAT_PROT. */
34−/* */
35−/* This suggested extension permits an easy expansion of protocol specific */
36−/* handling. Extensions may be added at any time without changing the HL */
37−/* driver code and not getting conflicts without certifications. */
38−/* The well known CAPI 2.0 interface handles such extensions in a similar */
39−/* way. Perhaps a protocol specific module may be added and separately */
40−/* loaded and linked to the basic isdn module for handling. */
41−/***************************************************************************/
42−
43−/*****************/
44−/* DSS1 commands */
45−/*****************/
46−#define DSS1_CMD_INVOKE ((0x00 << 8) | ISDN_PTYPE_EURO) /* invoke a supplementary service */
47−#define DSS1_CMD_INVOKE_ABORT ((0x01 << 8) | ISDN_PTYPE_EURO) /* abort a invoke cmd */
48−
49−/*******************************/
50−/* DSS1 Status callback values */
51−/*******************************/
52−#define DSS1_STAT_INVOKE_RES ((0x80 << 8) | ISDN_PTYPE_EURO) /* Result for invocation */
53−#define DSS1_STAT_INVOKE_ERR ((0x81 << 8) | ISDN_PTYPE_EURO) /* Error Return for invocation */
54−#define DSS1_STAT_INVOKE_BRD ((0x82 << 8) | ISDN_PTYPE_EURO) /* Deliver invoke broadcast info */
55−
56−
57−/*********************************************************************/
58−/* structures for DSS1 commands and callback */
59−/* */
60−/* An action is invoked by sending a DSS1_CMD_INVOKE. The ll_id, proc*/
61−/* timeout, datalen and data fields must be set before calling. */
62−/* */
63−/* The return value is a positive hl_id value also delivered in the */
64−/* hl_id field. A value of zero signals no more left hl_id capacitys.*/
65−/* A negative return value signals errors in LL. So if the return */
66−/* value is <= 0 no action in LL will be taken -> request ignored */
67−/* */
68−/* The timeout field must be filled with a positive value specifying */
69−/* the amount of time the INVOKED process waits for a reaction from */
70−/* the network. */
71−/* If a response (either error or result) is received during this */
72−/* intervall, a reporting callback is initiated and the process will */
73−/* be deleted, the hl identifier will be freed. */
74−/* If no response is received during the specified intervall, a error*/
75−/* callback is initiated with timeout set to -1 and a datalen set */
76−/* to 0. */
77−/* If timeout is set to a value <= 0 during INVOCATION the process is*/
78−/* immediately deleted after sending the data. No callback occurs ! */
79−/* */
80−/* A currently waiting process may be aborted with INVOKE_ABORT. No */
81−/* callback will occur when a process has been aborted. */
82−/* */
83−/* Broadcast invoke frames from the network are reported via the */
84−/* STAT_INVOKE_BRD callback. The ll_id is set to 0, the other fields */
85−/* are supplied by the network and not by the HL. */
86−/*********************************************************************/
87−
88−/*****************/
89−/* NI1 commands */
90−/*****************/
91−#define NI1_CMD_INVOKE ((0x00 << 8) | ISDN_PTYPE_NI1) /* invoke a supplementary service */
92−#define NI1_CMD_INVOKE_ABORT ((0x01 << 8) | ISDN_PTYPE_NI1) /* abort a invoke cmd */
93−
94−/*******************************/
95−/* NI1 Status callback values */
96−/*******************************/
97−#define NI1_STAT_INVOKE_RES ((0x80 << 8) | ISDN_PTYPE_NI1) /* Result for invocation */
98−#define NI1_STAT_INVOKE_ERR ((0x81 << 8) | ISDN_PTYPE_NI1) /* Error Return for invocation */
99−#define NI1_STAT_INVOKE_BRD ((0x82 << 8) | ISDN_PTYPE_NI1) /* Deliver invoke broadcast info */
100−
101−typedef struct
102− { ulong ll_id; /* ID supplied by LL when executing */
103− /* a command and returned by HL for */
104− /* INVOKE_RES and INVOKE_ERR */
105− int hl_id; /* ID supplied by HL when called */
106− /* for executing a cmd and delivered */
107− /* for results and errors */
108− /* must be supplied by LL when aborting*/
109− int proc; /* invoke procedure used by CMD_INVOKE */
110− /* returned by callback and broadcast */
111− int timeout; /* timeout for INVOKE CMD in ms */
112− /* -1 in stat callback when timed out */
113− /* error value when error callback */
114− int datalen; /* length of cmd or stat data */
115− u_char *data;/* pointer to data delivered or send */
116− } isdn_cmd_stat;
117−
118−/*
119− * Commands from linklevel to lowlevel
120− *
121− */
122−#define ISDN_CMD_IOCTL 0 /* Perform ioctl */
123−#define ISDN_CMD_DIAL 1 /* Dial out */
124−#define ISDN_CMD_ACCEPTD 2 /* Accept an incoming call on D-Chan. */
125−#define ISDN_CMD_ACCEPTB 3 /* Request B-Channel connect. */
126−#define ISDN_CMD_HANGUP 4 /* Hangup */
127−#define ISDN_CMD_CLREAZ 5 /* Clear EAZ(s) of channel */
128−#define ISDN_CMD_SETEAZ 6 /* Set EAZ(s) of channel */
129−#define ISDN_CMD_GETEAZ 7 /* Get EAZ(s) of channel */
130−#define ISDN_CMD_SETSIL 8 /* Set Service-Indicator-List of channel */
131−#define ISDN_CMD_GETSIL 9 /* Get Service-Indicator-List of channel */
132−#define ISDN_CMD_SETL2 10 /* Set B-Chan. Layer2-Parameter */
133−#define ISDN_CMD_GETL2 11 /* Get B-Chan. Layer2-Parameter */
134−#define ISDN_CMD_SETL3 12 /* Set B-Chan. Layer3-Parameter */
135−#define ISDN_CMD_GETL3 13 /* Get B-Chan. Layer3-Parameter */
136−// #define ISDN_CMD_LOCK 14 /* Signal usage by upper levels */
137−// #define ISDN_CMD_UNLOCK 15 /* Release usage-lock */
138−#define ISDN_CMD_SUSPEND 16 /* Suspend connection */
139−#define ISDN_CMD_RESUME 17 /* Resume connection */
140−#define ISDN_CMD_PROCEED 18 /* Proceed with call establishment */
141−#define ISDN_CMD_ALERT 19 /* Alert after Proceeding */
142−#define ISDN_CMD_REDIR 20 /* Redir a incoming call */
143−#define ISDN_CMD_PROT_IO 21 /* Protocol specific commands */
144−#define CAPI_PUT_MESSAGE 22 /* CAPI message send down or up */
145−#define ISDN_CMD_FAXCMD 23 /* FAX commands to HL-driver */
146−#define ISDN_CMD_AUDIO 24 /* DSP, DTMF, ... settings */
147−
148−/*
149− * Status-Values delivered from lowlevel to linklevel via
150− * statcallb().
151− *
152− */
153−#define ISDN_STAT_STAVAIL 256 /* Raw status-data available */
154−#define ISDN_STAT_ICALL 257 /* Incoming call detected */
155−#define ISDN_STAT_RUN 258 /* Signal protocol-code is running */
156−#define ISDN_STAT_STOP 259 /* Signal halt of protocol-code */
157−#define ISDN_STAT_DCONN 260 /* Signal D-Channel connect */
158−#define ISDN_STAT_BCONN 261 /* Signal B-Channel connect */
159−#define ISDN_STAT_DHUP 262 /* Signal D-Channel disconnect */
160−#define ISDN_STAT_BHUP 263 /* Signal B-Channel disconnect */
161−#define ISDN_STAT_CINF 264 /* Charge-Info */
162−#define ISDN_STAT_LOAD 265 /* Signal new lowlevel-driver is loaded */
163−#define ISDN_STAT_UNLOAD 266 /* Signal unload of lowlevel-driver */
164−#define ISDN_STAT_BSENT 267 /* Signal packet sent */
165−#define ISDN_STAT_NODCH 268 /* Signal no D-Channel */
166−#define ISDN_STAT_ADDCH 269 /* Add more Channels */
167−#define ISDN_STAT_CAUSE 270 /* Cause-Message */
168−#define ISDN_STAT_ICALLW 271 /* Incoming call without B-chan waiting */
169−#define ISDN_STAT_REDIR 272 /* Redir result */
170−#define ISDN_STAT_PROT 273 /* protocol IO specific callback */
171−#define ISDN_STAT_DISPLAY 274 /* deliver a received display message */
172−#define ISDN_STAT_L1ERR 275 /* Signal Layer-1 Error */
173−#define ISDN_STAT_FAXIND 276 /* FAX indications from HL-driver */
174−#define ISDN_STAT_AUDIO 277 /* DTMF, DSP indications */
175−#define ISDN_STAT_DISCH 278 /* Disable/Enable channel usage */
176−
177−/*
178− * Audio commands
179− */
180−#define ISDN_AUDIO_SETDD 0 /* Set DTMF detection */
181−#define ISDN_AUDIO_DTMF 1 /* Rx/Tx DTMF */
182−
183−/*
184− * Values for errcode field
185− */
186−#define ISDN_STAT_L1ERR_SEND 1
187−#define ISDN_STAT_L1ERR_RECV 2
188−
189−/*
190− * Values for feature-field of interface-struct.
191− */
192−/* Layer 2 */
193−#define ISDN_FEATURE_L2_X75I (0x0001 << ISDN_PROTO_L2_X75I)
194−#define ISDN_FEATURE_L2_X75UI (0x0001 << ISDN_PROTO_L2_X75UI)
195−#define ISDN_FEATURE_L2_X75BUI (0x0001 << ISDN_PROTO_L2_X75BUI)
196−#define ISDN_FEATURE_L2_HDLC (0x0001 << ISDN_PROTO_L2_HDLC)
197−#define ISDN_FEATURE_L2_TRANS (0x0001 << ISDN_PROTO_L2_TRANS)
198−#define ISDN_FEATURE_L2_X25DTE (0x0001 << ISDN_PROTO_L2_X25DTE)
199−#define ISDN_FEATURE_L2_X25DCE (0x0001 << ISDN_PROTO_L2_X25DCE)
200−#define ISDN_FEATURE_L2_V11096 (0x0001 << ISDN_PROTO_L2_V11096)
201−#define ISDN_FEATURE_L2_V11019 (0x0001 << ISDN_PROTO_L2_V11019)
202−#define ISDN_FEATURE_L2_V11038 (0x0001 << ISDN_PROTO_L2_V11038)
203−#define ISDN_FEATURE_L2_MODEM (0x0001 << ISDN_PROTO_L2_MODEM)
204−#define ISDN_FEATURE_L2_FAX (0x0001 << ISDN_PROTO_L2_FAX)
205−#define ISDN_FEATURE_L2_HDLC_56K (0x0001 << ISDN_PROTO_L2_HDLC_56K)
206−
207−#define ISDN_FEATURE_L2_MASK (0x0FFFF) /* Max. 16 protocols */
208−#define ISDN_FEATURE_L2_SHIFT (0)
209−
210−/* Layer 3 */
211−#define ISDN_FEATURE_L3_TRANS (0x10000 << ISDN_PROTO_L3_TRANS)
212−#define ISDN_FEATURE_L3_TRANSDSP (0x10000 << ISDN_PROTO_L3_TRANSDSP)
213−#define ISDN_FEATURE_L3_FCLASS2 (0x10000 << ISDN_PROTO_L3_FCLASS2)
214−#define ISDN_FEATURE_L3_FCLASS1 (0x10000 << ISDN_PROTO_L3_FCLASS1)
215−
216−#define ISDN_FEATURE_L3_MASK (0x0FF0000) /* Max. 8 Protocols */
217−#define ISDN_FEATURE_L3_SHIFT (16)
218−
219−/* Signaling */
220−#define ISDN_FEATURE_P_UNKNOWN (0x1000000 << ISDN_PTYPE_UNKNOWN)
221−#define ISDN_FEATURE_P_1TR6 (0x1000000 << ISDN_PTYPE_1TR6)
222−#define ISDN_FEATURE_P_EURO (0x1000000 << ISDN_PTYPE_EURO)
223−#define ISDN_FEATURE_P_NI1 (0x1000000 << ISDN_PTYPE_NI1)
224−
225−#define ISDN_FEATURE_P_MASK (0x0FF000000) /* Max. 8 Protocols */
226−#define ISDN_FEATURE_P_SHIFT (24)
227−
228−typedef struct setup_parm {
229− unsigned char phone[32]; /* Remote Phone-Number */
230− unsigned char eazmsn[32]; /* Local EAZ or MSN */
231− unsigned char si1; /* Service Indicator 1 */
232− unsigned char si2; /* Service Indicator 2 */
233− unsigned char plan; /* Numbering plan */
234− unsigned char screen; /* Screening info */
235−} setup_parm;
236−
237−
238−#ifdef CONFIG_ISDN_TTY_FAX
239−/* T.30 Fax G3 */
240−
241−#define FAXIDLEN 21
242−
243−typedef struct T30_s {
244− /* session parameters */
245− __u8 resolution;
246− __u8 rate;
247− __u8 width;
248− __u8 length;
249− __u8 compression;
250− __u8 ecm;
251− __u8 binary;
252− __u8 scantime;
253− __u8 id[FAXIDLEN];
254− /* additional parameters */
255− __u8 phase;
256− __u8 direction;
257− __u8 code;
258− __u8 badlin;
259− __u8 badmul;
260− __u8 bor;
261− __u8 fet;
262− __u8 pollid[FAXIDLEN];
263− __u8 cq;
264− __u8 cr;
265− __u8 ctcrty;
266− __u8 minsp;
267− __u8 phcto;
268− __u8 rel;
269− __u8 nbc;
270− /* remote station parameters */
271− __u8 r_resolution;
272− __u8 r_rate;
273− __u8 r_width;
274− __u8 r_length;
275− __u8 r_compression;
276− __u8 r_ecm;
277− __u8 r_binary;
278− __u8 r_scantime;
279− __u8 r_id[FAXIDLEN];
280− __u8 r_code;
281−} __packed T30_s;
282−
283−#define ISDN_TTY_FAX_CONN_IN 0
284−#define ISDN_TTY_FAX_CONN_OUT 1
285−
286−#define ISDN_TTY_FAX_FCON 0
287−#define ISDN_TTY_FAX_DIS 1
288−#define ISDN_TTY_FAX_FTT 2
289−#define ISDN_TTY_FAX_MCF 3
290−#define ISDN_TTY_FAX_DCS 4
291−#define ISDN_TTY_FAX_TRAIN_OK 5
292−#define ISDN_TTY_FAX_EOP 6
293−#define ISDN_TTY_FAX_EOM 7
294−#define ISDN_TTY_FAX_MPS 8
295−#define ISDN_TTY_FAX_DTC 9
296−#define ISDN_TTY_FAX_RID 10
297−#define ISDN_TTY_FAX_HNG 11
298−#define ISDN_TTY_FAX_DT 12
299−#define ISDN_TTY_FAX_FCON_I 13
300−#define ISDN_TTY_FAX_DR 14
301−#define ISDN_TTY_FAX_ET 15
302−#define ISDN_TTY_FAX_CFR 16
303−#define ISDN_TTY_FAX_PTS 17
304−#define ISDN_TTY_FAX_SENT 18
305−
306−#define ISDN_FAX_PHASE_IDLE 0
307−#define ISDN_FAX_PHASE_A 1
308−#define ISDN_FAX_PHASE_B 2
309−#define ISDN_FAX_PHASE_C 3
310−#define ISDN_FAX_PHASE_D 4
311−#define ISDN_FAX_PHASE_E 5
312−
313−#endif /* TTY_FAX */
314−
315−#define ISDN_FAX_CLASS1_FAE 0
316−#define ISDN_FAX_CLASS1_FTS 1
317−#define ISDN_FAX_CLASS1_FRS 2
318−#define ISDN_FAX_CLASS1_FTM 3
319−#define ISDN_FAX_CLASS1_FRM 4
320−#define ISDN_FAX_CLASS1_FTH 5
321−#define ISDN_FAX_CLASS1_FRH 6
322−#define ISDN_FAX_CLASS1_CTRL 7
323−
324−#define ISDN_FAX_CLASS1_OK 0
325−#define ISDN_FAX_CLASS1_CONNECT 1
326−#define ISDN_FAX_CLASS1_NOCARR 2
327−#define ISDN_FAX_CLASS1_ERROR 3
328−#define ISDN_FAX_CLASS1_FCERROR 4
329−#define ISDN_FAX_CLASS1_QUERY 5
330−
331−typedef struct {
332− __u8 cmd;
333− __u8 subcmd;
334− __u8 para[50];
335−} aux_s;
336−
337−#define AT_COMMAND 0
338−#define AT_EQ_VALUE 1
339−#define AT_QUERY 2
340−#define AT_EQ_QUERY 3
341−
342−/* CAPI structs */
343−
344−/* this is compatible to the old union size */
345−#define MAX_CAPI_PARA_LEN 50
346−
347−typedef struct {
348− /* Header */
349− __u16 Length;
350− __u16 ApplId;
351− __u8 Command;
352− __u8 Subcommand;
353− __u16 Messagenumber;
354−
355− /* Parameter */
356− union {
357− __u32 Controller;
358− __u32 PLCI;
359− __u32 NCCI;
360− } adr;
361− __u8 para[MAX_CAPI_PARA_LEN];
362−} capi_msg;
363−
364−/*
365− * Structure for exchanging above infos
366− *
367− */
368−typedef struct {
369− int driver; /* Lowlevel-Driver-ID */
370− int command; /* Command or Status (see above) */
371− ulong arg; /* Additional Data */
372− union {
373− ulong errcode; /* Type of error with STAT_L1ERR */
374− int length; /* Amount of bytes sent with STAT_BSENT */
375− u_char num[50]; /* Additional Data */
376− setup_parm setup;/* For SETUP msg */
377− capi_msg cmsg; /* For CAPI like messages */
378− char display[85];/* display message data */
379− isdn_cmd_stat isdn_io; /* ISDN IO-parameter/result */
380− aux_s aux; /* for modem commands/indications */
381−#ifdef CONFIG_ISDN_TTY_FAX
382− T30_s *fax; /* Pointer to ttys fax struct */
383−#endif
384− ulong userdata; /* User Data */
385− } parm;
386−} isdn_ctrl;
387−
388−#define dss1_io isdn_io
389−#define ni1_io isdn_io
390−
391−/*
392− * The interface-struct itself (initialized at load-time of lowlevel-driver)
393− *
394− * See Documentation/isdn/INTERFACE for a description, how the communication
395− * between the ISDN subsystem and its drivers is done.
396− *
397− */
398−typedef struct {
399− struct module *owner;
400−
401− /* Number of channels supported by this driver
402− */
403− int channels;
404−
405− /*
406− * Maximum Size of transmit/receive-buffer this driver supports.
407− */
408− int maxbufsize;
409−
410− /* Feature-Flags for this driver.
411− * See defines ISDN_FEATURE_... for Values
412− */
413− unsigned long features;
414−
415− /*
416− * Needed for calculating
417− * dev->hard_header_len = linklayer header + hl_hdrlen;
418− * Drivers, not supporting sk_buff's should set this to 0.
419− */
420− unsigned short hl_hdrlen;
421−
422− /*
423− * Receive-Callback using sk_buff's
424− * Parameters:
425− * int Driver-ID
426− * int local channel-number (0 ...)
427− * struct sk_buff *skb received Data
428− */
429− void (*rcvcallb_skb)(int, int, struct sk_buff *);
430−
431− /* Status-Callback
432− * Parameters:
433− * isdn_ctrl*
434− * driver = Driver ID.
435− * command = One of above ISDN_STAT_... constants.
436− * arg = depending on status-type.
437− * num = depending on status-type.
438− */
439− int (*statcallb)(isdn_ctrl*);
440−
441− /* Send command
442− * Parameters:
443− * isdn_ctrl*
444− * driver = Driver ID.
445− * command = One of above ISDN_CMD_... constants.
446− * arg = depending on command.
447− * num = depending on command.
448− */
449− int (*command)(isdn_ctrl*);
450−
451− /*
452− * Send data using sk_buff's
453− * Parameters:
454− * int driverId
455− * int local channel-number (0...)
456− * int Flag: Need ACK for this packet.
457− * struct sk_buff *skb Data to send
458− */
459− int (*writebuf_skb) (int, int, int, struct sk_buff *);
460−
461− /* Send raw D-Channel-Commands
462− * Parameters:
463− * u_char pointer data
464− * int length of data
465− * int driverId
466− * int local channel-number (0 ...)
467− */
468− int (*writecmd)(const u_char __user *, int, int, int);
469−
470− /* Read raw Status replies
471− * u_char pointer data (volatile)
472− * int length of buffer
473− * int driverId
474− * int local channel-number (0 ...)
475− */
476− int (*readstat)(u_char __user *, int, int, int);
477−
478− char id[20];
479−} isdn_if;
480−
481−/*
482− * Function which must be called by lowlevel-driver at loadtime with
483− * the following fields of above struct set:
484− *
485− * channels Number of channels that will be supported.
486− * hl_hdrlen Space to preserve in sk_buff's when sending. Drivers, not
487− * supporting sk_buff's should set this to 0.
488− * command Address of Command-Handler.
489− * features Bitwise coded Features of this driver. (use ISDN_FEATURE_...)
490− * writebuf_skb Address of Skbuff-Send-Handler.
491− * writecmd " " D-Channel " which accepts raw D-Ch-Commands.
492− * readstat " " D-Channel " which delivers raw Status-Data.
493− *
494− * The linklevel-driver fills the following fields:
495− *
496− * channels Driver-ID assigned to this driver. (Must be used on all
497− * subsequent callbacks.
498− * rcvcallb_skb Address of handler for received Skbuff's.
499− * statcallb " " " for status-changes.
500− *
501− */
502−extern int register_isdn(isdn_if*);
503−#include <linux/uaccess.h>
504−
505−#endif /* __ISDNIF_H__ */
include/linux/iversion.h+24−0
@@ -112,6 +112,30 @@ inode_peek_iversion_raw(const struct inode *inode) · 111 unmodified lines
112112 return atomic64_read(&inode->i_version);
113113 }
114114
115+/**
116+ * inode_set_max_iversion_raw - update i_version new value is larger
117+ * @inode: inode to set
118+ * @val: new i_version to set
119+ *
120+ * Some self-managed filesystems (e.g Ceph) will only update the i_version
121+ * value if the new value is larger than the one we already have.
122+ */
123+static inline void
124+inode_set_max_iversion_raw(struct inode *inode, u64 val)
125+{
126+ u64 cur, old;
127+
128+ cur = inode_peek_iversion_raw(inode);
129+ for (;;) {
130+ if (cur > val)
131+ break;
132+ old = atomic64_cmpxchg(&inode->i_version, cur, val);
133+ if (likely(old == cur))
134+ break;
135+ cur = old;
136+ }
137+}
138+
115139 /**
116140 * inode_set_iversion - set i_version to a particular value
117141 * @inode: inode to set
include/linux/jbd2.h+22−1
@@ -451,6 +451,22 @@ struct jbd2_inode { · 450 unmodified lines
451451 * @i_flags: Flags of inode [j_list_lock]
452452 */
453453 unsigned long i_flags;
454+
455+ /**
456+ * @i_dirty_start:
457+ *
458+ * Offset in bytes where the dirty range for this inode starts.
459+ * [j_list_lock]
460+ */
461+ loff_t i_dirty_start;
462+
463+ /**
464+ * @i_dirty_end:
465+ *
466+ * Inclusive offset in bytes where the dirty range for this inode
467+ * ends. [j_list_lock]
468+ */
469+ loff_t i_dirty_end;
454470 };
455471
456472 struct jbd2_revoke_table_s;
@@ -1357,7 +1373,6 @@ void jbd2_journal_set_triggers(struct buffer_head *, · 900 unmodified lines
13571373 struct jbd2_buffer_trigger_type *type);
13581374 extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
13591375 extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
1360−extern void journal_sync_buffer (struct buffer_head *);
13611376 extern int jbd2_journal_invalidatepage(journal_t *,
13621377 struct page *, unsigned int, unsigned int);
13631378 extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
@@ -1397,6 +1412,12 @@ extern int jbd2_journal_force_commit(journal_t *); · 33 unmodified lines
13971412 extern int jbd2_journal_force_commit_nested(journal_t *);
13981413 extern int jbd2_journal_inode_add_write(handle_t *handle, struct jbd2_inode *inode);
13991414 extern int jbd2_journal_inode_add_wait(handle_t *handle, struct jbd2_inode *inode);
1415+extern int jbd2_journal_inode_ranged_write(handle_t *handle,
1416+ struct jbd2_inode *inode, loff_t start_byte,
1417+ loff_t length);
1418+extern int jbd2_journal_inode_ranged_wait(handle_t *handle,
1419+ struct jbd2_inode *inode, loff_t start_byte,
1420+ loff_t length);
14001421 extern int jbd2_journal_begin_ordered_truncate(journal_t *journal,
14011422 struct jbd2_inode *inode, loff_t new_size);
14021423 extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
include/linux/jhash.h+1−1
@@ -17,7 +17,7 @@ · 16 unmodified lines
1717 * if SELF_TEST is defined. You can use this free for any purpose. It's in
1818 * the public domain. It has no warranty.
1919 *
20− * Copyright (C) 2009-2010 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu)
20+ * Copyright (C) 2009-2010 Jozsef Kadlecsik (kadlec@netfilter.org)
2121 *
2222 * I've modified Bob's hash to be useful in the Linux kernel, and
2323 * any bugs present are my fault.
include/linux/jump_label.h+3−0
@@ -215,6 +215,9 @@ extern void arch_jump_label_transform(struct jump_entry *entry, · 214 unmodified lines
215215 enum jump_label_type type);
216216 extern void arch_jump_label_transform_static(struct jump_entry *entry,
217217 enum jump_label_type type);
218+extern bool arch_jump_label_transform_queue(struct jump_entry *entry,
219+ enum jump_label_type type);
220+extern void arch_jump_label_transform_apply(void);
218221 extern int jump_label_text_reserved(void *start, void *end);
219222 extern void static_key_slow_inc(struct static_key *key);
220223 extern void static_key_slow_dec(struct static_key *key);
include/linux/jump_label_ratelimit.h+3−2
@@ -60,8 +60,6 @@ extern void jump_label_update_timeout(struct work_struct *work); · 59 unmodified lines
6060 0), \
6161 }
6262
63−#define static_branch_deferred_inc(x) static_branch_inc(&(x)->key)
64−
6563 #else /* !CONFIG_JUMP_LABEL */
6664 struct static_key_deferred {
6765 struct static_key key;
@@ -95,4 +93,7 @@ jump_label_rate_limit(struct static_key_deferred *key, · 27 unmodified lines
9593 STATIC_KEY_CHECK_USE(key);
9694 }
9795 #endif /* CONFIG_JUMP_LABEL */
96+
97+#define static_branch_deferred_inc(x) static_branch_inc(&(x)->key)
98+
9899 #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */
include/linux/kasan-checks.h+36−7
@@ -2,14 +2,43 @@ · 1 unmodified line
22 #ifndef _LINUX_KASAN_CHECKS_H
33 #define _LINUX_KASAN_CHECKS_H
44
5−#if defined(__SANITIZE_ADDRESS__) || defined(__KASAN_INTERNAL)
6−void kasan_check_read(const volatile void *p, unsigned int size);
7−void kasan_check_write(const volatile void *p, unsigned int size);
5+#include <linux/types.h>
6+
7+/*
8+ * __kasan_check_*: Always available when KASAN is enabled. This may be used
9+ * even in compilation units that selectively disable KASAN, but must use KASAN
10+ * to validate access to an address. Never use these in header files!
11+ */
12+#ifdef CONFIG_KASAN
13+bool __kasan_check_read(const volatile void *p, unsigned int size);
14+bool __kasan_check_write(const volatile void *p, unsigned int size);
15+#else
16+static inline bool __kasan_check_read(const volatile void *p, unsigned int size)
17+{
18+ return true;
19+}
20+static inline bool __kasan_check_write(const volatile void *p, unsigned int size)
21+{
22+ return true;
23+}
24+#endif
25+
26+/*
27+ * kasan_check_*: Only available when the particular compilation unit has KASAN
28+ * instrumentation enabled. May be used in header files.
29+ */
30+#ifdef __SANITIZE_ADDRESS__
31+#define kasan_check_read __kasan_check_read
32+#define kasan_check_write __kasan_check_write
833 #else
9−static inline void kasan_check_read(const volatile void *p, unsigned int size)
10−{ }
11−static inline void kasan_check_write(const volatile void *p, unsigned int size)
12−{ }
34+static inline bool kasan_check_read(const volatile void *p, unsigned int size)
35+{
36+ return true;
37+}
38+static inline bool kasan_check_write(const volatile void *p, unsigned int size)
39+{
40+ return true;
41+}
1342 #endif
1443
1544 #endif
include/linux/kasan.h+5−2
@@ -76,8 +76,11 @@ void kasan_free_shadow(const struct vm_struct *vm); · 75 unmodified lines
7676 int kasan_add_zero_shadow(void *start, unsigned long size);
7777 void kasan_remove_zero_shadow(void *start, unsigned long size);
7878
79−size_t ksize(const void *);
80−static inline void kasan_unpoison_slab(const void *ptr) { ksize(ptr); }
79+size_t __ksize(const void *);
80+static inline void kasan_unpoison_slab(const void *ptr)
81+{
82+ kasan_unpoison_shadow(ptr, __ksize(ptr));
83+}
8184 size_t kasan_metadata_size(struct kmem_cache *cache);
8285
8386 bool kasan_save_enable_multi_shot(void);
include/linux/kernel.h+2−0
@@ -88,6 +88,8 @@ · 87 unmodified lines
8888 */
8989 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
9090
91+#define typeof_member(T, m) typeof(((T*)0)->m)
92+
9193 #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
9294
9395 #define DIV_ROUND_DOWN_ULL(ll, d) \
include/linux/key-type.h+3−0
@@ -70,6 +70,9 @@ struct key_type { · 69 unmodified lines
7070 */
7171 size_t def_datalen;
7272
73+ unsigned int flags;
74+#define KEY_TYPE_NET_DOMAIN 0x00000001 /* Keys of this type have a net namespace domain */
75+
7376 /* vet a description */
7477 int (*vet_description)(const char *description);
7578
include/linux/key.h+84−18
@@ -31,6 +31,7 @@ typedef int32_t key_serial_t; · 30 unmodified lines
3131 typedef uint32_t key_perm_t;
3232
3333 struct key;
34+struct net;
3435
3536 #ifdef CONFIG_KEYS
3637
@@ -77,13 +78,34 @@ struct cred; · 40 unmodified lines
7778
7879 struct key_type;
7980 struct key_owner;
81+struct key_tag;
8082 struct keyring_list;
8183 struct keyring_name;
8284
85+struct key_tag {
86+ struct rcu_head rcu;
87+ refcount_t usage;
88+ bool removed; /* T when subject removed */
89+};
90+
8391 struct keyring_index_key {
92+ /* [!] If this structure is altered, the union in struct key must change too! */
93+ unsigned long hash; /* Hash value */
94+ union {
95+ struct {
96+#ifdef __LITTLE_ENDIAN /* Put desc_len at the LSB of x */
97+ u8 desc_len;
98+ char desc[sizeof(long) - 1]; /* First few chars of description */
99+#else
100+ char desc[sizeof(long) - 1]; /* First few chars of description */
101+ u8 desc_len;
102+#endif
103+ };
104+ unsigned long x;
105+ };
84106 struct key_type *type;
107+ struct key_tag *domain_tag; /* Domain of operation */
85108 const char *description;
86− size_t desc_len;
87109 };
88110
89111 union key_payload {
@@ -197,7 +219,10 @@ struct key { · 107 unmodified lines
197219 union {
198220 struct keyring_index_key index_key;
199221 struct {
222+ unsigned long hash;
223+ unsigned long len_desc;
200224 struct key_type *type; /* type of key */
225+ struct key_tag *domain_tag; /* Domain of operation */
201226 char *description;
202227 };
203228 };
@@ -248,6 +273,8 @@ extern struct key *key_alloc(struct key_type *type, · 44 unmodified lines
248273 extern void key_revoke(struct key *key);
249274 extern void key_invalidate(struct key *key);
250275 extern void key_put(struct key *key);
276+extern bool key_put_tag(struct key_tag *tag);
277+extern void key_remove_domain(struct key_tag *domain_tag);
251278
252279 static inline struct key *__key_get(struct key *key)
253280 {
@@ -265,26 +292,56 @@ static inline void key_ref_put(key_ref_t key_ref) · 11 unmodified lines
265292 key_put(key_ref_to_ptr(key_ref));
266293 }
267294
268−extern struct key *request_key(struct key_type *type,
269− const char *description,
270− const char *callout_info);
295+extern struct key *request_key_tag(struct key_type *type,
296+ const char *description,
297+ struct key_tag *domain_tag,
298+ const char *callout_info);
299+
300+extern struct key *request_key_rcu(struct key_type *type,
301+ const char *description,
302+ struct key_tag *domain_tag);
271303
272304 extern struct key *request_key_with_auxdata(struct key_type *type,
273305 const char *description,
306+ struct key_tag *domain_tag,
274307 const void *callout_info,
275308 size_t callout_len,
276309 void *aux);
277310
278−extern struct key *request_key_async(struct key_type *type,
279− const char *description,
280− const void *callout_info,
281− size_t callout_len);
311+/**
312+ * request_key - Request a key and wait for construction
313+ * @type: Type of key.
314+ * @description: The searchable description of the key.
315+ * @callout_info: The data to pass to the instantiation upcall (or NULL).
316+ *
317+ * As for request_key_tag(), but with the default global domain tag.
318+ */
319+static inline struct key *request_key(struct key_type *type,
320+ const char *description,
321+ const char *callout_info)
322+{
323+ return request_key_tag(type, description, NULL, callout_info);
324+}
282325
283−extern struct key *request_key_async_with_auxdata(struct key_type *type,
284− const char *description,
285− const void *callout_info,
286− size_t callout_len,
287− void *aux);
326+#ifdef CONFIG_NET
327+/*
328+ * request_key_net - Request a key for a net namespace and wait for construction
329+ * @type: Type of key.
330+ * @description: The searchable description of the key.
331+ * @net: The network namespace that is the key's domain of operation.
332+ * @callout_info: The data to pass to the instantiation upcall (or NULL).
333+ *
334+ * As for request_key() except that it does not add the returned key to a
335+ * keyring if found, new keys are always allocated in the user's quota, the
336+ * callout_info must be a NUL-terminated string and no auxiliary data can be
337+ * passed. Only keys that operate the specified network namespace are used.
338+ *
339+ * Furthermore, it then works as wait_for_key_construction() to wait for the
340+ * completion of keys undergoing construction with a non-interruptible wait.
341+ */
342+#define request_key_net(type, description, net, callout_info) \
343+ request_key_tag(type, description, net->key_domain, callout_info);
344+#endif /* CONFIG_NET */
288345
289346 extern int wait_for_key_construction(struct key *key, bool intr);
290347
@@ -305,6 +362,11 @@ extern int key_update(key_ref_t key, · 14 unmodified lines
305362 extern int key_link(struct key *keyring,
306363 struct key *key);
307364
365+extern int key_move(struct key *key,
366+ struct key *from_keyring,
367+ struct key *to_keyring,
368+ unsigned int flags);
369+
308370 extern int key_unlink(struct key *keyring,
309371 struct key *key);
310372
@@ -324,7 +386,8 @@ extern int keyring_clear(struct key *keyring); · 13 unmodified lines
324386
325387 extern key_ref_t keyring_search(key_ref_t keyring,
326388 struct key_type *type,
327− const char *description);
389+ const char *description,
390+ bool recurse);
328391
329392 extern int keyring_add_key(struct key *keyring,
330393 struct key *key);
@@ -343,6 +406,7 @@ extern void key_set_timeout(struct key *, unsigned); · 12 unmodified lines
343406
344407 extern key_ref_t lookup_user_key(key_serial_t id, unsigned long flags,
345408 key_perm_t perm);
409+extern void key_free_user_ns(struct user_namespace *);
346410
347411 /*
348412 * The permissions required on a key that we're looking up.
@@ -397,8 +461,8 @@ extern struct ctl_table key_sysctls[]; · 48 unmodified lines
397461 * the userspace interface
398462 */
399463 extern int install_thread_keyring_to_cred(struct cred *cred);
400−extern void key_fsuid_changed(struct task_struct *tsk);
401−extern void key_fsgid_changed(struct task_struct *tsk);
464+extern void key_fsuid_changed(struct cred *new_cred);
465+extern void key_fsgid_changed(struct cred *new_cred);
402466 extern void key_init(void);
403467
404468 #else /* CONFIG_KEYS */
@@ -413,9 +477,11 @@ extern void key_init(void); · 8 unmodified lines
413477 #define make_key_ref(k, p) NULL
414478 #define key_ref_to_ptr(k) NULL
415479 #define is_key_possessed(k) 0
416−#define key_fsuid_changed(t) do { } while(0)
417−#define key_fsgid_changed(t) do { } while(0)
480+#define key_fsuid_changed(c) do { } while(0)
481+#define key_fsgid_changed(c) do { } while(0)
418482 #define key_init() do { } while(0)
483+#define key_free_user_ns(ns) do { } while(0)
484+#define key_remove_domain(d) do { } while(0)
419485
420486 #endif /* CONFIG_KEYS */
421487 #endif /* __KERNEL__ */
include/linux/kprobes.h+19−0
@@ -458,4 +458,23 @@ static inline bool is_kprobe_optinsn_slot(unsigned long addr) · 457 unmodified lines
458458 }
459459 #endif
460460
461+/* Returns true if kprobes handled the fault */
462+static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs,
463+ unsigned int trap)
464+{
465+ if (!kprobes_built_in())
466+ return false;
467+ if (user_mode(regs))
468+ return false;
469+ /*
470+ * To be potentially processing a kprobe fault and to be allowed
471+ * to call kprobe_running(), we have to be non-preemptible.
472+ */
473+ if (preemptible())
474+ return false;
475+ if (!kprobe_running())
476+ return false;
477+ return kprobe_fault_handler(regs, trap);
478+}
479+
461480 #endif /* _LINUX_KPROBES_H */
include/linux/kvm_host.h+8−4
@@ -159,7 +159,7 @@ static inline bool is_error_page(struct page *page) · 158 unmodified lines
159159
160160 extern struct kmem_cache *kvm_vcpu_cache;
161161
162−extern spinlock_t kvm_lock;
162+extern struct mutex kvm_lock;
163163 extern struct list_head vm_list;
164164
165165 struct kvm_io_range {
@@ -318,6 +318,7 @@ struct kvm_vcpu { · 152 unmodified lines
318318 } spin_loop;
319319 #endif
320320 bool preempted;
321+ bool ready;
321322 struct kvm_vcpu_arch arch;
322323 struct dentry *debugfs_dentry;
323324 };
@@ -860,17 +861,19 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu); · 536 unmodified lines
860861 void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu);
861862 void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
862863
863−bool kvm_arch_has_vcpu_debugfs(void);
864−int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu);
864+#ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS
865+void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu);
866+#endif
865867
866868 int kvm_arch_hardware_enable(void);
867869 void kvm_arch_hardware_disable(void);
868870 int kvm_arch_hardware_setup(void);
869871 void kvm_arch_hardware_unsetup(void);
870−void kvm_arch_check_processor_compat(void *rtn);
872+int kvm_arch_check_processor_compat(void);
871873 int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
872874 bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu);
873875 int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
876+bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu);
874877
875878 #ifndef __KVM_HAVE_ARCH_VM_ALLOC
876879 /*
@@ -990,6 +993,7 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm, · 113 unmodified lines
990993 struct kvm_irq_ack_notifier *kian);
991994 int kvm_request_irq_source_id(struct kvm *kvm);
992995 void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
996+bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args);
993997
994998 /*
995999 * search_memslots() and __gfn_to_memslot() are here because they are
include/linux/leds-ti-lmu-common.h+47−0
@@ -0,0 +1,47 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+// TI LMU Common Core
3+// Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
4+
5+#ifndef _TI_LMU_COMMON_H_
6+#define _TI_LMU_COMMON_H_
7+
8+#include <linux/delay.h>
9+#include <linux/device.h>
10+#include <linux/init.h>
11+#include <linux/leds.h>
12+#include <linux/module.h>
13+#include <linux/regmap.h>
14+#include <linux/slab.h>
15+#include <uapi/linux/uleds.h>
16+
17+#define LMU_11BIT_LSB_MASK (BIT(0) | BIT(1) | BIT(2))
18+#define LMU_11BIT_MSB_SHIFT 3
19+
20+#define MAX_BRIGHTNESS_8BIT 255
21+#define MAX_BRIGHTNESS_11BIT 2047
22+
23+struct ti_lmu_bank {
24+ struct regmap *regmap;
25+
26+ int max_brightness;
27+
28+ u8 lsb_brightness_reg;
29+ u8 msb_brightness_reg;
30+
31+ u8 runtime_ramp_reg;
32+ u32 ramp_up_usec;
33+ u32 ramp_down_usec;
34+};
35+
36+int ti_lmu_common_set_brightness(struct ti_lmu_bank *lmu_bank, int brightness);
37+
38+int ti_lmu_common_set_ramp(struct ti_lmu_bank *lmu_bank);
39+
40+int ti_lmu_common_get_ramp_params(struct device *dev,
41+ struct fwnode_handle *child,
42+ struct ti_lmu_bank *lmu_data);
43+
44+int ti_lmu_common_get_brt_res(struct device *dev, struct fwnode_handle *child,
45+ struct ti_lmu_bank *lmu_data);
46+
47+#endif /* _TI_LMU_COMMON_H_ */
include/linux/libnvdimm.h+9−1
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/types.h>
1212 #include <linux/uuid.h>
1313 #include <linux/spinlock.h>
14+#include <linux/bio.h>
1415
1516 struct badrange_entry {
1617 u64 start;
@@ -57,6 +58,9 @@ enum { · 40 unmodified lines
5758 */
5859 ND_REGION_PERSIST_MEMCTRL = 2,
5960
61+ /* Platform provides asynchronous flush mechanism */
62+ ND_REGION_ASYNC = 3,
63+
6064 /* mark newly adjusted resources as requiring a label update */
6165 DPA_RESOURCE_ADJUSTED = 1 << 0,
6266 };
@@ -113,6 +117,7 @@ struct nd_mapping_desc { · 50 unmodified lines
113117 int position;
114118 };
115119
120+struct nd_region;
116121 struct nd_region_desc {
117122 struct resource *res;
118123 struct nd_mapping_desc *mapping;
@@ -125,6 +130,7 @@ struct nd_region_desc { · 6 unmodified lines
125130 int target_node;
126131 unsigned long flags;
127132 struct device_node *of_node;
133+ int (*flush)(struct nd_region *nd_region, struct bio *bio);
128134 };
129135
130136 struct device;
@@ -252,10 +258,12 @@ unsigned long nd_blk_memremap_flags(struct nd_blk_region *ndbr); · 121 unmodified lines
252258 unsigned int nd_region_acquire_lane(struct nd_region *nd_region);
253259 void nd_region_release_lane(struct nd_region *nd_region, unsigned int lane);
254260 u64 nd_fletcher64(void *addr, size_t len, bool le);
255−void nvdimm_flush(struct nd_region *nd_region);
261+int nvdimm_flush(struct nd_region *nd_region, struct bio *bio);
262+int generic_nvdimm_flush(struct nd_region *nd_region);
256263 int nvdimm_has_flush(struct nd_region *nd_region);
257264 int nvdimm_has_cache(struct nd_region *nd_region);
258265 int nvdimm_in_overwrite(struct nvdimm *nvdimm);
266+bool is_nvdimm_sync(struct nd_region *nd_region);
259267
260268 static inline int nvdimm_ctl(struct nvdimm *nvdimm, unsigned int cmd, void *buf,
261269 unsigned int buf_len, int *cmd_rc)
include/linux/list.h+14−0
@@ -106,6 +106,20 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) · 105 unmodified lines
106106 WRITE_ONCE(prev->next, next);
107107 }
108108
109+/*
110+ * Delete a list entry and clear the 'prev' pointer.
111+ *
112+ * This is a special-purpose list clearing method used in the networking code
113+ * for lists allocated as per-cpu, where we don't want to incur the extra
114+ * WRITE_ONCE() overhead of a regular list_del_init(). The code that uses this
115+ * needs to check the node 'prev' pointer instead of calling list_empty().
116+ */
117+static inline void __list_del_clearprev(struct list_head *entry)
118+{
119+ __list_del(entry->prev, entry->next);
120+ entry->prev = NULL;
121+}
122+
109123 /**
110124 * list_del - deletes entry from list.
111125 * @entry: the element to delete from the list.
include/linux/livepatch.h+0−3
@@ -35,7 +35,6 @@ · 34 unmodified lines
3535 * @stack_node: list node for klp_ops func_stack list
3636 * @old_size: size of the old function
3737 * @new_size: size of the new function
38− * @kobj_added: @kobj has been added and needs freeing
3938 * @nop: temporary patch to use the original code again; dyn. allocated
4039 * @patched: the func has been added to the klp_ops list
4140 * @transition: the func is currently being applied or reverted
@@ -113,7 +112,6 @@ struct klp_callbacks { · 71 unmodified lines
113112 * @node: list node for klp_patch obj_list
114113 * @mod: kernel module associated with the patched object
115114 * (NULL for vmlinux)
116− * @kobj_added: @kobj has been added and needs freeing
117115 * @dynamic: temporary object for nop functions; dynamically allocated
118116 * @patched: the object's funcs have been added to the klp_ops list
119117 */
@@ -140,7 +138,6 @@ struct klp_object { · 20 unmodified lines
140138 * @list: list node for global list of actively used patches
141139 * @kobj: kobject for sysfs resources
142140 * @obj_list: dynamic list of the object entries
143− * @kobj_added: @kobj has been added and needs freeing
144141 * @enabled: the patch is enabled (but operation may be incomplete)
145142 * @forced: was involved in a forced transition
146143 * @free_work: patch cleanup from workqueue-context
include/linux/lockd/lockd.h+2−0
@@ -282,6 +282,7 @@ void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, · 281 unmodified lines
282282 nlm_host_match_fn_t match);
283283 void nlmsvc_grant_reply(struct nlm_cookie *, __be32);
284284 void nlmsvc_release_call(struct nlm_rqst *);
285+void nlmsvc_locks_init_private(struct file_lock *, struct nlm_host *, pid_t);
285286
286287 /*
287288 * File handling for the server personality
@@ -289,6 +290,7 @@ void nlmsvc_release_call(struct nlm_rqst *); · 1 unmodified line
289290 __be32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **,
290291 struct nfs_fh *);
291292 void nlm_release_file(struct nlm_file *);
293+void nlmsvc_release_lockowner(struct nlm_lock *);
292294 void nlmsvc_mark_resources(struct net *);
293295 void nlmsvc_free_host_resources(struct nlm_host *);
294296 void nlmsvc_invalidate_all(void);
include/linux/lockdep.h+32−13
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
66 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra
77 *
8− * see Documentation/locking/lockdep-design.txt for more details.
8+ * see Documentation/locking/lockdep-design.rst for more details.
99 */
1010 #ifndef __LINUX_LOCKDEP_H
1111 #define __LINUX_LOCKDEP_H
@@ -203,11 +203,17 @@ struct lock_list { · 191 unmodified lines
203203 struct lock_list *parent;
204204 };
205205
206−/*
207− * We record lock dependency chains, so that we can cache them:
206+/**
207+ * struct lock_chain - lock dependency chain record
208+ *
209+ * @irq_context: the same as irq_context in held_lock below
210+ * @depth: the number of held locks in this chain
211+ * @base: the index in chain_hlocks for this chain
212+ * @entry: the collided lock chains in lock_chain hash list
213+ * @chain_key: the hash key of this lock_chain
208214 */
209215 struct lock_chain {
210− /* see BUILD_BUG_ON()s in lookup_chain_cache() */
216+ /* see BUILD_BUG_ON()s in add_chain_cache() */
211217 unsigned int irq_context : 2,
212218 depth : 6,
213219 base : 24;
@@ -217,12 +223,8 @@ struct lock_chain { · 3 unmodified lines
217223 };
218224
219225 #define MAX_LOCKDEP_KEYS_BITS 13
220−/*
221− * Subtract one because we offset hlock->class_idx by 1 in order
222− * to make 0 mean no class. This avoids overflowing the class_idx
223− * bitfield and hitting the BUG in hlock_class().
224− */
225−#define MAX_LOCKDEP_KEYS ((1UL << MAX_LOCKDEP_KEYS_BITS) - 1)
226+#define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS)
227+#define INITIAL_CHAIN_KEY -1
226228
227229 struct held_lock {
228230 /*
@@ -247,6 +249,11 @@ struct held_lock { · 18 unmodified lines
247249 u64 waittime_stamp;
248250 u64 holdtime_stamp;
249251 #endif
252+ /*
253+ * class_idx is zero-indexed; it points to the element in
254+ * lock_classes this held lock instance belongs to. class_idx is in
255+ * the range from 0 to (MAX_LOCKDEP_KEYS-1) inclusive.
256+ */
250257 unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS;
251258 /*
252259 * The lock-stack is unified in that the lock chains of interrupt
@@ -281,6 +288,8 @@ extern void lockdep_free_key_range(void *start, unsigned long size); · 28 unmodified lines
281288 extern asmlinkage void lockdep_sys_exit(void);
282289 extern void lockdep_set_selftest_task(struct task_struct *task);
283290
291+extern void lockdep_init_task(struct task_struct *task);
292+
284293 extern void lockdep_off(void);
285294 extern void lockdep_on(void);
286295
@@ -385,7 +394,7 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); · 98 unmodified lines
385394 WARN_ON(debug_locks && !lockdep_is_held(l)); \
386395 } while (0)
387396
388−#define lockdep_assert_held_exclusive(l) do { \
397+#define lockdep_assert_held_write(l) do { \
389398 WARN_ON(debug_locks && !lockdep_is_held_type(l, 0)); \
390399 } while (0)
391400
@@ -405,6 +414,10 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); · 13 unmodified lines
405414
406415 #else /* !CONFIG_LOCKDEP */
407416
417+static inline void lockdep_init_task(struct task_struct *task)
418+{
419+}
420+
408421 static inline void lockdep_off(void)
409422 {
410423 }
@@ -466,7 +479,7 @@ struct lockdep_map { }; · 55 unmodified lines
466479 #define lockdep_is_held_type(l, r) (1)
467480
468481 #define lockdep_assert_held(l) do { (void)(l); } while (0)
469−#define lockdep_assert_held_exclusive(l) do { (void)(l); } while (0)
482+#define lockdep_assert_held_write(l) do { (void)(l); } while (0)
470483 #define lockdep_assert_held_read(l) do { (void)(l); } while (0)
471484 #define lockdep_assert_held_once(l) do { (void)(l); } while (0)
472485
@@ -497,7 +510,6 @@ enum xhlock_context_t { · 24 unmodified lines
497510 { .name = (_name), .key = (void *)(_key), }
498511
499512 static inline void lockdep_invariant_state(bool force) {}
500−static inline void lockdep_init_task(struct task_struct *task) {}
501513 static inline void lockdep_free_task(struct task_struct *task) {}
502514
503515 #ifdef CONFIG_LOCK_STAT
@@ -632,11 +644,18 @@ do { \ · 128 unmodified lines
632644 "IRQs not disabled as expected\n"); \
633645 } while (0)
634646
647+#define lockdep_assert_in_irq() do { \
648+ WARN_ONCE(debug_locks && !current->lockdep_recursion && \
649+ !current->hardirq_context, \
650+ "Not in hardirq as expected\n"); \
651+ } while (0)
652+
635653 #else
636654 # define might_lock(lock) do { } while (0)
637655 # define might_lock_read(lock) do { } while (0)
638656 # define lockdep_assert_irqs_enabled() do { } while (0)
639657 # define lockdep_assert_irqs_disabled() do { } while (0)
658+# define lockdep_assert_in_irq() do { } while (0)
640659 #endif
641660
642661 #ifdef CONFIG_LOCKDEP
include/linux/log2.h+34−0
@@ -220,4 +220,38 @@ int __order_base_2(unsigned long n) · 219 unmodified lines
220220 ilog2((n) - 1) + 1) : \
221221 __order_base_2(n) \
222222 )
223+
224+static inline __attribute__((const))
225+int __bits_per(unsigned long n)
226+{
227+ if (n < 2)
228+ return 1;
229+ if (is_power_of_2(n))
230+ return order_base_2(n) + 1;
231+ return order_base_2(n);
232+}
233+
234+/**
235+ * bits_per - calculate the number of bits required for the argument
236+ * @n: parameter
237+ *
238+ * This is constant-capable and can be used for compile time
239+ * initializations, e.g bitfields.
240+ *
241+ * The first few values calculated by this routine:
242+ * bf(0) = 1
243+ * bf(1) = 1
244+ * bf(2) = 2
245+ * bf(3) = 2
246+ * bf(4) = 3
247+ * ... and so on.
248+ */
249+#define bits_per(n) \
250+( \
251+ __builtin_constant_p(n) ? ( \
252+ ((n) == 0 || (n) == 1) \
253+ ? 1 : ilog2(n) + 1 \
254+ ) : \
255+ __bits_per(n) \
256+)
223257 #endif /* _LINUX_LOG2_H */
include/linux/lsm_hooks.h+1−1
@@ -77,7 +77,7 @@ · 76 unmodified lines
7777 * state. This is called immediately after commit_creds().
7878 *
7979 * Security hooks for mount using fs_context.
80− * [See also Documentation/filesystems/mounting.txt]
80+ * [See also Documentation/filesystems/mount_api.txt]
8181 *
8282 * @fs_context_dup:
8383 * Allocate and attach a security structure to sc->security. This pointer
include/linux/lz4.h+9−9
@@ -278,7 +278,7 @@ int LZ4_decompress_fast(const char *source, char *dest, int originalSize); · 277 unmodified lines
278278 * @compressedSize: is the precise full size of the compressed block
279279 * @maxDecompressedSize: is the size of 'dest' buffer
280280 *
281− * Decompresses data fom 'source' into 'dest'.
281+ * Decompresses data from 'source' into 'dest'.
282282 * If the source stream is detected malformed, the function will
283283 * stop decoding and return a negative result.
284284 * This function is protected against buffer overflow exploits,
@@ -522,7 +522,7 @@ int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, · 237 unmodified lines
522522 const char *dictionary, int dictSize);
523523
524524 /**
525− * LZ4_decompress_fast_continue() - Decompress blocks in streaming mode
525+ * LZ4_decompress_safe_continue() - Decompress blocks in streaming mode
526526 * @LZ4_streamDecode: the 'LZ4_streamDecode_t' structure
527527 * @source: source address of the compressed data
528528 * @dest: output buffer address of the uncompressed data
@@ -530,7 +530,7 @@ int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, · 1 unmodified line
530530 * @compressedSize: is the precise full size of the compressed block
531531 * @maxDecompressedSize: is the size of 'dest' buffer
532532 *
533− * These decoding function allows decompression of multiple blocks
533+ * This decoding function allows decompression of multiple blocks
534534 * in "streaming" mode.
535535 * Previously decoded blocks *must* remain available at the memory position
536536 * where they were decoded (up to 64 KB)
@@ -569,7 +569,7 @@ int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, · 32 unmodified lines
569569 * which must be already allocated with 'originalSize' bytes
570570 * @originalSize: is the original and therefore uncompressed size
571571 *
572− * These decoding function allows decompression of multiple blocks
572+ * This decoding function allows decompression of multiple blocks
573573 * in "streaming" mode.
574574 * Previously decoded blocks *must* remain available at the memory position
575575 * where they were decoded (up to 64 KB)
@@ -610,10 +610,10 @@ int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode, · 34 unmodified lines
610610 * @dictStart: pointer to the start of the dictionary in memory
611611 * @dictSize: size of dictionary
612612 *
613− * These decoding function works the same as
613+ * This decoding function works the same as
614614 * a combination of LZ4_setStreamDecode() followed by
615615 * LZ4_decompress_safe_continue()
616− * It is stand-alone, and don'tn eed a LZ4_streamDecode_t structure.
616+ * It is stand-alone, and doesn't need an LZ4_streamDecode_t structure.
617617 *
618618 * Return: number of bytes decompressed into destination buffer
619619 * (necessarily <= maxDecompressedSize)
@@ -633,10 +633,10 @@ int LZ4_decompress_safe_usingDict(const char *source, char *dest, · 13 unmodified lines
633633 * @dictStart: pointer to the start of the dictionary in memory
634634 * @dictSize: size of dictionary
635635 *
636− * These decoding function works the same as
636+ * This decoding function works the same as
637637 * a combination of LZ4_setStreamDecode() followed by
638− * LZ4_decompress_safe_continue()
639− * It is stand-alone, and don'tn eed a LZ4_streamDecode_t structure.
638+ * LZ4_decompress_fast_continue()
639+ * It is stand-alone, and doesn't need an LZ4_streamDecode_t structure.
640640 *
641641 * Return: number of bytes decompressed into destination buffer
642642 * (necessarily <= maxDecompressedSize)
include/linux/memcontrol.h+16−8
@@ -233,8 +233,9 @@ struct mem_cgroup { · 232 unmodified lines
233233 /* OOM-Killer disable */
234234 int oom_kill_disable;
235235
236− /* memory.events */
236+ /* memory.events and memory.events.local */
237237 struct cgroup_file events_file;
238+ struct cgroup_file events_local_file;
238239
239240 /* handle for "memory.swap.events" */
240241 struct cgroup_file swap_events_file;
@@ -281,6 +282,7 @@ struct mem_cgroup { · 40 unmodified lines
281282
282283 /* memory.events */
283284 atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS];
285+ atomic_long_t memory_events_local[MEMCG_NR_MEMORY_EVENTS];
284286
285287 unsigned long socket_pressure;
286288
@@ -392,7 +394,6 @@ out: · 105 unmodified lines
392394
393395 struct lruvec *mem_cgroup_page_lruvec(struct page *, struct pglist_data *);
394396
395−bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg);
396397 struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
397398
398399 struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm);
@@ -747,6 +748,9 @@ static inline void count_memcg_event_mm(struct mm_struct *mm, · 348 unmodified lines
747748 static inline void memcg_memory_event(struct mem_cgroup *memcg,
748749 enum memcg_memory_event event)
749750 {
751+ atomic_long_inc(&memcg->memory_events_local[event]);
752+ cgroup_file_notify(&memcg->events_local_file);
753+
750754 do {
751755 atomic_long_inc(&memcg->memory_events[event]);
752756 cgroup_file_notify(&memcg->events_file);
@@ -870,12 +874,6 @@ static inline bool mm_match_cgroup(struct mm_struct *mm, · 117 unmodified lines
870874 return true;
871875 }
872876
873−static inline bool task_in_mem_cgroup(struct task_struct *task,
874− const struct mem_cgroup *memcg)
875−{
876− return true;
877−}
878−
879877 static inline struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)
880878 {
881879 return NULL;
@@ -1273,6 +1271,8 @@ int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order); · 391 unmodified lines
12731271 void __memcg_kmem_uncharge(struct page *page, int order);
12741272 int __memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order,
12751273 struct mem_cgroup *memcg);
1274+void __memcg_kmem_uncharge_memcg(struct mem_cgroup *memcg,
1275+ unsigned int nr_pages);
12761276
12771277 extern struct static_key_false memcg_kmem_enabled_key;
12781278 extern struct workqueue_struct *memcg_kmem_cache_wq;
@@ -1314,6 +1314,14 @@ static inline int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, · 35 unmodified lines
13141314 return __memcg_kmem_charge_memcg(page, gfp, order, memcg);
13151315 return 0;
13161316 }
1317+
1318+static inline void memcg_kmem_uncharge_memcg(struct page *page, int order,
1319+ struct mem_cgroup *memcg)
1320+{
1321+ if (memcg_kmem_enabled())
1322+ __memcg_kmem_uncharge_memcg(memcg, 1 << order);
1323+}
1324+
13171325 /*
13181326 * helper for accessing a memcg's index. It will be used as an index in the
13191327 * child cache array in kmem_cache, and also to derive its name. This function
include/linux/memory.h+5−6
@@ -111,16 +111,15 @@ extern int register_memory_notifier(struct notifier_block *nb); · 110 unmodified lines
111111 extern void unregister_memory_notifier(struct notifier_block *nb);
112112 extern int register_memory_isolate_notifier(struct notifier_block *nb);
113113 extern void unregister_memory_isolate_notifier(struct notifier_block *nb);
114−int hotplug_memory_register(int nid, struct mem_section *section);
115−#ifdef CONFIG_MEMORY_HOTREMOVE
116−extern void unregister_memory_section(struct mem_section *);
117−#endif
114+int create_memory_block_devices(unsigned long start, unsigned long size);
115+void remove_memory_block_devices(unsigned long start, unsigned long size);
118116 extern int memory_dev_init(void);
119117 extern int memory_notify(unsigned long val, void *v);
120118 extern int memory_isolate_notify(unsigned long val, void *v);
121−extern struct memory_block *find_memory_block_hinted(struct mem_section *,
122− struct memory_block *);
123119 extern struct memory_block *find_memory_block(struct mem_section *);
120+typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *);
121+extern int walk_memory_blocks(unsigned long start, unsigned long size,
122+ void *arg, walk_memory_blocks_func_t func);
124123 #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
125124 #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
126125
include/linux/memory_hotplug.h+10−17
@@ -123,20 +123,10 @@ static inline bool movable_node_is_enabled(void) · 122 unmodified lines
123123 return movable_node_enabled;
124124 }
125125
126−#ifdef CONFIG_MEMORY_HOTREMOVE
127126 extern void arch_remove_memory(int nid, u64 start, u64 size,
128127 struct vmem_altmap *altmap);
129128 extern void __remove_pages(struct zone *zone, unsigned long start_pfn,
130129 unsigned long nr_pages, struct vmem_altmap *altmap);
131−#endif /* CONFIG_MEMORY_HOTREMOVE */
132−
133−/*
134− * Do we want sysfs memblock files created. This will allow userspace to online
135− * and offline memory explicitly. Lack of this bit means that the caller has to
136− * call move_pfn_range_to_zone to finish the initialization.
137− */
138−
139−#define MHP_MEMBLOCK_API (1<<0)
140130
141131 /* reasonably generic interface to expand the physical pages */
142132 extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
@@ -324,7 +314,7 @@ static inline void pgdat_resize_init(struct pglist_data *pgdat) {} · 181 unmodified lines
324314 extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
325315 extern void try_offline_node(int nid);
326316 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
327−extern void remove_memory(int nid, u64 start, u64 size);
317+extern int remove_memory(int nid, u64 start, u64 size);
328318 extern void __remove_memory(int nid, u64 start, u64 size);
329319
330320 #else
@@ -341,22 +331,25 @@ static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages) · 10 unmodified lines
341331 return -EINVAL;
342332 }
343333
344−static inline void remove_memory(int nid, u64 start, u64 size) {}
334+static inline int remove_memory(int nid, u64 start, u64 size)
335+{
336+ return -EBUSY;
337+}
338+
345339 static inline void __remove_memory(int nid, u64 start, u64 size) {}
346340 #endif /* CONFIG_MEMORY_HOTREMOVE */
347341
348342 extern void __ref free_area_init_core_hotplug(int nid);
349−extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
350− void *arg, int (*func)(struct memory_block *, void *));
351343 extern int __add_memory(int nid, u64 start, u64 size);
352344 extern int add_memory(int nid, u64 start, u64 size);
353345 extern int add_memory_resource(int nid, struct resource *resource);
354346 extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
355347 unsigned long nr_pages, struct vmem_altmap *altmap);
356348 extern bool is_memblock_offlined(struct memory_block *mem);
357−extern int sparse_add_one_section(int nid, unsigned long start_pfn,
358− struct vmem_altmap *altmap);
359−extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms,
349+extern int sparse_add_section(int nid, unsigned long pfn,
350+ unsigned long nr_pages, struct vmem_altmap *altmap);
351+extern void sparse_remove_section(struct mem_section *ms,
352+ unsigned long pfn, unsigned long nr_pages,
360353 unsigned long map_offset, struct vmem_altmap *altmap);
361354 extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map,
362355 unsigned long pnum);
include/linux/memremap.h+49−26
@@ -37,13 +37,6 @@ struct vmem_altmap { · 36 unmodified lines
3737 * A more complete discussion of unaddressable memory may be found in
3838 * include/linux/hmm.h and Documentation/vm/hmm.rst.
3939 *
40− * MEMORY_DEVICE_PUBLIC:
41− * Device memory that is cache coherent from device and CPU point of view. This
42− * is use on platform that have an advance system bus (like CAPI or CCIX). A
43− * driver can hotplug the device memory using ZONE_DEVICE and with that memory
44− * type. Any page of a process can be migrated to such memory. However no one
45− * should be allow to pin such memory so that it can always be evicted.
46− *
4740 * MEMORY_DEVICE_FS_DAX:
4841 * Host memory that has similar access semantics as System RAM i.e. DMA
4942 * coherent and supports page pinning. In support of coordinating page
@@ -52,54 +45,84 @@ struct vmem_altmap { · 2 unmodified lines
5245 * wakeup is used to coordinate physical address space management (ex:
5346 * fs truncate/hole punch) vs pinned pages (ex: device dma).
5447 *
48+ * MEMORY_DEVICE_DEVDAX:
49+ * Host memory that has similar access semantics as System RAM i.e. DMA
50+ * coherent and supports page pinning. In contrast to
51+ * MEMORY_DEVICE_FS_DAX, this memory is access via a device-dax
52+ * character device.
53+ *
5554 * MEMORY_DEVICE_PCI_P2PDMA:
5655 * Device memory residing in a PCI BAR intended for use with Peer-to-Peer
5756 * transactions.
5857 */
5958 enum memory_type {
59+ /* 0 is reserved to catch uninitialized type fields */
6060 MEMORY_DEVICE_PRIVATE = 1,
61− MEMORY_DEVICE_PUBLIC,
6261 MEMORY_DEVICE_FS_DAX,
62+ MEMORY_DEVICE_DEVDAX,
6363 MEMORY_DEVICE_PCI_P2PDMA,
6464 };
6565
66−/*
67− * Additional notes about MEMORY_DEVICE_PRIVATE may be found in
68− * include/linux/hmm.h and Documentation/vm/hmm.rst. There is also a brief
69− * explanation in include/linux/memory_hotplug.h.
70− *
71− * The page_free() callback is called once the page refcount reaches 1
72− * (ZONE_DEVICE pages never reach 0 refcount unless there is a refcount bug.
73− * This allows the device driver to implement its own memory management.)
74− */
75−typedef void (*dev_page_free_t)(struct page *page, void *data);
66+struct dev_pagemap_ops {
67+ /*
68+ * Called once the page refcount reaches 1. (ZONE_DEVICE pages never
69+ * reach 0 refcount unless there is a refcount bug. This allows the
70+ * device driver to implement its own memory management.)
71+ */
72+ void (*page_free)(struct page *page);
73+
74+ /*
75+ * Transition the refcount in struct dev_pagemap to the dead state.
76+ */
77+ void (*kill)(struct dev_pagemap *pgmap);
78+
79+ /*
80+ * Wait for refcount in struct dev_pagemap to be idle and reap it.
81+ */
82+ void (*cleanup)(struct dev_pagemap *pgmap);
83+
84+ /*
85+ * Used for private (un-addressable) device memory only. Must migrate
86+ * the page back to a CPU accessible page.
87+ */
88+ vm_fault_t (*migrate_to_ram)(struct vm_fault *vmf);
89+};
90+
91+#define PGMAP_ALTMAP_VALID (1 << 0)
7692
7793 /**
7894 * struct dev_pagemap - metadata for ZONE_DEVICE mappings
79− * @page_free: free page callback when page refcount reaches 1
8095 * @altmap: pre-allocated/reserved memory for vmemmap allocations
8196 * @res: physical address range covered by @ref
8297 * @ref: reference count that pins the devm_memremap_pages() mapping
83− * @kill: callback to transition @ref to the dead state
84− * @cleanup: callback to wait for @ref to be idle and reap it
98+ * @internal_ref: internal reference if @ref is not provided by the caller
99+ * @done: completion for @internal_ref
85100 * @dev: host device of the mapping for debug
86101 * @data: private data pointer for page_free()
87102 * @type: memory type: see MEMORY_* in memory_hotplug.h
103+ * @flags: PGMAP_* flags to specify defailed behavior
104+ * @ops: method table
88105 */
89106 struct dev_pagemap {
90− dev_page_free_t page_free;
91107 struct vmem_altmap altmap;
92− bool altmap_valid;
93108 struct resource res;
94109 struct percpu_ref *ref;
95− void (*kill)(struct percpu_ref *ref);
96− void (*cleanup)(struct percpu_ref *ref);
110+ struct percpu_ref internal_ref;
111+ struct completion done;
97112 struct device *dev;
98− void *data;
99113 enum memory_type type;
114+ unsigned int flags;
100115 u64 pci_p2pdma_bus_offset;
116+ const struct dev_pagemap_ops *ops;
101117 };
102118
119+static inline struct vmem_altmap *pgmap_altmap(struct dev_pagemap *pgmap)
120+{
121+ if (pgmap->flags & PGMAP_ALTMAP_VALID)
122+ return &pgmap->altmap;
123+ return NULL;
124+}
125+
103126 #ifdef CONFIG_ZONE_DEVICE
104127 void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap);
105128 void devm_memunmap_pages(struct device *dev, struct dev_pagemap *pgmap);
include/linux/mfd/cros_ec.h+2−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #define CROS_EC_DEV_PD_NAME "cros_pd"
2020 #define CROS_EC_DEV_TP_NAME "cros_tp"
2121 #define CROS_EC_DEV_ISH_NAME "cros_ish"
22+#define CROS_EC_DEV_SCP_NAME "cros_scp"
2223
2324 /*
2425 * The EC is unresponsive for a time after a reboot command. Add a
@@ -155,6 +156,7 @@ struct cros_ec_device { · 130 unmodified lines
155156 struct ec_response_get_next_event_v1 event_data;
156157 int event_size;
157158 u32 host_event_wake_mask;
159+ u32 last_resume_result;
158160 };
159161
160162 /**
include/linux/mfd/cros_ec_commands.h+2911−739
@@ -4,17 +4,20 @@ · 3 unmodified lines
44 *
55 * Copyright (C) 2012 Google, Inc
66 *
7− * The ChromeOS EC multi function device is used to mux all the requests
8− * to the EC device for its multiple features: keyboard controller,
9− * battery charging and regulator control, firmware update.
10− *
11− * NOTE: This file is copied verbatim from the ChromeOS EC Open Source
12− * project in an attempt to make future updates easy to make.
7+ * NOTE: This file is auto-generated from ChromeOS EC Open Source code from
8+ * https://chromium.googlesource.com/chromiumos/platform/ec/+/master/include/ec_commands.h
139 */
1410
11+/* Host communication command constants for Chrome EC */
12+
1513 #ifndef __CROS_EC_COMMANDS_H
1614 #define __CROS_EC_COMMANDS_H
1715
16+
17+
18+
19+#define BUILD_ASSERT(_cond)
20+
1821 /*
1922 * Current version of this protocol
2023 *
@@ -25,7 +28,7 @@ · 4 unmodified lines
2528 #define EC_PROTO_VERSION 0x00000002
2629
2730 /* Command version mask */
28−#define EC_VER_MASK(version) (1UL << (version))
31+#define EC_VER_MASK(version) BIT(version)
2932
3033 /* I/O addresses for ACPI commands */
3134 #define EC_LPC_ADDR_ACPI_DATA 0x62
@@ -39,25 +42,28 @@ · 7 unmodified lines
3942 /* Protocol version 2 */
4043 #define EC_LPC_ADDR_HOST_ARGS 0x800 /* And 0x801, 0x802, 0x803 */
4144 #define EC_LPC_ADDR_HOST_PARAM 0x804 /* For version 2 params; size is
42− * EC_PROTO2_MAX_PARAM_SIZE */
45+ * EC_PROTO2_MAX_PARAM_SIZE
46+ */
4347 /* Protocol version 3 */
4448 #define EC_LPC_ADDR_HOST_PACKET 0x800 /* Offset of version 3 packet */
4549 #define EC_LPC_HOST_PACKET_SIZE 0x100 /* Max size of version 3 packet */
4650
47−/* The actual block is 0x800-0x8ff, but some BIOSes think it's 0x880-0x8ff
48− * and they tell the kernel that so we have to think of it as two parts. */
51+/*
52+ * The actual block is 0x800-0x8ff, but some BIOSes think it's 0x880-0x8ff
53+ * and they tell the kernel that so we have to think of it as two parts.
54+ */
4955 #define EC_HOST_CMD_REGION0 0x800
5056 #define EC_HOST_CMD_REGION1 0x880
5157 #define EC_HOST_CMD_REGION_SIZE 0x80
5258
5359 /* EC command register bit functions */
54−#define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */
55−#define EC_LPC_CMDR_PENDING (1 << 1) /* Write pending to EC */
56−#define EC_LPC_CMDR_BUSY (1 << 2) /* EC is busy processing a command */
57−#define EC_LPC_CMDR_CMD (1 << 3) /* Last host write was a command */
58−#define EC_LPC_CMDR_ACPI_BRST (1 << 4) /* Burst mode (not used) */
59−#define EC_LPC_CMDR_SCI (1 << 5) /* SCI event is pending */
60−#define EC_LPC_CMDR_SMI (1 << 6) /* SMI event is pending */
60+#define EC_LPC_CMDR_DATA BIT(0) /* Data ready for host to read */
61+#define EC_LPC_CMDR_PENDING BIT(1) /* Write pending to EC */
62+#define EC_LPC_CMDR_BUSY BIT(2) /* EC is busy processing a command */
63+#define EC_LPC_CMDR_CMD BIT(3) /* Last host write was a command */
64+#define EC_LPC_CMDR_ACPI_BRST BIT(4) /* Burst mode (not used) */
65+#define EC_LPC_CMDR_SCI BIT(5) /* SCI event is pending */
66+#define EC_LPC_CMDR_SMI BIT(6) /* SMI event is pending */
6167
6268 #define EC_LPC_ADDR_MEMMAP 0x900
6369 #define EC_MEMMAP_SIZE 255 /* ACPI IO buffer max is 255 bytes */
@@ -77,13 +83,15 @@ · 13 unmodified lines
7783 /* Unused 0x28 - 0x2f */
7884 #define EC_MEMMAP_SWITCHES 0x30 /* 8 bits */
7985 /* Unused 0x31 - 0x33 */
80−#define EC_MEMMAP_HOST_EVENTS 0x34 /* 32 bits */
81−/* Reserve 0x38 - 0x3f for additional host event-related stuff */
82−/* Battery values are all 32 bits */
86+#define EC_MEMMAP_HOST_EVENTS 0x34 /* 64 bits */
87+/* Battery values are all 32 bits, unless otherwise noted. */
8388 #define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */
8489 #define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */
8590 #define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */
86−#define EC_MEMMAP_BATT_FLAG 0x4c /* Battery State, defined below */
91+#define EC_MEMMAP_BATT_FLAG 0x4c /* Battery State, see below (8-bit) */
92+#define EC_MEMMAP_BATT_COUNT 0x4d /* Battery Count (8-bit) */
93+#define EC_MEMMAP_BATT_INDEX 0x4e /* Current Battery Data Index (8-bit) */
94+/* Unused 0x4f */
8795 #define EC_MEMMAP_BATT_DCAP 0x50 /* Battery Design Capacity */
8896 #define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */
8997 #define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */
@@ -97,15 +105,24 @@ · 7 unmodified lines
97105 /* Unused 0x84 - 0x8f */
98106 #define EC_MEMMAP_ACC_STATUS 0x90 /* Accelerometer status (8 bits )*/
99107 /* Unused 0x91 */
100−#define EC_MEMMAP_ACC_DATA 0x92 /* Accelerometer data 0x92 - 0x9f */
108+#define EC_MEMMAP_ACC_DATA 0x92 /* Accelerometers data 0x92 - 0x9f */
109+/* 0x92: Lid Angle if available, LID_ANGLE_UNRELIABLE otherwise */
110+/* 0x94 - 0x99: 1st Accelerometer */
111+/* 0x9a - 0x9f: 2nd Accelerometer */
101112 #define EC_MEMMAP_GYRO_DATA 0xa0 /* Gyroscope data 0xa0 - 0xa5 */
102−/* Unused 0xa6 - 0xfe (remember, 0xff is NOT part of the memmap region) */
113+/* Unused 0xa6 - 0xdf */
103114
115+/*
116+ * ACPI is unable to access memory mapped data at or above this offset due to
117+ * limitations of the ACPI protocol. Do not place data in the range 0xe0 - 0xfe
118+ * which might be needed by ACPI.
119+ */
120+#define EC_MEMMAP_NO_ACPI 0xe0
104121
105122 /* Define the format of the accelerometer mapped memory status byte. */
106123 #define EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK 0x0f
107−#define EC_MEMMAP_ACC_STATUS_BUSY_BIT (1 << 4)
108−#define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT (1 << 7)
124+#define EC_MEMMAP_ACC_STATUS_BUSY_BIT BIT(4)
125+#define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT BIT(7)
109126
110127 /* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */
111128 #define EC_TEMP_SENSOR_ENTRIES 16
@@ -149,6 +166,8 @@ · 37 unmodified lines
149166 #define EC_BATT_FLAG_DISCHARGING 0x04
150167 #define EC_BATT_FLAG_CHARGING 0x08
151168 #define EC_BATT_FLAG_LEVEL_CRITICAL 0x10
169+/* Set if some of the static/dynamic data is invalid (or outdated). */
170+#define EC_BATT_FLAG_INVALID_DATA 0x20
152171
153172 /* Switch flags at EC_MEMMAP_SWITCHES */
154173 #define EC_SWITCH_LID_OPEN 0x01
@@ -174,20 +193,242 @@ · 19 unmodified lines
174193 #define EC_WIRELESS_SWITCH_WWAN 0x04 /* WWAN power */
175194 #define EC_WIRELESS_SWITCH_WLAN_POWER 0x08 /* WLAN power */
176195
196+/*****************************************************************************/
197+/*
198+ * ACPI commands
199+ *
200+ * These are valid ONLY on the ACPI command/data port.
201+ */
202+
203+/*
204+ * ACPI Read Embedded Controller
205+ *
206+ * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*).
207+ *
208+ * Use the following sequence:
209+ *
210+ * - Write EC_CMD_ACPI_READ to EC_LPC_ADDR_ACPI_CMD
211+ * - Wait for EC_LPC_CMDR_PENDING bit to clear
212+ * - Write address to EC_LPC_ADDR_ACPI_DATA
213+ * - Wait for EC_LPC_CMDR_DATA bit to set
214+ * - Read value from EC_LPC_ADDR_ACPI_DATA
215+ */
216+#define EC_CMD_ACPI_READ 0x0080
217+
218+/*
219+ * ACPI Write Embedded Controller
220+ *
221+ * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*).
222+ *
223+ * Use the following sequence:
224+ *
225+ * - Write EC_CMD_ACPI_WRITE to EC_LPC_ADDR_ACPI_CMD
226+ * - Wait for EC_LPC_CMDR_PENDING bit to clear
227+ * - Write address to EC_LPC_ADDR_ACPI_DATA
228+ * - Wait for EC_LPC_CMDR_PENDING bit to clear
229+ * - Write value to EC_LPC_ADDR_ACPI_DATA
230+ */
231+#define EC_CMD_ACPI_WRITE 0x0081
232+
233+/*
234+ * ACPI Burst Enable Embedded Controller
235+ *
236+ * This enables burst mode on the EC to allow the host to issue several
237+ * commands back-to-back. While in this mode, writes to mapped multi-byte
238+ * data are locked out to ensure data consistency.
239+ */
240+#define EC_CMD_ACPI_BURST_ENABLE 0x0082
241+
242+/*
243+ * ACPI Burst Disable Embedded Controller
244+ *
245+ * This disables burst mode on the EC and stops preventing EC writes to mapped
246+ * multi-byte data.
247+ */
248+#define EC_CMD_ACPI_BURST_DISABLE 0x0083
249+
250+/*
251+ * ACPI Query Embedded Controller
252+ *
253+ * This clears the lowest-order bit in the currently pending host events, and
254+ * sets the result code to the 1-based index of the bit (event 0x00000001 = 1,
255+ * event 0x80000000 = 32), or 0 if no event was pending.
256+ */
257+#define EC_CMD_ACPI_QUERY_EVENT 0x0084
258+
259+/* Valid addresses in ACPI memory space, for read/write commands */
260+
261+/* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */
262+#define EC_ACPI_MEM_VERSION 0x00
263+/*
264+ * Test location; writing value here updates test compliment byte to (0xff -
265+ * value).
266+ */
267+#define EC_ACPI_MEM_TEST 0x01
268+/* Test compliment; writes here are ignored. */
269+#define EC_ACPI_MEM_TEST_COMPLIMENT 0x02
270+
271+/* Keyboard backlight brightness percent (0 - 100) */
272+#define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03
273+/* DPTF Target Fan Duty (0-100, 0xff for auto/none) */
274+#define EC_ACPI_MEM_FAN_DUTY 0x04
275+
276+/*
277+ * DPTF temp thresholds. Any of the EC's temp sensors can have up to two
278+ * independent thresholds attached to them. The current value of the ID
279+ * register determines which sensor is affected by the THRESHOLD and COMMIT
280+ * registers. The THRESHOLD register uses the same EC_TEMP_SENSOR_OFFSET scheme
281+ * as the memory-mapped sensors. The COMMIT register applies those settings.
282+ *
283+ * The spec does not mandate any way to read back the threshold settings
284+ * themselves, but when a threshold is crossed the AP needs a way to determine
285+ * which sensor(s) are responsible. Each reading of the ID register clears and
286+ * returns one sensor ID that has crossed one of its threshold (in either
287+ * direction) since the last read. A value of 0xFF means "no new thresholds
288+ * have tripped". Setting or enabling the thresholds for a sensor will clear
289+ * the unread event count for that sensor.
290+ */
291+#define EC_ACPI_MEM_TEMP_ID 0x05
292+#define EC_ACPI_MEM_TEMP_THRESHOLD 0x06
293+#define EC_ACPI_MEM_TEMP_COMMIT 0x07
294+/*
295+ * Here are the bits for the COMMIT register:
296+ * bit 0 selects the threshold index for the chosen sensor (0/1)
297+ * bit 1 enables/disables the selected threshold (0 = off, 1 = on)
298+ * Each write to the commit register affects one threshold.
299+ */
300+#define EC_ACPI_MEM_TEMP_COMMIT_SELECT_MASK BIT(0)
301+#define EC_ACPI_MEM_TEMP_COMMIT_ENABLE_MASK BIT(1)
302+/*
303+ * Example:
304+ *
305+ * Set the thresholds for sensor 2 to 50 C and 60 C:
306+ * write 2 to [0x05] -- select temp sensor 2
307+ * write 0x7b to [0x06] -- C_TO_K(50) - EC_TEMP_SENSOR_OFFSET
308+ * write 0x2 to [0x07] -- enable threshold 0 with this value
309+ * write 0x85 to [0x06] -- C_TO_K(60) - EC_TEMP_SENSOR_OFFSET
310+ * write 0x3 to [0x07] -- enable threshold 1 with this value
311+ *
312+ * Disable the 60 C threshold, leaving the 50 C threshold unchanged:
313+ * write 2 to [0x05] -- select temp sensor 2
314+ * write 0x1 to [0x07] -- disable threshold 1
315+ */
316+
317+/* DPTF battery charging current limit */
318+#define EC_ACPI_MEM_CHARGING_LIMIT 0x08
319+
320+/* Charging limit is specified in 64 mA steps */
321+#define EC_ACPI_MEM_CHARGING_LIMIT_STEP_MA 64
322+/* Value to disable DPTF battery charging limit */
323+#define EC_ACPI_MEM_CHARGING_LIMIT_DISABLED 0xff
324+
325+/*
326+ * Report device orientation
327+ * Bits Definition
328+ * 3:1 Device DPTF Profile Number (DDPN)
329+ * 0 = Reserved for backward compatibility (indicates no valid
330+ * profile number. Host should fall back to using TBMD).
331+ * 1..7 = DPTF Profile number to indicate to host which table needs
332+ * to be loaded.
333+ * 0 Tablet Mode Device Indicator (TBMD)
334+ */
335+#define EC_ACPI_MEM_DEVICE_ORIENTATION 0x09
336+#define EC_ACPI_MEM_TBMD_SHIFT 0
337+#define EC_ACPI_MEM_TBMD_MASK 0x1
338+#define EC_ACPI_MEM_DDPN_SHIFT 1
339+#define EC_ACPI_MEM_DDPN_MASK 0x7
340+
341+/*
342+ * Report device features. Uses the same format as the host command, except:
343+ *
344+ * bit 0 (EC_FEATURE_LIMITED) changes meaning from "EC code has a limited set
345+ * of features", which is of limited interest when the system is already
346+ * interpreting ACPI bytecode, to "EC_FEATURES[0-7] is not supported". Since
347+ * these are supported, it defaults to 0.
348+ * This allows detecting the presence of this field since older versions of
349+ * the EC codebase would simply return 0xff to that unknown address. Check
350+ * FEATURES0 != 0xff (or FEATURES0[0] == 0) to make sure that the other bits
351+ * are valid.
352+ */
353+#define EC_ACPI_MEM_DEVICE_FEATURES0 0x0a
354+#define EC_ACPI_MEM_DEVICE_FEATURES1 0x0b
355+#define EC_ACPI_MEM_DEVICE_FEATURES2 0x0c
356+#define EC_ACPI_MEM_DEVICE_FEATURES3 0x0d
357+#define EC_ACPI_MEM_DEVICE_FEATURES4 0x0e
358+#define EC_ACPI_MEM_DEVICE_FEATURES5 0x0f
359+#define EC_ACPI_MEM_DEVICE_FEATURES6 0x10
360+#define EC_ACPI_MEM_DEVICE_FEATURES7 0x11
361+
362+#define EC_ACPI_MEM_BATTERY_INDEX 0x12
363+
364+/*
365+ * USB Port Power. Each bit indicates whether the corresponding USB ports' power
366+ * is enabled (1) or disabled (0).
367+ * bit 0 USB port ID 0
368+ * ...
369+ * bit 7 USB port ID 7
370+ */
371+#define EC_ACPI_MEM_USB_PORT_POWER 0x13
372+
373+/*
374+ * ACPI addresses 0x20 - 0xff map to EC_MEMMAP offset 0x00 - 0xdf. This data
375+ * is read-only from the AP. Added in EC_ACPI_MEM_VERSION 2.
376+ */
377+#define EC_ACPI_MEM_MAPPED_BEGIN 0x20
378+#define EC_ACPI_MEM_MAPPED_SIZE 0xe0
379+
380+/* Current version of ACPI memory address space */
381+#define EC_ACPI_MEM_VERSION_CURRENT 2
382+
383+
177384 /*
178385 * This header file is used in coreboot both in C and ACPI code. The ACPI code
179386 * is pre-processed to handle constants but the ASL compiler is unable to
180387 * handle actual C code so keep it separate.
181388 */
182−#ifndef __ACPI__
389+
390+
391+/*
392+ * Attributes for EC request and response packets. Just defining __packed
393+ * results in inefficient assembly code on ARM, if the structure is actually
394+ * 32-bit aligned, as it should be for all buffers.
395+ *
396+ * Be very careful when adding these to existing structures. They will round
397+ * up the structure size to the specified boundary.
398+ *
399+ * Also be very careful to make that if a structure is included in some other
400+ * parent structure that the alignment will still be true given the packing of
401+ * the parent structure. This is particularly important if the sub-structure
402+ * will be passed as a pointer to another function, since that function will
403+ * not know about the misaligment caused by the parent structure's packing.
404+ *
405+ * Also be very careful using __packed - particularly when nesting non-packed
406+ * structures inside packed ones. In fact, DO NOT use __packed directly;
407+ * always use one of these attributes.
408+ *
409+ * Once everything is annotated properly, the following search strings should
410+ * not return ANY matches in this file other than right here:
411+ *
412+ * "__packed" - generates inefficient code; all sub-structs must also be packed
413+ *
414+ * "struct [^_]" - all structs should be annotated, except for structs that are
415+ * members of other structs/unions (and their original declarations should be
416+ * annotated).
417+ */
183418
184419 /*
185− * Define __packed if someone hasn't beat us to it. Linux kernel style
186− * checking prefers __packed over __attribute__((packed)).
420+ * Packed structures make no assumption about alignment, so they do inefficient
421+ * byte-wise reads.
187422 */
188−#ifndef __packed
189−#define __packed __attribute__((packed))
190−#endif
423+#define __ec_align1 __packed
424+#define __ec_align2 __packed
425+#define __ec_align4 __packed
426+#define __ec_align_size1 __packed
427+#define __ec_align_offset1 __packed
428+#define __ec_align_offset2 __packed
429+#define __ec_todo_packed __packed
430+#define __ec_todo_unpacked
431+
191432
192433 /* LPC command status byte masks */
193434 /* EC has written a byte in the data register and host hasn't read it yet */
@@ -198,7 +439,7 @@ · 4 unmodified lines
198439 #define EC_LPC_STATUS_PROCESSING 0x04
199440 /* Last write to EC was a command, not data */
200441 #define EC_LPC_STATUS_LAST_CMD 0x08
201−/* EC is in burst mode. Unsupported by Chrome EC, so this bit is never set */
442+/* EC is in burst mode */
202443 #define EC_LPC_STATUS_BURST_MODE 0x10
203444 /* SCI event is pending (requesting SCI query) */
204445 #define EC_LPC_STATUS_SCI_PENDING 0x20
@@ -214,7 +455,10 @@ · 9 unmodified lines
214455 #define EC_LPC_STATUS_BUSY_MASK \
215456 (EC_LPC_STATUS_FROM_HOST | EC_LPC_STATUS_PROCESSING)
216457
217−/* Host command response codes */
458+/*
459+ * Host command response codes (16-bit). Note that response codes should be
460+ * stored in a uint16_t rather than directly in a value of this type.
461+ */
218462 enum ec_status {
219463 EC_RES_SUCCESS = 0,
220464 EC_RES_INVALID_COMMAND = 1,
@@ -230,7 +474,13 @@ enum ec_status { · 9 unmodified lines
230474 EC_RES_OVERFLOW = 11, /* Table / data overflow */
231475 EC_RES_INVALID_HEADER = 12, /* Header contains invalid data */
232476 EC_RES_REQUEST_TRUNCATED = 13, /* Didn't get the entire request */
233− EC_RES_RESPONSE_TOO_BIG = 14 /* Response was too big to handle */
477+ EC_RES_RESPONSE_TOO_BIG = 14, /* Response was too big to handle */
478+ EC_RES_BUS_ERROR = 15, /* Communications bus error */
479+ EC_RES_BUSY = 16, /* Up but too busy. Should retry */
480+ EC_RES_INVALID_HEADER_VERSION = 17, /* Header version invalid */
481+ EC_RES_INVALID_HEADER_CRC = 18, /* Header CRC invalid */
482+ EC_RES_INVALID_DATA_CRC = 19, /* Data CRC invalid */
483+ EC_RES_DUP_UNAVAILABLE = 20, /* Can't resend response */
234484 };
235485
236486 /*
@@ -250,7 +500,8 @@ enum host_event_code { · 13 unmodified lines
250500 EC_HOST_EVENT_BATTERY_CRITICAL = 7,
251501 EC_HOST_EVENT_BATTERY = 8,
252502 EC_HOST_EVENT_THERMAL_THRESHOLD = 9,
253− EC_HOST_EVENT_THERMAL_OVERLOAD = 10,
503+ /* Event generated by a device attached to the EC */
504+ EC_HOST_EVENT_DEVICE = 10,
254505 EC_HOST_EVENT_THERMAL = 11,
255506 EC_HOST_EVENT_USB_CHARGER = 12,
256507 EC_HOST_EVENT_KEY_PRESSED = 13,
@@ -277,15 +528,34 @@ enum host_event_code { · 20 unmodified lines
277528 EC_HOST_EVENT_HANG_DETECT = 20,
278529 /* Hang detect logic detected a hang and warm rebooted the AP */
279530 EC_HOST_EVENT_HANG_REBOOT = 21,
531+
280532 /* PD MCU triggering host event */
281533 EC_HOST_EVENT_PD_MCU = 22,
282534
283− /* EC desires to change state of host-controlled USB mux */
284− EC_HOST_EVENT_USB_MUX = 28,
535+ /* Battery Status flags have changed */
536+ EC_HOST_EVENT_BATTERY_STATUS = 23,
537+
538+ /* EC encountered a panic, triggering a reset */
539+ EC_HOST_EVENT_PANIC = 24,
540+
541+ /* Keyboard fastboot combo has been pressed */
542+ EC_HOST_EVENT_KEYBOARD_FASTBOOT = 25,
285543
286544 /* EC RTC event occurred */
287545 EC_HOST_EVENT_RTC = 26,
288546
547+ /* Emulate MKBP event */
548+ EC_HOST_EVENT_MKBP = 27,
549+
550+ /* EC desires to change state of host-controlled USB mux */
551+ EC_HOST_EVENT_USB_MUX = 28,
552+
553+ /* TABLET/LAPTOP mode or detachable base attach/detach event */
554+ EC_HOST_EVENT_MODE_CHANGE = 29,
555+
556+ /* Keyboard recovery combo with hardware reinitialization */
557+ EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT = 30,
558+
289559 /*
290560 * The high bit of the event mask is not used as a host event code. If
291561 * it reads back as set, then the entire event mask should be
@@ -296,7 +566,7 @@ enum host_event_code { · 4 unmodified lines
296566 EC_HOST_EVENT_INVALID = 32
297567 };
298568 /* Host event mask */
299−#define EC_HOST_EVENT_MASK(event_code) (1UL << ((event_code) - 1))
569+#define EC_HOST_EVENT_MASK(event_code) BIT_ULL((event_code) - 1)
300570
301571 /**
302572 * struct ec_lpc_host_args - Arguments at EC_LPC_ADDR_HOST_ARGS
@@ -311,7 +581,7 @@ struct ec_lpc_host_args { · 8 unmodified lines
311581 uint8_t command_version;
312582 uint8_t data_size;
313583 uint8_t checksum;
314−} __packed;
584+} __ec_align4;
315585
316586 /* Flags for ec_lpc_host_args.flags */
317587 /*
@@ -321,7 +591,7 @@ struct ec_lpc_host_args { · 3 unmodified lines
321591 * If EC gets a command and this flag is not set, this is an old-style command.
322592 * Command version is 0 and params from host are at EC_LPC_ADDR_OLD_PARAM with
323593 * unknown length. EC must respond with an old-style response (that is,
324− * withouth setting EC_HOST_ARGS_FLAG_TO_HOST).
594+ * without setting EC_HOST_ARGS_FLAG_TO_HOST).
325595 */
326596 #define EC_HOST_ARGS_FLAG_FROM_HOST 0x01
327597 /*
@@ -482,7 +752,7 @@ struct ec_host_request { · 154 unmodified lines
482752 uint8_t command_version;
483753 uint8_t reserved;
484754 uint16_t data_len;
485−} __packed;
755+} __ec_align4;
486756
487757 #define EC_HOST_RESPONSE_VERSION 3
488758
@@ -501,18 +771,151 @@ struct ec_host_response { · 12 unmodified lines
501771 uint16_t result;
502772 uint16_t data_len;
503773 uint16_t reserved;
504−} __packed;
774+} __ec_align4;
775+
776+/*****************************************************************************/
777+
778+/*
779+ * Host command protocol V4.
780+ *
781+ * Packets always start with a request or response header. They are followed
782+ * by data_len bytes of data. If the data_crc_present flag is set, the data
783+ * bytes are followed by a CRC-8 of that data, using using x^8 + x^2 + x + 1
784+ * polynomial.
785+ *
786+ * Host algorithm when sending a request q:
787+ *
788+ * 101) tries_left=(some value, e.g. 3);
789+ * 102) q.seq_num++
790+ * 103) q.seq_dup=0
791+ * 104) Calculate q.header_crc.
792+ * 105) Send request q to EC.
793+ * 106) Wait for response r. Go to 201 if received or 301 if timeout.
794+ *
795+ * 201) If r.struct_version != 4, go to 301.
796+ * 202) If r.header_crc mismatches calculated CRC for r header, go to 301.
797+ * 203) If r.data_crc_present and r.data_crc mismatches, go to 301.
798+ * 204) If r.seq_num != q.seq_num, go to 301.
799+ * 205) If r.seq_dup == q.seq_dup, return success.
800+ * 207) If r.seq_dup == 1, go to 301.
801+ * 208) Return error.
802+ *
803+ * 301) If --tries_left <= 0, return error.
804+ * 302) If q.seq_dup == 1, go to 105.
805+ * 303) q.seq_dup = 1
806+ * 304) Go to 104.
807+ *
808+ * EC algorithm when receiving a request q.
809+ * EC has response buffer r, error buffer e.
810+ *
811+ * 101) If q.struct_version != 4, set e.result = EC_RES_INVALID_HEADER_VERSION
812+ * and go to 301
813+ * 102) If q.header_crc mismatches calculated CRC, set e.result =
814+ * EC_RES_INVALID_HEADER_CRC and go to 301
815+ * 103) If q.data_crc_present, calculate data CRC. If that mismatches the CRC
816+ * byte at the end of the packet, set e.result = EC_RES_INVALID_DATA_CRC
817+ * and go to 301.
818+ * 104) If q.seq_dup == 0, go to 201.
819+ * 105) If q.seq_num != r.seq_num, go to 201.
820+ * 106) If q.seq_dup == r.seq_dup, go to 205, else go to 203.
821+ *
822+ * 201) Process request q into response r.
823+ * 202) r.seq_num = q.seq_num
824+ * 203) r.seq_dup = q.seq_dup
825+ * 204) Calculate r.header_crc
826+ * 205) If r.data_len > 0 and data is no longer available, set e.result =
827+ * EC_RES_DUP_UNAVAILABLE and go to 301.
828+ * 206) Send response r.
829+ *
830+ * 301) e.seq_num = q.seq_num
831+ * 302) e.seq_dup = q.seq_dup
832+ * 303) Calculate e.header_crc.
833+ * 304) Send error response e.
834+ */
835+
836+/* Version 4 request from host */
837+struct ec_host_request4 {
838+ /*
839+ * bits 0-3: struct_version: Structure version (=4)
840+ * bit 4: is_response: Is response (=0)
841+ * bits 5-6: seq_num: Sequence number
842+ * bit 7: seq_dup: Sequence duplicate flag
843+ */
844+ uint8_t fields0;
845+
846+ /*
847+ * bits 0-4: command_version: Command version
848+ * bits 5-6: Reserved (set 0, ignore on read)
849+ * bit 7: data_crc_present: Is data CRC present after data
850+ */
851+ uint8_t fields1;
852+
853+ /* Command code (EC_CMD_*) */
854+ uint16_t command;
855+
856+ /* Length of data which follows this header (not including data CRC) */
857+ uint16_t data_len;
858+
859+ /* Reserved (set 0, ignore on read) */
860+ uint8_t reserved;
861+
862+ /* CRC-8 of above fields, using x^8 + x^2 + x + 1 polynomial */
863+ uint8_t header_crc;
864+} __ec_align4;
865+
866+/* Version 4 response from EC */
867+struct ec_host_response4 {
868+ /*
869+ * bits 0-3: struct_version: Structure version (=4)
870+ * bit 4: is_response: Is response (=1)
871+ * bits 5-6: seq_num: Sequence number
872+ * bit 7: seq_dup: Sequence duplicate flag
873+ */
874+ uint8_t fields0;
875+
876+ /*
877+ * bits 0-6: Reserved (set 0, ignore on read)
878+ * bit 7: data_crc_present: Is data CRC present after data
879+ */
880+ uint8_t fields1;
881+
882+ /* Result code (EC_RES_*) */
883+ uint16_t result;
884+
885+ /* Length of data which follows this header (not including data CRC) */
886+ uint16_t data_len;
887+
888+ /* Reserved (set 0, ignore on read) */
889+ uint8_t reserved;
890+
891+ /* CRC-8 of above fields, using x^8 + x^2 + x + 1 polynomial */
892+ uint8_t header_crc;
893+} __ec_align4;
894+
895+/* Fields in fields0 byte */
896+#define EC_PACKET4_0_STRUCT_VERSION_MASK 0x0f
897+#define EC_PACKET4_0_IS_RESPONSE_MASK 0x10
898+#define EC_PACKET4_0_SEQ_NUM_SHIFT 5
899+#define EC_PACKET4_0_SEQ_NUM_MASK 0x60
900+#define EC_PACKET4_0_SEQ_DUP_MASK 0x80
901+
902+/* Fields in fields1 byte */
903+#define EC_PACKET4_1_COMMAND_VERSION_MASK 0x1f /* (request only) */
904+#define EC_PACKET4_1_DATA_CRC_PRESENT_MASK 0x80
505905
506906 /*****************************************************************************/
507907 /*
508908 * Notes on commands:
509909 *
510910 * Each command is an 16-bit command value. Commands which take params or
511− * return response data specify structs for that data. If no struct is
911+ * return response data specify structures for that data. If no structure is
512912 * specified, the command does not input or output data, respectively.
513913 * Parameter/response length is implicit in the structs. Some underlying
514914 * communication protocols (I2C, SPI) may add length or checksum headers, but
515915 * those are implementation-dependent and not defined here.
916+ *
917+ * All commands MUST be #defined to be 4-digit UPPER CASE hex values
918+ * (e.g., 0x00AB, not 0xab) for CONFIG_HOSTCMD_SECTION_SORTED to work.
516919 */
517920
518921 /*****************************************************************************/
@@ -522,7 +925,7 @@ struct ec_host_response { · 3 unmodified lines
522925 * Get protocol version, used to deal with non-backward compatible protocol
523926 * changes.
524927 */
525−#define EC_CMD_PROTO_VERSION 0x00
928+#define EC_CMD_PROTO_VERSION 0x0000
526929
527930 /**
528931 * struct ec_response_proto_version - Response to the proto version command.
@@ -530,13 +933,13 @@ struct ec_host_response { · 1 unmodified line
530933 */
531934 struct ec_response_proto_version {
532935 uint32_t version;
533−} __packed;
936+} __ec_align4;
534937
535938 /*
536939 * Hello. This is a simple command to test the EC is responsive to
537940 * commands.
538941 */
539−#define EC_CMD_HELLO 0x01
942+#define EC_CMD_HELLO 0x0001
540943
541944 /**
542945 * struct ec_params_hello - Parameters to the hello command.
@@ -544,7 +947,7 @@ struct ec_response_proto_version { · 1 unmodified line
544947 */
545948 struct ec_params_hello {
546949 uint32_t in_data;
547−} __packed;
950+} __ec_align4;
548951
549952 /**
550953 * struct ec_response_hello - Response to the hello command.
@@ -552,10 +955,10 @@ struct ec_params_hello { · 1 unmodified line
552955 */
553956 struct ec_response_hello {
554957 uint32_t out_data;
555−} __packed;
958+} __ec_align4;
556959
557960 /* Get version number */
558−#define EC_CMD_GET_VERSION 0x02
961+#define EC_CMD_GET_VERSION 0x0002
559962
560963 enum ec_current_image {
561964 EC_IMAGE_UNKNOWN = 0,
@@ -575,10 +978,10 @@ struct ec_response_get_version { · 13 unmodified lines
575978 char version_string_rw[32];
576979 char reserved[32];
577980 uint32_t current_image;
578−} __packed;
981+} __ec_align4;
579982
580983 /* Read test */
581−#define EC_CMD_READ_TEST 0x03
984+#define EC_CMD_READ_TEST 0x0003
582985
583986 /**
584987 * struct ec_params_read_test - Parameters for the read test command.
@@ -588,7 +991,7 @@ struct ec_response_get_version { · 3 unmodified lines
588991 struct ec_params_read_test {
589992 uint32_t offset;
590993 uint32_t size;
591−} __packed;
994+} __ec_align4;
592995
593996 /**
594997 * struct ec_response_read_test - Response to the read test command.
@@ -596,17 +999,17 @@ struct ec_params_read_test { · 1 unmodified line
596999 */
5971000 struct ec_response_read_test {
5981001 uint32_t data[32];
599−} __packed;
1002+} __ec_align4;
6001003
6011004 /*
6021005 * Get build information
6031006 *
6041007 * Response is null-terminated string.
6051008 */
606−#define EC_CMD_GET_BUILD_INFO 0x04
1009+#define EC_CMD_GET_BUILD_INFO 0x0004
6071010
6081011 /* Get chip info */
609−#define EC_CMD_GET_CHIP_INFO 0x05
1012+#define EC_CMD_GET_CHIP_INFO 0x0005
6101013
6111014 /**
6121015 * struct ec_response_get_chip_info - Response to the get chip info command.
@@ -618,10 +1021,10 @@ struct ec_response_get_chip_info { · 5 unmodified lines
6181021 char vendor[32];
6191022 char name[32];
6201023 char revision[32];
621−} __packed;
1024+} __ec_align4;
6221025
6231026 /* Get board HW version */
624−#define EC_CMD_GET_BOARD_VERSION 0x06
1027+#define EC_CMD_GET_BOARD_VERSION 0x0006
6251028
6261029 /**
6271030 * struct ec_response_board_version - Response to the board version command.
@@ -629,7 +1032,7 @@ struct ec_response_get_chip_info { · 1 unmodified line
6291032 */
6301033 struct ec_response_board_version {
6311034 uint16_t board_version;
632−} __packed;
1035+} __ec_align2;
6331036
6341037 /*
6351038 * Read memory-mapped data.
@@ -639,7 +1042,7 @@ struct ec_response_board_version { · 3 unmodified lines
6391042 *
6401043 * Response is params.size bytes of data.
6411044 */
642−#define EC_CMD_READ_MEMMAP 0x07
1045+#define EC_CMD_READ_MEMMAP 0x0007
6431046
6441047 /**
6451048 * struct ec_params_read_memmap - Parameters for the read memory map command.
@@ -649,10 +1052,10 @@ struct ec_response_board_version { · 3 unmodified lines
6491052 struct ec_params_read_memmap {
6501053 uint8_t offset;
6511054 uint8_t size;
652−} __packed;
1055+} __ec_align1;
6531056
6541057 /* Read versions supported for a command */
655−#define EC_CMD_GET_CMD_VERSIONS 0x08
1058+#define EC_CMD_GET_CMD_VERSIONS 0x0008
6561059
6571060 /**
6581061 * struct ec_params_get_cmd_versions - Parameters for the get command versions.
@@ -660,7 +1063,7 @@ struct ec_params_read_memmap { · 1 unmodified line
6601063 */
6611064 struct ec_params_get_cmd_versions {
6621065 uint8_t cmd;
663−} __packed;
1066+} __ec_align1;
6641067
6651068 /**
6661069 * struct ec_params_get_cmd_versions_v1 - Parameters for the get command
@@ -669,7 +1072,7 @@ struct ec_params_get_cmd_versions { · 2 unmodified lines
6691072 */
6701073 struct ec_params_get_cmd_versions_v1 {
6711074 uint16_t cmd;
672−} __packed;
1075+} __ec_align2;
6731076
6741077 /**
6751078 * struct ec_response_get_cmd_version - Response to the get command versions.
@@ -678,20 +1081,20 @@ struct ec_params_get_cmd_versions_v1 { · 2 unmodified lines
6781081 */
6791082 struct ec_response_get_cmd_versions {
6801083 uint32_t version_mask;
681−} __packed;
1084+} __ec_align4;
6821085
6831086 /*
684− * Check EC communcations status (busy). This is needed on i2c/spi but not
1087+ * Check EC communications status (busy). This is needed on i2c/spi but not
6851088 * on lpc since it has its own out-of-band busy indicator.
6861089 *
6871090 * lpc must read the status from the command register. Attempting this on
6881091 * lpc will overwrite the args/parameter space and corrupt its data.
6891092 */
690−#define EC_CMD_GET_COMMS_STATUS 0x09
1093+#define EC_CMD_GET_COMMS_STATUS 0x0009
6911094
6921095 /* Avoid using ec_status which is for return values */
6931096 enum ec_comms_status {
694− EC_COMMS_STATUS_PROCESSING = 1 << 0, /* Processing cmd */
1097+ EC_COMMS_STATUS_PROCESSING = BIT(0), /* Processing cmd */
6951098 };
6961099
6971100 /**
@@ -701,29 +1104,29 @@ enum ec_comms_status { · 3 unmodified lines
7011104 */
7021105 struct ec_response_get_comms_status {
7031106 uint32_t flags; /* Mask of enum ec_comms_status */
704−} __packed;
1107+} __ec_align4;
7051108
7061109 /* Fake a variety of responses, purely for testing purposes. */
707−#define EC_CMD_TEST_PROTOCOL 0x0a
1110+#define EC_CMD_TEST_PROTOCOL 0x000A
7081111
7091112 /* Tell the EC what to send back to us. */
7101113 struct ec_params_test_protocol {
7111114 uint32_t ec_result;
7121115 uint32_t ret_len;
7131116 uint8_t buf[32];
714−} __packed;
1117+} __ec_align4;
7151118
7161119 /* Here it comes... */
7171120 struct ec_response_test_protocol {
7181121 uint8_t buf[32];
719−} __packed;
1122+} __ec_align4;
7201123
721−/* Get prococol information */
722−#define EC_CMD_GET_PROTOCOL_INFO 0x0b
1124+/* Get protocol information */
1125+#define EC_CMD_GET_PROTOCOL_INFO 0x000B
7231126
7241127 /* Flags for ec_response_get_protocol_info.flags */
7251128 /* EC_RES_IN_PROGRESS may be returned if a command is slow */
726−#define EC_PROTOCOL_INFO_IN_PROGRESS_SUPPORTED (1 << 0)
1129+#define EC_PROTOCOL_INFO_IN_PROGRESS_SUPPORTED BIT(0)
7271130
7281131 /**
7291132 * struct ec_response_get_protocol_info - Response to the get protocol info.
@@ -739,7 +1142,7 @@ struct ec_response_get_protocol_info { · 9 unmodified lines
7391142 uint16_t max_request_packet_size;
7401143 uint16_t max_response_packet_size;
7411144 uint32_t flags;
742−} __packed;
1145+} __ec_align4;
7431146
7441147
7451148 /*****************************************************************************/
@@ -757,19 +1160,19 @@ struct ec_response_get_protocol_info { · 11 unmodified lines
7571160 struct ec_params_get_set_value {
7581161 uint32_t flags;
7591162 uint32_t value;
760−} __packed;
1163+} __ec_align4;
7611164
7621165 struct ec_response_get_set_value {
7631166 uint32_t flags;
7641167 uint32_t value;
765−} __packed;
1168+} __ec_align4;
7661169
767−/* More than one command can use these structs to get/set paramters. */
768−#define EC_CMD_GSV_PAUSE_IN_S5 0x0c
1170+/* More than one command can use these structs to get/set parameters. */
1171+#define EC_CMD_GSV_PAUSE_IN_S5 0x000C
7691172
7701173 /*****************************************************************************/
7711174 /* List the features supported by the firmware */
772−#define EC_CMD_GET_FEATURES 0x0d
1175+#define EC_CMD_GET_FEATURES 0x000D
7731176
7741177 /* Supported features */
7751178 enum ec_feature_code {
@@ -876,24 +1279,36 @@ enum ec_feature_code { · 100 unmodified lines
8761279 EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37,
8771280 /* EC supports audio codec. */
8781281 EC_FEATURE_AUDIO_CODEC = 38,
879− /* EC Supports SCP. */
1282+ /* The MCU is a System Companion Processor (SCP). */
8801283 EC_FEATURE_SCP = 39,
8811284 /* The MCU is an Integrated Sensor Hub */
8821285 EC_FEATURE_ISH = 40,
8831286 };
8841287
885−#define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32))
886−#define EC_FEATURE_MASK_1(event_code) (1UL << (event_code - 32))
1288+#define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32)
1289+#define EC_FEATURE_MASK_1(event_code) BIT(event_code - 32)
8871290
8881291 struct ec_response_get_features {
8891292 uint32_t flags[2];
890−} __packed;
1293+} __ec_align4;
1294+
1295+/*****************************************************************************/
1296+/* Get the board's SKU ID from EC */
1297+#define EC_CMD_GET_SKU_ID 0x000E
1298+
1299+/* Set SKU ID from AP */
1300+#define EC_CMD_SET_SKU_ID 0x000F
1301+
1302+struct ec_sku_id_info {
1303+ uint32_t sku_id;
1304+} __ec_align4;
8911305
8921306 /*****************************************************************************/
8931307 /* Flash commands */
8941308
8951309 /* Get flash info */
896−#define EC_CMD_FLASH_INFO 0x10
1310+#define EC_CMD_FLASH_INFO 0x0010
1311+#define EC_VER_FLASH_INFO 2
8971312
8981313 /**
8991314 * struct ec_response_flash_info - Response to the flash info command.
@@ -912,11 +1327,22 @@ struct ec_response_flash_info { · 12 unmodified lines
9121327 uint32_t write_block_size;
9131328 uint32_t erase_block_size;
9141329 uint32_t protect_block_size;
915−} __packed;
1330+} __ec_align4;
1331+
1332+/*
1333+ * Flags for version 1+ flash info command
1334+ * EC flash erases bits to 0 instead of 1.
1335+ */
1336+#define EC_FLASH_INFO_ERASE_TO_0 BIT(0)
9161337
917−/* Flags for version 1+ flash info command */
918−/* EC flash erases bits to 0 instead of 1 */
919−#define EC_FLASH_INFO_ERASE_TO_0 (1 << 0)
1338+/*
1339+ * Flash must be selected for read/write/erase operations to succeed. This may
1340+ * be necessary on a chip where write/erase can be corrupted by other board
1341+ * activity, or where the chip needs to enable some sort of programming voltage,
1342+ * or where the read/write/erase operations require cleanly suspending other
1343+ * chip functionality.
1344+ */
1345+#define EC_FLASH_INFO_SELECT_REQUIRED BIT(1)
9201346
9211347 /**
9221348 * struct ec_response_flash_info_1 - Response to the flash info v1 command.
@@ -938,7 +1364,14 @@ struct ec_response_flash_info { · 15 unmodified lines
9381364 * fields following.
9391365 *
9401366 * gcc anonymous structs don't seem to get along with the __packed directive;
941− * if they did we'd define the version 0 struct as a sub-struct of this one.
1367+ * if they did we'd define the version 0 structure as a sub-structure of this
1368+ * one.
1369+ *
1370+ * Version 2 supports flash banks of different sizes:
1371+ * The caller specified the number of banks it has preallocated
1372+ * (num_banks_desc)
1373+ * The EC returns the number of banks describing the flash memory.
1374+ * It adds banks descriptions up to num_banks_desc.
9421375 */
9431376 struct ec_response_flash_info_1 {
9441377 /* Version 0 fields; see above for description */
@@ -950,14 +1383,50 @@ struct ec_response_flash_info_1 { · 5 unmodified lines
9501383 /* Version 1 adds these fields: */
9511384 uint32_t write_ideal_size;
9521385 uint32_t flags;
953−} __packed;
1386+} __ec_align4;
1387+
1388+struct ec_params_flash_info_2 {
1389+ /* Number of banks to describe */
1390+ uint16_t num_banks_desc;
1391+ /* Reserved; set 0; ignore on read */
1392+ uint8_t reserved[2];
1393+} __ec_align4;
1394+
1395+struct ec_flash_bank {
1396+ /* Number of sector is in this bank. */
1397+ uint16_t count;
1398+ /* Size in power of 2 of each sector (8 --> 256 bytes) */
1399+ uint8_t size_exp;
1400+ /* Minimal write size for the sectors in this bank */
1401+ uint8_t write_size_exp;
1402+ /* Erase size for the sectors in this bank */
1403+ uint8_t erase_size_exp;
1404+ /* Size for write protection, usually identical to erase size. */
1405+ uint8_t protect_size_exp;
1406+ /* Reserved; set 0; ignore on read */
1407+ uint8_t reserved[2];
1408+};
1409+
1410+struct ec_response_flash_info_2 {
1411+ /* Total flash in the EC. */
1412+ uint32_t flash_size;
1413+ /* Flags; see EC_FLASH_INFO_* */
1414+ uint32_t flags;
1415+ /* Maximum size to use to send data to write to the EC. */
1416+ uint32_t write_ideal_size;
1417+ /* Number of banks present in the EC. */
1418+ uint16_t num_banks_total;
1419+ /* Number of banks described in banks array. */
1420+ uint16_t num_banks_desc;
1421+ struct ec_flash_bank banks[0];
1422+} __ec_align4;
9541423
9551424 /*
9561425 * Read flash
9571426 *
9581427 * Response is params.size bytes of data.
9591428 */
960−#define EC_CMD_FLASH_READ 0x11
1429+#define EC_CMD_FLASH_READ 0x0011
9611430
9621431 /**
9631432 * struct ec_params_flash_read - Parameters for the flash read command.
@@ -967,10 +1436,10 @@ struct ec_response_flash_info_1 { · 3 unmodified lines
9671436 struct ec_params_flash_read {
9681437 uint32_t offset;
9691438 uint32_t size;
970−} __packed;
1439+} __ec_align4;
9711440
9721441 /* Write flash */
973−#define EC_CMD_FLASH_WRITE 0x12
1442+#define EC_CMD_FLASH_WRITE 0x0012
9741443 #define EC_VER_FLASH_WRITE 1
9751444
9761445 /* Version 0 of the flash command supported only 64 bytes of data */
@@ -985,20 +1454,57 @@ struct ec_params_flash_write { · 8 unmodified lines
9851454 uint32_t offset;
9861455 uint32_t size;
9871456 /* Followed by data to write */
988−} __packed;
1457+} __ec_align4;
9891458
9901459 /* Erase flash */
991−#define EC_CMD_FLASH_ERASE 0x13
1460+#define EC_CMD_FLASH_ERASE 0x0013
9921461
9931462 /**
994− * struct ec_params_flash_erase - Parameters for the flash erase command.
1463+ * struct ec_params_flash_erase - Parameters for the flash erase command, v0.
9951464 * @offset: Byte offset to erase.
9961465 * @size: Size to erase in bytes.
9971466 */
9981467 struct ec_params_flash_erase {
9991468 uint32_t offset;
10001469 uint32_t size;
1001−} __packed;
1470+} __ec_align4;
1471+
1472+/*
1473+ * v1 add async erase:
1474+ * subcommands can returns:
1475+ * EC_RES_SUCCESS : erased (see ERASE_SECTOR_ASYNC case below).
1476+ * EC_RES_INVALID_PARAM : offset/size are not aligned on a erase boundary.
1477+ * EC_RES_ERROR : other errors.
1478+ * EC_RES_BUSY : an existing erase operation is in progress.
1479+ * EC_RES_ACCESS_DENIED: Trying to erase running image.
1480+ *
1481+ * When ERASE_SECTOR_ASYNC returns EC_RES_SUCCESS, the operation is just
1482+ * properly queued. The user must call ERASE_GET_RESULT subcommand to get
1483+ * the proper result.
1484+ * When ERASE_GET_RESULT returns EC_RES_BUSY, the caller must wait and send
1485+ * ERASE_GET_RESULT again to get the result of ERASE_SECTOR_ASYNC.
1486+ * ERASE_GET_RESULT command may timeout on EC where flash access is not
1487+ * permitted while erasing. (For instance, STM32F4).
1488+ */
1489+enum ec_flash_erase_cmd {
1490+ FLASH_ERASE_SECTOR, /* Erase and wait for result */
1491+ FLASH_ERASE_SECTOR_ASYNC, /* Erase and return immediately. */
1492+ FLASH_ERASE_GET_RESULT, /* Ask for last erase result */
1493+};
1494+
1495+/**
1496+ * struct ec_params_flash_erase_v1 - Parameters for the flash erase command, v1.
1497+ * @cmd: One of ec_flash_erase_cmd.
1498+ * @reserved: Pad byte; currently always contains 0.
1499+ * @flag: No flags defined yet; set to 0.
1500+ * @params: Same as v0 parameters.
1501+ */
1502+struct ec_params_flash_erase_v1 {
1503+ uint8_t cmd;
1504+ uint8_t reserved;
1505+ uint16_t flag;
1506+ struct ec_params_flash_erase params;
1507+} __ec_align4;
10021508
10031509 /*
10041510 * Get/set flash protection.
@@ -1010,31 +1516,40 @@ struct ec_params_flash_erase { · 5 unmodified lines
10101516 *
10111517 * If mask=0, simply returns the current flags state.
10121518 */
1013−#define EC_CMD_FLASH_PROTECT 0x15
1519+#define EC_CMD_FLASH_PROTECT 0x0015
10141520 #define EC_VER_FLASH_PROTECT 1 /* Command version 1 */
10151521
10161522 /* Flags for flash protection */
10171523 /* RO flash code protected when the EC boots */
1018−#define EC_FLASH_PROTECT_RO_AT_BOOT (1 << 0)
1524+#define EC_FLASH_PROTECT_RO_AT_BOOT BIT(0)
10191525 /*
10201526 * RO flash code protected now. If this bit is set, at-boot status cannot
10211527 * be changed.
10221528 */
1023−#define EC_FLASH_PROTECT_RO_NOW (1 << 1)
1529+#define EC_FLASH_PROTECT_RO_NOW BIT(1)
10241530 /* Entire flash code protected now, until reboot. */
1025−#define EC_FLASH_PROTECT_ALL_NOW (1 << 2)
1531+#define EC_FLASH_PROTECT_ALL_NOW BIT(2)
10261532 /* Flash write protect GPIO is asserted now */
1027−#define EC_FLASH_PROTECT_GPIO_ASSERTED (1 << 3)
1533+#define EC_FLASH_PROTECT_GPIO_ASSERTED BIT(3)
10281534 /* Error - at least one bank of flash is stuck locked, and cannot be unlocked */
1029−#define EC_FLASH_PROTECT_ERROR_STUCK (1 << 4)
1535+#define EC_FLASH_PROTECT_ERROR_STUCK BIT(4)
10301536 /*
10311537 * Error - flash protection is in inconsistent state. At least one bank of
10321538 * flash which should be protected is not protected. Usually fixed by
10331539 * re-requesting the desired flags, or by a hard reset if that fails.
10341540 */
1035−#define EC_FLASH_PROTECT_ERROR_INCONSISTENT (1 << 5)
1036−/* Entile flash code protected when the EC boots */
1037−#define EC_FLASH_PROTECT_ALL_AT_BOOT (1 << 6)
1541+#define EC_FLASH_PROTECT_ERROR_INCONSISTENT BIT(5)
1542+/* Entire flash code protected when the EC boots */
1543+#define EC_FLASH_PROTECT_ALL_AT_BOOT BIT(6)
1544+/* RW flash code protected when the EC boots */
1545+#define EC_FLASH_PROTECT_RW_AT_BOOT BIT(7)
1546+/* RW flash code protected now. */
1547+#define EC_FLASH_PROTECT_RW_NOW BIT(8)
1548+/* Rollback information flash region protected when the EC boots */
1549+#define EC_FLASH_PROTECT_ROLLBACK_AT_BOOT BIT(9)
1550+/* Rollback information flash region protected now */
1551+#define EC_FLASH_PROTECT_ROLLBACK_NOW BIT(10)
1552+
10381553
10391554 /**
10401555 * struct ec_params_flash_protect - Parameters for the flash protect command.
@@ -1044,7 +1559,7 @@ struct ec_params_flash_erase { · 3 unmodified lines
10441559 struct ec_params_flash_protect {
10451560 uint32_t mask;
10461561 uint32_t flags;
1047−} __packed;
1562+} __ec_align4;
10481563
10491564 /**
10501565 * struct ec_response_flash_protect - Response to the flash protect command.
@@ -1059,7 +1574,7 @@ struct ec_response_flash_protect { · 8 unmodified lines
10591574 uint32_t flags;
10601575 uint32_t valid_flags;
10611576 uint32_t writable_flags;
1062−} __packed;
1577+} __ec_align4;
10631578
10641579 /*
10651580 * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash
@@ -1067,22 +1582,37 @@ struct ec_response_flash_protect { · 1 unmodified line
10671582 */
10681583
10691584 /* Get the region offset/size */
1070−#define EC_CMD_FLASH_REGION_INFO 0x16
1585+#define EC_CMD_FLASH_REGION_INFO 0x0016
10711586 #define EC_VER_FLASH_REGION_INFO 1
10721587
10731588 enum ec_flash_region {
10741589 /* Region which holds read-only EC image */
10751590 EC_FLASH_REGION_RO = 0,
1076− /* Region which holds rewritable EC image */
1077− EC_FLASH_REGION_RW,
1591+ /*
1592+ * Region which holds active RW image. 'Active' is different from
1593+ * 'running'. Active means 'scheduled-to-run'. Since RO image always
1594+ * scheduled to run, active/non-active applies only to RW images (for
1595+ * the same reason 'update' applies only to RW images. It's a state of
1596+ * an image on a flash. Running image can be RO, RW_A, RW_B but active
1597+ * image can only be RW_A or RW_B. In recovery mode, an active RW image
1598+ * doesn't enter 'running' state but it's still active on a flash.
1599+ */
1600+ EC_FLASH_REGION_ACTIVE,
10781601 /*
10791602 * Region which should be write-protected in the factory (a superset of
10801603 * EC_FLASH_REGION_RO)
10811604 */
10821605 EC_FLASH_REGION_WP_RO,
1606+ /* Region which holds updatable (non-active) RW image */
1607+ EC_FLASH_REGION_UPDATE,
10831608 /* Number of regions */
10841609 EC_FLASH_REGION_COUNT,
10851610 };
1611+/*
1612+ * 'RW' is vague if there are multiple RW images; we mean the active one,
1613+ * so the old constant is deprecated.
1614+ */
1615+#define EC_FLASH_REGION_RW EC_FLASH_REGION_ACTIVE
10861616
10871617 /**
10881618 * struct ec_params_flash_region_info - Parameters for the flash region info
@@ -1091,15 +1621,15 @@ enum ec_flash_region { · 2 unmodified lines
10911621 */
10921622 struct ec_params_flash_region_info {
10931623 uint32_t region;
1094−} __packed;
1624+} __ec_align4;
10951625
10961626 struct ec_response_flash_region_info {
10971627 uint32_t offset;
10981628 uint32_t size;
1099−} __packed;
1629+} __ec_align4;
11001630
11011631 /* Read/write VbNvContext */
1102−#define EC_CMD_VBNV_CONTEXT 0x17
1632+#define EC_CMD_VBNV_CONTEXT 0x0017
11031633 #define EC_VER_VBNV_CONTEXT 1
11041634 #define EC_VBNV_BLOCK_SIZE 16
11051635
@@ -1111,52 +1641,99 @@ enum ec_vbnvcontext_op { · 5 unmodified lines
11111641 struct ec_params_vbnvcontext {
11121642 uint32_t op;
11131643 uint8_t block[EC_VBNV_BLOCK_SIZE];
1114−} __packed;
1644+} __ec_align4;
11151645
11161646 struct ec_response_vbnvcontext {
11171647 uint8_t block[EC_VBNV_BLOCK_SIZE];
1118−} __packed;
1648+} __ec_align4;
1649+
1650+
1651+/* Get SPI flash information */
1652+#define EC_CMD_FLASH_SPI_INFO 0x0018
1653+
1654+struct ec_response_flash_spi_info {
1655+ /* JEDEC info from command 0x9F (manufacturer, memory type, size) */
1656+ uint8_t jedec[3];
1657+
1658+ /* Pad byte; currently always contains 0 */
1659+ uint8_t reserved0;
1660+
1661+ /* Manufacturer / device ID from command 0x90 */
1662+ uint8_t mfr_dev_id[2];
1663+
1664+ /* Status registers from command 0x05 and 0x35 */
1665+ uint8_t sr1, sr2;
1666+} __ec_align1;
1667+
1668+
1669+/* Select flash during flash operations */
1670+#define EC_CMD_FLASH_SELECT 0x0019
1671+
1672+/**
1673+ * struct ec_params_flash_select - Parameters for the flash select command.
1674+ * @select: 1 to select flash, 0 to deselect flash
1675+ */
1676+struct ec_params_flash_select {
1677+ uint8_t select;
1678+} __ec_align4;
1679+
11191680
11201681 /*****************************************************************************/
11211682 /* PWM commands */
11221683
11231684 /* Get fan target RPM */
1124−#define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x20
1685+#define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x0020
11251686
11261687 struct ec_response_pwm_get_fan_rpm {
11271688 uint32_t rpm;
1128−} __packed;
1689+} __ec_align4;
11291690
11301691 /* Set target fan RPM */
1131−#define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x21
1692+#define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x0021
1693+
1694+/* Version 0 of input params */
1695+struct ec_params_pwm_set_fan_target_rpm_v0 {
1696+ uint32_t rpm;
1697+} __ec_align4;
11321698
1133−struct ec_params_pwm_set_fan_target_rpm {
1699+/* Version 1 of input params */
1700+struct ec_params_pwm_set_fan_target_rpm_v1 {
11341701 uint32_t rpm;
1135−} __packed;
1702+ uint8_t fan_idx;
1703+} __ec_align_size1;
11361704
11371705 /* Get keyboard backlight */
1138−#define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x22
1706+/* OBSOLETE - Use EC_CMD_PWM_SET_DUTY */
1707+#define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x0022
11391708
11401709 struct ec_response_pwm_get_keyboard_backlight {
11411710 uint8_t percent;
11421711 uint8_t enabled;
1143−} __packed;
1712+} __ec_align1;
11441713
11451714 /* Set keyboard backlight */
1146−#define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x23
1715+/* OBSOLETE - Use EC_CMD_PWM_SET_DUTY */
1716+#define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x0023
11471717
11481718 struct ec_params_pwm_set_keyboard_backlight {
11491719 uint8_t percent;
1150−} __packed;
1720+} __ec_align1;
11511721
11521722 /* Set target fan PWM duty cycle */
1153−#define EC_CMD_PWM_SET_FAN_DUTY 0x24
1723+#define EC_CMD_PWM_SET_FAN_DUTY 0x0024
1724+
1725+/* Version 0 of input params */
1726+struct ec_params_pwm_set_fan_duty_v0 {
1727+ uint32_t percent;
1728+} __ec_align4;
11541729
1155−struct ec_params_pwm_set_fan_duty {
1730+/* Version 1 of input params */
1731+struct ec_params_pwm_set_fan_duty_v1 {
11561732 uint32_t percent;
1157−} __packed;
1733+ uint8_t fan_idx;
1734+} __ec_align_size1;
11581735
1159−#define EC_CMD_PWM_SET_DUTY 0x25
1736+#define EC_CMD_PWM_SET_DUTY 0x0025
11601737 /* 16 bit duty cycle, 0xffff = 100% */
11611738 #define EC_PWM_MAX_DUTY 0xffff
11621739
@@ -1174,18 +1751,18 @@ struct ec_params_pwm_set_duty { · 11 unmodified lines
11741751 uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */
11751752 uint8_t pwm_type; /* ec_pwm_type */
11761753 uint8_t index; /* Type-specific index, or 0 if unique */
1177−} __packed;
1754+} __ec_align4;
11781755
1179−#define EC_CMD_PWM_GET_DUTY 0x26
1756+#define EC_CMD_PWM_GET_DUTY 0x0026
11801757
11811758 struct ec_params_pwm_get_duty {
11821759 uint8_t pwm_type; /* ec_pwm_type */
11831760 uint8_t index; /* Type-specific index, or 0 if unique */
1184−} __packed;
1761+} __ec_align1;
11851762
11861763 struct ec_response_pwm_get_duty {
11871764 uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */
1188−} __packed;
1765+} __ec_align2;
11891766
11901767 /*****************************************************************************/
11911768 /*
@@ -1194,11 +1771,11 @@ struct ec_response_pwm_get_duty { · 2 unmodified lines
11941771 * into a subcommand. We'll make separate structs for subcommands with
11951772 * different input args, so that we know how much to expect.
11961773 */
1197−#define EC_CMD_LIGHTBAR_CMD 0x28
1774+#define EC_CMD_LIGHTBAR_CMD 0x0028
11981775
11991776 struct rgb_s {
12001777 uint8_t r, g, b;
1201−};
1778+} __ec_todo_unpacked;
12021779
12031780 #define LB_BATTERY_LEVELS 4
12041781
@@ -1238,7 +1815,7 @@ struct lightbar_params_v0 { · 33 unmodified lines
12381815
12391816 /* Color palette */
12401817 struct rgb_s color[8]; /* 0-3 are Google colors */
1241−} __packed;
1818+} __ec_todo_packed;
12421819
12431820 struct lightbar_params_v1 {
12441821 /* Timing */
@@ -1251,7 +1828,10 @@ struct lightbar_params_v1 { · 6 unmodified lines
12511828 int32_t s3_sleep_for;
12521829 int32_t s3_ramp_up;
12531830 int32_t s3_ramp_down;
1831+ int32_t s5_ramp_up;
1832+ int32_t s5_ramp_down;
12541833 int32_t tap_tick_delay;
1834+ int32_t tap_gate_delay;
12551835 int32_t tap_display_time;
12561836
12571837 /* Tap-for-battery params */
@@ -1279,84 +1859,182 @@ struct lightbar_params_v1 { · 21 unmodified lines
12791859 uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */
12801860 uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */
12811861
1862+ /* s5: single color pulse on inhibited power-up */
1863+ uint8_t s5_idx;
1864+
12821865 /* Color palette */
12831866 struct rgb_s color[8]; /* 0-3 are Google colors */
1284−} __packed;
1867+} __ec_todo_packed;
12851868
1286−/* Lightbar program */
1287−#define EC_LB_PROG_LEN 192
1869+/* Lightbar command params v2
1870+ * crbug.com/467716
1871+ *
1872+ * lightbar_parms_v1 was too big for i2c, therefore in v2, we split them up by
1873+ * logical groups to make it more manageable ( < 120 bytes).
1874+ *
1875+ * NOTE: Each of these groups must be less than 120 bytes.
1876+ */
1877+
1878+struct lightbar_params_v2_timing {
1879+ /* Timing */
1880+ int32_t google_ramp_up;
1881+ int32_t google_ramp_down;
1882+ int32_t s3s0_ramp_up;
1883+ int32_t s0_tick_delay[2]; /* AC=0/1 */
1884+ int32_t s0a_tick_delay[2]; /* AC=0/1 */
1885+ int32_t s0s3_ramp_down;
1886+ int32_t s3_sleep_for;
1887+ int32_t s3_ramp_up;
1888+ int32_t s3_ramp_down;
1889+ int32_t s5_ramp_up;
1890+ int32_t s5_ramp_down;
1891+ int32_t tap_tick_delay;
1892+ int32_t tap_gate_delay;
1893+ int32_t tap_display_time;
1894+} __ec_todo_packed;
1895+
1896+struct lightbar_params_v2_tap {
1897+ /* Tap-for-battery params */
1898+ uint8_t tap_pct_red;
1899+ uint8_t tap_pct_green;
1900+ uint8_t tap_seg_min_on;
1901+ uint8_t tap_seg_max_on;
1902+ uint8_t tap_seg_osc;
1903+ uint8_t tap_idx[3];
1904+} __ec_todo_packed;
1905+
1906+struct lightbar_params_v2_oscillation {
1907+ /* Oscillation */
1908+ uint8_t osc_min[2]; /* AC=0/1 */
1909+ uint8_t osc_max[2]; /* AC=0/1 */
1910+ uint8_t w_ofs[2]; /* AC=0/1 */
1911+} __ec_todo_packed;
1912+
1913+struct lightbar_params_v2_brightness {
1914+ /* Brightness limits based on the backlight and AC. */
1915+ uint8_t bright_bl_off_fixed[2]; /* AC=0/1 */
1916+ uint8_t bright_bl_on_min[2]; /* AC=0/1 */
1917+ uint8_t bright_bl_on_max[2]; /* AC=0/1 */
1918+} __ec_todo_packed;
1919+
1920+struct lightbar_params_v2_thresholds {
1921+ /* Battery level thresholds */
1922+ uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
1923+} __ec_todo_packed;
1924+
1925+struct lightbar_params_v2_colors {
1926+ /* Map [AC][battery_level] to color index */
1927+ uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */
1928+ uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */
1929+
1930+ /* s5: single color pulse on inhibited power-up */
1931+ uint8_t s5_idx;
1932+
1933+ /* Color palette */
1934+ struct rgb_s color[8]; /* 0-3 are Google colors */
1935+} __ec_todo_packed;
1936+
1937+/* Lightbar program. */
1938+#define EC_LB_PROG_LEN 192
12881939 struct lightbar_program {
12891940 uint8_t size;
12901941 uint8_t data[EC_LB_PROG_LEN];
1291−};
1942+} __ec_todo_unpacked;
12921943
12931944 struct ec_params_lightbar {
12941945 uint8_t cmd; /* Command (see enum lightbar_command) */
12951946 union {
1296− struct {
1297− /* no args */
1298− } dump, off, on, init, get_seq, get_params_v0, get_params_v1,
1299− version, get_brightness, get_demo, suspend, resume;
1947+ /*
1948+ * The following commands have no args:
1949+ *
1950+ * dump, off, on, init, get_seq, get_params_v0, get_params_v1,
1951+ * version, get_brightness, get_demo, suspend, resume,
1952+ * get_params_v2_timing, get_params_v2_tap, get_params_v2_osc,
1953+ * get_params_v2_bright, get_params_v2_thlds,
1954+ * get_params_v2_colors
1955+ *
1956+ * Don't use an empty struct, because C++ hates that.
1957+ */
13001958
1301− struct {
1959+ struct __ec_todo_unpacked {
13021960 uint8_t num;
13031961 } set_brightness, seq, demo;
13041962
1305− struct {
1963+ struct __ec_todo_unpacked {
13061964 uint8_t ctrl, reg, value;
13071965 } reg;
13081966
1309− struct {
1967+ struct __ec_todo_unpacked {
13101968 uint8_t led, red, green, blue;
13111969 } set_rgb;
13121970
1313− struct {
1971+ struct __ec_todo_unpacked {
13141972 uint8_t led;
13151973 } get_rgb;
13161974
1317− struct {
1975+ struct __ec_todo_unpacked {
13181976 uint8_t enable;
13191977 } manual_suspend_ctrl;
13201978
13211979 struct lightbar_params_v0 set_params_v0;
13221980 struct lightbar_params_v1 set_params_v1;
1981+
1982+ struct lightbar_params_v2_timing set_v2par_timing;
1983+ struct lightbar_params_v2_tap set_v2par_tap;
1984+ struct lightbar_params_v2_oscillation set_v2par_osc;
1985+ struct lightbar_params_v2_brightness set_v2par_bright;
1986+ struct lightbar_params_v2_thresholds set_v2par_thlds;
1987+ struct lightbar_params_v2_colors set_v2par_colors;
1988+
13231989 struct lightbar_program set_program;
13241990 };
1325−} __packed;
1991+} __ec_todo_packed;
13261992
13271993 struct ec_response_lightbar {
13281994 union {
1329− struct {
1330− struct {
1995+ struct __ec_todo_unpacked {
1996+ struct __ec_todo_unpacked {
13311997 uint8_t reg;
13321998 uint8_t ic0;
13331999 uint8_t ic1;
13342000 } vals[23];
13352001 } dump;
13362002
1337− struct {
2003+ struct __ec_todo_unpacked {
13382004 uint8_t num;
13392005 } get_seq, get_brightness, get_demo;
13402006
13412007 struct lightbar_params_v0 get_params_v0;
13422008 struct lightbar_params_v1 get_params_v1;
13432009
1344− struct {
2010+
2011+ struct lightbar_params_v2_timing get_params_v2_timing;
2012+ struct lightbar_params_v2_tap get_params_v2_tap;
2013+ struct lightbar_params_v2_oscillation get_params_v2_osc;
2014+ struct lightbar_params_v2_brightness get_params_v2_bright;
2015+ struct lightbar_params_v2_thresholds get_params_v2_thlds;
2016+ struct lightbar_params_v2_colors get_params_v2_colors;
2017+
2018+ struct __ec_todo_unpacked {
13452019 uint32_t num;
13462020 uint32_t flags;
13472021 } version;
13482022
1349− struct {
2023+ struct __ec_todo_unpacked {
13502024 uint8_t red, green, blue;
13512025 } get_rgb;
13522026
1353− struct {
1354− /* no return params */
1355− } off, on, init, set_brightness, seq, reg, set_rgb,
1356− demo, set_params_v0, set_params_v1,
1357− set_program, manual_suspend_ctrl, suspend, resume;
2027+ /*
2028+ * The following commands have no response:
2029+ *
2030+ * off, on, init, set_brightness, seq, reg, set_rgb, demo,
2031+ * set_params_v0, set_params_v1, set_program,
2032+ * manual_suspend_ctrl, suspend, resume, set_v2par_timing,
2033+ * set_v2par_tap, set_v2par_osc, set_v2par_bright,
2034+ * set_v2par_thlds, set_v2par_colors
2035+ */
13582036 };
1359−} __packed;
2037+} __ec_todo_packed;
13602038
13612039 /* Lightbar commands */
13622040 enum lightbar_command {
@@ -1382,13 +2060,25 @@ enum lightbar_command { · 19 unmodified lines
13822060 LIGHTBAR_CMD_MANUAL_SUSPEND_CTRL = 19,
13832061 LIGHTBAR_CMD_SUSPEND = 20,
13842062 LIGHTBAR_CMD_RESUME = 21,
2063+ LIGHTBAR_CMD_GET_PARAMS_V2_TIMING = 22,
2064+ LIGHTBAR_CMD_SET_PARAMS_V2_TIMING = 23,
2065+ LIGHTBAR_CMD_GET_PARAMS_V2_TAP = 24,
2066+ LIGHTBAR_CMD_SET_PARAMS_V2_TAP = 25,
2067+ LIGHTBAR_CMD_GET_PARAMS_V2_OSCILLATION = 26,
2068+ LIGHTBAR_CMD_SET_PARAMS_V2_OSCILLATION = 27,
2069+ LIGHTBAR_CMD_GET_PARAMS_V2_BRIGHTNESS = 28,
2070+ LIGHTBAR_CMD_SET_PARAMS_V2_BRIGHTNESS = 29,
2071+ LIGHTBAR_CMD_GET_PARAMS_V2_THRESHOLDS = 30,
2072+ LIGHTBAR_CMD_SET_PARAMS_V2_THRESHOLDS = 31,
2073+ LIGHTBAR_CMD_GET_PARAMS_V2_COLORS = 32,
2074+ LIGHTBAR_CMD_SET_PARAMS_V2_COLORS = 33,
13852075 LIGHTBAR_NUM_CMDS
13862076 };
13872077
13882078 /*****************************************************************************/
13892079 /* LED control commands */
13902080
1391−#define EC_CMD_LED_CONTROL 0x29
2081+#define EC_CMD_LED_CONTROL 0x0029
13922082
13932083 enum ec_led_id {
13942084 /* LED to indicate battery state of charge */
@@ -1400,13 +2090,21 @@ enum ec_led_id { · 5 unmodified lines
14002090 EC_LED_ID_POWER_LED,
14012091 /* LED on power adapter or its plug */
14022092 EC_LED_ID_ADAPTER_LED,
2093+ /* LED to indicate left side */
2094+ EC_LED_ID_LEFT_LED,
2095+ /* LED to indicate right side */
2096+ EC_LED_ID_RIGHT_LED,
2097+ /* LED to indicate recovery mode with HW_REINIT */
2098+ EC_LED_ID_RECOVERY_HW_REINIT_LED,
2099+ /* LED to indicate sysrq debug mode. */
2100+ EC_LED_ID_SYSRQ_DEBUG_LED,
14032101
14042102 EC_LED_ID_COUNT
14052103 };
14062104
14072105 /* LED control flags */
1408−#define EC_LED_FLAGS_QUERY (1 << 0) /* Query LED capability only */
1409−#define EC_LED_FLAGS_AUTO (1 << 1) /* Switch LED back to automatic control */
2106+#define EC_LED_FLAGS_QUERY BIT(0) /* Query LED capability only */
2107+#define EC_LED_FLAGS_AUTO BIT(1) /* Switch LED back to automatic control */
14102108
14112109 enum ec_led_colors {
14122110 EC_LED_COLOR_RED = 0,
@@ -1414,6 +2112,7 @@ enum ec_led_colors { · 1 unmodified line
14142112 EC_LED_COLOR_BLUE,
14152113 EC_LED_COLOR_YELLOW,
14162114 EC_LED_COLOR_WHITE,
2115+ EC_LED_COLOR_AMBER,
14172116
14182117 EC_LED_COLOR_COUNT
14192118 };
@@ -1423,7 +2122,7 @@ struct ec_params_led_control { · 3 unmodified lines
14232122 uint8_t flags; /* Control flags */
14242123
14252124 uint8_t brightness[EC_LED_COLOR_COUNT];
1426−} __packed;
2125+} __ec_align1;
14272126
14282127 struct ec_response_led_control {
14292128 /*
@@ -1434,7 +2133,7 @@ struct ec_response_led_control { · 4 unmodified lines
14342133 * Other values means the LED is control by PWM.
14352134 */
14362135 uint8_t brightness_range[EC_LED_COLOR_COUNT];
1437−} __packed;
2136+} __ec_align1;
14382137
14392138 /*****************************************************************************/
14402139 /* Verified boot commands */
@@ -1445,7 +2144,7 @@ struct ec_response_led_control { · 4 unmodified lines
14452144 */
14462145
14472146 /* Verified boot hash command */
1448−#define EC_CMD_VBOOT_HASH 0x2A
2147+#define EC_CMD_VBOOT_HASH 0x002A
14492148
14502149 struct ec_params_vboot_hash {
14512150 uint8_t cmd; /* enum ec_vboot_hash_cmd */
@@ -1455,7 +2154,7 @@ struct ec_params_vboot_hash { · 3 unmodified lines
14552154 uint32_t offset; /* Offset in flash to hash */
14562155 uint32_t size; /* Number of bytes to hash */
14572156 uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */
1458−} __packed;
2157+} __ec_align4;
14592158
14602159 struct ec_response_vboot_hash {
14612160 uint8_t status; /* enum ec_vboot_hash_status */
@@ -1465,7 +2164,7 @@ struct ec_response_vboot_hash { · 3 unmodified lines
14652164 uint32_t offset; /* Offset in flash which was hashed */
14662165 uint32_t size; /* Number of bytes hashed */
14672166 uint8_t hash_digest[64]; /* Hash digest data */
1468−} __packed;
2167+} __ec_align4;
14692168
14702169 enum ec_vboot_hash_cmd {
14712170 EC_VBOOT_HASH_GET = 0, /* Get current hash status */
@@ -1489,15 +2188,22 @@ enum ec_vboot_hash_status { · 17 unmodified lines
14892188 * If one of these is specified, the EC will automatically update offset and
14902189 * size to the correct values for the specified image (RO or RW).
14912190 */
1492−#define EC_VBOOT_HASH_OFFSET_RO 0xfffffffe
1493−#define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd
2191+#define EC_VBOOT_HASH_OFFSET_RO 0xfffffffe
2192+#define EC_VBOOT_HASH_OFFSET_ACTIVE 0xfffffffd
2193+#define EC_VBOOT_HASH_OFFSET_UPDATE 0xfffffffc
2194+
2195+/*
2196+ * 'RW' is vague if there are multiple RW images; we mean the active one,
2197+ * so the old constant is deprecated.
2198+ */
2199+#define EC_VBOOT_HASH_OFFSET_RW EC_VBOOT_HASH_OFFSET_ACTIVE
14942200
14952201 /*****************************************************************************/
14962202 /*
14972203 * Motion sense commands. We'll make separate structs for sub-commands with
14982204 * different input args, so that we know how much to expect.
14992205 */
1500−#define EC_CMD_MOTION_SENSE_CMD 0x2B
2206+#define EC_CMD_MOTION_SENSE_CMD 0x002B
15012207
15022208 /* Motion sense commands */
15032209 enum motionsense_command {
@@ -1516,7 +2222,13 @@ enum motionsense_command { · 12 unmodified lines
15162222
15172223 /*
15182224 * EC Rate command is a setter/getter command for the EC sampling rate
1519− * of all motion sensors in milliseconds.
2225+ * in milliseconds.
2226+ * It is per sensor, the EC run sample task at the minimum of all
2227+ * sensors EC_RATE.
2228+ * For sensors without hardware FIFO, EC_RATE should be equals to 1/ODR
2229+ * to collect all the sensor samples.
2230+ * For sensor with hardware FIFO, EC_RATE is used as the maximal delay
2231+ * to process of all motion sensors in milliseconds.
15202232 */
15212233 MOTIONSENSE_CMD_EC_RATE = 2,
15222234
@@ -1547,32 +2259,76 @@ enum motionsense_command { · 24 unmodified lines
15472259 MOTIONSENSE_CMD_DATA = 6,
15482260
15492261 /*
1550− * Perform low level calibration.. On sensors that support it, ask to
1551− * do offset calibration.
2262+ * Return sensor fifo info.
2263+ */
2264+ MOTIONSENSE_CMD_FIFO_INFO = 7,
2265+
2266+ /*
2267+ * Insert a flush element in the fifo and return sensor fifo info.
2268+ * The host can use that element to synchronize its operation.
2269+ */
2270+ MOTIONSENSE_CMD_FIFO_FLUSH = 8,
2271+
2272+ /*
2273+ * Return a portion of the fifo.
2274+ */
2275+ MOTIONSENSE_CMD_FIFO_READ = 9,
2276+
2277+ /*
2278+ * Perform low level calibration.
2279+ * On sensors that support it, ask to do offset calibration.
15522280 */
15532281 MOTIONSENSE_CMD_PERFORM_CALIB = 10,
15542282
15552283 /*
1556− * Sensor Offset command is a setter/getter command for the offset used
1557− * for calibration. The offsets can be calculated by the host, or via
2284+ * Sensor Offset command is a setter/getter command for the offset
2285+ * used for calibration.
2286+ * The offsets can be calculated by the host, or via
15582287 * PERFORM_CALIB command.
15592288 */
15602289 MOTIONSENSE_CMD_SENSOR_OFFSET = 11,
15612290
1562− /* Number of motionsense sub-commands. */
1563− MOTIONSENSE_NUM_CMDS
1564−};
2291+ /*
2292+ * List available activities for a MOTION sensor.
2293+ * Indicates if they are enabled or disabled.
2294+ */
2295+ MOTIONSENSE_CMD_LIST_ACTIVITIES = 12,
2296+
2297+ /*
2298+ * Activity management
2299+ * Enable/Disable activity recognition.
2300+ */
2301+ MOTIONSENSE_CMD_SET_ACTIVITY = 13,
2302+
2303+ /*
2304+ * Lid Angle
2305+ */
2306+ MOTIONSENSE_CMD_LID_ANGLE = 14,
2307+
2308+ /*
2309+ * Allow the FIFO to trigger interrupt via MKBP events.
2310+ * By default the FIFO does not send interrupt to process the FIFO
2311+ * until the AP is ready or it is coming from a wakeup sensor.
2312+ */
2313+ MOTIONSENSE_CMD_FIFO_INT_ENABLE = 15,
15652314
1566−enum motionsensor_id {
1567− EC_MOTION_SENSOR_ACCEL_BASE = 0,
1568− EC_MOTION_SENSOR_ACCEL_LID = 1,
1569− EC_MOTION_SENSOR_GYRO = 2,
2315+ /*
2316+ * Spoof the readings of the sensors. The spoofed readings can be set
2317+ * to arbitrary values, or will lock to the last read actual values.
2318+ */
2319+ MOTIONSENSE_CMD_SPOOF = 16,
2320+
2321+ /* Set lid angle for tablet mode detection. */
2322+ MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE = 17,
15702323
15712324 /*
1572− * Note, if more sensors are added and this count changes, the padding
1573− * in ec_response_motion_sense dump command must be modified.
2325+ * Sensor Scale command is a setter/getter command for the calibration
2326+ * scale.
15742327 */
1575− EC_MOTION_SENSOR_COUNT = 3
2328+ MOTIONSENSE_CMD_SENSOR_SCALE = 18,
2329+
2330+ /* Number of motionsense sub-commands. */
2331+ MOTIONSENSE_NUM_CMDS
15762332 };
15772333
15782334 /* List of motion sensor types. */
@@ -1584,6 +2340,7 @@ enum motionsensor_type { · 5 unmodified lines
15842340 MOTIONSENSE_TYPE_LIGHT = 4,
15852341 MOTIONSENSE_TYPE_ACTIVITY = 5,
15862342 MOTIONSENSE_TYPE_BARO = 6,
2343+ MOTIONSENSE_TYPE_SYNC = 7,
15872344 MOTIONSENSE_TYPE_MAX,
15882345 };
15892346
@@ -1591,19 +2348,116 @@ enum motionsensor_type { · 1 unmodified line
15912348 enum motionsensor_location {
15922349 MOTIONSENSE_LOC_BASE = 0,
15932350 MOTIONSENSE_LOC_LID = 1,
2351+ MOTIONSENSE_LOC_CAMERA = 2,
15942352 MOTIONSENSE_LOC_MAX,
15952353 };
15962354
15972355 /* List of motion sensor chips. */
15982356 enum motionsensor_chip {
15992357 MOTIONSENSE_CHIP_KXCJ9 = 0,
2358+ MOTIONSENSE_CHIP_LSM6DS0 = 1,
2359+ MOTIONSENSE_CHIP_BMI160 = 2,
2360+ MOTIONSENSE_CHIP_SI1141 = 3,
2361+ MOTIONSENSE_CHIP_SI1142 = 4,
2362+ MOTIONSENSE_CHIP_SI1143 = 5,
2363+ MOTIONSENSE_CHIP_KX022 = 6,
2364+ MOTIONSENSE_CHIP_L3GD20H = 7,
2365+ MOTIONSENSE_CHIP_BMA255 = 8,
2366+ MOTIONSENSE_CHIP_BMP280 = 9,
2367+ MOTIONSENSE_CHIP_OPT3001 = 10,
2368+ MOTIONSENSE_CHIP_BH1730 = 11,
2369+ MOTIONSENSE_CHIP_GPIO = 12,
2370+ MOTIONSENSE_CHIP_LIS2DH = 13,
2371+ MOTIONSENSE_CHIP_LSM6DSM = 14,
2372+ MOTIONSENSE_CHIP_LIS2DE = 15,
2373+ MOTIONSENSE_CHIP_LIS2MDL = 16,
2374+ MOTIONSENSE_CHIP_LSM6DS3 = 17,
2375+ MOTIONSENSE_CHIP_LSM6DSO = 18,
2376+ MOTIONSENSE_CHIP_LNG2DM = 19,
2377+ MOTIONSENSE_CHIP_MAX,
2378+};
2379+
2380+/* List of orientation positions */
2381+enum motionsensor_orientation {
2382+ MOTIONSENSE_ORIENTATION_LANDSCAPE = 0,
2383+ MOTIONSENSE_ORIENTATION_PORTRAIT = 1,
2384+ MOTIONSENSE_ORIENTATION_UPSIDE_DOWN_PORTRAIT = 2,
2385+ MOTIONSENSE_ORIENTATION_UPSIDE_DOWN_LANDSCAPE = 3,
2386+ MOTIONSENSE_ORIENTATION_UNKNOWN = 4,
2387+};
2388+
2389+struct ec_response_motion_sensor_data {
2390+ /* Flags for each sensor. */
2391+ uint8_t flags;
2392+ /* Sensor number the data comes from. */
2393+ uint8_t sensor_num;
2394+ /* Each sensor is up to 3-axis. */
2395+ union {
2396+ int16_t data[3];
2397+ struct __ec_todo_packed {
2398+ uint16_t reserved;
2399+ uint32_t timestamp;
2400+ };
2401+ struct __ec_todo_unpacked {
2402+ uint8_t activity; /* motionsensor_activity */
2403+ uint8_t state;
2404+ int16_t add_info[2];
2405+ };
2406+ };
2407+} __ec_todo_packed;
2408+
2409+/* Note: used in ec_response_get_next_data */
2410+struct ec_response_motion_sense_fifo_info {
2411+ /* Size of the fifo */
2412+ uint16_t size;
2413+ /* Amount of space used in the fifo */
2414+ uint16_t count;
2415+ /* Timestamp recorded in us.
2416+ * aka accurate timestamp when host event was triggered.
2417+ */
2418+ uint32_t timestamp;
2419+ /* Total amount of vector lost */
2420+ uint16_t total_lost;
2421+ /* Lost events since the last fifo_info, per sensors */
2422+ uint16_t lost[0];
2423+} __ec_todo_packed;
2424+
2425+struct ec_response_motion_sense_fifo_data {
2426+ uint32_t number_data;
2427+ struct ec_response_motion_sensor_data data[0];
2428+} __ec_todo_packed;
2429+
2430+/* List supported activity recognition */
2431+enum motionsensor_activity {
2432+ MOTIONSENSE_ACTIVITY_RESERVED = 0,
2433+ MOTIONSENSE_ACTIVITY_SIG_MOTION = 1,
2434+ MOTIONSENSE_ACTIVITY_DOUBLE_TAP = 2,
2435+ MOTIONSENSE_ACTIVITY_ORIENTATION = 3,
16002436 };
16012437
2438+struct ec_motion_sense_activity {
2439+ uint8_t sensor_num;
2440+ uint8_t activity; /* one of enum motionsensor_activity */
2441+ uint8_t enable; /* 1: enable, 0: disable */
2442+ uint8_t reserved;
2443+ uint16_t parameters[3]; /* activity dependent parameters */
2444+} __ec_todo_unpacked;
2445+
16022446 /* Module flag masks used for the dump sub-command. */
1603−#define MOTIONSENSE_MODULE_FLAG_ACTIVE (1<<0)
2447+#define MOTIONSENSE_MODULE_FLAG_ACTIVE BIT(0)
16042448
16052449 /* Sensor flag masks used for the dump sub-command. */
1606−#define MOTIONSENSE_SENSOR_FLAG_PRESENT (1<<0)
2450+#define MOTIONSENSE_SENSOR_FLAG_PRESENT BIT(0)
2451+
2452+/*
2453+ * Flush entry for synchronization.
2454+ * data contains time stamp
2455+ */
2456+#define MOTIONSENSE_SENSOR_FLAG_FLUSH BIT(0)
2457+#define MOTIONSENSE_SENSOR_FLAG_TIMESTAMP BIT(1)
2458+#define MOTIONSENSE_SENSOR_FLAG_WAKEUP BIT(2)
2459+#define MOTIONSENSE_SENSOR_FLAG_TABLET_MODE BIT(3)
2460+#define MOTIONSENSE_SENSOR_FLAG_ODR BIT(4)
16072461
16082462 /*
16092463 * Send this value for the data element to only perform a read. If you
@@ -1614,48 +2468,79 @@ enum motionsensor_chip { · 4 unmodified lines
16142468
16152469 #define EC_MOTION_SENSE_INVALID_CALIB_TEMP 0x8000
16162470
2471+/* MOTIONSENSE_CMD_SENSOR_OFFSET subcommand flag */
16172472 /* Set Calibration information */
1618−#define MOTION_SENSE_SET_OFFSET 1
2473+#define MOTION_SENSE_SET_OFFSET BIT(0)
16192474
1620−struct ec_response_motion_sensor_data {
1621− /* Flags for each sensor. */
1622− uint8_t flags;
1623− /* Sensor number the data comes from */
1624− uint8_t sensor_num;
1625− /* Each sensor is up to 3-axis. */
1626− union {
1627− int16_t data[3];
1628− struct {
1629− uint16_t rsvd;
1630− uint32_t timestamp;
1631− } __packed;
1632− struct {
1633− uint8_t activity; /* motionsensor_activity */
1634− uint8_t state;
1635− int16_t add_info[2];
1636− };
1637− };
1638−} __packed;
2475+/* Default Scale value, factor 1. */
2476+#define MOTION_SENSE_DEFAULT_SCALE BIT(15)
2477+
2478+#define LID_ANGLE_UNRELIABLE 500
2479+
2480+enum motionsense_spoof_mode {
2481+ /* Disable spoof mode. */
2482+ MOTIONSENSE_SPOOF_MODE_DISABLE = 0,
2483+
2484+ /* Enable spoof mode, but use provided component values. */
2485+ MOTIONSENSE_SPOOF_MODE_CUSTOM,
2486+
2487+ /* Enable spoof mode, but use the current sensor values. */
2488+ MOTIONSENSE_SPOOF_MODE_LOCK_CURRENT,
2489+
2490+ /* Query the current spoof mode status for the sensor. */
2491+ MOTIONSENSE_SPOOF_MODE_QUERY,
2492+};
16392493
16402494 struct ec_params_motion_sense {
16412495 uint8_t cmd;
16422496 union {
16432497 /* Used for MOTIONSENSE_CMD_DUMP. */
1644− struct {
1645− /* no args */
2498+ struct __ec_todo_unpacked {
2499+ /*
2500+ * Maximal number of sensor the host is expecting.
2501+ * 0 means the host is only interested in the number
2502+ * of sensors controlled by the EC.
2503+ */
2504+ uint8_t max_sensor_count;
16462505 } dump;
16472506
16482507 /*
1649− * Used for MOTIONSENSE_CMD_EC_RATE and
1650− * MOTIONSENSE_CMD_KB_WAKE_ANGLE.
2508+ * Used for MOTIONSENSE_CMD_KB_WAKE_ANGLE.
16512509 */
1652− struct {
1653− /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */
2510+ struct __ec_todo_unpacked {
2511+ /* Data to set or EC_MOTION_SENSE_NO_VALUE to read.
2512+ * kb_wake_angle: angle to wakup AP.
2513+ */
16542514 int16_t data;
1655− } ec_rate, kb_wake_angle;
2515+ } kb_wake_angle;
2516+
2517+ /*
2518+ * Used for MOTIONSENSE_CMD_INFO, MOTIONSENSE_CMD_DATA
2519+ * and MOTIONSENSE_CMD_PERFORM_CALIB.
2520+ */
2521+ struct __ec_todo_unpacked {
2522+ uint8_t sensor_num;
2523+ } info, info_3, data, fifo_flush, perform_calib,
2524+ list_activities;
2525+
2526+ /*
2527+ * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR
2528+ * and MOTIONSENSE_CMD_SENSOR_RANGE.
2529+ */
2530+ struct __ec_todo_unpacked {
2531+ uint8_t sensor_num;
2532+
2533+ /* Rounding flag, true for round-up, false for down. */
2534+ uint8_t roundup;
2535+
2536+ uint16_t reserved;
2537+
2538+ /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */
2539+ int32_t data;
2540+ } ec_rate, sensor_odr, sensor_range;
16562541
16572542 /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */
1658− struct {
2543+ struct __ec_todo_packed {
16592544 uint8_t sensor_num;
16602545
16612546 /*
@@ -1681,36 +2566,102 @@ struct ec_params_motion_sense { · 19 unmodified lines
16812566 * Compass: 1/16 uT
16822567 */
16832568 int16_t offset[3];
1684− } __packed sensor_offset;
2569+ } sensor_offset;
16852570
1686− /* Used for MOTIONSENSE_CMD_INFO. */
1687− struct {
2571+ /* Used for MOTIONSENSE_CMD_SENSOR_SCALE */
2572+ struct __ec_todo_packed {
16882573 uint8_t sensor_num;
1689− } info;
16902574
1691− /*
1692− * Used for MOTIONSENSE_CMD_SENSOR_ODR and
1693− * MOTIONSENSE_CMD_SENSOR_RANGE.
1694− */
1695− struct {
1696− /* Should be element of enum motionsensor_id. */
1697− uint8_t sensor_num;
2575+ /*
2576+ * bit 0: If set (MOTION_SENSE_SET_OFFSET), set
2577+ * the calibration information in the EC.
2578+ * If unset, just retrieve calibration information.
2579+ */
2580+ uint16_t flags;
16982581
1699− /* Rounding flag, true for round-up, false for down. */
1700− uint8_t roundup;
2582+ /*
2583+ * Temperature at calibration, in units of 0.01 C
2584+ * 0x8000: invalid / unknown.
2585+ * 0x0: 0C
2586+ * 0x7fff: +327.67C
2587+ */
2588+ int16_t temp;
17012589
1702− uint16_t reserved;
2590+ /*
2591+ * Scale for calibration:
2592+ * By default scale is 1, it is encoded on 16bits:
2593+ * 1 = BIT(15)
2594+ * ~2 = 0xFFFF
2595+ * ~0 = 0.
2596+ */
2597+ uint16_t scale[3];
2598+ } sensor_scale;
17032599
1704− /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */
1705− int32_t data;
1706− } sensor_odr, sensor_range;
2600+
2601+ /* Used for MOTIONSENSE_CMD_FIFO_INFO */
2602+ /* (no params) */
2603+
2604+ /* Used for MOTIONSENSE_CMD_FIFO_READ */
2605+ struct __ec_todo_unpacked {
2606+ /*
2607+ * Number of expected vector to return.
2608+ * EC may return less or 0 if none available.
2609+ */
2610+ uint32_t max_data_vector;
2611+ } fifo_read;
2612+
2613+ struct ec_motion_sense_activity set_activity;
2614+
2615+ /* Used for MOTIONSENSE_CMD_LID_ANGLE */
2616+ /* (no params) */
2617+
2618+ /* Used for MOTIONSENSE_CMD_FIFO_INT_ENABLE */
2619+ struct __ec_todo_unpacked {
2620+ /*
2621+ * 1: enable, 0 disable fifo,
2622+ * EC_MOTION_SENSE_NO_VALUE return value.
2623+ */
2624+ int8_t enable;
2625+ } fifo_int_enable;
2626+
2627+ /* Used for MOTIONSENSE_CMD_SPOOF */
2628+ struct __ec_todo_packed {
2629+ uint8_t sensor_id;
2630+
2631+ /* See enum motionsense_spoof_mode. */
2632+ uint8_t spoof_enable;
2633+
2634+ /* Ignored, used for alignment. */
2635+ uint8_t reserved;
2636+
2637+ /* Individual component values to spoof. */
2638+ int16_t components[3];
2639+ } spoof;
2640+
2641+ /* Used for MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. */
2642+ struct __ec_todo_unpacked {
2643+ /*
2644+ * Lid angle threshold for switching between tablet and
2645+ * clamshell mode.
2646+ */
2647+ int16_t lid_angle;
2648+
2649+ /*
2650+ * Hysteresis degree to prevent fluctuations between
2651+ * clamshell and tablet mode if lid angle keeps
2652+ * changing around the threshold. Lid motion driver will
2653+ * use lid_angle + hys_degree to trigger tablet mode and
2654+ * lid_angle - hys_degree to trigger clamshell mode.
2655+ */
2656+ int16_t hys_degree;
2657+ } tablet_mode_threshold;
17072658 };
1708−} __packed;
2659+} __ec_todo_packed;
17092660
17102661 struct ec_response_motion_sense {
17112662 union {
1712− /* Used for MOTIONSENSE_CMD_DUMP. */
1713− struct {
2663+ /* Used for MOTIONSENSE_CMD_DUMP */
2664+ struct __ec_todo_unpacked {
17142665 /* Flags representing the motion sensor module. */
17152666 uint8_t module_flags;
17162667
@@ -1725,7 +2676,7 @@ struct ec_response_motion_sense { · 8 unmodified lines
17252676 } dump;
17262677
17272678 /* Used for MOTIONSENSE_CMD_INFO. */
1728− struct {
2679+ struct __ec_todo_unpacked {
17292680 /* Should be element of enum motionsensor_type. */
17302681 uint8_t type;
17312682
@@ -1736,74 +2687,166 @@ struct ec_response_motion_sense { · 4 unmodified lines
17362687 uint8_t chip;
17372688 } info;
17382689
2690+ /* Used for MOTIONSENSE_CMD_INFO version 3 */
2691+ struct __ec_todo_unpacked {
2692+ /* Should be element of enum motionsensor_type. */
2693+ uint8_t type;
2694+
2695+ /* Should be element of enum motionsensor_location. */
2696+ uint8_t location;
2697+
2698+ /* Should be element of enum motionsensor_chip. */
2699+ uint8_t chip;
2700+
2701+ /* Minimum sensor sampling frequency */
2702+ uint32_t min_frequency;
2703+
2704+ /* Maximum sensor sampling frequency */
2705+ uint32_t max_frequency;
2706+
2707+ /* Max number of sensor events that could be in fifo */
2708+ uint32_t fifo_max_event_count;
2709+ } info_3;
2710+
17392711 /* Used for MOTIONSENSE_CMD_DATA */
17402712 struct ec_response_motion_sensor_data data;
17412713
17422714 /*
17432715 * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR,
1744− * MOTIONSENSE_CMD_SENSOR_RANGE, and
1745− * MOTIONSENSE_CMD_KB_WAKE_ANGLE.
2716+ * MOTIONSENSE_CMD_SENSOR_RANGE,
2717+ * MOTIONSENSE_CMD_KB_WAKE_ANGLE,
2718+ * MOTIONSENSE_CMD_FIFO_INT_ENABLE and
2719+ * MOTIONSENSE_CMD_SPOOF.
17462720 */
1747− struct {
2721+ struct __ec_todo_unpacked {
17482722 /* Current value of the parameter queried. */
17492723 int32_t ret;
1750− } ec_rate, sensor_odr, sensor_range, kb_wake_angle;
2724+ } ec_rate, sensor_odr, sensor_range, kb_wake_angle,
2725+ fifo_int_enable, spoof;
17512726
1752− /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */
1753− struct {
2727+ /*
2728+ * Used for MOTIONSENSE_CMD_SENSOR_OFFSET,
2729+ * PERFORM_CALIB.
2730+ */
2731+ struct __ec_todo_unpacked {
17542732 int16_t temp;
17552733 int16_t offset[3];
17562734 } sensor_offset, perform_calib;
1757− };
1758−} __packed;
17592735
1760−/*****************************************************************************/
1761−/* USB charging control commands */
2736+ /* Used for MOTIONSENSE_CMD_SENSOR_SCALE */
2737+ struct __ec_todo_unpacked {
2738+ int16_t temp;
2739+ uint16_t scale[3];
2740+ } sensor_scale;
17622741
1763−/* Set USB port charging mode */
1764−#define EC_CMD_USB_CHARGE_SET_MODE 0x30
2742+ struct ec_response_motion_sense_fifo_info fifo_info, fifo_flush;
17652743
1766−struct ec_params_usb_charge_set_mode {
1767− uint8_t usb_port_id;
1768− uint8_t mode;
1769−} __packed;
2744+ struct ec_response_motion_sense_fifo_data fifo_read;
17702745
1771−/*****************************************************************************/
1772−/* Persistent storage for host */
2746+ struct __ec_todo_packed {
2747+ uint16_t reserved;
2748+ uint32_t enabled;
2749+ uint32_t disabled;
2750+ } list_activities;
17732751
1774−/* Maximum bytes that can be read/written in a single command */
1775−#define EC_PSTORE_SIZE_MAX 64
2752+ /* No params for set activity */
17762753
1777−/* Get persistent storage info */
1778−#define EC_CMD_PSTORE_INFO 0x40
2754+ /* Used for MOTIONSENSE_CMD_LID_ANGLE */
2755+ struct __ec_todo_unpacked {
2756+ /*
2757+ * Angle between 0 and 360 degree if available,
2758+ * LID_ANGLE_UNRELIABLE otherwise.
2759+ */
2760+ uint16_t value;
2761+ } lid_angle;
17792762
1780−struct ec_response_pstore_info {
1781− /* Persistent storage size, in bytes */
1782− uint32_t pstore_size;
1783− /* Access size; read/write offset and size must be a multiple of this */
1784− uint32_t access_size;
1785−} __packed;
2763+ /* Used for MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. */
2764+ struct __ec_todo_unpacked {
2765+ /*
2766+ * Lid angle threshold for switching between tablet and
2767+ * clamshell mode.
2768+ */
2769+ uint16_t lid_angle;
2770+
2771+ /* Hysteresis degree. */
2772+ uint16_t hys_degree;
2773+ } tablet_mode_threshold;
2774+
2775+ };
2776+} __ec_todo_packed;
2777+
2778+/*****************************************************************************/
2779+/* Force lid open command */
2780+
2781+/* Make lid event always open */
2782+#define EC_CMD_FORCE_LID_OPEN 0x002C
2783+
2784+struct ec_params_force_lid_open {
2785+ uint8_t enabled;
2786+} __ec_align1;
2787+
2788+/*****************************************************************************/
2789+/* Configure the behavior of the power button */
2790+#define EC_CMD_CONFIG_POWER_BUTTON 0x002D
2791+
2792+enum ec_config_power_button_flags {
2793+ /* Enable/Disable power button pulses for x86 devices */
2794+ EC_POWER_BUTTON_ENABLE_PULSE = BIT(0),
2795+};
2796+
2797+struct ec_params_config_power_button {
2798+ /* See enum ec_config_power_button_flags */
2799+ uint8_t flags;
2800+} __ec_align1;
2801+
2802+/*****************************************************************************/
2803+/* USB charging control commands */
2804+
2805+/* Set USB port charging mode */
2806+#define EC_CMD_USB_CHARGE_SET_MODE 0x0030
2807+
2808+struct ec_params_usb_charge_set_mode {
2809+ uint8_t usb_port_id;
2810+ uint8_t mode:7;
2811+ uint8_t inhibit_charge:1;
2812+} __ec_align1;
2813+
2814+/*****************************************************************************/
2815+/* Persistent storage for host */
2816+
2817+/* Maximum bytes that can be read/written in a single command */
2818+#define EC_PSTORE_SIZE_MAX 64
2819+
2820+/* Get persistent storage info */
2821+#define EC_CMD_PSTORE_INFO 0x0040
2822+
2823+struct ec_response_pstore_info {
2824+ /* Persistent storage size, in bytes */
2825+ uint32_t pstore_size;
2826+ /* Access size; read/write offset and size must be a multiple of this */
2827+ uint32_t access_size;
2828+} __ec_align4;
17862829
17872830 /*
17882831 * Read persistent storage
17892832 *
17902833 * Response is params.size bytes of data.
17912834 */
1792−#define EC_CMD_PSTORE_READ 0x41
2835+#define EC_CMD_PSTORE_READ 0x0041
17932836
17942837 struct ec_params_pstore_read {
17952838 uint32_t offset; /* Byte offset to read */
17962839 uint32_t size; /* Size to read in bytes */
1797−} __packed;
2840+} __ec_align4;
17982841
17992842 /* Write persistent storage */
1800−#define EC_CMD_PSTORE_WRITE 0x42
2843+#define EC_CMD_PSTORE_WRITE 0x0042
18012844
18022845 struct ec_params_pstore_write {
18032846 uint32_t offset; /* Byte offset to write */
18042847 uint32_t size; /* Size to write in bytes */
18052848 uint8_t data[EC_PSTORE_SIZE_MAX];
1806−} __packed;
2849+} __ec_align4;
18072850
18082851 /*****************************************************************************/
18092852 /* Real-time clock */
@@ -1811,21 +2854,21 @@ struct ec_params_pstore_write { · 1 unmodified line
18112854 /* RTC params and response structures */
18122855 struct ec_params_rtc {
18132856 uint32_t time;
1814−} __packed;
2857+} __ec_align4;
18152858
18162859 struct ec_response_rtc {
18172860 uint32_t time;
1818−} __packed;
2861+} __ec_align4;
18192862
18202863 /* These use ec_response_rtc */
1821−#define EC_CMD_RTC_GET_VALUE 0x44
1822−#define EC_CMD_RTC_GET_ALARM 0x45
2864+#define EC_CMD_RTC_GET_VALUE 0x0044
2865+#define EC_CMD_RTC_GET_ALARM 0x0045
18232866
18242867 /* These all use ec_params_rtc */
1825−#define EC_CMD_RTC_SET_VALUE 0x46
1826−#define EC_CMD_RTC_SET_ALARM 0x47
2868+#define EC_CMD_RTC_SET_VALUE 0x0046
2869+#define EC_CMD_RTC_SET_ALARM 0x0047
18272870
1828−/* Pass as param to SET_ALARM to clear the current alarm */
2871+/* Pass as time param to SET_ALARM to clear the current alarm */
18292872 #define EC_RTC_ALARM_CLEAR 0
18302873
18312874 /*****************************************************************************/
@@ -1835,8 +2878,8 @@ struct ec_response_rtc { · 3 unmodified lines
18352878 #define EC_PORT80_SIZE_MAX 32
18362879
18372880 /* Get last port80 code from previous boot */
1838−#define EC_CMD_PORT80_LAST_BOOT 0x48
1839−#define EC_CMD_PORT80_READ 0x48
2881+#define EC_CMD_PORT80_LAST_BOOT 0x0048
2882+#define EC_CMD_PORT80_READ 0x0048
18402883
18412884 enum ec_port80_subcmd {
18422885 EC_PORT80_GET_INFO = 0,
@@ -1846,29 +2889,72 @@ enum ec_port80_subcmd { · 3 unmodified lines
18462889 struct ec_params_port80_read {
18472890 uint16_t subcmd;
18482891 union {
1849− struct {
2892+ struct __ec_todo_unpacked {
18502893 uint32_t offset;
18512894 uint32_t num_entries;
18522895 } read_buffer;
18532896 };
1854−} __packed;
2897+} __ec_todo_packed;
18552898
18562899 struct ec_response_port80_read {
18572900 union {
1858− struct {
2901+ struct __ec_todo_unpacked {
18592902 uint32_t writes;
18602903 uint32_t history_size;
18612904 uint32_t last_boot;
18622905 } get_info;
1863− struct {
2906+ struct __ec_todo_unpacked {
18642907 uint16_t codes[EC_PORT80_SIZE_MAX];
18652908 } data;
18662909 };
1867−} __packed;
2910+} __ec_todo_packed;
18682911
18692912 struct ec_response_port80_last_boot {
18702913 uint16_t code;
1871−} __packed;
2914+} __ec_align2;
2915+
2916+/*****************************************************************************/
2917+/* Temporary secure storage for host verified boot use */
2918+
2919+/* Number of bytes in a vstore slot */
2920+#define EC_VSTORE_SLOT_SIZE 64
2921+
2922+/* Maximum number of vstore slots */
2923+#define EC_VSTORE_SLOT_MAX 32
2924+
2925+/* Get persistent storage info */
2926+#define EC_CMD_VSTORE_INFO 0x0049
2927+struct ec_response_vstore_info {
2928+ /* Indicates which slots are locked */
2929+ uint32_t slot_locked;
2930+ /* Total number of slots available */
2931+ uint8_t slot_count;
2932+} __ec_align_size1;
2933+
2934+/*
2935+ * Read temporary secure storage
2936+ *
2937+ * Response is EC_VSTORE_SLOT_SIZE bytes of data.
2938+ */
2939+#define EC_CMD_VSTORE_READ 0x004A
2940+
2941+struct ec_params_vstore_read {
2942+ uint8_t slot; /* Slot to read from */
2943+} __ec_align1;
2944+
2945+struct ec_response_vstore_read {
2946+ uint8_t data[EC_VSTORE_SLOT_SIZE];
2947+} __ec_align1;
2948+
2949+/*
2950+ * Write temporary secure storage and lock it.
2951+ */
2952+#define EC_CMD_VSTORE_WRITE 0x004B
2953+
2954+struct ec_params_vstore_write {
2955+ uint8_t slot; /* Slot to write to */
2956+ uint8_t data[EC_VSTORE_SLOT_SIZE];
2957+} __ec_align1;
18722958
18732959 /*****************************************************************************/
18742960 /* Thermal engine commands. Note that there are two implementations. We'll
@@ -1877,8 +2963,8 @@ struct ec_response_port80_last_boot { · 2 unmodified lines
18772963 * Version 1 separates the CPU thermal limits from the fan control.
18782964 */
18792965
1880−#define EC_CMD_THERMAL_SET_THRESHOLD 0x50
1881−#define EC_CMD_THERMAL_GET_THRESHOLD 0x51
2966+#define EC_CMD_THERMAL_SET_THRESHOLD 0x0050
2967+#define EC_CMD_THERMAL_GET_THRESHOLD 0x0051
18822968
18832969 /* The version 0 structs are opaque. You have to know what they are for
18842970 * the get/set commands to make any sense.
@@ -1889,17 +2975,17 @@ struct ec_params_thermal_set_threshold { · 4 unmodified lines
18892975 uint8_t sensor_type;
18902976 uint8_t threshold_id;
18912977 uint16_t value;
1892−} __packed;
2978+} __ec_align2;
18932979
18942980 /* Version 0 - get */
18952981 struct ec_params_thermal_get_threshold {
18962982 uint8_t sensor_type;
18972983 uint8_t threshold_id;
1898−} __packed;
2984+} __ec_align1;
18992985
19002986 struct ec_response_thermal_get_threshold {
19012987 uint16_t value;
1902−} __packed;
2988+} __ec_align2;
19032989
19042990
19052991 /* The version 1 structs are visible. */
@@ -1911,71 +2997,124 @@ enum ec_temp_thresholds { · 5 unmodified lines
19112997 EC_TEMP_THRESH_COUNT
19122998 };
19132999
1914−/* Thermal configuration for one temperature sensor. Temps are in degrees K.
3000+/*
3001+ * Thermal configuration for one temperature sensor. Temps are in degrees K.
19153002 * Zero values will be silently ignored by the thermal task.
3003+ *
3004+ * Set 'temp_host' value allows thermal task to trigger some event with 1 degree
3005+ * hysteresis.
3006+ * For example,
3007+ * temp_host[EC_TEMP_THRESH_HIGH] = 300 K
3008+ * temp_host_release[EC_TEMP_THRESH_HIGH] = 0 K
3009+ * EC will throttle ap when temperature >= 301 K, and release throttling when
3010+ * temperature <= 299 K.
3011+ *
3012+ * Set 'temp_host_release' value allows thermal task has a custom hysteresis.
3013+ * For example,
3014+ * temp_host[EC_TEMP_THRESH_HIGH] = 300 K
3015+ * temp_host_release[EC_TEMP_THRESH_HIGH] = 295 K
3016+ * EC will throttle ap when temperature >= 301 K, and release throttling when
3017+ * temperature <= 294 K.
3018+ *
3019+ * Note that this structure is a sub-structure of
3020+ * ec_params_thermal_set_threshold_v1, but maintains its alignment there.
19163021 */
19173022 struct ec_thermal_config {
19183023 uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */
3024+ uint32_t temp_host_release[EC_TEMP_THRESH_COUNT]; /* release levels */
19193025 uint32_t temp_fan_off; /* no active cooling needed */
19203026 uint32_t temp_fan_max; /* max active cooling needed */
1921−} __packed;
3027+} __ec_align4;
19223028
19233029 /* Version 1 - get config for one sensor. */
19243030 struct ec_params_thermal_get_threshold_v1 {
19253031 uint32_t sensor_num;
1926−} __packed;
3032+} __ec_align4;
19273033 /* This returns a struct ec_thermal_config */
19283034
1929−/* Version 1 - set config for one sensor.
1930− * Use read-modify-write for best results! */
3035+/*
3036+ * Version 1 - set config for one sensor.
3037+ * Use read-modify-write for best results!
3038+ */
19313039 struct ec_params_thermal_set_threshold_v1 {
19323040 uint32_t sensor_num;
19333041 struct ec_thermal_config cfg;
1934−} __packed;
3042+} __ec_align4;
19353043 /* This returns no data */
19363044
19373045 /****************************************************************************/
19383046
19393047 /* Toggle automatic fan control */
1940−#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52
3048+#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x0052
3049+
3050+/* Version 1 of input params */
3051+struct ec_params_auto_fan_ctrl_v1 {
3052+ uint8_t fan_idx;
3053+} __ec_align1;
19413054
1942−/* Get TMP006 calibration data */
1943−#define EC_CMD_TMP006_GET_CALIBRATION 0x53
3055+/* Get/Set TMP006 calibration data */
3056+#define EC_CMD_TMP006_GET_CALIBRATION 0x0053
3057+#define EC_CMD_TMP006_SET_CALIBRATION 0x0054
3058+
3059+/*
3060+ * The original TMP006 calibration only needed four params, but now we need
3061+ * more. Since the algorithm is nothing but magic numbers anyway, we'll leave
3062+ * the params opaque. The v1 "get" response will include the algorithm number
3063+ * and how many params it requires. That way we can change the EC code without
3064+ * needing to update this file. We can also use a different algorithm on each
3065+ * sensor.
3066+ */
19443067
3068+/* This is the same struct for both v0 and v1. */
19453069 struct ec_params_tmp006_get_calibration {
19463070 uint8_t index;
1947−} __packed;
3071+} __ec_align1;
19483072
1949−struct ec_response_tmp006_get_calibration {
3073+/* Version 0 */
3074+struct ec_response_tmp006_get_calibration_v0 {
19503075 float s0;
19513076 float b0;
19523077 float b1;
19533078 float b2;
1954−} __packed;
1955−
1956−/* Set TMP006 calibration data */
1957−#define EC_CMD_TMP006_SET_CALIBRATION 0x54
3079+} __ec_align4;
19583080
1959−struct ec_params_tmp006_set_calibration {
3081+struct ec_params_tmp006_set_calibration_v0 {
19603082 uint8_t index;
1961− uint8_t reserved[3]; /* Reserved; set 0 */
3083+ uint8_t reserved[3];
19623084 float s0;
19633085 float b0;
19643086 float b1;
19653087 float b2;
1966−} __packed;
3088+} __ec_align4;
3089+
3090+/* Version 1 */
3091+struct ec_response_tmp006_get_calibration_v1 {
3092+ uint8_t algorithm;
3093+ uint8_t num_params;
3094+ uint8_t reserved[2];
3095+ float val[0];
3096+} __ec_align4;
3097+
3098+struct ec_params_tmp006_set_calibration_v1 {
3099+ uint8_t index;
3100+ uint8_t algorithm;
3101+ uint8_t num_params;
3102+ uint8_t reserved;
3103+ float val[0];
3104+} __ec_align4;
3105+
19673106
19683107 /* Read raw TMP006 data */
1969−#define EC_CMD_TMP006_GET_RAW 0x55
3108+#define EC_CMD_TMP006_GET_RAW 0x0055
19703109
19713110 struct ec_params_tmp006_get_raw {
19723111 uint8_t index;
1973−} __packed;
3112+} __ec_align1;
19743113
19753114 struct ec_response_tmp006_get_raw {
19763115 int32_t t; /* In 1/100 K */
19773116 int32_t v; /* In nV */
1978−};
3117+} __ec_align4;
19793118
19803119 /*****************************************************************************/
19813120 /* MKBP - Matrix KeyBoard Protocol */
@@ -1990,24 +3129,24 @@ struct ec_response_tmp006_get_raw { · 8 unmodified lines
19903129 * to obtain the instantaneous state, use EC_CMD_MKBP_INFO with the type
19913130 * EC_MKBP_INFO_CURRENT and event EC_MKBP_EVENT_KEY_MATRIX.
19923131 */
1993−#define EC_CMD_MKBP_STATE 0x60
3132+#define EC_CMD_MKBP_STATE 0x0060
19943133
19953134 /*
19963135 * Provide information about various MKBP things. See enum ec_mkbp_info_type.
19973136 */
1998−#define EC_CMD_MKBP_INFO 0x61
3137+#define EC_CMD_MKBP_INFO 0x0061
19993138
20003139 struct ec_response_mkbp_info {
20013140 uint32_t rows;
20023141 uint32_t cols;
20033142 /* Formerly "switches", which was 0. */
20043143 uint8_t reserved;
2005−} __packed;
3144+} __ec_align_size1;
20063145
20073146 struct ec_params_mkbp_info {
20083147 uint8_t info_type;
20093148 uint8_t event_type;
2010−} __packed;
3149+} __ec_align1;
20113150
20123151 enum ec_mkbp_info_type {
20133152 /*
@@ -2049,17 +3188,28 @@ enum ec_mkbp_info_type { · 35 unmodified lines
20493188 };
20503189
20513190 /* Simulate key press */
2052−#define EC_CMD_MKBP_SIMULATE_KEY 0x62
3191+#define EC_CMD_MKBP_SIMULATE_KEY 0x0062
20533192
20543193 struct ec_params_mkbp_simulate_key {
20553194 uint8_t col;
20563195 uint8_t row;
20573196 uint8_t pressed;
2058−} __packed;
3197+} __ec_align1;
3198+
3199+#define EC_CMD_GET_KEYBOARD_ID 0x0063
3200+
3201+struct ec_response_keyboard_id {
3202+ uint32_t keyboard_id;
3203+} __ec_align4;
3204+
3205+enum keyboard_id {
3206+ KEYBOARD_ID_UNSUPPORTED = 0,
3207+ KEYBOARD_ID_UNREADABLE = 0xffffffff,
3208+};
20593209
20603210 /* Configure keyboard scanning */
2061−#define EC_CMD_MKBP_SET_CONFIG 0x64
2062−#define EC_CMD_MKBP_GET_CONFIG 0x65
3211+#define EC_CMD_MKBP_SET_CONFIG 0x0064
3212+#define EC_CMD_MKBP_GET_CONFIG 0x0065
20633213
20643214 /* flags */
20653215 enum mkbp_config_flags {
@@ -2067,16 +3217,21 @@ enum mkbp_config_flags { · 1 unmodified line
20673217 };
20683218
20693219 enum mkbp_config_valid {
2070− EC_MKBP_VALID_SCAN_PERIOD = 1 << 0,
2071− EC_MKBP_VALID_POLL_TIMEOUT = 1 << 1,
2072− EC_MKBP_VALID_MIN_POST_SCAN_DELAY = 1 << 3,
2073− EC_MKBP_VALID_OUTPUT_SETTLE = 1 << 4,
2074− EC_MKBP_VALID_DEBOUNCE_DOWN = 1 << 5,
2075− EC_MKBP_VALID_DEBOUNCE_UP = 1 << 6,
2076− EC_MKBP_VALID_FIFO_MAX_DEPTH = 1 << 7,
3220+ EC_MKBP_VALID_SCAN_PERIOD = BIT(0),
3221+ EC_MKBP_VALID_POLL_TIMEOUT = BIT(1),
3222+ EC_MKBP_VALID_MIN_POST_SCAN_DELAY = BIT(3),
3223+ EC_MKBP_VALID_OUTPUT_SETTLE = BIT(4),
3224+ EC_MKBP_VALID_DEBOUNCE_DOWN = BIT(5),
3225+ EC_MKBP_VALID_DEBOUNCE_UP = BIT(6),
3226+ EC_MKBP_VALID_FIFO_MAX_DEPTH = BIT(7),
20773227 };
20783228
2079−/* Configuration for our key scanning algorithm */
3229+/*
3230+ * Configuration for our key scanning algorithm.
3231+ *
3232+ * Note that this is used as a sub-structure of
3233+ * ec_{params/response}_mkbp_get_config.
3234+ */
20803235 struct ec_mkbp_config {
20813236 uint32_t valid_mask; /* valid fields */
20823237 uint8_t flags; /* some flags (enum mkbp_config_flags) */
@@ -2096,18 +3251,18 @@ struct ec_mkbp_config { · 13 unmodified lines
20963251 uint16_t debounce_up_us; /* time for debounce on key up */
20973252 /* maximum depth to allow for fifo (0 = no keyscan output) */
20983253 uint8_t fifo_max_depth;
2099−} __packed;
3254+} __ec_align_size1;
21003255
21013256 struct ec_params_mkbp_set_config {
21023257 struct ec_mkbp_config config;
2103−} __packed;
3258+} __ec_align_size1;
21043259
21053260 struct ec_response_mkbp_get_config {
21063261 struct ec_mkbp_config config;
2107−} __packed;
3262+} __ec_align_size1;
21083263
21093264 /* Run the key scan emulation */
2110−#define EC_CMD_KEYSCAN_SEQ_CTRL 0x66
3265+#define EC_CMD_KEYSCAN_SEQ_CTRL 0x0066
21113266
21123267 enum ec_keyscan_seq_cmd {
21133268 EC_KEYSCAN_SEQ_STATUS = 0, /* Get status information */
@@ -2122,23 +3277,23 @@ enum ec_collect_flags { · 8 unmodified lines
21223277 * Indicates this scan was processed by the EC. Due to timing, some
21233278 * scans may be skipped.
21243279 */
2125− EC_KEYSCAN_SEQ_FLAG_DONE = 1 << 0,
3280+ EC_KEYSCAN_SEQ_FLAG_DONE = BIT(0),
21263281 };
21273282
21283283 struct ec_collect_item {
21293284 uint8_t flags; /* some flags (enum ec_collect_flags) */
2130−};
3285+} __ec_align1;
21313286
21323287 struct ec_params_keyscan_seq_ctrl {
21333288 uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */
21343289 union {
2135− struct {
3290+ struct __ec_align1 {
21363291 uint8_t active; /* still active */
21373292 uint8_t num_items; /* number of items */
21383293 /* Current item being presented */
21393294 uint8_t cur_item;
21403295 } status;
2141− struct {
3296+ struct __ec_todo_unpacked {
21423297 /*
21433298 * Absolute time for this scan, measured from the
21443299 * start of the sequence.
@@ -2146,29 +3301,40 @@ struct ec_params_keyscan_seq_ctrl { · 1 unmodified line
21463301 uint32_t time_us;
21473302 uint8_t scan[0]; /* keyscan data */
21483303 } add;
2149− struct {
3304+ struct __ec_align1 {
21503305 uint8_t start_item; /* First item to return */
21513306 uint8_t num_items; /* Number of items to return */
21523307 } collect;
21533308 };
2154−} __packed;
3309+} __ec_todo_packed;
21553310
21563311 struct ec_result_keyscan_seq_ctrl {
21573312 union {
2158− struct {
3313+ struct __ec_todo_unpacked {
21593314 uint8_t num_items; /* Number of items */
21603315 /* Data for each item */
21613316 struct ec_collect_item item[0];
21623317 } collect;
21633318 };
2164−} __packed;
3319+} __ec_todo_packed;
21653320
21663321 /*
2167− * Command for retrieving the next pending MKBP event from the EC device
3322+ * Get the next pending MKBP event.
21683323 *
2169− * The device replies with UNAVAILABLE if there aren't any pending events.
3324+ * Returns EC_RES_UNAVAILABLE if there is no event pending.
3325+ */
3326+#define EC_CMD_GET_NEXT_EVENT 0x0067
3327+
3328+#define EC_MKBP_HAS_MORE_EVENTS_SHIFT 7
3329+
3330+/*
3331+ * We use the most significant bit of the event type to indicate to the host
3332+ * that the EC has more MKBP events available to provide.
21703333 */
2171−#define EC_CMD_GET_NEXT_EVENT 0x67
3334+#define EC_MKBP_HAS_MORE_EVENTS BIT(EC_MKBP_HAS_MORE_EVENTS_SHIFT)
3335+
3336+/* The mask to apply to get the raw event type */
3337+#define EC_MKBP_EVENT_TYPE_MASK (BIT(EC_MKBP_HAS_MORE_EVENTS_SHIFT) - 1)
21723338
21733339 enum ec_mkbp_event {
21743340 /* Keyboard matrix changed. The event data is the new matrix state. */
@@ -2186,9 +3352,21 @@ enum ec_mkbp_event { · 11 unmodified lines
21863352 /* The state of the switches have changed. */
21873353 EC_MKBP_EVENT_SWITCH = 4,
21883354
2189− /* EC sent a sysrq command */
3355+ /* New Fingerprint sensor event, the event data is fp_events bitmap. */
3356+ EC_MKBP_EVENT_FINGERPRINT = 5,
3357+
3358+ /*
3359+ * Sysrq event: send emulated sysrq. The event data is sysrq,
3360+ * corresponding to the key to be pressed.
3361+ */
21903362 EC_MKBP_EVENT_SYSRQ = 6,
21913363
3364+ /*
3365+ * New 64-bit host event.
3366+ * The event data is 8 bytes of host event flags.
3367+ */
3368+ EC_MKBP_EVENT_HOST_EVENT64 = 7,
3369+
21923370 /* Notify the AP that something happened on CEC */
21933371 EC_MKBP_EVENT_CEC_EVENT = 8,
21943372
@@ -2198,65 +3376,140 @@ enum ec_mkbp_event { · 3 unmodified lines
21983376 /* Number of MKBP events */
21993377 EC_MKBP_EVENT_COUNT,
22003378 };
3379+BUILD_ASSERT(EC_MKBP_EVENT_COUNT <= EC_MKBP_EVENT_TYPE_MASK);
22013380
2202−union ec_response_get_next_data {
2203− uint8_t key_matrix[13];
3381+union __ec_align_offset1 ec_response_get_next_data {
3382+ uint8_t key_matrix[13];
22043383
22053384 /* Unaligned */
2206− uint32_t host_event;
3385+ uint32_t host_event;
3386+ uint64_t host_event64;
22073387
2208− uint32_t buttons;
2209− uint32_t switches;
2210− uint32_t sysrq;
2211−} __packed;
3388+ struct __ec_todo_unpacked {
3389+ /* For aligning the fifo_info */
3390+ uint8_t reserved[3];
3391+ struct ec_response_motion_sense_fifo_info info;
3392+ } sensor_fifo;
22123393
2213−union ec_response_get_next_data_v1 {
3394+ uint32_t buttons;
3395+
3396+ uint32_t switches;
3397+
3398+ uint32_t fp_events;
3399+
3400+ uint32_t sysrq;
3401+
3402+ /* CEC events from enum mkbp_cec_event */
3403+ uint32_t cec_events;
3404+};
3405+
3406+union __ec_align_offset1 ec_response_get_next_data_v1 {
22143407 uint8_t key_matrix[16];
3408+
3409+ /* Unaligned */
22153410 uint32_t host_event;
3411+ uint64_t host_event64;
3412+
3413+ struct __ec_todo_unpacked {
3414+ /* For aligning the fifo_info */
3415+ uint8_t reserved[3];
3416+ struct ec_response_motion_sense_fifo_info info;
3417+ } sensor_fifo;
3418+
22163419 uint32_t buttons;
3420+
22173421 uint32_t switches;
3422+
3423+ uint32_t fp_events;
3424+
22183425 uint32_t sysrq;
3426+
3427+ /* CEC events from enum mkbp_cec_event */
22193428 uint32_t cec_events;
3429+
22203430 uint8_t cec_message[16];
2221−} __packed;
3431+};
3432+BUILD_ASSERT(sizeof(union ec_response_get_next_data_v1) == 16);
22223433
22233434 struct ec_response_get_next_event {
22243435 uint8_t event_type;
22253436 /* Followed by event data if any */
22263437 union ec_response_get_next_data data;
2227−} __packed;
3438+} __ec_align1;
22283439
22293440 struct ec_response_get_next_event_v1 {
22303441 uint8_t event_type;
22313442 /* Followed by event data if any */
22323443 union ec_response_get_next_data_v1 data;
2233−} __packed;
3444+} __ec_align1;
22343445
22353446 /* Bit indices for buttons and switches.*/
22363447 /* Buttons */
22373448 #define EC_MKBP_POWER_BUTTON 0
22383449 #define EC_MKBP_VOL_UP 1
22393450 #define EC_MKBP_VOL_DOWN 2
3451+#define EC_MKBP_RECOVERY 3
22403452
22413453 /* Switches */
22423454 #define EC_MKBP_LID_OPEN 0
22433455 #define EC_MKBP_TABLET_MODE 1
22443456 #define EC_MKBP_BASE_ATTACHED 2
22453457
3458+/* Run keyboard factory test scanning */
3459+#define EC_CMD_KEYBOARD_FACTORY_TEST 0x0068
3460+
3461+struct ec_response_keyboard_factory_test {
3462+ uint16_t shorted; /* Keyboard pins are shorted */
3463+} __ec_align2;
3464+
3465+/* Fingerprint events in 'fp_events' for EC_MKBP_EVENT_FINGERPRINT */
3466+#define EC_MKBP_FP_RAW_EVENT(fp_events) ((fp_events) & 0x00FFFFFF)
3467+#define EC_MKBP_FP_ERRCODE(fp_events) ((fp_events) & 0x0000000F)
3468+#define EC_MKBP_FP_ENROLL_PROGRESS_OFFSET 4
3469+#define EC_MKBP_FP_ENROLL_PROGRESS(fpe) (((fpe) & 0x00000FF0) \
3470+ >> EC_MKBP_FP_ENROLL_PROGRESS_OFFSET)
3471+#define EC_MKBP_FP_MATCH_IDX_OFFSET 12
3472+#define EC_MKBP_FP_MATCH_IDX_MASK 0x0000F000
3473+#define EC_MKBP_FP_MATCH_IDX(fpe) (((fpe) & EC_MKBP_FP_MATCH_IDX_MASK) \
3474+ >> EC_MKBP_FP_MATCH_IDX_OFFSET)
3475+#define EC_MKBP_FP_ENROLL BIT(27)
3476+#define EC_MKBP_FP_MATCH BIT(28)
3477+#define EC_MKBP_FP_FINGER_DOWN BIT(29)
3478+#define EC_MKBP_FP_FINGER_UP BIT(30)
3479+#define EC_MKBP_FP_IMAGE_READY BIT(31)
3480+/* code given by EC_MKBP_FP_ERRCODE() when EC_MKBP_FP_ENROLL is set */
3481+#define EC_MKBP_FP_ERR_ENROLL_OK 0
3482+#define EC_MKBP_FP_ERR_ENROLL_LOW_QUALITY 1
3483+#define EC_MKBP_FP_ERR_ENROLL_IMMOBILE 2
3484+#define EC_MKBP_FP_ERR_ENROLL_LOW_COVERAGE 3
3485+#define EC_MKBP_FP_ERR_ENROLL_INTERNAL 5
3486+/* Can be used to detect if image was usable for enrollment or not. */
3487+#define EC_MKBP_FP_ERR_ENROLL_PROBLEM_MASK 1
3488+/* code given by EC_MKBP_FP_ERRCODE() when EC_MKBP_FP_MATCH is set */
3489+#define EC_MKBP_FP_ERR_MATCH_NO 0
3490+#define EC_MKBP_FP_ERR_MATCH_NO_INTERNAL 6
3491+#define EC_MKBP_FP_ERR_MATCH_NO_TEMPLATES 7
3492+#define EC_MKBP_FP_ERR_MATCH_NO_LOW_QUALITY 2
3493+#define EC_MKBP_FP_ERR_MATCH_NO_LOW_COVERAGE 4
3494+#define EC_MKBP_FP_ERR_MATCH_YES 1
3495+#define EC_MKBP_FP_ERR_MATCH_YES_UPDATED 3
3496+#define EC_MKBP_FP_ERR_MATCH_YES_UPDATE_FAILED 5
3497+
3498+
22463499 /*****************************************************************************/
22473500 /* Temperature sensor commands */
22483501
22493502 /* Read temperature sensor info */
2250−#define EC_CMD_TEMP_SENSOR_GET_INFO 0x70
3503+#define EC_CMD_TEMP_SENSOR_GET_INFO 0x0070
22513504
22523505 struct ec_params_temp_sensor_get_info {
22533506 uint8_t id;
2254−} __packed;
3507+} __ec_align1;
22553508
22563509 struct ec_response_temp_sensor_get_info {
22573510 char sensor_name[32];
22583511 uint8_t sensor_type;
2259−} __packed;
3512+} __ec_align1;
22603513
22613514 /*****************************************************************************/
22623515
@@ -2269,49 +3522,131 @@ struct ec_response_temp_sensor_get_info { · 6 unmodified lines
22693522 /*****************************************************************************/
22703523 /* Host event commands */
22713524
3525+
3526+/* Obsolete. New implementation should use EC_CMD_HOST_EVENT instead */
22723527 /*
22733528 * Host event mask params and response structures, shared by all of the host
22743529 * event commands below.
22753530 */
22763531 struct ec_params_host_event_mask {
22773532 uint32_t mask;
2278−} __packed;
3533+} __ec_align4;
22793534
22803535 struct ec_response_host_event_mask {
22813536 uint32_t mask;
2282−} __packed;
3537+} __ec_align4;
22833538
22843539 /* These all use ec_response_host_event_mask */
2285−#define EC_CMD_HOST_EVENT_GET_B 0x87
2286−#define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x88
2287−#define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x89
2288−#define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x8d
3540+#define EC_CMD_HOST_EVENT_GET_B 0x0087
3541+#define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x0088
3542+#define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x0089
3543+#define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x008D
22893544
22903545 /* These all use ec_params_host_event_mask */
2291−#define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x8a
2292−#define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x8b
2293−#define EC_CMD_HOST_EVENT_CLEAR 0x8c
2294−#define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x8e
2295−#define EC_CMD_HOST_EVENT_CLEAR_B 0x8f
3546+#define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x008A
3547+#define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x008B
3548+#define EC_CMD_HOST_EVENT_CLEAR 0x008C
3549+#define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x008E
3550+#define EC_CMD_HOST_EVENT_CLEAR_B 0x008F
3551+
3552+/*
3553+ * Unified host event programming interface - Should be used by newer versions
3554+ * of BIOS/OS to program host events and masks
3555+ */
3556+
3557+struct ec_params_host_event {
3558+
3559+ /* Action requested by host - one of enum ec_host_event_action. */
3560+ uint8_t action;
3561+
3562+ /*
3563+ * Mask type that the host requested the action on - one of
3564+ * enum ec_host_event_mask_type.
3565+ */
3566+ uint8_t mask_type;
3567+
3568+ /* Set to 0, ignore on read */
3569+ uint16_t reserved;
3570+
3571+ /* Value to be used in case of set operations. */
3572+ uint64_t value;
3573+} __ec_align4;
3574+
3575+/*
3576+ * Response structure returned by EC_CMD_HOST_EVENT.
3577+ * Update the value on a GET request. Set to 0 on GET/CLEAR
3578+ */
3579+
3580+struct ec_response_host_event {
3581+
3582+ /* Mask value in case of get operation */
3583+ uint64_t value;
3584+} __ec_align4;
3585+
3586+enum ec_host_event_action {
3587+ /*
3588+ * params.value is ignored. Value of mask_type populated
3589+ * in response.value
3590+ */
3591+ EC_HOST_EVENT_GET,
3592+
3593+ /* Bits in params.value are set */
3594+ EC_HOST_EVENT_SET,
3595+
3596+ /* Bits in params.value are cleared */
3597+ EC_HOST_EVENT_CLEAR,
3598+};
3599+
3600+enum ec_host_event_mask_type {
3601+
3602+ /* Main host event copy */
3603+ EC_HOST_EVENT_MAIN,
3604+
3605+ /* Copy B of host events */
3606+ EC_HOST_EVENT_B,
3607+
3608+ /* SCI Mask */
3609+ EC_HOST_EVENT_SCI_MASK,
3610+
3611+ /* SMI Mask */
3612+ EC_HOST_EVENT_SMI_MASK,
3613+
3614+ /* Mask of events that should be always reported in hostevents */
3615+ EC_HOST_EVENT_ALWAYS_REPORT_MASK,
3616+
3617+ /* Active wake mask */
3618+ EC_HOST_EVENT_ACTIVE_WAKE_MASK,
3619+
3620+ /* Lazy wake mask for S0ix */
3621+ EC_HOST_EVENT_LAZY_WAKE_MASK_S0IX,
3622+
3623+ /* Lazy wake mask for S3 */
3624+ EC_HOST_EVENT_LAZY_WAKE_MASK_S3,
3625+
3626+ /* Lazy wake mask for S5 */
3627+ EC_HOST_EVENT_LAZY_WAKE_MASK_S5,
3628+};
3629+
3630+#define EC_CMD_HOST_EVENT 0x00A4
22963631
22973632 /*****************************************************************************/
22983633 /* Switch commands */
22993634
23003635 /* Enable/disable LCD backlight */
2301−#define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x90
3636+#define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x0090
23023637
23033638 struct ec_params_switch_enable_backlight {
23043639 uint8_t enabled;
2305−} __packed;
3640+} __ec_align1;
23063641
23073642 /* Enable/disable WLAN/Bluetooth */
2308−#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91
3643+#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x0091
23093644 #define EC_VER_SWITCH_ENABLE_WIRELESS 1
23103645
23113646 /* Version 0 params; no response */
23123647 struct ec_params_switch_enable_wireless_v0 {
23133648 uint8_t enabled;
2314−} __packed;
3649+} __ec_align1;
23153650
23163651 /* Version 1 params */
23173652 struct ec_params_switch_enable_wireless_v1 {
@@ -2330,7 +3665,7 @@ struct ec_params_switch_enable_wireless_v1 { · 12 unmodified lines
23303665
23313666 /* Which flags to copy from suspend_flags */
23323667 uint8_t suspend_mask;
2333−} __packed;
3668+} __ec_align1;
23343669
23353670 /* Version 1 response */
23363671 struct ec_response_switch_enable_wireless_v1 {
@@ -2339,55 +3674,56 @@ struct ec_response_switch_enable_wireless_v1 { · 2 unmodified lines
23393674
23403675 /* Flags to leave enabled in S3 */
23413676 uint8_t suspend_flags;
2342−} __packed;
3677+} __ec_align1;
23433678
23443679 /*****************************************************************************/
23453680 /* GPIO commands. Only available on EC if write protect has been disabled. */
23463681
23473682 /* Set GPIO output value */
2348−#define EC_CMD_GPIO_SET 0x92
3683+#define EC_CMD_GPIO_SET 0x0092
23493684
23503685 struct ec_params_gpio_set {
23513686 char name[32];
23523687 uint8_t val;
2353−} __packed;
3688+} __ec_align1;
23543689
23553690 /* Get GPIO value */
2356−#define EC_CMD_GPIO_GET 0x93
3691+#define EC_CMD_GPIO_GET 0x0093
23573692
23583693 /* Version 0 of input params and response */
23593694 struct ec_params_gpio_get {
23603695 char name[32];
2361−} __packed;
3696+} __ec_align1;
3697+
23623698 struct ec_response_gpio_get {
23633699 uint8_t val;
2364−} __packed;
3700+} __ec_align1;
23653701
23663702 /* Version 1 of input params and response */
23673703 struct ec_params_gpio_get_v1 {
23683704 uint8_t subcmd;
23693705 union {
2370− struct {
3706+ struct __ec_align1 {
23713707 char name[32];
23723708 } get_value_by_name;
2373− struct {
3709+ struct __ec_align1 {
23743710 uint8_t index;
23753711 } get_info;
23763712 };
2377−} __packed;
3713+} __ec_align1;
23783714
23793715 struct ec_response_gpio_get_v1 {
23803716 union {
2381− struct {
3717+ struct __ec_align1 {
23823718 uint8_t val;
23833719 } get_value_by_name, get_count;
2384− struct {
3720+ struct __ec_todo_unpacked {
23853721 uint8_t val;
23863722 char name[32];
23873723 uint32_t flags;
23883724 } get_info;
23893725 };
2390−} __packed;
3726+} __ec_todo_packed;
23913727
23923728 enum gpio_get_subcmd {
23933729 EC_GPIO_GET_BY_NAME = 0,
@@ -2399,25 +3735,28 @@ enum gpio_get_subcmd { · 5 unmodified lines
23993735 /* I2C commands. Only available when flash write protect is unlocked. */
24003736
24013737 /*
2402− * TODO(crosbug.com/p/23570): These commands are deprecated, and will be
2403− * removed soon. Use EC_CMD_I2C_XFER instead.
3738+ * CAUTION: These commands are deprecated, and are not supported anymore in EC
3739+ * builds >= 8398.0.0 (see crosbug.com/p/23570).
3740+ *
3741+ * Use EC_CMD_I2C_PASSTHRU instead.
24043742 */
24053743
24063744 /* Read I2C bus */
2407−#define EC_CMD_I2C_READ 0x94
3745+#define EC_CMD_I2C_READ 0x0094
24083746
24093747 struct ec_params_i2c_read {
24103748 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
24113749 uint8_t read_size; /* Either 8 or 16. */
24123750 uint8_t port;
24133751 uint8_t offset;
2414−} __packed;
3752+} __ec_align_size1;
3753+
24153754 struct ec_response_i2c_read {
24163755 uint16_t data;
2417−} __packed;
3756+} __ec_align2;
24183757
24193758 /* Write I2C bus */
2420−#define EC_CMD_I2C_WRITE 0x95
3759+#define EC_CMD_I2C_WRITE 0x0095
24213760
24223761 struct ec_params_i2c_write {
24233762 uint16_t data;
@@ -2425,7 +3764,7 @@ struct ec_params_i2c_write { · 1 unmodified line
24253764 uint8_t write_size; /* Either 8 or 16. */
24263765 uint8_t port;
24273766 uint8_t offset;
2428−} __packed;
3767+} __ec_align_size1;
24293768
24303769 /*****************************************************************************/
24313770 /* Charge state commands. Only available when flash write protect unlocked. */
@@ -2433,7 +3772,7 @@ struct ec_params_i2c_write { · 1 unmodified line
24333772 /* Force charge state machine to stop charging the battery or force it to
24343773 * discharge the battery.
24353774 */
2436−#define EC_CMD_CHARGE_CONTROL 0x96
3775+#define EC_CMD_CHARGE_CONTROL 0x0096
24373776 #define EC_VER_CHARGE_CONTROL 1
24383777
24393778 enum ec_charge_control_mode {
@@ -2444,13 +3783,12 @@ enum ec_charge_control_mode { · 4 unmodified lines
24443783
24453784 struct ec_params_charge_control {
24463785 uint32_t mode; /* enum charge_control_mode */
2447−} __packed;
3786+} __ec_align4;
24483787
24493788 /*****************************************************************************/
2450−/* Console commands. Only available when flash write protect is unlocked. */
24513789
24523790 /* Snapshot console output buffer for use by EC_CMD_CONSOLE_READ. */
2453−#define EC_CMD_CONSOLE_SNAPSHOT 0x97
3791+#define EC_CMD_CONSOLE_SNAPSHOT 0x0097
24543792
24553793 /*
24563794 * Read data from the saved snapshot. If the subcmd parameter is
@@ -2464,7 +3802,7 @@ struct ec_params_charge_control { · 7 unmodified lines
24643802 * Response is null-terminated string. Empty string, if there is no more
24653803 * remaining output.
24663804 */
2467−#define EC_CMD_CONSOLE_READ 0x98
3805+#define EC_CMD_CONSOLE_READ 0x0098
24683806
24693807 enum ec_console_read_subcmd {
24703808 CONSOLE_READ_NEXT = 0,
@@ -2473,7 +3811,7 @@ enum ec_console_read_subcmd { · 2 unmodified lines
24733811
24743812 struct ec_params_console_read_v1 {
24753813 uint8_t subcmd; /* enum ec_console_read_subcmd */
2476−} __packed;
3814+} __ec_align1;
24773815
24783816 /*****************************************************************************/
24793817
@@ -2484,14 +3822,13 @@ struct ec_params_console_read_v1 { · 4 unmodified lines
24843822 * EC_RES_SUCCESS if the command was successful.
24853823 * EC_RES_ERROR if the cut off command failed.
24863824 */
3825+#define EC_CMD_BATTERY_CUT_OFF 0x0099
24873826
2488−#define EC_CMD_BATTERY_CUT_OFF 0x99
2489−
2490−#define EC_BATTERY_CUTOFF_FLAG_AT_SHUTDOWN (1 << 0)
3827+#define EC_BATTERY_CUTOFF_FLAG_AT_SHUTDOWN BIT(0)
24913828
24923829 struct ec_params_battery_cutoff {
24933830 uint8_t flags;
2494−} __packed;
3831+} __ec_align1;
24953832
24963833 /*****************************************************************************/
24973834 /* USB port mux control. */
@@ -2499,11 +3836,11 @@ struct ec_params_battery_cutoff { · 1 unmodified line
24993836 /*
25003837 * Switch USB mux or return to automatic switching.
25013838 */
2502−#define EC_CMD_USB_MUX 0x9a
3839+#define EC_CMD_USB_MUX 0x009A
25033840
25043841 struct ec_params_usb_mux {
25053842 uint8_t mux;
2506−} __packed;
3843+} __ec_align1;
25073844
25083845 /*****************************************************************************/
25093846 /* LDOs / FETs control. */
@@ -2516,25 +3853,25 @@ enum ec_ldo_state { · 6 unmodified lines
25163853 /*
25173854 * Switch on/off a LDO.
25183855 */
2519−#define EC_CMD_LDO_SET 0x9b
3856+#define EC_CMD_LDO_SET 0x009B
25203857
25213858 struct ec_params_ldo_set {
25223859 uint8_t index;
25233860 uint8_t state;
2524−} __packed;
3861+} __ec_align1;
25253862
25263863 /*
25273864 * Get LDO state.
25283865 */
2529−#define EC_CMD_LDO_GET 0x9c
3866+#define EC_CMD_LDO_GET 0x009C
25303867
25313868 struct ec_params_ldo_get {
25323869 uint8_t index;
2533−} __packed;
3870+} __ec_align1;
25343871
25353872 struct ec_response_ldo_get {
25363873 uint8_t state;
2537−} __packed;
3874+} __ec_align1;
25383875
25393876 /*****************************************************************************/
25403877 /* Power info. */
@@ -2542,7 +3879,7 @@ struct ec_response_ldo_get { · 1 unmodified line
25423879 /*
25433880 * Get power info.
25443881 */
2545−#define EC_CMD_POWER_INFO 0x9d
3882+#define EC_CMD_POWER_INFO 0x009D
25463883
25473884 struct ec_response_power_info {
25483885 uint32_t usb_dev_type;
@@ -2550,21 +3887,21 @@ struct ec_response_power_info { · 1 unmodified line
25503887 uint16_t voltage_system;
25513888 uint16_t current_system;
25523889 uint16_t usb_current_limit;
2553−} __packed;
3890+} __ec_align4;
25543891
25553892 /*****************************************************************************/
25563893 /* I2C passthru command */
25573894
2558−#define EC_CMD_I2C_PASSTHRU 0x9e
3895+#define EC_CMD_I2C_PASSTHRU 0x009E
25593896
25603897 /* Read data; if not present, message is a write */
2561−#define EC_I2C_FLAG_READ (1 << 15)
3898+#define EC_I2C_FLAG_READ BIT(15)
25623899
25633900 /* Mask for address */
25643901 #define EC_I2C_ADDR_MASK 0x3ff
25653902
2566−#define EC_I2C_STATUS_NAK (1 << 0) /* Transfer was not acknowledged */
2567−#define EC_I2C_STATUS_TIMEOUT (1 << 1) /* Timeout during transfer */
3903+#define EC_I2C_STATUS_NAK BIT(0) /* Transfer was not acknowledged */
3904+#define EC_I2C_STATUS_TIMEOUT BIT(1) /* Timeout during transfer */
25683905
25693906 /* Any error */
25703907 #define EC_I2C_STATUS_ERROR (EC_I2C_STATUS_NAK | EC_I2C_STATUS_TIMEOUT)
@@ -2572,49 +3909,49 @@ struct ec_response_power_info { · 1 unmodified line
25723909 struct ec_params_i2c_passthru_msg {
25733910 uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */
25743911 uint16_t len; /* Number of bytes to read or write */
2575−} __packed;
3912+} __ec_align2;
25763913
25773914 struct ec_params_i2c_passthru {
25783915 uint8_t port; /* I2C port number */
25793916 uint8_t num_msgs; /* Number of messages */
25803917 struct ec_params_i2c_passthru_msg msg[];
25813918 /* Data to write for all messages is concatenated here */
2582−} __packed;
3919+} __ec_align2;
25833920
25843921 struct ec_response_i2c_passthru {
25853922 uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */
25863923 uint8_t num_msgs; /* Number of messages processed */
25873924 uint8_t data[]; /* Data read by messages concatenated here */
2588−} __packed;
3925+} __ec_align1;
25893926
25903927 /*****************************************************************************/
25913928 /* Power button hang detect */
25923929
2593−#define EC_CMD_HANG_DETECT 0x9f
3930+#define EC_CMD_HANG_DETECT 0x009F
25943931
25953932 /* Reasons to start hang detection timer */
25963933 /* Power button pressed */
2597−#define EC_HANG_START_ON_POWER_PRESS (1 << 0)
3934+#define EC_HANG_START_ON_POWER_PRESS BIT(0)
25983935
25993936 /* Lid closed */
2600−#define EC_HANG_START_ON_LID_CLOSE (1 << 1)
3937+#define EC_HANG_START_ON_LID_CLOSE BIT(1)
26013938
26023939 /* Lid opened */
2603−#define EC_HANG_START_ON_LID_OPEN (1 << 2)
3940+#define EC_HANG_START_ON_LID_OPEN BIT(2)
26043941
26053942 /* Start of AP S3->S0 transition (booting or resuming from suspend) */
2606−#define EC_HANG_START_ON_RESUME (1 << 3)
3943+#define EC_HANG_START_ON_RESUME BIT(3)
26073944
26083945 /* Reasons to cancel hang detection */
26093946
26103947 /* Power button released */
2611−#define EC_HANG_STOP_ON_POWER_RELEASE (1 << 8)
3948+#define EC_HANG_STOP_ON_POWER_RELEASE BIT(8)
26123949
26133950 /* Any host command from AP received */
2614−#define EC_HANG_STOP_ON_HOST_COMMAND (1 << 9)
3951+#define EC_HANG_STOP_ON_HOST_COMMAND BIT(9)
26153952
26163953 /* Stop on end of AP S0->S3 transition (suspending or shutting down) */
2617−#define EC_HANG_STOP_ON_SUSPEND (1 << 10)
3954+#define EC_HANG_STOP_ON_SUSPEND BIT(10)
26183955
26193956 /*
26203957 * If this flag is set, all the other fields are ignored, and the hang detect
@@ -2622,14 +3959,14 @@ struct ec_response_i2c_passthru { · 1 unmodified line
26223959 * without reconfiguring any of the other hang detect settings. Note that
26233960 * you must previously have configured the timeouts.
26243961 */
2625−#define EC_HANG_START_NOW (1 << 30)
3962+#define EC_HANG_START_NOW BIT(30)
26263963
26273964 /*
26283965 * If this flag is set, all the other fields are ignored (including
26293966 * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer
26303967 * without reconfiguring any of the other hang detect settings.
26313968 */
2632−#define EC_HANG_STOP_NOW (1 << 31)
3969+#define EC_HANG_STOP_NOW BIT(31)
26333970
26343971 struct ec_params_hang_detect {
26353972 /* Flags; see EC_HANG_* */
@@ -2640,7 +3977,7 @@ struct ec_params_hang_detect { · 4 unmodified lines
26403977
26413978 /* Timeout in msec before generating warm reboot, if enabled */
26423979 uint16_t warm_reboot_timeout_msec;
2643−} __packed;
3980+} __ec_align4;
26443981
26453982 /*****************************************************************************/
26463983 /* Commands for battery charging */
@@ -2649,7 +3986,7 @@ struct ec_params_hang_detect { · 2 unmodified lines
26493986 * This is the single catch-all host command to exchange data regarding the
26503987 * charge state machine (v2 and up).
26513988 */
2652−#define EC_CMD_CHARGE_STATE 0xa0
3989+#define EC_CMD_CHARGE_STATE 0x00A0
26533990
26543991 /* Subcommands for this host command */
26553992 enum charge_state_command {
@@ -2669,6 +4006,11 @@ enum charge_state_params { · 13 unmodified lines
26694006 CS_PARAM_CHG_INPUT_CURRENT, /* charger input current limit */
26704007 CS_PARAM_CHG_STATUS, /* charger-specific status */
26714008 CS_PARAM_CHG_OPTION, /* charger-specific options */
4009+ CS_PARAM_LIMIT_POWER, /*
4010+ * Check if power is limited due to
4011+ * low battery and / or a weak external
4012+ * charger. READ ONLY.
4013+ */
26724014 /* How many so far? */
26734015 CS_NUM_BASE_PARAMS,
26744016
@@ -2676,30 +4018,39 @@ enum charge_state_params { · 1 unmodified line
26764018 CS_PARAM_CUSTOM_PROFILE_MIN = 0x10000,
26774019 CS_PARAM_CUSTOM_PROFILE_MAX = 0x1ffff,
26784020
4021+ /* Range for CONFIG_CHARGE_STATE_DEBUG params */
4022+ CS_PARAM_DEBUG_MIN = 0x20000,
4023+ CS_PARAM_DEBUG_CTL_MODE = 0x20000,
4024+ CS_PARAM_DEBUG_MANUAL_MODE,
4025+ CS_PARAM_DEBUG_SEEMS_DEAD,
4026+ CS_PARAM_DEBUG_SEEMS_DISCONNECTED,
4027+ CS_PARAM_DEBUG_BATT_REMOVED,
4028+ CS_PARAM_DEBUG_MANUAL_CURRENT,
4029+ CS_PARAM_DEBUG_MANUAL_VOLTAGE,
4030+ CS_PARAM_DEBUG_MAX = 0x2ffff,
4031+
26794032 /* Other custom param ranges go here... */
26804033 };
26814034
26824035 struct ec_params_charge_state {
26834036 uint8_t cmd; /* enum charge_state_command */
26844037 union {
2685− struct {
2686− /* no args */
2687− } get_state;
4038+ /* get_state has no args */
26884039
2689− struct {
4040+ struct __ec_todo_unpacked {
26904041 uint32_t param; /* enum charge_state_param */
26914042 } get_param;
26924043
2693− struct {
4044+ struct __ec_todo_unpacked {
26944045 uint32_t param; /* param to set */
26954046 uint32_t value; /* value to set */
26964047 } set_param;
26974048 };
2698−} __packed;
4049+} __ec_todo_packed;
26994050
27004051 struct ec_response_charge_state {
27014052 union {
2702− struct {
4053+ struct __ec_align4 {
27034054 int ac;
27044055 int chg_voltage;
27054056 int chg_current;
@@ -2707,24 +4058,23 @@ struct ec_response_charge_state { · 1 unmodified line
27074058 int batt_state_of_charge;
27084059 } get_state;
27094060
2710− struct {
4061+ struct __ec_align4 {
27114062 uint32_t value;
27124063 } get_param;
2713− struct {
2714− /* no return values */
2715− } set_param;
4064+
4065+ /* set_param returns no args */
27164066 };
2717−} __packed;
4067+} __ec_align4;
27184068
27194069
27204070 /*
27214071 * Set maximum battery charging current.
27224072 */
2723−#define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1
4073+#define EC_CMD_CHARGE_CURRENT_LIMIT 0x00A1
27244074
27254075 struct ec_params_current_limit {
27264076 uint32_t limit; /* in mA */
2727−} __packed;
4077+} __ec_align4;
27284078
27294079 /*
27304080 * Set maximum external voltage / current.
@@ -2735,23 +4085,69 @@ struct ec_params_current_limit { · 4 unmodified lines
27354085 struct ec_params_external_power_limit_v1 {
27364086 uint16_t current_lim; /* in mA, or EC_POWER_LIMIT_NONE to clear limit */
27374087 uint16_t voltage_lim; /* in mV, or EC_POWER_LIMIT_NONE to clear limit */
2738−} __packed;
4088+} __ec_align2;
27394089
27404090 #define EC_POWER_LIMIT_NONE 0xffff
27414091
4092+/*
4093+ * Set maximum voltage & current of a dedicated charge port
4094+ */
4095+#define EC_CMD_OVERRIDE_DEDICATED_CHARGER_LIMIT 0x00A3
4096+
4097+struct ec_params_dedicated_charger_limit {
4098+ uint16_t current_lim; /* in mA */
4099+ uint16_t voltage_lim; /* in mV */
4100+} __ec_align2;
4101+
4102+/*****************************************************************************/
4103+/* Hibernate/Deep Sleep Commands */
4104+
4105+/* Set the delay before going into hibernation. */
4106+#define EC_CMD_HIBERNATION_DELAY 0x00A8
4107+
4108+struct ec_params_hibernation_delay {
4109+ /*
4110+ * Seconds to wait in G3 before hibernate. Pass in 0 to read the
4111+ * current settings without changing them.
4112+ */
4113+ uint32_t seconds;
4114+} __ec_align4;
4115+
4116+struct ec_response_hibernation_delay {
4117+ /*
4118+ * The current time in seconds in which the system has been in the G3
4119+ * state. This value is reset if the EC transitions out of G3.
4120+ */
4121+ uint32_t time_g3;
4122+
4123+ /*
4124+ * The current time remaining in seconds until the EC should hibernate.
4125+ * This value is also reset if the EC transitions out of G3.
4126+ */
4127+ uint32_t time_remaining;
4128+
4129+ /*
4130+ * The current time in seconds that the EC should wait in G3 before
4131+ * hibernating.
4132+ */
4133+ uint32_t hibernate_delay;
4134+} __ec_align4;
4135+
27424136 /* Inform the EC when entering a sleep state */
2743−#define EC_CMD_HOST_SLEEP_EVENT 0xa9
4137+#define EC_CMD_HOST_SLEEP_EVENT 0x00A9
27444138
27454139 enum host_sleep_event {
27464140 HOST_SLEEP_EVENT_S3_SUSPEND = 1,
27474141 HOST_SLEEP_EVENT_S3_RESUME = 2,
27484142 HOST_SLEEP_EVENT_S0IX_SUSPEND = 3,
2749− HOST_SLEEP_EVENT_S0IX_RESUME = 4
4143+ HOST_SLEEP_EVENT_S0IX_RESUME = 4,
4144+ /* S3 suspend with additional enabled wake sources */
4145+ HOST_SLEEP_EVENT_S3_WAKEABLE_SUSPEND = 5,
27504146 };
27514147
27524148 struct ec_params_host_sleep_event {
27534149 uint8_t sleep_event;
2754−} __packed;
4150+} __ec_align1;
27554151
27564152 /*
27574153 * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep
@@ -2782,7 +4178,7 @@ struct ec_params_host_sleep_event_v1 { · 24 unmodified lines
27824178
27834179 /* No parameters for non-suspend messages. */
27844180 };
2785−} __packed;
4181+} __ec_align2;
27864182
27874183 /* A timeout occurred when this bit is set */
27884184 #define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000
@@ -2808,42 +4204,72 @@ struct ec_response_host_sleep_event_v1 { · 19 unmodified lines
28084204
28094205 /* No response fields for non-resume messages. */
28104206 };
2811−} __packed;
4207+} __ec_align4;
4208+
4209+/*****************************************************************************/
4210+/* Device events */
4211+#define EC_CMD_DEVICE_EVENT 0x00AA
4212+
4213+enum ec_device_event {
4214+ EC_DEVICE_EVENT_TRACKPAD,
4215+ EC_DEVICE_EVENT_DSP,
4216+ EC_DEVICE_EVENT_WIFI,
4217+};
4218+
4219+enum ec_device_event_param {
4220+ /* Get and clear pending device events */
4221+ EC_DEVICE_EVENT_PARAM_GET_CURRENT_EVENTS,
4222+ /* Get device event mask */
4223+ EC_DEVICE_EVENT_PARAM_GET_ENABLED_EVENTS,
4224+ /* Set device event mask */
4225+ EC_DEVICE_EVENT_PARAM_SET_ENABLED_EVENTS,
4226+};
4227+
4228+#define EC_DEVICE_EVENT_MASK(event_code) BIT(event_code % 32)
4229+
4230+struct ec_params_device_event {
4231+ uint32_t event_mask;
4232+ uint8_t param;
4233+} __ec_align_size1;
4234+
4235+struct ec_response_device_event {
4236+ uint32_t event_mask;
4237+} __ec_align4;
28124238
28134239 /*****************************************************************************/
28144240 /* Smart battery pass-through */
28154241
28164242 /* Get / Set 16-bit smart battery registers */
2817−#define EC_CMD_SB_READ_WORD 0xb0
2818−#define EC_CMD_SB_WRITE_WORD 0xb1
4243+#define EC_CMD_SB_READ_WORD 0x00B0
4244+#define EC_CMD_SB_WRITE_WORD 0x00B1
28194245
28204246 /* Get / Set string smart battery parameters
28214247 * formatted as SMBUS "block".
28224248 */
2823−#define EC_CMD_SB_READ_BLOCK 0xb2
2824−#define EC_CMD_SB_WRITE_BLOCK 0xb3
4249+#define EC_CMD_SB_READ_BLOCK 0x00B2
4250+#define EC_CMD_SB_WRITE_BLOCK 0x00B3
28254251
28264252 struct ec_params_sb_rd {
28274253 uint8_t reg;
2828−} __packed;
4254+} __ec_align1;
28294255
28304256 struct ec_response_sb_rd_word {
28314257 uint16_t value;
2832−} __packed;
4258+} __ec_align2;
28334259
28344260 struct ec_params_sb_wr_word {
28354261 uint8_t reg;
28364262 uint16_t value;
2837−} __packed;
4263+} __ec_align1;
28384264
28394265 struct ec_response_sb_rd_block {
28404266 uint8_t data[32];
2841−} __packed;
4267+} __ec_align1;
28424268
28434269 struct ec_params_sb_wr_block {
28444270 uint8_t reg;
28454271 uint16_t data[32];
2846−} __packed;
4272+} __ec_align1;
28474273
28484274 /*****************************************************************************/
28494275 /* Battery vendor parameters
@@ -2854,7 +4280,7 @@ struct ec_params_sb_wr_block { · 4 unmodified lines
28544280 * requested value.
28554281 */
28564282
2857−#define EC_CMD_BATTERY_VENDOR_PARAM 0xb4
4283+#define EC_CMD_BATTERY_VENDOR_PARAM 0x00B4
28584284
28594285 enum ec_battery_vendor_param_mode {
28604286 BATTERY_VENDOR_PARAM_MODE_GET = 0,
@@ -2865,257 +4291,105 @@ struct ec_params_battery_vendor_param { · 4 unmodified lines
28654291 uint32_t param;
28664292 uint32_t value;
28674293 uint8_t mode;
2868−} __packed;
4294+} __ec_align_size1;
28694295
28704296 struct ec_response_battery_vendor_param {
28714297 uint32_t value;
2872−} __packed;
4298+} __ec_align4;
28734299
28744300 /*****************************************************************************/
2875−/* Commands for I2S recording on audio codec. */
2876−
2877−#define EC_CMD_CODEC_I2S 0x00BC
2878−
2879−enum ec_codec_i2s_subcmd {
2880− EC_CODEC_SET_SAMPLE_DEPTH = 0x0,
2881− EC_CODEC_SET_GAIN = 0x1,
2882− EC_CODEC_GET_GAIN = 0x2,
2883− EC_CODEC_I2S_ENABLE = 0x3,
2884− EC_CODEC_I2S_SET_CONFIG = 0x4,
2885− EC_CODEC_I2S_SET_TDM_CONFIG = 0x5,
2886− EC_CODEC_I2S_SET_BCLK = 0x6,
4301+/*
4302+ * Smart Battery Firmware Update Commands
4303+ */
4304+#define EC_CMD_SB_FW_UPDATE 0x00B5
4305+
4306+enum ec_sb_fw_update_subcmd {
4307+ EC_SB_FW_UPDATE_PREPARE = 0x0,
4308+ EC_SB_FW_UPDATE_INFO = 0x1, /*query sb info */
4309+ EC_SB_FW_UPDATE_BEGIN = 0x2, /*check if protected */
4310+ EC_SB_FW_UPDATE_WRITE = 0x3, /*check if protected */
4311+ EC_SB_FW_UPDATE_END = 0x4,
4312+ EC_SB_FW_UPDATE_STATUS = 0x5,
4313+ EC_SB_FW_UPDATE_PROTECT = 0x6,
4314+ EC_SB_FW_UPDATE_MAX = 0x7,
28874315 };
28884316
2889−enum ec_sample_depth_value {
2890− EC_CODEC_SAMPLE_DEPTH_16 = 0,
2891− EC_CODEC_SAMPLE_DEPTH_24 = 1,
2892−};
4317+#define SB_FW_UPDATE_CMD_WRITE_BLOCK_SIZE 32
4318+#define SB_FW_UPDATE_CMD_STATUS_SIZE 2
4319+#define SB_FW_UPDATE_CMD_INFO_SIZE 8
28934320
2894−enum ec_i2s_config {
2895− EC_DAI_FMT_I2S = 0,
2896− EC_DAI_FMT_RIGHT_J = 1,
2897− EC_DAI_FMT_LEFT_J = 2,
2898− EC_DAI_FMT_PCM_A = 3,
2899− EC_DAI_FMT_PCM_B = 4,
2900− EC_DAI_FMT_PCM_TDM = 5,
2901−};
4321+struct ec_sb_fw_update_header {
4322+ uint16_t subcmd; /* enum ec_sb_fw_update_subcmd */
4323+ uint16_t fw_id; /* firmware id */
4324+} __ec_align4;
29024325
2903−struct ec_param_codec_i2s {
2904− /*
2905− * enum ec_codec_i2s_subcmd
2906− */
2907− uint8_t cmd;
4326+struct ec_params_sb_fw_update {
4327+ struct ec_sb_fw_update_header hdr;
29084328 union {
2909− /*
2910− * EC_CODEC_SET_SAMPLE_DEPTH
2911− * Value should be one of ec_sample_depth_value.
2912− */
2913− uint8_t depth;
4329+ /* EC_SB_FW_UPDATE_PREPARE = 0x0 */
4330+ /* EC_SB_FW_UPDATE_INFO = 0x1 */
4331+ /* EC_SB_FW_UPDATE_BEGIN = 0x2 */
4332+ /* EC_SB_FW_UPDATE_END = 0x4 */
4333+ /* EC_SB_FW_UPDATE_STATUS = 0x5 */
4334+ /* EC_SB_FW_UPDATE_PROTECT = 0x6 */
4335+ /* Those have no args */
4336+
4337+ /* EC_SB_FW_UPDATE_WRITE = 0x3 */
4338+ struct __ec_align4 {
4339+ uint8_t data[SB_FW_UPDATE_CMD_WRITE_BLOCK_SIZE];
4340+ } write;
4341+ };
4342+} __ec_align4;
29144343
2915− /*
2916− * EC_CODEC_SET_GAIN
2917− * Value should be 0~43 for both channels.
2918− */
2919− struct ec_param_codec_i2s_set_gain {
2920− uint8_t left;
2921− uint8_t right;
2922− } __packed gain;
4344+struct ec_response_sb_fw_update {
4345+ union {
4346+ /* EC_SB_FW_UPDATE_INFO = 0x1 */
4347+ struct __ec_align1 {
4348+ uint8_t data[SB_FW_UPDATE_CMD_INFO_SIZE];
4349+ } info;
29234350
2924− /*
2925− * EC_CODEC_I2S_ENABLE
2926− * 1 to enable, 0 to disable.
2927− */
2928− uint8_t i2s_enable;
4351+ /* EC_SB_FW_UPDATE_STATUS = 0x5 */
4352+ struct __ec_align1 {
4353+ uint8_t data[SB_FW_UPDATE_CMD_STATUS_SIZE];
4354+ } status;
4355+ };
4356+} __ec_align1;
29294357
2930− /*
2931− * EC_CODEC_I2S_SET_COFNIG
2932− * Value should be one of ec_i2s_config.
2933− */
2934− uint8_t i2s_config;
4358+/*
4359+ * Entering Verified Boot Mode Command
4360+ * Default mode is VBOOT_MODE_NORMAL if EC did not receive this command.
4361+ * Valid Modes are: normal, developer, and recovery.
4362+ */
4363+#define EC_CMD_ENTERING_MODE 0x00B6
29354364
2936− /*
2937− * EC_CODEC_I2S_SET_TDM_CONFIG
2938− * Value should be one of ec_i2s_config.
2939− */
2940− struct ec_param_codec_i2s_tdm {
2941− /*
2942− * 0 to 496
2943− */
2944− int16_t ch0_delay;
2945− /*
2946− * -1 to 496
2947− */
2948− int16_t ch1_delay;
2949− uint8_t adjacent_to_ch0;
2950− uint8_t adjacent_to_ch1;
2951− } __packed tdm_param;
4365+struct ec_params_entering_mode {
4366+ int vboot_mode;
4367+} __ec_align4;
29524368
2953− /*
2954− * EC_CODEC_I2S_SET_BCLK
2955− */
2956− uint32_t bclk;
2957− };
2958−} __packed;
2959−
2960−/*
2961− * For subcommand EC_CODEC_GET_GAIN.
2962− */
2963−struct ec_response_codec_gain {
2964− uint8_t left;
2965− uint8_t right;
2966−} __packed;
4369+#define VBOOT_MODE_NORMAL 0
4370+#define VBOOT_MODE_DEVELOPER 1
4371+#define VBOOT_MODE_RECOVERY 2
29674372
29684373 /*****************************************************************************/
2969−/* System commands */
2970−
29714374 /*
2972− * TODO(crosbug.com/p/23747): This is a confusing name, since it doesn't
2973− * necessarily reboot the EC. Rename to "image" or something similar?
4375+ * I2C passthru protection command: Protects I2C tunnels against access on
4376+ * certain addresses (board-specific).
29744377 */
2975−#define EC_CMD_REBOOT_EC 0xd2
4378+#define EC_CMD_I2C_PASSTHRU_PROTECT 0x00B7
29764379
2977−/* Command */
2978−enum ec_reboot_cmd {
2979− EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */
2980− EC_REBOOT_JUMP_RO = 1, /* Jump to RO without rebooting */
2981− EC_REBOOT_JUMP_RW = 2, /* Jump to RW without rebooting */
2982− /* (command 3 was jump to RW-B) */
2983− EC_REBOOT_COLD = 4, /* Cold-reboot */
2984− EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */
2985− EC_REBOOT_HIBERNATE = 6 /* Hibernate EC */
4380+enum ec_i2c_passthru_protect_subcmd {
4381+ EC_CMD_I2C_PASSTHRU_PROTECT_STATUS = 0x0,
4382+ EC_CMD_I2C_PASSTHRU_PROTECT_ENABLE = 0x1,
29864383 };
29874384
2988−/* Flags for ec_params_reboot_ec.reboot_flags */
2989−#define EC_REBOOT_FLAG_RESERVED0 (1 << 0) /* Was recovery request */
2990−#define EC_REBOOT_FLAG_ON_AP_SHUTDOWN (1 << 1) /* Reboot after AP shutdown */
2991−
2992−struct ec_params_reboot_ec {
2993− uint8_t cmd; /* enum ec_reboot_cmd */
2994− uint8_t flags; /* See EC_REBOOT_FLAG_* */
2995−} __packed;
2996−
2997−/*
2998− * Get information on last EC panic.
2999− *
3000− * Returns variable-length platform-dependent panic information. See panic.h
3001− * for details.
3002− */
3003−#define EC_CMD_GET_PANIC_INFO 0xd3
3004−
3005−/*****************************************************************************/
3006−/*
3007− * ACPI commands
3008− *
3009− * These are valid ONLY on the ACPI command/data port.
3010− */
3011−
3012−/*
3013− * ACPI Read Embedded Controller
3014− *
3015− * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*).
3016− *
3017− * Use the following sequence:
3018− *
3019− * - Write EC_CMD_ACPI_READ to EC_LPC_ADDR_ACPI_CMD
3020− * - Wait for EC_LPC_CMDR_PENDING bit to clear
3021− * - Write address to EC_LPC_ADDR_ACPI_DATA
3022− * - Wait for EC_LPC_CMDR_DATA bit to set
3023− * - Read value from EC_LPC_ADDR_ACPI_DATA
3024− */
3025−#define EC_CMD_ACPI_READ 0x80
3026−
3027−/*
3028− * ACPI Write Embedded Controller
3029− *
3030− * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*).
3031− *
3032− * Use the following sequence:
3033− *
3034− * - Write EC_CMD_ACPI_WRITE to EC_LPC_ADDR_ACPI_CMD
3035− * - Wait for EC_LPC_CMDR_PENDING bit to clear
3036− * - Write address to EC_LPC_ADDR_ACPI_DATA
3037− * - Wait for EC_LPC_CMDR_PENDING bit to clear
3038− * - Write value to EC_LPC_ADDR_ACPI_DATA
3039− */
3040−#define EC_CMD_ACPI_WRITE 0x81
3041−
3042−/*
3043− * ACPI Query Embedded Controller
3044− *
3045− * This clears the lowest-order bit in the currently pending host events, and
3046− * sets the result code to the 1-based index of the bit (event 0x00000001 = 1,
3047− * event 0x80000000 = 32), or 0 if no event was pending.
3048− */
3049−#define EC_CMD_ACPI_QUERY_EVENT 0x84
3050−
3051−/* Valid addresses in ACPI memory space, for read/write commands */
3052−
3053−/* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */
3054−#define EC_ACPI_MEM_VERSION 0x00
3055−/*
3056− * Test location; writing value here updates test compliment byte to (0xff -
3057− * value).
3058− */
3059−#define EC_ACPI_MEM_TEST 0x01
3060−/* Test compliment; writes here are ignored. */
3061−#define EC_ACPI_MEM_TEST_COMPLIMENT 0x02
3062−
3063−/* Keyboard backlight brightness percent (0 - 100) */
3064−#define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03
3065−/* DPTF Target Fan Duty (0-100, 0xff for auto/none) */
3066−#define EC_ACPI_MEM_FAN_DUTY 0x04
3067−
3068−/*
3069− * DPTF temp thresholds. Any of the EC's temp sensors can have up to two
3070− * independent thresholds attached to them. The current value of the ID
3071− * register determines which sensor is affected by the THRESHOLD and COMMIT
3072− * registers. The THRESHOLD register uses the same EC_TEMP_SENSOR_OFFSET scheme
3073− * as the memory-mapped sensors. The COMMIT register applies those settings.
3074− *
3075− * The spec does not mandate any way to read back the threshold settings
3076− * themselves, but when a threshold is crossed the AP needs a way to determine
3077− * which sensor(s) are responsible. Each reading of the ID register clears and
3078− * returns one sensor ID that has crossed one of its threshold (in either
3079− * direction) since the last read. A value of 0xFF means "no new thresholds
3080− * have tripped". Setting or enabling the thresholds for a sensor will clear
3081− * the unread event count for that sensor.
3082− */
3083−#define EC_ACPI_MEM_TEMP_ID 0x05
3084−#define EC_ACPI_MEM_TEMP_THRESHOLD 0x06
3085−#define EC_ACPI_MEM_TEMP_COMMIT 0x07
3086−/*
3087− * Here are the bits for the COMMIT register:
3088− * bit 0 selects the threshold index for the chosen sensor (0/1)
3089− * bit 1 enables/disables the selected threshold (0 = off, 1 = on)
3090− * Each write to the commit register affects one threshold.
3091− */
3092−#define EC_ACPI_MEM_TEMP_COMMIT_SELECT_MASK (1 << 0)
3093−#define EC_ACPI_MEM_TEMP_COMMIT_ENABLE_MASK (1 << 1)
3094−/*
3095− * Example:
3096− *
3097− * Set the thresholds for sensor 2 to 50 C and 60 C:
3098− * write 2 to [0x05] -- select temp sensor 2
3099− * write 0x7b to [0x06] -- C_TO_K(50) - EC_TEMP_SENSOR_OFFSET
3100− * write 0x2 to [0x07] -- enable threshold 0 with this value
3101− * write 0x85 to [0x06] -- C_TO_K(60) - EC_TEMP_SENSOR_OFFSET
3102− * write 0x3 to [0x07] -- enable threshold 1 with this value
3103− *
3104− * Disable the 60 C threshold, leaving the 50 C threshold unchanged:
3105− * write 2 to [0x05] -- select temp sensor 2
3106− * write 0x1 to [0x07] -- disable threshold 1
3107− */
3108−
3109−/* DPTF battery charging current limit */
3110−#define EC_ACPI_MEM_CHARGING_LIMIT 0x08
3111−
3112−/* Charging limit is specified in 64 mA steps */
3113−#define EC_ACPI_MEM_CHARGING_LIMIT_STEP_MA 64
3114−/* Value to disable DPTF battery charging limit */
3115−#define EC_ACPI_MEM_CHARGING_LIMIT_DISABLED 0xff
4385+struct ec_params_i2c_passthru_protect {
4386+ uint8_t subcmd;
4387+ uint8_t port; /* I2C port number */
4388+} __ec_align1;
31164389
3117−/* Current version of ACPI memory address space */
3118−#define EC_ACPI_MEM_VERSION_CURRENT 1
4390+struct ec_response_i2c_passthru_protect {
4391+ uint8_t status; /* Status flags (0: unlocked, 1: locked) */
4392+} __ec_align1;
31194393
31204394
31214395 /*****************************************************************************/
@@ -3124,7 +4398,8 @@ struct ec_params_reboot_ec { · 2 unmodified lines
31244398 *
31254399 * These commands are for sending and receiving message via HDMI CEC
31264400 */
3127−#define EC_MAX_CEC_MSG_LEN 16
4401+
4402+#define MAX_CEC_MSG_LEN 16
31284403
31294404 /* CEC message from the AP to be written on the CEC bus */
31304405 #define EC_CMD_CEC_WRITE_MSG 0x00B8
@@ -3134,8 +4409,8 @@ struct ec_params_reboot_ec { · 3 unmodified lines
31344409 * @msg: message content to write to the CEC bus
31354410 */
31364411 struct ec_params_cec_write {
3137− uint8_t msg[EC_MAX_CEC_MSG_LEN];
3138−} __packed;
4412+ uint8_t msg[MAX_CEC_MSG_LEN];
4413+} __ec_align1;
31394414
31404415 /* Set various CEC parameters */
31414416 #define EC_CMD_CEC_SET 0x00BA
@@ -3144,14 +4419,14 @@ struct ec_params_cec_write { · 2 unmodified lines
31444419 * struct ec_params_cec_set - CEC parameters set
31454420 * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS
31464421 * @val: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC
3147− * or 1 to enable CEC functionality, in case cmd is CEC_CMD_LOGICAL_ADDRESS,
3148− * this field encodes the requested logical address between 0 and 15
3149− * or 0xff to unregister
4422+ * or 1 to enable CEC functionality, in case cmd is
4423+ * CEC_CMD_LOGICAL_ADDRESS, this field encodes the requested logical
4424+ * address between 0 and 15 or 0xff to unregister
31504425 */
31514426 struct ec_params_cec_set {
31524427 uint8_t cmd; /* enum cec_command */
31534428 uint8_t val;
3154−} __packed;
4429+} __ec_align1;
31554430
31564431 /* Read various CEC parameters */
31574432 #define EC_CMD_CEC_GET 0x00BB
@@ -3162,7 +4437,7 @@ struct ec_params_cec_set { · 4 unmodified lines
31624437 */
31634438 struct ec_params_cec_get {
31644439 uint8_t cmd; /* enum cec_command */
3165−} __packed;
4440+} __ec_align1;
31664441
31674442 /**
31684443 * struct ec_response_cec_get - CEC parameters get response
@@ -3173,10 +4448,10 @@ struct ec_params_cec_get { · 4 unmodified lines
31734448 */
31744449 struct ec_response_cec_get {
31754450 uint8_t val;
3176−} __packed;
4451+} __ec_align1;
31774452
31784453 /* CEC parameters command */
3179−enum ec_cec_command {
4454+enum cec_command {
31804455 /* CEC reading, writing and events enable */
31814456 CEC_CMD_ENABLE,
31824457 /* CEC logical address */
@@ -3191,6 +4466,134 @@ enum mkbp_cec_event { · 8 unmodified lines
31914466 EC_MKBP_CEC_SEND_FAILED = BIT(1),
31924467 };
31934468
4469+/*****************************************************************************/
4470+
4471+/* Commands for I2S recording on audio codec. */
4472+
4473+#define EC_CMD_CODEC_I2S 0x00BC
4474+#define EC_WOV_I2S_SAMPLE_RATE 48000
4475+
4476+enum ec_codec_i2s_subcmd {
4477+ EC_CODEC_SET_SAMPLE_DEPTH = 0x0,
4478+ EC_CODEC_SET_GAIN = 0x1,
4479+ EC_CODEC_GET_GAIN = 0x2,
4480+ EC_CODEC_I2S_ENABLE = 0x3,
4481+ EC_CODEC_I2S_SET_CONFIG = 0x4,
4482+ EC_CODEC_I2S_SET_TDM_CONFIG = 0x5,
4483+ EC_CODEC_I2S_SET_BCLK = 0x6,
4484+ EC_CODEC_I2S_SUBCMD_COUNT = 0x7,
4485+};
4486+
4487+enum ec_sample_depth_value {
4488+ EC_CODEC_SAMPLE_DEPTH_16 = 0,
4489+ EC_CODEC_SAMPLE_DEPTH_24 = 1,
4490+};
4491+
4492+enum ec_i2s_config {
4493+ EC_DAI_FMT_I2S = 0,
4494+ EC_DAI_FMT_RIGHT_J = 1,
4495+ EC_DAI_FMT_LEFT_J = 2,
4496+ EC_DAI_FMT_PCM_A = 3,
4497+ EC_DAI_FMT_PCM_B = 4,
4498+ EC_DAI_FMT_PCM_TDM = 5,
4499+};
4500+
4501+/*
4502+ * For subcommand EC_CODEC_GET_GAIN.
4503+ */
4504+struct __ec_align1 ec_codec_i2s_gain {
4505+ uint8_t left;
4506+ uint8_t right;
4507+};
4508+
4509+struct __ec_todo_unpacked ec_param_codec_i2s_tdm {
4510+ int16_t ch0_delay; /* 0 to 496 */
4511+ int16_t ch1_delay; /* -1 to 496 */
4512+ uint8_t adjacent_to_ch0;
4513+ uint8_t adjacent_to_ch1;
4514+};
4515+
4516+struct __ec_todo_packed ec_param_codec_i2s {
4517+ /* enum ec_codec_i2s_subcmd */
4518+ uint8_t cmd;
4519+ union {
4520+ /*
4521+ * EC_CODEC_SET_SAMPLE_DEPTH
4522+ * Value should be one of ec_sample_depth_value.
4523+ */
4524+ uint8_t depth;
4525+
4526+ /*
4527+ * EC_CODEC_SET_GAIN
4528+ * Value should be 0~43 for both channels.
4529+ */
4530+ struct ec_codec_i2s_gain gain;
4531+
4532+ /*
4533+ * EC_CODEC_I2S_ENABLE
4534+ * 1 to enable, 0 to disable.
4535+ */
4536+ uint8_t i2s_enable;
4537+
4538+ /*
4539+ * EC_CODEC_I2S_SET_CONFIG
4540+ * Value should be one of ec_i2s_config.
4541+ */
4542+ uint8_t i2s_config;
4543+
4544+ /*
4545+ * EC_CODEC_I2S_SET_TDM_CONFIG
4546+ * Value should be one of ec_i2s_config.
4547+ */
4548+ struct ec_param_codec_i2s_tdm tdm_param;
4549+
4550+ /*
4551+ * EC_CODEC_I2S_SET_BCLK
4552+ */
4553+ uint32_t bclk;
4554+ };
4555+};
4556+
4557+
4558+/*****************************************************************************/
4559+/* System commands */
4560+
4561+/*
4562+ * TODO(crosbug.com/p/23747): This is a confusing name, since it doesn't
4563+ * necessarily reboot the EC. Rename to "image" or something similar?
4564+ */
4565+#define EC_CMD_REBOOT_EC 0x00D2
4566+
4567+/* Command */
4568+enum ec_reboot_cmd {
4569+ EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */
4570+ EC_REBOOT_JUMP_RO = 1, /* Jump to RO without rebooting */
4571+ EC_REBOOT_JUMP_RW = 2, /* Jump to active RW without rebooting */
4572+ /* (command 3 was jump to RW-B) */
4573+ EC_REBOOT_COLD = 4, /* Cold-reboot */
4574+ EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */
4575+ EC_REBOOT_HIBERNATE = 6, /* Hibernate EC */
4576+ EC_REBOOT_HIBERNATE_CLEAR_AP_OFF = 7, /* and clears AP_OFF flag */
4577+};
4578+
4579+/* Flags for ec_params_reboot_ec.reboot_flags */
4580+#define EC_REBOOT_FLAG_RESERVED0 BIT(0) /* Was recovery request */
4581+#define EC_REBOOT_FLAG_ON_AP_SHUTDOWN BIT(1) /* Reboot after AP shutdown */
4582+#define EC_REBOOT_FLAG_SWITCH_RW_SLOT BIT(2) /* Switch RW slot */
4583+
4584+struct ec_params_reboot_ec {
4585+ uint8_t cmd; /* enum ec_reboot_cmd */
4586+ uint8_t flags; /* See EC_REBOOT_FLAG_* */
4587+} __ec_align1;
4588+
4589+/*
4590+ * Get information on last EC panic.
4591+ *
4592+ * Returns variable-length platform-dependent panic information. See panic.h
4593+ * for details.
4594+ */
4595+#define EC_CMD_GET_PANIC_INFO 0x00D3
4596+
31944597 /*****************************************************************************/
31954598 /*
31964599 * Special commands
@@ -3208,7 +4611,7 @@ enum mkbp_cec_event { · 11 unmodified lines
32084611 *
32094612 * Use EC_CMD_REBOOT_EC to reboot the EC more politely.
32104613 */
3211−#define EC_CMD_REBOOT 0xd1 /* Think "die" */
4614+#define EC_CMD_REBOOT 0x00D1 /* Think "die" */
32124615
32134616 /*
32144617 * Resend last response (not supported on LPC).
@@ -3217,7 +4620,7 @@ enum mkbp_cec_event { · 2 unmodified lines
32174620 * there was no previous command, or the previous command's response was too
32184621 * big to save.
32194622 */
3220−#define EC_CMD_RESEND_RESPONSE 0xdb
4623+#define EC_CMD_RESEND_RESPONSE 0x00DB
32214624
32224625 /*
32234626 * This header byte on a command indicate version 0. Any header byte less
@@ -3229,9 +4632,7 @@ enum mkbp_cec_event { · 5 unmodified lines
32294632 *
32304633 * The old EC interface must not use commands 0xdc or higher.
32314634 */
3232−#define EC_CMD_VERSION0 0xdc
3233−
3234−#endif /* !__ACPI__ */
4635+#define EC_CMD_VERSION0 0x00DC
32354636
32364637 /*****************************************************************************/
32374638 /*
@@ -3241,21 +4642,56 @@ enum mkbp_cec_event { · 3 unmodified lines
32414642 */
32424643
32434644 /* EC to PD MCU exchange status command */
3244−#define EC_CMD_PD_EXCHANGE_STATUS 0x100
4645+#define EC_CMD_PD_EXCHANGE_STATUS 0x0100
4646+#define EC_VER_PD_EXCHANGE_STATUS 2
4647+
4648+enum pd_charge_state {
4649+ PD_CHARGE_NO_CHANGE = 0, /* Don't change charge state */
4650+ PD_CHARGE_NONE, /* No charging allowed */
4651+ PD_CHARGE_5V, /* 5V charging only */
4652+ PD_CHARGE_MAX /* Charge at max voltage */
4653+};
32454654
32464655 /* Status of EC being sent to PD */
4656+#define EC_STATUS_HIBERNATING BIT(0)
4657+
32474658 struct ec_params_pd_status {
3248− int8_t batt_soc; /* battery state of charge */
3249−} __packed;
4659+ uint8_t status; /* EC status */
4660+ int8_t batt_soc; /* battery state of charge */
4661+ uint8_t charge_state; /* charging state (from enum pd_charge_state) */
4662+} __ec_align1;
32504663
32514664 /* Status of PD being sent back to EC */
4665+#define PD_STATUS_HOST_EVENT BIT(0) /* Forward host event to AP */
4666+#define PD_STATUS_IN_RW BIT(1) /* Running RW image */
4667+#define PD_STATUS_JUMPED_TO_IMAGE BIT(2) /* Current image was jumped to */
4668+#define PD_STATUS_TCPC_ALERT_0 BIT(3) /* Alert active in port 0 TCPC */
4669+#define PD_STATUS_TCPC_ALERT_1 BIT(4) /* Alert active in port 1 TCPC */
4670+#define PD_STATUS_TCPC_ALERT_2 BIT(5) /* Alert active in port 2 TCPC */
4671+#define PD_STATUS_TCPC_ALERT_3 BIT(6) /* Alert active in port 3 TCPC */
4672+#define PD_STATUS_EC_INT_ACTIVE (PD_STATUS_TCPC_ALERT_0 | \
4673+ PD_STATUS_TCPC_ALERT_1 | \
4674+ PD_STATUS_HOST_EVENT)
32524675 struct ec_response_pd_status {
3253− int8_t status; /* PD MCU status */
3254− uint32_t curr_lim_ma; /* input current limit */
3255−} __packed;
4676+ uint32_t curr_lim_ma; /* input current limit */
4677+ uint16_t status; /* PD MCU status */
4678+ int8_t active_charge_port; /* active charging port */
4679+} __ec_align_size1;
4680+
4681+/* AP to PD MCU host event status command, cleared on read */
4682+#define EC_CMD_PD_HOST_EVENT_STATUS 0x0104
4683+
4684+/* PD MCU host event status bits */
4685+#define PD_EVENT_UPDATE_DEVICE BIT(0)
4686+#define PD_EVENT_POWER_CHANGE BIT(1)
4687+#define PD_EVENT_IDENTITY_RECEIVED BIT(2)
4688+#define PD_EVENT_DATA_SWAP BIT(3)
4689+struct ec_response_host_event_status {
4690+ uint32_t status; /* PD MCU host event status */
4691+} __ec_align4;
32564692
32574693 /* Set USB type-C port role and muxes */
3258−#define EC_CMD_USB_PD_CONTROL 0x101
4694+#define EC_CMD_USB_PD_CONTROL 0x0101
32594695
32604696 enum usb_pd_control_role {
32614697 USB_PD_CTRL_ROLE_NO_CHANGE = 0,
@@ -3263,6 +4699,8 @@ enum usb_pd_control_role { · 1 unmodified line
32634699 USB_PD_CTRL_ROLE_TOGGLE_OFF = 2,
32644700 USB_PD_CTRL_ROLE_FORCE_SINK = 3,
32654701 USB_PD_CTRL_ROLE_FORCE_SOURCE = 4,
4702+ USB_PD_CTRL_ROLE_FREEZE = 5,
4703+ USB_PD_CTRL_ROLE_COUNT
32664704 };
32674705
32684706 enum usb_pd_control_mux {
@@ -3272,6 +4710,7 @@ enum usb_pd_control_mux { · 3 unmodified lines
32724710 USB_PD_CTRL_MUX_DP = 3,
32734711 USB_PD_CTRL_MUX_DOCK = 4,
32744712 USB_PD_CTRL_MUX_AUTO = 5,
4713+ USB_PD_CTRL_MUX_COUNT
32754714 };
32764715
32774716 enum usb_pd_control_swap {
@@ -3287,11 +4726,11 @@ struct ec_params_usb_pd_control { · 9 unmodified lines
32874726 uint8_t role;
32884727 uint8_t mux;
32894728 uint8_t swap;
3290−} __packed;
4729+} __ec_align1;
32914730
3292−#define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */
3293−#define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */
3294−#define PD_CTRL_RESP_ENABLED_PD_CAPABLE (1 << 2) /* Partner is PD capable */
4731+#define PD_CTRL_RESP_ENABLED_COMMS BIT(0) /* Communication enabled */
4732+#define PD_CTRL_RESP_ENABLED_CONNECTED BIT(1) /* Device connected */
4733+#define PD_CTRL_RESP_ENABLED_PD_CAPABLE BIT(2) /* Partner is PD capable */
32954734
32964735 #define PD_CTRL_RESP_ROLE_POWER BIT(0) /* 0=SNK/1=SRC */
32974736 #define PD_CTRL_RESP_ROLE_DATA BIT(1) /* 0=UFP/1=DFP */
@@ -3301,28 +4740,54 @@ struct ec_params_usb_pd_control { · 3 unmodified lines
33014740 #define PD_CTRL_RESP_ROLE_USB_COMM BIT(5) /* Partner USB comm capable */
33024741 #define PD_CTRL_RESP_ROLE_EXT_POWERED BIT(6) /* Partner externally powerd */
33034742
4743+struct ec_response_usb_pd_control {
4744+ uint8_t enabled;
4745+ uint8_t role;
4746+ uint8_t polarity;
4747+ uint8_t state;
4748+} __ec_align1;
4749+
33044750 struct ec_response_usb_pd_control_v1 {
33054751 uint8_t enabled;
33064752 uint8_t role;
33074753 uint8_t polarity;
33084754 char state[32];
3309−} __packed;
4755+} __ec_align1;
4756+
4757+/* Values representing usbc PD CC state */
4758+#define USBC_PD_CC_NONE 0 /* No accessory connected */
4759+#define USBC_PD_CC_NO_UFP 1 /* No UFP accessory connected */
4760+#define USBC_PD_CC_AUDIO_ACC 2 /* Audio accessory connected */
4761+#define USBC_PD_CC_DEBUG_ACC 3 /* Debug accessory connected */
4762+#define USBC_PD_CC_UFP_ATTACHED 4 /* UFP attached to usbc */
4763+#define USBC_PD_CC_DFP_ATTACHED 5 /* DPF attached to usbc */
4764+
4765+struct ec_response_usb_pd_control_v2 {
4766+ uint8_t enabled;
4767+ uint8_t role;
4768+ uint8_t polarity;
4769+ char state[32];
4770+ uint8_t cc_state; /* USBC_PD_CC_*Encoded cc state */
4771+ uint8_t dp_mode; /* Current DP pin mode (MODE_DP_PIN_[A-E]) */
4772+ /* CL:1500994 Current cable type */
4773+ uint8_t reserved_cable_type;
4774+} __ec_align1;
33104775
3311−#define EC_CMD_USB_PD_PORTS 0x102
4776+#define EC_CMD_USB_PD_PORTS 0x0102
33124777
33134778 /* Maximum number of PD ports on a device, num_ports will be <= this */
33144779 #define EC_USB_PD_MAX_PORTS 8
33154780
33164781 struct ec_response_usb_pd_ports {
33174782 uint8_t num_ports;
3318−} __packed;
4783+} __ec_align1;
33194784
3320−#define EC_CMD_USB_PD_POWER_INFO 0x103
4785+#define EC_CMD_USB_PD_POWER_INFO 0x0103
33214786
33224787 #define PD_POWER_CHARGING_PORT 0xff
33234788 struct ec_params_usb_pd_power_info {
33244789 uint8_t port;
3325−} __packed;
4790+} __ec_align1;
33264791
33274792 enum usb_chg_type {
33284793 USB_CHG_TYPE_NONE,
@@ -3335,6 +4800,7 @@ enum usb_chg_type { · 6 unmodified lines
33354800 USB_CHG_TYPE_OTHER,
33364801 USB_CHG_TYPE_VBUS,
33374802 USB_CHG_TYPE_UNKNOWN,
4803+ USB_CHG_TYPE_DEDICATED,
33384804 };
33394805 enum usb_power_roles {
33404806 USB_PD_PORT_POWER_DISCONNECTED,
@@ -3348,7 +4814,7 @@ struct usb_chg_measures { · 7 unmodified lines
33484814 uint16_t voltage_now;
33494815 uint16_t current_max;
33504816 uint16_t current_lim;
3351−} __packed;
4817+} __ec_align2;
33524818
33534819 struct ec_response_usb_pd_power_info {
33544820 uint8_t role;
@@ -3357,11 +4823,8 @@ struct ec_response_usb_pd_power_info { · 2 unmodified lines
33574823 uint8_t reserved1;
33584824 struct usb_chg_measures meas;
33594825 uint32_t max_power;
3360−} __packed;
4826+} __ec_align4;
33614827
3362−struct ec_params_usb_pd_info_request {
3363− uint8_t port;
3364−} __packed;
33654828
33664829 /*
33674830 * This command will return the number of USB PD charge port + the number
@@ -3371,7 +4834,47 @@ struct ec_params_usb_pd_info_request { · 3 unmodified lines
33714834 #define EC_CMD_CHARGE_PORT_COUNT 0x0105
33724835 struct ec_response_charge_port_count {
33734836 uint8_t port_count;
3374−} __packed;
4837+} __ec_align1;
4838+
4839+/* Write USB-PD device FW */
4840+#define EC_CMD_USB_PD_FW_UPDATE 0x0110
4841+
4842+enum usb_pd_fw_update_cmds {
4843+ USB_PD_FW_REBOOT,
4844+ USB_PD_FW_FLASH_ERASE,
4845+ USB_PD_FW_FLASH_WRITE,
4846+ USB_PD_FW_ERASE_SIG,
4847+};
4848+
4849+struct ec_params_usb_pd_fw_update {
4850+ uint16_t dev_id;
4851+ uint8_t cmd;
4852+ uint8_t port;
4853+ uint32_t size; /* Size to write in bytes */
4854+ /* Followed by data to write */
4855+} __ec_align4;
4856+
4857+/* Write USB-PD Accessory RW_HASH table entry */
4858+#define EC_CMD_USB_PD_RW_HASH_ENTRY 0x0111
4859+/* RW hash is first 20 bytes of SHA-256 of RW section */
4860+#define PD_RW_HASH_SIZE 20
4861+struct ec_params_usb_pd_rw_hash_entry {
4862+ uint16_t dev_id;
4863+ uint8_t dev_rw_hash[PD_RW_HASH_SIZE];
4864+ uint8_t reserved; /*
4865+ * For alignment of current_image
4866+ * TODO(rspangler) but it's not aligned!
4867+ * Should have been reserved[2].
4868+ */
4869+ uint32_t current_image; /* One of ec_current_image */
4870+} __ec_align1;
4871+
4872+/* Read USB-PD Accessory info */
4873+#define EC_CMD_USB_PD_DEV_INFO 0x0112
4874+
4875+struct ec_params_usb_pd_info_request {
4876+ uint8_t port;
4877+} __ec_align1;
33754878
33764879 /* Read USB-PD Device discovery info */
33774880 #define EC_CMD_USB_PD_DISCOVERY 0x0113
@@ -3379,7 +4882,7 @@ struct ec_params_usb_pd_discovery_entry { · 1 unmodified line
33794882 uint16_t vid; /* USB-IF VID */
33804883 uint16_t pid; /* USB-IF PID */
33814884 uint8_t ptype; /* product type (hub,periph,cable,ama) */
3382−} __packed;
4885+} __ec_align_size1;
33834886
33844887 /* Override default charge behavior */
33854888 #define EC_CMD_PD_CHARGE_PORT_OVERRIDE 0x0114
@@ -3393,9 +4896,13 @@ enum usb_pd_override_ports { · 7 unmodified lines
33934896
33944897 struct ec_params_charge_port_override {
33954898 int16_t override_port; /* Override port# */
3396−} __packed;
4899+} __ec_align2;
33974900
3398−/* Read (and delete) one entry of PD event log */
4901+/*
4902+ * Read (and delete) one entry of PD event log.
4903+ * TODO(crbug.com/751742): Make this host command more generic to accommodate
4904+ * future non-PD logs that use the same internal EC event_log.
4905+ */
33994906 #define EC_CMD_PD_GET_LOG_ENTRY 0x0115
34004907
34014908 struct ec_response_pd_log {
@@ -3404,7 +4911,7 @@ struct ec_response_pd_log { · 2 unmodified lines
34044911 uint8_t size_port; /* [7:5] port number [4:0] payload size in bytes */
34054912 uint16_t data; /* type-defined data payload */
34064913 uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */
3407−} __packed;
4914+} __ec_align4;
34084915
34094916 /* The timestamp is the microsecond counter shifted to get about a ms. */
34104917 #define PD_LOG_TIMESTAMP_SHIFT 10 /* 1 LSB = 1024us */
@@ -3470,35 +4977,698 @@ struct mcdp_version { · 59 unmodified lines
34704977 uint8_t major;
34714978 uint8_t minor;
34724979 uint16_t build;
3473−} __packed;
4980+} __ec_align4;
34744981
34754982 struct mcdp_info {
34764983 uint8_t family[2];
34774984 uint8_t chipid[2];
34784985 struct mcdp_version irom;
34794986 struct mcdp_version fw;
3480−} __packed;
4987+} __ec_align4;
34814988
34824989 /* struct mcdp_info field decoding */
34834990 #define MCDP_CHIPID(chipid) ((chipid[0] << 8) | chipid[1])
34844991 #define MCDP_FAMILY(family) ((family[0] << 8) | family[1])
34854992
4993+/* Get/Set USB-PD Alternate mode info */
4994+#define EC_CMD_USB_PD_GET_AMODE 0x0116
4995+struct ec_params_usb_pd_get_mode_request {
4996+ uint16_t svid_idx; /* SVID index to get */
4997+ uint8_t port; /* port */
4998+} __ec_align_size1;
4999+
5000+struct ec_params_usb_pd_get_mode_response {
5001+ uint16_t svid; /* SVID */
5002+ uint16_t opos; /* Object Position */
5003+ uint32_t vdo[6]; /* Mode VDOs */
5004+} __ec_align4;
5005+
5006+#define EC_CMD_USB_PD_SET_AMODE 0x0117
5007+
5008+enum pd_mode_cmd {
5009+ PD_EXIT_MODE = 0,
5010+ PD_ENTER_MODE = 1,
5011+ /* Not a command. Do NOT remove. */
5012+ PD_MODE_CMD_COUNT,
5013+};
5014+
5015+struct ec_params_usb_pd_set_mode_request {
5016+ uint32_t cmd; /* enum pd_mode_cmd */
5017+ uint16_t svid; /* SVID to set */
5018+ uint8_t opos; /* Object Position */
5019+ uint8_t port; /* port */
5020+} __ec_align4;
5021+
5022+/* Ask the PD MCU to record a log of a requested type */
5023+#define EC_CMD_PD_WRITE_LOG_ENTRY 0x0118
5024+
5025+struct ec_params_pd_write_log_entry {
5026+ uint8_t type; /* event type : see PD_EVENT_xx above */
5027+ uint8_t port; /* port#, or 0 for events unrelated to a given port */
5028+} __ec_align1;
5029+
5030+
5031+/* Control USB-PD chip */
5032+#define EC_CMD_PD_CONTROL 0x0119
5033+
5034+enum ec_pd_control_cmd {
5035+ PD_SUSPEND = 0, /* Suspend the PD chip (EC: stop talking to PD) */
5036+ PD_RESUME, /* Resume the PD chip (EC: start talking to PD) */
5037+ PD_RESET, /* Force reset the PD chip */
5038+ PD_CONTROL_DISABLE, /* Disable further calls to this command */
5039+ PD_CHIP_ON, /* Power on the PD chip */
5040+};
5041+
5042+struct ec_params_pd_control {
5043+ uint8_t chip; /* chip id */
5044+ uint8_t subcmd;
5045+} __ec_align1;
5046+
34865047 /* Get info about USB-C SS muxes */
3487−#define EC_CMD_USB_PD_MUX_INFO 0x11a
5048+#define EC_CMD_USB_PD_MUX_INFO 0x011A
34885049
34895050 struct ec_params_usb_pd_mux_info {
34905051 uint8_t port; /* USB-C port number */
3491−} __packed;
5052+} __ec_align1;
34925053
34935054 /* Flags representing mux state */
3494−#define USB_PD_MUX_USB_ENABLED (1 << 0)
3495−#define USB_PD_MUX_DP_ENABLED (1 << 1)
3496−#define USB_PD_MUX_POLARITY_INVERTED (1 << 2)
3497−#define USB_PD_MUX_HPD_IRQ (1 << 3)
5055+#define USB_PD_MUX_USB_ENABLED BIT(0) /* USB connected */
5056+#define USB_PD_MUX_DP_ENABLED BIT(1) /* DP connected */
5057+#define USB_PD_MUX_POLARITY_INVERTED BIT(2) /* CC line Polarity inverted */
5058+#define USB_PD_MUX_HPD_IRQ BIT(3) /* HPD IRQ is asserted */
5059+#define USB_PD_MUX_HPD_LVL BIT(4) /* HPD level is asserted */
34985060
34995061 struct ec_response_usb_pd_mux_info {
35005062 uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */
3501−} __packed;
5063+} __ec_align1;
5064+
5065+#define EC_CMD_PD_CHIP_INFO 0x011B
5066+
5067+struct ec_params_pd_chip_info {
5068+ uint8_t port; /* USB-C port number */
5069+ uint8_t renew; /* Force renewal */
5070+} __ec_align1;
5071+
5072+struct ec_response_pd_chip_info {
5073+ uint16_t vendor_id;
5074+ uint16_t product_id;
5075+ uint16_t device_id;
5076+ union {
5077+ uint8_t fw_version_string[8];
5078+ uint64_t fw_version_number;
5079+ };
5080+} __ec_align2;
5081+
5082+struct ec_response_pd_chip_info_v1 {
5083+ uint16_t vendor_id;
5084+ uint16_t product_id;
5085+ uint16_t device_id;
5086+ union {
5087+ uint8_t fw_version_string[8];
5088+ uint64_t fw_version_number;
5089+ };
5090+ union {
5091+ uint8_t min_req_fw_version_string[8];
5092+ uint64_t min_req_fw_version_number;
5093+ };
5094+} __ec_align2;
5095+
5096+/* Run RW signature verification and get status */
5097+#define EC_CMD_RWSIG_CHECK_STATUS 0x011C
5098+
5099+struct ec_response_rwsig_check_status {
5100+ uint32_t status;
5101+} __ec_align4;
5102+
5103+/* For controlling RWSIG task */
5104+#define EC_CMD_RWSIG_ACTION 0x011D
5105+
5106+enum rwsig_action {
5107+ RWSIG_ACTION_ABORT = 0, /* Abort RWSIG and prevent jumping */
5108+ RWSIG_ACTION_CONTINUE = 1, /* Jump to RW immediately */
5109+};
5110+
5111+struct ec_params_rwsig_action {
5112+ uint32_t action;
5113+} __ec_align4;
5114+
5115+/* Run verification on a slot */
5116+#define EC_CMD_EFS_VERIFY 0x011E
5117+
5118+struct ec_params_efs_verify {
5119+ uint8_t region; /* enum ec_flash_region */
5120+} __ec_align1;
5121+
5122+/*
5123+ * Retrieve info from Cros Board Info store. Response is based on the data
5124+ * type. Integers return a uint32. Strings return a string, using the response
5125+ * size to determine how big it is.
5126+ */
5127+#define EC_CMD_GET_CROS_BOARD_INFO 0x011F
5128+/*
5129+ * Write info into Cros Board Info on EEPROM. Write fails if the board has
5130+ * hardware write-protect enabled.
5131+ */
5132+#define EC_CMD_SET_CROS_BOARD_INFO 0x0120
5133+
5134+enum cbi_data_tag {
5135+ CBI_TAG_BOARD_VERSION = 0, /* uint32_t or smaller */
5136+ CBI_TAG_OEM_ID = 1, /* uint32_t or smaller */
5137+ CBI_TAG_SKU_ID = 2, /* uint32_t or smaller */
5138+ CBI_TAG_DRAM_PART_NUM = 3, /* variable length ascii, nul terminated. */
5139+ CBI_TAG_OEM_NAME = 4, /* variable length ascii, nul terminated. */
5140+ CBI_TAG_MODEL_ID = 5, /* uint32_t or smaller */
5141+ CBI_TAG_COUNT,
5142+};
5143+
5144+/*
5145+ * Flags to control read operation
5146+ *
5147+ * RELOAD: Invalidate cache and read data from EEPROM. Useful to verify
5148+ * write was successful without reboot.
5149+ */
5150+#define CBI_GET_RELOAD BIT(0)
5151+
5152+struct ec_params_get_cbi {
5153+ uint32_t tag; /* enum cbi_data_tag */
5154+ uint32_t flag; /* CBI_GET_* */
5155+} __ec_align4;
5156+
5157+/*
5158+ * Flags to control write behavior.
5159+ *
5160+ * NO_SYNC: Makes EC update data in RAM but skip writing to EEPROM. It's
5161+ * useful when writing multiple fields in a row.
5162+ * INIT: Need to be set when creating a new CBI from scratch. All fields
5163+ * will be initialized to zero first.
5164+ */
5165+#define CBI_SET_NO_SYNC BIT(0)
5166+#define CBI_SET_INIT BIT(1)
5167+
5168+struct ec_params_set_cbi {
5169+ uint32_t tag; /* enum cbi_data_tag */
5170+ uint32_t flag; /* CBI_SET_* */
5171+ uint32_t size; /* Data size */
5172+ uint8_t data[]; /* For string and raw data */
5173+} __ec_align1;
5174+
5175+/*
5176+ * Information about resets of the AP by the EC and the EC's own uptime.
5177+ */
5178+#define EC_CMD_GET_UPTIME_INFO 0x0121
5179+
5180+struct ec_response_uptime_info {
5181+ /*
5182+ * Number of milliseconds since the last EC boot. Sysjump resets
5183+ * typically do not restart the EC's time_since_boot epoch.
5184+ *
5185+ * WARNING: The EC's sense of time is much less accurate than the AP's
5186+ * sense of time, in both phase and frequency. This timebase is similar
5187+ * to CLOCK_MONOTONIC_RAW, but with 1% or more frequency error.
5188+ */
5189+ uint32_t time_since_ec_boot_ms;
5190+
5191+ /*
5192+ * Number of times the AP was reset by the EC since the last EC boot.
5193+ * Note that the AP may be held in reset by the EC during the initial
5194+ * boot sequence, such that the very first AP boot may count as more
5195+ * than one here.
5196+ */
5197+ uint32_t ap_resets_since_ec_boot;
5198+
5199+ /*
5200+ * The set of flags which describe the EC's most recent reset. See
5201+ * include/system.h RESET_FLAG_* for details.
5202+ */
5203+ uint32_t ec_reset_flags;
5204+
5205+ /* Empty log entries have both the cause and timestamp set to zero. */
5206+ struct ap_reset_log_entry {
5207+ /*
5208+ * See include/chipset.h: enum chipset_{reset,shutdown}_reason
5209+ * for details.
5210+ */
5211+ uint16_t reset_cause;
5212+
5213+ /* Reserved for protocol growth. */
5214+ uint16_t reserved;
5215+
5216+ /*
5217+ * The time of the reset's assertion, in milliseconds since the
5218+ * last EC boot, in the same epoch as time_since_ec_boot_ms.
5219+ * Set to zero if the log entry is empty.
5220+ */
5221+ uint32_t reset_time_ms;
5222+ } recent_ap_reset[4];
5223+} __ec_align4;
5224+
5225+/*
5226+ * Add entropy to the device secret (stored in the rollback region).
5227+ *
5228+ * Depending on the chip, the operation may take a long time (e.g. to erase
5229+ * flash), so the commands are asynchronous.
5230+ */
5231+#define EC_CMD_ADD_ENTROPY 0x0122
5232+
5233+enum add_entropy_action {
5234+ /* Add entropy to the current secret. */
5235+ ADD_ENTROPY_ASYNC = 0,
5236+ /*
5237+ * Add entropy, and also make sure that the previous secret is erased.
5238+ * (this can be implemented by adding entropy multiple times until
5239+ * all rolback blocks have been overwritten).
5240+ */
5241+ ADD_ENTROPY_RESET_ASYNC = 1,
5242+ /* Read back result from the previous operation. */
5243+ ADD_ENTROPY_GET_RESULT = 2,
5244+};
5245+
5246+struct ec_params_rollback_add_entropy {
5247+ uint8_t action;
5248+} __ec_align1;
5249+
5250+/*
5251+ * Perform a single read of a given ADC channel.
5252+ */
5253+#define EC_CMD_ADC_READ 0x0123
5254+
5255+struct ec_params_adc_read {
5256+ uint8_t adc_channel;
5257+} __ec_align1;
5258+
5259+struct ec_response_adc_read {
5260+ int32_t adc_value;
5261+} __ec_align4;
5262+
5263+/*
5264+ * Read back rollback info
5265+ */
5266+#define EC_CMD_ROLLBACK_INFO 0x0124
5267+
5268+struct ec_response_rollback_info {
5269+ int32_t id; /* Incrementing number to indicate which region to use. */
5270+ int32_t rollback_min_version;
5271+ int32_t rw_rollback_version;
5272+} __ec_align4;

409 more lines aren’t shown here.

include/linux/mfd/da9062/registers.h+3−0
@@ -797,6 +797,9 @@ · 796 unmodified lines
797797 #define DA9062AA_BUCK3_SL_A_SHIFT 7
798798 #define DA9062AA_BUCK3_SL_A_MASK BIT(7)
799799
800+/* DA9062AA_VLDO[1-4]_A common */
801+#define DA9062AA_VLDO_A_MIN_SEL 2
802+
800803 /* DA9062AA_VLDO1_A = 0x0A9 */
801804 #define DA9062AA_VLDO1_A_SHIFT 0
802805 #define DA9062AA_VLDO1_A_MASK 0x3f
include/linux/mfd/da9063/pdata.h+0−49
@@ -11,55 +11,6 @@ · 10 unmodified lines
1111 #ifndef __MFD_DA9063_PDATA_H__
1212 #define __MFD_DA9063_PDATA_H__
1313
14−#include <linux/regulator/machine.h>
15−
16−/*
17− * Regulator configuration
18− */
19−/* DA9063 and DA9063L regulator IDs */
20−enum {
21− /* BUCKs */
22− DA9063_ID_BCORE1,
23− DA9063_ID_BCORE2,
24− DA9063_ID_BPRO,
25− DA9063_ID_BMEM,
26− DA9063_ID_BIO,
27− DA9063_ID_BPERI,
28−
29− /* BCORE1 and BCORE2 in merged mode */
30− DA9063_ID_BCORES_MERGED,
31− /* BMEM and BIO in merged mode */
32− DA9063_ID_BMEM_BIO_MERGED,
33− /* When two BUCKs are merged, they cannot be reused separately */
34−
35− /* LDOs on both DA9063 and DA9063L */
36− DA9063_ID_LDO3,
37− DA9063_ID_LDO7,
38− DA9063_ID_LDO8,
39− DA9063_ID_LDO9,
40− DA9063_ID_LDO11,
41−
42− /* DA9063-only LDOs */
43− DA9063_ID_LDO1,
44− DA9063_ID_LDO2,
45− DA9063_ID_LDO4,
46− DA9063_ID_LDO5,
47− DA9063_ID_LDO6,
48− DA9063_ID_LDO10,
49−};
50−
51−/* Regulators platform data */
52−struct da9063_regulator_data {
53− int id;
54− struct regulator_init_data *initdata;
55−};
56−
57−struct da9063_regulators_pdata {
58− unsigned n_regulators;
59− struct da9063_regulator_data *regulator_data;
60−};
61−
62−
6314 /*
6415 * RGB LED configuration
6516 */
include/linux/mfd/lp87565.h+2−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414
1515 enum lp87565_device_type {
1616 LP87565_DEVICE_TYPE_UNKNOWN = 0,
17+ LP87565_DEVICE_TYPE_LP87561_Q1,
1718 LP87565_DEVICE_TYPE_LP87565_Q1,
1819 };
1920
@@ -246,6 +247,7 @@ enum LP87565_regulator_id { · 226 unmodified lines
246247 LP87565_BUCK_3,
247248 LP87565_BUCK_10,
248249 LP87565_BUCK_23,
250+ LP87565_BUCK_3210,
249251 };
250252
251253 /**
include/linux/mfd/madera/core.h+7−5
@@ -1,12 +1,8 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0-only */
22 /*
33 * MFD internals for Cirrus Logic Madera codecs
44 *
55 * Copyright (C) 2015-2018 Cirrus Logic
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by the
9− * Free Software Foundation; version 2.
106 */
117
128 #ifndef MADERA_CORE_H
@@ -26,15 +22,21 @@ enum madera_type { · 13 unmodified lines
2622 CS47L85 = 2,
2723 CS47L90 = 3,
2824 CS47L91 = 4,
25+ CS47L92 = 5,
26+ CS47L93 = 6,
2927 WM1840 = 7,
28+ CS47L15 = 8,
29+ CS42L92 = 9,
3030 };
3131
3232 #define MADERA_MAX_CORE_SUPPLIES 2
3333 #define MADERA_MAX_GPIOS 40
3434
35+#define CS47L15_NUM_GPIOS 15
3536 #define CS47L35_NUM_GPIOS 16
3637 #define CS47L85_NUM_GPIOS 40
3738 #define CS47L90_NUM_GPIOS 38
39+#define CS47L92_NUM_GPIOS 16
3840
3941 #define MADERA_MAX_MICBIAS 4
4042
include/linux/mfd/madera/pdata.h+7−6
@@ -1,12 +1,8 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0-only */
22 /*
33 * Platform data for Cirrus Logic Madera codecs
44 *
55 * Copyright (C) 2015-2018 Cirrus Logic
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by the
9− * Free Software Foundation; version 2.
106 */
117
128 #ifndef MADERA_PDATA_H
@@ -16,6 +12,7 @@ · 3 unmodified lines
1612 #include <linux/regulator/arizona-ldo1.h>
1713 #include <linux/regulator/arizona-micsupp.h>
1814 #include <linux/regulator/machine.h>
15+#include <sound/madera-pdata.h>
1916
2017 #define MADERA_MAX_MICBIAS 4
2118 #define MADERA_MAX_CHILD_MICBIAS 4
@@ -34,11 +31,13 @@ struct madera_codec_pdata; · 12 unmodified lines
3431 * @micvdd: Substruct of pdata for the MICVDD regulator
3532 * @irq_flags: Mode for primary IRQ (defaults to active low)
3633 * @gpio_base: Base GPIO number
37− * @gpio_configs: Array of GPIO configurations (See Documentation/pinctrl.txt)
34+ * @gpio_configs: Array of GPIO configurations (See
35+ * Documentation/driver-api/pinctl.rst)
3836 * @n_gpio_configs: Number of entries in gpio_configs
3937 * @gpsw: General purpose switch mode setting. Depends on the external
4038 * hardware connected to the switch. (See the SW1_MODE field
4139 * in the datasheet for the available values for your codec)
40+ * @codec: Substruct of pdata for the ASoC codec driver
4241 */
4342 struct madera_pdata {
4443 struct gpio_desc *reset;
@@ -53,6 +52,8 @@ struct madera_pdata { · 8 unmodified lines
5352 int n_gpio_configs;
5453
5554 u32 gpsw[MADERA_MAX_GPSW];
55+
56+ struct madera_codec_pdata codec;
5657 };
5758
5859 #endif
include/linux/mfd/madera/registers.h+201−85
@@ -1,12 +1,8 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0-only */
22 /*
33 * Madera register definitions
44 *
55 * Copyright (C) 2015-2018 Cirrus Logic
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by the
9− * Free Software Foundation; version 2.
106 */
117
128 #ifndef MADERA_REGISTERS_H
@@ -76,10 +72,14 @@ · 63 unmodified lines
7672 #define MADERA_FLL1_CONTROL_4 0x174
7773 #define MADERA_FLL1_CONTROL_5 0x175
7874 #define MADERA_FLL1_CONTROL_6 0x176
79−#define MADERA_FLL1_LOOP_FILTER_TEST_1 0x177
80−#define MADERA_FLL1_NCO_TEST_0 0x178
75+#define CS47L92_FLL1_CONTROL_7 0x177
76+#define CS47L92_FLL1_CONTROL_8 0x178
8177 #define MADERA_FLL1_CONTROL_7 0x179
78+#define CS47L92_FLL1_CONTROL_9 0x179
8279 #define MADERA_FLL1_EFS_2 0x17A
80+#define CS47L92_FLL1_CONTROL_10 0x17A
81+#define MADERA_FLL1_CONTROL_11 0x17B
82+#define MADERA_FLL1_DIGITAL_TEST_1 0x17D
8383 #define CS47L35_FLL1_SYNCHRONISER_1 0x17F
8484 #define CS47L35_FLL1_SYNCHRONISER_2 0x180
8585 #define CS47L35_FLL1_SYNCHRONISER_3 0x181
@@ -98,16 +98,21 @@ · 12 unmodified lines
9898 #define MADERA_FLL1_SYNCHRONISER_7 0x187
9999 #define MADERA_FLL1_SPREAD_SPECTRUM 0x189
100100 #define MADERA_FLL1_GPIO_CLOCK 0x18A
101+#define CS47L92_FLL1_GPIO_CLOCK 0x18E
101102 #define MADERA_FLL2_CONTROL_1 0x191
102103 #define MADERA_FLL2_CONTROL_2 0x192
103104 #define MADERA_FLL2_CONTROL_3 0x193
104105 #define MADERA_FLL2_CONTROL_4 0x194
105106 #define MADERA_FLL2_CONTROL_5 0x195
106107 #define MADERA_FLL2_CONTROL_6 0x196
107−#define MADERA_FLL2_LOOP_FILTER_TEST_1 0x197
108−#define MADERA_FLL2_NCO_TEST_0 0x198
108+#define CS47L92_FLL2_CONTROL_7 0x197
109+#define CS47L92_FLL2_CONTROL_8 0x198
109110 #define MADERA_FLL2_CONTROL_7 0x199
111+#define CS47L92_FLL2_CONTROL_9 0x199
110112 #define MADERA_FLL2_EFS_2 0x19A
113+#define CS47L92_FLL2_CONTROL_10 0x19A
114+#define MADERA_FLL2_CONTROL_11 0x19B
115+#define MADERA_FLL2_DIGITAL_TEST_1 0x19D
111116 #define MADERA_FLL2_SYNCHRONISER_1 0x1A1
112117 #define MADERA_FLL2_SYNCHRONISER_2 0x1A2
113118 #define MADERA_FLL2_SYNCHRONISER_3 0x1A3
@@ -117,14 +122,13 @@ · 3 unmodified lines
117122 #define MADERA_FLL2_SYNCHRONISER_7 0x1A7
118123 #define MADERA_FLL2_SPREAD_SPECTRUM 0x1A9
119124 #define MADERA_FLL2_GPIO_CLOCK 0x1AA
125+#define CS47L92_FLL2_GPIO_CLOCK 0x1AE
120126 #define MADERA_FLL3_CONTROL_1 0x1B1
121127 #define MADERA_FLL3_CONTROL_2 0x1B2
122128 #define MADERA_FLL3_CONTROL_3 0x1B3
123129 #define MADERA_FLL3_CONTROL_4 0x1B4
124130 #define MADERA_FLL3_CONTROL_5 0x1B5
125131 #define MADERA_FLL3_CONTROL_6 0x1B6
126−#define MADERA_FLL3_LOOP_FILTER_TEST_1 0x1B7
127−#define MADERA_FLL3_NCO_TEST_0 0x1B8
128132 #define MADERA_FLL3_CONTROL_7 0x1B9
129133 #define MADERA_FLL3_SYNCHRONISER_1 0x1C1
130134 #define MADERA_FLL3_SYNCHRONISER_2 0x1C2
@@ -244,6 +248,8 @@ · 113 unmodified lines
244248 #define MADERA_IN6R_CONTROL 0x33C
245249 #define MADERA_ADC_DIGITAL_VOLUME_6R 0x33D
246250 #define MADERA_DMIC6R_CONTROL 0x33E
251+#define CS47L15_ADC_INT_BIAS 0x3A8
252+#define CS47L15_PGA_BIAS_SEL 0x3C4
247253 #define MADERA_OUTPUT_ENABLES_1 0x400
248254 #define MADERA_OUTPUT_STATUS_1 0x401
249255 #define MADERA_RAW_OUTPUT_STATUS_1 0x406
@@ -265,6 +271,7 @@ · 15 unmodified lines
265271 #define MADERA_NOISE_GATE_SELECT_2R 0x41F
266272 #define MADERA_OUTPUT_PATH_CONFIG_3L 0x420
267273 #define MADERA_DAC_DIGITAL_VOLUME_3L 0x421
274+#define MADERA_OUTPUT_PATH_CONFIG_3 0x422
268275 #define MADERA_NOISE_GATE_SELECT_3L 0x423
269276 #define MADERA_OUTPUT_PATH_CONFIG_3R 0x424
270277 #define MADERA_DAC_DIGITAL_VOLUME_3R 0x425
@@ -287,9 +294,6 @@ · 16 unmodified lines
287294 #define MADERA_OUTPUT_PATH_CONFIG_6R 0x43C
288295 #define MADERA_DAC_DIGITAL_VOLUME_6R 0x43D
289296 #define MADERA_NOISE_GATE_SELECT_6R 0x43F
290−#define MADERA_DRE_ENABLE 0x440
291−#define MADERA_EDRE_ENABLE 0x448
292−#define MADERA_EDRE_MANUAL 0x44A
293297 #define MADERA_DAC_AEC_CONTROL_1 0x450
294298 #define MADERA_DAC_AEC_CONTROL_2 0x451
295299 #define MADERA_NOISE_GATE_CONTROL 0x458
@@ -367,8 +371,20 @@ · 71 unmodified lines
367371 #define MADERA_AIF3_FRAME_CTRL_2 0x588
368372 #define MADERA_AIF3_FRAME_CTRL_3 0x589
369373 #define MADERA_AIF3_FRAME_CTRL_4 0x58A
374+#define MADERA_AIF3_FRAME_CTRL_5 0x58B
375+#define MADERA_AIF3_FRAME_CTRL_6 0x58C
376+#define MADERA_AIF3_FRAME_CTRL_7 0x58D
377+#define MADERA_AIF3_FRAME_CTRL_8 0x58E
378+#define MADERA_AIF3_FRAME_CTRL_9 0x58F
379+#define MADERA_AIF3_FRAME_CTRL_10 0x590
370380 #define MADERA_AIF3_FRAME_CTRL_11 0x591
371381 #define MADERA_AIF3_FRAME_CTRL_12 0x592
382+#define MADERA_AIF3_FRAME_CTRL_13 0x593
383+#define MADERA_AIF3_FRAME_CTRL_14 0x594
384+#define MADERA_AIF3_FRAME_CTRL_15 0x595
385+#define MADERA_AIF3_FRAME_CTRL_16 0x596
386+#define MADERA_AIF3_FRAME_CTRL_17 0x597
387+#define MADERA_AIF3_FRAME_CTRL_18 0x598
372388 #define MADERA_AIF3_TX_ENABLES 0x599
373389 #define MADERA_AIF3_RX_ENABLES 0x59A
374390 #define MADERA_AIF3_FORCE_WRITE 0x59B
@@ -660,6 +676,54 @@ · 285 unmodified lines
660676 #define MADERA_AIF3TX2MIX_INPUT_3_VOLUME 0x78D
661677 #define MADERA_AIF3TX2MIX_INPUT_4_SOURCE 0x78E
662678 #define MADERA_AIF3TX2MIX_INPUT_4_VOLUME 0x78F
679+#define MADERA_AIF3TX3MIX_INPUT_1_SOURCE 0x790
680+#define MADERA_AIF3TX3MIX_INPUT_1_VOLUME 0x791
681+#define MADERA_AIF3TX3MIX_INPUT_2_SOURCE 0x792
682+#define MADERA_AIF3TX3MIX_INPUT_2_VOLUME 0x793
683+#define MADERA_AIF3TX3MIX_INPUT_3_SOURCE 0x794
684+#define MADERA_AIF3TX3MIX_INPUT_3_VOLUME 0x795
685+#define MADERA_AIF3TX3MIX_INPUT_4_SOURCE 0x796
686+#define MADERA_AIF3TX3MIX_INPUT_4_VOLUME 0x797
687+#define MADERA_AIF3TX4MIX_INPUT_1_SOURCE 0x798
688+#define MADERA_AIF3TX4MIX_INPUT_1_VOLUME 0x799
689+#define MADERA_AIF3TX4MIX_INPUT_2_SOURCE 0x79A
690+#define MADERA_AIF3TX4MIX_INPUT_2_VOLUME 0x79B
691+#define MADERA_AIF3TX4MIX_INPUT_3_SOURCE 0x79C
692+#define MADERA_AIF3TX4MIX_INPUT_3_VOLUME 0x79D
693+#define MADERA_AIF3TX4MIX_INPUT_4_SOURCE 0x79E
694+#define MADERA_AIF3TX4MIX_INPUT_4_VOLUME 0x79F
695+#define CS47L92_AIF3TX5MIX_INPUT_1_SOURCE 0x7A0
696+#define CS47L92_AIF3TX5MIX_INPUT_1_VOLUME 0x7A1
697+#define CS47L92_AIF3TX5MIX_INPUT_2_SOURCE 0x7A2
698+#define CS47L92_AIF3TX5MIX_INPUT_2_VOLUME 0x7A3
699+#define CS47L92_AIF3TX5MIX_INPUT_3_SOURCE 0x7A4
700+#define CS47L92_AIF3TX5MIX_INPUT_3_VOLUME 0x7A5
701+#define CS47L92_AIF3TX5MIX_INPUT_4_SOURCE 0x7A6
702+#define CS47L92_AIF3TX5MIX_INPUT_4_VOLUME 0x7A7
703+#define CS47L92_AIF3TX6MIX_INPUT_1_SOURCE 0x7A8
704+#define CS47L92_AIF3TX6MIX_INPUT_1_VOLUME 0x7A9
705+#define CS47L92_AIF3TX6MIX_INPUT_2_SOURCE 0x7AA
706+#define CS47L92_AIF3TX6MIX_INPUT_2_VOLUME 0x7AB
707+#define CS47L92_AIF3TX6MIX_INPUT_3_SOURCE 0x7AC
708+#define CS47L92_AIF3TX6MIX_INPUT_3_VOLUME 0x7AD
709+#define CS47L92_AIF3TX6MIX_INPUT_4_SOURCE 0x7AE
710+#define CS47L92_AIF3TX6MIX_INPUT_4_VOLUME 0x7AF
711+#define CS47L92_AIF3TX7MIX_INPUT_1_SOURCE 0x7B0
712+#define CS47L92_AIF3TX7MIX_INPUT_1_VOLUME 0x7B1
713+#define CS47L92_AIF3TX7MIX_INPUT_2_SOURCE 0x7B2
714+#define CS47L92_AIF3TX7MIX_INPUT_2_VOLUME 0x7B3
715+#define CS47L92_AIF3TX7MIX_INPUT_3_SOURCE 0x7B4
716+#define CS47L92_AIF3TX7MIX_INPUT_3_VOLUME 0x7B5
717+#define CS47L92_AIF3TX7MIX_INPUT_4_SOURCE 0x7B6
718+#define CS47L92_AIF3TX7MIX_INPUT_4_VOLUME 0x7B7
719+#define CS47L92_AIF3TX8MIX_INPUT_1_SOURCE 0x7B8
720+#define CS47L92_AIF3TX8MIX_INPUT_1_VOLUME 0x7B9
721+#define CS47L92_AIF3TX8MIX_INPUT_2_SOURCE 0x7BA
722+#define CS47L92_AIF3TX8MIX_INPUT_2_VOLUME 0x7BB
723+#define CS47L92_AIF3TX8MIX_INPUT_3_SOURCE 0x7BC
724+#define CS47L92_AIF3TX8MIX_INPUT_3_VOLUME 0x7BD
725+#define CS47L92_AIF3TX8MIX_INPUT_4_SOURCE 0x7BE
726+#define CS47L92_AIF3TX8MIX_INPUT_4_VOLUME 0x7BF
663727 #define MADERA_AIF4TX1MIX_INPUT_1_SOURCE 0x7A0
664728 #define MADERA_AIF4TX1MIX_INPUT_1_VOLUME 0x7A1
665729 #define MADERA_AIF4TX1MIX_INPUT_2_SOURCE 0x7A2
@@ -1103,68 +1167,8 @@ · 437 unmodified lines
11031167 #define MADERA_FCR_ADC_REFORMATTER_CONTROL 0xF73
11041168 #define MADERA_FCR_COEFF_START 0xF74
11051169 #define MADERA_FCR_COEFF_END 0xFC5
1106−#define MADERA_DAC_COMP_1 0x1300
1107−#define MADERA_DAC_COMP_2 0x1302
1108−#define MADERA_FRF_COEFFICIENT_1L_1 0x1380
1109−#define MADERA_FRF_COEFFICIENT_1L_2 0x1381
1110−#define MADERA_FRF_COEFFICIENT_1L_3 0x1382
1111−#define MADERA_FRF_COEFFICIENT_1L_4 0x1383
1112−#define MADERA_FRF_COEFFICIENT_1R_1 0x1390
1113−#define MADERA_FRF_COEFFICIENT_1R_2 0x1391
1114−#define MADERA_FRF_COEFFICIENT_1R_3 0x1392
1115−#define MADERA_FRF_COEFFICIENT_1R_4 0x1393
1116−#define MADERA_FRF_COEFFICIENT_2L_1 0x13A0
1117−#define MADERA_FRF_COEFFICIENT_2L_2 0x13A1
1118−#define MADERA_FRF_COEFFICIENT_2L_3 0x13A2
1119−#define MADERA_FRF_COEFFICIENT_2L_4 0x13A3
1120−#define MADERA_FRF_COEFFICIENT_2R_1 0x13B0
1121−#define MADERA_FRF_COEFFICIENT_2R_2 0x13B1
1122−#define MADERA_FRF_COEFFICIENT_2R_3 0x13B2
1123−#define MADERA_FRF_COEFFICIENT_2R_4 0x13B3
1124−#define MADERA_FRF_COEFFICIENT_3L_1 0x13C0
1125−#define MADERA_FRF_COEFFICIENT_3L_2 0x13C1
1126−#define MADERA_FRF_COEFFICIENT_3L_3 0x13C2
1127−#define MADERA_FRF_COEFFICIENT_3L_4 0x13C3
1128−#define MADERA_FRF_COEFFICIENT_3R_1 0x13D0
1129−#define MADERA_FRF_COEFFICIENT_3R_2 0x13D1
1130−#define MADERA_FRF_COEFFICIENT_3R_3 0x13D2
1131−#define MADERA_FRF_COEFFICIENT_3R_4 0x13D3
1132−#define MADERA_FRF_COEFFICIENT_4L_1 0x13E0
1133−#define MADERA_FRF_COEFFICIENT_4L_2 0x13E1
1134−#define MADERA_FRF_COEFFICIENT_4L_3 0x13E2
1135−#define MADERA_FRF_COEFFICIENT_4L_4 0x13E3
1136−#define MADERA_FRF_COEFFICIENT_4R_1 0x13F0
1137−#define MADERA_FRF_COEFFICIENT_4R_2 0x13F1
1138−#define MADERA_FRF_COEFFICIENT_4R_3 0x13F2
1139−#define MADERA_FRF_COEFFICIENT_4R_4 0x13F3
1140−#define CS47L35_FRF_COEFFICIENT_4L_1 0x13A0
1141−#define CS47L35_FRF_COEFFICIENT_4L_2 0x13A1
1142−#define CS47L35_FRF_COEFFICIENT_4L_3 0x13A2
1143−#define CS47L35_FRF_COEFFICIENT_4L_4 0x13A3
1144−#define CS47L35_FRF_COEFFICIENT_5L_1 0x13B0
1145−#define CS47L35_FRF_COEFFICIENT_5L_2 0x13B1
1146−#define CS47L35_FRF_COEFFICIENT_5L_3 0x13B2
1147−#define CS47L35_FRF_COEFFICIENT_5L_4 0x13B3
1148−#define CS47L35_FRF_COEFFICIENT_5R_1 0x13C0
1149−#define CS47L35_FRF_COEFFICIENT_5R_2 0x13C1
1150−#define CS47L35_FRF_COEFFICIENT_5R_3 0x13C2
1151−#define CS47L35_FRF_COEFFICIENT_5R_4 0x13C3
1152−#define MADERA_FRF_COEFFICIENT_5L_1 0x1400
1153−#define MADERA_FRF_COEFFICIENT_5L_2 0x1401
1154−#define MADERA_FRF_COEFFICIENT_5L_3 0x1402
1155−#define MADERA_FRF_COEFFICIENT_5L_4 0x1403
1156−#define MADERA_FRF_COEFFICIENT_5R_1 0x1410
1157−#define MADERA_FRF_COEFFICIENT_5R_2 0x1411
1158−#define MADERA_FRF_COEFFICIENT_5R_3 0x1412
1159−#define MADERA_FRF_COEFFICIENT_5R_4 0x1413
1160−#define MADERA_FRF_COEFFICIENT_6L_1 0x1420
1161−#define MADERA_FRF_COEFFICIENT_6L_2 0x1421
1162−#define MADERA_FRF_COEFFICIENT_6L_3 0x1422
1163−#define MADERA_FRF_COEFFICIENT_6L_4 0x1423
1164−#define MADERA_FRF_COEFFICIENT_6R_1 0x1430
1165−#define MADERA_FRF_COEFFICIENT_6R_2 0x1431
1166−#define MADERA_FRF_COEFFICIENT_6R_3 0x1432
1167−#define MADERA_FRF_COEFFICIENT_6R_4 0x1433
1170+#define MADERA_AUXPDM1_CTRL_0 0x10C0
1171+#define MADERA_AUXPDM1_CTRL_1 0x10C1
11681172 #define MADERA_DFC1_CTRL 0x1480
11691173 #define MADERA_DFC1_RX 0x1482
11701174 #define MADERA_DFC1_TX 0x1484
@@ -1202,6 +1206,8 @@ · 31 unmodified lines
12021206 #define MADERA_GPIO1_CTRL_2 0x1701
12031207 #define MADERA_GPIO2_CTRL_1 0x1702
12041208 #define MADERA_GPIO2_CTRL_2 0x1703
1209+#define MADERA_GPIO15_CTRL_1 0x171C
1210+#define MADERA_GPIO15_CTRL_2 0x171D
12051211 #define MADERA_GPIO16_CTRL_1 0x171E
12061212 #define MADERA_GPIO16_CTRL_2 0x171F
12071213 #define MADERA_GPIO38_CTRL_1 0x174A
@@ -1232,6 +1238,7 @@ · 24 unmodified lines
12321238 #define MADERA_IRQ2_CTRL 0x1A82
12331239 #define MADERA_INTERRUPT_RAW_STATUS_1 0x1AA0
12341240 #define MADERA_WSEQ_SEQUENCE_1 0x3000
1241+#define MADERA_WSEQ_SEQUENCE_225 0x31C0
12351242 #define MADERA_WSEQ_SEQUENCE_252 0x31F6
12361243 #define CS47L35_OTP_HPDET_CAL_1 0x31F8
12371244 #define CS47L35_OTP_HPDET_CAL_2 0x31FA
@@ -1441,6 +1448,12 @@ · 203 unmodified lines
14411448 #define MADERA_OPCLK_ASYNC_SEL_WIDTH 3
14421449
14431450 /* (0x0171) FLL1_Control_1 */
1451+#define CS47L92_FLL1_REFCLK_SRC_MASK 0xF000
1452+#define CS47L92_FLL1_REFCLK_SRC_SHIFT 12
1453+#define CS47L92_FLL1_REFCLK_SRC_WIDTH 4
1454+#define MADERA_FLL1_HOLD_MASK 0x0004
1455+#define MADERA_FLL1_HOLD_SHIFT 2
1456+#define MADERA_FLL1_HOLD_WIDTH 1
14441457 #define MADERA_FLL1_FREERUN 0x0002
14451458 #define MADERA_FLL1_FREERUN_MASK 0x0002
14461459 #define MADERA_FLL1_FREERUN_SHIFT 1
@@ -1473,6 +1486,9 @@ · 26 unmodified lines
14731486 #define MADERA_FLL1_FRATIO_MASK 0x0F00
14741487 #define MADERA_FLL1_FRATIO_SHIFT 8
14751488 #define MADERA_FLL1_FRATIO_WIDTH 4
1489+#define MADERA_FLL1_FB_DIV_MASK 0x03FF
1490+#define MADERA_FLL1_FB_DIV_SHIFT 0
1491+#define MADERA_FLL1_FB_DIV_WIDTH 10
14761492
14771493 /* (0x0176) FLL1_Control_6 */
14781494 #define MADERA_FLL1_REFCLK_DIV_MASK 0x00C0
@@ -1482,15 +1498,6 @@ · 3 unmodified lines
14821498 #define MADERA_FLL1_REFCLK_SRC_SHIFT 0
14831499 #define MADERA_FLL1_REFCLK_SRC_WIDTH 4
14841500
1485−/* (0x0177) FLL1_Loop_Filter_Test_1 */
1486−#define MADERA_FLL1_FRC_INTEG_UPD 0x8000
1487−#define MADERA_FLL1_FRC_INTEG_UPD_MASK 0x8000
1488−#define MADERA_FLL1_FRC_INTEG_UPD_SHIFT 15
1489−#define MADERA_FLL1_FRC_INTEG_UPD_WIDTH 1
1490−#define MADERA_FLL1_FRC_INTEG_VAL_MASK 0x0FFF
1491−#define MADERA_FLL1_FRC_INTEG_VAL_SHIFT 0
1492−#define MADERA_FLL1_FRC_INTEG_VAL_WIDTH 12
1493−
14941501 /* (0x0179) FLL1_Control_7 */
14951502 #define MADERA_FLL1_GAIN_MASK 0x003c
14961503 #define MADERA_FLL1_GAIN_SHIFT 2
@@ -1504,6 +1511,30 @@ · 7 unmodified lines
15041511 #define MADERA_FLL1_PHASE_ENA_SHIFT 11
15051512 #define MADERA_FLL1_PHASE_ENA_WIDTH 1
15061513
1514+/* (0x017A) FLL1_Control_10 */
1515+#define MADERA_FLL1_HP_MASK 0xC000
1516+#define MADERA_FLL1_HP_SHIFT 14
1517+#define MADERA_FLL1_HP_WIDTH 2
1518+#define MADERA_FLL1_PHASEDET_ENA_MASK 0x1000
1519+#define MADERA_FLL1_PHASEDET_ENA_SHIFT 12
1520+#define MADERA_FLL1_PHASEDET_ENA_WIDTH 1
1521+
1522+/* (0x017B) FLL1_Control_11 */
1523+#define MADERA_FLL1_LOCKDET_THR_MASK 0x001E
1524+#define MADERA_FLL1_LOCKDET_THR_SHIFT 1
1525+#define MADERA_FLL1_LOCKDET_THR_WIDTH 4
1526+#define MADERA_FLL1_LOCKDET_MASK 0x0001
1527+#define MADERA_FLL1_LOCKDET_SHIFT 0
1528+#define MADERA_FLL1_LOCKDET_WIDTH 1
1529+
1530+/* (0x017D) FLL1_Digital_Test_1 */
1531+#define MADERA_FLL1_SYNC_EFS_ENA_MASK 0x0100
1532+#define MADERA_FLL1_SYNC_EFS_ENA_SHIFT 8
1533+#define MADERA_FLL1_SYNC_EFS_ENA_WIDTH 1
1534+#define MADERA_FLL1_CLK_VCO_FAST_SRC_MASK 0x0003
1535+#define MADERA_FLL1_CLK_VCO_FAST_SRC_SHIFT 0
1536+#define MADERA_FLL1_CLK_VCO_FAST_SRC_WIDTH 2
1537+
15071538 /* (0x0181) FLL1_Synchroniser_1 */
15081539 #define MADERA_FLL1_SYNC_ENA 0x0001
15091540 #define MADERA_FLL1_SYNC_ENA_MASK 0x0001
@@ -1625,6 +1656,13 @@ · 115 unmodified lines
16251656 #define MADERA_LDO2_ENA_WIDTH 1
16261657
16271658 /* (0x0218) Mic_Bias_Ctrl_1 */
1659+#define MADERA_MICB1_EXT_CAP 0x8000
1660+#define MADERA_MICB1_EXT_CAP_MASK 0x8000
1661+#define MADERA_MICB1_EXT_CAP_SHIFT 15
1662+#define MADERA_MICB1_EXT_CAP_WIDTH 1
1663+#define MADERA_MICB1_LVL_MASK 0x01E0
1664+#define MADERA_MICB1_LVL_SHIFT 5
1665+#define MADERA_MICB1_LVL_WIDTH 4
16281666 #define MADERA_MICB1_ENA 0x0001
16291667 #define MADERA_MICB1_ENA_MASK 0x0001
16301668 #define MADERA_MICB1_ENA_SHIFT 0
@@ -2308,6 +2346,17 @@ · 677 unmodified lines
23082346 #define MADERA_OUT1R_ENA_SHIFT 0
23092347 #define MADERA_OUT1R_ENA_WIDTH 1
23102348
2349+/* (0x0408) Output_Rate_1 */
2350+#define MADERA_CP_DAC_MODE_MASK 0x0040
2351+#define MADERA_CP_DAC_MODE_SHIFT 6
2352+#define MADERA_CP_DAC_MODE_WIDTH 1
2353+#define MADERA_OUT_EXT_CLK_DIV_MASK 0x0030
2354+#define MADERA_OUT_EXT_CLK_DIV_SHIFT 4
2355+#define MADERA_OUT_EXT_CLK_DIV_WIDTH 2
2356+#define MADERA_OUT_CLK_SRC_MASK 0x0007
2357+#define MADERA_OUT_CLK_SRC_SHIFT 0
2358+#define MADERA_OUT_CLK_SRC_WIDTH 3
2359+
23112360 /* (0x0409) Output_Volume_Ramp */
23122361 #define MADERA_OUT_VD_RAMP_MASK 0x0070
23132362 #define MADERA_OUT_VD_RAMP_SHIFT 4
@@ -2829,6 +2878,30 @@ · 515 unmodified lines
28292878 #define MADERA_AIF2RX1_ENA_WIDTH 1
28302879
28312880 /* (0x0599) AIF3_Tx_Enables */
2881+#define MADERA_AIF3TX8_ENA 0x0080
2882+#define MADERA_AIF3TX8_ENA_MASK 0x0080
2883+#define MADERA_AIF3TX8_ENA_SHIFT 7
2884+#define MADERA_AIF3TX8_ENA_WIDTH 1
2885+#define MADERA_AIF3TX7_ENA 0x0040
2886+#define MADERA_AIF3TX7_ENA_MASK 0x0040
2887+#define MADERA_AIF3TX7_ENA_SHIFT 6
2888+#define MADERA_AIF3TX7_ENA_WIDTH 1
2889+#define MADERA_AIF3TX6_ENA 0x0020
2890+#define MADERA_AIF3TX6_ENA_MASK 0x0020
2891+#define MADERA_AIF3TX6_ENA_SHIFT 5
2892+#define MADERA_AIF3TX6_ENA_WIDTH 1
2893+#define MADERA_AIF3TX5_ENA 0x0010
2894+#define MADERA_AIF3TX5_ENA_MASK 0x0010
2895+#define MADERA_AIF3TX5_ENA_SHIFT 4
2896+#define MADERA_AIF3TX5_ENA_WIDTH 1
2897+#define MADERA_AIF3TX4_ENA 0x0008
2898+#define MADERA_AIF3TX4_ENA_MASK 0x0008
2899+#define MADERA_AIF3TX4_ENA_SHIFT 3
2900+#define MADERA_AIF3TX4_ENA_WIDTH 1
2901+#define MADERA_AIF3TX3_ENA 0x0004
2902+#define MADERA_AIF3TX3_ENA_MASK 0x0004
2903+#define MADERA_AIF3TX3_ENA_SHIFT 2
2904+#define MADERA_AIF3TX3_ENA_WIDTH 1
28322905 #define MADERA_AIF3TX2_ENA 0x0002
28332906 #define MADERA_AIF3TX2_ENA_MASK 0x0002
28342907 #define MADERA_AIF3TX2_ENA_SHIFT 1
@@ -2839,6 +2912,30 @@ · 4 unmodified lines
28392912 #define MADERA_AIF3TX1_ENA_WIDTH 1
28402913
28412914 /* (0x059A) AIF3_Rx_Enables */
2915+#define MADERA_AIF3RX8_ENA 0x0080
2916+#define MADERA_AIF3RX8_ENA_MASK 0x0080
2917+#define MADERA_AIF3RX8_ENA_SHIFT 7
2918+#define MADERA_AIF3RX8_ENA_WIDTH 1
2919+#define MADERA_AIF3RX7_ENA 0x0040
2920+#define MADERA_AIF3RX7_ENA_MASK 0x0040
2921+#define MADERA_AIF3RX7_ENA_SHIFT 6
2922+#define MADERA_AIF3RX7_ENA_WIDTH 1
2923+#define MADERA_AIF3RX6_ENA 0x0020
2924+#define MADERA_AIF3RX6_ENA_MASK 0x0020
2925+#define MADERA_AIF3RX6_ENA_SHIFT 5
2926+#define MADERA_AIF3RX6_ENA_WIDTH 1
2927+#define MADERA_AIF3RX5_ENA 0x0010
2928+#define MADERA_AIF3RX5_ENA_MASK 0x0010
2929+#define MADERA_AIF3RX5_ENA_SHIFT 4
2930+#define MADERA_AIF3RX5_ENA_WIDTH 1
2931+#define MADERA_AIF3RX4_ENA 0x0008
2932+#define MADERA_AIF3RX4_ENA_MASK 0x0008
2933+#define MADERA_AIF3RX4_ENA_SHIFT 3
2934+#define MADERA_AIF3RX4_ENA_WIDTH 1
2935+#define MADERA_AIF3RX3_ENA 0x0004
2936+#define MADERA_AIF3RX3_ENA_MASK 0x0004
2937+#define MADERA_AIF3RX3_ENA_SHIFT 2
2938+#define MADERA_AIF3RX3_ENA_WIDTH 1
28422939 #define MADERA_AIF3RX2_ENA 0x0002
28432940 #define MADERA_AIF3RX2_ENA_MASK 0x0002
28442941 #define MADERA_AIF3RX2_ENA_SHIFT 1
@@ -3453,6 +3550,25 @@ · 608 unmodified lines
34533550 #define MADERA_FCR_MIC_MODE_SEL_SHIFT 2
34543551 #define MADERA_FCR_MIC_MODE_SEL_WIDTH 2
34553552
3553+/* (0x10C0) AUXPDM1_CTRL_0 */
3554+#define MADERA_AUXPDM1_SRC_MASK 0x0F00
3555+#define MADERA_AUXPDM1_SRC_SHIFT 8
3556+#define MADERA_AUXPDM1_SRC_WIDTH 4
3557+#define MADERA_AUXPDM1_TXEDGE_MASK 0x0010
3558+#define MADERA_AUXPDM1_TXEDGE_SHIFT 4
3559+#define MADERA_AUXPDM1_TXEDGE_WIDTH 1
3560+#define MADERA_AUXPDM1_MSTR_MASK 0x0008
3561+#define MADERA_AUXPDM1_MSTR_SHIFT 3
3562+#define MADERA_AUXPDM1_MSTR_WIDTH 1
3563+#define MADERA_AUXPDM1_ENABLE_MASK 0x0001
3564+#define MADERA_AUXPDM1_ENABLE_SHIFT 0
3565+#define MADERA_AUXPDM1_ENABLE_WIDTH 1
3566+
3567+/* (0x10C1) AUXPDM1_CTRL_1 */
3568+#define MADERA_AUXPDM1_CLK_FREQ_MASK 0xC000
3569+#define MADERA_AUXPDM1_CLK_FREQ_SHIFT 14
3570+#define MADERA_AUXPDM1_CLK_FREQ_WIDTH 2
3571+
34563572 /* (0x1480) DFC1_CTRL_W0 */
34573573 #define MADERA_DFC1_RATE_MASK 0x007C
34583574 #define MADERA_DFC1_RATE_SHIFT 2
include/linux/mfd/rk808.h+177−0
@@ -374,6 +374,7 @@ enum rk805_reg { · 373 unmodified lines
374374 #define SWITCH1_EN BIT(5)
375375 #define DEV_OFF_RST BIT(3)
376376 #define DEV_OFF BIT(0)
377+#define RTC_STOP BIT(0)
377378
378379 #define VB_LO_ACT BIT(4)
379380 #define VB_LO_SEL_3500MV (7 << 0)
@@ -387,7 +388,179 @@ enum rk805_reg { · 7 unmodified lines
387388 #define SHUTDOWN_FUN (0x2 << 2)
388389 #define SLEEP_FUN (0x1 << 2)
389390 #define RK8XX_ID_MSK 0xfff0
391+#define PWM_MODE_MSK BIT(7)
390392 #define FPWM_MODE BIT(7)
393+#define AUTO_PWM_MODE 0
394+
395+enum rk817_reg_id {
396+ RK817_ID_DCDC1 = 0,
397+ RK817_ID_DCDC2,
398+ RK817_ID_DCDC3,
399+ RK817_ID_DCDC4,
400+ RK817_ID_LDO1,
401+ RK817_ID_LDO2,
402+ RK817_ID_LDO3,
403+ RK817_ID_LDO4,
404+ RK817_ID_LDO5,
405+ RK817_ID_LDO6,
406+ RK817_ID_LDO7,
407+ RK817_ID_LDO8,
408+ RK817_ID_LDO9,
409+ RK817_ID_BOOST,
410+ RK817_ID_BOOST_OTG_SW,
411+ RK817_NUM_REGULATORS
412+};
413+
414+enum rk809_reg_id {
415+ RK809_ID_DCDC5 = RK817_ID_BOOST,
416+ RK809_ID_SW1,
417+ RK809_ID_SW2,
418+ RK809_NUM_REGULATORS
419+};
420+
421+#define RK817_SECONDS_REG 0x00
422+#define RK817_MINUTES_REG 0x01
423+#define RK817_HOURS_REG 0x02
424+#define RK817_DAYS_REG 0x03
425+#define RK817_MONTHS_REG 0x04
426+#define RK817_YEARS_REG 0x05
427+#define RK817_WEEKS_REG 0x06
428+#define RK817_ALARM_SECONDS_REG 0x07
429+#define RK817_ALARM_MINUTES_REG 0x08
430+#define RK817_ALARM_HOURS_REG 0x09
431+#define RK817_ALARM_DAYS_REG 0x0a
432+#define RK817_ALARM_MONTHS_REG 0x0b
433+#define RK817_ALARM_YEARS_REG 0x0c
434+#define RK817_RTC_CTRL_REG 0xd
435+#define RK817_RTC_STATUS_REG 0xe
436+#define RK817_RTC_INT_REG 0xf
437+#define RK817_RTC_COMP_LSB_REG 0x10
438+#define RK817_RTC_COMP_MSB_REG 0x11
439+
440+#define RK817_POWER_EN_REG(i) (0xb1 + (i))
441+#define RK817_POWER_SLP_EN_REG(i) (0xb5 + (i))
442+
443+#define RK817_POWER_CONFIG (0xb9)
444+
445+#define RK817_BUCK_CONFIG_REG(i) (0xba + (i) * 3)
446+
447+#define RK817_BUCK1_ON_VSEL_REG 0xBB
448+#define RK817_BUCK1_SLP_VSEL_REG 0xBC
449+
450+#define RK817_BUCK2_CONFIG_REG 0xBD
451+#define RK817_BUCK2_ON_VSEL_REG 0xBE
452+#define RK817_BUCK2_SLP_VSEL_REG 0xBF
453+
454+#define RK817_BUCK3_CONFIG_REG 0xC0
455+#define RK817_BUCK3_ON_VSEL_REG 0xC1
456+#define RK817_BUCK3_SLP_VSEL_REG 0xC2
457+
458+#define RK817_BUCK4_CONFIG_REG 0xC3
459+#define RK817_BUCK4_ON_VSEL_REG 0xC4
460+#define RK817_BUCK4_SLP_VSEL_REG 0xC5
461+
462+#define RK817_LDO_ON_VSEL_REG(idx) (0xcc + (idx) * 2)
463+#define RK817_BOOST_OTG_CFG (0xde)
464+
465+#define RK817_ID_MSB 0xed
466+#define RK817_ID_LSB 0xee
467+
468+#define RK817_SYS_STS 0xf0
469+#define RK817_SYS_CFG(i) (0xf1 + (i))
470+
471+#define RK817_ON_SOURCE_REG 0xf5
472+#define RK817_OFF_SOURCE_REG 0xf6
473+
474+/* INTERRUPT REGISTER */
475+#define RK817_INT_STS_REG0 0xf8
476+#define RK817_INT_STS_MSK_REG0 0xf9
477+#define RK817_INT_STS_REG1 0xfa
478+#define RK817_INT_STS_MSK_REG1 0xfb
479+#define RK817_INT_STS_REG2 0xfc
480+#define RK817_INT_STS_MSK_REG2 0xfd
481+#define RK817_GPIO_INT_CFG 0xfe
482+
483+/* IRQ Definitions */
484+#define RK817_IRQ_PWRON_FALL 0
485+#define RK817_IRQ_PWRON_RISE 1
486+#define RK817_IRQ_PWRON 2
487+#define RK817_IRQ_PWMON_LP 3
488+#define RK817_IRQ_HOTDIE 4
489+#define RK817_IRQ_RTC_ALARM 5
490+#define RK817_IRQ_RTC_PERIOD 6
491+#define RK817_IRQ_VB_LO 7
492+#define RK817_IRQ_PLUG_IN 8
493+#define RK817_IRQ_PLUG_OUT 9
494+#define RK817_IRQ_CHRG_TERM 10
495+#define RK817_IRQ_CHRG_TIME 11
496+#define RK817_IRQ_CHRG_TS 12
497+#define RK817_IRQ_USB_OV 13
498+#define RK817_IRQ_CHRG_IN_CLMP 14
499+#define RK817_IRQ_BAT_DIS_ILIM 15
500+#define RK817_IRQ_GATE_GPIO 16
501+#define RK817_IRQ_TS_GPIO 17
502+#define RK817_IRQ_CODEC_PD 18
503+#define RK817_IRQ_CODEC_PO 19
504+#define RK817_IRQ_CLASSD_MUTE_DONE 20
505+#define RK817_IRQ_CLASSD_OCP 21
506+#define RK817_IRQ_BAT_OVP 22
507+#define RK817_IRQ_CHRG_BAT_HI 23
508+#define RK817_IRQ_END (RK817_IRQ_CHRG_BAT_HI + 1)
509+
510+/*
511+ * rtc_ctrl 0xd
512+ * same as 808, except bit4
513+ */
514+#define RK817_RTC_CTRL_RSV4 BIT(4)
515+
516+/* power config 0xb9 */
517+#define RK817_BUCK3_FB_RES_MSK BIT(6)
518+#define RK817_BUCK3_FB_RES_INTER BIT(6)
519+#define RK817_BUCK3_FB_RES_EXT 0
520+
521+/* buck config 0xba */
522+#define RK817_RAMP_RATE_OFFSET 6
523+#define RK817_RAMP_RATE_MASK (0x3 << RK817_RAMP_RATE_OFFSET)
524+#define RK817_RAMP_RATE_3MV_PER_US (0x0 << RK817_RAMP_RATE_OFFSET)
525+#define RK817_RAMP_RATE_6_3MV_PER_US (0x1 << RK817_RAMP_RATE_OFFSET)
526+#define RK817_RAMP_RATE_12_5MV_PER_US (0x2 << RK817_RAMP_RATE_OFFSET)
527+#define RK817_RAMP_RATE_25MV_PER_US (0x3 << RK817_RAMP_RATE_OFFSET)
528+
529+/* sys_cfg1 0xf2 */
530+#define RK817_HOTDIE_TEMP_MSK (0x3 << 4)
531+#define RK817_HOTDIE_85 (0x0 << 4)
532+#define RK817_HOTDIE_95 (0x1 << 4)
533+#define RK817_HOTDIE_105 (0x2 << 4)
534+#define RK817_HOTDIE_115 (0x3 << 4)
535+
536+#define RK817_TSD_TEMP_MSK BIT(6)
537+#define RK817_TSD_140 0
538+#define RK817_TSD_160 BIT(6)
539+
540+#define RK817_CLK32KOUT2_EN BIT(7)
541+
542+/* sys_cfg3 0xf4 */
543+#define RK817_SLPPIN_FUNC_MSK (0x3 << 3)
544+#define SLPPIN_NULL_FUN (0x0 << 3)
545+#define SLPPIN_SLP_FUN (0x1 << 3)
546+#define SLPPIN_DN_FUN (0x2 << 3)
547+#define SLPPIN_RST_FUN (0x3 << 3)
548+
549+#define RK817_RST_FUNC_MSK (0x3 << 6)
550+#define RK817_RST_FUNC_SFT (6)
551+#define RK817_RST_FUNC_CNT (3)
552+#define RK817_RST_FUNC_DEV (0) /* reset the dev */
553+#define RK817_RST_FUNC_REG (0x1 << 6) /* reset the reg only */
554+
555+#define RK817_SLPPOL_MSK BIT(5)
556+#define RK817_SLPPOL_H BIT(5)
557+#define RK817_SLPPOL_L (0)
558+
559+/* gpio&int 0xfe */
560+#define RK817_INT_POL_MSK BIT(1)
561+#define RK817_INT_POL_H BIT(1)
562+#define RK817_INT_POL_L 0
563+#define RK809_BUCK5_CONFIG(i) (RK817_BOOST_OTG_CFG + (i) * 1)
391564
392565 enum {
393566 BUCK_ILMIN_50MA,
@@ -435,6 +608,8 @@ enum { · 41 unmodified lines
435608 enum {
436609 RK805_ID = 0x8050,
437610 RK808_ID = 0x0000,
611+ RK809_ID = 0x8090,
612+ RK817_ID = 0x8170,
438613 RK818_ID = 0x8181,
439614 };
440615
@@ -445,5 +620,7 @@ struct rk808 { · 4 unmodified lines
445620 long variant;
446621 const struct regmap_config *regmap_cfg;
447622 const struct regmap_irq_chip *regmap_irq_chip;
623+ void (*pm_pwroff_fn)(void);
624+ void (*pm_pwroff_prep_fn)(void);
448625 };
449626 #endif /* __LINUX_REGULATOR_RK808_H */
include/linux/mfd/rohm-bd70528.h+408−0
@@ -0,0 +1,408 @@
1+/* SPDX-License-Identifier: GPL-2.0-or-later */
2+/* Copyright (C) 2018 ROHM Semiconductors */
3+
4+#ifndef __LINUX_MFD_BD70528_H__
5+#define __LINUX_MFD_BD70528_H__
6+
7+#include <linux/bits.h>
8+#include <linux/device.h>
9+#include <linux/mfd/rohm-generic.h>
10+#include <linux/regmap.h>
11+
12+enum {
13+ BD70528_BUCK1,
14+ BD70528_BUCK2,
15+ BD70528_BUCK3,
16+ BD70528_LDO1,
17+ BD70528_LDO2,
18+ BD70528_LDO3,
19+ BD70528_LED1,
20+ BD70528_LED2,
21+};
22+
23+struct bd70528_data {
24+ struct rohm_regmap_dev chip;
25+ struct mutex rtc_timer_lock;
26+};
27+
28+#define BD70528_BUCK_VOLTS 17
29+#define BD70528_BUCK_VOLTS 17
30+#define BD70528_BUCK_VOLTS 17
31+#define BD70528_LDO_VOLTS 0x20
32+
33+#define BD70528_REG_BUCK1_EN 0x0F
34+#define BD70528_REG_BUCK1_VOLT 0x15
35+#define BD70528_REG_BUCK2_EN 0x10
36+#define BD70528_REG_BUCK2_VOLT 0x16
37+#define BD70528_REG_BUCK3_EN 0x11
38+#define BD70528_REG_BUCK3_VOLT 0x17
39+#define BD70528_REG_LDO1_EN 0x1b
40+#define BD70528_REG_LDO1_VOLT 0x1e
41+#define BD70528_REG_LDO2_EN 0x1c
42+#define BD70528_REG_LDO2_VOLT 0x1f
43+#define BD70528_REG_LDO3_EN 0x1d
44+#define BD70528_REG_LDO3_VOLT 0x20
45+#define BD70528_REG_LED_CTRL 0x2b
46+#define BD70528_REG_LED_VOLT 0x29
47+#define BD70528_REG_LED_EN 0x2a
48+
49+/* main irq registers */
50+#define BD70528_REG_INT_MAIN 0x7E
51+#define BD70528_REG_INT_MAIN_MASK 0x74
52+
53+/* 'sub irq' registers */
54+#define BD70528_REG_INT_SHDN 0x7F
55+#define BD70528_REG_INT_PWR_FLT 0x80
56+#define BD70528_REG_INT_VR_FLT 0x81
57+#define BD70528_REG_INT_MISC 0x82
58+#define BD70528_REG_INT_BAT1 0x83
59+#define BD70528_REG_INT_BAT2 0x84
60+#define BD70528_REG_INT_RTC 0x85
61+#define BD70528_REG_INT_GPIO 0x86
62+#define BD70528_REG_INT_OP_FAIL 0x87
63+
64+#define BD70528_REG_INT_SHDN_MASK 0x75
65+#define BD70528_REG_INT_PWR_FLT_MASK 0x76
66+#define BD70528_REG_INT_VR_FLT_MASK 0x77
67+#define BD70528_REG_INT_MISC_MASK 0x78
68+#define BD70528_REG_INT_BAT1_MASK 0x79
69+#define BD70528_REG_INT_BAT2_MASK 0x7a
70+#define BD70528_REG_INT_RTC_MASK 0x7b
71+#define BD70528_REG_INT_GPIO_MASK 0x7c
72+#define BD70528_REG_INT_OP_FAIL_MASK 0x7d
73+
74+/* Reset related 'magic' registers */
75+#define BD70528_REG_SHIPMODE 0x03
76+#define BD70528_REG_HWRESET 0x04
77+#define BD70528_REG_WARMRESET 0x05
78+#define BD70528_REG_STANDBY 0x06
79+
80+/* GPIO registers */
81+#define BD70528_REG_GPIO_STATE 0x8F
82+
83+#define BD70528_REG_GPIO1_IN 0x4d
84+#define BD70528_REG_GPIO2_IN 0x4f
85+#define BD70528_REG_GPIO3_IN 0x51
86+#define BD70528_REG_GPIO4_IN 0x53
87+#define BD70528_REG_GPIO1_OUT 0x4e
88+#define BD70528_REG_GPIO2_OUT 0x50
89+#define BD70528_REG_GPIO3_OUT 0x52
90+#define BD70528_REG_GPIO4_OUT 0x54
91+
92+/* clk control */
93+
94+#define BD70528_REG_CLK_OUT 0x2c
95+
96+/* RTC */
97+
98+#define BD70528_REG_RTC_COUNT_H 0x2d
99+#define BD70528_REG_RTC_COUNT_L 0x2e
100+#define BD70528_REG_RTC_SEC 0x2f
101+#define BD70528_REG_RTC_MINUTE 0x30
102+#define BD70528_REG_RTC_HOUR 0x31
103+#define BD70528_REG_RTC_WEEK 0x32
104+#define BD70528_REG_RTC_DAY 0x33
105+#define BD70528_REG_RTC_MONTH 0x34
106+#define BD70528_REG_RTC_YEAR 0x35
107+
108+#define BD70528_REG_RTC_ALM_SEC 0x36
109+#define BD70528_REG_RTC_ALM_START BD70528_REG_RTC_ALM_SEC
110+#define BD70528_REG_RTC_ALM_MINUTE 0x37
111+#define BD70528_REG_RTC_ALM_HOUR 0x38
112+#define BD70528_REG_RTC_ALM_WEEK 0x39
113+#define BD70528_REG_RTC_ALM_DAY 0x3a
114+#define BD70528_REG_RTC_ALM_MONTH 0x3b
115+#define BD70528_REG_RTC_ALM_YEAR 0x3c
116+#define BD70528_REG_RTC_ALM_MASK 0x3d
117+#define BD70528_REG_RTC_ALM_REPEAT 0x3e
118+#define BD70528_REG_RTC_START BD70528_REG_RTC_SEC
119+
120+#define BD70528_REG_RTC_WAKE_SEC 0x43
121+#define BD70528_REG_RTC_WAKE_START BD70528_REG_RTC_WAKE_SEC
122+#define BD70528_REG_RTC_WAKE_MIN 0x44
123+#define BD70528_REG_RTC_WAKE_HOUR 0x45
124+#define BD70528_REG_RTC_WAKE_CTRL 0x46
125+
126+#define BD70528_REG_ELAPSED_TIMER_EN 0x42
127+#define BD70528_REG_WAKE_EN 0x46
128+
129+/* WDT registers */
130+#define BD70528_REG_WDT_CTRL 0x4A
131+#define BD70528_REG_WDT_HOUR 0x49
132+#define BD70528_REG_WDT_MINUTE 0x48
133+#define BD70528_REG_WDT_SEC 0x47
134+
135+/* Charger / Battery */
136+#define BD70528_REG_CHG_CURR_STAT 0x59
137+#define BD70528_REG_CHG_BAT_STAT 0x57
138+#define BD70528_REG_CHG_BAT_TEMP 0x58
139+#define BD70528_REG_CHG_IN_STAT 0x56
140+#define BD70528_REG_CHG_DCIN_ILIM 0x5d
141+#define BD70528_REG_CHG_CHG_CURR_WARM 0x61
142+#define BD70528_REG_CHG_CHG_CURR_COLD 0x62
143+
144+/* Masks for main IRQ register bits */
145+enum {
146+ BD70528_INT_SHDN,
147+#define BD70528_INT_SHDN_MASK BIT(BD70528_INT_SHDN)
148+ BD70528_INT_PWR_FLT,
149+#define BD70528_INT_PWR_FLT_MASK BIT(BD70528_INT_PWR_FLT)
150+ BD70528_INT_VR_FLT,
151+#define BD70528_INT_VR_FLT_MASK BIT(BD70528_INT_VR_FLT)
152+ BD70528_INT_MISC,
153+#define BD70528_INT_MISC_MASK BIT(BD70528_INT_MISC)
154+ BD70528_INT_BAT1,
155+#define BD70528_INT_BAT1_MASK BIT(BD70528_INT_BAT1)
156+ BD70528_INT_RTC,
157+#define BD70528_INT_RTC_MASK BIT(BD70528_INT_RTC)
158+ BD70528_INT_GPIO,
159+#define BD70528_INT_GPIO_MASK BIT(BD70528_INT_GPIO)
160+ BD70528_INT_OP_FAIL,
161+#define BD70528_INT_OP_FAIL_MASK BIT(BD70528_INT_OP_FAIL)
162+};
163+
164+/* IRQs */
165+enum {
166+ /* Shutdown register IRQs */
167+ BD70528_INT_LONGPUSH,
168+ BD70528_INT_WDT,
169+ BD70528_INT_HWRESET,
170+ BD70528_INT_RSTB_FAULT,
171+ BD70528_INT_VBAT_UVLO,
172+ BD70528_INT_TSD,
173+ BD70528_INT_RSTIN,
174+ /* Power failure register IRQs */
175+ BD70528_INT_BUCK1_FAULT,
176+ BD70528_INT_BUCK2_FAULT,
177+ BD70528_INT_BUCK3_FAULT,
178+ BD70528_INT_LDO1_FAULT,
179+ BD70528_INT_LDO2_FAULT,
180+ BD70528_INT_LDO3_FAULT,
181+ BD70528_INT_LED1_FAULT,
182+ BD70528_INT_LED2_FAULT,
183+ /* VR FAULT register IRQs */
184+ BD70528_INT_BUCK1_OCP,
185+ BD70528_INT_BUCK2_OCP,
186+ BD70528_INT_BUCK3_OCP,
187+ BD70528_INT_LED1_OCP,
188+ BD70528_INT_LED2_OCP,
189+ BD70528_INT_BUCK1_FULLON,
190+ BD70528_INT_BUCK2_FULLON,
191+ /* PMU register interrupts */
192+ BD70528_INT_SHORTPUSH,
193+ BD70528_INT_AUTO_WAKEUP,
194+ BD70528_INT_STATE_CHANGE,
195+ /* Charger 1 register IRQs */
196+ BD70528_INT_BAT_OV_RES,
197+ BD70528_INT_BAT_OV_DET,
198+ BD70528_INT_DBAT_DET,
199+ BD70528_INT_BATTSD_COLD_RES,
200+ BD70528_INT_BATTSD_COLD_DET,
201+ BD70528_INT_BATTSD_HOT_RES,
202+ BD70528_INT_BATTSD_HOT_DET,
203+ BD70528_INT_CHG_TSD,
204+ /* Charger 2 register IRQs */
205+ BD70528_INT_BAT_RMV,
206+ BD70528_INT_BAT_DET,
207+ BD70528_INT_DCIN2_OV_RES,
208+ BD70528_INT_DCIN2_OV_DET,
209+ BD70528_INT_DCIN2_RMV,
210+ BD70528_INT_DCIN2_DET,
211+ BD70528_INT_DCIN1_RMV,
212+ BD70528_INT_DCIN1_DET,
213+ /* RTC register IRQs */
214+ BD70528_INT_RTC_ALARM,
215+ BD70528_INT_ELPS_TIM,
216+ /* GPIO register IRQs */
217+ BD70528_INT_GPIO0,
218+ BD70528_INT_GPIO1,
219+ BD70528_INT_GPIO2,
220+ BD70528_INT_GPIO3,
221+ /* Invalid operation register IRQs */
222+ BD70528_INT_BUCK1_DVS_OPFAIL,
223+ BD70528_INT_BUCK2_DVS_OPFAIL,
224+ BD70528_INT_BUCK3_DVS_OPFAIL,
225+ BD70528_INT_LED1_VOLT_OPFAIL,
226+ BD70528_INT_LED2_VOLT_OPFAIL,
227+};
228+
229+/* Masks */
230+#define BD70528_INT_LONGPUSH_MASK 0x1
231+#define BD70528_INT_WDT_MASK 0x2
232+#define BD70528_INT_HWRESET_MASK 0x4
233+#define BD70528_INT_RSTB_FAULT_MASK 0x8
234+#define BD70528_INT_VBAT_UVLO_MASK 0x10
235+#define BD70528_INT_TSD_MASK 0x20
236+#define BD70528_INT_RSTIN_MASK 0x40
237+
238+#define BD70528_INT_BUCK1_FAULT_MASK 0x1
239+#define BD70528_INT_BUCK2_FAULT_MASK 0x2
240+#define BD70528_INT_BUCK3_FAULT_MASK 0x4
241+#define BD70528_INT_LDO1_FAULT_MASK 0x8
242+#define BD70528_INT_LDO2_FAULT_MASK 0x10
243+#define BD70528_INT_LDO3_FAULT_MASK 0x20
244+#define BD70528_INT_LED1_FAULT_MASK 0x40
245+#define BD70528_INT_LED2_FAULT_MASK 0x80
246+
247+#define BD70528_INT_BUCK1_OCP_MASK 0x1
248+#define BD70528_INT_BUCK2_OCP_MASK 0x2
249+#define BD70528_INT_BUCK3_OCP_MASK 0x4
250+#define BD70528_INT_LED1_OCP_MASK 0x8
251+#define BD70528_INT_LED2_OCP_MASK 0x10
252+#define BD70528_INT_BUCK1_FULLON_MASK 0x20
253+#define BD70528_INT_BUCK2_FULLON_MASK 0x40
254+
255+#define BD70528_INT_SHORTPUSH_MASK 0x1
256+#define BD70528_INT_AUTO_WAKEUP_MASK 0x2
257+#define BD70528_INT_STATE_CHANGE_MASK 0x10
258+
259+#define BD70528_INT_BAT_OV_RES_MASK 0x1
260+#define BD70528_INT_BAT_OV_DET_MASK 0x2
261+#define BD70528_INT_DBAT_DET_MASK 0x4
262+#define BD70528_INT_BATTSD_COLD_RES_MASK 0x8
263+#define BD70528_INT_BATTSD_COLD_DET_MASK 0x10
264+#define BD70528_INT_BATTSD_HOT_RES_MASK 0x20
265+#define BD70528_INT_BATTSD_HOT_DET_MASK 0x40
266+#define BD70528_INT_CHG_TSD_MASK 0x80
267+
268+#define BD70528_INT_BAT_RMV_MASK 0x1
269+#define BD70528_INT_BAT_DET_MASK 0x2
270+#define BD70528_INT_DCIN2_OV_RES_MASK 0x4
271+#define BD70528_INT_DCIN2_OV_DET_MASK 0x8
272+#define BD70528_INT_DCIN2_RMV_MASK 0x10
273+#define BD70528_INT_DCIN2_DET_MASK 0x20
274+#define BD70528_INT_DCIN1_RMV_MASK 0x40
275+#define BD70528_INT_DCIN1_DET_MASK 0x80
276+
277+#define BD70528_INT_RTC_ALARM_MASK 0x1
278+#define BD70528_INT_ELPS_TIM_MASK 0x2
279+
280+#define BD70528_INT_GPIO0_MASK 0x1
281+#define BD70528_INT_GPIO1_MASK 0x2
282+#define BD70528_INT_GPIO2_MASK 0x4
283+#define BD70528_INT_GPIO3_MASK 0x8
284+
285+#define BD70528_INT_BUCK1_DVS_OPFAIL_MASK 0x1
286+#define BD70528_INT_BUCK2_DVS_OPFAIL_MASK 0x2
287+#define BD70528_INT_BUCK3_DVS_OPFAIL_MASK 0x4
288+#define BD70528_INT_LED1_VOLT_OPFAIL_MASK 0x10
289+#define BD70528_INT_LED2_VOLT_OPFAIL_MASK 0x20
290+
291+#define BD70528_DEBOUNCE_MASK 0x3
292+
293+#define BD70528_DEBOUNCE_DISABLE 0
294+#define BD70528_DEBOUNCE_15MS 1
295+#define BD70528_DEBOUNCE_30MS 2
296+#define BD70528_DEBOUNCE_50MS 3
297+
298+#define BD70528_GPIO_DRIVE_MASK 0x2
299+#define BD70528_GPIO_PUSH_PULL 0x0
300+#define BD70528_GPIO_OPEN_DRAIN 0x2
301+
302+#define BD70528_GPIO_OUT_EN_MASK 0x80
303+#define BD70528_GPIO_OUT_ENABLE 0x80
304+#define BD70528_GPIO_OUT_DISABLE 0x0
305+
306+#define BD70528_GPIO_OUT_HI 0x1
307+#define BD70528_GPIO_OUT_LO 0x0
308+#define BD70528_GPIO_OUT_MASK 0x1
309+
310+#define BD70528_GPIO_IN_STATE_BASE 1
311+
312+#define BD70528_CLK_OUT_EN_MASK 0x1
313+
314+/* RTC masks to mask out reserved bits */
315+
316+#define BD70528_MASK_RTC_SEC 0x7f
317+#define BD70528_MASK_RTC_MINUTE 0x7f
318+#define BD70528_MASK_RTC_HOUR_24H 0x80
319+#define BD70528_MASK_RTC_HOUR_PM 0x20
320+#define BD70528_MASK_RTC_HOUR 0x1f
321+#define BD70528_MASK_RTC_DAY 0x3f
322+#define BD70528_MASK_RTC_WEEK 0x07
323+#define BD70528_MASK_RTC_MONTH 0x1f
324+#define BD70528_MASK_RTC_YEAR 0xff
325+#define BD70528_MASK_RTC_COUNT_L 0x7f
326+
327+#define BD70528_MASK_ELAPSED_TIMER_EN 0x1
328+/* Mask second, min and hour fields
329+ * HW would support ALM irq for over 24h
330+ * (by setting day, month and year too)
331+ * but as we wish to keep this same as for
332+ * wake-up we limit ALM to 24H and only
333+ * unmask sec, min and hour
334+ */
335+#define BD70528_MASK_ALM_EN 0x7
336+#define BD70528_MASK_WAKE_EN 0x1
337+
338+/* WDT masks */
339+#define BD70528_MASK_WDT_EN 0x1
340+#define BD70528_MASK_WDT_HOUR 0x1
341+#define BD70528_MASK_WDT_MINUTE 0x7f
342+#define BD70528_MASK_WDT_SEC 0x7f
343+
344+#define BD70528_WDT_STATE_BIT 0x1
345+#define BD70528_ELAPSED_STATE_BIT 0x2
346+#define BD70528_WAKE_STATE_BIT 0x4
347+
348+/* Charger masks */
349+#define BD70528_MASK_CHG_STAT 0x7f
350+#define BD70528_MASK_CHG_BAT_TIMER 0x20
351+#define BD70528_MASK_CHG_BAT_OVERVOLT 0x10
352+#define BD70528_MASK_CHG_BAT_DETECT 0x1
353+#define BD70528_MASK_CHG_DCIN1_UVLO 0x1
354+#define BD70528_MASK_CHG_DCIN_ILIM 0x3f
355+#define BD70528_MASK_CHG_CHG_CURR 0x1f
356+#define BD70528_MASK_CHG_TRICKLE_CURR 0x10
357+
358+/*
359+ * Note, external battery register is the lonely rider at
360+ * address 0xc5. See how to stuff that in the regmap
361+ */
362+#define BD70528_MAX_REGISTER 0x94
363+
364+/* Buck control masks */
365+#define BD70528_MASK_RUN_EN 0x4
366+#define BD70528_MASK_STBY_EN 0x2
367+#define BD70528_MASK_IDLE_EN 0x1
368+#define BD70528_MASK_LED1_EN 0x1
369+#define BD70528_MASK_LED2_EN 0x10
370+
371+#define BD70528_MASK_BUCK_VOLT 0xf
372+#define BD70528_MASK_LDO_VOLT 0x1f
373+#define BD70528_MASK_LED1_VOLT 0x1
374+#define BD70528_MASK_LED2_VOLT 0x10
375+
376+/* Misc irq masks */
377+#define BD70528_INT_MASK_SHORT_PUSH 1
378+#define BD70528_INT_MASK_AUTO_WAKE 2
379+#define BD70528_INT_MASK_POWER_STATE 4
380+
381+#define BD70528_MASK_BUCK_RAMP 0x10
382+#define BD70528_SIFT_BUCK_RAMP 4
383+
384+#if IS_ENABLED(CONFIG_BD70528_WATCHDOG)
385+
386+int bd70528_wdt_set(struct rohm_regmap_dev *data, int enable, int *old_state);
387+void bd70528_wdt_lock(struct rohm_regmap_dev *data);
388+void bd70528_wdt_unlock(struct rohm_regmap_dev *data);
389+
390+#else /* CONFIG_BD70528_WATCHDOG */
391+
392+static inline int bd70528_wdt_set(struct rohm_regmap_dev *data, int enable,
393+ int *old_state)
394+{
395+ return 0;
396+}
397+
398+static inline void bd70528_wdt_lock(struct rohm_regmap_dev *data)
399+{
400+}
401+
402+static inline void bd70528_wdt_unlock(struct rohm_regmap_dev *data)
403+{
404+}
405+
406+#endif /* CONFIG_BD70528_WATCHDOG */
407+
408+#endif /* __LINUX_MFD_BD70528_H__ */
include/linux/mfd/rohm-bd718x7.h+8−14
@@ -4,14 +4,9 @@ · 3 unmodified lines
44 #ifndef __LINUX_MFD_BD718XX_H__
55 #define __LINUX_MFD_BD718XX_H__
66
7+#include <linux/mfd/rohm-generic.h>
78 #include <linux/regmap.h>
89
9−enum {
10− BD718XX_TYPE_BD71837 = 0,
11− BD718XX_TYPE_BD71847,
12− BD718XX_TYPE_AMOUNT
13−};
14−
1510 enum {
1611 BD718XX_BUCK1 = 0,
1712 BD718XX_BUCK2,
@@ -321,18 +316,17 @@ enum { · 303 unmodified lines
321316 BD718XX_PWRBTN_LONG_PRESS_15S
322317 };
323318
324−struct bd718xx_clk;
325−
326319 struct bd718xx {
327− unsigned int chip_type;
328− struct device *dev;
329− struct regmap *regmap;
330− unsigned long int id;
320+ /*
321+ * Please keep this as the first member here as some
322+ * drivers (clk) supporting more than one chip may only know this
323+ * generic struct 'struct rohm_regmap_dev' and assume it is
324+ * the first chunk of parent device's private data.
325+ */
326+ struct rohm_regmap_dev chip;
331327
332328 int chip_irq;
333329 struct regmap_irq_chip_data *irq_data;
334−
335− struct bd718xx_clk *clk;
336330 };
337331
338332 #endif /* __LINUX_MFD_BD718XX_H__ */
include/linux/mfd/rohm-generic.h+20−0
@@ -0,0 +1,20 @@
1+/* SPDX-License-Identifier: GPL-2.0-or-later */
2+/* Copyright (C) 2018 ROHM Semiconductors */
3+
4+#ifndef __LINUX_MFD_ROHM_H__
5+#define __LINUX_MFD_ROHM_H__
6+
7+enum {
8+ ROHM_CHIP_TYPE_BD71837 = 0,
9+ ROHM_CHIP_TYPE_BD71847,
10+ ROHM_CHIP_TYPE_BD70528,
11+ ROHM_CHIP_TYPE_AMOUNT
12+};
13+
14+struct rohm_regmap_dev {
15+ unsigned int chip_type;
16+ struct device *dev;
17+ struct regmap *regmap;
18+};
19+
20+#endif
include/linux/mfd/samsung/core.h+1−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #define MIN_850_MV 850000
2121 #define MIN_800_MV 800000
2222 #define MIN_750_MV 750000
23+#define MIN_650_MV 650000
2324 #define MIN_600_MV 600000
2425 #define MIN_500_MV 500000
2526
include/linux/mfd/samsung/s2mps11.h+8−1
@@ -170,7 +170,9 @@ enum s2mps11_regulators { · 169 unmodified lines
170170 #define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT)
171171 #define S2MPS11_ENABLE_SHIFT 0x06
172172 #define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1)
173−#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
173+#define S2MPS11_BUCK12346_N_VOLTAGES 153
174+#define S2MPS11_BUCK5_N_VOLTAGES 216
175+#define S2MPS11_BUCK7810_N_VOLTAGES 225
174176 #define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1)
175177 #define S2MPS11_RAMP_DELAY 25000 /* uV/us */
176178
@@ -188,4 +190,9 @@ enum s2mps11_regulators { · 11 unmodified lines
188190 #define S2MPS11_BUCK6_RAMP_EN_SHIFT 0
189191 #define S2MPS11_PMIC_EN_SHIFT 6
190192
193+/*
194+ * Bits for "enable suspend" (On/Off controlled by PWREN)
195+ * are the same as in S2MPS14: S2MPS14_ENABLE_SUSPEND
196+ */
197+
191198 #endif /* __LINUX_MFD_S2MPS11_H */
include/linux/mfd/stmfx.h+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 */
66
77 #ifndef MFD_STMFX_H
8−#define MFX_STMFX_H
8+#define MFD_STMFX_H
99
1010 #include <linux/regmap.h>
1111
include/linux/mfd/syscon.h+0−6
@@ -19,7 +19,6 @@ struct device_node; · 18 unmodified lines
1919 #ifdef CONFIG_MFD_SYSCON
2020 extern struct regmap *syscon_node_to_regmap(struct device_node *np);
2121 extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
22−extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s);
2322 extern struct regmap *syscon_regmap_lookup_by_phandle(
2423 struct device_node *np,
2524 const char *property);
@@ -34,11 +33,6 @@ static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s) · 8 unmodified lines
3433 return ERR_PTR(-ENOTSUPP);
3534 }
3635
37−static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s)
38−{
39− return ERR_PTR(-ENOTSUPP);
40−}
41−
4236 static inline struct regmap *syscon_regmap_lookup_by_phandle(
4337 struct device_node *np,
4438 const char *property)
include/linux/mfd/ti-lmu-register.h+21−42
@@ -187,47 +187,26 @@ · 186 unmodified lines
187187
188188 #define LM3695_MAX_REG 0x14
189189
190−/* LM3697 */
191−#define LM3697_REG_HVLED_OUTPUT_CFG 0x10
192−#define LM3697_HVLED1_CFG_MASK BIT(0)
193−#define LM3697_HVLED2_CFG_MASK BIT(1)
194−#define LM3697_HVLED3_CFG_MASK BIT(2)
195−#define LM3697_HVLED1_CFG_SHIFT 0
196−#define LM3697_HVLED2_CFG_SHIFT 1
197−#define LM3697_HVLED3_CFG_SHIFT 2
190+/* LM36274 */
191+#define LM36274_REG_REV 0x01
192+#define LM36274_REG_BL_CFG_1 0x02
193+#define LM36274_REG_BL_CFG_2 0x03
194+#define LM36274_REG_BRT_LSB 0x04
195+#define LM36274_REG_BRT_MSB 0x05
196+#define LM36274_REG_BL_EN 0x08
197+
198+#define LM36274_REG_BIAS_CONFIG_1 0x09
199+#define LM36274_EXT_EN_MASK BIT(0)
200+#define LM36274_EN_VNEG_MASK BIT(1)
201+#define LM36274_EN_VPOS_MASK BIT(2)
202+
203+#define LM36274_REG_BIAS_CONFIG_2 0x0a
204+#define LM36274_REG_BIAS_CONFIG_3 0x0b
205+#define LM36274_REG_VOUT_BOOST 0x0c
206+#define LM36274_REG_VOUT_POS 0x0d
207+#define LM36274_REG_VOUT_NEG 0x0e
208+#define LM36274_VOUT_MASK 0x3F
209+
210+#define LM36274_MAX_REG 0x13
198211
199−#define LM3697_REG_BL0_RAMP 0x11
200−#define LM3697_REG_BL1_RAMP 0x12
201−#define LM3697_RAMPUP_MASK 0xF0
202−#define LM3697_RAMPUP_SHIFT 4
203−#define LM3697_RAMPDN_MASK 0x0F
204−#define LM3697_RAMPDN_SHIFT 0
205−
206−#define LM3697_REG_RAMP_CONF 0x14
207−#define LM3697_RAMP_MASK 0x0F
208−#define LM3697_RAMP_EACH 0x05
209−
210−#define LM3697_REG_PWM_CFG 0x1C
211−#define LM3697_PWM_A_MASK BIT(0)
212−#define LM3697_PWM_B_MASK BIT(1)
213−
214−#define LM3697_REG_IMAX_A 0x17
215−#define LM3697_REG_IMAX_B 0x18
216−
217−#define LM3697_REG_FEEDBACK_ENABLE 0x19
218−
219−#define LM3697_REG_BRT_A_LSB 0x20
220−#define LM3697_REG_BRT_A_MSB 0x21
221−#define LM3697_REG_BRT_B_LSB 0x22
222−#define LM3697_REG_BRT_B_MSB 0x23
223−
224−#define LM3697_REG_ENABLE 0x24
225−
226−#define LM3697_REG_OPEN_FAULT_STATUS 0xB0
227−
228−#define LM3697_REG_SHORT_FAULT_STATUS 0xB2
229−
230−#define LM3697_REG_MONITOR_ENABLE 0xB4
231−
232−#define LM3697_MAX_REG 0xB4
233212 #endif
include/linux/mfd/ti-lmu.h+4−1
@@ -23,7 +23,7 @@ enum ti_lmu_id { · 22 unmodified lines
2323 LM3632,
2424 LM3633,
2525 LM3695,
26− LM3697,
26+ LM36274,
2727 LMU_MAX_ID,
2828 };
2929
@@ -65,6 +65,9 @@ enum lm363x_regulator_id { · 35 unmodified lines
6565 LM3632_BOOST, /* Boost output */
6666 LM3632_LDO_POS, /* Positive display bias output */
6767 LM3632_LDO_NEG, /* Negative display bias output */
68+ LM36274_BOOST, /* Boost output */
69+ LM36274_LDO_POS, /* Positive display bias output */
70+ LM36274_LDO_NEG, /* Negative display bias output */
6871 };
6972
7073 /**
include/linux/mfd/wm831x/pdata.h+0−1
@@ -47,7 +47,6 @@ struct wm831x_battery_pdata { · 46 unmodified lines
4747 * I2C or SPI buses.
4848 */
4949 struct wm831x_buckv_pdata {
50− int dvs_gpio; /** CPU GPIO to use for DVS switching */
5150 int dvs_control_src; /** Hardware DVS source to use (1 or 2) */
5251 int dvs_init_state; /** DVS state to expect on startup */
5352 int dvs_state_gpio; /** CPU GPIO to use for monitoring status */
include/linux/migrate.h+1−2
@@ -77,8 +77,7 @@ extern void migrate_page_copy(struct page *newpage, struct page *page); · 76 unmodified lines
7777 extern int migrate_huge_page_move_mapping(struct address_space *mapping,
7878 struct page *newpage, struct page *page);
7979 extern int migrate_page_move_mapping(struct address_space *mapping,
80− struct page *newpage, struct page *page, enum migrate_mode mode,
81− int extra_count);
80+ struct page *newpage, struct page *page, int extra_count);
8281 #else
8382
8483 static inline void putback_movable_pages(struct list_head *l) {}
include/linux/mlx5/accel.h+1−1
@@ -114,7 +114,7 @@ enum mlx5_accel_ipsec_cap { · 113 unmodified lines
114114 MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN = 1 << 7,
115115 };
116116
117−#ifdef CONFIG_MLX5_ACCEL
117+#ifdef CONFIG_MLX5_FPGA_IPSEC
118118
119119 u32 mlx5_accel_ipsec_device_caps(struct mlx5_core_dev *mdev);
120120
include/linux/mlx5/cq.h+3−3
@@ -47,7 +47,7 @@ struct mlx5_core_cq { · 46 unmodified lines
4747 struct completion free;
4848 unsigned vector;
4949 unsigned int irqn;
50− void (*comp) (struct mlx5_core_cq *);
50+ void (*comp)(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe);
5151 void (*event) (struct mlx5_core_cq *, enum mlx5_event);
5252 u32 cons_index;
5353 unsigned arm_sn;
@@ -55,7 +55,7 @@ struct mlx5_core_cq { · 1 unmodified line
5555 int pid;
5656 struct {
5757 struct list_head list;
58− void (*comp)(struct mlx5_core_cq *);
58+ void (*comp)(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe);
5959 void *priv;
6060 } tasklet_ctx;
6161 int reset_notify_added;
@@ -185,7 +185,7 @@ static inline void mlx5_cq_put(struct mlx5_core_cq *cq) · 123 unmodified lines
185185 }
186186
187187 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
188− u32 *in, int inlen);
188+ u32 *in, int inlen, u32 *out, int outlen);
189189 int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
190190 int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
191191 u32 *out, int outlen);
include/linux/mlx5/device.h+29−3
@@ -342,7 +342,7 @@ enum mlx5_event { · 341 unmodified lines
342342 MLX5_EVENT_TYPE_PAGE_FAULT = 0xc,
343343 MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd,
344344
345− MLX5_EVENT_TYPE_HOST_PARAMS_CHANGE = 0xe,
345+ MLX5_EVENT_TYPE_ESW_FUNCTIONS_CHANGED = 0xe,
346346
347347 MLX5_EVENT_TYPE_DCT_DRAINED = 0x1c,
348348
@@ -351,7 +351,7 @@ enum mlx5_event { · 2 unmodified lines
351351
352352 MLX5_EVENT_TYPE_DEVICE_TRACER = 0x26,
353353
354− MLX5_EVENT_TYPE_MAX = MLX5_EVENT_TYPE_DEVICE_TRACER + 1,
354+ MLX5_EVENT_TYPE_MAX = 0x100,
355355 };
356356
357357 enum {
@@ -437,6 +437,7 @@ enum { · 79 unmodified lines
437437 MLX5_OPCODE_SET_PSV = 0x20,
438438 MLX5_OPCODE_GET_PSV = 0x21,
439439 MLX5_OPCODE_CHECK_PSV = 0x22,
440+ MLX5_OPCODE_DUMP = 0x23,
440441 MLX5_OPCODE_RGET_PSV = 0x26,
441442 MLX5_OPCODE_RCHECK_PSV = 0x27,
442443
@@ -444,6 +445,14 @@ enum { · 1 unmodified line
444445
445446 };
446447
448+enum {
449+ MLX5_OPC_MOD_TLS_TIS_STATIC_PARAMS = 0x20,
450+};
451+
452+enum {
453+ MLX5_OPC_MOD_TLS_TIS_PROGRESS_PARAMS = 0x20,
454+};
455+
447456 enum {
448457 MLX5_SET_PORT_RESET_QKEY = 0,
449458 MLX5_SET_PORT_GUID0 = 16,
@@ -510,6 +519,10 @@ struct mlx5_cmd_layout { · 60 unmodified lines
510519 u8 status_own;
511520 };
512521
522+enum mlx5_fatal_assert_bit_offsets {
523+ MLX5_RFR_OFFSET = 31,
524+};
525+
513526 struct health_buffer {
514527 __be32 assert_var[5];
515528 __be32 rsvd0[3];
@@ -518,12 +531,16 @@ struct health_buffer { · 2 unmodified lines
518531 __be32 rsvd1[2];
519532 __be32 fw_ver;
520533 __be32 hw_id;
521− __be32 rsvd2;
534+ __be32 rfr;
522535 u8 irisc_index;
523536 u8 synd;
524537 __be16 ext_synd;
525538 };
526539
540+enum mlx5_initializing_bit_offsets {
541+ MLX5_FW_RESET_SUPPORTED_OFFSET = 30,
542+};
543+
527544 enum mlx5_cmd_addr_l_sz_offset {
528545 MLX5_NIC_IFC_OFFSET = 8,
529546 };
@@ -1077,6 +1094,9 @@ enum mlx5_cap_type { · 547 unmodified lines
10771094 MLX5_CAP_DEBUG,
10781095 MLX5_CAP_RESERVED_14,
10791096 MLX5_CAP_DEV_MEM,
1097+ MLX5_CAP_RESERVED_16,
1098+ MLX5_CAP_TLS,
1099+ MLX5_CAP_DEV_EVENT = 0x14,
10801100 /* NUM OF CAP Types */
10811101 MLX5_CAP_NUM
10821102 };
@@ -1255,6 +1275,12 @@ enum mlx5_qcam_feature_groups { · 172 unmodified lines
12551275 #define MLX5_CAP64_DEV_MEM(mdev, cap)\
12561276 MLX5_GET64(device_mem_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_MEM], cap)
12571277
1278+#define MLX5_CAP_TLS(mdev, cap) \
1279+ MLX5_GET(tls_cap, (mdev)->caps.hca_cur[MLX5_CAP_TLS], cap)
1280+
1281+#define MLX5_CAP_DEV_EVENT(mdev, cap)\
1282+ MLX5_ADDR_OF(device_event_cap, (mdev)->caps.hca_cur[MLX5_CAP_DEV_EVENT], cap)
1283+
12581284 enum {
12591285 MLX5_CMD_STAT_OK = 0x0,
12601286 MLX5_CMD_STAT_INT_ERR = 0x1,
include/linux/mlx5/driver.h+35−26
@@ -41,7 +41,7 @@ · 40 unmodified lines
4141 #include <linux/semaphore.h>
4242 #include <linux/slab.h>
4343 #include <linux/vmalloc.h>
44−#include <linux/radix-tree.h>
44+#include <linux/xarray.h>
4545 #include <linux/workqueue.h>
4646 #include <linux/mempool.h>
4747 #include <linux/interrupt.h>
@@ -53,6 +53,7 @@ · 5 unmodified lines
5353 #include <linux/mlx5/eq.h>
5454 #include <linux/timecounter.h>
5555 #include <linux/ptp_clock_kernel.h>
56+#include <net/devlink.h>
5657
5758 enum {
5859 MLX5_BOARD_ID_LEN = 64,
@@ -107,6 +108,7 @@ enum { · 48 unmodified lines
107108 MLX5_REG_FPGA_CAP = 0x4022,
108109 MLX5_REG_FPGA_CTRL = 0x4023,
109110 MLX5_REG_FPGA_ACCESS_REG = 0x4024,
111+ MLX5_REG_CORE_DUMP = 0x402e,
110112 MLX5_REG_PCAP = 0x5001,
111113 MLX5_REG_PMTU = 0x5003,
112114 MLX5_REG_PTYS = 0x5004,
@@ -137,6 +139,7 @@ enum { · 24 unmodified lines
137139 MLX5_REG_MTPPS = 0x9053,
138140 MLX5_REG_MTPPSE = 0x9054,
139141 MLX5_REG_MPEGC = 0x9056,
142+ MLX5_REG_MCQS = 0x9060,
140143 MLX5_REG_MCQI = 0x9061,
141144 MLX5_REG_MCC = 0x9062,
142145 MLX5_REG_MCDA = 0x9063,
@@ -180,6 +183,11 @@ enum port_state_policy { · 37 unmodified lines
180183 MLX5_POLICY_INVALID = 0xffffffff
181184 };
182185
186+enum mlx5_coredev_type {
187+ MLX5_COREDEV_PF,
188+ MLX5_COREDEV_VF
189+};
190+
183191 struct mlx5_field_desc {
184192 struct dentry *dent;
185193 int i;
@@ -433,13 +441,18 @@ struct mlx5_core_health { · 247 unmodified lines
433441 struct timer_list timer;
434442 u32 prev;
435443 int miss_counter;
436− bool sick;
444+ u8 synd;
445+ u32 fatal_error;
446+ u32 crdump_size;
437447 /* wq spinlock to synchronize draining */
438448 spinlock_t wq_lock;
439449 struct workqueue_struct *wq;
440450 unsigned long flags;
441− struct work_struct work;
451+ struct work_struct fatal_report_work;
452+ struct work_struct report_work;
442453 struct delayed_work recover_work;
454+ struct devlink_health_reporter *fw_reporter;
455+ struct devlink_health_reporter *fw_fatal_reporter;
443456 };
444457
445458 struct mlx5_qp_table {
@@ -451,13 +464,6 @@ struct mlx5_qp_table { · 5 unmodified lines
451464 struct radix_tree_root tree;
452465 };
453466
454−struct mlx5_mkey_table {
455− /* protect radix tree
456− */
457− rwlock_t lock;
458− struct radix_tree_root tree;
459−};
460−
461467 struct mlx5_vf_context {
462468 int enabled;
463469 u64 port_guid;
@@ -468,7 +474,7 @@ struct mlx5_vf_context { · 4 unmodified lines
468474 struct mlx5_core_sriov {
469475 struct mlx5_vf_context *vfs_ctx;
470476 int num_vfs;
471− int enabled_vfs;
477+ u16 max_vfs;
472478 };
473479
474480 struct mlx5_fc_stats {
@@ -490,6 +496,7 @@ struct mlx5_eswitch; · 15 unmodified lines
490496 struct mlx5_lag;
491497 struct mlx5_devcom;
492498 struct mlx5_eq_table;
499+struct mlx5_irq_table;
493500
494501 struct mlx5_rate_limit {
495502 u32 rate;
@@ -519,6 +526,8 @@ struct mlx5_core_roce { · 23 unmodified lines
519526 };
520527
521528 struct mlx5_priv {
529+ /* IRQ table valid only for real pci devices PF or VF */
530+ struct mlx5_irq_table *irq_table;
522531 struct mlx5_eq_table *eq_table;
523532
524533 /* pages stuff */
@@ -541,9 +550,7 @@ struct mlx5_priv { · 16 unmodified lines
541550 struct dentry *cmdif_debugfs;
542551 /* end: qp staff */
543552
544− /* start: mkey staff */
545− struct mlx5_mkey_table mkey_table;
546− /* end: mkey staff */
553+ struct xarray mkey_table;
547554
548555 /* start: alloc staff */
549556 /* protect buffer alocation according to numa node */
@@ -570,7 +577,6 @@ struct mlx5_priv { · 20 unmodified lines
570577 struct mlx5_core_sriov sriov;
571578 struct mlx5_lag *lag;
572579 struct mlx5_devcom *devcom;
573− unsigned long pci_dev_data;
574580 struct mlx5_core_roce roce;
575581 struct mlx5_fc_stats fc_stats;
576582 struct mlx5_rl_table rl_table;
@@ -580,6 +586,7 @@ struct mlx5_priv { · 3 unmodified lines
580586 };
581587
582588 enum mlx5_device_state {
589+ MLX5_DEVICE_STATE_UNINITIALIZED,
583590 MLX5_DEVICE_STATE_UP,
584591 MLX5_DEVICE_STATE_INTERNAL_ERROR,
585592 };
@@ -646,9 +653,11 @@ struct mlx5_clock { · 60 unmodified lines
646653
647654 struct mlx5_fw_tracer;
648655 struct mlx5_vxlan;
656+struct mlx5_geneve;
649657
650658 struct mlx5_core_dev {
651659 struct device *device;
660+ enum mlx5_coredev_type coredev_type;
652661 struct pci_dev *pdev;
653662 /* sync pci state */
654663 struct mutex pci_status_mutex;
@@ -680,6 +689,7 @@ struct mlx5_core_dev { · 25 unmodified lines
680689 u32 issi;
681690 struct mlx5e_resources mlx5e_res;
682691 struct mlx5_vxlan *vxlan;
692+ struct mlx5_geneve *geneve;
683693 struct {
684694 struct mlx5_rsvd_gids reserved_gids;
685695 u32 roce_en;
@@ -690,6 +700,7 @@ struct mlx5_core_dev { · 4 unmodified lines
690700 struct mlx5_clock clock;
691701 struct mlx5_ib_clock_info *clock_info;
692702 struct mlx5_fw_tracer *tracer;
703+ u32 vsc_addr;
693704 };
694705
695706 struct mlx5_db {
@@ -901,7 +912,6 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev); · 205 unmodified lines
901912 void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health);
902913 void mlx5_drain_health_wq(struct mlx5_core_dev *dev);
903914 void mlx5_trigger_health_work(struct mlx5_core_dev *dev);
904−void mlx5_drain_health_recovery(struct mlx5_core_dev *dev);
905915 int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size,
906916 struct mlx5_frag_buf *buf, int node);
907917 int mlx5_buf_alloc(struct mlx5_core_dev *dev,
@@ -1042,6 +1052,8 @@ int mlx5_register_interface(struct mlx5_interface *intf); · 134 unmodified lines
10421052 void mlx5_unregister_interface(struct mlx5_interface *intf);
10431053 int mlx5_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb);
10441054 int mlx5_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *nb);
1055+int mlx5_eq_notifier_register(struct mlx5_core_dev *dev, struct mlx5_nb *nb);
1056+int mlx5_eq_notifier_unregister(struct mlx5_core_dev *dev, struct mlx5_nb *nb);
10451057
10461058 int mlx5_core_query_vendor_id(struct mlx5_core_dev *mdev, u32 *vendor_id);
10471059
@@ -1082,9 +1094,9 @@ enum { · 34 unmodified lines
10821094 MLX5_PCI_DEV_IS_VF = 1 << 0,
10831095 };
10841096
1085−static inline int mlx5_core_is_pf(struct mlx5_core_dev *dev)
1097+static inline bool mlx5_core_is_pf(const struct mlx5_core_dev *dev)
10861098 {
1087− return !(dev->priv.pci_dev_data & MLX5_PCI_DEV_IS_VF);
1099+ return dev->coredev_type == MLX5_COREDEV_PF;
10881100 }
10891101
10901102 static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev)
@@ -1092,23 +1104,20 @@ static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev) · 1 unmodified line
10921104 return dev->caps.embedded_cpu;
10931105 }
10941106
1095−static inline bool mlx5_core_is_ecpf_esw_manager(struct mlx5_core_dev *dev)
1107+static inline bool
1108+mlx5_core_is_ecpf_esw_manager(const struct mlx5_core_dev *dev)
10961109 {
10971110 return dev->caps.embedded_cpu && MLX5_CAP_GEN(dev, eswitch_manager);
10981111 }
10991112
1100−static inline bool mlx5_ecpf_vport_exists(struct mlx5_core_dev *dev)
1113+static inline bool mlx5_ecpf_vport_exists(const struct mlx5_core_dev *dev)
11011114 {
11021115 return mlx5_core_is_pf(dev) && MLX5_CAP_ESW(dev, ecpf_vport_exists);
11031116 }
11041117
1105−#define MLX5_HOST_PF_MAX_VFS (127u)
1106−static inline u16 mlx5_core_max_vfs(struct mlx5_core_dev *dev)
1118+static inline u16 mlx5_core_max_vfs(const struct mlx5_core_dev *dev)
11071119 {
1108− if (mlx5_core_is_ecpf_esw_manager(dev))
1109− return MLX5_HOST_PF_MAX_VFS;
1110− else
1111− return pci_sriov_get_totalvfs(dev->pdev);
1120+ return dev->priv.sriov.max_vfs;
11121121 }
11131122
11141123 static inline int mlx5_get_gid_table_len(u16 param)
include/linux/mlx5/eq.h+8−17
@@ -4,17 +4,7 @@ · 3 unmodified lines
44 #ifndef MLX5_CORE_EQ_H
55 #define MLX5_CORE_EQ_H
66
7−enum {
8− MLX5_EQ_PAGEREQ_IDX = 0,
9− MLX5_EQ_CMD_IDX = 1,
10− MLX5_EQ_ASYNC_IDX = 2,
11− /* reserved to be used by mlx5_core ulps (mlx5e/mlx5_ib) */
12− MLX5_EQ_PFAULT_IDX = 3,
13− MLX5_EQ_MAX_ASYNC_EQS,
14− /* completion eqs vector indices start here */
15− MLX5_EQ_VEC_COMP_BASE = MLX5_EQ_MAX_ASYNC_EQS,
16−};
17−
7+#define MLX5_IRQ_VEC_COMP_BASE 1
188 #define MLX5_NUM_CMD_EQE (32)
199 #define MLX5_NUM_ASYNC_EQE (0x1000)
2010 #define MLX5_NUM_SPARE_EQE (0x80)
@@ -23,18 +13,19 @@ struct mlx5_eq; · 2 unmodified lines
2313 struct mlx5_core_dev;
2414
2515 struct mlx5_eq_param {
26− u8 index;
16+ u8 irq_index;
2717 int nent;
28− u64 mask;
29− void *context;
30− irq_handler_t handler;
18+ u64 mask[4];
3119 };
3220
3321 struct mlx5_eq *
34−mlx5_eq_create_generic(struct mlx5_core_dev *dev, const char *name,
35− struct mlx5_eq_param *param);
22+mlx5_eq_create_generic(struct mlx5_core_dev *dev, struct mlx5_eq_param *param);
3623 int
3724 mlx5_eq_destroy_generic(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
25+int mlx5_eq_enable(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
26+ struct notifier_block *nb);
27+void mlx5_eq_disable(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
28+ struct notifier_block *nb);
3829
3930 struct mlx5_eqe *mlx5_eq_get_eqe(struct mlx5_eq *eq, u32 cc);
4031 void mlx5_eq_update_ci(struct mlx5_eq *eq, u32 cc, bool arm);
include/linux/mlx5/eswitch.h+48−12
@@ -7,13 +7,14 @@ · 6 unmodified lines
77 #define _MLX5_ESWITCH_
88
99 #include <linux/mlx5/driver.h>
10+#include <net/devlink.h>
1011
1112 #define MLX5_ESWITCH_MANAGER(mdev) MLX5_CAP_GEN(mdev, eswitch_manager)
1213
1314 enum {
14− SRIOV_NONE,
15− SRIOV_LEGACY,
16− SRIOV_OFFLOADS
15+ MLX5_ESWITCH_NONE,
16+ MLX5_ESWITCH_LEGACY,
17+ MLX5_ESWITCH_OFFLOADS
1718 };
1819
1920 enum {
@@ -29,25 +30,29 @@ enum { · 9 unmodified lines
2930 };
3031
3132 struct mlx5_eswitch_rep;
32−struct mlx5_eswitch_rep_if {
33− int (*load)(struct mlx5_core_dev *dev,
34− struct mlx5_eswitch_rep *rep);
35− void (*unload)(struct mlx5_eswitch_rep *rep);
36− void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep);
37− void *priv;
38− atomic_t state;
33+struct mlx5_eswitch_rep_ops {
34+ int (*load)(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep);
35+ void (*unload)(struct mlx5_eswitch_rep *rep);
36+ void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep);
37+};
38+
39+struct mlx5_eswitch_rep_data {
40+ void *priv;
41+ atomic_t state;
3942 };
4043
4144 struct mlx5_eswitch_rep {
42− struct mlx5_eswitch_rep_if rep_if[NUM_REP_TYPES];
45+ struct mlx5_eswitch_rep_data rep_data[NUM_REP_TYPES];
4346 u16 vport;
4447 u8 hw_id[ETH_ALEN];
4548 u16 vlan;
49+ /* Only IB rep is using vport_index */
50+ u16 vport_index;
4651 u32 vlan_refcount;
4752 };
4853
4954 void mlx5_eswitch_register_vport_reps(struct mlx5_eswitch *esw,
50− struct mlx5_eswitch_rep_if *rep_if,
55+ const struct mlx5_eswitch_rep_ops *ops,
5156 u8 rep_type);
5257 void mlx5_eswitch_unregister_vport_reps(struct mlx5_eswitch *esw, u8 rep_type);
5358 void *mlx5_eswitch_get_proto_dev(struct mlx5_eswitch *esw,
@@ -60,4 +65,35 @@ u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw); · 6 unmodified lines
6065 struct mlx5_flow_handle *
6166 mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw,
6267 u16 vport_num, u32 sqn);
68+
69+u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev);
70+
71+#ifdef CONFIG_MLX5_ESWITCH
72+enum devlink_eswitch_encap_mode
73+mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev);
74+
75+bool mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw);
76+u32 mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw,
77+ u16 vport_num);
78+#else /* CONFIG_MLX5_ESWITCH */
79+static inline enum devlink_eswitch_encap_mode
80+mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev)
81+{
82+ return DEVLINK_ESWITCH_ENCAP_MODE_NONE;
83+}
84+
85+static inline bool
86+mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw)
87+{
88+ return false;
89+};
90+
91+static inline u32
92+mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw,
93+ int vport_num)
94+{
95+ return 0;
96+};
97+#endif /* CONFIG_MLX5_ESWITCH */
98+
6399 #endif
include/linux/mlx5/fs.h+15−5
@@ -47,6 +47,7 @@ enum { · 46 unmodified lines
4747 enum {
4848 MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT = BIT(0),
4949 MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1),
50+ MLX5_FLOW_TABLE_TERMINATION = BIT(2),
5051 };
5152
5253 #define LEFTOVERS_RULE_NUM 2
@@ -87,10 +88,21 @@ struct mlx5_flow_group; · 34 unmodified lines
8788 struct mlx5_flow_namespace;
8889 struct mlx5_flow_handle;
8990
91+enum {
92+ FLOW_CONTEXT_HAS_TAG = BIT(0),
93+};
94+
95+struct mlx5_flow_context {
96+ u32 flags;
97+ u32 flow_tag;
98+ u32 flow_source;
99+};
100+
90101 struct mlx5_flow_spec {
91102 u8 match_criteria_enable;
92103 u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)];
93104 u32 match_value[MLX5_ST_SZ_DW(fte_match_param)];
105+ struct mlx5_flow_context flow_context;
94106 };
95107
96108 enum {
@@ -172,13 +184,11 @@ struct mlx5_fs_vlan { · 75 unmodified lines
172184 #define MLX5_FS_VLAN_DEPTH 2
173185
174186 enum {
175− FLOW_ACT_HAS_TAG = BIT(0),
176− FLOW_ACT_NO_APPEND = BIT(1),
187+ FLOW_ACT_NO_APPEND = BIT(0),
177188 };
178189
179190 struct mlx5_flow_act {
180191 u32 action;
181− u32 flow_tag;
182192 u32 reformat_id;
183193 u32 modify_id;
184194 uintptr_t esp_id;
@@ -189,7 +199,6 @@ struct mlx5_flow_act { · 4 unmodified lines
189199
190200 #define MLX5_DECLARE_FLOW_ACT(name) \
191201 struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\
192− .flow_tag = MLX5_FS_DEFAULT_FLOW_TAG, \
193202 .reformat_id = 0, \
194203 .modify_id = 0, \
195204 .flags = 0, }
@@ -199,7 +208,7 @@ struct mlx5_flow_act { · 3 unmodified lines
199208 */
200209 struct mlx5_flow_handle *
201210 mlx5_add_flow_rules(struct mlx5_flow_table *ft,
202− struct mlx5_flow_spec *spec,
211+ const struct mlx5_flow_spec *spec,
203212 struct mlx5_flow_act *flow_act,
204213 struct mlx5_flow_destination *dest,
205214 int num_dest);
@@ -211,6 +220,7 @@ int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler, · 5 unmodified lines
211220
212221 struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
213222 void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
223+u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter);
214224 void mlx5_fc_query_cached(struct mlx5_fc *counter,
215225 u64 *bytes, u64 *packets, u64 *lastuse);
216226 int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
include/linux/mlx5/mlx5_ifc.h+373−32
@@ -91,6 +91,20 @@ enum { · 90 unmodified lines
9191
9292 enum {
9393 MLX5_OBJ_TYPE_GENEVE_TLV_OPT = 0x000b,
94+ MLX5_OBJ_TYPE_MKEY = 0xff01,
95+ MLX5_OBJ_TYPE_QP = 0xff02,
96+ MLX5_OBJ_TYPE_PSV = 0xff03,
97+ MLX5_OBJ_TYPE_RMP = 0xff04,
98+ MLX5_OBJ_TYPE_XRC_SRQ = 0xff05,
99+ MLX5_OBJ_TYPE_RQ = 0xff06,
100+ MLX5_OBJ_TYPE_SQ = 0xff07,
101+ MLX5_OBJ_TYPE_TIR = 0xff08,
102+ MLX5_OBJ_TYPE_TIS = 0xff09,
103+ MLX5_OBJ_TYPE_DCT = 0xff0a,
104+ MLX5_OBJ_TYPE_XRQ = 0xff0b,
105+ MLX5_OBJ_TYPE_RQT = 0xff0e,
106+ MLX5_OBJ_TYPE_FLOW_COUNTER = 0xff0f,
107+ MLX5_OBJ_TYPE_CQ = 0xff10,
94108 };
95109
96110 enum {
@@ -106,6 +120,9 @@ enum { · 9 unmodified lines
106120 MLX5_CMD_OP_QUERY_ISSI = 0x10a,
107121 MLX5_CMD_OP_SET_ISSI = 0x10b,
108122 MLX5_CMD_OP_SET_DRIVER_VERSION = 0x10d,
123+ MLX5_CMD_OP_QUERY_SF_PARTITION = 0x111,
124+ MLX5_CMD_OP_ALLOC_SF = 0x113,
125+ MLX5_CMD_OP_DEALLOC_SF = 0x114,
109126 MLX5_CMD_OP_CREATE_MKEY = 0x200,
110127 MLX5_CMD_OP_QUERY_MKEY = 0x201,
111128 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
@@ -155,7 +172,7 @@ enum { · 43 unmodified lines
155172 MLX5_CMD_OP_QUERY_XRQ_DC_PARAMS_ENTRY = 0x725,
156173 MLX5_CMD_OP_SET_XRQ_DC_PARAMS_ENTRY = 0x726,
157174 MLX5_CMD_OP_QUERY_XRQ_ERROR_PARAMS = 0x727,
158− MLX5_CMD_OP_QUERY_HOST_PARAMS = 0x740,
175+ MLX5_CMD_OP_QUERY_ESW_FUNCTIONS = 0x740,
159176 MLX5_CMD_OP_QUERY_VPORT_STATE = 0x750,
160177 MLX5_CMD_OP_MODIFY_VPORT_STATE = 0x751,
161178 MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT = 0x752,
@@ -382,7 +399,8 @@ struct mlx5_ifc_flow_table_prop_layout_bits { · 220 unmodified lines
382399 u8 reformat_and_modify_action[0x1];
383400 u8 reserved_at_15[0x2];
384401 u8 table_miss_action_domain[0x1];
385− u8 reserved_at_18[0x8];
402+ u8 termination_table[0x1];
403+ u8 reserved_at_19[0x7];
386404 u8 reserved_at_20[0x2];
387405 u8 log_max_ft_size[0x6];
388406 u8 log_max_modify_header_context[0x8];
@@ -527,7 +545,21 @@ struct mlx5_ifc_fte_match_set_misc2_bits { · 138 unmodified lines
527545
528546 struct mlx5_ifc_fte_match_mpls_bits outer_first_mpls_over_udp;
529547
530− u8 reserved_at_80[0x100];
548+ u8 metadata_reg_c_7[0x20];
549+
550+ u8 metadata_reg_c_6[0x20];
551+
552+ u8 metadata_reg_c_5[0x20];
553+
554+ u8 metadata_reg_c_4[0x20];
555+
556+ u8 metadata_reg_c_3[0x20];
557+
558+ u8 metadata_reg_c_2[0x20];
559+
560+ u8 metadata_reg_c_1[0x20];
561+
562+ u8 metadata_reg_c_0[0x20];
531563
532564 u8 metadata_reg_a[0x20];
533565
@@ -635,8 +667,22 @@ struct mlx5_ifc_flow_table_nic_cap_bits { · 101 unmodified lines
635667 u8 reserved_at_e00[0x7200];
636668 };
637669
670+enum {
671+ MLX5_FDB_TO_VPORT_REG_C_0 = 0x01,
672+ MLX5_FDB_TO_VPORT_REG_C_1 = 0x02,
673+ MLX5_FDB_TO_VPORT_REG_C_2 = 0x04,
674+ MLX5_FDB_TO_VPORT_REG_C_3 = 0x08,
675+ MLX5_FDB_TO_VPORT_REG_C_4 = 0x10,
676+ MLX5_FDB_TO_VPORT_REG_C_5 = 0x20,
677+ MLX5_FDB_TO_VPORT_REG_C_6 = 0x40,
678+ MLX5_FDB_TO_VPORT_REG_C_7 = 0x80,
679+};
680+
638681 struct mlx5_ifc_flow_table_eswitch_cap_bits {
639− u8 reserved_at_0[0x1a];
682+ u8 fdb_to_vport_reg_c_id[0x8];
683+ u8 reserved_at_8[0xf];
684+ u8 flow_source[0x1];
685+ u8 reserved_at_18[0x2];
640686 u8 multi_fdb_encap[0x1];
641687 u8 reserved_at_1b[0x1];
642688 u8 fdb_multi_path_to_table[0x1];
@@ -664,7 +710,11 @@ struct mlx5_ifc_e_switch_cap_bits { · 21 unmodified lines
664710 u8 vport_svlan_insert[0x1];
665711 u8 vport_cvlan_insert_if_not_exist[0x1];
666712 u8 vport_cvlan_insert_overwrite[0x1];
667− u8 reserved_at_5[0x16];
713+ u8 reserved_at_5[0x3];
714+ u8 esw_uplink_ingress_acl[0x1];
715+ u8 reserved_at_9[0x10];
716+ u8 esw_functions_changed[0x1];
717+ u8 reserved_at_1a[0x1];
668718 u8 ecpf_vport_exists[0x1];
669719 u8 counter_eswitch_affinity[0x1];
670720 u8 merged_eswitch[0x1];
@@ -680,7 +730,11 @@ struct mlx5_ifc_e_switch_cap_bits { · 9 unmodified lines
680730 u8 reserved_2b[0x6];
681731 u8 max_encap_header_size[0xa];
682732
683− u8 reserved_40[0x7c0];
733+ u8 reserved_at_40[0xb];
734+ u8 log_max_esw_sf[0x5];
735+ u8 esw_sf_base_id[0x10];
736+
737+ u8 reserved_at_60[0x7a0];
684738
685739 };
686740
@@ -715,7 +769,9 @@ struct mlx5_ifc_qos_cap_bits { · 28 unmodified lines
715769 };
716770
717771 struct mlx5_ifc_debug_cap_bits {
718− u8 reserved_at_0[0x20];
772+ u8 core_dump_general[0x1];
773+ u8 core_dump_qp[0x1];
774+ u8 reserved_at_2[0x1e];
719775
720776 u8 reserved_at_20[0x2];
721777 u8 stall_detect[0x1];
@@ -749,7 +805,8 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits { · 27 unmodified lines
749805 u8 swp[0x1];
750806 u8 swp_csum[0x1];
751807 u8 swp_lso[0x1];
752− u8 reserved_at_23[0xd];
808+ u8 cqe_checksum_full[0x1];
809+ u8 reserved_at_24[0xc];
753810 u8 max_vxlan_udp_ports[0x8];
754811 u8 reserved_at_38[0x6];
755812 u8 max_geneve_opt_len[0x1];
@@ -818,6 +875,12 @@ struct mlx5_ifc_device_mem_cap_bits { · 62 unmodified lines
818875 u8 reserved_at_180[0x680];
819876 };
820877
878+struct mlx5_ifc_device_event_cap_bits {
879+ u8 user_affiliated_events[4][0x40];
880+
881+ u8 user_unaffiliated_events[4][0x40];
882+};
883+
821884 enum {
822885 MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_1_BYTE = 0x0,
823886 MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_2_BYTES = 0x2,
@@ -911,6 +974,16 @@ struct mlx5_ifc_vector_calc_cap_bits { · 87 unmodified lines
911974 u8 reserved_at_c0[0x720];
912975 };
913976
977+struct mlx5_ifc_tls_cap_bits {
978+ u8 tls_1_2_aes_gcm_128[0x1];
979+ u8 tls_1_3_aes_gcm_128[0x1];
980+ u8 tls_1_2_aes_gcm_256[0x1];
981+ u8 tls_1_3_aes_gcm_256[0x1];
982+ u8 reserved_at_4[0x1c];
983+
984+ u8 reserved_at_20[0x7e0];
985+};
986+
914987 enum {
915988 MLX5_WQ_TYPE_LINKED_LIST = 0x0,
916989 MLX5_WQ_TYPE_CYCLIC = 0x1,
@@ -975,7 +1048,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 58 unmodified lines
9751048
9761049 u8 log_max_srq_sz[0x8];
9771050 u8 log_max_qp_sz[0x8];
978− u8 reserved_at_90[0x8];
1051+ u8 event_cap[0x1];
1052+ u8 reserved_at_91[0x7];
9791053 u8 prio_tag_required[0x1];
9801054 u8 reserved_at_99[0x2];
9811055 u8 log_max_qp[0x5];
@@ -1023,7 +1097,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 41 unmodified lines
10231097 u8 cc_modify_allowed[0x1];
10241098 u8 start_pad[0x1];
10251099 u8 cache_line_128byte[0x1];
1026− u8 reserved_at_165[0xa];
1100+ u8 reserved_at_165[0x4];
1101+ u8 rts2rts_qp_counters_set_id[0x1];
1102+ u8 reserved_at_16a[0x5];
10271103 u8 qcam_reg[0x1];
10281104 u8 gid_table_size[0x10];
10291105
@@ -1240,7 +1316,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 210 unmodified lines
12401316
12411317 u8 reserved_at_440[0x20];
12421318
1243− u8 reserved_at_460[0x3];
1319+ u8 tls[0x1];
1320+ u8 reserved_at_461[0x2];
12441321 u8 log_max_uctx[0x5];
12451322 u8 reserved_at_468[0x3];
12461323 u8 log_max_umem[0x5];
@@ -1265,7 +1342,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 18 unmodified lines
12651342 u8 max_geneve_tlv_option_data_len[0x5];
12661343 u8 reserved_at_570[0x10];
12671344
1268− u8 reserved_at_580[0x3c];
1345+ u8 reserved_at_580[0x33];
1346+ u8 log_max_dek[0x5];
1347+ u8 reserved_at_5b8[0x4];
12691348 u8 mini_cqe_resp_stride_index[0x1];
12701349 u8 cqe_128_always[0x1];
12711350 u8 cqe_compression_128[0x1];
@@ -1295,13 +1374,26 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 23 unmodified lines
12951374 u8 reserved_at_640[0x10];
12961375 u8 num_q_monitor_counters[0x10];
12971376
1298− u8 reserved_at_660[0x40];
1377+ u8 reserved_at_660[0x20];
1378+
1379+ u8 sf[0x1];
1380+ u8 sf_set_partition[0x1];
1381+ u8 reserved_at_682[0x1];
1382+ u8 log_max_sf[0x5];
1383+ u8 reserved_at_688[0x8];
1384+ u8 log_min_sf_size[0x8];
1385+ u8 max_num_sf_partitions[0x8];
12991386
13001387 u8 uctx_cap[0x20];
13011388
13021389 u8 reserved_at_6c0[0x4];
13031390 u8 flex_parser_id_geneve_tlv_option_0[0x4];
1304− u8 reserved_at_6c8[0x138];
1391+ u8 reserved_at_6c8[0x28];
1392+ u8 sf_base_id[0x10];
1393+
1394+ u8 reserved_at_700[0x80];
1395+ u8 vhca_tunnel_commands[0x40];
1396+ u8 reserved_at_7c0[0x40];
13051397 };
13061398
13071399 enum mlx5_flow_destination_type {
@@ -2531,7 +2623,9 @@ union mlx5_ifc_hca_cap_union_bits { · 1223 unmodified lines
25312623 struct mlx5_ifc_e_switch_cap_bits e_switch_cap;
25322624 struct mlx5_ifc_vector_calc_cap_bits vector_calc_cap;
25332625 struct mlx5_ifc_qos_cap_bits qos_cap;
2626+ struct mlx5_ifc_debug_cap_bits debug_cap;
25342627 struct mlx5_ifc_fpga_cap_bits fpga_cap;
2628+ struct mlx5_ifc_tls_cap_bits tls_cap;
25352629 u8 reserved_at_0[0x8000];
25362630 };
25372631
@@ -2549,6 +2643,12 @@ enum { · 11 unmodified lines
25492643 MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 = 0x800,
25502644 };
25512645
2646+enum {
2647+ MLX5_FLOW_CONTEXT_FLOW_SOURCE_ANY_VPORT = 0x0,
2648+ MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK = 0x1,
2649+ MLX5_FLOW_CONTEXT_FLOW_SOURCE_LOCAL_VPORT = 0x2,
2650+};
2651+
25522652 struct mlx5_ifc_vlan_bits {
25532653 u8 ethtype[0x10];
25542654 u8 prio[0x3];
@@ -2568,7 +2668,9 @@ struct mlx5_ifc_flow_context_bits { · 13 unmodified lines
25682668 u8 action[0x10];
25692669
25702670 u8 extended_destination[0x1];
2571− u8 reserved_at_80[0x7];
2671+ u8 reserved_at_81[0x1];
2672+ u8 flow_source[0x2];
2673+ u8 reserved_at_84[0x4];
25722674 u8 destination_list_size[0x18];
25732675
25742676 u8 reserved_at_a0[0x8];
@@ -2663,7 +2765,8 @@ struct mlx5_ifc_traffic_counter_bits { · 88 unmodified lines
26632765
26642766 struct mlx5_ifc_tisc_bits {
26652767 u8 strict_lag_tx_port_affinity[0x1];
2666− u8 reserved_at_1[0x3];
2768+ u8 tls_en[0x1];
2769+ u8 reserved_at_1[0x2];
26672770 u8 lag_tx_port_affinity[0x04];
26682771
26692772 u8 reserved_at_8[0x4];
@@ -2677,7 +2780,11 @@ struct mlx5_ifc_tisc_bits { · 7 unmodified lines
26772780
26782781 u8 reserved_at_140[0x8];
26792782 u8 underlay_qpn[0x18];
2680− u8 reserved_at_160[0x3a0];
2783+
2784+ u8 reserved_at_160[0x8];
2785+ u8 pd[0x18];
2786+
2787+ u8 reserved_at_180[0x380];
26812788 };
26822789
26832790 enum {
@@ -3093,12 +3200,14 @@ struct mlx5_ifc_hca_vport_context_bits { · 409 unmodified lines
30933200 };
30943201
30953202 struct mlx5_ifc_esw_vport_context_bits {
3096− u8 reserved_at_0[0x3];
3203+ u8 fdb_to_vport_reg_c[0x1];
3204+ u8 reserved_at_1[0x2];
30973205 u8 vport_svlan_strip[0x1];
30983206 u8 vport_cvlan_strip[0x1];
30993207 u8 vport_svlan_insert[0x1];
31003208 u8 vport_cvlan_insert[0x2];
3101− u8 reserved_at_8[0x18];
3209+ u8 fdb_to_vport_reg_c_id[0x8];
3210+ u8 reserved_at_10[0x10];
31023211
31033212 u8 reserved_at_20[0x20];
31043213
@@ -4979,7 +5088,8 @@ struct mlx5_ifc_modify_esw_vport_context_out_bits { · 1874 unmodified lines
49795088 };
49805089
49815090 struct mlx5_ifc_esw_vport_context_fields_select_bits {
4982− u8 reserved_at_0[0x1c];
5091+ u8 reserved_at_0[0x1b];
5092+ u8 fdb_to_vport_reg_c_id[0x1];
49835093 u8 vport_cvlan_insert[0x1];
49845094 u8 vport_svlan_insert[0x1];
49855095 u8 vport_cvlan_strip[0x1];
@@ -5176,6 +5286,7 @@ enum { · 190 unmodified lines
51765286 MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16,
51775287 MLX5_ACTION_IN_FIELD_OUT_FIRST_VID = 0x17,
51785288 MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47,
5289+ MLX5_ACTION_IN_FIELD_METADATA_REG_C_0 = 0x51,
51795290 };
51805291
51815292 struct mlx5_ifc_alloc_modify_header_context_out_bits {
@@ -5864,10 +5975,12 @@ struct mlx5_ifc_modify_cq_in_bits { · 682 unmodified lines
58645975
58655976 struct mlx5_ifc_cqc_bits cq_context;
58665977
5867− u8 reserved_at_280[0x40];
5978+ u8 reserved_at_280[0x60];
58685979
58695980 u8 cq_umem_valid[0x1];
5870− u8 reserved_at_2c1[0x5bf];
5981+ u8 reserved_at_2e1[0x1f];
5982+
5983+ u8 reserved_at_300[0x580];
58715984
58725985 u8 pas[0][0x40];
58735986 };
@@ -7236,7 +7349,8 @@ struct mlx5_ifc_create_flow_table_out_bits { · 1362 unmodified lines
72367349 struct mlx5_ifc_flow_table_context_bits {
72377350 u8 reformat_en[0x1];
72387351 u8 decap_en[0x1];
7239− u8 reserved_at_2[0x2];
7352+ u8 reserved_at_2[0x1];
7353+ u8 termination_table[0x1];
72407354 u8 table_miss_action[0x4];
72417355 u8 level[0x8];
72427356 u8 reserved_at_10[0x8];
@@ -7355,9 +7469,9 @@ struct mlx5_ifc_create_eq_in_bits { · 112 unmodified lines
73557469
73567470 u8 reserved_at_280[0x40];
73577471
7358− u8 event_bitmask[0x40];
7472+ u8 event_bitmask[4][0x40];
73597473
7360− u8 reserved_at_300[0x580];
7474+ u8 reserved_at_3c0[0x4c0];
73617475
73627476 u8 pas[0][0x40];
73637477 };
@@ -8475,7 +8589,7 @@ struct mlx5_ifc_mcam_access_reg_bits { · 1111 unmodified lines
84758589 u8 mcda[0x1];
84768590 u8 mcc[0x1];
84778591 u8 mcqi[0x1];
8478− u8 reserved_at_1f[0x1];
8592+ u8 mcqs[0x1];
84798593
84808594 u8 regs_95_to_87[0x9];
84818595 u8 mpegc[0x1];
@@ -8546,6 +8660,18 @@ struct mlx5_ifc_qcam_reg_bits { · 64 unmodified lines
85468660 u8 reserved_at_1c0[0x80];
85478661 };
85488662
8663+struct mlx5_ifc_core_dump_reg_bits {
8664+ u8 reserved_at_0[0x18];
8665+ u8 core_dump_type[0x8];
8666+
8667+ u8 reserved_at_20[0x30];
8668+ u8 vhca_id[0x10];
8669+
8670+ u8 reserved_at_60[0x8];
8671+ u8 qpn[0x18];
8672+ u8 reserved_at_80[0x180];
8673+};
8674+
85498675 struct mlx5_ifc_pcap_reg_bits {
85508676 u8 reserved_at_0[0x8];
85518677 u8 local_port[0x8];
@@ -8955,6 +9081,24 @@ struct mlx5_ifc_mtppse_reg_bits { · 403 unmodified lines
89559081 u8 reserved_at_40[0x40];
89569082 };
89579083
9084+struct mlx5_ifc_mcqs_reg_bits {
9085+ u8 last_index_flag[0x1];
9086+ u8 reserved_at_1[0x7];
9087+ u8 fw_device[0x8];
9088+ u8 component_index[0x10];
9089+
9090+ u8 reserved_at_20[0x10];
9091+ u8 identifier[0x10];
9092+
9093+ u8 reserved_at_40[0x17];
9094+ u8 component_status[0x5];
9095+ u8 component_update_state[0x4];
9096+
9097+ u8 last_update_state_changer_type[0x4];
9098+ u8 last_update_state_changer_host_id[0x4];
9099+ u8 reserved_at_68[0x18];
9100+};
9101+
89589102 struct mlx5_ifc_mcqi_cap_bits {
89599103 u8 supported_info_bitmask[0x20];
89609104
@@ -8975,6 +9119,43 @@ struct mlx5_ifc_mcqi_cap_bits { · 14 unmodified lines
89759119 u8 reserved_at_86[0x1a];
89769120 };
89779121
9122+struct mlx5_ifc_mcqi_version_bits {
9123+ u8 reserved_at_0[0x2];
9124+ u8 build_time_valid[0x1];
9125+ u8 user_defined_time_valid[0x1];
9126+ u8 reserved_at_4[0x14];
9127+ u8 version_string_length[0x8];
9128+
9129+ u8 version[0x20];
9130+
9131+ u8 build_time[0x40];
9132+
9133+ u8 user_defined_time[0x40];
9134+
9135+ u8 build_tool_version[0x20];
9136+
9137+ u8 reserved_at_e0[0x20];
9138+
9139+ u8 version_string[92][0x8];
9140+};
9141+
9142+struct mlx5_ifc_mcqi_activation_method_bits {
9143+ u8 pending_server_ac_power_cycle[0x1];
9144+ u8 pending_server_dc_power_cycle[0x1];
9145+ u8 pending_server_reboot[0x1];
9146+ u8 pending_fw_reset[0x1];
9147+ u8 auto_activate[0x1];
9148+ u8 all_hosts_sync[0x1];
9149+ u8 device_hw_reset[0x1];
9150+ u8 reserved_at_7[0x19];
9151+};
9152+
9153+union mlx5_ifc_mcqi_reg_data_bits {
9154+ struct mlx5_ifc_mcqi_cap_bits mcqi_caps;
9155+ struct mlx5_ifc_mcqi_version_bits mcqi_version;
9156+ struct mlx5_ifc_mcqi_activation_method_bits mcqi_activation_mathod;
9157+};
9158+
89789159 struct mlx5_ifc_mcqi_reg_bits {
89799160 u8 read_pending_component[0x1];
89809161 u8 reserved_at_1[0xf];
@@ -8992,7 +9173,7 @@ struct mlx5_ifc_mcqi_reg_bits { · 11 unmodified lines
89929173 u8 reserved_at_a0[0x10];
89939174 u8 data_size[0x10];
89949175
8995− u8 data[0][0x20];
9176+ union mlx5_ifc_mcqi_reg_data_bits data[0];
89969177 };
89979178
89989179 struct mlx5_ifc_mcc_reg_bits {
@@ -9518,7 +9699,7 @@ struct mlx5_ifc_general_obj_in_cmd_hdr_bits { · 519 unmodified lines
95189699 u8 opcode[0x10];
95199700 u8 uid[0x10];
95209701
9521− u8 reserved_at_20[0x10];
9702+ u8 vhca_tunnel_id[0x10];
95229703 u8 obj_type[0x10];
95239704
95249705 u8 obj_id[0x20];
@@ -9689,10 +9870,11 @@ struct mlx5_ifc_mtrc_ctrl_bits { · 164 unmodified lines
96899870
96909871 struct mlx5_ifc_host_params_context_bits {
96919872 u8 host_number[0x8];
9692− u8 reserved_at_8[0x8];
9873+ u8 reserved_at_8[0x7];
9874+ u8 host_pf_disabled[0x1];
96939875 u8 host_num_of_vfs[0x10];
96949876
9695− u8 reserved_at_20[0x10];
9877+ u8 host_total_vfs[0x10];
96969878 u8 host_pci_bus[0x10];
96979879
96989880 u8 reserved_at_40[0x10];
@@ -9704,7 +9886,7 @@ struct mlx5_ifc_host_params_context_bits { · 5 unmodified lines
97049886 u8 reserved_at_80[0x180];
97059887 };
97069888
9707−struct mlx5_ifc_query_host_params_in_bits {
9889+struct mlx5_ifc_query_esw_functions_in_bits {
97089890 u8 opcode[0x10];
97099891 u8 reserved_at_10[0x10];
97109892
@@ -9714,7 +9896,7 @@ struct mlx5_ifc_query_host_params_in_bits { · 3 unmodified lines
97149896 u8 reserved_at_40[0x40];
97159897 };
97169898
9717−struct mlx5_ifc_query_host_params_out_bits {
9899+struct mlx5_ifc_query_esw_functions_out_bits {
97189900 u8 status[0x8];
97199901 u8 reserved_at_8[0x18];
97209902
@@ -9725,6 +9907,165 @@ struct mlx5_ifc_query_host_params_out_bits { · 4 unmodified lines
97259907 struct mlx5_ifc_host_params_context_bits host_params_context;
97269908
97279909 u8 reserved_at_280[0x180];
9910+ u8 host_sf_enable[0][0x40];
9911+};
9912+
9913+struct mlx5_ifc_sf_partition_bits {
9914+ u8 reserved_at_0[0x10];
9915+ u8 log_num_sf[0x8];
9916+ u8 log_sf_bar_size[0x8];
9917+};
9918+
9919+struct mlx5_ifc_query_sf_partitions_out_bits {
9920+ u8 status[0x8];
9921+ u8 reserved_at_8[0x18];
9922+
9923+ u8 syndrome[0x20];
9924+
9925+ u8 reserved_at_40[0x18];
9926+ u8 num_sf_partitions[0x8];
9927+
9928+ u8 reserved_at_60[0x20];
9929+
9930+ struct mlx5_ifc_sf_partition_bits sf_partition[0];
9931+};
9932+
9933+struct mlx5_ifc_query_sf_partitions_in_bits {
9934+ u8 opcode[0x10];
9935+ u8 reserved_at_10[0x10];
9936+
9937+ u8 reserved_at_20[0x10];
9938+ u8 op_mod[0x10];
9939+
9940+ u8 reserved_at_40[0x40];
9941+};
9942+
9943+struct mlx5_ifc_dealloc_sf_out_bits {
9944+ u8 status[0x8];
9945+ u8 reserved_at_8[0x18];
9946+
9947+ u8 syndrome[0x20];
9948+
9949+ u8 reserved_at_40[0x40];
9950+};
9951+
9952+struct mlx5_ifc_dealloc_sf_in_bits {
9953+ u8 opcode[0x10];
9954+ u8 reserved_at_10[0x10];
9955+
9956+ u8 reserved_at_20[0x10];
9957+ u8 op_mod[0x10];
9958+
9959+ u8 reserved_at_40[0x10];
9960+ u8 function_id[0x10];
9961+
9962+ u8 reserved_at_60[0x20];
9963+};
9964+
9965+struct mlx5_ifc_alloc_sf_out_bits {
9966+ u8 status[0x8];
9967+ u8 reserved_at_8[0x18];
9968+
9969+ u8 syndrome[0x20];
9970+
9971+ u8 reserved_at_40[0x40];
9972+};
9973+
9974+struct mlx5_ifc_alloc_sf_in_bits {
9975+ u8 opcode[0x10];
9976+ u8 reserved_at_10[0x10];
9977+
9978+ u8 reserved_at_20[0x10];
9979+ u8 op_mod[0x10];
9980+
9981+ u8 reserved_at_40[0x10];
9982+ u8 function_id[0x10];
9983+
9984+ u8 reserved_at_60[0x20];
9985+};
9986+
9987+struct mlx5_ifc_affiliated_event_header_bits {
9988+ u8 reserved_at_0[0x10];
9989+ u8 obj_type[0x10];
9990+
9991+ u8 obj_id[0x20];
9992+};
9993+
9994+enum {
9995+ MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = BIT(0xc),
9996+};
9997+
9998+enum {
9999+ MLX5_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = 0xc,
10000+};
10001+
10002+struct mlx5_ifc_encryption_key_obj_bits {
10003+ u8 modify_field_select[0x40];
10004+
10005+ u8 reserved_at_40[0x14];
10006+ u8 key_size[0x4];
10007+ u8 reserved_at_58[0x4];
10008+ u8 key_type[0x4];
10009+
10010+ u8 reserved_at_60[0x8];
10011+ u8 pd[0x18];
10012+
10013+ u8 reserved_at_80[0x180];
10014+ u8 key[8][0x20];
10015+
10016+ u8 reserved_at_300[0x500];
10017+};
10018+
10019+struct mlx5_ifc_create_encryption_key_in_bits {
10020+ struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_in_cmd_hdr;
10021+ struct mlx5_ifc_encryption_key_obj_bits encryption_key_object;
10022+};
10023+
10024+enum {
10025+ MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_128 = 0x0,
10026+ MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_256 = 0x1,
10027+};
10028+
10029+enum {
10030+ MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_DEK = 0x1,
10031+};
10032+
10033+struct mlx5_ifc_tls_static_params_bits {
10034+ u8 const_2[0x2];
10035+ u8 tls_version[0x4];
10036+ u8 const_1[0x2];
10037+ u8 reserved_at_8[0x14];
10038+ u8 encryption_standard[0x4];
10039+
10040+ u8 reserved_at_20[0x20];
10041+
10042+ u8 initial_record_number[0x40];
10043+
10044+ u8 resync_tcp_sn[0x20];
10045+
10046+ u8 gcm_iv[0x20];
10047+
10048+ u8 implicit_iv[0x40];
10049+
10050+ u8 reserved_at_100[0x8];
10051+ u8 dek_index[0x18];
10052+
10053+ u8 reserved_at_120[0xe0];
10054+};
10055+
10056+struct mlx5_ifc_tls_progress_params_bits {
10057+ u8 valid[0x1];
10058+ u8 reserved_at_1[0x7];
10059+ u8 pd[0x18];
10060+
10061+ u8 next_record_tcp_sn[0x20];
10062+
10063+ u8 hw_resync_tcp_sn[0x20];
10064+
10065+ u8 record_tracker_state[0x2];
10066+ u8 auth_state[0x2];
10067+ u8 reserved_at_64[0x4];
10068+ u8 hw_offset_record_number[0x18];
972810069 };
972910070
973010071 #endif /* MLX5_IFC_H */
include/linux/mlx5/qp.h+9−7
@@ -37,7 +37,8 @@ · 36 unmodified lines
3737 #include <linux/mlx5/driver.h>
3838
3939 #define MLX5_INVALID_LKEY 0x100
40−#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5)
40+/* UMR (3 WQE_BB's) + SIG (3 WQE_BB's) + PSV (mem) + PSV (wire) */
41+#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 8)
4142 #define MLX5_DIF_SIZE 8
4243 #define MLX5_STRIDE_BLOCK_OP 0x400
4344 #define MLX5_CPY_GRD_MASK 0xc0
@@ -70,6 +71,7 @@ enum mlx5_qp_optpar { · 26 unmodified lines
7071 MLX5_QP_OPTPAR_CQN_RCV = 1 << 19,
7172 MLX5_QP_OPTPAR_DC_HS = 1 << 20,
7273 MLX5_QP_OPTPAR_DC_KEY = 1 << 21,
74+ MLX5_QP_OPTPAR_COUNTER_SET_ID = 1 << 25,
7375 };
7476
7577 enum mlx5_qp_state {
@@ -202,7 +204,12 @@ struct mlx5_wqe_ctrl_seg { · 126 unmodified lines
202204 u8 signature;
203205 u8 rsvd[2];
204206 u8 fm_ce_se;
205− __be32 imm;
207+ union {
208+ __be32 general_id;
209+ __be32 imm;
210+ __be32 umr_mkey;
211+ __be32 tisn;
212+ };
206213 };
207214
208215 #define MLX5_WQE_CTRL_DS_MASK 0x3f
@@ -551,11 +558,6 @@ static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u · 342 unmodified lines
551558 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);
552559 }
553560
554−static inline struct mlx5_core_mkey *__mlx5_mr_lookup(struct mlx5_core_dev *dev, u32 key)
555−{
556− return radix_tree_lookup(&dev->priv.mkey_table.tree, key);
557−}
558−
559561 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
560562 struct mlx5_core_dct *qp,
561563 u32 *in, int inlen,
include/linux/mlx5/vport.h+3−4
@@ -44,9 +44,6 @@ · 43 unmodified lines
4444 MLX5_VPORT_UPLINK_PLACEHOLDER + \
4545 MLX5_VPORT_ECPF_PLACEHOLDER(mdev))
4646
47−#define MLX5_TOTAL_VPORTS(mdev) (MLX5_SPECIAL_VPORTS(mdev) + \
48− mlx5_core_max_vfs(mdev))
49−
5047 #define MLX5_VPORT_MANAGER(mdev) \
5148 (MLX5_CAP_GEN(mdev, vport_group_manager) && \
5249 (MLX5_CAP_GEN(mdev, port_type) == MLX5_CAP_PORT_TYPE_ETH) && \
@@ -58,6 +55,7 @@ enum { · 5 unmodified lines
5855 MLX5_CAP_INLINE_MODE_NOT_REQUIRED,
5956 };
6057
58+/* Vport number for each function must keep unchanged */
6159 enum {
6260 MLX5_VPORT_PF = 0x0,
6361 MLX5_VPORT_FIRST_VF = 0x1,
@@ -69,7 +67,8 @@ u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); · 5 unmodified lines
6967 int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
7068 u16 vport, u8 other_vport, u8 state);
7169 int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
72− u16 vport, u8 *addr);
70+ u16 vport, bool other, u8 *addr);
71+int mlx5_query_mac_address(struct mlx5_core_dev *mdev, u8 *addr);
7372 int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev,
7473 u16 vport, u8 *min_inline);
7574 void mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline);
include/linux/mm.h+84−84
@@ -541,13 +541,30 @@ static inline void vma_set_anonymous(struct vm_area_struct *vma) · 540 unmodified lines
541541 vma->vm_ops = NULL;
542542 }
543543
544+static inline bool vma_is_anonymous(struct vm_area_struct *vma)
545+{
546+ return !vma->vm_ops;
547+}
548+
549+#ifdef CONFIG_SHMEM
550+/*
551+ * The vma_is_shmem is not inline because it is used only by slow
552+ * paths in userfault.
553+ */
554+bool vma_is_shmem(struct vm_area_struct *vma);
555+#else
556+static inline bool vma_is_shmem(struct vm_area_struct *vma) { return false; }
557+#endif
558+
559+int vma_is_stack_for_current(struct vm_area_struct *vma);
560+
544561 /* flush_tlb_range() takes a vma, not a mm, and can care about flags */
545562 #define TLB_FLUSH_VMA(mm,flags) { .vm_mm = (mm), .vm_flags = (flags) }
546563
547564 struct mmu_gather;
548565 struct inode;
549566
550−#if !defined(__HAVE_ARCH_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE)
567+#if !defined(CONFIG_ARCH_HAS_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE)
551568 static inline int pmd_devmap(pmd_t pmd)
552569 {
553570 return 0;
@@ -633,6 +650,11 @@ static inline bool is_vmalloc_addr(const void *x) · 79 unmodified lines
633650 return false;
634651 #endif
635652 }
653+
654+#ifndef is_ioremap_addr
655+#define is_ioremap_addr(x) is_vmalloc_addr(x)
656+#endif
657+
636658 #ifdef CONFIG_MMU
637659 extern int is_vmalloc_or_module_addr(const void *x);
638660 #else
@@ -932,8 +954,6 @@ static inline bool is_zone_device_page(const struct page *page) · 293 unmodified lines
932954 #endif
933955
934956 #ifdef CONFIG_DEV_PAGEMAP_OPS
935−void dev_pagemap_get_ops(void);
936−void dev_pagemap_put_ops(void);
937957 void __put_devmap_managed_page(struct page *page);
938958 DECLARE_STATIC_KEY_FALSE(devmap_managed_key);
939959 static inline bool put_devmap_managed_page(struct page *page)
@@ -944,7 +964,6 @@ static inline bool put_devmap_managed_page(struct page *page) · 4 unmodified lines
944964 return false;
945965 switch (page->pgmap->type) {
946966 case MEMORY_DEVICE_PRIVATE:
947− case MEMORY_DEVICE_PUBLIC:
948967 case MEMORY_DEVICE_FS_DAX:
949968 __put_devmap_managed_page(page);
950969 return true;
@@ -954,60 +973,28 @@ static inline bool put_devmap_managed_page(struct page *page) · 3 unmodified lines
954973 return false;
955974 }
956975
957−static inline bool is_device_private_page(const struct page *page)
958−{
959− return is_zone_device_page(page) &&
960− page->pgmap->type == MEMORY_DEVICE_PRIVATE;
961−}
962−
963−static inline bool is_device_public_page(const struct page *page)
964−{
965− return is_zone_device_page(page) &&
966− page->pgmap->type == MEMORY_DEVICE_PUBLIC;
967−}
968−
969−#ifdef CONFIG_PCI_P2PDMA
970−static inline bool is_pci_p2pdma_page(const struct page *page)
971−{
972− return is_zone_device_page(page) &&
973− page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
974−}
975−#else /* CONFIG_PCI_P2PDMA */
976−static inline bool is_pci_p2pdma_page(const struct page *page)
977−{
978− return false;
979−}
980−#endif /* CONFIG_PCI_P2PDMA */
981−
982976 #else /* CONFIG_DEV_PAGEMAP_OPS */
983−static inline void dev_pagemap_get_ops(void)
984−{
985−}
986−
987−static inline void dev_pagemap_put_ops(void)
988−{
989−}
990−
991977 static inline bool put_devmap_managed_page(struct page *page)
992978 {
993979 return false;
994980 }
981+#endif /* CONFIG_DEV_PAGEMAP_OPS */
995982
996983 static inline bool is_device_private_page(const struct page *page)
997984 {
998− return false;
999−}
1000−
1001−static inline bool is_device_public_page(const struct page *page)
1002−{
1003− return false;
985+ return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
986+ IS_ENABLED(CONFIG_DEVICE_PRIVATE) &&
987+ is_zone_device_page(page) &&
988+ page->pgmap->type == MEMORY_DEVICE_PRIVATE;
1004989 }
1005990
1006991 static inline bool is_pci_p2pdma_page(const struct page *page)
1007992 {
1008− return false;
993+ return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
994+ IS_ENABLED(CONFIG_PCI_P2PDMA) &&
995+ is_zone_device_page(page) &&
996+ page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
1009997 }
1010−#endif /* CONFIG_DEV_PAGEMAP_OPS */
1011998
1012999 /* 127: arbitrary random number, small enough to assemble well */
10131000 #define page_ref_zero_or_close_to_overflow(page) \
@@ -1431,10 +1418,8 @@ struct zap_details { · 417 unmodified lines
14311418 pgoff_t last_index; /* Highest page->index to unmap */
14321419 };
14331420
1434−struct page *_vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
1435− pte_t pte, bool with_public_device);
1436−#define vm_normal_page(vma, addr, pte) _vm_normal_page(vma, addr, pte, false)
1437−
1421+struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
1422+ pte_t pte);
14381423 struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
14391424 pmd_t pmd);
14401425
@@ -1575,6 +1560,10 @@ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, · 134 unmodified lines
15751560 int get_user_pages_fast(unsigned long start, int nr_pages,
15761561 unsigned int gup_flags, struct page **pages);
15771562
1563+int account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc);
1564+int __account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc,
1565+ struct task_struct *task, bool bypass_rlim);
1566+
15781567 /* Container for pinned pfns / pages */
15791568 struct frame_vector {
15801569 unsigned int nr_allocated; /* Number of frames we have space for */
@@ -1648,23 +1637,6 @@ int clear_page_dirty_for_io(struct page *page); · 67 unmodified lines
16481637
16491638 int get_cmdline(struct task_struct *task, char *buffer, int buflen);
16501639
1651−static inline bool vma_is_anonymous(struct vm_area_struct *vma)
1652−{
1653− return !vma->vm_ops;
1654−}
1655−
1656−#ifdef CONFIG_SHMEM
1657−/*
1658− * The vma_is_shmem is not inline because it is used only by slow
1659− * paths in userfault.
1660− */
1661−bool vma_is_shmem(struct vm_area_struct *vma);
1662−#else
1663−static inline bool vma_is_shmem(struct vm_area_struct *vma) { return false; }
1664−#endif
1665−
1666−int vma_is_stack_for_current(struct vm_area_struct *vma);
1667−
16681640 extern unsigned long move_page_tables(struct vm_area_struct *vma,
16691641 unsigned long old_addr, struct vm_area_struct *new_vma,
16701642 unsigned long new_addr, unsigned long len,
@@ -1782,7 +1754,7 @@ static inline void sync_mm_rss(struct mm_struct *mm) · 111 unmodified lines
17821754 }
17831755 #endif
17841756
1785−#ifndef __HAVE_ARCH_PTE_DEVMAP
1757+#ifndef CONFIG_ARCH_HAS_PTE_DEVMAP
17861758 static inline int pte_devmap(pte_t pte)
17871759 {
17881760 return 0;
@@ -2681,8 +2653,7 @@ static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags) · 892 unmodified lines
26812653 return 0;
26822654 }
26832655
2684−typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
2685− void *data);
2656+typedef int (*pte_fn_t)(pte_t *pte, unsigned long addr, void *data);
26862657 extern int apply_to_page_range(struct mm_struct *mm, unsigned long address,
26872658 unsigned long size, pte_fn_t fn, void *data);
26882659
@@ -2696,11 +2667,42 @@ static inline void kernel_poison_pages(struct page *page, int numpages, · 7 unmodified lines
26962667 int enable) { }
26972668 #endif
26982669
2699−extern bool _debug_pagealloc_enabled;
2670+#ifdef CONFIG_INIT_ON_ALLOC_DEFAULT_ON
2671+DECLARE_STATIC_KEY_TRUE(init_on_alloc);
2672+#else
2673+DECLARE_STATIC_KEY_FALSE(init_on_alloc);
2674+#endif
2675+static inline bool want_init_on_alloc(gfp_t flags)
2676+{
2677+ if (static_branch_unlikely(&init_on_alloc) &&
2678+ !page_poisoning_enabled())
2679+ return true;
2680+ return flags & __GFP_ZERO;
2681+}
2682+
2683+#ifdef CONFIG_INIT_ON_FREE_DEFAULT_ON
2684+DECLARE_STATIC_KEY_TRUE(init_on_free);
2685+#else
2686+DECLARE_STATIC_KEY_FALSE(init_on_free);
2687+#endif
2688+static inline bool want_init_on_free(void)
2689+{
2690+ return static_branch_unlikely(&init_on_free) &&
2691+ !page_poisoning_enabled();
2692+}
2693+
2694+#ifdef CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT
2695+DECLARE_STATIC_KEY_TRUE(_debug_pagealloc_enabled);
2696+#else
2697+DECLARE_STATIC_KEY_FALSE(_debug_pagealloc_enabled);
2698+#endif
27002699
27012700 static inline bool debug_pagealloc_enabled(void)
27022701 {
2703− return IS_ENABLED(CONFIG_DEBUG_PAGEALLOC) && _debug_pagealloc_enabled;
2702+ if (!IS_ENABLED(CONFIG_DEBUG_PAGEALLOC))
2703+ return false;
2704+
2705+ return static_branch_unlikely(&_debug_pagealloc_enabled);
27042706 }
27052707
27062708 #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP)
@@ -2756,11 +2758,17 @@ extern int randomize_va_space; · 49 unmodified lines
27562758 #endif
27572759
27582760 const char * arch_vma_name(struct vm_area_struct *vma);
2761+#ifdef CONFIG_MMU
27592762 void print_vma_addr(char *prefix, unsigned long rip);
2763+#else
2764+static inline void print_vma_addr(char *prefix, unsigned long rip)
2765+{
2766+}
2767+#endif
27602768
27612769 void *sparse_buffer_alloc(unsigned long size);
2762−struct page *sparse_mem_map_populate(unsigned long pnum, int nid,
2763− struct vmem_altmap *altmap);
2770+struct page * __populate_section_memmap(unsigned long pfn,
2771+ unsigned long nr_pages, int nid, struct vmem_altmap *altmap);
27642772 pgd_t *vmemmap_pgd_populate(unsigned long addr, int node);
27652773 p4d_t *vmemmap_p4d_populate(pgd_t *pgd, unsigned long addr, int node);
27662774 pud_t *vmemmap_pud_populate(p4d_t *p4d, unsigned long addr, int node);
@@ -2850,11 +2858,9 @@ extern long copy_huge_page_from_user(struct page *dst_page, · 83 unmodified lines
28502858 bool allow_pagefault);
28512859 #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
28522860
2853−extern struct page_ext_operations debug_guardpage_ops;
2854−
28552861 #ifdef CONFIG_DEBUG_PAGEALLOC
28562862 extern unsigned int _debug_guardpage_minorder;
2857−extern bool _debug_guardpage_enabled;
2863+DECLARE_STATIC_KEY_FALSE(_debug_guardpage_enabled);
28582864
28592865 static inline unsigned int debug_guardpage_minorder(void)
28602866 {
@@ -2863,21 +2869,15 @@ static inline unsigned int debug_guardpage_minorder(void) · 2 unmodified lines
28632869
28642870 static inline bool debug_guardpage_enabled(void)
28652871 {
2866− return _debug_guardpage_enabled;
2872+ return static_branch_unlikely(&_debug_guardpage_enabled);
28672873 }
28682874
28692875 static inline bool page_is_guard(struct page *page)
28702876 {
2871− struct page_ext *page_ext;
2872−
28732877 if (!debug_guardpage_enabled())
28742878 return false;
28752879
2876− page_ext = lookup_page_ext(page);
2877− if (unlikely(!page_ext))
2878− return false;
2879−
2880− return test_bit(PAGE_EXT_DEBUG_GUARD, &page_ext->flags);
2880+ return PageGuard(page);
28812881 }
28822882 #else
28832883 static inline unsigned int debug_guardpage_minorder(void) { return 0; }
include/linux/mm_types.h+4−2
@@ -158,7 +158,7 @@ struct page { · 157 unmodified lines
158158 struct { /* ZONE_DEVICE pages */
159159 /** @pgmap: Points to the hosting device page map. */
160160 struct dev_pagemap *pgmap;
161− unsigned long hmm_data;
161+ void *zone_device_data;
162162 unsigned long _zd_pad_1; /* uses mapping */
163163 };
164164
@@ -329,7 +329,9 @@ struct vm_area_struct { · 164 unmodified lines
329329 struct file * vm_file; /* File we map to (can be NULL). */
330330 void * vm_private_data; /* was vm_pte (shared mem) */
331331
332+#ifdef CONFIG_SWAP
332333 atomic_long_t swap_readahead_info;
334+#endif
333335 #ifndef CONFIG_MMU
334336 struct vm_region *vm_region; /* NOMMU mapping region */
335337 #endif
@@ -501,7 +503,7 @@ struct mm_struct { · 165 unmodified lines
501503 #endif
502504 struct work_struct async_put_work;
503505
504−#if IS_ENABLED(CONFIG_HMM)
506+#ifdef CONFIG_HMM_MIRROR
505507 /* HMM needs to track a few things per mm */
506508 struct hmm *hmm;
507509 #endif
include/linux/mmc/host.h+0−1
@@ -501,7 +501,6 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host) · 500 unmodified lines
501501 wake_up_process(host->sdio_irq_thread);
502502 }
503503
504−void sdio_run_irqs(struct mmc_host *host);
505504 void sdio_signal_irq(struct mmc_host *host);
506505
507506 #ifdef CONFIG_REGULATOR
include/linux/mmzone.h+69−19
@@ -855,18 +855,6 @@ static inline int local_memory_node(int node_id) { return node_id; }; · 854 unmodified lines
855855 */
856856 #define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
857857
858−#ifdef CONFIG_ZONE_DEVICE
859−static inline bool is_dev_zone(const struct zone *zone)
860−{
861− return zone_idx(zone) == ZONE_DEVICE;
862−}
863−#else
864−static inline bool is_dev_zone(const struct zone *zone)
865−{
866− return false;
867−}
868−#endif
869−
870858 /*
871859 * Returns true if a zone has pages managed by the buddy allocator.
872860 * All the reclaim decisions have to use this function rather than
@@ -1160,6 +1148,29 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec) · 287 unmodified lines
11601148 #define SECTION_ALIGN_UP(pfn) (((pfn) + PAGES_PER_SECTION - 1) & PAGE_SECTION_MASK)
11611149 #define SECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SECTION_MASK)
11621150
1151+#define SUBSECTION_SHIFT 21
1152+
1153+#define PFN_SUBSECTION_SHIFT (SUBSECTION_SHIFT - PAGE_SHIFT)
1154+#define PAGES_PER_SUBSECTION (1UL << PFN_SUBSECTION_SHIFT)
1155+#define PAGE_SUBSECTION_MASK (~(PAGES_PER_SUBSECTION-1))
1156+
1157+#if SUBSECTION_SHIFT > SECTION_SIZE_BITS
1158+#error Subsection size exceeds section size
1159+#else
1160+#define SUBSECTIONS_PER_SECTION (1UL << (SECTION_SIZE_BITS - SUBSECTION_SHIFT))
1161+#endif
1162+
1163+#define SUBSECTION_ALIGN_UP(pfn) ALIGN((pfn), PAGES_PER_SUBSECTION)
1164+#define SUBSECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SUBSECTION_MASK)
1165+
1166+struct mem_section_usage {
1167+ DECLARE_BITMAP(subsection_map, SUBSECTIONS_PER_SECTION);
1168+ /* See declaration of similar field in struct zone */
1169+ unsigned long pageblock_flags[0];
1170+};
1171+
1172+void subsection_map_init(unsigned long pfn, unsigned long nr_pages);
1173+
11631174 struct page;
11641175 struct page_ext;
11651176 struct mem_section {
@@ -1177,8 +1188,7 @@ struct mem_section { · 11 unmodified lines
11771188 */
11781189 unsigned long section_mem_map;
11791190
1180− /* See declaration of similar field in struct zone */
1181− unsigned long *pageblock_flags;
1191+ struct mem_section_usage *usage;
11821192 #ifdef CONFIG_PAGE_EXTENSION
11831193 /*
11841194 * If SPARSEMEM, pgdat doesn't have page_ext pointer. We use
@@ -1209,6 +1219,11 @@ extern struct mem_section **mem_section; · 24 unmodified lines
12091219 extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT];
12101220 #endif
12111221
1222+static inline unsigned long *section_to_usemap(struct mem_section *ms)
1223+{
1224+ return ms->usage->pageblock_flags;
1225+}
1226+
12121227 static inline struct mem_section *__nr_to_section(unsigned long nr)
12131228 {
12141229 #ifdef CONFIG_SPARSEMEM_EXTREME
@@ -1219,8 +1234,8 @@ static inline struct mem_section *__nr_to_section(unsigned long nr) · 4 unmodified lines
12191234 return NULL;
12201235 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
12211236 }
1222−extern int __section_nr(struct mem_section* ms);
1223−extern unsigned long usemap_size(void);
1237+extern unsigned long __section_nr(struct mem_section *ms);
1238+extern size_t mem_section_usage_size(void);
12241239
12251240 /*
12261241 * We use the lower bits of the mem_map pointer to store
@@ -1238,7 +1253,8 @@ extern unsigned long usemap_size(void); · 11 unmodified lines
12381253 #define SECTION_MARKED_PRESENT (1UL<<0)
12391254 #define SECTION_HAS_MEM_MAP (1UL<<1)
12401255 #define SECTION_IS_ONLINE (1UL<<2)
1241−#define SECTION_MAP_LAST_BIT (1UL<<3)
1256+#define SECTION_IS_EARLY (1UL<<3)
1257+#define SECTION_MAP_LAST_BIT (1UL<<4)
12421258 #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
12431259 #define SECTION_NID_SHIFT 3
12441260
@@ -1264,6 +1280,11 @@ static inline int valid_section(struct mem_section *section) · 19 unmodified lines
12641280 return (section && (section->section_mem_map & SECTION_HAS_MEM_MAP));
12651281 }
12661282
1283+static inline int early_section(struct mem_section *section)
1284+{
1285+ return (section && (section->section_mem_map & SECTION_IS_EARLY));
1286+}
1287+
12671288 static inline int valid_section_nr(unsigned long nr)
12681289 {
12691290 return valid_section(__nr_to_section(nr));
@@ -1291,14 +1312,42 @@ static inline struct mem_section *__pfn_to_section(unsigned long pfn) · 21 unmodified lines
12911312 return __nr_to_section(pfn_to_section_nr(pfn));
12921313 }
12931314
1294−extern int __highest_present_section_nr;
1315+extern unsigned long __highest_present_section_nr;
1316+
1317+static inline int subsection_map_index(unsigned long pfn)
1318+{
1319+ return (pfn & ~(PAGE_SECTION_MASK)) / PAGES_PER_SUBSECTION;
1320+}
1321+
1322+#ifdef CONFIG_SPARSEMEM_VMEMMAP
1323+static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn)
1324+{
1325+ int idx = subsection_map_index(pfn);
1326+
1327+ return test_bit(idx, ms->usage->subsection_map);
1328+}
1329+#else
1330+static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn)
1331+{
1332+ return 1;
1333+}
1334+#endif
12951335
12961336 #ifndef CONFIG_HAVE_ARCH_PFN_VALID
12971337 static inline int pfn_valid(unsigned long pfn)
12981338 {
1339+ struct mem_section *ms;
1340+
12991341 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
13001342 return 0;
1301− return valid_section(__nr_to_section(pfn_to_section_nr(pfn)));
1343+ ms = __nr_to_section(pfn_to_section_nr(pfn));
1344+ if (!valid_section(ms))
1345+ return 0;
1346+ /*
1347+ * Traditionally early sections always returned pfn_valid() for
1348+ * the entire section-sized span.
1349+ */
1350+ return early_section(ms) || pfn_section_valid(ms, pfn);
13021351 }
13031352 #endif
13041353
@@ -1330,6 +1379,7 @@ void sparse_init(void); · 25 unmodified lines
13301379 #define sparse_init() do {} while (0)
13311380 #define sparse_index_init(_sec, _nid) do {} while (0)
13321381 #define pfn_present pfn_valid
1382+#define subsection_map_init(_pfn, _nr_pages) do {} while (0)
13331383 #endif /* CONFIG_SPARSEMEM */
13341384
13351385 /*
include/linux/mod_devicetable.h+26−5
@@ -16,6 +16,25 @@ typedef unsigned long kernel_ulong_t; · 15 unmodified lines
1616
1717 #define PCI_ANY_ID (~0)
1818
19+/**
20+ * struct pci_device_id - PCI device ID structure
21+ * @vendor: Vendor ID to match (or PCI_ANY_ID)
22+ * @device: Device ID to match (or PCI_ANY_ID)
23+ * @subvendor: Subsystem vendor ID to match (or PCI_ANY_ID)
24+ * @subdevice: Subsystem device ID to match (or PCI_ANY_ID)
25+ * @class: Device class, subclass, and "interface" to match.
26+ * See Appendix D of the PCI Local Bus Spec or
27+ * include/linux/pci_ids.h for a full list of classes.
28+ * Most drivers do not need to specify class/class_mask
29+ * as vendor/device is normally sufficient.
30+ * @class_mask: Limit which sub-fields of the class field are compared.
31+ * See drivers/scsi/sym53c8xx_2/ for example of usage.
32+ * @driver_data: Data private to the driver.
33+ * Most drivers don't need to use driver_data field.
34+ * Best practice is to use driver_data as an index
35+ * into a static list of equivalent device types,
36+ * instead of using it as a pointer.
37+ */
1938 struct pci_device_id {
2039 __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
2140 __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
@@ -257,17 +276,17 @@ struct pcmcia_device_id { · 235 unmodified lines
257276 __u16 match_flags;
258277
259278 __u16 manf_id;
260− __u16 card_id;
279+ __u16 card_id;
261280
262− __u8 func_id;
281+ __u8 func_id;
263282
264283 /* for real multi-function devices */
265− __u8 function;
284+ __u8 function;
266285
267286 /* for pseudo multi-function devices */
268− __u8 device_no;
287+ __u8 device_no;
269288
270− __u32 prod_id_hash[4];
289+ __u32 prod_id_hash[4];
271290
272291 /* not matched against in kernelspace */
273292 const char * prod_id[4];
@@ -795,9 +814,11 @@ struct tee_client_device_id { · 521 unmodified lines
795814 /**
796815 * struct wmi_device_id - WMI device identifier
797816 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
817+ * @context: pointer to driver specific data
798818 */
799819 struct wmi_device_id {
800820 const char guid_string[UUID_STRING_LEN+1];
821+ const void *context;
801822 };
802823
803824 #endif /* LINUX_MOD_DEVICETABLE_H */
include/linux/module.h+5−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/rbtree_latch.h>
2222 #include <linux/error-injection.h>
2323 #include <linux/tracepoint-defs.h>
24+#include <linux/srcu.h>
2425
2526 #include <linux/percpu.h>
2627 #include <asm/module.h>
@@ -450,6 +451,10 @@ struct module { · 423 unmodified lines
450451 unsigned int num_tracepoints;
451452 tracepoint_ptr_t *tracepoints_ptrs;
452453 #endif
454+#ifdef CONFIG_TREE_SRCU
455+ unsigned int num_srcu_structs;
456+ struct srcu_struct **srcu_struct_ptrs;
457+#endif
453458 #ifdef CONFIG_BPF_EVENTS
454459 unsigned int num_bpf_raw_events;
455460 struct bpf_raw_event_map *bpf_raw_events;
include/linux/moduleloader.h+5−0
@@ -29,6 +29,11 @@ void *module_alloc(unsigned long size); · 28 unmodified lines
2929 /* Free memory returned from module_alloc. */
3030 void module_memfree(void *module_region);
3131
32+/* Determines if the section name is an exit section (that is only used during
33+ * module unloading)
34+ */
35+bool module_exit_section(const char *name);
36+
3237 /*
3338 * Apply the given relocation to the (simplified) ELF. Return -error
3439 * or 0.
include/linux/msi.h+8−0
@@ -64,6 +64,10 @@ struct ti_sci_inta_msi_desc { · 63 unmodified lines
6464 * @msg: The last set MSI message cached for reuse
6565 * @affinity: Optional pointer to a cpu affinity mask for this descriptor
6666 *
67+ * @write_msi_msg: Callback that may be called when the MSI message
68+ * address or data changes
69+ * @write_msi_msg_data: Data parameter for the callback.
70+ *
6771 * @masked: [PCI MSI/X] Mask bits
6872 * @is_msix: [PCI MSI/X] True if MSI-X
6973 * @multiple: [PCI MSI/X] log2 num of messages allocated
@@ -90,6 +94,9 @@ struct msi_desc { · 20 unmodified lines
9094 const void *iommu_cookie;
9195 #endif
9296
97+ void (*write_msi_msg)(struct msi_desc *entry, void *data);
98+ void *write_msi_msg_data;
99+
93100 union {
94101 /* PCI MSI/X specific data */
95102 struct {
@@ -100,6 +107,7 @@ struct msi_desc { · 4 unmodified lines
100107 u8 multi_cap : 3;
101108 u8 maskbit : 1;
102109 u8 is_64 : 1;
110+ u8 is_virtual : 1;
103111 u16 entry_nr;
104112 unsigned default_irq;
105113 } msi_attrib;
include/linux/mtd/cfi.h+7−0
@@ -219,6 +219,13 @@ struct cfi_pri_amdstd { · 218 unmodified lines
219219 uint8_t VppMin;
220220 uint8_t VppMax;
221221 uint8_t TopBottom;
222+ /* Below field are added from version 1.5 */
223+ uint8_t ProgramSuspend;
224+ uint8_t UnlockBypass;
225+ uint8_t SecureSiliconSector;
226+ uint8_t SoftwareFeatures;
227+#define CFI_POLL_STATUS_REG BIT(0)
228+#define CFI_POLL_DQ BIT(1)
222229 } __packed;
223230
224231 /* Vendor-Specific PRI for Atmel chips (command set 0x0002) */
include/linux/mtd/hyperbus.h+84−0
@@ -0,0 +1,84 @@
1+/* SPDX-License-Identifier: GPL-2.0
2+ *
3+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
4+ */
5+
6+#ifndef __LINUX_MTD_HYPERBUS_H__
7+#define __LINUX_MTD_HYPERBUS_H__
8+
9+#include <linux/mtd/map.h>
10+
11+enum hyperbus_memtype {
12+ HYPERFLASH,
13+ HYPERRAM,
14+};
15+
16+/**
17+ * struct hyperbus_device - struct representing HyperBus slave device
18+ * @map: map_info struct for accessing MMIO HyperBus flash memory
19+ * @np: pointer to HyperBus slave device node
20+ * @mtd: pointer to MTD struct
21+ * @ctlr: pointer to HyperBus controller struct
22+ * @memtype: type of memory device: HyperFlash or HyperRAM
23+ */
24+
25+struct hyperbus_device {
26+ struct map_info map;
27+ struct device_node *np;
28+ struct mtd_info *mtd;
29+ struct hyperbus_ctlr *ctlr;
30+ enum hyperbus_memtype memtype;
31+};
32+
33+/**
34+ * struct hyperbus_ops - struct representing custom HyperBus operations
35+ * @read16: read 16 bit of data from flash in a single burst. Used to read
36+ * from non default address space, such as ID/CFI space
37+ * @write16: write 16 bit of data to flash in a single burst. Used to
38+ * send cmd to flash or write single 16 bit word at a time.
39+ * @copy_from: copy data from flash memory
40+ * @copy_to: copy data to flash memory
41+ * @calibrate: calibrate HyperBus controller
42+ */
43+
44+struct hyperbus_ops {
45+ u16 (*read16)(struct hyperbus_device *hbdev, unsigned long addr);
46+ void (*write16)(struct hyperbus_device *hbdev,
47+ unsigned long addr, u16 val);
48+ void (*copy_from)(struct hyperbus_device *hbdev, void *to,
49+ unsigned long from, ssize_t len);
50+ void (*copy_to)(struct hyperbus_device *dev, unsigned long to,
51+ const void *from, ssize_t len);
52+ int (*calibrate)(struct hyperbus_device *dev);
53+};
54+
55+/**
56+ * struct hyperbus_ctlr - struct representing HyperBus controller
57+ * @dev: pointer to HyperBus controller device
58+ * @calibrated: flag to indicate ctlr calibration sequence is complete
59+ * @ops: HyperBus controller ops
60+ */
61+struct hyperbus_ctlr {
62+ struct device *dev;
63+ bool calibrated;
64+
65+ const struct hyperbus_ops *ops;
66+};
67+
68+/**
69+ * hyperbus_register_device - probe and register a HyperBus slave memory device
70+ * @hbdev: hyperbus_device struct with dev, np and ctlr field populated
71+ *
72+ * Return: 0 for success, others for failure.
73+ */
74+int hyperbus_register_device(struct hyperbus_device *hbdev);
75+
76+/**
77+ * hyperbus_unregister_device - deregister HyperBus slave memory device
78+ * @hbdev: hyperbus_device to be unregistered
79+ *
80+ * Return: 0 for success, others for failure.
81+ */
82+int hyperbus_unregister_device(struct hyperbus_device *hbdev);
83+
84+#endif /* __LINUX_MTD_HYPERBUS_H__ */
include/linux/mtd/mtd.h+6−0
@@ -316,6 +316,12 @@ struct mtd_info { · 315 unmodified lines
316316 int (*_get_device) (struct mtd_info *mtd);
317317 void (*_put_device) (struct mtd_info *mtd);
318318
319+ /*
320+ * flag indicates a panic write, low level drivers can take appropriate
321+ * action if required to ensure writes go through
322+ */
323+ bool oops_panic_write;
324+
319325 struct notifier_block reboot_notifier; /* default mode before reboot */
320326
321327 /* ECC status information */
include/linux/mtd/onenand_regs.h+1−0
@@ -77,6 +77,7 @@ · 76 unmodified lines
7777 #define ONENAND_DEVICE_DENSITY_1Gb (0x003)
7878 #define ONENAND_DEVICE_DENSITY_2Gb (0x004)
7979 #define ONENAND_DEVICE_DENSITY_4Gb (0x005)
80+#define ONENAND_DEVICE_DENSITY_8Gb (0x006)
8081
8182 /*
8283 * Version ID Register F002h (R)
include/linux/mtd/rawnand.h+36−0
@@ -874,6 +874,42 @@ int nand_op_parser_exec_op(struct nand_chip *chip, · 873 unmodified lines
874874 const struct nand_op_parser *parser,
875875 const struct nand_operation *op, bool check_only);
876876
877+static inline void nand_op_trace(const char *prefix,
878+ const struct nand_op_instr *instr)
879+{
880+#if IS_ENABLED(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG)
881+ switch (instr->type) {
882+ case NAND_OP_CMD_INSTR:
883+ pr_debug("%sCMD [0x%02x]\n", prefix,
884+ instr->ctx.cmd.opcode);
885+ break;
886+ case NAND_OP_ADDR_INSTR:
887+ pr_debug("%sADDR [%d cyc: %*ph]\n", prefix,
888+ instr->ctx.addr.naddrs,
889+ instr->ctx.addr.naddrs < 64 ?
890+ instr->ctx.addr.naddrs : 64,
891+ instr->ctx.addr.addrs);
892+ break;
893+ case NAND_OP_DATA_IN_INSTR:
894+ pr_debug("%sDATA_IN [%d B%s]\n", prefix,
895+ instr->ctx.data.len,
896+ instr->ctx.data.force_8bit ?
897+ ", force 8-bit" : "");
898+ break;
899+ case NAND_OP_DATA_OUT_INSTR:
900+ pr_debug("%sDATA_OUT [%d B%s]\n", prefix,
901+ instr->ctx.data.len,
902+ instr->ctx.data.force_8bit ?
903+ ", force 8-bit" : "");
904+ break;
905+ case NAND_OP_WAITRDY_INSTR:
906+ pr_debug("%sWAITRDY [max %d ms]\n", prefix,
907+ instr->ctx.waitrdy.timeout_ms);
908+ break;
909+ }
910+#endif
911+}
912+
877913 /**
878914 * struct nand_controller_ops - Controller operations
879915 *
include/linux/mtd/spinand.h+33−2
@@ -68,30 +68,60 @@ · 67 unmodified lines
6868 SPI_MEM_OP_DUMMY(ndummy, 1), \
6969 SPI_MEM_OP_DATA_IN(len, buf, 1))
7070
71+#define SPINAND_PAGE_READ_FROM_CACHE_OP_3A(fast, addr, ndummy, buf, len) \
72+ SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1), \
73+ SPI_MEM_OP_ADDR(3, addr, 1), \
74+ SPI_MEM_OP_DUMMY(ndummy, 1), \
75+ SPI_MEM_OP_DATA_IN(len, buf, 1))
76+
7177 #define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len) \
7278 SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \
7379 SPI_MEM_OP_ADDR(2, addr, 1), \
7480 SPI_MEM_OP_DUMMY(ndummy, 1), \
7581 SPI_MEM_OP_DATA_IN(len, buf, 2))
7682
83+#define SPINAND_PAGE_READ_FROM_CACHE_X2_OP_3A(addr, ndummy, buf, len) \
84+ SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \
85+ SPI_MEM_OP_ADDR(3, addr, 1), \
86+ SPI_MEM_OP_DUMMY(ndummy, 1), \
87+ SPI_MEM_OP_DATA_IN(len, buf, 2))
88+
7789 #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \
7890 SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \
7991 SPI_MEM_OP_ADDR(2, addr, 1), \
8092 SPI_MEM_OP_DUMMY(ndummy, 1), \
8193 SPI_MEM_OP_DATA_IN(len, buf, 4))
8294
95+#define SPINAND_PAGE_READ_FROM_CACHE_X4_OP_3A(addr, ndummy, buf, len) \
96+ SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \
97+ SPI_MEM_OP_ADDR(3, addr, 1), \
98+ SPI_MEM_OP_DUMMY(ndummy, 1), \
99+ SPI_MEM_OP_DATA_IN(len, buf, 4))
100+
83101 #define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len) \
84102 SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \
85103 SPI_MEM_OP_ADDR(2, addr, 2), \
86104 SPI_MEM_OP_DUMMY(ndummy, 2), \
87105 SPI_MEM_OP_DATA_IN(len, buf, 2))
88106
107+#define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP_3A(addr, ndummy, buf, len) \
108+ SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \
109+ SPI_MEM_OP_ADDR(3, addr, 2), \
110+ SPI_MEM_OP_DUMMY(ndummy, 2), \
111+ SPI_MEM_OP_DATA_IN(len, buf, 2))
112+
89113 #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \
90114 SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \
91115 SPI_MEM_OP_ADDR(2, addr, 4), \
92116 SPI_MEM_OP_DUMMY(ndummy, 4), \
93117 SPI_MEM_OP_DATA_IN(len, buf, 4))
94118
119+#define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP_3A(addr, ndummy, buf, len) \
120+ SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \
121+ SPI_MEM_OP_ADDR(3, addr, 4), \
122+ SPI_MEM_OP_DUMMY(ndummy, 4), \
123+ SPI_MEM_OP_DATA_IN(len, buf, 4))
124+
95125 #define SPINAND_PROG_EXEC_OP(addr) \
96126 SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \
97127 SPI_MEM_OP_ADDR(3, addr, 1), \
@@ -197,6 +227,7 @@ struct spinand_manufacturer { · 99 unmodified lines
197227 extern const struct spinand_manufacturer gigadevice_spinand_manufacturer;
198228 extern const struct spinand_manufacturer macronix_spinand_manufacturer;
199229 extern const struct spinand_manufacturer micron_spinand_manufacturer;
230+extern const struct spinand_manufacturer paragon_spinand_manufacturer;
200231 extern const struct spinand_manufacturer toshiba_spinand_manufacturer;
201232 extern const struct spinand_manufacturer winbond_spinand_manufacturer;
202233
@@ -260,7 +291,7 @@ struct spinand_ecc_info { · 57 unmodified lines
260291 */
261292 struct spinand_info {
262293 const char *model;
263− u8 devid;
294+ u16 devid;
264295 u32 flags;
265296 struct nand_memory_organization memorg;
266297 struct nand_ecc_req eccreq;
@@ -422,7 +453,7 @@ static inline void spinand_set_of_node(struct spinand_device *spinand, · 155 unmodified lines
422453
423454 int spinand_match_and_init(struct spinand_device *dev,
424455 const struct spinand_info *table,
425− unsigned int table_size, u8 devid);
456+ unsigned int table_size, u16 devid);
426457
427458 int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);
428459 int spinand_select_target(struct spinand_device *spinand, unsigned int target);
include/linux/mutex.h+1−1
@@ -151,7 +151,7 @@ static inline bool mutex_is_locked(struct mutex *lock) · 150 unmodified lines
151151
152152 /*
153153 * See kernel/locking/mutex.c for detailed documentation of these APIs.
154− * Also see Documentation/locking/mutex-design.txt.
154+ * Also see Documentation/locking/mutex-design.rst.
155155 */
156156 #ifdef CONFIG_DEBUG_LOCK_ALLOC
157157 extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
include/linux/mv643xx.h+0−46
@@ -918,52 +918,6 @@ · 917 unmodified lines
918918
919919 extern void mv64340_irq_init(unsigned int base);
920920
921−/* MPSC Platform Device, Driver Data (Shared register regions) */
922−#define MPSC_SHARED_NAME "mpsc_shared"
923−
924−#define MPSC_ROUTING_BASE_ORDER 0
925−#define MPSC_SDMA_INTR_BASE_ORDER 1
926−
927−#define MPSC_ROUTING_REG_BLOCK_SIZE 0x000c
928−#define MPSC_SDMA_INTR_REG_BLOCK_SIZE 0x0084
929−
930−struct mpsc_shared_pdata {
931− u32 mrr_val;
932− u32 rcrr_val;
933− u32 tcrr_val;
934− u32 intr_cause_val;
935− u32 intr_mask_val;
936−};
937−
938−/* MPSC Platform Device, Driver Data */
939−#define MPSC_CTLR_NAME "mpsc"
940−
941−#define MPSC_BASE_ORDER 0
942−#define MPSC_SDMA_BASE_ORDER 1
943−#define MPSC_BRG_BASE_ORDER 2
944−
945−#define MPSC_REG_BLOCK_SIZE 0x0038
946−#define MPSC_SDMA_REG_BLOCK_SIZE 0x0c18
947−#define MPSC_BRG_REG_BLOCK_SIZE 0x0008
948−
949−struct mpsc_pdata {
950− u8 mirror_regs;
951− u8 cache_mgmt;
952− u8 max_idle;
953− int default_baud;
954− int default_bits;
955− int default_parity;
956− int default_flow;
957− u32 chr_1_val;
958− u32 chr_2_val;
959− u32 chr_10_val;
960− u32 mpcr_val;
961− u32 bcr_val;
962− u8 brg_can_tune;
963− u8 brg_clk_src;
964− u32 brg_clk_freq;
965−};
966−
967921 /* Watchdog Platform Device, Driver Data */
968922 #define MV64x60_WDT_NAME "mv64x60_wdt"
969923
include/linux/net.h+2−2
@@ -116,11 +116,11 @@ struct socket { · 115 unmodified lines
116116
117117 unsigned long flags;
118118
119− struct socket_wq *wq;
120−
121119 struct file *file;
122120 struct sock *sk;
123121 const struct proto_ops *ops;
122+
123+ struct socket_wq wq;
124124 };
125125
126126 struct vm_area_struct;
include/linux/net_dim.h+0−418
@@ -1,418 +0,0 @@
1−/*
2− * Copyright (c) 2016, Mellanox Technologies. All rights reserved.
3− * Copyright (c) 2017-2018, Broadcom Limited. All rights reserved.
4− *
5− * This software is available to you under a choice of one of two
6− * licenses. You may choose to be licensed under the terms of the GNU
7− * General Public License (GPL) Version 2, available from the file
8− * COPYING in the main directory of this source tree, or the
9− * OpenIB.org BSD license below:
10− *
11− * Redistribution and use in source and binary forms, with or
12− * without modification, are permitted provided that the following
13− * conditions are met:
14− *
15− * - Redistributions of source code must retain the above
16− * copyright notice, this list of conditions and the following
17− * disclaimer.
18− *
19− * - Redistributions in binary form must reproduce the above
20− * copyright notice, this list of conditions and the following
21− * disclaimer in the documentation and/or other materials
22− * provided with the distribution.
23− *
24− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25− * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26− * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27− * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28− * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29− * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30− * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31− * SOFTWARE.
32− */
33−
34−#ifndef NET_DIM_H
35−#define NET_DIM_H
36−
37−#include <linux/module.h>
38−
39−struct net_dim_cq_moder {
40− u16 usec;
41− u16 pkts;
42− u8 cq_period_mode;
43−};
44−
45−struct net_dim_sample {
46− ktime_t time;
47− u32 pkt_ctr;
48− u32 byte_ctr;
49− u16 event_ctr;
50−};
51−
52−struct net_dim_stats {
53− int ppms; /* packets per msec */
54− int bpms; /* bytes per msec */
55− int epms; /* events per msec */
56−};
57−
58−struct net_dim { /* Adaptive Moderation */
59− u8 state;
60− struct net_dim_stats prev_stats;
61− struct net_dim_sample start_sample;
62− struct work_struct work;
63− u8 profile_ix;
64− u8 mode;
65− u8 tune_state;
66− u8 steps_right;
67− u8 steps_left;
68− u8 tired;
69−};
70−
71−enum {
72− NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0,
73− NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1,
74− NET_DIM_CQ_PERIOD_NUM_MODES
75−};
76−
77−/* Adaptive moderation logic */
78−enum {
79− NET_DIM_START_MEASURE,
80− NET_DIM_MEASURE_IN_PROGRESS,
81− NET_DIM_APPLY_NEW_PROFILE,
82−};
83−
84−enum {
85− NET_DIM_PARKING_ON_TOP,
86− NET_DIM_PARKING_TIRED,
87− NET_DIM_GOING_RIGHT,
88− NET_DIM_GOING_LEFT,
89−};
90−
91−enum {
92− NET_DIM_STATS_WORSE,
93− NET_DIM_STATS_SAME,
94− NET_DIM_STATS_BETTER,
95−};
96−
97−enum {
98− NET_DIM_STEPPED,
99− NET_DIM_TOO_TIRED,
100− NET_DIM_ON_EDGE,
101−};
102−
103−#define NET_DIM_PARAMS_NUM_PROFILES 5
104−/* Adaptive moderation profiles */
105−#define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256
106−#define NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE 128
107−#define NET_DIM_DEF_PROFILE_CQE 1
108−#define NET_DIM_DEF_PROFILE_EQE 1
109−
110−/* All profiles sizes must be NET_PARAMS_DIM_NUM_PROFILES */
111−#define NET_DIM_RX_EQE_PROFILES { \
112− {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
113− {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
114− {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
115− {128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
116− {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
117−}
118−
119−#define NET_DIM_RX_CQE_PROFILES { \
120− {2, 256}, \
121− {8, 128}, \
122− {16, 64}, \
123− {32, 64}, \
124− {64, 64} \
125−}
126−
127−#define NET_DIM_TX_EQE_PROFILES { \
128− {1, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
129− {8, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
130− {32, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
131− {64, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
132− {128, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE} \
133−}
134−
135−#define NET_DIM_TX_CQE_PROFILES { \
136− {5, 128}, \
137− {8, 64}, \
138− {16, 32}, \
139− {32, 32}, \
140− {64, 32} \
141−}
142−
143−static const struct net_dim_cq_moder
144−rx_profile[NET_DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
145− NET_DIM_RX_EQE_PROFILES,
146− NET_DIM_RX_CQE_PROFILES,
147−};
148−
149−static const struct net_dim_cq_moder
150−tx_profile[NET_DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
151− NET_DIM_TX_EQE_PROFILES,
152− NET_DIM_TX_CQE_PROFILES,
153−};
154−
155−static inline struct net_dim_cq_moder
156−net_dim_get_rx_moderation(u8 cq_period_mode, int ix)
157−{
158− struct net_dim_cq_moder cq_moder = rx_profile[cq_period_mode][ix];
159−
160− cq_moder.cq_period_mode = cq_period_mode;
161− return cq_moder;
162−}
163−
164−static inline struct net_dim_cq_moder
165−net_dim_get_def_rx_moderation(u8 cq_period_mode)
166−{
167− u8 profile_ix = cq_period_mode == NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE ?
168− NET_DIM_DEF_PROFILE_CQE : NET_DIM_DEF_PROFILE_EQE;
169−
170− return net_dim_get_rx_moderation(cq_period_mode, profile_ix);
171−}
172−
173−static inline struct net_dim_cq_moder
174−net_dim_get_tx_moderation(u8 cq_period_mode, int ix)
175−{
176− struct net_dim_cq_moder cq_moder = tx_profile[cq_period_mode][ix];
177−
178− cq_moder.cq_period_mode = cq_period_mode;
179− return cq_moder;
180−}
181−
182−static inline struct net_dim_cq_moder
183−net_dim_get_def_tx_moderation(u8 cq_period_mode)
184−{
185− u8 profile_ix = cq_period_mode == NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE ?
186− NET_DIM_DEF_PROFILE_CQE : NET_DIM_DEF_PROFILE_EQE;
187−
188− return net_dim_get_tx_moderation(cq_period_mode, profile_ix);
189−}
190−
191−static inline bool net_dim_on_top(struct net_dim *dim)
192−{
193− switch (dim->tune_state) {
194− case NET_DIM_PARKING_ON_TOP:
195− case NET_DIM_PARKING_TIRED:
196− return true;
197− case NET_DIM_GOING_RIGHT:
198− return (dim->steps_left > 1) && (dim->steps_right == 1);
199− default: /* NET_DIM_GOING_LEFT */
200− return (dim->steps_right > 1) && (dim->steps_left == 1);
201− }
202−}
203−
204−static inline void net_dim_turn(struct net_dim *dim)
205−{
206− switch (dim->tune_state) {
207− case NET_DIM_PARKING_ON_TOP:
208− case NET_DIM_PARKING_TIRED:
209− break;
210− case NET_DIM_GOING_RIGHT:
211− dim->tune_state = NET_DIM_GOING_LEFT;
212− dim->steps_left = 0;
213− break;
214− case NET_DIM_GOING_LEFT:
215− dim->tune_state = NET_DIM_GOING_RIGHT;
216− dim->steps_right = 0;
217− break;
218− }
219−}
220−
221−static inline int net_dim_step(struct net_dim *dim)
222−{
223− if (dim->tired == (NET_DIM_PARAMS_NUM_PROFILES * 2))
224− return NET_DIM_TOO_TIRED;
225−
226− switch (dim->tune_state) {
227− case NET_DIM_PARKING_ON_TOP:
228− case NET_DIM_PARKING_TIRED:
229− break;
230− case NET_DIM_GOING_RIGHT:
231− if (dim->profile_ix == (NET_DIM_PARAMS_NUM_PROFILES - 1))
232− return NET_DIM_ON_EDGE;
233− dim->profile_ix++;
234− dim->steps_right++;
235− break;
236− case NET_DIM_GOING_LEFT:
237− if (dim->profile_ix == 0)
238− return NET_DIM_ON_EDGE;
239− dim->profile_ix--;
240− dim->steps_left++;
241− break;
242− }
243−
244− dim->tired++;
245− return NET_DIM_STEPPED;
246−}
247−
248−static inline void net_dim_park_on_top(struct net_dim *dim)
249−{
250− dim->steps_right = 0;
251− dim->steps_left = 0;
252− dim->tired = 0;
253− dim->tune_state = NET_DIM_PARKING_ON_TOP;
254−}
255−
256−static inline void net_dim_park_tired(struct net_dim *dim)
257−{
258− dim->steps_right = 0;
259− dim->steps_left = 0;
260− dim->tune_state = NET_DIM_PARKING_TIRED;
261−}
262−
263−static inline void net_dim_exit_parking(struct net_dim *dim)
264−{
265− dim->tune_state = dim->profile_ix ? NET_DIM_GOING_LEFT :
266− NET_DIM_GOING_RIGHT;
267− net_dim_step(dim);
268−}
269−
270−#define IS_SIGNIFICANT_DIFF(val, ref) \
271− (((100UL * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */
272−
273−static inline int net_dim_stats_compare(struct net_dim_stats *curr,
274− struct net_dim_stats *prev)
275−{
276− if (!prev->bpms)
277− return curr->bpms ? NET_DIM_STATS_BETTER :
278− NET_DIM_STATS_SAME;
279−
280− if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms))
281− return (curr->bpms > prev->bpms) ? NET_DIM_STATS_BETTER :
282− NET_DIM_STATS_WORSE;
283−
284− if (!prev->ppms)
285− return curr->ppms ? NET_DIM_STATS_BETTER :
286− NET_DIM_STATS_SAME;
287−
288− if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms))
289− return (curr->ppms > prev->ppms) ? NET_DIM_STATS_BETTER :
290− NET_DIM_STATS_WORSE;
291−
292− if (!prev->epms)
293− return NET_DIM_STATS_SAME;
294−
295− if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms))
296− return (curr->epms < prev->epms) ? NET_DIM_STATS_BETTER :
297− NET_DIM_STATS_WORSE;
298−
299− return NET_DIM_STATS_SAME;
300−}
301−
302−static inline bool net_dim_decision(struct net_dim_stats *curr_stats,
303− struct net_dim *dim)
304−{
305− int prev_state = dim->tune_state;
306− int prev_ix = dim->profile_ix;
307− int stats_res;
308− int step_res;
309−
310− switch (dim->tune_state) {
311− case NET_DIM_PARKING_ON_TOP:
312− stats_res = net_dim_stats_compare(curr_stats, &dim->prev_stats);
313− if (stats_res != NET_DIM_STATS_SAME)
314− net_dim_exit_parking(dim);
315− break;
316−
317− case NET_DIM_PARKING_TIRED:
318− dim->tired--;
319− if (!dim->tired)
320− net_dim_exit_parking(dim);
321− break;
322−
323− case NET_DIM_GOING_RIGHT:
324− case NET_DIM_GOING_LEFT:
325− stats_res = net_dim_stats_compare(curr_stats, &dim->prev_stats);
326− if (stats_res != NET_DIM_STATS_BETTER)
327− net_dim_turn(dim);
328−
329− if (net_dim_on_top(dim)) {
330− net_dim_park_on_top(dim);
331− break;
332− }
333−
334− step_res = net_dim_step(dim);
335− switch (step_res) {
336− case NET_DIM_ON_EDGE:
337− net_dim_park_on_top(dim);
338− break;
339− case NET_DIM_TOO_TIRED:
340− net_dim_park_tired(dim);
341− break;
342− }
343−
344− break;
345− }
346−
347− if ((prev_state != NET_DIM_PARKING_ON_TOP) ||
348− (dim->tune_state != NET_DIM_PARKING_ON_TOP))
349− dim->prev_stats = *curr_stats;
350−
351− return dim->profile_ix != prev_ix;
352−}
353−
354−static inline void net_dim_sample(u16 event_ctr,
355− u64 packets,
356− u64 bytes,
357− struct net_dim_sample *s)
358−{
359− s->time = ktime_get();
360− s->pkt_ctr = packets;
361− s->byte_ctr = bytes;
362− s->event_ctr = event_ctr;
363−}
364−
365−#define NET_DIM_NEVENTS 64
366−#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1))
367−
368−static inline void net_dim_calc_stats(struct net_dim_sample *start,
369− struct net_dim_sample *end,
370− struct net_dim_stats *curr_stats)
371−{
372− /* u32 holds up to 71 minutes, should be enough */
373− u32 delta_us = ktime_us_delta(end->time, start->time);
374− u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr);
375− u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr,
376− start->byte_ctr);
377−
378− if (!delta_us)
379− return;
380−
381− curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us);
382− curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us);
383− curr_stats->epms = DIV_ROUND_UP(NET_DIM_NEVENTS * USEC_PER_MSEC,
384− delta_us);
385−}
386−
387−static inline void net_dim(struct net_dim *dim,
388− struct net_dim_sample end_sample)
389−{
390− struct net_dim_stats curr_stats;
391− u16 nevents;
392−
393− switch (dim->state) {
394− case NET_DIM_MEASURE_IN_PROGRESS:
395− nevents = BIT_GAP(BITS_PER_TYPE(u16),
396− end_sample.event_ctr,
397− dim->start_sample.event_ctr);
398− if (nevents < NET_DIM_NEVENTS)
399− break;
400− net_dim_calc_stats(&dim->start_sample, &end_sample,
401− &curr_stats);
402− if (net_dim_decision(&curr_stats, dim)) {
403− dim->state = NET_DIM_APPLY_NEW_PROFILE;
404− schedule_work(&dim->work);
405− break;
406− }
407− /* fall through */
408− case NET_DIM_START_MEASURE:
409− net_dim_sample(end_sample.event_ctr, end_sample.pkt_ctr, end_sample.byte_ctr,
410− &dim->start_sample);
411− dim->state = NET_DIM_MEASURE_IN_PROGRESS;
412− break;
413− case NET_DIM_APPLY_NEW_PROFILE:
414− break;
415− }
416−}
417−
418−#endif /* NET_DIM_H */
include/linux/netdevice.h+2−0
@@ -4870,4 +4870,6 @@ do { \ · 4869 unmodified lines
48704870 #define PTYPE_HASH_SIZE (16)
48714871 #define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1)
48724872
4873+extern struct net_device *blackhole_netdev;
4874+
48734875 #endif /* _LINUX_NETDEVICE_H */
include/linux/netfilter.h+0−5
@@ -336,11 +336,6 @@ int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, · 335 unmodified lines
336336 char __user *opt, int *len);
337337 #endif
338338
339−/* Call this before modifying an existing packet: ensures it is
340− modifiable and linear to the point you care about (writable_len).
341− Returns true or false. */
342−int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
343−
344339 struct flowi;
345340 struct nf_queue_entry;
346341
include/linux/netfilter/ipset/ip_set.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>
33 * Patrick Schaaf <bof@bof.de>
44 * Martin Josefsson <gandalf@wlug.westbo.se>
5− * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
5+ * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org>
66 */
77 #ifndef _IP_SET_H
88 #define _IP_SET_H
include/linux/netfilter/ipset/ip_set_counter.h+1−2
@@ -2,8 +2,7 @@ · 1 unmodified line
22 #ifndef _IP_SET_COUNTER_H
33 #define _IP_SET_COUNTER_H
44
5−/* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
6− */
5+/* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@netfilter.org> */
76
87 #ifdef __KERNEL__
98
include/linux/netfilter/ipset/ip_set_skbinfo.h+1−2
@@ -2,8 +2,7 @@ · 1 unmodified line
22 #ifndef _IP_SET_SKBINFO_H
33 #define _IP_SET_SKBINFO_H
44
5−/* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
6− */
5+/* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@netfilter.org> */
76
87 #ifdef __KERNEL__
98
include/linux/netfilter/ipset/ip_set_timeout.h+1−2
@@ -2,8 +2,7 @@ · 1 unmodified line
22 #ifndef _IP_SET_TIMEOUT_H
33 #define _IP_SET_TIMEOUT_H
44
5−/* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
6− */
5+/* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> */
76
87 #ifdef __KERNEL__
98
include/linux/netfilter/nf_conntrack_h323_asn1.h+1−2
@@ -1,7 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0-only */
22 /****************************************************************************
3− * ip_conntrack_h323_asn1.h - BER and PER decoding library for H.323
4− * conntrack/NAT module.
3+ * BER and PER decoding library for H.323 conntrack/NAT module.
54 *
65 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net>
76 *
include/linux/netfilter_ipv6.h+100−2
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #define __LINUX_IP6_NETFILTER_H
99
1010 #include <uapi/linux/netfilter_ipv6.h>
11+#include <net/tcp.h>
1112
1213 /* Extra routing may needed on local out, as the QUEUE target never returns
1314 * control to the table.
@@ -19,6 +20,7 @@ struct ip6_rt_info { · 5 unmodified lines
1920 };
2021
2122 struct nf_queue_entry;
23+struct nf_ct_bridge_frag_data;
2224
2325 /*
2426 * Hook functions for ipv6 to allow xt_* modules to be built-in even
@@ -34,11 +36,24 @@ struct nf_ipv6_ops { · 9 unmodified lines
3436 struct in6_addr *saddr);
3537 int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl,
3638 bool strict);
39+ u32 (*cookie_init_sequence)(const struct ipv6hdr *iph,
40+ const struct tcphdr *th, u16 *mssp);
41+ int (*cookie_v6_check)(const struct ipv6hdr *iph,
42+ const struct tcphdr *th, __u32 cookie);
3743 #endif
3844 void (*route_input)(struct sk_buff *skb);
3945 int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
4046 int (*output)(struct net *, struct sock *, struct sk_buff *));
4147 int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry);
48+#if IS_MODULE(CONFIG_IPV6)
49+ int (*br_defrag)(struct net *net, struct sk_buff *skb, u32 user);
50+ int (*br_fragment)(struct net *net, struct sock *sk,
51+ struct sk_buff *skb,
52+ struct nf_ct_bridge_frag_data *data,
53+ int (*output)(struct net *, struct sock *sk,
54+ const struct nf_ct_bridge_frag_data *data,
55+ struct sk_buff *));
56+#endif
4257 };
4358
4459 #ifdef CONFIG_NETFILTER
@@ -60,8 +75,10 @@ static inline int nf_ipv6_chk_addr(struct net *net, const struct in6_addr *addr, · 15 unmodified lines
6075 return 1;
6176
6277 return v6_ops->chk_addr(net, addr, dev, strict);
63−#else
78+#elif IS_BUILTIN(CONFIG_IPV6)
6479 return ipv6_chk_addr(net, addr, dev, strict);
80+#else
81+ return 1;
6582 #endif
6683 }
6784
@@ -86,6 +103,52 @@ static inline int nf_ip6_route(struct net *net, struct dst_entry **dst, · 18 unmodified lines
86103 #endif
87104 }
88105
106+#include <net/netfilter/ipv6/nf_defrag_ipv6.h>
107+
108+static inline int nf_ipv6_br_defrag(struct net *net, struct sk_buff *skb,
109+ u32 user)
110+{
111+#if IS_MODULE(CONFIG_IPV6)
112+ const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
113+
114+ if (!v6_ops)
115+ return 1;
116+
117+ return v6_ops->br_defrag(net, skb, user);
118+#elif IS_BUILTIN(CONFIG_IPV6)
119+ return nf_ct_frag6_gather(net, skb, user);
120+#else
121+ return 1;
122+#endif
123+}
124+
125+int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
126+ struct nf_ct_bridge_frag_data *data,
127+ int (*output)(struct net *, struct sock *sk,
128+ const struct nf_ct_bridge_frag_data *data,
129+ struct sk_buff *));
130+
131+static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk,
132+ struct sk_buff *skb,
133+ struct nf_ct_bridge_frag_data *data,
134+ int (*output)(struct net *, struct sock *sk,
135+ const struct nf_ct_bridge_frag_data *data,
136+ struct sk_buff *))
137+{
138+#if IS_MODULE(CONFIG_IPV6)
139+ const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
140+
141+ if (!v6_ops)
142+ return 1;
143+
144+ return v6_ops->br_fragment(net, sk, skb, data, output);
145+#elif IS_BUILTIN(CONFIG_IPV6)
146+ return br_ip6_fragment(net, sk, skb, data, output);
147+#else
148+ return 1;
149+#endif
150+}
151+
89152 int ip6_route_me_harder(struct net *net, struct sk_buff *skb);
90153
91154 static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb)
@@ -97,9 +160,44 @@ static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) · 5 unmodified lines
97160 return -EHOSTUNREACH;
98161
99162 return v6_ops->route_me_harder(net, skb);
100−#else
163+#elif IS_BUILTIN(CONFIG_IPV6)
101164 return ip6_route_me_harder(net, skb);
165+#else
166+ return -EHOSTUNREACH;
167+#endif
168+}
169+
170+static inline u32 nf_ipv6_cookie_init_sequence(const struct ipv6hdr *iph,
171+ const struct tcphdr *th,
172+ u16 *mssp)
173+{
174+#if IS_ENABLED(CONFIG_SYN_COOKIES)
175+#if IS_MODULE(CONFIG_IPV6)
176+ const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
177+
178+ if (v6_ops)
179+ return v6_ops->cookie_init_sequence(iph, th, mssp);
180+#elif IS_BUILTIN(CONFIG_IPV6)
181+ return __cookie_v6_init_sequence(iph, th, mssp);
182+#endif
183+#endif
184+ return 0;
185+}
186+
187+static inline int nf_cookie_v6_check(const struct ipv6hdr *iph,
188+ const struct tcphdr *th, __u32 cookie)
189+{
190+#if IS_ENABLED(CONFIG_SYN_COOKIES)
191+#if IS_MODULE(CONFIG_IPV6)
192+ const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
193+
194+ if (v6_ops)
195+ return v6_ops->cookie_v6_check(iph, th, cookie);
196+#elif IS_BUILTIN(CONFIG_IPV6)
197+ return __cookie_v6_check(iph, th, cookie);
198+#endif
102199 #endif
200+ return 0;
103201 }
104202
105203 __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
include/linux/netlink.h+8−1
@@ -192,7 +192,14 @@ struct netlink_callback { · 191 unmodified lines
192192 bool strict_check;
193193 u16 answer_flags;
194194 unsigned int prev_seq, seq;
195− long args[6];
195+ union {
196+ u8 ctx[48];
197+
198+ /* args is deprecated. Cast a struct over ctx instead
199+ * for proper type safety.
200+ */
201+ long args[6];
202+ };
196203 };
197204
198205 struct netlink_notify {
include/linux/nfs4.h+1−0
@@ -660,6 +660,7 @@ enum pnfs_update_layout_reason { · 659 unmodified lines
660660 PNFS_UPDATE_LAYOUT_BLOCKED,
661661 PNFS_UPDATE_LAYOUT_INVALID_OPEN,
662662 PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET,
663+ PNFS_UPDATE_LAYOUT_EXIT,
663664 };
664665
665666 #define NFS4_OP_MAP_NUM_LONGS \
include/linux/nfs_fs.h+2−0
@@ -223,6 +223,8 @@ struct nfs4_copy_state { · 222 unmodified lines
223223 #define NFS_INO_INVALID_MTIME BIT(10) /* cached mtime is invalid */
224224 #define NFS_INO_INVALID_SIZE BIT(11) /* cached size is invalid */
225225 #define NFS_INO_INVALID_OTHER BIT(12) /* other attrs are invalid */
226+#define NFS_INO_DATA_INVAL_DEFER \
227+ BIT(13) /* Deferred cache invalidation */
226228
227229 #define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \
228230 | NFS_INO_INVALID_CTIME \
include/linux/nfs_fs_sb.h+1−0
@@ -58,6 +58,7 @@ struct nfs_client { · 57 unmodified lines
5858 struct nfs_subversion * cl_nfs_mod; /* pointer to nfs version module */
5959
6060 u32 cl_minorversion;/* NFSv4 minorversion */
61+ unsigned int cl_nconnect; /* Number of connections */
6162 const char * cl_principal; /* used for machine cred */
6263
6364 #if IS_ENABLED(CONFIG_NFS_V4)
include/linux/node.h+2−12
@@ -137,10 +137,7 @@ static inline int register_one_node(int nid) · 136 unmodified lines
137137 extern void unregister_one_node(int nid);
138138 extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
139139 extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
140−extern int register_mem_sect_under_node(struct memory_block *mem_blk,
141− void *arg);
142−extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
143− unsigned long phys_index);
140+extern void unregister_memory_block_under_nodes(struct memory_block *mem_blk);
144141
145142 extern int register_memory_node_under_compute_node(unsigned int mem_nid,
146143 unsigned int cpu_nid,
@@ -171,15 +168,8 @@ static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) · 24 unmodified lines
171168 {
172169 return 0;
173170 }
174−static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
175− void *arg)
171+static inline void unregister_memory_block_under_nodes(struct memory_block *mem_blk)
176172 {
177− return 0;
178−}
179−static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
180− unsigned long phys_index)
181−{
182− return 0;
183173 }
184174
185175 static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
include/linux/ntb.h+197−3
@@ -58,9 +58,11 @@ · 57 unmodified lines
5858
5959 #include <linux/completion.h>
6060 #include <linux/device.h>
61+#include <linux/interrupt.h>
6162
6263 struct ntb_client;
6364 struct ntb_dev;
65+struct ntb_msi;
6466 struct pci_dev;
6567
6668 /**
@@ -205,7 +207,7 @@ static inline int ntb_ctx_ops_is_valid(const struct ntb_ctx_ops *ops) · 138 unmodified lines
205207 }
206208
207209 /**
208− * struct ntb_ctx_ops - ntb device operations
210+ * struct ntb_dev_ops - ntb device operations
209211 * @port_number: See ntb_port_number().
210212 * @peer_port_count: See ntb_peer_port_count().
211213 * @peer_port_number: See ntb_peer_port_number().
@@ -404,7 +406,7 @@ struct ntb_client { · 192 unmodified lines
404406 #define drv_ntb_client(__drv) container_of((__drv), struct ntb_client, drv)
405407
406408 /**
407− * struct ntb_device - ntb device
409+ * struct ntb_dev - ntb device
408410 * @dev: Linux device object.
409411 * @pdev: PCI device entry of the ntb.
410412 * @topo: Detected topology of the ntb.
@@ -426,6 +428,10 @@ struct ntb_dev { · 15 unmodified lines
426428 spinlock_t ctx_lock;
427429 /* block unregister until device is fully released */
428430 struct completion released;
431+
432+#ifdef CONFIG_NTB_MSI
433+ struct ntb_msi *msi;
434+#endif
429435 };
430436 #define dev_ntb(__dev) container_of((__dev), struct ntb_dev, dev)
431437
@@ -616,7 +622,6 @@ static inline int ntb_port_number(struct ntb_dev *ntb) · 184 unmodified lines
616622
617623 return ntb->ops->port_number(ntb);
618624 }
619−
620625 /**
621626 * ntb_peer_port_count() - get the number of peer device ports
622627 * @ntb: NTB device context.
@@ -653,6 +658,58 @@ static inline int ntb_peer_port_number(struct ntb_dev *ntb, int pidx) · 30 unmodified lines
653658 return ntb->ops->peer_port_number(ntb, pidx);
654659 }
655660
661+/**
662+ * ntb_logical_port_number() - get the logical port number of the local port
663+ * @ntb: NTB device context.
664+ *
665+ * The Logical Port Number is defined to be a unique number for each
666+ * port starting from zero through to the number of ports minus one.
667+ * This is in contrast to the Port Number where each port can be assigned
668+ * any unique physical number by the hardware.
669+ *
670+ * The logical port number is useful for calculating the resource indexes
671+ * used by peers.
672+ *
673+ * Return: the logical port number or negative value indicating an error
674+ */
675+static inline int ntb_logical_port_number(struct ntb_dev *ntb)
676+{
677+ int lport = ntb_port_number(ntb);
678+ int pidx;
679+
680+ if (lport < 0)
681+ return lport;
682+
683+ for (pidx = 0; pidx < ntb_peer_port_count(ntb); pidx++)
684+ if (lport <= ntb_peer_port_number(ntb, pidx))
685+ return pidx;
686+
687+ return pidx;
688+}
689+
690+/**
691+ * ntb_peer_logical_port_number() - get the logical peer port by given index
692+ * @ntb: NTB device context.
693+ * @pidx: Peer port index.
694+ *
695+ * The Logical Port Number is defined to be a unique number for each
696+ * port starting from zero through to the number of ports minus one.
697+ * This is in contrast to the Port Number where each port can be assigned
698+ * any unique physical number by the hardware.
699+ *
700+ * The logical port number is useful for calculating the resource indexes
701+ * used by peers.
702+ *
703+ * Return: the peer's logical port number or negative value indicating an error
704+ */
705+static inline int ntb_peer_logical_port_number(struct ntb_dev *ntb, int pidx)
706+{
707+ if (ntb_peer_port_number(ntb, pidx) < ntb_port_number(ntb))
708+ return pidx;
709+ else
710+ return pidx + 1;
711+}
712+
656713 /**
657714 * ntb_peer_port_idx() - get the peer device port index by given port number
658715 * @ntb: NTB device context.
@@ -1506,4 +1563,141 @@ static inline int ntb_peer_msg_write(struct ntb_dev *ntb, int pidx, int midx, · 847 unmodified lines
15061563 return ntb->ops->peer_msg_write(ntb, pidx, midx, msg);
15071564 }
15081565
1566+/**
1567+ * ntb_peer_resource_idx() - get a resource index for a given peer idx
1568+ * @ntb: NTB device context.
1569+ * @pidx: Peer port index.
1570+ *
1571+ * When constructing a graph of peers, each remote peer must use a different
1572+ * resource index (mw, doorbell, etc) to communicate with each other
1573+ * peer.
1574+ *
1575+ * In a two peer system, this function should always return 0 such that
1576+ * resource 0 points to the remote peer on both ports.
1577+ *
1578+ * In a 5 peer system, this function will return the following matrix
1579+ *
1580+ * pidx \ port 0 1 2 3 4
1581+ * 0 0 0 1 2 3
1582+ * 1 0 1 1 2 3
1583+ * 2 0 1 2 2 3
1584+ * 3 0 1 2 3 3
1585+ *
1586+ * For example, if this function is used to program peer's memory
1587+ * windows, port 0 will program MW 0 on all it's peers to point to itself.
1588+ * port 1 will program MW 0 in port 0 to point to itself and MW 1 on all
1589+ * other ports. etc.
1590+ *
1591+ * For the legacy two host case, ntb_port_number() and ntb_peer_port_number()
1592+ * both return zero and therefore this function will always return zero.
1593+ * So MW 0 on each host would be programmed to point to the other host.
1594+ *
1595+ * Return: the resource index to use for that peer.
1596+ */
1597+static inline int ntb_peer_resource_idx(struct ntb_dev *ntb, int pidx)
1598+{
1599+ int local_port, peer_port;
1600+
1601+ if (pidx >= ntb_peer_port_count(ntb))
1602+ return -EINVAL;
1603+
1604+ local_port = ntb_logical_port_number(ntb);
1605+ peer_port = ntb_peer_logical_port_number(ntb, pidx);
1606+
1607+ if (peer_port < local_port)
1608+ return local_port - 1;
1609+ else
1610+ return local_port;
1611+}
1612+
1613+/**
1614+ * ntb_peer_highest_mw_idx() - get a memory window index for a given peer idx
1615+ * using the highest index memory windows first
1616+ *
1617+ * @ntb: NTB device context.
1618+ * @pidx: Peer port index.
1619+ *
1620+ * Like ntb_peer_resource_idx(), except it returns indexes starting with
1621+ * last memory window index.
1622+ *
1623+ * Return: the resource index to use for that peer.
1624+ */
1625+static inline int ntb_peer_highest_mw_idx(struct ntb_dev *ntb, int pidx)
1626+{
1627+ int ret;
1628+
1629+ ret = ntb_peer_resource_idx(ntb, pidx);
1630+ if (ret < 0)
1631+ return ret;
1632+
1633+ return ntb_mw_count(ntb, pidx) - ret - 1;
1634+}
1635+
1636+struct ntb_msi_desc {
1637+ u32 addr_offset;
1638+ u32 data;
1639+};
1640+
1641+#ifdef CONFIG_NTB_MSI
1642+
1643+int ntb_msi_init(struct ntb_dev *ntb, void (*desc_changed)(void *ctx));
1644+int ntb_msi_setup_mws(struct ntb_dev *ntb);
1645+void ntb_msi_clear_mws(struct ntb_dev *ntb);
1646+int ntbm_msi_request_threaded_irq(struct ntb_dev *ntb, irq_handler_t handler,
1647+ irq_handler_t thread_fn,
1648+ const char *name, void *dev_id,
1649+ struct ntb_msi_desc *msi_desc);
1650+void ntbm_msi_free_irq(struct ntb_dev *ntb, unsigned int irq, void *dev_id);
1651+int ntb_msi_peer_trigger(struct ntb_dev *ntb, int peer,
1652+ struct ntb_msi_desc *desc);
1653+int ntb_msi_peer_addr(struct ntb_dev *ntb, int peer,
1654+ struct ntb_msi_desc *desc,
1655+ phys_addr_t *msi_addr);
1656+
1657+#else /* not CONFIG_NTB_MSI */
1658+
1659+static inline int ntb_msi_init(struct ntb_dev *ntb,
1660+ void (*desc_changed)(void *ctx))
1661+{
1662+ return -EOPNOTSUPP;
1663+}
1664+static inline int ntb_msi_setup_mws(struct ntb_dev *ntb)
1665+{
1666+ return -EOPNOTSUPP;
1667+}
1668+static inline void ntb_msi_clear_mws(struct ntb_dev *ntb) {}
1669+static inline int ntbm_msi_request_threaded_irq(struct ntb_dev *ntb,
1670+ irq_handler_t handler,
1671+ irq_handler_t thread_fn,
1672+ const char *name, void *dev_id,
1673+ struct ntb_msi_desc *msi_desc)
1674+{
1675+ return -EOPNOTSUPP;
1676+}
1677+static inline void ntbm_msi_free_irq(struct ntb_dev *ntb, unsigned int irq,
1678+ void *dev_id) {}
1679+static inline int ntb_msi_peer_trigger(struct ntb_dev *ntb, int peer,
1680+ struct ntb_msi_desc *desc)
1681+{
1682+ return -EOPNOTSUPP;
1683+}
1684+static inline int ntb_msi_peer_addr(struct ntb_dev *ntb, int peer,
1685+ struct ntb_msi_desc *desc,
1686+ phys_addr_t *msi_addr)
1687+{
1688+ return -EOPNOTSUPP;
1689+
1690+}
1691+
1692+#endif /* CONFIG_NTB_MSI */
1693+
1694+static inline int ntbm_msi_request_irq(struct ntb_dev *ntb,
1695+ irq_handler_t handler,
1696+ const char *name, void *dev_id,
1697+ struct ntb_msi_desc *msi_desc)
1698+{
1699+ return ntbm_msi_request_threaded_irq(ntb, handler, NULL, name,
1700+ dev_id, msi_desc);
1701+}
1702+
15091703 #endif
include/linux/nvme-fc-driver.h+6−0
@@ -791,6 +791,11 @@ struct nvmet_fc_target_port { · 790 unmodified lines
791791 * nvmefc_tgt_fcp_req.
792792 * Entrypoint is Optional.
793793 *
794+ * @discovery_event: Called by the transport to generate an RSCN
795+ * change notifications to NVME initiators. The RSCN notifications
796+ * should cause the initiator to rescan the discovery controller
797+ * on the targetport.
798+ *
794799 * @max_hw_queues: indicates the maximum number of hw queues the LLDD
795800 * supports for cpu affinitization.
796801 * Value is Mandatory. Must be at least 1.
@@ -832,6 +837,7 @@ struct nvmet_fc_target_template { · 35 unmodified lines
832837 struct nvmefc_tgt_fcp_req *fcpreq);
833838 void (*defer_rcv)(struct nvmet_fc_target_port *tgtport,
834839 struct nvmefc_tgt_fcp_req *fcpreq);
840+ void (*discovery_event)(struct nvmet_fc_target_port *tgtport);
835841
836842 u32 max_hw_queues;
837843 u16 max_sgl_segments;
include/linux/nvme.h+74−4
@@ -315,7 +315,7 @@ struct nvme_id_ns { · 314 unmodified lines
315315 __u8 nmic;
316316 __u8 rescap;
317317 __u8 fpi;
318− __u8 rsvd33;
318+ __u8 dlfeat;
319319 __le16 nawun;
320320 __le16 nawupf;
321321 __le16 nacwu;
@@ -324,11 +324,17 @@ struct nvme_id_ns { · 2 unmodified lines
324324 __le16 nabspf;
325325 __le16 noiob;
326326 __u8 nvmcap[16];
327− __u8 rsvd64[28];
327+ __le16 npwg;
328+ __le16 npwa;
329+ __le16 npdg;
330+ __le16 npda;
331+ __le16 nows;
332+ __u8 rsvd74[18];
328333 __le32 anagrpid;
329334 __u8 rsvd96[3];
330335 __u8 nsattr;
331− __u8 rsvd100[4];
336+ __le16 nvmsetid;
337+ __le16 endgid;
332338 __u8 nguid[16];
333339 __u8 eui64[8];
334340 struct nvme_lbaf lbaf[16];
@@ -562,6 +568,22 @@ enum nvme_opcode { · 227 unmodified lines
562568 nvme_cmd_resv_release = 0x15,
563569 };
564570
571+#define nvme_opcode_name(opcode) { opcode, #opcode }
572+#define show_nvm_opcode_name(val) \
573+ __print_symbolic(val, \
574+ nvme_opcode_name(nvme_cmd_flush), \
575+ nvme_opcode_name(nvme_cmd_write), \
576+ nvme_opcode_name(nvme_cmd_read), \
577+ nvme_opcode_name(nvme_cmd_write_uncor), \
578+ nvme_opcode_name(nvme_cmd_compare), \
579+ nvme_opcode_name(nvme_cmd_write_zeroes), \
580+ nvme_opcode_name(nvme_cmd_dsm), \
581+ nvme_opcode_name(nvme_cmd_resv_register), \
582+ nvme_opcode_name(nvme_cmd_resv_report), \
583+ nvme_opcode_name(nvme_cmd_resv_acquire), \
584+ nvme_opcode_name(nvme_cmd_resv_release))
585+
586+
565587 /*
566588 * Descriptor subtype - lower 4 bits of nvme_(keyed_)sgl_desc identifier
567589 *
@@ -794,6 +816,32 @@ enum nvme_admin_opcode { · 226 unmodified lines
794816 nvme_admin_sanitize_nvm = 0x84,
795817 };
796818
819+#define nvme_admin_opcode_name(opcode) { opcode, #opcode }
820+#define show_admin_opcode_name(val) \
821+ __print_symbolic(val, \
822+ nvme_admin_opcode_name(nvme_admin_delete_sq), \
823+ nvme_admin_opcode_name(nvme_admin_create_sq), \
824+ nvme_admin_opcode_name(nvme_admin_get_log_page), \
825+ nvme_admin_opcode_name(nvme_admin_delete_cq), \
826+ nvme_admin_opcode_name(nvme_admin_create_cq), \
827+ nvme_admin_opcode_name(nvme_admin_identify), \
828+ nvme_admin_opcode_name(nvme_admin_abort_cmd), \
829+ nvme_admin_opcode_name(nvme_admin_set_features), \
830+ nvme_admin_opcode_name(nvme_admin_get_features), \
831+ nvme_admin_opcode_name(nvme_admin_async_event), \
832+ nvme_admin_opcode_name(nvme_admin_ns_mgmt), \
833+ nvme_admin_opcode_name(nvme_admin_activate_fw), \
834+ nvme_admin_opcode_name(nvme_admin_download_fw), \
835+ nvme_admin_opcode_name(nvme_admin_ns_attach), \
836+ nvme_admin_opcode_name(nvme_admin_keep_alive), \
837+ nvme_admin_opcode_name(nvme_admin_directive_send), \
838+ nvme_admin_opcode_name(nvme_admin_directive_recv), \
839+ nvme_admin_opcode_name(nvme_admin_dbbuf), \
840+ nvme_admin_opcode_name(nvme_admin_format_nvm), \
841+ nvme_admin_opcode_name(nvme_admin_security_send), \
842+ nvme_admin_opcode_name(nvme_admin_security_recv), \
843+ nvme_admin_opcode_name(nvme_admin_sanitize_nvm))
844+
797845 enum {
798846 NVME_QUEUE_PHYS_CONTIG = (1 << 0),
799847 NVME_CQ_IRQ_ENABLED = (1 << 1),
@@ -1008,6 +1056,23 @@ enum nvmf_capsule_command { · 208 unmodified lines
10081056 nvme_fabrics_type_property_get = 0x04,
10091057 };
10101058
1059+#define nvme_fabrics_type_name(type) { type, #type }
1060+#define show_fabrics_type_name(type) \
1061+ __print_symbolic(type, \
1062+ nvme_fabrics_type_name(nvme_fabrics_type_property_set), \
1063+ nvme_fabrics_type_name(nvme_fabrics_type_connect), \
1064+ nvme_fabrics_type_name(nvme_fabrics_type_property_get))
1065+
1066+/*
1067+ * If not fabrics command, fctype will be ignored.
1068+ */
1069+#define show_opcode_name(qid, opcode, fctype) \
1070+ ((opcode) == nvme_fabrics_command ? \
1071+ show_fabrics_type_name(fctype) : \
1072+ ((qid) ? \
1073+ show_nvm_opcode_name(opcode) : \
1074+ show_admin_opcode_name(opcode)))
1075+
10111076 struct nvmf_common_command {
10121077 __u8 opcode;
10131078 __u8 resv1;
@@ -1165,6 +1230,11 @@ struct nvme_command { · 151 unmodified lines
11651230 };
11661231 };
11671232
1233+static inline bool nvme_is_fabrics(struct nvme_command *cmd)
1234+{
1235+ return cmd->common.opcode == nvme_fabrics_command;
1236+}
1237+
11681238 struct nvme_error_slot {
11691239 __le64 error_count;
11701240 __le16 sqid;
@@ -1186,7 +1256,7 @@ static inline bool nvme_is_write(struct nvme_command *cmd) · 15 unmodified lines
11861256 *
11871257 * Why can't we simply have a Fabrics In and Fabrics out command?
11881258 */
1189− if (unlikely(cmd->common.opcode == nvme_fabrics_command))
1259+ if (unlikely(nvme_is_fabrics(cmd)))
11901260 return cmd->fabrics.fctype & 1;
11911261 return cmd->common.opcode & 1;
11921262 }
include/linux/of.h+1−1
@@ -1164,7 +1164,7 @@ static inline int of_property_read_string_index(const struct device_node *np, · 1163 unmodified lines
11641164 }
11651165
11661166 /**
1167− * of_property_read_bool - Findfrom a property
1167+ * of_property_read_bool - Find a property
11681168 * @np: device node from which the property value is to be read.
11691169 * @propname: name of the property to be searched.
11701170 *
include/linux/of_fdt.h+0−11
@@ -23,15 +23,6 @@ · 22 unmodified lines
2323 struct device_node;
2424
2525 /* For scanning an arbitrary device-tree at any time */
26−extern char *of_fdt_get_string(const void *blob, u32 offset);
27−extern void *of_fdt_get_property(const void *blob,
28− unsigned long node,
29− const char *name,
30− int *size);
31−extern bool of_fdt_is_big_endian(const void *blob,
32− unsigned long node);
33−extern int of_fdt_match(const void *blob, unsigned long node,
34− const char *const *compat);
3526 extern void *of_fdt_unflatten_tree(const unsigned long *blob,
3627 struct device_node *dad,
3728 struct device_node **mynodes);
@@ -64,9 +55,7 @@ extern int of_get_flat_dt_subnode_by_name(unsigned long node, · 26 unmodified lines
6455 extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
6556 int *size);
6657 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
67−extern int of_flat_dt_match(unsigned long node, const char *const *matches);
6858 extern unsigned long of_get_flat_dt_root(void);
69−extern int of_get_flat_dt_size(void);
7059 extern uint32_t of_get_flat_dt_phandle(unsigned long node);
7160
7261 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
include/linux/olpc-ec.h+34−3
@@ -2,6 +2,8 @@ · 1 unmodified line
22 #ifndef _LINUX_OLPC_EC_H
33 #define _LINUX_OLPC_EC_H
44
5+#include <linux/bits.h>
6+
57 /* XO-1 EC commands */
68 #define EC_FIRMWARE_REV 0x08
79 #define EC_WRITE_SCI_MASK 0x1b
@@ -16,28 +18,57 @@ · 8 unmodified lines
1618 #define EC_SCI_QUERY 0x84
1719 #define EC_EXT_SCI_QUERY 0x85
1820
21+/* SCI source values */
22+#define EC_SCI_SRC_GAME BIT(0)
23+#define EC_SCI_SRC_BATTERY BIT(1)
24+#define EC_SCI_SRC_BATSOC BIT(2)
25+#define EC_SCI_SRC_BATERR BIT(3)
26+#define EC_SCI_SRC_EBOOK BIT(4) /* XO-1 only */
27+#define EC_SCI_SRC_WLAN BIT(5) /* XO-1 only */
28+#define EC_SCI_SRC_ACPWR BIT(6)
29+#define EC_SCI_SRC_BATCRIT BIT(7)
30+#define EC_SCI_SRC_GPWAKE BIT(8) /* XO-1.5 only */
31+#define EC_SCI_SRC_ALL GENMASK(8, 0)
32+
1933 struct platform_device;
2034
2135 struct olpc_ec_driver {
22− int (*probe)(struct platform_device *);
2336 int (*suspend)(struct platform_device *);
2437 int (*resume)(struct platform_device *);
2538
2639 int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *);
40+
41+ bool wakeup_available;
2742 };
2843
29−#ifdef CONFIG_OLPC
44+#ifdef CONFIG_OLPC_EC
3045
3146 extern void olpc_ec_driver_register(struct olpc_ec_driver *drv, void *arg);
3247
3348 extern int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,
3449 size_t outlen);
3550
51+extern void olpc_ec_wakeup_set(u16 value);
52+extern void olpc_ec_wakeup_clear(u16 value);
53+
54+extern int olpc_ec_mask_write(u16 bits);
55+extern int olpc_ec_sci_query(u16 *sci_value);
56+
57+extern bool olpc_ec_wakeup_available(void);
58+
3659 #else
3760
3861 static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,
3962 size_t outlen) { return -ENODEV; }
4063
41−#endif /* CONFIG_OLPC */
64+static inline void olpc_ec_wakeup_set(u16 value) { }
65+static inline void olpc_ec_wakeup_clear(u16 value) { }
66+
67+static inline bool olpc_ec_wakeup_available(void)
68+{
69+ return false;
70+}
71+
72+#endif /* CONFIG_OLPC_EC */
4273
4374 #endif /* _LINUX_OLPC_EC_H */
include/linux/omap-mailbox.h+3−1
@@ -6,7 +6,9 @@ · 5 unmodified lines
66 #ifndef OMAP_MAILBOX_H
77 #define OMAP_MAILBOX_H
88
9−typedef u32 mbox_msg_t;
9+typedef uintptr_t mbox_msg_t;
10+
11+#define omap_mbox_message(data) (u32)(mbox_msg_t)(data)
1012
1113 typedef int __bitwise omap_mbox_irq_t;
1214 #define IRQ_TX ((__force omap_mbox_irq_t) 1)
include/linux/oom.h+0−1
@@ -108,7 +108,6 @@ static inline vm_fault_t check_stable_address_space(struct mm_struct *mm) · 107 unmodified lines
108108 bool __oom_reap_task_mm(struct mm_struct *mm);
109109
110110 extern unsigned long oom_badness(struct task_struct *p,
111− struct mem_cgroup *memcg, const nodemask_t *nodemask,
112111 unsigned long totalpages);
113112
114113 extern bool out_of_memory(struct oom_control *oc);
include/linux/page-flags-layout.h+11−7
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232
3333 #endif /* CONFIG_SPARSEMEM */
3434
35+#ifndef BUILD_VDSO32_64
3536 /*
3637 * page->flags layout:
3738 *
@@ -76,20 +77,22 @@ · 38 unmodified lines
7677 #define LAST_CPUPID_SHIFT 0
7778 #endif
7879
79−#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
80+#ifdef CONFIG_KASAN_SW_TAGS
81+#define KASAN_TAG_WIDTH 8
82+#else
83+#define KASAN_TAG_WIDTH 0
84+#endif
85+
86+#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT+KASAN_TAG_WIDTH \
87+ <= BITS_PER_LONG - NR_PAGEFLAGS
8088 #define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT
8189 #else
8290 #define LAST_CPUPID_WIDTH 0
8391 #endif
8492
85−#ifdef CONFIG_KASAN_SW_TAGS
86−#define KASAN_TAG_WIDTH 8
8793 #if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH+LAST_CPUPID_WIDTH+KASAN_TAG_WIDTH \
8894 > BITS_PER_LONG - NR_PAGEFLAGS
89−#error "KASAN: not enough bits in page flags for tag"
90−#endif
91−#else
92−#define KASAN_TAG_WIDTH 0
95+#error "Not enough bits in page flags"
9396 #endif
9497
9598 /*
@@ -104,4 +107,5 @@ · 8 unmodified lines
104107 #define LAST_CPUPID_NOT_IN_PAGE_FLAGS
105108 #endif
106109
110+#endif
107111 #endif /* _LINUX_PAGE_FLAGS_LAYOUT */
include/linux/page-flags.h+10−0
@@ -152,6 +152,8 @@ enum pageflags { · 151 unmodified lines
152152 PG_savepinned = PG_dirty,
153153 /* Has a grant mapping of another (foreign) domain's page. */
154154 PG_foreign = PG_owner_priv_1,
155+ /* Remapped by swiotlb-xen. */
156+ PG_xen_remapped = PG_owner_priv_1,
155157
156158 /* SLOB */
157159 PG_slob_free = PG_private,
@@ -329,6 +331,8 @@ PAGEFLAG(Pinned, pinned, PF_NO_COMPOUND) · 171 unmodified lines
329331 TESTSCFLAG(Pinned, pinned, PF_NO_COMPOUND)
330332 PAGEFLAG(SavePinned, savepinned, PF_NO_COMPOUND);
331333 PAGEFLAG(Foreign, foreign, PF_NO_COMPOUND);
334+PAGEFLAG(XenRemapped, xen_remapped, PF_NO_COMPOUND)
335+ TESTCLEARFLAG(XenRemapped, xen_remapped, PF_NO_COMPOUND)
332336
333337 PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
334338 __CLEARPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
@@ -703,6 +707,7 @@ PAGEFLAG_FALSE(DoubleMap) · 368 unmodified lines
703707 #define PG_offline 0x00000100
704708 #define PG_kmemcg 0x00000200
705709 #define PG_table 0x00000400
710+#define PG_guard 0x00000800
706711
707712 #define PageType(page, flag) \
708713 ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE)
@@ -754,6 +759,11 @@ PAGE_TYPE_OPS(Kmemcg, kmemcg) · 45 unmodified lines
754759 */
755760 PAGE_TYPE_OPS(Table, table)
756761
762+/*
763+ * Marks guardpages used with debug_pagealloc.
764+ */
765+PAGE_TYPE_OPS(Guard, guard)
766+
757767 extern bool is_free_buddy_page(struct page *page);

2 more lines aren’t shown here.

include/linux/page-isolation.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/page_ext.h+0−1

This diff is large: its 8 lines aren’t shown here.

include/linux/pagemap.h+4−2

This diff is large: its 20 lines aren’t shown here.

include/linux/pci-acpi.h+4−3

This diff is large: its 14 lines aren’t shown here.

include/linux/pci-aspm.h+4−3

This diff is large: its 16 lines aren’t shown here.

include/linux/pci.h+60−2

This diff is large: its 111 lines aren’t shown here.

include/linux/pci_ids.h+5−3

This diff is large: its 43 lines aren’t shown here.

include/linux/percpu-refcount.h+9−1

This diff is large: its 31 lines aren’t shown here.

include/linux/percpu-rwsem.h+9−5

This diff is large: its 40 lines aren’t shown here.

include/linux/perf/arm_pmu.h+2−0

This diff is large: its 7 lines aren’t shown here.

include/linux/perf_event.h+11−0

This diff is large: its 32 lines aren’t shown here.

include/linux/pfn_t.h+2−9

This diff is large: its 32 lines aren’t shown here.

include/linux/phy.h+13−12

This diff is large: its 109 lines aren’t shown here.

include/linux/phylink.h+46−22

This diff is large: its 157 lines aren’t shown here.

include/linux/pid.h+6−2

This diff is large: its 32 lines aren’t shown here.

include/linux/pinctrl/pinconf-generic.h+9−14

This diff is large: its 64 lines aren’t shown here.

include/linux/pinctrl/pinconf.h+1−3

This diff is large: its 16 lines aren’t shown here.

include/linux/pinctrl/pinctrl-state.h+5−0

This diff is large: its 16 lines aren’t shown here.

include/linux/pinctrl/pinctrl.h+5−14

This diff is large: its 53 lines aren’t shown here.

include/linux/pinctrl/pinmux.h+0−4

This diff is large: its 16 lines aren’t shown here.

include/linux/platform_data/dma-imx.h+0−1

This diff is large: its 8 lines aren’t shown here.

include/linux/platform_data/fsa9480.h+0−24

This diff is large: its 25 lines aren’t shown here.

include/linux/platform_data/gpio-omap.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/platform_data/i2c-mux-gpio.h+0−7

This diff is large: its 21 lines aren’t shown here.

include/linux/platform_data/keypad-w90p910.h+0−16

This diff is large: its 17 lines aren’t shown here.

include/linux/platform_data/media/mmp-camera.h+0−4

This diff is large: its 12 lines aren’t shown here.

include/linux/platform_data/spi-mt65xx.h+0−2

This diff is large: its 9 lines aren’t shown here.

include/linux/platform_data/ti-sysc.h+12−0

This diff is large: its 36 lines aren’t shown here.

include/linux/platform_data/video-clcd-versatile.h+0−28

This diff is large: its 29 lines aren’t shown here.

include/linux/platform_data/wilco-ec.h+87−7

This diff is large: its 134 lines aren’t shown here.

include/linux/platform_data/x86/asus-wmi.h+3−2

This diff is large: its 19 lines aren’t shown here.

include/linux/platform_data/xilinx-ll-temac.h+2−1

This diff is large: its 17 lines aren’t shown here.

include/linux/platform_device.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/pm.h+1−2

This diff is large: its 17 lines aren’t shown here.

include/linux/pm_opp.h+4−4

This diff is large: its 26 lines aren’t shown here.

include/linux/pm_qos.h+37−11

This diff is large: its 117 lines aren’t shown here.

include/linux/pm_wakeup.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/poison.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/power_supply.h+15−0

This diff is large: its 27 lines aren’t shown here.

include/linux/proc_fs.h+9−0

This diff is large: its 16 lines aren’t shown here.

include/linux/processor.h+0−9

This diff is large: its 16 lines aren’t shown here.

include/linux/property.h+95−0

This diff is large: its 124 lines aren’t shown here.

include/linux/pseudo_fs.h+16−0

This diff is large: its 17 lines aren’t shown here.

include/linux/ptp_clock_kernel.h+8−0

This diff is large: its 15 lines aren’t shown here.

include/linux/ptrace.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/pwm.h+14−2

This diff is large: its 42 lines aren’t shown here.

include/linux/qed/qed_if.h+9−1

This diff is large: its 24 lines aren’t shown here.

include/linux/qed/qed_rdma_if.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/linux/ramfs.h+0−1

This diff is large: its 8 lines aren’t shown here.

include/linux/rbtree.h+46−24

This diff is large: its 99 lines aren’t shown here.

include/linux/rbtree_augmented.h+10−17

This diff is large: its 77 lines aren’t shown here.

include/linux/rcu_sync.h+11−29

This diff is large: its 74 lines aren’t shown here.

include/linux/rcupdate.h+12−9

This diff is large: its 55 lines aren’t shown here.

include/linux/regmap.h+22−2

This diff is large: its 59 lines aren’t shown here.

include/linux/regulator/coupler.h+97−0

This diff is large: its 98 lines aren’t shown here.

include/linux/regulator/driver.h+9−3

This diff is large: its 45 lines aren’t shown here.

include/linux/regulator/machine.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/regulator/max8952.h+0−3

This diff is large: its 10 lines aren’t shown here.

include/linux/remoteproc.h+26−6

This diff is large: its 67 lines aren’t shown here.

include/linux/reservation.h+6−2

This diff is large: its 15 lines aren’t shown here.

include/linux/rhashtable.h+18−18

This diff is large: its 81 lines aren’t shown here.

include/linux/rwsem.h+10−8

This diff is large: its 56 lines aren’t shown here.

include/linux/scatterlist.h+7−4

This diff is large: its 28 lines aren’t shown here.

include/linux/sched.h+91−9

This diff is large: its 188 lines aren’t shown here.

include/linux/sched/isolation.h+6−0

This diff is large: its 20 lines aren’t shown here.

include/linux/sched/nohz.h+0−8

This diff is large: its 15 lines aren’t shown here.

include/linux/sched/numa_balancing.h+2−2

This diff is large: its 18 lines aren’t shown here.

include/linux/sched/signal.h+21−10

This diff is large: its 90 lines aren’t shown here.

include/linux/sched/sysctl.h+11−0

This diff is large: its 25 lines aren’t shown here.

include/linux/sched/task.h+17−1

This diff is large: its 37 lines aren’t shown here.

include/linux/sched/topology.h+3−22

This diff is large: its 60 lines aren’t shown here.

include/linux/sched/user.h+0−14

This diff is large: its 28 lines aren’t shown here.

include/linux/sched/wake_q.h+5−0

This diff is large: its 12 lines aren’t shown here.

include/linux/scmi_protocol.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/security.h+6−6

This diff is large: its 34 lines aren’t shown here.

include/linux/sed-opal.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/linux/seq_file.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/serial_8250.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/serial_core.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/sfp.h+8−4

This diff is large: its 44 lines aren’t shown here.

include/linux/signal.h+0−4

This diff is large: its 11 lines aren’t shown here.

include/linux/siox.h+10−0

This diff is large: its 14 lines aren’t shown here.

include/linux/sizes.h+1−0

This diff is large: its 7 lines aren’t shown here.

include/linux/skbuff.h+23−5

This diff is large: its 70 lines aren’t shown here.

include/linux/skmsg.h+7−1

This diff is large: its 15 lines aren’t shown here.

include/linux/slab.h+11−5

This diff is large: its 53 lines aren’t shown here.

include/linux/smp.h+34−18

This diff is large: its 90 lines aren’t shown here.

include/linux/soc/qcom/mdt_loader.h+2−0

This diff is large: its 7 lines aren’t shown here.

include/linux/soc/ti/ti_sci_protocol.h+260−14

This diff is large: its 310 lines aren’t shown here.

include/linux/socket.h+7−0

This diff is large: its 21 lines aren’t shown here.

include/linux/soundwire/sdw.h+69−19

This diff is large: its 164 lines aren’t shown here.

include/linux/soundwire/sdw_type.h+11−0

This diff is large: its 16 lines aren’t shown here.

include/linux/spi/spi.h+37−0

This diff is large: its 89 lines aren’t shown here.

include/linux/srcutree.h+11−3

This diff is large: its 21 lines aren’t shown here.

include/linux/stmmac.h+1−5

This diff is large: its 23 lines aren’t shown here.

include/linux/stop_machine.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/string_helpers.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/linux/sudmac.h+0−49

This diff is large: its 50 lines aren’t shown here.

include/linux/sunrpc/bc_xprt.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/sunrpc/clnt.h+4−0

This diff is large: its 25 lines aren’t shown here.

include/linux/sunrpc/metrics.h+6−1

This diff is large: its 21 lines aren’t shown here.

include/linux/sunrpc/sched.h+3−1

This diff is large: its 19 lines aren’t shown here.

include/linux/sunrpc/xdr.h+7−0

This diff is large: its 14 lines aren’t shown here.

include/linux/sunrpc/xprt.h+8−2

This diff is large: its 38 lines aren’t shown here.

include/linux/sunrpc/xprtmultipath.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/linux/sunrpc/xprtsock.h+5−0

This diff is large: its 19 lines aren’t shown here.

include/linux/suspend.h+3−2

This diff is large: its 26 lines aren’t shown here.

include/linux/swap.h+12−6

This diff is large: its 61 lines aren’t shown here.

include/linux/swapops.h+3−17

This diff is large: its 58 lines aren’t shown here.

include/linux/syscalls.h+8−3

This diff is large: its 46 lines aren’t shown here.

include/linux/sysctl.h+7−0

This diff is large: its 14 lines aren’t shown here.

include/linux/sysfs.h+8−0

This diff is large: its 22 lines aren’t shown here.

include/linux/tcp.h+3−6

This diff is large: its 30 lines aren’t shown here.

include/linux/thermal.h+2−2

This diff is large: its 18 lines aren’t shown here.

include/linux/timekeeping.h+30−2

This diff is large: its 50 lines aren’t shown here.

include/linux/timer.h+19−8

This diff is large: its 39 lines aren’t shown here.

include/linux/topology.h+6−0

This diff is large: its 20 lines aren’t shown here.

include/linux/torture.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/tpm_eventlog.h+152−0

This diff is large: its 157 lines aren’t shown here.

include/linux/trace_events.h+9−0

This diff is large: its 23 lines aren’t shown here.

include/linux/tracehook.h+13−3

This diff is large: its 57 lines aren’t shown here.

include/linux/types.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/uaccess.h+19−1

This diff is large: its 41 lines aren’t shown here.

include/linux/uio.h+3−11

This diff is large: its 47 lines aren’t shown here.

include/linux/unicode.h+3−0

This diff is large: its 10 lines aren’t shown here.

include/linux/usb.h+2−0

This diff is large: its 16 lines aren’t shown here.

include/linux/usb/chipidea.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/usb/gadget.h+2−1

This diff is large: its 10 lines aren’t shown here.

include/linux/usb/hcd.h+5−1

This diff is large: its 27 lines aren’t shown here.

include/linux/usb/renesas_usbhs.h+6−33

This diff is large: its 81 lines aren’t shown here.

include/linux/usb/typec_mux.h+28−34

This diff is large: its 83 lines aren’t shown here.

include/linux/user_namespace.h+11−1

This diff is large: its 22 lines aren’t shown here.

include/linux/vmalloc.h+2−0

This diff is large: its 13 lines aren’t shown here.

include/linux/vmpressure.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/vmw_vmci_defs.h+20−21

This diff is large: its 86 lines aren’t shown here.

include/linux/wait.h+13−0

This diff is large: its 20 lines aren’t shown here.

include/linux/wanrouter.h+0−11

This diff is large: its 12 lines aren’t shown here.

include/linux/wmi.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/linux/workqueue.h+0−4

This diff is large: its 11 lines aren’t shown here.

include/linux/writeback.h+34−7

This diff is large: its 79 lines aren’t shown here.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t