diff options
Diffstat (limited to 'include')
559 files changed, 17356 insertions, 7522 deletions
diff --git a/include/Kbuild b/include/Kbuild new file mode 100644 index 000000000000..7e9f1acb9dd5 --- /dev/null +++ b/include/Kbuild | |||
| @@ -0,0 +1,1270 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 2 | |||
| 3 | # Add header-test-$(CONFIG_...) guard to headers that are only compiled | ||
| 4 | # for particular architectures. | ||
| 5 | # | ||
| 6 | # Headers listed in header-test- are excluded from the test coverage. | ||
| 7 | # Many headers are excluded for now because they fail to build. Please | ||
| 8 | # consider to fix headers first before adding new ones to the blacklist. | ||
| 9 | # | ||
| 10 | # Sorted alphabetically. | ||
| 11 | header-test- += acpi/acbuffer.h | ||
| 12 | header-test- += acpi/acpi.h | ||
| 13 | header-test- += acpi/acpi_bus.h | ||
| 14 | header-test- += acpi/acpi_drivers.h | ||
| 15 | header-test- += acpi/acpi_io.h | ||
| 16 | header-test- += acpi/acpi_lpat.h | ||
| 17 | header-test- += acpi/acpiosxf.h | ||
| 18 | header-test- += acpi/acpixf.h | ||
| 19 | header-test- += acpi/acrestyp.h | ||
| 20 | header-test- += acpi/actbl.h | ||
| 21 | header-test- += acpi/actbl1.h | ||
| 22 | header-test- += acpi/actbl2.h | ||
| 23 | header-test- += acpi/actbl3.h | ||
| 24 | header-test- += acpi/actypes.h | ||
| 25 | header-test- += acpi/battery.h | ||
| 26 | header-test- += acpi/cppc_acpi.h | ||
| 27 | header-test- += acpi/nfit.h | ||
| 28 | header-test- += acpi/platform/acenv.h | ||
| 29 | header-test- += acpi/platform/acenvex.h | ||
| 30 | header-test- += acpi/platform/acintel.h | ||
| 31 | header-test- += acpi/platform/aclinux.h | ||
| 32 | header-test- += acpi/platform/aclinuxex.h | ||
| 33 | header-test- += acpi/processor.h | ||
| 34 | header-test- += clocksource/hyperv_timer.h | ||
| 35 | header-test- += clocksource/timer-sp804.h | ||
| 36 | header-test- += crypto/cast_common.h | ||
| 37 | header-test- += crypto/internal/cryptouser.h | ||
| 38 | header-test- += crypto/pkcs7.h | ||
| 39 | header-test- += crypto/poly1305.h | ||
| 40 | header-test- += crypto/sha3.h | ||
| 41 | header-test- += drm/ati_pcigart.h | ||
| 42 | header-test- += drm/bridge/dw_hdmi.h | ||
| 43 | header-test- += drm/bridge/dw_mipi_dsi.h | ||
| 44 | header-test- += drm/drm_audio_component.h | ||
| 45 | header-test- += drm/drm_auth.h | ||
| 46 | header-test- += drm/drm_debugfs.h | ||
| 47 | header-test- += drm/drm_debugfs_crc.h | ||
| 48 | header-test- += drm/drm_displayid.h | ||
| 49 | header-test- += drm/drm_encoder_slave.h | ||
| 50 | header-test- += drm/drm_fb_cma_helper.h | ||
| 51 | header-test- += drm/drm_fb_helper.h | ||
| 52 | header-test- += drm/drm_fixed.h | ||
| 53 | header-test- += drm/drm_format_helper.h | ||
| 54 | header-test- += drm/drm_lease.h | ||
| 55 | header-test- += drm/drm_legacy.h | ||
| 56 | header-test- += drm/drm_panel.h | ||
| 57 | header-test- += drm/drm_plane_helper.h | ||
| 58 | header-test- += drm/drm_rect.h | ||
| 59 | header-test- += drm/i915_component.h | ||
| 60 | header-test- += drm/intel-gtt.h | ||
| 61 | header-test- += drm/tinydrm/tinydrm-helpers.h | ||
| 62 | header-test- += drm/ttm/ttm_debug.h | ||
| 63 | header-test- += keys/asymmetric-parser.h | ||
| 64 | header-test- += keys/asymmetric-subtype.h | ||
| 65 | header-test- += keys/asymmetric-type.h | ||
| 66 | header-test- += keys/big_key-type.h | ||
| 67 | header-test- += keys/request_key_auth-type.h | ||
| 68 | header-test- += keys/trusted.h | ||
| 69 | header-test- += kvm/arm_arch_timer.h | ||
| 70 | header-test- += kvm/arm_pmu.h | ||
| 71 | header-test-$(CONFIG_ARM) += kvm/arm_psci.h | ||
| 72 | header-test-$(CONFIG_ARM64) += kvm/arm_psci.h | ||
| 73 | header-test- += kvm/arm_vgic.h | ||
| 74 | header-test- += linux/8250_pci.h | ||
| 75 | header-test- += linux/a.out.h | ||
| 76 | header-test- += linux/adxl.h | ||
| 77 | header-test- += linux/agpgart.h | ||
| 78 | header-test- += linux/alcor_pci.h | ||
| 79 | header-test- += linux/amba/clcd.h | ||
| 80 | header-test- += linux/amba/pl080.h | ||
| 81 | header-test- += linux/amd-iommu.h | ||
| 82 | header-test-$(CONFIG_ARM) += linux/arm-cci.h | ||
| 83 | header-test-$(CONFIG_ARM64) += linux/arm-cci.h | ||
| 84 | header-test- += linux/arm_sdei.h | ||
| 85 | header-test- += linux/asn1_decoder.h | ||
| 86 | header-test- += linux/ata_platform.h | ||
| 87 | header-test- += linux/ath9k_platform.h | ||
| 88 | header-test- += linux/atm_tcp.h | ||
| 89 | header-test- += linux/atomic-fallback.h | ||
| 90 | header-test- += linux/avf/virtchnl.h | ||
| 91 | header-test- += linux/bcm47xx_sprom.h | ||
| 92 | header-test- += linux/bcma/bcma_driver_gmac_cmn.h | ||
| 93 | header-test- += linux/bcma/bcma_driver_mips.h | ||
| 94 | header-test- += linux/bcma/bcma_driver_pci.h | ||
| 95 | header-test- += linux/bcma/bcma_driver_pcie2.h | ||
| 96 | header-test- += linux/bit_spinlock.h | ||
| 97 | header-test- += linux/blk-mq-rdma.h | ||
| 98 | header-test- += linux/blk-mq.h | ||
| 99 | header-test- += linux/blktrace_api.h | ||
| 100 | header-test- += linux/blockgroup_lock.h | ||
| 101 | header-test- += linux/bma150.h | ||
| 102 | header-test- += linux/bpf_lirc.h | ||
| 103 | header-test- += linux/bpf_types.h | ||
| 104 | header-test- += linux/bsg-lib.h | ||
| 105 | header-test- += linux/bsg.h | ||
| 106 | header-test- += linux/btf.h | ||
| 107 | header-test- += linux/btree-128.h | ||
| 108 | header-test- += linux/btree-type.h | ||
| 109 | header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h | ||
| 110 | header-test- += linux/byteorder/generic.h | ||
| 111 | header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h | ||
| 112 | header-test- += linux/c2port.h | ||
| 113 | header-test- += linux/can/dev/peak_canfd.h | ||
| 114 | header-test- += linux/can/platform/cc770.h | ||
| 115 | header-test- += linux/can/platform/sja1000.h | ||
| 116 | header-test- += linux/ceph/ceph_features.h | ||
| 117 | header-test- += linux/ceph/ceph_frag.h | ||
| 118 | header-test- += linux/ceph/ceph_fs.h | ||
| 119 | header-test- += linux/ceph/debugfs.h | ||
| 120 | header-test- += linux/ceph/msgr.h | ||
| 121 | header-test- += linux/ceph/rados.h | ||
| 122 | header-test- += linux/cgroup_subsys.h | ||
| 123 | header-test- += linux/clk/sunxi-ng.h | ||
| 124 | header-test- += linux/clk/ti.h | ||
| 125 | header-test- += linux/cn_proc.h | ||
| 126 | header-test- += linux/coda_psdev.h | ||
| 127 | header-test- += linux/compaction.h | ||
| 128 | header-test- += linux/console_struct.h | ||
| 129 | header-test- += linux/count_zeros.h | ||
| 130 | header-test- += linux/cs5535.h | ||
| 131 | header-test- += linux/cuda.h | ||
| 132 | header-test- += linux/cyclades.h | ||
| 133 | header-test- += linux/dcookies.h | ||
| 134 | header-test- += linux/delayacct.h | ||
| 135 | header-test- += linux/delayed_call.h | ||
| 136 | header-test- += linux/device-mapper.h | ||
| 137 | header-test- += linux/devpts_fs.h | ||
| 138 | header-test- += linux/dio.h | ||
| 139 | header-test- += linux/dirent.h | ||
| 140 | header-test- += linux/dlm_plock.h | ||
| 141 | header-test- += linux/dm-dirty-log.h | ||
| 142 | header-test- += linux/dm-region-hash.h | ||
| 143 | header-test- += linux/dma-debug.h | ||
| 144 | header-test- += linux/dma/mmp-pdma.h | ||
| 145 | header-test- += linux/dma/sprd-dma.h | ||
| 146 | header-test- += linux/dns_resolver.h | ||
| 147 | header-test- += linux/drbd_genl.h | ||
| 148 | header-test- += linux/drbd_genl_api.h | ||
| 149 | header-test- += linux/dw_apb_timer.h | ||
| 150 | header-test- += linux/dynamic_debug.h | ||
| 151 | header-test- += linux/dynamic_queue_limits.h | ||
| 152 | header-test- += linux/ecryptfs.h | ||
| 153 | header-test- += linux/edma.h | ||
| 154 | header-test- += linux/eeprom_93cx6.h | ||
| 155 | header-test- += linux/efs_vh.h | ||
| 156 | header-test- += linux/elevator.h | ||
| 157 | header-test- += linux/elfcore-compat.h | ||
| 158 | header-test- += linux/error-injection.h | ||
| 159 | header-test- += linux/errseq.h | ||
| 160 | header-test- += linux/eventpoll.h | ||
| 161 | header-test- += linux/ext2_fs.h | ||
| 162 | header-test- += linux/f75375s.h | ||
| 163 | header-test- += linux/falloc.h | ||
| 164 | header-test- += linux/fault-inject.h | ||
| 165 | header-test- += linux/fbcon.h | ||
| 166 | header-test- += linux/firmware/intel/stratix10-svc-client.h | ||
| 167 | header-test- += linux/firmware/meson/meson_sm.h | ||
| 168 | header-test- += linux/firmware/trusted_foundations.h | ||
| 169 | header-test- += linux/firmware/xlnx-zynqmp.h | ||
| 170 | header-test- += linux/fixp-arith.h | ||
| 171 | header-test- += linux/flat.h | ||
| 172 | header-test- += linux/fs_types.h | ||
| 173 | header-test- += linux/fs_uart_pd.h | ||
| 174 | header-test- += linux/fsi-occ.h | ||
| 175 | header-test- += linux/fsi-sbefifo.h | ||
| 176 | header-test- += linux/fsl/bestcomm/ata.h | ||
| 177 | header-test- += linux/fsl/bestcomm/bestcomm.h | ||
| 178 | header-test- += linux/fsl/bestcomm/bestcomm_priv.h | ||
| 179 | header-test- += linux/fsl/bestcomm/fec.h | ||
| 180 | header-test- += linux/fsl/bestcomm/gen_bd.h | ||
| 181 | header-test- += linux/fsl/bestcomm/sram.h | ||
| 182 | header-test- += linux/fsl_hypervisor.h | ||
| 183 | header-test- += linux/fsldma.h | ||
| 184 | header-test- += linux/ftrace_irq.h | ||
| 185 | header-test- += linux/gameport.h | ||
| 186 | header-test- += linux/genl_magic_func.h | ||
| 187 | header-test- += linux/genl_magic_struct.h | ||
| 188 | header-test- += linux/gpio/aspeed.h | ||
| 189 | header-test- += linux/gpio/gpio-reg.h | ||
| 190 | header-test- += linux/hid-debug.h | ||
| 191 | header-test- += linux/hiddev.h | ||
| 192 | header-test- += linux/hippidevice.h | ||
| 193 | header-test- += linux/hmm.h | ||
| 194 | header-test- += linux/hp_sdc.h | ||
| 195 | header-test- += linux/huge_mm.h | ||
| 196 | header-test- += linux/hugetlb_cgroup.h | ||
| 197 | header-test- += linux/hugetlb_inline.h | ||
| 198 | header-test- += linux/hwmon-vid.h | ||
| 199 | header-test- += linux/hyperv.h | ||
| 200 | header-test- += linux/i2c-algo-pca.h | ||
| 201 | header-test- += linux/i2c-algo-pcf.h | ||
| 202 | header-test- += linux/i3c/ccc.h | ||
| 203 | header-test- += linux/i3c/device.h | ||
| 204 | header-test- += linux/i3c/master.h | ||
| 205 | header-test- += linux/i8042.h | ||
| 206 | header-test- += linux/ide.h | ||
| 207 | header-test- += linux/idle_inject.h | ||
| 208 | header-test- += linux/if_frad.h | ||
| 209 | header-test- += linux/if_rmnet.h | ||
| 210 | header-test- += linux/if_tap.h | ||
| 211 | header-test- += linux/iio/accel/kxcjk_1013.h | ||
| 212 | header-test- += linux/iio/adc/ad_sigma_delta.h | ||
| 213 | header-test- += linux/iio/buffer-dma.h | ||
| 214 | header-test- += linux/iio/buffer_impl.h | ||
| 215 | header-test- += linux/iio/common/st_sensors.h | ||
| 216 | header-test- += linux/iio/common/st_sensors_i2c.h | ||
| 217 | header-test- += linux/iio/common/st_sensors_spi.h | ||
| 218 | header-test- += linux/iio/dac/ad5421.h | ||
| 219 | header-test- += linux/iio/dac/ad5504.h | ||
| 220 | header-test- += linux/iio/dac/ad5791.h | ||
| 221 | header-test- += linux/iio/dac/max517.h | ||
| 222 | header-test- += linux/iio/dac/mcp4725.h | ||
| 223 | header-test- += linux/iio/frequency/ad9523.h | ||
| 224 | header-test- += linux/iio/frequency/adf4350.h | ||
| 225 | header-test- += linux/iio/hw-consumer.h | ||
| 226 | header-test- += linux/iio/imu/adis.h | ||
| 227 | header-test- += linux/iio/sysfs.h | ||
| 228 | header-test- += linux/iio/timer/stm32-timer-trigger.h | ||
| 229 | header-test- += linux/iio/trigger.h | ||
| 230 | header-test- += linux/iio/triggered_event.h | ||
| 231 | header-test- += linux/imx-media.h | ||
| 232 | header-test- += linux/inet_diag.h | ||
| 233 | header-test- += linux/init_ohci1394_dma.h | ||
| 234 | header-test- += linux/initrd.h | ||
| 235 | header-test- += linux/input/adp5589.h | ||
| 236 | header-test- += linux/input/bu21013.h | ||
| 237 | header-test- += linux/input/cma3000.h | ||
| 238 | header-test- += linux/input/kxtj9.h | ||
| 239 | header-test- += linux/input/lm8333.h | ||
| 240 | header-test- += linux/input/sparse-keymap.h | ||
| 241 | header-test- += linux/input/touchscreen.h | ||
| 242 | header-test- += linux/input/tps6507x-ts.h | ||
| 243 | header-test-$(CONFIG_X86) += linux/intel-iommu.h | ||
| 244 | header-test- += linux/intel-ish-client-if.h | ||
| 245 | header-test- += linux/intel-pti.h | ||
| 246 | header-test- += linux/intel-svm.h | ||
| 247 | header-test- += linux/interconnect-provider.h | ||
| 248 | header-test- += linux/ioc3.h | ||
| 249 | header-test- += linux/ipack.h | ||
| 250 | header-test- += linux/irq_cpustat.h | ||
| 251 | header-test- += linux/irq_poll.h | ||
| 252 | header-test- += linux/irqchip/arm-gic-v3.h | ||
| 253 | header-test- += linux/irqchip/arm-gic-v4.h | ||
| 254 | header-test- += linux/irqchip/irq-madera.h | ||
| 255 | header-test- += linux/irqchip/irq-sa11x0.h | ||
| 256 | header-test- += linux/irqchip/mxs.h | ||
| 257 | header-test- += linux/irqchip/versatile-fpga.h | ||
| 258 | header-test- += linux/irqdesc.h | ||
| 259 | header-test- += linux/irqflags.h | ||
| 260 | header-test- += linux/iscsi_boot_sysfs.h | ||
| 261 | header-test- += linux/isdn/capiutil.h | ||
| 262 | header-test- += linux/isdn/hdlc.h | ||
| 263 | header-test- += linux/isdn_ppp.h | ||
| 264 | header-test- += linux/jbd2.h | ||
| 265 | header-test- += linux/jump_label.h | ||
| 266 | header-test- += linux/jump_label_ratelimit.h | ||
| 267 | header-test- += linux/jz4740-adc.h | ||
| 268 | header-test- += linux/kasan.h | ||
| 269 | header-test- += linux/kcore.h | ||
| 270 | header-test- += linux/kdev_t.h | ||
| 271 | header-test- += linux/kernelcapi.h | ||
| 272 | header-test- += linux/khugepaged.h | ||
| 273 | header-test- += linux/kobj_map.h | ||
| 274 | header-test- += linux/kobject_ns.h | ||
| 275 | header-test- += linux/kvm_host.h | ||
| 276 | header-test- += linux/kvm_irqfd.h | ||
| 277 | header-test- += linux/kvm_para.h | ||
| 278 | header-test- += linux/lantiq.h | ||
| 279 | header-test- += linux/lapb.h | ||
| 280 | header-test- += linux/latencytop.h | ||
| 281 | header-test- += linux/led-lm3530.h | ||
| 282 | header-test- += linux/leds-bd2802.h | ||
| 283 | header-test- += linux/leds-lp3944.h | ||
| 284 | header-test- += linux/leds-lp3952.h | ||
| 285 | header-test- += linux/leds_pwm.h | ||
| 286 | header-test- += linux/libata.h | ||
| 287 | header-test- += linux/license.h | ||
| 288 | header-test- += linux/lightnvm.h | ||
| 289 | header-test- += linux/lis3lv02d.h | ||
| 290 | header-test- += linux/list_bl.h | ||
| 291 | header-test- += linux/list_lru.h | ||
| 292 | header-test- += linux/list_nulls.h | ||
| 293 | header-test- += linux/lockd/share.h | ||
| 294 | header-test- += linux/lzo.h | ||
| 295 | header-test- += linux/mailbox/zynqmp-ipi-message.h | ||
| 296 | header-test- += linux/maple.h | ||
| 297 | header-test- += linux/mbcache.h | ||
| 298 | header-test- += linux/mbus.h | ||
| 299 | header-test- += linux/mc146818rtc.h | ||
| 300 | header-test- += linux/mc6821.h | ||
| 301 | header-test- += linux/mdev.h | ||
| 302 | header-test- += linux/mem_encrypt.h | ||
| 303 | header-test- += linux/memfd.h | ||
| 304 | header-test- += linux/mfd/88pm80x.h | ||
| 305 | header-test- += linux/mfd/88pm860x.h | ||
| 306 | header-test- += linux/mfd/abx500/ab8500-bm.h | ||
| 307 | header-test- += linux/mfd/abx500/ab8500-gpadc.h | ||
| 308 | header-test- += linux/mfd/adp5520.h | ||
| 309 | header-test- += linux/mfd/arizona/pdata.h | ||
| 310 | header-test- += linux/mfd/as3711.h | ||
| 311 | header-test- += linux/mfd/as3722.h | ||
| 312 | header-test- += linux/mfd/cros_ec_commands.h | ||
| 313 | header-test- += linux/mfd/da903x.h | ||
| 314 | header-test- += linux/mfd/da9055/pdata.h | ||
| 315 | header-test- += linux/mfd/da9063/pdata.h | ||
| 316 | header-test- += linux/mfd/db8500-prcmu.h | ||
| 317 | header-test- += linux/mfd/dbx500-prcmu.h | ||
| 318 | header-test- += linux/mfd/dln2.h | ||
| 319 | header-test- += linux/mfd/dm355evm_msp.h | ||
| 320 | header-test- += linux/mfd/ds1wm.h | ||
| 321 | header-test- += linux/mfd/ezx-pcap.h | ||
| 322 | header-test- += linux/mfd/intel_msic.h | ||
| 323 | header-test- += linux/mfd/janz.h | ||
| 324 | header-test- += linux/mfd/kempld.h | ||
| 325 | header-test- += linux/mfd/lm3533.h | ||
| 326 | header-test- += linux/mfd/lp8788-isink.h | ||
| 327 | header-test- += linux/mfd/lpc_ich.h | ||
| 328 | header-test- += linux/mfd/max77693.h | ||
| 329 | header-test- += linux/mfd/max8998-private.h | ||
| 330 | header-test- += linux/mfd/menelaus.h | ||
| 331 | header-test- += linux/mfd/mt6397/core.h | ||
| 332 | header-test- += linux/mfd/palmas.h | ||
| 333 | header-test- += linux/mfd/pcf50633/backlight.h | ||
| 334 | header-test- += linux/mfd/rc5t583.h | ||
| 335 | header-test- += linux/mfd/retu.h | ||
| 336 | header-test- += linux/mfd/samsung/core.h | ||
| 337 | header-test- += linux/mfd/si476x-platform.h | ||
| 338 | header-test- += linux/mfd/si476x-reports.h | ||
| 339 | header-test- += linux/mfd/sky81452.h | ||
| 340 | header-test- += linux/mfd/smsc.h | ||
| 341 | header-test- += linux/mfd/sta2x11-mfd.h | ||
| 342 | header-test- += linux/mfd/stmfx.h | ||
| 343 | header-test- += linux/mfd/tc3589x.h | ||
| 344 | header-test- += linux/mfd/tc6387xb.h | ||
| 345 | header-test- += linux/mfd/tc6393xb.h | ||
| 346 | header-test- += linux/mfd/tps65090.h | ||
| 347 | header-test- += linux/mfd/tps6586x.h | ||
| 348 | header-test- += linux/mfd/tps65910.h | ||
| 349 | header-test- += linux/mfd/tps80031.h | ||
| 350 | header-test- += linux/mfd/ucb1x00.h | ||
| 351 | header-test- += linux/mfd/viperboard.h | ||
| 352 | header-test- += linux/mfd/wm831x/core.h | ||
| 353 | header-test- += linux/mfd/wm831x/otp.h | ||
| 354 | header-test- += linux/mfd/wm831x/pdata.h | ||
| 355 | header-test- += linux/mfd/wm8994/core.h | ||
| 356 | header-test- += linux/mfd/wm8994/pdata.h | ||
| 357 | header-test- += linux/mlx4/doorbell.h | ||
| 358 | header-test- += linux/mlx4/srq.h | ||
| 359 | header-test- += linux/mlx5/doorbell.h | ||
| 360 | header-test- += linux/mlx5/eq.h | ||
| 361 | header-test- += linux/mlx5/fs_helpers.h | ||
| 362 | header-test- += linux/mlx5/mlx5_ifc.h | ||
| 363 | header-test- += linux/mlx5/mlx5_ifc_fpga.h | ||
| 364 | header-test- += linux/mm-arch-hooks.h | ||
| 365 | header-test- += linux/mm_inline.h | ||
| 366 | header-test- += linux/mmu_context.h | ||
| 367 | header-test- += linux/mpage.h | ||
| 368 | header-test- += linux/mtd/bbm.h | ||
| 369 | header-test- += linux/mtd/cfi.h | ||
| 370 | header-test- += linux/mtd/doc2000.h | ||
| 371 | header-test- += linux/mtd/flashchip.h | ||
| 372 | header-test- += linux/mtd/ftl.h | ||
| 373 | header-test- += linux/mtd/gen_probe.h | ||
| 374 | header-test- += linux/mtd/jedec.h | ||
| 375 | header-test- += linux/mtd/nand_bch.h | ||
| 376 | header-test- += linux/mtd/nand_ecc.h | ||
| 377 | header-test- += linux/mtd/ndfc.h | ||
| 378 | header-test- += linux/mtd/onenand.h | ||
| 379 | header-test- += linux/mtd/pismo.h | ||
| 380 | header-test- += linux/mtd/plat-ram.h | ||
| 381 | header-test- += linux/mtd/spi-nor.h | ||
| 382 | header-test- += linux/mv643xx.h | ||
| 383 | header-test- += linux/mv643xx_eth.h | ||
| 384 | header-test- += linux/mvebu-pmsu.h | ||
| 385 | header-test- += linux/mxm-wmi.h | ||
| 386 | header-test- += linux/n_r3964.h | ||
| 387 | header-test- += linux/ndctl.h | ||
| 388 | header-test- += linux/netfilter/ipset/ip_set.h | ||
| 389 | header-test- += linux/netfilter/ipset/ip_set_bitmap.h | ||
| 390 | header-test- += linux/netfilter/ipset/ip_set_comment.h | ||
| 391 | header-test- += linux/netfilter/ipset/ip_set_counter.h | ||
| 392 | header-test- += linux/netfilter/ipset/ip_set_getport.h | ||
| 393 | header-test- += linux/netfilter/ipset/ip_set_hash.h | ||
| 394 | header-test- += linux/netfilter/ipset/ip_set_list.h | ||
| 395 | header-test- += linux/netfilter/ipset/ip_set_skbinfo.h | ||
| 396 | header-test- += linux/netfilter/ipset/ip_set_timeout.h | ||
| 397 | header-test- += linux/netfilter/nf_conntrack_amanda.h | ||
| 398 | header-test- += linux/netfilter/nf_conntrack_ftp.h | ||
| 399 | header-test- += linux/netfilter/nf_conntrack_h323.h | ||
| 400 | header-test- += linux/netfilter/nf_conntrack_h323_asn1.h | ||
| 401 | header-test- += linux/netfilter/nf_conntrack_irc.h | ||
| 402 | header-test- += linux/netfilter/nf_conntrack_pptp.h | ||
| 403 | header-test- += linux/netfilter/nf_conntrack_proto_gre.h | ||
| 404 | header-test- += linux/netfilter/nf_conntrack_sip.h | ||
| 405 | header-test- += linux/netfilter/nf_conntrack_snmp.h | ||
| 406 | header-test- += linux/netfilter/nf_conntrack_tftp.h | ||
| 407 | header-test- += linux/netfilter/x_tables.h | ||
| 408 | header-test- += linux/netfilter_arp/arp_tables.h | ||
| 409 | header-test- += linux/netfilter_bridge/ebtables.h | ||
| 410 | header-test- += linux/netfilter_ipv4/ip4_tables.h | ||
| 411 | header-test- += linux/netfilter_ipv4/ip_tables.h | ||
| 412 | header-test- += linux/netfilter_ipv6/ip6_tables.h | ||
| 413 | header-test- += linux/nfs.h | ||
| 414 | header-test- += linux/nfs_fs_i.h | ||
| 415 | header-test- += linux/nfs_fs_sb.h | ||
| 416 | header-test- += linux/nfs_page.h | ||
| 417 | header-test- += linux/nfs_xdr.h | ||
| 418 | header-test- += linux/nfsacl.h | ||
| 419 | header-test- += linux/nl802154.h | ||
| 420 | header-test- += linux/ns_common.h | ||
| 421 | header-test- += linux/nsc_gpio.h | ||
| 422 | header-test- += linux/ntb_transport.h | ||
| 423 | header-test- += linux/nubus.h | ||
| 424 | header-test- += linux/nvme-fc-driver.h | ||
| 425 | header-test- += linux/nvme-fc.h | ||
| 426 | header-test- += linux/nvme-rdma.h | ||
| 427 | header-test- += linux/nvram.h | ||
| 428 | header-test- += linux/objagg.h | ||
| 429 | header-test- += linux/of_clk.h | ||
| 430 | header-test- += linux/of_net.h | ||
| 431 | header-test- += linux/of_pdt.h | ||
| 432 | header-test- += linux/olpc-ec.h | ||
| 433 | header-test- += linux/omap-dma.h | ||
| 434 | header-test- += linux/omap-dmaengine.h | ||
| 435 | header-test- += linux/omap-gpmc.h | ||
| 436 | header-test- += linux/omap-iommu.h | ||
| 437 | header-test- += linux/omap-mailbox.h | ||
| 438 | header-test- += linux/once.h | ||
| 439 | header-test- += linux/osq_lock.h | ||
| 440 | header-test- += linux/overflow.h | ||
| 441 | header-test- += linux/page-flags-layout.h | ||
| 442 | header-test- += linux/page-isolation.h | ||
| 443 | header-test- += linux/page_ext.h | ||
| 444 | header-test- += linux/page_owner.h | ||
| 445 | header-test- += linux/parport_pc.h | ||
| 446 | header-test- += linux/parser.h | ||
| 447 | header-test- += linux/pci-acpi.h | ||
| 448 | header-test- += linux/pci-dma-compat.h | ||
| 449 | header-test- += linux/pci_hotplug.h | ||
| 450 | header-test- += linux/pda_power.h | ||
| 451 | header-test- += linux/perf/arm_pmu.h | ||
| 452 | header-test- += linux/perf_regs.h | ||
| 453 | header-test- += linux/phy/omap_control_phy.h | ||
| 454 | header-test- += linux/phy/tegra/xusb.h | ||
| 455 | header-test- += linux/phy/ulpi_phy.h | ||
| 456 | header-test- += linux/phy_fixed.h | ||
| 457 | header-test- += linux/pinctrl/pinconf-generic.h | ||
| 458 | header-test- += linux/pinctrl/pinconf.h | ||
| 459 | header-test- += linux/pinctrl/pinctrl.h | ||
| 460 | header-test- += linux/pipe_fs_i.h | ||
| 461 | header-test- += linux/pktcdvd.h | ||
| 462 | header-test- += linux/pl320-ipc.h | ||
| 463 | header-test- += linux/pl353-smc.h | ||
| 464 | header-test- += linux/platform_data/ad5449.h | ||
| 465 | header-test- += linux/platform_data/ad5755.h | ||
| 466 | header-test- += linux/platform_data/ad7266.h | ||
| 467 | header-test- += linux/platform_data/ad7291.h | ||
| 468 | header-test- += linux/platform_data/ad7298.h | ||
| 469 | header-test- += linux/platform_data/ad7303.h | ||
| 470 | header-test- += linux/platform_data/ad7791.h | ||
| 471 | header-test- += linux/platform_data/ad7793.h | ||
| 472 | header-test- += linux/platform_data/ad7887.h | ||
| 473 | header-test- += linux/platform_data/adau17x1.h | ||
| 474 | header-test- += linux/platform_data/adp8870.h | ||
| 475 | header-test- += linux/platform_data/ads1015.h | ||
| 476 | header-test- += linux/platform_data/ads7828.h | ||
| 477 | header-test- += linux/platform_data/apds990x.h | ||
| 478 | header-test- += linux/platform_data/arm-ux500-pm.h | ||
| 479 | header-test- += linux/platform_data/asoc-s3c.h | ||
| 480 | header-test- += linux/platform_data/at91_adc.h | ||
| 481 | header-test- += linux/platform_data/ata-pxa.h | ||
| 482 | header-test- += linux/platform_data/atmel.h | ||
| 483 | header-test- += linux/platform_data/bh1770glc.h | ||
| 484 | header-test- += linux/platform_data/brcmfmac.h | ||
| 485 | header-test- += linux/platform_data/clk-u300.h | ||
| 486 | header-test- += linux/platform_data/cyttsp4.h | ||
| 487 | header-test- += linux/platform_data/dma-coh901318.h | ||
| 488 | header-test- += linux/platform_data/dma-imx-sdma.h | ||
| 489 | header-test- += linux/platform_data/dma-mcf-edma.h | ||
| 490 | header-test- += linux/platform_data/dma-s3c24xx.h | ||
| 491 | header-test- += linux/platform_data/dmtimer-omap.h | ||
| 492 | header-test- += linux/platform_data/dsa.h | ||
| 493 | header-test- += linux/platform_data/edma.h | ||
| 494 | header-test- += linux/platform_data/elm.h | ||
| 495 | header-test- += linux/platform_data/emif_plat.h | ||
| 496 | header-test- += linux/platform_data/fsa9480.h | ||
| 497 | header-test- += linux/platform_data/g762.h | ||
| 498 | header-test- += linux/platform_data/gpio-ath79.h | ||
| 499 | header-test- += linux/platform_data/gpio-davinci.h | ||
| 500 | header-test- += linux/platform_data/gpio-dwapb.h | ||
| 501 | header-test- += linux/platform_data/gpio-htc-egpio.h | ||
| 502 | header-test- += linux/platform_data/gpmc-omap.h | ||
| 503 | header-test- += linux/platform_data/hsmmc-omap.h | ||
| 504 | header-test- += linux/platform_data/hwmon-s3c.h | ||
| 505 | header-test- += linux/platform_data/i2c-davinci.h | ||
| 506 | header-test- += linux/platform_data/i2c-imx.h | ||
| 507 | header-test- += linux/platform_data/i2c-mux-reg.h | ||
| 508 | header-test- += linux/platform_data/i2c-ocores.h | ||
| 509 | header-test- += linux/platform_data/i2c-xiic.h | ||
| 510 | header-test- += linux/platform_data/intel-spi.h | ||
| 511 | header-test- += linux/platform_data/invensense_mpu6050.h | ||
| 512 | header-test- += linux/platform_data/irda-pxaficp.h | ||
| 513 | header-test- += linux/platform_data/irda-sa11x0.h | ||
| 514 | header-test- += linux/platform_data/itco_wdt.h | ||
| 515 | header-test- += linux/platform_data/jz4740/jz4740_nand.h | ||
| 516 | header-test- += linux/platform_data/keyboard-pxa930_rotary.h | ||
| 517 | header-test- += linux/platform_data/keypad-omap.h | ||
| 518 | header-test- += linux/platform_data/leds-lp55xx.h | ||
| 519 | header-test- += linux/platform_data/leds-omap.h | ||
| 520 | header-test- += linux/platform_data/lp855x.h | ||
| 521 | header-test- += linux/platform_data/lp8727.h | ||
| 522 | header-test- += linux/platform_data/max197.h | ||
| 523 | header-test- += linux/platform_data/max3421-hcd.h | ||
| 524 | header-test- += linux/platform_data/max732x.h | ||
| 525 | header-test- += linux/platform_data/mcs.h | ||
| 526 | header-test- += linux/platform_data/mdio-bcm-unimac.h | ||
| 527 | header-test- += linux/platform_data/mdio-gpio.h | ||
| 528 | header-test- += linux/platform_data/media/si4713.h | ||
| 529 | header-test- += linux/platform_data/mlxreg.h | ||
| 530 | header-test- += linux/platform_data/mmc-omap.h | ||
| 531 | header-test- += linux/platform_data/mmc-sdhci-s3c.h | ||
| 532 | header-test- += linux/platform_data/mmp_audio.h | ||
| 533 | header-test- += linux/platform_data/mtd-orion_nand.h | ||
| 534 | header-test- += linux/platform_data/mv88e6xxx.h | ||
| 535 | header-test- += linux/platform_data/net-cw1200.h | ||
| 536 | header-test- += linux/platform_data/omap-twl4030.h | ||
| 537 | header-test- += linux/platform_data/omapdss.h | ||
| 538 | header-test- += linux/platform_data/pcf857x.h | ||
| 539 | header-test- += linux/platform_data/pixcir_i2c_ts.h | ||
| 540 | header-test- += linux/platform_data/pwm_omap_dmtimer.h | ||
| 541 | header-test- += linux/platform_data/pxa2xx_udc.h | ||
| 542 | header-test- += linux/platform_data/pxa_sdhci.h | ||
| 543 | header-test- += linux/platform_data/remoteproc-omap.h | ||
| 544 | header-test- += linux/platform_data/sa11x0-serial.h | ||
| 545 | header-test- += linux/platform_data/sc18is602.h | ||
| 546 | header-test- += linux/platform_data/sdhci-pic32.h | ||
| 547 | header-test- += linux/platform_data/serial-sccnxp.h | ||
| 548 | header-test- += linux/platform_data/sht3x.h | ||
| 549 | header-test- += linux/platform_data/shtc1.h | ||
| 550 | header-test- += linux/platform_data/si5351.h | ||
| 551 | header-test- += linux/platform_data/sky81452-backlight.h | ||
| 552 | header-test- += linux/platform_data/spi-davinci.h | ||
| 553 | header-test- += linux/platform_data/spi-ep93xx.h | ||
| 554 | header-test- += linux/platform_data/spi-mt65xx.h | ||
| 555 | header-test- += linux/platform_data/spi-nuc900.h | ||
| 556 | header-test- += linux/platform_data/st_sensors_pdata.h | ||
| 557 | header-test- += linux/platform_data/ti-sysc.h | ||
| 558 | header-test- += linux/platform_data/timer-ixp4xx.h | ||
| 559 | header-test- += linux/platform_data/touchscreen-s3c2410.h | ||
| 560 | header-test- += linux/platform_data/tsc2007.h | ||
| 561 | header-test- += linux/platform_data/tsl2772.h | ||
| 562 | header-test- += linux/platform_data/uio_pruss.h | ||
| 563 | header-test- += linux/platform_data/usb-davinci.h | ||
| 564 | header-test- += linux/platform_data/usb-ehci-mxc.h | ||
| 565 | header-test- += linux/platform_data/usb-ehci-orion.h | ||
| 566 | header-test- += linux/platform_data/usb-mx2.h | ||
| 567 | header-test- += linux/platform_data/usb-ohci-s3c2410.h | ||
| 568 | header-test- += linux/platform_data/usb-omap.h | ||
| 569 | header-test- += linux/platform_data/usb-s3c2410_udc.h | ||
| 570 | header-test- += linux/platform_data/usb3503.h | ||
| 571 | header-test- += linux/platform_data/ux500_wdt.h | ||
| 572 | header-test- += linux/platform_data/video-clcd-versatile.h | ||
| 573 | header-test- += linux/platform_data/video-imxfb.h | ||
| 574 | header-test- += linux/platform_data/video-nuc900fb.h | ||
| 575 | header-test- += linux/platform_data/video-pxafb.h | ||
| 576 | header-test- += linux/platform_data/video_s3c.h | ||
| 577 | header-test- += linux/platform_data/voltage-omap.h | ||
| 578 | header-test- += linux/platform_data/x86/apple.h | ||
| 579 | header-test- += linux/platform_data/x86/clk-pmc-atom.h | ||
| 580 | header-test- += linux/platform_data/x86/pmc_atom.h | ||
| 581 | header-test- += linux/platform_data/xtalk-bridge.h | ||
| 582 | header-test- += linux/pm2301_charger.h | ||
| 583 | header-test- += linux/pm_wakeirq.h | ||
| 584 | header-test- += linux/pm_wakeup.h | ||
| 585 | header-test- += linux/pmbus.h | ||
| 586 | header-test- += linux/pmu.h | ||
| 587 | header-test- += linux/posix_acl.h | ||
| 588 | header-test- += linux/posix_acl_xattr.h | ||
| 589 | header-test- += linux/power/ab8500.h | ||
| 590 | header-test- += linux/power/bq27xxx_battery.h | ||
| 591 | header-test- += linux/power/generic-adc-battery.h | ||
| 592 | header-test- += linux/power/jz4740-battery.h | ||
| 593 | header-test- += linux/power/max17042_battery.h | ||
| 594 | header-test- += linux/power/max8903_charger.h | ||
| 595 | header-test- += linux/ppp-comp.h | ||
| 596 | header-test- += linux/pps-gpio.h | ||
| 597 | header-test- += linux/pr.h | ||
| 598 | header-test- += linux/proc_ns.h | ||
| 599 | header-test- += linux/processor.h | ||
| 600 | header-test- += linux/psi.h | ||
| 601 | header-test- += linux/psp-sev.h | ||
| 602 | header-test- += linux/pstore.h | ||
| 603 | header-test- += linux/ptr_ring.h | ||
| 604 | header-test- += linux/ptrace.h | ||
| 605 | header-test- += linux/qcom-geni-se.h | ||
| 606 | header-test- += linux/qed/eth_common.h | ||
| 607 | header-test- += linux/qed/fcoe_common.h | ||
| 608 | header-test- += linux/qed/iscsi_common.h | ||
| 609 | header-test- += linux/qed/iwarp_common.h | ||
| 610 | header-test- += linux/qed/qed_eth_if.h | ||
| 611 | header-test- += linux/qed/qed_fcoe_if.h | ||
| 612 | header-test- += linux/qed/rdma_common.h | ||
| 613 | header-test- += linux/qed/storage_common.h | ||
| 614 | header-test- += linux/qed/tcp_common.h | ||
| 615 | header-test- += linux/qnx6_fs.h | ||
| 616 | header-test- += linux/quicklist.h | ||
| 617 | header-test- += linux/ramfs.h | ||
| 618 | header-test- += linux/range.h | ||
| 619 | header-test- += linux/rcu_node_tree.h | ||
| 620 | header-test- += linux/rculist_bl.h | ||
| 621 | header-test- += linux/rculist_nulls.h | ||
| 622 | header-test- += linux/rcutiny.h | ||
| 623 | header-test- += linux/rcutree.h | ||
| 624 | header-test- += linux/reboot-mode.h | ||
| 625 | header-test- += linux/regulator/fixed.h | ||
| 626 | header-test- += linux/regulator/gpio-regulator.h | ||
| 627 | header-test- += linux/regulator/max8973-regulator.h | ||
| 628 | header-test- += linux/regulator/of_regulator.h | ||
| 629 | header-test- += linux/regulator/tps51632-regulator.h | ||
| 630 | header-test- += linux/regulator/tps62360.h | ||
| 631 | header-test- += linux/regulator/tps6507x.h | ||
| 632 | header-test- += linux/regulator/userspace-consumer.h | ||
| 633 | header-test- += linux/remoteproc/st_slim_rproc.h | ||
| 634 | header-test- += linux/reset/socfpga.h | ||
| 635 | header-test- += linux/reset/sunxi.h | ||
| 636 | header-test- += linux/rtc/m48t59.h | ||
| 637 | header-test- += linux/rtc/rtc-omap.h | ||
| 638 | header-test- += linux/rtc/sirfsoc_rtciobrg.h | ||
| 639 | header-test- += linux/rwlock.h | ||
| 640 | header-test- += linux/rwlock_types.h | ||
| 641 | header-test- += linux/scc.h | ||
| 642 | header-test- += linux/sched/deadline.h | ||
| 643 | header-test- += linux/sched/smt.h | ||
| 644 | header-test- += linux/sched/sysctl.h | ||
| 645 | header-test- += linux/sched_clock.h | ||
| 646 | header-test- += linux/scpi_protocol.h | ||
| 647 | header-test- += linux/scx200_gpio.h | ||
| 648 | header-test- += linux/seccomp.h | ||
| 649 | header-test- += linux/sed-opal.h | ||
| 650 | header-test- += linux/seg6_iptunnel.h | ||
| 651 | header-test- += linux/selection.h | ||
| 652 | header-test- += linux/set_memory.h | ||
| 653 | header-test- += linux/shrinker.h | ||
| 654 | header-test- += linux/sirfsoc_dma.h | ||
| 655 | header-test- += linux/skb_array.h | ||
| 656 | header-test- += linux/slab_def.h | ||
| 657 | header-test- += linux/slub_def.h | ||
| 658 | header-test- += linux/sm501.h | ||
| 659 | header-test- += linux/smc91x.h | ||
| 660 | header-test- += linux/static_key.h | ||
| 661 | header-test- += linux/soc/actions/owl-sps.h | ||
| 662 | header-test- += linux/soc/amlogic/meson-canvas.h | ||
| 663 | header-test- += linux/soc/brcmstb/brcmstb.h | ||
| 664 | header-test- += linux/soc/ixp4xx/npe.h | ||
| 665 | header-test- += linux/soc/mediatek/infracfg.h | ||
| 666 | header-test- += linux/soc/qcom/smd-rpm.h | ||
| 667 | header-test- += linux/soc/qcom/smem.h | ||
| 668 | header-test- += linux/soc/qcom/smem_state.h | ||
| 669 | header-test- += linux/soc/qcom/wcnss_ctrl.h | ||
| 670 | header-test- += linux/soc/renesas/rcar-rst.h | ||
| 671 | header-test- += linux/soc/samsung/exynos-pmu.h | ||
| 672 | header-test- += linux/soc/sunxi/sunxi_sram.h | ||
| 673 | header-test- += linux/soc/ti/ti-msgmgr.h | ||
| 674 | header-test- += linux/soc/ti/ti_sci_inta_msi.h | ||
| 675 | header-test- += linux/soc/ti/ti_sci_protocol.h | ||
| 676 | header-test- += linux/soundwire/sdw.h | ||
| 677 | header-test- += linux/soundwire/sdw_intel.h | ||
| 678 | header-test- += linux/soundwire/sdw_type.h | ||
| 679 | header-test- += linux/spi/ad7877.h | ||
| 680 | header-test- += linux/spi/ads7846.h | ||
| 681 | header-test- += linux/spi/at86rf230.h | ||
| 682 | header-test- += linux/spi/ds1305.h | ||
| 683 | header-test- += linux/spi/libertas_spi.h | ||
| 684 | header-test- += linux/spi/lms283gf05.h | ||
| 685 | header-test- += linux/spi/max7301.h | ||
| 686 | header-test- += linux/spi/mcp23s08.h | ||
| 687 | header-test- += linux/spi/rspi.h | ||
| 688 | header-test- += linux/spi/s3c24xx.h | ||
| 689 | header-test- += linux/spi/sh_msiof.h | ||
| 690 | header-test- += linux/spi/spi-fsl-dspi.h | ||
| 691 | header-test- += linux/spi/spi_bitbang.h | ||
| 692 | header-test- += linux/spi/spi_gpio.h | ||
| 693 | header-test- += linux/spi/xilinx_spi.h | ||
| 694 | header-test- += linux/spinlock_api_smp.h | ||
| 695 | header-test- += linux/spinlock_api_up.h | ||
| 696 | header-test- += linux/spinlock_types.h | ||
| 697 | header-test- += linux/splice.h | ||
| 698 | header-test- += linux/sram.h | ||
| 699 | header-test- += linux/srcutiny.h | ||
| 700 | header-test- += linux/srcutree.h | ||
| 701 | header-test- += linux/ssb/ssb_driver_chipcommon.h | ||
| 702 | header-test- += linux/ssb/ssb_driver_extif.h | ||
| 703 | header-test- += linux/ssb/ssb_driver_mips.h | ||
| 704 | header-test- += linux/ssb/ssb_driver_pci.h | ||
| 705 | header-test- += linux/ssbi.h | ||
| 706 | header-test- += linux/stackdepot.h | ||
| 707 | header-test- += linux/stmp3xxx_rtc_wdt.h | ||
| 708 | header-test- += linux/string_helpers.h | ||
| 709 | header-test- += linux/sungem_phy.h | ||
| 710 | header-test- += linux/sunrpc/msg_prot.h | ||
| 711 | header-test- += linux/sunrpc/rpc_pipe_fs.h | ||
| 712 | header-test- += linux/sunrpc/xprtmultipath.h | ||
| 713 | header-test- += linux/sunrpc/xprtsock.h | ||
| 714 | header-test- += linux/sunxi-rsb.h | ||
| 715 | header-test- += linux/svga.h | ||
| 716 | header-test- += linux/sw842.h | ||
| 717 | header-test- += linux/swapfile.h | ||
| 718 | header-test- += linux/swapops.h | ||
| 719 | header-test- += linux/swiotlb.h | ||
| 720 | header-test- += linux/sysv_fs.h | ||
| 721 | header-test- += linux/t10-pi.h | ||
| 722 | header-test- += linux/task_io_accounting.h | ||
| 723 | header-test- += linux/tick.h | ||
| 724 | header-test- += linux/timb_dma.h | ||
| 725 | header-test- += linux/timekeeping.h | ||
| 726 | header-test- += linux/timekeeping32.h | ||
| 727 | header-test- += linux/ts-nbus.h | ||
| 728 | header-test- += linux/tsacct_kern.h | ||
| 729 | header-test- += linux/tty_flip.h | ||
| 730 | header-test- += linux/tty_ldisc.h | ||
| 731 | header-test- += linux/ucb1400.h | ||
| 732 | header-test- += linux/usb/association.h | ||
| 733 | header-test- += linux/usb/cdc-wdm.h | ||
| 734 | header-test- += linux/usb/cdc_ncm.h | ||
| 735 | header-test- += linux/usb/ezusb.h | ||
| 736 | header-test- += linux/usb/gadget_configfs.h | ||
| 737 | header-test- += linux/usb/gpio_vbus.h | ||
| 738 | header-test- += linux/usb/hcd.h | ||
| 739 | header-test- += linux/usb/iowarrior.h | ||
| 740 | header-test- += linux/usb/irda.h | ||
| 741 | header-test- += linux/usb/isp116x.h | ||
| 742 | header-test- += linux/usb/isp1362.h | ||
| 743 | header-test- += linux/usb/musb.h | ||
| 744 | header-test- += linux/usb/net2280.h | ||
| 745 | header-test- += linux/usb/ohci_pdriver.h | ||
| 746 | header-test- += linux/usb/otg-fsm.h | ||
| 747 | header-test- += linux/usb/pd_ado.h | ||
| 748 | header-test- += linux/usb/r8a66597.h | ||
| 749 | header-test- += linux/usb/rndis_host.h | ||
| 750 | header-test- += linux/usb/serial.h | ||
| 751 | header-test- += linux/usb/sl811.h | ||
| 752 | header-test- += linux/usb/storage.h | ||
| 753 | header-test- += linux/usb/uas.h | ||
| 754 | header-test- += linux/usb/usb338x.h | ||
| 755 | header-test- += linux/usb/usbnet.h | ||
| 756 | header-test- += linux/usb/wusb-wa.h | ||
| 757 | header-test- += linux/usb/xhci-dbgp.h | ||
| 758 | header-test- += linux/usb_usual.h | ||
| 759 | header-test- += linux/user-return-notifier.h | ||
| 760 | header-test- += linux/userfaultfd_k.h | ||
| 761 | header-test- += linux/verification.h | ||
| 762 | header-test- += linux/vgaarb.h | ||
| 763 | header-test- += linux/via_core.h | ||
| 764 | header-test- += linux/via_i2c.h | ||
| 765 | header-test- += linux/virtio_byteorder.h | ||
| 766 | header-test- += linux/virtio_ring.h | ||
| 767 | header-test- += linux/visorbus.h | ||
| 768 | header-test- += linux/vme.h | ||
| 769 | header-test- += linux/vmstat.h | ||
| 770 | header-test- += linux/vmw_vmci_api.h | ||
| 771 | header-test- += linux/vmw_vmci_defs.h | ||
| 772 | header-test- += linux/vringh.h | ||
| 773 | header-test- += linux/vt_buffer.h | ||
| 774 | header-test- += linux/zorro.h | ||
| 775 | header-test- += linux/zpool.h | ||
| 776 | header-test- += math-emu/double.h | ||
| 777 | header-test- += math-emu/op-common.h | ||
| 778 | header-test- += math-emu/quad.h | ||
| 779 | header-test- += math-emu/single.h | ||
| 780 | header-test- += math-emu/soft-fp.h | ||
| 781 | header-test- += media/davinci/dm355_ccdc.h | ||
| 782 | header-test- += media/davinci/dm644x_ccdc.h | ||
| 783 | header-test- += media/davinci/isif.h | ||
| 784 | header-test- += media/davinci/vpbe_osd.h | ||
| 785 | header-test- += media/davinci/vpbe_types.h | ||
| 786 | header-test- += media/davinci/vpif_types.h | ||
| 787 | header-test- += media/demux.h | ||
| 788 | header-test- += media/drv-intf/soc_mediabus.h | ||
| 789 | header-test- += media/dvb_net.h | ||
| 790 | header-test- += media/fwht-ctrls.h | ||
| 791 | header-test- += media/i2c/ad9389b.h | ||
| 792 | header-test- += media/i2c/adv7343.h | ||
| 793 | header-test- += media/i2c/adv7511.h | ||
| 794 | header-test- += media/i2c/adv7842.h | ||
| 795 | header-test- += media/i2c/m5mols.h | ||
| 796 | header-test- += media/i2c/mt9m032.h | ||
| 797 | header-test- += media/i2c/mt9t112.h | ||
| 798 | header-test- += media/i2c/mt9v032.h | ||
| 799 | header-test- += media/i2c/ov2659.h | ||
| 800 | header-test- += media/i2c/ov7670.h | ||
| 801 | header-test- += media/i2c/rj54n1cb0c.h | ||
| 802 | header-test- += media/i2c/saa6588.h | ||
| 803 | header-test- += media/i2c/saa7115.h | ||
| 804 | header-test- += media/i2c/sr030pc30.h | ||
| 805 | header-test- += media/i2c/tc358743.h | ||
| 806 | header-test- += media/i2c/tda1997x.h | ||
| 807 | header-test- += media/i2c/ths7303.h | ||
| 808 | header-test- += media/i2c/tvaudio.h | ||
| 809 | header-test- += media/i2c/tvp514x.h | ||
| 810 | header-test- += media/i2c/tvp7002.h | ||
| 811 | header-test- += media/i2c/wm8775.h | ||
| 812 | header-test- += media/imx.h | ||
| 813 | header-test- += media/media-dev-allocator.h | ||
| 814 | header-test- += media/mpeg2-ctrls.h | ||
| 815 | header-test- += media/rcar-fcp.h | ||
| 816 | header-test- += media/tuner-types.h | ||
| 817 | header-test- += media/tveeprom.h | ||
| 818 | header-test- += media/v4l2-flash-led-class.h | ||
| 819 | header-test- += misc/altera.h | ||
| 820 | header-test- += misc/cxl-base.h | ||
| 821 | header-test- += misc/cxllib.h | ||
| 822 | header-test- += net/9p/9p.h | ||
| 823 | header-test- += net/9p/client.h | ||
| 824 | header-test- += net/9p/transport.h | ||
| 825 | header-test- += net/af_vsock.h | ||
| 826 | header-test- += net/ax88796.h | ||
| 827 | header-test- += net/bluetooth/hci.h | ||
| 828 | header-test- += net/bluetooth/hci_core.h | ||
| 829 | header-test- += net/bluetooth/hci_mon.h | ||
| 830 | header-test- += net/bluetooth/hci_sock.h | ||
| 831 | header-test- += net/bluetooth/l2cap.h | ||
| 832 | header-test- += net/bluetooth/mgmt.h | ||
| 833 | header-test- += net/bluetooth/rfcomm.h | ||
| 834 | header-test- += net/bluetooth/sco.h | ||
| 835 | header-test- += net/bond_options.h | ||
| 836 | header-test- += net/caif/cfsrvl.h | ||
| 837 | header-test- += net/codel_impl.h | ||
| 838 | header-test- += net/codel_qdisc.h | ||
| 839 | header-test- += net/compat.h | ||
| 840 | header-test- += net/datalink.h | ||
| 841 | header-test- += net/dcbevent.h | ||
| 842 | header-test- += net/dcbnl.h | ||
| 843 | header-test- += net/dn_dev.h | ||
| 844 | header-test- += net/dn_fib.h | ||
| 845 | header-test- += net/dn_neigh.h | ||
| 846 | header-test- += net/dn_nsp.h | ||
| 847 | header-test- += net/dn_route.h | ||
| 848 | header-test- += net/erspan.h | ||
| 849 | header-test- += net/esp.h | ||
| 850 | header-test- += net/ethoc.h | ||
| 851 | header-test- += net/firewire.h | ||
| 852 | header-test- += net/flow_offload.h | ||
| 853 | header-test- += net/fq.h | ||
| 854 | header-test- += net/fq_impl.h | ||
| 855 | header-test- += net/garp.h | ||
| 856 | header-test- += net/gtp.h | ||
| 857 | header-test- += net/gue.h | ||
| 858 | header-test- += net/hwbm.h | ||
| 859 | header-test- += net/ila.h | ||
| 860 | header-test- += net/inet6_connection_sock.h | ||
| 861 | header-test- += net/inet_common.h | ||
| 862 | header-test- += net/inet_frag.h | ||
| 863 | header-test- += net/ip6_route.h | ||
| 864 | header-test- += net/ip_vs.h | ||
| 865 | header-test- += net/ipcomp.h | ||
| 866 | header-test- += net/ipconfig.h | ||
| 867 | header-test- += net/iucv/af_iucv.h | ||
| 868 | header-test- += net/iucv/iucv.h | ||
| 869 | header-test- += net/lapb.h | ||
| 870 | header-test- += net/llc_c_ac.h | ||
| 871 | header-test- += net/llc_c_st.h | ||
| 872 | header-test- += net/llc_s_ac.h | ||
| 873 | header-test- += net/llc_s_ev.h | ||
| 874 | header-test- += net/llc_s_st.h | ||
| 875 | header-test- += net/mpls_iptunnel.h | ||
| 876 | header-test- += net/mrp.h | ||
| 877 | header-test- += net/ncsi.h | ||
| 878 | header-test- += net/netevent.h | ||
| 879 | header-test- += net/netfilter/br_netfilter.h | ||
| 880 | header-test- += net/netfilter/ipv4/nf_dup_ipv4.h | ||
| 881 | header-test- += net/netfilter/ipv6/nf_defrag_ipv6.h | ||
| 882 | header-test- += net/netfilter/ipv6/nf_dup_ipv6.h | ||
| 883 | header-test- += net/netfilter/nf_conntrack.h | ||
| 884 | header-test- += net/netfilter/nf_conntrack_acct.h | ||
| 885 | header-test- += net/netfilter/nf_conntrack_bridge.h | ||
| 886 | header-test- += net/netfilter/nf_conntrack_core.h | ||
| 887 | header-test- += net/netfilter/nf_conntrack_count.h | ||
| 888 | header-test- += net/netfilter/nf_conntrack_ecache.h | ||
| 889 | header-test- += net/netfilter/nf_conntrack_expect.h | ||
| 890 | header-test- += net/netfilter/nf_conntrack_extend.h | ||
| 891 | header-test- += net/netfilter/nf_conntrack_helper.h | ||
| 892 | header-test- += net/netfilter/nf_conntrack_l4proto.h | ||
| 893 | header-test- += net/netfilter/nf_conntrack_labels.h | ||
| 894 | header-test- += net/netfilter/nf_conntrack_seqadj.h | ||
| 895 | header-test- += net/netfilter/nf_conntrack_synproxy.h | ||
| 896 | header-test- += net/netfilter/nf_conntrack_timeout.h | ||
| 897 | header-test- += net/netfilter/nf_conntrack_timestamp.h | ||
| 898 | header-test- += net/netfilter/nf_conntrack_tuple.h | ||
| 899 | header-test- += net/netfilter/nf_dup_netdev.h | ||
| 900 | header-test- += net/netfilter/nf_flow_table.h | ||
| 901 | header-test- += net/netfilter/nf_nat.h | ||
| 902 | header-test- += net/netfilter/nf_nat_helper.h | ||
| 903 | header-test- += net/netfilter/nf_nat_masquerade.h | ||
| 904 | header-test- += net/netfilter/nf_nat_redirect.h | ||
| 905 | header-test- += net/netfilter/nf_queue.h | ||
| 906 | header-test- += net/netfilter/nf_reject.h | ||
| 907 | header-test- += net/netfilter/nf_synproxy.h | ||
| 908 | header-test- += net/netfilter/nf_tables.h | ||
| 909 | header-test- += net/netfilter/nf_tables_core.h | ||
| 910 | header-test- += net/netfilter/nf_tables_ipv4.h | ||
| 911 | header-test- += net/netfilter/nf_tables_ipv6.h | ||
| 912 | header-test- += net/netfilter/nft_fib.h | ||
| 913 | header-test- += net/netfilter/nft_meta.h | ||
| 914 | header-test- += net/netfilter/nft_reject.h | ||
| 915 | header-test- += net/netns/can.h | ||
| 916 | header-test- += net/netns/generic.h | ||
| 917 | header-test- += net/netns/ieee802154_6lowpan.h | ||
| 918 | header-test- += net/netns/ipv4.h | ||
| 919 | header-test- += net/netns/ipv6.h | ||
| 920 | header-test- += net/netns/mpls.h | ||
| 921 | header-test- += net/netns/nftables.h | ||
| 922 | header-test- += net/netns/sctp.h | ||
| 923 | header-test- += net/netrom.h | ||
| 924 | header-test- += net/p8022.h | ||
| 925 | header-test- += net/phonet/pep.h | ||
| 926 | header-test- += net/phonet/phonet.h | ||
| 927 | header-test- += net/phonet/pn_dev.h | ||
| 928 | header-test- += net/pptp.h | ||
| 929 | header-test- += net/psample.h | ||
| 930 | header-test- += net/psnap.h | ||
| 931 | header-test- += net/regulatory.h | ||
| 932 | header-test- += net/rose.h | ||
| 933 | header-test- += net/sctp/auth.h | ||
| 934 | header-test- += net/sctp/stream_interleave.h | ||
| 935 | header-test- += net/sctp/stream_sched.h | ||
| 936 | header-test- += net/sctp/tsnmap.h | ||
| 937 | header-test- += net/sctp/ulpevent.h | ||
| 938 | header-test- += net/sctp/ulpqueue.h | ||
| 939 | header-test- += net/secure_seq.h | ||
| 940 | header-test- += net/smc.h | ||
| 941 | header-test- += net/stp.h | ||
| 942 | header-test- += net/transp_v6.h | ||
| 943 | header-test- += net/tun_proto.h | ||
| 944 | header-test- += net/udplite.h | ||
| 945 | header-test- += net/xdp.h | ||
| 946 | header-test- += net/xdp_priv.h | ||
| 947 | header-test- += pcmcia/cistpl.h | ||
| 948 | header-test- += pcmcia/ds.h | ||
| 949 | header-test- += rdma/ib.h | ||
| 950 | header-test- += rdma/iw_portmap.h | ||
| 951 | header-test- += rdma/opa_port_info.h | ||
| 952 | header-test- += rdma/rdma_counter.h | ||
| 953 | header-test- += rdma/rdmavt_cq.h | ||
| 954 | header-test- += rdma/restrack.h | ||
| 955 | header-test- += rdma/signature.h | ||
| 956 | header-test- += rdma/tid_rdma_defs.h | ||
| 957 | header-test- += scsi/fc/fc_encaps.h | ||
| 958 | header-test- += scsi/fc/fc_fc2.h | ||
| 959 | header-test- += scsi/fc/fc_fcoe.h | ||
| 960 | header-test- += scsi/fc/fc_fip.h | ||
| 961 | header-test- += scsi/fc_encode.h | ||
| 962 | header-test- += scsi/fc_frame.h | ||
| 963 | header-test- += scsi/iser.h | ||
| 964 | header-test- += scsi/libfc.h | ||
| 965 | header-test- += scsi/libfcoe.h | ||
| 966 | header-test- += scsi/libsas.h | ||
| 967 | header-test- += scsi/sas_ata.h | ||
| 968 | header-test- += scsi/scsi_cmnd.h | ||
| 969 | header-test- += scsi/scsi_dbg.h | ||
| 970 | header-test- += scsi/scsi_device.h | ||
| 971 | header-test- += scsi/scsi_dh.h | ||
| 972 | header-test- += scsi/scsi_eh.h | ||
| 973 | header-test- += scsi/scsi_host.h | ||
| 974 | header-test- += scsi/scsi_ioctl.h | ||
| 975 | header-test- += scsi/scsi_request.h | ||
| 976 | header-test- += scsi/scsi_tcq.h | ||
| 977 | header-test- += scsi/scsi_transport.h | ||
| 978 | header-test- += scsi/scsi_transport_fc.h | ||
| 979 | header-test- += scsi/scsi_transport_sas.h | ||
| 980 | header-test- += scsi/scsi_transport_spi.h | ||
| 981 | header-test- += scsi/scsi_transport_srp.h | ||
| 982 | header-test- += scsi/scsicam.h | ||
| 983 | header-test- += scsi/sg.h | ||
| 984 | header-test- += soc/arc/aux.h | ||
| 985 | header-test- += soc/arc/mcip.h | ||
| 986 | header-test- += soc/arc/timers.h | ||
| 987 | header-test- += soc/brcmstb/common.h | ||
| 988 | header-test- += soc/fsl/bman.h | ||
| 989 | header-test- += soc/fsl/qe/qe.h | ||
| 990 | header-test- += soc/fsl/qe/qe_ic.h | ||
| 991 | header-test- += soc/fsl/qe/qe_tdm.h | ||
| 992 | header-test- += soc/fsl/qe/ucc.h | ||
| 993 | header-test- += soc/fsl/qe/ucc_fast.h | ||
| 994 | header-test- += soc/fsl/qe/ucc_slow.h | ||
| 995 | header-test- += soc/fsl/qman.h | ||
| 996 | header-test- += soc/nps/common.h | ||
| 997 | header-test-$(CONFIG_ARC) += soc/nps/mtm.h | ||
| 998 | header-test- += soc/qcom/cmd-db.h | ||
| 999 | header-test- += soc/qcom/rpmh.h | ||
| 1000 | header-test- += soc/qcom/tcs.h | ||
| 1001 | header-test- += soc/tegra/ahb.h | ||
| 1002 | header-test- += soc/tegra/bpmp-abi.h | ||
| 1003 | header-test- += soc/tegra/common.h | ||
| 1004 | header-test- += soc/tegra/flowctrl.h | ||
| 1005 | header-test- += soc/tegra/fuse.h | ||
| 1006 | header-test- += soc/tegra/mc.h | ||
| 1007 | header-test- += sound/ac97/compat.h | ||
| 1008 | header-test- += sound/aci.h | ||
| 1009 | header-test- += sound/ad1843.h | ||
| 1010 | header-test- += sound/adau1373.h | ||
| 1011 | header-test- += sound/ak4113.h | ||
| 1012 | header-test- += sound/ak4114.h | ||
| 1013 | header-test- += sound/ak4117.h | ||
| 1014 | header-test- += sound/cs35l33.h | ||
| 1015 | header-test- += sound/cs35l34.h | ||
| 1016 | header-test- += sound/cs35l35.h | ||
| 1017 | header-test- += sound/cs35l36.h | ||
| 1018 | header-test- += sound/cs4271.h | ||
| 1019 | header-test- += sound/cs42l52.h | ||
| 1020 | header-test- += sound/cs8427.h | ||
| 1021 | header-test- += sound/da7218.h | ||
| 1022 | header-test- += sound/da7219-aad.h | ||
| 1023 | header-test- += sound/da7219.h | ||
| 1024 | header-test- += sound/da9055.h | ||
| 1025 | header-test- += sound/emu8000.h | ||
| 1026 | header-test- += sound/emux_synth.h | ||
| 1027 | header-test- += sound/hda_component.h | ||
| 1028 | header-test- += sound/hda_hwdep.h | ||
| 1029 | header-test- += sound/hda_i915.h | ||
| 1030 | header-test- += sound/hwdep.h | ||
| 1031 | header-test- += sound/i2c.h | ||
| 1032 | header-test- += sound/l3.h | ||
| 1033 | header-test- += sound/max98088.h | ||
| 1034 | header-test- += sound/max98095.h | ||
| 1035 | header-test- += sound/mixer_oss.h | ||
| 1036 | header-test- += sound/omap-hdmi-audio.h | ||
| 1037 | header-test- += sound/pcm_drm_eld.h | ||
| 1038 | header-test- += sound/pcm_iec958.h | ||
| 1039 | header-test- += sound/pcm_oss.h | ||
| 1040 | header-test- += sound/pxa2xx-lib.h | ||
| 1041 | header-test- += sound/rt286.h | ||
| 1042 | header-test- += sound/rt298.h | ||
| 1043 | header-test- += sound/rt5645.h | ||
| 1044 | header-test- += sound/rt5659.h | ||
| 1045 | header-test- += sound/rt5660.h | ||
| 1046 | header-test- += sound/rt5665.h | ||
| 1047 | header-test- += sound/rt5670.h | ||
| 1048 | header-test- += sound/s3c24xx_uda134x.h | ||
| 1049 | header-test- += sound/seq_device.h | ||
| 1050 | header-test- += sound/seq_kernel.h | ||
| 1051 | header-test- += sound/seq_midi_emul.h | ||
| 1052 | header-test- += sound/seq_oss.h | ||
| 1053 | header-test- += sound/soc-acpi-intel-match.h | ||
| 1054 | header-test- += sound/soc-dai.h | ||
| 1055 | header-test- += sound/soc-dapm.h | ||
| 1056 | header-test- += sound/soc-dpcm.h | ||
| 1057 | header-test- += sound/sof/control.h | ||
| 1058 | header-test- += sound/sof/dai-intel.h | ||
| 1059 | header-test- += sound/sof/dai.h | ||
| 1060 | header-test- += sound/sof/header.h | ||
| 1061 | header-test- += sound/sof/info.h | ||
| 1062 | header-test- += sound/sof/pm.h | ||
| 1063 | header-test- += sound/sof/stream.h | ||
| 1064 | header-test- += sound/sof/topology.h | ||
| 1065 | header-test- += sound/sof/trace.h | ||
| 1066 | header-test- += sound/sof/xtensa.h | ||
| 1067 | header-test- += sound/spear_spdif.h | ||
| 1068 | header-test- += sound/sta32x.h | ||
| 1069 | header-test- += sound/sta350.h | ||
| 1070 | header-test- += sound/tea6330t.h | ||
| 1071 | header-test- += sound/tlv320aic32x4.h | ||
| 1072 | header-test- += sound/tlv320dac33-plat.h | ||
| 1073 | header-test- += sound/uda134x.h | ||
| 1074 | header-test- += sound/wavefront.h | ||
| 1075 | header-test- += sound/wm8903.h | ||
| 1076 | header-test- += sound/wm8904.h | ||
| 1077 | header-test- += sound/wm8960.h | ||
| 1078 | header-test- += sound/wm8962.h | ||
| 1079 | header-test- += sound/wm8993.h | ||
| 1080 | header-test- += sound/wm8996.h | ||
| 1081 | header-test- += sound/wm9081.h | ||
| 1082 | header-test- += sound/wm9090.h | ||
| 1083 | header-test- += target/iscsi/iscsi_target_stat.h | ||
| 1084 | header-test- += trace/bpf_probe.h | ||
| 1085 | header-test- += trace/events/9p.h | ||
| 1086 | header-test- += trace/events/afs.h | ||
| 1087 | header-test- += trace/events/asoc.h | ||
| 1088 | header-test- += trace/events/bcache.h | ||
| 1089 | header-test- += trace/events/block.h | ||
| 1090 | header-test- += trace/events/cachefiles.h | ||
| 1091 | header-test- += trace/events/cgroup.h | ||
| 1092 | header-test- += trace/events/clk.h | ||
| 1093 | header-test- += trace/events/cma.h | ||
| 1094 | header-test- += trace/events/ext4.h | ||
| 1095 | header-test- += trace/events/f2fs.h | ||
| 1096 | header-test- += trace/events/fs_dax.h | ||
| 1097 | header-test- += trace/events/fscache.h | ||
| 1098 | header-test- += trace/events/fsi.h | ||
| 1099 | header-test- += trace/events/fsi_master_ast_cf.h | ||
| 1100 | header-test- += trace/events/fsi_master_gpio.h | ||
| 1101 | header-test- += trace/events/huge_memory.h | ||
| 1102 | header-test- += trace/events/ib_mad.h | ||
| 1103 | header-test- += trace/events/ib_umad.h | ||
| 1104 | header-test- += trace/events/iscsi.h | ||
| 1105 | header-test- += trace/events/jbd2.h | ||
| 1106 | header-test- += trace/events/kvm.h | ||
| 1107 | header-test- += trace/events/kyber.h | ||
| 1108 | header-test- += trace/events/libata.h | ||
| 1109 | header-test- += trace/events/mce.h | ||
| 1110 | header-test- += trace/events/mdio.h | ||
| 1111 | header-test- += trace/events/migrate.h | ||
| 1112 | header-test- += trace/events/mmflags.h | ||
| 1113 | header-test- += trace/events/nbd.h | ||
| 1114 | header-test- += trace/events/nilfs2.h | ||
| 1115 | header-test- += trace/events/pwc.h | ||
| 1116 | header-test- += trace/events/rdma.h | ||
| 1117 | header-test- += trace/events/rpcgss.h | ||
| 1118 | header-test- += trace/events/rpcrdma.h | ||
| 1119 | header-test- += trace/events/rxrpc.h | ||
| 1120 | header-test- += trace/events/scsi.h | ||
| 1121 | header-test- += trace/events/siox.h | ||
| 1122 | header-test- += trace/events/spi.h | ||
| 1123 | header-test- += trace/events/swiotlb.h | ||
| 1124 | header-test- += trace/events/syscalls.h | ||
| 1125 | header-test- += trace/events/target.h | ||
| 1126 | header-test- += trace/events/thermal_power_allocator.h | ||
| 1127 | header-test- += trace/events/timer.h | ||
| 1128 | header-test- += trace/events/wbt.h | ||
| 1129 | header-test- += trace/events/xen.h | ||
| 1130 | header-test- += trace/perf.h | ||
| 1131 | header-test- += trace/trace_events.h | ||
| 1132 | header-test- += uapi/drm/vmwgfx_drm.h | ||
| 1133 | header-test- += uapi/linux/a.out.h | ||
| 1134 | header-test- += uapi/linux/coda.h | ||
| 1135 | header-test- += uapi/linux/coda_psdev.h | ||
| 1136 | header-test- += uapi/linux/errqueue.h | ||
| 1137 | header-test- += uapi/linux/eventpoll.h | ||
| 1138 | header-test- += uapi/linux/hdlc/ioctl.h | ||
| 1139 | header-test- += uapi/linux/input.h | ||
| 1140 | header-test- += uapi/linux/kvm.h | ||
| 1141 | header-test- += uapi/linux/kvm_para.h | ||
| 1142 | header-test- += uapi/linux/lightnvm.h | ||
| 1143 | header-test- += uapi/linux/mic_common.h | ||
| 1144 | header-test- += uapi/linux/mman.h | ||
| 1145 | header-test- += uapi/linux/netfilter/ipset/ip_set_bitmap.h | ||
| 1146 | header-test- += uapi/linux/netfilter/ipset/ip_set_hash.h | ||
| 1147 | header-test- += uapi/linux/netfilter/ipset/ip_set_list.h | ||
| 1148 | header-test- += uapi/linux/netfilter/nf_synproxy.h | ||
| 1149 | header-test- += uapi/linux/netfilter/xt_policy.h | ||
| 1150 | header-test- += uapi/linux/netfilter/xt_set.h | ||
| 1151 | header-test- += uapi/linux/netfilter_arp/arp_tables.h | ||
| 1152 | header-test- += uapi/linux/netfilter_arp/arpt_mangle.h | ||
| 1153 | header-test- += uapi/linux/netfilter_ipv4/ip_tables.h | ||
| 1154 | header-test- += uapi/linux/netfilter_ipv4/ipt_LOG.h | ||
| 1155 | header-test- += uapi/linux/netfilter_ipv6/ip6_tables.h | ||
| 1156 | header-test- += uapi/linux/netfilter_ipv6/ip6t_LOG.h | ||
| 1157 | header-test- += uapi/linux/nilfs2_ondisk.h | ||
| 1158 | header-test- += uapi/linux/patchkey.h | ||
| 1159 | header-test- += uapi/linux/ptrace.h | ||
| 1160 | header-test- += uapi/linux/scc.h | ||
| 1161 | header-test- += uapi/linux/seg6_iptunnel.h | ||
| 1162 | header-test- += uapi/linux/smc_diag.h | ||
| 1163 | header-test- += uapi/linux/timex.h | ||
| 1164 | header-test- += uapi/linux/videodev2.h | ||
| 1165 | header-test- += uapi/scsi/scsi_bsg_fc.h | ||
| 1166 | header-test- += uapi/sound/asound.h | ||
| 1167 | header-test- += uapi/sound/sof/eq.h | ||
| 1168 | header-test- += uapi/sound/sof/fw.h | ||
| 1169 | header-test- += uapi/sound/sof/header.h | ||
| 1170 | header-test- += uapi/sound/sof/manifest.h | ||
| 1171 | header-test- += uapi/sound/sof/trace.h | ||
| 1172 | header-test- += uapi/xen/evtchn.h | ||
| 1173 | header-test- += uapi/xen/gntdev.h | ||
| 1174 | header-test- += uapi/xen/privcmd.h | ||
| 1175 | header-test- += vdso/vsyscall.h | ||
| 1176 | header-test- += video/broadsheetfb.h | ||
| 1177 | header-test- += video/cvisionppc.h | ||
| 1178 | header-test- += video/gbe.h | ||
| 1179 | header-test- += video/kyro.h | ||
| 1180 | header-test- += video/maxinefb.h | ||
| 1181 | header-test- += video/metronomefb.h | ||
| 1182 | header-test- += video/neomagic.h | ||
| 1183 | header-test- += video/of_display_timing.h | ||
| 1184 | header-test- += video/omapvrfb.h | ||
| 1185 | header-test- += video/s1d13xxxfb.h | ||
| 1186 | header-test- += video/sstfb.h | ||
| 1187 | header-test- += video/tgafb.h | ||
| 1188 | header-test- += video/udlfb.h | ||
| 1189 | header-test- += video/uvesafb.h | ||
| 1190 | header-test- += video/vga.h | ||
| 1191 | header-test- += video/w100fb.h | ||
| 1192 | header-test- += xen/acpi.h | ||
| 1193 | header-test- += xen/arm/hypercall.h | ||
| 1194 | header-test- += xen/arm/page-coherent.h | ||
| 1195 | header-test- += xen/arm/page.h | ||
| 1196 | header-test- += xen/balloon.h | ||
| 1197 | header-test- += xen/events.h | ||
| 1198 | header-test- += xen/features.h | ||
| 1199 | header-test- += xen/grant_table.h | ||
| 1200 | header-test- += xen/hvm.h | ||
| 1201 | header-test- += xen/interface/callback.h | ||
| 1202 | header-test- += xen/interface/event_channel.h | ||
| 1203 | header-test- += xen/interface/grant_table.h | ||
| 1204 | header-test- += xen/interface/hvm/dm_op.h | ||
| 1205 | header-test- += xen/interface/hvm/hvm_op.h | ||
| 1206 | header-test- += xen/interface/hvm/hvm_vcpu.h | ||
| 1207 | header-test- += xen/interface/hvm/params.h | ||
| 1208 | header-test- += xen/interface/hvm/start_info.h | ||
| 1209 | header-test- += xen/interface/io/9pfs.h | ||
| 1210 | header-test- += xen/interface/io/blkif.h | ||
| 1211 | header-test- += xen/interface/io/console.h | ||
| 1212 | header-test- += xen/interface/io/displif.h | ||
| 1213 | header-test- += xen/interface/io/fbif.h | ||
| 1214 | header-test- += xen/interface/io/kbdif.h | ||
| 1215 | header-test- += xen/interface/io/netif.h | ||
| 1216 | header-test- += xen/interface/io/pciif.h | ||
| 1217 | header-test- += xen/interface/io/protocols.h | ||
| 1218 | header-test- += xen/interface/io/pvcalls.h | ||
| 1219 | header-test- += xen/interface/io/ring.h | ||
| 1220 | header-test- += xen/interface/io/sndif.h | ||
| 1221 | header-test- += xen/interface/io/tpmif.h | ||
| 1222 | header-test- += xen/interface/io/vscsiif.h | ||
| 1223 | header-test- += xen/interface/io/xs_wire.h | ||
| 1224 | header-test- += xen/interface/memory.h | ||
| 1225 | header-test- += xen/interface/nmi.h | ||
| 1226 | header-test- += xen/interface/physdev.h | ||
| 1227 | header-test- += xen/interface/platform.h | ||
| 1228 | header-test- += xen/interface/sched.h | ||
| 1229 | header-test- += xen/interface/vcpu.h | ||
| 1230 | header-test- += xen/interface/version.h | ||
| 1231 | header-test- += xen/interface/xen-mca.h | ||
| 1232 | header-test- += xen/interface/xen.h | ||
| 1233 | header-test- += xen/interface/xenpmu.h | ||
| 1234 | header-test- += xen/mem-reservation.h | ||
| 1235 | header-test- += xen/page.h | ||
| 1236 | header-test- += xen/platform_pci.h | ||
| 1237 | header-test- += xen/swiotlb-xen.h | ||
| 1238 | header-test- += xen/xen-front-pgdir-shbuf.h | ||
| 1239 | header-test- += xen/xen-ops.h | ||
| 1240 | header-test- += xen/xen.h | ||
| 1241 | header-test- += xen/xenbus.h | ||
| 1242 | |||
| 1243 | # Do not include directly | ||
| 1244 | header-test- += linux/compiler-clang.h | ||
| 1245 | header-test- += linux/compiler-gcc.h | ||
| 1246 | header-test- += linux/patchkey.h | ||
| 1247 | header-test- += linux/rwlock_api_smp.h | ||
| 1248 | header-test- += linux/spinlock_types_up.h | ||
| 1249 | header-test- += linux/spinlock_up.h | ||
| 1250 | header-test- += linux/wimax/debug.h | ||
| 1251 | header-test- += rdma/uverbs_named_ioctl.h | ||
| 1252 | |||
| 1253 | # asm-generic/*.h is used by asm/*.h, and should not be included directly | ||
| 1254 | header-test- += asm-generic/% uapi/asm-generic/% | ||
| 1255 | |||
| 1256 | # Timestamp files touched by Kconfig | ||
| 1257 | header-test- += config/% | ||
| 1258 | |||
| 1259 | # Timestamp files touched by scripts/adjust_autoksyms.sh | ||
| 1260 | header-test- += ksym/% | ||
| 1261 | |||
| 1262 | # You could compile-test these, but maybe not so useful... | ||
| 1263 | header-test- += dt-bindings/% | ||
| 1264 | |||
| 1265 | # Do not test generated headers. Stale headers are often left over when you | ||
| 1266 | # traverse the git history without cleaning. | ||
| 1267 | header-test- += generated/% | ||
| 1268 | |||
| 1269 | # The rest are compile-tested | ||
| 1270 | header-test-pattern-y += */*.h */*/*.h */*/*/*.h */*/*/*/*.h | ||
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 31b6c87d6240..175f7b40c585 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -506,13 +506,16 @@ int acpi_bus_get_status(struct acpi_device *device); | |||
| 506 | 506 | ||
| 507 | int acpi_bus_set_power(acpi_handle handle, int state); | 507 | int acpi_bus_set_power(acpi_handle handle, int state); |
| 508 | const char *acpi_power_state_string(int state); | 508 | const char *acpi_power_state_string(int state); |
| 509 | int acpi_device_get_power(struct acpi_device *device, int *state); | ||
| 510 | int acpi_device_set_power(struct acpi_device *device, int state); | 509 | int acpi_device_set_power(struct acpi_device *device, int state); |
| 511 | int acpi_bus_init_power(struct acpi_device *device); | 510 | int acpi_bus_init_power(struct acpi_device *device); |
| 512 | int acpi_device_fix_up_power(struct acpi_device *device); | 511 | int acpi_device_fix_up_power(struct acpi_device *device); |
| 513 | int acpi_bus_update_power(acpi_handle handle, int *state_p); | 512 | int acpi_bus_update_power(acpi_handle handle, int *state_p); |
| 514 | int acpi_device_update_power(struct acpi_device *device, int *state_p); | 513 | int acpi_device_update_power(struct acpi_device *device, int *state_p); |
| 515 | bool acpi_bus_power_manageable(acpi_handle handle); | 514 | bool acpi_bus_power_manageable(acpi_handle handle); |
| 515 | int acpi_device_power_add_dependent(struct acpi_device *adev, | ||
| 516 | struct device *dev); | ||
| 517 | void acpi_device_power_remove_dependent(struct acpi_device *adev, | ||
| 518 | struct device *dev); | ||
| 516 | 519 | ||
| 517 | #ifdef CONFIG_PM | 520 | #ifdef CONFIG_PM |
| 518 | bool acpi_bus_can_wakeup(acpi_handle handle); | 521 | bool acpi_bus_can_wakeup(acpi_handle handle); |
| @@ -651,6 +654,12 @@ static inline int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable) | |||
| 651 | } | 654 | } |
| 652 | #endif | 655 | #endif |
| 653 | 656 | ||
| 657 | #ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT | ||
| 658 | bool acpi_sleep_state_supported(u8 sleep_state); | ||
| 659 | #else | ||
| 660 | static inline bool acpi_sleep_state_supported(u8 sleep_state) { return false; } | ||
| 661 | #endif | ||
| 662 | |||
| 654 | #ifdef CONFIG_ACPI_SLEEP | 663 | #ifdef CONFIG_ACPI_SLEEP |
| 655 | u32 acpi_target_system_state(void); | 664 | u32 acpi_target_system_state(void); |
| 656 | #else | 665 | #else |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index 84f2b3642ab0..5eb175933a5b 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #define ACPI_MAX_STRING 80 | 12 | #define ACPI_MAX_STRING 80 |
| 13 | 13 | ||
| 14 | /* | 14 | /* |
| 15 | * Please update drivers/acpi/debug.c and Documentation/acpi/debug.txt | 15 | * Please update drivers/acpi/debug.c and Documentation/firmware-guide/acpi/debug.rst |
| 16 | * if you add to this list. | 16 | * if you add to this list. |
| 17 | */ | 17 | */ |
| 18 | #define ACPI_BUS_COMPONENT 0x00010000 | 18 | #define ACPI_BUS_COMPONENT 0x00010000 |
diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h index d0633fc1fc15..12d8bd333fe7 100644 --- a/include/acpi/acpi_io.h +++ b/include/acpi/acpi_io.h | |||
| @@ -16,8 +16,8 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, | |||
| 16 | 16 | ||
| 17 | extern bool acpi_permanent_mmap; | 17 | extern bool acpi_permanent_mmap; |
| 18 | 18 | ||
| 19 | void __iomem *__ref | 19 | void __iomem __ref |
| 20 | acpi_os_map_iomem(acpi_physical_address phys, acpi_size size); | 20 | *acpi_os_map_iomem(acpi_physical_address phys, acpi_size size); |
| 21 | void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size); | 21 | void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size); |
| 22 | void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); | 22 | void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); |
| 23 | 23 | ||
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 4a8a05401fb5..3845c8fcc94e 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 13 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
| 14 | 14 | ||
| 15 | #define ACPI_CA_VERSION 0x20190509 | 15 | #define ACPI_CA_VERSION 0x20190703 |
| 16 | 16 | ||
| 17 | #include <acpi/acconfig.h> | 17 | #include <acpi/acconfig.h> |
| 18 | #include <acpi/actypes.h> | 18 | #include <acpi/actypes.h> |
diff --git a/include/asm-generic/atomic64.h b/include/asm-generic/atomic64.h index d7a15096fb3b..370f01d4450f 100644 --- a/include/asm-generic/atomic64.h +++ b/include/asm-generic/atomic64.h | |||
| @@ -10,24 +10,24 @@ | |||
| 10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
| 11 | 11 | ||
| 12 | typedef struct { | 12 | typedef struct { |
| 13 | long long counter; | 13 | s64 counter; |
| 14 | } atomic64_t; | 14 | } atomic64_t; |
| 15 | 15 | ||
| 16 | #define ATOMIC64_INIT(i) { (i) } | 16 | #define ATOMIC64_INIT(i) { (i) } |
| 17 | 17 | ||
| 18 | extern long long atomic64_read(const atomic64_t *v); | 18 | extern s64 atomic64_read(const atomic64_t *v); |
| 19 | extern void atomic64_set(atomic64_t *v, long long i); | 19 | extern void atomic64_set(atomic64_t *v, s64 i); |
| 20 | 20 | ||
| 21 | #define atomic64_set_release(v, i) atomic64_set((v), (i)) | 21 | #define atomic64_set_release(v, i) atomic64_set((v), (i)) |
| 22 | 22 | ||
| 23 | #define ATOMIC64_OP(op) \ | 23 | #define ATOMIC64_OP(op) \ |
| 24 | extern void atomic64_##op(long long a, atomic64_t *v); | 24 | extern void atomic64_##op(s64 a, atomic64_t *v); |
| 25 | 25 | ||
| 26 | #define ATOMIC64_OP_RETURN(op) \ | 26 | #define ATOMIC64_OP_RETURN(op) \ |
| 27 | extern long long atomic64_##op##_return(long long a, atomic64_t *v); | 27 | extern s64 atomic64_##op##_return(s64 a, atomic64_t *v); |
| 28 | 28 | ||
| 29 | #define ATOMIC64_FETCH_OP(op) \ | 29 | #define ATOMIC64_FETCH_OP(op) \ |
| 30 | extern long long atomic64_fetch_##op(long long a, atomic64_t *v); | 30 | extern s64 atomic64_fetch_##op(s64 a, atomic64_t *v); |
| 31 | 31 | ||
| 32 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op) ATOMIC64_FETCH_OP(op) | 32 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op) ATOMIC64_FETCH_OP(op) |
| 33 | 33 | ||
| @@ -46,11 +46,11 @@ ATOMIC64_OPS(xor) | |||
| 46 | #undef ATOMIC64_OP_RETURN | 46 | #undef ATOMIC64_OP_RETURN |
| 47 | #undef ATOMIC64_OP | 47 | #undef ATOMIC64_OP |
| 48 | 48 | ||
| 49 | extern long long atomic64_dec_if_positive(atomic64_t *v); | 49 | extern s64 atomic64_dec_if_positive(atomic64_t *v); |
| 50 | #define atomic64_dec_if_positive atomic64_dec_if_positive | 50 | #define atomic64_dec_if_positive atomic64_dec_if_positive |
| 51 | extern long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n); | 51 | extern s64 atomic64_cmpxchg(atomic64_t *v, s64 o, s64 n); |
| 52 | extern long long atomic64_xchg(atomic64_t *v, long long new); | 52 | extern s64 atomic64_xchg(atomic64_t *v, s64 new); |
| 53 | extern long long atomic64_fetch_add_unless(atomic64_t *v, long long a, long long u); | 53 | extern s64 atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u); |
| 54 | #define atomic64_fetch_add_unless atomic64_fetch_add_unless | 54 | #define atomic64_fetch_add_unless atomic64_fetch_add_unless |
| 55 | 55 | ||
| 56 | #endif /* _ASM_GENERIC_ATOMIC64_H */ | 56 | #endif /* _ASM_GENERIC_ATOMIC64_H */ |
diff --git a/include/asm-generic/bitops-instrumented.h b/include/asm-generic/bitops-instrumented.h new file mode 100644 index 000000000000..ddd1c6d9d8db --- /dev/null +++ b/include/asm-generic/bitops-instrumented.h | |||
| @@ -0,0 +1,263 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * This file provides wrappers with sanitizer instrumentation for bit | ||
| 5 | * operations. | ||
| 6 | * | ||
| 7 | * To use this functionality, an arch's bitops.h file needs to define each of | ||
| 8 | * the below bit operations with an arch_ prefix (e.g. arch_set_bit(), | ||
| 9 | * arch___set_bit(), etc.). | ||
| 10 | */ | ||
| 11 | #ifndef _ASM_GENERIC_BITOPS_INSTRUMENTED_H | ||
| 12 | #define _ASM_GENERIC_BITOPS_INSTRUMENTED_H | ||
| 13 | |||
| 14 | #include <linux/kasan-checks.h> | ||
| 15 | |||
| 16 | /** | ||
| 17 | * set_bit - Atomically set a bit in memory | ||
| 18 | * @nr: the bit to set | ||
| 19 | * @addr: the address to start counting from | ||
| 20 | * | ||
| 21 | * This is a relaxed atomic operation (no implied memory barriers). | ||
| 22 | * | ||
| 23 | * Note that @nr may be almost arbitrarily large; this function is not | ||
| 24 | * restricted to acting on a single-word quantity. | ||
| 25 | */ | ||
| 26 | static inline void set_bit(long nr, volatile unsigned long *addr) | ||
| 27 | { | ||
| 28 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 29 | arch_set_bit(nr, addr); | ||
| 30 | } | ||
| 31 | |||
| 32 | /** | ||
| 33 | * __set_bit - Set a bit in memory | ||
| 34 | * @nr: the bit to set | ||
| 35 | * @addr: the address to start counting from | ||
| 36 | * | ||
| 37 | * Unlike set_bit(), this function is non-atomic. If it is called on the same | ||
| 38 | * region of memory concurrently, the effect may be that only one operation | ||
| 39 | * succeeds. | ||
| 40 | */ | ||
| 41 | static inline void __set_bit(long nr, volatile unsigned long *addr) | ||
| 42 | { | ||
| 43 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 44 | arch___set_bit(nr, addr); | ||
| 45 | } | ||
| 46 | |||
| 47 | /** | ||
| 48 | * clear_bit - Clears a bit in memory | ||
| 49 | * @nr: Bit to clear | ||
| 50 | * @addr: Address to start counting from | ||
| 51 | * | ||
| 52 | * This is a relaxed atomic operation (no implied memory barriers). | ||
| 53 | */ | ||
| 54 | static inline void clear_bit(long nr, volatile unsigned long *addr) | ||
| 55 | { | ||
| 56 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 57 | arch_clear_bit(nr, addr); | ||
| 58 | } | ||
| 59 | |||
| 60 | /** | ||
| 61 | * __clear_bit - Clears a bit in memory | ||
| 62 | * @nr: the bit to clear | ||
| 63 | * @addr: the address to start counting from | ||
| 64 | * | ||
| 65 | * Unlike clear_bit(), this function is non-atomic. If it is called on the same | ||
| 66 | * region of memory concurrently, the effect may be that only one operation | ||
| 67 | * succeeds. | ||
| 68 | */ | ||
| 69 | static inline void __clear_bit(long nr, volatile unsigned long *addr) | ||
| 70 | { | ||
| 71 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 72 | arch___clear_bit(nr, addr); | ||
| 73 | } | ||
| 74 | |||
| 75 | /** | ||
| 76 | * clear_bit_unlock - Clear a bit in memory, for unlock | ||
| 77 | * @nr: the bit to set | ||
| 78 | * @addr: the address to start counting from | ||
| 79 | * | ||
| 80 | * This operation is atomic and provides release barrier semantics. | ||
| 81 | */ | ||
| 82 | static inline void clear_bit_unlock(long nr, volatile unsigned long *addr) | ||
| 83 | { | ||
| 84 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 85 | arch_clear_bit_unlock(nr, addr); | ||
| 86 | } | ||
| 87 | |||
| 88 | /** | ||
| 89 | * __clear_bit_unlock - Clears a bit in memory | ||
| 90 | * @nr: Bit to clear | ||
| 91 | * @addr: Address to start counting from | ||
| 92 | * | ||
| 93 | * This is a non-atomic operation but implies a release barrier before the | ||
| 94 | * memory operation. It can be used for an unlock if no other CPUs can | ||
| 95 | * concurrently modify other bits in the word. | ||
| 96 | */ | ||
| 97 | static inline void __clear_bit_unlock(long nr, volatile unsigned long *addr) | ||
| 98 | { | ||
| 99 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 100 | arch___clear_bit_unlock(nr, addr); | ||
| 101 | } | ||
| 102 | |||
| 103 | /** | ||
| 104 | * change_bit - Toggle a bit in memory | ||
| 105 | * @nr: Bit to change | ||
| 106 | * @addr: Address to start counting from | ||
| 107 | * | ||
| 108 | * This is a relaxed atomic operation (no implied memory barriers). | ||
| 109 | * | ||
| 110 | * Note that @nr may be almost arbitrarily large; this function is not | ||
| 111 | * restricted to acting on a single-word quantity. | ||
| 112 | */ | ||
| 113 | static inline void change_bit(long nr, volatile unsigned long *addr) | ||
| 114 | { | ||
| 115 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 116 | arch_change_bit(nr, addr); | ||
| 117 | } | ||
| 118 | |||
| 119 | /** | ||
| 120 | * __change_bit - Toggle a bit in memory | ||
| 121 | * @nr: the bit to change | ||
| 122 | * @addr: the address to start counting from | ||
| 123 | * | ||
| 124 | * Unlike change_bit(), this function is non-atomic. If it is called on the same | ||
| 125 | * region of memory concurrently, the effect may be that only one operation | ||
| 126 | * succeeds. | ||
| 127 | */ | ||
| 128 | static inline void __change_bit(long nr, volatile unsigned long *addr) | ||
| 129 | { | ||
| 130 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 131 | arch___change_bit(nr, addr); | ||
| 132 | } | ||
| 133 | |||
| 134 | /** | ||
| 135 | * test_and_set_bit - Set a bit and return its old value | ||
| 136 | * @nr: Bit to set | ||
| 137 | * @addr: Address to count from | ||
| 138 | * | ||
| 139 | * This is an atomic fully-ordered operation (implied full memory barrier). | ||
| 140 | */ | ||
| 141 | static inline bool test_and_set_bit(long nr, volatile unsigned long *addr) | ||
| 142 | { | ||
| 143 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 144 | return arch_test_and_set_bit(nr, addr); | ||
| 145 | } | ||
| 146 | |||
| 147 | /** | ||
| 148 | * __test_and_set_bit - Set a bit and return its old value | ||
| 149 | * @nr: Bit to set | ||
| 150 | * @addr: Address to count from | ||
| 151 | * | ||
| 152 | * This operation is non-atomic. If two instances of this operation race, one | ||
| 153 | * can appear to succeed but actually fail. | ||
| 154 | */ | ||
| 155 | static inline bool __test_and_set_bit(long nr, volatile unsigned long *addr) | ||
| 156 | { | ||
| 157 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 158 | return arch___test_and_set_bit(nr, addr); | ||
| 159 | } | ||
| 160 | |||
| 161 | /** | ||
| 162 | * test_and_set_bit_lock - Set a bit and return its old value, for lock | ||
| 163 | * @nr: Bit to set | ||
| 164 | * @addr: Address to count from | ||
| 165 | * | ||
| 166 | * This operation is atomic and provides acquire barrier semantics if | ||
| 167 | * the returned value is 0. | ||
| 168 | * It can be used to implement bit locks. | ||
| 169 | */ | ||
| 170 | static inline bool test_and_set_bit_lock(long nr, volatile unsigned long *addr) | ||
| 171 | { | ||
| 172 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 173 | return arch_test_and_set_bit_lock(nr, addr); | ||
| 174 | } | ||
| 175 | |||
| 176 | /** | ||
| 177 | * test_and_clear_bit - Clear a bit and return its old value | ||
| 178 | * @nr: Bit to clear | ||
| 179 | * @addr: Address to count from | ||
| 180 | * | ||
| 181 | * This is an atomic fully-ordered operation (implied full memory barrier). | ||
| 182 | */ | ||
| 183 | static inline bool test_and_clear_bit(long nr, volatile unsigned long *addr) | ||
| 184 | { | ||
| 185 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 186 | return arch_test_and_clear_bit(nr, addr); | ||
| 187 | } | ||
| 188 | |||
| 189 | /** | ||
| 190 | * __test_and_clear_bit - Clear a bit and return its old value | ||
| 191 | * @nr: Bit to clear | ||
| 192 | * @addr: Address to count from | ||
| 193 | * | ||
| 194 | * This operation is non-atomic. If two instances of this operation race, one | ||
| 195 | * can appear to succeed but actually fail. | ||
| 196 | */ | ||
| 197 | static inline bool __test_and_clear_bit(long nr, volatile unsigned long *addr) | ||
| 198 | { | ||
| 199 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 200 | return arch___test_and_clear_bit(nr, addr); | ||
| 201 | } | ||
| 202 | |||
| 203 | /** | ||
| 204 | * test_and_change_bit - Change a bit and return its old value | ||
| 205 | * @nr: Bit to change | ||
| 206 | * @addr: Address to count from | ||
| 207 | * | ||
| 208 | * This is an atomic fully-ordered operation (implied full memory barrier). | ||
| 209 | */ | ||
| 210 | static inline bool test_and_change_bit(long nr, volatile unsigned long *addr) | ||
| 211 | { | ||
| 212 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 213 | return arch_test_and_change_bit(nr, addr); | ||
| 214 | } | ||
| 215 | |||
| 216 | /** | ||
| 217 | * __test_and_change_bit - Change a bit and return its old value | ||
| 218 | * @nr: Bit to change | ||
| 219 | * @addr: Address to count from | ||
| 220 | * | ||
| 221 | * This operation is non-atomic. If two instances of this operation race, one | ||
| 222 | * can appear to succeed but actually fail. | ||
| 223 | */ | ||
| 224 | static inline bool __test_and_change_bit(long nr, volatile unsigned long *addr) | ||
| 225 | { | ||
| 226 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 227 | return arch___test_and_change_bit(nr, addr); | ||
| 228 | } | ||
| 229 | |||
| 230 | /** | ||
| 231 | * test_bit - Determine whether a bit is set | ||
| 232 | * @nr: bit number to test | ||
| 233 | * @addr: Address to start counting from | ||
| 234 | */ | ||
| 235 | static inline bool test_bit(long nr, const volatile unsigned long *addr) | ||
| 236 | { | ||
| 237 | kasan_check_read(addr + BIT_WORD(nr), sizeof(long)); | ||
| 238 | return arch_test_bit(nr, addr); | ||
| 239 | } | ||
| 240 | |||
| 241 | #if defined(arch_clear_bit_unlock_is_negative_byte) | ||
| 242 | /** | ||
| 243 | * clear_bit_unlock_is_negative_byte - Clear a bit in memory and test if bottom | ||
| 244 | * byte is negative, for unlock. | ||
| 245 | * @nr: the bit to clear | ||
| 246 | * @addr: the address to start counting from | ||
| 247 | * | ||
| 248 | * This operation is atomic and provides release barrier semantics. | ||
| 249 | * | ||
| 250 | * This is a bit of a one-trick-pony for the filemap code, which clears | ||
| 251 | * PG_locked and tests PG_waiters, | ||
| 252 | */ | ||
| 253 | static inline bool | ||
| 254 | clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr) | ||
| 255 | { | ||
| 256 | kasan_check_write(addr + BIT_WORD(nr), sizeof(long)); | ||
| 257 | return arch_clear_bit_unlock_is_negative_byte(nr, addr); | ||
| 258 | } | ||
| 259 | /* Let everybody know we have it. */ | ||
| 260 | #define clear_bit_unlock_is_negative_byte clear_bit_unlock_is_negative_byte | ||
| 261 | #endif | ||
| 262 | |||
| 263 | #endif /* _ASM_GENERIC_BITOPS_INSTRUMENTED_H */ | ||
diff --git a/include/asm-generic/flat.h b/include/asm-generic/flat.h new file mode 100644 index 000000000000..1928a3596938 --- /dev/null +++ b/include/asm-generic/flat.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_GENERIC_FLAT_H | ||
| 3 | #define _ASM_GENERIC_FLAT_H | ||
| 4 | |||
| 5 | #include <linux/uaccess.h> | ||
| 6 | |||
| 7 | static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags, | ||
| 8 | u32 *addr) | ||
| 9 | { | ||
| 10 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | ||
| 11 | return copy_from_user(addr, rp, 4) ? -EFAULT : 0; | ||
| 12 | #else | ||
| 13 | return get_user(*addr, rp); | ||
| 14 | #endif | ||
| 15 | } | ||
| 16 | |||
| 17 | static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel) | ||
| 18 | { | ||
| 19 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | ||
| 20 | return copy_to_user(rp, &addr, 4) ? -EFAULT : 0; | ||
| 21 | #else | ||
| 22 | return put_user(addr, rp); | ||
| 23 | #endif | ||
| 24 | } | ||
| 25 | |||
| 26 | #endif /* _ASM_GENERIC_FLAT_H */ | ||
diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h new file mode 100644 index 000000000000..0becb7d9704d --- /dev/null +++ b/include/asm-generic/mshyperv.h | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Linux-specific definitions for managing interactions with Microsoft's | ||
| 5 | * Hyper-V hypervisor. The definitions in this file are architecture | ||
| 6 | * independent. See arch/<arch>/include/asm/mshyperv.h for definitions | ||
| 7 | * that are specific to architecture <arch>. | ||
| 8 | * | ||
| 9 | * Definitions that are specified in the Hyper-V Top Level Functional | ||
| 10 | * Spec (TLFS) should not go in this file, but should instead go in | ||
| 11 | * hyperv-tlfs.h. | ||
| 12 | * | ||
| 13 | * Copyright (C) 2019, Microsoft, Inc. | ||
| 14 | * | ||
| 15 | * Author : Michael Kelley <mikelley@microsoft.com> | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef _ASM_GENERIC_MSHYPERV_H | ||
| 19 | #define _ASM_GENERIC_MSHYPERV_H | ||
| 20 | |||
| 21 | #include <linux/types.h> | ||
| 22 | #include <linux/atomic.h> | ||
| 23 | #include <linux/bitops.h> | ||
| 24 | #include <linux/cpumask.h> | ||
| 25 | #include <asm/ptrace.h> | ||
| 26 | #include <asm/hyperv-tlfs.h> | ||
| 27 | |||
| 28 | struct ms_hyperv_info { | ||
| 29 | u32 features; | ||
| 30 | u32 misc_features; | ||
| 31 | u32 hints; | ||
| 32 | u32 nested_features; | ||
| 33 | u32 max_vp_index; | ||
| 34 | u32 max_lp_index; | ||
| 35 | }; | ||
| 36 | extern struct ms_hyperv_info ms_hyperv; | ||
| 37 | |||
| 38 | extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr); | ||
| 39 | extern u64 hv_do_fast_hypercall8(u16 control, u64 input8); | ||
| 40 | |||
| 41 | |||
| 42 | /* Generate the guest OS identifier as described in the Hyper-V TLFS */ | ||
| 43 | static inline __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version, | ||
| 44 | __u64 d_info2) | ||
| 45 | { | ||
| 46 | __u64 guest_id = 0; | ||
| 47 | |||
| 48 | guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48); | ||
| 49 | guest_id |= (d_info1 << 48); | ||
| 50 | guest_id |= (kernel_version << 16); | ||
| 51 | guest_id |= d_info2; | ||
| 52 | |||
| 53 | return guest_id; | ||
| 54 | } | ||
| 55 | |||
| 56 | |||
| 57 | /* Free the message slot and signal end-of-message if required */ | ||
| 58 | static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type) | ||
| 59 | { | ||
| 60 | /* | ||
| 61 | * On crash we're reading some other CPU's message page and we need | ||
| 62 | * to be careful: this other CPU may already had cleared the header | ||
| 63 | * and the host may already had delivered some other message there. | ||
| 64 | * In case we blindly write msg->header.message_type we're going | ||
| 65 | * to lose it. We can still lose a message of the same type but | ||
| 66 | * we count on the fact that there can only be one | ||
| 67 | * CHANNELMSG_UNLOAD_RESPONSE and we don't care about other messages | ||
| 68 | * on crash. | ||
| 69 | */ | ||
| 70 | if (cmpxchg(&msg->header.message_type, old_msg_type, | ||
| 71 | HVMSG_NONE) != old_msg_type) | ||
| 72 | return; | ||
| 73 | |||
| 74 | /* | ||
| 75 | * The cmxchg() above does an implicit memory barrier to | ||
| 76 | * ensure the write to MessageType (ie set to | ||
| 77 | * HVMSG_NONE) happens before we read the | ||
| 78 | * MessagePending and EOMing. Otherwise, the EOMing | ||
| 79 | * will not deliver any more messages since there is | ||
| 80 | * no empty slot | ||
| 81 | */ | ||
| 82 | if (msg->header.message_flags.msg_pending) { | ||
| 83 | /* | ||
| 84 | * This will cause message queue rescan to | ||
| 85 | * possibly deliver another msg from the | ||
| 86 | * hypervisor | ||
| 87 | */ | ||
| 88 | hv_signal_eom(); | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | void hv_setup_vmbus_irq(void (*handler)(void)); | ||
| 93 | void hv_remove_vmbus_irq(void); | ||
| 94 | void hv_enable_vmbus_irq(void); | ||
| 95 | void hv_disable_vmbus_irq(void); | ||
| 96 | |||
| 97 | void hv_setup_kexec_handler(void (*handler)(void)); | ||
| 98 | void hv_remove_kexec_handler(void); | ||
| 99 | void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)); | ||
| 100 | void hv_remove_crash_handler(void); | ||
| 101 | |||
| 102 | #if IS_ENABLED(CONFIG_HYPERV) | ||
| 103 | /* | ||
| 104 | * Hypervisor's notion of virtual processor ID is different from | ||
| 105 | * Linux' notion of CPU ID. This information can only be retrieved | ||
| 106 | * in the context of the calling CPU. Setup a map for easy access | ||
| 107 | * to this information. | ||
| 108 | */ | ||
| 109 | extern u32 *hv_vp_index; | ||
| 110 | extern u32 hv_max_vp_index; | ||
| 111 | |||
| 112 | /* Sentinel value for an uninitialized entry in hv_vp_index array */ | ||
| 113 | #define VP_INVAL U32_MAX | ||
| 114 | |||
| 115 | /** | ||
| 116 | * hv_cpu_number_to_vp_number() - Map CPU to VP. | ||
| 117 | * @cpu_number: CPU number in Linux terms | ||
| 118 | * | ||
| 119 | * This function returns the mapping between the Linux processor | ||
| 120 | * number and the hypervisor's virtual processor number, useful | ||
| 121 | * in making hypercalls and such that talk about specific | ||
| 122 | * processors. | ||
| 123 | * | ||
| 124 | * Return: Virtual processor number in Hyper-V terms | ||
| 125 | */ | ||
| 126 | static inline int hv_cpu_number_to_vp_number(int cpu_number) | ||
| 127 | { | ||
| 128 | return hv_vp_index[cpu_number]; | ||
| 129 | } | ||
| 130 | |||
| 131 | static inline int cpumask_to_vpset(struct hv_vpset *vpset, | ||
| 132 | const struct cpumask *cpus) | ||
| 133 | { | ||
| 134 | int cpu, vcpu, vcpu_bank, vcpu_offset, nr_bank = 1; | ||
| 135 | |||
| 136 | /* valid_bank_mask can represent up to 64 banks */ | ||
| 137 | if (hv_max_vp_index / 64 >= 64) | ||
| 138 | return 0; | ||
| 139 | |||
| 140 | /* | ||
| 141 | * Clear all banks up to the maximum possible bank as hv_tlb_flush_ex | ||
| 142 | * structs are not cleared between calls, we risk flushing unneeded | ||
| 143 | * vCPUs otherwise. | ||
| 144 | */ | ||
| 145 | for (vcpu_bank = 0; vcpu_bank <= hv_max_vp_index / 64; vcpu_bank++) | ||
| 146 | vpset->bank_contents[vcpu_bank] = 0; | ||
| 147 | |||
| 148 | /* | ||
| 149 | * Some banks may end up being empty but this is acceptable. | ||
| 150 | */ | ||
| 151 | for_each_cpu(cpu, cpus) { | ||
| 152 | vcpu = hv_cpu_number_to_vp_number(cpu); | ||
| 153 | if (vcpu == VP_INVAL) | ||
| 154 | return -1; | ||
| 155 | vcpu_bank = vcpu / 64; | ||
| 156 | vcpu_offset = vcpu % 64; | ||
| 157 | __set_bit(vcpu_offset, (unsigned long *) | ||
| 158 | &vpset->bank_contents[vcpu_bank]); | ||
| 159 | if (vcpu_bank >= nr_bank) | ||
| 160 | nr_bank = vcpu_bank + 1; | ||
| 161 | } | ||
| 162 | vpset->valid_bank_mask = GENMASK_ULL(nr_bank - 1, 0); | ||
| 163 | return nr_bank; | ||
| 164 | } | ||
| 165 | |||
| 166 | void hyperv_report_panic(struct pt_regs *regs, long err); | ||
| 167 | void hyperv_report_panic_msg(phys_addr_t pa, size_t size); | ||
| 168 | bool hv_is_hyperv_initialized(void); | ||
| 169 | void hyperv_cleanup(void); | ||
| 170 | #else /* CONFIG_HYPERV */ | ||
| 171 | static inline bool hv_is_hyperv_initialized(void) { return false; } | ||
| 172 | static inline void hyperv_cleanup(void) {} | ||
| 173 | #endif /* CONFIG_HYPERV */ | ||
| 174 | |||
| 175 | #if IS_ENABLED(CONFIG_HYPERV) | ||
| 176 | extern int hv_setup_stimer0_irq(int *irq, int *vector, void (*handler)(void)); | ||
| 177 | extern void hv_remove_stimer0_irq(int irq); | ||
| 178 | #endif | ||
| 179 | |||
| 180 | #endif | ||
diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h index 948714c1535a..8476175c07e7 100644 --- a/include/asm-generic/pgalloc.h +++ b/include/asm-generic/pgalloc.h | |||
| @@ -1,13 +1,112 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef __ASM_GENERIC_PGALLOC_H | 2 | #ifndef __ASM_GENERIC_PGALLOC_H |
| 3 | #define __ASM_GENERIC_PGALLOC_H | 3 | #define __ASM_GENERIC_PGALLOC_H |
| 4 | /* | 4 | |
| 5 | * an empty file is enough for a nommu architecture | ||
| 6 | */ | ||
| 7 | #ifdef CONFIG_MMU | 5 | #ifdef CONFIG_MMU |
| 8 | #error need to implement an architecture specific asm/pgalloc.h | 6 | |
| 7 | #define GFP_PGTABLE_KERNEL (GFP_KERNEL | __GFP_ZERO) | ||
| 8 | #define GFP_PGTABLE_USER (GFP_PGTABLE_KERNEL | __GFP_ACCOUNT) | ||
| 9 | |||
| 10 | /** | ||
| 11 | * __pte_alloc_one_kernel - allocate a page for PTE-level kernel page table | ||
| 12 | * @mm: the mm_struct of the current context | ||
| 13 | * | ||
| 14 | * This function is intended for architectures that need | ||
| 15 | * anything beyond simple page allocation. | ||
| 16 | * | ||
| 17 | * Return: pointer to the allocated memory or %NULL on error | ||
| 18 | */ | ||
| 19 | static inline pte_t *__pte_alloc_one_kernel(struct mm_struct *mm) | ||
| 20 | { | ||
| 21 | return (pte_t *)__get_free_page(GFP_PGTABLE_KERNEL); | ||
| 22 | } | ||
| 23 | |||
| 24 | #ifndef __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL | ||
| 25 | /** | ||
| 26 | * pte_alloc_one_kernel - allocate a page for PTE-level kernel page table | ||
| 27 | * @mm: the mm_struct of the current context | ||
| 28 | * | ||
| 29 | * Return: pointer to the allocated memory or %NULL on error | ||
| 30 | */ | ||
| 31 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) | ||
| 32 | { | ||
| 33 | return __pte_alloc_one_kernel(mm); | ||
| 34 | } | ||
| 35 | #endif | ||
| 36 | |||
| 37 | /** | ||
| 38 | * pte_free_kernel - free PTE-level kernel page table page | ||
| 39 | * @mm: the mm_struct of the current context | ||
| 40 | * @pte: pointer to the memory containing the page table | ||
| 41 | */ | ||
| 42 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
| 43 | { | ||
| 44 | free_page((unsigned long)pte); | ||
| 45 | } | ||
| 46 | |||
| 47 | /** | ||
| 48 | * __pte_alloc_one - allocate a page for PTE-level user page table | ||
| 49 | * @mm: the mm_struct of the current context | ||
| 50 | * @gfp: GFP flags to use for the allocation | ||
| 51 | * | ||
| 52 | * Allocates a page and runs the pgtable_page_ctor(). | ||
| 53 | * | ||
| 54 | * This function is intended for architectures that need | ||
| 55 | * anything beyond simple page allocation or must have custom GFP flags. | ||
| 56 | * | ||
| 57 | * Return: `struct page` initialized as page table or %NULL on error | ||
| 58 | */ | ||
| 59 | static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp) | ||
| 60 | { | ||
| 61 | struct page *pte; | ||
| 62 | |||
| 63 | pte = alloc_page(gfp); | ||
| 64 | if (!pte) | ||
| 65 | return NULL; | ||
| 66 | if (!pgtable_page_ctor(pte)) { | ||
| 67 | __free_page(pte); | ||
| 68 | return NULL; | ||
| 69 | } | ||
| 70 | |||
| 71 | return pte; | ||
| 72 | } | ||
| 73 | |||
| 74 | #ifndef __HAVE_ARCH_PTE_ALLOC_ONE | ||
| 75 | /** | ||
| 76 | * pte_alloc_one - allocate a page for PTE-level user page table | ||
| 77 | * @mm: the mm_struct of the current context | ||
| 78 | * | ||
| 79 | * Allocates a page and runs the pgtable_page_ctor(). | ||
| 80 | * | ||
| 81 | * Return: `struct page` initialized as page table or %NULL on error | ||
| 82 | */ | ||
| 83 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm) | ||
| 84 | { | ||
| 85 | return __pte_alloc_one(mm, GFP_PGTABLE_USER); | ||
| 86 | } | ||
| 9 | #endif | 87 | #endif |
| 10 | 88 | ||
| 89 | /* | ||
| 90 | * Should really implement gc for free page table pages. This could be | ||
| 91 | * done with a reference count in struct page. | ||
| 92 | */ | ||
| 93 | |||
| 94 | /** | ||
| 95 | * pte_free - free PTE-level user page table page | ||
| 96 | * @mm: the mm_struct of the current context | ||
| 97 | * @pte_page: the `struct page` representing the page table | ||
| 98 | */ | ||
| 99 | static inline void pte_free(struct mm_struct *mm, struct page *pte_page) | ||
| 100 | { | ||
| 101 | pgtable_page_dtor(pte_page); | ||
| 102 | __free_page(pte_page); | ||
| 103 | } | ||
| 104 | |||
| 105 | #else /* CONFIG_MMU */ | ||
| 106 | |||
| 107 | /* This is enough for a nommu architecture */ | ||
| 11 | #define check_pgt_cache() do { } while (0) | 108 | #define check_pgt_cache() do { } while (0) |
| 12 | 109 | ||
| 110 | #endif /* CONFIG_MMU */ | ||
| 111 | |||
| 13 | #endif /* __ASM_GENERIC_PGALLOC_H */ | 112 | #endif /* __ASM_GENERIC_PGALLOC_H */ |
diff --git a/include/asm-generic/ptrace.h b/include/asm-generic/ptrace.h deleted file mode 100644 index ab16b6cb1028..000000000000 --- a/include/asm-generic/ptrace.h +++ /dev/null | |||
| @@ -1,73 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | /* | ||
| 3 | * Common low level (register) ptrace helpers | ||
| 4 | * | ||
| 5 | * Copyright 2004-2011 Analog Devices Inc. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef __ASM_GENERIC_PTRACE_H__ | ||
| 9 | #define __ASM_GENERIC_PTRACE_H__ | ||
| 10 | |||
| 11 | #ifndef __ASSEMBLY__ | ||
| 12 | |||
| 13 | /* Helpers for working with the instruction pointer */ | ||
| 14 | #ifndef GET_IP | ||
| 15 | #define GET_IP(regs) ((regs)->pc) | ||
| 16 | #endif | ||
| 17 | #ifndef SET_IP | ||
| 18 | #define SET_IP(regs, val) (GET_IP(regs) = (val)) | ||
| 19 | #endif | ||
| 20 | |||
| 21 | static inline unsigned long instruction_pointer(struct pt_regs *regs) | ||
| 22 | { | ||
| 23 | return GET_IP(regs); | ||
| 24 | } | ||
| 25 | static inline void instruction_pointer_set(struct pt_regs *regs, | ||
| 26 | unsigned long val) | ||
| 27 | { | ||
| 28 | SET_IP(regs, val); | ||
| 29 | } | ||
| 30 | |||
| 31 | #ifndef profile_pc | ||
| 32 | #define profile_pc(regs) instruction_pointer(regs) | ||
| 33 | #endif | ||
| 34 | |||
| 35 | /* Helpers for working with the user stack pointer */ | ||
| 36 | #ifndef GET_USP | ||
| 37 | #define GET_USP(regs) ((regs)->usp) | ||
| 38 | #endif | ||
| 39 | #ifndef SET_USP | ||
| 40 | #define SET_USP(regs, val) (GET_USP(regs) = (val)) | ||
| 41 | #endif | ||
| 42 | |||
| 43 | static inline unsigned long user_stack_pointer(struct pt_regs *regs) | ||
| 44 | { | ||
| 45 | return GET_USP(regs); | ||
| 46 | } | ||
| 47 | static inline void user_stack_pointer_set(struct pt_regs *regs, | ||
| 48 | unsigned long val) | ||
| 49 | { | ||
| 50 | SET_USP(regs, val); | ||
| 51 | } | ||
| 52 | |||
| 53 | /* Helpers for working with the frame pointer */ | ||
| 54 | #ifndef GET_FP | ||
| 55 | #define GET_FP(regs) ((regs)->fp) | ||
| 56 | #endif | ||
| 57 | #ifndef SET_FP | ||
| 58 | #define SET_FP(regs, val) (GET_FP(regs) = (val)) | ||
| 59 | #endif | ||
| 60 | |||
| 61 | static inline unsigned long frame_pointer(struct pt_regs *regs) | ||
| 62 | { | ||
| 63 | return GET_FP(regs); | ||
| 64 | } | ||
| 65 | static inline void frame_pointer_set(struct pt_regs *regs, | ||
| 66 | unsigned long val) | ||
| 67 | { | ||
| 68 | SET_FP(regs, val); | ||
| 69 | } | ||
| 70 | |||
| 71 | #endif /* __ASSEMBLY__ */ | ||
| 72 | |||
| 73 | #endif | ||
diff --git a/include/asm-generic/vdso/vsyscall.h b/include/asm-generic/vdso/vsyscall.h new file mode 100644 index 000000000000..e94b19782c92 --- /dev/null +++ b/include/asm-generic/vdso/vsyscall.h | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __ASM_GENERIC_VSYSCALL_H | ||
| 3 | #define __ASM_GENERIC_VSYSCALL_H | ||
| 4 | |||
| 5 | #ifndef __ASSEMBLY__ | ||
| 6 | |||
| 7 | #ifndef __arch_get_k_vdso_data | ||
| 8 | static __always_inline struct vdso_data *__arch_get_k_vdso_data(void) | ||
| 9 | { | ||
| 10 | return NULL; | ||
| 11 | } | ||
| 12 | #endif /* __arch_get_k_vdso_data */ | ||
| 13 | |||
| 14 | #ifndef __arch_update_vdso_data | ||
| 15 | static __always_inline int __arch_update_vdso_data(void) | ||
| 16 | { | ||
| 17 | return 0; | ||
| 18 | } | ||
| 19 | #endif /* __arch_update_vdso_data */ | ||
| 20 | |||
| 21 | #ifndef __arch_get_clock_mode | ||
| 22 | static __always_inline int __arch_get_clock_mode(struct timekeeper *tk) | ||
| 23 | { | ||
| 24 | return 0; | ||
| 25 | } | ||
| 26 | #endif /* __arch_get_clock_mode */ | ||
| 27 | |||
| 28 | #ifndef __arch_use_vsyscall | ||
| 29 | static __always_inline int __arch_use_vsyscall(struct vdso_data *vdata) | ||
| 30 | { | ||
| 31 | return 1; | ||
| 32 | } | ||
| 33 | #endif /* __arch_use_vsyscall */ | ||
| 34 | |||
| 35 | #ifndef __arch_update_vsyscall | ||
| 36 | static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata, | ||
| 37 | struct timekeeper *tk) | ||
| 38 | { | ||
| 39 | } | ||
| 40 | #endif /* __arch_update_vsyscall */ | ||
| 41 | |||
| 42 | #ifndef __arch_sync_vdso_data | ||
| 43 | static __always_inline void __arch_sync_vdso_data(struct vdso_data *vdata) | ||
| 44 | { | ||
| 45 | } | ||
| 46 | #endif /* __arch_sync_vdso_data */ | ||
| 47 | |||
| 48 | #endif /* !__ASSEMBLY__ */ | ||
| 49 | |||
| 50 | #endif /* __ASM_GENERIC_VSYSCALL_H */ | ||
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 088987e9a3ea..ca42182992a5 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -110,10 +110,17 @@ | |||
| 110 | #endif | 110 | #endif |
| 111 | 111 | ||
| 112 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 112 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 113 | #ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY | ||
| 114 | #define MCOUNT_REC() . = ALIGN(8); \ | ||
| 115 | __start_mcount_loc = .; \ | ||
| 116 | KEEP(*(__patchable_function_entries)) \ | ||
| 117 | __stop_mcount_loc = .; | ||
| 118 | #else | ||
| 113 | #define MCOUNT_REC() . = ALIGN(8); \ | 119 | #define MCOUNT_REC() . = ALIGN(8); \ |
| 114 | __start_mcount_loc = .; \ | 120 | __start_mcount_loc = .; \ |
| 115 | KEEP(*(__mcount_loc)) \ | 121 | KEEP(*(__mcount_loc)) \ |
| 116 | __stop_mcount_loc = .; | 122 | __stop_mcount_loc = .; |
| 123 | #endif | ||
| 117 | #else | 124 | #else |
| 118 | #define MCOUNT_REC() | 125 | #define MCOUNT_REC() |
| 119 | #endif | 126 | #endif |
diff --git a/include/clocksource/hyperv_timer.h b/include/clocksource/hyperv_timer.h new file mode 100644 index 000000000000..a821deb8ecb2 --- /dev/null +++ b/include/clocksource/hyperv_timer.h | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Definitions for the clocksource provided by the Hyper-V | ||
| 5 | * hypervisor to guest VMs, as described in the Hyper-V Top | ||
| 6 | * Level Functional Spec (TLFS). | ||
| 7 | * | ||
| 8 | * Copyright (C) 2019, Microsoft, Inc. | ||
| 9 | * | ||
| 10 | * Author: Michael Kelley <mikelley@microsoft.com> | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef __CLKSOURCE_HYPERV_TIMER_H | ||
| 14 | #define __CLKSOURCE_HYPERV_TIMER_H | ||
| 15 | |||
| 16 | #include <linux/clocksource.h> | ||
| 17 | #include <linux/math64.h> | ||
| 18 | #include <asm/mshyperv.h> | ||
| 19 | |||
| 20 | #define HV_MAX_MAX_DELTA_TICKS 0xffffffff | ||
| 21 | #define HV_MIN_DELTA_TICKS 1 | ||
| 22 | |||
| 23 | /* Routines called by the VMbus driver */ | ||
| 24 | extern int hv_stimer_alloc(int sint); | ||
| 25 | extern void hv_stimer_free(void); | ||
| 26 | extern void hv_stimer_init(unsigned int cpu); | ||
| 27 | extern void hv_stimer_cleanup(unsigned int cpu); | ||
| 28 | extern void hv_stimer_global_cleanup(void); | ||
| 29 | extern void hv_stimer0_isr(void); | ||
| 30 | |||
| 31 | #if IS_ENABLED(CONFIG_HYPERV) | ||
| 32 | extern struct clocksource *hyperv_cs; | ||
| 33 | extern void hv_init_clocksource(void); | ||
| 34 | #endif /* CONFIG_HYPERV */ | ||
| 35 | |||
| 36 | #ifdef CONFIG_HYPERV_TSCPAGE | ||
| 37 | extern struct ms_hyperv_tsc_page *hv_get_tsc_page(void); | ||
| 38 | |||
| 39 | static inline notrace u64 | ||
| 40 | hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg, u64 *cur_tsc) | ||
| 41 | { | ||
| 42 | u64 scale, offset; | ||
| 43 | u32 sequence; | ||
| 44 | |||
| 45 | /* | ||
| 46 | * The protocol for reading Hyper-V TSC page is specified in Hypervisor | ||
| 47 | * Top-Level Functional Specification ver. 3.0 and above. To get the | ||
| 48 | * reference time we must do the following: | ||
| 49 | * - READ ReferenceTscSequence | ||
| 50 | * A special '0' value indicates the time source is unreliable and we | ||
| 51 | * need to use something else. The currently published specification | ||
| 52 | * versions (up to 4.0b) contain a mistake and wrongly claim '-1' | ||
| 53 | * instead of '0' as the special value, see commit c35b82ef0294. | ||
| 54 | * - ReferenceTime = | ||
| 55 | * ((RDTSC() * ReferenceTscScale) >> 64) + ReferenceTscOffset | ||
| 56 | * - READ ReferenceTscSequence again. In case its value has changed | ||
| 57 | * since our first reading we need to discard ReferenceTime and repeat | ||
| 58 | * the whole sequence as the hypervisor was updating the page in | ||
| 59 | * between. | ||
| 60 | */ | ||
| 61 | do { | ||
| 62 | sequence = READ_ONCE(tsc_pg->tsc_sequence); | ||
| 63 | if (!sequence) | ||
| 64 | return U64_MAX; | ||
| 65 | /* | ||
| 66 | * Make sure we read sequence before we read other values from | ||
| 67 | * TSC page. | ||
| 68 | */ | ||
| 69 | smp_rmb(); | ||
| 70 | |||
| 71 | scale = READ_ONCE(tsc_pg->tsc_scale); | ||
| 72 | offset = READ_ONCE(tsc_pg->tsc_offset); | ||
| 73 | *cur_tsc = hv_get_raw_timer(); | ||
| 74 | |||
| 75 | /* | ||
| 76 | * Make sure we read sequence after we read all other values | ||
| 77 | * from TSC page. | ||
| 78 | */ | ||
| 79 | smp_rmb(); | ||
| 80 | |||
| 81 | } while (READ_ONCE(tsc_pg->tsc_sequence) != sequence); | ||
| 82 | |||
| 83 | return mul_u64_u64_shr(*cur_tsc, scale, 64) + offset; | ||
| 84 | } | ||
| 85 | |||
| 86 | static inline notrace u64 | ||
| 87 | hv_read_tsc_page(const struct ms_hyperv_tsc_page *tsc_pg) | ||
| 88 | { | ||
| 89 | u64 cur_tsc; | ||
| 90 | |||
| 91 | return hv_read_tsc_page_tsc(tsc_pg, &cur_tsc); | ||
| 92 | } | ||
| 93 | |||
| 94 | #else /* CONFIG_HYPERV_TSC_PAGE */ | ||
| 95 | static inline struct ms_hyperv_tsc_page *hv_get_tsc_page(void) | ||
| 96 | { | ||
| 97 | return NULL; | ||
| 98 | } | ||
| 99 | |||
| 100 | static inline u64 hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg, | ||
| 101 | u64 *cur_tsc) | ||
| 102 | { | ||
| 103 | return U64_MAX; | ||
| 104 | } | ||
| 105 | #endif /* CONFIG_HYPERV_TSCPAGE */ | ||
| 106 | |||
| 107 | #endif | ||
diff --git a/include/clocksource/timer-davinci.h b/include/clocksource/timer-davinci.h new file mode 100644 index 000000000000..1dcc1333fbc8 --- /dev/null +++ b/include/clocksource/timer-davinci.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | /* | ||
| 3 | * TI DaVinci clocksource driver | ||
| 4 | * | ||
| 5 | * Copyright (C) 2019 Texas Instruments | ||
| 6 | * Author: Bartosz Golaszewski <bgolaszewski@baylibre.com> | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __TIMER_DAVINCI_H__ | ||
| 10 | #define __TIMER_DAVINCI_H__ | ||
| 11 | |||
| 12 | #include <linux/clk.h> | ||
| 13 | #include <linux/ioport.h> | ||
| 14 | |||
| 15 | enum { | ||
| 16 | DAVINCI_TIMER_CLOCKEVENT_IRQ, | ||
| 17 | DAVINCI_TIMER_CLOCKSOURCE_IRQ, | ||
| 18 | DAVINCI_TIMER_NUM_IRQS, | ||
| 19 | }; | ||
| 20 | |||
| 21 | /** | ||
| 22 | * struct davinci_timer_cfg - davinci clocksource driver configuration struct | ||
| 23 | * @reg: register range resource | ||
| 24 | * @irq: clockevent and clocksource interrupt resources | ||
| 25 | * @cmp_off: if set - it specifies the compare register used for clockevent | ||
| 26 | * | ||
| 27 | * Note: if the compare register is specified, the driver will use the bottom | ||
| 28 | * clock half for both clocksource and clockevent and the compare register | ||
| 29 | * to generate event irqs. The user must supply the correct compare register | ||
| 30 | * interrupt number. | ||
| 31 | * | ||
| 32 | * This is only used by da830 the DSP of which uses the top half. The timer | ||
| 33 | * driver still configures the top half to run in free-run mode. | ||
| 34 | */ | ||
| 35 | struct davinci_timer_cfg { | ||
| 36 | struct resource reg; | ||
| 37 | struct resource irq[DAVINCI_TIMER_NUM_IRQS]; | ||
| 38 | unsigned int cmp_off; | ||
| 39 | }; | ||
| 40 | |||
| 41 | int __init davinci_timer_register(struct clk *clk, | ||
| 42 | const struct davinci_timer_cfg *data); | ||
| 43 | |||
| 44 | #endif /* __TIMER_DAVINCI_H__ */ | ||
diff --git a/include/crypto/aead.h b/include/crypto/aead.h index 61bb10490492..3c245b1859e7 100644 --- a/include/crypto/aead.h +++ b/include/crypto/aead.h | |||
| @@ -317,21 +317,7 @@ static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req) | |||
| 317 | * | 317 | * |
| 318 | * Return: 0 if the cipher operation was successful; < 0 if an error occurred | 318 | * Return: 0 if the cipher operation was successful; < 0 if an error occurred |
| 319 | */ | 319 | */ |
| 320 | static inline int crypto_aead_encrypt(struct aead_request *req) | 320 | int crypto_aead_encrypt(struct aead_request *req); |
| 321 | { | ||
| 322 | struct crypto_aead *aead = crypto_aead_reqtfm(req); | ||
| 323 | struct crypto_alg *alg = aead->base.__crt_alg; | ||
| 324 | unsigned int cryptlen = req->cryptlen; | ||
| 325 | int ret; | ||
| 326 | |||
| 327 | crypto_stats_get(alg); | ||
| 328 | if (crypto_aead_get_flags(aead) & CRYPTO_TFM_NEED_KEY) | ||
| 329 | ret = -ENOKEY; | ||
| 330 | else | ||
| 331 | ret = crypto_aead_alg(aead)->encrypt(req); | ||
| 332 | crypto_stats_aead_encrypt(cryptlen, alg, ret); | ||
| 333 | return ret; | ||
| 334 | } | ||
| 335 | 321 | ||
| 336 | /** | 322 | /** |
| 337 | * crypto_aead_decrypt() - decrypt ciphertext | 323 | * crypto_aead_decrypt() - decrypt ciphertext |
| @@ -355,23 +341,7 @@ static inline int crypto_aead_encrypt(struct aead_request *req) | |||
| 355 | * integrity of the ciphertext or the associated data was violated); | 341 | * integrity of the ciphertext or the associated data was violated); |
| 356 | * < 0 if an error occurred. | 342 | * < 0 if an error occurred. |
| 357 | */ | 343 | */ |
| 358 | static inline int crypto_aead_decrypt(struct aead_request *req) | 344 | int crypto_aead_decrypt(struct aead_request *req); |
| 359 | { | ||
| 360 | struct crypto_aead *aead = crypto_aead_reqtfm(req); | ||
| 361 | struct crypto_alg *alg = aead->base.__crt_alg; | ||
| 362 | unsigned int cryptlen = req->cryptlen; | ||
| 363 | int ret; | ||
| 364 | |||
| 365 | crypto_stats_get(alg); | ||
| 366 | if (crypto_aead_get_flags(aead) & CRYPTO_TFM_NEED_KEY) | ||
| 367 | ret = -ENOKEY; | ||
| 368 | else if (req->cryptlen < crypto_aead_authsize(aead)) | ||
| 369 | ret = -EINVAL; | ||
| 370 | else | ||
| 371 | ret = crypto_aead_alg(aead)->decrypt(req); | ||
| 372 | crypto_stats_aead_decrypt(cryptlen, alg, ret); | ||
| 373 | return ret; | ||
| 374 | } | ||
| 375 | 345 | ||
| 376 | /** | 346 | /** |
| 377 | * DOC: Asynchronous AEAD Request Handle | 347 | * DOC: Asynchronous AEAD Request Handle |
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 743d626479ef..dc1106af95c3 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
| @@ -189,7 +189,6 @@ void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen); | |||
| 189 | int crypto_enqueue_request(struct crypto_queue *queue, | 189 | int crypto_enqueue_request(struct crypto_queue *queue, |
| 190 | struct crypto_async_request *request); | 190 | struct crypto_async_request *request); |
| 191 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue); | 191 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue); |
| 192 | int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm); | ||
| 193 | static inline unsigned int crypto_queue_len(struct crypto_queue *queue) | 192 | static inline unsigned int crypto_queue_len(struct crypto_queue *queue) |
| 194 | { | 193 | { |
| 195 | return queue->qlen; | 194 | return queue->qlen; |
| @@ -371,12 +370,6 @@ static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req) | |||
| 371 | return req->__ctx; | 370 | return req->__ctx; |
| 372 | } | 371 | } |
| 373 | 372 | ||
| 374 | static inline int ablkcipher_tfm_in_queue(struct crypto_queue *queue, | ||
| 375 | struct crypto_ablkcipher *tfm) | ||
| 376 | { | ||
| 377 | return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm)); | ||
| 378 | } | ||
| 379 | |||
| 380 | static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, | 373 | static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, |
| 381 | u32 type, u32 mask) | 374 | u32 type, u32 mask) |
| 382 | { | 375 | { |
diff --git a/include/crypto/arc4.h b/include/crypto/arc4.h index 5b2c24ab0139..f3c22fe01704 100644 --- a/include/crypto/arc4.h +++ b/include/crypto/arc4.h | |||
| @@ -6,8 +6,18 @@ | |||
| 6 | #ifndef _CRYPTO_ARC4_H | 6 | #ifndef _CRYPTO_ARC4_H |
| 7 | #define _CRYPTO_ARC4_H | 7 | #define _CRYPTO_ARC4_H |
| 8 | 8 | ||
| 9 | #include <linux/types.h> | ||
| 10 | |||
| 9 | #define ARC4_MIN_KEY_SIZE 1 | 11 | #define ARC4_MIN_KEY_SIZE 1 |
| 10 | #define ARC4_MAX_KEY_SIZE 256 | 12 | #define ARC4_MAX_KEY_SIZE 256 |
| 11 | #define ARC4_BLOCK_SIZE 1 | 13 | #define ARC4_BLOCK_SIZE 1 |
| 12 | 14 | ||
| 15 | struct arc4_ctx { | ||
| 16 | u32 S[256]; | ||
| 17 | u32 x, y; | ||
| 18 | }; | ||
| 19 | |||
| 20 | int arc4_setkey(struct arc4_ctx *ctx, const u8 *in_key, unsigned int key_len); | ||
| 21 | void arc4_crypt(struct arc4_ctx *ctx, u8 *out, const u8 *in, unsigned int len); | ||
| 22 | |||
| 13 | #endif /* _CRYPTO_ARC4_H */ | 23 | #endif /* _CRYPTO_ARC4_H */ |
diff --git a/include/crypto/chacha.h b/include/crypto/chacha.h index 1fc70a69d550..d1e723c6a37d 100644 --- a/include/crypto/chacha.h +++ b/include/crypto/chacha.h | |||
| @@ -41,7 +41,7 @@ static inline void chacha20_block(u32 *state, u8 *stream) | |||
| 41 | } | 41 | } |
| 42 | void hchacha_block(const u32 *in, u32 *out, int nrounds); | 42 | void hchacha_block(const u32 *in, u32 *out, int nrounds); |
| 43 | 43 | ||
| 44 | void crypto_chacha_init(u32 *state, struct chacha_ctx *ctx, u8 *iv); | 44 | void crypto_chacha_init(u32 *state, const struct chacha_ctx *ctx, const u8 *iv); |
| 45 | 45 | ||
| 46 | int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key, | 46 | int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key, |
| 47 | unsigned int keysize); | 47 | unsigned int keysize); |
diff --git a/include/crypto/crypto_wq.h b/include/crypto/crypto_wq.h deleted file mode 100644 index 23114746ac08..000000000000 --- a/include/crypto/crypto_wq.h +++ /dev/null | |||
| @@ -1,8 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef CRYPTO_WQ_H | ||
| 3 | #define CRYPTO_WQ_H | ||
| 4 | |||
| 5 | #include <linux/workqueue.h> | ||
| 6 | |||
| 7 | extern struct workqueue_struct *kcrypto_wq; | ||
| 8 | #endif | ||
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h index 3fb581bf3b87..8c9af21efce1 100644 --- a/include/crypto/drbg.h +++ b/include/crypto/drbg.h | |||
| @@ -129,6 +129,8 @@ struct drbg_state { | |||
| 129 | 129 | ||
| 130 | bool seeded; /* DRBG fully seeded? */ | 130 | bool seeded; /* DRBG fully seeded? */ |
| 131 | bool pr; /* Prediction resistance enabled? */ | 131 | bool pr; /* Prediction resistance enabled? */ |
| 132 | bool fips_primed; /* Continuous test primed? */ | ||
| 133 | unsigned char *prev; /* FIPS 140-2 continuous test value */ | ||
| 132 | struct work_struct seed_work; /* asynchronous seeding support */ | 134 | struct work_struct seed_work; /* asynchronous seeding support */ |
| 133 | struct crypto_rng *jent; | 135 | struct crypto_rng *jent; |
| 134 | const struct drbg_state_ops *d_ops; | 136 | const struct drbg_state_ops *d_ops; |
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h index 31e0662fa429..bfc9db7b100d 100644 --- a/include/crypto/internal/hash.h +++ b/include/crypto/internal/hash.h | |||
| @@ -196,12 +196,6 @@ static inline struct ahash_request *ahash_dequeue_request( | |||
| 196 | return ahash_request_cast(crypto_dequeue_request(queue)); | 196 | return ahash_request_cast(crypto_dequeue_request(queue)); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | static inline int ahash_tfm_in_queue(struct crypto_queue *queue, | ||
| 200 | struct crypto_ahash *tfm) | ||
| 201 | { | ||
| 202 | return crypto_tfm_in_queue(queue, crypto_ahash_tfm(tfm)); | ||
| 203 | } | ||
| 204 | |||
| 205 | static inline void *crypto_shash_ctx(struct crypto_shash *tfm) | 199 | static inline void *crypto_shash_ctx(struct crypto_shash *tfm) |
| 206 | { | 200 | { |
| 207 | return crypto_tfm_ctx(&tfm->base); | 201 | return crypto_tfm_ctx(&tfm->base); |
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index fe0376d5a471..d68faa5759ad 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h | |||
| @@ -200,6 +200,66 @@ static inline unsigned int crypto_skcipher_alg_max_keysize( | |||
| 200 | return alg->max_keysize; | 200 | return alg->max_keysize; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | static inline unsigned int crypto_skcipher_alg_chunksize( | ||
| 204 | struct skcipher_alg *alg) | ||
| 205 | { | ||
| 206 | if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == | ||
| 207 | CRYPTO_ALG_TYPE_BLKCIPHER) | ||
| 208 | return alg->base.cra_blocksize; | ||
| 209 | |||
| 210 | if (alg->base.cra_ablkcipher.encrypt) | ||
| 211 | return alg->base.cra_blocksize; | ||
| 212 | |||
| 213 | return alg->chunksize; | ||
| 214 | } | ||
| 215 | |||
| 216 | static inline unsigned int crypto_skcipher_alg_walksize( | ||
| 217 | struct skcipher_alg *alg) | ||
| 218 | { | ||
| 219 | if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == | ||
| 220 | CRYPTO_ALG_TYPE_BLKCIPHER) | ||
| 221 | return alg->base.cra_blocksize; | ||
| 222 | |||
| 223 | if (alg->base.cra_ablkcipher.encrypt) | ||
| 224 | return alg->base.cra_blocksize; | ||
| 225 | |||
| 226 | return alg->walksize; | ||
| 227 | } | ||
| 228 | |||
| 229 | /** | ||
| 230 | * crypto_skcipher_chunksize() - obtain chunk size | ||
| 231 | * @tfm: cipher handle | ||
| 232 | * | ||
| 233 | * The block size is set to one for ciphers such as CTR. However, | ||
| 234 | * you still need to provide incremental updates in multiples of | ||
| 235 | * the underlying block size as the IV does not have sub-block | ||
| 236 | * granularity. This is known in this API as the chunk size. | ||
| 237 | * | ||
| 238 | * Return: chunk size in bytes | ||
| 239 | */ | ||
| 240 | static inline unsigned int crypto_skcipher_chunksize( | ||
| 241 | struct crypto_skcipher *tfm) | ||
| 242 | { | ||
| 243 | return crypto_skcipher_alg_chunksize(crypto_skcipher_alg(tfm)); | ||
| 244 | } | ||
| 245 | |||
| 246 | /** | ||
| 247 | * crypto_skcipher_walksize() - obtain walk size | ||
| 248 | * @tfm: cipher handle | ||
| 249 | * | ||
| 250 | * In some cases, algorithms can only perform optimally when operating on | ||
| 251 | * multiple blocks in parallel. This is reflected by the walksize, which | ||
| 252 | * must be a multiple of the chunksize (or equal if the concern does not | ||
| 253 | * apply) | ||
| 254 | * | ||
| 255 | * Return: walk size in bytes | ||
| 256 | */ | ||
| 257 | static inline unsigned int crypto_skcipher_walksize( | ||
| 258 | struct crypto_skcipher *tfm) | ||
| 259 | { | ||
| 260 | return crypto_skcipher_alg_walksize(crypto_skcipher_alg(tfm)); | ||
| 261 | } | ||
| 262 | |||
| 203 | /* Helpers for simple block cipher modes of operation */ | 263 | /* Helpers for simple block cipher modes of operation */ |
| 204 | struct skcipher_ctx_simple { | 264 | struct skcipher_ctx_simple { |
| 205 | struct crypto_cipher *cipher; /* underlying block cipher */ | 265 | struct crypto_cipher *cipher; /* underlying block cipher */ |
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h index ce7fa0973580..37c164234d97 100644 --- a/include/crypto/skcipher.h +++ b/include/crypto/skcipher.h | |||
| @@ -288,66 +288,6 @@ static inline unsigned int crypto_sync_skcipher_ivsize( | |||
| 288 | return crypto_skcipher_ivsize(&tfm->base); | 288 | return crypto_skcipher_ivsize(&tfm->base); |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | static inline unsigned int crypto_skcipher_alg_chunksize( | ||
| 292 | struct skcipher_alg *alg) | ||
| 293 | { | ||
| 294 | if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == | ||
| 295 | CRYPTO_ALG_TYPE_BLKCIPHER) | ||
| 296 | return alg->base.cra_blocksize; | ||
| 297 | |||
| 298 | if (alg->base.cra_ablkcipher.encrypt) | ||
| 299 | return alg->base.cra_blocksize; | ||
| 300 | |||
| 301 | return alg->chunksize; | ||
| 302 | } | ||
| 303 | |||
| 304 | static inline unsigned int crypto_skcipher_alg_walksize( | ||
| 305 | struct skcipher_alg *alg) | ||
| 306 | { | ||
| 307 | if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == | ||
| 308 | CRYPTO_ALG_TYPE_BLKCIPHER) | ||
| 309 | return alg->base.cra_blocksize; | ||
| 310 | |||
| 311 | if (alg->base.cra_ablkcipher.encrypt) | ||
| 312 | return alg->base.cra_blocksize; | ||
| 313 | |||
| 314 | return alg->walksize; | ||
| 315 | } | ||
| 316 | |||
| 317 | /** | ||
| 318 | * crypto_skcipher_chunksize() - obtain chunk size | ||
| 319 | * @tfm: cipher handle | ||
| 320 | * | ||
| 321 | * The block size is set to one for ciphers such as CTR. However, | ||
| 322 | * you still need to provide incremental updates in multiples of | ||
| 323 | * the underlying block size as the IV does not have sub-block | ||
| 324 | * granularity. This is known in this API as the chunk size. | ||
| 325 | * | ||
| 326 | * Return: chunk size in bytes | ||
| 327 | */ | ||
| 328 | static inline unsigned int crypto_skcipher_chunksize( | ||
| 329 | struct crypto_skcipher *tfm) | ||
| 330 | { | ||
| 331 | return crypto_skcipher_alg_chunksize(crypto_skcipher_alg(tfm)); | ||
| 332 | } | ||
| 333 | |||
| 334 | /** | ||
| 335 | * crypto_skcipher_walksize() - obtain walk size | ||
| 336 | * @tfm: cipher handle | ||
| 337 | * | ||
| 338 | * In some cases, algorithms can only perform optimally when operating on | ||
| 339 | * multiple blocks in parallel. This is reflected by the walksize, which | ||
| 340 | * must be a multiple of the chunksize (or equal if the concern does not | ||
| 341 | * apply) | ||
| 342 | * | ||
| 343 | * Return: walk size in bytes | ||
| 344 | */ | ||
| 345 | static inline unsigned int crypto_skcipher_walksize( | ||
| 346 | struct crypto_skcipher *tfm) | ||
| 347 | { | ||
| 348 | return crypto_skcipher_alg_walksize(crypto_skcipher_alg(tfm)); | ||
| 349 | } | ||
| 350 | |||
| 351 | /** | 291 | /** |
| 352 | * crypto_skcipher_blocksize() - obtain block size of cipher | 292 | * crypto_skcipher_blocksize() - obtain block size of cipher |
| 353 | * @tfm: cipher handle | 293 | * @tfm: cipher handle |
| @@ -479,21 +419,7 @@ static inline struct crypto_sync_skcipher *crypto_sync_skcipher_reqtfm( | |||
| 479 | * | 419 | * |
| 480 | * Return: 0 if the cipher operation was successful; < 0 if an error occurred | 420 | * Return: 0 if the cipher operation was successful; < 0 if an error occurred |
| 481 | */ | 421 | */ |
| 482 | static inline int crypto_skcipher_encrypt(struct skcipher_request *req) | 422 | int crypto_skcipher_encrypt(struct skcipher_request *req); |
| 483 | { | ||
| 484 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); | ||
| 485 | struct crypto_alg *alg = tfm->base.__crt_alg; | ||
| 486 | unsigned int cryptlen = req->cryptlen; | ||
| 487 | int ret; | ||
| 488 | |||
| 489 | crypto_stats_get(alg); | ||
| 490 | if (crypto_skcipher_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) | ||
| 491 | ret = -ENOKEY; | ||
| 492 | else | ||
| 493 | ret = tfm->encrypt(req); | ||
| 494 | crypto_stats_skcipher_encrypt(cryptlen, ret, alg); | ||
| 495 | return ret; | ||
| 496 | } | ||
| 497 | 423 | ||
| 498 | /** | 424 | /** |
| 499 | * crypto_skcipher_decrypt() - decrypt ciphertext | 425 | * crypto_skcipher_decrypt() - decrypt ciphertext |
| @@ -506,21 +432,7 @@ static inline int crypto_skcipher_encrypt(struct skcipher_request *req) | |||
| 506 | * | 432 | * |
| 507 | * Return: 0 if the cipher operation was successful; < 0 if an error occurred | 433 | * Return: 0 if the cipher operation was successful; < 0 if an error occurred |
| 508 | */ | 434 | */ |
| 509 | static inline int crypto_skcipher_decrypt(struct skcipher_request *req) | 435 | int crypto_skcipher_decrypt(struct skcipher_request *req); |
| 510 | { | ||
| 511 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); | ||
| 512 | struct crypto_alg *alg = tfm->base.__crt_alg; | ||
| 513 | unsigned int cryptlen = req->cryptlen; | ||
| 514 | int ret; | ||
| 515 | |||
| 516 | crypto_stats_get(alg); | ||
| 517 | if (crypto_skcipher_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) | ||
| 518 | ret = -ENOKEY; | ||
| 519 | else | ||
| 520 | ret = tfm->decrypt(req); | ||
| 521 | crypto_stats_skcipher_decrypt(cryptlen, ret, alg); | ||
| 522 | return ret; | ||
| 523 | } | ||
| 524 | 436 | ||
| 525 | /** | 437 | /** |
| 526 | * DOC: Symmetric Key Cipher Request Handle | 438 | * DOC: Symmetric Key Cipher Request Handle |
diff --git a/include/drm/amd_asic_type.h b/include/drm/amd_asic_type.h index dd63d08cc54e..bcc2bcf32886 100644 --- a/include/drm/amd_asic_type.h +++ b/include/drm/amd_asic_type.h | |||
| @@ -49,6 +49,7 @@ enum amd_asic_type { | |||
| 49 | CHIP_VEGA12, | 49 | CHIP_VEGA12, |
| 50 | CHIP_VEGA20, | 50 | CHIP_VEGA20, |
| 51 | CHIP_RAVEN, | 51 | CHIP_RAVEN, |
| 52 | CHIP_NAVI10, | ||
| 52 | CHIP_LAST, | 53 | CHIP_LAST, |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index b4ca970a5b75..c402364aec0d 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h | |||
| @@ -150,6 +150,8 @@ struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev, | |||
| 150 | struct drm_encoder *encoder, | 150 | struct drm_encoder *encoder, |
| 151 | const struct dw_hdmi_plat_data *plat_data); | 151 | const struct dw_hdmi_plat_data *plat_data); |
| 152 | 152 | ||
| 153 | void dw_hdmi_resume(struct dw_hdmi *hdmi); | ||
| 154 | |||
| 153 | void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); | 155 | void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); |
| 154 | 156 | ||
| 155 | void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate); | 157 | void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate); |
diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index 0c33b9e9e0f0..94cc64a342e1 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h | |||
| @@ -9,10 +9,20 @@ | |||
| 9 | #ifndef __DW_MIPI_DSI__ | 9 | #ifndef __DW_MIPI_DSI__ |
| 10 | #define __DW_MIPI_DSI__ | 10 | #define __DW_MIPI_DSI__ |
| 11 | 11 | ||
| 12 | #include <linux/types.h> | ||
| 13 | |||
| 14 | #include <drm/drm_modes.h> | ||
| 15 | |||
| 16 | struct drm_display_mode; | ||
| 17 | struct drm_encoder; | ||
| 12 | struct dw_mipi_dsi; | 18 | struct dw_mipi_dsi; |
| 19 | struct mipi_dsi_device; | ||
| 20 | struct platform_device; | ||
| 13 | 21 | ||
| 14 | struct dw_mipi_dsi_phy_ops { | 22 | struct dw_mipi_dsi_phy_ops { |
| 15 | int (*init)(void *priv_data); | 23 | int (*init)(void *priv_data); |
| 24 | void (*power_on)(void *priv_data); | ||
| 25 | void (*power_off)(void *priv_data); | ||
| 16 | int (*get_lane_mbps)(void *priv_data, | 26 | int (*get_lane_mbps)(void *priv_data, |
| 17 | const struct drm_display_mode *mode, | 27 | const struct drm_display_mode *mode, |
| 18 | unsigned long mode_flags, u32 lanes, u32 format, | 28 | unsigned long mode_flags, u32 lanes, u32 format, |
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index e937ff2beb04..927e1205d7aa 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h | |||
| @@ -459,6 +459,13 @@ struct drm_private_state * | |||
| 459 | drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, | 459 | drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, |
| 460 | struct drm_private_obj *obj); | 460 | struct drm_private_obj *obj); |
| 461 | 461 | ||
| 462 | struct drm_connector * | ||
| 463 | drm_atomic_get_old_connector_for_encoder(struct drm_atomic_state *state, | ||
| 464 | struct drm_encoder *encoder); | ||
| 465 | struct drm_connector * | ||
| 466 | drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state, | ||
| 467 | struct drm_encoder *encoder); | ||
| 468 | |||
| 462 | /** | 469 | /** |
| 463 | * drm_atomic_get_existing_crtc_state - get crtc state, if it exists | 470 | * drm_atomic_get_existing_crtc_state - get crtc state, if it exists |
| 464 | * @state: global atomic state object | 471 | * @state: global atomic state object |
| @@ -950,4 +957,19 @@ drm_atomic_crtc_needs_modeset(const struct drm_crtc_state *state) | |||
| 950 | state->connectors_changed; | 957 | state->connectors_changed; |
| 951 | } | 958 | } |
| 952 | 959 | ||
| 960 | /** | ||
| 961 | * drm_atomic_crtc_effectively_active - compute whether crtc is actually active | ||
| 962 | * @state: &drm_crtc_state for the CRTC | ||
| 963 | * | ||
| 964 | * When in self refresh mode, the crtc_state->active value will be false, since | ||
| 965 | * the crtc is off. However in some cases we're interested in whether the crtc | ||
| 966 | * is active, or effectively active (ie: it's connected to an active display). | ||
| 967 | * In these cases, use this function instead of just checking active. | ||
| 968 | */ | ||
| 969 | static inline bool | ||
| 970 | drm_atomic_crtc_effectively_active(const struct drm_crtc_state *state) | ||
| 971 | { | ||
| 972 | return state->active || state->self_refresh_active; | ||
| 973 | } | ||
| 974 | |||
| 953 | #endif /* DRM_ATOMIC_H_ */ | 975 | #endif /* DRM_ATOMIC_H_ */ |
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 58214be3bf3d..bf4e07141d81 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h | |||
| @@ -117,12 +117,8 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane, | |||
| 117 | struct drm_modeset_acquire_ctx *ctx); | 117 | struct drm_modeset_acquire_ctx *ctx); |
| 118 | int drm_atomic_helper_disable_plane(struct drm_plane *plane, | 118 | int drm_atomic_helper_disable_plane(struct drm_plane *plane, |
| 119 | struct drm_modeset_acquire_ctx *ctx); | 119 | struct drm_modeset_acquire_ctx *ctx); |
| 120 | int __drm_atomic_helper_disable_plane(struct drm_plane *plane, | ||
| 121 | struct drm_plane_state *plane_state); | ||
| 122 | int drm_atomic_helper_set_config(struct drm_mode_set *set, | 120 | int drm_atomic_helper_set_config(struct drm_mode_set *set, |
| 123 | struct drm_modeset_acquire_ctx *ctx); | 121 | struct drm_modeset_acquire_ctx *ctx); |
| 124 | int __drm_atomic_helper_set_config(struct drm_mode_set *set, | ||
| 125 | struct drm_atomic_state *state); | ||
| 126 | 122 | ||
| 127 | int drm_atomic_helper_disable_all(struct drm_device *dev, | 123 | int drm_atomic_helper_disable_all(struct drm_device *dev, |
| 128 | struct drm_modeset_acquire_ctx *ctx); | 124 | struct drm_modeset_acquire_ctx *ctx); |
diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index 66c92cbd8e16..e4577cc11689 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h | |||
| @@ -37,6 +37,8 @@ struct drm_private_state; | |||
| 37 | struct drm_modeset_acquire_ctx; | 37 | struct drm_modeset_acquire_ctx; |
| 38 | struct drm_device; | 38 | struct drm_device; |
| 39 | 39 | ||
| 40 | void __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc, | ||
| 41 | struct drm_crtc_state *state); | ||
| 40 | void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); | 42 | void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); |
| 41 | void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, | 43 | void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, |
| 42 | struct drm_crtc_state *state); | 44 | struct drm_crtc_state *state); |
| @@ -60,6 +62,7 @@ void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane, | |||
| 60 | void __drm_atomic_helper_connector_reset(struct drm_connector *connector, | 62 | void __drm_atomic_helper_connector_reset(struct drm_connector *connector, |
| 61 | struct drm_connector_state *conn_state); | 63 | struct drm_connector_state *conn_state); |
| 62 | void drm_atomic_helper_connector_reset(struct drm_connector *connector); | 64 | void drm_atomic_helper_connector_reset(struct drm_connector *connector); |
| 65 | void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector); | ||
| 63 | void | 66 | void |
| 64 | __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector, | 67 | __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector, |
| 65 | struct drm_connector_state *state); | 68 | struct drm_connector_state *state); |
diff --git a/include/drm/drm_auth.h b/include/drm/drm_auth.h index 871008118bab..6bf8b2b78991 100644 --- a/include/drm/drm_auth.h +++ b/include/drm/drm_auth.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef _DRM_AUTH_H_ | ||
| 2 | #define _DRM_AUTH_H_ | ||
| 3 | |||
| 1 | /* | 4 | /* |
| 2 | * Internal Header for the Direct Rendering Manager | 5 | * Internal Header for the Direct Rendering Manager |
| 3 | * | 6 | * |
| @@ -25,8 +28,12 @@ | |||
| 25 | * OTHER DEALINGS IN THE SOFTWARE. | 28 | * OTHER DEALINGS IN THE SOFTWARE. |
| 26 | */ | 29 | */ |
| 27 | 30 | ||
| 28 | #ifndef _DRM_AUTH_H_ | 31 | #include <linux/idr.h> |
| 29 | #define _DRM_AUTH_H_ | 32 | #include <linux/kref.h> |
| 33 | #include <linux/wait.h> | ||
| 34 | |||
| 35 | struct drm_file; | ||
| 36 | struct drm_hw_lock; | ||
| 30 | 37 | ||
| 31 | /* | 38 | /* |
| 32 | * Legacy DRI1 locking data structure. Only here instead of in drm_legacy.h for | 39 | * Legacy DRI1 locking data structure. Only here instead of in drm_legacy.h for |
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index d4428913a4e1..7616f6562fe4 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h | |||
| @@ -237,6 +237,103 @@ struct drm_bridge_funcs { | |||
| 237 | * The enable callback is optional. | 237 | * The enable callback is optional. |
| 238 | */ | 238 | */ |
| 239 | void (*enable)(struct drm_bridge *bridge); | 239 | void (*enable)(struct drm_bridge *bridge); |
| 240 | |||
| 241 | /** | ||
| 242 | * @atomic_pre_enable: | ||
| 243 | * | ||
| 244 | * This callback should enable the bridge. It is called right before | ||
| 245 | * the preceding element in the display pipe is enabled. If the | ||
| 246 | * preceding element is a bridge this means it's called before that | ||
| 247 | * bridge's @atomic_pre_enable or @pre_enable function. If the preceding | ||
| 248 | * element is a &drm_encoder it's called right before the encoder's | ||
| 249 | * &drm_encoder_helper_funcs.atomic_enable hook. | ||
| 250 | * | ||
| 251 | * The display pipe (i.e. clocks and timing signals) feeding this bridge | ||
| 252 | * will not yet be running when this callback is called. The bridge must | ||
| 253 | * not enable the display link feeding the next bridge in the chain (if | ||
| 254 | * there is one) when this callback is called. | ||
| 255 | * | ||
| 256 | * Note that this function will only be invoked in the context of an | ||
| 257 | * atomic commit. It will not be invoked from &drm_bridge_pre_enable. It | ||
| 258 | * would be prudent to also provide an implementation of @pre_enable if | ||
| 259 | * you are expecting driver calls into &drm_bridge_pre_enable. | ||
| 260 | * | ||
| 261 | * The @atomic_pre_enable callback is optional. | ||
| 262 | */ | ||
| 263 | void (*atomic_pre_enable)(struct drm_bridge *bridge, | ||
| 264 | struct drm_atomic_state *state); | ||
| 265 | |||
| 266 | /** | ||
| 267 | * @atomic_enable: | ||
| 268 | * | ||
| 269 | * This callback should enable the bridge. It is called right after | ||
| 270 | * the preceding element in the display pipe is enabled. If the | ||
| 271 | * preceding element is a bridge this means it's called after that | ||
| 272 | * bridge's @atomic_enable or @enable function. If the preceding element | ||
| 273 | * is a &drm_encoder it's called right after the encoder's | ||
| 274 | * &drm_encoder_helper_funcs.atomic_enable hook. | ||
| 275 | * | ||
| 276 | * The bridge can assume that the display pipe (i.e. clocks and timing | ||
| 277 | * signals) feeding it is running when this callback is called. This | ||
| 278 | * callback must enable the display link feeding the next bridge in the | ||
| 279 | * chain if there is one. | ||
| 280 | * | ||
| 281 | * Note that this function will only be invoked in the context of an | ||
| 282 | * atomic commit. It will not be invoked from &drm_bridge_enable. It | ||
| 283 | * would be prudent to also provide an implementation of @enable if | ||
| 284 | * you are expecting driver calls into &drm_bridge_enable. | ||
| 285 | * | ||
| 286 | * The enable callback is optional. | ||
| 287 | */ | ||
| 288 | void (*atomic_enable)(struct drm_bridge *bridge, | ||
| 289 | struct drm_atomic_state *state); | ||
| 290 | /** | ||
| 291 | * @atomic_disable: | ||
| 292 | * | ||
| 293 | * This callback should disable the bridge. It is called right before | ||
| 294 | * the preceding element in the display pipe is disabled. If the | ||
| 295 | * preceding element is a bridge this means it's called before that | ||
| 296 | * bridge's @atomic_disable or @disable vfunc. If the preceding element | ||
| 297 | * is a &drm_encoder it's called right before the | ||
| 298 | * &drm_encoder_helper_funcs.atomic_disable hook. | ||
| 299 | * | ||
| 300 | * The bridge can assume that the display pipe (i.e. clocks and timing | ||
| 301 | * signals) feeding it is still running when this callback is called. | ||
| 302 | * | ||
| 303 | * Note that this function will only be invoked in the context of an | ||
| 304 | * atomic commit. It will not be invoked from &drm_bridge_disable. It | ||
| 305 | * would be prudent to also provide an implementation of @disable if | ||
| 306 | * you are expecting driver calls into &drm_bridge_disable. | ||
| 307 | * | ||
| 308 | * The disable callback is optional. | ||
| 309 | */ | ||
| 310 | void (*atomic_disable)(struct drm_bridge *bridge, | ||
| 311 | struct drm_atomic_state *state); | ||
| 312 | |||
| 313 | /** | ||
| 314 | * @atomic_post_disable: | ||
| 315 | * | ||
| 316 | * This callback should disable the bridge. It is called right after the | ||
| 317 | * preceding element in the display pipe is disabled. If the preceding | ||
| 318 | * element is a bridge this means it's called after that bridge's | ||
| 319 | * @atomic_post_disable or @post_disable function. If the preceding | ||
| 320 | * element is a &drm_encoder it's called right after the encoder's | ||
| 321 | * &drm_encoder_helper_funcs.atomic_disable hook. | ||
| 322 | * | ||
| 323 | * The bridge must assume that the display pipe (i.e. clocks and timing | ||
| 324 | * signals) feeding it is no longer running when this callback is | ||
| 325 | * called. | ||
| 326 | * | ||
| 327 | * Note that this function will only be invoked in the context of an | ||
| 328 | * atomic commit. It will not be invoked from &drm_bridge_post_disable. | ||
| 329 | * It would be prudent to also provide an implementation of | ||
| 330 | * @post_disable if you are expecting driver calls into | ||
| 331 | * &drm_bridge_post_disable. | ||
| 332 | * | ||
| 333 | * The post_disable callback is optional. | ||
| 334 | */ | ||
| 335 | void (*atomic_post_disable)(struct drm_bridge *bridge, | ||
| 336 | struct drm_atomic_state *state); | ||
| 240 | }; | 337 | }; |
| 241 | 338 | ||
| 242 | /** | 339 | /** |
| @@ -265,6 +362,14 @@ struct drm_bridge_timings { | |||
| 265 | * input signal after the clock edge. | 362 | * input signal after the clock edge. |
| 266 | */ | 363 | */ |
| 267 | u32 hold_time_ps; | 364 | u32 hold_time_ps; |
| 365 | /** | ||
| 366 | * @dual_link: | ||
| 367 | * | ||
| 368 | * True if the bus operates in dual-link mode. The exact meaning is | ||
| 369 | * dependent on the bus type. For LVDS buses, this indicates that even- | ||
| 370 | * and odd-numbered pixels are received on separate links. | ||
| 371 | */ | ||
| 372 | bool dual_link; | ||
| 268 | }; | 373 | }; |
| 269 | 374 | ||
| 270 | /** | 375 | /** |
| @@ -314,6 +419,15 @@ void drm_bridge_mode_set(struct drm_bridge *bridge, | |||
| 314 | void drm_bridge_pre_enable(struct drm_bridge *bridge); | 419 | void drm_bridge_pre_enable(struct drm_bridge *bridge); |
| 315 | void drm_bridge_enable(struct drm_bridge *bridge); | 420 | void drm_bridge_enable(struct drm_bridge *bridge); |
| 316 | 421 | ||
| 422 | void drm_atomic_bridge_disable(struct drm_bridge *bridge, | ||
| 423 | struct drm_atomic_state *state); | ||
| 424 | void drm_atomic_bridge_post_disable(struct drm_bridge *bridge, | ||
| 425 | struct drm_atomic_state *state); | ||
| 426 | void drm_atomic_bridge_pre_enable(struct drm_bridge *bridge, | ||
| 427 | struct drm_atomic_state *state); | ||
| 428 | void drm_atomic_bridge_enable(struct drm_bridge *bridge, | ||
| 429 | struct drm_atomic_state *state); | ||
| 430 | |||
| 317 | #ifdef CONFIG_DRM_PANEL_BRIDGE | 431 | #ifdef CONFIG_DRM_PANEL_BRIDGE |
| 318 | struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel, | 432 | struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel, |
| 319 | u32 connector_type); | 433 | u32 connector_type); |
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h index 268b2cf0052a..72d51d1e9dd9 100644 --- a/include/drm/drm_client.h +++ b/include/drm/drm_client.h | |||
| @@ -3,8 +3,13 @@ | |||
| 3 | #ifndef _DRM_CLIENT_H_ | 3 | #ifndef _DRM_CLIENT_H_ |
| 4 | #define _DRM_CLIENT_H_ | 4 | #define _DRM_CLIENT_H_ |
| 5 | 5 | ||
| 6 | #include <linux/lockdep.h> | ||
| 7 | #include <linux/mutex.h> | ||
| 6 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 7 | 9 | ||
| 10 | #include <drm/drm_connector.h> | ||
| 11 | #include <drm/drm_crtc.h> | ||
| 12 | |||
| 8 | struct drm_client_dev; | 13 | struct drm_client_dev; |
| 9 | struct drm_device; | 14 | struct drm_device; |
| 10 | struct drm_file; | 15 | struct drm_file; |
| @@ -85,6 +90,16 @@ struct drm_client_dev { | |||
| 85 | * @file: DRM file | 90 | * @file: DRM file |
| 86 | */ | 91 | */ |
| 87 | struct drm_file *file; | 92 | struct drm_file *file; |
| 93 | |||
| 94 | /** | ||
| 95 | * @modeset_mutex: Protects @modesets. | ||
| 96 | */ | ||
| 97 | struct mutex modeset_mutex; | ||
| 98 | |||
| 99 | /** | ||
| 100 | * @modesets: CRTC configurations | ||
| 101 | */ | ||
| 102 | struct drm_mode_set *modesets; | ||
| 88 | }; | 103 | }; |
| 89 | 104 | ||
| 90 | int drm_client_init(struct drm_device *dev, struct drm_client_dev *client, | 105 | int drm_client_init(struct drm_device *dev, struct drm_client_dev *client, |
| @@ -135,6 +150,37 @@ struct drm_client_buffer * | |||
| 135 | drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format); | 150 | drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format); |
| 136 | void drm_client_framebuffer_delete(struct drm_client_buffer *buffer); | 151 | void drm_client_framebuffer_delete(struct drm_client_buffer *buffer); |
| 137 | 152 | ||
| 153 | int drm_client_modeset_create(struct drm_client_dev *client); | ||
| 154 | void drm_client_modeset_free(struct drm_client_dev *client); | ||
| 155 | int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, unsigned int height); | ||
| 156 | bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation); | ||
| 157 | int drm_client_modeset_commit_force(struct drm_client_dev *client); | ||
| 158 | int drm_client_modeset_commit(struct drm_client_dev *client); | ||
| 159 | int drm_client_modeset_dpms(struct drm_client_dev *client, int mode); | ||
| 160 | |||
| 161 | /** | ||
| 162 | * drm_client_for_each_modeset() - Iterate over client modesets | ||
| 163 | * @modeset: &drm_mode_set loop cursor | ||
| 164 | * @client: DRM client | ||
| 165 | */ | ||
| 166 | #define drm_client_for_each_modeset(modeset, client) \ | ||
| 167 | for (({ lockdep_assert_held(&(client)->modeset_mutex); }), \ | ||
| 168 | modeset = (client)->modesets; modeset->crtc; modeset++) | ||
| 169 | |||
| 170 | /** | ||
| 171 | * drm_client_for_each_connector_iter - connector_list iterator macro | ||
| 172 | * @connector: &struct drm_connector pointer used as cursor | ||
| 173 | * @iter: &struct drm_connector_list_iter | ||
| 174 | * | ||
| 175 | * This iterates the connectors that are useable for internal clients (excludes | ||
| 176 | * writeback connectors). | ||
| 177 | * | ||
| 178 | * For more info see drm_for_each_connector_iter(). | ||
| 179 | */ | ||
| 180 | #define drm_client_for_each_connector_iter(connector, iter) \ | ||
| 181 | drm_for_each_connector_iter(connector, iter) \ | ||
| 182 | if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) | ||
| 183 | |||
| 138 | int drm_client_debugfs_init(struct drm_minor *minor); | 184 | int drm_client_debugfs_init(struct drm_minor *minor); |
| 139 | 185 | ||
| 140 | #endif | 186 | #endif |
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 02a131202add..ca745d9feaf5 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h | |||
| @@ -464,13 +464,37 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info, | |||
| 464 | unsigned int num_formats); | 464 | unsigned int num_formats); |
| 465 | 465 | ||
| 466 | /** | 466 | /** |
| 467 | * struct drm_connector_tv_margins - TV connector related margins | ||
| 468 | * | ||
| 469 | * Describes the margins in pixels to put around the image on TV | ||
| 470 | * connectors to deal with overscan. | ||
| 471 | */ | ||
| 472 | struct drm_connector_tv_margins { | ||
| 473 | /** | ||
| 474 | * @bottom: Bottom margin in pixels. | ||
| 475 | */ | ||
| 476 | unsigned int bottom; | ||
| 477 | |||
| 478 | /** | ||
| 479 | * @left: Left margin in pixels. | ||
| 480 | */ | ||
| 481 | unsigned int left; | ||
| 482 | |||
| 483 | /** | ||
| 484 | * @right: Right margin in pixels. | ||
| 485 | */ | ||
| 486 | unsigned int right; | ||
| 487 | |||
| 488 | /** | ||
| 489 | * @top: Top margin in pixels. | ||
| 490 | */ | ||
| 491 | unsigned int top; | ||
| 492 | }; | ||
| 493 | |||
| 494 | /** | ||
| 467 | * struct drm_tv_connector_state - TV connector related states | 495 | * struct drm_tv_connector_state - TV connector related states |
| 468 | * @subconnector: selected subconnector | 496 | * @subconnector: selected subconnector |
| 469 | * @margins: margins (all margins are expressed in pixels) | 497 | * @margins: TV margins |
| 470 | * @margins.left: left margin | ||
| 471 | * @margins.right: right margin | ||
| 472 | * @margins.top: top margin | ||
| 473 | * @margins.bottom: bottom margin | ||
| 474 | * @mode: TV mode | 498 | * @mode: TV mode |
| 475 | * @brightness: brightness in percent | 499 | * @brightness: brightness in percent |
| 476 | * @contrast: contrast in percent | 500 | * @contrast: contrast in percent |
| @@ -481,12 +505,7 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info, | |||
| 481 | */ | 505 | */ |
| 482 | struct drm_tv_connector_state { | 506 | struct drm_tv_connector_state { |
| 483 | enum drm_mode_subconnector subconnector; | 507 | enum drm_mode_subconnector subconnector; |
| 484 | struct { | 508 | struct drm_connector_tv_margins margins; |
| 485 | unsigned int left; | ||
| 486 | unsigned int right; | ||
| 487 | unsigned int top; | ||
| 488 | unsigned int bottom; | ||
| 489 | } margins; | ||
| 490 | unsigned int mode; | 509 | unsigned int mode; |
| 491 | unsigned int brightness; | 510 | unsigned int brightness; |
| 492 | unsigned int contrast; | 511 | unsigned int contrast; |
| @@ -517,6 +536,15 @@ struct drm_connector_state { | |||
| 517 | * Used by the atomic helpers to select the encoder, through the | 536 | * Used by the atomic helpers to select the encoder, through the |
| 518 | * &drm_connector_helper_funcs.atomic_best_encoder or | 537 | * &drm_connector_helper_funcs.atomic_best_encoder or |
| 519 | * &drm_connector_helper_funcs.best_encoder callbacks. | 538 | * &drm_connector_helper_funcs.best_encoder callbacks. |
| 539 | * | ||
| 540 | * This is also used in the atomic helpers to map encoders to their | ||
| 541 | * current and previous connectors, see | ||
| 542 | * &drm_atomic_get_old_connector_for_encoder() and | ||
| 543 | * &drm_atomic_get_new_connector_for_encoder(). | ||
| 544 | * | ||
| 545 | * NOTE: Atomic drivers must fill this out (either themselves or through | ||
| 546 | * helpers), for otherwise the GETCONNECTOR and GETENCODER IOCTLs will | ||
| 547 | * not return correct data to userspace. | ||
| 520 | */ | 548 | */ |
| 521 | struct drm_encoder *best_encoder; | 549 | struct drm_encoder *best_encoder; |
| 522 | 550 | ||
| @@ -540,6 +568,20 @@ struct drm_connector_state { | |||
| 540 | struct drm_tv_connector_state tv; | 568 | struct drm_tv_connector_state tv; |
| 541 | 569 | ||
| 542 | /** | 570 | /** |
| 571 | * @self_refresh_aware: | ||
| 572 | * | ||
| 573 | * This tracks whether a connector is aware of the self refresh state. | ||
| 574 | * It should be set to true for those connector implementations which | ||
| 575 | * understand the self refresh state. This is needed since the crtc | ||
| 576 | * registers the self refresh helpers and it doesn't know if the | ||
| 577 | * connectors downstream have implemented self refresh entry/exit. | ||
| 578 | * | ||
| 579 | * Drivers should set this to true in atomic_check if they know how to | ||
| 580 | * handle self_refresh requests. | ||
| 581 | */ | ||
| 582 | bool self_refresh_aware; | ||
| 583 | |||
| 584 | /** | ||
| 543 | * @picture_aspect_ratio: Connector property to control the | 585 | * @picture_aspect_ratio: Connector property to control the |
| 544 | * HDMI infoframe aspect ratio setting. | 586 | * HDMI infoframe aspect ratio setting. |
| 545 | * | 587 | * |
| @@ -599,6 +641,12 @@ struct drm_connector_state { | |||
| 599 | * and the connector bpc limitations obtained from edid. | 641 | * and the connector bpc limitations obtained from edid. |
| 600 | */ | 642 | */ |
| 601 | u8 max_bpc; | 643 | u8 max_bpc; |
| 644 | |||
| 645 | /** | ||
| 646 | * @hdr_output_metadata: | ||
| 647 | * DRM blob property for HDR output metadata | ||
| 648 | */ | ||
| 649 | struct drm_property_blob *hdr_output_metadata; | ||
| 602 | }; | 650 | }; |
| 603 | 651 | ||
| 604 | /** | 652 | /** |
| @@ -894,19 +942,123 @@ struct drm_connector_funcs { | |||
| 894 | const struct drm_connector_state *state); | 942 | const struct drm_connector_state *state); |
| 895 | }; | 943 | }; |
| 896 | 944 | ||
| 897 | /* mode specified on the command line */ | 945 | /** |
| 946 | * struct drm_cmdline_mode - DRM Mode passed through the kernel command-line | ||
| 947 | * | ||
| 948 | * Each connector can have an initial mode with additional options | ||
| 949 | * passed through the kernel command line. This structure allows to | ||
| 950 | * express those parameters and will be filled by the command-line | ||
| 951 | * parser. | ||
| 952 | */ | ||
| 898 | struct drm_cmdline_mode { | 953 | struct drm_cmdline_mode { |
| 954 | /** | ||
| 955 | * @name: | ||
| 956 | * | ||
| 957 | * Name of the mode. | ||
| 958 | */ | ||
| 959 | char name[DRM_DISPLAY_MODE_LEN]; | ||
| 960 | |||
| 961 | /** | ||
| 962 | * @specified: | ||
| 963 | * | ||
| 964 | * Has a mode been read from the command-line? | ||
| 965 | */ | ||
| 899 | bool specified; | 966 | bool specified; |
| 967 | |||
| 968 | /** | ||
| 969 | * @refresh_specified: | ||
| 970 | * | ||
| 971 | * Did the mode have a preferred refresh rate? | ||
| 972 | */ | ||
| 900 | bool refresh_specified; | 973 | bool refresh_specified; |
| 974 | |||
| 975 | /** | ||
| 976 | * @bpp_specified: | ||
| 977 | * | ||
| 978 | * Did the mode have a preferred BPP? | ||
| 979 | */ | ||
| 901 | bool bpp_specified; | 980 | bool bpp_specified; |
| 902 | int xres, yres; | 981 | |
| 982 | /** | ||
| 983 | * @xres: | ||
| 984 | * | ||
| 985 | * Active resolution on the X axis, in pixels. | ||
| 986 | */ | ||
| 987 | int xres; | ||
| 988 | |||
| 989 | /** | ||
| 990 | * @yres: | ||
| 991 | * | ||
| 992 | * Active resolution on the Y axis, in pixels. | ||
| 993 | */ | ||
| 994 | int yres; | ||
| 995 | |||
| 996 | /** | ||
| 997 | * @bpp: | ||
| 998 | * | ||
| 999 | * Bits per pixels for the mode. | ||
| 1000 | */ | ||
| 903 | int bpp; | 1001 | int bpp; |
| 1002 | |||
| 1003 | /** | ||
| 1004 | * @refresh: | ||
| 1005 | * | ||
| 1006 | * Refresh rate, in Hertz. | ||
| 1007 | */ | ||
| 904 | int refresh; | 1008 | int refresh; |
| 1009 | |||
| 1010 | /** | ||
| 1011 | * @rb: | ||
| 1012 | * | ||
| 1013 | * Do we need to use reduced blanking? | ||
| 1014 | */ | ||
| 905 | bool rb; | 1015 | bool rb; |
| 1016 | |||
| 1017 | /** | ||
| 1018 | * @interlace: | ||
| 1019 | * | ||
| 1020 | * The mode is interlaced. | ||
| 1021 | */ | ||
| 906 | bool interlace; | 1022 | bool interlace; |
| 1023 | |||
| 1024 | /** | ||
| 1025 | * @cvt: | ||
| 1026 | * | ||
| 1027 | * The timings will be calculated using the VESA Coordinated | ||
| 1028 | * Video Timings instead of looking up the mode from a table. | ||
| 1029 | */ | ||
| 907 | bool cvt; | 1030 | bool cvt; |
| 1031 | |||
| 1032 | /** | ||
| 1033 | * @margins: | ||
| 1034 | * | ||
| 1035 | * Add margins to the mode calculation (1.8% of xres rounded | ||
| 1036 | * down to 8 pixels and 1.8% of yres). | ||
| 1037 | */ | ||
| 908 | bool margins; | 1038 | bool margins; |
| 1039 | |||
| 1040 | /** | ||
| 1041 | * @force: | ||
| 1042 | * | ||
| 1043 | * Ignore the hotplug state of the connector, and force its | ||
| 1044 | * state to one of the DRM_FORCE_* values. | ||
| 1045 | */ | ||
| 909 | enum drm_connector_force force; | 1046 | enum drm_connector_force force; |
| 1047 | |||
| 1048 | /** | ||
| 1049 | * @rotation_reflection: | ||
| 1050 | * | ||
| 1051 | * Initial rotation and reflection of the mode setup from the | ||
| 1052 | * command line. See DRM_MODE_ROTATE_* and | ||
| 1053 | * DRM_MODE_REFLECT_*. The only rotations supported are | ||
| 1054 | * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180. | ||
| 1055 | */ | ||
| 1056 | unsigned int rotation_reflection; | ||
| 1057 | |||
| 1058 | /** | ||
| 1059 | * @tv_margins: TV margins to apply to the mode. | ||
| 1060 | */ | ||
| 1061 | struct drm_connector_tv_margins tv_margins; | ||
| 910 | }; | 1062 | }; |
| 911 | 1063 | ||
| 912 | /** | 1064 | /** |
| @@ -1062,12 +1214,6 @@ struct drm_connector { | |||
| 1062 | struct drm_property *vrr_capable_property; | 1214 | struct drm_property *vrr_capable_property; |
| 1063 | 1215 | ||
| 1064 | /** | 1216 | /** |
| 1065 | * @content_protection_property: DRM ENUM property for content | ||
| 1066 | * protection. See drm_connector_attach_content_protection_property(). | ||
| 1067 | */ | ||
| 1068 | struct drm_property *content_protection_property; | ||
| 1069 | |||
| 1070 | /** | ||
| 1071 | * @colorspace_property: Connector property to set the suitable | 1217 | * @colorspace_property: Connector property to set the suitable |
| 1072 | * colorspace supported by the sink. | 1218 | * colorspace supported by the sink. |
| 1073 | */ | 1219 | */ |
| @@ -1239,6 +1385,9 @@ struct drm_connector { | |||
| 1239 | * &drm_mode_config.connector_free_work. | 1385 | * &drm_mode_config.connector_free_work. |
| 1240 | */ | 1386 | */ |
| 1241 | struct llist_node free_node; | 1387 | struct llist_node free_node; |
| 1388 | |||
| 1389 | /** @hdr_sink_metadata: HDR Metadata Information read from sink */ | ||
| 1390 | struct hdr_sink_metadata hdr_sink_metadata; | ||
| 1242 | }; | 1391 | }; |
| 1243 | 1392 | ||
| 1244 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) | 1393 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) |
| @@ -1345,8 +1494,6 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, | |||
| 1345 | u32 scaling_mode_mask); | 1494 | u32 scaling_mode_mask); |
| 1346 | int drm_connector_attach_vrr_capable_property( | 1495 | int drm_connector_attach_vrr_capable_property( |
| 1347 | struct drm_connector *connector); | 1496 | struct drm_connector *connector); |
| 1348 | int drm_connector_attach_content_protection_property( | ||
| 1349 | struct drm_connector *connector); | ||
| 1350 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev); | 1497 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev); |
| 1351 | int drm_mode_create_colorspace_property(struct drm_connector *connector); | 1498 | int drm_mode_create_colorspace_property(struct drm_connector *connector); |
| 1352 | int drm_mode_create_content_type_property(struct drm_device *dev); | 1499 | int drm_mode_create_content_type_property(struct drm_device *dev); |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 58ad983d7cd6..128d8b210621 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <drm/drm_framebuffer.h> | 39 | #include <drm/drm_framebuffer.h> |
| 40 | #include <drm/drm_modes.h> | 40 | #include <drm/drm_modes.h> |
| 41 | #include <drm/drm_connector.h> | 41 | #include <drm/drm_connector.h> |
| 42 | #include <drm/drm_device.h> | ||
| 42 | #include <drm/drm_property.h> | 43 | #include <drm/drm_property.h> |
| 43 | #include <drm/drm_bridge.h> | 44 | #include <drm/drm_bridge.h> |
| 44 | #include <drm/drm_edid.h> | 45 | #include <drm/drm_edid.h> |
| @@ -53,6 +54,7 @@ struct drm_mode_set; | |||
| 53 | struct drm_file; | 54 | struct drm_file; |
| 54 | struct drm_clip_rect; | 55 | struct drm_clip_rect; |
| 55 | struct drm_printer; | 56 | struct drm_printer; |
| 57 | struct drm_self_refresh_data; | ||
| 56 | struct device_node; | 58 | struct device_node; |
| 57 | struct dma_fence; | 59 | struct dma_fence; |
| 58 | struct edid; | 60 | struct edid; |
| @@ -300,6 +302,17 @@ struct drm_crtc_state { | |||
| 300 | bool vrr_enabled; | 302 | bool vrr_enabled; |
| 301 | 303 | ||
| 302 | /** | 304 | /** |
| 305 | * @self_refresh_active: | ||
| 306 | * | ||
| 307 | * Used by the self refresh helpers to denote when a self refresh | ||
| 308 | * transition is occurring. This will be set on enable/disable callbacks | ||
| 309 | * when self refresh is being enabled or disabled. In some cases, it may | ||
| 310 | * not be desirable to fully shut off the crtc during self refresh. | ||
| 311 | * CRTC's can inspect this flag and determine the best course of action. | ||
| 312 | */ | ||
| 313 | bool self_refresh_active; | ||
| 314 | |||
| 315 | /** | ||
| 303 | * @event: | 316 | * @event: |
| 304 | * | 317 | * |
| 305 | * Optional pointer to a DRM event to signal upon completion of the | 318 | * Optional pointer to a DRM event to signal upon completion of the |
| @@ -1087,6 +1100,13 @@ struct drm_crtc { | |||
| 1087 | * The name of the CRTC's fence timeline. | 1100 | * The name of the CRTC's fence timeline. |
| 1088 | */ | 1101 | */ |
| 1089 | char timeline_name[32]; | 1102 | char timeline_name[32]; |
| 1103 | |||
| 1104 | /** | ||
| 1105 | * @self_refresh_data: Holds the state for the self refresh helpers | ||
| 1106 | * | ||
| 1107 | * Initialized via drm_self_refresh_helper_register(). | ||
| 1108 | */ | ||
| 1109 | struct drm_self_refresh_data *self_refresh_data; | ||
| 1090 | }; | 1110 | }; |
| 1091 | 1111 | ||
| 1092 | /** | 1112 | /** |
diff --git a/include/drm/drm_debugfs.h b/include/drm/drm_debugfs.h index ac0f75df1ac9..7501e323d383 100644 --- a/include/drm/drm_debugfs.h +++ b/include/drm/drm_debugfs.h | |||
| @@ -32,6 +32,8 @@ | |||
| 32 | #ifndef _DRM_DEBUGFS_H_ | 32 | #ifndef _DRM_DEBUGFS_H_ |
| 33 | #define _DRM_DEBUGFS_H_ | 33 | #define _DRM_DEBUGFS_H_ |
| 34 | 34 | ||
| 35 | #include <linux/types.h> | ||
| 36 | #include <linux/seq_file.h> | ||
| 35 | /** | 37 | /** |
| 36 | * struct drm_info_list - debugfs info list entry | 38 | * struct drm_info_list - debugfs info list entry |
| 37 | * | 39 | * |
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h index 7f9ef709b2b6..1acfc3bbd3fb 100644 --- a/include/drm/drm_device.h +++ b/include/drm/drm_device.h | |||
| @@ -17,6 +17,7 @@ struct drm_vblank_crtc; | |||
| 17 | struct drm_sg_mem; | 17 | struct drm_sg_mem; |
| 18 | struct drm_local_map; | 18 | struct drm_local_map; |
| 19 | struct drm_vma_offset_manager; | 19 | struct drm_vma_offset_manager; |
| 20 | struct drm_vram_mm; | ||
| 20 | struct drm_fb_helper; | 21 | struct drm_fb_helper; |
| 21 | 22 | ||
| 22 | struct inode; | 23 | struct inode; |
| @@ -286,6 +287,9 @@ struct drm_device { | |||
| 286 | /** @vma_offset_manager: GEM information */ | 287 | /** @vma_offset_manager: GEM information */ |
| 287 | struct drm_vma_offset_manager *vma_offset_manager; | 288 | struct drm_vma_offset_manager *vma_offset_manager; |
| 288 | 289 | ||
| 290 | /** @vram_mm: VRAM MM memory manager */ | ||
| 291 | struct drm_vram_mm *vram_mm; | ||
| 292 | |||
| 289 | /** | 293 | /** |
| 290 | * @switch_power_state: | 294 | * @switch_power_state: |
| 291 | * | 295 | * |
diff --git a/include/drm/drm_displayid.h b/include/drm/drm_displayid.h index c0d4df6a606f..9d3b745c3107 100644 --- a/include/drm/drm_displayid.h +++ b/include/drm/drm_displayid.h | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #define DATA_BLOCK_DISPLAY_INTERFACE 0x0f | 40 | #define DATA_BLOCK_DISPLAY_INTERFACE 0x0f |
| 41 | #define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x10 | 41 | #define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x10 |
| 42 | #define DATA_BLOCK_TILED_DISPLAY 0x12 | 42 | #define DATA_BLOCK_TILED_DISPLAY 0x12 |
| 43 | #define DATA_BLOCK_CTA 0x81 | ||
| 43 | 44 | ||
| 44 | #define DATA_BLOCK_VENDOR_SPECIFIC 0x7f | 45 | #define DATA_BLOCK_VENDOR_SPECIFIC 0x7f |
| 45 | 46 | ||
| @@ -90,4 +91,13 @@ struct displayid_detailed_timing_block { | |||
| 90 | struct displayid_block base; | 91 | struct displayid_block base; |
| 91 | struct displayid_detailed_timings_1 timings[0]; | 92 | struct displayid_detailed_timings_1 timings[0]; |
| 92 | }; | 93 | }; |
| 94 | |||
| 95 | #define for_each_displayid_db(displayid, block, idx, length) \ | ||
| 96 | for ((block) = (struct displayid_block *)&(displayid)[idx]; \ | ||
| 97 | (idx) + sizeof(struct displayid_block) <= (length) && \ | ||
| 98 | (idx) + sizeof(struct displayid_block) + (block)->num_bytes <= (length) && \ | ||
| 99 | (block)->num_bytes > 0; \ | ||
| 100 | (idx) += (block)->num_bytes + sizeof(struct displayid_block), \ | ||
| 101 | (block) = (struct displayid_block *)&(displayid)[idx]) | ||
| 102 | |||
| 93 | #endif | 103 | #endif |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 97ce790a5b5a..397896b5b21a 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h | |||
| @@ -249,6 +249,7 @@ | |||
| 249 | #define DP_DSC_PEAK_THROUGHPUT 0x06B | 249 | #define DP_DSC_PEAK_THROUGHPUT 0x06B |
| 250 | # define DP_DSC_THROUGHPUT_MODE_0_MASK (0xf << 0) | 250 | # define DP_DSC_THROUGHPUT_MODE_0_MASK (0xf << 0) |
| 251 | # define DP_DSC_THROUGHPUT_MODE_0_SHIFT 0 | 251 | # define DP_DSC_THROUGHPUT_MODE_0_SHIFT 0 |
| 252 | # define DP_DSC_THROUGHPUT_MODE_0_UPSUPPORTED 0 | ||
| 252 | # define DP_DSC_THROUGHPUT_MODE_0_340 (1 << 0) | 253 | # define DP_DSC_THROUGHPUT_MODE_0_340 (1 << 0) |
| 253 | # define DP_DSC_THROUGHPUT_MODE_0_400 (2 << 0) | 254 | # define DP_DSC_THROUGHPUT_MODE_0_400 (2 << 0) |
| 254 | # define DP_DSC_THROUGHPUT_MODE_0_450 (3 << 0) | 255 | # define DP_DSC_THROUGHPUT_MODE_0_450 (3 << 0) |
| @@ -263,8 +264,10 @@ | |||
| 263 | # define DP_DSC_THROUGHPUT_MODE_0_900 (12 << 0) | 264 | # define DP_DSC_THROUGHPUT_MODE_0_900 (12 << 0) |
| 264 | # define DP_DSC_THROUGHPUT_MODE_0_950 (13 << 0) | 265 | # define DP_DSC_THROUGHPUT_MODE_0_950 (13 << 0) |
| 265 | # define DP_DSC_THROUGHPUT_MODE_0_1000 (14 << 0) | 266 | # define DP_DSC_THROUGHPUT_MODE_0_1000 (14 << 0) |
| 267 | # define DP_DSC_THROUGHPUT_MODE_0_170 (15 << 4) | ||
| 266 | # define DP_DSC_THROUGHPUT_MODE_1_MASK (0xf << 4) | 268 | # define DP_DSC_THROUGHPUT_MODE_1_MASK (0xf << 4) |
| 267 | # define DP_DSC_THROUGHPUT_MODE_1_SHIFT 4 | 269 | # define DP_DSC_THROUGHPUT_MODE_1_SHIFT 4 |
| 270 | # define DP_DSC_THROUGHPUT_MODE_1_UPSUPPORTED 0 | ||
| 268 | # define DP_DSC_THROUGHPUT_MODE_1_340 (1 << 4) | 271 | # define DP_DSC_THROUGHPUT_MODE_1_340 (1 << 4) |
| 269 | # define DP_DSC_THROUGHPUT_MODE_1_400 (2 << 4) | 272 | # define DP_DSC_THROUGHPUT_MODE_1_400 (2 << 4) |
| 270 | # define DP_DSC_THROUGHPUT_MODE_1_450 (3 << 4) | 273 | # define DP_DSC_THROUGHPUT_MODE_1_450 (3 << 4) |
| @@ -279,6 +282,7 @@ | |||
| 279 | # define DP_DSC_THROUGHPUT_MODE_1_900 (12 << 4) | 282 | # define DP_DSC_THROUGHPUT_MODE_1_900 (12 << 4) |
| 280 | # define DP_DSC_THROUGHPUT_MODE_1_950 (13 << 4) | 283 | # define DP_DSC_THROUGHPUT_MODE_1_950 (13 << 4) |
| 281 | # define DP_DSC_THROUGHPUT_MODE_1_1000 (14 << 4) | 284 | # define DP_DSC_THROUGHPUT_MODE_1_1000 (14 << 4) |
| 285 | # define DP_DSC_THROUGHPUT_MODE_1_170 (15 << 4) | ||
| 282 | 286 | ||
| 283 | #define DP_DSC_MAX_SLICE_WIDTH 0x06C | 287 | #define DP_DSC_MAX_SLICE_WIDTH 0x06C |
| 284 | #define DP_DSC_MIN_SLICE_WIDTH_VALUE 2560 | 288 | #define DP_DSC_MIN_SLICE_WIDTH_VALUE 2560 |
| @@ -352,6 +356,11 @@ | |||
| 352 | # define DP_FEC_CORR_BLK_ERROR_COUNT_CAP (1 << 2) | 356 | # define DP_FEC_CORR_BLK_ERROR_COUNT_CAP (1 << 2) |
| 353 | # define DP_FEC_BIT_ERROR_COUNT_CAP (1 << 3) | 357 | # define DP_FEC_BIT_ERROR_COUNT_CAP (1 << 3) |
| 354 | 358 | ||
| 359 | /* DP Extended DSC Capabilities */ | ||
| 360 | #define DP_DSC_BRANCH_OVERALL_THROUGHPUT_0 0x0a0 /* DP 1.4a SCR */ | ||
| 361 | #define DP_DSC_BRANCH_OVERALL_THROUGHPUT_1 0x0a1 | ||
| 362 | #define DP_DSC_BRANCH_MAX_LINE_WIDTH 0x0a2 | ||
| 363 | |||
| 355 | /* link configuration */ | 364 | /* link configuration */ |
| 356 | #define DP_LINK_BW_SET 0x100 | 365 | #define DP_LINK_BW_SET 0x100 |
| 357 | # define DP_LINK_RATE_TABLE 0x00 /* eDP 1.4 */ | 366 | # define DP_LINK_RATE_TABLE 0x00 /* eDP 1.4 */ |
| @@ -1083,17 +1092,30 @@ struct dp_sdp_header { | |||
| 1083 | #define EDP_SDP_HEADER_VALID_PAYLOAD_BYTES 0x1F | 1092 | #define EDP_SDP_HEADER_VALID_PAYLOAD_BYTES 0x1F |
| 1084 | #define DP_SDP_PPS_HEADER_PAYLOAD_BYTES_MINUS_1 0x7F | 1093 | #define DP_SDP_PPS_HEADER_PAYLOAD_BYTES_MINUS_1 0x7F |
| 1085 | 1094 | ||
| 1086 | struct edp_vsc_psr { | 1095 | /** |
| 1096 | * struct dp_sdp - DP secondary data packet | ||
| 1097 | * @sdp_header: DP secondary data packet header | ||
| 1098 | * @db: DP secondaray data packet data blocks | ||
| 1099 | * VSC SDP Payload for PSR | ||
| 1100 | * db[0]: Stereo Interface | ||
| 1101 | * db[1]: 0 - PSR State; 1 - Update RFB; 2 - CRC Valid | ||
| 1102 | * db[2]: CRC value bits 7:0 of the R or Cr component | ||
| 1103 | * db[3]: CRC value bits 15:8 of the R or Cr component | ||
| 1104 | * db[4]: CRC value bits 7:0 of the G or Y component | ||
| 1105 | * db[5]: CRC value bits 15:8 of the G or Y component | ||
| 1106 | * db[6]: CRC value bits 7:0 of the B or Cb component | ||
| 1107 | * db[7]: CRC value bits 15:8 of the B or Cb component | ||
| 1108 | * db[8] - db[31]: Reserved | ||
| 1109 | * VSC SDP Payload for Pixel Encoding/Colorimetry Format | ||
| 1110 | * db[0] - db[15]: Reserved | ||
| 1111 | * db[16]: Pixel Encoding and Colorimetry Formats | ||
| 1112 | * db[17]: Dynamic Range and Component Bit Depth | ||
| 1113 | * db[18]: Content Type | ||
| 1114 | * db[19] - db[31]: Reserved | ||
| 1115 | */ | ||
| 1116 | struct dp_sdp { | ||
| 1087 | struct dp_sdp_header sdp_header; | 1117 | struct dp_sdp_header sdp_header; |
| 1088 | u8 DB0; /* Stereo Interface */ | 1118 | u8 db[32]; |
| 1089 | u8 DB1; /* 0 - PSR State; 1 - Update RFB; 2 - CRC Valid */ | ||
| 1090 | u8 DB2; /* CRC value bits 7:0 of the R or Cr component */ | ||
| 1091 | u8 DB3; /* CRC value bits 15:8 of the R or Cr component */ | ||
| 1092 | u8 DB4; /* CRC value bits 7:0 of the G or Y component */ | ||
| 1093 | u8 DB5; /* CRC value bits 15:8 of the G or Y component */ | ||
| 1094 | u8 DB6; /* CRC value bits 7:0 of the B or Cb component */ | ||
| 1095 | u8 DB7; /* CRC value bits 15:8 of the B or Cb component */ | ||
| 1096 | u8 DB8_31[24]; /* Reserved */ | ||
| 1097 | } __packed; | 1119 | } __packed; |
| 1098 | 1120 | ||
| 1099 | #define EDP_VSC_PSR_STATE_ACTIVE (1<<0) | 1121 | #define EDP_VSC_PSR_STATE_ACTIVE (1<<0) |
| @@ -1401,6 +1423,13 @@ enum drm_dp_quirk { | |||
| 1401 | * driver still need to implement proper handling for such device. | 1423 | * driver still need to implement proper handling for such device. |
| 1402 | */ | 1424 | */ |
| 1403 | DP_DPCD_QUIRK_NO_PSR, | 1425 | DP_DPCD_QUIRK_NO_PSR, |
| 1426 | /** | ||
| 1427 | * @DP_DPCD_QUIRK_NO_SINK_COUNT: | ||
| 1428 | * | ||
| 1429 | * The device does not set SINK_COUNT to a non-zero value. | ||
| 1430 | * The driver should ignore SINK_COUNT during detection. | ||
| 1431 | */ | ||
| 1432 | DP_DPCD_QUIRK_NO_SINK_COUNT, | ||
| 1404 | }; | 1433 | }; |
| 1405 | 1434 | ||
| 1406 | /** | 1435 | /** |
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index c9ca0be54d9a..b9719418c3d2 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
| 27 | #include <linux/hdmi.h> | 27 | #include <linux/hdmi.h> |
| 28 | #include <drm/drm_mode.h> | ||
| 28 | 29 | ||
| 29 | struct drm_device; | 30 | struct drm_device; |
| 30 | struct i2c_adapter; | 31 | struct i2c_adapter; |
| @@ -176,21 +177,23 @@ struct detailed_timing { | |||
| 176 | #define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4) | 177 | #define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4) |
| 177 | #define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5) | 178 | #define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5) |
| 178 | #define DRM_EDID_INPUT_DIGITAL (1 << 7) | 179 | #define DRM_EDID_INPUT_DIGITAL (1 << 7) |
| 179 | #define DRM_EDID_DIGITAL_DEPTH_MASK (7 << 4) | 180 | #define DRM_EDID_DIGITAL_DEPTH_MASK (7 << 4) /* 1.4 */ |
| 180 | #define DRM_EDID_DIGITAL_DEPTH_UNDEF (0 << 4) | 181 | #define DRM_EDID_DIGITAL_DEPTH_UNDEF (0 << 4) /* 1.4 */ |
| 181 | #define DRM_EDID_DIGITAL_DEPTH_6 (1 << 4) | 182 | #define DRM_EDID_DIGITAL_DEPTH_6 (1 << 4) /* 1.4 */ |
| 182 | #define DRM_EDID_DIGITAL_DEPTH_8 (2 << 4) | 183 | #define DRM_EDID_DIGITAL_DEPTH_8 (2 << 4) /* 1.4 */ |
| 183 | #define DRM_EDID_DIGITAL_DEPTH_10 (3 << 4) | 184 | #define DRM_EDID_DIGITAL_DEPTH_10 (3 << 4) /* 1.4 */ |
| 184 | #define DRM_EDID_DIGITAL_DEPTH_12 (4 << 4) | 185 | #define DRM_EDID_DIGITAL_DEPTH_12 (4 << 4) /* 1.4 */ |
| 185 | #define DRM_EDID_DIGITAL_DEPTH_14 (5 << 4) | 186 | #define DRM_EDID_DIGITAL_DEPTH_14 (5 << 4) /* 1.4 */ |
| 186 | #define DRM_EDID_DIGITAL_DEPTH_16 (6 << 4) | 187 | #define DRM_EDID_DIGITAL_DEPTH_16 (6 << 4) /* 1.4 */ |
| 187 | #define DRM_EDID_DIGITAL_DEPTH_RSVD (7 << 4) | 188 | #define DRM_EDID_DIGITAL_DEPTH_RSVD (7 << 4) /* 1.4 */ |
| 188 | #define DRM_EDID_DIGITAL_TYPE_UNDEF (0) | 189 | #define DRM_EDID_DIGITAL_TYPE_MASK (7 << 0) /* 1.4 */ |
| 189 | #define DRM_EDID_DIGITAL_TYPE_DVI (1) | 190 | #define DRM_EDID_DIGITAL_TYPE_UNDEF (0 << 0) /* 1.4 */ |
| 190 | #define DRM_EDID_DIGITAL_TYPE_HDMI_A (2) | 191 | #define DRM_EDID_DIGITAL_TYPE_DVI (1 << 0) /* 1.4 */ |
| 191 | #define DRM_EDID_DIGITAL_TYPE_HDMI_B (3) | 192 | #define DRM_EDID_DIGITAL_TYPE_HDMI_A (2 << 0) /* 1.4 */ |
| 192 | #define DRM_EDID_DIGITAL_TYPE_MDDI (4) | 193 | #define DRM_EDID_DIGITAL_TYPE_HDMI_B (3 << 0) /* 1.4 */ |
| 193 | #define DRM_EDID_DIGITAL_TYPE_DP (5) | 194 | #define DRM_EDID_DIGITAL_TYPE_MDDI (4 << 0) /* 1.4 */ |
| 195 | #define DRM_EDID_DIGITAL_TYPE_DP (5 << 0) /* 1.4 */ | ||
| 196 | #define DRM_EDID_DIGITAL_DFP_1_X (1 << 0) /* 1.3 */ | ||
| 194 | 197 | ||
| 195 | #define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) | 198 | #define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) |
| 196 | #define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1) | 199 | #define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1) |
| @@ -370,6 +373,10 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, | |||
| 370 | const struct drm_display_mode *mode, | 373 | const struct drm_display_mode *mode, |
| 371 | enum hdmi_quantization_range rgb_quant_range); | 374 | enum hdmi_quantization_range rgb_quant_range); |
| 372 | 375 | ||
| 376 | int | ||
| 377 | drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame, | ||
| 378 | const struct drm_connector_state *conn_state); | ||
| 379 | |||
| 373 | /** | 380 | /** |
| 374 | * drm_eld_mnl - Get ELD monitor name length in bytes. | 381 | * drm_eld_mnl - Get ELD monitor name length in bytes. |
| 375 | * @eld: pointer to an eld memory structure with mnl set | 382 | * @eld: pointer to an eld memory structure with mnl set |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 40af2866c26a..c8a8ae2a678a 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
| @@ -43,17 +43,6 @@ enum mode_set_atomic { | |||
| 43 | ENTER_ATOMIC_MODE_SET, | 43 | ENTER_ATOMIC_MODE_SET, |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | struct drm_fb_offset { | ||
| 47 | int x, y; | ||
| 48 | }; | ||
| 49 | |||
| 50 | struct drm_fb_helper_crtc { | ||
| 51 | struct drm_mode_set mode_set; | ||
| 52 | struct drm_display_mode *desired_mode; | ||
| 53 | int x, y; | ||
| 54 | int rotation; | ||
| 55 | }; | ||
| 56 | |||
| 57 | /** | 46 | /** |
| 58 | * struct drm_fb_helper_surface_size - describes fbdev size and scanout surface size | 47 | * struct drm_fb_helper_surface_size - describes fbdev size and scanout surface size |
| 59 | * @fb_width: fbdev width | 48 | * @fb_width: fbdev width |
| @@ -104,18 +93,10 @@ struct drm_fb_helper_funcs { | |||
| 104 | struct drm_fb_helper_surface_size *sizes); | 93 | struct drm_fb_helper_surface_size *sizes); |
| 105 | }; | 94 | }; |
| 106 | 95 | ||
| 107 | struct drm_fb_helper_connector { | ||
| 108 | struct drm_connector *connector; | ||
| 109 | }; | ||
| 110 | |||
| 111 | /** | 96 | /** |
| 112 | * struct drm_fb_helper - main structure to emulate fbdev on top of KMS | 97 | * struct drm_fb_helper - main structure to emulate fbdev on top of KMS |
| 113 | * @fb: Scanout framebuffer object | 98 | * @fb: Scanout framebuffer object |
| 114 | * @dev: DRM device | 99 | * @dev: DRM device |
| 115 | * @crtc_count: number of possible CRTCs | ||
| 116 | * @crtc_info: per-CRTC helper state (mode, x/y offset, etc) | ||
| 117 | * @connector_count: number of connected connectors | ||
| 118 | * @connector_info_alloc_count: size of connector_info | ||
| 119 | * @funcs: driver callbacks for fb helper | 100 | * @funcs: driver callbacks for fb helper |
| 120 | * @fbdev: emulated fbdev device info struct | 101 | * @fbdev: emulated fbdev device info struct |
| 121 | * @pseudo_palette: fake palette of 16 colors | 102 | * @pseudo_palette: fake palette of 16 colors |
| @@ -147,24 +128,6 @@ struct drm_fb_helper { | |||
| 147 | 128 | ||
| 148 | struct drm_framebuffer *fb; | 129 | struct drm_framebuffer *fb; |
| 149 | struct drm_device *dev; | 130 | struct drm_device *dev; |
| 150 | int crtc_count; | ||
| 151 | struct drm_fb_helper_crtc *crtc_info; | ||
| 152 | int connector_count; | ||
| 153 | int connector_info_alloc_count; | ||
| 154 | /** | ||
| 155 | * @sw_rotations: | ||
| 156 | * Bitmask of all rotations requested for panel-orientation which | ||
| 157 | * could not be handled in hardware. If only one bit is set | ||
| 158 | * fbdev->fbcon_rotate_hint gets set to the requested rotation. | ||
| 159 | */ | ||
| 160 | int sw_rotations; | ||
| 161 | /** | ||
| 162 | * @connector_info: | ||
| 163 | * | ||
| 164 | * Array of per-connector information. Do not iterate directly, but use | ||
| 165 | * drm_fb_helper_for_each_connector. | ||
| 166 | */ | ||
| 167 | struct drm_fb_helper_connector **connector_info; | ||
| 168 | const struct drm_fb_helper_funcs *funcs; | 131 | const struct drm_fb_helper_funcs *funcs; |
| 169 | struct fb_info *fbdev; | 132 | struct fb_info *fbdev; |
| 170 | u32 pseudo_palette[17]; | 133 | u32 pseudo_palette[17]; |
| @@ -304,18 +267,8 @@ int drm_fb_helper_ioctl(struct fb_info *info, unsigned int cmd, | |||
| 304 | 267 | ||
| 305 | int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); | 268 | int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); |
| 306 | int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); | 269 | int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); |
| 307 | int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); | ||
| 308 | int drm_fb_helper_debug_enter(struct fb_info *info); | 270 | int drm_fb_helper_debug_enter(struct fb_info *info); |
| 309 | int drm_fb_helper_debug_leave(struct fb_info *info); | 271 | int drm_fb_helper_debug_leave(struct fb_info *info); |
| 310 | struct drm_display_mode * | ||
| 311 | drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector, | ||
| 312 | int width, int height); | ||
| 313 | struct drm_display_mode * | ||
| 314 | drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn); | ||
| 315 | |||
| 316 | int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); | ||
| 317 | int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | ||
| 318 | struct drm_connector *connector); | ||
| 319 | 272 | ||
| 320 | int drm_fb_helper_fbdev_setup(struct drm_device *dev, | 273 | int drm_fb_helper_fbdev_setup(struct drm_device *dev, |
| 321 | struct drm_fb_helper *fb_helper, | 274 | struct drm_fb_helper *fb_helper, |
| @@ -490,12 +443,6 @@ static inline int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, | |||
| 490 | return 0; | 443 | return 0; |
| 491 | } | 444 | } |
| 492 | 445 | ||
| 493 | static inline int | ||
| 494 | drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) | ||
| 495 | { | ||
| 496 | return 0; | ||
| 497 | } | ||
| 498 | |||
| 499 | static inline int drm_fb_helper_debug_enter(struct fb_info *info) | 446 | static inline int drm_fb_helper_debug_enter(struct fb_info *info) |
| 500 | { | 447 | { |
| 501 | return 0; | 448 | return 0; |
| @@ -506,34 +453,6 @@ static inline int drm_fb_helper_debug_leave(struct fb_info *info) | |||
| 506 | return 0; | 453 | return 0; |
| 507 | } | 454 | } |
| 508 | 455 | ||
| 509 | static inline struct drm_display_mode * | ||
| 510 | drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector, | ||
| 511 | int width, int height) | ||
| 512 | { | ||
| 513 | return NULL; | ||
| 514 | } | ||
| 515 | |||
| 516 | static inline struct drm_display_mode * | ||
| 517 | drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, | ||
| 518 | int width, int height) | ||
| 519 | { | ||
| 520 | return NULL; | ||
| 521 | } | ||
| 522 | |||
| 523 | static inline int | ||
| 524 | drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, | ||
| 525 | struct drm_connector *connector) | ||
| 526 | { | ||
| 527 | return 0; | ||
| 528 | } | ||
| 529 | |||
| 530 | static inline int | ||
| 531 | drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | ||
| 532 | struct drm_connector *connector) | ||
| 533 | { | ||
| 534 | return 0; | ||
| 535 | } | ||
| 536 | |||
| 537 | static inline int | 456 | static inline int |
| 538 | drm_fb_helper_fbdev_setup(struct drm_device *dev, | 457 | drm_fb_helper_fbdev_setup(struct drm_device *dev, |
| 539 | struct drm_fb_helper *fb_helper, | 458 | struct drm_fb_helper *fb_helper, |
| @@ -575,6 +494,27 @@ drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp) | |||
| 575 | 494 | ||
| 576 | #endif | 495 | #endif |
| 577 | 496 | ||
| 497 | /* TODO: There's a todo entry to remove these three */ | ||
| 498 | static inline int | ||
| 499 | drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) | ||
| 500 | { | ||
| 501 | return 0; | ||
| 502 | } | ||
| 503 | |||
| 504 | static inline int | ||
| 505 | drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, | ||
| 506 | struct drm_connector *connector) | ||
| 507 | { | ||
| 508 | return 0; | ||
| 509 | } | ||
| 510 | |||
| 511 | static inline int | ||
| 512 | drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | ||
| 513 | struct drm_connector *connector) | ||
| 514 | { | ||
| 515 | return 0; | ||
| 516 | } | ||
| 517 | |||
| 578 | /** | 518 | /** |
| 579 | * drm_fb_helper_remove_conflicting_framebuffers - remove firmware-configured framebuffers | 519 | * drm_fb_helper_remove_conflicting_framebuffers - remove firmware-configured framebuffers |
| 580 | * @a: memory range, users of which are to be removed | 520 | * @a: memory range, users of which are to be removed |
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index b3d9d88ab290..306d1efeb5e0 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h | |||
| @@ -260,6 +260,50 @@ drm_format_info_is_yuv_sampling_444(const struct drm_format_info *info) | |||
| 260 | return info->is_yuv && info->hsub == 1 && info->vsub == 1; | 260 | return info->is_yuv && info->hsub == 1 && info->vsub == 1; |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | /** | ||
| 264 | * drm_format_info_plane_width - width of the plane given the first plane | ||
| 265 | * @info: pixel format info | ||
| 266 | * @width: width of the first plane | ||
| 267 | * @plane: plane index | ||
| 268 | * | ||
| 269 | * Returns: | ||
| 270 | * The width of @plane, given that the width of the first plane is @width. | ||
| 271 | */ | ||
| 272 | static inline | ||
| 273 | int drm_format_info_plane_width(const struct drm_format_info *info, int width, | ||
| 274 | int plane) | ||
| 275 | { | ||
| 276 | if (!info || plane >= info->num_planes) | ||
| 277 | return 0; | ||
| 278 | |||
| 279 | if (plane == 0) | ||
| 280 | return width; | ||
| 281 | |||
| 282 | return width / info->hsub; | ||
| 283 | } | ||
| 284 | |||
| 285 | /** | ||
| 286 | * drm_format_info_plane_height - height of the plane given the first plane | ||
| 287 | * @info: pixel format info | ||
| 288 | * @height: height of the first plane | ||
| 289 | * @plane: plane index | ||
| 290 | * | ||
| 291 | * Returns: | ||
| 292 | * The height of @plane, given that the height of the first plane is @height. | ||
| 293 | */ | ||
| 294 | static inline | ||
| 295 | int drm_format_info_plane_height(const struct drm_format_info *info, int height, | ||
| 296 | int plane) | ||
| 297 | { | ||
| 298 | if (!info || plane >= info->num_planes) | ||
| 299 | return 0; | ||
| 300 | |||
| 301 | if (plane == 0) | ||
| 302 | return height; | ||
| 303 | |||
| 304 | return height / info->vsub; | ||
| 305 | } | ||
| 306 | |||
| 263 | const struct drm_format_info *__drm_format_info(u32 format); | 307 | const struct drm_format_info *__drm_format_info(u32 format); |
| 264 | const struct drm_format_info *drm_format_info(u32 format); | 308 | const struct drm_format_info *drm_format_info(u32 format); |
| 265 | const struct drm_format_info * | 309 | const struct drm_format_info * |
| @@ -268,12 +312,6 @@ drm_get_format_info(struct drm_device *dev, | |||
| 268 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); | 312 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); |
| 269 | uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, | 313 | uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, |
| 270 | uint32_t bpp, uint32_t depth); | 314 | uint32_t bpp, uint32_t depth); |
| 271 | int drm_format_num_planes(uint32_t format); | ||
| 272 | int drm_format_plane_cpp(uint32_t format, int plane); | ||
| 273 | int drm_format_horz_chroma_subsampling(uint32_t format); | ||
| 274 | int drm_format_vert_chroma_subsampling(uint32_t format); | ||
| 275 | int drm_format_plane_width(int width, uint32_t format, int plane); | ||
| 276 | int drm_format_plane_height(int height, uint32_t format, int plane); | ||
| 277 | unsigned int drm_format_info_block_width(const struct drm_format_info *info, | 315 | unsigned int drm_format_info_block_width(const struct drm_format_info *info, |
| 278 | int plane); | 316 | int plane); |
| 279 | unsigned int drm_format_info_block_height(const struct drm_format_info *info, | 317 | unsigned int drm_format_info_block_height(const struct drm_format_info *info, |
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index c23016748e3f..c0e0256e3e98 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h | |||
| @@ -87,6 +87,9 @@ struct drm_framebuffer_funcs { | |||
| 87 | * for more information as all the semantics and arguments have a one to | 87 | * for more information as all the semantics and arguments have a one to |
| 88 | * one mapping on this function. | 88 | * one mapping on this function. |
| 89 | * | 89 | * |
| 90 | * Atomic drivers should use drm_atomic_helper_dirtyfb() to implement | ||
| 91 | * this hook. | ||
| 92 | * | ||
| 90 | * RETURNS: | 93 | * RETURNS: |
| 91 | * | 94 | * |
| 92 | * 0 on success or a negative error code on failure. | 95 | * 0 on success or a negative error code on failure. |
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 5047c7ee25f5..a9121fe66ea2 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h | |||
| @@ -401,9 +401,4 @@ int drm_gem_dumb_destroy(struct drm_file *file, | |||
| 401 | struct drm_device *dev, | 401 | struct drm_device *dev, |
| 402 | uint32_t handle); | 402 | uint32_t handle); |
| 403 | 403 | ||
| 404 | int drm_gem_pin(struct drm_gem_object *obj); | ||
| 405 | void drm_gem_unpin(struct drm_gem_object *obj); | ||
| 406 | void *drm_gem_vmap(struct drm_gem_object *obj); | ||
| 407 | void drm_gem_vunmap(struct drm_gem_object *obj, void *vaddr); | ||
| 408 | |||
| 409 | #endif /* __DRM_GEM_H__ */ | 404 | #endif /* __DRM_GEM_H__ */ |
diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h new file mode 100644 index 000000000000..9581ea0a4f7e --- /dev/null +++ b/include/drm/drm_gem_vram_helper.h | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | |||
| 3 | #ifndef DRM_GEM_VRAM_HELPER_H | ||
| 4 | #define DRM_GEM_VRAM_HELPER_H | ||
| 5 | |||
| 6 | #include <drm/drm_gem.h> | ||
| 7 | #include <drm/ttm/ttm_bo_api.h> | ||
| 8 | #include <drm/ttm/ttm_placement.h> | ||
| 9 | #include <linux/kernel.h> /* for container_of() */ | ||
| 10 | |||
| 11 | struct drm_mode_create_dumb; | ||
| 12 | struct drm_vram_mm_funcs; | ||
| 13 | struct filp; | ||
| 14 | struct vm_area_struct; | ||
| 15 | |||
| 16 | #define DRM_GEM_VRAM_PL_FLAG_VRAM TTM_PL_FLAG_VRAM | ||
| 17 | #define DRM_GEM_VRAM_PL_FLAG_SYSTEM TTM_PL_FLAG_SYSTEM | ||
| 18 | |||
| 19 | /* | ||
| 20 | * Buffer-object helpers | ||
| 21 | */ | ||
| 22 | |||
| 23 | /** | ||
| 24 | * struct drm_gem_vram_object - GEM object backed by VRAM | ||
| 25 | * @gem: GEM object | ||
| 26 | * @bo: TTM buffer object | ||
| 27 | * @kmap: Mapping information for @bo | ||
| 28 | * @placement: TTM placement information. Supported placements are \ | ||
| 29 | %TTM_PL_VRAM and %TTM_PL_SYSTEM | ||
| 30 | * @placements: TTM placement information. | ||
| 31 | * @pin_count: Pin counter | ||
| 32 | * | ||
| 33 | * The type struct drm_gem_vram_object represents a GEM object that is | ||
| 34 | * backed by VRAM. It can be used for simple framebuffer devices with | ||
| 35 | * dedicated memory. The buffer object can be evicted to system memory if | ||
| 36 | * video memory becomes scarce. | ||
| 37 | */ | ||
| 38 | struct drm_gem_vram_object { | ||
| 39 | struct drm_gem_object gem; | ||
| 40 | struct ttm_buffer_object bo; | ||
| 41 | struct ttm_bo_kmap_obj kmap; | ||
| 42 | |||
| 43 | /* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */ | ||
| 44 | struct ttm_placement placement; | ||
| 45 | struct ttm_place placements[2]; | ||
| 46 | |||
| 47 | int pin_count; | ||
| 48 | }; | ||
| 49 | |||
| 50 | /** | ||
| 51 | * Returns the container of type &struct drm_gem_vram_object | ||
| 52 | * for field bo. | ||
| 53 | * @bo: the VRAM buffer object | ||
| 54 | * Returns: The containing GEM VRAM object | ||
| 55 | */ | ||
| 56 | static inline struct drm_gem_vram_object *drm_gem_vram_of_bo( | ||
| 57 | struct ttm_buffer_object *bo) | ||
| 58 | { | ||
| 59 | return container_of(bo, struct drm_gem_vram_object, bo); | ||
| 60 | } | ||
| 61 | |||
| 62 | /** | ||
| 63 | * Returns the container of type &struct drm_gem_vram_object | ||
| 64 | * for field gem. | ||
| 65 | * @gem: the GEM object | ||
| 66 | * Returns: The containing GEM VRAM object | ||
| 67 | */ | ||
| 68 | static inline struct drm_gem_vram_object *drm_gem_vram_of_gem( | ||
| 69 | struct drm_gem_object *gem) | ||
| 70 | { | ||
| 71 | return container_of(gem, struct drm_gem_vram_object, gem); | ||
| 72 | } | ||
| 73 | |||
| 74 | struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev, | ||
| 75 | struct ttm_bo_device *bdev, | ||
| 76 | size_t size, | ||
| 77 | unsigned long pg_align, | ||
| 78 | bool interruptible); | ||
| 79 | void drm_gem_vram_put(struct drm_gem_vram_object *gbo); | ||
| 80 | u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo); | ||
| 81 | s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo); | ||
| 82 | int drm_gem_vram_pin(struct drm_gem_vram_object *gbo, unsigned long pl_flag); | ||
| 83 | int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo); | ||
| 84 | void *drm_gem_vram_kmap(struct drm_gem_vram_object *gbo, bool map, | ||
| 85 | bool *is_iomem); | ||
| 86 | void drm_gem_vram_kunmap(struct drm_gem_vram_object *gbo); | ||
| 87 | |||
| 88 | int drm_gem_vram_fill_create_dumb(struct drm_file *file, | ||
| 89 | struct drm_device *dev, | ||
| 90 | struct ttm_bo_device *bdev, | ||
| 91 | unsigned long pg_align, | ||
| 92 | bool interruptible, | ||
| 93 | struct drm_mode_create_dumb *args); | ||
| 94 | |||
| 95 | /* | ||
| 96 | * Helpers for struct ttm_bo_driver | ||
| 97 | */ | ||
| 98 | |||
| 99 | void drm_gem_vram_bo_driver_evict_flags(struct ttm_buffer_object *bo, | ||
| 100 | struct ttm_placement *pl); | ||
| 101 | |||
| 102 | int drm_gem_vram_bo_driver_verify_access(struct ttm_buffer_object *bo, | ||
| 103 | struct file *filp); | ||
| 104 | |||
| 105 | extern const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs; | ||
| 106 | |||
| 107 | /* | ||
| 108 | * Helpers for struct drm_driver | ||
| 109 | */ | ||
| 110 | |||
| 111 | void drm_gem_vram_driver_gem_free_object_unlocked(struct drm_gem_object *gem); | ||
| 112 | int drm_gem_vram_driver_dumb_create(struct drm_file *file, | ||
| 113 | struct drm_device *dev, | ||
| 114 | struct drm_mode_create_dumb *args); | ||
| 115 | int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file, | ||
| 116 | struct drm_device *dev, | ||
| 117 | uint32_t handle, uint64_t *offset); | ||
| 118 | |||
| 119 | /** | ||
| 120 | * define DRM_GEM_VRAM_DRIVER - default callback functions for \ | ||
| 121 | &struct drm_driver | ||
| 122 | * | ||
| 123 | * Drivers that use VRAM MM and GEM VRAM can use this macro to initialize | ||
| 124 | * &struct drm_driver with default functions. | ||
| 125 | */ | ||
| 126 | #define DRM_GEM_VRAM_DRIVER \ | ||
| 127 | .gem_free_object_unlocked = \ | ||
| 128 | drm_gem_vram_driver_gem_free_object_unlocked, \ | ||
| 129 | .dumb_create = drm_gem_vram_driver_dumb_create, \ | ||
| 130 | .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset | ||
| 131 | |||
| 132 | /* | ||
| 133 | * PRIME helpers for struct drm_driver | ||
| 134 | */ | ||
| 135 | |||
| 136 | int drm_gem_vram_driver_gem_prime_pin(struct drm_gem_object *obj); | ||
| 137 | void drm_gem_vram_driver_gem_prime_unpin(struct drm_gem_object *obj); | ||
| 138 | void *drm_gem_vram_driver_gem_prime_vmap(struct drm_gem_object *obj); | ||
| 139 | void drm_gem_vram_driver_gem_prime_vunmap(struct drm_gem_object *obj, | ||
| 140 | void *vaddr); | ||
| 141 | int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *obj, | ||
| 142 | struct vm_area_struct *vma); | ||
| 143 | |||
| 144 | #define DRM_GEM_VRAM_DRIVER_PRIME \ | ||
| 145 | .gem_prime_export = drm_gem_prime_export, \ | ||
| 146 | .gem_prime_import = drm_gem_prime_import, \ | ||
| 147 | .gem_prime_pin = drm_gem_vram_driver_gem_prime_pin, \ | ||
| 148 | .gem_prime_unpin = drm_gem_vram_driver_gem_prime_unpin, \ | ||
| 149 | .gem_prime_vmap = drm_gem_vram_driver_gem_prime_vmap, \ | ||
| 150 | .gem_prime_vunmap = drm_gem_vram_driver_gem_prime_vunmap, \ | ||
| 151 | .gem_prime_mmap = drm_gem_vram_driver_gem_prime_mmap | ||
| 152 | |||
| 153 | #endif | ||
diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index f243408ecf26..13771a496e2b 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h | |||
| @@ -252,17 +252,44 @@ struct hdcp2_rep_stream_ready { | |||
| 252 | * host format and back | 252 | * host format and back |
| 253 | */ | 253 | */ |
| 254 | static inline | 254 | static inline |
| 255 | u32 drm_hdcp2_seq_num_to_u32(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN]) | 255 | u32 drm_hdcp_be24_to_cpu(const u8 seq_num[HDCP_2_2_SEQ_NUM_LEN]) |
| 256 | { | 256 | { |
| 257 | return (u32)(seq_num[2] | seq_num[1] << 8 | seq_num[0] << 16); | 257 | return (u32)(seq_num[2] | seq_num[1] << 8 | seq_num[0] << 16); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | static inline | 260 | static inline |
| 261 | void drm_hdcp2_u32_to_seq_num(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val) | 261 | void drm_hdcp_cpu_to_be24(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val) |
| 262 | { | 262 | { |
| 263 | seq_num[0] = val >> 16; | 263 | seq_num[0] = val >> 16; |
| 264 | seq_num[1] = val >> 8; | 264 | seq_num[1] = val >> 8; |
| 265 | seq_num[2] = val; | 265 | seq_num[2] = val; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | #define DRM_HDCP_SRM_GEN1_MAX_BYTES (5 * 1024) | ||
| 269 | #define DRM_HDCP_1_4_SRM_ID 0x8 | ||
| 270 | #define DRM_HDCP_SRM_ID_MASK (0xF << 4) | ||
| 271 | #define DRM_HDCP_1_4_VRL_LENGTH_SIZE 3 | ||
| 272 | #define DRM_HDCP_1_4_DCP_SIG_SIZE 40 | ||
| 273 | #define DRM_HDCP_2_SRM_ID 0x9 | ||
| 274 | #define DRM_HDCP_2_INDICATOR 0x1 | ||
| 275 | #define DRM_HDCP_2_INDICATOR_MASK 0xF | ||
| 276 | #define DRM_HDCP_2_VRL_LENGTH_SIZE 3 | ||
| 277 | #define DRM_HDCP_2_DCP_SIG_SIZE 384 | ||
| 278 | #define DRM_HDCP_2_NO_OF_DEV_PLUS_RESERVED_SZ 4 | ||
| 279 | #define DRM_HDCP_2_KSV_COUNT_2_LSBITS(byte) (((byte) & 0xC) >> 6) | ||
| 280 | |||
| 281 | struct hdcp_srm_header { | ||
| 282 | u8 srm_id; | ||
| 283 | u8 reserved; | ||
| 284 | __be16 srm_version; | ||
| 285 | u8 srm_gen_no; | ||
| 286 | } __packed; | ||
| 287 | |||
| 288 | struct drm_device; | ||
| 289 | struct drm_connector; | ||
| 290 | |||
| 291 | bool drm_hdcp_check_ksvs_revoked(struct drm_device *dev, | ||
| 292 | u8 *ksvs, u32 ksv_count); | ||
| 293 | int drm_connector_attach_content_protection_property( | ||
| 294 | struct drm_connector *connector); | ||
| 268 | #endif | 295 | #endif |
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h index 2182a56ac421..58dc0c04bf99 100644 --- a/include/drm/drm_legacy.h +++ b/include/drm/drm_legacy.h | |||
| @@ -1,11 +1,5 @@ | |||
| 1 | #ifndef __DRM_DRM_LEGACY_H__ | 1 | #ifndef __DRM_DRM_LEGACY_H__ |
| 2 | #define __DRM_DRM_LEGACY_H__ | 2 | #define __DRM_DRM_LEGACY_H__ |
| 3 | |||
| 4 | #include <drm/drm_auth.h> | ||
| 5 | #include <drm/drm_hashtab.h> | ||
| 6 | |||
| 7 | struct drm_device; | ||
| 8 | |||
| 9 | /* | 3 | /* |
| 10 | * Legacy driver interfaces for the Direct Rendering Manager | 4 | * Legacy driver interfaces for the Direct Rendering Manager |
| 11 | * | 5 | * |
| @@ -39,6 +33,12 @@ struct drm_device; | |||
| 39 | * OTHER DEALINGS IN THE SOFTWARE. | 33 | * OTHER DEALINGS IN THE SOFTWARE. |
| 40 | */ | 34 | */ |
| 41 | 35 | ||
| 36 | #include <drm/drm.h> | ||
| 37 | #include <drm/drm_auth.h> | ||
| 38 | #include <drm/drm_hashtab.h> | ||
| 39 | |||
| 40 | struct drm_device; | ||
| 41 | struct file; | ||
| 42 | 42 | ||
| 43 | /* | 43 | /* |
| 44 | * Legacy Support for palateontologic DRM drivers | 44 | * Legacy Support for palateontologic DRM drivers |
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 7f60e8eb269a..759d462d028b 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h | |||
| @@ -836,6 +836,19 @@ struct drm_mode_config { | |||
| 836 | */ | 836 | */ |
| 837 | struct drm_property *writeback_out_fence_ptr_property; | 837 | struct drm_property *writeback_out_fence_ptr_property; |
| 838 | 838 | ||
| 839 | /** | ||
| 840 | * @hdr_output_metadata_property: Connector property containing hdr | ||
| 841 | * metatada. This will be provided by userspace compositors based | ||
| 842 | * on HDR content | ||
| 843 | */ | ||
| 844 | struct drm_property *hdr_output_metadata_property; | ||
| 845 | |||
| 846 | /** | ||
| 847 | * @content_protection_property: DRM ENUM property for content | ||
| 848 | * protection. See drm_connector_attach_content_protection_property(). | ||
| 849 | */ | ||
| 850 | struct drm_property *content_protection_property; | ||
| 851 | |||
| 839 | /* dumb ioctl parameters */ | 852 | /* dumb ioctl parameters */ |
| 840 | uint32_t preferred_depth, prefer_shadow; | 853 | uint32_t preferred_depth, prefer_shadow; |
| 841 | 854 | ||
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index f7bbd0b0ecd1..6b18c8adfe9d 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h | |||
| @@ -680,6 +680,52 @@ struct drm_encoder_helper_funcs { | |||
| 680 | struct drm_connector *connector); | 680 | struct drm_connector *connector); |
| 681 | 681 | ||
| 682 | /** | 682 | /** |
| 683 | * @atomic_disable: | ||
| 684 | * | ||
| 685 | * This callback should be used to disable the encoder. With the atomic | ||
| 686 | * drivers it is called before this encoder's CRTC has been shut off | ||
| 687 | * using their own &drm_crtc_helper_funcs.atomic_disable hook. If that | ||
| 688 | * sequence is too simple drivers can just add their own driver private | ||
| 689 | * encoder hooks and call them from CRTC's callback by looping over all | ||
| 690 | * encoders connected to it using for_each_encoder_on_crtc(). | ||
| 691 | * | ||
| 692 | * This callback is a variant of @disable that provides the atomic state | ||
| 693 | * to the driver. If @atomic_disable is implemented, @disable is not | ||
| 694 | * called by the helpers. | ||
| 695 | * | ||
| 696 | * This hook is only used by atomic helpers. Atomic drivers don't need | ||
| 697 | * to implement it if there's no need to disable anything at the encoder | ||
| 698 | * level. To ensure that runtime PM handling (using either DPMS or the | ||
| 699 | * new "ACTIVE" property) works @atomic_disable must be the inverse of | ||
| 700 | * @atomic_enable. | ||
| 701 | */ | ||
| 702 | void (*atomic_disable)(struct drm_encoder *encoder, | ||
| 703 | struct drm_atomic_state *state); | ||
| 704 | |||
| 705 | /** | ||
| 706 | * @atomic_enable: | ||
| 707 | * | ||
| 708 | * This callback should be used to enable the encoder. It is called | ||
| 709 | * after this encoder's CRTC has been enabled using their own | ||
| 710 | * &drm_crtc_helper_funcs.atomic_enable hook. If that sequence is | ||
| 711 | * too simple drivers can just add their own driver private encoder | ||
| 712 | * hooks and call them from CRTC's callback by looping over all encoders | ||
| 713 | * connected to it using for_each_encoder_on_crtc(). | ||
| 714 | * | ||
| 715 | * This callback is a variant of @enable that provides the atomic state | ||
| 716 | * to the driver. If @atomic_enable is implemented, @enable is not | ||
| 717 | * called by the helpers. | ||
| 718 | * | ||
| 719 | * This hook is only used by atomic helpers, it is the opposite of | ||
| 720 | * @atomic_disable. Atomic drivers don't need to implement it if there's | ||
| 721 | * no need to enable anything at the encoder level. To ensure that | ||
| 722 | * runtime PM handling works @atomic_enable must be the inverse of | ||
| 723 | * @atomic_disable. | ||
| 724 | */ | ||
| 725 | void (*atomic_enable)(struct drm_encoder *encoder, | ||
| 726 | struct drm_atomic_state *state); | ||
| 727 | |||
| 728 | /** | ||
| 683 | * @disable: | 729 | * @disable: |
| 684 | * | 730 | * |
| 685 | * This callback should be used to disable the encoder. With the atomic | 731 | * This callback should be used to disable the encoder. With the atomic |
| @@ -695,6 +741,9 @@ struct drm_encoder_helper_funcs { | |||
| 695 | * handling (using either DPMS or the new "ACTIVE" property) works | 741 | * handling (using either DPMS or the new "ACTIVE" property) works |
| 696 | * @disable must be the inverse of @enable for atomic drivers. | 742 | * @disable must be the inverse of @enable for atomic drivers. |
| 697 | * | 743 | * |
| 744 | * For atomic drivers also consider @atomic_disable and save yourself | ||
| 745 | * from having to read the NOTE below! | ||
| 746 | * | ||
| 698 | * NOTE: | 747 | * NOTE: |
| 699 | * | 748 | * |
| 700 | * With legacy CRTC helpers there's a big semantic difference between | 749 | * With legacy CRTC helpers there's a big semantic difference between |
| @@ -719,11 +768,11 @@ struct drm_encoder_helper_funcs { | |||
| 719 | * hooks and call them from CRTC's callback by looping over all encoders | 768 | * hooks and call them from CRTC's callback by looping over all encoders |
| 720 | * connected to it using for_each_encoder_on_crtc(). | 769 | * connected to it using for_each_encoder_on_crtc(). |
| 721 | * | 770 | * |
| 722 | * This hook is used only by atomic helpers, for symmetry with @disable. | 771 | * This hook is only used by atomic helpers, it is the opposite of |
| 723 | * Atomic drivers don't need to implement it if there's no need to | 772 | * @disable. Atomic drivers don't need to implement it if there's no |
| 724 | * enable anything at the encoder level. To ensure that runtime PM handling | 773 | * need to enable anything at the encoder level. To ensure that |
| 725 | * (using either DPMS or the new "ACTIVE" property) works | 774 | * runtime PM handling (using either DPMS or the new "ACTIVE" property) |
| 726 | * @enable must be the inverse of @disable for atomic drivers. | 775 | * works @enable must be the inverse of @disable for atomic drivers. |
| 727 | */ | 776 | */ |
| 728 | void (*enable)(struct drm_encoder *encoder); | 777 | void (*enable)(struct drm_encoder *encoder); |
| 729 | 778 | ||
| @@ -979,7 +1028,7 @@ struct drm_connector_helper_funcs { | |||
| 979 | * deadlock. | 1028 | * deadlock. |
| 980 | */ | 1029 | */ |
| 981 | int (*atomic_check)(struct drm_connector *connector, | 1030 | int (*atomic_check)(struct drm_connector *connector, |
| 982 | struct drm_connector_state *state); | 1031 | struct drm_atomic_state *state); |
| 983 | 1032 | ||
| 984 | /** | 1033 | /** |
| 985 | * @atomic_commit: | 1034 | * @atomic_commit: |
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 6078c700d9ba..cd5903ad33f7 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h | |||
| @@ -69,7 +69,7 @@ struct drm_plane_state { | |||
| 69 | * | 69 | * |
| 70 | * Optional fence to wait for before scanning out @fb. The core atomic | 70 | * Optional fence to wait for before scanning out @fb. The core atomic |
| 71 | * code will set this when userspace is using explicit fencing. Do not | 71 | * code will set this when userspace is using explicit fencing. Do not |
| 72 | * write this directly for a driver's implicit fence, use | 72 | * write this field directly for a driver's implicit fence, use |
| 73 | * drm_atomic_set_fence_for_plane() to ensure that an explicit fence is | 73 | * drm_atomic_set_fence_for_plane() to ensure that an explicit fence is |
| 74 | * preserved. | 74 | * preserved. |
| 75 | * | 75 | * |
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 3a4247319e63..a5d6f2f3e430 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h | |||
| @@ -32,6 +32,8 @@ | |||
| 32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
| 33 | #include <linux/debugfs.h> | 33 | #include <linux/debugfs.h> |
| 34 | 34 | ||
| 35 | #include <drm/drm.h> | ||
| 36 | |||
| 35 | /** | 37 | /** |
| 36 | * DOC: print | 38 | * DOC: print |
| 37 | * | 39 | * |
diff --git a/include/drm/drm_self_refresh_helper.h b/include/drm/drm_self_refresh_helper.h new file mode 100644 index 000000000000..397a583ccca7 --- /dev/null +++ b/include/drm/drm_self_refresh_helper.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | // SPDX-License-Identifier: MIT | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2019 Google, Inc. | ||
| 4 | * | ||
| 5 | * Authors: | ||
| 6 | * Sean Paul <seanpaul@chromium.org> | ||
| 7 | */ | ||
| 8 | #ifndef DRM_SELF_REFRESH_HELPER_H_ | ||
| 9 | #define DRM_SELF_REFRESH_HELPER_H_ | ||
| 10 | |||
| 11 | struct drm_atomic_state; | ||
| 12 | struct drm_crtc; | ||
| 13 | |||
| 14 | void drm_self_refresh_helper_alter_state(struct drm_atomic_state *state); | ||
| 15 | |||
| 16 | int drm_self_refresh_helper_init(struct drm_crtc *crtc, | ||
| 17 | unsigned int entry_delay_ms); | ||
| 18 | |||
| 19 | void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc); | ||
| 20 | #endif | ||
diff --git a/include/drm/drm_vram_mm_helper.h b/include/drm/drm_vram_mm_helper.h new file mode 100644 index 000000000000..a8ffd8599b08 --- /dev/null +++ b/include/drm/drm_vram_mm_helper.h | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | |||
| 3 | #ifndef DRM_VRAM_MM_HELPER_H | ||
| 4 | #define DRM_VRAM_MM_HELPER_H | ||
| 5 | |||
| 6 | #include <drm/ttm/ttm_bo_driver.h> | ||
| 7 | |||
| 8 | struct drm_device; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * struct drm_vram_mm_funcs - Callback functions for &struct drm_vram_mm | ||
| 12 | * @evict_flags: Provides an implementation for struct \ | ||
| 13 | &ttm_bo_driver.evict_flags | ||
| 14 | * @verify_access: Provides an implementation for \ | ||
| 15 | struct &ttm_bo_driver.verify_access | ||
| 16 | * | ||
| 17 | * These callback function integrate VRAM MM with TTM buffer objects. New | ||
| 18 | * functions can be added if necessary. | ||
| 19 | */ | ||
| 20 | struct drm_vram_mm_funcs { | ||
| 21 | void (*evict_flags)(struct ttm_buffer_object *bo, | ||
| 22 | struct ttm_placement *placement); | ||
| 23 | int (*verify_access)(struct ttm_buffer_object *bo, struct file *filp); | ||
| 24 | }; | ||
| 25 | |||
| 26 | /** | ||
| 27 | * struct drm_vram_mm - An instance of VRAM MM | ||
| 28 | * @vram_base: Base address of the managed video memory | ||
| 29 | * @vram_size: Size of the managed video memory in bytes | ||
| 30 | * @bdev: The TTM BO device. | ||
| 31 | * @funcs: TTM BO functions | ||
| 32 | * | ||
| 33 | * The fields &struct drm_vram_mm.vram_base and | ||
| 34 | * &struct drm_vram_mm.vrm_size are managed by VRAM MM, but are | ||
| 35 | * available for public read access. Use the field | ||
| 36 | * &struct drm_vram_mm.bdev to access the TTM BO device. | ||
| 37 | */ | ||
| 38 | struct drm_vram_mm { | ||
| 39 | uint64_t vram_base; | ||
| 40 | size_t vram_size; | ||
| 41 | |||
| 42 | struct ttm_bo_device bdev; | ||
| 43 | |||
| 44 | const struct drm_vram_mm_funcs *funcs; | ||
| 45 | }; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * drm_vram_mm_of_bdev() - \ | ||
| 49 | Returns the container of type &struct ttm_bo_device for field bdev. | ||
| 50 | * @bdev: the TTM BO device | ||
| 51 | * | ||
| 52 | * Returns: | ||
| 53 | * The containing instance of &struct drm_vram_mm | ||
| 54 | */ | ||
| 55 | static inline struct drm_vram_mm *drm_vram_mm_of_bdev( | ||
| 56 | struct ttm_bo_device *bdev) | ||
| 57 | { | ||
| 58 | return container_of(bdev, struct drm_vram_mm, bdev); | ||
| 59 | } | ||
| 60 | |||
| 61 | int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev, | ||
| 62 | uint64_t vram_base, size_t vram_size, | ||
| 63 | const struct drm_vram_mm_funcs *funcs); | ||
| 64 | void drm_vram_mm_cleanup(struct drm_vram_mm *vmm); | ||
| 65 | |||
| 66 | int drm_vram_mm_mmap(struct file *filp, struct vm_area_struct *vma, | ||
| 67 | struct drm_vram_mm *vmm); | ||
| 68 | |||
| 69 | /* | ||
| 70 | * Helpers for integration with struct drm_device | ||
| 71 | */ | ||
| 72 | |||
| 73 | struct drm_vram_mm *drm_vram_helper_alloc_mm( | ||
| 74 | struct drm_device *dev, uint64_t vram_base, size_t vram_size, | ||
| 75 | const struct drm_vram_mm_funcs *funcs); | ||
| 76 | void drm_vram_helper_release_mm(struct drm_device *dev); | ||
| 77 | |||
| 78 | /* | ||
| 79 | * Helpers for &struct file_operations | ||
| 80 | */ | ||
| 81 | |||
| 82 | int drm_vram_mm_file_operations_mmap( | ||
| 83 | struct file *filp, struct vm_area_struct *vma); | ||
| 84 | |||
| 85 | /** | ||
| 86 | * define DRM_VRAM_MM_FILE_OPERATIONS - default callback functions for \ | ||
| 87 | &struct file_operations | ||
| 88 | * | ||
| 89 | * Drivers that use VRAM MM can use this macro to initialize | ||
| 90 | * &struct file_operations with default functions. | ||
| 91 | */ | ||
| 92 | #define DRM_VRAM_MM_FILE_OPERATIONS \ | ||
| 93 | .llseek = no_llseek, \ | ||
| 94 | .read = drm_read, \ | ||
| 95 | .poll = drm_poll, \ | ||
| 96 | .unlocked_ioctl = drm_ioctl, \ | ||
| 97 | .compat_ioctl = drm_compat_ioctl, \ | ||
| 98 | .mmap = drm_vram_mm_file_operations_mmap, \ | ||
| 99 | .open = drm_open, \ | ||
| 100 | .release = drm_release \ | ||
| 101 | |||
| 102 | #endif | ||
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 0daca4d8dad9..57b4121c750a 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h | |||
| @@ -167,9 +167,6 @@ struct drm_sched_fence *to_drm_sched_fence(struct dma_fence *f); | |||
| 167 | * @sched: the scheduler instance on which this job is scheduled. | 167 | * @sched: the scheduler instance on which this job is scheduled. |
| 168 | * @s_fence: contains the fences for the scheduling of job. | 168 | * @s_fence: contains the fences for the scheduling of job. |
| 169 | * @finish_cb: the callback for the finished fence. | 169 | * @finish_cb: the callback for the finished fence. |
| 170 | * @finish_work: schedules the function @drm_sched_job_finish once the job has | ||
| 171 | * finished to remove the job from the | ||
| 172 | * @drm_gpu_scheduler.ring_mirror_list. | ||
| 173 | * @node: used to append this struct to the @drm_gpu_scheduler.ring_mirror_list. | 170 | * @node: used to append this struct to the @drm_gpu_scheduler.ring_mirror_list. |
| 174 | * @id: a unique id assigned to each job scheduled on the scheduler. | 171 | * @id: a unique id assigned to each job scheduled on the scheduler. |
| 175 | * @karma: increment on every hang caused by this job. If this exceeds the hang | 172 | * @karma: increment on every hang caused by this job. If this exceeds the hang |
| @@ -188,7 +185,6 @@ struct drm_sched_job { | |||
| 188 | struct drm_gpu_scheduler *sched; | 185 | struct drm_gpu_scheduler *sched; |
| 189 | struct drm_sched_fence *s_fence; | 186 | struct drm_sched_fence *s_fence; |
| 190 | struct dma_fence_cb finish_cb; | 187 | struct dma_fence_cb finish_cb; |
| 191 | struct work_struct finish_work; | ||
| 192 | struct list_head node; | 188 | struct list_head node; |
| 193 | uint64_t id; | 189 | uint64_t id; |
| 194 | atomic_t karma; | 190 | atomic_t karma; |
| @@ -263,6 +259,7 @@ struct drm_sched_backend_ops { | |||
| 263 | * guilty and it will be considered for scheduling further. | 259 | * guilty and it will be considered for scheduling further. |
| 264 | * @num_jobs: the number of jobs in queue in the scheduler | 260 | * @num_jobs: the number of jobs in queue in the scheduler |
| 265 | * @ready: marks if the underlying HW is ready to work | 261 | * @ready: marks if the underlying HW is ready to work |
| 262 | * @free_guilty: A hit to time out handler to free the guilty job. | ||
| 266 | * | 263 | * |
| 267 | * One scheduler is implemented for each hardware ring. | 264 | * One scheduler is implemented for each hardware ring. |
| 268 | */ | 265 | */ |
| @@ -283,6 +280,7 @@ struct drm_gpu_scheduler { | |||
| 283 | int hang_limit; | 280 | int hang_limit; |
| 284 | atomic_t num_jobs; | 281 | atomic_t num_jobs; |
| 285 | bool ready; | 282 | bool ready; |
| 283 | bool free_guilty; | ||
| 286 | }; | 284 | }; |
| 287 | 285 | ||
| 288 | int drm_sched_init(struct drm_gpu_scheduler *sched, | 286 | int drm_sched_init(struct drm_gpu_scheduler *sched, |
| @@ -296,7 +294,7 @@ int drm_sched_job_init(struct drm_sched_job *job, | |||
| 296 | void *owner); | 294 | void *owner); |
| 297 | void drm_sched_job_cleanup(struct drm_sched_job *job); | 295 | void drm_sched_job_cleanup(struct drm_sched_job *job); |
| 298 | void drm_sched_wakeup(struct drm_gpu_scheduler *sched); | 296 | void drm_sched_wakeup(struct drm_gpu_scheduler *sched); |
| 299 | void drm_sched_stop(struct drm_gpu_scheduler *sched); | 297 | void drm_sched_stop(struct drm_gpu_scheduler *sched, struct drm_sched_job *bad); |
| 300 | void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery); | 298 | void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery); |
| 301 | void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched); | 299 | void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched); |
| 302 | void drm_sched_increase_karma(struct drm_sched_job *bad); | 300 | void drm_sched_increase_karma(struct drm_sched_job *bad); |
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h index 6477da22af28..6d60ea68c171 100644 --- a/include/drm/i915_pciids.h +++ b/include/drm/i915_pciids.h | |||
| @@ -559,7 +559,6 @@ | |||
| 559 | #define INTEL_ICL_PORT_F_IDS(info) \ | 559 | #define INTEL_ICL_PORT_F_IDS(info) \ |
| 560 | INTEL_VGA_DEVICE(0x8A50, info), \ | 560 | INTEL_VGA_DEVICE(0x8A50, info), \ |
| 561 | INTEL_VGA_DEVICE(0x8A5C, info), \ | 561 | INTEL_VGA_DEVICE(0x8A5C, info), \ |
| 562 | INTEL_VGA_DEVICE(0x8A5D, info), \ | ||
| 563 | INTEL_VGA_DEVICE(0x8A59, info), \ | 562 | INTEL_VGA_DEVICE(0x8A59, info), \ |
| 564 | INTEL_VGA_DEVICE(0x8A58, info), \ | 563 | INTEL_VGA_DEVICE(0x8A58, info), \ |
| 565 | INTEL_VGA_DEVICE(0x8A52, info), \ | 564 | INTEL_VGA_DEVICE(0x8A52, info), \ |
| @@ -573,7 +572,8 @@ | |||
| 573 | 572 | ||
| 574 | #define INTEL_ICL_11_IDS(info) \ | 573 | #define INTEL_ICL_11_IDS(info) \ |
| 575 | INTEL_ICL_PORT_F_IDS(info), \ | 574 | INTEL_ICL_PORT_F_IDS(info), \ |
| 576 | INTEL_VGA_DEVICE(0x8A51, info) | 575 | INTEL_VGA_DEVICE(0x8A51, info), \ |
| 576 | INTEL_VGA_DEVICE(0x8A5D, info) | ||
| 577 | 577 | ||
| 578 | /* EHL */ | 578 | /* EHL */ |
| 579 | #define INTEL_EHL_IDS(info) \ | 579 | #define INTEL_EHL_IDS(info) \ |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 129dabbc002d..c9b8ba492f24 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -767,11 +767,12 @@ static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo, | |||
| 767 | */ | 767 | */ |
| 768 | static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) | 768 | static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) |
| 769 | { | 769 | { |
| 770 | if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { | 770 | spin_lock(&bo->bdev->glob->lru_lock); |
| 771 | spin_lock(&bo->bdev->glob->lru_lock); | 771 | if (list_empty(&bo->lru)) |
| 772 | ttm_bo_add_to_lru(bo); | 772 | ttm_bo_add_to_lru(bo); |
| 773 | spin_unlock(&bo->bdev->glob->lru_lock); | 773 | else |
| 774 | } | 774 | ttm_bo_move_to_lru_tail(bo, NULL); |
| 775 | spin_unlock(&bo->bdev->glob->lru_lock); | ||
| 775 | reservation_object_unlock(bo->resv); | 776 | reservation_object_unlock(bo->resv); |
| 776 | } | 777 | } |
| 777 | 778 | ||
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h index 621615fa7728..7e46cc678e7e 100644 --- a/include/drm/ttm/ttm_execbuf_util.h +++ b/include/drm/ttm/ttm_execbuf_util.h | |||
| @@ -70,6 +70,7 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, | |||
| 70 | * @list: thread private list of ttm_validate_buffer structs. | 70 | * @list: thread private list of ttm_validate_buffer structs. |
| 71 | * @intr: should the wait be interruptible | 71 | * @intr: should the wait be interruptible |
| 72 | * @dups: [out] optional list of duplicates. | 72 | * @dups: [out] optional list of duplicates. |
| 73 | * @del_lru: true if BOs should be removed from the LRU. | ||
| 73 | * | 74 | * |
| 74 | * Tries to reserve bos pointed to by the list entries for validation. | 75 | * Tries to reserve bos pointed to by the list entries for validation. |
| 75 | * If the function returns 0, all buffers are marked as "unfenced", | 76 | * If the function returns 0, all buffers are marked as "unfenced", |
| @@ -98,7 +99,7 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, | |||
| 98 | 99 | ||
| 99 | extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, | 100 | extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, |
| 100 | struct list_head *list, bool intr, | 101 | struct list_head *list, bool intr, |
| 101 | struct list_head *dups); | 102 | struct list_head *dups, bool del_lru); |
| 102 | 103 | ||
| 103 | /** | 104 | /** |
| 104 | * function ttm_eu_fence_buffer_objects. | 105 | * function ttm_eu_fence_buffer_objects. |
diff --git a/include/dt-bindings/net/ti-dp83867.h b/include/dt-bindings/net/ti-dp83867.h index 3b48847cd83b..6fc4b445d3a1 100644 --- a/include/dt-bindings/net/ti-dp83867.h +++ b/include/dt-bindings/net/ti-dp83867.h | |||
| @@ -48,4 +48,6 @@ | |||
| 48 | #define DP83867_CLK_O_SEL_CHN_C_TCLK 0xA | 48 | #define DP83867_CLK_O_SEL_CHN_C_TCLK 0xA |
| 49 | #define DP83867_CLK_O_SEL_CHN_D_TCLK 0xB | 49 | #define DP83867_CLK_O_SEL_CHN_D_TCLK 0xB |
| 50 | #define DP83867_CLK_O_SEL_REF_CLK 0xC | 50 | #define DP83867_CLK_O_SEL_REF_CLK 0xC |
| 51 | /* Special flag to indicate clock should be off */ | ||
| 52 | #define DP83867_CLK_O_SEL_OFF 0xFFFFFFFF | ||
| 51 | #endif | 53 | #endif |
diff --git a/include/dt-bindings/sound/madera.h b/include/dt-bindings/sound/madera.h new file mode 100644 index 000000000000..d0096d5eb0da --- /dev/null +++ b/include/dt-bindings/sound/madera.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | /* | ||
| 3 | * Device Tree defines for Madera codecs | ||
| 4 | * | ||
| 5 | * Copyright (C) 2016-2017 Cirrus Logic, Inc. and | ||
| 6 | * Cirrus Logic International Semiconductor Ltd. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef DT_BINDINGS_SOUND_MADERA_H | ||
| 10 | #define DT_BINDINGS_SOUND_MADERA_H | ||
| 11 | |||
| 12 | #define MADERA_INMODE_DIFF 0 | ||
| 13 | #define MADERA_INMODE_SE 1 | ||
| 14 | #define MADERA_INMODE_DMIC 2 | ||
| 15 | |||
| 16 | #define MADERA_DMIC_REF_MICVDD 0 | ||
| 17 | #define MADERA_DMIC_REF_MICBIAS1 1 | ||
| 18 | #define MADERA_DMIC_REF_MICBIAS2 2 | ||
| 19 | #define MADERA_DMIC_REF_MICBIAS3 3 | ||
| 20 | |||
| 21 | #define CS47L35_DMIC_REF_MICBIAS1B 1 | ||
| 22 | #define CS47L35_DMIC_REF_MICBIAS2A 2 | ||
| 23 | #define CS47L35_DMIC_REF_MICBIAS2B 3 | ||
| 24 | |||
| 25 | #endif | ||
diff --git a/include/dt-bindings/sound/meson-g12a-tohdmitx.h b/include/dt-bindings/sound/meson-g12a-tohdmitx.h new file mode 100644 index 000000000000..c5e1f48d30d0 --- /dev/null +++ b/include/dt-bindings/sound/meson-g12a-tohdmitx.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __DT_MESON_G12A_TOHDMITX_H | ||
| 3 | #define __DT_MESON_G12A_TOHDMITX_H | ||
| 4 | |||
| 5 | #define TOHDMITX_I2S_IN_A 0 | ||
| 6 | #define TOHDMITX_I2S_IN_B 1 | ||
| 7 | #define TOHDMITX_I2S_IN_C 2 | ||
| 8 | #define TOHDMITX_I2S_OUT 3 | ||
| 9 | #define TOHDMITX_SPDIF_IN_A 4 | ||
| 10 | #define TOHDMITX_SPDIF_IN_B 5 | ||
| 11 | #define TOHDMITX_SPDIF_OUT 6 | ||
| 12 | |||
| 13 | #endif /* __DT_MESON_G12A_TOHDMITX_H */ | ||
diff --git a/include/keys/request_key_auth-type.h b/include/keys/request_key_auth-type.h index 20485ca481f4..36b89a933310 100644 --- a/include/keys/request_key_auth-type.h +++ b/include/keys/request_key_auth-type.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | * Authorisation record for request_key(). | 14 | * Authorisation record for request_key(). |
| 15 | */ | 15 | */ |
| 16 | struct request_key_auth { | 16 | struct request_key_auth { |
| 17 | struct rcu_head rcu; | ||
| 17 | struct key *target_key; | 18 | struct key *target_key; |
| 18 | struct key *dest_keyring; | 19 | struct key *dest_keyring; |
| 19 | const struct cred *cred; | 20 | const struct cred *cred; |
diff --git a/include/kvm/arm_pmu.h b/include/kvm/arm_pmu.h index 84a9db156be7..16c769a7f979 100644 --- a/include/kvm/arm_pmu.h +++ b/include/kvm/arm_pmu.h | |||
| @@ -11,18 +11,19 @@ | |||
| 11 | #include <asm/perf_event.h> | 11 | #include <asm/perf_event.h> |
| 12 | 12 | ||
| 13 | #define ARMV8_PMU_CYCLE_IDX (ARMV8_PMU_MAX_COUNTERS - 1) | 13 | #define ARMV8_PMU_CYCLE_IDX (ARMV8_PMU_MAX_COUNTERS - 1) |
| 14 | #define ARMV8_PMU_MAX_COUNTER_PAIRS ((ARMV8_PMU_MAX_COUNTERS + 1) >> 1) | ||
| 14 | 15 | ||
| 15 | #ifdef CONFIG_KVM_ARM_PMU | 16 | #ifdef CONFIG_KVM_ARM_PMU |
| 16 | 17 | ||
| 17 | struct kvm_pmc { | 18 | struct kvm_pmc { |
| 18 | u8 idx; /* index into the pmu->pmc array */ | 19 | u8 idx; /* index into the pmu->pmc array */ |
| 19 | struct perf_event *perf_event; | 20 | struct perf_event *perf_event; |
| 20 | u64 bitmask; | ||
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | struct kvm_pmu { | 23 | struct kvm_pmu { |
| 24 | int irq_num; | 24 | int irq_num; |
| 25 | struct kvm_pmc pmc[ARMV8_PMU_MAX_COUNTERS]; | 25 | struct kvm_pmc pmc[ARMV8_PMU_MAX_COUNTERS]; |
| 26 | DECLARE_BITMAP(chained, ARMV8_PMU_MAX_COUNTER_PAIRS); | ||
| 26 | bool ready; | 27 | bool ready; |
| 27 | bool created; | 28 | bool created; |
| 28 | bool irq_level; | 29 | bool irq_level; |
| @@ -35,8 +36,8 @@ void kvm_pmu_set_counter_value(struct kvm_vcpu *vcpu, u64 select_idx, u64 val); | |||
| 35 | u64 kvm_pmu_valid_counter_mask(struct kvm_vcpu *vcpu); | 36 | u64 kvm_pmu_valid_counter_mask(struct kvm_vcpu *vcpu); |
| 36 | void kvm_pmu_vcpu_reset(struct kvm_vcpu *vcpu); | 37 | void kvm_pmu_vcpu_reset(struct kvm_vcpu *vcpu); |
| 37 | void kvm_pmu_vcpu_destroy(struct kvm_vcpu *vcpu); | 38 | void kvm_pmu_vcpu_destroy(struct kvm_vcpu *vcpu); |
| 38 | void kvm_pmu_disable_counter(struct kvm_vcpu *vcpu, u64 val); | 39 | void kvm_pmu_disable_counter_mask(struct kvm_vcpu *vcpu, u64 val); |
| 39 | void kvm_pmu_enable_counter(struct kvm_vcpu *vcpu, u64 val); | 40 | void kvm_pmu_enable_counter_mask(struct kvm_vcpu *vcpu, u64 val); |
| 40 | void kvm_pmu_flush_hwstate(struct kvm_vcpu *vcpu); | 41 | void kvm_pmu_flush_hwstate(struct kvm_vcpu *vcpu); |
| 41 | void kvm_pmu_sync_hwstate(struct kvm_vcpu *vcpu); | 42 | void kvm_pmu_sync_hwstate(struct kvm_vcpu *vcpu); |
| 42 | bool kvm_pmu_should_notify_user(struct kvm_vcpu *vcpu); | 43 | bool kvm_pmu_should_notify_user(struct kvm_vcpu *vcpu); |
| @@ -72,8 +73,8 @@ static inline u64 kvm_pmu_valid_counter_mask(struct kvm_vcpu *vcpu) | |||
| 72 | } | 73 | } |
| 73 | static inline void kvm_pmu_vcpu_reset(struct kvm_vcpu *vcpu) {} | 74 | static inline void kvm_pmu_vcpu_reset(struct kvm_vcpu *vcpu) {} |
| 74 | static inline void kvm_pmu_vcpu_destroy(struct kvm_vcpu *vcpu) {} | 75 | static inline void kvm_pmu_vcpu_destroy(struct kvm_vcpu *vcpu) {} |
| 75 | static inline void kvm_pmu_disable_counter(struct kvm_vcpu *vcpu, u64 val) {} | 76 | static inline void kvm_pmu_disable_counter_mask(struct kvm_vcpu *vcpu, u64 val) {} |
| 76 | static inline void kvm_pmu_enable_counter(struct kvm_vcpu *vcpu, u64 val) {} | 77 | static inline void kvm_pmu_enable_counter_mask(struct kvm_vcpu *vcpu, u64 val) {} |
| 77 | static inline void kvm_pmu_flush_hwstate(struct kvm_vcpu *vcpu) {} | 78 | static inline void kvm_pmu_flush_hwstate(struct kvm_vcpu *vcpu) {} |
| 78 | static inline void kvm_pmu_sync_hwstate(struct kvm_vcpu *vcpu) {} | 79 | static inline void kvm_pmu_sync_hwstate(struct kvm_vcpu *vcpu) {} |
| 79 | static inline bool kvm_pmu_should_notify_user(struct kvm_vcpu *vcpu) | 80 | static inline bool kvm_pmu_should_notify_user(struct kvm_vcpu *vcpu) |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d315d86844e4..a95cce5e82e7 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
| 12 | #include <linux/ioport.h> /* for struct resource */ | 12 | #include <linux/ioport.h> /* for struct resource */ |
| 13 | #include <linux/irqdomain.h> | ||
| 13 | #include <linux/resource_ext.h> | 14 | #include <linux/resource_ext.h> |
| 14 | #include <linux/device.h> | 15 | #include <linux/device.h> |
| 15 | #include <linux/property.h> | 16 | #include <linux/property.h> |
| @@ -314,6 +315,12 @@ int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); | |||
| 314 | void acpi_set_irq_model(enum acpi_irq_model_id model, | 315 | void acpi_set_irq_model(enum acpi_irq_model_id model, |
| 315 | struct fwnode_handle *fwnode); | 316 | struct fwnode_handle *fwnode); |
| 316 | 317 | ||
| 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 | |||
| 317 | #ifdef CONFIG_X86_IO_APIC | 324 | #ifdef CONFIG_X86_IO_APIC |
| 318 | extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); | 325 | extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); |
| 319 | #else | 326 | #else |
| @@ -367,6 +374,7 @@ extern acpi_status wmi_install_notify_handler(const char *guid, | |||
| 367 | extern acpi_status wmi_remove_notify_handler(const char *guid); | 374 | extern acpi_status wmi_remove_notify_handler(const char *guid); |
| 368 | extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out); | 375 | extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out); |
| 369 | extern bool wmi_has_guid(const char *guid); | 376 | extern bool wmi_has_guid(const char *guid); |
| 377 | extern char *wmi_get_acpi_device_uid(const char *guid); | ||
| 370 | 378 | ||
| 371 | #endif /* CONFIG_ACPI_WMI */ | 379 | #endif /* CONFIG_ACPI_WMI */ |
| 372 | 380 | ||
| @@ -913,31 +921,21 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) | |||
| 913 | #endif | 921 | #endif |
| 914 | 922 | ||
| 915 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP) | 923 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP) |
| 916 | int acpi_dev_suspend_late(struct device *dev); | ||
| 917 | int acpi_subsys_prepare(struct device *dev); | 924 | int acpi_subsys_prepare(struct device *dev); |
| 918 | void acpi_subsys_complete(struct device *dev); | 925 | void acpi_subsys_complete(struct device *dev); |
| 919 | int acpi_subsys_suspend_late(struct device *dev); | 926 | int acpi_subsys_suspend_late(struct device *dev); |
| 920 | int acpi_subsys_suspend_noirq(struct device *dev); | 927 | 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); | ||
| 923 | int acpi_subsys_suspend(struct device *dev); | 928 | int acpi_subsys_suspend(struct device *dev); |
| 924 | int acpi_subsys_freeze(struct device *dev); | 929 | int acpi_subsys_freeze(struct device *dev); |
| 925 | int acpi_subsys_freeze_late(struct device *dev); | 930 | int acpi_subsys_poweroff(struct device *dev); |
| 926 | int acpi_subsys_freeze_noirq(struct device *dev); | ||
| 927 | int acpi_subsys_thaw_noirq(struct device *dev); | ||
| 928 | #else | 931 | #else |
| 929 | static inline int acpi_dev_resume_early(struct device *dev) { return 0; } | ||
| 930 | static inline int acpi_subsys_prepare(struct device *dev) { return 0; } | 932 | static inline int acpi_subsys_prepare(struct device *dev) { return 0; } |
| 931 | static inline void acpi_subsys_complete(struct device *dev) {} | 933 | static inline void acpi_subsys_complete(struct device *dev) {} |
| 932 | static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } | 934 | static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } |
| 933 | static inline int acpi_subsys_suspend_noirq(struct device *dev) { return 0; } | 935 | 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; } | ||
| 936 | static inline int acpi_subsys_suspend(struct device *dev) { return 0; } | 936 | static inline int acpi_subsys_suspend(struct device *dev) { return 0; } |
| 937 | static inline int acpi_subsys_freeze(struct device *dev) { return 0; } | 937 | static inline int acpi_subsys_freeze(struct device *dev) { return 0; } |
| 938 | static inline int acpi_subsys_freeze_late(struct device *dev) { return 0; } | 938 | static inline int acpi_subsys_poweroff(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 | #endif | 939 | #endif |
| 942 | 940 | ||
| 943 | #ifdef CONFIG_ACPI | 941 | #ifdef CONFIG_ACPI |
| @@ -1303,6 +1301,7 @@ static inline int lpit_read_residency_count_address(u64 *address) | |||
| 1303 | #ifdef CONFIG_ACPI_PPTT | 1301 | #ifdef CONFIG_ACPI_PPTT |
| 1304 | int find_acpi_cpu_topology(unsigned int cpu, int level); | 1302 | int find_acpi_cpu_topology(unsigned int cpu, int level); |
| 1305 | int find_acpi_cpu_topology_package(unsigned int cpu); | 1303 | int find_acpi_cpu_topology_package(unsigned int cpu); |
| 1304 | int find_acpi_cpu_topology_hetero_id(unsigned int cpu); | ||
| 1306 | int find_acpi_cpu_cache_topology(unsigned int cpu, int level); | 1305 | int find_acpi_cpu_cache_topology(unsigned int cpu, int level); |
| 1307 | #else | 1306 | #else |
| 1308 | static inline int find_acpi_cpu_topology(unsigned int cpu, int level) | 1307 | static inline int find_acpi_cpu_topology(unsigned int cpu, int level) |
| @@ -1313,6 +1312,10 @@ static inline int find_acpi_cpu_topology_package(unsigned int cpu) | |||
| 1313 | { | 1312 | { |
| 1314 | return -EINVAL; | 1313 | return -EINVAL; |
| 1315 | } | 1314 | } |
| 1315 | static inline int find_acpi_cpu_topology_hetero_id(unsigned int cpu) | ||
| 1316 | { | ||
| 1317 | return -EINVAL; | ||
| 1318 | } | ||
| 1316 | static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) | 1319 | static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) |
| 1317 | { | 1320 | { |
| 1318 | return -EINVAL; | 1321 | return -EINVAL; |
diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h index d9bdc1a7f4e7..1cfe05ea1d89 100644 --- a/include/linux/arch_topology.h +++ b/include/linux/arch_topology.h | |||
| @@ -18,7 +18,7 @@ DECLARE_PER_CPU(unsigned long, cpu_scale); | |||
| 18 | 18 | ||
| 19 | struct sched_domain; | 19 | struct sched_domain; |
| 20 | static inline | 20 | static inline |
| 21 | unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu) | 21 | unsigned long topology_get_cpu_scale(int cpu) |
| 22 | { | 22 | { |
| 23 | return per_cpu(cpu_scale, cpu); | 23 | return per_cpu(cpu_scale, cpu); |
| 24 | } | 24 | } |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 3a4f2415bb7c..97d0925454df 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -182,6 +182,9 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk) | |||
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | extern u32 audit_enabled; | 184 | extern u32 audit_enabled; |
| 185 | |||
| 186 | extern int audit_signal_info(int sig, struct task_struct *t); | ||
| 187 | |||
| 185 | #else /* CONFIG_AUDIT */ | 188 | #else /* CONFIG_AUDIT */ |
| 186 | static inline __printf(4, 5) | 189 | static inline __printf(4, 5) |
| 187 | void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type, | 190 | 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) | |||
| 235 | } | 238 | } |
| 236 | 239 | ||
| 237 | #define audit_enabled AUDIT_OFF | 240 | #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 | |||
| 238 | #endif /* CONFIG_AUDIT */ | 247 | #endif /* CONFIG_AUDIT */ |
| 239 | 248 | ||
| 240 | #ifdef CONFIG_AUDIT_COMPAT_GENERIC | 249 | #ifdef CONFIG_AUDIT_COMPAT_GENERIC |
diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h index 191621ff7594..ca956b672ac0 100644 --- a/include/linux/avf/virtchnl.h +++ b/include/linux/avf/virtchnl.h | |||
| @@ -61,12 +61,14 @@ enum virtchnl_status_code { | |||
| 61 | #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM | 61 | #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM |
| 62 | #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED | 62 | #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED |
| 63 | 63 | ||
| 64 | #define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT 0x0 | ||
| 64 | #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1 | 65 | #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1 |
| 65 | #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2 | 66 | #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2 |
| 66 | #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3 | 67 | #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3 |
| 67 | #define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4 | 68 | #define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4 |
| 68 | #define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5 | 69 | #define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5 |
| 69 | #define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6 | 70 | #define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6 |
| 71 | #define VIRTCHNL_LINK_SPEED_5GB_SHIFT 0x7 | ||
| 70 | 72 | ||
| 71 | enum virtchnl_link_speed { | 73 | enum virtchnl_link_speed { |
| 72 | VIRTCHNL_LINK_SPEED_UNKNOWN = 0, | 74 | VIRTCHNL_LINK_SPEED_UNKNOWN = 0, |
| @@ -76,6 +78,8 @@ enum virtchnl_link_speed { | |||
| 76 | VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT), | 78 | VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT), |
| 77 | VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT), | 79 | VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT), |
| 78 | VIRTCHNL_LINK_SPEED_25GB = BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT), | 80 | 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), | ||
| 79 | }; | 83 | }; |
| 80 | 84 | ||
| 81 | /* for hsplit_0 field of Rx HMC context */ | 85 | /* for hsplit_0 field of Rx HMC context */ |
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 07e02d6df5ad..6a1a8a314d85 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h | |||
| @@ -203,7 +203,6 @@ struct backing_dev_info { | |||
| 203 | 203 | ||
| 204 | #ifdef CONFIG_DEBUG_FS | 204 | #ifdef CONFIG_DEBUG_FS |
| 205 | struct dentry *debug_dir; | 205 | struct dentry *debug_dir; |
| 206 | struct dentry *debug_stats; | ||
| 207 | #endif | 206 | #endif |
| 208 | }; | 207 | }; |
| 209 | 208 | ||
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index f9b029180241..35b31d176f74 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
| @@ -48,6 +48,7 @@ extern spinlock_t bdi_lock; | |||
| 48 | extern struct list_head bdi_list; | 48 | extern struct list_head bdi_list; |
| 49 | 49 | ||
| 50 | extern struct workqueue_struct *bdi_wq; | 50 | extern struct workqueue_struct *bdi_wq; |
| 51 | extern struct workqueue_struct *bdi_async_bio_wq; | ||
| 51 | 52 | ||
| 52 | static inline bool wb_has_dirty_io(struct bdi_writeback *wb) | 53 | static inline bool wb_has_dirty_io(struct bdi_writeback *wb) |
| 53 | { | 54 | { |
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h index f31521dcb09a..338aa27e4773 100644 --- a/include/linux/balloon_compaction.h +++ b/include/linux/balloon_compaction.h | |||
| @@ -64,6 +64,10 @@ extern struct page *balloon_page_alloc(void); | |||
| 64 | extern void balloon_page_enqueue(struct balloon_dev_info *b_dev_info, | 64 | extern void balloon_page_enqueue(struct balloon_dev_info *b_dev_info, |
| 65 | struct page *page); | 65 | struct page *page); |
| 66 | extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info); | 66 | 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); | ||
| 67 | 71 | ||
| 68 | static inline void balloon_devinfo_init(struct balloon_dev_info *balloon) | 72 | static inline void balloon_devinfo_init(struct balloon_dev_info *balloon) |
| 69 | { | 73 | { |
diff --git a/include/linux/bio.h b/include/linux/bio.h index f87abaa898f0..3cdb84cdc488 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -102,9 +102,23 @@ static inline void *bio_data(struct bio *bio) | |||
| 102 | return NULL; | 102 | return NULL; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 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) | ||
| 106 | { | 114 | { |
| 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; | ||
| 108 | } | 122 | } |
| 109 | 123 | ||
| 110 | static inline bool bio_next_segment(const struct bio *bio, | 124 | static inline bool bio_next_segment(const struct bio *bio, |
| @@ -408,7 +422,6 @@ static inline void bio_wouldblock_error(struct bio *bio) | |||
| 408 | } | 422 | } |
| 409 | 423 | ||
| 410 | struct request_queue; | 424 | struct request_queue; |
| 411 | extern int bio_phys_segments(struct request_queue *, struct bio *); | ||
| 412 | 425 | ||
| 413 | extern int submit_bio_wait(struct bio *bio); | 426 | extern int submit_bio_wait(struct bio *bio); |
| 414 | extern void bio_advance(struct bio *, unsigned); | 427 | extern void bio_advance(struct bio *, unsigned); |
| @@ -427,6 +440,7 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page, | |||
| 427 | void __bio_add_page(struct bio *bio, struct page *page, | 440 | void __bio_add_page(struct bio *bio, struct page *page, |
| 428 | unsigned int len, unsigned int off); | 441 | unsigned int len, unsigned int off); |
| 429 | int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter); | 442 | int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter); |
| 443 | void bio_release_pages(struct bio *bio, bool mark_dirty); | ||
| 430 | struct rq_map_data; | 444 | struct rq_map_data; |
| 431 | extern struct bio *bio_map_user_iov(struct request_queue *, | 445 | extern struct bio *bio_map_user_iov(struct request_queue *, |
| 432 | struct iov_iter *, gfp_t); | 446 | struct iov_iter *, gfp_t); |
| @@ -444,17 +458,6 @@ void generic_end_io_acct(struct request_queue *q, int op, | |||
| 444 | struct hd_struct *part, | 458 | struct hd_struct *part, |
| 445 | unsigned long start_time); | 459 | unsigned long start_time); |
| 446 | 460 | ||
| 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 | |||
| 458 | extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, | 461 | extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, |
| 459 | struct bio *src, struct bvec_iter *src_iter); | 462 | struct bio *src, struct bvec_iter *src_iter); |
| 460 | extern void bio_copy_data(struct bio *dst, struct bio *src); | 463 | extern void bio_copy_data(struct bio *dst, struct bio *src); |
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 76c61318fda5..689a58231288 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h | |||
| @@ -63,19 +63,17 @@ struct blkcg { | |||
| 63 | 63 | ||
| 64 | /* | 64 | /* |
| 65 | * blkg_[rw]stat->aux_cnt is excluded for local stats but included for | 65 | * 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, | 66 | * recursive. Used to carry stats of dead children. |
| 67 | * to carry result values from read and sum operations. | ||
| 68 | */ | 67 | */ |
| 69 | struct blkg_stat { | ||
| 70 | struct percpu_counter cpu_cnt; | ||
| 71 | atomic64_t aux_cnt; | ||
| 72 | }; | ||
| 73 | |||
| 74 | struct blkg_rwstat { | 68 | struct blkg_rwstat { |
| 75 | struct percpu_counter cpu_cnt[BLKG_RWSTAT_NR]; | 69 | struct percpu_counter cpu_cnt[BLKG_RWSTAT_NR]; |
| 76 | atomic64_t aux_cnt[BLKG_RWSTAT_NR]; | 70 | atomic64_t aux_cnt[BLKG_RWSTAT_NR]; |
| 77 | }; | 71 | }; |
| 78 | 72 | ||
| 73 | struct blkg_rwstat_sample { | ||
| 74 | u64 cnt[BLKG_RWSTAT_NR]; | ||
| 75 | }; | ||
| 76 | |||
| 79 | /* | 77 | /* |
| 80 | * A blkcg_gq (blkg) is association between a block cgroup (blkcg) and a | 78 | * A blkcg_gq (blkg) is association between a block cgroup (blkcg) and a |
| 81 | * request_queue (q). This is used by blkcg policies which need to track | 79 | * request_queue (q). This is used by blkcg policies which need to track |
| @@ -134,13 +132,17 @@ struct blkcg_gq { | |||
| 134 | 132 | ||
| 135 | struct blkg_policy_data *pd[BLKCG_MAX_POLS]; | 133 | struct blkg_policy_data *pd[BLKCG_MAX_POLS]; |
| 136 | 134 | ||
| 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; | ||
| 138 | 138 | ||
| 139 | atomic_t use_delay; | 139 | atomic_t use_delay; |
| 140 | atomic64_t delay_nsec; | 140 | atomic64_t delay_nsec; |
| 141 | atomic64_t delay_start; | 141 | atomic64_t delay_start; |
| 142 | u64 last_delay; | 142 | u64 last_delay; |
| 143 | int last_use; | 143 | int last_use; |
| 144 | |||
| 145 | struct rcu_head rcu_head; | ||
| 144 | }; | 146 | }; |
| 145 | 147 | ||
| 146 | typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp); | 148 | typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp); |
| @@ -198,6 +200,13 @@ int blkcg_activate_policy(struct request_queue *q, | |||
| 198 | void blkcg_deactivate_policy(struct request_queue *q, | 200 | void blkcg_deactivate_policy(struct request_queue *q, |
| 199 | const struct blkcg_policy *pol); | 201 | const struct blkcg_policy *pol); |
| 200 | 202 | ||
| 203 | static inline u64 blkg_rwstat_read_counter(struct blkg_rwstat *rwstat, | ||
| 204 | unsigned int idx) | ||
| 205 | { | ||
| 206 | return atomic64_read(&rwstat->aux_cnt[idx]) + | ||
| 207 | percpu_counter_sum_positive(&rwstat->cpu_cnt[idx]); | ||
| 208 | } | ||
| 209 | |||
| 201 | const char *blkg_dev_name(struct blkcg_gq *blkg); | 210 | const char *blkg_dev_name(struct blkcg_gq *blkg); |
| 202 | void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, | 211 | void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, |
| 203 | u64 (*prfill)(struct seq_file *, | 212 | u64 (*prfill)(struct seq_file *, |
| @@ -206,8 +215,7 @@ void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, | |||
| 206 | bool show_total); | 215 | bool show_total); |
| 207 | u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v); | 216 | u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v); |
| 208 | u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, | 217 | u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, |
| 209 | const struct blkg_rwstat *rwstat); | 218 | const struct blkg_rwstat_sample *rwstat); |
| 210 | u64 blkg_prfill_stat(struct seq_file *sf, struct blkg_policy_data *pd, int off); | ||
| 211 | u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, | 219 | u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, |
| 212 | int off); | 220 | int off); |
| 213 | int blkg_print_stat_bytes(struct seq_file *sf, void *v); | 221 | int blkg_print_stat_bytes(struct seq_file *sf, void *v); |
| @@ -215,10 +223,8 @@ int blkg_print_stat_ios(struct seq_file *sf, void *v); | |||
| 215 | int blkg_print_stat_bytes_recursive(struct seq_file *sf, void *v); | 223 | int blkg_print_stat_bytes_recursive(struct seq_file *sf, void *v); |
| 216 | int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v); | 224 | int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v); |
| 217 | 225 | ||
| 218 | u64 blkg_stat_recursive_sum(struct blkcg_gq *blkg, | 226 | void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, |
| 219 | struct blkcg_policy *pol, int off); | 227 | int off, struct blkg_rwstat_sample *sum); |
| 220 | struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, | ||
| 221 | struct blkcg_policy *pol, int off); | ||
| 222 | 228 | ||
| 223 | struct blkg_conf_ctx { | 229 | struct blkg_conf_ctx { |
| 224 | struct gendisk *disk; | 230 | struct gendisk *disk; |
| @@ -569,69 +575,6 @@ static inline void blkg_put(struct blkcg_gq *blkg) | |||
| 569 | if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \ | 575 | if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \ |
| 570 | (p_blkg)->q, false))) | 576 | (p_blkg)->q, false))) |
| 571 | 577 | ||
| 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 | |||
| 635 | static inline int blkg_rwstat_init(struct blkg_rwstat *rwstat, gfp_t gfp) | 578 | static inline int blkg_rwstat_init(struct blkg_rwstat *rwstat, gfp_t gfp) |
| 636 | { | 579 | { |
| 637 | int i, ret; | 580 | int i, ret; |
| @@ -693,15 +636,14 @@ static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat, | |||
| 693 | * | 636 | * |
| 694 | * Read the current snapshot of @rwstat and return it in the aux counts. | 637 | * Read the current snapshot of @rwstat and return it in the aux counts. |
| 695 | */ | 638 | */ |
| 696 | static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat) | 639 | static inline void blkg_rwstat_read(struct blkg_rwstat *rwstat, |
| 640 | struct blkg_rwstat_sample *result) | ||
| 697 | { | 641 | { |
| 698 | struct blkg_rwstat result; | ||
| 699 | int i; | 642 | int i; |
| 700 | 643 | ||
| 701 | for (i = 0; i < BLKG_RWSTAT_NR; i++) | 644 | for (i = 0; i < BLKG_RWSTAT_NR; i++) |
| 702 | atomic64_set(&result.aux_cnt[i], | 645 | result->cnt[i] = |
| 703 | percpu_counter_sum_positive(&rwstat->cpu_cnt[i])); | 646 | percpu_counter_sum_positive(&rwstat->cpu_cnt[i]); |
| 704 | return result; | ||
| 705 | } | 647 | } |
| 706 | 648 | ||
| 707 | /** | 649 | /** |
| @@ -714,10 +656,10 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat) | |||
| 714 | */ | 656 | */ |
| 715 | static inline uint64_t blkg_rwstat_total(struct blkg_rwstat *rwstat) | 657 | static inline uint64_t blkg_rwstat_total(struct blkg_rwstat *rwstat) |
| 716 | { | 658 | { |
| 717 | struct blkg_rwstat tmp = blkg_rwstat_read(rwstat); | 659 | struct blkg_rwstat_sample tmp = { }; |
| 718 | 660 | ||
| 719 | return atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_READ]) + | 661 | blkg_rwstat_read(rwstat, &tmp); |
| 720 | atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_WRITE]); | 662 | return tmp.cnt[BLKG_RWSTAT_READ] + tmp.cnt[BLKG_RWSTAT_WRITE]; |
| 721 | } | 663 | } |
| 722 | 664 | ||
| 723 | /** | 665 | /** |
| @@ -763,6 +705,15 @@ static inline bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg | |||
| 763 | struct bio *bio) { return false; } | 705 | struct bio *bio) { return false; } |
| 764 | #endif | 706 | #endif |
| 765 | 707 | ||
| 708 | bool __blkcg_punt_bio_submit(struct bio *bio); | ||
| 709 | |||
| 710 | static inline bool blkcg_punt_bio_submit(struct bio *bio) | ||
| 711 | { | ||
| 712 | if (bio->bi_opf & REQ_CGROUP_PUNT) | ||
| 713 | return __blkcg_punt_bio_submit(bio); | ||
| 714 | else | ||
| 715 | return false; | ||
| 716 | } | ||
| 766 | 717 | ||
| 767 | static inline void blkcg_bio_issue_init(struct bio *bio) | 718 | static inline void blkcg_bio_issue_init(struct bio *bio) |
| 768 | { | 719 | { |
| @@ -910,6 +861,7 @@ static inline char *blkg_path(struct blkcg_gq *blkg) { return NULL; } | |||
| 910 | static inline void blkg_get(struct blkcg_gq *blkg) { } | 861 | static inline void blkg_get(struct blkcg_gq *blkg) { } |
| 911 | static inline void blkg_put(struct blkcg_gq *blkg) { } | 862 | static inline void blkg_put(struct blkcg_gq *blkg) { } |
| 912 | 863 | ||
| 864 | static inline bool blkcg_punt_bio_submit(struct bio *bio) { return false; } | ||
| 913 | static inline void blkcg_bio_issue_init(struct bio *bio) { } | 865 | static inline void blkcg_bio_issue_init(struct bio *bio) { } |
| 914 | static inline bool blkcg_bio_issue_check(struct request_queue *q, | 866 | static inline bool blkcg_bio_issue_check(struct request_queue *q, |
| 915 | struct bio *bio) { return true; } | 867 | struct bio *bio) { return true; } |
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 15d1aa53d96c..3fa1fa59f9b2 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h | |||
| @@ -306,7 +306,7 @@ void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs | |||
| 306 | bool blk_mq_complete_request(struct request *rq); | 306 | bool blk_mq_complete_request(struct request *rq); |
| 307 | void blk_mq_complete_request_sync(struct request *rq); | 307 | void blk_mq_complete_request_sync(struct request *rq); |
| 308 | bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list, | 308 | 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); |
| 310 | bool blk_mq_queue_stopped(struct request_queue *q); | 310 | bool blk_mq_queue_stopped(struct request_queue *q); |
| 311 | void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx); | 311 | void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx); |
| 312 | void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx); | 312 | void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx); |
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 95202f80676c..feff3fe4467e 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h | |||
| @@ -154,11 +154,6 @@ struct bio { | |||
| 154 | blk_status_t bi_status; | 154 | blk_status_t bi_status; |
| 155 | u8 bi_partno; | 155 | u8 bi_partno; |
| 156 | 156 | ||
| 157 | /* Number of segments in this BIO after | ||
| 158 | * physical address coalescing is performed. | ||
| 159 | */ | ||
| 160 | unsigned int bi_phys_segments; | ||
| 161 | |||
| 162 | struct bvec_iter bi_iter; | 157 | struct bvec_iter bi_iter; |
| 163 | 158 | ||
| 164 | atomic_t __bi_remaining; | 159 | atomic_t __bi_remaining; |
| @@ -210,7 +205,6 @@ struct bio { | |||
| 210 | */ | 205 | */ |
| 211 | enum { | 206 | enum { |
| 212 | BIO_NO_PAGE_REF, /* don't put release vec pages */ | 207 | BIO_NO_PAGE_REF, /* don't put release vec pages */ |
| 213 | BIO_SEG_VALID, /* bi_phys_segments valid */ | ||
| 214 | BIO_CLONED, /* doesn't own data */ | 208 | BIO_CLONED, /* doesn't own data */ |
| 215 | BIO_BOUNCED, /* bio is a bounce bio */ | 209 | BIO_BOUNCED, /* bio is a bounce bio */ |
| 216 | BIO_USER_MAPPED, /* contains user pages */ | 210 | BIO_USER_MAPPED, /* contains user pages */ |
| @@ -317,6 +311,14 @@ enum req_flag_bits { | |||
| 317 | __REQ_RAHEAD, /* read ahead, can fail anytime */ | 311 | __REQ_RAHEAD, /* read ahead, can fail anytime */ |
| 318 | __REQ_BACKGROUND, /* background IO */ | 312 | __REQ_BACKGROUND, /* background IO */ |
| 319 | __REQ_NOWAIT, /* Don't wait if request will block */ | 313 | __REQ_NOWAIT, /* Don't wait if request will block */ |
| 314 | /* | ||
| 315 | * When a shared kthread needs to issue a bio for a cgroup, doing | ||
| 316 | * so synchronously can lead to priority inversions as the kthread | ||
| 317 | * can be trapped waiting for that cgroup. CGROUP_PUNT flag makes | ||
| 318 | * submit_bio() punt the actual issuing to a dedicated per-blkcg | ||
| 319 | * work item to avoid such priority inversions. | ||
| 320 | */ | ||
| 321 | __REQ_CGROUP_PUNT, | ||
| 320 | 322 | ||
| 321 | /* command specific flags for REQ_OP_WRITE_ZEROES: */ | 323 | /* command specific flags for REQ_OP_WRITE_ZEROES: */ |
| 322 | __REQ_NOUNMAP, /* do not free blocks when zeroing */ | 324 | __REQ_NOUNMAP, /* do not free blocks when zeroing */ |
| @@ -343,6 +345,8 @@ enum req_flag_bits { | |||
| 343 | #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) | 345 | #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) |
| 344 | #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) | 346 | #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) |
| 345 | #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) | 347 | #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) |
| 348 | #define REQ_CGROUP_PUNT (1ULL << __REQ_CGROUP_PUNT) | ||
| 349 | |||
| 346 | #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) | 350 | #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) |
| 347 | #define REQ_HIPRI (1ULL << __REQ_HIPRI) | 351 | #define REQ_HIPRI (1ULL << __REQ_HIPRI) |
| 348 | 352 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 592669bcc536..1ef375dafb1c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -137,11 +137,11 @@ struct request { | |||
| 137 | unsigned int cmd_flags; /* op and common flags */ | 137 | unsigned int cmd_flags; /* op and common flags */ |
| 138 | req_flags_t rq_flags; | 138 | req_flags_t rq_flags; |
| 139 | 139 | ||
| 140 | int tag; | ||
| 140 | int internal_tag; | 141 | int internal_tag; |
| 141 | 142 | ||
| 142 | /* the following two fields are internal, NEVER access directly */ | 143 | /* the following two fields are internal, NEVER access directly */ |
| 143 | unsigned int __data_len; /* total data len */ | 144 | unsigned int __data_len; /* total data len */ |
| 144 | int tag; | ||
| 145 | sector_t __sector; /* sector cursor */ | 145 | sector_t __sector; /* sector cursor */ |
| 146 | 146 | ||
| 147 | struct bio *bio; | 147 | struct bio *bio; |
| @@ -344,10 +344,15 @@ struct queue_limits { | |||
| 344 | 344 | ||
| 345 | #ifdef CONFIG_BLK_DEV_ZONED | 345 | #ifdef CONFIG_BLK_DEV_ZONED |
| 346 | 346 | ||
| 347 | /* | ||
| 348 | * Maximum number of zones to report with a single report zones command. | ||
| 349 | */ | ||
| 350 | #define BLK_ZONED_REPORT_MAX_ZONES 8192U | ||
| 351 | |||
| 347 | extern unsigned int blkdev_nr_zones(struct block_device *bdev); | 352 | extern unsigned int blkdev_nr_zones(struct block_device *bdev); |
| 348 | extern int blkdev_report_zones(struct block_device *bdev, | 353 | extern int blkdev_report_zones(struct block_device *bdev, |
| 349 | sector_t sector, struct blk_zone *zones, | 354 | sector_t sector, struct blk_zone *zones, |
| 350 | unsigned int *nr_zones, gfp_t gfp_mask); | 355 | unsigned int *nr_zones); |
| 351 | extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors, | 356 | extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors, |
| 352 | sector_t nr_sectors, gfp_t gfp_mask); | 357 | sector_t nr_sectors, gfp_t gfp_mask); |
| 353 | extern int blk_revalidate_disk_zones(struct gendisk *disk); | 358 | extern int blk_revalidate_disk_zones(struct gendisk *disk); |
| @@ -681,7 +686,7 @@ static inline bool blk_queue_is_zoned(struct request_queue *q) | |||
| 681 | } | 686 | } |
| 682 | } | 687 | } |
| 683 | 688 | ||
| 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) |
| 685 | { | 690 | { |
| 686 | return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; | 691 | return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; |
| 687 | } | 692 | } |
| @@ -828,7 +833,6 @@ extern void blk_unregister_queue(struct gendisk *disk); | |||
| 828 | extern blk_qc_t generic_make_request(struct bio *bio); | 833 | extern blk_qc_t generic_make_request(struct bio *bio); |
| 829 | extern blk_qc_t direct_make_request(struct bio *bio); | 834 | extern blk_qc_t direct_make_request(struct bio *bio); |
| 830 | extern void blk_rq_init(struct request_queue *q, struct request *rq); | 835 | 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); | ||
| 832 | extern void blk_put_request(struct request *); | 836 | extern void blk_put_request(struct request *); |
| 833 | extern struct request *blk_get_request(struct request_queue *, unsigned int op, | 837 | extern struct request *blk_get_request(struct request_queue *, unsigned int op, |
| 834 | blk_mq_req_flags_t flags); | 838 | blk_mq_req_flags_t flags); |
| @@ -842,7 +846,6 @@ extern blk_status_t blk_insert_cloned_request(struct request_queue *q, | |||
| 842 | struct request *rq); | 846 | struct request *rq); |
| 843 | extern int blk_rq_append_bio(struct request *rq, struct bio **bio); | 847 | extern int blk_rq_append_bio(struct request *rq, struct bio **bio); |
| 844 | extern void blk_queue_split(struct request_queue *, struct bio **); | 848 | extern void blk_queue_split(struct request_queue *, struct bio **); |
| 845 | extern void blk_recount_segments(struct request_queue *, struct bio *); | ||
| 846 | extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int); | 849 | extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int); |
| 847 | extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t, | 850 | extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t, |
| 848 | unsigned int, void __user *); | 851 | unsigned int, void __user *); |
| @@ -867,6 +870,9 @@ extern void blk_execute_rq(struct request_queue *, struct gendisk *, | |||
| 867 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, | 870 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, |
| 868 | struct request *, int, rq_end_io_fn *); | 871 | struct request *, int, rq_end_io_fn *); |
| 869 | 872 | ||
| 873 | /* Helper to convert REQ_OP_XXX to its string format XXX */ | ||
| 874 | extern const char *blk_op_str(unsigned int op); | ||
| 875 | |||
| 870 | int blk_status_to_errno(blk_status_t status); | 876 | int blk_status_to_errno(blk_status_t status); |
| 871 | blk_status_t errno_to_blk_status(int errno); | 877 | blk_status_t errno_to_blk_status(int errno); |
| 872 | 878 | ||
| @@ -1026,21 +1032,9 @@ void blk_steal_bios(struct bio_list *list, struct request *rq); | |||
| 1026 | * | 1032 | * |
| 1027 | * blk_update_request() completes given number of bytes and updates | 1033 | * blk_update_request() completes given number of bytes and updates |
| 1028 | * the request without completing it. | 1034 | * 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. | ||
| 1036 | */ | 1035 | */ |
| 1037 | extern bool blk_update_request(struct request *rq, blk_status_t error, | 1036 | extern bool blk_update_request(struct request *rq, blk_status_t error, |
| 1038 | unsigned int nr_bytes); | 1037 | 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); | ||
| 1044 | 1038 | ||
| 1045 | extern void __blk_complete_request(struct request *); | 1039 | extern void __blk_complete_request(struct request *); |
| 1046 | extern void blk_abort_request(struct request *); | 1040 | extern void blk_abort_request(struct request *); |
| @@ -1429,7 +1423,7 @@ static inline bool bdev_is_zoned(struct block_device *bdev) | |||
| 1429 | return false; | 1423 | return false; |
| 1430 | } | 1424 | } |
| 1431 | 1425 | ||
| 1432 | static inline unsigned int bdev_zone_sectors(struct block_device *bdev) | 1426 | static inline sector_t bdev_zone_sectors(struct block_device *bdev) |
| 1433 | { | 1427 | { |
| 1434 | struct request_queue *q = bdev_get_queue(bdev); | 1428 | struct request_queue *q = bdev_get_queue(bdev); |
| 1435 | 1429 | ||
| @@ -1684,8 +1678,7 @@ struct block_device_operations { | |||
| 1684 | /* this callback is with swap_lock and sometimes page table lock held */ | 1678 | /* this callback is with swap_lock and sometimes page table lock held */ |
| 1685 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); | 1679 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); |
| 1686 | int (*report_zones)(struct gendisk *, sector_t sector, | 1680 | int (*report_zones)(struct gendisk *, sector_t sector, |
| 1687 | struct blk_zone *zones, unsigned int *nr_zones, | 1681 | struct blk_zone *zones, unsigned int *nr_zones); |
| 1688 | gfp_t gfp_mask); | ||
| 1689 | struct module *owner; | 1682 | struct module *owner; |
| 1690 | const struct pr_ops *pr_ops; | 1683 | const struct pr_ops *pr_ops; |
| 1691 | }; | 1684 | }; |
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index a7f7a98ec39d..169fd25f6bc2 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <linux/errno.h> | 6 | #include <linux/errno.h> |
| 7 | #include <linux/jump_label.h> | 7 | #include <linux/jump_label.h> |
| 8 | #include <linux/percpu.h> | 8 | #include <linux/percpu.h> |
| 9 | #include <linux/percpu-refcount.h> | ||
| 9 | #include <linux/rbtree.h> | 10 | #include <linux/rbtree.h> |
| 10 | #include <uapi/linux/bpf.h> | 11 | #include <uapi/linux/bpf.h> |
| 11 | 12 | ||
| @@ -71,11 +72,17 @@ struct cgroup_bpf { | |||
| 71 | u32 flags[MAX_BPF_ATTACH_TYPE]; | 72 | u32 flags[MAX_BPF_ATTACH_TYPE]; |
| 72 | 73 | ||
| 73 | /* temp storage for effective prog array used by prog_attach/detach */ | 74 | /* 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; | ||
| 75 | }; | 82 | }; |
| 76 | 83 | ||
| 77 | void cgroup_bpf_put(struct cgroup *cgrp); | ||
| 78 | int cgroup_bpf_inherit(struct cgroup *cgrp); | 84 | int cgroup_bpf_inherit(struct cgroup *cgrp); |
| 85 | void cgroup_bpf_offline(struct cgroup *cgrp); | ||
| 79 | 86 | ||
| 80 | int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, | 87 | int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, |
| 81 | enum bpf_attach_type type, u32 flags); | 88 | enum bpf_attach_type type, u32 flags); |
| @@ -117,6 +124,14 @@ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, | |||
| 117 | loff_t *ppos, void **new_buf, | 124 | loff_t *ppos, void **new_buf, |
| 118 | enum bpf_attach_type type); | 125 | enum bpf_attach_type type); |
| 119 | 126 | ||
| 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 | |||
| 120 | static inline enum bpf_cgroup_storage_type cgroup_storage_type( | 135 | static inline enum bpf_cgroup_storage_type cgroup_storage_type( |
| 121 | struct bpf_map *map) | 136 | struct bpf_map *map) |
| 122 | { | 137 | { |
| @@ -279,6 +294,38 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, | |||
| 279 | __ret; \ | 294 | __ret; \ |
| 280 | }) | 295 | }) |
| 281 | 296 | ||
| 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 | |||
| 282 | int cgroup_bpf_prog_attach(const union bpf_attr *attr, | 329 | int cgroup_bpf_prog_attach(const union bpf_attr *attr, |
| 283 | enum bpf_prog_type ptype, struct bpf_prog *prog); | 330 | enum bpf_prog_type ptype, struct bpf_prog *prog); |
| 284 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, | 331 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, |
| @@ -289,8 +336,8 @@ int cgroup_bpf_prog_query(const union bpf_attr *attr, | |||
| 289 | 336 | ||
| 290 | struct bpf_prog; | 337 | struct bpf_prog; |
| 291 | struct cgroup_bpf {}; | 338 | struct cgroup_bpf {}; |
| 292 | static inline void cgroup_bpf_put(struct cgroup *cgrp) {} | ||
| 293 | static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; } | 339 | static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; } |
| 340 | static inline void cgroup_bpf_offline(struct cgroup *cgrp) {} | ||
| 294 | 341 | ||
| 295 | static inline int cgroup_bpf_prog_attach(const union bpf_attr *attr, | 342 | static inline int cgroup_bpf_prog_attach(const union bpf_attr *attr, |
| 296 | enum bpf_prog_type ptype, | 343 | enum bpf_prog_type ptype, |
| @@ -350,6 +397,11 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, | |||
| 350 | #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) | 397 | #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) |
| 351 | #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) | 398 | #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) |
| 352 | #define BPF_CGROUP_RUN_PROG_SYSCTL(head,table,write,buf,count,pos,nbuf) ({ 0; }) | 399 | #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; }) | ||
| 353 | 405 | ||
| 354 | #define for_each_cgroup_storage_type(stype) for (; false; ) | 406 | #define for_each_cgroup_storage_type(stype) for (; false; ) |
| 355 | 407 | ||
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index b92ef9f73e42..18f4cc2c6acd 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h | |||
| @@ -63,6 +63,11 @@ struct bpf_map_ops { | |||
| 63 | u64 imm, u32 *off); | 63 | u64 imm, u32 *off); |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | struct bpf_map_memory { | ||
| 67 | u32 pages; | ||
| 68 | struct user_struct *user; | ||
| 69 | }; | ||
| 70 | |||
| 66 | struct bpf_map { | 71 | struct bpf_map { |
| 67 | /* The first two cachelines with read-mostly members of which some | 72 | /* The first two cachelines with read-mostly members of which some |
| 68 | * are also accessed in fast-path (e.g. ops, max_entries). | 73 | * are also accessed in fast-path (e.g. ops, max_entries). |
| @@ -83,7 +88,7 @@ struct bpf_map { | |||
| 83 | u32 btf_key_type_id; | 88 | u32 btf_key_type_id; |
| 84 | u32 btf_value_type_id; | 89 | u32 btf_value_type_id; |
| 85 | struct btf *btf; | 90 | struct btf *btf; |
| 86 | u32 pages; | 91 | struct bpf_map_memory memory; |
| 87 | bool unpriv_array; | 92 | bool unpriv_array; |
| 88 | bool frozen; /* write-once */ | 93 | bool frozen; /* write-once */ |
| 89 | /* 48 bytes hole */ | 94 | /* 48 bytes hole */ |
| @@ -91,8 +96,7 @@ struct bpf_map { | |||
| 91 | /* The 3rd and 4th cacheline with misc members to avoid false sharing | 96 | /* The 3rd and 4th cacheline with misc members to avoid false sharing |
| 92 | * particularly with refcounting. | 97 | * particularly with refcounting. |
| 93 | */ | 98 | */ |
| 94 | struct user_struct *user ____cacheline_aligned; | 99 | atomic_t refcnt ____cacheline_aligned; |
| 95 | atomic_t refcnt; | ||
| 96 | atomic_t usercnt; | 100 | atomic_t usercnt; |
| 97 | struct work_struct work; | 101 | struct work_struct work; |
| 98 | char name[BPF_OBJ_NAME_LEN]; | 102 | char name[BPF_OBJ_NAME_LEN]; |
| @@ -273,6 +277,7 @@ enum bpf_reg_type { | |||
| 273 | PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ | 277 | PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ |
| 274 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ | 278 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ |
| 275 | PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ | 279 | PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ |
| 280 | PTR_TO_XDP_SOCK, /* reg points to struct xdp_sock */ | ||
| 276 | }; | 281 | }; |
| 277 | 282 | ||
| 278 | /* The information passed from prog-specific *_is_valid_access | 283 | /* The information passed from prog-specific *_is_valid_access |
| @@ -367,6 +372,7 @@ struct bpf_prog_aux { | |||
| 367 | u32 id; | 372 | u32 id; |
| 368 | u32 func_cnt; /* used by non-func prog as the number of func progs */ | 373 | u32 func_cnt; /* used by non-func prog as the number of func progs */ |
| 369 | u32 func_idx; /* 0 for non-func prog, the index in func array for func prog */ | 374 | 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. */ | ||
| 370 | bool offload_requested; | 376 | bool offload_requested; |
| 371 | struct bpf_prog **func; | 377 | struct bpf_prog **func; |
| 372 | void *jit_data; /* JIT specific data. arch dependent */ | 378 | void *jit_data; /* JIT specific data. arch dependent */ |
| @@ -510,17 +516,18 @@ struct bpf_prog_array { | |||
| 510 | }; | 516 | }; |
| 511 | 517 | ||
| 512 | struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags); | 518 | 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); | 519 | void bpf_prog_array_free(struct bpf_prog_array *progs); |
| 514 | int bpf_prog_array_length(struct bpf_prog_array __rcu *progs); | 520 | int bpf_prog_array_length(struct bpf_prog_array *progs); |
| 515 | int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *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, | ||
| 516 | __u32 __user *prog_ids, u32 cnt); | 523 | __u32 __user *prog_ids, u32 cnt); |
| 517 | 524 | ||
| 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, |
| 519 | struct bpf_prog *old_prog); | 526 | 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, |
| 521 | u32 *prog_ids, u32 request_cnt, | 528 | u32 *prog_ids, u32 request_cnt, |
| 522 | u32 *prog_cnt); | 529 | 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, |
| 524 | struct bpf_prog *exclude_prog, | 531 | struct bpf_prog *exclude_prog, |
| 525 | struct bpf_prog *include_prog, | 532 | struct bpf_prog *include_prog, |
| 526 | struct bpf_prog_array **new_array); | 533 | struct bpf_prog_array **new_array); |
| @@ -548,6 +555,56 @@ _out: \ | |||
| 548 | _ret; \ | 555 | _ret; \ |
| 549 | }) | 556 | }) |
| 550 | 557 | ||
| 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 | |||
| 551 | #define BPF_PROG_RUN_ARRAY(array, ctx, func) \ | 608 | #define BPF_PROG_RUN_ARRAY(array, ctx, func) \ |
| 552 | __BPF_PROG_RUN_ARRAY(array, ctx, func, false) | 609 | __BPF_PROG_RUN_ARRAY(array, ctx, func, false) |
| 553 | 610 | ||
| @@ -592,9 +649,12 @@ struct bpf_map *__bpf_map_get(struct fd f); | |||
| 592 | struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref); | 649 | struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref); |
| 593 | void bpf_map_put_with_uref(struct bpf_map *map); | 650 | void bpf_map_put_with_uref(struct bpf_map *map); |
| 594 | void bpf_map_put(struct bpf_map *map); | 651 | void bpf_map_put(struct bpf_map *map); |
| 595 | int bpf_map_precharge_memlock(u32 pages); | ||
| 596 | int bpf_map_charge_memlock(struct bpf_map *map, u32 pages); | 652 | int bpf_map_charge_memlock(struct bpf_map *map, u32 pages); |
| 597 | void bpf_map_uncharge_memlock(struct bpf_map *map, u32 pages); | 653 | 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); | ||
| 598 | void *bpf_map_area_alloc(size_t size, int numa_node); | 658 | void *bpf_map_area_alloc(size_t size, int numa_node); |
| 599 | void bpf_map_area_free(void *base); | 659 | void bpf_map_area_free(void *base); |
| 600 | void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr); | 660 | 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; | |||
| 992 | extern const struct bpf_func_proto bpf_get_local_storage_proto; | 1052 | extern const struct bpf_func_proto bpf_get_local_storage_proto; |
| 993 | extern const struct bpf_func_proto bpf_strtol_proto; | 1053 | extern const struct bpf_func_proto bpf_strtol_proto; |
| 994 | extern const struct bpf_func_proto bpf_strtoul_proto; | 1054 | extern const struct bpf_func_proto bpf_strtoul_proto; |
| 1055 | extern const struct bpf_func_proto bpf_tcp_sock_proto; | ||
| 995 | 1056 | ||
| 996 | /* Shared helpers among cBPF and eBPF. */ | 1057 | /* Shared helpers among cBPF and eBPF. */ |
| 997 | void bpf_user_rnd_init_once(void); | 1058 | void bpf_user_rnd_init_once(void); |
| @@ -1040,6 +1101,15 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, | |||
| 1040 | struct bpf_insn *insn_buf, | 1101 | struct bpf_insn *insn_buf, |
| 1041 | struct bpf_prog *prog, | 1102 | struct bpf_prog *prog, |
| 1042 | u32 *target_size); | 1103 | 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); | ||
| 1043 | #else | 1113 | #else |
| 1044 | static inline bool bpf_tcp_sock_is_valid_access(int off, int size, | 1114 | static inline bool bpf_tcp_sock_is_valid_access(int off, int size, |
| 1045 | enum bpf_access_type type, | 1115 | enum bpf_access_type type, |
| @@ -1056,6 +1126,21 @@ static inline u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, | |||
| 1056 | { | 1126 | { |
| 1057 | return 0; | 1127 | return 0; |
| 1058 | } | 1128 | } |
| 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 | } | ||
| 1059 | #endif /* CONFIG_INET */ | 1144 | #endif /* CONFIG_INET */ |
| 1060 | 1145 | ||
| 1061 | #endif /* _LINUX_BPF_H */ | 1146 | #endif /* _LINUX_BPF_H */ |
diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index 5a9975678d6f..eec5aeeeaf92 100644 --- a/include/linux/bpf_types.h +++ b/include/linux/bpf_types.h | |||
| @@ -30,6 +30,7 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable) | |||
| 30 | #ifdef CONFIG_CGROUP_BPF | 30 | #ifdef CONFIG_CGROUP_BPF |
| 31 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) | 31 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) |
| 32 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl) | 32 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl) |
| 33 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCKOPT, cg_sockopt) | ||
| 33 | #endif | 34 | #endif |
| 34 | #ifdef CONFIG_BPF_LIRC_MODE2 | 35 | #ifdef CONFIG_BPF_LIRC_MODE2 |
| 35 | BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) | 36 | BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) |
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 519aafabc40c..5fe99f322b1c 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h | |||
| @@ -33,9 +33,11 @@ | |||
| 33 | */ | 33 | */ |
| 34 | enum bpf_reg_liveness { | 34 | enum bpf_reg_liveness { |
| 35 | REG_LIVE_NONE = 0, /* reg hasn't been read or written this branch */ | 35 | 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 */ | 36 | REG_LIVE_READ32 = 0x1, /* reg was read, so we're sensitive to initial value */ |
| 37 | REG_LIVE_WRITTEN, /* reg was written first, screening off later reads */ | 37 | REG_LIVE_READ64 = 0x2, /* likewise, but full 64-bit content matters */ |
| 38 | REG_LIVE_DONE = 4, /* liveness won't be updating this register anymore */ | 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 */ | ||
| 39 | }; | 41 | }; |
| 40 | 42 | ||
| 41 | struct bpf_reg_state { | 43 | struct bpf_reg_state { |
| @@ -128,7 +130,14 @@ struct bpf_reg_state { | |||
| 128 | * pointing to bpf_func_state. | 130 | * pointing to bpf_func_state. |
| 129 | */ | 131 | */ |
| 130 | u32 frameno; | 132 | 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; | ||
| 131 | enum bpf_reg_liveness live; | 138 | enum bpf_reg_liveness live; |
| 139 | /* if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety */ | ||
| 140 | bool precise; | ||
| 132 | }; | 141 | }; |
| 133 | 142 | ||
| 134 | enum bpf_stack_slot_type { | 143 | enum bpf_stack_slot_type { |
| @@ -180,13 +189,77 @@ struct bpf_func_state { | |||
| 180 | struct bpf_stack_state *stack; | 189 | struct bpf_stack_state *stack; |
| 181 | }; | 190 | }; |
| 182 | 191 | ||
| 192 | struct bpf_idx_pair { | ||
| 193 | u32 prev_idx; | ||
| 194 | u32 idx; | ||
| 195 | }; | ||
| 196 | |||
| 183 | #define MAX_CALL_FRAMES 8 | 197 | #define MAX_CALL_FRAMES 8 |
| 184 | struct bpf_verifier_state { | 198 | struct bpf_verifier_state { |
| 185 | /* call stack tracking */ | 199 | /* call stack tracking */ |
| 186 | struct bpf_func_state *frame[MAX_CALL_FRAMES]; | 200 | 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; | ||
| 187 | u32 curframe; | 249 | u32 curframe; |
| 188 | u32 active_spin_lock; | 250 | u32 active_spin_lock; |
| 189 | bool speculative; | 251 | 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; | ||
| 190 | }; | 263 | }; |
| 191 | 264 | ||
| 192 | #define bpf_get_spilled_reg(slot, frame) \ | 265 | #define bpf_get_spilled_reg(slot, frame) \ |
| @@ -229,7 +302,9 @@ struct bpf_insn_aux_data { | |||
| 229 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ | 302 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ |
| 230 | int sanitize_stack_off; /* stack slot to be cleared */ | 303 | int sanitize_stack_off; /* stack slot to be cleared */ |
| 231 | bool seen; /* this insn was processed by the verifier */ | 304 | bool seen; /* this insn was processed by the verifier */ |
| 305 | bool zext_dst; /* this insn zero extends dst reg */ | ||
| 232 | u8 alu_state; /* used in combination with alu_limit */ | 306 | u8 alu_state; /* used in combination with alu_limit */ |
| 307 | bool prune_point; | ||
| 233 | unsigned int orig_idx; /* original instruction index */ | 308 | unsigned int orig_idx; /* original instruction index */ |
| 234 | }; | 309 | }; |
| 235 | 310 | ||
| @@ -299,7 +374,9 @@ struct bpf_verifier_env { | |||
| 299 | } cfg; | 374 | } cfg; |
| 300 | u32 subprog_cnt; | 375 | u32 subprog_cnt; |
| 301 | /* number of instructions analyzed by the verifier */ | 376 | /* 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; | ||
| 303 | /* total verification time */ | 380 | /* total verification time */ |
| 304 | u64 verification_time; | 381 | u64 verification_time; |
| 305 | /* maximum number of verifier states kept in 'branching' instructions */ | 382 | /* maximum number of verifier states kept in 'branching' instructions */ |
diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index 70e19bc6cc9f..46b92cd61d0c 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h | |||
| @@ -17,6 +17,8 @@ enum cache_type { | |||
| 17 | CACHE_TYPE_UNIFIED = BIT(2), | 17 | CACHE_TYPE_UNIFIED = BIT(2), |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | extern unsigned int coherency_max_size; | ||
| 21 | |||
| 20 | /** | 22 | /** |
| 21 | * struct cacheinfo - represent a cache leaf node | 23 | * struct cacheinfo - represent a cache leaf node |
| 22 | * @id: This cache's id. It is unique among caches with the same (type, level). | 24 | * @id: This cache's id. It is unique among caches with the same (type, level). |
diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h index fa5f9b7f5dbb..cf5e840eec71 100644 --- a/include/linux/ceph/debugfs.h +++ b/include/linux/ceph/debugfs.h | |||
| @@ -19,9 +19,9 @@ static const struct file_operations name##_fops = { \ | |||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | /* debugfs.c */ | 21 | /* debugfs.c */ |
| 22 | extern int ceph_debugfs_init(void); | 22 | extern void ceph_debugfs_init(void); |
| 23 | extern void ceph_debugfs_cleanup(void); | 23 | 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); |
| 25 | extern void ceph_debugfs_client_cleanup(struct ceph_client *client); | 25 | extern void ceph_debugfs_client_cleanup(struct ceph_client *client); |
| 26 | 26 | ||
| 27 | #endif | 27 | #endif |
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index b4e766e93f6e..430e219e3aba 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h | |||
| @@ -624,7 +624,7 @@ struct cftype { | |||
| 624 | 624 | ||
| 625 | /* | 625 | /* |
| 626 | * Control Group subsystem type. | 626 | * Control Group subsystem type. |
| 627 | * See Documentation/cgroup-v1/cgroups.txt for details | 627 | * See Documentation/admin-guide/cgroup-v1/cgroups.rst for details |
| 628 | */ | 628 | */ |
| 629 | struct cgroup_subsys { | 629 | struct cgroup_subsys { |
| 630 | struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css); | 630 | struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css); |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 0297f930a56e..f6b048902d6c 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
| @@ -131,6 +131,8 @@ void cgroup_free(struct task_struct *p); | |||
| 131 | int cgroup_init_early(void); | 131 | int cgroup_init_early(void); |
| 132 | int cgroup_init(void); | 132 | int cgroup_init(void); |
| 133 | 133 | ||
| 134 | int cgroup_parse_float(const char *input, unsigned dec_shift, s64 *v); | ||
| 135 | |||
| 134 | /* | 136 | /* |
| 135 | * Iteration helpers and macros. | 137 | * Iteration helpers and macros. |
| 136 | */ | 138 | */ |
| @@ -697,6 +699,7 @@ void cgroup_path_from_kernfs_id(const union kernfs_node_id *id, | |||
| 697 | struct cgroup_subsys_state; | 699 | struct cgroup_subsys_state; |
| 698 | struct cgroup; | 700 | struct cgroup; |
| 699 | 701 | ||
| 702 | static inline void css_get(struct cgroup_subsys_state *css) {} | ||
| 700 | static inline void css_put(struct cgroup_subsys_state *css) {} | 703 | static inline void css_put(struct cgroup_subsys_state *css) {} |
| 701 | static inline int cgroup_attach_task_all(struct task_struct *from, | 704 | static inline int cgroup_attach_task_all(struct task_struct *from, |
| 702 | struct task_struct *t) { return 0; } | 705 | struct task_struct *t) { return 0; } |
| @@ -934,4 +937,22 @@ static inline bool cgroup_task_frozen(struct task_struct *task) | |||
| 934 | 937 | ||
| 935 | #endif /* !CONFIG_CGROUPS */ | 938 | #endif /* !CONFIG_CGROUPS */ |
| 936 | 939 | ||
| 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 | |||
| 937 | #endif /* _LINUX_CGROUP_H */ | 958 | #endif /* _LINUX_CGROUP_H */ |
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 19e58b9138a0..095d55c3834d 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h | |||
| @@ -112,6 +112,8 @@ struct ftrace_likely_data { | |||
| 112 | 112 | ||
| 113 | #if defined(CC_USING_HOTPATCH) | 113 | #if defined(CC_USING_HOTPATCH) |
| 114 | #define notrace __attribute__((hotpatch(0, 0))) | 114 | #define notrace __attribute__((hotpatch(0, 0))) |
| 115 | #elif defined(CC_USING_PATCHABLE_FUNCTION_ENTRY) | ||
| 116 | #define notrace __attribute__((patchable_function_entry(0, 0))) | ||
| 115 | #else | 117 | #else |
| 116 | #define notrace __attribute__((__no_instrument_function__)) | 118 | #define notrace __attribute__((__no_instrument_function__)) |
| 117 | #endif | 119 | #endif |
diff --git a/include/linux/concap.h b/include/linux/concap.h deleted file mode 100644 index 977acb3d1fb2..000000000000 --- a/include/linux/concap.h +++ /dev/null | |||
| @@ -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 | ||
diff --git a/include/linux/connector.h b/include/linux/connector.h index 1d72ef76f24f..6b6c7396a584 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
| @@ -55,10 +55,71 @@ struct cn_dev { | |||
| 55 | struct cn_queue_dev *cbdev; | 55 | struct cn_queue_dev *cbdev; |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | /** | ||
| 59 | * cn_add_callback() - Registers new callback with connector core. | ||
| 60 | * | ||
| 61 | * @id: unique connector's user identifier. | ||
| 62 | * It must be registered in connector.h for legal | ||
| 63 | * in-kernel users. | ||
| 64 | * @name: connector's callback symbolic name. | ||
| 65 | * @callback: connector's callback. | ||
| 66 | * parameters are %cn_msg and the sender's credentials | ||
| 67 | */ | ||
| 58 | int cn_add_callback(struct cb_id *id, const char *name, | 68 | int cn_add_callback(struct cb_id *id, const char *name, |
| 59 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); | 69 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); |
| 60 | void cn_del_callback(struct cb_id *); | 70 | /** |
| 71 | * cn_del_callback() - Unregisters new callback with connector core. | ||
| 72 | * | ||
| 73 | * @id: unique connector's user identifier. | ||
| 74 | */ | ||
| 75 | void cn_del_callback(struct cb_id *id); | ||
| 76 | |||
| 77 | |||
| 78 | /** | ||
| 79 | * cn_netlink_send_mult - Sends message to the specified groups. | ||
| 80 | * | ||
| 81 | * @msg: message header(with attached data). | ||
| 82 | * @len: Number of @msg to be sent. | ||
| 83 | * @portid: destination port. | ||
| 84 | * If non-zero the message will be sent to the given port, | ||
| 85 | * which should be set to the original sender. | ||
| 86 | * @group: destination group. | ||
| 87 | * If @portid and @group is zero, then appropriate group will | ||
| 88 | * be searched through all registered connector users, and | ||
| 89 | * message will be delivered to the group which was created | ||
| 90 | * for user with the same ID as in @msg. | ||
| 91 | * If @group is not zero, then message will be delivered | ||
| 92 | * to the specified group. | ||
| 93 | * @gfp_mask: GFP mask. | ||
| 94 | * | ||
| 95 | * It can be safely called from softirq context, but may silently | ||
| 96 | * fail under strong memory pressure. | ||
| 97 | * | ||
| 98 | * If there are no listeners for given group %-ESRCH can be returned. | ||
| 99 | */ | ||
| 61 | int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask); | 100 | int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask); |
| 101 | |||
| 102 | /** | ||
| 103 | * cn_netlink_send_mult - Sends message to the specified groups. | ||
| 104 | * | ||
| 105 | * @msg: message header(with attached data). | ||
| 106 | * @portid: destination port. | ||
| 107 | * If non-zero the message will be sent to the given port, | ||
| 108 | * which should be set to the original sender. | ||
| 109 | * @group: destination group. | ||
| 110 | * If @portid and @group is zero, then appropriate group will | ||
| 111 | * be searched through all registered connector users, and | ||
| 112 | * message will be delivered to the group which was created | ||
| 113 | * for user with the same ID as in @msg. | ||
| 114 | * If @group is not zero, then message will be delivered | ||
| 115 | * to the specified group. | ||
| 116 | * @gfp_mask: GFP mask. | ||
| 117 | * | ||
| 118 | * It can be safely called from softirq context, but may silently | ||
| 119 | * fail under strong memory pressure. | ||
| 120 | * | ||
| 121 | * If there are no listeners for given group %-ESRCH can be returned. | ||
| 122 | */ | ||
| 62 | int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); | 123 | int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); |
| 63 | 124 | ||
| 64 | int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, | 125 | int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, |
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index ed798e114663..24d4c16e3ae0 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h | |||
| @@ -168,9 +168,6 @@ extern void vc_SAK(struct work_struct *work); | |||
| 168 | 168 | ||
| 169 | #define CUR_DEFAULT CUR_UNDERLINE | 169 | #define CUR_DEFAULT CUR_UNDERLINE |
| 170 | 170 | ||
| 171 | static inline bool con_is_visible(const struct vc_data *vc) | 171 | bool con_is_visible(const struct vc_data *vc); |
| 172 | { | ||
| 173 | return *vc->vc_display_fg == vc; | ||
| 174 | } | ||
| 175 | 172 | ||
| 176 | #endif /* _LINUX_CONSOLE_STRUCT_H */ | 173 | #endif /* _LINUX_CONSOLE_STRUCT_H */ |
diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 62a520df8add..a2b68823717b 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h | |||
| @@ -91,15 +91,11 @@ union coresight_dev_subtype { | |||
| 91 | 91 | ||
| 92 | /** | 92 | /** |
| 93 | * struct coresight_platform_data - data harvested from the DT specification | 93 | * 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. | ||
| 96 | * @nr_inport: number of input ports for this component. | 94 | * @nr_inport: number of input ports for this component. |
| 97 | * @nr_outport: number of output ports for this component. | 95 | * @nr_outport: number of output ports for this component. |
| 98 | * @conns: Array of nr_outport connections from this component | 96 | * @conns: Array of nr_outport connections from this component |
| 99 | */ | 97 | */ |
| 100 | struct coresight_platform_data { | 98 | struct coresight_platform_data { |
| 101 | int cpu; | ||
| 102 | const char *name; | ||
| 103 | int nr_inport; | 99 | int nr_inport; |
| 104 | int nr_outport; | 100 | int nr_outport; |
| 105 | struct coresight_connection *conns; | 101 | struct coresight_connection *conns; |
| @@ -110,11 +106,12 @@ struct coresight_platform_data { | |||
| 110 | * @type: as defined by @coresight_dev_type. | 106 | * @type: as defined by @coresight_dev_type. |
| 111 | * @subtype: as defined by @coresight_dev_subtype. | 107 | * @subtype: as defined by @coresight_dev_subtype. |
| 112 | * @ops: generic operations for this component, as defined | 108 | * @ops: generic operations for this component, as defined |
| 113 | by @coresight_ops. | 109 | * by @coresight_ops. |
| 114 | * @pdata: platform data collected from DT. | 110 | * @pdata: platform data collected from DT. |
| 115 | * @dev: The device entity associated to this component. | 111 | * @dev: The device entity associated to this component. |
| 116 | * @groups: operations specific to this component. These will end up | 112 | * @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. | ||
| 118 | */ | 115 | */ |
| 119 | struct coresight_desc { | 116 | struct coresight_desc { |
| 120 | enum coresight_dev_type type; | 117 | enum coresight_dev_type type; |
| @@ -123,28 +120,27 @@ struct coresight_desc { | |||
| 123 | struct coresight_platform_data *pdata; | 120 | struct coresight_platform_data *pdata; |
| 124 | struct device *dev; | 121 | struct device *dev; |
| 125 | const struct attribute_group **groups; | 122 | const struct attribute_group **groups; |
| 123 | const char *name; | ||
| 126 | }; | 124 | }; |
| 127 | 125 | ||
| 128 | /** | 126 | /** |
| 129 | * struct coresight_connection - representation of a single connection | 127 | * struct coresight_connection - representation of a single connection |
| 130 | * @outport: a connection's output port number. | 128 | * @outport: a connection's output port number. |
| 131 | * @chid_name: remote component's name. | ||
| 132 | * @child_port: remote component's port number @output is connected to. | 129 | * @child_port: remote component's port number @output is connected to. |
| 130 | * @chid_fwnode: remote component's fwnode handle. | ||
| 133 | * @child_dev: a @coresight_device representation of the component | 131 | * @child_dev: a @coresight_device representation of the component |
| 134 | connected to @outport. | 132 | connected to @outport. |
| 135 | */ | 133 | */ |
| 136 | struct coresight_connection { | 134 | struct coresight_connection { |
| 137 | int outport; | 135 | int outport; |
| 138 | const char *child_name; | ||
| 139 | int child_port; | 136 | int child_port; |
| 137 | struct fwnode_handle *child_fwnode; | ||
| 140 | struct coresight_device *child_dev; | 138 | struct coresight_device *child_dev; |
| 141 | }; | 139 | }; |
| 142 | 140 | ||
| 143 | /** | 141 | /** |
| 144 | * struct coresight_device - representation of a device as used by the framework | 142 | * struct coresight_device - representation of a device as used by the framework |
| 145 | * @conns: array of coresight_connections associated to this component. | 143 | * @pdata: Platform data with device connections associated to this device. |
| 146 | * @nr_inport: number of input port associated to this component. | ||
| 147 | * @nr_outport: number of output port associated to this component. | ||
| 148 | * @type: as defined by @coresight_dev_type. | 144 | * @type: as defined by @coresight_dev_type. |
| 149 | * @subtype: as defined by @coresight_dev_subtype. | 145 | * @subtype: as defined by @coresight_dev_subtype. |
| 150 | * @ops: generic operations for this component, as defined | 146 | * @ops: generic operations for this component, as defined |
| @@ -159,9 +155,7 @@ struct coresight_connection { | |||
| 159 | * @ea: Device attribute for sink representation under PMU directory. | 155 | * @ea: Device attribute for sink representation under PMU directory. |
| 160 | */ | 156 | */ |
| 161 | struct coresight_device { | 157 | struct coresight_device { |
| 162 | struct coresight_connection *conns; | 158 | struct coresight_platform_data *pdata; |
| 163 | int nr_inport; | ||
| 164 | int nr_outport; | ||
| 165 | enum coresight_dev_type type; | 159 | enum coresight_dev_type type; |
| 166 | union coresight_dev_subtype subtype; | 160 | union coresight_dev_subtype subtype; |
| 167 | const struct coresight_ops *ops; | 161 | const struct coresight_ops *ops; |
| @@ -174,6 +168,28 @@ struct coresight_device { | |||
| 174 | struct dev_ext_attribute *ea; | 168 | struct dev_ext_attribute *ea; |
| 175 | }; | 169 | }; |
| 176 | 170 | ||
| 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 | |||
| 177 | #define to_coresight_device(d) container_of(d, struct coresight_device, dev) | 193 | #define to_coresight_device(d) container_of(d, struct coresight_device, dev) |
| 178 | 194 | ||
| 179 | #define source_ops(csdev) csdev->ops->source_ops | 195 | #define source_ops(csdev) csdev->ops->source_ops |
| @@ -267,7 +283,8 @@ extern int coresight_claim_device_unlocked(void __iomem *base); | |||
| 267 | 283 | ||
| 268 | extern void coresight_disclaim_device(void __iomem *base); | 284 | extern void coresight_disclaim_device(void __iomem *base); |
| 269 | extern void coresight_disclaim_device_unlocked(void __iomem *base); | 285 | 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); | ||
| 271 | #else | 288 | #else |
| 272 | static inline struct coresight_device * | 289 | static inline struct coresight_device * |
| 273 | coresight_register(struct coresight_desc *desc) { return NULL; } | 290 | coresight_register(struct coresight_desc *desc) { return NULL; } |
| @@ -292,16 +309,8 @@ static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} | |||
| 292 | 309 | ||
| 293 | #endif | 310 | #endif |
| 294 | 311 | ||
| 295 | #ifdef CONFIG_OF | 312 | extern int coresight_get_cpu(struct device *dev); |
| 296 | extern int of_coresight_get_cpu(const struct device_node *node); | 313 | |
| 297 | extern struct coresight_platform_data * | 314 | struct coresight_platform_data *coresight_get_platform_data(struct device *dev); |
| 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 | ||
| 306 | 315 | ||
| 307 | #endif | 316 | #endif |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 32a1733014f5..46b167fba155 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -406,6 +406,12 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); | |||
| 406 | const char *cpufreq_get_current_driver(void); | 406 | const char *cpufreq_get_current_driver(void); |
| 407 | void *cpufreq_get_driver_data(void); | 407 | void *cpufreq_get_driver_data(void); |
| 408 | 408 | ||
| 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 | |||
| 409 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, | 415 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, |
| 410 | unsigned int min, unsigned int max) | 416 | unsigned int min, unsigned int max) |
| 411 | { | 417 | { |
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 5c6062206760..068793a619ca 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
| @@ -116,10 +116,10 @@ enum cpuhp_state { | |||
| 116 | CPUHP_AP_PERF_ARM_ACPI_STARTING, | 116 | CPUHP_AP_PERF_ARM_ACPI_STARTING, |
| 117 | CPUHP_AP_PERF_ARM_STARTING, | 117 | CPUHP_AP_PERF_ARM_STARTING, |
| 118 | CPUHP_AP_ARM_L2X0_STARTING, | 118 | CPUHP_AP_ARM_L2X0_STARTING, |
| 119 | CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING, | ||
| 119 | CPUHP_AP_ARM_ARCH_TIMER_STARTING, | 120 | CPUHP_AP_ARM_ARCH_TIMER_STARTING, |
| 120 | CPUHP_AP_ARM_GLOBAL_TIMER_STARTING, | 121 | CPUHP_AP_ARM_GLOBAL_TIMER_STARTING, |
| 121 | CPUHP_AP_JCORE_TIMER_STARTING, | 122 | CPUHP_AP_JCORE_TIMER_STARTING, |
| 122 | CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING, | ||
| 123 | CPUHP_AP_ARM_TWD_STARTING, | 123 | CPUHP_AP_ARM_TWD_STARTING, |
| 124 | CPUHP_AP_QCOM_TIMER_STARTING, | 124 | CPUHP_AP_QCOM_TIMER_STARTING, |
| 125 | CPUHP_AP_TEGRA_TIMER_STARTING, | 125 | CPUHP_AP_TEGRA_TIMER_STARTING, |
| @@ -176,6 +176,7 @@ enum cpuhp_state { | |||
| 176 | CPUHP_AP_WATCHDOG_ONLINE, | 176 | CPUHP_AP_WATCHDOG_ONLINE, |
| 177 | CPUHP_AP_WORKQUEUE_ONLINE, | 177 | CPUHP_AP_WORKQUEUE_ONLINE, |
| 178 | CPUHP_AP_RCUTREE_ONLINE, | 178 | CPUHP_AP_RCUTREE_ONLINE, |
| 179 | CPUHP_AP_BASE_CACHEINFO_ONLINE, | ||
| 179 | CPUHP_AP_ONLINE_DYN, | 180 | CPUHP_AP_ONLINE_DYN, |
| 180 | CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, | 181 | CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, |
| 181 | CPUHP_AP_X86_HPET_ONLINE, | 182 | CPUHP_AP_X86_HPET_ONLINE, |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 9cf8f3ce0e50..19ea3a371d7b 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
| @@ -49,7 +49,6 @@ | |||
| 49 | #define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b | 49 | #define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b |
| 50 | #define CRYPTO_ALG_TYPE_RNG 0x0000000c | 50 | #define CRYPTO_ALG_TYPE_RNG 0x0000000c |
| 51 | #define CRYPTO_ALG_TYPE_AKCIPHER 0x0000000d | 51 | #define CRYPTO_ALG_TYPE_AKCIPHER 0x0000000d |
| 52 | #define CRYPTO_ALG_TYPE_DIGEST 0x0000000e | ||
| 53 | #define CRYPTO_ALG_TYPE_HASH 0x0000000e | 52 | #define CRYPTO_ALG_TYPE_HASH 0x0000000e |
| 54 | #define CRYPTO_ALG_TYPE_SHASH 0x0000000e | 53 | #define CRYPTO_ALG_TYPE_SHASH 0x0000000e |
| 55 | #define CRYPTO_ALG_TYPE_AHASH 0x0000000f | 54 | #define CRYPTO_ALG_TYPE_AHASH 0x0000000f |
| @@ -323,6 +322,17 @@ struct cipher_alg { | |||
| 323 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | 322 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); |
| 324 | }; | 323 | }; |
| 325 | 324 | ||
| 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 | */ | ||
| 326 | struct compress_alg { | 336 | struct compress_alg { |
| 327 | int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src, | 337 | int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src, |
| 328 | unsigned int slen, u8 *dst, unsigned int *dlen); | 338 | unsigned int slen, u8 *dst, unsigned int *dlen); |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index f14e587c5d5d..5e0eadf7de55 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -153,7 +153,7 @@ struct dentry_operations { | |||
| 153 | * Locking rules for dentry_operations callbacks are to be found in | 153 | * Locking rules for dentry_operations callbacks are to be found in |
| 154 | * Documentation/filesystems/Locking. Keep it updated! | 154 | * Documentation/filesystems/Locking. Keep it updated! |
| 155 | * | 155 | * |
| 156 | * FUrther descriptions are found in Documentation/filesystems/vfs.txt. | 156 | * FUrther descriptions are found in Documentation/filesystems/vfs.rst. |
| 157 | * Keep it updated too! | 157 | * Keep it updated too! |
| 158 | */ | 158 | */ |
| 159 | 159 | ||
| @@ -568,7 +568,7 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper) | |||
| 568 | * If dentry is on a union/overlay, then return the underlying, real dentry. | 568 | * If dentry is on a union/overlay, then return the underlying, real dentry. |
| 569 | * Otherwise return the dentry itself. | 569 | * Otherwise return the dentry itself. |
| 570 | * | 570 | * |
| 571 | * See also: Documentation/filesystems/vfs.txt | 571 | * See also: Documentation/filesystems/vfs.rst |
| 572 | */ | 572 | */ |
| 573 | static inline struct dentry *d_real(struct dentry *dentry, | 573 | static inline struct dentry *d_real(struct dentry *dentry, |
| 574 | const struct inode *inode) | 574 | const struct inode *inode) |
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 3b0ba54cc4d5..58424eb3b329 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
| @@ -133,9 +133,8 @@ struct dentry *debugfs_create_regset32(const char *name, umode_t mode, | |||
| 133 | void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, | 133 | void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, |
| 134 | int nregs, void __iomem *base, char *prefix); | 134 | int nregs, void __iomem *base, char *prefix); |
| 135 | 135 | ||
| 136 | struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, | 136 | void debugfs_create_u32_array(const char *name, umode_t mode, |
| 137 | struct dentry *parent, | 137 | struct dentry *parent, u32 *array, u32 elements); |
| 138 | u32 *array, u32 elements); | ||
| 139 | 138 | ||
| 140 | struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name, | 139 | struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name, |
| 141 | struct dentry *parent, | 140 | struct dentry *parent, |
| @@ -353,11 +352,10 @@ static inline bool debugfs_initialized(void) | |||
| 353 | return false; | 352 | return false; |
| 354 | } | 353 | } |
| 355 | 354 | ||
| 356 | static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, | 355 | static inline void debugfs_create_u32_array(const char *name, umode_t mode, |
| 357 | struct dentry *parent, | 356 | struct dentry *parent, u32 *array, |
| 358 | u32 *array, u32 elements) | 357 | u32 elements) |
| 359 | { | 358 | { |
| 360 | return ERR_PTR(-ENODEV); | ||
| 361 | } | 359 | } |
| 362 | 360 | ||
| 363 | static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev, | 361 | static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev, |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index e1f51d607cc5..3b470cb03b66 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
| @@ -95,8 +95,7 @@ typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, struct block_device ** | |||
| 95 | 95 | ||
| 96 | typedef int (*dm_report_zones_fn) (struct dm_target *ti, sector_t sector, | 96 | typedef int (*dm_report_zones_fn) (struct dm_target *ti, sector_t sector, |
| 97 | struct blk_zone *zones, | 97 | struct blk_zone *zones, |
| 98 | unsigned int *nr_zones, | 98 | unsigned int *nr_zones); |
| 99 | gfp_t gfp_mask); | ||
| 100 | 99 | ||
| 101 | /* | 100 | /* |
| 102 | * These iteration functions are typically used to check (and combine) | 101 | * These iteration functions are typically used to check (and combine) |
diff --git a/include/linux/device.h b/include/linux/device.h index 4a295e324ac5..c330b75c6c57 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de> | 6 | * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de> |
| 7 | * Copyright (c) 2008-2009 Novell Inc. | 7 | * Copyright (c) 2008-2009 Novell Inc. |
| 8 | * | 8 | * |
| 9 | * See Documentation/driver-model/ for more information. | 9 | * See Documentation/driver-api/driver-model/ for more information. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #ifndef _DEVICE_H_ | 12 | #ifndef _DEVICE_H_ |
| @@ -42,6 +42,7 @@ struct iommu_ops; | |||
| 42 | struct iommu_group; | 42 | struct iommu_group; |
| 43 | struct iommu_fwspec; | 43 | struct iommu_fwspec; |
| 44 | struct dev_pin_info; | 44 | struct dev_pin_info; |
| 45 | struct iommu_param; | ||
| 45 | 46 | ||
| 46 | struct bus_attribute { | 47 | struct bus_attribute { |
| 47 | struct attribute attr; | 48 | struct attribute attr; |
| @@ -163,11 +164,13 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, | |||
| 163 | struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); | 164 | struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); |
| 164 | void subsys_dev_iter_exit(struct subsys_dev_iter *iter); | 165 | void subsys_dev_iter_exit(struct subsys_dev_iter *iter); |
| 165 | 166 | ||
| 167 | int device_match_of_node(struct device *dev, const void *np); | ||
| 168 | |||
| 166 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, | 169 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, |
| 167 | int (*fn)(struct device *dev, void *data)); | 170 | int (*fn)(struct device *dev, void *data)); |
| 168 | struct device *bus_find_device(struct bus_type *bus, struct device *start, | 171 | struct device *bus_find_device(struct bus_type *bus, struct device *start, |
| 169 | void *data, | 172 | const void *data, |
| 170 | int (*match)(struct device *dev, void *data)); | 173 | int (*match)(struct device *dev, const void *data)); |
| 171 | struct device *bus_find_device_by_name(struct bus_type *bus, | 174 | struct device *bus_find_device_by_name(struct bus_type *bus, |
| 172 | struct device *start, | 175 | struct device *start, |
| 173 | const char *name); | 176 | const char *name); |
| @@ -336,11 +339,12 @@ extern int __must_check driver_for_each_device(struct device_driver *drv, | |||
| 336 | int (*fn)(struct device *dev, | 339 | int (*fn)(struct device *dev, |
| 337 | void *)); | 340 | void *)); |
| 338 | struct device *driver_find_device(struct device_driver *drv, | 341 | struct device *driver_find_device(struct device_driver *drv, |
| 339 | struct device *start, void *data, | 342 | struct device *start, const void *data, |
| 340 | int (*match)(struct device *dev, void *data)); | 343 | int (*match)(struct device *dev, const void *data)); |
| 341 | 344 | ||
| 342 | void driver_deferred_probe_add(struct device *dev); | 345 | void driver_deferred_probe_add(struct device *dev); |
| 343 | int driver_deferred_probe_check_state(struct device *dev); | 346 | int driver_deferred_probe_check_state(struct device *dev); |
| 347 | int driver_deferred_probe_check_state_continue(struct device *dev); | ||
| 344 | 348 | ||
| 345 | /** | 349 | /** |
| 346 | * struct subsys_interface - interfaces to device functions | 350 | * struct subsys_interface - interfaces to device functions |
| @@ -961,6 +965,7 @@ struct dev_links_info { | |||
| 961 | * device (i.e. the bus driver that discovered the device). | 965 | * device (i.e. the bus driver that discovered the device). |
| 962 | * @iommu_group: IOMMU group the device belongs to. | 966 | * @iommu_group: IOMMU group the device belongs to. |
| 963 | * @iommu_fwspec: IOMMU-specific properties supplied by firmware. | 967 | * @iommu_fwspec: IOMMU-specific properties supplied by firmware. |
| 968 | * @iommu_param: Per device generic IOMMU runtime data | ||
| 964 | * | 969 | * |
| 965 | * @offline_disabled: If set, the device is permanently online. | 970 | * @offline_disabled: If set, the device is permanently online. |
| 966 | * @offline: Set after successful invocation of bus type's .offline(). | 971 | * @offline: Set after successful invocation of bus type's .offline(). |
| @@ -1054,6 +1059,7 @@ struct device { | |||
| 1054 | void (*release)(struct device *dev); | 1059 | void (*release)(struct device *dev); |
| 1055 | struct iommu_group *iommu_group; | 1060 | struct iommu_group *iommu_group; |
| 1056 | struct iommu_fwspec *iommu_fwspec; | 1061 | struct iommu_fwspec *iommu_fwspec; |
| 1062 | struct iommu_param *iommu_param; | ||
| 1057 | 1063 | ||
| 1058 | bool offline_disabled:1; | 1064 | bool offline_disabled:1; |
| 1059 | bool offline:1; | 1065 | bool offline:1; |
| @@ -1252,6 +1258,8 @@ extern int device_for_each_child_reverse(struct device *dev, void *data, | |||
| 1252 | int (*fn)(struct device *dev, void *data)); | 1258 | int (*fn)(struct device *dev, void *data)); |
| 1253 | extern struct device *device_find_child(struct device *dev, void *data, | 1259 | extern struct device *device_find_child(struct device *dev, void *data, |
| 1254 | int (*match)(struct device *dev, void *data)); | 1260 | int (*match)(struct device *dev, void *data)); |
| 1261 | extern struct device *device_find_child_by_name(struct device *parent, | ||
| 1262 | const char *name); | ||
| 1255 | extern int device_rename(struct device *dev, const char *new_name); | 1263 | extern int device_rename(struct device *dev, const char *new_name); |
| 1256 | extern int device_move(struct device *dev, struct device *new_parent, | 1264 | extern int device_move(struct device *dev, struct device *new_parent, |
| 1257 | enum dpm_order dpm_order); | 1265 | enum dpm_order dpm_order); |
diff --git a/include/linux/dim.h b/include/linux/dim.h new file mode 100644 index 000000000000..d3a0fbfff2bb --- /dev/null +++ b/include/linux/dim.h | |||
| @@ -0,0 +1,389 @@ | |||
| 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 profiles: | ||
| 277 | * There are different set of profiles for each CQ period mode. | ||
| 278 | * There are different set of profiles for RX/TX CQs. | ||
| 279 | * Each profile size must be of NET_DIM_PARAMS_NUM_PROFILES | ||
| 280 | */ | ||
| 281 | #define NET_DIM_PARAMS_NUM_PROFILES 5 | ||
| 282 | #define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 | ||
| 283 | #define NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE 128 | ||
| 284 | #define NET_DIM_DEF_PROFILE_CQE 1 | ||
| 285 | #define NET_DIM_DEF_PROFILE_EQE 1 | ||
| 286 | |||
| 287 | #define NET_DIM_RX_EQE_PROFILES { \ | ||
| 288 | {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 289 | {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 290 | {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 291 | {128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 292 | {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 293 | } | ||
| 294 | |||
| 295 | #define NET_DIM_RX_CQE_PROFILES { \ | ||
| 296 | {2, 256}, \ | ||
| 297 | {8, 128}, \ | ||
| 298 | {16, 64}, \ | ||
| 299 | {32, 64}, \ | ||
| 300 | {64, 64} \ | ||
| 301 | } | ||
| 302 | |||
| 303 | #define NET_DIM_TX_EQE_PROFILES { \ | ||
| 304 | {1, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 305 | {8, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 306 | {32, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 307 | {64, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 308 | {128, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE} \ | ||
| 309 | } | ||
| 310 | |||
| 311 | #define NET_DIM_TX_CQE_PROFILES { \ | ||
| 312 | {5, 128}, \ | ||
| 313 | {8, 64}, \ | ||
| 314 | {16, 32}, \ | ||
| 315 | {32, 32}, \ | ||
| 316 | {64, 32} \ | ||
| 317 | } | ||
| 318 | |||
| 319 | static const struct dim_cq_moder | ||
| 320 | rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { | ||
| 321 | NET_DIM_RX_EQE_PROFILES, | ||
| 322 | NET_DIM_RX_CQE_PROFILES, | ||
| 323 | }; | ||
| 324 | |||
| 325 | static const struct dim_cq_moder | ||
| 326 | tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { | ||
| 327 | NET_DIM_TX_EQE_PROFILES, | ||
| 328 | NET_DIM_TX_CQE_PROFILES, | ||
| 329 | }; | ||
| 330 | |||
| 331 | /** | ||
| 332 | * net_dim_get_rx_moderation - provide a CQ moderation object for the given RX profile | ||
| 333 | * @cq_period_mode: CQ period mode | ||
| 334 | * @ix: Profile index | ||
| 335 | */ | ||
| 336 | struct dim_cq_moder net_dim_get_rx_moderation(u8 cq_period_mode, int ix); | ||
| 337 | |||
| 338 | /** | ||
| 339 | * net_dim_get_def_rx_moderation - provide the default RX moderation | ||
| 340 | * @cq_period_mode: CQ period mode | ||
| 341 | */ | ||
| 342 | struct dim_cq_moder net_dim_get_def_rx_moderation(u8 cq_period_mode); | ||
| 343 | |||
| 344 | /** | ||
| 345 | * net_dim_get_tx_moderation - provide a CQ moderation object for the given TX profile | ||
| 346 | * @cq_period_mode: CQ period mode | ||
| 347 | * @ix: Profile index | ||
| 348 | */ | ||
| 349 | struct dim_cq_moder net_dim_get_tx_moderation(u8 cq_period_mode, int ix); | ||
| 350 | |||
| 351 | /** | ||
| 352 | * net_dim_get_def_tx_moderation - provide the default TX moderation | ||
| 353 | * @cq_period_mode: CQ period mode | ||
| 354 | */ | ||
| 355 | struct dim_cq_moder net_dim_get_def_tx_moderation(u8 cq_period_mode); | ||
| 356 | |||
| 357 | /** | ||
| 358 | * net_dim - main DIM algorithm entry point | ||
| 359 | * @dim: DIM instance information | ||
| 360 | * @end_sample: Current data measurement | ||
| 361 | * | ||
| 362 | * Called by the consumer. | ||
| 363 | * This is the main logic of the algorithm, where data is processed in order to decide on next | ||
| 364 | * required action. | ||
| 365 | */ | ||
| 366 | void net_dim(struct dim *dim, struct dim_sample end_sample); | ||
| 367 | |||
| 368 | /* RDMA DIM */ | ||
| 369 | |||
| 370 | /* | ||
| 371 | * RDMA DIM profile: | ||
| 372 | * profile size must be of RDMA_DIM_PARAMS_NUM_PROFILES. | ||
| 373 | */ | ||
| 374 | #define RDMA_DIM_PARAMS_NUM_PROFILES 9 | ||
| 375 | #define RDMA_DIM_START_PROFILE 0 | ||
| 376 | |||
| 377 | /** | ||
| 378 | * rdma_dim - Runs the adaptive moderation. | ||
| 379 | * @dim: The moderation struct. | ||
| 380 | * @completions: The number of completions collected in this round. | ||
| 381 | * | ||
| 382 | * Each call to rdma_dim takes the latest amount of completions that | ||
| 383 | * have been collected and counts them as a new event. | ||
| 384 | * Once enough events have been collected the algorithm decides a new | ||
| 385 | * moderation level. | ||
| 386 | */ | ||
| 387 | void rdma_dim(struct dim *dim, u64 completions); | ||
| 388 | |||
| 389 | #endif /* DIM_H */ | ||
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 9b84114f74ce..bae060fae862 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
| @@ -28,19 +28,21 @@ struct dma_buf_attachment; | |||
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | * struct dma_buf_ops - operations possible on struct dma_buf | 30 | * 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. | ||
| 38 | * @vmap: [optional] creates a virtual mapping for the buffer into kernel | 31 | * @vmap: [optional] creates a virtual mapping for the buffer into kernel |
| 39 | * address space. Same restrictions as for vmap and friends apply. | 32 | * address space. Same restrictions as for vmap and friends apply. |
| 40 | * @vunmap: [optional] unmaps a vmap from the buffer | 33 | * @vunmap: [optional] unmaps a vmap from the buffer |
| 41 | */ | 34 | */ |
| 42 | struct dma_buf_ops { | 35 | struct dma_buf_ops { |
| 43 | /** | 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 | |||
| 45 | /** | ||
| 44 | * @attach: | 46 | * @attach: |
| 45 | * | 47 | * |
| 46 | * This is called from dma_buf_attach() to make sure that a given | 48 | * This is called from dma_buf_attach() to make sure that a given |
| @@ -194,8 +196,6 @@ struct dma_buf_ops { | |||
| 194 | * to be restarted. | 196 | * to be restarted. |
| 195 | */ | 197 | */ |
| 196 | int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); | 198 | 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 *); | ||
| 199 | 199 | ||
| 200 | /** | 200 | /** |
| 201 | * @mmap: | 201 | * @mmap: |
| @@ -234,6 +234,31 @@ struct dma_buf_ops { | |||
| 234 | */ | 234 | */ |
| 235 | int (*mmap)(struct dma_buf *, struct vm_area_struct *vma); | 235 | int (*mmap)(struct dma_buf *, struct vm_area_struct *vma); |
| 236 | 236 | ||
| 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 | |||
| 237 | void *(*vmap)(struct dma_buf *); | 262 | void *(*vmap)(struct dma_buf *); |
| 238 | void (*vunmap)(struct dma_buf *, void *vaddr); | 263 | void (*vunmap)(struct dma_buf *, void *vaddr); |
| 239 | }; | 264 | }; |
| @@ -244,10 +269,12 @@ struct dma_buf_ops { | |||
| 244 | * @file: file pointer used for sharing buffers across, and for refcounting. | 269 | * @file: file pointer used for sharing buffers across, and for refcounting. |
| 245 | * @attachments: list of dma_buf_attachment that denotes all devices attached. | 270 | * @attachments: list of dma_buf_attachment that denotes all devices attached. |
| 246 | * @ops: dma_buf_ops associated with this buffer object. | 271 | * @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 | ||
| 248 | * @vmapping_counter: used internally to refcnt the vmaps | 274 | * @vmapping_counter: used internally to refcnt the vmaps |
| 249 | * @vmap_ptr: the current vmap ptr if vmapping_counter > 0 | 275 | * @vmap_ptr: the current vmap ptr if vmapping_counter > 0 |
| 250 | * @exp_name: name of the exporter; useful for debugging. | 276 | * @exp_name: name of the exporter; useful for debugging. |
| 277 | * @name: userspace-provided name; useful for accounting and debugging. | ||
| 251 | * @owner: pointer to exporter module; used for refcounting when exporter is a | 278 | * @owner: pointer to exporter module; used for refcounting when exporter is a |
| 252 | * kernel module. | 279 | * kernel module. |
| 253 | * @list_node: node for dma_buf accounting and debugging. | 280 | * @list_node: node for dma_buf accounting and debugging. |
| @@ -275,6 +302,7 @@ struct dma_buf { | |||
| 275 | unsigned vmapping_counter; | 302 | unsigned vmapping_counter; |
| 276 | void *vmap_ptr; | 303 | void *vmap_ptr; |
| 277 | const char *exp_name; | 304 | const char *exp_name; |
| 305 | const char *name; | ||
| 278 | struct module *owner; | 306 | struct module *owner; |
| 279 | struct list_head list_node; | 307 | struct list_head list_node; |
| 280 | void *priv; | 308 | void *priv; |
| @@ -296,6 +324,8 @@ struct dma_buf { | |||
| 296 | * @dmabuf: buffer for this attachment. | 324 | * @dmabuf: buffer for this attachment. |
| 297 | * @dev: device attached to the buffer. | 325 | * @dev: device attached to the buffer. |
| 298 | * @node: list of dma_buf_attachment. | 326 | * @node: list of dma_buf_attachment. |
| 327 | * @sgt: cached mapping. | ||
| 328 | * @dir: direction of cached mapping. | ||
| 299 | * @priv: exporter specific attachment data. | 329 | * @priv: exporter specific attachment data. |
| 300 | * | 330 | * |
| 301 | * This structure holds the attachment information between the dma_buf buffer | 331 | * This structure holds the attachment information between the dma_buf buffer |
| @@ -311,6 +341,8 @@ struct dma_buf_attachment { | |||
| 311 | struct dma_buf *dmabuf; | 341 | struct dma_buf *dmabuf; |
| 312 | struct device *dev; | 342 | struct device *dev; |
| 313 | struct list_head node; | 343 | struct list_head node; |
| 344 | struct sg_table *sgt; | ||
| 345 | enum dma_data_direction dir; | ||
| 314 | void *priv; | 346 | void *priv; |
| 315 | }; | 347 | }; |
| 316 | 348 | ||
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h index 6665fa03c0d1..c05d4e661489 100644 --- a/include/linux/dma-contiguous.h +++ b/include/linux/dma-contiguous.h | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #ifdef __KERNEL__ | 50 | #ifdef __KERNEL__ |
| 51 | 51 | ||
| 52 | #include <linux/device.h> | 52 | #include <linux/device.h> |
| 53 | #include <linux/mm.h> | ||
| 53 | 54 | ||
| 54 | struct cma; | 55 | struct cma; |
| 55 | struct page; | 56 | struct page; |
| @@ -111,6 +112,8 @@ struct page *dma_alloc_from_contiguous(struct device *dev, size_t count, | |||
| 111 | unsigned int order, bool no_warn); | 112 | unsigned int order, bool no_warn); |
| 112 | bool dma_release_from_contiguous(struct device *dev, struct page *pages, | 113 | bool dma_release_from_contiguous(struct device *dev, struct page *pages, |
| 113 | int count); | 114 | 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); | ||
| 114 | 117 | ||
| 115 | #else | 118 | #else |
| 116 | 119 | ||
| @@ -153,6 +156,22 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, | |||
| 153 | return false; | 156 | return false; |
| 154 | } | 157 | } |
| 155 | 158 | ||
| 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 | |||
| 156 | #endif | 175 | #endif |
| 157 | 176 | ||
| 158 | #endif | 177 | #endif |
diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h index 37258c8b2063..2112f21f73d8 100644 --- a/include/linux/dma-iommu.h +++ b/include/linux/dma-iommu.h | |||
| @@ -5,59 +5,21 @@ | |||
| 5 | #ifndef __DMA_IOMMU_H | 5 | #ifndef __DMA_IOMMU_H |
| 6 | #define __DMA_IOMMU_H | 6 | #define __DMA_IOMMU_H |
| 7 | 7 | ||
| 8 | #ifdef __KERNEL__ | 8 | #include <linux/errno.h> |
| 9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 10 | #include <asm/errno.h> | ||
| 11 | 10 | ||
| 12 | #ifdef CONFIG_IOMMU_DMA | 11 | #ifdef CONFIG_IOMMU_DMA |
| 13 | #include <linux/dma-mapping.h> | 12 | #include <linux/dma-mapping.h> |
| 14 | #include <linux/iommu.h> | 13 | #include <linux/iommu.h> |
| 15 | #include <linux/msi.h> | 14 | #include <linux/msi.h> |
| 16 | 15 | ||
| 17 | int iommu_dma_init(void); | ||
| 18 | |||
| 19 | /* Domain management interface for IOMMU drivers */ | 16 | /* Domain management interface for IOMMU drivers */ |
| 20 | int iommu_get_dma_cookie(struct iommu_domain *domain); | 17 | int iommu_get_dma_cookie(struct iommu_domain *domain); |
| 21 | int iommu_get_msi_cookie(struct iommu_domain *domain, dma_addr_t base); | 18 | int iommu_get_msi_cookie(struct iommu_domain *domain, dma_addr_t base); |
| 22 | void iommu_put_dma_cookie(struct iommu_domain *domain); | 19 | void iommu_put_dma_cookie(struct iommu_domain *domain); |
| 23 | 20 | ||
| 24 | /* Setup call for arch DMA mapping code */ | 21 | /* Setup call for arch DMA mapping code */ |
| 25 | int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base, | 22 | void iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size); |
| 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); | ||
| 61 | 23 | ||
| 62 | /* The DMA API isn't _quite_ the whole story, though... */ | 24 | /* The DMA API isn't _quite_ the whole story, though... */ |
| 63 | /* | 25 | /* |
| @@ -75,16 +37,16 @@ void iommu_dma_compose_msi_msg(struct msi_desc *desc, | |||
| 75 | 37 | ||
| 76 | void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); | 38 | void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); |
| 77 | 39 | ||
| 78 | #else | 40 | #else /* CONFIG_IOMMU_DMA */ |
| 79 | 41 | ||
| 80 | struct iommu_domain; | 42 | struct iommu_domain; |
| 81 | struct msi_desc; | 43 | struct msi_desc; |
| 82 | struct msi_msg; | 44 | struct msi_msg; |
| 83 | struct device; | 45 | struct device; |
| 84 | 46 | ||
| 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) | ||
| 86 | { | 49 | { |
| 87 | return 0; | ||
| 88 | } | 50 | } |
| 89 | 51 | ||
| 90 | static inline int iommu_get_dma_cookie(struct iommu_domain *domain) | 52 | 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 | |||
| 117 | } | 79 | } |
| 118 | 80 | ||
| 119 | #endif /* CONFIG_IOMMU_DMA */ | 81 | #endif /* CONFIG_IOMMU_DMA */ |
| 120 | #endif /* __KERNEL__ */ | ||
| 121 | #endif /* __DMA_IOMMU_H */ | 82 | #endif /* __DMA_IOMMU_H */ |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 6309a721394b..8d13e28a8e07 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
| @@ -729,13 +729,6 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) | |||
| 729 | return -EIO; | 729 | return -EIO; |
| 730 | } | 730 | } |
| 731 | 731 | ||
| 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 | |||
| 739 | static inline int dma_get_cache_alignment(void) | 732 | static inline int dma_get_cache_alignment(void) |
| 740 | { | 733 | { |
| 741 | #ifdef ARCH_DMA_MINALIGN | 734 | #ifdef ARCH_DMA_MINALIGN |
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h index 9741767e400f..3813211a9aad 100644 --- a/include/linux/dma-noncoherent.h +++ b/include/linux/dma-noncoherent.h | |||
| @@ -20,6 +20,22 @@ static inline bool dev_is_dma_coherent(struct device *dev) | |||
| 20 | } | 20 | } |
| 21 | #endif /* CONFIG_ARCH_HAS_DMA_COHERENCE_H */ | 21 | #endif /* CONFIG_ARCH_HAS_DMA_COHERENCE_H */ |
| 22 | 22 | ||
| 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 | |||
| 23 | void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, | 39 | void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, |
| 24 | gfp_t gfp, unsigned long attrs); | 40 | gfp_t gfp, unsigned long attrs); |
| 25 | void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, | 41 | 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) | |||
| 80 | } | 96 | } |
| 81 | #endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */ | 97 | #endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */ |
| 82 | 98 | ||
| 99 | void *uncached_kernel_address(void *addr); | ||
| 100 | void *cached_kernel_address(void *addr); | ||
| 101 | |||
| 83 | #endif /* _LINUX_DMA_NONCOHERENT_H */ | 102 | #endif /* _LINUX_DMA_NONCOHERENT_H */ |
diff --git a/include/linux/dma/mxs-dma.h b/include/linux/dma/mxs-dma.h new file mode 100644 index 000000000000..069d9f5a609e --- /dev/null +++ b/include/linux/dma/mxs-dma.h | |||
| @@ -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_ */ | ||
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 28813c6f44b6..a7cf3599d9a1 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
| @@ -92,12 +92,14 @@ static inline bool dmar_rcu_check(void) | |||
| 92 | 92 | ||
| 93 | #define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check()) | 93 | #define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check()) |
| 94 | 94 | ||
| 95 | #define for_each_dev_scope(a, c, p, d) \ | 95 | #define for_each_dev_scope(devs, cnt, i, tmp) \ |
| 96 | for ((p) = 0; ((d) = (p) < (c) ? dmar_rcu_dereference((a)[(p)].dev) : \ | 96 | for ((i) = 0; ((tmp) = (i) < (cnt) ? \ |
| 97 | NULL, (p) < (c)); (p)++) | 97 | dmar_rcu_dereference((devs)[(i)].dev) : NULL, (i) < (cnt)); \ |
| 98 | 98 | (i)++) | |
| 99 | #define for_each_active_dev_scope(a, c, p, d) \ | 99 | |
| 100 | for_each_dev_scope((a), (c), (p), (d)) if (!(d)) { continue; } else | 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 | ||
| 101 | 103 | ||
| 102 | extern int dmar_table_init(void); | 104 | extern int dmar_table_init(void); |
| 103 | extern int dmar_dev_scope_init(void); | 105 | extern int dmar_dev_scope_init(void); |
diff --git a/include/linux/dns_resolver.h b/include/linux/dns_resolver.h index f2b3ae22e6b7..976cbbdb2832 100644 --- a/include/linux/dns_resolver.h +++ b/include/linux/dns_resolver.h | |||
| @@ -26,7 +26,8 @@ | |||
| 26 | 26 | ||
| 27 | #include <uapi/linux/dns_resolver.h> | 27 | #include <uapi/linux/dns_resolver.h> |
| 28 | 28 | ||
| 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, | ||
| 30 | const char *options, char **_result, time64_t *_expiry, | 31 | const char *options, char **_result, time64_t *_expiry, |
| 31 | bool invalidate); | 32 | bool invalidate); |
| 32 | 33 | ||
diff --git a/include/linux/dsa/8021q.h b/include/linux/dsa/8021q.h index 3911e0586478..0aa803c451a3 100644 --- a/include/linux/dsa/8021q.h +++ b/include/linux/dsa/8021q.h | |||
| @@ -20,9 +20,6 @@ int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, | |||
| 20 | struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, | 20 | struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, |
| 21 | u16 tpid, u16 tci); | 21 | u16 tpid, u16 tci); |
| 22 | 22 | ||
| 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 | |||
| 26 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port); | 23 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port); |
| 27 | 24 | ||
| 28 | u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port); | 25 | u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port); |
| @@ -31,6 +28,8 @@ int dsa_8021q_rx_switch_id(u16 vid); | |||
| 31 | 28 | ||
| 32 | int dsa_8021q_rx_source_port(u16 vid); | 29 | int dsa_8021q_rx_source_port(u16 vid); |
| 33 | 30 | ||
| 31 | struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb); | ||
| 32 | |||
| 34 | #else | 33 | #else |
| 35 | 34 | ||
| 36 | int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, | 35 | 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, | |||
| 45 | return NULL; | 44 | return NULL; |
| 46 | } | 45 | } |
| 47 | 46 | ||
| 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 | |||
| 54 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port) | 47 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port) |
| 55 | { | 48 | { |
| 56 | return 0; | 49 | return 0; |
| @@ -71,6 +64,11 @@ int dsa_8021q_rx_source_port(u16 vid) | |||
| 71 | return 0; | 64 | return 0; |
| 72 | } | 65 | } |
| 73 | 66 | ||
| 67 | struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb) | ||
| 68 | { | ||
| 69 | return NULL; | ||
| 70 | } | ||
| 71 | |||
| 74 | #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */ | 72 | #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */ |
| 75 | 73 | ||
| 76 | #endif /* _NET_DSA_8021Q_H */ | 74 | #endif /* _NET_DSA_8021Q_H */ |
diff --git a/include/linux/dsa/sja1105.h b/include/linux/dsa/sja1105.h index e46e18c47d41..79435cfc20eb 100644 --- a/include/linux/dsa/sja1105.h +++ b/include/linux/dsa/sja1105.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <net/dsa.h> | 12 | #include <net/dsa.h> |
| 13 | 13 | ||
| 14 | #define ETH_P_SJA1105 ETH_P_DSA_8021Q | 14 | #define ETH_P_SJA1105 ETH_P_DSA_8021Q |
| 15 | #define ETH_P_SJA1105_META 0x0008 | ||
| 15 | 16 | ||
| 16 | /* IEEE 802.3 Annex 57A: Slow Protocols PDUs (01:80:C2:xx:xx:xx) */ | 17 | /* IEEE 802.3 Annex 57A: Slow Protocols PDUs (01:80:C2:xx:xx:xx) */ |
| 17 | #define SJA1105_LINKLOCAL_FILTER_A 0x0180C2000000ull | 18 | #define SJA1105_LINKLOCAL_FILTER_A 0x0180C2000000ull |
| @@ -20,8 +21,41 @@ | |||
| 20 | #define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull | 21 | #define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull |
| 21 | #define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull | 22 | #define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull |
| 22 | 23 | ||
| 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 | |||
| 23 | struct sja1105_port { | 55 | struct sja1105_port { |
| 56 | struct sja1105_tagger_data *data; | ||
| 24 | struct dsa_port *dp; | 57 | struct dsa_port *dp; |
| 58 | bool hwts_tx_en; | ||
| 25 | int mgmt_slot; | 59 | int mgmt_slot; |
| 26 | }; | 60 | }; |
| 27 | 61 | ||
diff --git a/include/linux/efi.h b/include/linux/efi.h index 6ebc2098cfe1..f87fabea4a85 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -689,6 +689,7 @@ void efi_native_runtime_setup(void); | |||
| 689 | #define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f) | 689 | #define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f) |
| 690 | #define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b) | 690 | #define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b) |
| 691 | #define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa) | 691 | #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) | ||
| 692 | #define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2) | 693 | #define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2) |
| 693 | 694 | ||
| 694 | typedef struct { | 695 | typedef struct { |
| @@ -996,6 +997,7 @@ extern struct efi { | |||
| 996 | unsigned long mem_attr_table; /* memory attributes table */ | 997 | unsigned long mem_attr_table; /* memory attributes table */ |
| 997 | unsigned long rng_seed; /* UEFI firmware random seed */ | 998 | unsigned long rng_seed; /* UEFI firmware random seed */ |
| 998 | unsigned long tpm_log; /* TPM2 Event Log table */ | 999 | unsigned long tpm_log; /* TPM2 Event Log table */ |
| 1000 | unsigned long tpm_final_log; /* TPM2 Final Events Log table */ | ||
| 999 | unsigned long mem_reserve; /* Linux EFI memreserve table */ | 1001 | unsigned long mem_reserve; /* Linux EFI memreserve table */ |
| 1000 | efi_get_time_t *get_time; | 1002 | efi_get_time_t *get_time; |
| 1001 | efi_set_time_t *set_time; | 1003 | efi_set_time_t *set_time; |
| @@ -1706,12 +1708,20 @@ struct linux_efi_random_seed { | |||
| 1706 | 1708 | ||
| 1707 | struct linux_efi_tpm_eventlog { | 1709 | struct linux_efi_tpm_eventlog { |
| 1708 | u32 size; | 1710 | u32 size; |
| 1711 | u32 final_events_preboot_size; | ||
| 1709 | u8 version; | 1712 | u8 version; |
| 1710 | u8 log[]; | 1713 | u8 log[]; |
| 1711 | }; | 1714 | }; |
| 1712 | 1715 | ||
| 1713 | extern int efi_tpm_eventlog_init(void); | 1716 | extern int efi_tpm_eventlog_init(void); |
| 1714 | 1717 | ||
| 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 | |||
| 1715 | /* | 1725 | /* |
| 1716 | * efi_runtime_service() function identifiers. | 1726 | * efi_runtime_service() function identifiers. |
| 1717 | * "NONE" is used by efi_recover_from_page_fault() to check if the page | 1727 | * "NONE" is used by efi_recover_from_page_fault() to check if the page |
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 6e8bc53740f0..17cd0078377c 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
| @@ -34,7 +34,7 @@ struct elevator_mq_ops { | |||
| 34 | void (*depth_updated)(struct blk_mq_hw_ctx *); | 34 | void (*depth_updated)(struct blk_mq_hw_ctx *); |
| 35 | 35 | ||
| 36 | bool (*allow_merge)(struct request_queue *, struct request *, struct bio *); | 36 | 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); |
| 38 | int (*request_merge)(struct request_queue *q, struct request **, struct bio *); | 38 | int (*request_merge)(struct request_queue *q, struct request **, struct bio *); |
| 39 | void (*request_merged)(struct request_queue *, struct request *, enum elv_merge); | 39 | void (*request_merged)(struct request_queue *, struct request *, enum elv_merge); |
| 40 | void (*requests_merged)(struct request_queue *, struct request *, struct request *); | 40 | void (*requests_merged)(struct request_queue *, struct request *, struct request *); |
| @@ -75,7 +75,7 @@ struct elevator_type | |||
| 75 | size_t icq_size; /* see iocontext.h */ | 75 | size_t icq_size; /* see iocontext.h */ |
| 76 | size_t icq_align; /* ditto */ | 76 | size_t icq_align; /* ditto */ |
| 77 | struct elv_fs_entry *elevator_attrs; | 77 | struct elv_fs_entry *elevator_attrs; |
| 78 | char elevator_name[ELV_NAME_MAX]; | 78 | const char *elevator_name; |
| 79 | const char *elevator_alias; | 79 | const char *elevator_alias; |
| 80 | struct module *elevator_owner; | 80 | struct module *elevator_owner; |
| 81 | #ifdef CONFIG_BLK_DEBUG_FS | 81 | #ifdef CONFIG_BLK_DEBUG_FS |
| @@ -160,15 +160,6 @@ extern struct request *elv_rb_find(struct rb_root *, sector_t); | |||
| 160 | #define ELEVATOR_INSERT_FLUSH 5 | 160 | #define ELEVATOR_INSERT_FLUSH 5 |
| 161 | #define ELEVATOR_INSERT_SORT_MERGE 6 | 161 | #define ELEVATOR_INSERT_SORT_MERGE 6 |
| 162 | 162 | ||
| 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 | |||
| 172 | #define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq)) | 163 | #define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq)) |
| 173 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) | 164 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) |
| 174 | 165 | ||
diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h index aa027f7bcb3e..73f8c3cb9588 100644 --- a/include/linux/energy_model.h +++ b/include/linux/energy_model.h | |||
| @@ -89,7 +89,7 @@ static inline unsigned long em_pd_energy(struct em_perf_domain *pd, | |||
| 89 | * like schedutil. | 89 | * like schedutil. |
| 90 | */ | 90 | */ |
| 91 | cpu = cpumask_first(to_cpumask(pd->cpus)); | 91 | cpu = cpumask_first(to_cpumask(pd->cpus)); |
| 92 | scale_cpu = arch_scale_cpu_capacity(NULL, cpu); | 92 | scale_cpu = arch_scale_cpu_capacity(cpu); |
| 93 | cs = &pd->table[pd->nr_cap_states - 1]; | 93 | cs = &pd->table[pd->nr_cap_states - 1]; |
| 94 | freq = map_util_freq(max_util, cs->frequency, scale_cpu); | 94 | freq = map_util_freq(max_util, cs->frequency, scale_cpu); |
| 95 | 95 | ||
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h index 7e6c77740413..e525f6957c49 100644 --- a/include/linux/fault-inject.h +++ b/include/linux/fault-inject.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | /* | 12 | /* |
| 13 | * For explanation of the elements of this struct, see | 13 | * For explanation of the elements of this struct, see |
| 14 | * Documentation/fault-injection/fault-injection.txt | 14 | * Documentation/fault-injection/fault-injection.rst |
| 15 | */ | 15 | */ |
| 16 | struct fault_attr { | 16 | struct fault_attr { |
| 17 | unsigned long probability; | 17 | unsigned long probability; |
diff --git a/include/linux/fb.h b/include/linux/fb.h index f52ef0ad6781..303771264644 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -126,39 +126,15 @@ struct fb_cursor_user { | |||
| 126 | 126 | ||
| 127 | /* The resolution of the passed in fb_info about to change */ | 127 | /* The resolution of the passed in fb_info about to change */ |
| 128 | #define FB_EVENT_MODE_CHANGE 0x01 | 128 | #define FB_EVENT_MODE_CHANGE 0x01 |
| 129 | /* The display on this fb_info is being suspended, no access to the | 129 | |
| 130 | * framebuffer is allowed any more after that call returns | 130 | #ifdef CONFIG_GUMSTIX_AM200EPD |
| 131 | */ | 131 | /* only used by mach-pxa/am200epd.c */ |
| 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 */ | ||
| 140 | #define FB_EVENT_FB_REGISTERED 0x05 | 132 | #define FB_EVENT_FB_REGISTERED 0x05 |
| 141 | /* A driver unregistered itself */ | ||
| 142 | #define FB_EVENT_FB_UNREGISTERED 0x06 | 133 | #define FB_EVENT_FB_UNREGISTERED 0x06 |
| 143 | /* CONSOLE-SPECIFIC: get console to framebuffer mapping */ | 134 | #endif |
| 144 | #define FB_EVENT_GET_CONSOLE_MAP 0x07 | 135 | |
| 145 | /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ | 136 | /* A display blank is requested */ |
| 146 | #define FB_EVENT_SET_CONSOLE_MAP 0x08 | ||
| 147 | /* A hardware display blank change occurred */ | ||
| 148 | #define FB_EVENT_BLANK 0x09 | 137 | #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 | ||
| 162 | /* A hardware display blank early change occurred */ | 138 | /* A hardware display blank early change occurred */ |
| 163 | #define FB_EARLY_EVENT_BLANK 0x10 | 139 | #define FB_EARLY_EVENT_BLANK 0x10 |
| 164 | /* A hardware display blank revert early change occurred */ | 140 | /* 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, | |||
| 633 | 609 | ||
| 634 | /* drivers/video/fbmem.c */ | 610 | /* drivers/video/fbmem.c */ |
| 635 | extern int register_framebuffer(struct fb_info *fb_info); | 611 | extern int register_framebuffer(struct fb_info *fb_info); |
| 636 | extern int unregister_framebuffer(struct fb_info *fb_info); | 612 | extern void unregister_framebuffer(struct fb_info *fb_info); |
| 637 | extern int unlink_framebuffer(struct fb_info *fb_info); | 613 | extern void unlink_framebuffer(struct fb_info *fb_info); |
| 638 | extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, | 614 | extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, |
| 639 | const char *name); | 615 | const char *name); |
| 640 | extern int remove_conflicting_framebuffers(struct apertures_struct *a, | 616 | extern int remove_conflicting_framebuffers(struct apertures_struct *a, |
| @@ -660,7 +636,10 @@ extern struct class *fb_class; | |||
| 660 | for (i = 0; i < FB_MAX; i++) \ | 636 | for (i = 0; i < FB_MAX; i++) \ |
| 661 | if (!registered_fb[i]) {} else | 637 | if (!registered_fb[i]) {} else |
| 662 | 638 | ||
| 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 | } | ||
| 664 | 643 | ||
| 665 | static inline void unlock_fb_info(struct fb_info *info) | 644 | static inline void unlock_fb_info(struct fb_info *info) |
| 666 | { | 645 | { |
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index f68a7db14165..ff5596dd30f8 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h | |||
| @@ -4,9 +4,39 @@ | |||
| 4 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE | 4 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE |
| 5 | void __init fb_console_init(void); | 5 | void __init fb_console_init(void); |
| 6 | void __exit fb_console_exit(void); | 6 | 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); | ||
| 7 | #else | 22 | #else |
| 8 | static inline void fb_console_init(void) {} | 23 | static inline void fb_console_init(void) {} |
| 9 | static inline void fb_console_exit(void) {} | 24 | 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; } | ||
| 10 | #endif | 40 | #endif |
| 11 | 41 | ||
| 12 | #endif /* _LINUX_FBCON_H */ | 42 | #endif /* _LINUX_FBCON_H */ |
diff --git a/include/linux/filter.h b/include/linux/filter.h index 7148bab96943..6d944369ca87 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
| @@ -160,6 +160,20 @@ struct ctl_table_header; | |||
| 160 | .off = 0, \ | 160 | .off = 0, \ |
| 161 | .imm = IMM }) | 161 | .imm = IMM }) |
| 162 | 162 | ||
| 163 | /* Special form of mov32, used for doing explicit zero extension on dst. */ | ||
| 164 | #define BPF_ZEXT_REG(DST) \ | ||
| 165 | ((struct bpf_insn) { \ | ||
| 166 | .code = BPF_ALU | BPF_MOV | BPF_X, \ | ||
| 167 | .dst_reg = DST, \ | ||
| 168 | .src_reg = DST, \ | ||
| 169 | .off = 0, \ | ||
| 170 | .imm = 1 }) | ||
| 171 | |||
| 172 | static inline bool insn_is_zext(const struct bpf_insn *insn) | ||
| 173 | { | ||
| 174 | return insn->code == (BPF_ALU | BPF_MOV | BPF_X) && insn->imm == 1; | ||
| 175 | } | ||
| 176 | |||
| 163 | /* BPF_LD_IMM64 macro encodes single 'load 64-bit immediate' insn */ | 177 | /* BPF_LD_IMM64 macro encodes single 'load 64-bit immediate' insn */ |
| 164 | #define BPF_LD_IMM64(DST, IMM) \ | 178 | #define BPF_LD_IMM64(DST, IMM) \ |
| 165 | BPF_LD_IMM64_RAW(DST, 0, IMM) | 179 | BPF_LD_IMM64_RAW(DST, 0, IMM) |
| @@ -512,7 +526,8 @@ struct bpf_prog { | |||
| 512 | blinded:1, /* Was blinded */ | 526 | blinded:1, /* Was blinded */ |
| 513 | is_func:1, /* program is a bpf function */ | 527 | is_func:1, /* program is a bpf function */ |
| 514 | kprobe_override:1, /* Do we override a kprobe? */ | 528 | kprobe_override:1, /* Do we override a kprobe? */ |
| 515 | has_callchain_buf:1; /* callchain buffer allocated? */ | 529 | has_callchain_buf:1, /* callchain buffer allocated? */ |
| 530 | enforce_expected_attach_type:1; /* Enforce expected_attach_type checking at attach time */ | ||
| 516 | enum bpf_prog_type type; /* Type of BPF program */ | 531 | enum bpf_prog_type type; /* Type of BPF program */ |
| 517 | enum bpf_attach_type expected_attach_type; /* For some prog types */ | 532 | enum bpf_attach_type expected_attach_type; /* For some prog types */ |
| 518 | u32 len; /* Number of filter blocks */ | 533 | u32 len; /* Number of filter blocks */ |
| @@ -563,8 +578,9 @@ struct bpf_skb_data_end { | |||
| 563 | }; | 578 | }; |
| 564 | 579 | ||
| 565 | struct bpf_redirect_info { | 580 | struct bpf_redirect_info { |
| 566 | u32 ifindex; | ||
| 567 | u32 flags; | 581 | u32 flags; |
| 582 | u32 tgt_index; | ||
| 583 | void *tgt_value; | ||
| 568 | struct bpf_map *map; | 584 | struct bpf_map *map; |
| 569 | struct bpf_map *map_to_flush; | 585 | struct bpf_map *map_to_flush; |
| 570 | u32 kern_flags; | 586 | u32 kern_flags; |
| @@ -731,6 +747,12 @@ bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default) | |||
| 731 | return size <= size_default && (size & (size - 1)) == 0; | 747 | return size <= size_default && (size & (size - 1)) == 0; |
| 732 | } | 748 | } |
| 733 | 749 | ||
| 750 | #define bpf_ctx_wide_store_ok(off, size, type, field) \ | ||
| 751 | (size == sizeof(__u64) && \ | ||
| 752 | off >= offsetof(type, field) && \ | ||
| 753 | off + sizeof(__u64) <= offsetofend(type, field) && \ | ||
| 754 | off % sizeof(__u64) == 0) | ||
| 755 | |||
| 734 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) | 756 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) |
| 735 | 757 | ||
| 736 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) | 758 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) |
| @@ -811,6 +833,7 @@ u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); | |||
| 811 | 833 | ||
| 812 | struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog); | 834 | struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog); |
| 813 | void bpf_jit_compile(struct bpf_prog *prog); | 835 | void bpf_jit_compile(struct bpf_prog *prog); |
| 836 | bool bpf_jit_needs_zext(void); | ||
| 814 | bool bpf_helper_changes_pkt_data(void *func); | 837 | bool bpf_helper_changes_pkt_data(void *func); |
| 815 | 838 | ||
| 816 | static inline bool bpf_dump_raw_ok(void) | 839 | static inline bool bpf_dump_raw_ok(void) |
| @@ -1183,4 +1206,14 @@ struct bpf_sysctl_kern { | |||
| 1183 | u64 tmp_reg; | 1206 | u64 tmp_reg; |
| 1184 | }; | 1207 | }; |
| 1185 | 1208 | ||
| 1209 | struct bpf_sockopt_kern { | ||
| 1210 | struct sock *sk; | ||
| 1211 | u8 *optval; | ||
| 1212 | u8 *optval_end; | ||
| 1213 | s32 level; | ||
| 1214 | s32 optname; | ||
| 1215 | s32 optlen; | ||
| 1216 | s32 retval; | ||
| 1217 | }; | ||
| 1218 | |||
| 1186 | #endif /* __LINUX_FILTER_H__ */ | 1219 | #endif /* __LINUX_FILTER_H__ */ |
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 1262ea6a1f4b..778abbbc7d94 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h | |||
| @@ -46,7 +46,6 @@ | |||
| 46 | #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U | 46 | #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U |
| 47 | #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U | 47 | #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U |
| 48 | #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U | 48 | #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U |
| 49 | #define ZYNQMP_PM_CAPABILITY_POWER 0x8U | ||
| 50 | 49 | ||
| 51 | /* | 50 | /* |
| 52 | * Firmware FPGA Manager flags | 51 | * Firmware FPGA Manager flags |
diff --git a/include/linux/flat.h b/include/linux/flat.h index 569b67d64d5c..83977c0ce3de 100644 --- a/include/linux/flat.h +++ b/include/linux/flat.h | |||
| @@ -10,8 +10,41 @@ | |||
| 10 | #ifndef _LINUX_FLAT_H | 10 | #ifndef _LINUX_FLAT_H |
| 11 | #define _LINUX_FLAT_H | 11 | #define _LINUX_FLAT_H |
| 12 | 12 | ||
| 13 | #include <uapi/linux/flat.h> | 13 | #define FLAT_VERSION 0x00000004L |
| 14 | #include <asm/flat.h> | 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 */ | ||
| 15 | 48 | ||
| 16 | /* | 49 | /* |
| 17 | * While it would be nice to keep this header clean, users of older | 50 | * While it would be nice to keep this header clean, users of older |
| @@ -22,28 +55,21 @@ | |||
| 22 | * with the format above, except to fix bugs with old format support. | 55 | * with the format above, except to fix bugs with old format support. |
| 23 | */ | 56 | */ |
| 24 | 57 | ||
| 25 | #include <asm/byteorder.h> | ||
| 26 | |||
| 27 | #define OLD_FLAT_VERSION 0x00000002L | 58 | #define OLD_FLAT_VERSION 0x00000002L |
| 28 | #define OLD_FLAT_RELOC_TYPE_TEXT 0 | 59 | #define OLD_FLAT_RELOC_TYPE_TEXT 0 |
| 29 | #define OLD_FLAT_RELOC_TYPE_DATA 1 | 60 | #define OLD_FLAT_RELOC_TYPE_DATA 1 |
| 30 | #define OLD_FLAT_RELOC_TYPE_BSS 2 | 61 | #define OLD_FLAT_RELOC_TYPE_BSS 2 |
| 31 | 62 | ||
| 32 | typedef union { | 63 | typedef union { |
| 33 | unsigned long value; | 64 | u32 value; |
| 34 | struct { | 65 | struct { |
| 35 | # if defined(mc68000) && !defined(CONFIG_COLDFIRE) | 66 | #if defined(__LITTLE_ENDIAN_BITFIELD) || \ |
| 36 | signed long offset : 30; | 67 | (defined(mc68000) && !defined(CONFIG_COLDFIRE)) |
| 37 | unsigned long type : 2; | 68 | s32 offset : 30; |
| 38 | # define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */ | 69 | u32 type : 2; |
| 39 | # elif defined(__BIG_ENDIAN_BITFIELD) | 70 | # elif defined(__BIG_ENDIAN_BITFIELD) |
| 40 | unsigned long type : 2; | 71 | u32 type : 2; |
| 41 | signed long offset : 30; | 72 | s32 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 */ | ||
| 47 | # else | 73 | # else |
| 48 | # error "Unknown bitfield order for flat files." | 74 | # error "Unknown bitfield order for flat files." |
| 49 | # endif | 75 | # endif |
diff --git a/include/linux/fmc-sdb.h b/include/linux/fmc-sdb.h deleted file mode 100644 index bec899f0867c..000000000000 --- a/include/linux/fmc-sdb.h +++ /dev/null | |||
| @@ -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); | ||
diff --git a/include/linux/fmc.h b/include/linux/fmc.h deleted file mode 100644 index b355f3806f3f..000000000000 --- a/include/linux/fmc.h +++ /dev/null | |||
| @@ -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__ */ | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index f7fdfe93e25d..75f2ed289a3f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -694,7 +694,7 @@ struct inode { | |||
| 694 | atomic_t i_count; | 694 | atomic_t i_count; |
| 695 | atomic_t i_dio_count; | 695 | atomic_t i_dio_count; |
| 696 | atomic_t i_writecount; | 696 | atomic_t i_writecount; |
| 697 | #ifdef CONFIG_IMA | 697 | #if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING) |
| 698 | atomic_t i_readcount; /* struct files open RO */ | 698 | atomic_t i_readcount; /* struct files open RO */ |
| 699 | #endif | 699 | #endif |
| 700 | union { | 700 | union { |
| @@ -1019,8 +1019,6 @@ struct file_lock_operations { | |||
| 1019 | }; | 1019 | }; |
| 1020 | 1020 | ||
| 1021 | struct lock_manager_operations { | 1021 | struct lock_manager_operations { |
| 1022 | int (*lm_compare_owner)(struct file_lock *, struct file_lock *); | ||
| 1023 | unsigned long (*lm_owner_key)(struct file_lock *); | ||
| 1024 | fl_owner_t (*lm_get_owner)(fl_owner_t); | 1022 | fl_owner_t (*lm_get_owner)(fl_owner_t); |
| 1025 | void (*lm_put_owner)(fl_owner_t); | 1023 | void (*lm_put_owner)(fl_owner_t); |
| 1026 | void (*lm_notify)(struct file_lock *); /* unblock callback */ | 1024 | void (*lm_notify)(struct file_lock *); /* unblock callback */ |
| @@ -1769,7 +1767,7 @@ struct block_device_operations; | |||
| 1769 | /* | 1767 | /* |
| 1770 | * These flags control the behavior of the remap_file_range function pointer. | 1768 | * These flags control the behavior of the remap_file_range function pointer. |
| 1771 | * If it is called with len == 0 that means "remap to end of source file". | 1769 | * 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. |
| 1773 | * | 1771 | * |
| 1774 | * REMAP_FILE_DEDUP: only remap if contents identical (i.e. deduplicate) | 1772 | * REMAP_FILE_DEDUP: only remap if contents identical (i.e. deduplicate) |
| 1775 | * REMAP_FILE_CAN_SHORTEN: caller can handle a shortened request | 1773 | * 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 *, | |||
| 1889 | unsigned long, loff_t *, rwf_t); | 1887 | unsigned long, loff_t *, rwf_t); |
| 1890 | extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *, | 1888 | extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *, |
| 1891 | loff_t, size_t, unsigned int); | 1889 | 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); | ||
| 1892 | extern int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, | 1893 | extern int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, |
| 1893 | struct file *file_out, loff_t pos_out, | 1894 | struct file *file_out, loff_t pos_out, |
| 1894 | loff_t *count, | 1895 | loff_t *count, |
| @@ -2174,6 +2175,8 @@ static inline void file_accessed(struct file *file) | |||
| 2174 | touch_atime(&file->f_path); | 2175 | touch_atime(&file->f_path); |
| 2175 | } | 2176 | } |
| 2176 | 2177 | ||
| 2178 | extern int file_modified(struct file *file); | ||
| 2179 | |||
| 2177 | int sync_inode(struct inode *inode, struct writeback_control *wbc); | 2180 | int sync_inode(struct inode *inode, struct writeback_control *wbc); |
| 2178 | int sync_inode_metadata(struct inode *inode, int wait); | 2181 | int sync_inode_metadata(struct inode *inode, int wait); |
| 2179 | 2182 | ||
| @@ -2184,6 +2187,7 @@ struct file_system_type { | |||
| 2184 | #define FS_BINARY_MOUNTDATA 2 | 2187 | #define FS_BINARY_MOUNTDATA 2 |
| 2185 | #define FS_HAS_SUBTYPE 4 | 2188 | #define FS_HAS_SUBTYPE 4 |
| 2186 | #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ | 2189 | #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ |
| 2190 | #define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */ | ||
| 2187 | #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ | 2191 | #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ |
| 2188 | int (*init_fs_context)(struct fs_context *); | 2192 | int (*init_fs_context)(struct fs_context *); |
| 2189 | const struct fs_parameter_description *parameters; | 2193 | const struct fs_parameter_description *parameters; |
| @@ -2712,6 +2716,8 @@ extern int filemap_flush(struct address_space *); | |||
| 2712 | extern int filemap_fdatawait_keep_errors(struct address_space *mapping); | 2716 | extern int filemap_fdatawait_keep_errors(struct address_space *mapping); |
| 2713 | extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, | 2717 | extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, |
| 2714 | loff_t lend); | 2718 | loff_t lend); |
| 2719 | extern int filemap_fdatawait_range_keep_errors(struct address_space *mapping, | ||
| 2720 | loff_t start_byte, loff_t end_byte); | ||
| 2715 | 2721 | ||
| 2716 | static inline int filemap_fdatawait(struct address_space *mapping) | 2722 | static inline int filemap_fdatawait(struct address_space *mapping) |
| 2717 | { | 2723 | { |
| @@ -2890,7 +2896,7 @@ static inline bool inode_is_open_for_write(const struct inode *inode) | |||
| 2890 | return atomic_read(&inode->i_writecount) > 0; | 2896 | return atomic_read(&inode->i_writecount) > 0; |
| 2891 | } | 2897 | } |
| 2892 | 2898 | ||
| 2893 | #ifdef CONFIG_IMA | 2899 | #if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING) |
| 2894 | static inline void i_readcount_dec(struct inode *inode) | 2900 | static inline void i_readcount_dec(struct inode *inode) |
| 2895 | { | 2901 | { |
| 2896 | BUG_ON(!atomic_read(&inode->i_readcount)); | 2902 | BUG_ON(!atomic_read(&inode->i_readcount)); |
| @@ -3046,6 +3052,10 @@ extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *); | |||
| 3046 | extern int generic_remap_checks(struct file *file_in, loff_t pos_in, | 3052 | extern int generic_remap_checks(struct file *file_in, loff_t pos_in, |
| 3047 | struct file *file_out, loff_t pos_out, | 3053 | struct file *file_out, loff_t pos_out, |
| 3048 | loff_t *count, unsigned int remap_flags); | 3054 | loff_t *count, unsigned int remap_flags); |
| 3055 | extern int generic_file_rw_checks(struct file *file_in, struct file *file_out); | ||
| 3056 | extern int generic_copy_file_checks(struct file *file_in, loff_t pos_in, | ||
| 3057 | struct file *file_out, loff_t pos_out, | ||
| 3058 | size_t *count, unsigned int flags); | ||
| 3049 | extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); | 3059 | extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); |
| 3050 | extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); | 3060 | extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); |
| 3051 | extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); | 3061 | extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); |
| @@ -3546,4 +3556,16 @@ static inline struct sock *io_uring_get_socket(struct file *file) | |||
| 3546 | } | 3556 | } |
| 3547 | #endif | 3557 | #endif |
| 3548 | 3558 | ||
| 3559 | int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags, | ||
| 3560 | unsigned int flags); | ||
| 3561 | |||
| 3562 | int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, | ||
| 3563 | struct fsxattr *fa); | ||
| 3564 | |||
| 3565 | static inline void simple_fill_fsxattr(struct fsxattr *fa, __u32 xflags) | ||
| 3566 | { | ||
| 3567 | memset(fa, 0, sizeof(*fa)); | ||
| 3568 | fa->fsx_xflags = xflags; | ||
| 3569 | } | ||
| 3570 | |||
| 3549 | #endif /* _LINUX_FS_H */ | 3571 | #endif /* _LINUX_FS_H */ |
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h index d476ff0c10df..4933187d5b9a 100644 --- a/include/linux/fs_context.h +++ b/include/linux/fs_context.h | |||
| @@ -81,7 +81,7 @@ struct fs_parameter { | |||
| 81 | * Superblock creation fills in ->root whereas reconfiguration begins with this | 81 | * Superblock creation fills in ->root whereas reconfiguration begins with this |
| 82 | * already set. | 82 | * already set. |
| 83 | * | 83 | * |
| 84 | * See Documentation/filesystems/mounting.txt | 84 | * See Documentation/filesystems/mount_api.txt |
| 85 | */ | 85 | */ |
| 86 | struct fs_context { | 86 | struct fs_context { |
| 87 | const struct fs_context_operations *ops; | 87 | const struct fs_context_operations *ops; |
diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index f7680ef1abd2..bd8f207a2fb6 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h | |||
| @@ -63,16 +63,13 @@ struct fscrypt_operations { | |||
| 63 | unsigned int max_namelen; | 63 | unsigned int max_namelen; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | /* Decryption work */ | ||
| 66 | struct fscrypt_ctx { | 67 | struct fscrypt_ctx { |
| 67 | union { | 68 | union { |
| 68 | struct { | 69 | struct { |
| 69 | struct page *bounce_page; /* Ciphertext page */ | ||
| 70 | struct page *control_page; /* Original page */ | ||
| 71 | } w; | ||
| 72 | struct { | ||
| 73 | struct bio *bio; | 70 | struct bio *bio; |
| 74 | struct work_struct work; | 71 | struct work_struct work; |
| 75 | } r; | 72 | }; |
| 76 | struct list_head free_list; /* Free list */ | 73 | struct list_head free_list; /* Free list */ |
| 77 | }; | 74 | }; |
| 78 | u8 flags; /* Flags */ | 75 | u8 flags; /* Flags */ |
| @@ -106,18 +103,33 @@ static inline void fscrypt_handle_d_move(struct dentry *dentry) | |||
| 106 | extern void fscrypt_enqueue_decrypt_work(struct work_struct *); | 103 | extern void fscrypt_enqueue_decrypt_work(struct work_struct *); |
| 107 | extern struct fscrypt_ctx *fscrypt_get_ctx(gfp_t); | 104 | extern struct fscrypt_ctx *fscrypt_get_ctx(gfp_t); |
| 108 | extern void fscrypt_release_ctx(struct fscrypt_ctx *); | 105 | 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); | ||
| 114 | 106 | ||
| 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) | ||
| 116 | { | 128 | { |
| 117 | return ((struct fscrypt_ctx *)page_private(page))->w.control_page; | 129 | return (struct page *)page_private(bounce_page); |
| 118 | } | 130 | } |
| 119 | 131 | ||
| 120 | extern void fscrypt_restore_control_page(struct page *); | 132 | extern void fscrypt_free_bounce_page(struct page *bounce_page); |
| 121 | 133 | ||
| 122 | /* policy.c */ | 134 | /* policy.c */ |
| 123 | extern int fscrypt_ioctl_set_policy(struct file *, const void __user *); | 135 | 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, | |||
| 223 | extern void fscrypt_decrypt_bio(struct bio *); | 235 | extern void fscrypt_decrypt_bio(struct bio *); |
| 224 | extern void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, | 236 | extern void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, |
| 225 | struct bio *bio); | 237 | struct bio *bio); |
| 226 | extern void fscrypt_pullback_bio_page(struct page **, bool); | ||
| 227 | extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t, | 238 | extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t, |
| 228 | unsigned int); | 239 | unsigned int); |
| 229 | 240 | ||
| @@ -283,32 +294,51 @@ static inline void fscrypt_release_ctx(struct fscrypt_ctx *ctx) | |||
| 283 | return; | 294 | return; |
| 284 | } | 295 | } |
| 285 | 296 | ||
| 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, | ||
| 287 | struct page *page, | 306 | struct page *page, |
| 288 | unsigned int len, | 307 | unsigned int len, |
| 289 | unsigned int offs, | 308 | unsigned int offs, u64 lblk_num, |
| 290 | u64 lblk_num, gfp_t gfp_flags) | 309 | gfp_t gfp_flags) |
| 291 | { | 310 | { |
| 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; | ||
| 293 | } | 319 | } |
| 294 | 320 | ||
| 295 | static inline int fscrypt_decrypt_page(const struct inode *inode, | 321 | static inline int fscrypt_decrypt_block_inplace(const struct inode *inode, |
| 296 | struct page *page, | 322 | struct page *page, |
| 297 | unsigned int len, unsigned int offs, | 323 | unsigned int len, |
| 298 | u64 lblk_num) | 324 | unsigned int offs, u64 lblk_num) |
| 299 | { | 325 | { |
| 300 | return -EOPNOTSUPP; | 326 | return -EOPNOTSUPP; |
| 301 | } | 327 | } |
| 302 | 328 | ||
| 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) | ||
| 304 | { | 335 | { |
| 305 | WARN_ON_ONCE(1); | 336 | WARN_ON_ONCE(1); |
| 306 | return ERR_PTR(-EINVAL); | 337 | return ERR_PTR(-EINVAL); |
| 307 | } | 338 | } |
| 308 | 339 | ||
| 309 | static inline void fscrypt_restore_control_page(struct page *page) | 340 | static inline void fscrypt_free_bounce_page(struct page *bounce_page) |
| 310 | { | 341 | { |
| 311 | return; | ||
| 312 | } | 342 | } |
| 313 | 343 | ||
| 314 | /* policy.c */ | 344 | /* policy.c */ |
| @@ -410,11 +440,6 @@ static inline void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, | |||
| 410 | { | 440 | { |
| 411 | } | 441 | } |
| 412 | 442 | ||
| 413 | static inline void fscrypt_pullback_bio_page(struct page **page, bool restore) | ||
| 414 | { | ||
| 415 | return; | ||
| 416 | } | ||
| 417 | |||
| 418 | static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, | 443 | static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, |
| 419 | sector_t pblk, unsigned int len) | 444 | sector_t pblk, unsigned int len) |
| 420 | { | 445 | { |
| @@ -692,4 +717,15 @@ static inline int fscrypt_encrypt_symlink(struct inode *inode, | |||
| 692 | return 0; | 717 | return 0; |
| 693 | } | 718 | } |
| 694 | 719 | ||
| 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 | |||
| 695 | #endif /* _LINUX_FSCRYPT_H */ | 731 | #endif /* _LINUX_FSCRYPT_H */ |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index cb2b46f57af3..5d231ce8709b 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
| @@ -98,6 +98,7 @@ struct fsl_usb2_platform_data { | |||
| 98 | unsigned has_fsl_erratum_14:1; | 98 | unsigned has_fsl_erratum_14:1; |
| 99 | unsigned has_fsl_erratum_a005275:1; | 99 | unsigned has_fsl_erratum_a005275:1; |
| 100 | unsigned has_fsl_erratum_a005697:1; | 100 | unsigned has_fsl_erratum_a005697:1; |
| 101 | unsigned has_fsl_erratum_a006918:1; | ||
| 101 | unsigned check_phy_clk_valid:1; | 102 | unsigned check_phy_clk_valid:1; |
| 102 | 103 | ||
| 103 | /* register save area for suspend/resume */ | 104 | /* register save area for suspend/resume */ |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 94972e8eb6d1..a2d5d175d3c1 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
| @@ -189,6 +189,19 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct | |||
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | /* | 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 | |||
| 204 | /* | ||
| 192 | * fsnotify_mkdir - directory 'name' was created | 205 | * fsnotify_mkdir - directory 'name' was created |
| 193 | */ | 206 | */ |
| 194 | static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) | 207 | static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) |
| @@ -199,6 +212,19 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) | |||
| 199 | } | 212 | } |
| 200 | 213 | ||
| 201 | /* | 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 | |||
| 227 | /* | ||
| 202 | * fsnotify_access - file was read | 228 | * fsnotify_access - file was read |
| 203 | */ | 229 | */ |
| 204 | static inline void fsnotify_access(struct file *file) | 230 | static inline void fsnotify_access(struct file *file) |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index d4844cad2c2b..2de3b2ddd19a 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
| @@ -357,7 +357,6 @@ extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u | |||
| 357 | extern void __fsnotify_inode_delete(struct inode *inode); | 357 | extern void __fsnotify_inode_delete(struct inode *inode); |
| 358 | extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); | 358 | extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); |
| 359 | extern void fsnotify_sb_delete(struct super_block *sb); | 359 | extern void fsnotify_sb_delete(struct super_block *sb); |
| 360 | extern void fsnotify_nameremove(struct dentry *dentry, int isdir); | ||
| 361 | extern u32 fsnotify_get_cookie(void); | 360 | extern u32 fsnotify_get_cookie(void); |
| 362 | 361 | ||
| 363 | static inline int fsnotify_inode_watches_children(struct inode *inode) | 362 | static inline int fsnotify_inode_watches_children(struct inode *inode) |
| @@ -527,9 +526,6 @@ static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt) | |||
| 527 | static inline void fsnotify_sb_delete(struct super_block *sb) | 526 | static inline void fsnotify_sb_delete(struct super_block *sb) |
| 528 | {} | 527 | {} |
| 529 | 528 | ||
| 530 | static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) | ||
| 531 | {} | ||
| 532 | |||
| 533 | static inline void fsnotify_update_flags(struct dentry *dentry) | 529 | static inline void fsnotify_update_flags(struct dentry *dentry) |
| 534 | {} | 530 | {} |
| 535 | 531 | ||
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h index 205f62b8d291..4bd583bd6934 100644 --- a/include/linux/genalloc.h +++ b/include/linux/genalloc.h | |||
| @@ -155,6 +155,15 @@ static inline unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size) | |||
| 155 | 155 | ||
| 156 | extern void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size, | 156 | extern void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size, |
| 157 | dma_addr_t *dma); | 157 | 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); | ||
| 158 | extern void gen_pool_free_owner(struct gen_pool *pool, unsigned long addr, | 167 | extern void gen_pool_free_owner(struct gen_pool *pool, unsigned long addr, |
| 159 | size_t size, void **owner); | 168 | size_t size, void **owner); |
| 160 | static inline void gen_pool_free(struct gen_pool *pool, unsigned long addr, | 169 | static inline void gen_pool_free(struct gen_pool *pool, unsigned long addr, |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 39745b8bdd65..40915b461f18 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
| @@ -106,6 +106,7 @@ void devm_gpio_free(struct device *dev, unsigned int gpio); | |||
| 106 | 106 | ||
| 107 | struct device; | 107 | struct device; |
| 108 | struct gpio_chip; | 108 | struct gpio_chip; |
| 109 | struct pinctrl_dev; | ||
| 109 | 110 | ||
| 110 | static inline bool gpio_is_valid(int number) | 111 | static inline bool gpio_is_valid(int number) |
| 111 | { | 112 | { |
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index a1d273c96016..6a0e420915a3 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h | |||
| @@ -18,6 +18,7 @@ struct seq_file; | |||
| 18 | struct gpio_device; | 18 | struct gpio_device; |
| 19 | struct module; | 19 | struct module; |
| 20 | enum gpiod_flags; | 20 | enum gpiod_flags; |
| 21 | enum gpio_lookup_flags; | ||
| 21 | 22 | ||
| 22 | #ifdef CONFIG_GPIOLIB | 23 | #ifdef CONFIG_GPIOLIB |
| 23 | 24 | ||
| @@ -102,13 +103,6 @@ struct gpio_irq_chip { | |||
| 102 | unsigned int num_parents; | 103 | unsigned int num_parents; |
| 103 | 104 | ||
| 104 | /** | 105 | /** |
| 105 | * @parent_irq: | ||
| 106 | * | ||
| 107 | * For use by gpiochip_set_cascaded_irqchip() | ||
| 108 | */ | ||
| 109 | unsigned int parent_irq; | ||
| 110 | |||
| 111 | /** | ||
| 112 | * @parents: | 106 | * @parents: |
| 113 | * | 107 | * |
| 114 | * A list of interrupt parents of a GPIO chip. This is owned by the | 108 | * A list of interrupt parents of a GPIO chip. This is owned by the |
| @@ -167,7 +161,7 @@ struct gpio_irq_chip { | |||
| 167 | */ | 161 | */ |
| 168 | void (*irq_disable)(struct irq_data *data); | 162 | void (*irq_disable)(struct irq_data *data); |
| 169 | }; | 163 | }; |
| 170 | #endif | 164 | #endif /* CONFIG_GPIOLIB_IRQCHIP */ |
| 171 | 165 | ||
| 172 | /** | 166 | /** |
| 173 | * struct gpio_chip - abstract a GPIO controller | 167 | * struct gpio_chip - abstract a GPIO controller |
| @@ -200,6 +194,8 @@ struct gpio_irq_chip { | |||
| 200 | * @dbg_show: optional routine to show contents in debugfs; default code | 194 | * @dbg_show: optional routine to show contents in debugfs; default code |
| 201 | * will be used when this is omitted, but custom code can show extra | 195 | * will be used when this is omitted, but custom code can show extra |
| 202 | * state (such as pullup/pulldown configuration). | 196 | * 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. | ||
| 203 | * @base: identifies the first GPIO number handled by this chip; | 199 | * @base: identifies the first GPIO number handled by this chip; |
| 204 | * or, if negative during registration, requests dynamic ID allocation. | 200 | * or, if negative during registration, requests dynamic ID allocation. |
| 205 | * DEPRECATION: providing anything non-negative and nailing the base | 201 | * DEPRECATION: providing anything non-negative and nailing the base |
| @@ -307,7 +303,7 @@ struct gpio_chip { | |||
| 307 | spinlock_t bgpio_lock; | 303 | spinlock_t bgpio_lock; |
| 308 | unsigned long bgpio_data; | 304 | unsigned long bgpio_data; |
| 309 | unsigned long bgpio_dir; | 305 | unsigned long bgpio_dir; |
| 310 | #endif | 306 | #endif /* CONFIG_GPIO_GENERIC */ |
| 311 | 307 | ||
| 312 | #ifdef CONFIG_GPIOLIB_IRQCHIP | 308 | #ifdef CONFIG_GPIOLIB_IRQCHIP |
| 313 | /* | 309 | /* |
| @@ -322,7 +318,7 @@ struct gpio_chip { | |||
| 322 | * used to handle IRQs for most practical cases. | 318 | * used to handle IRQs for most practical cases. |
| 323 | */ | 319 | */ |
| 324 | struct gpio_irq_chip irq; | 320 | struct gpio_irq_chip irq; |
| 325 | #endif | 321 | #endif /* CONFIG_GPIOLIB_IRQCHIP */ |
| 326 | 322 | ||
| 327 | /** | 323 | /** |
| 328 | * @need_valid_mask: | 324 | * @need_valid_mask: |
| @@ -369,7 +365,7 @@ struct gpio_chip { | |||
| 369 | */ | 365 | */ |
| 370 | int (*of_xlate)(struct gpio_chip *gc, | 366 | int (*of_xlate)(struct gpio_chip *gc, |
| 371 | const struct of_phandle_args *gpiospec, u32 *flags); | 367 | const struct of_phandle_args *gpiospec, u32 *flags); |
| 372 | #endif | 368 | #endif /* CONFIG_OF_GPIO */ |
| 373 | }; | 369 | }; |
| 374 | 370 | ||
| 375 | extern const char *gpiochip_is_requested(struct gpio_chip *chip, | 371 | 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, | |||
| 412 | }) | 408 | }) |
| 413 | #else | 409 | #else |
| 414 | #define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL, NULL) | 410 | #define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL, NULL) |
| 415 | #endif | 411 | #endif /* CONFIG_LOCKDEP */ |
| 416 | 412 | ||
| 417 | static inline int gpiochip_add(struct gpio_chip *chip) | 413 | static inline int gpiochip_add(struct gpio_chip *chip) |
| 418 | { | 414 | { |
| @@ -467,7 +463,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev, | |||
| 467 | #define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */ | 463 | #define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */ |
| 468 | #define BGPIOF_NO_OUTPUT BIT(5) /* only input */ | 464 | #define BGPIOF_NO_OUTPUT BIT(5) /* only input */ |
| 469 | 465 | ||
| 470 | #endif | 466 | #endif /* CONFIG_GPIO_GENERIC */ |
| 471 | 467 | ||
| 472 | #ifdef CONFIG_GPIOLIB_IRQCHIP | 468 | #ifdef CONFIG_GPIOLIB_IRQCHIP |
| 473 | 469 | ||
| @@ -537,7 +533,7 @@ static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip, | |||
| 537 | handler, type, true, | 533 | handler, type, true, |
| 538 | &lock_key, &request_key); | 534 | &lock_key, &request_key); |
| 539 | } | 535 | } |
| 540 | #else | 536 | #else /* ! CONFIG_LOCKDEP */ |
| 541 | static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip, | 537 | static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip, |
| 542 | struct irq_chip *irqchip, | 538 | struct irq_chip *irqchip, |
| 543 | unsigned int first_irq, | 539 | unsigned int first_irq, |
| @@ -588,7 +584,9 @@ int gpiochip_add_pingroup_range(struct gpio_chip *chip, | |||
| 588 | unsigned int gpio_offset, const char *pin_group); | 584 | unsigned int gpio_offset, const char *pin_group); |
| 589 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip); | 585 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip); |
| 590 | 586 | ||
| 591 | #else | 587 | #else /* ! CONFIG_PINCTRL */ |
| 588 | |||
| 589 | struct pinctrl_dev; | ||
| 592 | 590 | ||
| 593 | static inline int | 591 | static inline int |
| 594 | gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | 592 | gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, |
| @@ -614,7 +612,8 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip) | |||
| 614 | 612 | ||
| 615 | struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum, | 613 | struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum, |
| 616 | const char *label, | 614 | const char *label, |
| 617 | enum gpiod_flags flags); | 615 | enum gpio_lookup_flags lflags, |
| 616 | enum gpiod_flags dflags); | ||
| 618 | void gpiochip_free_own_desc(struct gpio_desc *desc); | 617 | void gpiochip_free_own_desc(struct gpio_desc *desc); |
| 619 | 618 | ||
| 620 | void devprop_gpiochip_set_names(struct gpio_chip *chip, | 619 | void devprop_gpiochip_set_names(struct gpio_chip *chip, |
diff --git a/include/linux/gpio/gpio-reg.h b/include/linux/gpio/gpio-reg.h index 5c6efd394cb0..39b888c40b39 100644 --- a/include/linux/gpio/gpio-reg.h +++ b/include/linux/gpio/gpio-reg.h | |||
| @@ -11,4 +11,4 @@ struct gpio_chip *gpio_reg_init(struct device *dev, void __iomem *reg, | |||
| 11 | 11 | ||
| 12 | int gpio_reg_resume(struct gpio_chip *gc); | 12 | int gpio_reg_resume(struct gpio_chip *gc); |
| 13 | 13 | ||
| 14 | #endif | 14 | #endif /* GPIO_REG_H */ |
diff --git a/include/linux/gpio/machine.h b/include/linux/gpio/machine.h index 35f299d1f6a7..1ebe5be05d5f 100644 --- a/include/linux/gpio/machine.h +++ b/include/linux/gpio/machine.h | |||
| @@ -97,7 +97,7 @@ void gpiod_add_lookup_table(struct gpiod_lookup_table *table); | |||
| 97 | void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n); | 97 | void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n); |
| 98 | void gpiod_remove_lookup_table(struct gpiod_lookup_table *table); | 98 | void gpiod_remove_lookup_table(struct gpiod_lookup_table *table); |
| 99 | void gpiod_add_hogs(struct gpiod_hog *hogs); | 99 | void gpiod_add_hogs(struct gpiod_hog *hogs); |
| 100 | #else | 100 | #else /* ! CONFIG_GPIOLIB */ |
| 101 | static inline | 101 | static inline |
| 102 | void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {} | 102 | void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {} |
| 103 | static inline | 103 | static inline |
| @@ -105,6 +105,6 @@ void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n) {} | |||
| 105 | static inline | 105 | static inline |
| 106 | void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {} | 106 | void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {} |
| 107 | static inline void gpiod_add_hogs(struct gpiod_hog *hogs) {} | 107 | static inline void gpiod_add_hogs(struct gpiod_hog *hogs) {} |
| 108 | #endif | 108 | #endif /* CONFIG_GPIOLIB */ |
| 109 | 109 | ||
| 110 | #endif /* __LINUX_GPIO_MACHINE_H */ | 110 | #endif /* __LINUX_GPIO_MACHINE_H */ |
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index 927ad6451105..9918a6c910c5 100644 --- a/include/linux/hdmi.h +++ b/include/linux/hdmi.h | |||
| @@ -47,6 +47,7 @@ enum hdmi_infoframe_type { | |||
| 47 | HDMI_INFOFRAME_TYPE_AVI = 0x82, | 47 | HDMI_INFOFRAME_TYPE_AVI = 0x82, |
| 48 | HDMI_INFOFRAME_TYPE_SPD = 0x83, | 48 | HDMI_INFOFRAME_TYPE_SPD = 0x83, |
| 49 | HDMI_INFOFRAME_TYPE_AUDIO = 0x84, | 49 | HDMI_INFOFRAME_TYPE_AUDIO = 0x84, |
| 50 | HDMI_INFOFRAME_TYPE_DRM = 0x87, | ||
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | #define HDMI_IEEE_OUI 0x000c03 | 53 | #define HDMI_IEEE_OUI 0x000c03 |
| @@ -55,6 +56,7 @@ enum hdmi_infoframe_type { | |||
| 55 | #define HDMI_AVI_INFOFRAME_SIZE 13 | 56 | #define HDMI_AVI_INFOFRAME_SIZE 13 |
| 56 | #define HDMI_SPD_INFOFRAME_SIZE 25 | 57 | #define HDMI_SPD_INFOFRAME_SIZE 25 |
| 57 | #define HDMI_AUDIO_INFOFRAME_SIZE 10 | 58 | #define HDMI_AUDIO_INFOFRAME_SIZE 10 |
| 59 | #define HDMI_DRM_INFOFRAME_SIZE 26 | ||
| 58 | 60 | ||
| 59 | #define HDMI_INFOFRAME_SIZE(type) \ | 61 | #define HDMI_INFOFRAME_SIZE(type) \ |
| 60 | (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) | 62 | (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) |
| @@ -152,6 +154,17 @@ enum hdmi_content_type { | |||
| 152 | HDMI_CONTENT_TYPE_GAME, | 154 | HDMI_CONTENT_TYPE_GAME, |
| 153 | }; | 155 | }; |
| 154 | 156 | ||
| 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 | |||
| 155 | struct hdmi_avi_infoframe { | 168 | struct hdmi_avi_infoframe { |
| 156 | enum hdmi_infoframe_type type; | 169 | enum hdmi_infoframe_type type; |
| 157 | unsigned char version; | 170 | unsigned char version; |
| @@ -175,12 +188,37 @@ struct hdmi_avi_infoframe { | |||
| 175 | unsigned short right_bar; | 188 | unsigned short right_bar; |
| 176 | }; | 189 | }; |
| 177 | 190 | ||
| 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 | |||
| 178 | int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame); | 210 | int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame); |
| 179 | ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer, | 211 | ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer, |
| 180 | size_t size); | 212 | size_t size); |
| 181 | ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame, | 213 | ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame, |
| 182 | void *buffer, size_t size); | 214 | void *buffer, size_t size); |
| 183 | int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame); | 215 | 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); | ||
| 184 | 222 | ||
| 185 | enum hdmi_spd_sdi { | 223 | enum hdmi_spd_sdi { |
| 186 | HDMI_SPD_SDI_UNKNOWN, | 224 | HDMI_SPD_SDI_UNKNOWN, |
| @@ -320,6 +358,33 @@ struct hdmi_vendor_infoframe { | |||
| 320 | unsigned int s3d_ext_data; | 358 | unsigned int s3d_ext_data; |
| 321 | }; | 359 | }; |
| 322 | 360 | ||
| 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 | |||
| 323 | int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame); | 388 | int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame); |
| 324 | ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, | 389 | ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, |
| 325 | void *buffer, size_t size); | 390 | void *buffer, size_t size); |
| @@ -344,6 +409,7 @@ union hdmi_vendor_any_infoframe { | |||
| 344 | * @spd: spd infoframe | 409 | * @spd: spd infoframe |
| 345 | * @vendor: union of all vendor infoframes | 410 | * @vendor: union of all vendor infoframes |
| 346 | * @audio: audio infoframe | 411 | * @audio: audio infoframe |
| 412 | * @drm: Dynamic Range and Mastering infoframe | ||
| 347 | * | 413 | * |
| 348 | * This is used by the generic pack function. This works since all infoframes | 414 | * This is used by the generic pack function. This works since all infoframes |
| 349 | * have the same header which also indicates which type of infoframe should be | 415 | * have the same header which also indicates which type of infoframe should be |
| @@ -355,6 +421,7 @@ union hdmi_infoframe { | |||
| 355 | struct hdmi_spd_infoframe spd; | 421 | struct hdmi_spd_infoframe spd; |
| 356 | union hdmi_vendor_any_infoframe vendor; | 422 | union hdmi_vendor_any_infoframe vendor; |
| 357 | struct hdmi_audio_infoframe audio; | 423 | struct hdmi_audio_infoframe audio; |
| 424 | struct hdmi_drm_infoframe drm; | ||
| 358 | }; | 425 | }; |
| 359 | 426 | ||
| 360 | ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, | 427 | ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, |
diff --git a/include/linux/hmm.h b/include/linux/hmm.h index 044a36d7c3f8..b8a08b2a10ca 100644 --- a/include/linux/hmm.h +++ b/include/linux/hmm.h | |||
| @@ -21,8 +21,8 @@ | |||
| 21 | * | 21 | * |
| 22 | * HMM address space mirroring API: | 22 | * HMM address space mirroring API: |
| 23 | * | 23 | * |
| 24 | * Use HMM address space mirroring if you want to mirror range of the CPU page | 24 | * Use HMM address space mirroring if you want to mirror a range of the CPU |
| 25 | * table of a process into a device page table. Here, "mirror" means "keep | 25 | * page tables of a process into a device page table. Here, "mirror" means "keep |
| 26 | * synchronized". Prerequisites: the device must provide the ability to write- | 26 | * synchronized". Prerequisites: the device must provide the ability to write- |
| 27 | * protect its page tables (at PAGE_SIZE granularity), and must be able to | 27 | * protect its page tables (at PAGE_SIZE granularity), and must be able to |
| 28 | * recover from the resulting potential page faults. | 28 | * recover from the resulting potential page faults. |
| @@ -62,7 +62,7 @@ | |||
| 62 | #include <linux/kconfig.h> | 62 | #include <linux/kconfig.h> |
| 63 | #include <asm/pgtable.h> | 63 | #include <asm/pgtable.h> |
| 64 | 64 | ||
| 65 | #if IS_ENABLED(CONFIG_HMM) | 65 | #ifdef CONFIG_HMM_MIRROR |
| 66 | 66 | ||
| 67 | #include <linux/device.h> | 67 | #include <linux/device.h> |
| 68 | #include <linux/migrate.h> | 68 | #include <linux/migrate.h> |
| @@ -82,19 +82,18 @@ | |||
| 82 | * @mirrors_sem: read/write semaphore protecting the mirrors list | 82 | * @mirrors_sem: read/write semaphore protecting the mirrors list |
| 83 | * @wq: wait queue for user waiting on a range invalidation | 83 | * @wq: wait queue for user waiting on a range invalidation |
| 84 | * @notifiers: count of active mmu notifiers | 84 | * @notifiers: count of active mmu notifiers |
| 85 | * @dead: is the mm dead ? | ||
| 86 | */ | 85 | */ |
| 87 | struct hmm { | 86 | struct hmm { |
| 88 | struct mm_struct *mm; | 87 | struct mm_struct *mm; |
| 89 | struct kref kref; | 88 | struct kref kref; |
| 90 | struct mutex lock; | 89 | spinlock_t ranges_lock; |
| 91 | struct list_head ranges; | 90 | struct list_head ranges; |
| 92 | struct list_head mirrors; | 91 | struct list_head mirrors; |
| 93 | struct mmu_notifier mmu_notifier; | 92 | struct mmu_notifier mmu_notifier; |
| 94 | struct rw_semaphore mirrors_sem; | 93 | struct rw_semaphore mirrors_sem; |
| 95 | wait_queue_head_t wq; | 94 | wait_queue_head_t wq; |
| 95 | struct rcu_head rcu; | ||
| 96 | long notifiers; | 96 | long notifiers; |
| 97 | bool dead; | ||
| 98 | }; | 97 | }; |
| 99 | 98 | ||
| 100 | /* | 99 | /* |
| @@ -105,10 +104,11 @@ struct hmm { | |||
| 105 | * HMM_PFN_WRITE: CPU page table has write permission set | 104 | * HMM_PFN_WRITE: CPU page table has write permission set |
| 106 | * HMM_PFN_DEVICE_PRIVATE: private device memory (ZONE_DEVICE) | 105 | * HMM_PFN_DEVICE_PRIVATE: private device memory (ZONE_DEVICE) |
| 107 | * | 106 | * |
| 108 | * The driver provide a flags array, if driver valid bit for an entry is bit | 107 | * The driver provides a flags array for mapping page protections to device |
| 109 | * 3 ie (entry & (1 << 3)) is true if entry is valid then driver must provide | 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 | ||
| 110 | * an array in hmm_range.flags with hmm_range.flags[HMM_PFN_VALID] == 1 << 3. | 110 | * 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 |
| 112 | * except that this is per device driver rather than per architecture. | 112 | * except that this is per device driver rather than per architecture. |
| 113 | */ | 113 | */ |
| 114 | enum hmm_pfn_flag_e { | 114 | enum hmm_pfn_flag_e { |
| @@ -129,13 +129,13 @@ enum hmm_pfn_flag_e { | |||
| 129 | * be mirrored by a device, because the entry will never have HMM_PFN_VALID | 129 | * be mirrored by a device, because the entry will never have HMM_PFN_VALID |
| 130 | * set and the pfn value is undefined. | 130 | * set and the pfn value is undefined. |
| 131 | * | 131 | * |
| 132 | * Driver provide entry value for none entry, error entry and special entry, | 132 | * Driver provides values for none entry, error entry, and special entry. |
| 133 | * driver can alias (ie use same value for error and special for instance). It | 133 | * Driver can alias (i.e., use same value) error and special, but |
| 134 | * should not alias none and error or special. | 134 | * it should not alias none with error or special. |
| 135 | * | 135 | * |
| 136 | * HMM pfn value returned by hmm_vma_get_pfns() or hmm_vma_fault() will be: | 136 | * HMM pfn value returned by hmm_vma_get_pfns() or hmm_vma_fault() will be: |
| 137 | * hmm_range.values[HMM_PFN_ERROR] if CPU page table entry is poisonous, | 137 | * 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, |
| 139 | * hmm_range.values[HMM_PFN_SPECIAL] if CPU page table entry is a special one | 139 | * hmm_range.values[HMM_PFN_SPECIAL] if CPU page table entry is a special one |
| 140 | */ | 140 | */ |
| 141 | enum hmm_pfn_value_e { | 141 | enum hmm_pfn_value_e { |
| @@ -158,6 +158,7 @@ enum hmm_pfn_value_e { | |||
| 158 | * @values: pfn value for some special case (none, special, error, ...) | 158 | * @values: pfn value for some special case (none, special, error, ...) |
| 159 | * @default_flags: default flags for the range (write, read, ... see hmm doc) | 159 | * @default_flags: default flags for the range (write, read, ... see hmm doc) |
| 160 | * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter | 160 | * @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) | ||
| 161 | * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT) | 162 | * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT) |
| 162 | * @valid: pfns array did not change since it has been fill by an HMM function | 163 | * @valid: pfns array did not change since it has been fill by an HMM function |
| 163 | */ | 164 | */ |
| @@ -180,7 +181,7 @@ struct hmm_range { | |||
| 180 | /* | 181 | /* |
| 181 | * hmm_range_page_shift() - return the page shift for the range | 182 | * hmm_range_page_shift() - return the page shift for the range |
| 182 | * @range: range being queried | 183 | * @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 |
| 184 | */ | 185 | */ |
| 185 | static inline unsigned hmm_range_page_shift(const struct hmm_range *range) | 186 | static inline unsigned hmm_range_page_shift(const struct hmm_range *range) |
| 186 | { | 187 | { |
| @@ -190,7 +191,7 @@ static inline unsigned hmm_range_page_shift(const struct hmm_range *range) | |||
| 190 | /* | 191 | /* |
| 191 | * hmm_range_page_size() - return the page size for the range | 192 | * hmm_range_page_size() - return the page size for the range |
| 192 | * @range: range being queried | 193 | * @range: range being queried |
| 193 | * Returns: page size for the range in bytes | 194 | * Return: page size for the range in bytes |
| 194 | */ | 195 | */ |
| 195 | static inline unsigned long hmm_range_page_size(const struct hmm_range *range) | 196 | static inline unsigned long hmm_range_page_size(const struct hmm_range *range) |
| 196 | { | 197 | { |
| @@ -201,28 +202,19 @@ static inline unsigned long hmm_range_page_size(const struct hmm_range *range) | |||
| 201 | * hmm_range_wait_until_valid() - wait for range to be valid | 202 | * hmm_range_wait_until_valid() - wait for range to be valid |
| 202 | * @range: range affected by invalidation to wait on | 203 | * @range: range affected by invalidation to wait on |
| 203 | * @timeout: time out for wait in ms (ie abort wait after that period of time) | 204 | * @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. |
| 205 | */ | 206 | */ |
| 206 | static inline bool hmm_range_wait_until_valid(struct hmm_range *range, | 207 | static inline bool hmm_range_wait_until_valid(struct hmm_range *range, |
| 207 | unsigned long timeout) | 208 | unsigned long timeout) |
| 208 | { | 209 | { |
| 209 | /* Check if mm is dead ? */ | 210 | return wait_event_timeout(range->hmm->wq, range->valid, |
| 210 | if (range->hmm == NULL || range->hmm->dead || range->hmm->mm == NULL) { | 211 | msecs_to_jiffies(timeout)) != 0; |
| 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; | ||
| 220 | } | 212 | } |
| 221 | 213 | ||
| 222 | /* | 214 | /* |
| 223 | * hmm_range_valid() - test if a range is valid or not | 215 | * hmm_range_valid() - test if a range is valid or not |
| 224 | * @range: range | 216 | * @range: range |
| 225 | * Returns: true if the range is valid, false otherwise. | 217 | * Return: true if the range is valid, false otherwise. |
| 226 | */ | 218 | */ |
| 227 | static inline bool hmm_range_valid(struct hmm_range *range) | 219 | static inline bool hmm_range_valid(struct hmm_range *range) |
| 228 | { | 220 | { |
| @@ -233,7 +225,7 @@ static inline bool hmm_range_valid(struct hmm_range *range) | |||
| 233 | * hmm_device_entry_to_page() - return struct page pointed to by a device entry | 225 | * hmm_device_entry_to_page() - return struct page pointed to by a device entry |
| 234 | * @range: range use to decode device entry value | 226 | * @range: range use to decode device entry value |
| 235 | * @entry: device entry value to get corresponding struct page from | 227 | * @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 |
| 237 | * | 229 | * |
| 238 | * If the device entry is valid (ie valid flag set) then return the struct page | 230 | * If the device entry is valid (ie valid flag set) then return the struct page |
| 239 | * matching the entry value. Otherwise return NULL. | 231 | * 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 | |||
| 256 | * hmm_device_entry_to_pfn() - return pfn value store in a device entry | 248 | * hmm_device_entry_to_pfn() - return pfn value store in a device entry |
| 257 | * @range: range use to decode device entry value | 249 | * @range: range use to decode device entry value |
| 258 | * @entry: device entry to extract pfn from | 250 | * @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 |
| 260 | */ | 252 | */ |
| 261 | static inline unsigned long | 253 | static inline unsigned long |
| 262 | hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn) | 254 | 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) | |||
| 276 | * hmm_device_entry_from_page() - create a valid device entry for a page | 268 | * hmm_device_entry_from_page() - create a valid device entry for a page |
| 277 | * @range: range use to encode HMM pfn value | 269 | * @range: range use to encode HMM pfn value |
| 278 | * @page: page for which to create the device entry | 270 | * @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 |
| 280 | */ | 272 | */ |
| 281 | static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, | 273 | static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, |
| 282 | struct page *page) | 274 | struct page *page) |
| @@ -289,7 +281,7 @@ static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, | |||
| 289 | * hmm_device_entry_from_pfn() - create a valid device entry value from pfn | 281 | * hmm_device_entry_from_pfn() - create a valid device entry value from pfn |
| 290 | * @range: range use to encode HMM pfn value | 282 | * @range: range use to encode HMM pfn value |
| 291 | * @pfn: pfn value for which to create the device entry | 283 | * @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 |
| 293 | */ | 285 | */ |
| 294 | static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range, | 286 | static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range, |
| 295 | unsigned long pfn) | 287 | unsigned long pfn) |
| @@ -332,9 +324,6 @@ static inline uint64_t hmm_pfn_from_pfn(const struct hmm_range *range, | |||
| 332 | return hmm_device_entry_from_pfn(range, pfn); | 324 | return hmm_device_entry_from_pfn(range, pfn); |
| 333 | } | 325 | } |
| 334 | 326 | ||
| 335 | |||
| 336 | |||
| 337 | #if IS_ENABLED(CONFIG_HMM_MIRROR) | ||
| 338 | /* | 327 | /* |
| 339 | * Mirroring: how to synchronize device page table with CPU page table. | 328 | * Mirroring: how to synchronize device page table with CPU page table. |
| 340 | * | 329 | * |
| @@ -394,7 +383,7 @@ enum hmm_update_event { | |||
| 394 | }; | 383 | }; |
| 395 | 384 | ||
| 396 | /* | 385 | /* |
| 397 | * struct hmm_update - HMM update informations for callback | 386 | * struct hmm_update - HMM update information for callback |
| 398 | * | 387 | * |
| 399 | * @start: virtual start address of the range to update | 388 | * @start: virtual start address of the range to update |
| 400 | * @end: virtual end address of the range to update | 389 | * @end: virtual end address of the range to update |
| @@ -418,17 +407,18 @@ struct hmm_mirror_ops { | |||
| 418 | * | 407 | * |
| 419 | * @mirror: pointer to struct hmm_mirror | 408 | * @mirror: pointer to struct hmm_mirror |
| 420 | * | 409 | * |
| 421 | * This is called when the mm_struct is being released. | 410 | * This is called when the mm_struct is being released. The callback |
| 422 | * The callback should make sure no references to the mirror occur | 411 | * must ensure that all access to any pages obtained from this mirror |
| 423 | * after the callback returns. | 412 | * is halted before the callback returns. All future access should |
| 413 | * fault. | ||
| 424 | */ | 414 | */ |
| 425 | void (*release)(struct hmm_mirror *mirror); | 415 | void (*release)(struct hmm_mirror *mirror); |
| 426 | 416 | ||
| 427 | /* sync_cpu_device_pagetables() - synchronize page tables | 417 | /* sync_cpu_device_pagetables() - synchronize page tables |
| 428 | * | 418 | * |
| 429 | * @mirror: pointer to struct hmm_mirror | 419 | * @mirror: pointer to struct hmm_mirror |
| 430 | * @update: update informations (see struct hmm_update) | 420 | * @update: update information (see struct hmm_update) |
| 431 | * Returns: -EAGAIN if update.blockable false and callback need to | 421 | * Return: -EAGAIN if update.blockable false and callback need to |
| 432 | * block, 0 otherwise. | 422 | * block, 0 otherwise. |
| 433 | * | 423 | * |
| 434 | * This callback ultimately originates from mmu_notifiers when the CPU | 424 | * This callback ultimately originates from mmu_notifiers when the CPU |
| @@ -465,35 +455,10 @@ int hmm_mirror_register(struct hmm_mirror *mirror, struct mm_struct *mm); | |||
| 465 | void hmm_mirror_unregister(struct hmm_mirror *mirror); | 455 | void hmm_mirror_unregister(struct hmm_mirror *mirror); |
| 466 | 456 | ||
| 467 | /* | 457 | /* |
| 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 | |||
| 492 | /* | ||
| 493 | * Please see Documentation/vm/hmm.rst for how to use the range API. | 458 | * Please see Documentation/vm/hmm.rst for how to use the range API. |
| 494 | */ | 459 | */ |
| 495 | int hmm_range_register(struct hmm_range *range, | 460 | int hmm_range_register(struct hmm_range *range, |
| 496 | struct mm_struct *mm, | 461 | struct hmm_mirror *mirror, |
| 497 | unsigned long start, | 462 | unsigned long start, |
| 498 | unsigned long end, | 463 | unsigned long end, |
| 499 | unsigned page_shift); | 464 | unsigned page_shift); |
| @@ -529,7 +494,8 @@ static inline bool hmm_vma_range_done(struct hmm_range *range) | |||
| 529 | } | 494 | } |
| 530 | 495 | ||
| 531 | /* This is a temporary helper to avoid merge conflict between trees. */ | 496 | /* This is a temporary helper to avoid merge conflict between trees. */ |
| 532 | static inline int hmm_vma_fault(struct hmm_range *range, bool block) | 497 | static inline int hmm_vma_fault(struct hmm_mirror *mirror, |
| 498 | struct hmm_range *range, bool block) | ||
| 533 | { | 499 | { |
| 534 | long ret; | 500 | long ret; |
| 535 | 501 | ||
| @@ -542,7 +508,7 @@ static inline int hmm_vma_fault(struct hmm_range *range, bool block) | |||
| 542 | range->default_flags = 0; | 508 | range->default_flags = 0; |
| 543 | range->pfn_flags_mask = -1UL; | 509 | range->pfn_flags_mask = -1UL; |
| 544 | 510 | ||
| 545 | ret = hmm_range_register(range, range->vma->vm_mm, | 511 | ret = hmm_range_register(range, mirror, |
| 546 | range->start, range->end, | 512 | range->start, range->end, |
| 547 | PAGE_SHIFT); | 513 | PAGE_SHIFT); |
| 548 | if (ret) | 514 | if (ret) |
| @@ -561,7 +527,7 @@ static inline int hmm_vma_fault(struct hmm_range *range, bool block) | |||
| 561 | ret = hmm_range_fault(range, block); | 527 | ret = hmm_range_fault(range, block); |
| 562 | if (ret <= 0) { | 528 | if (ret <= 0) { |
| 563 | if (ret == -EBUSY || !ret) { | 529 | if (ret == -EBUSY || !ret) { |
| 564 | /* Same as above drop mmap_sem to match old API. */ | 530 | /* Same as above, drop mmap_sem to match old API. */ |
| 565 | up_read(&range->vma->vm_mm->mmap_sem); | 531 | up_read(&range->vma->vm_mm->mmap_sem); |
| 566 | ret = -EBUSY; | 532 | ret = -EBUSY; |
| 567 | } else if (ret == -EAGAIN) | 533 | } else if (ret == -EAGAIN) |
| @@ -573,208 +539,12 @@ static inline int hmm_vma_fault(struct hmm_range *range, bool block) | |||
| 573 | } | 539 | } |
| 574 | 540 | ||
| 575 | /* Below are for HMM internal use only! Not to be used by device driver! */ | 541 | /* Below are for HMM internal use only! Not to be used by device driver! */ |
| 576 | void hmm_mm_destroy(struct mm_struct *mm); | ||
| 577 | |||
| 578 | static inline void hmm_mm_init(struct mm_struct *mm) | 542 | static inline void hmm_mm_init(struct mm_struct *mm) |
| 579 | { | 543 | { |
| 580 | mm->hmm = NULL; | 544 | mm->hmm = NULL; |
| 581 | } | 545 | } |
| 582 | #else /* IS_ENABLED(CONFIG_HMM_MIRROR) */ | 546 | #else /* IS_ENABLED(CONFIG_HMM_MIRROR) */ |
| 583 | static inline void hmm_mm_destroy(struct mm_struct *mm) {} | ||
| 584 | static inline void hmm_mm_init(struct mm_struct *mm) {} | 547 | static inline void hmm_mm_init(struct mm_struct *mm) {} |
| 585 | #endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */ | 548 | #endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */ |
| 586 | 549 | ||
| 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 | |||
| 780 | #endif /* LINUX_HMM_H */ | 550 | #endif /* LINUX_HMM_H */ |
diff --git a/include/linux/host1x.h b/include/linux/host1x.h index cfff30b9a62e..e6eea45e1154 100644 --- a/include/linux/host1x.h +++ b/include/linux/host1x.h | |||
| @@ -297,6 +297,8 @@ struct host1x_device { | |||
| 297 | struct list_head clients; | 297 | struct list_head clients; |
| 298 | 298 | ||
| 299 | bool registered; | 299 | bool registered; |
| 300 | |||
| 301 | struct device_dma_parameters dma_parms; | ||
| 300 | }; | 302 | }; |
| 301 | 303 | ||
| 302 | static inline struct host1x_device *to_host1x_device(struct device *dev) | 304 | static inline struct host1x_device *to_host1x_device(struct device *dev) |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 2e8957eac4d4..4971100a8cab 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | #ifndef _LINUX_HRTIMER_H | 12 | #ifndef _LINUX_HRTIMER_H |
| 13 | #define _LINUX_HRTIMER_H | 13 | #define _LINUX_HRTIMER_H |
| 14 | 14 | ||
| 15 | #include <linux/hrtimer_defs.h> | ||
| 15 | #include <linux/rbtree.h> | 16 | #include <linux/rbtree.h> |
| 16 | #include <linux/ktime.h> | ||
| 17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
| 19 | #include <linux/percpu.h> | 19 | #include <linux/percpu.h> |
| @@ -298,26 +298,12 @@ struct clock_event_device; | |||
| 298 | 298 | ||
| 299 | extern void hrtimer_interrupt(struct clock_event_device *dev); | 299 | extern void hrtimer_interrupt(struct clock_event_device *dev); |
| 300 | 300 | ||
| 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 | |||
| 312 | extern void clock_was_set_delayed(void); | 301 | extern void clock_was_set_delayed(void); |
| 313 | 302 | ||
| 314 | extern unsigned int hrtimer_resolution; | 303 | extern unsigned int hrtimer_resolution; |
| 315 | 304 | ||
| 316 | #else | 305 | #else |
| 317 | 306 | ||
| 318 | # define MONOTONIC_RES_NSEC LOW_RES_NSEC | ||
| 319 | # define KTIME_MONOTONIC_RES KTIME_LOW_RES | ||
| 320 | |||
| 321 | #define hrtimer_resolution (unsigned int)LOW_RES_NSEC | 307 | #define hrtimer_resolution (unsigned int)LOW_RES_NSEC |
| 322 | 308 | ||
| 323 | static inline void clock_was_set_delayed(void) { } | 309 | static inline void clock_was_set_delayed(void) { } |
diff --git a/include/linux/hrtimer_defs.h b/include/linux/hrtimer_defs.h new file mode 100644 index 000000000000..2d3e3c5fb946 --- /dev/null +++ b/include/linux/hrtimer_defs.h | |||
| @@ -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 | ||
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index edf476c8cfb9..edfca4278319 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
| @@ -16,29 +16,11 @@ struct user_struct; | |||
| 16 | struct mmu_gather; | 16 | struct mmu_gather; |
| 17 | 17 | ||
| 18 | #ifndef is_hugepd | 18 | #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 | */ | ||
| 26 | typedef struct { unsigned long pd; } hugepd_t; | 19 | typedef struct { unsigned long pd; } hugepd_t; |
| 27 | #define is_hugepd(hugepd) (0) | 20 | #define is_hugepd(hugepd) (0) |
| 28 | #define __hugepd(x) ((hugepd_t) { (x) }) | 21 | #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); | ||
| 39 | #endif | 22 | #endif |
| 40 | 23 | ||
| 41 | |||
| 42 | #ifdef CONFIG_HUGETLB_PAGE | 24 | #ifdef CONFIG_HUGETLB_PAGE |
| 43 | 25 | ||
| 44 | #include <linux/mempolicy.h> | 26 | #include <linux/mempolicy.h> |
| @@ -608,22 +590,92 @@ static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, | |||
| 608 | 590 | ||
| 609 | #else /* CONFIG_HUGETLB_PAGE */ | 591 | #else /* CONFIG_HUGETLB_PAGE */ |
| 610 | struct hstate {}; | 592 | struct hstate {}; |
| 611 | #define alloc_huge_page(v, a, r) NULL | 593 | |
| 612 | #define alloc_huge_page_node(h, nid) NULL | 594 | static inline struct page *alloc_huge_page(struct vm_area_struct *vma, |
| 613 | #define alloc_huge_page_nodemask(h, preferred_nid, nmask) NULL | 595 | unsigned long addr, |
| 614 | #define alloc_huge_page_vma(h, vma, address) NULL | 596 | int avoid_reserve) |
| 615 | #define alloc_bootmem_huge_page(h) NULL | 597 | { |
| 616 | #define hstate_file(f) NULL | 598 | return NULL; |
| 617 | #define hstate_sizelog(s) NULL | 599 | } |
| 618 | #define hstate_vma(v) NULL | 600 | |
| 619 | #define hstate_inode(i) NULL | 601 | static inline struct page *alloc_huge_page_node(struct hstate *h, int nid) |
| 620 | #define page_hstate(page) NULL | 602 | { |
| 621 | #define huge_page_size(h) PAGE_SIZE | 603 | return NULL; |
| 622 | #define huge_page_mask(h) PAGE_MASK | 604 | } |
| 623 | #define vma_kernel_pagesize(v) PAGE_SIZE | 605 | |
| 624 | #define vma_mmu_pagesize(v) PAGE_SIZE | 606 | static inline struct page * |
| 625 | #define huge_page_order(h) 0 | 607 | alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask) |
| 626 | #define huge_page_shift(h) PAGE_SHIFT | 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 | |||
| 627 | static inline bool hstate_is_gigantic(struct hstate *h) | 679 | static inline bool hstate_is_gigantic(struct hstate *h) |
| 628 | { | 680 | { |
| 629 | return false; | 681 | return false; |
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index c0b93e0ff0c0..8e6dd908da21 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Hardware Random Number Generator | 2 | Hardware Random Number Generator |
| 3 | 3 | ||
| 4 | Please read Documentation/hw_random.txt for details on use. | 4 | Please read Documentation/admin-guide/hw_random.rst for details on use. |
| 5 | 5 | ||
| 6 | ---------------------------------------------------------- | 6 | ---------------------------------------------------------- |
| 7 | This software may be used and distributed according to the terms | 7 | This software may be used and distributed according to the terms |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 1308126fc384..fa5552c2307b 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -1,19 +1,16 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | /* ------------------------------------------------------------------------- */ | 2 | /* |
| 3 | /* */ | 3 | * i2c.h - definitions for the Linux i2c bus interface |
| 4 | /* i2c.h - definitions for the i2c-bus interface */ | 4 | * Copyright (C) 1995-2000 Simon G. Vogl |
| 5 | /* */ | 5 | * Copyright (C) 2013-2019 Wolfram Sang <wsa@the-dreams.de> |
| 6 | /* ------------------------------------------------------------------------- */ | 6 | * |
| 7 | /* Copyright (C) 1995-2000 Simon G. Vogl | 7 | * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and |
| 8 | 8 | * Frodo Looijaard <frodol@dds.nl> | |
| 9 | */ | 9 | */ |
| 10 | /* ------------------------------------------------------------------------- */ | ||
| 11 | |||
| 12 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and | ||
| 13 | Frodo Looijaard <frodol@dds.nl> */ | ||
| 14 | #ifndef _LINUX_I2C_H | 10 | #ifndef _LINUX_I2C_H |
| 15 | #define _LINUX_I2C_H | 11 | #define _LINUX_I2C_H |
| 16 | 12 | ||
| 13 | #include <linux/acpi.h> /* for acpi_handle */ | ||
| 17 | #include <linux/mod_devicetable.h> | 14 | #include <linux/mod_devicetable.h> |
| 18 | #include <linux/device.h> /* for struct device */ | 15 | #include <linux/device.h> /* for struct device */ |
| 19 | #include <linux/sched.h> /* for completion */ | 16 | #include <linux/sched.h> /* for completion */ |
| @@ -39,7 +36,8 @@ struct i2c_device_identity; | |||
| 39 | union i2c_smbus_data; | 36 | union i2c_smbus_data; |
| 40 | struct i2c_board_info; | 37 | struct i2c_board_info; |
| 41 | enum i2c_slave_event; | 38 | 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); | ||
| 43 | 41 | ||
| 44 | struct module; | 42 | struct module; |
| 45 | struct property_entry; | 43 | struct property_entry; |
| @@ -256,16 +254,16 @@ struct i2c_driver { | |||
| 256 | unsigned int class; | 254 | unsigned int class; |
| 257 | 255 | ||
| 258 | /* Standard driver model interfaces */ | 256 | /* Standard driver model interfaces */ |
| 259 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); | 257 | int (*probe)(struct i2c_client *client, const struct i2c_device_id *id); |
| 260 | int (*remove)(struct i2c_client *); | 258 | int (*remove)(struct i2c_client *client); |
| 261 | 259 | ||
| 262 | /* New driver model interface to aid the seamless removal of the | 260 | /* New driver model interface to aid the seamless removal of the |
| 263 | * current probe()'s, more commonly unused than used second parameter. | 261 | * current probe()'s, more commonly unused than used second parameter. |
| 264 | */ | 262 | */ |
| 265 | int (*probe_new)(struct i2c_client *); | 263 | int (*probe_new)(struct i2c_client *client); |
| 266 | 264 | ||
| 267 | /* driver model interfaces that don't relate to enumeration */ | 265 | /* driver model interfaces that don't relate to enumeration */ |
| 268 | void (*shutdown)(struct i2c_client *); | 266 | void (*shutdown)(struct i2c_client *client); |
| 269 | 267 | ||
| 270 | /* Alert callback, for example for the SMBus alert protocol. | 268 | /* Alert callback, for example for the SMBus alert protocol. |
| 271 | * The format and meaning of the data value depends on the protocol. | 269 | * The format and meaning of the data value depends on the protocol. |
| @@ -274,7 +272,7 @@ struct i2c_driver { | |||
| 274 | * For the SMBus Host Notify protocol, the data corresponds to the | 272 | * For the SMBus Host Notify protocol, the data corresponds to the |
| 275 | * 16-bit payload data reported by the slave device acting as master. | 273 | * 16-bit payload data reported by the slave device acting as master. |
| 276 | */ | 274 | */ |
| 277 | void (*alert)(struct i2c_client *, enum i2c_alert_protocol protocol, | 275 | void (*alert)(struct i2c_client *client, enum i2c_alert_protocol protocol, |
| 278 | unsigned int data); | 276 | unsigned int data); |
| 279 | 277 | ||
| 280 | /* a ioctl like command that can be used to perform specific functions | 278 | /* a ioctl like command that can be used to perform specific functions |
| @@ -286,7 +284,7 @@ struct i2c_driver { | |||
| 286 | const struct i2c_device_id *id_table; | 284 | const struct i2c_device_id *id_table; |
| 287 | 285 | ||
| 288 | /* Device detection callback for automatic device creation */ | 286 | /* 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); |
| 290 | const unsigned short *address_list; | 288 | const unsigned short *address_list; |
| 291 | struct list_head clients; | 289 | struct list_head clients; |
| 292 | 290 | ||
| @@ -296,8 +294,7 @@ struct i2c_driver { | |||
| 296 | 294 | ||
| 297 | /** | 295 | /** |
| 298 | * struct i2c_client - represent an I2C slave device | 296 | * struct i2c_client - represent an I2C slave device |
| 299 | * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address; | 297 | * @flags: see I2C_CLIENT_* for possible flags |
| 300 | * I2C_CLIENT_PEC indicates it uses SMBus Packet Error Checking | ||
| 301 | * @addr: Address used on the I2C bus connected to the parent adapter. | 298 | * @addr: Address used on the I2C bus connected to the parent adapter. |
| 302 | * @name: Indicates the type of the device, usually a chip name that's | 299 | * @name: Indicates the type of the device, usually a chip name that's |
| 303 | * generic enough to hide second-sourcing and compatible revisions. | 300 | * generic enough to hide second-sourcing and compatible revisions. |
| @@ -315,6 +312,15 @@ struct i2c_driver { | |||
| 315 | */ | 312 | */ |
| 316 | struct i2c_client { | 313 | struct i2c_client { |
| 317 | unsigned short flags; /* div., see below */ | 314 | 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 | |||
| 318 | unsigned short addr; /* chip address - NOTE: 7bit */ | 324 | unsigned short addr; /* chip address - NOTE: 7bit */ |
| 319 | /* addresses are stored in the */ | 325 | /* addresses are stored in the */ |
| 320 | /* _LOWER_ 7 bits */ | 326 | /* _LOWER_ 7 bits */ |
| @@ -436,6 +442,9 @@ struct i2c_board_info { | |||
| 436 | extern struct i2c_client * | 442 | extern struct i2c_client * |
| 437 | i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info); | 443 | i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info); |
| 438 | 444 | ||
| 445 | extern struct i2c_client * | ||
| 446 | i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *info); | ||
| 447 | |||
| 439 | /* If you don't know the exact address of an I2C device, use this variant | 448 | /* If you don't know the exact address of an I2C device, use this variant |
| 440 | * instead, which can probe for device presence in a list of possible | 449 | * instead, which can probe for device presence in a list of possible |
| 441 | * addresses. The "probe" callback function is optional. If it is provided, | 450 | * addresses. The "probe" callback function is optional. If it is provided, |
| @@ -446,10 +455,10 @@ extern struct i2c_client * | |||
| 446 | i2c_new_probed_device(struct i2c_adapter *adap, | 455 | i2c_new_probed_device(struct i2c_adapter *adap, |
| 447 | struct i2c_board_info *info, | 456 | struct i2c_board_info *info, |
| 448 | unsigned short const *addr_list, | 457 | unsigned short const *addr_list, |
| 449 | int (*probe)(struct i2c_adapter *, unsigned short addr)); | 458 | int (*probe)(struct i2c_adapter *adap, unsigned short addr)); |
| 450 | 459 | ||
| 451 | /* Common custom probe functions */ | 460 | /* 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); |
| 453 | 462 | ||
| 454 | /* For devices that use several addresses, use i2c_new_dummy() to make | 463 | /* For devices that use several addresses, use i2c_new_dummy() to make |
| 455 | * client handles for the extra addresses. | 464 | * client handles for the extra addresses. |
| @@ -458,6 +467,9 @@ extern struct i2c_client * | |||
| 458 | i2c_new_dummy(struct i2c_adapter *adap, u16 address); | 467 | i2c_new_dummy(struct i2c_adapter *adap, u16 address); |
| 459 | 468 | ||
| 460 | extern struct i2c_client * | 469 | extern struct i2c_client * |
| 470 | i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address); | ||
| 471 | |||
| 472 | extern struct i2c_client * | ||
| 461 | devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address); | 473 | devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address); |
| 462 | 474 | ||
| 463 | extern struct i2c_client * | 475 | extern struct i2c_client * |
| @@ -465,7 +477,7 @@ i2c_new_secondary_device(struct i2c_client *client, | |||
| 465 | const char *name, | 477 | const char *name, |
| 466 | u16 default_addr); | 478 | u16 default_addr); |
| 467 | 479 | ||
| 468 | extern void i2c_unregister_device(struct i2c_client *); | 480 | extern void i2c_unregister_device(struct i2c_client *client); |
| 469 | #endif /* I2C */ | 481 | #endif /* I2C */ |
| 470 | 482 | ||
| 471 | /* Mainboard arch_initcall() code should register all its I2C devices. | 483 | /* Mainboard arch_initcall() code should register all its I2C devices. |
| @@ -550,9 +562,9 @@ struct i2c_algorithm { | |||
| 550 | * The main operations are wrapped by i2c_lock_bus and i2c_unlock_bus. | 562 | * The main operations are wrapped by i2c_lock_bus and i2c_unlock_bus. |
| 551 | */ | 563 | */ |
| 552 | struct i2c_lock_operations { | 564 | struct i2c_lock_operations { |
| 553 | void (*lock_bus)(struct i2c_adapter *, unsigned int flags); | 565 | void (*lock_bus)(struct i2c_adapter *adapter, unsigned int flags); |
| 554 | int (*trylock_bus)(struct i2c_adapter *, unsigned int flags); | 566 | int (*trylock_bus)(struct i2c_adapter *adapter, unsigned int flags); |
| 555 | void (*unlock_bus)(struct i2c_adapter *, unsigned int flags); | 567 | void (*unlock_bus)(struct i2c_adapter *adapter, unsigned int flags); |
| 556 | }; | 568 | }; |
| 557 | 569 | ||
| 558 | /** | 570 | /** |
| @@ -702,14 +714,14 @@ struct i2c_adapter { | |||
| 702 | }; | 714 | }; |
| 703 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) | 715 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) |
| 704 | 716 | ||
| 705 | static inline void *i2c_get_adapdata(const struct i2c_adapter *dev) | 717 | static inline void *i2c_get_adapdata(const struct i2c_adapter *adap) |
| 706 | { | 718 | { |
| 707 | return dev_get_drvdata(&dev->dev); | 719 | return dev_get_drvdata(&adap->dev); |
| 708 | } | 720 | } |
| 709 | 721 | ||
| 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) |
| 711 | { | 723 | { |
| 712 | dev_set_drvdata(&dev->dev, data); | 724 | dev_set_drvdata(&adap->dev, data); |
| 713 | } | 725 | } |
| 714 | 726 | ||
| 715 | static inline struct i2c_adapter * | 727 | static inline struct i2c_adapter * |
| @@ -725,7 +737,7 @@ i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) | |||
| 725 | return NULL; | 737 | return NULL; |
| 726 | } | 738 | } |
| 727 | 739 | ||
| 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)); |
| 729 | 741 | ||
| 730 | /* Adapter locking functions, exported for shared pin cases */ | 742 | /* Adapter locking functions, exported for shared pin cases */ |
| 731 | #define I2C_LOCK_ROOT_ADAPTER BIT(0) | 743 | #define I2C_LOCK_ROOT_ADAPTER BIT(0) |
| @@ -801,16 +813,6 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap) | |||
| 801 | i2c_unlock_bus(adap, I2C_LOCK_ROOT_ADAPTER); | 813 | i2c_unlock_bus(adap, I2C_LOCK_ROOT_ADAPTER); |
| 802 | } | 814 | } |
| 803 | 815 | ||
| 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 | |||
| 814 | /* i2c adapter classes (bitmask) */ | 816 | /* i2c adapter classes (bitmask) */ |
| 815 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ | 817 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ |
| 816 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ | 818 | #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) | |||
| 831 | /* administration... | 833 | /* administration... |
| 832 | */ | 834 | */ |
| 833 | #if IS_ENABLED(CONFIG_I2C) | 835 | #if IS_ENABLED(CONFIG_I2C) |
| 834 | extern int i2c_add_adapter(struct i2c_adapter *); | 836 | extern int i2c_add_adapter(struct i2c_adapter *adap); |
| 835 | extern void i2c_del_adapter(struct i2c_adapter *); | 837 | extern void i2c_del_adapter(struct i2c_adapter *adap); |
| 836 | extern int i2c_add_numbered_adapter(struct i2c_adapter *); | 838 | extern int i2c_add_numbered_adapter(struct i2c_adapter *adap); |
| 837 | 839 | ||
| 838 | extern int i2c_register_driver(struct module *, struct i2c_driver *); | 840 | extern int i2c_register_driver(struct module *owner, struct i2c_driver *driver); |
| 839 | extern void i2c_del_driver(struct i2c_driver *); | 841 | extern void i2c_del_driver(struct i2c_driver *driver); |
| 840 | 842 | ||
| 841 | /* use a define to avoid include chaining to get THIS_MODULE */ | 843 | /* use a define to avoid include chaining to get THIS_MODULE */ |
| 842 | #define i2c_add_driver(driver) \ | 844 | #define i2c_add_driver(driver) \ |
| @@ -981,6 +983,7 @@ bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares, | |||
| 981 | u32 i2c_acpi_find_bus_speed(struct device *dev); | 983 | u32 i2c_acpi_find_bus_speed(struct device *dev); |
| 982 | struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, | 984 | struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, |
| 983 | struct i2c_board_info *info); | 985 | struct i2c_board_info *info); |
| 986 | struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle); | ||
| 984 | #else | 987 | #else |
| 985 | static inline bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares, | 988 | static inline bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares, |
| 986 | struct acpi_resource_i2c_serialbus **i2c) | 989 | struct acpi_resource_i2c_serialbus **i2c) |
| @@ -996,6 +999,10 @@ static inline struct i2c_client *i2c_acpi_new_device(struct device *dev, | |||
| 996 | { | 999 | { |
| 997 | return NULL; | 1000 | return NULL; |
| 998 | } | 1001 | } |
| 1002 | static inline struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle) | ||
| 1003 | { | ||
| 1004 | return NULL; | ||
| 1005 | } | ||
| 999 | #endif /* CONFIG_ACPI */ | 1006 | #endif /* CONFIG_ACPI */ |
| 1000 | 1007 | ||
| 1001 | #endif /* _LINUX_I2C_H */ | 1008 | #endif /* _LINUX_I2C_H */ |
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index f13fd8b1dd79..1f08fa8d69d2 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h | |||
| @@ -48,7 +48,7 @@ struct i3c_i2c_dev_desc { | |||
| 48 | #define I3C_LVR_I2C_INDEX(x) ((x) << 5) | 48 | #define I3C_LVR_I2C_INDEX(x) ((x) << 5) |
| 49 | #define I3C_LVR_I2C_FM_MODE BIT(4) | 49 | #define I3C_LVR_I2C_FM_MODE BIT(4) |
| 50 | 50 | ||
| 51 | #define I2C_MAX_ADDR GENMASK(9, 0) | 51 | #define I2C_MAX_ADDR GENMASK(6, 0) |
| 52 | 52 | ||
| 53 | /** | 53 | /** |
| 54 | * struct i2c_dev_boardinfo - I2C device board information | 54 | * struct i2c_dev_boardinfo - I2C device board information |
| @@ -250,12 +250,17 @@ struct i3c_device { | |||
| 250 | * the bus. The only impact in this mode is that the | 250 | * the bus. The only impact in this mode is that the |
| 251 | * high SCL pulse has to stay below 50ns to trick I2C | 251 | * high SCL pulse has to stay below 50ns to trick I2C |
| 252 | * devices when transmitting I3C frames | 252 | * 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. | ||
| 253 | * @I3C_BUS_MODE_MIXED_SLOW: I2C devices without 50ns spike filter are present | 257 | * @I3C_BUS_MODE_MIXED_SLOW: I2C devices without 50ns spike filter are present |
| 254 | * on the bus | 258 | * on the bus |
| 255 | */ | 259 | */ |
| 256 | enum i3c_bus_mode { | 260 | enum i3c_bus_mode { |
| 257 | I3C_BUS_MODE_PURE, | 261 | I3C_BUS_MODE_PURE, |
| 258 | I3C_BUS_MODE_MIXED_FAST, | 262 | I3C_BUS_MODE_MIXED_FAST, |
| 263 | I3C_BUS_MODE_MIXED_LIMITED, | ||
| 259 | I3C_BUS_MODE_MIXED_SLOW, | 264 | I3C_BUS_MODE_MIXED_SLOW, |
| 260 | }; | 265 | }; |
| 261 | 266 | ||
| @@ -390,8 +395,6 @@ struct i3c_bus { | |||
| 390 | * and i2c_put_dma_safe_msg_buf() helpers provided by the I2C | 395 | * and i2c_put_dma_safe_msg_buf() helpers provided by the I2C |
| 391 | * framework. | 396 | * framework. |
| 392 | * This method is mandatory. | 397 | * This method is mandatory. |
| 393 | * @i2c_funcs: expose the supported I2C functionalities. | ||
| 394 | * This method is mandatory. | ||
| 395 | * @request_ibi: attach an IBI handler to an I3C device. This implies defining | 398 | * @request_ibi: attach an IBI handler to an I3C device. This implies defining |
| 396 | * an IBI handler and the constraints of the IBI (maximum payload | 399 | * an IBI handler and the constraints of the IBI (maximum payload |
| 397 | * length and number of pre-allocated slots). | 400 | * length and number of pre-allocated slots). |
| @@ -437,7 +440,6 @@ struct i3c_master_controller_ops { | |||
| 437 | void (*detach_i2c_dev)(struct i2c_dev_desc *dev); | 440 | void (*detach_i2c_dev)(struct i2c_dev_desc *dev); |
| 438 | int (*i2c_xfers)(struct i2c_dev_desc *dev, | 441 | int (*i2c_xfers)(struct i2c_dev_desc *dev, |
| 439 | const struct i2c_msg *xfers, int nxfers); | 442 | const struct i2c_msg *xfers, int nxfers); |
| 440 | u32 (*i2c_funcs)(struct i3c_master_controller *master); | ||
| 441 | int (*request_ibi)(struct i3c_dev_desc *dev, | 443 | int (*request_ibi)(struct i3c_dev_desc *dev, |
| 442 | const struct i3c_ibi_setup *req); | 444 | const struct i3c_ibi_setup *req); |
| 443 | void (*free_ibi)(struct i3c_dev_desc *dev); | 445 | void (*free_ibi)(struct i3c_dev_desc *dev); |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 971cf76a78a0..46b771d6999e 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -253,9 +253,9 @@ static inline void ide_std_init_ports(struct ide_hw *hw, | |||
| 253 | * Special Driver Flags | 253 | * Special Driver Flags |
| 254 | */ | 254 | */ |
| 255 | enum { | 255 | enum { |
| 256 | IDE_SFLAG_SET_GEOMETRY = (1 << 0), | 256 | IDE_SFLAG_SET_GEOMETRY = BIT(0), |
| 257 | IDE_SFLAG_RECALIBRATE = (1 << 1), | 257 | IDE_SFLAG_RECALIBRATE = BIT(1), |
| 258 | IDE_SFLAG_SET_MULTMODE = (1 << 2), | 258 | IDE_SFLAG_SET_MULTMODE = BIT(2), |
| 259 | }; | 259 | }; |
| 260 | 260 | ||
| 261 | /* | 261 | /* |
| @@ -267,13 +267,13 @@ typedef enum { | |||
| 267 | } ide_startstop_t; | 267 | } ide_startstop_t; |
| 268 | 268 | ||
| 269 | enum { | 269 | enum { |
| 270 | IDE_VALID_ERROR = (1 << 1), | 270 | IDE_VALID_ERROR = BIT(1), |
| 271 | IDE_VALID_FEATURE = IDE_VALID_ERROR, | 271 | IDE_VALID_FEATURE = IDE_VALID_ERROR, |
| 272 | IDE_VALID_NSECT = (1 << 2), | 272 | IDE_VALID_NSECT = BIT(2), |
| 273 | IDE_VALID_LBAL = (1 << 3), | 273 | IDE_VALID_LBAL = BIT(3), |
| 274 | IDE_VALID_LBAM = (1 << 4), | 274 | IDE_VALID_LBAM = BIT(4), |
| 275 | IDE_VALID_LBAH = (1 << 5), | 275 | IDE_VALID_LBAH = BIT(5), |
| 276 | IDE_VALID_DEVICE = (1 << 6), | 276 | IDE_VALID_DEVICE = BIT(6), |
| 277 | IDE_VALID_LBA = IDE_VALID_LBAL | | 277 | IDE_VALID_LBA = IDE_VALID_LBAL | |
| 278 | IDE_VALID_LBAM | | 278 | IDE_VALID_LBAM | |
| 279 | IDE_VALID_LBAH, | 279 | IDE_VALID_LBAH, |
| @@ -289,24 +289,24 @@ enum { | |||
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | enum { | 291 | enum { |
| 292 | IDE_TFLAG_LBA48 = (1 << 0), | 292 | IDE_TFLAG_LBA48 = BIT(0), |
| 293 | IDE_TFLAG_WRITE = (1 << 1), | 293 | IDE_TFLAG_WRITE = BIT(1), |
| 294 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 2), | 294 | IDE_TFLAG_CUSTOM_HANDLER = BIT(2), |
| 295 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 3), | 295 | IDE_TFLAG_DMA_PIO_FALLBACK = BIT(3), |
| 296 | /* force 16-bit I/O operations */ | 296 | /* force 16-bit I/O operations */ |
| 297 | IDE_TFLAG_IO_16BIT = (1 << 4), | 297 | IDE_TFLAG_IO_16BIT = BIT(4), |
| 298 | /* struct ide_cmd was allocated using kmalloc() */ | 298 | /* struct ide_cmd was allocated using kmalloc() */ |
| 299 | IDE_TFLAG_DYN = (1 << 5), | 299 | IDE_TFLAG_DYN = BIT(5), |
| 300 | IDE_TFLAG_FS = (1 << 6), | 300 | IDE_TFLAG_FS = BIT(6), |
| 301 | IDE_TFLAG_MULTI_PIO = (1 << 7), | 301 | IDE_TFLAG_MULTI_PIO = BIT(7), |
| 302 | IDE_TFLAG_SET_XFER = (1 << 8), | 302 | IDE_TFLAG_SET_XFER = BIT(8), |
| 303 | }; | 303 | }; |
| 304 | 304 | ||
| 305 | enum { | 305 | enum { |
| 306 | IDE_FTFLAG_FLAGGED = (1 << 0), | 306 | IDE_FTFLAG_FLAGGED = BIT(0), |
| 307 | IDE_FTFLAG_SET_IN_FLAGS = (1 << 1), | 307 | IDE_FTFLAG_SET_IN_FLAGS = BIT(1), |
| 308 | IDE_FTFLAG_OUT_DATA = (1 << 2), | 308 | IDE_FTFLAG_OUT_DATA = BIT(2), |
| 309 | IDE_FTFLAG_IN_DATA = (1 << 3), | 309 | IDE_FTFLAG_IN_DATA = BIT(3), |
| 310 | }; | 310 | }; |
| 311 | 311 | ||
| 312 | struct ide_taskfile { | 312 | struct ide_taskfile { |
| @@ -357,13 +357,13 @@ struct ide_cmd { | |||
| 357 | /* ATAPI packet command flags */ | 357 | /* ATAPI packet command flags */ |
| 358 | enum { | 358 | enum { |
| 359 | /* set when an error is considered normal - no retry (ide-tape) */ | 359 | /* set when an error is considered normal - no retry (ide-tape) */ |
| 360 | PC_FLAG_ABORT = (1 << 0), | 360 | PC_FLAG_ABORT = BIT(0), |
| 361 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), | 361 | PC_FLAG_SUPPRESS_ERROR = BIT(1), |
| 362 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), | 362 | PC_FLAG_WAIT_FOR_DSC = BIT(2), |
| 363 | PC_FLAG_DMA_OK = (1 << 3), | 363 | PC_FLAG_DMA_OK = BIT(3), |
| 364 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), | 364 | PC_FLAG_DMA_IN_PROGRESS = BIT(4), |
| 365 | PC_FLAG_DMA_ERROR = (1 << 5), | 365 | PC_FLAG_DMA_ERROR = BIT(5), |
| 366 | PC_FLAG_WRITING = (1 << 6), | 366 | PC_FLAG_WRITING = BIT(6), |
| 367 | }; | 367 | }; |
| 368 | 368 | ||
| 369 | #define ATAPI_WAIT_PC (60 * HZ) | 369 | #define ATAPI_WAIT_PC (60 * HZ) |
| @@ -417,111 +417,111 @@ struct ide_disk_ops { | |||
| 417 | 417 | ||
| 418 | /* ATAPI device flags */ | 418 | /* ATAPI device flags */ |
| 419 | enum { | 419 | enum { |
| 420 | IDE_AFLAG_DRQ_INTERRUPT = (1 << 0), | 420 | IDE_AFLAG_DRQ_INTERRUPT = BIT(0), |
| 421 | 421 | ||
| 422 | /* ide-cd */ | 422 | /* ide-cd */ |
| 423 | /* Drive cannot eject the disc. */ | 423 | /* Drive cannot eject the disc. */ |
| 424 | IDE_AFLAG_NO_EJECT = (1 << 1), | 424 | IDE_AFLAG_NO_EJECT = BIT(1), |
| 425 | /* Drive is a pre ATAPI 1.2 drive. */ | 425 | /* Drive is a pre ATAPI 1.2 drive. */ |
| 426 | IDE_AFLAG_PRE_ATAPI12 = (1 << 2), | 426 | IDE_AFLAG_PRE_ATAPI12 = BIT(2), |
| 427 | /* TOC addresses are in BCD. */ | 427 | /* TOC addresses are in BCD. */ |
| 428 | IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3), | 428 | IDE_AFLAG_TOCADDR_AS_BCD = BIT(3), |
| 429 | /* TOC track numbers are in BCD. */ | 429 | /* TOC track numbers are in BCD. */ |
| 430 | IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4), | 430 | IDE_AFLAG_TOCTRACKS_AS_BCD = BIT(4), |
| 431 | /* Saved TOC information is current. */ | 431 | /* Saved TOC information is current. */ |
| 432 | IDE_AFLAG_TOC_VALID = (1 << 6), | 432 | IDE_AFLAG_TOC_VALID = BIT(6), |
| 433 | /* We think that the drive door is locked. */ | 433 | /* We think that the drive door is locked. */ |
| 434 | IDE_AFLAG_DOOR_LOCKED = (1 << 7), | 434 | IDE_AFLAG_DOOR_LOCKED = BIT(7), |
| 435 | /* SET_CD_SPEED command is unsupported. */ | 435 | /* SET_CD_SPEED command is unsupported. */ |
| 436 | IDE_AFLAG_NO_SPEED_SELECT = (1 << 8), | 436 | IDE_AFLAG_NO_SPEED_SELECT = BIT(8), |
| 437 | IDE_AFLAG_VERTOS_300_SSD = (1 << 9), | 437 | IDE_AFLAG_VERTOS_300_SSD = BIT(9), |
| 438 | IDE_AFLAG_VERTOS_600_ESD = (1 << 10), | 438 | IDE_AFLAG_VERTOS_600_ESD = BIT(10), |
| 439 | IDE_AFLAG_SANYO_3CD = (1 << 11), | 439 | IDE_AFLAG_SANYO_3CD = BIT(11), |
| 440 | IDE_AFLAG_FULL_CAPS_PAGE = (1 << 12), | 440 | IDE_AFLAG_FULL_CAPS_PAGE = BIT(12), |
| 441 | IDE_AFLAG_PLAY_AUDIO_OK = (1 << 13), | 441 | IDE_AFLAG_PLAY_AUDIO_OK = BIT(13), |
| 442 | IDE_AFLAG_LE_SPEED_FIELDS = (1 << 14), | 442 | IDE_AFLAG_LE_SPEED_FIELDS = BIT(14), |
| 443 | 443 | ||
| 444 | /* ide-floppy */ | 444 | /* ide-floppy */ |
| 445 | /* Avoid commands not supported in Clik drive */ | 445 | /* Avoid commands not supported in Clik drive */ |
| 446 | IDE_AFLAG_CLIK_DRIVE = (1 << 15), | 446 | IDE_AFLAG_CLIK_DRIVE = BIT(15), |
| 447 | /* Requires BH algorithm for packets */ | 447 | /* Requires BH algorithm for packets */ |
| 448 | IDE_AFLAG_ZIP_DRIVE = (1 << 16), | 448 | IDE_AFLAG_ZIP_DRIVE = BIT(16), |
| 449 | /* Supports format progress report */ | 449 | /* Supports format progress report */ |
| 450 | IDE_AFLAG_SRFP = (1 << 17), | 450 | IDE_AFLAG_SRFP = BIT(17), |
| 451 | 451 | ||
| 452 | /* ide-tape */ | 452 | /* ide-tape */ |
| 453 | IDE_AFLAG_IGNORE_DSC = (1 << 18), | 453 | IDE_AFLAG_IGNORE_DSC = BIT(18), |
| 454 | /* 0 When the tape position is unknown */ | 454 | /* 0 When the tape position is unknown */ |
| 455 | IDE_AFLAG_ADDRESS_VALID = (1 << 19), | 455 | IDE_AFLAG_ADDRESS_VALID = BIT(19), |
| 456 | /* Device already opened */ | 456 | /* Device already opened */ |
| 457 | IDE_AFLAG_BUSY = (1 << 20), | 457 | IDE_AFLAG_BUSY = BIT(20), |
| 458 | /* Attempt to auto-detect the current user block size */ | 458 | /* Attempt to auto-detect the current user block size */ |
| 459 | IDE_AFLAG_DETECT_BS = (1 << 21), | 459 | IDE_AFLAG_DETECT_BS = BIT(21), |
| 460 | /* Currently on a filemark */ | 460 | /* Currently on a filemark */ |
| 461 | IDE_AFLAG_FILEMARK = (1 << 22), | 461 | IDE_AFLAG_FILEMARK = BIT(22), |
| 462 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ | 462 | /* 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), |
| 464 | 464 | ||
| 465 | IDE_AFLAG_NO_AUTOCLOSE = (1 << 24), | 465 | IDE_AFLAG_NO_AUTOCLOSE = BIT(24), |
| 466 | }; | 466 | }; |
| 467 | 467 | ||
| 468 | /* device flags */ | 468 | /* device flags */ |
| 469 | enum { | 469 | enum { |
| 470 | /* restore settings after device reset */ | 470 | /* restore settings after device reset */ |
| 471 | IDE_DFLAG_KEEP_SETTINGS = (1 << 0), | 471 | IDE_DFLAG_KEEP_SETTINGS = BIT(0), |
| 472 | /* device is using DMA for read/write */ | 472 | /* device is using DMA for read/write */ |
| 473 | IDE_DFLAG_USING_DMA = (1 << 1), | 473 | IDE_DFLAG_USING_DMA = BIT(1), |
| 474 | /* okay to unmask other IRQs */ | 474 | /* okay to unmask other IRQs */ |
| 475 | IDE_DFLAG_UNMASK = (1 << 2), | 475 | IDE_DFLAG_UNMASK = BIT(2), |
| 476 | /* don't attempt flushes */ | 476 | /* don't attempt flushes */ |
| 477 | IDE_DFLAG_NOFLUSH = (1 << 3), | 477 | IDE_DFLAG_NOFLUSH = BIT(3), |
| 478 | /* DSC overlap */ | 478 | /* DSC overlap */ |
| 479 | IDE_DFLAG_DSC_OVERLAP = (1 << 4), | 479 | IDE_DFLAG_DSC_OVERLAP = BIT(4), |
| 480 | /* give potential excess bandwidth */ | 480 | /* give potential excess bandwidth */ |
| 481 | IDE_DFLAG_NICE1 = (1 << 5), | 481 | IDE_DFLAG_NICE1 = BIT(5), |
| 482 | /* device is physically present */ | 482 | /* device is physically present */ |
| 483 | IDE_DFLAG_PRESENT = (1 << 6), | 483 | IDE_DFLAG_PRESENT = BIT(6), |
| 484 | /* disable Host Protected Area */ | 484 | /* disable Host Protected Area */ |
| 485 | IDE_DFLAG_NOHPA = (1 << 7), | 485 | IDE_DFLAG_NOHPA = BIT(7), |
| 486 | /* id read from device (synthetic if not set) */ | 486 | /* id read from device (synthetic if not set) */ |
| 487 | IDE_DFLAG_ID_READ = (1 << 8), | 487 | IDE_DFLAG_ID_READ = BIT(8), |
| 488 | IDE_DFLAG_NOPROBE = (1 << 9), | 488 | IDE_DFLAG_NOPROBE = BIT(9), |
| 489 | /* need to do check_media_change() */ | 489 | /* need to do check_media_change() */ |
| 490 | IDE_DFLAG_REMOVABLE = (1 << 10), | 490 | IDE_DFLAG_REMOVABLE = BIT(10), |
| 491 | /* needed for removable devices */ | 491 | /* needed for removable devices */ |
| 492 | IDE_DFLAG_ATTACH = (1 << 11), | 492 | IDE_DFLAG_ATTACH = BIT(11), |
| 493 | IDE_DFLAG_FORCED_GEOM = (1 << 12), | 493 | IDE_DFLAG_FORCED_GEOM = BIT(12), |
| 494 | /* disallow setting unmask bit */ | 494 | /* disallow setting unmask bit */ |
| 495 | IDE_DFLAG_NO_UNMASK = (1 << 13), | 495 | IDE_DFLAG_NO_UNMASK = BIT(13), |
| 496 | /* disallow enabling 32-bit I/O */ | 496 | /* disallow enabling 32-bit I/O */ |
| 497 | IDE_DFLAG_NO_IO_32BIT = (1 << 14), | 497 | IDE_DFLAG_NO_IO_32BIT = BIT(14), |
| 498 | /* for removable only: door lock/unlock works */ | 498 | /* for removable only: door lock/unlock works */ |
| 499 | IDE_DFLAG_DOORLOCKING = (1 << 15), | 499 | IDE_DFLAG_DOORLOCKING = BIT(15), |
| 500 | /* disallow DMA */ | 500 | /* disallow DMA */ |
| 501 | IDE_DFLAG_NODMA = (1 << 16), | 501 | IDE_DFLAG_NODMA = BIT(16), |
| 502 | /* powermanagement told us not to do anything, so sleep nicely */ | 502 | /* powermanagement told us not to do anything, so sleep nicely */ |
| 503 | IDE_DFLAG_BLOCKED = (1 << 17), | 503 | IDE_DFLAG_BLOCKED = BIT(17), |
| 504 | /* sleeping & sleep field valid */ | 504 | /* sleeping & sleep field valid */ |
| 505 | IDE_DFLAG_SLEEPING = (1 << 18), | 505 | IDE_DFLAG_SLEEPING = BIT(18), |
| 506 | IDE_DFLAG_POST_RESET = (1 << 19), | 506 | IDE_DFLAG_POST_RESET = BIT(19), |
| 507 | IDE_DFLAG_UDMA33_WARNED = (1 << 20), | 507 | IDE_DFLAG_UDMA33_WARNED = BIT(20), |
| 508 | IDE_DFLAG_LBA48 = (1 << 21), | 508 | IDE_DFLAG_LBA48 = BIT(21), |
| 509 | /* status of write cache */ | 509 | /* status of write cache */ |
| 510 | IDE_DFLAG_WCACHE = (1 << 22), | 510 | IDE_DFLAG_WCACHE = BIT(22), |
| 511 | /* used for ignoring ATA_DF */ | 511 | /* used for ignoring ATA_DF */ |
| 512 | IDE_DFLAG_NOWERR = (1 << 23), | 512 | IDE_DFLAG_NOWERR = BIT(23), |
| 513 | /* retrying in PIO */ | 513 | /* retrying in PIO */ |
| 514 | IDE_DFLAG_DMA_PIO_RETRY = (1 << 24), | 514 | IDE_DFLAG_DMA_PIO_RETRY = BIT(24), |
| 515 | IDE_DFLAG_LBA = (1 << 25), | 515 | IDE_DFLAG_LBA = BIT(25), |
| 516 | /* don't unload heads */ | 516 | /* don't unload heads */ |
| 517 | IDE_DFLAG_NO_UNLOAD = (1 << 26), | 517 | IDE_DFLAG_NO_UNLOAD = BIT(26), |
| 518 | /* heads unloaded, please don't reset port */ | 518 | /* heads unloaded, please don't reset port */ |
| 519 | IDE_DFLAG_PARKED = (1 << 27), | 519 | IDE_DFLAG_PARKED = BIT(27), |
| 520 | IDE_DFLAG_MEDIA_CHANGED = (1 << 28), | 520 | IDE_DFLAG_MEDIA_CHANGED = BIT(28), |
| 521 | /* write protect */ | 521 | /* write protect */ |
| 522 | IDE_DFLAG_WP = (1 << 29), | 522 | IDE_DFLAG_WP = BIT(29), |
| 523 | IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30), | 523 | IDE_DFLAG_FORMAT_IN_PROGRESS = BIT(30), |
| 524 | IDE_DFLAG_NIEN_QUIRK = (1 << 31), | 524 | IDE_DFLAG_NIEN_QUIRK = BIT(31), |
| 525 | }; | 525 | }; |
| 526 | 526 | ||
| 527 | struct ide_drive_s { | 527 | struct ide_drive_s { |
| @@ -709,7 +709,7 @@ struct ide_dma_ops { | |||
| 709 | }; | 709 | }; |
| 710 | 710 | ||
| 711 | enum { | 711 | enum { |
| 712 | IDE_PFLAG_PROBING = (1 << 0), | 712 | IDE_PFLAG_PROBING = BIT(0), |
| 713 | }; | 713 | }; |
| 714 | 714 | ||
| 715 | struct ide_host; | 715 | struct ide_host; |
| @@ -862,7 +862,7 @@ extern struct mutex ide_setting_mtx; | |||
| 862 | * configurable drive settings | 862 | * configurable drive settings |
| 863 | */ | 863 | */ |
| 864 | 864 | ||
| 865 | #define DS_SYNC (1 << 0) | 865 | #define DS_SYNC BIT(0) |
| 866 | 866 | ||
| 867 | struct ide_devset { | 867 | struct ide_devset { |
| 868 | int (*get)(ide_drive_t *); | 868 | int (*get)(ide_drive_t *); |
| @@ -1000,15 +1000,15 @@ static inline void ide_proc_unregister_driver(ide_drive_t *drive, | |||
| 1000 | 1000 | ||
| 1001 | enum { | 1001 | enum { |
| 1002 | /* enter/exit functions */ | 1002 | /* enter/exit functions */ |
| 1003 | IDE_DBG_FUNC = (1 << 0), | 1003 | IDE_DBG_FUNC = BIT(0), |
| 1004 | /* sense key/asc handling */ | 1004 | /* sense key/asc handling */ |
| 1005 | IDE_DBG_SENSE = (1 << 1), | 1005 | IDE_DBG_SENSE = BIT(1), |
| 1006 | /* packet commands handling */ | 1006 | /* packet commands handling */ |
| 1007 | IDE_DBG_PC = (1 << 2), | 1007 | IDE_DBG_PC = BIT(2), |
| 1008 | /* request handling */ | 1008 | /* request handling */ |
| 1009 | IDE_DBG_RQ = (1 << 3), | 1009 | IDE_DBG_RQ = BIT(3), |
| 1010 | /* driver probing/setup */ | 1010 | /* driver probing/setup */ |
| 1011 | IDE_DBG_PROBE = (1 << 4), | 1011 | IDE_DBG_PROBE = BIT(4), |
| 1012 | }; | 1012 | }; |
| 1013 | 1013 | ||
| 1014 | /* DRV_NAME has to be defined in the driver before using the macro below */ | 1014 | /* 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, | |||
| 1171 | * the tail of our block device request queue and wait for their completion. | 1171 | * the tail of our block device request queue and wait for their completion. |
| 1172 | */ | 1172 | */ |
| 1173 | enum { | 1173 | enum { |
| 1174 | REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */ | 1174 | REQ_IDETAPE_PC1 = BIT(0), /* packet command (first stage) */ |
| 1175 | REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */ | 1175 | REQ_IDETAPE_PC2 = BIT(1), /* packet command (second stage) */ |
| 1176 | REQ_IDETAPE_READ = (1 << 2), | 1176 | REQ_IDETAPE_READ = BIT(2), |
| 1177 | REQ_IDETAPE_WRITE = (1 << 3), | 1177 | REQ_IDETAPE_WRITE = BIT(3), |
| 1178 | }; | 1178 | }; |
| 1179 | 1179 | ||
| 1180 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *, | 1180 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *, |
| @@ -1264,71 +1264,71 @@ struct ide_pci_enablebit { | |||
| 1264 | 1264 | ||
| 1265 | enum { | 1265 | enum { |
| 1266 | /* Uses ISA control ports not PCI ones. */ | 1266 | /* Uses ISA control ports not PCI ones. */ |
| 1267 | IDE_HFLAG_ISA_PORTS = (1 << 0), | 1267 | IDE_HFLAG_ISA_PORTS = BIT(0), |
| 1268 | /* single port device */ | 1268 | /* single port device */ |
| 1269 | IDE_HFLAG_SINGLE = (1 << 1), | 1269 | IDE_HFLAG_SINGLE = BIT(1), |
| 1270 | /* don't use legacy PIO blacklist */ | 1270 | /* don't use legacy PIO blacklist */ |
| 1271 | IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), | 1271 | IDE_HFLAG_PIO_NO_BLACKLIST = BIT(2), |
| 1272 | /* set for the second port of QD65xx */ | 1272 | /* set for the second port of QD65xx */ |
| 1273 | IDE_HFLAG_QD_2ND_PORT = (1 << 3), | 1273 | IDE_HFLAG_QD_2ND_PORT = BIT(3), |
| 1274 | /* use PIO8/9 for prefetch off/on */ | 1274 | /* use PIO8/9 for prefetch off/on */ |
| 1275 | IDE_HFLAG_ABUSE_PREFETCH = (1 << 4), | 1275 | IDE_HFLAG_ABUSE_PREFETCH = BIT(4), |
| 1276 | /* use PIO6/7 for fast-devsel off/on */ | 1276 | /* use PIO6/7 for fast-devsel off/on */ |
| 1277 | IDE_HFLAG_ABUSE_FAST_DEVSEL = (1 << 5), | 1277 | IDE_HFLAG_ABUSE_FAST_DEVSEL = BIT(5), |
| 1278 | /* use 100-102 and 200-202 PIO values to set DMA modes */ | 1278 | /* 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), |
| 1280 | /* | 1280 | /* |
| 1281 | * keep DMA setting when programming PIO mode, may be used only | 1281 | * keep DMA setting when programming PIO mode, may be used only |
| 1282 | * for hosts which have separate PIO and DMA timings (ie. PMAC) | 1282 | * for hosts which have separate PIO and DMA timings (ie. PMAC) |
| 1283 | */ | 1283 | */ |
| 1284 | IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = (1 << 7), | 1284 | IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = BIT(7), |
| 1285 | /* program host for the transfer mode after programming device */ | 1285 | /* 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), |
| 1287 | /* don't program host/device for the transfer mode ("smart" hosts) */ | 1287 | /* 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), |
| 1289 | /* trust BIOS for programming chipset/device for DMA */ | 1289 | /* 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), |
| 1291 | /* host is CS5510/CS5520 */ | 1291 | /* host is CS5510/CS5520 */ |
| 1292 | IDE_HFLAG_CS5520 = (1 << 11), | 1292 | IDE_HFLAG_CS5520 = BIT(11), |
| 1293 | /* ATAPI DMA is unsupported */ | 1293 | /* ATAPI DMA is unsupported */ |
| 1294 | IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), | 1294 | IDE_HFLAG_NO_ATAPI_DMA = BIT(12), |
| 1295 | /* set if host is a "non-bootable" controller */ | 1295 | /* set if host is a "non-bootable" controller */ |
| 1296 | IDE_HFLAG_NON_BOOTABLE = (1 << 13), | 1296 | IDE_HFLAG_NON_BOOTABLE = BIT(13), |
| 1297 | /* host doesn't support DMA */ | 1297 | /* host doesn't support DMA */ |
| 1298 | IDE_HFLAG_NO_DMA = (1 << 14), | 1298 | IDE_HFLAG_NO_DMA = BIT(14), |
| 1299 | /* check if host is PCI IDE device before allowing DMA */ | 1299 | /* check if host is PCI IDE device before allowing DMA */ |
| 1300 | IDE_HFLAG_NO_AUTODMA = (1 << 15), | 1300 | IDE_HFLAG_NO_AUTODMA = BIT(15), |
| 1301 | /* host uses MMIO */ | 1301 | /* host uses MMIO */ |
| 1302 | IDE_HFLAG_MMIO = (1 << 16), | 1302 | IDE_HFLAG_MMIO = BIT(16), |
| 1303 | /* no LBA48 */ | 1303 | /* no LBA48 */ |
| 1304 | IDE_HFLAG_NO_LBA48 = (1 << 17), | 1304 | IDE_HFLAG_NO_LBA48 = BIT(17), |
| 1305 | /* no LBA48 DMA */ | 1305 | /* no LBA48 DMA */ |
| 1306 | IDE_HFLAG_NO_LBA48_DMA = (1 << 18), | 1306 | IDE_HFLAG_NO_LBA48_DMA = BIT(18), |
| 1307 | /* data FIFO is cleared by an error */ | 1307 | /* data FIFO is cleared by an error */ |
| 1308 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), | 1308 | IDE_HFLAG_ERROR_STOPS_FIFO = BIT(19), |
| 1309 | /* serialize ports */ | 1309 | /* serialize ports */ |
| 1310 | IDE_HFLAG_SERIALIZE = (1 << 20), | 1310 | IDE_HFLAG_SERIALIZE = BIT(20), |
| 1311 | /* host is DTC2278 */ | 1311 | /* host is DTC2278 */ |
| 1312 | IDE_HFLAG_DTC2278 = (1 << 21), | 1312 | IDE_HFLAG_DTC2278 = BIT(21), |
| 1313 | /* 4 devices on a single set of I/O ports */ | 1313 | /* 4 devices on a single set of I/O ports */ |
| 1314 | IDE_HFLAG_4DRIVES = (1 << 22), | 1314 | IDE_HFLAG_4DRIVES = BIT(22), |
| 1315 | /* host is TRM290 */ | 1315 | /* host is TRM290 */ |
| 1316 | IDE_HFLAG_TRM290 = (1 << 23), | 1316 | IDE_HFLAG_TRM290 = BIT(23), |
| 1317 | /* use 32-bit I/O ops */ | 1317 | /* use 32-bit I/O ops */ |
| 1318 | IDE_HFLAG_IO_32BIT = (1 << 24), | 1318 | IDE_HFLAG_IO_32BIT = BIT(24), |
| 1319 | /* unmask IRQs */ | 1319 | /* unmask IRQs */ |
| 1320 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), | 1320 | IDE_HFLAG_UNMASK_IRQS = BIT(25), |
| 1321 | IDE_HFLAG_BROKEN_ALTSTATUS = (1 << 26), | 1321 | IDE_HFLAG_BROKEN_ALTSTATUS = BIT(26), |
| 1322 | /* serialize ports if DMA is possible (for sl82c105) */ | 1322 | /* serialize ports if DMA is possible (for sl82c105) */ |
| 1323 | IDE_HFLAG_SERIALIZE_DMA = (1 << 27), | 1323 | IDE_HFLAG_SERIALIZE_DMA = BIT(27), |
| 1324 | /* force host out of "simplex" mode */ | 1324 | /* force host out of "simplex" mode */ |
| 1325 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), | 1325 | IDE_HFLAG_CLEAR_SIMPLEX = BIT(28), |
| 1326 | /* DSC overlap is unsupported */ | 1326 | /* DSC overlap is unsupported */ |
| 1327 | IDE_HFLAG_NO_DSC = (1 << 29), | 1327 | IDE_HFLAG_NO_DSC = BIT(29), |
| 1328 | /* never use 32-bit I/O ops */ | 1328 | /* never use 32-bit I/O ops */ |
| 1329 | IDE_HFLAG_NO_IO_32BIT = (1 << 30), | 1329 | IDE_HFLAG_NO_IO_32BIT = BIT(30), |
| 1330 | /* never unmask IRQs */ | 1330 | /* never unmask IRQs */ |
| 1331 | IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31), | 1331 | IDE_HFLAG_NO_UNMASK_IRQS = BIT(31), |
| 1332 | }; | 1332 | }; |
| 1333 | 1333 | ||
| 1334 | #ifdef CONFIG_BLK_DEV_OFFBOARD | 1334 | #ifdef CONFIG_BLK_DEV_OFFBOARD |
| @@ -1536,16 +1536,16 @@ struct ide_timing { | |||
| 1536 | }; | 1536 | }; |
| 1537 | 1537 | ||
| 1538 | enum { | 1538 | enum { |
| 1539 | IDE_TIMING_SETUP = (1 << 0), | 1539 | IDE_TIMING_SETUP = BIT(0), |
| 1540 | IDE_TIMING_ACT8B = (1 << 1), | 1540 | IDE_TIMING_ACT8B = BIT(1), |
| 1541 | IDE_TIMING_REC8B = (1 << 2), | 1541 | IDE_TIMING_REC8B = BIT(2), |
| 1542 | IDE_TIMING_CYC8B = (1 << 3), | 1542 | IDE_TIMING_CYC8B = BIT(3), |
| 1543 | IDE_TIMING_8BIT = IDE_TIMING_ACT8B | IDE_TIMING_REC8B | | 1543 | IDE_TIMING_8BIT = IDE_TIMING_ACT8B | IDE_TIMING_REC8B | |
| 1544 | IDE_TIMING_CYC8B, | 1544 | IDE_TIMING_CYC8B, |
| 1545 | IDE_TIMING_ACTIVE = (1 << 4), | 1545 | IDE_TIMING_ACTIVE = BIT(4), |
| 1546 | IDE_TIMING_RECOVER = (1 << 5), | 1546 | IDE_TIMING_RECOVER = BIT(5), |
| 1547 | IDE_TIMING_CYCLE = (1 << 6), | 1547 | IDE_TIMING_CYCLE = BIT(6), |
| 1548 | IDE_TIMING_UDMA = (1 << 7), | 1548 | IDE_TIMING_UDMA = BIT(7), |
| 1549 | IDE_TIMING_ALL = IDE_TIMING_SETUP | IDE_TIMING_8BIT | | 1549 | IDE_TIMING_ALL = IDE_TIMING_SETUP | IDE_TIMING_8BIT | |
| 1550 | IDE_TIMING_ACTIVE | IDE_TIMING_RECOVER | | 1550 | IDE_TIMING_ACTIVE | IDE_TIMING_RECOVER | |
| 1551 | IDE_TIMING_CYCLE | IDE_TIMING_UDMA, | 1551 | IDE_TIMING_CYCLE | IDE_TIMING_UDMA, |
diff --git a/include/linux/idr.h b/include/linux/idr.h index ee7abae143d3..4ec8986e5dfb 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
| @@ -191,14 +191,17 @@ static inline void idr_preload_end(void) | |||
| 191 | * idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type. | 191 | * idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type. |
| 192 | * @idr: IDR handle. | 192 | * @idr: IDR handle. |
| 193 | * @entry: The type * to use as cursor. | 193 | * @entry: The type * to use as cursor. |
| 194 | * @tmp: A temporary placeholder for ID. | ||
| 194 | * @id: Entry ID. | 195 | * @id: Entry ID. |
| 195 | * | 196 | * |
| 196 | * @entry and @id do not need to be initialized before the loop, and | 197 | * @entry and @id do not need to be initialized before the loop, and |
| 197 | * after normal termination @entry is left with the value NULL. This | 198 | * after normal termination @entry is left with the value NULL. This |
| 198 | * is convenient for a "not found" value. | 199 | * is convenient for a "not found" value. |
| 199 | */ | 200 | */ |
| 200 | #define idr_for_each_entry_ul(idr, entry, id) \ | 201 | #define idr_for_each_entry_ul(idr, entry, tmp, id) \ |
| 201 | for (id = 0; ((entry) = idr_get_next_ul(idr, &(id))) != NULL; ++id) | 202 | for (tmp = 0, id = 0; \ |
| 203 | tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \ | ||
| 204 | tmp = id, ++id) | ||
| 202 | 205 | ||
| 203 | /** | 206 | /** |
| 204 | * idr_for_each_entry_continue() - Continue iteration over an IDR's elements of a given type | 207 | * 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) | |||
| 213 | entry; \ | 216 | entry; \ |
| 214 | ++id, (entry) = idr_get_next((idr), &(id))) | 217 | ++id, (entry) = idr_get_next((idr), &(id))) |
| 215 | 218 | ||
| 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 | |||
| 216 | /* | 233 | /* |
| 217 | * IDA - ID Allocator, use when translation from id to pointer isn't necessary. | 234 | * IDA - ID Allocator, use when translation from id to pointer isn't necessary. |
| 218 | */ | 235 | */ |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 42690007d612..8511fadc0935 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
| @@ -2609,6 +2609,7 @@ enum ieee80211_key_len { | |||
| 2609 | #define FILS_ERP_MAX_RRK_LEN 64 | 2609 | #define FILS_ERP_MAX_RRK_LEN 64 |
| 2610 | 2610 | ||
| 2611 | #define PMK_MAX_LEN 64 | 2611 | #define PMK_MAX_LEN 64 |
| 2612 | #define SAE_PASSWORD_MAX_LEN 128 | ||
| 2612 | 2613 | ||
| 2613 | /* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */ | 2614 | /* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */ |
| 2614 | enum ieee80211_pub_actioncode { | 2615 | enum ieee80211_pub_actioncode { |
| @@ -2709,6 +2710,13 @@ enum ieee80211_tdls_actioncode { | |||
| 2709 | #define WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT BIT(5) | 2710 | #define WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT BIT(5) |
| 2710 | #define WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT BIT(6) | 2711 | #define WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT BIT(6) |
| 2711 | 2712 | ||
| 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 | |||
| 2712 | /* Defines support for enhanced multi-bssid advertisement*/ | 2720 | /* Defines support for enhanced multi-bssid advertisement*/ |
| 2713 | #define WLAN_EXT_CAPA11_EMA_SUPPORT BIT(1) | 2721 | #define WLAN_EXT_CAPA11_EMA_SUPPORT BIT(1) |
| 2714 | 2722 | ||
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index f3fab5d0ea97..9e57c4411734 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h | |||
| @@ -88,6 +88,8 @@ static inline bool br_multicast_router(const struct net_device *dev) | |||
| 88 | #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) | 88 | #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) |
| 89 | bool br_vlan_enabled(const struct net_device *dev); | 89 | bool br_vlan_enabled(const struct net_device *dev); |
| 90 | int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid); | 90 | 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); | ||
| 91 | int br_vlan_get_info(const struct net_device *dev, u16 vid, | 93 | int br_vlan_get_info(const struct net_device *dev, u16 vid, |
| 92 | struct bridge_vlan_info *p_vinfo); | 94 | struct bridge_vlan_info *p_vinfo); |
| 93 | #else | 95 | #else |
| @@ -101,6 +103,16 @@ static inline int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid) | |||
| 101 | return -EINVAL; | 103 | return -EINVAL; |
| 102 | } | 104 | } |
| 103 | 105 | ||
| 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 | |||
| 104 | static inline int br_vlan_get_info(const struct net_device *dev, u16 vid, | 116 | static inline int br_vlan_get_info(const struct net_device *dev, u16 vid, |
| 105 | struct bridge_vlan_info *p_vinfo) | 117 | struct bridge_vlan_info *p_vinfo) |
| 106 | { | 118 | { |
diff --git a/include/linux/if_rmnet.h b/include/linux/if_rmnet.h new file mode 100644 index 000000000000..b4f5403383fc --- /dev/null +++ b/include/linux/if_rmnet.h | |||
| @@ -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_ip4_ind:1; | ||
| 45 | u16 csum_enabled:1; | ||
| 46 | #elif defined (__BIG_ENDIAN_BITFIELD) | ||
| 47 | u16 csum_enabled:1; | ||
| 48 | u16 udp_ip4_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_) */ | ||
diff --git a/include/linux/if_tap.h b/include/linux/if_tap.h index 8e66866c11be..915a187cfabd 100644 --- a/include/linux/if_tap.h +++ b/include/linux/if_tap.h | |||
| @@ -62,7 +62,6 @@ struct tap_dev { | |||
| 62 | struct tap_queue { | 62 | struct tap_queue { |
| 63 | struct sock sk; | 63 | struct sock sk; |
| 64 | struct socket sock; | 64 | struct socket sock; |
| 65 | struct socket_wq wq; | ||
| 66 | int vnet_hdr_sz; | 65 | int vnet_hdr_sz; |
| 67 | struct tap_dev __rcu *tap; | 66 | struct tap_dev __rcu *tap; |
| 68 | struct file *file; | 67 | struct file *file; |
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index 9cbbd1baaf85..463047d0190b 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
| @@ -60,8 +60,8 @@ struct ip_mc_socklist { | |||
| 60 | 60 | ||
| 61 | struct ip_sf_list { | 61 | struct ip_sf_list { |
| 62 | struct ip_sf_list *sf_next; | 62 | struct ip_sf_list *sf_next; |
| 63 | __be32 sf_inaddr; | ||
| 64 | unsigned long sf_count[2]; /* include/exclude counts */ | 63 | unsigned long sf_count[2]; /* include/exclude counts */ |
| 64 | __be32 sf_inaddr; | ||
| 65 | unsigned char sf_gsresp; /* include in g & s response? */ | 65 | unsigned char sf_gsresp; /* include in g & s response? */ |
| 66 | unsigned char sf_oldin; /* change state */ | 66 | unsigned char sf_oldin; /* change state */ |
| 67 | unsigned char sf_crcount; /* retrans. left to send */ | 67 | unsigned char sf_crcount; /* retrans. left to send */ |
diff --git a/include/linux/ima.h b/include/linux/ima.h index 00036d2f57c3..a20ad398d260 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h | |||
| @@ -23,6 +23,7 @@ extern int ima_read_file(struct file *file, enum kernel_read_file_id id); | |||
| 23 | extern int ima_post_read_file(struct file *file, void *buf, loff_t size, | 23 | extern int ima_post_read_file(struct file *file, void *buf, loff_t size, |
| 24 | enum kernel_read_file_id id); | 24 | enum kernel_read_file_id id); |
| 25 | extern void ima_post_path_mknod(struct dentry *dentry); | 25 | extern void ima_post_path_mknod(struct dentry *dentry); |
| 26 | extern void ima_kexec_cmdline(const void *buf, int size); | ||
| 26 | 27 | ||
| 27 | #ifdef CONFIG_IMA_KEXEC | 28 | #ifdef CONFIG_IMA_KEXEC |
| 28 | extern void ima_add_kexec_buffer(struct kimage *image); | 29 | extern void ima_add_kexec_buffer(struct kimage *image); |
| @@ -89,6 +90,7 @@ static inline void ima_post_path_mknod(struct dentry *dentry) | |||
| 89 | return; | 90 | return; |
| 90 | } | 91 | } |
| 91 | 92 | ||
| 93 | static inline void ima_kexec_cmdline(const void *buf, int size) {} | ||
| 92 | #endif /* CONFIG_IMA */ | 94 | #endif /* CONFIG_IMA */ |
| 93 | 95 | ||
| 94 | #ifndef CONFIG_IMA_KEXEC | 96 | #ifndef CONFIG_IMA_KEXEC |
diff --git a/include/linux/in.h b/include/linux/in.h index 4d2fedfb753a..1873ef642605 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
| @@ -63,7 +63,7 @@ static inline bool ipv4_is_all_snoopers(__be32 addr) | |||
| 63 | 63 | ||
| 64 | static inline bool ipv4_is_zeronet(__be32 addr) | 64 | static inline bool ipv4_is_zeronet(__be32 addr) |
| 65 | { | 65 | { |
| 66 | return (addr & htonl(0xff000000)) == htonl(0x00000000); | 66 | return (addr == 0); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | /* Special-Use IPv4 Addresses (RFC3330) */ | 69 | /* Special-Use IPv4 Addresses (RFC3330) */ |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 367dc2a0f84a..3515ca64e638 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
| @@ -26,7 +26,7 @@ struct in_device { | |||
| 26 | struct net_device *dev; | 26 | struct net_device *dev; |
| 27 | refcount_t refcnt; | 27 | refcount_t refcnt; |
| 28 | int dead; | 28 | int dead; |
| 29 | struct in_ifaddr *ifa_list; /* IP ifaddr chain */ | 29 | struct in_ifaddr __rcu *ifa_list;/* IP ifaddr chain */ |
| 30 | 30 | ||
| 31 | struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */ | 31 | struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */ |
| 32 | struct ip_mc_list __rcu * __rcu *mc_hash; | 32 | struct ip_mc_list __rcu * __rcu *mc_hash; |
| @@ -136,7 +136,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
| 136 | 136 | ||
| 137 | struct in_ifaddr { | 137 | struct in_ifaddr { |
| 138 | struct hlist_node hash; | 138 | struct hlist_node hash; |
| 139 | struct in_ifaddr *ifa_next; | 139 | struct in_ifaddr __rcu *ifa_next; |
| 140 | struct in_device *ifa_dev; | 140 | struct in_device *ifa_dev; |
| 141 | struct rcu_head rcu_head; | 141 | struct rcu_head rcu_head; |
| 142 | __be32 ifa_local; | 142 | __be32 ifa_local; |
| @@ -186,7 +186,7 @@ __be32 inet_confirm_addr(struct net *net, struct in_device *in_dev, __be32 dst, | |||
| 186 | struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, | 186 | struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, |
| 187 | __be32 mask); | 187 | __be32 mask); |
| 188 | struct in_ifaddr *inet_lookup_ifaddr_rcu(struct net *net, __be32 addr); | 188 | 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) |
| 190 | { | 190 | { |
| 191 | return !((addr^ifa->ifa_address)&ifa->ifa_mask); | 191 | return !((addr^ifa->ifa_address)&ifa->ifa_mask); |
| 192 | } | 192 | } |
| @@ -206,14 +206,13 @@ static __inline__ bool bad_mask(__be32 mask, __be32 addr) | |||
| 206 | return false; | 206 | return false; |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | #define for_primary_ifa(in_dev) { struct in_ifaddr *ifa; \ | 209 | #define in_dev_for_each_ifa_rtnl(ifa, in_dev) \ |
| 210 | for (ifa = (in_dev)->ifa_list; ifa && !(ifa->ifa_flags&IFA_F_SECONDARY); ifa = ifa->ifa_next) | 210 | for (ifa = rtnl_dereference((in_dev)->ifa_list); ifa; \ |
| 211 | ifa = rtnl_dereference(ifa->ifa_next)) | ||
| 211 | 212 | ||
| 212 | #define for_ifa(in_dev) { struct in_ifaddr *ifa; \ | 213 | #define in_dev_for_each_ifa_rcu(ifa, in_dev) \ |
| 213 | for (ifa = (in_dev)->ifa_list; ifa; ifa = ifa->ifa_next) | 214 | for (ifa = rcu_dereference((in_dev)->ifa_list); ifa; \ |
| 214 | 215 | ifa = rcu_dereference(ifa->ifa_next)) | |
| 215 | |||
| 216 | #define endfor_ifa(in_dev) } | ||
| 217 | 216 | ||
| 218 | static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) | 217 | static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) |
| 219 | { | 218 | { |
diff --git a/include/linux/input/elan-i2c-ids.h b/include/linux/input/elan-i2c-ids.h new file mode 100644 index 000000000000..ceabb01a6a7d --- /dev/null +++ b/include/linux/input/elan-i2c-ids.h | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | /* | ||
| 2 | * Elan I2C/SMBus Touchpad device whitelist | ||
| 3 | * | ||
| 4 | * Copyright (c) 2013 ELAN Microelectronics Corp. | ||
| 5 | * | ||
| 6 | * Author: Ã¦ç¶ (Duson Lin) <dusonlin@emc.com.tw> | ||
| 7 | * Author: KT Liao <kt.liao@emc.com.tw> | ||
| 8 | * Version: 1.6.3 | ||
| 9 | * | ||
| 10 | * Based on cyapa driver: | ||
| 11 | * copyright (c) 2011-2012 Cypress Semiconductor, Inc. | ||
| 12 | * copyright (c) 2011-2012 Google, Inc. | ||
| 13 | * | ||
| 14 | * This program is free software; you can redistribute it and/or modify it | ||
| 15 | * under the terms of the GNU General Public License version 2 as published | ||
| 16 | * by the Free Software Foundation. | ||
| 17 | * | ||
| 18 | * Trademarks are the property of their respective owners. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef __ELAN_I2C_IDS_H | ||
| 22 | #define __ELAN_I2C_IDS_H | ||
| 23 | |||
| 24 | #include <linux/mod_devicetable.h> | ||
| 25 | |||
| 26 | static const struct acpi_device_id elan_acpi_id[] = { | ||
| 27 | { "ELAN0000", 0 }, | ||
| 28 | { "ELAN0100", 0 }, | ||
| 29 | { "ELAN0600", 0 }, | ||
| 30 | { "ELAN0601", 0 }, | ||
| 31 | { "ELAN0602", 0 }, | ||
| 32 | { "ELAN0603", 0 }, | ||
| 33 | { "ELAN0604", 0 }, | ||
| 34 | { "ELAN0605", 0 }, | ||
| 35 | { "ELAN0606", 0 }, | ||
| 36 | { "ELAN0607", 0 }, | ||
| 37 | { "ELAN0608", 0 }, | ||
| 38 | { "ELAN0609", 0 }, | ||
| 39 | { "ELAN060B", 0 }, | ||
| 40 | { "ELAN060C", 0 }, | ||
| 41 | { "ELAN060F", 0 }, | ||
| 42 | { "ELAN0610", 0 }, | ||
| 43 | { "ELAN0611", 0 }, | ||
| 44 | { "ELAN0612", 0 }, | ||
| 45 | { "ELAN0615", 0 }, | ||
| 46 | { "ELAN0616", 0 }, | ||
| 47 | { "ELAN0617", 0 }, | ||
| 48 | { "ELAN0618", 0 }, | ||
| 49 | { "ELAN0619", 0 }, | ||
| 50 | { "ELAN061A", 0 }, | ||
| 51 | { "ELAN061B", 0 }, | ||
| 52 | { "ELAN061C", 0 }, | ||
| 53 | { "ELAN061D", 0 }, | ||
| 54 | { "ELAN061E", 0 }, | ||
| 55 | { "ELAN061F", 0 }, | ||
| 56 | { "ELAN0620", 0 }, | ||
| 57 | { "ELAN0621", 0 }, | ||
| 58 | { "ELAN0622", 0 }, | ||
| 59 | { "ELAN0623", 0 }, | ||
| 60 | { "ELAN0624", 0 }, | ||
| 61 | { "ELAN0625", 0 }, | ||
| 62 | { "ELAN0626", 0 }, | ||
| 63 | { "ELAN0627", 0 }, | ||
| 64 | { "ELAN0628", 0 }, | ||
| 65 | { "ELAN0629", 0 }, | ||
| 66 | { "ELAN062A", 0 }, | ||
| 67 | { "ELAN062B", 0 }, | ||
| 68 | { "ELAN062C", 0 }, | ||
| 69 | { "ELAN062D", 0 }, | ||
| 70 | { "ELAN0631", 0 }, | ||
| 71 | { "ELAN0632", 0 }, | ||
| 72 | { "ELAN1000", 0 }, | ||
| 73 | { } | ||
| 74 | }; | ||
| 75 | |||
| 76 | #endif /* __ELAN_I2C_IDS_H */ | ||
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 6a8dd4af0147..f2ae8a006ff8 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
| @@ -435,6 +435,12 @@ enum { | |||
| 435 | #define VTD_FLAG_TRANS_PRE_ENABLED (1 << 0) | 435 | #define VTD_FLAG_TRANS_PRE_ENABLED (1 << 0) |
| 436 | #define VTD_FLAG_IRQ_REMAP_PRE_ENABLED (1 << 1) | 436 | #define VTD_FLAG_IRQ_REMAP_PRE_ENABLED (1 << 1) |
| 437 | 437 | ||
| 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 | |||
| 438 | struct pasid_entry; | 444 | struct pasid_entry; |
| 439 | struct pasid_state_entry; | 445 | struct pasid_state_entry; |
| 440 | struct page_req_dsc; | 446 | struct page_req_dsc; |
| @@ -642,7 +648,6 @@ extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); | |||
| 642 | 648 | ||
| 643 | extern int dmar_ir_support(void); | 649 | extern int dmar_ir_support(void); |
| 644 | 650 | ||
| 645 | struct dmar_domain *get_valid_domain_for_dev(struct device *dev); | ||
| 646 | void *alloc_pgtable_page(int node); | 651 | void *alloc_pgtable_page(int node); |
| 647 | void free_pgtable_page(void *vaddr); | 652 | void free_pgtable_page(void *vaddr); |
| 648 | struct intel_iommu *domain_get_iommu(struct dmar_domain *domain); | 653 | struct intel_iommu *domain_get_iommu(struct dmar_domain *domain); |
diff --git a/include/linux/intel-svm.h b/include/linux/intel-svm.h index 54ffcc6a322e..94f047a8a845 100644 --- a/include/linux/intel-svm.h +++ b/include/linux/intel-svm.h | |||
| @@ -49,7 +49,7 @@ struct svm_dev_ops { | |||
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | * intel_svm_bind_mm() - Bind the current process to a PASID | 51 | * 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 |
| 53 | * @pasid: Address for allocated PASID | 53 | * @pasid: Address for allocated PASID |
| 54 | * @flags: Flags. Later for requesting supervisor mode, etc. | 54 | * @flags: Flags. Later for requesting supervisor mode, etc. |
| 55 | * @ops: Callbacks to device driver | 55 | * @ops: Callbacks to device driver |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index c7eef32e7739..5b8328a99b2a 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -52,7 +52,7 @@ | |||
| 52 | * irq line disabled until the threaded handler has been run. | 52 | * irq line disabled until the threaded handler has been run. |
| 53 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend. Does not guarantee | 53 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend. Does not guarantee |
| 54 | * that this interrupt will wake the system from a suspended | 54 | * 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 |
| 56 | * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set | 56 | * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set |
| 57 | * IRQF_NO_THREAD - Interrupt cannot be threaded | 57 | * IRQF_NO_THREAD - Interrupt cannot be threaded |
| 58 | * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device | 58 | * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device |
diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h index 76969a564831..b5a450a3bb47 100644 --- a/include/linux/io-pgtable.h +++ b/include/linux/io-pgtable.h | |||
| @@ -44,6 +44,8 @@ struct iommu_gather_ops { | |||
| 44 | * tables. | 44 | * tables. |
| 45 | * @ias: Input address (iova) size, in bits. | 45 | * @ias: Input address (iova) size, in bits. |
| 46 | * @oas: Output address (paddr) size, in bits. | 46 | * @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. | ||
| 47 | * @tlb: TLB management callbacks for this set of tables. | 49 | * @tlb: TLB management callbacks for this set of tables. |
| 48 | * @iommu_dev: The device representing the DMA configuration for the | 50 | * @iommu_dev: The device representing the DMA configuration for the |
| 49 | * page table walker. | 51 | * page table walker. |
| @@ -68,11 +70,6 @@ struct io_pgtable_cfg { | |||
| 68 | * when the SoC is in "4GB mode" and they can only access the high | 70 | * when the SoC is in "4GB mode" and they can only access the high |
| 69 | * remap of DRAM (0x1_00000000 to 0x1_ffffffff). | 71 | * remap of DRAM (0x1_00000000 to 0x1_ffffffff). |
| 70 | * | 72 | * |
| 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 | * | ||
| 76 | * IO_PGTABLE_QUIRK_NON_STRICT: Skip issuing synchronous leaf TLBIs | 73 | * IO_PGTABLE_QUIRK_NON_STRICT: Skip issuing synchronous leaf TLBIs |
| 77 | * on unmap, for DMA domains using the flush queue mechanism for | 74 | * on unmap, for DMA domains using the flush queue mechanism for |
| 78 | * delayed invalidation. | 75 | * delayed invalidation. |
| @@ -81,12 +78,12 @@ struct io_pgtable_cfg { | |||
| 81 | #define IO_PGTABLE_QUIRK_NO_PERMS BIT(1) | 78 | #define IO_PGTABLE_QUIRK_NO_PERMS BIT(1) |
| 82 | #define IO_PGTABLE_QUIRK_TLBI_ON_MAP BIT(2) | 79 | #define IO_PGTABLE_QUIRK_TLBI_ON_MAP BIT(2) |
| 83 | #define IO_PGTABLE_QUIRK_ARM_MTK_4GB BIT(3) | 80 | #define IO_PGTABLE_QUIRK_ARM_MTK_4GB BIT(3) |
| 84 | #define IO_PGTABLE_QUIRK_NO_DMA BIT(4) | 81 | #define IO_PGTABLE_QUIRK_NON_STRICT BIT(4) |
| 85 | #define IO_PGTABLE_QUIRK_NON_STRICT BIT(5) | ||
| 86 | unsigned long quirks; | 82 | unsigned long quirks; |
| 87 | unsigned long pgsize_bitmap; | 83 | unsigned long pgsize_bitmap; |
| 88 | unsigned int ias; | 84 | unsigned int ias; |
| 89 | unsigned int oas; | 85 | unsigned int oas; |
| 86 | bool coherent_walk; | ||
| 90 | const struct iommu_gather_ops *tlb; | 87 | const struct iommu_gather_ops *tlb; |
| 91 | struct device *iommu_dev; | 88 | struct device *iommu_dev; |
| 92 | 89 | ||
diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 2103b94cb1bf..1df9ea187a9a 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h | |||
| @@ -35,6 +35,7 @@ struct vm_fault; | |||
| 35 | #define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ | 35 | #define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ |
| 36 | #define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ | 36 | #define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ |
| 37 | #define IOMAP_F_BUFFER_HEAD 0x04 /* file system requires buffer heads */ | 37 | #define IOMAP_F_BUFFER_HEAD 0x04 /* file system requires buffer heads */ |
| 38 | #define IOMAP_F_SIZE_CHANGED 0x08 /* file size has changed */ | ||
| 38 | 39 | ||
| 39 | /* | 40 | /* |
| 40 | * Flags that only need to be reported for IOMAP_REPORT requests: | 41 | * Flags that only need to be reported for IOMAP_REPORT requests: |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index e552c3b63f6f..fdc355ccc570 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
| 14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
| 15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
| 16 | #include <uapi/linux/iommu.h> | ||
| 16 | 17 | ||
| 17 | #define IOMMU_READ (1 << 0) | 18 | #define IOMMU_READ (1 << 0) |
| 18 | #define IOMMU_WRITE (1 << 1) | 19 | #define IOMMU_WRITE (1 << 1) |
| @@ -29,6 +30,12 @@ | |||
| 29 | * if the IOMMU page table format is equivalent. | 30 | * if the IOMMU page table format is equivalent. |
| 30 | */ | 31 | */ |
| 31 | #define IOMMU_PRIV (1 << 5) | 32 | #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) | ||
| 32 | 39 | ||
| 33 | struct iommu_ops; | 40 | struct iommu_ops; |
| 34 | struct iommu_group; | 41 | struct iommu_group; |
| @@ -37,6 +44,7 @@ struct device; | |||
| 37 | struct iommu_domain; | 44 | struct iommu_domain; |
| 38 | struct notifier_block; | 45 | struct notifier_block; |
| 39 | struct iommu_sva; | 46 | struct iommu_sva; |
| 47 | struct iommu_fault_event; | ||
| 40 | 48 | ||
| 41 | /* iommu fault flags */ | 49 | /* iommu fault flags */ |
| 42 | #define IOMMU_FAULT_READ 0x0 | 50 | #define IOMMU_FAULT_READ 0x0 |
| @@ -46,6 +54,7 @@ typedef int (*iommu_fault_handler_t)(struct iommu_domain *, | |||
| 46 | struct device *, unsigned long, int, void *); | 54 | struct device *, unsigned long, int, void *); |
| 47 | typedef int (*iommu_mm_exit_handler_t)(struct device *dev, struct iommu_sva *, | 55 | typedef int (*iommu_mm_exit_handler_t)(struct device *dev, struct iommu_sva *, |
| 48 | void *); | 56 | void *); |
| 57 | typedef int (*iommu_dev_fault_handler_t)(struct iommu_fault *, void *); | ||
| 49 | 58 | ||
| 50 | struct iommu_domain_geometry { | 59 | struct iommu_domain_geometry { |
| 51 | dma_addr_t aperture_start; /* First address that can be mapped */ | 60 | dma_addr_t aperture_start; /* First address that can be mapped */ |
| @@ -123,6 +132,12 @@ enum iommu_attr { | |||
| 123 | enum iommu_resv_type { | 132 | enum iommu_resv_type { |
| 124 | /* Memory regions which must be mapped 1:1 at all times */ | 133 | /* Memory regions which must be mapped 1:1 at all times */ |
| 125 | IOMMU_RESV_DIRECT, | 134 | 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, | ||
| 126 | /* Arbitrary "never map this or give it to a device" address ranges */ | 141 | /* Arbitrary "never map this or give it to a device" address ranges */ |
| 127 | IOMMU_RESV_RESERVED, | 142 | IOMMU_RESV_RESERVED, |
| 128 | /* Hardware MSI region (untranslated) */ | 143 | /* Hardware MSI region (untranslated) */ |
| @@ -212,6 +227,7 @@ struct iommu_sva_ops { | |||
| 212 | * @sva_bind: Bind process address space to device | 227 | * @sva_bind: Bind process address space to device |
| 213 | * @sva_unbind: Unbind process address space from device | 228 | * @sva_unbind: Unbind process address space from device |
| 214 | * @sva_get_pasid: Get PASID associated to a SVA handle | 229 | * @sva_get_pasid: Get PASID associated to a SVA handle |
| 230 | * @page_response: handle page request response | ||
| 215 | * @pgsize_bitmap: bitmap of all possible supported page sizes | 231 | * @pgsize_bitmap: bitmap of all possible supported page sizes |
| 216 | */ | 232 | */ |
| 217 | struct iommu_ops { | 233 | struct iommu_ops { |
| @@ -272,6 +288,10 @@ struct iommu_ops { | |||
| 272 | void (*sva_unbind)(struct iommu_sva *handle); | 288 | void (*sva_unbind)(struct iommu_sva *handle); |
| 273 | int (*sva_get_pasid)(struct iommu_sva *handle); | 289 | int (*sva_get_pasid)(struct iommu_sva *handle); |
| 274 | 290 | ||
| 291 | int (*page_response)(struct device *dev, | ||
| 292 | struct iommu_fault_event *evt, | ||
| 293 | struct iommu_page_response *msg); | ||
| 294 | |||
| 275 | unsigned long pgsize_bitmap; | 295 | unsigned long pgsize_bitmap; |
| 276 | }; | 296 | }; |
| 277 | 297 | ||
| @@ -289,6 +309,48 @@ struct iommu_device { | |||
| 289 | struct device *dev; | 309 | struct device *dev; |
| 290 | }; | 310 | }; |
| 291 | 311 | ||
| 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 | |||
| 292 | int iommu_device_register(struct iommu_device *iommu); | 354 | int iommu_device_register(struct iommu_device *iommu); |
| 293 | void iommu_device_unregister(struct iommu_device *iommu); | 355 | void iommu_device_unregister(struct iommu_device *iommu); |
| 294 | int iommu_device_sysfs_add(struct iommu_device *iommu, | 356 | int iommu_device_sysfs_add(struct iommu_device *iommu, |
| @@ -350,6 +412,7 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain, | |||
| 350 | extern void iommu_get_resv_regions(struct device *dev, struct list_head *list); | 412 | extern void iommu_get_resv_regions(struct device *dev, struct list_head *list); |
| 351 | extern void iommu_put_resv_regions(struct device *dev, struct list_head *list); | 413 | extern void iommu_put_resv_regions(struct device *dev, struct list_head *list); |
| 352 | extern int iommu_request_dm_for_dev(struct device *dev); | 414 | extern int iommu_request_dm_for_dev(struct device *dev); |
| 415 | extern int iommu_request_dma_domain_for_dev(struct device *dev); | ||
| 353 | extern struct iommu_resv_region * | 416 | extern struct iommu_resv_region * |
| 354 | iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot, | 417 | iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot, |
| 355 | enum iommu_resv_type type); | 418 | enum iommu_resv_type type); |
| @@ -378,6 +441,17 @@ extern int iommu_group_register_notifier(struct iommu_group *group, | |||
| 378 | struct notifier_block *nb); | 441 | struct notifier_block *nb); |
| 379 | extern int iommu_group_unregister_notifier(struct iommu_group *group, | 442 | extern int iommu_group_unregister_notifier(struct iommu_group *group, |
| 380 | struct notifier_block *nb); | 443 | 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 | |||
| 381 | extern int iommu_group_id(struct iommu_group *group); | 455 | extern int iommu_group_id(struct iommu_group *group); |
| 382 | extern struct iommu_group *iommu_group_get_for_dev(struct device *dev); | 456 | extern struct iommu_group *iommu_group_get_for_dev(struct device *dev); |
| 383 | extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *); | 457 | extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *); |
| @@ -492,6 +566,7 @@ struct iommu_ops {}; | |||
| 492 | struct iommu_group {}; | 566 | struct iommu_group {}; |
| 493 | struct iommu_fwspec {}; | 567 | struct iommu_fwspec {}; |
| 494 | struct iommu_device {}; | 568 | struct iommu_device {}; |
| 569 | struct iommu_fault_param {}; | ||
| 495 | 570 | ||
| 496 | static inline bool iommu_present(struct bus_type *bus) | 571 | static inline bool iommu_present(struct bus_type *bus) |
| 497 | { | 572 | { |
| @@ -614,6 +689,11 @@ static inline int iommu_request_dm_for_dev(struct device *dev) | |||
| 614 | return -ENODEV; | 689 | return -ENODEV; |
| 615 | } | 690 | } |
| 616 | 691 | ||
| 692 | static inline int iommu_request_dma_domain_for_dev(struct device *dev) | ||
| 693 | { | ||
| 694 | return -ENODEV; | ||
| 695 | } | ||
| 696 | |||
| 617 | static inline int iommu_attach_group(struct iommu_domain *domain, | 697 | static inline int iommu_attach_group(struct iommu_domain *domain, |
| 618 | struct iommu_group *group) | 698 | struct iommu_group *group) |
| 619 | { | 699 | { |
| @@ -685,6 +765,31 @@ static inline int iommu_group_unregister_notifier(struct iommu_group *group, | |||
| 685 | return 0; | 765 | return 0; |
| 686 | } | 766 | } |
| 687 | 767 | ||
| 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 | |||
| 688 | static inline int iommu_group_id(struct iommu_group *group) | 793 | static inline int iommu_group_id(struct iommu_group *group) |
| 689 | { | 794 | { |
| 690 | return -ENODEV; | 795 | return -ENODEV; |
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h index 3908353deec6..35e15dfd4155 100644 --- a/include/linux/iopoll.h +++ b/include/linux/iopoll.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | * @cond: Break condition (usually involving @val) | 21 | * @cond: Break condition (usually involving @val) |
| 22 | * @sleep_us: Maximum time to sleep between reads in us (0 | 22 | * @sleep_us: Maximum time to sleep between reads in us (0 |
| 23 | * tight-loops). Should be less than ~20ms since usleep_range | 23 | * 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). |
| 25 | * @timeout_us: Timeout in us, 0 means never timeout | 25 | * @timeout_us: Timeout in us, 0 means never timeout |
| 26 | * | 26 | * |
| 27 | * Returns 0 on success and -ETIMEDOUT upon a timeout. In either | 27 | * Returns 0 on success and -ETIMEDOUT upon a timeout. In either |
| @@ -60,7 +60,7 @@ | |||
| 60 | * @cond: Break condition (usually involving @val) | 60 | * @cond: Break condition (usually involving @val) |
| 61 | * @delay_us: Time to udelay between reads in us (0 tight-loops). Should | 61 | * @delay_us: Time to udelay between reads in us (0 tight-loops). Should |
| 62 | * be less than ~10us since udelay is used (see | 62 | * be less than ~10us since udelay is used (see |
| 63 | * Documentation/timers/timers-howto.txt). | 63 | * Documentation/timers/timers-howto.rst). |
| 64 | * @timeout_us: Timeout in us, 0 means never timeout | 64 | * @timeout_us: Timeout in us, 0 means never timeout |
| 65 | * | 65 | * |
| 66 | * Returns 0 on success and -ETIMEDOUT upon a timeout. In either | 66 | * Returns 0 on success and -ETIMEDOUT upon a timeout. In either |
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index da0ebaec25f0..5b6a7121c9f0 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #ifndef __ASSEMBLY__ | 12 | #ifndef __ASSEMBLY__ |
| 13 | #include <linux/compiler.h> | 13 | #include <linux/compiler.h> |
| 14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 15 | #include <linux/bits.h> | ||
| 15 | /* | 16 | /* |
| 16 | * Resources are tree-like, allowing | 17 | * Resources are tree-like, allowing |
| 17 | * nesting etc.. | 18 | * nesting etc.. |
| @@ -132,7 +133,15 @@ enum { | |||
| 132 | IORES_DESC_PERSISTENT_MEMORY = 4, | 133 | IORES_DESC_PERSISTENT_MEMORY = 4, |
| 133 | IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, | 134 | IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, |
| 134 | IORES_DESC_DEVICE_PRIVATE_MEMORY = 6, | 135 | 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), | ||
| 136 | }; | 145 | }; |
| 137 | 146 | ||
| 138 | /* helpers to define resources */ | 147 | /* helpers to define resources */ |
| @@ -286,6 +295,8 @@ static inline bool resource_overlaps(struct resource *r1, struct resource *r2) | |||
| 286 | return (r1->start <= r2->end && r1->end >= r2->start); | 295 | return (r1->start <= r2->end && r1->end >= r2->start); |
| 287 | } | 296 | } |
| 288 | 297 | ||
| 298 | struct resource *devm_request_free_mem_region(struct device *dev, | ||
| 299 | struct resource *base, unsigned long size); | ||
| 289 | 300 | ||
| 290 | #endif /* __ASSEMBLY__ */ | 301 | #endif /* __ASSEMBLY__ */ |
| 291 | #endif /* _LINUX_IOPORT_H */ | 302 | #endif /* _LINUX_IOPORT_H */ |
diff --git a/include/linux/irqchip/arm-gic-common.h b/include/linux/irqchip/arm-gic-common.h index 626283858563..b9850f5f1906 100644 --- a/include/linux/irqchip/arm-gic-common.h +++ b/include/linux/irqchip/arm-gic-common.h | |||
| @@ -36,4 +36,9 @@ struct gic_kvm_info { | |||
| 36 | 36 | ||
| 37 | const struct gic_kvm_info *gic_get_kvm_info(void); | 37 | const struct gic_kvm_info *gic_get_kvm_info(void); |
| 38 | 38 | ||
| 39 | struct irq_domain; | ||
| 40 | struct fwnode_handle; | ||
| 41 | int gicv2m_init(struct fwnode_handle *parent_handle, | ||
| 42 | struct irq_domain *parent); | ||
| 43 | |||
| 39 | #endif /* __LINUX_IRQCHIP_ARM_GIC_COMMON_H */ | 44 | #endif /* __LINUX_IRQCHIP_ARM_GIC_COMMON_H */ |
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h index 316087da1d09..5686711b0f40 100644 --- a/include/linux/irqchip/arm-gic.h +++ b/include/linux/irqchip/arm-gic.h | |||
| @@ -157,9 +157,6 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq); | |||
| 157 | */ | 157 | */ |
| 158 | void gic_init(void __iomem *dist , void __iomem *cpu); | 158 | void gic_init(void __iomem *dist , void __iomem *cpu); |
| 159 | 159 | ||
| 160 | int gicv2m_init(struct fwnode_handle *parent_handle, | ||
| 161 | struct irq_domain *parent); | ||
| 162 | |||
| 163 | void gic_send_sgi(unsigned int cpu_id, unsigned int irq); | 160 | void gic_send_sgi(unsigned int cpu_id, unsigned int irq); |
| 164 | int gic_get_cpu_id(unsigned int cpu); | 161 | int gic_get_cpu_id(unsigned int cpu); |
| 165 | void gic_migrate_target(unsigned int new_cpu_id); | 162 | void gic_migrate_target(unsigned int new_cpu_id); |
diff --git a/include/linux/isdn.h b/include/linux/isdn.h deleted file mode 100644 index df97c8444f5d..000000000000 --- a/include/linux/isdn.h +++ /dev/null | |||
| @@ -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__ */ | ||
diff --git a/include/linux/isdn/hdlc.h b/include/linux/isdn/hdlc.h deleted file mode 100644 index fe2c1279c139..000000000000 --- a/include/linux/isdn/hdlc.h +++ /dev/null | |||
| @@ -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__ */ | ||
diff --git a/include/linux/isdn_divertif.h b/include/linux/isdn_divertif.h deleted file mode 100644 index 19ab361f9f07..000000000000 --- a/include/linux/isdn_divertif.h +++ /dev/null | |||
| @@ -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 */ | ||
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h deleted file mode 100644 index a0070c6dfaf8..000000000000 --- a/include/linux/isdn_ppp.h +++ /dev/null | |||
| @@ -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 */ | ||
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h deleted file mode 100644 index 8d80fdc68647..000000000000 --- a/include/linux/isdnif.h +++ /dev/null | |||
| @@ -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__ */ | ||
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 5c04181b7c6d..df03825ad1a1 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
| @@ -451,6 +451,22 @@ struct jbd2_inode { | |||
| 451 | * @i_flags: Flags of inode [j_list_lock] | 451 | * @i_flags: Flags of inode [j_list_lock] |
| 452 | */ | 452 | */ |
| 453 | unsigned long i_flags; | 453 | 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; | ||
| 454 | }; | 470 | }; |
| 455 | 471 | ||
| 456 | struct jbd2_revoke_table_s; | 472 | struct jbd2_revoke_table_s; |
| @@ -1357,7 +1373,6 @@ void jbd2_journal_set_triggers(struct buffer_head *, | |||
| 1357 | struct jbd2_buffer_trigger_type *type); | 1373 | struct jbd2_buffer_trigger_type *type); |
| 1358 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); | 1374 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); |
| 1359 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); | 1375 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); |
| 1360 | extern void journal_sync_buffer (struct buffer_head *); | ||
| 1361 | extern int jbd2_journal_invalidatepage(journal_t *, | 1376 | extern int jbd2_journal_invalidatepage(journal_t *, |
| 1362 | struct page *, unsigned int, unsigned int); | 1377 | struct page *, unsigned int, unsigned int); |
| 1363 | extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); | 1378 | 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 *); | |||
| 1397 | extern int jbd2_journal_force_commit_nested(journal_t *); | 1412 | extern int jbd2_journal_force_commit_nested(journal_t *); |
| 1398 | extern int jbd2_journal_inode_add_write(handle_t *handle, struct jbd2_inode *inode); | 1413 | extern int jbd2_journal_inode_add_write(handle_t *handle, struct jbd2_inode *inode); |
| 1399 | extern int jbd2_journal_inode_add_wait(handle_t *handle, struct jbd2_inode *inode); | 1414 | 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); | ||
| 1400 | extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, | 1421 | extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, |
| 1401 | struct jbd2_inode *inode, loff_t new_size); | 1422 | struct jbd2_inode *inode, loff_t new_size); |
| 1402 | extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); | 1423 | extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); |
diff --git a/include/linux/jhash.h b/include/linux/jhash.h index 8037850f3104..ba2f6a9776b6 100644 --- a/include/linux/jhash.h +++ b/include/linux/jhash.h | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | * if SELF_TEST is defined. You can use this free for any purpose. It's in | 17 | * if SELF_TEST is defined. You can use this free for any purpose. It's in |
| 18 | * the public domain. It has no warranty. | 18 | * the public domain. It has no warranty. |
| 19 | * | 19 | * |
| 20 | * Copyright (C) 2009-2010 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu) | 20 | * Copyright (C) 2009-2010 Jozsef Kadlecsik (kadlec@netfilter.org) |
| 21 | * | 21 | * |
| 22 | * I've modified Bob's hash to be useful in the Linux kernel, and | 22 | * I've modified Bob's hash to be useful in the Linux kernel, and |
| 23 | * any bugs present are my fault. | 23 | * any bugs present are my fault. |
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 3e113a1fa0f1..3526c0aee954 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
| @@ -215,6 +215,9 @@ extern void arch_jump_label_transform(struct jump_entry *entry, | |||
| 215 | enum jump_label_type type); | 215 | enum jump_label_type type); |
| 216 | extern void arch_jump_label_transform_static(struct jump_entry *entry, | 216 | extern void arch_jump_label_transform_static(struct jump_entry *entry, |
| 217 | enum jump_label_type type); | 217 | 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); | ||
| 218 | extern int jump_label_text_reserved(void *start, void *end); | 221 | extern int jump_label_text_reserved(void *start, void *end); |
| 219 | extern void static_key_slow_inc(struct static_key *key); | 222 | extern void static_key_slow_inc(struct static_key *key); |
| 220 | extern void static_key_slow_dec(struct static_key *key); | 223 | extern void static_key_slow_dec(struct static_key *key); |
diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h index 42710d5949ba..8c3ee291b2d8 100644 --- a/include/linux/jump_label_ratelimit.h +++ b/include/linux/jump_label_ratelimit.h | |||
| @@ -60,8 +60,6 @@ extern void jump_label_update_timeout(struct work_struct *work); | |||
| 60 | 0), \ | 60 | 0), \ |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | #define static_branch_deferred_inc(x) static_branch_inc(&(x)->key) | ||
| 64 | |||
| 65 | #else /* !CONFIG_JUMP_LABEL */ | 63 | #else /* !CONFIG_JUMP_LABEL */ |
| 66 | struct static_key_deferred { | 64 | struct static_key_deferred { |
| 67 | struct static_key key; | 65 | struct static_key key; |
| @@ -95,4 +93,7 @@ jump_label_rate_limit(struct static_key_deferred *key, | |||
| 95 | STATIC_KEY_CHECK_USE(key); | 93 | STATIC_KEY_CHECK_USE(key); |
| 96 | } | 94 | } |
| 97 | #endif /* CONFIG_JUMP_LABEL */ | 95 | #endif /* CONFIG_JUMP_LABEL */ |
| 96 | |||
| 97 | #define static_branch_deferred_inc(x) static_branch_inc(&(x)->key) | ||
| 98 | |||
| 98 | #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ | 99 | #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ |
diff --git a/include/linux/kasan-checks.h b/include/linux/kasan-checks.h index a61dc075e2ce..ac6aba632f2d 100644 --- a/include/linux/kasan-checks.h +++ b/include/linux/kasan-checks.h | |||
| @@ -2,14 +2,43 @@ | |||
| 2 | #ifndef _LINUX_KASAN_CHECKS_H | 2 | #ifndef _LINUX_KASAN_CHECKS_H |
| 3 | #define _LINUX_KASAN_CHECKS_H | 3 | #define _LINUX_KASAN_CHECKS_H |
| 4 | 4 | ||
| 5 | #if defined(__SANITIZE_ADDRESS__) || defined(__KASAN_INTERNAL) | 5 | #include <linux/types.h> |
| 6 | void kasan_check_read(const volatile void *p, unsigned int size); | 6 | |
| 7 | void kasan_check_write(const volatile void *p, unsigned int size); | 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 | ||
| 8 | #else | 33 | #else |
| 9 | static inline void kasan_check_read(const volatile void *p, unsigned int size) | 34 | static inline bool kasan_check_read(const volatile void *p, unsigned int size) |
| 10 | { } | 35 | { |
| 11 | static inline void kasan_check_write(const volatile void *p, unsigned int size) | 36 | return true; |
| 12 | { } | 37 | } |
| 38 | static inline bool kasan_check_write(const volatile void *p, unsigned int size) | ||
| 39 | { | ||
| 40 | return true; | ||
| 41 | } | ||
| 13 | #endif | 42 | #endif |
| 14 | 43 | ||
| 15 | #endif | 44 | #endif |
diff --git a/include/linux/kasan.h b/include/linux/kasan.h index b40ea104dd36..cc8a03cc9674 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h | |||
| @@ -76,8 +76,11 @@ void kasan_free_shadow(const struct vm_struct *vm); | |||
| 76 | int kasan_add_zero_shadow(void *start, unsigned long size); | 76 | int kasan_add_zero_shadow(void *start, unsigned long size); |
| 77 | void kasan_remove_zero_shadow(void *start, unsigned long size); | 77 | void kasan_remove_zero_shadow(void *start, unsigned long size); |
| 78 | 78 | ||
| 79 | size_t ksize(const void *); | 79 | size_t __ksize(const void *); |
| 80 | static inline void kasan_unpoison_slab(const void *ptr) { ksize(ptr); } | 80 | static inline void kasan_unpoison_slab(const void *ptr) |
| 81 | { | ||
| 82 | kasan_unpoison_shadow(ptr, __ksize(ptr)); | ||
| 83 | } | ||
| 81 | size_t kasan_metadata_size(struct kmem_cache *cache); | 84 | size_t kasan_metadata_size(struct kmem_cache *cache); |
| 82 | 85 | ||
| 83 | bool kasan_save_enable_multi_shot(void); | 86 | bool kasan_save_enable_multi_shot(void); |
diff --git a/include/linux/key-type.h b/include/linux/key-type.h index 331cab70db09..4ded94bcf274 100644 --- a/include/linux/key-type.h +++ b/include/linux/key-type.h | |||
| @@ -70,6 +70,9 @@ struct key_type { | |||
| 70 | */ | 70 | */ |
| 71 | size_t def_datalen; | 71 | size_t def_datalen; |
| 72 | 72 | ||
| 73 | unsigned int flags; | ||
| 74 | #define KEY_TYPE_NET_DOMAIN 0x00000001 /* Keys of this type have a net namespace domain */ | ||
| 75 | |||
| 73 | /* vet a description */ | 76 | /* vet a description */ |
| 74 | int (*vet_description)(const char *description); | 77 | int (*vet_description)(const char *description); |
| 75 | 78 | ||
diff --git a/include/linux/key.h b/include/linux/key.h index 1c8b88b455ef..91f391cd272e 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
| @@ -31,6 +31,7 @@ typedef int32_t key_serial_t; | |||
| 31 | typedef uint32_t key_perm_t; | 31 | typedef uint32_t key_perm_t; |
| 32 | 32 | ||
| 33 | struct key; | 33 | struct key; |
| 34 | struct net; | ||
| 34 | 35 | ||
| 35 | #ifdef CONFIG_KEYS | 36 | #ifdef CONFIG_KEYS |
| 36 | 37 | ||
| @@ -77,13 +78,34 @@ struct cred; | |||
| 77 | 78 | ||
| 78 | struct key_type; | 79 | struct key_type; |
| 79 | struct key_owner; | 80 | struct key_owner; |
| 81 | struct key_tag; | ||
| 80 | struct keyring_list; | 82 | struct keyring_list; |
| 81 | struct keyring_name; | 83 | struct keyring_name; |
| 82 | 84 | ||
| 85 | struct key_tag { | ||
| 86 | struct rcu_head rcu; | ||
| 87 | refcount_t usage; | ||
| 88 | bool removed; /* T when subject removed */ | ||
| 89 | }; | ||
| 90 | |||
| 83 | struct keyring_index_key { | 91 | 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 | }; | ||
| 84 | struct key_type *type; | 106 | struct key_type *type; |
| 107 | struct key_tag *domain_tag; /* Domain of operation */ | ||
| 85 | const char *description; | 108 | const char *description; |
| 86 | size_t desc_len; | ||
| 87 | }; | 109 | }; |
| 88 | 110 | ||
| 89 | union key_payload { | 111 | union key_payload { |
| @@ -197,7 +219,10 @@ struct key { | |||
| 197 | union { | 219 | union { |
| 198 | struct keyring_index_key index_key; | 220 | struct keyring_index_key index_key; |
| 199 | struct { | 221 | struct { |
| 222 | unsigned long hash; | ||
| 223 | unsigned long len_desc; | ||
| 200 | struct key_type *type; /* type of key */ | 224 | struct key_type *type; /* type of key */ |
| 225 | struct key_tag *domain_tag; /* Domain of operation */ | ||
| 201 | char *description; | 226 | char *description; |
| 202 | }; | 227 | }; |
| 203 | }; | 228 | }; |
| @@ -248,6 +273,8 @@ extern struct key *key_alloc(struct key_type *type, | |||
| 248 | extern void key_revoke(struct key *key); | 273 | extern void key_revoke(struct key *key); |
| 249 | extern void key_invalidate(struct key *key); | 274 | extern void key_invalidate(struct key *key); |
| 250 | extern void key_put(struct key *key); | 275 | 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); | ||
| 251 | 278 | ||
| 252 | static inline struct key *__key_get(struct key *key) | 279 | static inline struct key *__key_get(struct key *key) |
| 253 | { | 280 | { |
| @@ -265,26 +292,56 @@ static inline void key_ref_put(key_ref_t key_ref) | |||
| 265 | key_put(key_ref_to_ptr(key_ref)); | 292 | key_put(key_ref_to_ptr(key_ref)); |
| 266 | } | 293 | } |
| 267 | 294 | ||
| 268 | extern struct key *request_key(struct key_type *type, | 295 | extern struct key *request_key_tag(struct key_type *type, |
| 269 | const char *description, | 296 | const char *description, |
| 270 | const char *callout_info); | 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); | ||
| 271 | 303 | ||
| 272 | extern struct key *request_key_with_auxdata(struct key_type *type, | 304 | extern struct key *request_key_with_auxdata(struct key_type *type, |
| 273 | const char *description, | 305 | const char *description, |
| 306 | struct key_tag *domain_tag, | ||
| 274 | const void *callout_info, | 307 | const void *callout_info, |
| 275 | size_t callout_len, | 308 | size_t callout_len, |
| 276 | void *aux); | 309 | void *aux); |
| 277 | 310 | ||
| 278 | extern struct key *request_key_async(struct key_type *type, | 311 | /** |
| 279 | const char *description, | 312 | * request_key - Request a key and wait for construction |
| 280 | const void *callout_info, | 313 | * @type: Type of key. |
| 281 | size_t callout_len); | 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 | } | ||
| 282 | 325 | ||
| 283 | extern struct key *request_key_async_with_auxdata(struct key_type *type, | 326 | #ifdef CONFIG_NET |
| 284 | const char *description, | 327 | /* |
| 285 | const void *callout_info, | 328 | * request_key_net - Request a key for a net namespace and wait for construction |
| 286 | size_t callout_len, | 329 | * @type: Type of key. |
| 287 | void *aux); | 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 */ | ||
| 288 | 345 | ||
| 289 | extern int wait_for_key_construction(struct key *key, bool intr); | 346 | extern int wait_for_key_construction(struct key *key, bool intr); |
| 290 | 347 | ||
| @@ -305,6 +362,11 @@ extern int key_update(key_ref_t key, | |||
| 305 | extern int key_link(struct key *keyring, | 362 | extern int key_link(struct key *keyring, |
| 306 | struct key *key); | 363 | struct key *key); |
| 307 | 364 | ||
| 365 | extern int key_move(struct key *key, | ||
| 366 | struct key *from_keyring, | ||
| 367 | struct key *to_keyring, | ||
| 368 | unsigned int flags); | ||
| 369 | |||
| 308 | extern int key_unlink(struct key *keyring, | 370 | extern int key_unlink(struct key *keyring, |
| 309 | struct key *key); | 371 | struct key *key); |
| 310 | 372 | ||
| @@ -324,7 +386,8 @@ extern int keyring_clear(struct key *keyring); | |||
| 324 | 386 | ||
| 325 | extern key_ref_t keyring_search(key_ref_t keyring, | 387 | extern key_ref_t keyring_search(key_ref_t keyring, |
| 326 | struct key_type *type, | 388 | struct key_type *type, |
| 327 | const char *description); | 389 | const char *description, |
| 390 | bool recurse); | ||
| 328 | 391 | ||
| 329 | extern int keyring_add_key(struct key *keyring, | 392 | extern int keyring_add_key(struct key *keyring, |
| 330 | struct key *key); | 393 | struct key *key); |
| @@ -343,6 +406,7 @@ extern void key_set_timeout(struct key *, unsigned); | |||
| 343 | 406 | ||
| 344 | extern key_ref_t lookup_user_key(key_serial_t id, unsigned long flags, | 407 | extern key_ref_t lookup_user_key(key_serial_t id, unsigned long flags, |
| 345 | key_perm_t perm); | 408 | key_perm_t perm); |
| 409 | extern void key_free_user_ns(struct user_namespace *); | ||
| 346 | 410 | ||
| 347 | /* | 411 | /* |
| 348 | * The permissions required on a key that we're looking up. | 412 | * The permissions required on a key that we're looking up. |
| @@ -397,8 +461,8 @@ extern struct ctl_table key_sysctls[]; | |||
| 397 | * the userspace interface | 461 | * the userspace interface |
| 398 | */ | 462 | */ |
| 399 | extern int install_thread_keyring_to_cred(struct cred *cred); | 463 | extern int install_thread_keyring_to_cred(struct cred *cred); |
| 400 | extern void key_fsuid_changed(struct task_struct *tsk); | 464 | extern void key_fsuid_changed(struct cred *new_cred); |
| 401 | extern void key_fsgid_changed(struct task_struct *tsk); | 465 | extern void key_fsgid_changed(struct cred *new_cred); |
| 402 | extern void key_init(void); | 466 | extern void key_init(void); |
| 403 | 467 | ||
| 404 | #else /* CONFIG_KEYS */ | 468 | #else /* CONFIG_KEYS */ |
| @@ -413,9 +477,11 @@ extern void key_init(void); | |||
| 413 | #define make_key_ref(k, p) NULL | 477 | #define make_key_ref(k, p) NULL |
| 414 | #define key_ref_to_ptr(k) NULL | 478 | #define key_ref_to_ptr(k) NULL |
| 415 | #define is_key_possessed(k) 0 | 479 | #define is_key_possessed(k) 0 |
| 416 | #define key_fsuid_changed(t) do { } while(0) | 480 | #define key_fsuid_changed(c) do { } while(0) |
| 417 | #define key_fsgid_changed(t) do { } while(0) | 481 | #define key_fsgid_changed(c) do { } while(0) |
| 418 | #define key_init() do { } while(0) | 482 | #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) | ||
| 419 | 485 | ||
| 420 | #endif /* CONFIG_KEYS */ | 486 | #endif /* CONFIG_KEYS */ |
| 421 | #endif /* __KERNEL__ */ | 487 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d1ad38a3f048..c5da875f19e3 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -159,7 +159,7 @@ static inline bool is_error_page(struct page *page) | |||
| 159 | 159 | ||
| 160 | extern struct kmem_cache *kvm_vcpu_cache; | 160 | extern struct kmem_cache *kvm_vcpu_cache; |
| 161 | 161 | ||
| 162 | extern spinlock_t kvm_lock; | 162 | extern struct mutex kvm_lock; |
| 163 | extern struct list_head vm_list; | 163 | extern struct list_head vm_list; |
| 164 | 164 | ||
| 165 | struct kvm_io_range { | 165 | struct kvm_io_range { |
| @@ -867,7 +867,7 @@ int kvm_arch_hardware_enable(void); | |||
| 867 | void kvm_arch_hardware_disable(void); | 867 | void kvm_arch_hardware_disable(void); |
| 868 | int kvm_arch_hardware_setup(void); | 868 | int kvm_arch_hardware_setup(void); |
| 869 | void kvm_arch_hardware_unsetup(void); | 869 | void kvm_arch_hardware_unsetup(void); |
| 870 | void kvm_arch_check_processor_compat(void *rtn); | 870 | int kvm_arch_check_processor_compat(void); |
| 871 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); | 871 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); |
| 872 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); | 872 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); |
| 873 | int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); | 873 | int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); |
| @@ -990,6 +990,7 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm, | |||
| 990 | struct kvm_irq_ack_notifier *kian); | 990 | struct kvm_irq_ack_notifier *kian); |
| 991 | int kvm_request_irq_source_id(struct kvm *kvm); | 991 | int kvm_request_irq_source_id(struct kvm *kvm); |
| 992 | void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | 992 | void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); |
| 993 | bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args); | ||
| 993 | 994 | ||
| 994 | /* | 995 | /* |
| 995 | * search_memslots() and __gfn_to_memslot() are here because they are | 996 | * search_memslots() and __gfn_to_memslot() are here because they are |
diff --git a/include/linux/leds-ti-lmu-common.h b/include/linux/leds-ti-lmu-common.h new file mode 100644 index 000000000000..5eb111f38803 --- /dev/null +++ b/include/linux/leds-ti-lmu-common.h | |||
| @@ -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_ */ | ||
diff --git a/include/linux/list.h b/include/linux/list.h index e951228db4b2..85c92555e31f 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -106,6 +106,20 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) | |||
| 106 | WRITE_ONCE(prev->next, next); | 106 | WRITE_ONCE(prev->next, next); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 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 | |||
| 109 | /** | 123 | /** |
| 110 | * list_del - deletes entry from list. | 124 | * list_del - deletes entry from list. |
| 111 | * @entry: the element to delete from the list. | 125 | * @entry: the element to delete from the list. |
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index eeba421cc671..273400814020 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | * @stack_node: list node for klp_ops func_stack list | 35 | * @stack_node: list node for klp_ops func_stack list |
| 36 | * @old_size: size of the old function | 36 | * @old_size: size of the old function |
| 37 | * @new_size: size of the new function | 37 | * @new_size: size of the new function |
| 38 | * @kobj_added: @kobj has been added and needs freeing | ||
| 39 | * @nop: temporary patch to use the original code again; dyn. allocated | 38 | * @nop: temporary patch to use the original code again; dyn. allocated |
| 40 | * @patched: the func has been added to the klp_ops list | 39 | * @patched: the func has been added to the klp_ops list |
| 41 | * @transition: the func is currently being applied or reverted | 40 | * @transition: the func is currently being applied or reverted |
| @@ -113,7 +112,6 @@ struct klp_callbacks { | |||
| 113 | * @node: list node for klp_patch obj_list | 112 | * @node: list node for klp_patch obj_list |
| 114 | * @mod: kernel module associated with the patched object | 113 | * @mod: kernel module associated with the patched object |
| 115 | * (NULL for vmlinux) | 114 | * (NULL for vmlinux) |
| 116 | * @kobj_added: @kobj has been added and needs freeing | ||
| 117 | * @dynamic: temporary object for nop functions; dynamically allocated | 115 | * @dynamic: temporary object for nop functions; dynamically allocated |
| 118 | * @patched: the object's funcs have been added to the klp_ops list | 116 | * @patched: the object's funcs have been added to the klp_ops list |
| 119 | */ | 117 | */ |
| @@ -140,7 +138,6 @@ struct klp_object { | |||
| 140 | * @list: list node for global list of actively used patches | 138 | * @list: list node for global list of actively used patches |
| 141 | * @kobj: kobject for sysfs resources | 139 | * @kobj: kobject for sysfs resources |
| 142 | * @obj_list: dynamic list of the object entries | 140 | * @obj_list: dynamic list of the object entries |
| 143 | * @kobj_added: @kobj has been added and needs freeing | ||
| 144 | * @enabled: the patch is enabled (but operation may be incomplete) | 141 | * @enabled: the patch is enabled (but operation may be incomplete) |
| 145 | * @forced: was involved in a forced transition | 142 | * @forced: was involved in a forced transition |
| 146 | * @free_work: patch cleanup from workqueue-context | 143 | * @free_work: patch cleanup from workqueue-context |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index c9b422dde542..d294dde9e546 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
| @@ -282,6 +282,7 @@ void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, | |||
| 282 | nlm_host_match_fn_t match); | 282 | nlm_host_match_fn_t match); |
| 283 | void nlmsvc_grant_reply(struct nlm_cookie *, __be32); | 283 | void nlmsvc_grant_reply(struct nlm_cookie *, __be32); |
| 284 | void nlmsvc_release_call(struct nlm_rqst *); | 284 | void nlmsvc_release_call(struct nlm_rqst *); |
| 285 | void nlmsvc_locks_init_private(struct file_lock *, struct nlm_host *, pid_t); | ||
| 285 | 286 | ||
| 286 | /* | 287 | /* |
| 287 | * File handling for the server personality | 288 | * File handling for the server personality |
| @@ -289,6 +290,7 @@ void nlmsvc_release_call(struct nlm_rqst *); | |||
| 289 | __be32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **, | 290 | __be32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **, |
| 290 | struct nfs_fh *); | 291 | struct nfs_fh *); |
| 291 | void nlm_release_file(struct nlm_file *); | 292 | void nlm_release_file(struct nlm_file *); |
| 293 | void nlmsvc_release_lockowner(struct nlm_lock *); | ||
| 292 | void nlmsvc_mark_resources(struct net *); | 294 | void nlmsvc_mark_resources(struct net *); |
| 293 | void nlmsvc_free_host_resources(struct nlm_host *); | 295 | void nlmsvc_free_host_resources(struct nlm_host *); |
| 294 | void nlmsvc_invalidate_all(void); | 296 | void nlmsvc_invalidate_all(void); |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 6e2377e6c1d6..0b0d7259276d 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 5 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 6 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra | 6 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 7 | * | 7 | * |
| 8 | * see Documentation/locking/lockdep-design.txt for more details. | 8 | * see Documentation/locking/lockdep-design.rst for more details. |
| 9 | */ | 9 | */ |
| 10 | #ifndef __LINUX_LOCKDEP_H | 10 | #ifndef __LINUX_LOCKDEP_H |
| 11 | #define __LINUX_LOCKDEP_H | 11 | #define __LINUX_LOCKDEP_H |
| @@ -203,11 +203,17 @@ struct lock_list { | |||
| 203 | struct lock_list *parent; | 203 | struct lock_list *parent; |
| 204 | }; | 204 | }; |
| 205 | 205 | ||
| 206 | /* | 206 | /** |
| 207 | * We record lock dependency chains, so that we can cache them: | 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 | ||
| 208 | */ | 214 | */ |
| 209 | struct lock_chain { | 215 | struct lock_chain { |
| 210 | /* see BUILD_BUG_ON()s in lookup_chain_cache() */ | 216 | /* see BUILD_BUG_ON()s in add_chain_cache() */ |
| 211 | unsigned int irq_context : 2, | 217 | unsigned int irq_context : 2, |
| 212 | depth : 6, | 218 | depth : 6, |
| 213 | base : 24; | 219 | base : 24; |
| @@ -217,12 +223,8 @@ struct lock_chain { | |||
| 217 | }; | 223 | }; |
| 218 | 224 | ||
| 219 | #define MAX_LOCKDEP_KEYS_BITS 13 | 225 | #define MAX_LOCKDEP_KEYS_BITS 13 |
| 220 | /* | 226 | #define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS) |
| 221 | * Subtract one because we offset hlock->class_idx by 1 in order | 227 | #define INITIAL_CHAIN_KEY -1 |
| 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 | 228 | ||
| 227 | struct held_lock { | 229 | struct held_lock { |
| 228 | /* | 230 | /* |
| @@ -247,6 +249,11 @@ struct held_lock { | |||
| 247 | u64 waittime_stamp; | 249 | u64 waittime_stamp; |
| 248 | u64 holdtime_stamp; | 250 | u64 holdtime_stamp; |
| 249 | #endif | 251 | #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 | */ | ||
| 250 | unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS; | 257 | unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS; |
| 251 | /* | 258 | /* |
| 252 | * The lock-stack is unified in that the lock chains of interrupt | 259 | * 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); | |||
| 281 | extern asmlinkage void lockdep_sys_exit(void); | 288 | extern asmlinkage void lockdep_sys_exit(void); |
| 282 | extern void lockdep_set_selftest_task(struct task_struct *task); | 289 | extern void lockdep_set_selftest_task(struct task_struct *task); |
| 283 | 290 | ||
| 291 | extern void lockdep_init_task(struct task_struct *task); | ||
| 292 | |||
| 284 | extern void lockdep_off(void); | 293 | extern void lockdep_off(void); |
| 285 | extern void lockdep_on(void); | 294 | extern void lockdep_on(void); |
| 286 | 295 | ||
| @@ -385,7 +394,7 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); | |||
| 385 | WARN_ON(debug_locks && !lockdep_is_held(l)); \ | 394 | WARN_ON(debug_locks && !lockdep_is_held(l)); \ |
| 386 | } while (0) | 395 | } while (0) |
| 387 | 396 | ||
| 388 | #define lockdep_assert_held_exclusive(l) do { \ | 397 | #define lockdep_assert_held_write(l) do { \ |
| 389 | WARN_ON(debug_locks && !lockdep_is_held_type(l, 0)); \ | 398 | WARN_ON(debug_locks && !lockdep_is_held_type(l, 0)); \ |
| 390 | } while (0) | 399 | } while (0) |
| 391 | 400 | ||
| @@ -405,6 +414,10 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); | |||
| 405 | 414 | ||
| 406 | #else /* !CONFIG_LOCKDEP */ | 415 | #else /* !CONFIG_LOCKDEP */ |
| 407 | 416 | ||
| 417 | static inline void lockdep_init_task(struct task_struct *task) | ||
| 418 | { | ||
| 419 | } | ||
| 420 | |||
| 408 | static inline void lockdep_off(void) | 421 | static inline void lockdep_off(void) |
| 409 | { | 422 | { |
| 410 | } | 423 | } |
| @@ -466,7 +479,7 @@ struct lockdep_map { }; | |||
| 466 | #define lockdep_is_held_type(l, r) (1) | 479 | #define lockdep_is_held_type(l, r) (1) |
| 467 | 480 | ||
| 468 | #define lockdep_assert_held(l) do { (void)(l); } while (0) | 481 | #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) |
| 470 | #define lockdep_assert_held_read(l) do { (void)(l); } while (0) | 483 | #define lockdep_assert_held_read(l) do { (void)(l); } while (0) |
| 471 | #define lockdep_assert_held_once(l) do { (void)(l); } while (0) | 484 | #define lockdep_assert_held_once(l) do { (void)(l); } while (0) |
| 472 | 485 | ||
| @@ -497,7 +510,6 @@ enum xhlock_context_t { | |||
| 497 | { .name = (_name), .key = (void *)(_key), } | 510 | { .name = (_name), .key = (void *)(_key), } |
| 498 | 511 | ||
| 499 | static inline void lockdep_invariant_state(bool force) {} | 512 | static inline void lockdep_invariant_state(bool force) {} |
| 500 | static inline void lockdep_init_task(struct task_struct *task) {} | ||
| 501 | static inline void lockdep_free_task(struct task_struct *task) {} | 513 | static inline void lockdep_free_task(struct task_struct *task) {} |
| 502 | 514 | ||
| 503 | #ifdef CONFIG_LOCK_STAT | 515 | #ifdef CONFIG_LOCK_STAT |
| @@ -632,11 +644,18 @@ do { \ | |||
| 632 | "IRQs not disabled as expected\n"); \ | 644 | "IRQs not disabled as expected\n"); \ |
| 633 | } while (0) | 645 | } while (0) |
| 634 | 646 | ||
| 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 | |||
| 635 | #else | 653 | #else |
| 636 | # define might_lock(lock) do { } while (0) | 654 | # define might_lock(lock) do { } while (0) |
| 637 | # define might_lock_read(lock) do { } while (0) | 655 | # define might_lock_read(lock) do { } while (0) |
| 638 | # define lockdep_assert_irqs_enabled() do { } while (0) | 656 | # define lockdep_assert_irqs_enabled() do { } while (0) |
| 639 | # define lockdep_assert_irqs_disabled() do { } while (0) | 657 | # define lockdep_assert_irqs_disabled() do { } while (0) |
| 658 | # define lockdep_assert_in_irq() do { } while (0) | ||
| 640 | #endif | 659 | #endif |
| 641 | 660 | ||
| 642 | #ifdef CONFIG_LOCKDEP | 661 | #ifdef CONFIG_LOCKDEP |
diff --git a/include/linux/log2.h b/include/linux/log2.h index 1aec01365ed4..83a4a3ca3e8a 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h | |||
| @@ -220,4 +220,38 @@ int __order_base_2(unsigned long n) | |||
| 220 | ilog2((n) - 1) + 1) : \ | 220 | ilog2((n) - 1) + 1) : \ |
| 221 | __order_base_2(n) \ | 221 | __order_base_2(n) \ |
| 222 | ) | 222 | ) |
| 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 | ) | ||
| 223 | #endif /* _LINUX_LOG2_H */ | 257 | #endif /* _LINUX_LOG2_H */ |
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 47f58cfb6a19..df1318d85f7d 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h | |||
| @@ -77,7 +77,7 @@ | |||
| 77 | * state. This is called immediately after commit_creds(). | 77 | * state. This is called immediately after commit_creds(). |
| 78 | * | 78 | * |
| 79 | * Security hooks for mount using fs_context. | 79 | * Security hooks for mount using fs_context. |
| 80 | * [See also Documentation/filesystems/mounting.txt] | 80 | * [See also Documentation/filesystems/mount_api.txt] |
| 81 | * | 81 | * |
| 82 | * @fs_context_dup: | 82 | * @fs_context_dup: |
| 83 | * Allocate and attach a security structure to sc->security. This pointer | 83 | * Allocate and attach a security structure to sc->security. This pointer |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 1dcb763bb610..44c41462be33 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -233,8 +233,9 @@ struct mem_cgroup { | |||
| 233 | /* OOM-Killer disable */ | 233 | /* OOM-Killer disable */ |
| 234 | int oom_kill_disable; | 234 | int oom_kill_disable; |
| 235 | 235 | ||
| 236 | /* memory.events */ | 236 | /* memory.events and memory.events.local */ |
| 237 | struct cgroup_file events_file; | 237 | struct cgroup_file events_file; |
| 238 | struct cgroup_file events_local_file; | ||
| 238 | 239 | ||
| 239 | /* handle for "memory.swap.events" */ | 240 | /* handle for "memory.swap.events" */ |
| 240 | struct cgroup_file swap_events_file; | 241 | struct cgroup_file swap_events_file; |
| @@ -281,6 +282,7 @@ struct mem_cgroup { | |||
| 281 | 282 | ||
| 282 | /* memory.events */ | 283 | /* memory.events */ |
| 283 | atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; | 284 | atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; |
| 285 | atomic_long_t memory_events_local[MEMCG_NR_MEMORY_EVENTS]; | ||
| 284 | 286 | ||
| 285 | unsigned long socket_pressure; | 287 | unsigned long socket_pressure; |
| 286 | 288 | ||
| @@ -392,7 +394,6 @@ out: | |||
| 392 | 394 | ||
| 393 | struct lruvec *mem_cgroup_page_lruvec(struct page *, struct pglist_data *); | 395 | struct lruvec *mem_cgroup_page_lruvec(struct page *, struct pglist_data *); |
| 394 | 396 | ||
| 395 | bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg); | ||
| 396 | struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); | 397 | struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); |
| 397 | 398 | ||
| 398 | struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm); | 399 | 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, | |||
| 747 | static inline void memcg_memory_event(struct mem_cgroup *memcg, | 748 | static inline void memcg_memory_event(struct mem_cgroup *memcg, |
| 748 | enum memcg_memory_event event) | 749 | enum memcg_memory_event event) |
| 749 | { | 750 | { |
| 751 | atomic_long_inc(&memcg->memory_events_local[event]); | ||
| 752 | cgroup_file_notify(&memcg->events_local_file); | ||
| 753 | |||
| 750 | do { | 754 | do { |
| 751 | atomic_long_inc(&memcg->memory_events[event]); | 755 | atomic_long_inc(&memcg->memory_events[event]); |
| 752 | cgroup_file_notify(&memcg->events_file); | 756 | cgroup_file_notify(&memcg->events_file); |
| @@ -870,12 +874,6 @@ static inline bool mm_match_cgroup(struct mm_struct *mm, | |||
| 870 | return true; | 874 | return true; |
| 871 | } | 875 | } |
| 872 | 876 | ||
| 873 | static inline bool task_in_mem_cgroup(struct task_struct *task, | ||
| 874 | const struct mem_cgroup *memcg) | ||
| 875 | { | ||
| 876 | return true; | ||
| 877 | } | ||
| 878 | |||
| 879 | static inline struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm) | 877 | static inline struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm) |
| 880 | { | 878 | { |
| 881 | return NULL; | 879 | return NULL; |
| @@ -1273,6 +1271,8 @@ int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order); | |||
| 1273 | void __memcg_kmem_uncharge(struct page *page, int order); | 1271 | void __memcg_kmem_uncharge(struct page *page, int order); |
| 1274 | int __memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order, | 1272 | int __memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order, |
| 1275 | struct mem_cgroup *memcg); | 1273 | struct mem_cgroup *memcg); |
| 1274 | void __memcg_kmem_uncharge_memcg(struct mem_cgroup *memcg, | ||
| 1275 | unsigned int nr_pages); | ||
| 1276 | 1276 | ||
| 1277 | extern struct static_key_false memcg_kmem_enabled_key; | 1277 | extern struct static_key_false memcg_kmem_enabled_key; |
| 1278 | extern struct workqueue_struct *memcg_kmem_cache_wq; | 1278 | 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, | |||
| 1314 | return __memcg_kmem_charge_memcg(page, gfp, order, memcg); | 1314 | return __memcg_kmem_charge_memcg(page, gfp, order, memcg); |
| 1315 | return 0; | 1315 | return 0; |
| 1316 | } | 1316 | } |
| 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 | |||
| 1317 | /* | 1325 | /* |
| 1318 | * helper for accessing a memcg's index. It will be used as an index in the | 1326 | * helper for accessing a memcg's index. It will be used as an index in the |
| 1319 | * child cache array in kmem_cache, and also to derive its name. This function | 1327 | * child cache array in kmem_cache, and also to derive its name. This function |
diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 1732dea030b2..f8a5b2a19945 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h | |||
| @@ -37,13 +37,6 @@ struct vmem_altmap { | |||
| 37 | * A more complete discussion of unaddressable memory may be found in | 37 | * A more complete discussion of unaddressable memory may be found in |
| 38 | * include/linux/hmm.h and Documentation/vm/hmm.rst. | 38 | * include/linux/hmm.h and Documentation/vm/hmm.rst. |
| 39 | * | 39 | * |
| 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 | * | ||
| 47 | * MEMORY_DEVICE_FS_DAX: | 40 | * MEMORY_DEVICE_FS_DAX: |
| 48 | * Host memory that has similar access semantics as System RAM i.e. DMA | 41 | * Host memory that has similar access semantics as System RAM i.e. DMA |
| 49 | * coherent and supports page pinning. In support of coordinating page | 42 | * coherent and supports page pinning. In support of coordinating page |
| @@ -52,54 +45,84 @@ struct vmem_altmap { | |||
| 52 | * wakeup is used to coordinate physical address space management (ex: | 45 | * wakeup is used to coordinate physical address space management (ex: |
| 53 | * fs truncate/hole punch) vs pinned pages (ex: device dma). | 46 | * fs truncate/hole punch) vs pinned pages (ex: device dma). |
| 54 | * | 47 | * |
| 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 | * | ||
| 55 | * MEMORY_DEVICE_PCI_P2PDMA: | 54 | * MEMORY_DEVICE_PCI_P2PDMA: |
| 56 | * Device memory residing in a PCI BAR intended for use with Peer-to-Peer | 55 | * Device memory residing in a PCI BAR intended for use with Peer-to-Peer |
| 57 | * transactions. | 56 | * transactions. |
| 58 | */ | 57 | */ |
| 59 | enum memory_type { | 58 | enum memory_type { |
| 59 | /* 0 is reserved to catch uninitialized type fields */ | ||
| 60 | MEMORY_DEVICE_PRIVATE = 1, | 60 | MEMORY_DEVICE_PRIVATE = 1, |
| 61 | MEMORY_DEVICE_PUBLIC, | ||
| 62 | MEMORY_DEVICE_FS_DAX, | 61 | MEMORY_DEVICE_FS_DAX, |
| 62 | MEMORY_DEVICE_DEVDAX, | ||
| 63 | MEMORY_DEVICE_PCI_P2PDMA, | 63 | MEMORY_DEVICE_PCI_P2PDMA, |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | /* | 66 | struct dev_pagemap_ops { |
| 67 | * Additional notes about MEMORY_DEVICE_PRIVATE may be found in | 67 | /* |
| 68 | * include/linux/hmm.h and Documentation/vm/hmm.rst. There is also a brief | 68 | * Called once the page refcount reaches 1. (ZONE_DEVICE pages never |
| 69 | * explanation in include/linux/memory_hotplug.h. | 69 | * reach 0 refcount unless there is a refcount bug. This allows the |
| 70 | * | 70 | * device driver to implement its own memory management.) |
| 71 | * The page_free() callback is called once the page refcount reaches 1 | 71 | */ |
| 72 | * (ZONE_DEVICE pages never reach 0 refcount unless there is a refcount bug. | 72 | void (*page_free)(struct page *page); |
| 73 | * This allows the device driver to implement its own memory management.) | 73 | |
| 74 | */ | 74 | /* |
| 75 | typedef void (*dev_page_free_t)(struct page *page, void *data); | 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) | ||
| 76 | 92 | ||
| 77 | /** | 93 | /** |
| 78 | * struct dev_pagemap - metadata for ZONE_DEVICE mappings | 94 | * struct dev_pagemap - metadata for ZONE_DEVICE mappings |
| 79 | * @page_free: free page callback when page refcount reaches 1 | ||
| 80 | * @altmap: pre-allocated/reserved memory for vmemmap allocations | 95 | * @altmap: pre-allocated/reserved memory for vmemmap allocations |
| 81 | * @res: physical address range covered by @ref | 96 | * @res: physical address range covered by @ref |
| 82 | * @ref: reference count that pins the devm_memremap_pages() mapping | 97 | * @ref: reference count that pins the devm_memremap_pages() mapping |
| 83 | * @kill: callback to transition @ref to the dead state | 98 | * @internal_ref: internal reference if @ref is not provided by the caller |
| 84 | * @cleanup: callback to wait for @ref to be idle and reap it | 99 | * @done: completion for @internal_ref |
| 85 | * @dev: host device of the mapping for debug | 100 | * @dev: host device of the mapping for debug |
| 86 | * @data: private data pointer for page_free() | 101 | * @data: private data pointer for page_free() |
| 87 | * @type: memory type: see MEMORY_* in memory_hotplug.h | 102 | * @type: memory type: see MEMORY_* in memory_hotplug.h |
| 103 | * @flags: PGMAP_* flags to specify defailed behavior | ||
| 104 | * @ops: method table | ||
| 88 | */ | 105 | */ |
| 89 | struct dev_pagemap { | 106 | struct dev_pagemap { |
| 90 | dev_page_free_t page_free; | ||
| 91 | struct vmem_altmap altmap; | 107 | struct vmem_altmap altmap; |
| 92 | bool altmap_valid; | ||
| 93 | struct resource res; | 108 | struct resource res; |
| 94 | struct percpu_ref *ref; | 109 | struct percpu_ref *ref; |
| 95 | void (*kill)(struct percpu_ref *ref); | 110 | struct percpu_ref internal_ref; |
| 96 | void (*cleanup)(struct percpu_ref *ref); | 111 | struct completion done; |
| 97 | struct device *dev; | 112 | struct device *dev; |
| 98 | void *data; | ||
| 99 | enum memory_type type; | 113 | enum memory_type type; |
| 114 | unsigned int flags; | ||
| 100 | u64 pci_p2pdma_bus_offset; | 115 | u64 pci_p2pdma_bus_offset; |
| 116 | const struct dev_pagemap_ops *ops; | ||
| 101 | }; | 117 | }; |
| 102 | 118 | ||
| 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 | |||
| 103 | #ifdef CONFIG_ZONE_DEVICE | 126 | #ifdef CONFIG_ZONE_DEVICE |
| 104 | void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap); | 127 | void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap); |
| 105 | void devm_memunmap_pages(struct device *dev, struct dev_pagemap *pgmap); | 128 | void devm_memunmap_pages(struct device *dev, struct dev_pagemap *pgmap); |
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index 5ddca44be06d..77805c3f2de7 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #define CROS_EC_DEV_PD_NAME "cros_pd" | 19 | #define CROS_EC_DEV_PD_NAME "cros_pd" |
| 20 | #define CROS_EC_DEV_TP_NAME "cros_tp" | 20 | #define CROS_EC_DEV_TP_NAME "cros_tp" |
| 21 | #define CROS_EC_DEV_ISH_NAME "cros_ish" | 21 | #define CROS_EC_DEV_ISH_NAME "cros_ish" |
| 22 | #define CROS_EC_DEV_SCP_NAME "cros_scp" | ||
| 22 | 23 | ||
| 23 | /* | 24 | /* |
| 24 | * The EC is unresponsive for a time after a reboot command. Add a | 25 | * The EC is unresponsive for a time after a reboot command. Add a |
| @@ -155,6 +156,7 @@ struct cros_ec_device { | |||
| 155 | struct ec_response_get_next_event_v1 event_data; | 156 | struct ec_response_get_next_event_v1 event_data; |
| 156 | int event_size; | 157 | int event_size; |
| 157 | u32 host_event_wake_mask; | 158 | u32 host_event_wake_mask; |
| 159 | u32 last_resume_result; | ||
| 158 | }; | 160 | }; |
| 159 | 161 | ||
| 160 | /** | 162 | /** |
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index 114614e20e4d..7ccb8757b79d 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h | |||
| @@ -4,17 +4,20 @@ | |||
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2012 Google, Inc | 5 | * Copyright (C) 2012 Google, Inc |
| 6 | * | 6 | * |
| 7 | * The ChromeOS EC multi function device is used to mux all the requests | 7 | * NOTE: This file is auto-generated from ChromeOS EC Open Source code from |
| 8 | * to the EC device for its multiple features: keyboard controller, | 8 | * https://chromium.googlesource.com/chromiumos/platform/ec/+/master/include/ec_commands.h |
| 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. | ||
| 13 | */ | 9 | */ |
| 14 | 10 | ||
| 11 | /* Host communication command constants for Chrome EC */ | ||
| 12 | |||
| 15 | #ifndef __CROS_EC_COMMANDS_H | 13 | #ifndef __CROS_EC_COMMANDS_H |
| 16 | #define __CROS_EC_COMMANDS_H | 14 | #define __CROS_EC_COMMANDS_H |
| 17 | 15 | ||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | #define BUILD_ASSERT(_cond) | ||
| 20 | |||
| 18 | /* | 21 | /* |
| 19 | * Current version of this protocol | 22 | * Current version of this protocol |
| 20 | * | 23 | * |
| @@ -25,7 +28,7 @@ | |||
| 25 | #define EC_PROTO_VERSION 0x00000002 | 28 | #define EC_PROTO_VERSION 0x00000002 |
| 26 | 29 | ||
| 27 | /* Command version mask */ | 30 | /* Command version mask */ |
| 28 | #define EC_VER_MASK(version) (1UL << (version)) | 31 | #define EC_VER_MASK(version) BIT(version) |
| 29 | 32 | ||
| 30 | /* I/O addresses for ACPI commands */ | 33 | /* I/O addresses for ACPI commands */ |
| 31 | #define EC_LPC_ADDR_ACPI_DATA 0x62 | 34 | #define EC_LPC_ADDR_ACPI_DATA 0x62 |
| @@ -39,25 +42,28 @@ | |||
| 39 | /* Protocol version 2 */ | 42 | /* Protocol version 2 */ |
| 40 | #define EC_LPC_ADDR_HOST_ARGS 0x800 /* And 0x801, 0x802, 0x803 */ | 43 | #define EC_LPC_ADDR_HOST_ARGS 0x800 /* And 0x801, 0x802, 0x803 */ |
| 41 | #define EC_LPC_ADDR_HOST_PARAM 0x804 /* For version 2 params; size is | 44 | #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 | */ | ||
| 43 | /* Protocol version 3 */ | 47 | /* Protocol version 3 */ |
| 44 | #define EC_LPC_ADDR_HOST_PACKET 0x800 /* Offset of version 3 packet */ | 48 | #define EC_LPC_ADDR_HOST_PACKET 0x800 /* Offset of version 3 packet */ |
| 45 | #define EC_LPC_HOST_PACKET_SIZE 0x100 /* Max size of version 3 packet */ | 49 | #define EC_LPC_HOST_PACKET_SIZE 0x100 /* Max size of version 3 packet */ |
| 46 | 50 | ||
| 47 | /* The actual block is 0x800-0x8ff, but some BIOSes think it's 0x880-0x8ff | 51 | /* |
| 48 | * and they tell the kernel that so we have to think of it as two parts. */ | 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 | */ | ||
| 49 | #define EC_HOST_CMD_REGION0 0x800 | 55 | #define EC_HOST_CMD_REGION0 0x800 |
| 50 | #define EC_HOST_CMD_REGION1 0x880 | 56 | #define EC_HOST_CMD_REGION1 0x880 |
| 51 | #define EC_HOST_CMD_REGION_SIZE 0x80 | 57 | #define EC_HOST_CMD_REGION_SIZE 0x80 |
| 52 | 58 | ||
| 53 | /* EC command register bit functions */ | 59 | /* EC command register bit functions */ |
| 54 | #define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */ | 60 | #define EC_LPC_CMDR_DATA BIT(0) /* Data ready for host to read */ |
| 55 | #define EC_LPC_CMDR_PENDING (1 << 1) /* Write pending to EC */ | 61 | #define EC_LPC_CMDR_PENDING BIT(1) /* Write pending to EC */ |
| 56 | #define EC_LPC_CMDR_BUSY (1 << 2) /* EC is busy processing a command */ | 62 | #define EC_LPC_CMDR_BUSY BIT(2) /* EC is busy processing a command */ |
| 57 | #define EC_LPC_CMDR_CMD (1 << 3) /* Last host write was a command */ | 63 | #define EC_LPC_CMDR_CMD BIT(3) /* Last host write was a command */ |
| 58 | #define EC_LPC_CMDR_ACPI_BRST (1 << 4) /* Burst mode (not used) */ | 64 | #define EC_LPC_CMDR_ACPI_BRST BIT(4) /* Burst mode (not used) */ |
| 59 | #define EC_LPC_CMDR_SCI (1 << 5) /* SCI event is pending */ | 65 | #define EC_LPC_CMDR_SCI BIT(5) /* SCI event is pending */ |
| 60 | #define EC_LPC_CMDR_SMI (1 << 6) /* SMI event is pending */ | 66 | #define EC_LPC_CMDR_SMI BIT(6) /* SMI event is pending */ |
| 61 | 67 | ||
| 62 | #define EC_LPC_ADDR_MEMMAP 0x900 | 68 | #define EC_LPC_ADDR_MEMMAP 0x900 |
| 63 | #define EC_MEMMAP_SIZE 255 /* ACPI IO buffer max is 255 bytes */ | 69 | #define EC_MEMMAP_SIZE 255 /* ACPI IO buffer max is 255 bytes */ |
| @@ -77,13 +83,15 @@ | |||
| 77 | /* Unused 0x28 - 0x2f */ | 83 | /* Unused 0x28 - 0x2f */ |
| 78 | #define EC_MEMMAP_SWITCHES 0x30 /* 8 bits */ | 84 | #define EC_MEMMAP_SWITCHES 0x30 /* 8 bits */ |
| 79 | /* Unused 0x31 - 0x33 */ | 85 | /* Unused 0x31 - 0x33 */ |
| 80 | #define EC_MEMMAP_HOST_EVENTS 0x34 /* 32 bits */ | 86 | #define EC_MEMMAP_HOST_EVENTS 0x34 /* 64 bits */ |
| 81 | /* Reserve 0x38 - 0x3f for additional host event-related stuff */ | 87 | /* Battery values are all 32 bits, unless otherwise noted. */ |
| 82 | /* Battery values are all 32 bits */ | ||
| 83 | #define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */ | 88 | #define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */ |
| 84 | #define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */ | 89 | #define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */ |
| 85 | #define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */ | 90 | #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 */ | ||
| 87 | #define EC_MEMMAP_BATT_DCAP 0x50 /* Battery Design Capacity */ | 95 | #define EC_MEMMAP_BATT_DCAP 0x50 /* Battery Design Capacity */ |
| 88 | #define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */ | 96 | #define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */ |
| 89 | #define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */ | 97 | #define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */ |
| @@ -97,15 +105,24 @@ | |||
| 97 | /* Unused 0x84 - 0x8f */ | 105 | /* Unused 0x84 - 0x8f */ |
| 98 | #define EC_MEMMAP_ACC_STATUS 0x90 /* Accelerometer status (8 bits )*/ | 106 | #define EC_MEMMAP_ACC_STATUS 0x90 /* Accelerometer status (8 bits )*/ |
| 99 | /* Unused 0x91 */ | 107 | /* 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 */ | ||
| 101 | #define EC_MEMMAP_GYRO_DATA 0xa0 /* Gyroscope data 0xa0 - 0xa5 */ | 112 | #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 */ |
| 103 | 114 | ||
| 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 | ||
| 104 | 121 | ||
| 105 | /* Define the format of the accelerometer mapped memory status byte. */ | 122 | /* Define the format of the accelerometer mapped memory status byte. */ |
| 106 | #define EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK 0x0f | 123 | #define EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK 0x0f |
| 107 | #define EC_MEMMAP_ACC_STATUS_BUSY_BIT (1 << 4) | 124 | #define EC_MEMMAP_ACC_STATUS_BUSY_BIT BIT(4) |
| 108 | #define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT (1 << 7) | 125 | #define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT BIT(7) |
| 109 | 126 | ||
| 110 | /* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */ | 127 | /* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */ |
| 111 | #define EC_TEMP_SENSOR_ENTRIES 16 | 128 | #define EC_TEMP_SENSOR_ENTRIES 16 |
| @@ -149,6 +166,8 @@ | |||
| 149 | #define EC_BATT_FLAG_DISCHARGING 0x04 | 166 | #define EC_BATT_FLAG_DISCHARGING 0x04 |
| 150 | #define EC_BATT_FLAG_CHARGING 0x08 | 167 | #define EC_BATT_FLAG_CHARGING 0x08 |
| 151 | #define EC_BATT_FLAG_LEVEL_CRITICAL 0x10 | 168 | #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 | ||
| 152 | 171 | ||
| 153 | /* Switch flags at EC_MEMMAP_SWITCHES */ | 172 | /* Switch flags at EC_MEMMAP_SWITCHES */ |
| 154 | #define EC_SWITCH_LID_OPEN 0x01 | 173 | #define EC_SWITCH_LID_OPEN 0x01 |
| @@ -174,20 +193,242 @@ | |||
| 174 | #define EC_WIRELESS_SWITCH_WWAN 0x04 /* WWAN power */ | 193 | #define EC_WIRELESS_SWITCH_WWAN 0x04 /* WWAN power */ |
| 175 | #define EC_WIRELESS_SWITCH_WLAN_POWER 0x08 /* WLAN power */ | 194 | #define EC_WIRELESS_SWITCH_WLAN_POWER 0x08 /* WLAN power */ |
| 176 | 195 | ||
| 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 | |||
| 177 | /* | 384 | /* |
| 178 | * This header file is used in coreboot both in C and ACPI code. The ACPI code | 385 | * This header file is used in coreboot both in C and ACPI code. The ACPI code |
| 179 | * is pre-processed to handle constants but the ASL compiler is unable to | 386 | * is pre-processed to handle constants but the ASL compiler is unable to |
| 180 | * handle actual C code so keep it separate. | 387 | * handle actual C code so keep it separate. |
| 181 | */ | 388 | */ |
| 182 | #ifndef __ACPI__ | 389 | |
| 183 | 390 | ||
| 184 | /* | 391 | /* |
| 185 | * Define __packed if someone hasn't beat us to it. Linux kernel style | 392 | * Attributes for EC request and response packets. Just defining __packed |
| 186 | * checking prefers __packed over __attribute__((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 | */ | ||
| 418 | |||
| 419 | /* | ||
| 420 | * Packed structures make no assumption about alignment, so they do inefficient | ||
| 421 | * byte-wise reads. | ||
| 187 | */ | 422 | */ |
| 188 | #ifndef __packed | 423 | #define __ec_align1 __packed |
| 189 | #define __packed __attribute__((packed)) | 424 | #define __ec_align2 __packed |
| 190 | #endif | 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 | |||
| 191 | 432 | ||
| 192 | /* LPC command status byte masks */ | 433 | /* LPC command status byte masks */ |
| 193 | /* EC has written a byte in the data register and host hasn't read it yet */ | 434 | /* EC has written a byte in the data register and host hasn't read it yet */ |
| @@ -198,7 +439,7 @@ | |||
| 198 | #define EC_LPC_STATUS_PROCESSING 0x04 | 439 | #define EC_LPC_STATUS_PROCESSING 0x04 |
| 199 | /* Last write to EC was a command, not data */ | 440 | /* Last write to EC was a command, not data */ |
| 200 | #define EC_LPC_STATUS_LAST_CMD 0x08 | 441 | #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 */ |
| 202 | #define EC_LPC_STATUS_BURST_MODE 0x10 | 443 | #define EC_LPC_STATUS_BURST_MODE 0x10 |
| 203 | /* SCI event is pending (requesting SCI query) */ | 444 | /* SCI event is pending (requesting SCI query) */ |
| 204 | #define EC_LPC_STATUS_SCI_PENDING 0x20 | 445 | #define EC_LPC_STATUS_SCI_PENDING 0x20 |
| @@ -214,7 +455,10 @@ | |||
| 214 | #define EC_LPC_STATUS_BUSY_MASK \ | 455 | #define EC_LPC_STATUS_BUSY_MASK \ |
| 215 | (EC_LPC_STATUS_FROM_HOST | EC_LPC_STATUS_PROCESSING) | 456 | (EC_LPC_STATUS_FROM_HOST | EC_LPC_STATUS_PROCESSING) |
| 216 | 457 | ||
| 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 | */ | ||
| 218 | enum ec_status { | 462 | enum ec_status { |
| 219 | EC_RES_SUCCESS = 0, | 463 | EC_RES_SUCCESS = 0, |
| 220 | EC_RES_INVALID_COMMAND = 1, | 464 | EC_RES_INVALID_COMMAND = 1, |
| @@ -230,7 +474,13 @@ enum ec_status { | |||
| 230 | EC_RES_OVERFLOW = 11, /* Table / data overflow */ | 474 | EC_RES_OVERFLOW = 11, /* Table / data overflow */ |
| 231 | EC_RES_INVALID_HEADER = 12, /* Header contains invalid data */ | 475 | EC_RES_INVALID_HEADER = 12, /* Header contains invalid data */ |
| 232 | EC_RES_REQUEST_TRUNCATED = 13, /* Didn't get the entire request */ | 476 | 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 */ | ||
| 234 | }; | 484 | }; |
| 235 | 485 | ||
| 236 | /* | 486 | /* |
| @@ -250,7 +500,8 @@ enum host_event_code { | |||
| 250 | EC_HOST_EVENT_BATTERY_CRITICAL = 7, | 500 | EC_HOST_EVENT_BATTERY_CRITICAL = 7, |
| 251 | EC_HOST_EVENT_BATTERY = 8, | 501 | EC_HOST_EVENT_BATTERY = 8, |
| 252 | EC_HOST_EVENT_THERMAL_THRESHOLD = 9, | 502 | 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, | ||
| 254 | EC_HOST_EVENT_THERMAL = 11, | 505 | EC_HOST_EVENT_THERMAL = 11, |
| 255 | EC_HOST_EVENT_USB_CHARGER = 12, | 506 | EC_HOST_EVENT_USB_CHARGER = 12, |
| 256 | EC_HOST_EVENT_KEY_PRESSED = 13, | 507 | EC_HOST_EVENT_KEY_PRESSED = 13, |
| @@ -277,15 +528,34 @@ enum host_event_code { | |||
| 277 | EC_HOST_EVENT_HANG_DETECT = 20, | 528 | EC_HOST_EVENT_HANG_DETECT = 20, |
| 278 | /* Hang detect logic detected a hang and warm rebooted the AP */ | 529 | /* Hang detect logic detected a hang and warm rebooted the AP */ |
| 279 | EC_HOST_EVENT_HANG_REBOOT = 21, | 530 | EC_HOST_EVENT_HANG_REBOOT = 21, |
| 531 | |||
| 280 | /* PD MCU triggering host event */ | 532 | /* PD MCU triggering host event */ |
| 281 | EC_HOST_EVENT_PD_MCU = 22, | 533 | EC_HOST_EVENT_PD_MCU = 22, |
| 282 | 534 | ||
| 283 | /* EC desires to change state of host-controlled USB mux */ | 535 | /* Battery Status flags have changed */ |
| 284 | EC_HOST_EVENT_USB_MUX = 28, | 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, | ||
| 285 | 543 | ||
| 286 | /* EC RTC event occurred */ | 544 | /* EC RTC event occurred */ |
| 287 | EC_HOST_EVENT_RTC = 26, | 545 | EC_HOST_EVENT_RTC = 26, |
| 288 | 546 | ||
| 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 | |||
| 289 | /* | 559 | /* |
| 290 | * The high bit of the event mask is not used as a host event code. If | 560 | * The high bit of the event mask is not used as a host event code. If |
| 291 | * it reads back as set, then the entire event mask should be | 561 | * it reads back as set, then the entire event mask should be |
| @@ -296,7 +566,7 @@ enum host_event_code { | |||
| 296 | EC_HOST_EVENT_INVALID = 32 | 566 | EC_HOST_EVENT_INVALID = 32 |
| 297 | }; | 567 | }; |
| 298 | /* Host event mask */ | 568 | /* 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) |
| 300 | 570 | ||
| 301 | /** | 571 | /** |
| 302 | * struct ec_lpc_host_args - Arguments at EC_LPC_ADDR_HOST_ARGS | 572 | * struct ec_lpc_host_args - Arguments at EC_LPC_ADDR_HOST_ARGS |
| @@ -311,7 +581,7 @@ struct ec_lpc_host_args { | |||
| 311 | uint8_t command_version; | 581 | uint8_t command_version; |
| 312 | uint8_t data_size; | 582 | uint8_t data_size; |
| 313 | uint8_t checksum; | 583 | uint8_t checksum; |
| 314 | } __packed; | 584 | } __ec_align4; |
| 315 | 585 | ||
| 316 | /* Flags for ec_lpc_host_args.flags */ | 586 | /* Flags for ec_lpc_host_args.flags */ |
| 317 | /* | 587 | /* |
| @@ -321,7 +591,7 @@ struct ec_lpc_host_args { | |||
| 321 | * If EC gets a command and this flag is not set, this is an old-style command. | 591 | * If EC gets a command and this flag is not set, this is an old-style command. |
| 322 | * Command version is 0 and params from host are at EC_LPC_ADDR_OLD_PARAM with | 592 | * Command version is 0 and params from host are at EC_LPC_ADDR_OLD_PARAM with |
| 323 | * unknown length. EC must respond with an old-style response (that is, | 593 | * 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). |
| 325 | */ | 595 | */ |
| 326 | #define EC_HOST_ARGS_FLAG_FROM_HOST 0x01 | 596 | #define EC_HOST_ARGS_FLAG_FROM_HOST 0x01 |
| 327 | /* | 597 | /* |
| @@ -482,7 +752,7 @@ struct ec_host_request { | |||
| 482 | uint8_t command_version; | 752 | uint8_t command_version; |
| 483 | uint8_t reserved; | 753 | uint8_t reserved; |
| 484 | uint16_t data_len; | 754 | uint16_t data_len; |
| 485 | } __packed; | 755 | } __ec_align4; |
| 486 | 756 | ||
| 487 | #define EC_HOST_RESPONSE_VERSION 3 | 757 | #define EC_HOST_RESPONSE_VERSION 3 |
| 488 | 758 | ||
| @@ -501,18 +771,151 @@ struct ec_host_response { | |||
| 501 | uint16_t result; | 771 | uint16_t result; |
| 502 | uint16_t data_len; | 772 | uint16_t data_len; |
| 503 | uint16_t reserved; | 773 | 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 | ||
| 505 | 905 | ||
| 506 | /*****************************************************************************/ | 906 | /*****************************************************************************/ |
| 507 | /* | 907 | /* |
| 508 | * Notes on commands: | 908 | * Notes on commands: |
| 509 | * | 909 | * |
| 510 | * Each command is an 16-bit command value. Commands which take params or | 910 | * 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 |
| 512 | * specified, the command does not input or output data, respectively. | 912 | * specified, the command does not input or output data, respectively. |
| 513 | * Parameter/response length is implicit in the structs. Some underlying | 913 | * Parameter/response length is implicit in the structs. Some underlying |
| 514 | * communication protocols (I2C, SPI) may add length or checksum headers, but | 914 | * communication protocols (I2C, SPI) may add length or checksum headers, but |
| 515 | * those are implementation-dependent and not defined here. | 915 | * 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. | ||
| 516 | */ | 919 | */ |
| 517 | 920 | ||
| 518 | /*****************************************************************************/ | 921 | /*****************************************************************************/ |
| @@ -522,7 +925,7 @@ struct ec_host_response { | |||
| 522 | * Get protocol version, used to deal with non-backward compatible protocol | 925 | * Get protocol version, used to deal with non-backward compatible protocol |
| 523 | * changes. | 926 | * changes. |
| 524 | */ | 927 | */ |
| 525 | #define EC_CMD_PROTO_VERSION 0x00 | 928 | #define EC_CMD_PROTO_VERSION 0x0000 |
| 526 | 929 | ||
| 527 | /** | 930 | /** |
| 528 | * struct ec_response_proto_version - Response to the proto version command. | 931 | * struct ec_response_proto_version - Response to the proto version command. |
| @@ -530,13 +933,13 @@ struct ec_host_response { | |||
| 530 | */ | 933 | */ |
| 531 | struct ec_response_proto_version { | 934 | struct ec_response_proto_version { |
| 532 | uint32_t version; | 935 | uint32_t version; |
| 533 | } __packed; | 936 | } __ec_align4; |
| 534 | 937 | ||
| 535 | /* | 938 | /* |
| 536 | * Hello. This is a simple command to test the EC is responsive to | 939 | * Hello. This is a simple command to test the EC is responsive to |
| 537 | * commands. | 940 | * commands. |
| 538 | */ | 941 | */ |
| 539 | #define EC_CMD_HELLO 0x01 | 942 | #define EC_CMD_HELLO 0x0001 |
| 540 | 943 | ||
| 541 | /** | 944 | /** |
| 542 | * struct ec_params_hello - Parameters to the hello command. | 945 | * struct ec_params_hello - Parameters to the hello command. |
| @@ -544,7 +947,7 @@ struct ec_response_proto_version { | |||
| 544 | */ | 947 | */ |
| 545 | struct ec_params_hello { | 948 | struct ec_params_hello { |
| 546 | uint32_t in_data; | 949 | uint32_t in_data; |
| 547 | } __packed; | 950 | } __ec_align4; |
| 548 | 951 | ||
| 549 | /** | 952 | /** |
| 550 | * struct ec_response_hello - Response to the hello command. | 953 | * struct ec_response_hello - Response to the hello command. |
| @@ -552,10 +955,10 @@ struct ec_params_hello { | |||
| 552 | */ | 955 | */ |
| 553 | struct ec_response_hello { | 956 | struct ec_response_hello { |
| 554 | uint32_t out_data; | 957 | uint32_t out_data; |
| 555 | } __packed; | 958 | } __ec_align4; |
| 556 | 959 | ||
| 557 | /* Get version number */ | 960 | /* Get version number */ |
| 558 | #define EC_CMD_GET_VERSION 0x02 | 961 | #define EC_CMD_GET_VERSION 0x0002 |
| 559 | 962 | ||
| 560 | enum ec_current_image { | 963 | enum ec_current_image { |
| 561 | EC_IMAGE_UNKNOWN = 0, | 964 | EC_IMAGE_UNKNOWN = 0, |
| @@ -575,10 +978,10 @@ struct ec_response_get_version { | |||
| 575 | char version_string_rw[32]; | 978 | char version_string_rw[32]; |
| 576 | char reserved[32]; | 979 | char reserved[32]; |
| 577 | uint32_t current_image; | 980 | uint32_t current_image; |
| 578 | } __packed; | 981 | } __ec_align4; |
| 579 | 982 | ||
| 580 | /* Read test */ | 983 | /* Read test */ |
| 581 | #define EC_CMD_READ_TEST 0x03 | 984 | #define EC_CMD_READ_TEST 0x0003 |
| 582 | 985 | ||
| 583 | /** | 986 | /** |
| 584 | * struct ec_params_read_test - Parameters for the read test command. | 987 | * struct ec_params_read_test - Parameters for the read test command. |
| @@ -588,7 +991,7 @@ struct ec_response_get_version { | |||
| 588 | struct ec_params_read_test { | 991 | struct ec_params_read_test { |
| 589 | uint32_t offset; | 992 | uint32_t offset; |
| 590 | uint32_t size; | 993 | uint32_t size; |
| 591 | } __packed; | 994 | } __ec_align4; |
| 592 | 995 | ||
| 593 | /** | 996 | /** |
| 594 | * struct ec_response_read_test - Response to the read test command. | 997 | * struct ec_response_read_test - Response to the read test command. |
| @@ -596,17 +999,17 @@ struct ec_params_read_test { | |||
| 596 | */ | 999 | */ |
| 597 | struct ec_response_read_test { | 1000 | struct ec_response_read_test { |
| 598 | uint32_t data[32]; | 1001 | uint32_t data[32]; |
| 599 | } __packed; | 1002 | } __ec_align4; |
| 600 | 1003 | ||
| 601 | /* | 1004 | /* |
| 602 | * Get build information | 1005 | * Get build information |
| 603 | * | 1006 | * |
| 604 | * Response is null-terminated string. | 1007 | * Response is null-terminated string. |
| 605 | */ | 1008 | */ |
| 606 | #define EC_CMD_GET_BUILD_INFO 0x04 | 1009 | #define EC_CMD_GET_BUILD_INFO 0x0004 |
| 607 | 1010 | ||
| 608 | /* Get chip info */ | 1011 | /* Get chip info */ |
| 609 | #define EC_CMD_GET_CHIP_INFO 0x05 | 1012 | #define EC_CMD_GET_CHIP_INFO 0x0005 |
| 610 | 1013 | ||
| 611 | /** | 1014 | /** |
| 612 | * struct ec_response_get_chip_info - Response to the get chip info command. | 1015 | * struct ec_response_get_chip_info - Response to the get chip info command. |
| @@ -618,10 +1021,10 @@ struct ec_response_get_chip_info { | |||
| 618 | char vendor[32]; | 1021 | char vendor[32]; |
| 619 | char name[32]; | 1022 | char name[32]; |
| 620 | char revision[32]; | 1023 | char revision[32]; |
| 621 | } __packed; | 1024 | } __ec_align4; |
| 622 | 1025 | ||
| 623 | /* Get board HW version */ | 1026 | /* Get board HW version */ |
| 624 | #define EC_CMD_GET_BOARD_VERSION 0x06 | 1027 | #define EC_CMD_GET_BOARD_VERSION 0x0006 |
| 625 | 1028 | ||
| 626 | /** | 1029 | /** |
| 627 | * struct ec_response_board_version - Response to the board version command. | 1030 | * struct ec_response_board_version - Response to the board version command. |
| @@ -629,7 +1032,7 @@ struct ec_response_get_chip_info { | |||
| 629 | */ | 1032 | */ |
| 630 | struct ec_response_board_version { | 1033 | struct ec_response_board_version { |
| 631 | uint16_t board_version; | 1034 | uint16_t board_version; |
| 632 | } __packed; | 1035 | } __ec_align2; |
| 633 | 1036 | ||
| 634 | /* | 1037 | /* |
| 635 | * Read memory-mapped data. | 1038 | * Read memory-mapped data. |
| @@ -639,7 +1042,7 @@ struct ec_response_board_version { | |||
| 639 | * | 1042 | * |
| 640 | * Response is params.size bytes of data. | 1043 | * Response is params.size bytes of data. |
| 641 | */ | 1044 | */ |
| 642 | #define EC_CMD_READ_MEMMAP 0x07 | 1045 | #define EC_CMD_READ_MEMMAP 0x0007 |
| 643 | 1046 | ||
| 644 | /** | 1047 | /** |
| 645 | * struct ec_params_read_memmap - Parameters for the read memory map command. | 1048 | * struct ec_params_read_memmap - Parameters for the read memory map command. |
| @@ -649,10 +1052,10 @@ struct ec_response_board_version { | |||
| 649 | struct ec_params_read_memmap { | 1052 | struct ec_params_read_memmap { |
| 650 | uint8_t offset; | 1053 | uint8_t offset; |
| 651 | uint8_t size; | 1054 | uint8_t size; |
| 652 | } __packed; | 1055 | } __ec_align1; |
| 653 | 1056 | ||
| 654 | /* Read versions supported for a command */ | 1057 | /* Read versions supported for a command */ |
| 655 | #define EC_CMD_GET_CMD_VERSIONS 0x08 | 1058 | #define EC_CMD_GET_CMD_VERSIONS 0x0008 |
| 656 | 1059 | ||
| 657 | /** | 1060 | /** |
| 658 | * struct ec_params_get_cmd_versions - Parameters for the get command versions. | 1061 | * struct ec_params_get_cmd_versions - Parameters for the get command versions. |
| @@ -660,7 +1063,7 @@ struct ec_params_read_memmap { | |||
| 660 | */ | 1063 | */ |
| 661 | struct ec_params_get_cmd_versions { | 1064 | struct ec_params_get_cmd_versions { |
| 662 | uint8_t cmd; | 1065 | uint8_t cmd; |
| 663 | } __packed; | 1066 | } __ec_align1; |
| 664 | 1067 | ||
| 665 | /** | 1068 | /** |
| 666 | * struct ec_params_get_cmd_versions_v1 - Parameters for the get command | 1069 | * struct ec_params_get_cmd_versions_v1 - Parameters for the get command |
| @@ -669,7 +1072,7 @@ struct ec_params_get_cmd_versions { | |||
| 669 | */ | 1072 | */ |
| 670 | struct ec_params_get_cmd_versions_v1 { | 1073 | struct ec_params_get_cmd_versions_v1 { |
| 671 | uint16_t cmd; | 1074 | uint16_t cmd; |
| 672 | } __packed; | 1075 | } __ec_align2; |
| 673 | 1076 | ||
| 674 | /** | 1077 | /** |
| 675 | * struct ec_response_get_cmd_version - Response to the get command versions. | 1078 | * struct ec_response_get_cmd_version - Response to the get command versions. |
| @@ -678,20 +1081,20 @@ struct ec_params_get_cmd_versions_v1 { | |||
| 678 | */ | 1081 | */ |
| 679 | struct ec_response_get_cmd_versions { | 1082 | struct ec_response_get_cmd_versions { |
| 680 | uint32_t version_mask; | 1083 | uint32_t version_mask; |
| 681 | } __packed; | 1084 | } __ec_align4; |
| 682 | 1085 | ||
| 683 | /* | 1086 | /* |
| 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 |
| 685 | * on lpc since it has its own out-of-band busy indicator. | 1088 | * on lpc since it has its own out-of-band busy indicator. |
| 686 | * | 1089 | * |
| 687 | * lpc must read the status from the command register. Attempting this on | 1090 | * lpc must read the status from the command register. Attempting this on |
| 688 | * lpc will overwrite the args/parameter space and corrupt its data. | 1091 | * lpc will overwrite the args/parameter space and corrupt its data. |
| 689 | */ | 1092 | */ |
| 690 | #define EC_CMD_GET_COMMS_STATUS 0x09 | 1093 | #define EC_CMD_GET_COMMS_STATUS 0x0009 |
| 691 | 1094 | ||
| 692 | /* Avoid using ec_status which is for return values */ | 1095 | /* Avoid using ec_status which is for return values */ |
| 693 | enum ec_comms_status { | 1096 | enum ec_comms_status { |
| 694 | EC_COMMS_STATUS_PROCESSING = 1 << 0, /* Processing cmd */ | 1097 | EC_COMMS_STATUS_PROCESSING = BIT(0), /* Processing cmd */ |
| 695 | }; | 1098 | }; |
| 696 | 1099 | ||
| 697 | /** | 1100 | /** |
| @@ -701,29 +1104,29 @@ enum ec_comms_status { | |||
| 701 | */ | 1104 | */ |
| 702 | struct ec_response_get_comms_status { | 1105 | struct ec_response_get_comms_status { |
| 703 | uint32_t flags; /* Mask of enum ec_comms_status */ | 1106 | uint32_t flags; /* Mask of enum ec_comms_status */ |
| 704 | } __packed; | 1107 | } __ec_align4; |
| 705 | 1108 | ||
| 706 | /* Fake a variety of responses, purely for testing purposes. */ | 1109 | /* Fake a variety of responses, purely for testing purposes. */ |
| 707 | #define EC_CMD_TEST_PROTOCOL 0x0a | 1110 | #define EC_CMD_TEST_PROTOCOL 0x000A |
| 708 | 1111 | ||
| 709 | /* Tell the EC what to send back to us. */ | 1112 | /* Tell the EC what to send back to us. */ |
| 710 | struct ec_params_test_protocol { | 1113 | struct ec_params_test_protocol { |
| 711 | uint32_t ec_result; | 1114 | uint32_t ec_result; |
| 712 | uint32_t ret_len; | 1115 | uint32_t ret_len; |
| 713 | uint8_t buf[32]; | 1116 | uint8_t buf[32]; |
| 714 | } __packed; | 1117 | } __ec_align4; |
| 715 | 1118 | ||
| 716 | /* Here it comes... */ | 1119 | /* Here it comes... */ |
| 717 | struct ec_response_test_protocol { | 1120 | struct ec_response_test_protocol { |
| 718 | uint8_t buf[32]; | 1121 | uint8_t buf[32]; |
| 719 | } __packed; | 1122 | } __ec_align4; |
| 720 | 1123 | ||
| 721 | /* Get prococol information */ | 1124 | /* Get protocol information */ |
| 722 | #define EC_CMD_GET_PROTOCOL_INFO 0x0b | 1125 | #define EC_CMD_GET_PROTOCOL_INFO 0x000B |
| 723 | 1126 | ||
| 724 | /* Flags for ec_response_get_protocol_info.flags */ | 1127 | /* Flags for ec_response_get_protocol_info.flags */ |
| 725 | /* EC_RES_IN_PROGRESS may be returned if a command is slow */ | 1128 | /* 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) |
| 727 | 1130 | ||
| 728 | /** | 1131 | /** |
| 729 | * struct ec_response_get_protocol_info - Response to the get protocol info. | 1132 | * struct ec_response_get_protocol_info - Response to the get protocol info. |
| @@ -739,7 +1142,7 @@ struct ec_response_get_protocol_info { | |||
| 739 | uint16_t max_request_packet_size; | 1142 | uint16_t max_request_packet_size; |
| 740 | uint16_t max_response_packet_size; | 1143 | uint16_t max_response_packet_size; |
| 741 | uint32_t flags; | 1144 | uint32_t flags; |
| 742 | } __packed; | 1145 | } __ec_align4; |
| 743 | 1146 | ||
| 744 | 1147 | ||
| 745 | /*****************************************************************************/ | 1148 | /*****************************************************************************/ |
| @@ -757,19 +1160,19 @@ struct ec_response_get_protocol_info { | |||
| 757 | struct ec_params_get_set_value { | 1160 | struct ec_params_get_set_value { |
| 758 | uint32_t flags; | 1161 | uint32_t flags; |
| 759 | uint32_t value; | 1162 | uint32_t value; |
| 760 | } __packed; | 1163 | } __ec_align4; |
| 761 | 1164 | ||
| 762 | struct ec_response_get_set_value { | 1165 | struct ec_response_get_set_value { |
| 763 | uint32_t flags; | 1166 | uint32_t flags; |
| 764 | uint32_t value; | 1167 | uint32_t value; |
| 765 | } __packed; | 1168 | } __ec_align4; |
| 766 | 1169 | ||
| 767 | /* More than one command can use these structs to get/set paramters. */ | 1170 | /* More than one command can use these structs to get/set parameters. */ |
| 768 | #define EC_CMD_GSV_PAUSE_IN_S5 0x0c | 1171 | #define EC_CMD_GSV_PAUSE_IN_S5 0x000C |
| 769 | 1172 | ||
| 770 | /*****************************************************************************/ | 1173 | /*****************************************************************************/ |
| 771 | /* List the features supported by the firmware */ | 1174 | /* List the features supported by the firmware */ |
| 772 | #define EC_CMD_GET_FEATURES 0x0d | 1175 | #define EC_CMD_GET_FEATURES 0x000D |
| 773 | 1176 | ||
| 774 | /* Supported features */ | 1177 | /* Supported features */ |
| 775 | enum ec_feature_code { | 1178 | enum ec_feature_code { |
| @@ -876,24 +1279,36 @@ enum ec_feature_code { | |||
| 876 | EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37, | 1279 | EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37, |
| 877 | /* EC supports audio codec. */ | 1280 | /* EC supports audio codec. */ |
| 878 | EC_FEATURE_AUDIO_CODEC = 38, | 1281 | EC_FEATURE_AUDIO_CODEC = 38, |
| 879 | /* EC Supports SCP. */ | 1282 | /* The MCU is a System Companion Processor (SCP). */ |
| 880 | EC_FEATURE_SCP = 39, | 1283 | EC_FEATURE_SCP = 39, |
| 881 | /* The MCU is an Integrated Sensor Hub */ | 1284 | /* The MCU is an Integrated Sensor Hub */ |
| 882 | EC_FEATURE_ISH = 40, | 1285 | EC_FEATURE_ISH = 40, |
| 883 | }; | 1286 | }; |
| 884 | 1287 | ||
| 885 | #define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32)) | 1288 | #define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32) |
| 886 | #define EC_FEATURE_MASK_1(event_code) (1UL << (event_code - 32)) | 1289 | #define EC_FEATURE_MASK_1(event_code) BIT(event_code - 32) |
| 887 | 1290 | ||
| 888 | struct ec_response_get_features { | 1291 | struct ec_response_get_features { |
| 889 | uint32_t flags[2]; | 1292 | 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; | ||
| 891 | 1305 | ||
| 892 | /*****************************************************************************/ | 1306 | /*****************************************************************************/ |
| 893 | /* Flash commands */ | 1307 | /* Flash commands */ |
| 894 | 1308 | ||
| 895 | /* Get flash info */ | 1309 | /* Get flash info */ |
| 896 | #define EC_CMD_FLASH_INFO 0x10 | 1310 | #define EC_CMD_FLASH_INFO 0x0010 |
| 1311 | #define EC_VER_FLASH_INFO 2 | ||
| 897 | 1312 | ||
| 898 | /** | 1313 | /** |
| 899 | * struct ec_response_flash_info - Response to the flash info command. | 1314 | * struct ec_response_flash_info - Response to the flash info command. |
| @@ -912,11 +1327,22 @@ struct ec_response_flash_info { | |||
| 912 | uint32_t write_block_size; | 1327 | uint32_t write_block_size; |
| 913 | uint32_t erase_block_size; | 1328 | uint32_t erase_block_size; |
| 914 | uint32_t protect_block_size; | 1329 | uint32_t protect_block_size; |
| 915 | } __packed; | 1330 | } __ec_align4; |
| 916 | 1331 | ||
| 917 | /* Flags for version 1+ flash info command */ | 1332 | /* |
| 918 | /* EC flash erases bits to 0 instead of 1 */ | 1333 | * Flags for version 1+ flash info command |
| 919 | #define EC_FLASH_INFO_ERASE_TO_0 (1 << 0) | 1334 | * EC flash erases bits to 0 instead of 1. |
| 1335 | */ | ||
| 1336 | #define EC_FLASH_INFO_ERASE_TO_0 BIT(0) | ||
| 1337 | |||
| 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) | ||
| 920 | 1346 | ||
| 921 | /** | 1347 | /** |
| 922 | * struct ec_response_flash_info_1 - Response to the flash info v1 command. | 1348 | * struct ec_response_flash_info_1 - Response to the flash info v1 command. |
| @@ -938,7 +1364,14 @@ struct ec_response_flash_info { | |||
| 938 | * fields following. | 1364 | * fields following. |
| 939 | * | 1365 | * |
| 940 | * gcc anonymous structs don't seem to get along with the __packed directive; | 1366 | * 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. | ||
| 942 | */ | 1375 | */ |
| 943 | struct ec_response_flash_info_1 { | 1376 | struct ec_response_flash_info_1 { |
| 944 | /* Version 0 fields; see above for description */ | 1377 | /* Version 0 fields; see above for description */ |
| @@ -950,14 +1383,50 @@ struct ec_response_flash_info_1 { | |||
| 950 | /* Version 1 adds these fields: */ | 1383 | /* Version 1 adds these fields: */ |
| 951 | uint32_t write_ideal_size; | 1384 | uint32_t write_ideal_size; |
| 952 | uint32_t flags; | 1385 | 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; | ||
| 954 | 1423 | ||
| 955 | /* | 1424 | /* |
| 956 | * Read flash | 1425 | * Read flash |
| 957 | * | 1426 | * |
| 958 | * Response is params.size bytes of data. | 1427 | * Response is params.size bytes of data. |
| 959 | */ | 1428 | */ |
| 960 | #define EC_CMD_FLASH_READ 0x11 | 1429 | #define EC_CMD_FLASH_READ 0x0011 |
| 961 | 1430 | ||
| 962 | /** | 1431 | /** |
| 963 | * struct ec_params_flash_read - Parameters for the flash read command. | 1432 | * struct ec_params_flash_read - Parameters for the flash read command. |
| @@ -967,10 +1436,10 @@ struct ec_response_flash_info_1 { | |||
| 967 | struct ec_params_flash_read { | 1436 | struct ec_params_flash_read { |
| 968 | uint32_t offset; | 1437 | uint32_t offset; |
| 969 | uint32_t size; | 1438 | uint32_t size; |
| 970 | } __packed; | 1439 | } __ec_align4; |
| 971 | 1440 | ||
| 972 | /* Write flash */ | 1441 | /* Write flash */ |
| 973 | #define EC_CMD_FLASH_WRITE 0x12 | 1442 | #define EC_CMD_FLASH_WRITE 0x0012 |
| 974 | #define EC_VER_FLASH_WRITE 1 | 1443 | #define EC_VER_FLASH_WRITE 1 |
| 975 | 1444 | ||
| 976 | /* Version 0 of the flash command supported only 64 bytes of data */ | 1445 | /* Version 0 of the flash command supported only 64 bytes of data */ |
| @@ -985,20 +1454,57 @@ struct ec_params_flash_write { | |||
| 985 | uint32_t offset; | 1454 | uint32_t offset; |
| 986 | uint32_t size; | 1455 | uint32_t size; |
| 987 | /* Followed by data to write */ | 1456 | /* Followed by data to write */ |
| 988 | } __packed; | 1457 | } __ec_align4; |
| 989 | 1458 | ||
| 990 | /* Erase flash */ | 1459 | /* Erase flash */ |
| 991 | #define EC_CMD_FLASH_ERASE 0x13 | 1460 | #define EC_CMD_FLASH_ERASE 0x0013 |
| 992 | 1461 | ||
| 993 | /** | 1462 | /** |
| 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. |
| 995 | * @offset: Byte offset to erase. | 1464 | * @offset: Byte offset to erase. |
| 996 | * @size: Size to erase in bytes. | 1465 | * @size: Size to erase in bytes. |
| 997 | */ | 1466 | */ |
| 998 | struct ec_params_flash_erase { | 1467 | struct ec_params_flash_erase { |
| 999 | uint32_t offset; | 1468 | uint32_t offset; |
| 1000 | uint32_t size; | 1469 | 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; | ||
| 1002 | 1508 | ||
| 1003 | /* | 1509 | /* |
| 1004 | * Get/set flash protection. | 1510 | * Get/set flash protection. |
| @@ -1010,31 +1516,40 @@ struct ec_params_flash_erase { | |||
| 1010 | * | 1516 | * |
| 1011 | * If mask=0, simply returns the current flags state. | 1517 | * If mask=0, simply returns the current flags state. |
| 1012 | */ | 1518 | */ |
| 1013 | #define EC_CMD_FLASH_PROTECT 0x15 | 1519 | #define EC_CMD_FLASH_PROTECT 0x0015 |
| 1014 | #define EC_VER_FLASH_PROTECT 1 /* Command version 1 */ | 1520 | #define EC_VER_FLASH_PROTECT 1 /* Command version 1 */ |
| 1015 | 1521 | ||
| 1016 | /* Flags for flash protection */ | 1522 | /* Flags for flash protection */ |
| 1017 | /* RO flash code protected when the EC boots */ | 1523 | /* 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) |
| 1019 | /* | 1525 | /* |
| 1020 | * RO flash code protected now. If this bit is set, at-boot status cannot | 1526 | * RO flash code protected now. If this bit is set, at-boot status cannot |
| 1021 | * be changed. | 1527 | * be changed. |
| 1022 | */ | 1528 | */ |
| 1023 | #define EC_FLASH_PROTECT_RO_NOW (1 << 1) | 1529 | #define EC_FLASH_PROTECT_RO_NOW BIT(1) |
| 1024 | /* Entire flash code protected now, until reboot. */ | 1530 | /* 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) |
| 1026 | /* Flash write protect GPIO is asserted now */ | 1532 | /* 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) |
| 1028 | /* Error - at least one bank of flash is stuck locked, and cannot be unlocked */ | 1534 | /* 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) |
| 1030 | /* | 1536 | /* |
| 1031 | * Error - flash protection is in inconsistent state. At least one bank of | 1537 | * Error - flash protection is in inconsistent state. At least one bank of |
| 1032 | * flash which should be protected is not protected. Usually fixed by | 1538 | * flash which should be protected is not protected. Usually fixed by |
| 1033 | * re-requesting the desired flags, or by a hard reset if that fails. | 1539 | * re-requesting the desired flags, or by a hard reset if that fails. |
| 1034 | */ | 1540 | */ |
| 1035 | #define EC_FLASH_PROTECT_ERROR_INCONSISTENT (1 << 5) | 1541 | #define EC_FLASH_PROTECT_ERROR_INCONSISTENT BIT(5) |
| 1036 | /* Entile flash code protected when the EC boots */ | 1542 | /* Entire flash code protected when the EC boots */ |
| 1037 | #define EC_FLASH_PROTECT_ALL_AT_BOOT (1 << 6) | 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 | |||
| 1038 | 1553 | ||
| 1039 | /** | 1554 | /** |
| 1040 | * struct ec_params_flash_protect - Parameters for the flash protect command. | 1555 | * struct ec_params_flash_protect - Parameters for the flash protect command. |
| @@ -1044,7 +1559,7 @@ struct ec_params_flash_erase { | |||
| 1044 | struct ec_params_flash_protect { | 1559 | struct ec_params_flash_protect { |
| 1045 | uint32_t mask; | 1560 | uint32_t mask; |
| 1046 | uint32_t flags; | 1561 | uint32_t flags; |
| 1047 | } __packed; | 1562 | } __ec_align4; |
| 1048 | 1563 | ||
| 1049 | /** | 1564 | /** |
| 1050 | * struct ec_response_flash_protect - Response to the flash protect command. | 1565 | * struct ec_response_flash_protect - Response to the flash protect command. |
| @@ -1059,7 +1574,7 @@ struct ec_response_flash_protect { | |||
| 1059 | uint32_t flags; | 1574 | uint32_t flags; |
| 1060 | uint32_t valid_flags; | 1575 | uint32_t valid_flags; |
| 1061 | uint32_t writable_flags; | 1576 | uint32_t writable_flags; |
| 1062 | } __packed; | 1577 | } __ec_align4; |
| 1063 | 1578 | ||
| 1064 | /* | 1579 | /* |
| 1065 | * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash | 1580 | * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash |
| @@ -1067,22 +1582,37 @@ struct ec_response_flash_protect { | |||
| 1067 | */ | 1582 | */ |
| 1068 | 1583 | ||
| 1069 | /* Get the region offset/size */ | 1584 | /* Get the region offset/size */ |
| 1070 | #define EC_CMD_FLASH_REGION_INFO 0x16 | 1585 | #define EC_CMD_FLASH_REGION_INFO 0x0016 |
| 1071 | #define EC_VER_FLASH_REGION_INFO 1 | 1586 | #define EC_VER_FLASH_REGION_INFO 1 |
| 1072 | 1587 | ||
| 1073 | enum ec_flash_region { | 1588 | enum ec_flash_region { |
| 1074 | /* Region which holds read-only EC image */ | 1589 | /* Region which holds read-only EC image */ |
| 1075 | EC_FLASH_REGION_RO = 0, | 1590 | EC_FLASH_REGION_RO = 0, |
| 1076 | /* Region which holds rewritable EC image */ | 1591 | /* |
| 1077 | EC_FLASH_REGION_RW, | 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, | ||
| 1078 | /* | 1601 | /* |
| 1079 | * Region which should be write-protected in the factory (a superset of | 1602 | * Region which should be write-protected in the factory (a superset of |
| 1080 | * EC_FLASH_REGION_RO) | 1603 | * EC_FLASH_REGION_RO) |
| 1081 | */ | 1604 | */ |
| 1082 | EC_FLASH_REGION_WP_RO, | 1605 | EC_FLASH_REGION_WP_RO, |
| 1606 | /* Region which holds updatable (non-active) RW image */ | ||
| 1607 | EC_FLASH_REGION_UPDATE, | ||
| 1083 | /* Number of regions */ | 1608 | /* Number of regions */ |
| 1084 | EC_FLASH_REGION_COUNT, | 1609 | EC_FLASH_REGION_COUNT, |
| 1085 | }; | 1610 | }; |
| 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 | ||
| 1086 | 1616 | ||
| 1087 | /** | 1617 | /** |
| 1088 | * struct ec_params_flash_region_info - Parameters for the flash region info | 1618 | * struct ec_params_flash_region_info - Parameters for the flash region info |
| @@ -1091,15 +1621,15 @@ enum ec_flash_region { | |||
| 1091 | */ | 1621 | */ |
| 1092 | struct ec_params_flash_region_info { | 1622 | struct ec_params_flash_region_info { |
| 1093 | uint32_t region; | 1623 | uint32_t region; |
| 1094 | } __packed; | 1624 | } __ec_align4; |
| 1095 | 1625 | ||
| 1096 | struct ec_response_flash_region_info { | 1626 | struct ec_response_flash_region_info { |
| 1097 | uint32_t offset; | 1627 | uint32_t offset; |
| 1098 | uint32_t size; | 1628 | uint32_t size; |
| 1099 | } __packed; | 1629 | } __ec_align4; |
| 1100 | 1630 | ||
| 1101 | /* Read/write VbNvContext */ | 1631 | /* Read/write VbNvContext */ |
| 1102 | #define EC_CMD_VBNV_CONTEXT 0x17 | 1632 | #define EC_CMD_VBNV_CONTEXT 0x0017 |
| 1103 | #define EC_VER_VBNV_CONTEXT 1 | 1633 | #define EC_VER_VBNV_CONTEXT 1 |
| 1104 | #define EC_VBNV_BLOCK_SIZE 16 | 1634 | #define EC_VBNV_BLOCK_SIZE 16 |
| 1105 | 1635 | ||
| @@ -1111,52 +1641,99 @@ enum ec_vbnvcontext_op { | |||
| 1111 | struct ec_params_vbnvcontext { | 1641 | struct ec_params_vbnvcontext { |
| 1112 | uint32_t op; | 1642 | uint32_t op; |
| 1113 | uint8_t block[EC_VBNV_BLOCK_SIZE]; | 1643 | uint8_t block[EC_VBNV_BLOCK_SIZE]; |
| 1114 | } __packed; | 1644 | } __ec_align4; |
| 1115 | 1645 | ||
| 1116 | struct ec_response_vbnvcontext { | 1646 | struct ec_response_vbnvcontext { |
| 1117 | uint8_t block[EC_VBNV_BLOCK_SIZE]; | 1647 | 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 | |||
| 1119 | 1680 | ||
| 1120 | /*****************************************************************************/ | 1681 | /*****************************************************************************/ |
| 1121 | /* PWM commands */ | 1682 | /* PWM commands */ |
| 1122 | 1683 | ||
| 1123 | /* Get fan target RPM */ | 1684 | /* Get fan target RPM */ |
| 1124 | #define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x20 | 1685 | #define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x0020 |
| 1125 | 1686 | ||
| 1126 | struct ec_response_pwm_get_fan_rpm { | 1687 | struct ec_response_pwm_get_fan_rpm { |
| 1127 | uint32_t rpm; | 1688 | uint32_t rpm; |
| 1128 | } __packed; | 1689 | } __ec_align4; |
| 1129 | 1690 | ||
| 1130 | /* Set target fan RPM */ | 1691 | /* 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; | ||
| 1132 | 1698 | ||
| 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 { | ||
| 1134 | uint32_t rpm; | 1701 | uint32_t rpm; |
| 1135 | } __packed; | 1702 | uint8_t fan_idx; |
| 1703 | } __ec_align_size1; | ||
| 1136 | 1704 | ||
| 1137 | /* Get keyboard backlight */ | 1705 | /* 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 | ||
| 1139 | 1708 | ||
| 1140 | struct ec_response_pwm_get_keyboard_backlight { | 1709 | struct ec_response_pwm_get_keyboard_backlight { |
| 1141 | uint8_t percent; | 1710 | uint8_t percent; |
| 1142 | uint8_t enabled; | 1711 | uint8_t enabled; |
| 1143 | } __packed; | 1712 | } __ec_align1; |
| 1144 | 1713 | ||
| 1145 | /* Set keyboard backlight */ | 1714 | /* 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 | ||
| 1147 | 1717 | ||
| 1148 | struct ec_params_pwm_set_keyboard_backlight { | 1718 | struct ec_params_pwm_set_keyboard_backlight { |
| 1149 | uint8_t percent; | 1719 | uint8_t percent; |
| 1150 | } __packed; | 1720 | } __ec_align1; |
| 1151 | 1721 | ||
| 1152 | /* Set target fan PWM duty cycle */ | 1722 | /* 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; | ||
| 1154 | 1729 | ||
| 1155 | struct ec_params_pwm_set_fan_duty { | 1730 | /* Version 1 of input params */ |
| 1731 | struct ec_params_pwm_set_fan_duty_v1 { | ||
| 1156 | uint32_t percent; | 1732 | uint32_t percent; |
| 1157 | } __packed; | 1733 | uint8_t fan_idx; |
| 1734 | } __ec_align_size1; | ||
| 1158 | 1735 | ||
| 1159 | #define EC_CMD_PWM_SET_DUTY 0x25 | 1736 | #define EC_CMD_PWM_SET_DUTY 0x0025 |
| 1160 | /* 16 bit duty cycle, 0xffff = 100% */ | 1737 | /* 16 bit duty cycle, 0xffff = 100% */ |
| 1161 | #define EC_PWM_MAX_DUTY 0xffff | 1738 | #define EC_PWM_MAX_DUTY 0xffff |
| 1162 | 1739 | ||
| @@ -1174,18 +1751,18 @@ struct ec_params_pwm_set_duty { | |||
| 1174 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ | 1751 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ |
| 1175 | uint8_t pwm_type; /* ec_pwm_type */ | 1752 | uint8_t pwm_type; /* ec_pwm_type */ |
| 1176 | uint8_t index; /* Type-specific index, or 0 if unique */ | 1753 | uint8_t index; /* Type-specific index, or 0 if unique */ |
| 1177 | } __packed; | 1754 | } __ec_align4; |
| 1178 | 1755 | ||
| 1179 | #define EC_CMD_PWM_GET_DUTY 0x26 | 1756 | #define EC_CMD_PWM_GET_DUTY 0x0026 |
| 1180 | 1757 | ||
| 1181 | struct ec_params_pwm_get_duty { | 1758 | struct ec_params_pwm_get_duty { |
| 1182 | uint8_t pwm_type; /* ec_pwm_type */ | 1759 | uint8_t pwm_type; /* ec_pwm_type */ |
| 1183 | uint8_t index; /* Type-specific index, or 0 if unique */ | 1760 | uint8_t index; /* Type-specific index, or 0 if unique */ |
| 1184 | } __packed; | 1761 | } __ec_align1; |
| 1185 | 1762 | ||
| 1186 | struct ec_response_pwm_get_duty { | 1763 | struct ec_response_pwm_get_duty { |
| 1187 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ | 1764 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ |
| 1188 | } __packed; | 1765 | } __ec_align2; |
| 1189 | 1766 | ||
| 1190 | /*****************************************************************************/ | 1767 | /*****************************************************************************/ |
| 1191 | /* | 1768 | /* |
| @@ -1194,11 +1771,11 @@ struct ec_response_pwm_get_duty { | |||
| 1194 | * into a subcommand. We'll make separate structs for subcommands with | 1771 | * into a subcommand. We'll make separate structs for subcommands with |
| 1195 | * different input args, so that we know how much to expect. | 1772 | * different input args, so that we know how much to expect. |
| 1196 | */ | 1773 | */ |
| 1197 | #define EC_CMD_LIGHTBAR_CMD 0x28 | 1774 | #define EC_CMD_LIGHTBAR_CMD 0x0028 |
| 1198 | 1775 | ||
| 1199 | struct rgb_s { | 1776 | struct rgb_s { |
| 1200 | uint8_t r, g, b; | 1777 | uint8_t r, g, b; |
| 1201 | }; | 1778 | } __ec_todo_unpacked; |
| 1202 | 1779 | ||
| 1203 | #define LB_BATTERY_LEVELS 4 | 1780 | #define LB_BATTERY_LEVELS 4 |
| 1204 | 1781 | ||
| @@ -1238,7 +1815,7 @@ struct lightbar_params_v0 { | |||
| 1238 | 1815 | ||
| 1239 | /* Color palette */ | 1816 | /* Color palette */ |
| 1240 | struct rgb_s color[8]; /* 0-3 are Google colors */ | 1817 | struct rgb_s color[8]; /* 0-3 are Google colors */ |
| 1241 | } __packed; | 1818 | } __ec_todo_packed; |
| 1242 | 1819 | ||
| 1243 | struct lightbar_params_v1 { | 1820 | struct lightbar_params_v1 { |
| 1244 | /* Timing */ | 1821 | /* Timing */ |
| @@ -1251,7 +1828,10 @@ struct lightbar_params_v1 { | |||
| 1251 | int32_t s3_sleep_for; | 1828 | int32_t s3_sleep_for; |
| 1252 | int32_t s3_ramp_up; | 1829 | int32_t s3_ramp_up; |
| 1253 | int32_t s3_ramp_down; | 1830 | int32_t s3_ramp_down; |
| 1831 | int32_t s5_ramp_up; | ||
| 1832 | int32_t s5_ramp_down; | ||
| 1254 | int32_t tap_tick_delay; | 1833 | int32_t tap_tick_delay; |
| 1834 | int32_t tap_gate_delay; | ||
| 1255 | int32_t tap_display_time; | 1835 | int32_t tap_display_time; |
| 1256 | 1836 | ||
| 1257 | /* Tap-for-battery params */ | 1837 | /* Tap-for-battery params */ |
| @@ -1279,84 +1859,182 @@ struct lightbar_params_v1 { | |||
| 1279 | uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */ | 1859 | uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */ |
| 1280 | uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */ | 1860 | uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */ |
| 1281 | 1861 | ||
| 1862 | /* s5: single color pulse on inhibited power-up */ | ||
| 1863 | uint8_t s5_idx; | ||
| 1864 | |||
| 1282 | /* Color palette */ | 1865 | /* Color palette */ |
| 1283 | struct rgb_s color[8]; /* 0-3 are Google colors */ | 1866 | struct rgb_s color[8]; /* 0-3 are Google colors */ |
| 1284 | } __packed; | 1867 | } __ec_todo_packed; |
| 1868 | |||
| 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; | ||
| 1285 | 1924 | ||
| 1286 | /* Lightbar program */ | 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. */ | ||
| 1287 | #define EC_LB_PROG_LEN 192 | 1938 | #define EC_LB_PROG_LEN 192 |
| 1288 | struct lightbar_program { | 1939 | struct lightbar_program { |
| 1289 | uint8_t size; | 1940 | uint8_t size; |
| 1290 | uint8_t data[EC_LB_PROG_LEN]; | 1941 | uint8_t data[EC_LB_PROG_LEN]; |
| 1291 | }; | 1942 | } __ec_todo_unpacked; |
| 1292 | 1943 | ||
| 1293 | struct ec_params_lightbar { | 1944 | struct ec_params_lightbar { |
| 1294 | uint8_t cmd; /* Command (see enum lightbar_command) */ | 1945 | uint8_t cmd; /* Command (see enum lightbar_command) */ |
| 1295 | union { | 1946 | union { |
| 1296 | struct { | 1947 | /* |
| 1297 | /* no args */ | 1948 | * The following commands have no args: |
| 1298 | } dump, off, on, init, get_seq, get_params_v0, get_params_v1, | 1949 | * |
| 1299 | version, get_brightness, get_demo, suspend, resume; | 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 | */ | ||
| 1300 | 1958 | ||
| 1301 | struct { | 1959 | struct __ec_todo_unpacked { |
| 1302 | uint8_t num; | 1960 | uint8_t num; |
| 1303 | } set_brightness, seq, demo; | 1961 | } set_brightness, seq, demo; |
| 1304 | 1962 | ||
| 1305 | struct { | 1963 | struct __ec_todo_unpacked { |
| 1306 | uint8_t ctrl, reg, value; | 1964 | uint8_t ctrl, reg, value; |
| 1307 | } reg; | 1965 | } reg; |
| 1308 | 1966 | ||
| 1309 | struct { | 1967 | struct __ec_todo_unpacked { |
| 1310 | uint8_t led, red, green, blue; | 1968 | uint8_t led, red, green, blue; |
| 1311 | } set_rgb; | 1969 | } set_rgb; |
| 1312 | 1970 | ||
| 1313 | struct { | 1971 | struct __ec_todo_unpacked { |
| 1314 | uint8_t led; | 1972 | uint8_t led; |
| 1315 | } get_rgb; | 1973 | } get_rgb; |
| 1316 | 1974 | ||
| 1317 | struct { | 1975 | struct __ec_todo_unpacked { |
| 1318 | uint8_t enable; | 1976 | uint8_t enable; |
| 1319 | } manual_suspend_ctrl; | 1977 | } manual_suspend_ctrl; |
| 1320 | 1978 | ||
| 1321 | struct lightbar_params_v0 set_params_v0; | 1979 | struct lightbar_params_v0 set_params_v0; |
| 1322 | struct lightbar_params_v1 set_params_v1; | 1980 | 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 | |||
| 1323 | struct lightbar_program set_program; | 1989 | struct lightbar_program set_program; |
| 1324 | }; | 1990 | }; |
| 1325 | } __packed; | 1991 | } __ec_todo_packed; |
| 1326 | 1992 | ||
| 1327 | struct ec_response_lightbar { | 1993 | struct ec_response_lightbar { |
| 1328 | union { | 1994 | union { |
| 1329 | struct { | 1995 | struct __ec_todo_unpacked { |
| 1330 | struct { | 1996 | struct __ec_todo_unpacked { |
| 1331 | uint8_t reg; | 1997 | uint8_t reg; |
| 1332 | uint8_t ic0; | 1998 | uint8_t ic0; |
| 1333 | uint8_t ic1; | 1999 | uint8_t ic1; |
| 1334 | } vals[23]; | 2000 | } vals[23]; |
| 1335 | } dump; | 2001 | } dump; |
| 1336 | 2002 | ||
| 1337 | struct { | 2003 | struct __ec_todo_unpacked { |
| 1338 | uint8_t num; | 2004 | uint8_t num; |
| 1339 | } get_seq, get_brightness, get_demo; | 2005 | } get_seq, get_brightness, get_demo; |
| 1340 | 2006 | ||
| 1341 | struct lightbar_params_v0 get_params_v0; | 2007 | struct lightbar_params_v0 get_params_v0; |
| 1342 | struct lightbar_params_v1 get_params_v1; | 2008 | struct lightbar_params_v1 get_params_v1; |
| 1343 | 2009 | ||
| 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 { | ||
| 1345 | uint32_t num; | 2019 | uint32_t num; |
| 1346 | uint32_t flags; | 2020 | uint32_t flags; |
| 1347 | } version; | 2021 | } version; |
| 1348 | 2022 | ||
| 1349 | struct { | 2023 | struct __ec_todo_unpacked { |
| 1350 | uint8_t red, green, blue; | 2024 | uint8_t red, green, blue; |
| 1351 | } get_rgb; | 2025 | } get_rgb; |
| 1352 | 2026 | ||
| 1353 | struct { | 2027 | /* |
| 1354 | /* no return params */ | 2028 | * The following commands have no response: |
| 1355 | } off, on, init, set_brightness, seq, reg, set_rgb, | 2029 | * |
| 1356 | demo, set_params_v0, set_params_v1, | 2030 | * off, on, init, set_brightness, seq, reg, set_rgb, demo, |
| 1357 | set_program, manual_suspend_ctrl, suspend, resume; | 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 | */ | ||
| 1358 | }; | 2036 | }; |
| 1359 | } __packed; | 2037 | } __ec_todo_packed; |
| 1360 | 2038 | ||
| 1361 | /* Lightbar commands */ | 2039 | /* Lightbar commands */ |
| 1362 | enum lightbar_command { | 2040 | enum lightbar_command { |
| @@ -1382,13 +2060,25 @@ enum lightbar_command { | |||
| 1382 | LIGHTBAR_CMD_MANUAL_SUSPEND_CTRL = 19, | 2060 | LIGHTBAR_CMD_MANUAL_SUSPEND_CTRL = 19, |
| 1383 | LIGHTBAR_CMD_SUSPEND = 20, | 2061 | LIGHTBAR_CMD_SUSPEND = 20, |
| 1384 | LIGHTBAR_CMD_RESUME = 21, | 2062 | 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, | ||
| 1385 | LIGHTBAR_NUM_CMDS | 2075 | LIGHTBAR_NUM_CMDS |
| 1386 | }; | 2076 | }; |
| 1387 | 2077 | ||
| 1388 | /*****************************************************************************/ | 2078 | /*****************************************************************************/ |
| 1389 | /* LED control commands */ | 2079 | /* LED control commands */ |
| 1390 | 2080 | ||
| 1391 | #define EC_CMD_LED_CONTROL 0x29 | 2081 | #define EC_CMD_LED_CONTROL 0x0029 |
| 1392 | 2082 | ||
| 1393 | enum ec_led_id { | 2083 | enum ec_led_id { |
| 1394 | /* LED to indicate battery state of charge */ | 2084 | /* LED to indicate battery state of charge */ |
| @@ -1400,13 +2090,21 @@ enum ec_led_id { | |||
| 1400 | EC_LED_ID_POWER_LED, | 2090 | EC_LED_ID_POWER_LED, |
| 1401 | /* LED on power adapter or its plug */ | 2091 | /* LED on power adapter or its plug */ |
| 1402 | EC_LED_ID_ADAPTER_LED, | 2092 | 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, | ||
| 1403 | 2101 | ||
| 1404 | EC_LED_ID_COUNT | 2102 | EC_LED_ID_COUNT |
| 1405 | }; | 2103 | }; |
| 1406 | 2104 | ||
| 1407 | /* LED control flags */ | 2105 | /* LED control flags */ |
| 1408 | #define EC_LED_FLAGS_QUERY (1 << 0) /* Query LED capability only */ | 2106 | #define EC_LED_FLAGS_QUERY BIT(0) /* Query LED capability only */ |
| 1409 | #define EC_LED_FLAGS_AUTO (1 << 1) /* Switch LED back to automatic control */ | 2107 | #define EC_LED_FLAGS_AUTO BIT(1) /* Switch LED back to automatic control */ |
| 1410 | 2108 | ||
| 1411 | enum ec_led_colors { | 2109 | enum ec_led_colors { |
| 1412 | EC_LED_COLOR_RED = 0, | 2110 | EC_LED_COLOR_RED = 0, |
| @@ -1414,6 +2112,7 @@ enum ec_led_colors { | |||
| 1414 | EC_LED_COLOR_BLUE, | 2112 | EC_LED_COLOR_BLUE, |
| 1415 | EC_LED_COLOR_YELLOW, | 2113 | EC_LED_COLOR_YELLOW, |
| 1416 | EC_LED_COLOR_WHITE, | 2114 | EC_LED_COLOR_WHITE, |
| 2115 | EC_LED_COLOR_AMBER, | ||
| 1417 | 2116 | ||
| 1418 | EC_LED_COLOR_COUNT | 2117 | EC_LED_COLOR_COUNT |
| 1419 | }; | 2118 | }; |
| @@ -1423,7 +2122,7 @@ struct ec_params_led_control { | |||
| 1423 | uint8_t flags; /* Control flags */ | 2122 | uint8_t flags; /* Control flags */ |
| 1424 | 2123 | ||
| 1425 | uint8_t brightness[EC_LED_COLOR_COUNT]; | 2124 | uint8_t brightness[EC_LED_COLOR_COUNT]; |
| 1426 | } __packed; | 2125 | } __ec_align1; |
| 1427 | 2126 | ||
| 1428 | struct ec_response_led_control { | 2127 | struct ec_response_led_control { |
| 1429 | /* | 2128 | /* |
| @@ -1434,7 +2133,7 @@ struct ec_response_led_control { | |||
| 1434 | * Other values means the LED is control by PWM. | 2133 | * Other values means the LED is control by PWM. |
| 1435 | */ | 2134 | */ |
| 1436 | uint8_t brightness_range[EC_LED_COLOR_COUNT]; | 2135 | uint8_t brightness_range[EC_LED_COLOR_COUNT]; |
| 1437 | } __packed; | 2136 | } __ec_align1; |
| 1438 | 2137 | ||
| 1439 | /*****************************************************************************/ | 2138 | /*****************************************************************************/ |
| 1440 | /* Verified boot commands */ | 2139 | /* Verified boot commands */ |
| @@ -1445,7 +2144,7 @@ struct ec_response_led_control { | |||
| 1445 | */ | 2144 | */ |
| 1446 | 2145 | ||
| 1447 | /* Verified boot hash command */ | 2146 | /* Verified boot hash command */ |
| 1448 | #define EC_CMD_VBOOT_HASH 0x2A | 2147 | #define EC_CMD_VBOOT_HASH 0x002A |
| 1449 | 2148 | ||
| 1450 | struct ec_params_vboot_hash { | 2149 | struct ec_params_vboot_hash { |
| 1451 | uint8_t cmd; /* enum ec_vboot_hash_cmd */ | 2150 | uint8_t cmd; /* enum ec_vboot_hash_cmd */ |
| @@ -1455,7 +2154,7 @@ struct ec_params_vboot_hash { | |||
| 1455 | uint32_t offset; /* Offset in flash to hash */ | 2154 | uint32_t offset; /* Offset in flash to hash */ |
| 1456 | uint32_t size; /* Number of bytes to hash */ | 2155 | uint32_t size; /* Number of bytes to hash */ |
| 1457 | uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */ | 2156 | uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */ |
| 1458 | } __packed; | 2157 | } __ec_align4; |
| 1459 | 2158 | ||
| 1460 | struct ec_response_vboot_hash { | 2159 | struct ec_response_vboot_hash { |
| 1461 | uint8_t status; /* enum ec_vboot_hash_status */ | 2160 | uint8_t status; /* enum ec_vboot_hash_status */ |
| @@ -1465,7 +2164,7 @@ struct ec_response_vboot_hash { | |||
| 1465 | uint32_t offset; /* Offset in flash which was hashed */ | 2164 | uint32_t offset; /* Offset in flash which was hashed */ |
| 1466 | uint32_t size; /* Number of bytes hashed */ | 2165 | uint32_t size; /* Number of bytes hashed */ |
| 1467 | uint8_t hash_digest[64]; /* Hash digest data */ | 2166 | uint8_t hash_digest[64]; /* Hash digest data */ |
| 1468 | } __packed; | 2167 | } __ec_align4; |
| 1469 | 2168 | ||
| 1470 | enum ec_vboot_hash_cmd { | 2169 | enum ec_vboot_hash_cmd { |
| 1471 | EC_VBOOT_HASH_GET = 0, /* Get current hash status */ | 2170 | EC_VBOOT_HASH_GET = 0, /* Get current hash status */ |
| @@ -1489,15 +2188,22 @@ enum ec_vboot_hash_status { | |||
| 1489 | * If one of these is specified, the EC will automatically update offset and | 2188 | * If one of these is specified, the EC will automatically update offset and |
| 1490 | * size to the correct values for the specified image (RO or RW). | 2189 | * size to the correct values for the specified image (RO or RW). |
| 1491 | */ | 2190 | */ |
| 1492 | #define EC_VBOOT_HASH_OFFSET_RO 0xfffffffe | 2191 | #define EC_VBOOT_HASH_OFFSET_RO 0xfffffffe |
| 1493 | #define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd | 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 | ||
| 1494 | 2200 | ||
| 1495 | /*****************************************************************************/ | 2201 | /*****************************************************************************/ |
| 1496 | /* | 2202 | /* |
| 1497 | * Motion sense commands. We'll make separate structs for sub-commands with | 2203 | * Motion sense commands. We'll make separate structs for sub-commands with |
| 1498 | * different input args, so that we know how much to expect. | 2204 | * different input args, so that we know how much to expect. |
| 1499 | */ | 2205 | */ |
| 1500 | #define EC_CMD_MOTION_SENSE_CMD 0x2B | 2206 | #define EC_CMD_MOTION_SENSE_CMD 0x002B |
| 1501 | 2207 | ||
| 1502 | /* Motion sense commands */ | 2208 | /* Motion sense commands */ |
| 1503 | enum motionsense_command { | 2209 | enum motionsense_command { |
| @@ -1516,7 +2222,13 @@ enum motionsense_command { | |||
| 1516 | 2222 | ||
| 1517 | /* | 2223 | /* |
| 1518 | * EC Rate command is a setter/getter command for the EC sampling rate | 2224 | * 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. | ||
| 1520 | */ | 2232 | */ |
| 1521 | MOTIONSENSE_CMD_EC_RATE = 2, | 2233 | MOTIONSENSE_CMD_EC_RATE = 2, |
| 1522 | 2234 | ||
| @@ -1547,32 +2259,76 @@ enum motionsense_command { | |||
| 1547 | MOTIONSENSE_CMD_DATA = 6, | 2259 | MOTIONSENSE_CMD_DATA = 6, |
| 1548 | 2260 | ||
| 1549 | /* | 2261 | /* |
| 1550 | * Perform low level calibration.. On sensors that support it, ask to | 2262 | * Return sensor fifo info. |
| 1551 | * do offset calibration. | 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. | ||
| 1552 | */ | 2280 | */ |
| 1553 | MOTIONSENSE_CMD_PERFORM_CALIB = 10, | 2281 | MOTIONSENSE_CMD_PERFORM_CALIB = 10, |
| 1554 | 2282 | ||
| 1555 | /* | 2283 | /* |
| 1556 | * Sensor Offset command is a setter/getter command for the offset used | 2284 | * Sensor Offset command is a setter/getter command for the offset |
| 1557 | * for calibration. The offsets can be calculated by the host, or via | 2285 | * used for calibration. |
| 2286 | * The offsets can be calculated by the host, or via | ||
| 1558 | * PERFORM_CALIB command. | 2287 | * PERFORM_CALIB command. |
| 1559 | */ | 2288 | */ |
| 1560 | MOTIONSENSE_CMD_SENSOR_OFFSET = 11, | 2289 | MOTIONSENSE_CMD_SENSOR_OFFSET = 11, |
| 1561 | 2290 | ||
| 1562 | /* Number of motionsense sub-commands. */ | 2291 | /* |
| 1563 | MOTIONSENSE_NUM_CMDS | 2292 | * List available activities for a MOTION sensor. |
| 1564 | }; | 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, | ||
| 2314 | |||
| 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, | ||
| 1565 | 2320 | ||
| 1566 | enum motionsensor_id { | 2321 | /* Set lid angle for tablet mode detection. */ |
| 1567 | EC_MOTION_SENSOR_ACCEL_BASE = 0, | 2322 | MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE = 17, |
| 1568 | EC_MOTION_SENSOR_ACCEL_LID = 1, | ||
| 1569 | EC_MOTION_SENSOR_GYRO = 2, | ||
| 1570 | 2323 | ||
| 1571 | /* | 2324 | /* |
| 1572 | * Note, if more sensors are added and this count changes, the padding | 2325 | * Sensor Scale command is a setter/getter command for the calibration |
| 1573 | * in ec_response_motion_sense dump command must be modified. | 2326 | * scale. |
| 1574 | */ | 2327 | */ |
| 1575 | EC_MOTION_SENSOR_COUNT = 3 | 2328 | MOTIONSENSE_CMD_SENSOR_SCALE = 18, |
| 2329 | |||
| 2330 | /* Number of motionsense sub-commands. */ | ||
| 2331 | MOTIONSENSE_NUM_CMDS | ||
| 1576 | }; | 2332 | }; |
| 1577 | 2333 | ||
| 1578 | /* List of motion sensor types. */ | 2334 | /* List of motion sensor types. */ |
| @@ -1584,6 +2340,7 @@ enum motionsensor_type { | |||
| 1584 | MOTIONSENSE_TYPE_LIGHT = 4, | 2340 | MOTIONSENSE_TYPE_LIGHT = 4, |
| 1585 | MOTIONSENSE_TYPE_ACTIVITY = 5, | 2341 | MOTIONSENSE_TYPE_ACTIVITY = 5, |
| 1586 | MOTIONSENSE_TYPE_BARO = 6, | 2342 | MOTIONSENSE_TYPE_BARO = 6, |
| 2343 | MOTIONSENSE_TYPE_SYNC = 7, | ||
| 1587 | MOTIONSENSE_TYPE_MAX, | 2344 | MOTIONSENSE_TYPE_MAX, |
| 1588 | }; | 2345 | }; |
| 1589 | 2346 | ||
| @@ -1591,19 +2348,116 @@ enum motionsensor_type { | |||
| 1591 | enum motionsensor_location { | 2348 | enum motionsensor_location { |
| 1592 | MOTIONSENSE_LOC_BASE = 0, | 2349 | MOTIONSENSE_LOC_BASE = 0, |
| 1593 | MOTIONSENSE_LOC_LID = 1, | 2350 | MOTIONSENSE_LOC_LID = 1, |
| 2351 | MOTIONSENSE_LOC_CAMERA = 2, | ||
| 1594 | MOTIONSENSE_LOC_MAX, | 2352 | MOTIONSENSE_LOC_MAX, |
| 1595 | }; | 2353 | }; |
| 1596 | 2354 | ||
| 1597 | /* List of motion sensor chips. */ | 2355 | /* List of motion sensor chips. */ |
| 1598 | enum motionsensor_chip { | 2356 | enum motionsensor_chip { |
| 1599 | MOTIONSENSE_CHIP_KXCJ9 = 0, | 2357 | 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, | ||
| 1600 | }; | 2436 | }; |
| 1601 | 2437 | ||
| 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 | |||
| 1602 | /* Module flag masks used for the dump sub-command. */ | 2446 | /* 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) |
| 1604 | 2448 | ||
| 1605 | /* Sensor flag masks used for the dump sub-command. */ | 2449 | /* 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) | ||
| 1607 | 2461 | ||
| 1608 | /* | 2462 | /* |
| 1609 | * Send this value for the data element to only perform a read. If you | 2463 | * Send this value for the data element to only perform a read. If you |
| @@ -1614,48 +2468,79 @@ enum motionsensor_chip { | |||
| 1614 | 2468 | ||
| 1615 | #define EC_MOTION_SENSE_INVALID_CALIB_TEMP 0x8000 | 2469 | #define EC_MOTION_SENSE_INVALID_CALIB_TEMP 0x8000 |
| 1616 | 2470 | ||
| 2471 | /* MOTIONSENSE_CMD_SENSOR_OFFSET subcommand flag */ | ||
| 1617 | /* Set Calibration information */ | 2472 | /* Set Calibration information */ |
| 1618 | #define MOTION_SENSE_SET_OFFSET 1 | 2473 | #define MOTION_SENSE_SET_OFFSET BIT(0) |
| 1619 | 2474 | ||
| 1620 | struct ec_response_motion_sensor_data { | 2475 | /* Default Scale value, factor 1. */ |
| 1621 | /* Flags for each sensor. */ | 2476 | #define MOTION_SENSE_DEFAULT_SCALE BIT(15) |
| 1622 | uint8_t flags; | 2477 | |
| 1623 | /* Sensor number the data comes from */ | 2478 | #define LID_ANGLE_UNRELIABLE 500 |
| 1624 | uint8_t sensor_num; | 2479 | |
| 1625 | /* Each sensor is up to 3-axis. */ | 2480 | enum motionsense_spoof_mode { |
| 1626 | union { | 2481 | /* Disable spoof mode. */ |
| 1627 | int16_t data[3]; | 2482 | MOTIONSENSE_SPOOF_MODE_DISABLE = 0, |
| 1628 | struct { | 2483 | |
| 1629 | uint16_t rsvd; | 2484 | /* Enable spoof mode, but use provided component values. */ |
| 1630 | uint32_t timestamp; | 2485 | MOTIONSENSE_SPOOF_MODE_CUSTOM, |
| 1631 | } __packed; | 2486 | |
| 1632 | struct { | 2487 | /* Enable spoof mode, but use the current sensor values. */ |
| 1633 | uint8_t activity; /* motionsensor_activity */ | 2488 | MOTIONSENSE_SPOOF_MODE_LOCK_CURRENT, |
| 1634 | uint8_t state; | 2489 | |
| 1635 | int16_t add_info[2]; | 2490 | /* Query the current spoof mode status for the sensor. */ |
| 1636 | }; | 2491 | MOTIONSENSE_SPOOF_MODE_QUERY, |
| 1637 | }; | 2492 | }; |
| 1638 | } __packed; | ||
| 1639 | 2493 | ||
| 1640 | struct ec_params_motion_sense { | 2494 | struct ec_params_motion_sense { |
| 1641 | uint8_t cmd; | 2495 | uint8_t cmd; |
| 1642 | union { | 2496 | union { |
| 1643 | /* Used for MOTIONSENSE_CMD_DUMP. */ | 2497 | /* Used for MOTIONSENSE_CMD_DUMP. */ |
| 1644 | struct { | 2498 | struct __ec_todo_unpacked { |
| 1645 | /* no args */ | 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; | ||
| 1646 | } dump; | 2505 | } dump; |
| 1647 | 2506 | ||
| 1648 | /* | 2507 | /* |
| 1649 | * Used for MOTIONSENSE_CMD_EC_RATE and | 2508 | * Used for MOTIONSENSE_CMD_KB_WAKE_ANGLE. |
| 1650 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. | ||
| 1651 | */ | 2509 | */ |
| 1652 | struct { | 2510 | struct __ec_todo_unpacked { |
| 1653 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */ | 2511 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. |
| 2512 | * kb_wake_angle: angle to wakup AP. | ||
| 2513 | */ | ||
| 1654 | int16_t data; | 2514 | 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; | ||
| 1656 | 2541 | ||
| 1657 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ | 2542 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ |
| 1658 | struct { | 2543 | struct __ec_todo_packed { |
| 1659 | uint8_t sensor_num; | 2544 | uint8_t sensor_num; |
| 1660 | 2545 | ||
| 1661 | /* | 2546 | /* |
| @@ -1681,36 +2566,102 @@ struct ec_params_motion_sense { | |||
| 1681 | * Compass: 1/16 uT | 2566 | * Compass: 1/16 uT |
| 1682 | */ | 2567 | */ |
| 1683 | int16_t offset[3]; | 2568 | int16_t offset[3]; |
| 1684 | } __packed sensor_offset; | 2569 | } sensor_offset; |
| 1685 | 2570 | ||
| 1686 | /* Used for MOTIONSENSE_CMD_INFO. */ | 2571 | /* Used for MOTIONSENSE_CMD_SENSOR_SCALE */ |
| 1687 | struct { | 2572 | struct __ec_todo_packed { |
| 1688 | uint8_t sensor_num; | 2573 | uint8_t sensor_num; |
| 1689 | } info; | ||
| 1690 | 2574 | ||
| 1691 | /* | 2575 | /* |
| 1692 | * Used for MOTIONSENSE_CMD_SENSOR_ODR and | 2576 | * bit 0: If set (MOTION_SENSE_SET_OFFSET), set |
| 1693 | * MOTIONSENSE_CMD_SENSOR_RANGE. | 2577 | * the calibration information in the EC. |
| 1694 | */ | 2578 | * If unset, just retrieve calibration information. |
| 1695 | struct { | 2579 | */ |
| 1696 | /* Should be element of enum motionsensor_id. */ | 2580 | uint16_t flags; |
| 1697 | uint8_t sensor_num; | ||
| 1698 | 2581 | ||
| 1699 | /* Rounding flag, true for round-up, false for down. */ | 2582 | /* |
| 1700 | uint8_t roundup; | 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; | ||
| 1701 | 2589 | ||
| 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; | ||
| 1703 | 2599 | ||
| 1704 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */ | 2600 | |
| 1705 | int32_t data; | 2601 | /* Used for MOTIONSENSE_CMD_FIFO_INFO */ |
| 1706 | } sensor_odr, sensor_range; | 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; | ||
| 1707 | }; | 2658 | }; |
| 1708 | } __packed; | 2659 | } __ec_todo_packed; |
| 1709 | 2660 | ||
| 1710 | struct ec_response_motion_sense { | 2661 | struct ec_response_motion_sense { |
| 1711 | union { | 2662 | union { |
| 1712 | /* Used for MOTIONSENSE_CMD_DUMP. */ | 2663 | /* Used for MOTIONSENSE_CMD_DUMP */ |
| 1713 | struct { | 2664 | struct __ec_todo_unpacked { |
| 1714 | /* Flags representing the motion sensor module. */ | 2665 | /* Flags representing the motion sensor module. */ |
| 1715 | uint8_t module_flags; | 2666 | uint8_t module_flags; |
| 1716 | 2667 | ||
| @@ -1725,7 +2676,7 @@ struct ec_response_motion_sense { | |||
| 1725 | } dump; | 2676 | } dump; |
| 1726 | 2677 | ||
| 1727 | /* Used for MOTIONSENSE_CMD_INFO. */ | 2678 | /* Used for MOTIONSENSE_CMD_INFO. */ |
| 1728 | struct { | 2679 | struct __ec_todo_unpacked { |
| 1729 | /* Should be element of enum motionsensor_type. */ | 2680 | /* Should be element of enum motionsensor_type. */ |
| 1730 | uint8_t type; | 2681 | uint8_t type; |
| 1731 | 2682 | ||
| @@ -1736,37 +2687,129 @@ struct ec_response_motion_sense { | |||
| 1736 | uint8_t chip; | 2687 | uint8_t chip; |
| 1737 | } info; | 2688 | } info; |
| 1738 | 2689 | ||
| 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 | |||
| 1739 | /* Used for MOTIONSENSE_CMD_DATA */ | 2711 | /* Used for MOTIONSENSE_CMD_DATA */ |
| 1740 | struct ec_response_motion_sensor_data data; | 2712 | struct ec_response_motion_sensor_data data; |
| 1741 | 2713 | ||
| 1742 | /* | 2714 | /* |
| 1743 | * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR, | 2715 | * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR, |
| 1744 | * MOTIONSENSE_CMD_SENSOR_RANGE, and | 2716 | * MOTIONSENSE_CMD_SENSOR_RANGE, |
| 1745 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. | 2717 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE, |
| 2718 | * MOTIONSENSE_CMD_FIFO_INT_ENABLE and | ||
| 2719 | * MOTIONSENSE_CMD_SPOOF. | ||
| 1746 | */ | 2720 | */ |
| 1747 | struct { | 2721 | struct __ec_todo_unpacked { |
| 1748 | /* Current value of the parameter queried. */ | 2722 | /* Current value of the parameter queried. */ |
| 1749 | int32_t ret; | 2723 | 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; | ||
| 1751 | 2726 | ||
| 1752 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ | 2727 | /* |
| 1753 | struct { | 2728 | * Used for MOTIONSENSE_CMD_SENSOR_OFFSET, |
| 2729 | * PERFORM_CALIB. | ||
| 2730 | */ | ||
| 2731 | struct __ec_todo_unpacked { | ||
| 1754 | int16_t temp; | 2732 | int16_t temp; |
| 1755 | int16_t offset[3]; | 2733 | int16_t offset[3]; |
| 1756 | } sensor_offset, perform_calib; | 2734 | } sensor_offset, perform_calib; |
| 2735 | |||
| 2736 | /* Used for MOTIONSENSE_CMD_SENSOR_SCALE */ | ||
| 2737 | struct __ec_todo_unpacked { | ||
| 2738 | int16_t temp; | ||
| 2739 | uint16_t scale[3]; | ||
| 2740 | } sensor_scale; | ||
| 2741 | |||
| 2742 | struct ec_response_motion_sense_fifo_info fifo_info, fifo_flush; | ||
| 2743 | |||
| 2744 | struct ec_response_motion_sense_fifo_data fifo_read; | ||
| 2745 | |||
| 2746 | struct __ec_todo_packed { | ||
| 2747 | uint16_t reserved; | ||
| 2748 | uint32_t enabled; | ||
| 2749 | uint32_t disabled; | ||
| 2750 | } list_activities; | ||
| 2751 | |||
| 2752 | /* No params for set activity */ | ||
| 2753 | |||
| 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; | ||
| 2762 | |||
| 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 | |||
| 1757 | }; | 2775 | }; |
| 1758 | } __packed; | 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; | ||
| 1759 | 2801 | ||
| 1760 | /*****************************************************************************/ | 2802 | /*****************************************************************************/ |
| 1761 | /* USB charging control commands */ | 2803 | /* USB charging control commands */ |
| 1762 | 2804 | ||
| 1763 | /* Set USB port charging mode */ | 2805 | /* Set USB port charging mode */ |
| 1764 | #define EC_CMD_USB_CHARGE_SET_MODE 0x30 | 2806 | #define EC_CMD_USB_CHARGE_SET_MODE 0x0030 |
| 1765 | 2807 | ||
| 1766 | struct ec_params_usb_charge_set_mode { | 2808 | struct ec_params_usb_charge_set_mode { |
| 1767 | uint8_t usb_port_id; | 2809 | uint8_t usb_port_id; |
| 1768 | uint8_t mode; | 2810 | uint8_t mode:7; |
| 1769 | } __packed; | 2811 | uint8_t inhibit_charge:1; |
| 2812 | } __ec_align1; | ||
| 1770 | 2813 | ||
| 1771 | /*****************************************************************************/ | 2814 | /*****************************************************************************/ |
| 1772 | /* Persistent storage for host */ | 2815 | /* Persistent storage for host */ |
| @@ -1775,35 +2818,35 @@ struct ec_params_usb_charge_set_mode { | |||
| 1775 | #define EC_PSTORE_SIZE_MAX 64 | 2818 | #define EC_PSTORE_SIZE_MAX 64 |
| 1776 | 2819 | ||
| 1777 | /* Get persistent storage info */ | 2820 | /* Get persistent storage info */ |
| 1778 | #define EC_CMD_PSTORE_INFO 0x40 | 2821 | #define EC_CMD_PSTORE_INFO 0x0040 |
| 1779 | 2822 | ||
| 1780 | struct ec_response_pstore_info { | 2823 | struct ec_response_pstore_info { |
| 1781 | /* Persistent storage size, in bytes */ | 2824 | /* Persistent storage size, in bytes */ |
| 1782 | uint32_t pstore_size; | 2825 | uint32_t pstore_size; |
| 1783 | /* Access size; read/write offset and size must be a multiple of this */ | 2826 | /* Access size; read/write offset and size must be a multiple of this */ |
| 1784 | uint32_t access_size; | 2827 | uint32_t access_size; |
| 1785 | } __packed; | 2828 | } __ec_align4; |
| 1786 | 2829 | ||
| 1787 | /* | 2830 | /* |
| 1788 | * Read persistent storage | 2831 | * Read persistent storage |
| 1789 | * | 2832 | * |
| 1790 | * Response is params.size bytes of data. | 2833 | * Response is params.size bytes of data. |
| 1791 | */ | 2834 | */ |
| 1792 | #define EC_CMD_PSTORE_READ 0x41 | 2835 | #define EC_CMD_PSTORE_READ 0x0041 |
| 1793 | 2836 | ||
| 1794 | struct ec_params_pstore_read { | 2837 | struct ec_params_pstore_read { |
| 1795 | uint32_t offset; /* Byte offset to read */ | 2838 | uint32_t offset; /* Byte offset to read */ |
| 1796 | uint32_t size; /* Size to read in bytes */ | 2839 | uint32_t size; /* Size to read in bytes */ |
| 1797 | } __packed; | 2840 | } __ec_align4; |
| 1798 | 2841 | ||
| 1799 | /* Write persistent storage */ | 2842 | /* Write persistent storage */ |
| 1800 | #define EC_CMD_PSTORE_WRITE 0x42 | 2843 | #define EC_CMD_PSTORE_WRITE 0x0042 |
| 1801 | 2844 | ||
| 1802 | struct ec_params_pstore_write { | 2845 | struct ec_params_pstore_write { |
| 1803 | uint32_t offset; /* Byte offset to write */ | 2846 | uint32_t offset; /* Byte offset to write */ |
| 1804 | uint32_t size; /* Size to write in bytes */ | 2847 | uint32_t size; /* Size to write in bytes */ |
| 1805 | uint8_t data[EC_PSTORE_SIZE_MAX]; | 2848 | uint8_t data[EC_PSTORE_SIZE_MAX]; |
| 1806 | } __packed; | 2849 | } __ec_align4; |
| 1807 | 2850 | ||
| 1808 | /*****************************************************************************/ | 2851 | /*****************************************************************************/ |
| 1809 | /* Real-time clock */ | 2852 | /* Real-time clock */ |
| @@ -1811,21 +2854,21 @@ struct ec_params_pstore_write { | |||
| 1811 | /* RTC params and response structures */ | 2854 | /* RTC params and response structures */ |
| 1812 | struct ec_params_rtc { | 2855 | struct ec_params_rtc { |
| 1813 | uint32_t time; | 2856 | uint32_t time; |
| 1814 | } __packed; | 2857 | } __ec_align4; |
| 1815 | 2858 | ||
| 1816 | struct ec_response_rtc { | 2859 | struct ec_response_rtc { |
| 1817 | uint32_t time; | 2860 | uint32_t time; |
| 1818 | } __packed; | 2861 | } __ec_align4; |
| 1819 | 2862 | ||
| 1820 | /* These use ec_response_rtc */ | 2863 | /* These use ec_response_rtc */ |
| 1821 | #define EC_CMD_RTC_GET_VALUE 0x44 | 2864 | #define EC_CMD_RTC_GET_VALUE 0x0044 |
| 1822 | #define EC_CMD_RTC_GET_ALARM 0x45 | 2865 | #define EC_CMD_RTC_GET_ALARM 0x0045 |
| 1823 | 2866 | ||
| 1824 | /* These all use ec_params_rtc */ | 2867 | /* These all use ec_params_rtc */ |
| 1825 | #define EC_CMD_RTC_SET_VALUE 0x46 | 2868 | #define EC_CMD_RTC_SET_VALUE 0x0046 |
| 1826 | #define EC_CMD_RTC_SET_ALARM 0x47 | 2869 | #define EC_CMD_RTC_SET_ALARM 0x0047 |
| 1827 | 2870 | ||
| 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 */ |
| 1829 | #define EC_RTC_ALARM_CLEAR 0 | 2872 | #define EC_RTC_ALARM_CLEAR 0 |
| 1830 | 2873 | ||
| 1831 | /*****************************************************************************/ | 2874 | /*****************************************************************************/ |
| @@ -1835,8 +2878,8 @@ struct ec_response_rtc { | |||
| 1835 | #define EC_PORT80_SIZE_MAX 32 | 2878 | #define EC_PORT80_SIZE_MAX 32 |
| 1836 | 2879 | ||
| 1837 | /* Get last port80 code from previous boot */ | 2880 | /* Get last port80 code from previous boot */ |
| 1838 | #define EC_CMD_PORT80_LAST_BOOT 0x48 | 2881 | #define EC_CMD_PORT80_LAST_BOOT 0x0048 |
| 1839 | #define EC_CMD_PORT80_READ 0x48 | 2882 | #define EC_CMD_PORT80_READ 0x0048 |
| 1840 | 2883 | ||
| 1841 | enum ec_port80_subcmd { | 2884 | enum ec_port80_subcmd { |
| 1842 | EC_PORT80_GET_INFO = 0, | 2885 | EC_PORT80_GET_INFO = 0, |
| @@ -1846,29 +2889,72 @@ enum ec_port80_subcmd { | |||
| 1846 | struct ec_params_port80_read { | 2889 | struct ec_params_port80_read { |
| 1847 | uint16_t subcmd; | 2890 | uint16_t subcmd; |
| 1848 | union { | 2891 | union { |
| 1849 | struct { | 2892 | struct __ec_todo_unpacked { |
| 1850 | uint32_t offset; | 2893 | uint32_t offset; |
| 1851 | uint32_t num_entries; | 2894 | uint32_t num_entries; |
| 1852 | } read_buffer; | 2895 | } read_buffer; |
| 1853 | }; | 2896 | }; |
| 1854 | } __packed; | 2897 | } __ec_todo_packed; |
| 1855 | 2898 | ||
| 1856 | struct ec_response_port80_read { | 2899 | struct ec_response_port80_read { |
| 1857 | union { | 2900 | union { |
| 1858 | struct { | 2901 | struct __ec_todo_unpacked { |
| 1859 | uint32_t writes; | 2902 | uint32_t writes; |
| 1860 | uint32_t history_size; | 2903 | uint32_t history_size; |
| 1861 | uint32_t last_boot; | 2904 | uint32_t last_boot; |
| 1862 | } get_info; | 2905 | } get_info; |
| 1863 | struct { | 2906 | struct __ec_todo_unpacked { |
| 1864 | uint16_t codes[EC_PORT80_SIZE_MAX]; | 2907 | uint16_t codes[EC_PORT80_SIZE_MAX]; |
| 1865 | } data; | 2908 | } data; |
| 1866 | }; | 2909 | }; |
| 1867 | } __packed; | 2910 | } __ec_todo_packed; |
| 1868 | 2911 | ||
| 1869 | struct ec_response_port80_last_boot { | 2912 | struct ec_response_port80_last_boot { |
| 1870 | uint16_t code; | 2913 | 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; | ||
| 1872 | 2958 | ||
| 1873 | /*****************************************************************************/ | 2959 | /*****************************************************************************/ |
| 1874 | /* Thermal engine commands. Note that there are two implementations. We'll | 2960 | /* Thermal engine commands. Note that there are two implementations. We'll |
| @@ -1877,8 +2963,8 @@ struct ec_response_port80_last_boot { | |||
| 1877 | * Version 1 separates the CPU thermal limits from the fan control. | 2963 | * Version 1 separates the CPU thermal limits from the fan control. |
| 1878 | */ | 2964 | */ |
| 1879 | 2965 | ||
| 1880 | #define EC_CMD_THERMAL_SET_THRESHOLD 0x50 | 2966 | #define EC_CMD_THERMAL_SET_THRESHOLD 0x0050 |
| 1881 | #define EC_CMD_THERMAL_GET_THRESHOLD 0x51 | 2967 | #define EC_CMD_THERMAL_GET_THRESHOLD 0x0051 |
| 1882 | 2968 | ||
| 1883 | /* The version 0 structs are opaque. You have to know what they are for | 2969 | /* The version 0 structs are opaque. You have to know what they are for |
| 1884 | * the get/set commands to make any sense. | 2970 | * the get/set commands to make any sense. |
| @@ -1889,17 +2975,17 @@ struct ec_params_thermal_set_threshold { | |||
| 1889 | uint8_t sensor_type; | 2975 | uint8_t sensor_type; |
| 1890 | uint8_t threshold_id; | 2976 | uint8_t threshold_id; |
| 1891 | uint16_t value; | 2977 | uint16_t value; |
| 1892 | } __packed; | 2978 | } __ec_align2; |
| 1893 | 2979 | ||
| 1894 | /* Version 0 - get */ | 2980 | /* Version 0 - get */ |
| 1895 | struct ec_params_thermal_get_threshold { | 2981 | struct ec_params_thermal_get_threshold { |
| 1896 | uint8_t sensor_type; | 2982 | uint8_t sensor_type; |
| 1897 | uint8_t threshold_id; | 2983 | uint8_t threshold_id; |
| 1898 | } __packed; | 2984 | } __ec_align1; |
| 1899 | 2985 | ||
| 1900 | struct ec_response_thermal_get_threshold { | 2986 | struct ec_response_thermal_get_threshold { |
| 1901 | uint16_t value; | 2987 | uint16_t value; |
| 1902 | } __packed; | 2988 | } __ec_align2; |
| 1903 | 2989 | ||
| 1904 | 2990 | ||
| 1905 | /* The version 1 structs are visible. */ | 2991 | /* The version 1 structs are visible. */ |
| @@ -1911,71 +2997,124 @@ enum ec_temp_thresholds { | |||
| 1911 | EC_TEMP_THRESH_COUNT | 2997 | EC_TEMP_THRESH_COUNT |
| 1912 | }; | 2998 | }; |
| 1913 | 2999 | ||
| 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. | ||
| 1915 | * Zero values will be silently ignored by the thermal task. | 3002 | * 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. | ||
| 1916 | */ | 3021 | */ |
| 1917 | struct ec_thermal_config { | 3022 | struct ec_thermal_config { |
| 1918 | uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */ | 3023 | uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */ |
| 3024 | uint32_t temp_host_release[EC_TEMP_THRESH_COUNT]; /* release levels */ | ||
| 1919 | uint32_t temp_fan_off; /* no active cooling needed */ | 3025 | uint32_t temp_fan_off; /* no active cooling needed */ |
| 1920 | uint32_t temp_fan_max; /* max active cooling needed */ | 3026 | uint32_t temp_fan_max; /* max active cooling needed */ |
| 1921 | } __packed; | 3027 | } __ec_align4; |
| 1922 | 3028 | ||
| 1923 | /* Version 1 - get config for one sensor. */ | 3029 | /* Version 1 - get config for one sensor. */ |
| 1924 | struct ec_params_thermal_get_threshold_v1 { | 3030 | struct ec_params_thermal_get_threshold_v1 { |
| 1925 | uint32_t sensor_num; | 3031 | uint32_t sensor_num; |
| 1926 | } __packed; | 3032 | } __ec_align4; |
| 1927 | /* This returns a struct ec_thermal_config */ | 3033 | /* This returns a struct ec_thermal_config */ |
| 1928 | 3034 | ||
| 1929 | /* Version 1 - set config for one sensor. | 3035 | /* |
| 1930 | * Use read-modify-write for best results! */ | 3036 | * Version 1 - set config for one sensor. |
| 3037 | * Use read-modify-write for best results! | ||
| 3038 | */ | ||
| 1931 | struct ec_params_thermal_set_threshold_v1 { | 3039 | struct ec_params_thermal_set_threshold_v1 { |
| 1932 | uint32_t sensor_num; | 3040 | uint32_t sensor_num; |
| 1933 | struct ec_thermal_config cfg; | 3041 | struct ec_thermal_config cfg; |
| 1934 | } __packed; | 3042 | } __ec_align4; |
| 1935 | /* This returns no data */ | 3043 | /* This returns no data */ |
| 1936 | 3044 | ||
| 1937 | /****************************************************************************/ | 3045 | /****************************************************************************/ |
| 1938 | 3046 | ||
| 1939 | /* Toggle automatic fan control */ | 3047 | /* 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; | ||
| 1941 | 3054 | ||
| 1942 | /* Get TMP006 calibration data */ | 3055 | /* Get/Set TMP006 calibration data */ |
| 1943 | #define EC_CMD_TMP006_GET_CALIBRATION 0x53 | 3056 | #define EC_CMD_TMP006_GET_CALIBRATION 0x0053 |
| 3057 | #define EC_CMD_TMP006_SET_CALIBRATION 0x0054 | ||
| 1944 | 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 | */ | ||
| 3067 | |||
| 3068 | /* This is the same struct for both v0 and v1. */ | ||
| 1945 | struct ec_params_tmp006_get_calibration { | 3069 | struct ec_params_tmp006_get_calibration { |
| 1946 | uint8_t index; | 3070 | uint8_t index; |
| 1947 | } __packed; | 3071 | } __ec_align1; |
| 1948 | 3072 | ||
| 1949 | struct ec_response_tmp006_get_calibration { | 3073 | /* Version 0 */ |
| 3074 | struct ec_response_tmp006_get_calibration_v0 { | ||
| 1950 | float s0; | 3075 | float s0; |
| 1951 | float b0; | 3076 | float b0; |
| 1952 | float b1; | 3077 | float b1; |
| 1953 | float b2; | 3078 | float b2; |
| 1954 | } __packed; | 3079 | } __ec_align4; |
| 1955 | 3080 | ||
| 1956 | /* Set TMP006 calibration data */ | 3081 | struct ec_params_tmp006_set_calibration_v0 { |
| 1957 | #define EC_CMD_TMP006_SET_CALIBRATION 0x54 | ||
| 1958 | |||
| 1959 | struct ec_params_tmp006_set_calibration { | ||
| 1960 | uint8_t index; | 3082 | uint8_t index; |
| 1961 | uint8_t reserved[3]; /* Reserved; set 0 */ | 3083 | uint8_t reserved[3]; |
| 1962 | float s0; | 3084 | float s0; |
| 1963 | float b0; | 3085 | float b0; |
| 1964 | float b1; | 3086 | float b1; |
| 1965 | float b2; | 3087 | 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 | |||
| 1967 | 3106 | ||
| 1968 | /* Read raw TMP006 data */ | 3107 | /* Read raw TMP006 data */ |
| 1969 | #define EC_CMD_TMP006_GET_RAW 0x55 | 3108 | #define EC_CMD_TMP006_GET_RAW 0x0055 |
| 1970 | 3109 | ||
| 1971 | struct ec_params_tmp006_get_raw { | 3110 | struct ec_params_tmp006_get_raw { |
| 1972 | uint8_t index; | 3111 | uint8_t index; |
| 1973 | } __packed; | 3112 | } __ec_align1; |
| 1974 | 3113 | ||
| 1975 | struct ec_response_tmp006_get_raw { | 3114 | struct ec_response_tmp006_get_raw { |
| 1976 | int32_t t; /* In 1/100 K */ | 3115 | int32_t t; /* In 1/100 K */ |
| 1977 | int32_t v; /* In nV */ | 3116 | int32_t v; /* In nV */ |
| 1978 | }; | 3117 | } __ec_align4; |
| 1979 | 3118 | ||
| 1980 | /*****************************************************************************/ | 3119 | /*****************************************************************************/ |
| 1981 | /* MKBP - Matrix KeyBoard Protocol */ | 3120 | /* MKBP - Matrix KeyBoard Protocol */ |
| @@ -1990,24 +3129,24 @@ struct ec_response_tmp006_get_raw { | |||
| 1990 | * to obtain the instantaneous state, use EC_CMD_MKBP_INFO with the type | 3129 | * to obtain the instantaneous state, use EC_CMD_MKBP_INFO with the type |
| 1991 | * EC_MKBP_INFO_CURRENT and event EC_MKBP_EVENT_KEY_MATRIX. | 3130 | * EC_MKBP_INFO_CURRENT and event EC_MKBP_EVENT_KEY_MATRIX. |
| 1992 | */ | 3131 | */ |
| 1993 | #define EC_CMD_MKBP_STATE 0x60 | 3132 | #define EC_CMD_MKBP_STATE 0x0060 |
| 1994 | 3133 | ||
| 1995 | /* | 3134 | /* |
| 1996 | * Provide information about various MKBP things. See enum ec_mkbp_info_type. | 3135 | * Provide information about various MKBP things. See enum ec_mkbp_info_type. |
| 1997 | */ | 3136 | */ |
| 1998 | #define EC_CMD_MKBP_INFO 0x61 | 3137 | #define EC_CMD_MKBP_INFO 0x0061 |
| 1999 | 3138 | ||
| 2000 | struct ec_response_mkbp_info { | 3139 | struct ec_response_mkbp_info { |
| 2001 | uint32_t rows; | 3140 | uint32_t rows; |
| 2002 | uint32_t cols; | 3141 | uint32_t cols; |
| 2003 | /* Formerly "switches", which was 0. */ | 3142 | /* Formerly "switches", which was 0. */ |
| 2004 | uint8_t reserved; | 3143 | uint8_t reserved; |
| 2005 | } __packed; | 3144 | } __ec_align_size1; |
| 2006 | 3145 | ||
| 2007 | struct ec_params_mkbp_info { | 3146 | struct ec_params_mkbp_info { |
| 2008 | uint8_t info_type; | 3147 | uint8_t info_type; |
| 2009 | uint8_t event_type; | 3148 | uint8_t event_type; |
| 2010 | } __packed; | 3149 | } __ec_align1; |
| 2011 | 3150 | ||
| 2012 | enum ec_mkbp_info_type { | 3151 | enum ec_mkbp_info_type { |
| 2013 | /* | 3152 | /* |
| @@ -2049,17 +3188,28 @@ enum ec_mkbp_info_type { | |||
| 2049 | }; | 3188 | }; |
| 2050 | 3189 | ||
| 2051 | /* Simulate key press */ | 3190 | /* Simulate key press */ |
| 2052 | #define EC_CMD_MKBP_SIMULATE_KEY 0x62 | 3191 | #define EC_CMD_MKBP_SIMULATE_KEY 0x0062 |
| 2053 | 3192 | ||
| 2054 | struct ec_params_mkbp_simulate_key { | 3193 | struct ec_params_mkbp_simulate_key { |
| 2055 | uint8_t col; | 3194 | uint8_t col; |
| 2056 | uint8_t row; | 3195 | uint8_t row; |
| 2057 | uint8_t pressed; | 3196 | 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 | }; | ||
| 2059 | 3209 | ||
| 2060 | /* Configure keyboard scanning */ | 3210 | /* Configure keyboard scanning */ |
| 2061 | #define EC_CMD_MKBP_SET_CONFIG 0x64 | 3211 | #define EC_CMD_MKBP_SET_CONFIG 0x0064 |
| 2062 | #define EC_CMD_MKBP_GET_CONFIG 0x65 | 3212 | #define EC_CMD_MKBP_GET_CONFIG 0x0065 |
| 2063 | 3213 | ||
| 2064 | /* flags */ | 3214 | /* flags */ |
| 2065 | enum mkbp_config_flags { | 3215 | enum mkbp_config_flags { |
| @@ -2067,16 +3217,21 @@ enum mkbp_config_flags { | |||
| 2067 | }; | 3217 | }; |
| 2068 | 3218 | ||
| 2069 | enum mkbp_config_valid { | 3219 | enum mkbp_config_valid { |
| 2070 | EC_MKBP_VALID_SCAN_PERIOD = 1 << 0, | 3220 | EC_MKBP_VALID_SCAN_PERIOD = BIT(0), |
| 2071 | EC_MKBP_VALID_POLL_TIMEOUT = 1 << 1, | 3221 | EC_MKBP_VALID_POLL_TIMEOUT = BIT(1), |
| 2072 | EC_MKBP_VALID_MIN_POST_SCAN_DELAY = 1 << 3, | 3222 | EC_MKBP_VALID_MIN_POST_SCAN_DELAY = BIT(3), |
| 2073 | EC_MKBP_VALID_OUTPUT_SETTLE = 1 << 4, | 3223 | EC_MKBP_VALID_OUTPUT_SETTLE = BIT(4), |
| 2074 | EC_MKBP_VALID_DEBOUNCE_DOWN = 1 << 5, | 3224 | EC_MKBP_VALID_DEBOUNCE_DOWN = BIT(5), |
| 2075 | EC_MKBP_VALID_DEBOUNCE_UP = 1 << 6, | 3225 | EC_MKBP_VALID_DEBOUNCE_UP = BIT(6), |
| 2076 | EC_MKBP_VALID_FIFO_MAX_DEPTH = 1 << 7, | 3226 | EC_MKBP_VALID_FIFO_MAX_DEPTH = BIT(7), |
| 2077 | }; | 3227 | }; |
| 2078 | 3228 | ||
| 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 | */ | ||
| 2080 | struct ec_mkbp_config { | 3235 | struct ec_mkbp_config { |
| 2081 | uint32_t valid_mask; /* valid fields */ | 3236 | uint32_t valid_mask; /* valid fields */ |
| 2082 | uint8_t flags; /* some flags (enum mkbp_config_flags) */ | 3237 | uint8_t flags; /* some flags (enum mkbp_config_flags) */ |
| @@ -2096,18 +3251,18 @@ struct ec_mkbp_config { | |||
| 2096 | uint16_t debounce_up_us; /* time for debounce on key up */ | 3251 | uint16_t debounce_up_us; /* time for debounce on key up */ |
| 2097 | /* maximum depth to allow for fifo (0 = no keyscan output) */ | 3252 | /* maximum depth to allow for fifo (0 = no keyscan output) */ |
| 2098 | uint8_t fifo_max_depth; | 3253 | uint8_t fifo_max_depth; |
| 2099 | } __packed; | 3254 | } __ec_align_size1; |
| 2100 | 3255 | ||
| 2101 | struct ec_params_mkbp_set_config { | 3256 | struct ec_params_mkbp_set_config { |
| 2102 | struct ec_mkbp_config config; | 3257 | struct ec_mkbp_config config; |
| 2103 | } __packed; | 3258 | } __ec_align_size1; |
| 2104 | 3259 | ||
| 2105 | struct ec_response_mkbp_get_config { | 3260 | struct ec_response_mkbp_get_config { |
| 2106 | struct ec_mkbp_config config; | 3261 | struct ec_mkbp_config config; |
| 2107 | } __packed; | 3262 | } __ec_align_size1; |
| 2108 | 3263 | ||
| 2109 | /* Run the key scan emulation */ | 3264 | /* Run the key scan emulation */ |
| 2110 | #define EC_CMD_KEYSCAN_SEQ_CTRL 0x66 | 3265 | #define EC_CMD_KEYSCAN_SEQ_CTRL 0x0066 |
| 2111 | 3266 | ||
| 2112 | enum ec_keyscan_seq_cmd { | 3267 | enum ec_keyscan_seq_cmd { |
| 2113 | EC_KEYSCAN_SEQ_STATUS = 0, /* Get status information */ | 3268 | EC_KEYSCAN_SEQ_STATUS = 0, /* Get status information */ |
| @@ -2122,23 +3277,23 @@ enum ec_collect_flags { | |||
| 2122 | * Indicates this scan was processed by the EC. Due to timing, some | 3277 | * Indicates this scan was processed by the EC. Due to timing, some |
| 2123 | * scans may be skipped. | 3278 | * scans may be skipped. |
| 2124 | */ | 3279 | */ |
| 2125 | EC_KEYSCAN_SEQ_FLAG_DONE = 1 << 0, | 3280 | EC_KEYSCAN_SEQ_FLAG_DONE = BIT(0), |
| 2126 | }; | 3281 | }; |
| 2127 | 3282 | ||
| 2128 | struct ec_collect_item { | 3283 | struct ec_collect_item { |
| 2129 | uint8_t flags; /* some flags (enum ec_collect_flags) */ | 3284 | uint8_t flags; /* some flags (enum ec_collect_flags) */ |
| 2130 | }; | 3285 | } __ec_align1; |
| 2131 | 3286 | ||
| 2132 | struct ec_params_keyscan_seq_ctrl { | 3287 | struct ec_params_keyscan_seq_ctrl { |
| 2133 | uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */ | 3288 | uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */ |
| 2134 | union { | 3289 | union { |
| 2135 | struct { | 3290 | struct __ec_align1 { |
| 2136 | uint8_t active; /* still active */ | 3291 | uint8_t active; /* still active */ |
| 2137 | uint8_t num_items; /* number of items */ | 3292 | uint8_t num_items; /* number of items */ |
| 2138 | /* Current item being presented */ | 3293 | /* Current item being presented */ |
| 2139 | uint8_t cur_item; | 3294 | uint8_t cur_item; |
| 2140 | } status; | 3295 | } status; |
| 2141 | struct { | 3296 | struct __ec_todo_unpacked { |
| 2142 | /* | 3297 | /* |
| 2143 | * Absolute time for this scan, measured from the | 3298 | * Absolute time for this scan, measured from the |
| 2144 | * start of the sequence. | 3299 | * start of the sequence. |
| @@ -2146,29 +3301,40 @@ struct ec_params_keyscan_seq_ctrl { | |||
| 2146 | uint32_t time_us; | 3301 | uint32_t time_us; |
| 2147 | uint8_t scan[0]; /* keyscan data */ | 3302 | uint8_t scan[0]; /* keyscan data */ |
| 2148 | } add; | 3303 | } add; |
| 2149 | struct { | 3304 | struct __ec_align1 { |
| 2150 | uint8_t start_item; /* First item to return */ | 3305 | uint8_t start_item; /* First item to return */ |
| 2151 | uint8_t num_items; /* Number of items to return */ | 3306 | uint8_t num_items; /* Number of items to return */ |
| 2152 | } collect; | 3307 | } collect; |
| 2153 | }; | 3308 | }; |
| 2154 | } __packed; | 3309 | } __ec_todo_packed; |
| 2155 | 3310 | ||
| 2156 | struct ec_result_keyscan_seq_ctrl { | 3311 | struct ec_result_keyscan_seq_ctrl { |
| 2157 | union { | 3312 | union { |
| 2158 | struct { | 3313 | struct __ec_todo_unpacked { |
| 2159 | uint8_t num_items; /* Number of items */ | 3314 | uint8_t num_items; /* Number of items */ |
| 2160 | /* Data for each item */ | 3315 | /* Data for each item */ |
| 2161 | struct ec_collect_item item[0]; | 3316 | struct ec_collect_item item[0]; |
| 2162 | } collect; | 3317 | } collect; |
| 2163 | }; | 3318 | }; |
| 2164 | } __packed; | 3319 | } __ec_todo_packed; |
| 2165 | 3320 | ||
| 2166 | /* | 3321 | /* |
| 2167 | * Command for retrieving the next pending MKBP event from the EC device | 3322 | * Get the next pending MKBP event. |
| 2168 | * | 3323 | * |
| 2169 | * The device replies with UNAVAILABLE if there aren't any pending events. | 3324 | * Returns EC_RES_UNAVAILABLE if there is no event pending. |
| 2170 | */ | 3325 | */ |
| 2171 | #define EC_CMD_GET_NEXT_EVENT 0x67 | 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. | ||
| 3333 | */ | ||
| 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) | ||
| 2172 | 3338 | ||
| 2173 | enum ec_mkbp_event { | 3339 | enum ec_mkbp_event { |
| 2174 | /* Keyboard matrix changed. The event data is the new matrix state. */ | 3340 | /* Keyboard matrix changed. The event data is the new matrix state. */ |
| @@ -2186,9 +3352,21 @@ enum ec_mkbp_event { | |||
| 2186 | /* The state of the switches have changed. */ | 3352 | /* The state of the switches have changed. */ |
| 2187 | EC_MKBP_EVENT_SWITCH = 4, | 3353 | EC_MKBP_EVENT_SWITCH = 4, |
| 2188 | 3354 | ||
| 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 | */ | ||
| 2190 | EC_MKBP_EVENT_SYSRQ = 6, | 3362 | EC_MKBP_EVENT_SYSRQ = 6, |
| 2191 | 3363 | ||
| 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 | |||
| 2192 | /* Notify the AP that something happened on CEC */ | 3370 | /* Notify the AP that something happened on CEC */ |
| 2193 | EC_MKBP_EVENT_CEC_EVENT = 8, | 3371 | EC_MKBP_EVENT_CEC_EVENT = 8, |
| 2194 | 3372 | ||
| @@ -2198,65 +3376,140 @@ enum ec_mkbp_event { | |||
| 2198 | /* Number of MKBP events */ | 3376 | /* Number of MKBP events */ |
| 2199 | EC_MKBP_EVENT_COUNT, | 3377 | EC_MKBP_EVENT_COUNT, |
| 2200 | }; | 3378 | }; |
| 3379 | BUILD_ASSERT(EC_MKBP_EVENT_COUNT <= EC_MKBP_EVENT_TYPE_MASK); | ||
| 2201 | 3380 | ||
| 2202 | union ec_response_get_next_data { | 3381 | union __ec_align_offset1 ec_response_get_next_data { |
| 2203 | uint8_t key_matrix[13]; | 3382 | uint8_t key_matrix[13]; |
| 2204 | 3383 | ||
| 2205 | /* Unaligned */ | 3384 | /* Unaligned */ |
| 2206 | uint32_t host_event; | 3385 | uint32_t host_event; |
| 3386 | uint64_t host_event64; | ||
| 3387 | |||
| 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; | ||
| 3393 | |||
| 3394 | uint32_t buttons; | ||
| 3395 | |||
| 3396 | uint32_t switches; | ||
| 2207 | 3397 | ||
| 2208 | uint32_t buttons; | 3398 | uint32_t fp_events; |
| 2209 | uint32_t switches; | 3399 | |
| 2210 | uint32_t sysrq; | 3400 | uint32_t sysrq; |
| 2211 | } __packed; | ||
| 2212 | 3401 | ||
| 2213 | union ec_response_get_next_data_v1 { | 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 { | ||
| 2214 | uint8_t key_matrix[16]; | 3407 | uint8_t key_matrix[16]; |
| 3408 | |||
| 3409 | /* Unaligned */ | ||
| 2215 | uint32_t host_event; | 3410 | 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 | |||
| 2216 | uint32_t buttons; | 3419 | uint32_t buttons; |
| 3420 | |||
| 2217 | uint32_t switches; | 3421 | uint32_t switches; |
| 3422 | |||
| 3423 | uint32_t fp_events; | ||
| 3424 | |||
| 2218 | uint32_t sysrq; | 3425 | uint32_t sysrq; |
| 3426 | |||
| 3427 | /* CEC events from enum mkbp_cec_event */ | ||
| 2219 | uint32_t cec_events; | 3428 | uint32_t cec_events; |
| 3429 | |||
| 2220 | uint8_t cec_message[16]; | 3430 | uint8_t cec_message[16]; |
| 2221 | } __packed; | 3431 | }; |
| 3432 | BUILD_ASSERT(sizeof(union ec_response_get_next_data_v1) == 16); | ||
| 2222 | 3433 | ||
| 2223 | struct ec_response_get_next_event { | 3434 | struct ec_response_get_next_event { |
| 2224 | uint8_t event_type; | 3435 | uint8_t event_type; |
| 2225 | /* Followed by event data if any */ | 3436 | /* Followed by event data if any */ |
| 2226 | union ec_response_get_next_data data; | 3437 | union ec_response_get_next_data data; |
| 2227 | } __packed; | 3438 | } __ec_align1; |
| 2228 | 3439 | ||
| 2229 | struct ec_response_get_next_event_v1 { | 3440 | struct ec_response_get_next_event_v1 { |
| 2230 | uint8_t event_type; | 3441 | uint8_t event_type; |
| 2231 | /* Followed by event data if any */ | 3442 | /* Followed by event data if any */ |
| 2232 | union ec_response_get_next_data_v1 data; | 3443 | union ec_response_get_next_data_v1 data; |
| 2233 | } __packed; | 3444 | } __ec_align1; |
| 2234 | 3445 | ||
| 2235 | /* Bit indices for buttons and switches.*/ | 3446 | /* Bit indices for buttons and switches.*/ |
| 2236 | /* Buttons */ | 3447 | /* Buttons */ |
| 2237 | #define EC_MKBP_POWER_BUTTON 0 | 3448 | #define EC_MKBP_POWER_BUTTON 0 |
| 2238 | #define EC_MKBP_VOL_UP 1 | 3449 | #define EC_MKBP_VOL_UP 1 |
| 2239 | #define EC_MKBP_VOL_DOWN 2 | 3450 | #define EC_MKBP_VOL_DOWN 2 |
| 3451 | #define EC_MKBP_RECOVERY 3 | ||
| 2240 | 3452 | ||
| 2241 | /* Switches */ | 3453 | /* Switches */ |
| 2242 | #define EC_MKBP_LID_OPEN 0 | 3454 | #define EC_MKBP_LID_OPEN 0 |
| 2243 | #define EC_MKBP_TABLET_MODE 1 | 3455 | #define EC_MKBP_TABLET_MODE 1 |
| 2244 | #define EC_MKBP_BASE_ATTACHED 2 | 3456 | #define EC_MKBP_BASE_ATTACHED 2 |
| 2245 | 3457 | ||
| 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 | |||
| 2246 | /*****************************************************************************/ | 3499 | /*****************************************************************************/ |
| 2247 | /* Temperature sensor commands */ | 3500 | /* Temperature sensor commands */ |
| 2248 | 3501 | ||
| 2249 | /* Read temperature sensor info */ | 3502 | /* Read temperature sensor info */ |
| 2250 | #define EC_CMD_TEMP_SENSOR_GET_INFO 0x70 | 3503 | #define EC_CMD_TEMP_SENSOR_GET_INFO 0x0070 |
| 2251 | 3504 | ||
| 2252 | struct ec_params_temp_sensor_get_info { | 3505 | struct ec_params_temp_sensor_get_info { |
| 2253 | uint8_t id; | 3506 | uint8_t id; |
| 2254 | } __packed; | 3507 | } __ec_align1; |
| 2255 | 3508 | ||
| 2256 | struct ec_response_temp_sensor_get_info { | 3509 | struct ec_response_temp_sensor_get_info { |
| 2257 | char sensor_name[32]; | 3510 | char sensor_name[32]; |
| 2258 | uint8_t sensor_type; | 3511 | uint8_t sensor_type; |
| 2259 | } __packed; | 3512 | } __ec_align1; |
| 2260 | 3513 | ||
| 2261 | /*****************************************************************************/ | 3514 | /*****************************************************************************/ |
| 2262 | 3515 | ||
| @@ -2269,49 +3522,131 @@ struct ec_response_temp_sensor_get_info { | |||
| 2269 | /*****************************************************************************/ | 3522 | /*****************************************************************************/ |
| 2270 | /* Host event commands */ | 3523 | /* Host event commands */ |
| 2271 | 3524 | ||
| 3525 | |||
| 3526 | /* Obsolete. New implementation should use EC_CMD_HOST_EVENT instead */ | ||
| 2272 | /* | 3527 | /* |
| 2273 | * Host event mask params and response structures, shared by all of the host | 3528 | * Host event mask params and response structures, shared by all of the host |
| 2274 | * event commands below. | 3529 | * event commands below. |
| 2275 | */ | 3530 | */ |
| 2276 | struct ec_params_host_event_mask { | 3531 | struct ec_params_host_event_mask { |
| 2277 | uint32_t mask; | 3532 | uint32_t mask; |
| 2278 | } __packed; | 3533 | } __ec_align4; |
| 2279 | 3534 | ||
| 2280 | struct ec_response_host_event_mask { | 3535 | struct ec_response_host_event_mask { |
| 2281 | uint32_t mask; | 3536 | uint32_t mask; |
| 2282 | } __packed; | 3537 | } __ec_align4; |
| 2283 | 3538 | ||
| 2284 | /* These all use ec_response_host_event_mask */ | 3539 | /* These all use ec_response_host_event_mask */ |
| 2285 | #define EC_CMD_HOST_EVENT_GET_B 0x87 | 3540 | #define EC_CMD_HOST_EVENT_GET_B 0x0087 |
| 2286 | #define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x88 | 3541 | #define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x0088 |
| 2287 | #define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x89 | 3542 | #define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x0089 |
| 2288 | #define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x8d | 3543 | #define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x008D |
| 2289 | 3544 | ||
| 2290 | /* These all use ec_params_host_event_mask */ | 3545 | /* These all use ec_params_host_event_mask */ |
| 2291 | #define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x8a | 3546 | #define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x008A |
| 2292 | #define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x8b | 3547 | #define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x008B |
| 2293 | #define EC_CMD_HOST_EVENT_CLEAR 0x8c | 3548 | #define EC_CMD_HOST_EVENT_CLEAR 0x008C |
| 2294 | #define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x8e | 3549 | #define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x008E |
| 2295 | #define EC_CMD_HOST_EVENT_CLEAR_B 0x8f | 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 | ||
| 2296 | 3631 | ||
| 2297 | /*****************************************************************************/ | 3632 | /*****************************************************************************/ |
| 2298 | /* Switch commands */ | 3633 | /* Switch commands */ |
| 2299 | 3634 | ||
| 2300 | /* Enable/disable LCD backlight */ | 3635 | /* Enable/disable LCD backlight */ |
| 2301 | #define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x90 | 3636 | #define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x0090 |
| 2302 | 3637 | ||
| 2303 | struct ec_params_switch_enable_backlight { | 3638 | struct ec_params_switch_enable_backlight { |
| 2304 | uint8_t enabled; | 3639 | uint8_t enabled; |
| 2305 | } __packed; | 3640 | } __ec_align1; |
| 2306 | 3641 | ||
| 2307 | /* Enable/disable WLAN/Bluetooth */ | 3642 | /* Enable/disable WLAN/Bluetooth */ |
| 2308 | #define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91 | 3643 | #define EC_CMD_SWITCH_ENABLE_WIRELESS 0x0091 |
| 2309 | #define EC_VER_SWITCH_ENABLE_WIRELESS 1 | 3644 | #define EC_VER_SWITCH_ENABLE_WIRELESS 1 |
| 2310 | 3645 | ||
| 2311 | /* Version 0 params; no response */ | 3646 | /* Version 0 params; no response */ |
| 2312 | struct ec_params_switch_enable_wireless_v0 { | 3647 | struct ec_params_switch_enable_wireless_v0 { |
| 2313 | uint8_t enabled; | 3648 | uint8_t enabled; |
| 2314 | } __packed; | 3649 | } __ec_align1; |
| 2315 | 3650 | ||
| 2316 | /* Version 1 params */ | 3651 | /* Version 1 params */ |
| 2317 | struct ec_params_switch_enable_wireless_v1 { | 3652 | struct ec_params_switch_enable_wireless_v1 { |
| @@ -2330,7 +3665,7 @@ struct ec_params_switch_enable_wireless_v1 { | |||
| 2330 | 3665 | ||
| 2331 | /* Which flags to copy from suspend_flags */ | 3666 | /* Which flags to copy from suspend_flags */ |
| 2332 | uint8_t suspend_mask; | 3667 | uint8_t suspend_mask; |
| 2333 | } __packed; | 3668 | } __ec_align1; |
| 2334 | 3669 | ||
| 2335 | /* Version 1 response */ | 3670 | /* Version 1 response */ |
| 2336 | struct ec_response_switch_enable_wireless_v1 { | 3671 | struct ec_response_switch_enable_wireless_v1 { |
| @@ -2339,55 +3674,56 @@ struct ec_response_switch_enable_wireless_v1 { | |||
| 2339 | 3674 | ||
| 2340 | /* Flags to leave enabled in S3 */ | 3675 | /* Flags to leave enabled in S3 */ |
| 2341 | uint8_t suspend_flags; | 3676 | uint8_t suspend_flags; |
| 2342 | } __packed; | 3677 | } __ec_align1; |
| 2343 | 3678 | ||
| 2344 | /*****************************************************************************/ | 3679 | /*****************************************************************************/ |
| 2345 | /* GPIO commands. Only available on EC if write protect has been disabled. */ | 3680 | /* GPIO commands. Only available on EC if write protect has been disabled. */ |
| 2346 | 3681 | ||
| 2347 | /* Set GPIO output value */ | 3682 | /* Set GPIO output value */ |
| 2348 | #define EC_CMD_GPIO_SET 0x92 | 3683 | #define EC_CMD_GPIO_SET 0x0092 |
| 2349 | 3684 | ||
| 2350 | struct ec_params_gpio_set { | 3685 | struct ec_params_gpio_set { |
| 2351 | char name[32]; | 3686 | char name[32]; |
| 2352 | uint8_t val; | 3687 | uint8_t val; |
| 2353 | } __packed; | 3688 | } __ec_align1; |
| 2354 | 3689 | ||
| 2355 | /* Get GPIO value */ | 3690 | /* Get GPIO value */ |
| 2356 | #define EC_CMD_GPIO_GET 0x93 | 3691 | #define EC_CMD_GPIO_GET 0x0093 |
| 2357 | 3692 | ||
| 2358 | /* Version 0 of input params and response */ | 3693 | /* Version 0 of input params and response */ |
| 2359 | struct ec_params_gpio_get { | 3694 | struct ec_params_gpio_get { |
| 2360 | char name[32]; | 3695 | char name[32]; |
| 2361 | } __packed; | 3696 | } __ec_align1; |
| 3697 | |||
| 2362 | struct ec_response_gpio_get { | 3698 | struct ec_response_gpio_get { |
| 2363 | uint8_t val; | 3699 | uint8_t val; |
| 2364 | } __packed; | 3700 | } __ec_align1; |
| 2365 | 3701 | ||
| 2366 | /* Version 1 of input params and response */ | 3702 | /* Version 1 of input params and response */ |
| 2367 | struct ec_params_gpio_get_v1 { | 3703 | struct ec_params_gpio_get_v1 { |
| 2368 | uint8_t subcmd; | 3704 | uint8_t subcmd; |
| 2369 | union { | 3705 | union { |
| 2370 | struct { | 3706 | struct __ec_align1 { |
| 2371 | char name[32]; | 3707 | char name[32]; |
| 2372 | } get_value_by_name; | 3708 | } get_value_by_name; |
| 2373 | struct { | 3709 | struct __ec_align1 { |
| 2374 | uint8_t index; | 3710 | uint8_t index; |
| 2375 | } get_info; | 3711 | } get_info; |
| 2376 | }; | 3712 | }; |
| 2377 | } __packed; | 3713 | } __ec_align1; |
| 2378 | 3714 | ||
| 2379 | struct ec_response_gpio_get_v1 { | 3715 | struct ec_response_gpio_get_v1 { |
| 2380 | union { | 3716 | union { |
| 2381 | struct { | 3717 | struct __ec_align1 { |
| 2382 | uint8_t val; | 3718 | uint8_t val; |
| 2383 | } get_value_by_name, get_count; | 3719 | } get_value_by_name, get_count; |
| 2384 | struct { | 3720 | struct __ec_todo_unpacked { |
| 2385 | uint8_t val; | 3721 | uint8_t val; |
| 2386 | char name[32]; | 3722 | char name[32]; |
| 2387 | uint32_t flags; | 3723 | uint32_t flags; |
| 2388 | } get_info; | 3724 | } get_info; |
| 2389 | }; | 3725 | }; |
| 2390 | } __packed; | 3726 | } __ec_todo_packed; |
| 2391 | 3727 | ||
| 2392 | enum gpio_get_subcmd { | 3728 | enum gpio_get_subcmd { |
| 2393 | EC_GPIO_GET_BY_NAME = 0, | 3729 | EC_GPIO_GET_BY_NAME = 0, |
| @@ -2399,25 +3735,28 @@ enum gpio_get_subcmd { | |||
| 2399 | /* I2C commands. Only available when flash write protect is unlocked. */ | 3735 | /* I2C commands. Only available when flash write protect is unlocked. */ |
| 2400 | 3736 | ||
| 2401 | /* | 3737 | /* |
| 2402 | * TODO(crosbug.com/p/23570): These commands are deprecated, and will be | 3738 | * CAUTION: These commands are deprecated, and are not supported anymore in EC |
| 2403 | * removed soon. Use EC_CMD_I2C_XFER instead. | 3739 | * builds >= 8398.0.0 (see crosbug.com/p/23570). |
| 3740 | * | ||
| 3741 | * Use EC_CMD_I2C_PASSTHRU instead. | ||
| 2404 | */ | 3742 | */ |
| 2405 | 3743 | ||
| 2406 | /* Read I2C bus */ | 3744 | /* Read I2C bus */ |
| 2407 | #define EC_CMD_I2C_READ 0x94 | 3745 | #define EC_CMD_I2C_READ 0x0094 |
| 2408 | 3746 | ||
| 2409 | struct ec_params_i2c_read { | 3747 | struct ec_params_i2c_read { |
| 2410 | uint16_t addr; /* 8-bit address (7-bit shifted << 1) */ | 3748 | uint16_t addr; /* 8-bit address (7-bit shifted << 1) */ |
| 2411 | uint8_t read_size; /* Either 8 or 16. */ | 3749 | uint8_t read_size; /* Either 8 or 16. */ |
| 2412 | uint8_t port; | 3750 | uint8_t port; |
| 2413 | uint8_t offset; | 3751 | uint8_t offset; |
| 2414 | } __packed; | 3752 | } __ec_align_size1; |
| 3753 | |||
| 2415 | struct ec_response_i2c_read { | 3754 | struct ec_response_i2c_read { |
| 2416 | uint16_t data; | 3755 | uint16_t data; |
| 2417 | } __packed; | 3756 | } __ec_align2; |
| 2418 | 3757 | ||
| 2419 | /* Write I2C bus */ | 3758 | /* Write I2C bus */ |
| 2420 | #define EC_CMD_I2C_WRITE 0x95 | 3759 | #define EC_CMD_I2C_WRITE 0x0095 |
| 2421 | 3760 | ||
| 2422 | struct ec_params_i2c_write { | 3761 | struct ec_params_i2c_write { |
| 2423 | uint16_t data; | 3762 | uint16_t data; |
| @@ -2425,7 +3764,7 @@ struct ec_params_i2c_write { | |||
| 2425 | uint8_t write_size; /* Either 8 or 16. */ | 3764 | uint8_t write_size; /* Either 8 or 16. */ |
| 2426 | uint8_t port; | 3765 | uint8_t port; |
| 2427 | uint8_t offset; | 3766 | uint8_t offset; |
| 2428 | } __packed; | 3767 | } __ec_align_size1; |
| 2429 | 3768 | ||
| 2430 | /*****************************************************************************/ | 3769 | /*****************************************************************************/ |
| 2431 | /* Charge state commands. Only available when flash write protect unlocked. */ | 3770 | /* Charge state commands. Only available when flash write protect unlocked. */ |
| @@ -2433,7 +3772,7 @@ struct ec_params_i2c_write { | |||
| 2433 | /* Force charge state machine to stop charging the battery or force it to | 3772 | /* Force charge state machine to stop charging the battery or force it to |
| 2434 | * discharge the battery. | 3773 | * discharge the battery. |
| 2435 | */ | 3774 | */ |
| 2436 | #define EC_CMD_CHARGE_CONTROL 0x96 | 3775 | #define EC_CMD_CHARGE_CONTROL 0x0096 |
| 2437 | #define EC_VER_CHARGE_CONTROL 1 | 3776 | #define EC_VER_CHARGE_CONTROL 1 |
| 2438 | 3777 | ||
| 2439 | enum ec_charge_control_mode { | 3778 | enum ec_charge_control_mode { |
| @@ -2444,13 +3783,12 @@ enum ec_charge_control_mode { | |||
| 2444 | 3783 | ||
| 2445 | struct ec_params_charge_control { | 3784 | struct ec_params_charge_control { |
| 2446 | uint32_t mode; /* enum charge_control_mode */ | 3785 | uint32_t mode; /* enum charge_control_mode */ |
| 2447 | } __packed; | 3786 | } __ec_align4; |
| 2448 | 3787 | ||
| 2449 | /*****************************************************************************/ | 3788 | /*****************************************************************************/ |
| 2450 | /* Console commands. Only available when flash write protect is unlocked. */ | ||
| 2451 | 3789 | ||
| 2452 | /* Snapshot console output buffer for use by EC_CMD_CONSOLE_READ. */ | 3790 | /* 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 |
| 2454 | 3792 | ||
| 2455 | /* | 3793 | /* |
| 2456 | * Read data from the saved snapshot. If the subcmd parameter is | 3794 | * Read data from the saved snapshot. If the subcmd parameter is |
| @@ -2464,7 +3802,7 @@ struct ec_params_charge_control { | |||
| 2464 | * Response is null-terminated string. Empty string, if there is no more | 3802 | * Response is null-terminated string. Empty string, if there is no more |
| 2465 | * remaining output. | 3803 | * remaining output. |
| 2466 | */ | 3804 | */ |
| 2467 | #define EC_CMD_CONSOLE_READ 0x98 | 3805 | #define EC_CMD_CONSOLE_READ 0x0098 |
| 2468 | 3806 | ||
| 2469 | enum ec_console_read_subcmd { | 3807 | enum ec_console_read_subcmd { |
| 2470 | CONSOLE_READ_NEXT = 0, | 3808 | CONSOLE_READ_NEXT = 0, |
| @@ -2473,7 +3811,7 @@ enum ec_console_read_subcmd { | |||
| 2473 | 3811 | ||
| 2474 | struct ec_params_console_read_v1 { | 3812 | struct ec_params_console_read_v1 { |
| 2475 | uint8_t subcmd; /* enum ec_console_read_subcmd */ | 3813 | uint8_t subcmd; /* enum ec_console_read_subcmd */ |
| 2476 | } __packed; | 3814 | } __ec_align1; |
| 2477 | 3815 | ||
| 2478 | /*****************************************************************************/ | 3816 | /*****************************************************************************/ |
| 2479 | 3817 | ||
| @@ -2484,14 +3822,13 @@ struct ec_params_console_read_v1 { | |||
| 2484 | * EC_RES_SUCCESS if the command was successful. | 3822 | * EC_RES_SUCCESS if the command was successful. |
| 2485 | * EC_RES_ERROR if the cut off command failed. | 3823 | * EC_RES_ERROR if the cut off command failed. |
| 2486 | */ | 3824 | */ |
| 3825 | #define EC_CMD_BATTERY_CUT_OFF 0x0099 | ||
| 2487 | 3826 | ||
| 2488 | #define EC_CMD_BATTERY_CUT_OFF 0x99 | 3827 | #define EC_BATTERY_CUTOFF_FLAG_AT_SHUTDOWN BIT(0) |
| 2489 | |||
| 2490 | #define EC_BATTERY_CUTOFF_FLAG_AT_SHUTDOWN (1 << 0) | ||
| 2491 | 3828 | ||
| 2492 | struct ec_params_battery_cutoff { | 3829 | struct ec_params_battery_cutoff { |
| 2493 | uint8_t flags; | 3830 | uint8_t flags; |
| 2494 | } __packed; | 3831 | } __ec_align1; |
| 2495 | 3832 | ||
| 2496 | /*****************************************************************************/ | 3833 | /*****************************************************************************/ |
| 2497 | /* USB port mux control. */ | 3834 | /* USB port mux control. */ |
| @@ -2499,11 +3836,11 @@ struct ec_params_battery_cutoff { | |||
| 2499 | /* | 3836 | /* |
| 2500 | * Switch USB mux or return to automatic switching. | 3837 | * Switch USB mux or return to automatic switching. |
| 2501 | */ | 3838 | */ |
| 2502 | #define EC_CMD_USB_MUX 0x9a | 3839 | #define EC_CMD_USB_MUX 0x009A |
| 2503 | 3840 | ||
| 2504 | struct ec_params_usb_mux { | 3841 | struct ec_params_usb_mux { |
| 2505 | uint8_t mux; | 3842 | uint8_t mux; |
| 2506 | } __packed; | 3843 | } __ec_align1; |
| 2507 | 3844 | ||
| 2508 | /*****************************************************************************/ | 3845 | /*****************************************************************************/ |
| 2509 | /* LDOs / FETs control. */ | 3846 | /* LDOs / FETs control. */ |
| @@ -2516,25 +3853,25 @@ enum ec_ldo_state { | |||
| 2516 | /* | 3853 | /* |
| 2517 | * Switch on/off a LDO. | 3854 | * Switch on/off a LDO. |
| 2518 | */ | 3855 | */ |
| 2519 | #define EC_CMD_LDO_SET 0x9b | 3856 | #define EC_CMD_LDO_SET 0x009B |
| 2520 | 3857 | ||
| 2521 | struct ec_params_ldo_set { | 3858 | struct ec_params_ldo_set { |
| 2522 | uint8_t index; | 3859 | uint8_t index; |
| 2523 | uint8_t state; | 3860 | uint8_t state; |
| 2524 | } __packed; | 3861 | } __ec_align1; |
| 2525 | 3862 | ||
| 2526 | /* | 3863 | /* |
| 2527 | * Get LDO state. | 3864 | * Get LDO state. |
| 2528 | */ | 3865 | */ |
| 2529 | #define EC_CMD_LDO_GET 0x9c | 3866 | #define EC_CMD_LDO_GET 0x009C |
| 2530 | 3867 | ||
| 2531 | struct ec_params_ldo_get { | 3868 | struct ec_params_ldo_get { |
| 2532 | uint8_t index; | 3869 | uint8_t index; |
| 2533 | } __packed; | 3870 | } __ec_align1; |
| 2534 | 3871 | ||
| 2535 | struct ec_response_ldo_get { | 3872 | struct ec_response_ldo_get { |
| 2536 | uint8_t state; | 3873 | uint8_t state; |
| 2537 | } __packed; | 3874 | } __ec_align1; |
| 2538 | 3875 | ||
| 2539 | /*****************************************************************************/ | 3876 | /*****************************************************************************/ |
| 2540 | /* Power info. */ | 3877 | /* Power info. */ |
| @@ -2542,7 +3879,7 @@ struct ec_response_ldo_get { | |||
| 2542 | /* | 3879 | /* |
| 2543 | * Get power info. | 3880 | * Get power info. |
| 2544 | */ | 3881 | */ |
| 2545 | #define EC_CMD_POWER_INFO 0x9d | 3882 | #define EC_CMD_POWER_INFO 0x009D |
| 2546 | 3883 | ||
| 2547 | struct ec_response_power_info { | 3884 | struct ec_response_power_info { |
| 2548 | uint32_t usb_dev_type; | 3885 | uint32_t usb_dev_type; |
| @@ -2550,21 +3887,21 @@ struct ec_response_power_info { | |||
| 2550 | uint16_t voltage_system; | 3887 | uint16_t voltage_system; |
| 2551 | uint16_t current_system; | 3888 | uint16_t current_system; |
| 2552 | uint16_t usb_current_limit; | 3889 | uint16_t usb_current_limit; |
| 2553 | } __packed; | 3890 | } __ec_align4; |
| 2554 | 3891 | ||
| 2555 | /*****************************************************************************/ | 3892 | /*****************************************************************************/ |
| 2556 | /* I2C passthru command */ | 3893 | /* I2C passthru command */ |
| 2557 | 3894 | ||
| 2558 | #define EC_CMD_I2C_PASSTHRU 0x9e | 3895 | #define EC_CMD_I2C_PASSTHRU 0x009E |
| 2559 | 3896 | ||
| 2560 | /* Read data; if not present, message is a write */ | 3897 | /* 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) |
| 2562 | 3899 | ||
| 2563 | /* Mask for address */ | 3900 | /* Mask for address */ |
| 2564 | #define EC_I2C_ADDR_MASK 0x3ff | 3901 | #define EC_I2C_ADDR_MASK 0x3ff |
| 2565 | 3902 | ||
| 2566 | #define EC_I2C_STATUS_NAK (1 << 0) /* Transfer was not acknowledged */ | 3903 | #define EC_I2C_STATUS_NAK BIT(0) /* Transfer was not acknowledged */ |
| 2567 | #define EC_I2C_STATUS_TIMEOUT (1 << 1) /* Timeout during transfer */ | 3904 | #define EC_I2C_STATUS_TIMEOUT BIT(1) /* Timeout during transfer */ |
| 2568 | 3905 | ||
| 2569 | /* Any error */ | 3906 | /* Any error */ |
| 2570 | #define EC_I2C_STATUS_ERROR (EC_I2C_STATUS_NAK | EC_I2C_STATUS_TIMEOUT) | 3907 | #define EC_I2C_STATUS_ERROR (EC_I2C_STATUS_NAK | EC_I2C_STATUS_TIMEOUT) |
| @@ -2572,49 +3909,49 @@ struct ec_response_power_info { | |||
| 2572 | struct ec_params_i2c_passthru_msg { | 3909 | struct ec_params_i2c_passthru_msg { |
| 2573 | uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */ | 3910 | uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */ |
| 2574 | uint16_t len; /* Number of bytes to read or write */ | 3911 | uint16_t len; /* Number of bytes to read or write */ |
| 2575 | } __packed; | 3912 | } __ec_align2; |
| 2576 | 3913 | ||
| 2577 | struct ec_params_i2c_passthru { | 3914 | struct ec_params_i2c_passthru { |
| 2578 | uint8_t port; /* I2C port number */ | 3915 | uint8_t port; /* I2C port number */ |
| 2579 | uint8_t num_msgs; /* Number of messages */ | 3916 | uint8_t num_msgs; /* Number of messages */ |
| 2580 | struct ec_params_i2c_passthru_msg msg[]; | 3917 | struct ec_params_i2c_passthru_msg msg[]; |
| 2581 | /* Data to write for all messages is concatenated here */ | 3918 | /* Data to write for all messages is concatenated here */ |
| 2582 | } __packed; | 3919 | } __ec_align2; |
| 2583 | 3920 | ||
| 2584 | struct ec_response_i2c_passthru { | 3921 | struct ec_response_i2c_passthru { |
| 2585 | uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */ | 3922 | uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */ |
| 2586 | uint8_t num_msgs; /* Number of messages processed */ | 3923 | uint8_t num_msgs; /* Number of messages processed */ |
| 2587 | uint8_t data[]; /* Data read by messages concatenated here */ | 3924 | uint8_t data[]; /* Data read by messages concatenated here */ |
| 2588 | } __packed; | 3925 | } __ec_align1; |
| 2589 | 3926 | ||
| 2590 | /*****************************************************************************/ | 3927 | /*****************************************************************************/ |
| 2591 | /* Power button hang detect */ | 3928 | /* Power button hang detect */ |
| 2592 | 3929 | ||
| 2593 | #define EC_CMD_HANG_DETECT 0x9f | 3930 | #define EC_CMD_HANG_DETECT 0x009F |
| 2594 | 3931 | ||
| 2595 | /* Reasons to start hang detection timer */ | 3932 | /* Reasons to start hang detection timer */ |
| 2596 | /* Power button pressed */ | 3933 | /* Power button pressed */ |
| 2597 | #define EC_HANG_START_ON_POWER_PRESS (1 << 0) | 3934 | #define EC_HANG_START_ON_POWER_PRESS BIT(0) |
| 2598 | 3935 | ||
| 2599 | /* Lid closed */ | 3936 | /* Lid closed */ |
| 2600 | #define EC_HANG_START_ON_LID_CLOSE (1 << 1) | 3937 | #define EC_HANG_START_ON_LID_CLOSE BIT(1) |
| 2601 | 3938 | ||
| 2602 | /* Lid opened */ | 3939 | /* Lid opened */ |
| 2603 | #define EC_HANG_START_ON_LID_OPEN (1 << 2) | 3940 | #define EC_HANG_START_ON_LID_OPEN BIT(2) |
| 2604 | 3941 | ||
| 2605 | /* Start of AP S3->S0 transition (booting or resuming from suspend) */ | 3942 | /* 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) |
| 2607 | 3944 | ||
| 2608 | /* Reasons to cancel hang detection */ | 3945 | /* Reasons to cancel hang detection */ |
| 2609 | 3946 | ||
| 2610 | /* Power button released */ | 3947 | /* Power button released */ |
| 2611 | #define EC_HANG_STOP_ON_POWER_RELEASE (1 << 8) | 3948 | #define EC_HANG_STOP_ON_POWER_RELEASE BIT(8) |
| 2612 | 3949 | ||
| 2613 | /* Any host command from AP received */ | 3950 | /* 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) |
| 2615 | 3952 | ||
| 2616 | /* Stop on end of AP S0->S3 transition (suspending or shutting down) */ | 3953 | /* 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) |
| 2618 | 3955 | ||
| 2619 | /* | 3956 | /* |
| 2620 | * If this flag is set, all the other fields are ignored, and the hang detect | 3957 | * If this flag is set, all the other fields are ignored, and the hang detect |
| @@ -2622,14 +3959,14 @@ struct ec_response_i2c_passthru { | |||
| 2622 | * without reconfiguring any of the other hang detect settings. Note that | 3959 | * without reconfiguring any of the other hang detect settings. Note that |
| 2623 | * you must previously have configured the timeouts. | 3960 | * you must previously have configured the timeouts. |
| 2624 | */ | 3961 | */ |
| 2625 | #define EC_HANG_START_NOW (1 << 30) | 3962 | #define EC_HANG_START_NOW BIT(30) |
| 2626 | 3963 | ||
| 2627 | /* | 3964 | /* |
| 2628 | * If this flag is set, all the other fields are ignored (including | 3965 | * If this flag is set, all the other fields are ignored (including |
| 2629 | * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer | 3966 | * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer |
| 2630 | * without reconfiguring any of the other hang detect settings. | 3967 | * without reconfiguring any of the other hang detect settings. |
| 2631 | */ | 3968 | */ |
| 2632 | #define EC_HANG_STOP_NOW (1 << 31) | 3969 | #define EC_HANG_STOP_NOW BIT(31) |
| 2633 | 3970 | ||
| 2634 | struct ec_params_hang_detect { | 3971 | struct ec_params_hang_detect { |
| 2635 | /* Flags; see EC_HANG_* */ | 3972 | /* Flags; see EC_HANG_* */ |
| @@ -2640,7 +3977,7 @@ struct ec_params_hang_detect { | |||
| 2640 | 3977 | ||
| 2641 | /* Timeout in msec before generating warm reboot, if enabled */ | 3978 | /* Timeout in msec before generating warm reboot, if enabled */ |
| 2642 | uint16_t warm_reboot_timeout_msec; | 3979 | uint16_t warm_reboot_timeout_msec; |
| 2643 | } __packed; | 3980 | } __ec_align4; |
| 2644 | 3981 | ||
| 2645 | /*****************************************************************************/ | 3982 | /*****************************************************************************/ |
| 2646 | /* Commands for battery charging */ | 3983 | /* Commands for battery charging */ |
| @@ -2649,7 +3986,7 @@ struct ec_params_hang_detect { | |||
| 2649 | * This is the single catch-all host command to exchange data regarding the | 3986 | * This is the single catch-all host command to exchange data regarding the |
| 2650 | * charge state machine (v2 and up). | 3987 | * charge state machine (v2 and up). |
| 2651 | */ | 3988 | */ |
| 2652 | #define EC_CMD_CHARGE_STATE 0xa0 | 3989 | #define EC_CMD_CHARGE_STATE 0x00A0 |
| 2653 | 3990 | ||
| 2654 | /* Subcommands for this host command */ | 3991 | /* Subcommands for this host command */ |
| 2655 | enum charge_state_command { | 3992 | enum charge_state_command { |
| @@ -2669,6 +4006,11 @@ enum charge_state_params { | |||
| 2669 | CS_PARAM_CHG_INPUT_CURRENT, /* charger input current limit */ | 4006 | CS_PARAM_CHG_INPUT_CURRENT, /* charger input current limit */ |
| 2670 | CS_PARAM_CHG_STATUS, /* charger-specific status */ | 4007 | CS_PARAM_CHG_STATUS, /* charger-specific status */ |
| 2671 | CS_PARAM_CHG_OPTION, /* charger-specific options */ | 4008 | 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 | */ | ||
| 2672 | /* How many so far? */ | 4014 | /* How many so far? */ |
| 2673 | CS_NUM_BASE_PARAMS, | 4015 | CS_NUM_BASE_PARAMS, |
| 2674 | 4016 | ||
| @@ -2676,30 +4018,39 @@ enum charge_state_params { | |||
| 2676 | CS_PARAM_CUSTOM_PROFILE_MIN = 0x10000, | 4018 | CS_PARAM_CUSTOM_PROFILE_MIN = 0x10000, |
| 2677 | CS_PARAM_CUSTOM_PROFILE_MAX = 0x1ffff, | 4019 | CS_PARAM_CUSTOM_PROFILE_MAX = 0x1ffff, |
| 2678 | 4020 | ||
| 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 | |||
| 2679 | /* Other custom param ranges go here... */ | 4032 | /* Other custom param ranges go here... */ |
| 2680 | }; | 4033 | }; |
| 2681 | 4034 | ||
| 2682 | struct ec_params_charge_state { | 4035 | struct ec_params_charge_state { |
| 2683 | uint8_t cmd; /* enum charge_state_command */ | 4036 | uint8_t cmd; /* enum charge_state_command */ |
| 2684 | union { | 4037 | union { |
| 2685 | struct { | 4038 | /* get_state has no args */ |
| 2686 | /* no args */ | ||
| 2687 | } get_state; | ||
| 2688 | 4039 | ||
| 2689 | struct { | 4040 | struct __ec_todo_unpacked { |
| 2690 | uint32_t param; /* enum charge_state_param */ | 4041 | uint32_t param; /* enum charge_state_param */ |
| 2691 | } get_param; | 4042 | } get_param; |
| 2692 | 4043 | ||
| 2693 | struct { | 4044 | struct __ec_todo_unpacked { |
| 2694 | uint32_t param; /* param to set */ | 4045 | uint32_t param; /* param to set */ |
| 2695 | uint32_t value; /* value to set */ | 4046 | uint32_t value; /* value to set */ |
| 2696 | } set_param; | 4047 | } set_param; |
| 2697 | }; | 4048 | }; |
| 2698 | } __packed; | 4049 | } __ec_todo_packed; |
| 2699 | 4050 | ||
| 2700 | struct ec_response_charge_state { | 4051 | struct ec_response_charge_state { |
| 2701 | union { | 4052 | union { |
| 2702 | struct { | 4053 | struct __ec_align4 { |
| 2703 | int ac; | 4054 | int ac; |
| 2704 | int chg_voltage; | 4055 | int chg_voltage; |
| 2705 | int chg_current; | 4056 | int chg_current; |
| @@ -2707,24 +4058,23 @@ struct ec_response_charge_state { | |||
| 2707 | int batt_state_of_charge; | 4058 | int batt_state_of_charge; |
| 2708 | } get_state; | 4059 | } get_state; |
| 2709 | 4060 | ||
| 2710 | struct { | 4061 | struct __ec_align4 { |
| 2711 | uint32_t value; | 4062 | uint32_t value; |
| 2712 | } get_param; | 4063 | } get_param; |
| 2713 | struct { | 4064 | |
| 2714 | /* no return values */ | 4065 | /* set_param returns no args */ |
| 2715 | } set_param; | ||
| 2716 | }; | 4066 | }; |
| 2717 | } __packed; | 4067 | } __ec_align4; |
| 2718 | 4068 | ||
| 2719 | 4069 | ||
| 2720 | /* | 4070 | /* |
| 2721 | * Set maximum battery charging current. | 4071 | * Set maximum battery charging current. |
| 2722 | */ | 4072 | */ |
| 2723 | #define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1 | 4073 | #define EC_CMD_CHARGE_CURRENT_LIMIT 0x00A1 |
| 2724 | 4074 | ||
| 2725 | struct ec_params_current_limit { | 4075 | struct ec_params_current_limit { |
| 2726 | uint32_t limit; /* in mA */ | 4076 | uint32_t limit; /* in mA */ |
| 2727 | } __packed; | 4077 | } __ec_align4; |
| 2728 | 4078 | ||
| 2729 | /* | 4079 | /* |
| 2730 | * Set maximum external voltage / current. | 4080 | * Set maximum external voltage / current. |
| @@ -2735,23 +4085,69 @@ struct ec_params_current_limit { | |||
| 2735 | struct ec_params_external_power_limit_v1 { | 4085 | struct ec_params_external_power_limit_v1 { |
| 2736 | uint16_t current_lim; /* in mA, or EC_POWER_LIMIT_NONE to clear limit */ | 4086 | uint16_t current_lim; /* in mA, or EC_POWER_LIMIT_NONE to clear limit */ |
| 2737 | uint16_t voltage_lim; /* in mV, or EC_POWER_LIMIT_NONE to clear limit */ | 4087 | uint16_t voltage_lim; /* in mV, or EC_POWER_LIMIT_NONE to clear limit */ |
| 2738 | } __packed; | 4088 | } __ec_align2; |
| 2739 | 4089 | ||
| 2740 | #define EC_POWER_LIMIT_NONE 0xffff | 4090 | #define EC_POWER_LIMIT_NONE 0xffff |
| 2741 | 4091 | ||
| 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 | |||
| 2742 | /* Inform the EC when entering a sleep state */ | 4136 | /* Inform the EC when entering a sleep state */ |
| 2743 | #define EC_CMD_HOST_SLEEP_EVENT 0xa9 | 4137 | #define EC_CMD_HOST_SLEEP_EVENT 0x00A9 |
| 2744 | 4138 | ||
| 2745 | enum host_sleep_event { | 4139 | enum host_sleep_event { |
| 2746 | HOST_SLEEP_EVENT_S3_SUSPEND = 1, | 4140 | HOST_SLEEP_EVENT_S3_SUSPEND = 1, |
| 2747 | HOST_SLEEP_EVENT_S3_RESUME = 2, | 4141 | HOST_SLEEP_EVENT_S3_RESUME = 2, |
| 2748 | HOST_SLEEP_EVENT_S0IX_SUSPEND = 3, | 4142 | 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, | ||
| 2750 | }; | 4146 | }; |
| 2751 | 4147 | ||
| 2752 | struct ec_params_host_sleep_event { | 4148 | struct ec_params_host_sleep_event { |
| 2753 | uint8_t sleep_event; | 4149 | uint8_t sleep_event; |
| 2754 | } __packed; | 4150 | } __ec_align1; |
| 2755 | 4151 | ||
| 2756 | /* | 4152 | /* |
| 2757 | * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep | 4153 | * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep |
| @@ -2782,7 +4178,7 @@ struct ec_params_host_sleep_event_v1 { | |||
| 2782 | 4178 | ||
| 2783 | /* No parameters for non-suspend messages. */ | 4179 | /* No parameters for non-suspend messages. */ |
| 2784 | }; | 4180 | }; |
| 2785 | } __packed; | 4181 | } __ec_align2; |
| 2786 | 4182 | ||
| 2787 | /* A timeout occurred when this bit is set */ | 4183 | /* A timeout occurred when this bit is set */ |
| 2788 | #define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000 | 4184 | #define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000 |
| @@ -2808,42 +4204,72 @@ struct ec_response_host_sleep_event_v1 { | |||
| 2808 | 4204 | ||
| 2809 | /* No response fields for non-resume messages. */ | 4205 | /* No response fields for non-resume messages. */ |
| 2810 | }; | 4206 | }; |
| 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; | ||
| 2812 | 4238 | ||
| 2813 | /*****************************************************************************/ | 4239 | /*****************************************************************************/ |
| 2814 | /* Smart battery pass-through */ | 4240 | /* Smart battery pass-through */ |
| 2815 | 4241 | ||
| 2816 | /* Get / Set 16-bit smart battery registers */ | 4242 | /* Get / Set 16-bit smart battery registers */ |
| 2817 | #define EC_CMD_SB_READ_WORD 0xb0 | 4243 | #define EC_CMD_SB_READ_WORD 0x00B0 |
| 2818 | #define EC_CMD_SB_WRITE_WORD 0xb1 | 4244 | #define EC_CMD_SB_WRITE_WORD 0x00B1 |
| 2819 | 4245 | ||
| 2820 | /* Get / Set string smart battery parameters | 4246 | /* Get / Set string smart battery parameters |
| 2821 | * formatted as SMBUS "block". | 4247 | * formatted as SMBUS "block". |
| 2822 | */ | 4248 | */ |
| 2823 | #define EC_CMD_SB_READ_BLOCK 0xb2 | 4249 | #define EC_CMD_SB_READ_BLOCK 0x00B2 |
| 2824 | #define EC_CMD_SB_WRITE_BLOCK 0xb3 | 4250 | #define EC_CMD_SB_WRITE_BLOCK 0x00B3 |
| 2825 | 4251 | ||
| 2826 | struct ec_params_sb_rd { | 4252 | struct ec_params_sb_rd { |
| 2827 | uint8_t reg; | 4253 | uint8_t reg; |
| 2828 | } __packed; | 4254 | } __ec_align1; |
| 2829 | 4255 | ||
| 2830 | struct ec_response_sb_rd_word { | 4256 | struct ec_response_sb_rd_word { |
| 2831 | uint16_t value; | 4257 | uint16_t value; |
| 2832 | } __packed; | 4258 | } __ec_align2; |
| 2833 | 4259 | ||
| 2834 | struct ec_params_sb_wr_word { | 4260 | struct ec_params_sb_wr_word { |
| 2835 | uint8_t reg; | 4261 | uint8_t reg; |
| 2836 | uint16_t value; | 4262 | uint16_t value; |
| 2837 | } __packed; | 4263 | } __ec_align1; |
| 2838 | 4264 | ||
| 2839 | struct ec_response_sb_rd_block { | 4265 | struct ec_response_sb_rd_block { |
| 2840 | uint8_t data[32]; | 4266 | uint8_t data[32]; |
| 2841 | } __packed; | 4267 | } __ec_align1; |
| 2842 | 4268 | ||
| 2843 | struct ec_params_sb_wr_block { | 4269 | struct ec_params_sb_wr_block { |
| 2844 | uint8_t reg; | 4270 | uint8_t reg; |
| 2845 | uint16_t data[32]; | 4271 | uint16_t data[32]; |
| 2846 | } __packed; | 4272 | } __ec_align1; |
| 2847 | 4273 | ||
| 2848 | /*****************************************************************************/ | 4274 | /*****************************************************************************/ |
| 2849 | /* Battery vendor parameters | 4275 | /* Battery vendor parameters |
| @@ -2854,7 +4280,7 @@ struct ec_params_sb_wr_block { | |||
| 2854 | * requested value. | 4280 | * requested value. |
| 2855 | */ | 4281 | */ |
| 2856 | 4282 | ||
| 2857 | #define EC_CMD_BATTERY_VENDOR_PARAM 0xb4 | 4283 | #define EC_CMD_BATTERY_VENDOR_PARAM 0x00B4 |
| 2858 | 4284 | ||
| 2859 | enum ec_battery_vendor_param_mode { | 4285 | enum ec_battery_vendor_param_mode { |
| 2860 | BATTERY_VENDOR_PARAM_MODE_GET = 0, | 4286 | BATTERY_VENDOR_PARAM_MODE_GET = 0, |
| @@ -2865,16 +4291,187 @@ struct ec_params_battery_vendor_param { | |||
| 2865 | uint32_t param; | 4291 | uint32_t param; |
| 2866 | uint32_t value; | 4292 | uint32_t value; |
| 2867 | uint8_t mode; | 4293 | uint8_t mode; |
| 2868 | } __packed; | 4294 | } __ec_align_size1; |
| 2869 | 4295 | ||
| 2870 | struct ec_response_battery_vendor_param { | 4296 | struct ec_response_battery_vendor_param { |
| 2871 | uint32_t value; | 4297 | uint32_t value; |
| 2872 | } __packed; | 4298 | } __ec_align4; |
| 4299 | |||
| 4300 | /*****************************************************************************/ | ||
| 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, | ||
| 4315 | }; | ||
| 4316 | |||
| 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 | ||
| 4320 | |||
| 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; | ||
| 4325 | |||
| 4326 | struct ec_params_sb_fw_update { | ||
| 4327 | struct ec_sb_fw_update_header hdr; | ||
| 4328 | union { | ||
| 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; | ||
| 4343 | |||
| 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; | ||
| 4350 | |||
| 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; | ||
| 4357 | |||
| 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 | ||
| 4364 | |||
| 4365 | struct ec_params_entering_mode { | ||
| 4366 | int vboot_mode; | ||
| 4367 | } __ec_align4; | ||
| 4368 | |||
| 4369 | #define VBOOT_MODE_NORMAL 0 | ||
| 4370 | #define VBOOT_MODE_DEVELOPER 1 | ||
| 4371 | #define VBOOT_MODE_RECOVERY 2 | ||
| 4372 | |||
| 4373 | /*****************************************************************************/ | ||
| 4374 | /* | ||
| 4375 | * I2C passthru protection command: Protects I2C tunnels against access on | ||
| 4376 | * certain addresses (board-specific). | ||
| 4377 | */ | ||
| 4378 | #define EC_CMD_I2C_PASSTHRU_PROTECT 0x00B7 | ||
| 4379 | |||
| 4380 | enum ec_i2c_passthru_protect_subcmd { | ||
| 4381 | EC_CMD_I2C_PASSTHRU_PROTECT_STATUS = 0x0, | ||
| 4382 | EC_CMD_I2C_PASSTHRU_PROTECT_ENABLE = 0x1, | ||
| 4383 | }; | ||
| 4384 | |||
| 4385 | struct ec_params_i2c_passthru_protect { | ||
| 4386 | uint8_t subcmd; | ||
| 4387 | uint8_t port; /* I2C port number */ | ||
| 4388 | } __ec_align1; | ||
| 4389 | |||
| 4390 | struct ec_response_i2c_passthru_protect { | ||
| 4391 | uint8_t status; /* Status flags (0: unlocked, 1: locked) */ | ||
| 4392 | } __ec_align1; | ||
| 4393 | |||
| 4394 | |||
| 4395 | /*****************************************************************************/ | ||
| 4396 | /* | ||
| 4397 | * HDMI CEC commands | ||
| 4398 | * | ||
| 4399 | * These commands are for sending and receiving message via HDMI CEC | ||
| 4400 | */ | ||
| 4401 | |||
| 4402 | #define MAX_CEC_MSG_LEN 16 | ||
| 4403 | |||
| 4404 | /* CEC message from the AP to be written on the CEC bus */ | ||
| 4405 | #define EC_CMD_CEC_WRITE_MSG 0x00B8 | ||
| 4406 | |||
| 4407 | /** | ||
| 4408 | * struct ec_params_cec_write - Message to write to the CEC bus | ||
| 4409 | * @msg: message content to write to the CEC bus | ||
| 4410 | */ | ||
| 4411 | struct ec_params_cec_write { | ||
| 4412 | uint8_t msg[MAX_CEC_MSG_LEN]; | ||
| 4413 | } __ec_align1; | ||
| 4414 | |||
| 4415 | /* Set various CEC parameters */ | ||
| 4416 | #define EC_CMD_CEC_SET 0x00BA | ||
| 4417 | |||
| 4418 | /** | ||
| 4419 | * struct ec_params_cec_set - CEC parameters set | ||
| 4420 | * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS | ||
| 4421 | * @val: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC | ||
| 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 | ||
| 4425 | */ | ||
| 4426 | struct ec_params_cec_set { | ||
| 4427 | uint8_t cmd; /* enum cec_command */ | ||
| 4428 | uint8_t val; | ||
| 4429 | } __ec_align1; | ||
| 4430 | |||
| 4431 | /* Read various CEC parameters */ | ||
| 4432 | #define EC_CMD_CEC_GET 0x00BB | ||
| 4433 | |||
| 4434 | /** | ||
| 4435 | * struct ec_params_cec_get - CEC parameters get | ||
| 4436 | * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS | ||
| 4437 | */ | ||
| 4438 | struct ec_params_cec_get { | ||
| 4439 | uint8_t cmd; /* enum cec_command */ | ||
| 4440 | } __ec_align1; | ||
| 4441 | |||
| 4442 | /** | ||
| 4443 | * struct ec_response_cec_get - CEC parameters get response | ||
| 4444 | * @val: in case cmd was CEC_CMD_ENABLE, this field will 0 if CEC is | ||
| 4445 | * disabled or 1 if CEC functionality is enabled, | ||
| 4446 | * in case cmd was CEC_CMD_LOGICAL_ADDRESS, this will encode the | ||
| 4447 | * configured logical address between 0 and 15 or 0xff if unregistered | ||
| 4448 | */ | ||
| 4449 | struct ec_response_cec_get { | ||
| 4450 | uint8_t val; | ||
| 4451 | } __ec_align1; | ||
| 4452 | |||
| 4453 | /* CEC parameters command */ | ||
| 4454 | enum cec_command { | ||
| 4455 | /* CEC reading, writing and events enable */ | ||
| 4456 | CEC_CMD_ENABLE, | ||
| 4457 | /* CEC logical address */ | ||
| 4458 | CEC_CMD_LOGICAL_ADDRESS, | ||
| 4459 | }; | ||
| 4460 | |||
| 4461 | /* Events from CEC to AP */ | ||
| 4462 | enum mkbp_cec_event { | ||
| 4463 | /* Outgoing message was acknowledged by a follower */ | ||
| 4464 | EC_MKBP_CEC_SEND_OK = BIT(0), | ||
| 4465 | /* Outgoing message was not acknowledged */ | ||
| 4466 | EC_MKBP_CEC_SEND_FAILED = BIT(1), | ||
| 4467 | }; | ||
| 2873 | 4468 | ||
| 2874 | /*****************************************************************************/ | 4469 | /*****************************************************************************/ |
| 4470 | |||
| 2875 | /* Commands for I2S recording on audio codec. */ | 4471 | /* Commands for I2S recording on audio codec. */ |
| 2876 | 4472 | ||
| 2877 | #define EC_CMD_CODEC_I2S 0x00BC | 4473 | #define EC_CMD_CODEC_I2S 0x00BC |
| 4474 | #define EC_WOV_I2S_SAMPLE_RATE 48000 | ||
| 2878 | 4475 | ||
| 2879 | enum ec_codec_i2s_subcmd { | 4476 | enum ec_codec_i2s_subcmd { |
| 2880 | EC_CODEC_SET_SAMPLE_DEPTH = 0x0, | 4477 | EC_CODEC_SET_SAMPLE_DEPTH = 0x0, |
| @@ -2884,6 +4481,7 @@ enum ec_codec_i2s_subcmd { | |||
| 2884 | EC_CODEC_I2S_SET_CONFIG = 0x4, | 4481 | EC_CODEC_I2S_SET_CONFIG = 0x4, |
| 2885 | EC_CODEC_I2S_SET_TDM_CONFIG = 0x5, | 4482 | EC_CODEC_I2S_SET_TDM_CONFIG = 0x5, |
| 2886 | EC_CODEC_I2S_SET_BCLK = 0x6, | 4483 | EC_CODEC_I2S_SET_BCLK = 0x6, |
| 4484 | EC_CODEC_I2S_SUBCMD_COUNT = 0x7, | ||
| 2887 | }; | 4485 | }; |
| 2888 | 4486 | ||
| 2889 | enum ec_sample_depth_value { | 4487 | enum ec_sample_depth_value { |
| @@ -2900,10 +4498,23 @@ enum ec_i2s_config { | |||
| 2900 | EC_DAI_FMT_PCM_TDM = 5, | 4498 | EC_DAI_FMT_PCM_TDM = 5, |
| 2901 | }; | 4499 | }; |
| 2902 | 4500 | ||
| 2903 | struct ec_param_codec_i2s { | 4501 | /* |
| 2904 | /* | 4502 | * For subcommand EC_CODEC_GET_GAIN. |
| 2905 | * enum ec_codec_i2s_subcmd | 4503 | */ |
| 2906 | */ | 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 */ | ||
| 2907 | uint8_t cmd; | 4518 | uint8_t cmd; |
| 2908 | union { | 4519 | union { |
| 2909 | /* | 4520 | /* |
| @@ -2916,10 +4527,7 @@ struct ec_param_codec_i2s { | |||
| 2916 | * EC_CODEC_SET_GAIN | 4527 | * EC_CODEC_SET_GAIN |
| 2917 | * Value should be 0~43 for both channels. | 4528 | * Value should be 0~43 for both channels. |
| 2918 | */ | 4529 | */ |
| 2919 | struct ec_param_codec_i2s_set_gain { | 4530 | struct ec_codec_i2s_gain gain; |
| 2920 | uint8_t left; | ||
| 2921 | uint8_t right; | ||
| 2922 | } __packed gain; | ||
| 2923 | 4531 | ||
| 2924 | /* | 4532 | /* |
| 2925 | * EC_CODEC_I2S_ENABLE | 4533 | * EC_CODEC_I2S_ENABLE |
| @@ -2928,7 +4536,7 @@ struct ec_param_codec_i2s { | |||
| 2928 | uint8_t i2s_enable; | 4536 | uint8_t i2s_enable; |
| 2929 | 4537 | ||
| 2930 | /* | 4538 | /* |
| 2931 | * EC_CODEC_I2S_SET_COFNIG | 4539 | * EC_CODEC_I2S_SET_CONFIG |
| 2932 | * Value should be one of ec_i2s_config. | 4540 | * Value should be one of ec_i2s_config. |
| 2933 | */ | 4541 | */ |
| 2934 | uint8_t i2s_config; | 4542 | uint8_t i2s_config; |
| @@ -2937,33 +4545,15 @@ struct ec_param_codec_i2s { | |||
| 2937 | * EC_CODEC_I2S_SET_TDM_CONFIG | 4545 | * EC_CODEC_I2S_SET_TDM_CONFIG |
| 2938 | * Value should be one of ec_i2s_config. | 4546 | * Value should be one of ec_i2s_config. |
| 2939 | */ | 4547 | */ |
| 2940 | struct ec_param_codec_i2s_tdm { | 4548 | struct ec_param_codec_i2s_tdm tdm_param; |
| 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; | ||
| 2952 | 4549 | ||
| 2953 | /* | 4550 | /* |
| 2954 | * EC_CODEC_I2S_SET_BCLK | 4551 | * EC_CODEC_I2S_SET_BCLK |
| 2955 | */ | 4552 | */ |
| 2956 | uint32_t bclk; | 4553 | uint32_t bclk; |
| 2957 | }; | 4554 | }; |
| 2958 | } __packed; | 4555 | }; |
| 2959 | 4556 | ||
| 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; | ||
| 2967 | 4557 | ||
| 2968 | /*****************************************************************************/ | 4558 | /*****************************************************************************/ |
| 2969 | /* System commands */ | 4559 | /* System commands */ |
| @@ -2972,27 +4562,29 @@ struct ec_response_codec_gain { | |||
| 2972 | * TODO(crosbug.com/p/23747): This is a confusing name, since it doesn't | 4562 | * 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? | 4563 | * necessarily reboot the EC. Rename to "image" or something similar? |
| 2974 | */ | 4564 | */ |
| 2975 | #define EC_CMD_REBOOT_EC 0xd2 | 4565 | #define EC_CMD_REBOOT_EC 0x00D2 |
| 2976 | 4566 | ||
| 2977 | /* Command */ | 4567 | /* Command */ |
| 2978 | enum ec_reboot_cmd { | 4568 | enum ec_reboot_cmd { |
| 2979 | EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */ | 4569 | EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */ |
| 2980 | EC_REBOOT_JUMP_RO = 1, /* Jump to RO without rebooting */ | 4570 | EC_REBOOT_JUMP_RO = 1, /* Jump to RO without rebooting */ |
| 2981 | EC_REBOOT_JUMP_RW = 2, /* Jump to RW without rebooting */ | 4571 | EC_REBOOT_JUMP_RW = 2, /* Jump to active RW without rebooting */ |
| 2982 | /* (command 3 was jump to RW-B) */ | 4572 | /* (command 3 was jump to RW-B) */ |
| 2983 | EC_REBOOT_COLD = 4, /* Cold-reboot */ | 4573 | EC_REBOOT_COLD = 4, /* Cold-reboot */ |
| 2984 | EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */ | 4574 | EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */ |
| 2985 | EC_REBOOT_HIBERNATE = 6 /* Hibernate EC */ | 4575 | EC_REBOOT_HIBERNATE = 6, /* Hibernate EC */ |
| 4576 | EC_REBOOT_HIBERNATE_CLEAR_AP_OFF = 7, /* and clears AP_OFF flag */ | ||
| 2986 | }; | 4577 | }; |
| 2987 | 4578 | ||
| 2988 | /* Flags for ec_params_reboot_ec.reboot_flags */ | 4579 | /* Flags for ec_params_reboot_ec.reboot_flags */ |
| 2989 | #define EC_REBOOT_FLAG_RESERVED0 (1 << 0) /* Was recovery request */ | 4580 | #define EC_REBOOT_FLAG_RESERVED0 BIT(0) /* Was recovery request */ |
| 2990 | #define EC_REBOOT_FLAG_ON_AP_SHUTDOWN (1 << 1) /* Reboot after AP shutdown */ | 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 */ | ||
| 2991 | 4583 | ||
| 2992 | struct ec_params_reboot_ec { | 4584 | struct ec_params_reboot_ec { |
| 2993 | uint8_t cmd; /* enum ec_reboot_cmd */ | 4585 | uint8_t cmd; /* enum ec_reboot_cmd */ |
| 2994 | uint8_t flags; /* See EC_REBOOT_FLAG_* */ | 4586 | uint8_t flags; /* See EC_REBOOT_FLAG_* */ |
| 2995 | } __packed; | 4587 | } __ec_align1; |
| 2996 | 4588 | ||
| 2997 | /* | 4589 | /* |
| 2998 | * Get information on last EC panic. | 4590 | * Get information on last EC panic. |
| @@ -3000,196 +4592,7 @@ struct ec_params_reboot_ec { | |||
| 3000 | * Returns variable-length platform-dependent panic information. See panic.h | 4592 | * Returns variable-length platform-dependent panic information. See panic.h |
| 3001 | * for details. | 4593 | * for details. |
| 3002 | */ | 4594 | */ |
| 3003 | #define EC_CMD_GET_PANIC_INFO 0xd3 | 4595 | #define EC_CMD_GET_PANIC_INFO 0x00D3 |
| 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 | ||
| 3116 | |||
| 3117 | /* Current version of ACPI memory address space */ | ||
| 3118 | #define EC_ACPI_MEM_VERSION_CURRENT 1 | ||
| 3119 | |||
| 3120 | |||
| 3121 | /*****************************************************************************/ | ||
| 3122 | /* | ||
| 3123 | * HDMI CEC commands | ||
| 3124 | * | ||
| 3125 | * These commands are for sending and receiving message via HDMI CEC | ||
| 3126 | */ | ||
| 3127 | #define EC_MAX_CEC_MSG_LEN 16 | ||
| 3128 | |||
| 3129 | /* CEC message from the AP to be written on the CEC bus */ | ||
| 3130 | #define EC_CMD_CEC_WRITE_MSG 0x00B8 | ||
| 3131 | |||
| 3132 | /** | ||
| 3133 | * struct ec_params_cec_write - Message to write to the CEC bus | ||
| 3134 | * @msg: message content to write to the CEC bus | ||
| 3135 | */ | ||
| 3136 | struct ec_params_cec_write { | ||
| 3137 | uint8_t msg[EC_MAX_CEC_MSG_LEN]; | ||
| 3138 | } __packed; | ||
| 3139 | |||
| 3140 | /* Set various CEC parameters */ | ||
| 3141 | #define EC_CMD_CEC_SET 0x00BA | ||
| 3142 | |||
| 3143 | /** | ||
| 3144 | * struct ec_params_cec_set - CEC parameters set | ||
| 3145 | * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS | ||
| 3146 | * @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 | ||
| 3150 | */ | ||
| 3151 | struct ec_params_cec_set { | ||
| 3152 | uint8_t cmd; /* enum cec_command */ | ||
| 3153 | uint8_t val; | ||
| 3154 | } __packed; | ||
| 3155 | |||
| 3156 | /* Read various CEC parameters */ | ||
| 3157 | #define EC_CMD_CEC_GET 0x00BB | ||
| 3158 | |||
| 3159 | /** | ||
| 3160 | * struct ec_params_cec_get - CEC parameters get | ||
| 3161 | * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS | ||
| 3162 | */ | ||
| 3163 | struct ec_params_cec_get { | ||
| 3164 | uint8_t cmd; /* enum cec_command */ | ||
| 3165 | } __packed; | ||
| 3166 | |||
| 3167 | /** | ||
| 3168 | * struct ec_response_cec_get - CEC parameters get response | ||
| 3169 | * @val: in case cmd was CEC_CMD_ENABLE, this field will 0 if CEC is | ||
| 3170 | * disabled or 1 if CEC functionality is enabled, | ||
| 3171 | * in case cmd was CEC_CMD_LOGICAL_ADDRESS, this will encode the | ||
| 3172 | * configured logical address between 0 and 15 or 0xff if unregistered | ||
| 3173 | */ | ||
| 3174 | struct ec_response_cec_get { | ||
| 3175 | uint8_t val; | ||
| 3176 | } __packed; | ||
| 3177 | |||
| 3178 | /* CEC parameters command */ | ||
| 3179 | enum ec_cec_command { | ||
| 3180 | /* CEC reading, writing and events enable */ | ||
| 3181 | CEC_CMD_ENABLE, | ||
| 3182 | /* CEC logical address */ | ||
| 3183 | CEC_CMD_LOGICAL_ADDRESS, | ||
| 3184 | }; | ||
| 3185 | |||
| 3186 | /* Events from CEC to AP */ | ||
| 3187 | enum mkbp_cec_event { | ||
| 3188 | /* Outgoing message was acknowledged by a follower */ | ||
| 3189 | EC_MKBP_CEC_SEND_OK = BIT(0), | ||
| 3190 | /* Outgoing message was not acknowledged */ | ||
| 3191 | EC_MKBP_CEC_SEND_FAILED = BIT(1), | ||
| 3192 | }; | ||
| 3193 | 4596 | ||
| 3194 | /*****************************************************************************/ | 4597 | /*****************************************************************************/ |
| 3195 | /* | 4598 | /* |
| @@ -3208,7 +4611,7 @@ enum mkbp_cec_event { | |||
| 3208 | * | 4611 | * |
| 3209 | * Use EC_CMD_REBOOT_EC to reboot the EC more politely. | 4612 | * Use EC_CMD_REBOOT_EC to reboot the EC more politely. |
| 3210 | */ | 4613 | */ |
| 3211 | #define EC_CMD_REBOOT 0xd1 /* Think "die" */ | 4614 | #define EC_CMD_REBOOT 0x00D1 /* Think "die" */ |
| 3212 | 4615 | ||
| 3213 | /* | 4616 | /* |
| 3214 | * Resend last response (not supported on LPC). | 4617 | * Resend last response (not supported on LPC). |
| @@ -3217,7 +4620,7 @@ enum mkbp_cec_event { | |||
| 3217 | * there was no previous command, or the previous command's response was too | 4620 | * there was no previous command, or the previous command's response was too |
| 3218 | * big to save. | 4621 | * big to save. |
| 3219 | */ | 4622 | */ |
| 3220 | #define EC_CMD_RESEND_RESPONSE 0xdb | 4623 | #define EC_CMD_RESEND_RESPONSE 0x00DB |
| 3221 | 4624 | ||
| 3222 | /* | 4625 | /* |
| 3223 | * This header byte on a command indicate version 0. Any header byte less | 4626 | * This header byte on a command indicate version 0. Any header byte less |
| @@ -3229,9 +4632,7 @@ enum mkbp_cec_event { | |||
| 3229 | * | 4632 | * |
| 3230 | * The old EC interface must not use commands 0xdc or higher. | 4633 | * The old EC interface must not use commands 0xdc or higher. |
| 3231 | */ | 4634 | */ |
| 3232 | #define EC_CMD_VERSION0 0xdc | 4635 | #define EC_CMD_VERSION0 0x00DC |
| 3233 | |||
| 3234 | #endif /* !__ACPI__ */ | ||
| 3235 | 4636 | ||
| 3236 | /*****************************************************************************/ | 4637 | /*****************************************************************************/ |
| 3237 | /* | 4638 | /* |
| @@ -3241,21 +4642,56 @@ enum mkbp_cec_event { | |||
| 3241 | */ | 4642 | */ |
| 3242 | 4643 | ||
| 3243 | /* EC to PD MCU exchange status command */ | 4644 | /* 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 | }; | ||
| 3245 | 4654 | ||
| 3246 | /* Status of EC being sent to PD */ | 4655 | /* Status of EC being sent to PD */ |
| 4656 | #define EC_STATUS_HIBERNATING BIT(0) | ||
| 4657 | |||
| 3247 | struct ec_params_pd_status { | 4658 | struct ec_params_pd_status { |
| 3248 | int8_t batt_soc; /* battery state of charge */ | 4659 | uint8_t status; /* EC status */ |
| 3249 | } __packed; | 4660 | int8_t batt_soc; /* battery state of charge */ |
| 4661 | uint8_t charge_state; /* charging state (from enum pd_charge_state) */ | ||
| 4662 | } __ec_align1; | ||
| 3250 | 4663 | ||
| 3251 | /* Status of PD being sent back to EC */ | 4664 | /* 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) | ||
| 3252 | struct ec_response_pd_status { | 4675 | struct ec_response_pd_status { |
| 3253 | int8_t status; /* PD MCU status */ | 4676 | uint32_t curr_lim_ma; /* input current limit */ |
| 3254 | uint32_t curr_lim_ma; /* input current limit */ | 4677 | uint16_t status; /* PD MCU status */ |
| 3255 | } __packed; | 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; | ||
| 3256 | 4692 | ||
| 3257 | /* Set USB type-C port role and muxes */ | 4693 | /* Set USB type-C port role and muxes */ |
| 3258 | #define EC_CMD_USB_PD_CONTROL 0x101 | 4694 | #define EC_CMD_USB_PD_CONTROL 0x0101 |
| 3259 | 4695 | ||
| 3260 | enum usb_pd_control_role { | 4696 | enum usb_pd_control_role { |
| 3261 | USB_PD_CTRL_ROLE_NO_CHANGE = 0, | 4697 | USB_PD_CTRL_ROLE_NO_CHANGE = 0, |
| @@ -3263,6 +4699,8 @@ enum usb_pd_control_role { | |||
| 3263 | USB_PD_CTRL_ROLE_TOGGLE_OFF = 2, | 4699 | USB_PD_CTRL_ROLE_TOGGLE_OFF = 2, |
| 3264 | USB_PD_CTRL_ROLE_FORCE_SINK = 3, | 4700 | USB_PD_CTRL_ROLE_FORCE_SINK = 3, |
| 3265 | USB_PD_CTRL_ROLE_FORCE_SOURCE = 4, | 4701 | USB_PD_CTRL_ROLE_FORCE_SOURCE = 4, |
| 4702 | USB_PD_CTRL_ROLE_FREEZE = 5, | ||
| 4703 | USB_PD_CTRL_ROLE_COUNT | ||
| 3266 | }; | 4704 | }; |
| 3267 | 4705 | ||
| 3268 | enum usb_pd_control_mux { | 4706 | enum usb_pd_control_mux { |
| @@ -3272,6 +4710,7 @@ enum usb_pd_control_mux { | |||
| 3272 | USB_PD_CTRL_MUX_DP = 3, | 4710 | USB_PD_CTRL_MUX_DP = 3, |
| 3273 | USB_PD_CTRL_MUX_DOCK = 4, | 4711 | USB_PD_CTRL_MUX_DOCK = 4, |
| 3274 | USB_PD_CTRL_MUX_AUTO = 5, | 4712 | USB_PD_CTRL_MUX_AUTO = 5, |
| 4713 | USB_PD_CTRL_MUX_COUNT | ||
| 3275 | }; | 4714 | }; |
| 3276 | 4715 | ||
| 3277 | enum usb_pd_control_swap { | 4716 | enum usb_pd_control_swap { |
| @@ -3287,11 +4726,11 @@ struct ec_params_usb_pd_control { | |||
| 3287 | uint8_t role; | 4726 | uint8_t role; |
| 3288 | uint8_t mux; | 4727 | uint8_t mux; |
| 3289 | uint8_t swap; | 4728 | uint8_t swap; |
| 3290 | } __packed; | 4729 | } __ec_align1; |
| 3291 | 4730 | ||
| 3292 | #define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */ | 4731 | #define PD_CTRL_RESP_ENABLED_COMMS BIT(0) /* Communication enabled */ |
| 3293 | #define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */ | 4732 | #define PD_CTRL_RESP_ENABLED_CONNECTED BIT(1) /* Device connected */ |
| 3294 | #define PD_CTRL_RESP_ENABLED_PD_CAPABLE (1 << 2) /* Partner is PD capable */ | 4733 | #define PD_CTRL_RESP_ENABLED_PD_CAPABLE BIT(2) /* Partner is PD capable */ |
| 3295 | 4734 | ||
| 3296 | #define PD_CTRL_RESP_ROLE_POWER BIT(0) /* 0=SNK/1=SRC */ | 4735 | #define PD_CTRL_RESP_ROLE_POWER BIT(0) /* 0=SNK/1=SRC */ |
| 3297 | #define PD_CTRL_RESP_ROLE_DATA BIT(1) /* 0=UFP/1=DFP */ | 4736 | #define PD_CTRL_RESP_ROLE_DATA BIT(1) /* 0=UFP/1=DFP */ |
| @@ -3301,28 +4740,54 @@ struct ec_params_usb_pd_control { | |||
| 3301 | #define PD_CTRL_RESP_ROLE_USB_COMM BIT(5) /* Partner USB comm capable */ | 4740 | #define PD_CTRL_RESP_ROLE_USB_COMM BIT(5) /* Partner USB comm capable */ |
| 3302 | #define PD_CTRL_RESP_ROLE_EXT_POWERED BIT(6) /* Partner externally powerd */ | 4741 | #define PD_CTRL_RESP_ROLE_EXT_POWERED BIT(6) /* Partner externally powerd */ |
| 3303 | 4742 | ||
| 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 | |||
| 3304 | struct ec_response_usb_pd_control_v1 { | 4750 | struct ec_response_usb_pd_control_v1 { |
| 3305 | uint8_t enabled; | 4751 | uint8_t enabled; |
| 3306 | uint8_t role; | 4752 | uint8_t role; |
| 3307 | uint8_t polarity; | 4753 | uint8_t polarity; |
| 3308 | char state[32]; | 4754 | 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; | ||
| 3310 | 4775 | ||
| 3311 | #define EC_CMD_USB_PD_PORTS 0x102 | 4776 | #define EC_CMD_USB_PD_PORTS 0x0102 |
| 3312 | 4777 | ||
| 3313 | /* Maximum number of PD ports on a device, num_ports will be <= this */ | 4778 | /* Maximum number of PD ports on a device, num_ports will be <= this */ |
| 3314 | #define EC_USB_PD_MAX_PORTS 8 | 4779 | #define EC_USB_PD_MAX_PORTS 8 |
| 3315 | 4780 | ||
| 3316 | struct ec_response_usb_pd_ports { | 4781 | struct ec_response_usb_pd_ports { |
| 3317 | uint8_t num_ports; | 4782 | uint8_t num_ports; |
| 3318 | } __packed; | 4783 | } __ec_align1; |
| 3319 | 4784 | ||
| 3320 | #define EC_CMD_USB_PD_POWER_INFO 0x103 | 4785 | #define EC_CMD_USB_PD_POWER_INFO 0x0103 |
| 3321 | 4786 | ||
| 3322 | #define PD_POWER_CHARGING_PORT 0xff | 4787 | #define PD_POWER_CHARGING_PORT 0xff |
| 3323 | struct ec_params_usb_pd_power_info { | 4788 | struct ec_params_usb_pd_power_info { |
| 3324 | uint8_t port; | 4789 | uint8_t port; |
| 3325 | } __packed; | 4790 | } __ec_align1; |
| 3326 | 4791 | ||
| 3327 | enum usb_chg_type { | 4792 | enum usb_chg_type { |
| 3328 | USB_CHG_TYPE_NONE, | 4793 | USB_CHG_TYPE_NONE, |
| @@ -3335,6 +4800,7 @@ enum usb_chg_type { | |||
| 3335 | USB_CHG_TYPE_OTHER, | 4800 | USB_CHG_TYPE_OTHER, |
| 3336 | USB_CHG_TYPE_VBUS, | 4801 | USB_CHG_TYPE_VBUS, |
| 3337 | USB_CHG_TYPE_UNKNOWN, | 4802 | USB_CHG_TYPE_UNKNOWN, |
| 4803 | USB_CHG_TYPE_DEDICATED, | ||
| 3338 | }; | 4804 | }; |
| 3339 | enum usb_power_roles { | 4805 | enum usb_power_roles { |
| 3340 | USB_PD_PORT_POWER_DISCONNECTED, | 4806 | USB_PD_PORT_POWER_DISCONNECTED, |
| @@ -3348,7 +4814,7 @@ struct usb_chg_measures { | |||
| 3348 | uint16_t voltage_now; | 4814 | uint16_t voltage_now; |
| 3349 | uint16_t current_max; | 4815 | uint16_t current_max; |
| 3350 | uint16_t current_lim; | 4816 | uint16_t current_lim; |
| 3351 | } __packed; | 4817 | } __ec_align2; |
| 3352 | 4818 | ||
| 3353 | struct ec_response_usb_pd_power_info { | 4819 | struct ec_response_usb_pd_power_info { |
| 3354 | uint8_t role; | 4820 | uint8_t role; |
| @@ -3357,11 +4823,8 @@ struct ec_response_usb_pd_power_info { | |||
| 3357 | uint8_t reserved1; | 4823 | uint8_t reserved1; |
| 3358 | struct usb_chg_measures meas; | 4824 | struct usb_chg_measures meas; |
| 3359 | uint32_t max_power; | 4825 | uint32_t max_power; |
| 3360 | } __packed; | 4826 | } __ec_align4; |
| 3361 | 4827 | ||
| 3362 | struct ec_params_usb_pd_info_request { | ||
| 3363 | uint8_t port; | ||
| 3364 | } __packed; | ||
| 3365 | 4828 | ||
| 3366 | /* | 4829 | /* |
| 3367 | * This command will return the number of USB PD charge port + the number | 4830 | * This command will return the number of USB PD charge port + the number |
| @@ -3371,7 +4834,47 @@ struct ec_params_usb_pd_info_request { | |||
| 3371 | #define EC_CMD_CHARGE_PORT_COUNT 0x0105 | 4834 | #define EC_CMD_CHARGE_PORT_COUNT 0x0105 |
| 3372 | struct ec_response_charge_port_count { | 4835 | struct ec_response_charge_port_count { |
| 3373 | uint8_t port_count; | 4836 | 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; | ||
| 3375 | 4878 | ||
| 3376 | /* Read USB-PD Device discovery info */ | 4879 | /* Read USB-PD Device discovery info */ |
| 3377 | #define EC_CMD_USB_PD_DISCOVERY 0x0113 | 4880 | #define EC_CMD_USB_PD_DISCOVERY 0x0113 |
| @@ -3379,7 +4882,7 @@ struct ec_params_usb_pd_discovery_entry { | |||
| 3379 | uint16_t vid; /* USB-IF VID */ | 4882 | uint16_t vid; /* USB-IF VID */ |
| 3380 | uint16_t pid; /* USB-IF PID */ | 4883 | uint16_t pid; /* USB-IF PID */ |
| 3381 | uint8_t ptype; /* product type (hub,periph,cable,ama) */ | 4884 | uint8_t ptype; /* product type (hub,periph,cable,ama) */ |
| 3382 | } __packed; | 4885 | } __ec_align_size1; |
| 3383 | 4886 | ||
| 3384 | /* Override default charge behavior */ | 4887 | /* Override default charge behavior */ |
| 3385 | #define EC_CMD_PD_CHARGE_PORT_OVERRIDE 0x0114 | 4888 | #define EC_CMD_PD_CHARGE_PORT_OVERRIDE 0x0114 |
| @@ -3393,9 +4896,13 @@ enum usb_pd_override_ports { | |||
| 3393 | 4896 | ||
| 3394 | struct ec_params_charge_port_override { | 4897 | struct ec_params_charge_port_override { |
| 3395 | int16_t override_port; /* Override port# */ | 4898 | int16_t override_port; /* Override port# */ |
| 3396 | } __packed; | 4899 | } __ec_align2; |
| 3397 | 4900 | ||
| 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 | */ | ||
| 3399 | #define EC_CMD_PD_GET_LOG_ENTRY 0x0115 | 4906 | #define EC_CMD_PD_GET_LOG_ENTRY 0x0115 |
| 3400 | 4907 | ||
| 3401 | struct ec_response_pd_log { | 4908 | struct ec_response_pd_log { |
| @@ -3404,7 +4911,7 @@ struct ec_response_pd_log { | |||
| 3404 | uint8_t size_port; /* [7:5] port number [4:0] payload size in bytes */ | 4911 | uint8_t size_port; /* [7:5] port number [4:0] payload size in bytes */ |
| 3405 | uint16_t data; /* type-defined data payload */ | 4912 | uint16_t data; /* type-defined data payload */ |
| 3406 | uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */ | 4913 | uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */ |
| 3407 | } __packed; | 4914 | } __ec_align4; |
| 3408 | 4915 | ||
| 3409 | /* The timestamp is the microsecond counter shifted to get about a ms. */ | 4916 | /* The timestamp is the microsecond counter shifted to get about a ms. */ |
| 3410 | #define PD_LOG_TIMESTAMP_SHIFT 10 /* 1 LSB = 1024us */ | 4917 | #define PD_LOG_TIMESTAMP_SHIFT 10 /* 1 LSB = 1024us */ |
| @@ -3470,35 +4977,698 @@ struct mcdp_version { | |||
| 3470 | uint8_t major; | 4977 | uint8_t major; |
| 3471 | uint8_t minor; | 4978 | uint8_t minor; |
| 3472 | uint16_t build; | 4979 | uint16_t build; |
| 3473 | } __packed; | 4980 | } __ec_align4; |
| 3474 | 4981 | ||
| 3475 | struct mcdp_info { | 4982 | struct mcdp_info { |
| 3476 | uint8_t family[2]; | 4983 | uint8_t family[2]; |
| 3477 | uint8_t chipid[2]; | 4984 | uint8_t chipid[2]; |
| 3478 | struct mcdp_version irom; | 4985 | struct mcdp_version irom; |
| 3479 | struct mcdp_version fw; | 4986 | struct mcdp_version fw; |
| 3480 | } __packed; | 4987 | } __ec_align4; |
| 3481 | 4988 | ||
| 3482 | /* struct mcdp_info field decoding */ | 4989 | /* struct mcdp_info field decoding */ |
| 3483 | #define MCDP_CHIPID(chipid) ((chipid[0] << 8) | chipid[1]) | 4990 | #define MCDP_CHIPID(chipid) ((chipid[0] << 8) | chipid[1]) |
| 3484 | #define MCDP_FAMILY(family) ((family[0] << 8) | family[1]) | 4991 | #define MCDP_FAMILY(family) ((family[0] << 8) | family[1]) |
| 3485 | 4992 | ||
| 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 | |||
| 3486 | /* Get info about USB-C SS muxes */ | 5047 | /* 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 |
| 3488 | 5049 | ||
| 3489 | struct ec_params_usb_pd_mux_info { | 5050 | struct ec_params_usb_pd_mux_info { |
| 3490 | uint8_t port; /* USB-C port number */ | 5051 | uint8_t port; /* USB-C port number */ |
| 3491 | } __packed; | 5052 | } __ec_align1; |
| 3492 | 5053 | ||
| 3493 | /* Flags representing mux state */ | 5054 | /* Flags representing mux state */ |
| 3494 | #define USB_PD_MUX_USB_ENABLED (1 << 0) | 5055 | #define USB_PD_MUX_USB_ENABLED BIT(0) /* USB connected */ |
| 3495 | #define USB_PD_MUX_DP_ENABLED (1 << 1) | 5056 | #define USB_PD_MUX_DP_ENABLED BIT(1) /* DP connected */ |
| 3496 | #define USB_PD_MUX_POLARITY_INVERTED (1 << 2) | 5057 | #define USB_PD_MUX_POLARITY_INVERTED BIT(2) /* CC line Polarity inverted */ |
| 3497 | #define USB_PD_MUX_HPD_IRQ (1 << 3) | 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 */ | ||
| 3498 | 5060 | ||
| 3499 | struct ec_response_usb_pd_mux_info { | 5061 | struct ec_response_usb_pd_mux_info { |
| 3500 | uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */ | 5062 | 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; | ||
| 5273 | |||
| 5274 | |||
| 5275 | /* Issue AP reset */ | ||
| 5276 | #define EC_CMD_AP_RESET 0x0125 | ||
| 5277 | |||
| 5278 | /*****************************************************************************/ | ||
| 5279 | /* The command range 0x200-0x2FF is reserved for Rotor. */ | ||
| 5280 | |||
| 5281 | /*****************************************************************************/ | ||
| 5282 | /* | ||
| 5283 | * Reserve a range of host commands for the CR51 firmware. | ||
| 5284 | */ | ||
| 5285 | #define EC_CMD_CR51_BASE 0x0300 | ||
| 5286 | #define EC_CMD_CR51_LAST 0x03FF | ||
| 5287 | |||
| 5288 | /*****************************************************************************/ | ||
| 5289 | /* Fingerprint MCU commands: range 0x0400-0x040x */ | ||
| 5290 | |||
| 5291 | /* Fingerprint SPI sensor passthru command: prototyping ONLY */ | ||
| 5292 | #define EC_CMD_FP_PASSTHRU 0x0400 | ||
| 5293 | |||
| 5294 | #define EC_FP_FLAG_NOT_COMPLETE 0x1 | ||
| 5295 | |||
| 5296 | struct ec_params_fp_passthru { | ||
| 5297 | uint16_t len; /* Number of bytes to write then read */ | ||
| 5298 | uint16_t flags; /* EC_FP_FLAG_xxx */ | ||
| 5299 | uint8_t data[]; /* Data to send */ | ||
| 5300 | } __ec_align2; | ||
| 5301 | |||
| 5302 | /* Configure the Fingerprint MCU behavior */ | ||
| 5303 | #define EC_CMD_FP_MODE 0x0402 | ||
| 5304 | |||
| 5305 | /* Put the sensor in its lowest power mode */ | ||
| 5306 | #define FP_MODE_DEEPSLEEP BIT(0) | ||
| 5307 | /* Wait to see a finger on the sensor */ | ||
| 5308 | #define FP_MODE_FINGER_DOWN BIT(1) | ||
| 5309 | /* Poll until the finger has left the sensor */ | ||
| 5310 | #define FP_MODE_FINGER_UP BIT(2) | ||
| 5311 | /* Capture the current finger image */ | ||
| 5312 | #define FP_MODE_CAPTURE BIT(3) | ||
| 5313 | /* Finger enrollment session on-going */ | ||
| 5314 | #define FP_MODE_ENROLL_SESSION BIT(4) | ||
| 5315 | /* Enroll the current finger image */ | ||
| 5316 | #define FP_MODE_ENROLL_IMAGE BIT(5) | ||
| 5317 | /* Try to match the current finger image */ | ||
| 5318 | #define FP_MODE_MATCH BIT(6) | ||
| 5319 | /* Reset and re-initialize the sensor. */ | ||
| 5320 | #define FP_MODE_RESET_SENSOR BIT(7) | ||
| 5321 | /* special value: don't change anything just read back current mode */ | ||
| 5322 | #define FP_MODE_DONT_CHANGE BIT(31) | ||
| 5323 | |||
| 5324 | #define FP_VALID_MODES (FP_MODE_DEEPSLEEP | \ | ||
| 5325 | FP_MODE_FINGER_DOWN | \ | ||
| 5326 | FP_MODE_FINGER_UP | \ | ||
| 5327 | FP_MODE_CAPTURE | \ | ||
| 5328 | FP_MODE_ENROLL_SESSION | \ | ||
| 5329 | FP_MODE_ENROLL_IMAGE | \ | ||
| 5330 | FP_MODE_MATCH | \ | ||
| 5331 | FP_MODE_RESET_SENSOR | \ | ||
| 5332 | FP_MODE_DONT_CHANGE) | ||
| 5333 | |||
| 5334 | /* Capture types defined in bits [30..28] */ | ||
| 5335 | #define FP_MODE_CAPTURE_TYPE_SHIFT 28 | ||
| 5336 | #define FP_MODE_CAPTURE_TYPE_MASK (0x7 << FP_MODE_CAPTURE_TYPE_SHIFT) | ||
| 5337 | /* | ||
| 5338 | * This enum must remain ordered, if you add new values you must ensure that | ||
| 5339 | * FP_CAPTURE_TYPE_MAX is still the last one. | ||
| 5340 | */ | ||
| 5341 | enum fp_capture_type { | ||
| 5342 | /* Full blown vendor-defined capture (produces 'frame_size' bytes) */ | ||
| 5343 | FP_CAPTURE_VENDOR_FORMAT = 0, | ||
| 5344 | /* Simple raw image capture (produces width x height x bpp bits) */ | ||
| 5345 | FP_CAPTURE_SIMPLE_IMAGE = 1, | ||
| 5346 | /* Self test pattern (e.g. checkerboard) */ | ||
| 5347 | FP_CAPTURE_PATTERN0 = 2, | ||
| 5348 | /* Self test pattern (e.g. inverted checkerboard) */ | ||
| 5349 | FP_CAPTURE_PATTERN1 = 3, | ||
| 5350 | /* Capture for Quality test with fixed contrast */ | ||
| 5351 | FP_CAPTURE_QUALITY_TEST = 4, | ||
| 5352 | /* Capture for pixel reset value test */ | ||
| 5353 | FP_CAPTURE_RESET_TEST = 5, | ||
| 5354 | FP_CAPTURE_TYPE_MAX, | ||
| 5355 | }; | ||
| 5356 | /* Extracts the capture type from the sensor 'mode' word */ | ||
| 5357 | #define FP_CAPTURE_TYPE(mode) (((mode) & FP_MODE_CAPTURE_TYPE_MASK) \ | ||
| 5358 | >> FP_MODE_CAPTURE_TYPE_SHIFT) | ||
| 5359 | |||
| 5360 | struct ec_params_fp_mode { | ||
| 5361 | uint32_t mode; /* as defined by FP_MODE_ constants */ | ||
| 5362 | } __ec_align4; | ||
| 5363 | |||
| 5364 | struct ec_response_fp_mode { | ||
| 5365 | uint32_t mode; /* as defined by FP_MODE_ constants */ | ||
| 5366 | } __ec_align4; | ||
| 5367 | |||
| 5368 | /* Retrieve Fingerprint sensor information */ | ||
| 5369 | #define EC_CMD_FP_INFO 0x0403 | ||
| 5370 | |||
| 5371 | /* Number of dead pixels detected on the last maintenance */ | ||
| 5372 | #define FP_ERROR_DEAD_PIXELS(errors) ((errors) & 0x3FF) | ||
| 5373 | /* Unknown number of dead pixels detected on the last maintenance */ | ||
| 5374 | #define FP_ERROR_DEAD_PIXELS_UNKNOWN (0x3FF) | ||
| 5375 | /* No interrupt from the sensor */ | ||
| 5376 | #define FP_ERROR_NO_IRQ BIT(12) | ||
| 5377 | /* SPI communication error */ | ||
| 5378 | #define FP_ERROR_SPI_COMM BIT(13) | ||
| 5379 | /* Invalid sensor Hardware ID */ | ||
| 5380 | #define FP_ERROR_BAD_HWID BIT(14) | ||
| 5381 | /* Sensor initialization failed */ | ||
| 5382 | #define FP_ERROR_INIT_FAIL BIT(15) | ||
| 5383 | |||
| 5384 | struct ec_response_fp_info_v0 { | ||
| 5385 | /* Sensor identification */ | ||
| 5386 | uint32_t vendor_id; | ||
| 5387 | uint32_t product_id; | ||
| 5388 | uint32_t model_id; | ||
| 5389 | uint32_t version; | ||
| 5390 | /* Image frame characteristics */ | ||
| 5391 | uint32_t frame_size; | ||
| 5392 | uint32_t pixel_format; /* using V4L2_PIX_FMT_ */ | ||
| 5393 | uint16_t width; | ||
| 5394 | uint16_t height; | ||
| 5395 | uint16_t bpp; | ||
| 5396 | uint16_t errors; /* see FP_ERROR_ flags above */ | ||
| 5397 | } __ec_align4; | ||
| 5398 | |||
| 5399 | struct ec_response_fp_info { | ||
| 5400 | /* Sensor identification */ | ||
| 5401 | uint32_t vendor_id; | ||
| 5402 | uint32_t product_id; | ||
| 5403 | uint32_t model_id; | ||
| 5404 | uint32_t version; | ||
| 5405 | /* Image frame characteristics */ | ||
| 5406 | uint32_t frame_size; | ||
| 5407 | uint32_t pixel_format; /* using V4L2_PIX_FMT_ */ | ||
| 5408 | uint16_t width; | ||
| 5409 | uint16_t height; | ||
| 5410 | uint16_t bpp; | ||
| 5411 | uint16_t errors; /* see FP_ERROR_ flags above */ | ||
| 5412 | /* Template/finger current information */ | ||
| 5413 | uint32_t template_size; /* max template size in bytes */ | ||
| 5414 | uint16_t template_max; /* maximum number of fingers/templates */ | ||
| 5415 | uint16_t template_valid; /* number of valid fingers/templates */ | ||
| 5416 | uint32_t template_dirty; /* bitmap of templates with MCU side changes */ | ||
| 5417 | uint32_t template_version; /* version of the template format */ | ||
| 5418 | } __ec_align4; | ||
| 5419 | |||
| 5420 | /* Get the last captured finger frame or a template content */ | ||
| 5421 | #define EC_CMD_FP_FRAME 0x0404 | ||
| 5422 | |||
| 5423 | /* constants defining the 'offset' field which also contains the frame index */ | ||
| 5424 | #define FP_FRAME_INDEX_SHIFT 28 | ||
| 5425 | /* Frame buffer where the captured image is stored */ | ||
| 5426 | #define FP_FRAME_INDEX_RAW_IMAGE 0 | ||
| 5427 | /* First frame buffer holding a template */ | ||
| 5428 | #define FP_FRAME_INDEX_TEMPLATE 1 | ||
| 5429 | #define FP_FRAME_GET_BUFFER_INDEX(offset) ((offset) >> FP_FRAME_INDEX_SHIFT) | ||
| 5430 | #define FP_FRAME_OFFSET_MASK 0x0FFFFFFF | ||
| 5431 | |||
| 5432 | /* Version of the format of the encrypted templates. */ | ||
| 5433 | #define FP_TEMPLATE_FORMAT_VERSION 3 | ||
| 5434 | |||
| 5435 | /* Constants for encryption parameters */ | ||
| 5436 | #define FP_CONTEXT_NONCE_BYTES 12 | ||
| 5437 | #define FP_CONTEXT_USERID_WORDS (32 / sizeof(uint32_t)) | ||
| 5438 | #define FP_CONTEXT_TAG_BYTES 16 | ||
| 5439 | #define FP_CONTEXT_SALT_BYTES 16 | ||
| 5440 | #define FP_CONTEXT_TPM_BYTES 32 | ||
| 5441 | |||
| 5442 | struct ec_fp_template_encryption_metadata { | ||
| 5443 | /* | ||
| 5444 | * Version of the structure format (N=3). | ||
| 5445 | */ | ||
| 5446 | uint16_t struct_version; | ||
| 5447 | /* Reserved bytes, set to 0. */ | ||
| 5448 | uint16_t reserved; | ||
| 5449 | /* | ||
| 5450 | * The salt is *only* ever used for key derivation. The nonce is unique, | ||
| 5451 | * a different one is used for every message. | ||
| 5452 | */ | ||
| 5453 | uint8_t nonce[FP_CONTEXT_NONCE_BYTES]; | ||
| 5454 | uint8_t salt[FP_CONTEXT_SALT_BYTES]; | ||
| 5455 | uint8_t tag[FP_CONTEXT_TAG_BYTES]; | ||
| 5456 | }; | ||
| 5457 | |||
| 5458 | struct ec_params_fp_frame { | ||
| 5459 | /* | ||
| 5460 | * The offset contains the template index or FP_FRAME_INDEX_RAW_IMAGE | ||
| 5461 | * in the high nibble, and the real offset within the frame in | ||
| 5462 | * FP_FRAME_OFFSET_MASK. | ||
| 5463 | */ | ||
| 5464 | uint32_t offset; | ||
| 5465 | uint32_t size; | ||
| 5466 | } __ec_align4; | ||
| 5467 | |||
| 5468 | /* Load a template into the MCU */ | ||
| 5469 | #define EC_CMD_FP_TEMPLATE 0x0405 | ||
| 5470 | |||
| 5471 | /* Flag in the 'size' field indicating that the full template has been sent */ | ||
| 5472 | #define FP_TEMPLATE_COMMIT 0x80000000 | ||
| 5473 | |||
| 5474 | struct ec_params_fp_template { | ||
| 5475 | uint32_t offset; | ||
| 5476 | uint32_t size; | ||
| 5477 | uint8_t data[]; | ||
| 5478 | } __ec_align4; | ||
| 5479 | |||
| 5480 | /* Clear the current fingerprint user context and set a new one */ | ||
| 5481 | #define EC_CMD_FP_CONTEXT 0x0406 | ||
| 5482 | |||
| 5483 | struct ec_params_fp_context { | ||
| 5484 | uint32_t userid[FP_CONTEXT_USERID_WORDS]; | ||
| 5485 | } __ec_align4; | ||
| 5486 | |||
| 5487 | #define EC_CMD_FP_STATS 0x0407 | ||
| 5488 | |||
| 5489 | #define FPSTATS_CAPTURE_INV BIT(0) | ||
| 5490 | #define FPSTATS_MATCHING_INV BIT(1) | ||
| 5491 | |||
| 5492 | struct ec_response_fp_stats { | ||
| 5493 | uint32_t capture_time_us; | ||
| 5494 | uint32_t matching_time_us; | ||
| 5495 | uint32_t overall_time_us; | ||
| 5496 | struct { | ||
| 5497 | uint32_t lo; | ||
| 5498 | uint32_t hi; | ||
| 5499 | } overall_t0; | ||
| 5500 | uint8_t timestamps_invalid; | ||
| 5501 | int8_t template_matched; | ||
| 5502 | } __ec_align2; | ||
| 5503 | |||
| 5504 | #define EC_CMD_FP_SEED 0x0408 | ||
| 5505 | struct ec_params_fp_seed { | ||
| 5506 | /* | ||
| 5507 | * Version of the structure format (N=3). | ||
| 5508 | */ | ||
| 5509 | uint16_t struct_version; | ||
| 5510 | /* Reserved bytes, set to 0. */ | ||
| 5511 | uint16_t reserved; | ||
| 5512 | /* Seed from the TPM. */ | ||
| 5513 | uint8_t seed[FP_CONTEXT_TPM_BYTES]; | ||
| 5514 | } __ec_align4; | ||
| 5515 | |||
| 5516 | /*****************************************************************************/ | ||
| 5517 | /* Touchpad MCU commands: range 0x0500-0x05FF */ | ||
| 5518 | |||
| 5519 | /* Perform touchpad self test */ | ||
| 5520 | #define EC_CMD_TP_SELF_TEST 0x0500 | ||
| 5521 | |||
| 5522 | /* Get number of frame types, and the size of each type */ | ||
| 5523 | #define EC_CMD_TP_FRAME_INFO 0x0501 | ||
| 5524 | |||
| 5525 | struct ec_response_tp_frame_info { | ||
| 5526 | uint32_t n_frames; | ||
| 5527 | uint32_t frame_sizes[0]; | ||
| 5528 | } __ec_align4; | ||
| 5529 | |||
| 5530 | /* Create a snapshot of current frame readings */ | ||
| 5531 | #define EC_CMD_TP_FRAME_SNAPSHOT 0x0502 | ||
| 5532 | |||
| 5533 | /* Read the frame */ | ||
| 5534 | #define EC_CMD_TP_FRAME_GET 0x0503 | ||
| 5535 | |||
| 5536 | struct ec_params_tp_frame_get { | ||
| 5537 | uint32_t frame_index; | ||
| 5538 | uint32_t offset; | ||
| 5539 | uint32_t size; | ||
| 5540 | } __ec_align4; | ||
| 5541 | |||
| 5542 | /*****************************************************************************/ | ||
| 5543 | /* EC-EC communication commands: range 0x0600-0x06FF */ | ||
| 5544 | |||
| 5545 | #define EC_COMM_TEXT_MAX 8 | ||
| 5546 | |||
| 5547 | /* | ||
| 5548 | * Get battery static information, i.e. information that never changes, or | ||
| 5549 | * very infrequently. | ||
| 5550 | */ | ||
| 5551 | #define EC_CMD_BATTERY_GET_STATIC 0x0600 | ||
| 5552 | |||
| 5553 | /** | ||
| 5554 | * struct ec_params_battery_static_info - Battery static info parameters | ||
| 5555 | * @index: Battery index. | ||
| 5556 | */ | ||
| 5557 | struct ec_params_battery_static_info { | ||
| 5558 | uint8_t index; | ||
| 5559 | } __ec_align_size1; | ||
| 5560 | |||
| 5561 | /** | ||
| 5562 | * struct ec_response_battery_static_info - Battery static info response | ||
| 5563 | * @design_capacity: Battery Design Capacity (mAh) | ||
| 5564 | * @design_voltage: Battery Design Voltage (mV) | ||
| 5565 | * @manufacturer: Battery Manufacturer String | ||
| 5566 | * @model: Battery Model Number String | ||
| 5567 | * @serial: Battery Serial Number String | ||
| 5568 | * @type: Battery Type String | ||
| 5569 | * @cycle_count: Battery Cycle Count | ||
| 5570 | */ | ||
| 5571 | struct ec_response_battery_static_info { | ||
| 5572 | uint16_t design_capacity; | ||
| 5573 | uint16_t design_voltage; | ||
| 5574 | char manufacturer[EC_COMM_TEXT_MAX]; | ||
| 5575 | char model[EC_COMM_TEXT_MAX]; | ||
| 5576 | char serial[EC_COMM_TEXT_MAX]; | ||
| 5577 | char type[EC_COMM_TEXT_MAX]; | ||
| 5578 | /* TODO(crbug.com/795991): Consider moving to dynamic structure. */ | ||
| 5579 | uint32_t cycle_count; | ||
| 5580 | } __ec_align4; | ||
| 5581 | |||
| 5582 | /* | ||
| 5583 | * Get battery dynamic information, i.e. information that is likely to change | ||
| 5584 | * every time it is read. | ||
| 5585 | */ | ||
| 5586 | #define EC_CMD_BATTERY_GET_DYNAMIC 0x0601 | ||
| 5587 | |||
| 5588 | /** | ||
| 5589 | * struct ec_params_battery_dynamic_info - Battery dynamic info parameters | ||
| 5590 | * @index: Battery index. | ||
| 5591 | */ | ||
| 5592 | struct ec_params_battery_dynamic_info { | ||
| 5593 | uint8_t index; | ||
| 5594 | } __ec_align_size1; | ||
| 5595 | |||
| 5596 | /** | ||
| 5597 | * struct ec_response_battery_dynamic_info - Battery dynamic info response | ||
| 5598 | * @actual_voltage: Battery voltage (mV) | ||
| 5599 | * @actual_current: Battery current (mA); negative=discharging | ||
| 5600 | * @remaining_capacity: Remaining capacity (mAh) | ||
| 5601 | * @full_capacity: Capacity (mAh, might change occasionally) | ||
| 5602 | * @flags: Flags, see EC_BATT_FLAG_* | ||
| 5603 | * @desired_voltage: Charging voltage desired by battery (mV) | ||
| 5604 | * @desired_current: Charging current desired by battery (mA) | ||
| 5605 | */ | ||
| 5606 | struct ec_response_battery_dynamic_info { | ||
| 5607 | int16_t actual_voltage; | ||
| 5608 | int16_t actual_current; | ||
| 5609 | int16_t remaining_capacity; | ||
| 5610 | int16_t full_capacity; | ||
| 5611 | int16_t flags; | ||
| 5612 | int16_t desired_voltage; | ||
| 5613 | int16_t desired_current; | ||
| 5614 | } __ec_align2; | ||
| 5615 | |||
| 5616 | /* | ||
| 5617 | * Control charger chip. Used to control charger chip on the slave. | ||
| 5618 | */ | ||
| 5619 | #define EC_CMD_CHARGER_CONTROL 0x0602 | ||
| 5620 | |||
| 5621 | /** | ||
| 5622 | * struct ec_params_charger_control - Charger control parameters | ||
| 5623 | * @max_current: Charger current (mA). Positive to allow base to draw up to | ||
| 5624 | * max_current and (possibly) charge battery, negative to request current | ||
| 5625 | * from base (OTG). | ||
| 5626 | * @otg_voltage: Voltage (mV) to use in OTG mode, ignored if max_current is | ||
| 5627 | * >= 0. | ||
| 5628 | * @allow_charging: Allow base battery charging (only makes sense if | ||
| 5629 | * max_current > 0). | ||
| 5630 | */ | ||
| 5631 | struct ec_params_charger_control { | ||
| 5632 | int16_t max_current; | ||
| 5633 | uint16_t otg_voltage; | ||
| 5634 | uint8_t allow_charging; | ||
| 5635 | } __ec_align_size1; | ||
| 5636 | |||
| 5637 | /*****************************************************************************/ | ||
| 5638 | /* | ||
| 5639 | * Reserve a range of host commands for board-specific, experimental, or | ||
| 5640 | * special purpose features. These can be (re)used without updating this file. | ||
| 5641 | * | ||
| 5642 | * CAUTION: Don't go nuts with this. Shipping products should document ALL | ||
| 5643 | * their EC commands for easier development, testing, debugging, and support. | ||
| 5644 | * | ||
| 5645 | * All commands MUST be #defined to be 4-digit UPPER CASE hex values | ||
| 5646 | * (e.g., 0x00AB, not 0xab) for CONFIG_HOSTCMD_SECTION_SORTED to work. | ||
| 5647 | * | ||
| 5648 | * In your experimental code, you may want to do something like this: | ||
| 5649 | * | ||
| 5650 | * #define EC_CMD_MAGIC_FOO 0x0000 | ||
| 5651 | * #define EC_CMD_MAGIC_BAR 0x0001 | ||
| 5652 | * #define EC_CMD_MAGIC_HEY 0x0002 | ||
| 5653 | * | ||
| 5654 | * DECLARE_PRIVATE_HOST_COMMAND(EC_CMD_MAGIC_FOO, magic_foo_handler, | ||
| 5655 | * EC_VER_MASK(0); | ||
| 5656 | * | ||
| 5657 | * DECLARE_PRIVATE_HOST_COMMAND(EC_CMD_MAGIC_BAR, magic_bar_handler, | ||
| 5658 | * EC_VER_MASK(0); | ||
| 5659 | * | ||
| 5660 | * DECLARE_PRIVATE_HOST_COMMAND(EC_CMD_MAGIC_HEY, magic_hey_handler, | ||
| 5661 | * EC_VER_MASK(0); | ||
| 5662 | */ | ||
| 5663 | #define EC_CMD_BOARD_SPECIFIC_BASE 0x3E00 | ||
| 5664 | #define EC_CMD_BOARD_SPECIFIC_LAST 0x3FFF | ||
| 5665 | |||
| 5666 | /* | ||
| 5667 | * Given the private host command offset, calculate the true private host | ||
| 5668 | * command value. | ||
| 5669 | */ | ||
| 5670 | #define EC_PRIVATE_HOST_COMMAND_VALUE(command) \ | ||
| 5671 | (EC_CMD_BOARD_SPECIFIC_BASE + (command)) | ||
| 3502 | 5672 | ||
| 3503 | /*****************************************************************************/ | 5673 | /*****************************************************************************/ |
| 3504 | /* | 5674 | /* |
| @@ -3538,4 +5708,6 @@ struct ec_response_usb_pd_mux_info { | |||
| 3538 | #define EC_LPC_ADDR_OLD_PARAM EC_HOST_CMD_REGION1 | 5708 | #define EC_LPC_ADDR_OLD_PARAM EC_HOST_CMD_REGION1 |
| 3539 | #define EC_OLD_PARAM_SIZE EC_HOST_CMD_REGION_SIZE | 5709 | #define EC_OLD_PARAM_SIZE EC_HOST_CMD_REGION_SIZE |
| 3540 | 5710 | ||
| 5711 | |||
| 5712 | |||
| 3541 | #endif /* __CROS_EC_COMMANDS_H */ | 5713 | #endif /* __CROS_EC_COMMANDS_H */ |
diff --git a/include/linux/mfd/da9062/registers.h b/include/linux/mfd/da9062/registers.h index fe04b708742b..2906bf6160fb 100644 --- a/include/linux/mfd/da9062/registers.h +++ b/include/linux/mfd/da9062/registers.h | |||
| @@ -797,6 +797,9 @@ | |||
| 797 | #define DA9062AA_BUCK3_SL_A_SHIFT 7 | 797 | #define DA9062AA_BUCK3_SL_A_SHIFT 7 |
| 798 | #define DA9062AA_BUCK3_SL_A_MASK BIT(7) | 798 | #define DA9062AA_BUCK3_SL_A_MASK BIT(7) |
| 799 | 799 | ||
| 800 | /* DA9062AA_VLDO[1-4]_A common */ | ||
| 801 | #define DA9062AA_VLDO_A_MIN_SEL 2 | ||
| 802 | |||
| 800 | /* DA9062AA_VLDO1_A = 0x0A9 */ | 803 | /* DA9062AA_VLDO1_A = 0x0A9 */ |
| 801 | #define DA9062AA_VLDO1_A_SHIFT 0 | 804 | #define DA9062AA_VLDO1_A_SHIFT 0 |
| 802 | #define DA9062AA_VLDO1_A_MASK 0x3f | 805 | #define DA9062AA_VLDO1_A_MASK 0x3f |
diff --git a/include/linux/mfd/da9063/pdata.h b/include/linux/mfd/da9063/pdata.h index 77c566ab96ab..085edbf7601b 100644 --- a/include/linux/mfd/da9063/pdata.h +++ b/include/linux/mfd/da9063/pdata.h | |||
| @@ -11,55 +11,6 @@ | |||
| 11 | #ifndef __MFD_DA9063_PDATA_H__ | 11 | #ifndef __MFD_DA9063_PDATA_H__ |
| 12 | #define __MFD_DA9063_PDATA_H__ | 12 | #define __MFD_DA9063_PDATA_H__ |
| 13 | 13 | ||
| 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 | |||
| 63 | /* | 14 | /* |
| 64 | * RGB LED configuration | 15 | * RGB LED configuration |
| 65 | */ | 16 | */ |
diff --git a/include/linux/mfd/lp87565.h b/include/linux/mfd/lp87565.h index e619def115b4..ce965354bbad 100644 --- a/include/linux/mfd/lp87565.h +++ b/include/linux/mfd/lp87565.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | enum lp87565_device_type { | 15 | enum lp87565_device_type { |
| 16 | LP87565_DEVICE_TYPE_UNKNOWN = 0, | 16 | LP87565_DEVICE_TYPE_UNKNOWN = 0, |
| 17 | LP87565_DEVICE_TYPE_LP87561_Q1, | ||
| 17 | LP87565_DEVICE_TYPE_LP87565_Q1, | 18 | LP87565_DEVICE_TYPE_LP87565_Q1, |
| 18 | }; | 19 | }; |
| 19 | 20 | ||
| @@ -246,6 +247,7 @@ enum LP87565_regulator_id { | |||
| 246 | LP87565_BUCK_3, | 247 | LP87565_BUCK_3, |
| 247 | LP87565_BUCK_10, | 248 | LP87565_BUCK_10, |
| 248 | LP87565_BUCK_23, | 249 | LP87565_BUCK_23, |
| 250 | LP87565_BUCK_3210, | ||
| 249 | }; | 251 | }; |
| 250 | 252 | ||
| 251 | /** | 253 | /** |
diff --git a/include/linux/mfd/madera/core.h b/include/linux/mfd/madera/core.h index 4d5d51a9c8a6..7ffa696cce7c 100644 --- a/include/linux/mfd/madera/core.h +++ b/include/linux/mfd/madera/core.h | |||
| @@ -1,12 +1,8 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * MFD internals for Cirrus Logic Madera codecs | 3 | * MFD internals for Cirrus Logic Madera codecs |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2015-2018 Cirrus Logic | 5 | * 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. | ||
| 10 | */ | 6 | */ |
| 11 | 7 | ||
| 12 | #ifndef MADERA_CORE_H | 8 | #ifndef MADERA_CORE_H |
| @@ -26,15 +22,21 @@ enum madera_type { | |||
| 26 | CS47L85 = 2, | 22 | CS47L85 = 2, |
| 27 | CS47L90 = 3, | 23 | CS47L90 = 3, |
| 28 | CS47L91 = 4, | 24 | CS47L91 = 4, |
| 25 | CS47L92 = 5, | ||
| 26 | CS47L93 = 6, | ||
| 29 | WM1840 = 7, | 27 | WM1840 = 7, |
| 28 | CS47L15 = 8, | ||
| 29 | CS42L92 = 9, | ||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | #define MADERA_MAX_CORE_SUPPLIES 2 | 32 | #define MADERA_MAX_CORE_SUPPLIES 2 |
| 33 | #define MADERA_MAX_GPIOS 40 | 33 | #define MADERA_MAX_GPIOS 40 |
| 34 | 34 | ||
| 35 | #define CS47L15_NUM_GPIOS 15 | ||
| 35 | #define CS47L35_NUM_GPIOS 16 | 36 | #define CS47L35_NUM_GPIOS 16 |
| 36 | #define CS47L85_NUM_GPIOS 40 | 37 | #define CS47L85_NUM_GPIOS 40 |
| 37 | #define CS47L90_NUM_GPIOS 38 | 38 | #define CS47L90_NUM_GPIOS 38 |
| 39 | #define CS47L92_NUM_GPIOS 16 | ||
| 38 | 40 | ||
| 39 | #define MADERA_MAX_MICBIAS 4 | 41 | #define MADERA_MAX_MICBIAS 4 |
| 40 | 42 | ||
diff --git a/include/linux/mfd/madera/pdata.h b/include/linux/mfd/madera/pdata.h index 8dc852402dbb..fa9595dd42ba 100644 --- a/include/linux/mfd/madera/pdata.h +++ b/include/linux/mfd/madera/pdata.h | |||
| @@ -1,12 +1,8 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * Platform data for Cirrus Logic Madera codecs | 3 | * Platform data for Cirrus Logic Madera codecs |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2015-2018 Cirrus Logic | 5 | * 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. | ||
| 10 | */ | 6 | */ |
| 11 | 7 | ||
| 12 | #ifndef MADERA_PDATA_H | 8 | #ifndef MADERA_PDATA_H |
| @@ -16,6 +12,7 @@ | |||
| 16 | #include <linux/regulator/arizona-ldo1.h> | 12 | #include <linux/regulator/arizona-ldo1.h> |
| 17 | #include <linux/regulator/arizona-micsupp.h> | 13 | #include <linux/regulator/arizona-micsupp.h> |
| 18 | #include <linux/regulator/machine.h> | 14 | #include <linux/regulator/machine.h> |
| 15 | #include <sound/madera-pdata.h> | ||
| 19 | 16 | ||
| 20 | #define MADERA_MAX_MICBIAS 4 | 17 | #define MADERA_MAX_MICBIAS 4 |
| 21 | #define MADERA_MAX_CHILD_MICBIAS 4 | 18 | #define MADERA_MAX_CHILD_MICBIAS 4 |
| @@ -34,11 +31,13 @@ struct madera_codec_pdata; | |||
| 34 | * @micvdd: Substruct of pdata for the MICVDD regulator | 31 | * @micvdd: Substruct of pdata for the MICVDD regulator |
| 35 | * @irq_flags: Mode for primary IRQ (defaults to active low) | 32 | * @irq_flags: Mode for primary IRQ (defaults to active low) |
| 36 | * @gpio_base: Base GPIO number | 33 | * @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) | ||
| 38 | * @n_gpio_configs: Number of entries in gpio_configs | 36 | * @n_gpio_configs: Number of entries in gpio_configs |
| 39 | * @gpsw: General purpose switch mode setting. Depends on the external | 37 | * @gpsw: General purpose switch mode setting. Depends on the external |
| 40 | * hardware connected to the switch. (See the SW1_MODE field | 38 | * hardware connected to the switch. (See the SW1_MODE field |
| 41 | * in the datasheet for the available values for your codec) | 39 | * in the datasheet for the available values for your codec) |
| 40 | * @codec: Substruct of pdata for the ASoC codec driver | ||
| 42 | */ | 41 | */ |
| 43 | struct madera_pdata { | 42 | struct madera_pdata { |
| 44 | struct gpio_desc *reset; | 43 | struct gpio_desc *reset; |
| @@ -53,6 +52,8 @@ struct madera_pdata { | |||
| 53 | int n_gpio_configs; | 52 | int n_gpio_configs; |
| 54 | 53 | ||
| 55 | u32 gpsw[MADERA_MAX_GPSW]; | 54 | u32 gpsw[MADERA_MAX_GPSW]; |
| 55 | |||
| 56 | struct madera_codec_pdata codec; | ||
| 56 | }; | 57 | }; |
| 57 | 58 | ||
| 58 | #endif | 59 | #endif |
diff --git a/include/linux/mfd/madera/registers.h b/include/linux/mfd/madera/registers.h index 977e06101711..fe909d177762 100644 --- a/include/linux/mfd/madera/registers.h +++ b/include/linux/mfd/madera/registers.h | |||
| @@ -1,12 +1,8 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * Madera register definitions | 3 | * Madera register definitions |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2015-2018 Cirrus Logic | 5 | * 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. | ||
| 10 | */ | 6 | */ |
| 11 | 7 | ||
| 12 | #ifndef MADERA_REGISTERS_H | 8 | #ifndef MADERA_REGISTERS_H |
| @@ -76,10 +72,14 @@ | |||
| 76 | #define MADERA_FLL1_CONTROL_4 0x174 | 72 | #define MADERA_FLL1_CONTROL_4 0x174 |
| 77 | #define MADERA_FLL1_CONTROL_5 0x175 | 73 | #define MADERA_FLL1_CONTROL_5 0x175 |
| 78 | #define MADERA_FLL1_CONTROL_6 0x176 | 74 | #define MADERA_FLL1_CONTROL_6 0x176 |
| 79 | #define MADERA_FLL1_LOOP_FILTER_TEST_1 0x177 | 75 | #define CS47L92_FLL1_CONTROL_7 0x177 |
| 80 | #define MADERA_FLL1_NCO_TEST_0 0x178 | 76 | #define CS47L92_FLL1_CONTROL_8 0x178 |
| 81 | #define MADERA_FLL1_CONTROL_7 0x179 | 77 | #define MADERA_FLL1_CONTROL_7 0x179 |
| 78 | #define CS47L92_FLL1_CONTROL_9 0x179 | ||
| 82 | #define MADERA_FLL1_EFS_2 0x17A | 79 | #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 | ||
| 83 | #define CS47L35_FLL1_SYNCHRONISER_1 0x17F | 83 | #define CS47L35_FLL1_SYNCHRONISER_1 0x17F |
| 84 | #define CS47L35_FLL1_SYNCHRONISER_2 0x180 | 84 | #define CS47L35_FLL1_SYNCHRONISER_2 0x180 |
| 85 | #define CS47L35_FLL1_SYNCHRONISER_3 0x181 | 85 | #define CS47L35_FLL1_SYNCHRONISER_3 0x181 |
| @@ -98,16 +98,21 @@ | |||
| 98 | #define MADERA_FLL1_SYNCHRONISER_7 0x187 | 98 | #define MADERA_FLL1_SYNCHRONISER_7 0x187 |
| 99 | #define MADERA_FLL1_SPREAD_SPECTRUM 0x189 | 99 | #define MADERA_FLL1_SPREAD_SPECTRUM 0x189 |
| 100 | #define MADERA_FLL1_GPIO_CLOCK 0x18A | 100 | #define MADERA_FLL1_GPIO_CLOCK 0x18A |
| 101 | #define CS47L92_FLL1_GPIO_CLOCK 0x18E | ||
| 101 | #define MADERA_FLL2_CONTROL_1 0x191 | 102 | #define MADERA_FLL2_CONTROL_1 0x191 |
| 102 | #define MADERA_FLL2_CONTROL_2 0x192 | 103 | #define MADERA_FLL2_CONTROL_2 0x192 |
| 103 | #define MADERA_FLL2_CONTROL_3 0x193 | 104 | #define MADERA_FLL2_CONTROL_3 0x193 |
| 104 | #define MADERA_FLL2_CONTROL_4 0x194 | 105 | #define MADERA_FLL2_CONTROL_4 0x194 |
| 105 | #define MADERA_FLL2_CONTROL_5 0x195 | 106 | #define MADERA_FLL2_CONTROL_5 0x195 |
| 106 | #define MADERA_FLL2_CONTROL_6 0x196 | 107 | #define MADERA_FLL2_CONTROL_6 0x196 |
| 107 | #define MADERA_FLL2_LOOP_FILTER_TEST_1 0x197 | 108 | #define CS47L92_FLL2_CONTROL_7 0x197 |
| 108 | #define MADERA_FLL2_NCO_TEST_0 0x198 | 109 | #define CS47L92_FLL2_CONTROL_8 0x198 |
| 109 | #define MADERA_FLL2_CONTROL_7 0x199 | 110 | #define MADERA_FLL2_CONTROL_7 0x199 |
| 111 | #define CS47L92_FLL2_CONTROL_9 0x199 | ||
| 110 | #define MADERA_FLL2_EFS_2 0x19A | 112 | #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 | ||
| 111 | #define MADERA_FLL2_SYNCHRONISER_1 0x1A1 | 116 | #define MADERA_FLL2_SYNCHRONISER_1 0x1A1 |
| 112 | #define MADERA_FLL2_SYNCHRONISER_2 0x1A2 | 117 | #define MADERA_FLL2_SYNCHRONISER_2 0x1A2 |
| 113 | #define MADERA_FLL2_SYNCHRONISER_3 0x1A3 | 118 | #define MADERA_FLL2_SYNCHRONISER_3 0x1A3 |
| @@ -117,14 +122,13 @@ | |||
| 117 | #define MADERA_FLL2_SYNCHRONISER_7 0x1A7 | 122 | #define MADERA_FLL2_SYNCHRONISER_7 0x1A7 |
| 118 | #define MADERA_FLL2_SPREAD_SPECTRUM 0x1A9 | 123 | #define MADERA_FLL2_SPREAD_SPECTRUM 0x1A9 |
| 119 | #define MADERA_FLL2_GPIO_CLOCK 0x1AA | 124 | #define MADERA_FLL2_GPIO_CLOCK 0x1AA |
| 125 | #define CS47L92_FLL2_GPIO_CLOCK 0x1AE | ||
| 120 | #define MADERA_FLL3_CONTROL_1 0x1B1 | 126 | #define MADERA_FLL3_CONTROL_1 0x1B1 |
| 121 | #define MADERA_FLL3_CONTROL_2 0x1B2 | 127 | #define MADERA_FLL3_CONTROL_2 0x1B2 |
| 122 | #define MADERA_FLL3_CONTROL_3 0x1B3 | 128 | #define MADERA_FLL3_CONTROL_3 0x1B3 |
| 123 | #define MADERA_FLL3_CONTROL_4 0x1B4 | 129 | #define MADERA_FLL3_CONTROL_4 0x1B4 |
| 124 | #define MADERA_FLL3_CONTROL_5 0x1B5 | 130 | #define MADERA_FLL3_CONTROL_5 0x1B5 |
| 125 | #define MADERA_FLL3_CONTROL_6 0x1B6 | 131 | #define MADERA_FLL3_CONTROL_6 0x1B6 |
| 126 | #define MADERA_FLL3_LOOP_FILTER_TEST_1 0x1B7 | ||
| 127 | #define MADERA_FLL3_NCO_TEST_0 0x1B8 | ||
| 128 | #define MADERA_FLL3_CONTROL_7 0x1B9 | 132 | #define MADERA_FLL3_CONTROL_7 0x1B9 |
| 129 | #define MADERA_FLL3_SYNCHRONISER_1 0x1C1 | 133 | #define MADERA_FLL3_SYNCHRONISER_1 0x1C1 |
| 130 | #define MADERA_FLL3_SYNCHRONISER_2 0x1C2 | 134 | #define MADERA_FLL3_SYNCHRONISER_2 0x1C2 |
| @@ -244,6 +248,8 @@ | |||
| 244 | #define MADERA_IN6R_CONTROL 0x33C | 248 | #define MADERA_IN6R_CONTROL 0x33C |
| 245 | #define MADERA_ADC_DIGITAL_VOLUME_6R 0x33D | 249 | #define MADERA_ADC_DIGITAL_VOLUME_6R 0x33D |
| 246 | #define MADERA_DMIC6R_CONTROL 0x33E | 250 | #define MADERA_DMIC6R_CONTROL 0x33E |
| 251 | #define CS47L15_ADC_INT_BIAS 0x3A8 | ||
| 252 | #define CS47L15_PGA_BIAS_SEL 0x3C4 | ||
| 247 | #define MADERA_OUTPUT_ENABLES_1 0x400 | 253 | #define MADERA_OUTPUT_ENABLES_1 0x400 |
| 248 | #define MADERA_OUTPUT_STATUS_1 0x401 | 254 | #define MADERA_OUTPUT_STATUS_1 0x401 |
| 249 | #define MADERA_RAW_OUTPUT_STATUS_1 0x406 | 255 | #define MADERA_RAW_OUTPUT_STATUS_1 0x406 |
| @@ -265,6 +271,7 @@ | |||
| 265 | #define MADERA_NOISE_GATE_SELECT_2R 0x41F | 271 | #define MADERA_NOISE_GATE_SELECT_2R 0x41F |
| 266 | #define MADERA_OUTPUT_PATH_CONFIG_3L 0x420 | 272 | #define MADERA_OUTPUT_PATH_CONFIG_3L 0x420 |
| 267 | #define MADERA_DAC_DIGITAL_VOLUME_3L 0x421 | 273 | #define MADERA_DAC_DIGITAL_VOLUME_3L 0x421 |
| 274 | #define MADERA_OUTPUT_PATH_CONFIG_3 0x422 | ||
| 268 | #define MADERA_NOISE_GATE_SELECT_3L 0x423 | 275 | #define MADERA_NOISE_GATE_SELECT_3L 0x423 |
| 269 | #define MADERA_OUTPUT_PATH_CONFIG_3R 0x424 | 276 | #define MADERA_OUTPUT_PATH_CONFIG_3R 0x424 |
| 270 | #define MADERA_DAC_DIGITAL_VOLUME_3R 0x425 | 277 | #define MADERA_DAC_DIGITAL_VOLUME_3R 0x425 |
| @@ -287,9 +294,6 @@ | |||
| 287 | #define MADERA_OUTPUT_PATH_CONFIG_6R 0x43C | 294 | #define MADERA_OUTPUT_PATH_CONFIG_6R 0x43C |
| 288 | #define MADERA_DAC_DIGITAL_VOLUME_6R 0x43D | 295 | #define MADERA_DAC_DIGITAL_VOLUME_6R 0x43D |
| 289 | #define MADERA_NOISE_GATE_SELECT_6R 0x43F | 296 | #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 | ||
| 293 | #define MADERA_DAC_AEC_CONTROL_1 0x450 | 297 | #define MADERA_DAC_AEC_CONTROL_1 0x450 |
| 294 | #define MADERA_DAC_AEC_CONTROL_2 0x451 | 298 | #define MADERA_DAC_AEC_CONTROL_2 0x451 |
| 295 | #define MADERA_NOISE_GATE_CONTROL 0x458 | 299 | #define MADERA_NOISE_GATE_CONTROL 0x458 |
| @@ -367,8 +371,20 @@ | |||
| 367 | #define MADERA_AIF3_FRAME_CTRL_2 0x588 | 371 | #define MADERA_AIF3_FRAME_CTRL_2 0x588 |
| 368 | #define MADERA_AIF3_FRAME_CTRL_3 0x589 | 372 | #define MADERA_AIF3_FRAME_CTRL_3 0x589 |
| 369 | #define MADERA_AIF3_FRAME_CTRL_4 0x58A | 373 | #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 | ||
| 370 | #define MADERA_AIF3_FRAME_CTRL_11 0x591 | 380 | #define MADERA_AIF3_FRAME_CTRL_11 0x591 |
| 371 | #define MADERA_AIF3_FRAME_CTRL_12 0x592 | 381 | #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 | ||
| 372 | #define MADERA_AIF3_TX_ENABLES 0x599 | 388 | #define MADERA_AIF3_TX_ENABLES 0x599 |
| 373 | #define MADERA_AIF3_RX_ENABLES 0x59A | 389 | #define MADERA_AIF3_RX_ENABLES 0x59A |
| 374 | #define MADERA_AIF3_FORCE_WRITE 0x59B | 390 | #define MADERA_AIF3_FORCE_WRITE 0x59B |
| @@ -660,6 +676,54 @@ | |||
| 660 | #define MADERA_AIF3TX2MIX_INPUT_3_VOLUME 0x78D | 676 | #define MADERA_AIF3TX2MIX_INPUT_3_VOLUME 0x78D |
| 661 | #define MADERA_AIF3TX2MIX_INPUT_4_SOURCE 0x78E | 677 | #define MADERA_AIF3TX2MIX_INPUT_4_SOURCE 0x78E |
| 662 | #define MADERA_AIF3TX2MIX_INPUT_4_VOLUME 0x78F | 678 | #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 | ||
| 663 | #define MADERA_AIF4TX1MIX_INPUT_1_SOURCE 0x7A0 | 727 | #define MADERA_AIF4TX1MIX_INPUT_1_SOURCE 0x7A0 |
| 664 | #define MADERA_AIF4TX1MIX_INPUT_1_VOLUME 0x7A1 | 728 | #define MADERA_AIF4TX1MIX_INPUT_1_VOLUME 0x7A1 |
| 665 | #define MADERA_AIF4TX1MIX_INPUT_2_SOURCE 0x7A2 | 729 | #define MADERA_AIF4TX1MIX_INPUT_2_SOURCE 0x7A2 |
| @@ -1103,68 +1167,8 @@ | |||
| 1103 | #define MADERA_FCR_ADC_REFORMATTER_CONTROL 0xF73 | 1167 | #define MADERA_FCR_ADC_REFORMATTER_CONTROL 0xF73 |
| 1104 | #define MADERA_FCR_COEFF_START 0xF74 | 1168 | #define MADERA_FCR_COEFF_START 0xF74 |
| 1105 | #define MADERA_FCR_COEFF_END 0xFC5 | 1169 | #define MADERA_FCR_COEFF_END 0xFC5 |
| 1106 | #define MADERA_DAC_COMP_1 0x1300 | 1170 | #define MADERA_AUXPDM1_CTRL_0 0x10C0 |
| 1107 | #define MADERA_DAC_COMP_2 0x1302 | 1171 | #define MADERA_AUXPDM1_CTRL_1 0x10C1 |
| 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 | ||
| 1168 | #define MADERA_DFC1_CTRL 0x1480 | 1172 | #define MADERA_DFC1_CTRL 0x1480 |
| 1169 | #define MADERA_DFC1_RX 0x1482 | 1173 | #define MADERA_DFC1_RX 0x1482 |
| 1170 | #define MADERA_DFC1_TX 0x1484 | 1174 | #define MADERA_DFC1_TX 0x1484 |
| @@ -1202,6 +1206,8 @@ | |||
| 1202 | #define MADERA_GPIO1_CTRL_2 0x1701 | 1206 | #define MADERA_GPIO1_CTRL_2 0x1701 |
| 1203 | #define MADERA_GPIO2_CTRL_1 0x1702 | 1207 | #define MADERA_GPIO2_CTRL_1 0x1702 |
| 1204 | #define MADERA_GPIO2_CTRL_2 0x1703 | 1208 | #define MADERA_GPIO2_CTRL_2 0x1703 |
| 1209 | #define MADERA_GPIO15_CTRL_1 0x171C | ||
| 1210 | #define MADERA_GPIO15_CTRL_2 0x171D | ||
| 1205 | #define MADERA_GPIO16_CTRL_1 0x171E | 1211 | #define MADERA_GPIO16_CTRL_1 0x171E |
| 1206 | #define MADERA_GPIO16_CTRL_2 0x171F | 1212 | #define MADERA_GPIO16_CTRL_2 0x171F |
| 1207 | #define MADERA_GPIO38_CTRL_1 0x174A | 1213 | #define MADERA_GPIO38_CTRL_1 0x174A |
| @@ -1232,6 +1238,7 @@ | |||
| 1232 | #define MADERA_IRQ2_CTRL 0x1A82 | 1238 | #define MADERA_IRQ2_CTRL 0x1A82 |
| 1233 | #define MADERA_INTERRUPT_RAW_STATUS_1 0x1AA0 | 1239 | #define MADERA_INTERRUPT_RAW_STATUS_1 0x1AA0 |
| 1234 | #define MADERA_WSEQ_SEQUENCE_1 0x3000 | 1240 | #define MADERA_WSEQ_SEQUENCE_1 0x3000 |
| 1241 | #define MADERA_WSEQ_SEQUENCE_225 0x31C0 | ||
| 1235 | #define MADERA_WSEQ_SEQUENCE_252 0x31F6 | 1242 | #define MADERA_WSEQ_SEQUENCE_252 0x31F6 |
| 1236 | #define CS47L35_OTP_HPDET_CAL_1 0x31F8 | 1243 | #define CS47L35_OTP_HPDET_CAL_1 0x31F8 |
| 1237 | #define CS47L35_OTP_HPDET_CAL_2 0x31FA | 1244 | #define CS47L35_OTP_HPDET_CAL_2 0x31FA |
| @@ -1441,6 +1448,12 @@ | |||
| 1441 | #define MADERA_OPCLK_ASYNC_SEL_WIDTH 3 | 1448 | #define MADERA_OPCLK_ASYNC_SEL_WIDTH 3 |
| 1442 | 1449 | ||
| 1443 | /* (0x0171) FLL1_Control_1 */ | 1450 | /* (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 | ||
| 1444 | #define MADERA_FLL1_FREERUN 0x0002 | 1457 | #define MADERA_FLL1_FREERUN 0x0002 |
| 1445 | #define MADERA_FLL1_FREERUN_MASK 0x0002 | 1458 | #define MADERA_FLL1_FREERUN_MASK 0x0002 |
| 1446 | #define MADERA_FLL1_FREERUN_SHIFT 1 | 1459 | #define MADERA_FLL1_FREERUN_SHIFT 1 |
| @@ -1473,6 +1486,9 @@ | |||
| 1473 | #define MADERA_FLL1_FRATIO_MASK 0x0F00 | 1486 | #define MADERA_FLL1_FRATIO_MASK 0x0F00 |
| 1474 | #define MADERA_FLL1_FRATIO_SHIFT 8 | 1487 | #define MADERA_FLL1_FRATIO_SHIFT 8 |
| 1475 | #define MADERA_FLL1_FRATIO_WIDTH 4 | 1488 | #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 | ||
| 1476 | 1492 | ||
| 1477 | /* (0x0176) FLL1_Control_6 */ | 1493 | /* (0x0176) FLL1_Control_6 */ |
| 1478 | #define MADERA_FLL1_REFCLK_DIV_MASK 0x00C0 | 1494 | #define MADERA_FLL1_REFCLK_DIV_MASK 0x00C0 |
| @@ -1482,15 +1498,6 @@ | |||
| 1482 | #define MADERA_FLL1_REFCLK_SRC_SHIFT 0 | 1498 | #define MADERA_FLL1_REFCLK_SRC_SHIFT 0 |
| 1483 | #define MADERA_FLL1_REFCLK_SRC_WIDTH 4 | 1499 | #define MADERA_FLL1_REFCLK_SRC_WIDTH 4 |
| 1484 | 1500 | ||
| 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 | |||
| 1494 | /* (0x0179) FLL1_Control_7 */ | 1501 | /* (0x0179) FLL1_Control_7 */ |
| 1495 | #define MADERA_FLL1_GAIN_MASK 0x003c | 1502 | #define MADERA_FLL1_GAIN_MASK 0x003c |
| 1496 | #define MADERA_FLL1_GAIN_SHIFT 2 | 1503 | #define MADERA_FLL1_GAIN_SHIFT 2 |
| @@ -1504,6 +1511,30 @@ | |||
| 1504 | #define MADERA_FLL1_PHASE_ENA_SHIFT 11 | 1511 | #define MADERA_FLL1_PHASE_ENA_SHIFT 11 |
| 1505 | #define MADERA_FLL1_PHASE_ENA_WIDTH 1 | 1512 | #define MADERA_FLL1_PHASE_ENA_WIDTH 1 |
| 1506 | 1513 | ||
| 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 | |||
| 1507 | /* (0x0181) FLL1_Synchroniser_1 */ | 1538 | /* (0x0181) FLL1_Synchroniser_1 */ |
| 1508 | #define MADERA_FLL1_SYNC_ENA 0x0001 | 1539 | #define MADERA_FLL1_SYNC_ENA 0x0001 |
| 1509 | #define MADERA_FLL1_SYNC_ENA_MASK 0x0001 | 1540 | #define MADERA_FLL1_SYNC_ENA_MASK 0x0001 |
| @@ -1625,6 +1656,13 @@ | |||
| 1625 | #define MADERA_LDO2_ENA_WIDTH 1 | 1656 | #define MADERA_LDO2_ENA_WIDTH 1 |
| 1626 | 1657 | ||
| 1627 | /* (0x0218) Mic_Bias_Ctrl_1 */ | 1658 | /* (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 | ||
| 1628 | #define MADERA_MICB1_ENA 0x0001 | 1666 | #define MADERA_MICB1_ENA 0x0001 |
| 1629 | #define MADERA_MICB1_ENA_MASK 0x0001 | 1667 | #define MADERA_MICB1_ENA_MASK 0x0001 |
| 1630 | #define MADERA_MICB1_ENA_SHIFT 0 | 1668 | #define MADERA_MICB1_ENA_SHIFT 0 |
| @@ -2308,6 +2346,17 @@ | |||
| 2308 | #define MADERA_OUT1R_ENA_SHIFT 0 | 2346 | #define MADERA_OUT1R_ENA_SHIFT 0 |
| 2309 | #define MADERA_OUT1R_ENA_WIDTH 1 | 2347 | #define MADERA_OUT1R_ENA_WIDTH 1 |
| 2310 | 2348 | ||
| 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 | |||
| 2311 | /* (0x0409) Output_Volume_Ramp */ | 2360 | /* (0x0409) Output_Volume_Ramp */ |
| 2312 | #define MADERA_OUT_VD_RAMP_MASK 0x0070 | 2361 | #define MADERA_OUT_VD_RAMP_MASK 0x0070 |
| 2313 | #define MADERA_OUT_VD_RAMP_SHIFT 4 | 2362 | #define MADERA_OUT_VD_RAMP_SHIFT 4 |
| @@ -2829,6 +2878,30 @@ | |||
| 2829 | #define MADERA_AIF2RX1_ENA_WIDTH 1 | 2878 | #define MADERA_AIF2RX1_ENA_WIDTH 1 |
| 2830 | 2879 | ||
| 2831 | /* (0x0599) AIF3_Tx_Enables */ | 2880 | /* (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 | ||
| 2832 | #define MADERA_AIF3TX2_ENA 0x0002 | 2905 | #define MADERA_AIF3TX2_ENA 0x0002 |
| 2833 | #define MADERA_AIF3TX2_ENA_MASK 0x0002 | 2906 | #define MADERA_AIF3TX2_ENA_MASK 0x0002 |
| 2834 | #define MADERA_AIF3TX2_ENA_SHIFT 1 | 2907 | #define MADERA_AIF3TX2_ENA_SHIFT 1 |
| @@ -2839,6 +2912,30 @@ | |||
| 2839 | #define MADERA_AIF3TX1_ENA_WIDTH 1 | 2912 | #define MADERA_AIF3TX1_ENA_WIDTH 1 |
| 2840 | 2913 | ||
| 2841 | /* (0x059A) AIF3_Rx_Enables */ | 2914 | /* (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 | ||
| 2842 | #define MADERA_AIF3RX2_ENA 0x0002 | 2939 | #define MADERA_AIF3RX2_ENA 0x0002 |
| 2843 | #define MADERA_AIF3RX2_ENA_MASK 0x0002 | 2940 | #define MADERA_AIF3RX2_ENA_MASK 0x0002 |
| 2844 | #define MADERA_AIF3RX2_ENA_SHIFT 1 | 2941 | #define MADERA_AIF3RX2_ENA_SHIFT 1 |
| @@ -3453,6 +3550,25 @@ | |||
| 3453 | #define MADERA_FCR_MIC_MODE_SEL_SHIFT 2 | 3550 | #define MADERA_FCR_MIC_MODE_SEL_SHIFT 2 |
| 3454 | #define MADERA_FCR_MIC_MODE_SEL_WIDTH 2 | 3551 | #define MADERA_FCR_MIC_MODE_SEL_WIDTH 2 |
| 3455 | 3552 | ||
| 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 | |||
| 3456 | /* (0x1480) DFC1_CTRL_W0 */ | 3572 | /* (0x1480) DFC1_CTRL_W0 */ |
| 3457 | #define MADERA_DFC1_RATE_MASK 0x007C | 3573 | #define MADERA_DFC1_RATE_MASK 0x007C |
| 3458 | #define MADERA_DFC1_RATE_SHIFT 2 | 3574 | #define MADERA_DFC1_RATE_SHIFT 2 |
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index 1d831c7222b9..7cfd2b0504df 100644 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h | |||
| @@ -374,6 +374,7 @@ enum rk805_reg { | |||
| 374 | #define SWITCH1_EN BIT(5) | 374 | #define SWITCH1_EN BIT(5) |
| 375 | #define DEV_OFF_RST BIT(3) | 375 | #define DEV_OFF_RST BIT(3) |
| 376 | #define DEV_OFF BIT(0) | 376 | #define DEV_OFF BIT(0) |
| 377 | #define RTC_STOP BIT(0) | ||
| 377 | 378 | ||
| 378 | #define VB_LO_ACT BIT(4) | 379 | #define VB_LO_ACT BIT(4) |
| 379 | #define VB_LO_SEL_3500MV (7 << 0) | 380 | #define VB_LO_SEL_3500MV (7 << 0) |
| @@ -387,7 +388,179 @@ enum rk805_reg { | |||
| 387 | #define SHUTDOWN_FUN (0x2 << 2) | 388 | #define SHUTDOWN_FUN (0x2 << 2) |
| 388 | #define SLEEP_FUN (0x1 << 2) | 389 | #define SLEEP_FUN (0x1 << 2) |
| 389 | #define RK8XX_ID_MSK 0xfff0 | 390 | #define RK8XX_ID_MSK 0xfff0 |
| 391 | #define PWM_MODE_MSK BIT(7) | ||
| 390 | #define FPWM_MODE BIT(7) | 392 | #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) | ||
| 391 | 564 | ||
| 392 | enum { | 565 | enum { |
| 393 | BUCK_ILMIN_50MA, | 566 | BUCK_ILMIN_50MA, |
| @@ -435,6 +608,8 @@ enum { | |||
| 435 | enum { | 608 | enum { |
| 436 | RK805_ID = 0x8050, | 609 | RK805_ID = 0x8050, |
| 437 | RK808_ID = 0x0000, | 610 | RK808_ID = 0x0000, |
| 611 | RK809_ID = 0x8090, | ||
| 612 | RK817_ID = 0x8170, | ||
| 438 | RK818_ID = 0x8181, | 613 | RK818_ID = 0x8181, |
| 439 | }; | 614 | }; |
| 440 | 615 | ||
| @@ -445,5 +620,7 @@ struct rk808 { | |||
| 445 | long variant; | 620 | long variant; |
| 446 | const struct regmap_config *regmap_cfg; | 621 | const struct regmap_config *regmap_cfg; |
| 447 | const struct regmap_irq_chip *regmap_irq_chip; | 622 | const struct regmap_irq_chip *regmap_irq_chip; |
| 623 | void (*pm_pwroff_fn)(void); | ||
| 624 | void (*pm_pwroff_prep_fn)(void); | ||
| 448 | }; | 625 | }; |
| 449 | #endif /* __LINUX_REGULATOR_RK808_H */ | 626 | #endif /* __LINUX_REGULATOR_RK808_H */ |
diff --git a/include/linux/mfd/rohm-bd70528.h b/include/linux/mfd/rohm-bd70528.h new file mode 100644 index 000000000000..1013e60c5b25 --- /dev/null +++ b/include/linux/mfd/rohm-bd70528.h | |||
| @@ -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__ */ | ||
diff --git a/include/linux/mfd/rohm-bd718x7.h b/include/linux/mfd/rohm-bd718x7.h index fd194bfc836f..7f2dbde402a1 100644 --- a/include/linux/mfd/rohm-bd718x7.h +++ b/include/linux/mfd/rohm-bd718x7.h | |||
| @@ -4,15 +4,10 @@ | |||
| 4 | #ifndef __LINUX_MFD_BD718XX_H__ | 4 | #ifndef __LINUX_MFD_BD718XX_H__ |
| 5 | #define __LINUX_MFD_BD718XX_H__ | 5 | #define __LINUX_MFD_BD718XX_H__ |
| 6 | 6 | ||
| 7 | #include <linux/mfd/rohm-generic.h> | ||
| 7 | #include <linux/regmap.h> | 8 | #include <linux/regmap.h> |
| 8 | 9 | ||
| 9 | enum { | 10 | enum { |
| 10 | BD718XX_TYPE_BD71837 = 0, | ||
| 11 | BD718XX_TYPE_BD71847, | ||
| 12 | BD718XX_TYPE_AMOUNT | ||
| 13 | }; | ||
| 14 | |||
| 15 | enum { | ||
| 16 | BD718XX_BUCK1 = 0, | 11 | BD718XX_BUCK1 = 0, |
| 17 | BD718XX_BUCK2, | 12 | BD718XX_BUCK2, |
| 18 | BD718XX_BUCK3, | 13 | BD718XX_BUCK3, |
| @@ -321,18 +316,17 @@ enum { | |||
| 321 | BD718XX_PWRBTN_LONG_PRESS_15S | 316 | BD718XX_PWRBTN_LONG_PRESS_15S |
| 322 | }; | 317 | }; |
| 323 | 318 | ||
| 324 | struct bd718xx_clk; | ||
| 325 | |||
| 326 | struct bd718xx { | 319 | struct bd718xx { |
| 327 | unsigned int chip_type; | 320 | /* |
| 328 | struct device *dev; | 321 | * Please keep this as the first member here as some |
| 329 | struct regmap *regmap; | 322 | * drivers (clk) supporting more than one chip may only know this |
| 330 | unsigned long int id; | 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; | ||
| 331 | 327 | ||
| 332 | int chip_irq; | 328 | int chip_irq; |
| 333 | struct regmap_irq_chip_data *irq_data; | 329 | struct regmap_irq_chip_data *irq_data; |
| 334 | |||
| 335 | struct bd718xx_clk *clk; | ||
| 336 | }; | 330 | }; |
| 337 | 331 | ||
| 338 | #endif /* __LINUX_MFD_BD718XX_H__ */ | 332 | #endif /* __LINUX_MFD_BD718XX_H__ */ |
diff --git a/include/linux/mfd/rohm-generic.h b/include/linux/mfd/rohm-generic.h new file mode 100644 index 000000000000..bff15ac26f2c --- /dev/null +++ b/include/linux/mfd/rohm-generic.h | |||
| @@ -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 | ||
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h index 3ca17eb89aa2..f1631a39acfc 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #define MIN_850_MV 850000 | 20 | #define MIN_850_MV 850000 |
| 21 | #define MIN_800_MV 800000 | 21 | #define MIN_800_MV 800000 |
| 22 | #define MIN_750_MV 750000 | 22 | #define MIN_750_MV 750000 |
| 23 | #define MIN_650_MV 650000 | ||
| 23 | #define MIN_600_MV 600000 | 24 | #define MIN_600_MV 600000 |
| 24 | #define MIN_500_MV 500000 | 25 | #define MIN_500_MV 500000 |
| 25 | 26 | ||
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h index 6e7668a389a1..4805c90609c4 100644 --- a/include/linux/mfd/samsung/s2mps11.h +++ b/include/linux/mfd/samsung/s2mps11.h | |||
| @@ -170,7 +170,9 @@ enum s2mps11_regulators { | |||
| 170 | #define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT) | 170 | #define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT) |
| 171 | #define S2MPS11_ENABLE_SHIFT 0x06 | 171 | #define S2MPS11_ENABLE_SHIFT 0x06 |
| 172 | #define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1) | 172 | #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 | ||
| 174 | #define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1) | 176 | #define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1) |
| 175 | #define S2MPS11_RAMP_DELAY 25000 /* uV/us */ | 177 | #define S2MPS11_RAMP_DELAY 25000 /* uV/us */ |
| 176 | 178 | ||
| @@ -188,4 +190,9 @@ enum s2mps11_regulators { | |||
| 188 | #define S2MPS11_BUCK6_RAMP_EN_SHIFT 0 | 190 | #define S2MPS11_BUCK6_RAMP_EN_SHIFT 0 |
| 189 | #define S2MPS11_PMIC_EN_SHIFT 6 | 191 | #define S2MPS11_PMIC_EN_SHIFT 6 |
| 190 | 192 | ||
| 193 | /* | ||
| 194 | * Bits for "enable suspend" (On/Off controlled by PWREN) | ||
| 195 | * are the same as in S2MPS14: S2MPS14_ENABLE_SUSPEND | ||
| 196 | */ | ||
| 197 | |||
| 191 | #endif /* __LINUX_MFD_S2MPS11_H */ | 198 | #endif /* __LINUX_MFD_S2MPS11_H */ |
diff --git a/include/linux/mfd/stmfx.h b/include/linux/mfd/stmfx.h index d890595b89b6..3c67983678ec 100644 --- a/include/linux/mfd/stmfx.h +++ b/include/linux/mfd/stmfx.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef MFD_STMFX_H | 7 | #ifndef MFD_STMFX_H |
| 8 | #define MFX_STMFX_H | 8 | #define MFD_STMFX_H |
| 9 | 9 | ||
| 10 | #include <linux/regmap.h> | 10 | #include <linux/regmap.h> |
| 11 | 11 | ||
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h index f0273c9e972b..8cfda0554381 100644 --- a/include/linux/mfd/syscon.h +++ b/include/linux/mfd/syscon.h | |||
| @@ -19,7 +19,6 @@ struct device_node; | |||
| 19 | #ifdef CONFIG_MFD_SYSCON | 19 | #ifdef CONFIG_MFD_SYSCON |
| 20 | extern struct regmap *syscon_node_to_regmap(struct device_node *np); | 20 | extern struct regmap *syscon_node_to_regmap(struct device_node *np); |
| 21 | extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); | 21 | extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); |
| 22 | extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s); | ||
| 23 | extern struct regmap *syscon_regmap_lookup_by_phandle( | 22 | extern struct regmap *syscon_regmap_lookup_by_phandle( |
| 24 | struct device_node *np, | 23 | struct device_node *np, |
| 25 | const char *property); | 24 | const char *property); |
| @@ -34,11 +33,6 @@ static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s) | |||
| 34 | return ERR_PTR(-ENOTSUPP); | 33 | return ERR_PTR(-ENOTSUPP); |
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s) | ||
| 38 | { | ||
| 39 | return ERR_PTR(-ENOTSUPP); | ||
| 40 | } | ||
| 41 | |||
| 42 | static inline struct regmap *syscon_regmap_lookup_by_phandle( | 36 | static inline struct regmap *syscon_regmap_lookup_by_phandle( |
| 43 | struct device_node *np, | 37 | struct device_node *np, |
| 44 | const char *property) | 38 | const char *property) |
diff --git a/include/linux/mfd/ti-lmu-register.h b/include/linux/mfd/ti-lmu-register.h index 222cb14c5b0f..116a749e0302 100644 --- a/include/linux/mfd/ti-lmu-register.h +++ b/include/linux/mfd/ti-lmu-register.h | |||
| @@ -187,47 +187,26 @@ | |||
| 187 | 187 | ||
| 188 | #define LM3695_MAX_REG 0x14 | 188 | #define LM3695_MAX_REG 0x14 |
| 189 | 189 | ||
| 190 | /* LM3697 */ | 190 | /* LM36274 */ |
| 191 | #define LM3697_REG_HVLED_OUTPUT_CFG 0x10 | 191 | #define LM36274_REG_REV 0x01 |
| 192 | #define LM3697_HVLED1_CFG_MASK BIT(0) | 192 | #define LM36274_REG_BL_CFG_1 0x02 |
| 193 | #define LM3697_HVLED2_CFG_MASK BIT(1) | 193 | #define LM36274_REG_BL_CFG_2 0x03 |
| 194 | #define LM3697_HVLED3_CFG_MASK BIT(2) | 194 | #define LM36274_REG_BRT_LSB 0x04 |
| 195 | #define LM3697_HVLED1_CFG_SHIFT 0 | 195 | #define LM36274_REG_BRT_MSB 0x05 |
| 196 | #define LM3697_HVLED2_CFG_SHIFT 1 | 196 | #define LM36274_REG_BL_EN 0x08 |
| 197 | #define LM3697_HVLED3_CFG_SHIFT 2 | 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 | ||
| 198 | 211 | ||
| 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 | ||
| 233 | #endif | 212 | #endif |
diff --git a/include/linux/mfd/ti-lmu.h b/include/linux/mfd/ti-lmu.h index 7d1e9c24f818..0bc0e8199798 100644 --- a/include/linux/mfd/ti-lmu.h +++ b/include/linux/mfd/ti-lmu.h | |||
| @@ -23,7 +23,7 @@ enum ti_lmu_id { | |||
| 23 | LM3632, | 23 | LM3632, |
| 24 | LM3633, | 24 | LM3633, |
| 25 | LM3695, | 25 | LM3695, |
| 26 | LM3697, | 26 | LM36274, |
| 27 | LMU_MAX_ID, | 27 | LMU_MAX_ID, |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| @@ -65,6 +65,9 @@ enum lm363x_regulator_id { | |||
| 65 | LM3632_BOOST, /* Boost output */ | 65 | LM3632_BOOST, /* Boost output */ |
| 66 | LM3632_LDO_POS, /* Positive display bias output */ | 66 | LM3632_LDO_POS, /* Positive display bias output */ |
| 67 | LM3632_LDO_NEG, /* Negative display bias output */ | 67 | 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 */ | ||
| 68 | }; | 71 | }; |
| 69 | 72 | ||
| 70 | /** | 73 | /** |
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h index 071cdf3e16cf..986986fe4e4e 100644 --- a/include/linux/mfd/wm831x/pdata.h +++ b/include/linux/mfd/wm831x/pdata.h | |||
| @@ -47,7 +47,6 @@ struct wm831x_battery_pdata { | |||
| 47 | * I2C or SPI buses. | 47 | * I2C or SPI buses. |
| 48 | */ | 48 | */ |
| 49 | struct wm831x_buckv_pdata { | 49 | struct wm831x_buckv_pdata { |
| 50 | int dvs_gpio; /** CPU GPIO to use for DVS switching */ | ||
| 51 | int dvs_control_src; /** Hardware DVS source to use (1 or 2) */ | 50 | int dvs_control_src; /** Hardware DVS source to use (1 or 2) */ |
| 52 | int dvs_init_state; /** DVS state to expect on startup */ | 51 | int dvs_init_state; /** DVS state to expect on startup */ |
| 53 | int dvs_state_gpio; /** CPU GPIO to use for monitoring status */ | 52 | int dvs_state_gpio; /** CPU GPIO to use for monitoring status */ |
diff --git a/include/linux/mlx5/accel.h b/include/linux/mlx5/accel.h index 70e7e5673ce9..5613e677a5f9 100644 --- a/include/linux/mlx5/accel.h +++ b/include/linux/mlx5/accel.h | |||
| @@ -114,7 +114,7 @@ enum mlx5_accel_ipsec_cap { | |||
| 114 | MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN = 1 << 7, | 114 | MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN = 1 << 7, |
| 115 | }; | 115 | }; |
| 116 | 116 | ||
| 117 | #ifdef CONFIG_MLX5_ACCEL | 117 | #ifdef CONFIG_MLX5_FPGA_IPSEC |
| 118 | 118 | ||
| 119 | u32 mlx5_accel_ipsec_device_caps(struct mlx5_core_dev *mdev); | 119 | u32 mlx5_accel_ipsec_device_caps(struct mlx5_core_dev *mdev); |
| 120 | 120 | ||
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h index 769326ea1d9b..40748fc1b11b 100644 --- a/include/linux/mlx5/cq.h +++ b/include/linux/mlx5/cq.h | |||
| @@ -47,7 +47,7 @@ struct mlx5_core_cq { | |||
| 47 | struct completion free; | 47 | struct completion free; |
| 48 | unsigned vector; | 48 | unsigned vector; |
| 49 | unsigned int irqn; | 49 | unsigned int irqn; |
| 50 | void (*comp) (struct mlx5_core_cq *); | 50 | void (*comp)(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe); |
| 51 | void (*event) (struct mlx5_core_cq *, enum mlx5_event); | 51 | void (*event) (struct mlx5_core_cq *, enum mlx5_event); |
| 52 | u32 cons_index; | 52 | u32 cons_index; |
| 53 | unsigned arm_sn; | 53 | unsigned arm_sn; |
| @@ -55,7 +55,7 @@ struct mlx5_core_cq { | |||
| 55 | int pid; | 55 | int pid; |
| 56 | struct { | 56 | struct { |
| 57 | struct list_head list; | 57 | struct list_head list; |
| 58 | void (*comp)(struct mlx5_core_cq *); | 58 | void (*comp)(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe); |
| 59 | void *priv; | 59 | void *priv; |
| 60 | } tasklet_ctx; | 60 | } tasklet_ctx; |
| 61 | int reset_notify_added; | 61 | int reset_notify_added; |
| @@ -185,7 +185,7 @@ static inline void mlx5_cq_put(struct mlx5_core_cq *cq) | |||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, | 187 | 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); |
| 189 | int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); | 189 | int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); |
| 190 | int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, | 190 | int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, |
| 191 | u32 *out, int outlen); | 191 | u32 *out, int outlen); |
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index fc2b6e807f06..ce9839c8bc1a 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
| @@ -342,7 +342,7 @@ enum mlx5_event { | |||
| 342 | MLX5_EVENT_TYPE_PAGE_FAULT = 0xc, | 342 | MLX5_EVENT_TYPE_PAGE_FAULT = 0xc, |
| 343 | MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd, | 343 | MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd, |
| 344 | 344 | ||
| 345 | MLX5_EVENT_TYPE_HOST_PARAMS_CHANGE = 0xe, | 345 | MLX5_EVENT_TYPE_ESW_FUNCTIONS_CHANGED = 0xe, |
| 346 | 346 | ||
| 347 | MLX5_EVENT_TYPE_DCT_DRAINED = 0x1c, | 347 | MLX5_EVENT_TYPE_DCT_DRAINED = 0x1c, |
| 348 | 348 | ||
| @@ -351,7 +351,7 @@ enum mlx5_event { | |||
| 351 | 351 | ||
| 352 | MLX5_EVENT_TYPE_DEVICE_TRACER = 0x26, | 352 | MLX5_EVENT_TYPE_DEVICE_TRACER = 0x26, |
| 353 | 353 | ||
| 354 | MLX5_EVENT_TYPE_MAX = MLX5_EVENT_TYPE_DEVICE_TRACER + 1, | 354 | MLX5_EVENT_TYPE_MAX = 0x100, |
| 355 | }; | 355 | }; |
| 356 | 356 | ||
| 357 | enum { | 357 | enum { |
| @@ -437,6 +437,7 @@ enum { | |||
| 437 | MLX5_OPCODE_SET_PSV = 0x20, | 437 | MLX5_OPCODE_SET_PSV = 0x20, |
| 438 | MLX5_OPCODE_GET_PSV = 0x21, | 438 | MLX5_OPCODE_GET_PSV = 0x21, |
| 439 | MLX5_OPCODE_CHECK_PSV = 0x22, | 439 | MLX5_OPCODE_CHECK_PSV = 0x22, |
| 440 | MLX5_OPCODE_DUMP = 0x23, | ||
| 440 | MLX5_OPCODE_RGET_PSV = 0x26, | 441 | MLX5_OPCODE_RGET_PSV = 0x26, |
| 441 | MLX5_OPCODE_RCHECK_PSV = 0x27, | 442 | MLX5_OPCODE_RCHECK_PSV = 0x27, |
| 442 | 443 | ||
| @@ -445,6 +446,14 @@ enum { | |||
| 445 | }; | 446 | }; |
| 446 | 447 | ||
| 447 | enum { | 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 | |||
| 456 | enum { | ||
| 448 | MLX5_SET_PORT_RESET_QKEY = 0, | 457 | MLX5_SET_PORT_RESET_QKEY = 0, |
| 449 | MLX5_SET_PORT_GUID0 = 16, | 458 | MLX5_SET_PORT_GUID0 = 16, |
| 450 | MLX5_SET_PORT_NODE_GUID = 17, | 459 | MLX5_SET_PORT_NODE_GUID = 17, |
| @@ -510,6 +519,10 @@ struct mlx5_cmd_layout { | |||
| 510 | u8 status_own; | 519 | u8 status_own; |
| 511 | }; | 520 | }; |
| 512 | 521 | ||
| 522 | enum mlx5_fatal_assert_bit_offsets { | ||
| 523 | MLX5_RFR_OFFSET = 31, | ||
| 524 | }; | ||
| 525 | |||
| 513 | struct health_buffer { | 526 | struct health_buffer { |
| 514 | __be32 assert_var[5]; | 527 | __be32 assert_var[5]; |
| 515 | __be32 rsvd0[3]; | 528 | __be32 rsvd0[3]; |
| @@ -518,12 +531,16 @@ struct health_buffer { | |||
| 518 | __be32 rsvd1[2]; | 531 | __be32 rsvd1[2]; |
| 519 | __be32 fw_ver; | 532 | __be32 fw_ver; |
| 520 | __be32 hw_id; | 533 | __be32 hw_id; |
| 521 | __be32 rsvd2; | 534 | __be32 rfr; |
| 522 | u8 irisc_index; | 535 | u8 irisc_index; |
| 523 | u8 synd; | 536 | u8 synd; |
| 524 | __be16 ext_synd; | 537 | __be16 ext_synd; |
| 525 | }; | 538 | }; |
| 526 | 539 | ||
| 540 | enum mlx5_initializing_bit_offsets { | ||
| 541 | MLX5_FW_RESET_SUPPORTED_OFFSET = 30, | ||
| 542 | }; | ||
| 543 | |||
| 527 | enum mlx5_cmd_addr_l_sz_offset { | 544 | enum mlx5_cmd_addr_l_sz_offset { |
| 528 | MLX5_NIC_IFC_OFFSET = 8, | 545 | MLX5_NIC_IFC_OFFSET = 8, |
| 529 | }; | 546 | }; |
| @@ -1077,6 +1094,9 @@ enum mlx5_cap_type { | |||
| 1077 | MLX5_CAP_DEBUG, | 1094 | MLX5_CAP_DEBUG, |
| 1078 | MLX5_CAP_RESERVED_14, | 1095 | MLX5_CAP_RESERVED_14, |
| 1079 | MLX5_CAP_DEV_MEM, | 1096 | MLX5_CAP_DEV_MEM, |
| 1097 | MLX5_CAP_RESERVED_16, | ||
| 1098 | MLX5_CAP_TLS, | ||
| 1099 | MLX5_CAP_DEV_EVENT = 0x14, | ||
| 1080 | /* NUM OF CAP Types */ | 1100 | /* NUM OF CAP Types */ |
| 1081 | MLX5_CAP_NUM | 1101 | MLX5_CAP_NUM |
| 1082 | }; | 1102 | }; |
| @@ -1255,6 +1275,12 @@ enum mlx5_qcam_feature_groups { | |||
| 1255 | #define MLX5_CAP64_DEV_MEM(mdev, cap)\ | 1275 | #define MLX5_CAP64_DEV_MEM(mdev, cap)\ |
| 1256 | MLX5_GET64(device_mem_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_MEM], cap) | 1276 | MLX5_GET64(device_mem_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_MEM], cap) |
| 1257 | 1277 | ||
| 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 | |||
| 1258 | enum { | 1284 | enum { |
| 1259 | MLX5_CMD_STAT_OK = 0x0, | 1285 | MLX5_CMD_STAT_OK = 0x0, |
| 1260 | MLX5_CMD_STAT_INT_ERR = 0x1, | 1286 | MLX5_CMD_STAT_INT_ERR = 0x1, |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 5a27246db883..0e6da1840c7d 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | #include <linux/semaphore.h> | 41 | #include <linux/semaphore.h> |
| 42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
| 43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
| 44 | #include <linux/radix-tree.h> | 44 | #include <linux/xarray.h> |
| 45 | #include <linux/workqueue.h> | 45 | #include <linux/workqueue.h> |
| 46 | #include <linux/mempool.h> | 46 | #include <linux/mempool.h> |
| 47 | #include <linux/interrupt.h> | 47 | #include <linux/interrupt.h> |
| @@ -53,6 +53,7 @@ | |||
| 53 | #include <linux/mlx5/eq.h> | 53 | #include <linux/mlx5/eq.h> |
| 54 | #include <linux/timecounter.h> | 54 | #include <linux/timecounter.h> |
| 55 | #include <linux/ptp_clock_kernel.h> | 55 | #include <linux/ptp_clock_kernel.h> |
| 56 | #include <net/devlink.h> | ||
| 56 | 57 | ||
| 57 | enum { | 58 | enum { |
| 58 | MLX5_BOARD_ID_LEN = 64, | 59 | MLX5_BOARD_ID_LEN = 64, |
| @@ -107,6 +108,7 @@ enum { | |||
| 107 | MLX5_REG_FPGA_CAP = 0x4022, | 108 | MLX5_REG_FPGA_CAP = 0x4022, |
| 108 | MLX5_REG_FPGA_CTRL = 0x4023, | 109 | MLX5_REG_FPGA_CTRL = 0x4023, |
| 109 | MLX5_REG_FPGA_ACCESS_REG = 0x4024, | 110 | MLX5_REG_FPGA_ACCESS_REG = 0x4024, |
| 111 | MLX5_REG_CORE_DUMP = 0x402e, | ||
| 110 | MLX5_REG_PCAP = 0x5001, | 112 | MLX5_REG_PCAP = 0x5001, |
| 111 | MLX5_REG_PMTU = 0x5003, | 113 | MLX5_REG_PMTU = 0x5003, |
| 112 | MLX5_REG_PTYS = 0x5004, | 114 | MLX5_REG_PTYS = 0x5004, |
| @@ -137,6 +139,7 @@ enum { | |||
| 137 | MLX5_REG_MTPPS = 0x9053, | 139 | MLX5_REG_MTPPS = 0x9053, |
| 138 | MLX5_REG_MTPPSE = 0x9054, | 140 | MLX5_REG_MTPPSE = 0x9054, |
| 139 | MLX5_REG_MPEGC = 0x9056, | 141 | MLX5_REG_MPEGC = 0x9056, |
| 142 | MLX5_REG_MCQS = 0x9060, | ||
| 140 | MLX5_REG_MCQI = 0x9061, | 143 | MLX5_REG_MCQI = 0x9061, |
| 141 | MLX5_REG_MCC = 0x9062, | 144 | MLX5_REG_MCC = 0x9062, |
| 142 | MLX5_REG_MCDA = 0x9063, | 145 | MLX5_REG_MCDA = 0x9063, |
| @@ -180,6 +183,11 @@ enum port_state_policy { | |||
| 180 | MLX5_POLICY_INVALID = 0xffffffff | 183 | MLX5_POLICY_INVALID = 0xffffffff |
| 181 | }; | 184 | }; |
| 182 | 185 | ||
| 186 | enum mlx5_coredev_type { | ||
| 187 | MLX5_COREDEV_PF, | ||
| 188 | MLX5_COREDEV_VF | ||
| 189 | }; | ||
| 190 | |||
| 183 | struct mlx5_field_desc { | 191 | struct mlx5_field_desc { |
| 184 | struct dentry *dent; | 192 | struct dentry *dent; |
| 185 | int i; | 193 | int i; |
| @@ -433,13 +441,18 @@ struct mlx5_core_health { | |||
| 433 | struct timer_list timer; | 441 | struct timer_list timer; |
| 434 | u32 prev; | 442 | u32 prev; |
| 435 | int miss_counter; | 443 | int miss_counter; |
| 436 | bool sick; | 444 | u8 synd; |
| 445 | u32 fatal_error; | ||
| 446 | u32 crdump_size; | ||
| 437 | /* wq spinlock to synchronize draining */ | 447 | /* wq spinlock to synchronize draining */ |
| 438 | spinlock_t wq_lock; | 448 | spinlock_t wq_lock; |
| 439 | struct workqueue_struct *wq; | 449 | struct workqueue_struct *wq; |
| 440 | unsigned long flags; | 450 | unsigned long flags; |
| 441 | struct work_struct work; | 451 | struct work_struct fatal_report_work; |
| 452 | struct work_struct report_work; | ||
| 442 | struct delayed_work recover_work; | 453 | struct delayed_work recover_work; |
| 454 | struct devlink_health_reporter *fw_reporter; | ||
| 455 | struct devlink_health_reporter *fw_fatal_reporter; | ||
| 443 | }; | 456 | }; |
| 444 | 457 | ||
| 445 | struct mlx5_qp_table { | 458 | struct mlx5_qp_table { |
| @@ -451,13 +464,6 @@ struct mlx5_qp_table { | |||
| 451 | struct radix_tree_root tree; | 464 | struct radix_tree_root tree; |
| 452 | }; | 465 | }; |
| 453 | 466 | ||
| 454 | struct mlx5_mkey_table { | ||
| 455 | /* protect radix tree | ||
| 456 | */ | ||
| 457 | rwlock_t lock; | ||
| 458 | struct radix_tree_root tree; | ||
| 459 | }; | ||
| 460 | |||
| 461 | struct mlx5_vf_context { | 467 | struct mlx5_vf_context { |
| 462 | int enabled; | 468 | int enabled; |
| 463 | u64 port_guid; | 469 | u64 port_guid; |
| @@ -468,7 +474,7 @@ struct mlx5_vf_context { | |||
| 468 | struct mlx5_core_sriov { | 474 | struct mlx5_core_sriov { |
| 469 | struct mlx5_vf_context *vfs_ctx; | 475 | struct mlx5_vf_context *vfs_ctx; |
| 470 | int num_vfs; | 476 | int num_vfs; |
| 471 | int enabled_vfs; | 477 | u16 max_vfs; |
| 472 | }; | 478 | }; |
| 473 | 479 | ||
| 474 | struct mlx5_fc_stats { | 480 | struct mlx5_fc_stats { |
| @@ -490,6 +496,7 @@ struct mlx5_eswitch; | |||
| 490 | struct mlx5_lag; | 496 | struct mlx5_lag; |
| 491 | struct mlx5_devcom; | 497 | struct mlx5_devcom; |
| 492 | struct mlx5_eq_table; | 498 | struct mlx5_eq_table; |
| 499 | struct mlx5_irq_table; | ||
| 493 | 500 | ||
| 494 | struct mlx5_rate_limit { | 501 | struct mlx5_rate_limit { |
| 495 | u32 rate; | 502 | u32 rate; |
| @@ -519,6 +526,8 @@ struct mlx5_core_roce { | |||
| 519 | }; | 526 | }; |
| 520 | 527 | ||
| 521 | struct mlx5_priv { | 528 | struct mlx5_priv { |
| 529 | /* IRQ table valid only for real pci devices PF or VF */ | ||
| 530 | struct mlx5_irq_table *irq_table; | ||
| 522 | struct mlx5_eq_table *eq_table; | 531 | struct mlx5_eq_table *eq_table; |
| 523 | 532 | ||
| 524 | /* pages stuff */ | 533 | /* pages stuff */ |
| @@ -541,9 +550,7 @@ struct mlx5_priv { | |||
| 541 | struct dentry *cmdif_debugfs; | 550 | struct dentry *cmdif_debugfs; |
| 542 | /* end: qp staff */ | 551 | /* end: qp staff */ |
| 543 | 552 | ||
| 544 | /* start: mkey staff */ | 553 | struct xarray mkey_table; |
| 545 | struct mlx5_mkey_table mkey_table; | ||
| 546 | /* end: mkey staff */ | ||
| 547 | 554 | ||
| 548 | /* start: alloc staff */ | 555 | /* start: alloc staff */ |
| 549 | /* protect buffer alocation according to numa node */ | 556 | /* protect buffer alocation according to numa node */ |
| @@ -570,7 +577,6 @@ struct mlx5_priv { | |||
| 570 | struct mlx5_core_sriov sriov; | 577 | struct mlx5_core_sriov sriov; |
| 571 | struct mlx5_lag *lag; | 578 | struct mlx5_lag *lag; |
| 572 | struct mlx5_devcom *devcom; | 579 | struct mlx5_devcom *devcom; |
| 573 | unsigned long pci_dev_data; | ||
| 574 | struct mlx5_core_roce roce; | 580 | struct mlx5_core_roce roce; |
| 575 | struct mlx5_fc_stats fc_stats; | 581 | struct mlx5_fc_stats fc_stats; |
| 576 | struct mlx5_rl_table rl_table; | 582 | struct mlx5_rl_table rl_table; |
| @@ -580,6 +586,7 @@ struct mlx5_priv { | |||
| 580 | }; | 586 | }; |
| 581 | 587 | ||
| 582 | enum mlx5_device_state { | 588 | enum mlx5_device_state { |
| 589 | MLX5_DEVICE_STATE_UNINITIALIZED, | ||
| 583 | MLX5_DEVICE_STATE_UP, | 590 | MLX5_DEVICE_STATE_UP, |
| 584 | MLX5_DEVICE_STATE_INTERNAL_ERROR, | 591 | MLX5_DEVICE_STATE_INTERNAL_ERROR, |
| 585 | }; | 592 | }; |
| @@ -646,9 +653,11 @@ struct mlx5_clock { | |||
| 646 | 653 | ||
| 647 | struct mlx5_fw_tracer; | 654 | struct mlx5_fw_tracer; |
| 648 | struct mlx5_vxlan; | 655 | struct mlx5_vxlan; |
| 656 | struct mlx5_geneve; | ||
| 649 | 657 | ||
| 650 | struct mlx5_core_dev { | 658 | struct mlx5_core_dev { |
| 651 | struct device *device; | 659 | struct device *device; |
| 660 | enum mlx5_coredev_type coredev_type; | ||
| 652 | struct pci_dev *pdev; | 661 | struct pci_dev *pdev; |
| 653 | /* sync pci state */ | 662 | /* sync pci state */ |
| 654 | struct mutex pci_status_mutex; | 663 | struct mutex pci_status_mutex; |
| @@ -680,6 +689,7 @@ struct mlx5_core_dev { | |||
| 680 | u32 issi; | 689 | u32 issi; |
| 681 | struct mlx5e_resources mlx5e_res; | 690 | struct mlx5e_resources mlx5e_res; |
| 682 | struct mlx5_vxlan *vxlan; | 691 | struct mlx5_vxlan *vxlan; |
| 692 | struct mlx5_geneve *geneve; | ||
| 683 | struct { | 693 | struct { |
| 684 | struct mlx5_rsvd_gids reserved_gids; | 694 | struct mlx5_rsvd_gids reserved_gids; |
| 685 | u32 roce_en; | 695 | u32 roce_en; |
| @@ -690,6 +700,7 @@ struct mlx5_core_dev { | |||
| 690 | struct mlx5_clock clock; | 700 | struct mlx5_clock clock; |
| 691 | struct mlx5_ib_clock_info *clock_info; | 701 | struct mlx5_ib_clock_info *clock_info; |
| 692 | struct mlx5_fw_tracer *tracer; | 702 | struct mlx5_fw_tracer *tracer; |
| 703 | u32 vsc_addr; | ||
| 693 | }; | 704 | }; |
| 694 | 705 | ||
| 695 | struct mlx5_db { | 706 | struct mlx5_db { |
| @@ -901,7 +912,6 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev); | |||
| 901 | void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); | 912 | void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); |
| 902 | void mlx5_drain_health_wq(struct mlx5_core_dev *dev); | 913 | void mlx5_drain_health_wq(struct mlx5_core_dev *dev); |
| 903 | void mlx5_trigger_health_work(struct mlx5_core_dev *dev); | 914 | void mlx5_trigger_health_work(struct mlx5_core_dev *dev); |
| 904 | void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); | ||
| 905 | int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, | 915 | int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, |
| 906 | struct mlx5_frag_buf *buf, int node); | 916 | struct mlx5_frag_buf *buf, int node); |
| 907 | int mlx5_buf_alloc(struct mlx5_core_dev *dev, | 917 | int mlx5_buf_alloc(struct mlx5_core_dev *dev, |
| @@ -1042,6 +1052,8 @@ int mlx5_register_interface(struct mlx5_interface *intf); | |||
| 1042 | void mlx5_unregister_interface(struct mlx5_interface *intf); | 1052 | void mlx5_unregister_interface(struct mlx5_interface *intf); |
| 1043 | int mlx5_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb); | 1053 | int mlx5_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb); |
| 1044 | int mlx5_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *nb); | 1054 | 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); | ||
| 1045 | 1057 | ||
| 1046 | int mlx5_core_query_vendor_id(struct mlx5_core_dev *mdev, u32 *vendor_id); | 1058 | int mlx5_core_query_vendor_id(struct mlx5_core_dev *mdev, u32 *vendor_id); |
| 1047 | 1059 | ||
| @@ -1082,9 +1094,9 @@ enum { | |||
| 1082 | MLX5_PCI_DEV_IS_VF = 1 << 0, | 1094 | MLX5_PCI_DEV_IS_VF = 1 << 0, |
| 1083 | }; | 1095 | }; |
| 1084 | 1096 | ||
| 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) |
| 1086 | { | 1098 | { |
| 1087 | return !(dev->priv.pci_dev_data & MLX5_PCI_DEV_IS_VF); | 1099 | return dev->coredev_type == MLX5_COREDEV_PF; |
| 1088 | } | 1100 | } |
| 1089 | 1101 | ||
| 1090 | static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev) | 1102 | 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) | |||
| 1092 | return dev->caps.embedded_cpu; | 1104 | return dev->caps.embedded_cpu; |
| 1093 | } | 1105 | } |
| 1094 | 1106 | ||
| 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) | ||
| 1096 | { | 1109 | { |
| 1097 | return dev->caps.embedded_cpu && MLX5_CAP_GEN(dev, eswitch_manager); | 1110 | return dev->caps.embedded_cpu && MLX5_CAP_GEN(dev, eswitch_manager); |
| 1098 | } | 1111 | } |
| 1099 | 1112 | ||
| 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) |
| 1101 | { | 1114 | { |
| 1102 | return mlx5_core_is_pf(dev) && MLX5_CAP_ESW(dev, ecpf_vport_exists); | 1115 | return mlx5_core_is_pf(dev) && MLX5_CAP_ESW(dev, ecpf_vport_exists); |
| 1103 | } | 1116 | } |
| 1104 | 1117 | ||
| 1105 | #define MLX5_HOST_PF_MAX_VFS (127u) | 1118 | static inline u16 mlx5_core_max_vfs(const struct mlx5_core_dev *dev) |
| 1106 | static inline u16 mlx5_core_max_vfs(struct mlx5_core_dev *dev) | ||
| 1107 | { | 1119 | { |
| 1108 | if (mlx5_core_is_ecpf_esw_manager(dev)) | 1120 | return dev->priv.sriov.max_vfs; |
| 1109 | return MLX5_HOST_PF_MAX_VFS; | ||
| 1110 | else | ||
| 1111 | return pci_sriov_get_totalvfs(dev->pdev); | ||
| 1112 | } | 1121 | } |
| 1113 | 1122 | ||
| 1114 | static inline int mlx5_get_gid_table_len(u16 param) | 1123 | static inline int mlx5_get_gid_table_len(u16 param) |
diff --git a/include/linux/mlx5/eq.h b/include/linux/mlx5/eq.h index 00045cc4ea11..e49d8c0d4f26 100644 --- a/include/linux/mlx5/eq.h +++ b/include/linux/mlx5/eq.h | |||
| @@ -4,17 +4,7 @@ | |||
| 4 | #ifndef MLX5_CORE_EQ_H | 4 | #ifndef MLX5_CORE_EQ_H |
| 5 | #define MLX5_CORE_EQ_H | 5 | #define MLX5_CORE_EQ_H |
| 6 | 6 | ||
| 7 | enum { | 7 | #define MLX5_IRQ_VEC_COMP_BASE 1 |
| 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 | |||
| 18 | #define MLX5_NUM_CMD_EQE (32) | 8 | #define MLX5_NUM_CMD_EQE (32) |
| 19 | #define MLX5_NUM_ASYNC_EQE (0x1000) | 9 | #define MLX5_NUM_ASYNC_EQE (0x1000) |
| 20 | #define MLX5_NUM_SPARE_EQE (0x80) | 10 | #define MLX5_NUM_SPARE_EQE (0x80) |
| @@ -23,18 +13,19 @@ struct mlx5_eq; | |||
| 23 | struct mlx5_core_dev; | 13 | struct mlx5_core_dev; |
| 24 | 14 | ||
| 25 | struct mlx5_eq_param { | 15 | struct mlx5_eq_param { |
| 26 | u8 index; | 16 | u8 irq_index; |
| 27 | int nent; | 17 | int nent; |
| 28 | u64 mask; | 18 | u64 mask[4]; |
| 29 | void *context; | ||
| 30 | irq_handler_t handler; | ||
| 31 | }; | 19 | }; |
| 32 | 20 | ||
| 33 | struct mlx5_eq * | 21 | struct mlx5_eq * |
| 34 | mlx5_eq_create_generic(struct mlx5_core_dev *dev, const char *name, | 22 | mlx5_eq_create_generic(struct mlx5_core_dev *dev, struct mlx5_eq_param *param); |
| 35 | struct mlx5_eq_param *param); | ||
| 36 | int | 23 | int |
| 37 | mlx5_eq_destroy_generic(struct mlx5_core_dev *dev, struct mlx5_eq *eq); | 24 | 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); | ||
| 38 | 29 | ||
| 39 | struct mlx5_eqe *mlx5_eq_get_eqe(struct mlx5_eq *eq, u32 cc); | 30 | struct mlx5_eqe *mlx5_eq_get_eqe(struct mlx5_eq *eq, u32 cc); |
| 40 | void mlx5_eq_update_ci(struct mlx5_eq *eq, u32 cc, bool arm); | 31 | void mlx5_eq_update_ci(struct mlx5_eq *eq, u32 cc, bool arm); |
diff --git a/include/linux/mlx5/eswitch.h b/include/linux/mlx5/eswitch.h index cf226c190329..46b5ba029802 100644 --- a/include/linux/mlx5/eswitch.h +++ b/include/linux/mlx5/eswitch.h | |||
| @@ -7,13 +7,14 @@ | |||
| 7 | #define _MLX5_ESWITCH_ | 7 | #define _MLX5_ESWITCH_ |
| 8 | 8 | ||
| 9 | #include <linux/mlx5/driver.h> | 9 | #include <linux/mlx5/driver.h> |
| 10 | #include <net/devlink.h> | ||
| 10 | 11 | ||
| 11 | #define MLX5_ESWITCH_MANAGER(mdev) MLX5_CAP_GEN(mdev, eswitch_manager) | 12 | #define MLX5_ESWITCH_MANAGER(mdev) MLX5_CAP_GEN(mdev, eswitch_manager) |
| 12 | 13 | ||
| 13 | enum { | 14 | enum { |
| 14 | SRIOV_NONE, | 15 | MLX5_ESWITCH_NONE, |
| 15 | SRIOV_LEGACY, | 16 | MLX5_ESWITCH_LEGACY, |
| 16 | SRIOV_OFFLOADS | 17 | MLX5_ESWITCH_OFFLOADS |
| 17 | }; | 18 | }; |
| 18 | 19 | ||
| 19 | enum { | 20 | enum { |
| @@ -29,25 +30,29 @@ enum { | |||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | struct mlx5_eswitch_rep; | 32 | struct mlx5_eswitch_rep; |
| 32 | struct mlx5_eswitch_rep_if { | 33 | struct mlx5_eswitch_rep_ops { |
| 33 | int (*load)(struct mlx5_core_dev *dev, | 34 | int (*load)(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep); |
| 34 | struct mlx5_eswitch_rep *rep); | 35 | void (*unload)(struct mlx5_eswitch_rep *rep); |
| 35 | void (*unload)(struct mlx5_eswitch_rep *rep); | 36 | void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep); |
| 36 | void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep); | 37 | }; |
| 37 | void *priv; | 38 | |
| 38 | atomic_t state; | 39 | struct mlx5_eswitch_rep_data { |
| 40 | void *priv; | ||
| 41 | atomic_t state; | ||
| 39 | }; | 42 | }; |
| 40 | 43 | ||
| 41 | struct mlx5_eswitch_rep { | 44 | 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]; |
| 43 | u16 vport; | 46 | u16 vport; |
| 44 | u8 hw_id[ETH_ALEN]; | 47 | u8 hw_id[ETH_ALEN]; |
| 45 | u16 vlan; | 48 | u16 vlan; |
| 49 | /* Only IB rep is using vport_index */ | ||
| 50 | u16 vport_index; | ||
| 46 | u32 vlan_refcount; | 51 | u32 vlan_refcount; |
| 47 | }; | 52 | }; |
| 48 | 53 | ||
| 49 | void mlx5_eswitch_register_vport_reps(struct mlx5_eswitch *esw, | 54 | 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, |
| 51 | u8 rep_type); | 56 | u8 rep_type); |
| 52 | void mlx5_eswitch_unregister_vport_reps(struct mlx5_eswitch *esw, u8 rep_type); | 57 | void mlx5_eswitch_unregister_vport_reps(struct mlx5_eswitch *esw, u8 rep_type); |
| 53 | void *mlx5_eswitch_get_proto_dev(struct mlx5_eswitch *esw, | 58 | void *mlx5_eswitch_get_proto_dev(struct mlx5_eswitch *esw, |
| @@ -60,4 +65,35 @@ u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw); | |||
| 60 | struct mlx5_flow_handle * | 65 | struct mlx5_flow_handle * |
| 61 | mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, | 66 | mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, |
| 62 | u16 vport_num, u32 sqn); | 67 | 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 | |||
| 63 | #endif | 99 | #endif |
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h index e690ba0f965c..04a569568eac 100644 --- a/include/linux/mlx5/fs.h +++ b/include/linux/mlx5/fs.h | |||
| @@ -47,6 +47,7 @@ enum { | |||
| 47 | enum { | 47 | enum { |
| 48 | MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT = BIT(0), | 48 | MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT = BIT(0), |
| 49 | MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1), | 49 | MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1), |
| 50 | MLX5_FLOW_TABLE_TERMINATION = BIT(2), | ||
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | #define LEFTOVERS_RULE_NUM 2 | 53 | #define LEFTOVERS_RULE_NUM 2 |
| @@ -87,10 +88,21 @@ struct mlx5_flow_group; | |||
| 87 | struct mlx5_flow_namespace; | 88 | struct mlx5_flow_namespace; |
| 88 | struct mlx5_flow_handle; | 89 | struct mlx5_flow_handle; |
| 89 | 90 | ||
| 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 | |||
| 90 | struct mlx5_flow_spec { | 101 | struct mlx5_flow_spec { |
| 91 | u8 match_criteria_enable; | 102 | u8 match_criteria_enable; |
| 92 | u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)]; | 103 | u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)]; |
| 93 | u32 match_value[MLX5_ST_SZ_DW(fte_match_param)]; | 104 | u32 match_value[MLX5_ST_SZ_DW(fte_match_param)]; |
| 105 | struct mlx5_flow_context flow_context; | ||
| 94 | }; | 106 | }; |
| 95 | 107 | ||
| 96 | enum { | 108 | enum { |
| @@ -172,13 +184,11 @@ struct mlx5_fs_vlan { | |||
| 172 | #define MLX5_FS_VLAN_DEPTH 2 | 184 | #define MLX5_FS_VLAN_DEPTH 2 |
| 173 | 185 | ||
| 174 | enum { | 186 | enum { |
| 175 | FLOW_ACT_HAS_TAG = BIT(0), | 187 | FLOW_ACT_NO_APPEND = BIT(0), |
| 176 | FLOW_ACT_NO_APPEND = BIT(1), | ||
| 177 | }; | 188 | }; |
| 178 | 189 | ||
| 179 | struct mlx5_flow_act { | 190 | struct mlx5_flow_act { |
| 180 | u32 action; | 191 | u32 action; |
| 181 | u32 flow_tag; | ||
| 182 | u32 reformat_id; | 192 | u32 reformat_id; |
| 183 | u32 modify_id; | 193 | u32 modify_id; |
| 184 | uintptr_t esp_id; | 194 | uintptr_t esp_id; |
| @@ -189,7 +199,6 @@ struct mlx5_flow_act { | |||
| 189 | 199 | ||
| 190 | #define MLX5_DECLARE_FLOW_ACT(name) \ | 200 | #define MLX5_DECLARE_FLOW_ACT(name) \ |
| 191 | struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\ | 201 | struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\ |
| 192 | .flow_tag = MLX5_FS_DEFAULT_FLOW_TAG, \ | ||
| 193 | .reformat_id = 0, \ | 202 | .reformat_id = 0, \ |
| 194 | .modify_id = 0, \ | 203 | .modify_id = 0, \ |
| 195 | .flags = 0, } | 204 | .flags = 0, } |
| @@ -199,7 +208,7 @@ struct mlx5_flow_act { | |||
| 199 | */ | 208 | */ |
| 200 | struct mlx5_flow_handle * | 209 | struct mlx5_flow_handle * |
| 201 | mlx5_add_flow_rules(struct mlx5_flow_table *ft, | 210 | mlx5_add_flow_rules(struct mlx5_flow_table *ft, |
| 202 | struct mlx5_flow_spec *spec, | 211 | const struct mlx5_flow_spec *spec, |
| 203 | struct mlx5_flow_act *flow_act, | 212 | struct mlx5_flow_act *flow_act, |
| 204 | struct mlx5_flow_destination *dest, | 213 | struct mlx5_flow_destination *dest, |
| 205 | int num_dest); | 214 | int num_dest); |
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 5e74305e2e57..b3d5752657d9 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
| @@ -91,6 +91,20 @@ enum { | |||
| 91 | 91 | ||
| 92 | enum { | 92 | enum { |
| 93 | MLX5_OBJ_TYPE_GENEVE_TLV_OPT = 0x000b, | 93 | 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, | ||
| 94 | }; | 108 | }; |
| 95 | 109 | ||
| 96 | enum { | 110 | enum { |
| @@ -106,6 +120,9 @@ enum { | |||
| 106 | MLX5_CMD_OP_QUERY_ISSI = 0x10a, | 120 | MLX5_CMD_OP_QUERY_ISSI = 0x10a, |
| 107 | MLX5_CMD_OP_SET_ISSI = 0x10b, | 121 | MLX5_CMD_OP_SET_ISSI = 0x10b, |
| 108 | MLX5_CMD_OP_SET_DRIVER_VERSION = 0x10d, | 122 | 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, | ||
| 109 | MLX5_CMD_OP_CREATE_MKEY = 0x200, | 126 | MLX5_CMD_OP_CREATE_MKEY = 0x200, |
| 110 | MLX5_CMD_OP_QUERY_MKEY = 0x201, | 127 | MLX5_CMD_OP_QUERY_MKEY = 0x201, |
| 111 | MLX5_CMD_OP_DESTROY_MKEY = 0x202, | 128 | MLX5_CMD_OP_DESTROY_MKEY = 0x202, |
| @@ -155,7 +172,7 @@ enum { | |||
| 155 | MLX5_CMD_OP_QUERY_XRQ_DC_PARAMS_ENTRY = 0x725, | 172 | MLX5_CMD_OP_QUERY_XRQ_DC_PARAMS_ENTRY = 0x725, |
| 156 | MLX5_CMD_OP_SET_XRQ_DC_PARAMS_ENTRY = 0x726, | 173 | MLX5_CMD_OP_SET_XRQ_DC_PARAMS_ENTRY = 0x726, |
| 157 | MLX5_CMD_OP_QUERY_XRQ_ERROR_PARAMS = 0x727, | 174 | MLX5_CMD_OP_QUERY_XRQ_ERROR_PARAMS = 0x727, |
| 158 | MLX5_CMD_OP_QUERY_HOST_PARAMS = 0x740, | 175 | MLX5_CMD_OP_QUERY_ESW_FUNCTIONS = 0x740, |
| 159 | MLX5_CMD_OP_QUERY_VPORT_STATE = 0x750, | 176 | MLX5_CMD_OP_QUERY_VPORT_STATE = 0x750, |
| 160 | MLX5_CMD_OP_MODIFY_VPORT_STATE = 0x751, | 177 | MLX5_CMD_OP_MODIFY_VPORT_STATE = 0x751, |
| 161 | MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT = 0x752, | 178 | MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT = 0x752, |
| @@ -382,7 +399,8 @@ struct mlx5_ifc_flow_table_prop_layout_bits { | |||
| 382 | u8 reformat_and_modify_action[0x1]; | 399 | u8 reformat_and_modify_action[0x1]; |
| 383 | u8 reserved_at_15[0x2]; | 400 | u8 reserved_at_15[0x2]; |
| 384 | u8 table_miss_action_domain[0x1]; | 401 | u8 table_miss_action_domain[0x1]; |
| 385 | u8 reserved_at_18[0x8]; | 402 | u8 termination_table[0x1]; |
| 403 | u8 reserved_at_19[0x7]; | ||
| 386 | u8 reserved_at_20[0x2]; | 404 | u8 reserved_at_20[0x2]; |
| 387 | u8 log_max_ft_size[0x6]; | 405 | u8 log_max_ft_size[0x6]; |
| 388 | u8 log_max_modify_header_context[0x8]; | 406 | u8 log_max_modify_header_context[0x8]; |
| @@ -527,7 +545,21 @@ struct mlx5_ifc_fte_match_set_misc2_bits { | |||
| 527 | 545 | ||
| 528 | struct mlx5_ifc_fte_match_mpls_bits outer_first_mpls_over_udp; | 546 | struct mlx5_ifc_fte_match_mpls_bits outer_first_mpls_over_udp; |
| 529 | 547 | ||
| 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]; | ||
| 531 | 563 | ||
| 532 | u8 metadata_reg_a[0x20]; | 564 | u8 metadata_reg_a[0x20]; |
| 533 | 565 | ||
| @@ -635,8 +667,22 @@ struct mlx5_ifc_flow_table_nic_cap_bits { | |||
| 635 | u8 reserved_at_e00[0x7200]; | 667 | u8 reserved_at_e00[0x7200]; |
| 636 | }; | 668 | }; |
| 637 | 669 | ||
| 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 | |||
| 638 | struct mlx5_ifc_flow_table_eswitch_cap_bits { | 681 | 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]; | ||
| 640 | u8 multi_fdb_encap[0x1]; | 686 | u8 multi_fdb_encap[0x1]; |
| 641 | u8 reserved_at_1b[0x1]; | 687 | u8 reserved_at_1b[0x1]; |
| 642 | u8 fdb_multi_path_to_table[0x1]; | 688 | u8 fdb_multi_path_to_table[0x1]; |
| @@ -664,7 +710,11 @@ struct mlx5_ifc_e_switch_cap_bits { | |||
| 664 | u8 vport_svlan_insert[0x1]; | 710 | u8 vport_svlan_insert[0x1]; |
| 665 | u8 vport_cvlan_insert_if_not_exist[0x1]; | 711 | u8 vport_cvlan_insert_if_not_exist[0x1]; |
| 666 | u8 vport_cvlan_insert_overwrite[0x1]; | 712 | 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]; | ||
| 668 | u8 ecpf_vport_exists[0x1]; | 718 | u8 ecpf_vport_exists[0x1]; |
| 669 | u8 counter_eswitch_affinity[0x1]; | 719 | u8 counter_eswitch_affinity[0x1]; |
| 670 | u8 merged_eswitch[0x1]; | 720 | u8 merged_eswitch[0x1]; |
| @@ -680,7 +730,11 @@ struct mlx5_ifc_e_switch_cap_bits { | |||
| 680 | u8 reserved_2b[0x6]; | 730 | u8 reserved_2b[0x6]; |
| 681 | u8 max_encap_header_size[0xa]; | 731 | u8 max_encap_header_size[0xa]; |
| 682 | 732 | ||
| 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]; | ||
| 684 | 738 | ||
| 685 | }; | 739 | }; |
| 686 | 740 | ||
| @@ -715,7 +769,9 @@ struct mlx5_ifc_qos_cap_bits { | |||
| 715 | }; | 769 | }; |
| 716 | 770 | ||
| 717 | struct mlx5_ifc_debug_cap_bits { | 771 | 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]; | ||
| 719 | 775 | ||
| 720 | u8 reserved_at_20[0x2]; | 776 | u8 reserved_at_20[0x2]; |
| 721 | u8 stall_detect[0x1]; | 777 | u8 stall_detect[0x1]; |
| @@ -749,7 +805,8 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits { | |||
| 749 | u8 swp[0x1]; | 805 | u8 swp[0x1]; |
| 750 | u8 swp_csum[0x1]; | 806 | u8 swp_csum[0x1]; |
| 751 | u8 swp_lso[0x1]; | 807 | u8 swp_lso[0x1]; |
| 752 | u8 reserved_at_23[0xd]; | 808 | u8 cqe_checksum_full[0x1]; |
| 809 | u8 reserved_at_24[0xc]; | ||
| 753 | u8 max_vxlan_udp_ports[0x8]; | 810 | u8 max_vxlan_udp_ports[0x8]; |
| 754 | u8 reserved_at_38[0x6]; | 811 | u8 reserved_at_38[0x6]; |
| 755 | u8 max_geneve_opt_len[0x1]; | 812 | u8 max_geneve_opt_len[0x1]; |
| @@ -818,6 +875,12 @@ struct mlx5_ifc_device_mem_cap_bits { | |||
| 818 | u8 reserved_at_180[0x680]; | 875 | u8 reserved_at_180[0x680]; |
| 819 | }; | 876 | }; |
| 820 | 877 | ||
| 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 | |||
| 821 | enum { | 884 | enum { |
| 822 | MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_1_BYTE = 0x0, | 885 | MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_1_BYTE = 0x0, |
| 823 | MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_2_BYTES = 0x2, | 886 | MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_2_BYTES = 0x2, |
| @@ -911,6 +974,16 @@ struct mlx5_ifc_vector_calc_cap_bits { | |||
| 911 | u8 reserved_at_c0[0x720]; | 974 | u8 reserved_at_c0[0x720]; |
| 912 | }; | 975 | }; |
| 913 | 976 | ||
| 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 | |||
| 914 | enum { | 987 | enum { |
| 915 | MLX5_WQ_TYPE_LINKED_LIST = 0x0, | 988 | MLX5_WQ_TYPE_LINKED_LIST = 0x0, |
| 916 | MLX5_WQ_TYPE_CYCLIC = 0x1, | 989 | MLX5_WQ_TYPE_CYCLIC = 0x1, |
| @@ -975,7 +1048,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { | |||
| 975 | 1048 | ||
| 976 | u8 log_max_srq_sz[0x8]; | 1049 | u8 log_max_srq_sz[0x8]; |
| 977 | u8 log_max_qp_sz[0x8]; | 1050 | u8 log_max_qp_sz[0x8]; |
| 978 | u8 reserved_at_90[0x8]; | 1051 | u8 event_cap[0x1]; |
| 1052 | u8 reserved_at_91[0x7]; | ||
| 979 | u8 prio_tag_required[0x1]; | 1053 | u8 prio_tag_required[0x1]; |
| 980 | u8 reserved_at_99[0x2]; | 1054 | u8 reserved_at_99[0x2]; |
| 981 | u8 log_max_qp[0x5]; | 1055 | u8 log_max_qp[0x5]; |
| @@ -1023,7 +1097,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { | |||
| 1023 | u8 cc_modify_allowed[0x1]; | 1097 | u8 cc_modify_allowed[0x1]; |
| 1024 | u8 start_pad[0x1]; | 1098 | u8 start_pad[0x1]; |
| 1025 | u8 cache_line_128byte[0x1]; | 1099 | 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]; | ||
| 1027 | u8 qcam_reg[0x1]; | 1103 | u8 qcam_reg[0x1]; |
| 1028 | u8 gid_table_size[0x10]; | 1104 | u8 gid_table_size[0x10]; |
| 1029 | 1105 | ||
| @@ -1240,7 +1316,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { | |||
| 1240 | 1316 | ||
| 1241 | u8 reserved_at_440[0x20]; | 1317 | u8 reserved_at_440[0x20]; |
| 1242 | 1318 | ||
| 1243 | u8 reserved_at_460[0x3]; | 1319 | u8 tls[0x1]; |
| 1320 | u8 reserved_at_461[0x2]; | ||
| 1244 | u8 log_max_uctx[0x5]; | 1321 | u8 log_max_uctx[0x5]; |
| 1245 | u8 reserved_at_468[0x3]; | 1322 | u8 reserved_at_468[0x3]; |
| 1246 | u8 log_max_umem[0x5]; | 1323 | u8 log_max_umem[0x5]; |
| @@ -1265,7 +1342,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { | |||
| 1265 | u8 max_geneve_tlv_option_data_len[0x5]; | 1342 | u8 max_geneve_tlv_option_data_len[0x5]; |
| 1266 | u8 reserved_at_570[0x10]; | 1343 | u8 reserved_at_570[0x10]; |
| 1267 | 1344 | ||
| 1268 | u8 reserved_at_580[0x3c]; | 1345 | u8 reserved_at_580[0x33]; |
| 1346 | u8 log_max_dek[0x5]; | ||
| 1347 | u8 reserved_at_5b8[0x4]; | ||
| 1269 | u8 mini_cqe_resp_stride_index[0x1]; | 1348 | u8 mini_cqe_resp_stride_index[0x1]; |
| 1270 | u8 cqe_128_always[0x1]; | 1349 | u8 cqe_128_always[0x1]; |
| 1271 | u8 cqe_compression_128[0x1]; | 1350 | u8 cqe_compression_128[0x1]; |
| @@ -1295,13 +1374,26 @@ struct mlx5_ifc_cmd_hca_cap_bits { | |||
| 1295 | u8 reserved_at_640[0x10]; | 1374 | u8 reserved_at_640[0x10]; |
| 1296 | u8 num_q_monitor_counters[0x10]; | 1375 | u8 num_q_monitor_counters[0x10]; |
| 1297 | 1376 | ||
| 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]; | ||
| 1299 | 1386 | ||
| 1300 | u8 uctx_cap[0x20]; | 1387 | u8 uctx_cap[0x20]; |
| 1301 | 1388 | ||
| 1302 | u8 reserved_at_6c0[0x4]; | 1389 | u8 reserved_at_6c0[0x4]; |
| 1303 | u8 flex_parser_id_geneve_tlv_option_0[0x4]; | 1390 | 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]; | ||
| 1305 | }; | 1397 | }; |
| 1306 | 1398 | ||
| 1307 | enum mlx5_flow_destination_type { | 1399 | enum mlx5_flow_destination_type { |
| @@ -2531,7 +2623,9 @@ union mlx5_ifc_hca_cap_union_bits { | |||
| 2531 | struct mlx5_ifc_e_switch_cap_bits e_switch_cap; | 2623 | struct mlx5_ifc_e_switch_cap_bits e_switch_cap; |
| 2532 | struct mlx5_ifc_vector_calc_cap_bits vector_calc_cap; | 2624 | struct mlx5_ifc_vector_calc_cap_bits vector_calc_cap; |
| 2533 | struct mlx5_ifc_qos_cap_bits qos_cap; | 2625 | struct mlx5_ifc_qos_cap_bits qos_cap; |
| 2626 | struct mlx5_ifc_debug_cap_bits debug_cap; | ||
| 2534 | struct mlx5_ifc_fpga_cap_bits fpga_cap; | 2627 | struct mlx5_ifc_fpga_cap_bits fpga_cap; |
| 2628 | struct mlx5_ifc_tls_cap_bits tls_cap; | ||
| 2535 | u8 reserved_at_0[0x8000]; | 2629 | u8 reserved_at_0[0x8000]; |
| 2536 | }; | 2630 | }; |
| 2537 | 2631 | ||
| @@ -2549,6 +2643,12 @@ enum { | |||
| 2549 | MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 = 0x800, | 2643 | MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 = 0x800, |
| 2550 | }; | 2644 | }; |
| 2551 | 2645 | ||
| 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 | |||
| 2552 | struct mlx5_ifc_vlan_bits { | 2652 | struct mlx5_ifc_vlan_bits { |
| 2553 | u8 ethtype[0x10]; | 2653 | u8 ethtype[0x10]; |
| 2554 | u8 prio[0x3]; | 2654 | u8 prio[0x3]; |
| @@ -2568,7 +2668,9 @@ struct mlx5_ifc_flow_context_bits { | |||
| 2568 | u8 action[0x10]; | 2668 | u8 action[0x10]; |
| 2569 | 2669 | ||
| 2570 | u8 extended_destination[0x1]; | 2670 | 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]; | ||
| 2572 | u8 destination_list_size[0x18]; | 2674 | u8 destination_list_size[0x18]; |
| 2573 | 2675 | ||
| 2574 | u8 reserved_at_a0[0x8]; | 2676 | u8 reserved_at_a0[0x8]; |
| @@ -2663,7 +2765,8 @@ struct mlx5_ifc_traffic_counter_bits { | |||
| 2663 | 2765 | ||
| 2664 | struct mlx5_ifc_tisc_bits { | 2766 | struct mlx5_ifc_tisc_bits { |
| 2665 | u8 strict_lag_tx_port_affinity[0x1]; | 2767 | u8 strict_lag_tx_port_affinity[0x1]; |
| 2666 | u8 reserved_at_1[0x3]; | 2768 | u8 tls_en[0x1]; |
| 2769 | u8 reserved_at_1[0x2]; | ||
| 2667 | u8 lag_tx_port_affinity[0x04]; | 2770 | u8 lag_tx_port_affinity[0x04]; |
| 2668 | 2771 | ||
| 2669 | u8 reserved_at_8[0x4]; | 2772 | u8 reserved_at_8[0x4]; |
| @@ -2677,7 +2780,11 @@ struct mlx5_ifc_tisc_bits { | |||
| 2677 | 2780 | ||
| 2678 | u8 reserved_at_140[0x8]; | 2781 | u8 reserved_at_140[0x8]; |
| 2679 | u8 underlay_qpn[0x18]; | 2782 | 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]; | ||
| 2681 | }; | 2788 | }; |
| 2682 | 2789 | ||
| 2683 | enum { | 2790 | enum { |
| @@ -3093,12 +3200,14 @@ struct mlx5_ifc_hca_vport_context_bits { | |||
| 3093 | }; | 3200 | }; |
| 3094 | 3201 | ||
| 3095 | struct mlx5_ifc_esw_vport_context_bits { | 3202 | 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]; | ||
| 3097 | u8 vport_svlan_strip[0x1]; | 3205 | u8 vport_svlan_strip[0x1]; |
| 3098 | u8 vport_cvlan_strip[0x1]; | 3206 | u8 vport_cvlan_strip[0x1]; |
| 3099 | u8 vport_svlan_insert[0x1]; | 3207 | u8 vport_svlan_insert[0x1]; |
| 3100 | u8 vport_cvlan_insert[0x2]; | 3208 | 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]; | ||
| 3102 | 3211 | ||
| 3103 | u8 reserved_at_20[0x20]; | 3212 | u8 reserved_at_20[0x20]; |
| 3104 | 3213 | ||
| @@ -4979,7 +5088,8 @@ struct mlx5_ifc_modify_esw_vport_context_out_bits { | |||
| 4979 | }; | 5088 | }; |
| 4980 | 5089 | ||
| 4981 | struct mlx5_ifc_esw_vport_context_fields_select_bits { | 5090 | 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]; | ||
| 4983 | u8 vport_cvlan_insert[0x1]; | 5093 | u8 vport_cvlan_insert[0x1]; |
| 4984 | u8 vport_svlan_insert[0x1]; | 5094 | u8 vport_svlan_insert[0x1]; |
| 4985 | u8 vport_cvlan_strip[0x1]; | 5095 | u8 vport_cvlan_strip[0x1]; |
| @@ -5176,6 +5286,7 @@ enum { | |||
| 5176 | MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16, | 5286 | MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16, |
| 5177 | MLX5_ACTION_IN_FIELD_OUT_FIRST_VID = 0x17, | 5287 | MLX5_ACTION_IN_FIELD_OUT_FIRST_VID = 0x17, |
| 5178 | MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47, | 5288 | MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47, |
| 5289 | MLX5_ACTION_IN_FIELD_METADATA_REG_C_0 = 0x51, | ||
| 5179 | }; | 5290 | }; |
| 5180 | 5291 | ||
| 5181 | struct mlx5_ifc_alloc_modify_header_context_out_bits { | 5292 | struct mlx5_ifc_alloc_modify_header_context_out_bits { |
| @@ -7236,7 +7347,8 @@ struct mlx5_ifc_create_flow_table_out_bits { | |||
| 7236 | struct mlx5_ifc_flow_table_context_bits { | 7347 | struct mlx5_ifc_flow_table_context_bits { |
| 7237 | u8 reformat_en[0x1]; | 7348 | u8 reformat_en[0x1]; |
| 7238 | u8 decap_en[0x1]; | 7349 | u8 decap_en[0x1]; |
| 7239 | u8 reserved_at_2[0x2]; | 7350 | u8 reserved_at_2[0x1]; |
| 7351 | u8 termination_table[0x1]; | ||
| 7240 | u8 table_miss_action[0x4]; | 7352 | u8 table_miss_action[0x4]; |
| 7241 | u8 level[0x8]; | 7353 | u8 level[0x8]; |
| 7242 | u8 reserved_at_10[0x8]; | 7354 | u8 reserved_at_10[0x8]; |
| @@ -7355,9 +7467,9 @@ struct mlx5_ifc_create_eq_in_bits { | |||
| 7355 | 7467 | ||
| 7356 | u8 reserved_at_280[0x40]; | 7468 | u8 reserved_at_280[0x40]; |
| 7357 | 7469 | ||
| 7358 | u8 event_bitmask[0x40]; | 7470 | u8 event_bitmask[4][0x40]; |
| 7359 | 7471 | ||
| 7360 | u8 reserved_at_300[0x580]; | 7472 | u8 reserved_at_3c0[0x4c0]; |
| 7361 | 7473 | ||
| 7362 | u8 pas[0][0x40]; | 7474 | u8 pas[0][0x40]; |
| 7363 | }; | 7475 | }; |
| @@ -8475,7 +8587,7 @@ struct mlx5_ifc_mcam_access_reg_bits { | |||
| 8475 | u8 mcda[0x1]; | 8587 | u8 mcda[0x1]; |
| 8476 | u8 mcc[0x1]; | 8588 | u8 mcc[0x1]; |
| 8477 | u8 mcqi[0x1]; | 8589 | u8 mcqi[0x1]; |
| 8478 | u8 reserved_at_1f[0x1]; | 8590 | u8 mcqs[0x1]; |
| 8479 | 8591 | ||
| 8480 | u8 regs_95_to_87[0x9]; | 8592 | u8 regs_95_to_87[0x9]; |
| 8481 | u8 mpegc[0x1]; | 8593 | u8 mpegc[0x1]; |
| @@ -8546,6 +8658,18 @@ struct mlx5_ifc_qcam_reg_bits { | |||
| 8546 | u8 reserved_at_1c0[0x80]; | 8658 | u8 reserved_at_1c0[0x80]; |
| 8547 | }; | 8659 | }; |
| 8548 | 8660 | ||
| 8661 | struct mlx5_ifc_core_dump_reg_bits { | ||
| 8662 | u8 reserved_at_0[0x18]; | ||
| 8663 | u8 core_dump_type[0x8]; | ||
| 8664 | |||
| 8665 | u8 reserved_at_20[0x30]; | ||
| 8666 | u8 vhca_id[0x10]; | ||
| 8667 | |||
| 8668 | u8 reserved_at_60[0x8]; | ||
| 8669 | u8 qpn[0x18]; | ||
| 8670 | u8 reserved_at_80[0x180]; | ||
| 8671 | }; | ||
| 8672 | |||
| 8549 | struct mlx5_ifc_pcap_reg_bits { | 8673 | struct mlx5_ifc_pcap_reg_bits { |
| 8550 | u8 reserved_at_0[0x8]; | 8674 | u8 reserved_at_0[0x8]; |
| 8551 | u8 local_port[0x8]; | 8675 | u8 local_port[0x8]; |
| @@ -8955,6 +9079,24 @@ struct mlx5_ifc_mtppse_reg_bits { | |||
| 8955 | u8 reserved_at_40[0x40]; | 9079 | u8 reserved_at_40[0x40]; |
| 8956 | }; | 9080 | }; |
| 8957 | 9081 | ||
| 9082 | struct mlx5_ifc_mcqs_reg_bits { | ||
| 9083 | u8 last_index_flag[0x1]; | ||
| 9084 | u8 reserved_at_1[0x7]; | ||
| 9085 | u8 fw_device[0x8]; | ||
| 9086 | u8 component_index[0x10]; | ||
| 9087 | |||
| 9088 | u8 reserved_at_20[0x10]; | ||
| 9089 | u8 identifier[0x10]; | ||
| 9090 | |||
| 9091 | u8 reserved_at_40[0x17]; | ||
| 9092 | u8 component_status[0x5]; | ||
| 9093 | u8 component_update_state[0x4]; | ||
| 9094 | |||
| 9095 | u8 last_update_state_changer_type[0x4]; | ||
| 9096 | u8 last_update_state_changer_host_id[0x4]; | ||
| 9097 | u8 reserved_at_68[0x18]; | ||
| 9098 | }; | ||
| 9099 | |||
| 8958 | struct mlx5_ifc_mcqi_cap_bits { | 9100 | struct mlx5_ifc_mcqi_cap_bits { |
| 8959 | u8 supported_info_bitmask[0x20]; | 9101 | u8 supported_info_bitmask[0x20]; |
| 8960 | 9102 | ||
| @@ -8975,6 +9117,43 @@ struct mlx5_ifc_mcqi_cap_bits { | |||
| 8975 | u8 reserved_at_86[0x1a]; | 9117 | u8 reserved_at_86[0x1a]; |
| 8976 | }; | 9118 | }; |
| 8977 | 9119 | ||
| 9120 | struct mlx5_ifc_mcqi_version_bits { | ||
| 9121 | u8 reserved_at_0[0x2]; | ||
| 9122 | u8 build_time_valid[0x1]; | ||
| 9123 | u8 user_defined_time_valid[0x1]; | ||
| 9124 | u8 reserved_at_4[0x14]; | ||
| 9125 | u8 version_string_length[0x8]; | ||
| 9126 | |||
| 9127 | u8 version[0x20]; | ||
| 9128 | |||
| 9129 | u8 build_time[0x40]; | ||
| 9130 | |||
| 9131 | u8 user_defined_time[0x40]; | ||
| 9132 | |||
| 9133 | u8 build_tool_version[0x20]; | ||
| 9134 | |||
| 9135 | u8 reserved_at_e0[0x20]; | ||
| 9136 | |||
| 9137 | u8 version_string[92][0x8]; | ||
| 9138 | }; | ||
| 9139 | |||
| 9140 | struct mlx5_ifc_mcqi_activation_method_bits { | ||
| 9141 | u8 pending_server_ac_power_cycle[0x1]; | ||
| 9142 | u8 pending_server_dc_power_cycle[0x1]; | ||
| 9143 | u8 pending_server_reboot[0x1]; | ||
| 9144 | u8 pending_fw_reset[0x1]; | ||
| 9145 | u8 auto_activate[0x1]; | ||
| 9146 | u8 all_hosts_sync[0x1]; | ||
| 9147 | u8 device_hw_reset[0x1]; | ||
| 9148 | u8 reserved_at_7[0x19]; | ||
| 9149 | }; | ||
| 9150 | |||
| 9151 | union mlx5_ifc_mcqi_reg_data_bits { | ||
| 9152 | struct mlx5_ifc_mcqi_cap_bits mcqi_caps; | ||
| 9153 | struct mlx5_ifc_mcqi_version_bits mcqi_version; | ||
| 9154 | struct mlx5_ifc_mcqi_activation_method_bits mcqi_activation_mathod; | ||
| 9155 | }; | ||
| 9156 | |||
| 8978 | struct mlx5_ifc_mcqi_reg_bits { | 9157 | struct mlx5_ifc_mcqi_reg_bits { |
| 8979 | u8 read_pending_component[0x1]; | 9158 | u8 read_pending_component[0x1]; |
| 8980 | u8 reserved_at_1[0xf]; | 9159 | u8 reserved_at_1[0xf]; |
| @@ -8992,7 +9171,7 @@ struct mlx5_ifc_mcqi_reg_bits { | |||
| 8992 | u8 reserved_at_a0[0x10]; | 9171 | u8 reserved_at_a0[0x10]; |
| 8993 | u8 data_size[0x10]; | 9172 | u8 data_size[0x10]; |
| 8994 | 9173 | ||
| 8995 | u8 data[0][0x20]; | 9174 | union mlx5_ifc_mcqi_reg_data_bits data[0]; |
| 8996 | }; | 9175 | }; |
| 8997 | 9176 | ||
| 8998 | struct mlx5_ifc_mcc_reg_bits { | 9177 | struct mlx5_ifc_mcc_reg_bits { |
| @@ -9518,7 +9697,7 @@ struct mlx5_ifc_general_obj_in_cmd_hdr_bits { | |||
| 9518 | u8 opcode[0x10]; | 9697 | u8 opcode[0x10]; |
| 9519 | u8 uid[0x10]; | 9698 | u8 uid[0x10]; |
| 9520 | 9699 | ||
| 9521 | u8 reserved_at_20[0x10]; | 9700 | u8 vhca_tunnel_id[0x10]; |
| 9522 | u8 obj_type[0x10]; | 9701 | u8 obj_type[0x10]; |
| 9523 | 9702 | ||
| 9524 | u8 obj_id[0x20]; | 9703 | u8 obj_id[0x20]; |
| @@ -9689,10 +9868,11 @@ struct mlx5_ifc_mtrc_ctrl_bits { | |||
| 9689 | 9868 | ||
| 9690 | struct mlx5_ifc_host_params_context_bits { | 9869 | struct mlx5_ifc_host_params_context_bits { |
| 9691 | u8 host_number[0x8]; | 9870 | u8 host_number[0x8]; |
| 9692 | u8 reserved_at_8[0x8]; | 9871 | u8 reserved_at_8[0x7]; |
| 9872 | u8 host_pf_disabled[0x1]; | ||
| 9693 | u8 host_num_of_vfs[0x10]; | 9873 | u8 host_num_of_vfs[0x10]; |
| 9694 | 9874 | ||
| 9695 | u8 reserved_at_20[0x10]; | 9875 | u8 host_total_vfs[0x10]; |
| 9696 | u8 host_pci_bus[0x10]; | 9876 | u8 host_pci_bus[0x10]; |
| 9697 | 9877 | ||
| 9698 | u8 reserved_at_40[0x10]; | 9878 | u8 reserved_at_40[0x10]; |
| @@ -9704,7 +9884,7 @@ struct mlx5_ifc_host_params_context_bits { | |||
| 9704 | u8 reserved_at_80[0x180]; | 9884 | u8 reserved_at_80[0x180]; |
| 9705 | }; | 9885 | }; |
| 9706 | 9886 | ||
| 9707 | struct mlx5_ifc_query_host_params_in_bits { | 9887 | struct mlx5_ifc_query_esw_functions_in_bits { |
| 9708 | u8 opcode[0x10]; | 9888 | u8 opcode[0x10]; |
| 9709 | u8 reserved_at_10[0x10]; | 9889 | u8 reserved_at_10[0x10]; |
| 9710 | 9890 | ||
| @@ -9714,7 +9894,7 @@ struct mlx5_ifc_query_host_params_in_bits { | |||
| 9714 | u8 reserved_at_40[0x40]; | 9894 | u8 reserved_at_40[0x40]; |
| 9715 | }; | 9895 | }; |
| 9716 | 9896 | ||
| 9717 | struct mlx5_ifc_query_host_params_out_bits { | 9897 | struct mlx5_ifc_query_esw_functions_out_bits { |
| 9718 | u8 status[0x8]; | 9898 | u8 status[0x8]; |
| 9719 | u8 reserved_at_8[0x18]; | 9899 | u8 reserved_at_8[0x18]; |
| 9720 | 9900 | ||
| @@ -9725,6 +9905,165 @@ struct mlx5_ifc_query_host_params_out_bits { | |||
| 9725 | struct mlx5_ifc_host_params_context_bits host_params_context; | 9905 | struct mlx5_ifc_host_params_context_bits host_params_context; |
| 9726 | 9906 | ||
| 9727 | u8 reserved_at_280[0x180]; | 9907 | u8 reserved_at_280[0x180]; |
| 9908 | u8 host_sf_enable[0][0x40]; | ||
| 9909 | }; | ||
| 9910 | |||
| 9911 | struct mlx5_ifc_sf_partition_bits { | ||
| 9912 | u8 reserved_at_0[0x10]; | ||
| 9913 | u8 log_num_sf[0x8]; | ||
| 9914 | u8 log_sf_bar_size[0x8]; | ||
| 9915 | }; | ||
| 9916 | |||
| 9917 | struct mlx5_ifc_query_sf_partitions_out_bits { | ||
| 9918 | u8 status[0x8]; | ||
| 9919 | u8 reserved_at_8[0x18]; | ||
| 9920 | |||
| 9921 | u8 syndrome[0x20]; | ||
| 9922 | |||
| 9923 | u8 reserved_at_40[0x18]; | ||
| 9924 | u8 num_sf_partitions[0x8]; | ||
| 9925 | |||
| 9926 | u8 reserved_at_60[0x20]; | ||
| 9927 | |||
| 9928 | struct mlx5_ifc_sf_partition_bits sf_partition[0]; | ||
| 9929 | }; | ||
| 9930 | |||
| 9931 | struct mlx5_ifc_query_sf_partitions_in_bits { | ||
| 9932 | u8 opcode[0x10]; | ||
| 9933 | u8 reserved_at_10[0x10]; | ||
| 9934 | |||
| 9935 | u8 reserved_at_20[0x10]; | ||
| 9936 | u8 op_mod[0x10]; | ||
| 9937 | |||
| 9938 | u8 reserved_at_40[0x40]; | ||
| 9939 | }; | ||
| 9940 | |||
| 9941 | struct mlx5_ifc_dealloc_sf_out_bits { | ||
| 9942 | u8 status[0x8]; | ||
| 9943 | u8 reserved_at_8[0x18]; | ||
| 9944 | |||
| 9945 | u8 syndrome[0x20]; | ||
| 9946 | |||
| 9947 | u8 reserved_at_40[0x40]; | ||
| 9948 | }; | ||
| 9949 | |||
| 9950 | struct mlx5_ifc_dealloc_sf_in_bits { | ||
| 9951 | u8 opcode[0x10]; | ||
| 9952 | u8 reserved_at_10[0x10]; | ||
| 9953 | |||
| 9954 | u8 reserved_at_20[0x10]; | ||
| 9955 | u8 op_mod[0x10]; | ||
| 9956 | |||
| 9957 | u8 reserved_at_40[0x10]; | ||
| 9958 | u8 function_id[0x10]; | ||
| 9959 | |||
| 9960 | u8 reserved_at_60[0x20]; | ||
| 9961 | }; | ||
| 9962 | |||
| 9963 | struct mlx5_ifc_alloc_sf_out_bits { | ||
| 9964 | u8 status[0x8]; | ||
| 9965 | u8 reserved_at_8[0x18]; | ||
| 9966 | |||
| 9967 | u8 syndrome[0x20]; | ||
| 9968 | |||
| 9969 | u8 reserved_at_40[0x40]; | ||
| 9970 | }; | ||
| 9971 | |||
| 9972 | struct mlx5_ifc_alloc_sf_in_bits { | ||
| 9973 | u8 opcode[0x10]; | ||
| 9974 | u8 reserved_at_10[0x10]; | ||
| 9975 | |||
| 9976 | u8 reserved_at_20[0x10]; | ||
| 9977 | u8 op_mod[0x10]; | ||
| 9978 | |||
| 9979 | u8 reserved_at_40[0x10]; | ||
| 9980 | u8 function_id[0x10]; | ||
| 9981 | |||
| 9982 | u8 reserved_at_60[0x20]; | ||
| 9983 | }; | ||
| 9984 | |||
| 9985 | struct mlx5_ifc_affiliated_event_header_bits { | ||
| 9986 | u8 reserved_at_0[0x10]; | ||
| 9987 | u8 obj_type[0x10]; | ||
| 9988 | |||
| 9989 | u8 obj_id[0x20]; | ||
| 9990 | }; | ||
| 9991 | |||
| 9992 | enum { | ||
| 9993 | MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = BIT(0xc), | ||
| 9994 | }; | ||
| 9995 | |||
| 9996 | enum { | ||
| 9997 | MLX5_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = 0xc, | ||
| 9998 | }; | ||
| 9999 | |||
| 10000 | struct mlx5_ifc_encryption_key_obj_bits { | ||
| 10001 | u8 modify_field_select[0x40]; | ||
| 10002 | |||
| 10003 | u8 reserved_at_40[0x14]; | ||
| 10004 | u8 key_size[0x4]; | ||
| 10005 | u8 reserved_at_58[0x4]; | ||
| 10006 | u8 key_type[0x4]; | ||
| 10007 | |||
| 10008 | u8 reserved_at_60[0x8]; | ||
| 10009 | u8 pd[0x18]; | ||
| 10010 | |||
| 10011 | u8 reserved_at_80[0x180]; | ||
| 10012 | u8 key[8][0x20]; | ||
| 10013 | |||
| 10014 | u8 reserved_at_300[0x500]; | ||
| 10015 | }; | ||
| 10016 | |||
| 10017 | struct mlx5_ifc_create_encryption_key_in_bits { | ||
| 10018 | struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_in_cmd_hdr; | ||
| 10019 | struct mlx5_ifc_encryption_key_obj_bits encryption_key_object; | ||
| 10020 | }; | ||
| 10021 | |||
| 10022 | enum { | ||
| 10023 | MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_128 = 0x0, | ||
| 10024 | MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_256 = 0x1, | ||
| 10025 | }; | ||
| 10026 | |||
| 10027 | enum { | ||
| 10028 | MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_DEK = 0x1, | ||
| 10029 | }; | ||
| 10030 | |||
| 10031 | struct mlx5_ifc_tls_static_params_bits { | ||
| 10032 | u8 const_2[0x2]; | ||
| 10033 | u8 tls_version[0x4]; | ||
| 10034 | u8 const_1[0x2]; | ||
| 10035 | u8 reserved_at_8[0x14]; | ||
| 10036 | u8 encryption_standard[0x4]; | ||
| 10037 | |||
| 10038 | u8 reserved_at_20[0x20]; | ||
| 10039 | |||
| 10040 | u8 initial_record_number[0x40]; | ||
| 10041 | |||
| 10042 | u8 resync_tcp_sn[0x20]; | ||
| 10043 | |||
| 10044 | u8 gcm_iv[0x20]; | ||
| 10045 | |||
| 10046 | u8 implicit_iv[0x40]; | ||
| 10047 | |||
| 10048 | u8 reserved_at_100[0x8]; | ||
| 10049 | u8 dek_index[0x18]; | ||
| 10050 | |||
| 10051 | u8 reserved_at_120[0xe0]; | ||
| 10052 | }; | ||
| 10053 | |||
| 10054 | struct mlx5_ifc_tls_progress_params_bits { | ||
| 10055 | u8 valid[0x1]; | ||
| 10056 | u8 reserved_at_1[0x7]; | ||
| 10057 | u8 pd[0x18]; | ||
| 10058 | |||
| 10059 | u8 next_record_tcp_sn[0x20]; | ||
| 10060 | |||
| 10061 | u8 hw_resync_tcp_sn[0x20]; | ||
| 10062 | |||
| 10063 | u8 record_tracker_state[0x2]; | ||
| 10064 | u8 auth_state[0x2]; | ||
| 10065 | u8 reserved_at_64[0x4]; | ||
| 10066 | u8 hw_offset_record_number[0x18]; | ||
| 9728 | }; | 10067 | }; |
| 9729 | 10068 | ||
| 9730 | #endif /* MLX5_IFC_H */ | 10069 | #endif /* MLX5_IFC_H */ |
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h index 3ba4edbd17a6..ae63b1ae9004 100644 --- a/include/linux/mlx5/qp.h +++ b/include/linux/mlx5/qp.h | |||
| @@ -37,7 +37,8 @@ | |||
| 37 | #include <linux/mlx5/driver.h> | 37 | #include <linux/mlx5/driver.h> |
| 38 | 38 | ||
| 39 | #define MLX5_INVALID_LKEY 0x100 | 39 | #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) | ||
| 41 | #define MLX5_DIF_SIZE 8 | 42 | #define MLX5_DIF_SIZE 8 |
| 42 | #define MLX5_STRIDE_BLOCK_OP 0x400 | 43 | #define MLX5_STRIDE_BLOCK_OP 0x400 |
| 43 | #define MLX5_CPY_GRD_MASK 0xc0 | 44 | #define MLX5_CPY_GRD_MASK 0xc0 |
| @@ -70,6 +71,7 @@ enum mlx5_qp_optpar { | |||
| 70 | MLX5_QP_OPTPAR_CQN_RCV = 1 << 19, | 71 | MLX5_QP_OPTPAR_CQN_RCV = 1 << 19, |
| 71 | MLX5_QP_OPTPAR_DC_HS = 1 << 20, | 72 | MLX5_QP_OPTPAR_DC_HS = 1 << 20, |
| 72 | MLX5_QP_OPTPAR_DC_KEY = 1 << 21, | 73 | MLX5_QP_OPTPAR_DC_KEY = 1 << 21, |
| 74 | MLX5_QP_OPTPAR_COUNTER_SET_ID = 1 << 25, | ||
| 73 | }; | 75 | }; |
| 74 | 76 | ||
| 75 | enum mlx5_qp_state { | 77 | enum mlx5_qp_state { |
| @@ -202,7 +204,12 @@ struct mlx5_wqe_ctrl_seg { | |||
| 202 | u8 signature; | 204 | u8 signature; |
| 203 | u8 rsvd[2]; | 205 | u8 rsvd[2]; |
| 204 | u8 fm_ce_se; | 206 | u8 fm_ce_se; |
| 205 | __be32 imm; | 207 | union { |
| 208 | __be32 general_id; | ||
| 209 | __be32 imm; | ||
| 210 | __be32 umr_mkey; | ||
| 211 | __be32 tisn; | ||
| 212 | }; | ||
| 206 | }; | 213 | }; |
| 207 | 214 | ||
| 208 | #define MLX5_WQE_CTRL_DS_MASK 0x3f | 215 | #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 | |||
| 551 | return radix_tree_lookup(&dev->priv.qp_table.tree, qpn); | 558 | return radix_tree_lookup(&dev->priv.qp_table.tree, qpn); |
| 552 | } | 559 | } |
| 553 | 560 | ||
| 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 | |||
| 559 | int mlx5_core_create_dct(struct mlx5_core_dev *dev, | 561 | int mlx5_core_create_dct(struct mlx5_core_dev *dev, |
| 560 | struct mlx5_core_dct *qp, | 562 | struct mlx5_core_dct *qp, |
| 561 | u32 *in, int inlen, | 563 | u32 *in, int inlen, |
diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h index 3d1c6cdbbba7..16060fb9b5e5 100644 --- a/include/linux/mlx5/vport.h +++ b/include/linux/mlx5/vport.h | |||
| @@ -44,9 +44,6 @@ | |||
| 44 | MLX5_VPORT_UPLINK_PLACEHOLDER + \ | 44 | MLX5_VPORT_UPLINK_PLACEHOLDER + \ |
| 45 | MLX5_VPORT_ECPF_PLACEHOLDER(mdev)) | 45 | MLX5_VPORT_ECPF_PLACEHOLDER(mdev)) |
| 46 | 46 | ||
| 47 | #define MLX5_TOTAL_VPORTS(mdev) (MLX5_SPECIAL_VPORTS(mdev) + \ | ||
| 48 | mlx5_core_max_vfs(mdev)) | ||
| 49 | |||
| 50 | #define MLX5_VPORT_MANAGER(mdev) \ | 47 | #define MLX5_VPORT_MANAGER(mdev) \ |
| 51 | (MLX5_CAP_GEN(mdev, vport_group_manager) && \ | 48 | (MLX5_CAP_GEN(mdev, vport_group_manager) && \ |
| 52 | (MLX5_CAP_GEN(mdev, port_type) == MLX5_CAP_PORT_TYPE_ETH) && \ | 49 | (MLX5_CAP_GEN(mdev, port_type) == MLX5_CAP_PORT_TYPE_ETH) && \ |
| @@ -58,6 +55,7 @@ enum { | |||
| 58 | MLX5_CAP_INLINE_MODE_NOT_REQUIRED, | 55 | MLX5_CAP_INLINE_MODE_NOT_REQUIRED, |
| 59 | }; | 56 | }; |
| 60 | 57 | ||
| 58 | /* Vport number for each function must keep unchanged */ | ||
| 61 | enum { | 59 | enum { |
| 62 | MLX5_VPORT_PF = 0x0, | 60 | MLX5_VPORT_PF = 0x0, |
| 63 | MLX5_VPORT_FIRST_VF = 0x1, | 61 | MLX5_VPORT_FIRST_VF = 0x1, |
| @@ -69,7 +67,8 @@ u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); | |||
| 69 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, | 67 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, |
| 70 | u16 vport, u8 other_vport, u8 state); | 68 | u16 vport, u8 other_vport, u8 state); |
| 71 | int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, | 69 | 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); | ||
| 73 | int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, | 72 | int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, |
| 74 | u16 vport, u8 *min_inline); | 73 | u16 vport, u8 *min_inline); |
| 75 | void mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline); | 74 | void mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline); |
diff --git a/include/linux/mm.h b/include/linux/mm.h index dd0b5f4e1e45..0389c34ac529 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -633,6 +633,11 @@ static inline bool is_vmalloc_addr(const void *x) | |||
| 633 | return false; | 633 | return false; |
| 634 | #endif | 634 | #endif |
| 635 | } | 635 | } |
| 636 | |||
| 637 | #ifndef is_ioremap_addr | ||
| 638 | #define is_ioremap_addr(x) is_vmalloc_addr(x) | ||
| 639 | #endif | ||
| 640 | |||
| 636 | #ifdef CONFIG_MMU | 641 | #ifdef CONFIG_MMU |
| 637 | extern int is_vmalloc_or_module_addr(const void *x); | 642 | extern int is_vmalloc_or_module_addr(const void *x); |
| 638 | #else | 643 | #else |
| @@ -932,8 +937,6 @@ static inline bool is_zone_device_page(const struct page *page) | |||
| 932 | #endif | 937 | #endif |
| 933 | 938 | ||
| 934 | #ifdef CONFIG_DEV_PAGEMAP_OPS | 939 | #ifdef CONFIG_DEV_PAGEMAP_OPS |
| 935 | void dev_pagemap_get_ops(void); | ||
| 936 | void dev_pagemap_put_ops(void); | ||
| 937 | void __put_devmap_managed_page(struct page *page); | 940 | void __put_devmap_managed_page(struct page *page); |
| 938 | DECLARE_STATIC_KEY_FALSE(devmap_managed_key); | 941 | DECLARE_STATIC_KEY_FALSE(devmap_managed_key); |
| 939 | static inline bool put_devmap_managed_page(struct page *page) | 942 | static inline bool put_devmap_managed_page(struct page *page) |
| @@ -944,7 +947,6 @@ static inline bool put_devmap_managed_page(struct page *page) | |||
| 944 | return false; | 947 | return false; |
| 945 | switch (page->pgmap->type) { | 948 | switch (page->pgmap->type) { |
| 946 | case MEMORY_DEVICE_PRIVATE: | 949 | case MEMORY_DEVICE_PRIVATE: |
| 947 | case MEMORY_DEVICE_PUBLIC: | ||
| 948 | case MEMORY_DEVICE_FS_DAX: | 950 | case MEMORY_DEVICE_FS_DAX: |
| 949 | __put_devmap_managed_page(page); | 951 | __put_devmap_managed_page(page); |
| 950 | return true; | 952 | return true; |
| @@ -960,12 +962,6 @@ static inline bool is_device_private_page(const struct page *page) | |||
| 960 | page->pgmap->type == MEMORY_DEVICE_PRIVATE; | 962 | page->pgmap->type == MEMORY_DEVICE_PRIVATE; |
| 961 | } | 963 | } |
| 962 | 964 | ||
| 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 | 965 | #ifdef CONFIG_PCI_P2PDMA |
| 970 | static inline bool is_pci_p2pdma_page(const struct page *page) | 966 | static inline bool is_pci_p2pdma_page(const struct page *page) |
| 971 | { | 967 | { |
| @@ -980,14 +976,6 @@ static inline bool is_pci_p2pdma_page(const struct page *page) | |||
| 980 | #endif /* CONFIG_PCI_P2PDMA */ | 976 | #endif /* CONFIG_PCI_P2PDMA */ |
| 981 | 977 | ||
| 982 | #else /* CONFIG_DEV_PAGEMAP_OPS */ | 978 | #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 | |||
| 991 | static inline bool put_devmap_managed_page(struct page *page) | 979 | static inline bool put_devmap_managed_page(struct page *page) |
| 992 | { | 980 | { |
| 993 | return false; | 981 | return false; |
| @@ -998,11 +986,6 @@ static inline bool is_device_private_page(const struct page *page) | |||
| 998 | return false; | 986 | return false; |
| 999 | } | 987 | } |
| 1000 | 988 | ||
| 1001 | static inline bool is_device_public_page(const struct page *page) | ||
| 1002 | { | ||
| 1003 | return false; | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | static inline bool is_pci_p2pdma_page(const struct page *page) | 989 | static inline bool is_pci_p2pdma_page(const struct page *page) |
| 1007 | { | 990 | { |
| 1008 | return false; | 991 | return false; |
| @@ -1431,10 +1414,8 @@ struct zap_details { | |||
| 1431 | pgoff_t last_index; /* Highest page->index to unmap */ | 1414 | pgoff_t last_index; /* Highest page->index to unmap */ |
| 1432 | }; | 1415 | }; |
| 1433 | 1416 | ||
| 1434 | struct page *_vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | 1417 | struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, |
| 1435 | pte_t pte, bool with_public_device); | 1418 | pte_t pte); |
| 1436 | #define vm_normal_page(vma, addr, pte) _vm_normal_page(vma, addr, pte, false) | ||
| 1437 | |||
| 1438 | struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, | 1419 | struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, |
| 1439 | pmd_t pmd); | 1420 | pmd_t pmd); |
| 1440 | 1421 | ||
| @@ -2681,8 +2662,7 @@ static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags) | |||
| 2681 | return 0; | 2662 | return 0; |
| 2682 | } | 2663 | } |
| 2683 | 2664 | ||
| 2684 | typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, | 2665 | typedef int (*pte_fn_t)(pte_t *pte, unsigned long addr, void *data); |
| 2685 | void *data); | ||
| 2686 | extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, | 2666 | extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, |
| 2687 | unsigned long size, pte_fn_t fn, void *data); | 2667 | unsigned long size, pte_fn_t fn, void *data); |
| 2688 | 2668 | ||
| @@ -2696,11 +2676,42 @@ static inline void kernel_poison_pages(struct page *page, int numpages, | |||
| 2696 | int enable) { } | 2676 | int enable) { } |
| 2697 | #endif | 2677 | #endif |
| 2698 | 2678 | ||
| 2699 | extern bool _debug_pagealloc_enabled; | 2679 | #ifdef CONFIG_INIT_ON_ALLOC_DEFAULT_ON |
| 2680 | DECLARE_STATIC_KEY_TRUE(init_on_alloc); | ||
| 2681 | #else | ||
| 2682 | DECLARE_STATIC_KEY_FALSE(init_on_alloc); | ||
| 2683 | #endif | ||
| 2684 | static inline bool want_init_on_alloc(gfp_t flags) | ||
| 2685 | { | ||
| 2686 | if (static_branch_unlikely(&init_on_alloc) && | ||
| 2687 | !page_poisoning_enabled()) | ||
| 2688 | return true; | ||
| 2689 | return flags & __GFP_ZERO; | ||
| 2690 | } | ||
| 2691 | |||
| 2692 | #ifdef CONFIG_INIT_ON_FREE_DEFAULT_ON | ||
| 2693 | DECLARE_STATIC_KEY_TRUE(init_on_free); | ||
| 2694 | #else | ||
| 2695 | DECLARE_STATIC_KEY_FALSE(init_on_free); | ||
| 2696 | #endif | ||
| 2697 | static inline bool want_init_on_free(void) | ||
| 2698 | { | ||
| 2699 | return static_branch_unlikely(&init_on_free) && | ||
| 2700 | !page_poisoning_enabled(); | ||
| 2701 | } | ||
| 2702 | |||
| 2703 | #ifdef CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT | ||
| 2704 | DECLARE_STATIC_KEY_TRUE(_debug_pagealloc_enabled); | ||
| 2705 | #else | ||
| 2706 | DECLARE_STATIC_KEY_FALSE(_debug_pagealloc_enabled); | ||
| 2707 | #endif | ||
| 2700 | 2708 | ||
| 2701 | static inline bool debug_pagealloc_enabled(void) | 2709 | static inline bool debug_pagealloc_enabled(void) |
| 2702 | { | 2710 | { |
| 2703 | return IS_ENABLED(CONFIG_DEBUG_PAGEALLOC) && _debug_pagealloc_enabled; | 2711 | if (!IS_ENABLED(CONFIG_DEBUG_PAGEALLOC)) |
| 2712 | return false; | ||
| 2713 | |||
| 2714 | return static_branch_unlikely(&_debug_pagealloc_enabled); | ||
| 2704 | } | 2715 | } |
| 2705 | 2716 | ||
| 2706 | #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP) | 2717 | #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP) |
| @@ -2850,11 +2861,9 @@ extern long copy_huge_page_from_user(struct page *dst_page, | |||
| 2850 | bool allow_pagefault); | 2861 | bool allow_pagefault); |
| 2851 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ | 2862 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ |
| 2852 | 2863 | ||
| 2853 | extern struct page_ext_operations debug_guardpage_ops; | ||
| 2854 | |||
| 2855 | #ifdef CONFIG_DEBUG_PAGEALLOC | 2864 | #ifdef CONFIG_DEBUG_PAGEALLOC |
| 2856 | extern unsigned int _debug_guardpage_minorder; | 2865 | extern unsigned int _debug_guardpage_minorder; |
| 2857 | extern bool _debug_guardpage_enabled; | 2866 | DECLARE_STATIC_KEY_FALSE(_debug_guardpage_enabled); |
| 2858 | 2867 | ||
| 2859 | static inline unsigned int debug_guardpage_minorder(void) | 2868 | static inline unsigned int debug_guardpage_minorder(void) |
| 2860 | { | 2869 | { |
| @@ -2863,21 +2872,15 @@ static inline unsigned int debug_guardpage_minorder(void) | |||
| 2863 | 2872 | ||
| 2864 | static inline bool debug_guardpage_enabled(void) | 2873 | static inline bool debug_guardpage_enabled(void) |
| 2865 | { | 2874 | { |
| 2866 | return _debug_guardpage_enabled; | 2875 | return static_branch_unlikely(&_debug_guardpage_enabled); |
| 2867 | } | 2876 | } |
| 2868 | 2877 | ||
| 2869 | static inline bool page_is_guard(struct page *page) | 2878 | static inline bool page_is_guard(struct page *page) |
| 2870 | { | 2879 | { |
| 2871 | struct page_ext *page_ext; | ||
| 2872 | |||
| 2873 | if (!debug_guardpage_enabled()) | 2880 | if (!debug_guardpage_enabled()) |
| 2874 | return false; | 2881 | return false; |
| 2875 | 2882 | ||
| 2876 | page_ext = lookup_page_ext(page); | 2883 | return PageGuard(page); |
| 2877 | if (unlikely(!page_ext)) | ||
| 2878 | return false; | ||
| 2879 | |||
| 2880 | return test_bit(PAGE_EXT_DEBUG_GUARD, &page_ext->flags); | ||
| 2881 | } | 2884 | } |
| 2882 | #else | 2885 | #else |
| 2883 | static inline unsigned int debug_guardpage_minorder(void) { return 0; } | 2886 | static inline unsigned int debug_guardpage_minorder(void) { return 0; } |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 8ec38b11b361..3a37a89eb7a7 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
| @@ -158,7 +158,7 @@ struct page { | |||
| 158 | struct { /* ZONE_DEVICE pages */ | 158 | struct { /* ZONE_DEVICE pages */ |
| 159 | /** @pgmap: Points to the hosting device page map. */ | 159 | /** @pgmap: Points to the hosting device page map. */ |
| 160 | struct dev_pagemap *pgmap; | 160 | struct dev_pagemap *pgmap; |
| 161 | unsigned long hmm_data; | 161 | void *zone_device_data; |
| 162 | unsigned long _zd_pad_1; /* uses mapping */ | 162 | unsigned long _zd_pad_1; /* uses mapping */ |
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| @@ -329,7 +329,9 @@ struct vm_area_struct { | |||
| 329 | struct file * vm_file; /* File we map to (can be NULL). */ | 329 | struct file * vm_file; /* File we map to (can be NULL). */ |
| 330 | void * vm_private_data; /* was vm_pte (shared mem) */ | 330 | void * vm_private_data; /* was vm_pte (shared mem) */ |
| 331 | 331 | ||
| 332 | #ifdef CONFIG_SWAP | ||
| 332 | atomic_long_t swap_readahead_info; | 333 | atomic_long_t swap_readahead_info; |
| 334 | #endif | ||
| 333 | #ifndef CONFIG_MMU | 335 | #ifndef CONFIG_MMU |
| 334 | struct vm_region *vm_region; /* NOMMU mapping region */ | 336 | struct vm_region *vm_region; /* NOMMU mapping region */ |
| 335 | #endif | 337 | #endif |
| @@ -501,7 +503,7 @@ struct mm_struct { | |||
| 501 | #endif | 503 | #endif |
| 502 | struct work_struct async_put_work; | 504 | struct work_struct async_put_work; |
| 503 | 505 | ||
| 504 | #if IS_ENABLED(CONFIG_HMM) | 506 | #ifdef CONFIG_HMM_MIRROR |
| 505 | /* HMM needs to track a few things per mm */ | 507 | /* HMM needs to track a few things per mm */ |
| 506 | struct hmm *hmm; | 508 | struct hmm *hmm; |
| 507 | #endif | 509 | #endif |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 7ac3755444d3..4a351cb7f20f 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
| @@ -501,7 +501,6 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host) | |||
| 501 | wake_up_process(host->sdio_irq_thread); | 501 | wake_up_process(host->sdio_irq_thread); |
| 502 | } | 502 | } |
| 503 | 503 | ||
| 504 | void sdio_run_irqs(struct mmc_host *host); | ||
| 505 | void sdio_signal_irq(struct mmc_host *host); | 504 | void sdio_signal_irq(struct mmc_host *host); |
| 506 | 505 | ||
| 507 | #ifdef CONFIG_REGULATOR | 506 | #ifdef CONFIG_REGULATOR |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 448621c32e4d..b2c1648f7e5d 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
| @@ -16,6 +16,25 @@ typedef unsigned long kernel_ulong_t; | |||
| 16 | 16 | ||
| 17 | #define PCI_ANY_ID (~0) | 17 | #define PCI_ANY_ID (~0) |
| 18 | 18 | ||
| 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 | */ | ||
| 19 | struct pci_device_id { | 38 | struct pci_device_id { |
| 20 | __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/ | 39 | __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/ |
| 21 | __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */ | 40 | __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */ |
| @@ -257,17 +276,17 @@ struct pcmcia_device_id { | |||
| 257 | __u16 match_flags; | 276 | __u16 match_flags; |
| 258 | 277 | ||
| 259 | __u16 manf_id; | 278 | __u16 manf_id; |
| 260 | __u16 card_id; | 279 | __u16 card_id; |
| 261 | 280 | ||
| 262 | __u8 func_id; | 281 | __u8 func_id; |
| 263 | 282 | ||
| 264 | /* for real multi-function devices */ | 283 | /* for real multi-function devices */ |
| 265 | __u8 function; | 284 | __u8 function; |
| 266 | 285 | ||
| 267 | /* for pseudo multi-function devices */ | 286 | /* for pseudo multi-function devices */ |
| 268 | __u8 device_no; | 287 | __u8 device_no; |
| 269 | 288 | ||
| 270 | __u32 prod_id_hash[4]; | 289 | __u32 prod_id_hash[4]; |
| 271 | 290 | ||
| 272 | /* not matched against in kernelspace */ | 291 | /* not matched against in kernelspace */ |
| 273 | const char * prod_id[4]; | 292 | const char * prod_id[4]; |
| @@ -798,6 +817,7 @@ struct tee_client_device_id { | |||
| 798 | */ | 817 | */ |
| 799 | struct wmi_device_id { | 818 | struct wmi_device_id { |
| 800 | const char guid_string[UUID_STRING_LEN+1]; | 819 | const char guid_string[UUID_STRING_LEN+1]; |
| 820 | const void *context; | ||
| 801 | }; | 821 | }; |
| 802 | 822 | ||
| 803 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 823 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index 188998d3dca9..1455812dd325 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/rbtree_latch.h> | 21 | #include <linux/rbtree_latch.h> |
| 22 | #include <linux/error-injection.h> | 22 | #include <linux/error-injection.h> |
| 23 | #include <linux/tracepoint-defs.h> | 23 | #include <linux/tracepoint-defs.h> |
| 24 | #include <linux/srcu.h> | ||
| 24 | 25 | ||
| 25 | #include <linux/percpu.h> | 26 | #include <linux/percpu.h> |
| 26 | #include <asm/module.h> | 27 | #include <asm/module.h> |
| @@ -450,6 +451,10 @@ struct module { | |||
| 450 | unsigned int num_tracepoints; | 451 | unsigned int num_tracepoints; |
| 451 | tracepoint_ptr_t *tracepoints_ptrs; | 452 | tracepoint_ptr_t *tracepoints_ptrs; |
| 452 | #endif | 453 | #endif |
| 454 | #ifdef CONFIG_TREE_SRCU | ||
| 455 | unsigned int num_srcu_structs; | ||
| 456 | struct srcu_struct **srcu_struct_ptrs; | ||
| 457 | #endif | ||
| 453 | #ifdef CONFIG_BPF_EVENTS | 458 | #ifdef CONFIG_BPF_EVENTS |
| 454 | unsigned int num_bpf_raw_events; | 459 | unsigned int num_bpf_raw_events; |
| 455 | struct bpf_raw_event_map *bpf_raw_events; | 460 | struct bpf_raw_event_map *bpf_raw_events; |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 208c87cf2e3e..c98a21108688 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
| @@ -219,6 +219,13 @@ struct cfi_pri_amdstd { | |||
| 219 | uint8_t VppMin; | 219 | uint8_t VppMin; |
| 220 | uint8_t VppMax; | 220 | uint8_t VppMax; |
| 221 | uint8_t TopBottom; | 221 | 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) | ||
| 222 | } __packed; | 229 | } __packed; |
| 223 | 230 | ||
| 224 | /* Vendor-Specific PRI for Atmel chips (command set 0x0002) */ | 231 | /* Vendor-Specific PRI for Atmel chips (command set 0x0002) */ |
diff --git a/include/linux/mtd/hyperbus.h b/include/linux/mtd/hyperbus.h new file mode 100644 index 000000000000..2dfe65964f6e --- /dev/null +++ b/include/linux/mtd/hyperbus.h | |||
| @@ -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__ */ | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 936a3fdb48b5..4ca8c1c845fb 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -316,6 +316,12 @@ struct mtd_info { | |||
| 316 | int (*_get_device) (struct mtd_info *mtd); | 316 | int (*_get_device) (struct mtd_info *mtd); |
| 317 | void (*_put_device) (struct mtd_info *mtd); | 317 | void (*_put_device) (struct mtd_info *mtd); |
| 318 | 318 | ||
| 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 | |||
| 319 | struct notifier_block reboot_notifier; /* default mode before reboot */ | 325 | struct notifier_block reboot_notifier; /* default mode before reboot */ |
| 320 | 326 | ||
| 321 | /* ECC status information */ | 327 | /* ECC status information */ |
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index 2d12a1b18742..5f728407a579 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h | |||
| @@ -77,6 +77,7 @@ | |||
| 77 | #define ONENAND_DEVICE_DENSITY_1Gb (0x003) | 77 | #define ONENAND_DEVICE_DENSITY_1Gb (0x003) |
| 78 | #define ONENAND_DEVICE_DENSITY_2Gb (0x004) | 78 | #define ONENAND_DEVICE_DENSITY_2Gb (0x004) |
| 79 | #define ONENAND_DEVICE_DENSITY_4Gb (0x005) | 79 | #define ONENAND_DEVICE_DENSITY_4Gb (0x005) |
| 80 | #define ONENAND_DEVICE_DENSITY_8Gb (0x006) | ||
| 80 | 81 | ||
| 81 | /* | 82 | /* |
| 82 | * Version ID Register F002h (R) | 83 | * Version ID Register F002h (R) |
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index ac3884a28dea..4ab9bccfcde0 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h | |||
| @@ -874,6 +874,42 @@ int nand_op_parser_exec_op(struct nand_chip *chip, | |||
| 874 | const struct nand_op_parser *parser, | 874 | const struct nand_op_parser *parser, |
| 875 | const struct nand_operation *op, bool check_only); | 875 | const struct nand_operation *op, bool check_only); |
| 876 | 876 | ||
| 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 | |||
| 877 | /** | 913 | /** |
| 878 | * struct nand_controller_ops - Controller operations | 914 | * struct nand_controller_ops - Controller operations |
| 879 | * | 915 | * |
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index 507f7e289bd1..4ea558bd3c46 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h | |||
| @@ -68,30 +68,60 @@ | |||
| 68 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | 68 | SPI_MEM_OP_DUMMY(ndummy, 1), \ |
| 69 | SPI_MEM_OP_DATA_IN(len, buf, 1)) | 69 | SPI_MEM_OP_DATA_IN(len, buf, 1)) |
| 70 | 70 | ||
| 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 | |||
| 71 | #define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len) \ | 77 | #define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len) \ |
| 72 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \ | 78 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \ |
| 73 | SPI_MEM_OP_ADDR(2, addr, 1), \ | 79 | SPI_MEM_OP_ADDR(2, addr, 1), \ |
| 74 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | 80 | SPI_MEM_OP_DUMMY(ndummy, 1), \ |
| 75 | SPI_MEM_OP_DATA_IN(len, buf, 2)) | 81 | SPI_MEM_OP_DATA_IN(len, buf, 2)) |
| 76 | 82 | ||
| 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 | |||
| 77 | #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \ | 89 | #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \ |
| 78 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \ | 90 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \ |
| 79 | SPI_MEM_OP_ADDR(2, addr, 1), \ | 91 | SPI_MEM_OP_ADDR(2, addr, 1), \ |
| 80 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | 92 | SPI_MEM_OP_DUMMY(ndummy, 1), \ |
| 81 | SPI_MEM_OP_DATA_IN(len, buf, 4)) | 93 | SPI_MEM_OP_DATA_IN(len, buf, 4)) |
| 82 | 94 | ||
| 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 | |||
| 83 | #define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len) \ | 101 | #define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len) \ |
| 84 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ | 102 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ |
| 85 | SPI_MEM_OP_ADDR(2, addr, 2), \ | 103 | SPI_MEM_OP_ADDR(2, addr, 2), \ |
| 86 | SPI_MEM_OP_DUMMY(ndummy, 2), \ | 104 | SPI_MEM_OP_DUMMY(ndummy, 2), \ |
| 87 | SPI_MEM_OP_DATA_IN(len, buf, 2)) | 105 | SPI_MEM_OP_DATA_IN(len, buf, 2)) |
| 88 | 106 | ||
| 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 | |||
| 89 | #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \ | 113 | #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \ |
| 90 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ | 114 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ |
| 91 | SPI_MEM_OP_ADDR(2, addr, 4), \ | 115 | SPI_MEM_OP_ADDR(2, addr, 4), \ |
| 92 | SPI_MEM_OP_DUMMY(ndummy, 4), \ | 116 | SPI_MEM_OP_DUMMY(ndummy, 4), \ |
| 93 | SPI_MEM_OP_DATA_IN(len, buf, 4)) | 117 | SPI_MEM_OP_DATA_IN(len, buf, 4)) |
| 94 | 118 | ||
| 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 | |||
| 95 | #define SPINAND_PROG_EXEC_OP(addr) \ | 125 | #define SPINAND_PROG_EXEC_OP(addr) \ |
| 96 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \ | 126 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \ |
| 97 | SPI_MEM_OP_ADDR(3, addr, 1), \ | 127 | SPI_MEM_OP_ADDR(3, addr, 1), \ |
| @@ -197,6 +227,7 @@ struct spinand_manufacturer { | |||
| 197 | extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; | 227 | extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; |
| 198 | extern const struct spinand_manufacturer macronix_spinand_manufacturer; | 228 | extern const struct spinand_manufacturer macronix_spinand_manufacturer; |
| 199 | extern const struct spinand_manufacturer micron_spinand_manufacturer; | 229 | extern const struct spinand_manufacturer micron_spinand_manufacturer; |
| 230 | extern const struct spinand_manufacturer paragon_spinand_manufacturer; | ||
| 200 | extern const struct spinand_manufacturer toshiba_spinand_manufacturer; | 231 | extern const struct spinand_manufacturer toshiba_spinand_manufacturer; |
| 201 | extern const struct spinand_manufacturer winbond_spinand_manufacturer; | 232 | extern const struct spinand_manufacturer winbond_spinand_manufacturer; |
| 202 | 233 | ||
| @@ -260,7 +291,7 @@ struct spinand_ecc_info { | |||
| 260 | */ | 291 | */ |
| 261 | struct spinand_info { | 292 | struct spinand_info { |
| 262 | const char *model; | 293 | const char *model; |
| 263 | u8 devid; | 294 | u16 devid; |
| 264 | u32 flags; | 295 | u32 flags; |
| 265 | struct nand_memory_organization memorg; | 296 | struct nand_memory_organization memorg; |
| 266 | struct nand_ecc_req eccreq; | 297 | struct nand_ecc_req eccreq; |
| @@ -422,7 +453,7 @@ static inline void spinand_set_of_node(struct spinand_device *spinand, | |||
| 422 | 453 | ||
| 423 | int spinand_match_and_init(struct spinand_device *dev, | 454 | int spinand_match_and_init(struct spinand_device *dev, |
| 424 | const struct spinand_info *table, | 455 | const struct spinand_info *table, |
| 425 | unsigned int table_size, u8 devid); | 456 | unsigned int table_size, u16 devid); |
| 426 | 457 | ||
| 427 | int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val); | 458 | int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val); |
| 428 | int spinand_select_target(struct spinand_device *spinand, unsigned int target); | 459 | int spinand_select_target(struct spinand_device *spinand, unsigned int target); |
diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 3093dd162424..dcd03fee6e01 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h | |||
| @@ -151,7 +151,7 @@ static inline bool mutex_is_locked(struct mutex *lock) | |||
| 151 | 151 | ||
| 152 | /* | 152 | /* |
| 153 | * See kernel/locking/mutex.c for detailed documentation of these APIs. | 153 | * 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. |
| 155 | */ | 155 | */ |
| 156 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 156 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 157 | extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); | 157 | extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); |
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h index 4471cf96ef69..47e5679b48e1 100644 --- a/include/linux/mv643xx.h +++ b/include/linux/mv643xx.h | |||
| @@ -918,52 +918,6 @@ | |||
| 918 | 918 | ||
| 919 | extern void mv64340_irq_init(unsigned int base); | 919 | extern void mv64340_irq_init(unsigned int base); |
| 920 | 920 | ||
| 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 | |||
| 967 | /* Watchdog Platform Device, Driver Data */ | 921 | /* Watchdog Platform Device, Driver Data */ |
| 968 | #define MV64x60_WDT_NAME "mv64x60_wdt" | 922 | #define MV64x60_WDT_NAME "mv64x60_wdt" |
| 969 | 923 | ||
diff --git a/include/linux/net.h b/include/linux/net.h index f7d672cf25b5..9cafb5f353a9 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
| @@ -116,11 +116,11 @@ struct socket { | |||
| 116 | 116 | ||
| 117 | unsigned long flags; | 117 | unsigned long flags; |
| 118 | 118 | ||
| 119 | struct socket_wq *wq; | ||
| 120 | |||
| 121 | struct file *file; | 119 | struct file *file; |
| 122 | struct sock *sk; | 120 | struct sock *sk; |
| 123 | const struct proto_ops *ops; | 121 | const struct proto_ops *ops; |
| 122 | |||
| 123 | struct socket_wq wq; | ||
| 124 | }; | 124 | }; |
| 125 | 125 | ||
| 126 | struct vm_area_struct; | 126 | struct vm_area_struct; |
diff --git a/include/linux/net_dim.h b/include/linux/net_dim.h deleted file mode 100644 index fd458389f7d1..000000000000 --- a/include/linux/net_dim.h +++ /dev/null | |||
| @@ -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 */ | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index eeacebd7debb..88292953aa6f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -4870,4 +4870,6 @@ do { \ | |||
| 4870 | #define PTYPE_HASH_SIZE (16) | 4870 | #define PTYPE_HASH_SIZE (16) |
| 4871 | #define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1) | 4871 | #define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1) |
| 4872 | 4872 | ||
| 4873 | extern struct net_device *blackhole_netdev; | ||
| 4874 | |||
| 4873 | #endif /* _LINUX_NETDEVICE_H */ | 4875 | #endif /* _LINUX_NETDEVICE_H */ |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 996bc247ef6e..049aeb40fa35 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
| @@ -336,11 +336,6 @@ int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, | |||
| 336 | char __user *opt, int *len); | 336 | char __user *opt, int *len); |
| 337 | #endif | 337 | #endif |
| 338 | 338 | ||
| 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 | |||
| 344 | struct flowi; | 339 | struct flowi; |
| 345 | struct nf_queue_entry; | 340 | struct nf_queue_entry; |
| 346 | 341 | ||
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index f5e03809cdb2..12ad9b1853b4 100644 --- a/include/linux/netfilter/ipset/ip_set.h +++ b/include/linux/netfilter/ipset/ip_set.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 2 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 3 | * Patrick Schaaf <bof@bof.de> | 3 | * Patrick Schaaf <bof@bof.de> |
| 4 | * Martin Josefsson <gandalf@wlug.westbo.se> | 4 | * 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> |
| 6 | */ | 6 | */ |
| 7 | #ifndef _IP_SET_H | 7 | #ifndef _IP_SET_H |
| 8 | #define _IP_SET_H | 8 | #define _IP_SET_H |
diff --git a/include/linux/netfilter/ipset/ip_set_counter.h b/include/linux/netfilter/ipset/ip_set_counter.h index 5477492c8374..3400958c07be 100644 --- a/include/linux/netfilter/ipset/ip_set_counter.h +++ b/include/linux/netfilter/ipset/ip_set_counter.h | |||
| @@ -2,8 +2,7 @@ | |||
| 2 | #ifndef _IP_SET_COUNTER_H | 2 | #ifndef _IP_SET_COUNTER_H |
| 3 | #define _IP_SET_COUNTER_H | 3 | #define _IP_SET_COUNTER_H |
| 4 | 4 | ||
| 5 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@netfilter.org> */ |
| 6 | */ | ||
| 7 | 6 | ||
| 8 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 9 | 8 | ||
diff --git a/include/linux/netfilter/ipset/ip_set_skbinfo.h b/include/linux/netfilter/ipset/ip_set_skbinfo.h index aae081e085c6..3a2df02dbd55 100644 --- a/include/linux/netfilter/ipset/ip_set_skbinfo.h +++ b/include/linux/netfilter/ipset/ip_set_skbinfo.h | |||
| @@ -2,8 +2,7 @@ | |||
| 2 | #ifndef _IP_SET_SKBINFO_H | 2 | #ifndef _IP_SET_SKBINFO_H |
| 3 | #define _IP_SET_SKBINFO_H | 3 | #define _IP_SET_SKBINFO_H |
| 4 | 4 | ||
| 5 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@netfilter.org> */ |
| 6 | */ | ||
| 7 | 6 | ||
| 8 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 9 | 8 | ||
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h index 88926b4c75f0..2be60e379ecf 100644 --- a/include/linux/netfilter/ipset/ip_set_timeout.h +++ b/include/linux/netfilter/ipset/ip_set_timeout.h | |||
| @@ -2,8 +2,7 @@ | |||
| 2 | #ifndef _IP_SET_TIMEOUT_H | 2 | #ifndef _IP_SET_TIMEOUT_H |
| 3 | #define _IP_SET_TIMEOUT_H | 3 | #define _IP_SET_TIMEOUT_H |
| 4 | 4 | ||
| 5 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> */ |
| 6 | */ | ||
| 7 | 6 | ||
| 8 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 9 | 8 | ||
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index 12113e502656..7beb681e1ce5 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #define __LINUX_IP6_NETFILTER_H | 8 | #define __LINUX_IP6_NETFILTER_H |
| 9 | 9 | ||
| 10 | #include <uapi/linux/netfilter_ipv6.h> | 10 | #include <uapi/linux/netfilter_ipv6.h> |
| 11 | #include <net/tcp.h> | ||
| 11 | 12 | ||
| 12 | /* Extra routing may needed on local out, as the QUEUE target never returns | 13 | /* Extra routing may needed on local out, as the QUEUE target never returns |
| 13 | * control to the table. | 14 | * control to the table. |
| @@ -19,6 +20,7 @@ struct ip6_rt_info { | |||
| 19 | }; | 20 | }; |
| 20 | 21 | ||
| 21 | struct nf_queue_entry; | 22 | struct nf_queue_entry; |
| 23 | struct nf_ct_bridge_frag_data; | ||
| 22 | 24 | ||
| 23 | /* | 25 | /* |
| 24 | * Hook functions for ipv6 to allow xt_* modules to be built-in even | 26 | * Hook functions for ipv6 to allow xt_* modules to be built-in even |
| @@ -34,11 +36,24 @@ struct nf_ipv6_ops { | |||
| 34 | struct in6_addr *saddr); | 36 | struct in6_addr *saddr); |
| 35 | int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl, | 37 | int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl, |
| 36 | bool strict); | 38 | 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); | ||
| 37 | #endif | 43 | #endif |
| 38 | void (*route_input)(struct sk_buff *skb); | 44 | void (*route_input)(struct sk_buff *skb); |
| 39 | int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, | 45 | int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, |
| 40 | int (*output)(struct net *, struct sock *, struct sk_buff *)); | 46 | int (*output)(struct net *, struct sock *, struct sk_buff *)); |
| 41 | int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry); | 47 | 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 | ||
| 42 | }; | 57 | }; |
| 43 | 58 | ||
| 44 | #ifdef CONFIG_NETFILTER | 59 | #ifdef CONFIG_NETFILTER |
| @@ -60,8 +75,10 @@ static inline int nf_ipv6_chk_addr(struct net *net, const struct in6_addr *addr, | |||
| 60 | return 1; | 75 | return 1; |
| 61 | 76 | ||
| 62 | return v6_ops->chk_addr(net, addr, dev, strict); | 77 | return v6_ops->chk_addr(net, addr, dev, strict); |
| 63 | #else | 78 | #elif IS_BUILTIN(CONFIG_IPV6) |
| 64 | return ipv6_chk_addr(net, addr, dev, strict); | 79 | return ipv6_chk_addr(net, addr, dev, strict); |
| 80 | #else | ||
| 81 | return 1; | ||
| 65 | #endif | 82 | #endif |
| 66 | } | 83 | } |
| 67 | 84 | ||
| @@ -86,6 +103,52 @@ static inline int nf_ip6_route(struct net *net, struct dst_entry **dst, | |||
| 86 | #endif | 103 | #endif |
| 87 | } | 104 | } |
| 88 | 105 | ||
| 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 | |||
| 89 | int ip6_route_me_harder(struct net *net, struct sk_buff *skb); | 152 | int ip6_route_me_harder(struct net *net, struct sk_buff *skb); |
| 90 | 153 | ||
| 91 | static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) | 154 | 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) | |||
| 97 | return -EHOSTUNREACH; | 160 | return -EHOSTUNREACH; |
| 98 | 161 | ||
| 99 | return v6_ops->route_me_harder(net, skb); | 162 | return v6_ops->route_me_harder(net, skb); |
| 100 | #else | 163 | #elif IS_BUILTIN(CONFIG_IPV6) |
| 101 | return ip6_route_me_harder(net, skb); | 164 | 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 | ||
| 102 | #endif | 199 | #endif |
| 200 | return 0; | ||
| 103 | } | 201 | } |
| 104 | 202 | ||
| 105 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, | 203 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 593d1b9c33a8..205fa7b1f07a 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -192,7 +192,14 @@ struct netlink_callback { | |||
| 192 | bool strict_check; | 192 | bool strict_check; |
| 193 | u16 answer_flags; | 193 | u16 answer_flags; |
| 194 | unsigned int prev_seq, seq; | 194 | 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 | }; | ||
| 196 | }; | 203 | }; |
| 197 | 204 | ||
| 198 | struct netlink_notify { | 205 | struct netlink_notify { |
diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h index c48e96436f56..98d904961b33 100644 --- a/include/linux/nvme-fc-driver.h +++ b/include/linux/nvme-fc-driver.h | |||
| @@ -791,6 +791,11 @@ struct nvmet_fc_target_port { | |||
| 791 | * nvmefc_tgt_fcp_req. | 791 | * nvmefc_tgt_fcp_req. |
| 792 | * Entrypoint is Optional. | 792 | * Entrypoint is Optional. |
| 793 | * | 793 | * |
| 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 | * | ||
| 794 | * @max_hw_queues: indicates the maximum number of hw queues the LLDD | 799 | * @max_hw_queues: indicates the maximum number of hw queues the LLDD |
| 795 | * supports for cpu affinitization. | 800 | * supports for cpu affinitization. |
| 796 | * Value is Mandatory. Must be at least 1. | 801 | * Value is Mandatory. Must be at least 1. |
| @@ -832,6 +837,7 @@ struct nvmet_fc_target_template { | |||
| 832 | struct nvmefc_tgt_fcp_req *fcpreq); | 837 | struct nvmefc_tgt_fcp_req *fcpreq); |
| 833 | void (*defer_rcv)(struct nvmet_fc_target_port *tgtport, | 838 | void (*defer_rcv)(struct nvmet_fc_target_port *tgtport, |
| 834 | struct nvmefc_tgt_fcp_req *fcpreq); | 839 | struct nvmefc_tgt_fcp_req *fcpreq); |
| 840 | void (*discovery_event)(struct nvmet_fc_target_port *tgtport); | ||
| 835 | 841 | ||
| 836 | u32 max_hw_queues; | 842 | u32 max_hw_queues; |
| 837 | u16 max_sgl_segments; | 843 | u16 max_sgl_segments; |
diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 8028adacaff3..01aa6a6c241d 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h | |||
| @@ -315,7 +315,7 @@ struct nvme_id_ns { | |||
| 315 | __u8 nmic; | 315 | __u8 nmic; |
| 316 | __u8 rescap; | 316 | __u8 rescap; |
| 317 | __u8 fpi; | 317 | __u8 fpi; |
| 318 | __u8 rsvd33; | 318 | __u8 dlfeat; |
| 319 | __le16 nawun; | 319 | __le16 nawun; |
| 320 | __le16 nawupf; | 320 | __le16 nawupf; |
| 321 | __le16 nacwu; | 321 | __le16 nacwu; |
| @@ -324,11 +324,17 @@ struct nvme_id_ns { | |||
| 324 | __le16 nabspf; | 324 | __le16 nabspf; |
| 325 | __le16 noiob; | 325 | __le16 noiob; |
| 326 | __u8 nvmcap[16]; | 326 | __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]; | ||
| 328 | __le32 anagrpid; | 333 | __le32 anagrpid; |
| 329 | __u8 rsvd96[3]; | 334 | __u8 rsvd96[3]; |
| 330 | __u8 nsattr; | 335 | __u8 nsattr; |
| 331 | __u8 rsvd100[4]; | 336 | __le16 nvmsetid; |
| 337 | __le16 endgid; | ||
| 332 | __u8 nguid[16]; | 338 | __u8 nguid[16]; |
| 333 | __u8 eui64[8]; | 339 | __u8 eui64[8]; |
| 334 | struct nvme_lbaf lbaf[16]; | 340 | struct nvme_lbaf lbaf[16]; |
| @@ -562,6 +568,22 @@ enum nvme_opcode { | |||
| 562 | nvme_cmd_resv_release = 0x15, | 568 | nvme_cmd_resv_release = 0x15, |
| 563 | }; | 569 | }; |
| 564 | 570 | ||
| 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 | |||
| 565 | /* | 587 | /* |
| 566 | * Descriptor subtype - lower 4 bits of nvme_(keyed_)sgl_desc identifier | 588 | * Descriptor subtype - lower 4 bits of nvme_(keyed_)sgl_desc identifier |
| 567 | * | 589 | * |
| @@ -794,6 +816,32 @@ enum nvme_admin_opcode { | |||
| 794 | nvme_admin_sanitize_nvm = 0x84, | 816 | nvme_admin_sanitize_nvm = 0x84, |
| 795 | }; | 817 | }; |
| 796 | 818 | ||
| 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 | |||
| 797 | enum { | 845 | enum { |
| 798 | NVME_QUEUE_PHYS_CONTIG = (1 << 0), | 846 | NVME_QUEUE_PHYS_CONTIG = (1 << 0), |
| 799 | NVME_CQ_IRQ_ENABLED = (1 << 1), | 847 | NVME_CQ_IRQ_ENABLED = (1 << 1), |
| @@ -1008,6 +1056,23 @@ enum nvmf_capsule_command { | |||
| 1008 | nvme_fabrics_type_property_get = 0x04, | 1056 | nvme_fabrics_type_property_get = 0x04, |
| 1009 | }; | 1057 | }; |
| 1010 | 1058 | ||
| 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 | |||
| 1011 | struct nvmf_common_command { | 1076 | struct nvmf_common_command { |
| 1012 | __u8 opcode; | 1077 | __u8 opcode; |
| 1013 | __u8 resv1; | 1078 | __u8 resv1; |
| @@ -1165,6 +1230,11 @@ struct nvme_command { | |||
| 1165 | }; | 1230 | }; |
| 1166 | }; | 1231 | }; |
| 1167 | 1232 | ||
| 1233 | static inline bool nvme_is_fabrics(struct nvme_command *cmd) | ||
| 1234 | { | ||
| 1235 | return cmd->common.opcode == nvme_fabrics_command; | ||
| 1236 | } | ||
| 1237 | |||
| 1168 | struct nvme_error_slot { | 1238 | struct nvme_error_slot { |
| 1169 | __le64 error_count; | 1239 | __le64 error_count; |
| 1170 | __le16 sqid; | 1240 | __le16 sqid; |
| @@ -1186,7 +1256,7 @@ static inline bool nvme_is_write(struct nvme_command *cmd) | |||
| 1186 | * | 1256 | * |
| 1187 | * Why can't we simply have a Fabrics In and Fabrics out command? | 1257 | * Why can't we simply have a Fabrics In and Fabrics out command? |
| 1188 | */ | 1258 | */ |
| 1189 | if (unlikely(cmd->common.opcode == nvme_fabrics_command)) | 1259 | if (unlikely(nvme_is_fabrics(cmd))) |
| 1190 | return cmd->fabrics.fctype & 1; | 1260 | return cmd->fabrics.fctype & 1; |
| 1191 | return cmd->common.opcode & 1; | 1261 | return cmd->common.opcode & 1; |
| 1192 | } | 1262 | } |
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index a713e5d156d8..acf820e88952 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h | |||
| @@ -23,15 +23,6 @@ | |||
| 23 | struct device_node; | 23 | struct device_node; |
| 24 | 24 | ||
| 25 | /* For scanning an arbitrary device-tree at any time */ | 25 | /* 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); | ||
| 35 | extern void *of_fdt_unflatten_tree(const unsigned long *blob, | 26 | extern void *of_fdt_unflatten_tree(const unsigned long *blob, |
| 36 | struct device_node *dad, | 27 | struct device_node *dad, |
| 37 | struct device_node **mynodes); | 28 | struct device_node **mynodes); |
| @@ -64,9 +55,7 @@ extern int of_get_flat_dt_subnode_by_name(unsigned long node, | |||
| 64 | extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, | 55 | extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, |
| 65 | int *size); | 56 | int *size); |
| 66 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); | 57 | 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); | ||
| 68 | extern unsigned long of_get_flat_dt_root(void); | 58 | extern unsigned long of_get_flat_dt_root(void); |
| 69 | extern int of_get_flat_dt_size(void); | ||
| 70 | extern uint32_t of_get_flat_dt_phandle(unsigned long node); | 59 | extern uint32_t of_get_flat_dt_phandle(unsigned long node); |
| 71 | 60 | ||
| 72 | extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, | 61 | extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, |
diff --git a/include/linux/olpc-ec.h b/include/linux/olpc-ec.h index 79bdc6328c52..c4602364e909 100644 --- a/include/linux/olpc-ec.h +++ b/include/linux/olpc-ec.h | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #ifndef _LINUX_OLPC_EC_H | 2 | #ifndef _LINUX_OLPC_EC_H |
| 3 | #define _LINUX_OLPC_EC_H | 3 | #define _LINUX_OLPC_EC_H |
| 4 | 4 | ||
| 5 | #include <linux/bits.h> | ||
| 6 | |||
| 5 | /* XO-1 EC commands */ | 7 | /* XO-1 EC commands */ |
| 6 | #define EC_FIRMWARE_REV 0x08 | 8 | #define EC_FIRMWARE_REV 0x08 |
| 7 | #define EC_WRITE_SCI_MASK 0x1b | 9 | #define EC_WRITE_SCI_MASK 0x1b |
| @@ -16,28 +18,57 @@ | |||
| 16 | #define EC_SCI_QUERY 0x84 | 18 | #define EC_SCI_QUERY 0x84 |
| 17 | #define EC_EXT_SCI_QUERY 0x85 | 19 | #define EC_EXT_SCI_QUERY 0x85 |
| 18 | 20 | ||
| 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 | |||
| 19 | struct platform_device; | 33 | struct platform_device; |
| 20 | 34 | ||
| 21 | struct olpc_ec_driver { | 35 | struct olpc_ec_driver { |
| 22 | int (*probe)(struct platform_device *); | ||
| 23 | int (*suspend)(struct platform_device *); | 36 | int (*suspend)(struct platform_device *); |
| 24 | int (*resume)(struct platform_device *); | 37 | int (*resume)(struct platform_device *); |
| 25 | 38 | ||
| 26 | int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *); | 39 | int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *); |
| 40 | |||
| 41 | bool wakeup_available; | ||
| 27 | }; | 42 | }; |
| 28 | 43 | ||
| 29 | #ifdef CONFIG_OLPC | 44 | #ifdef CONFIG_OLPC_EC |
| 30 | 45 | ||
| 31 | extern void olpc_ec_driver_register(struct olpc_ec_driver *drv, void *arg); | 46 | extern void olpc_ec_driver_register(struct olpc_ec_driver *drv, void *arg); |
| 32 | 47 | ||
| 33 | extern int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, | 48 | extern int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, |
| 34 | size_t outlen); | 49 | size_t outlen); |
| 35 | 50 | ||
| 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 | |||
| 36 | #else | 59 | #else |
| 37 | 60 | ||
| 38 | static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, | 61 | static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, |
| 39 | size_t outlen) { return -ENODEV; } | 62 | size_t outlen) { return -ENODEV; } |
| 40 | 63 | ||
| 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 */ | ||
| 42 | 73 | ||
| 43 | #endif /* _LINUX_OLPC_EC_H */ | 74 | #endif /* _LINUX_OLPC_EC_H */ |
diff --git a/include/linux/omap-mailbox.h b/include/linux/omap-mailbox.h index 6dbcd2da0332..8aa984ec1f38 100644 --- a/include/linux/omap-mailbox.h +++ b/include/linux/omap-mailbox.h | |||
| @@ -6,7 +6,9 @@ | |||
| 6 | #ifndef OMAP_MAILBOX_H | 6 | #ifndef OMAP_MAILBOX_H |
| 7 | #define OMAP_MAILBOX_H | 7 | #define OMAP_MAILBOX_H |
| 8 | 8 | ||
| 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) | ||
| 10 | 12 | ||
| 11 | typedef int __bitwise omap_mbox_irq_t; | 13 | typedef int __bitwise omap_mbox_irq_t; |
| 12 | #define IRQ_TX ((__force omap_mbox_irq_t) 1) | 14 | #define IRQ_TX ((__force omap_mbox_irq_t) 1) |
diff --git a/include/linux/oom.h b/include/linux/oom.h index d07992009265..c696c265f019 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
| @@ -108,7 +108,6 @@ static inline vm_fault_t check_stable_address_space(struct mm_struct *mm) | |||
| 108 | bool __oom_reap_task_mm(struct mm_struct *mm); | 108 | bool __oom_reap_task_mm(struct mm_struct *mm); |
| 109 | 109 | ||
| 110 | extern unsigned long oom_badness(struct task_struct *p, | 110 | extern unsigned long oom_badness(struct task_struct *p, |
| 111 | struct mem_cgroup *memcg, const nodemask_t *nodemask, | ||
| 112 | unsigned long totalpages); | 111 | unsigned long totalpages); |
| 113 | 112 | ||
| 114 | extern bool out_of_memory(struct oom_control *oc); | 113 | extern bool out_of_memory(struct oom_control *oc); |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 9f8712a4b1a5..b848517da64c 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
| @@ -703,6 +703,7 @@ PAGEFLAG_FALSE(DoubleMap) | |||
| 703 | #define PG_offline 0x00000100 | 703 | #define PG_offline 0x00000100 |
| 704 | #define PG_kmemcg 0x00000200 | 704 | #define PG_kmemcg 0x00000200 |
| 705 | #define PG_table 0x00000400 | 705 | #define PG_table 0x00000400 |
| 706 | #define PG_guard 0x00000800 | ||
| 706 | 707 | ||
| 707 | #define PageType(page, flag) \ | 708 | #define PageType(page, flag) \ |
| 708 | ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) | 709 | ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) |
| @@ -754,6 +755,11 @@ PAGE_TYPE_OPS(Kmemcg, kmemcg) | |||
| 754 | */ | 755 | */ |
| 755 | PAGE_TYPE_OPS(Table, table) | 756 | PAGE_TYPE_OPS(Table, table) |
| 756 | 757 | ||
| 758 | /* | ||
| 759 | * Marks guardpages used with debug_pagealloc. | ||
| 760 | */ | ||
| 761 | PAGE_TYPE_OPS(Guard, guard) | ||
| 762 | |||
| 757 | extern bool is_free_buddy_page(struct page *page); | 763 | extern bool is_free_buddy_page(struct page *page); |
| 758 | 764 | ||
| 759 | __PAGEFLAG(Isolated, isolated, PF_ANY); | 765 | __PAGEFLAG(Isolated, isolated, PF_ANY); |
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h index 280ae96dc4c3..1099c2fee20f 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h | |||
| @@ -50,7 +50,7 @@ start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, | |||
| 50 | * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE. | 50 | * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE. |
| 51 | * target range is [start_pfn, end_pfn) | 51 | * target range is [start_pfn, end_pfn) |
| 52 | */ | 52 | */ |
| 53 | int | 53 | void |
| 54 | undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, | 54 | undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, |
| 55 | unsigned migratetype); | 55 | unsigned migratetype); |
| 56 | 56 | ||
diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h index f84f167ec04c..09592951725c 100644 --- a/include/linux/page_ext.h +++ b/include/linux/page_ext.h | |||
| @@ -17,7 +17,6 @@ struct page_ext_operations { | |||
| 17 | #ifdef CONFIG_PAGE_EXTENSION | 17 | #ifdef CONFIG_PAGE_EXTENSION |
| 18 | 18 | ||
| 19 | enum page_ext_flags { | 19 | enum page_ext_flags { |
| 20 | PAGE_EXT_DEBUG_GUARD, | ||
| 21 | PAGE_EXT_OWNER, | 20 | PAGE_EXT_OWNER, |
| 22 | #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT) | 21 | #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT) |
| 23 | PAGE_EXT_YOUNG, | 22 | PAGE_EXT_YOUNG, |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index fe0b29bf2df7..c7552459a15f 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
| @@ -383,8 +383,7 @@ extern int read_cache_pages(struct address_space *mapping, | |||
| 383 | static inline struct page *read_mapping_page(struct address_space *mapping, | 383 | static inline struct page *read_mapping_page(struct address_space *mapping, |
| 384 | pgoff_t index, void *data) | 384 | pgoff_t index, void *data) |
| 385 | { | 385 | { |
| 386 | filler_t *filler = (filler_t *)mapping->a_ops->readpage; | 386 | return read_cache_page(mapping, index, NULL, data); |
| 387 | return read_cache_page(mapping, index, filler, data); | ||
| 388 | } | 387 | } |
| 389 | 388 | ||
| 390 | /* | 389 | /* |
| @@ -452,6 +451,9 @@ extern int __lock_page_or_retry(struct page *page, struct mm_struct *mm, | |||
| 452 | unsigned int flags); | 451 | unsigned int flags); |
| 453 | extern void unlock_page(struct page *page); | 452 | extern void unlock_page(struct page *page); |
| 454 | 453 | ||
| 454 | /* | ||
| 455 | * Return true if the page was successfully locked | ||
| 456 | */ | ||
| 455 | static inline int trylock_page(struct page *page) | 457 | static inline int trylock_page(struct page *page) |
| 456 | { | 458 | { |
| 457 | page = compound_head(page); | 459 | page = compound_head(page); |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 8082b612f561..62b7fdcc661c 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
| @@ -107,9 +107,10 @@ static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { } | |||
| 107 | #endif | 107 | #endif |
| 108 | 108 | ||
| 109 | extern const guid_t pci_acpi_dsm_guid; | 109 | extern const guid_t pci_acpi_dsm_guid; |
| 110 | #define DEVICE_LABEL_DSM 0x07 | 110 | #define IGNORE_PCI_BOOT_CONFIG_DSM 0x05 |
| 111 | #define RESET_DELAY_DSM 0x08 | 111 | #define DEVICE_LABEL_DSM 0x07 |
| 112 | #define FUNCTION_DELAY_DSM 0x09 | 112 | #define RESET_DELAY_DSM 0x08 |
| 113 | #define FUNCTION_DELAY_DSM 0x09 | ||
| 113 | 114 | ||
| 114 | #else /* CONFIG_ACPI */ | 115 | #else /* CONFIG_ACPI */ |
| 115 | static inline void acpi_pci_add_bus(struct pci_bus *bus) { } | 116 | static inline void acpi_pci_add_bus(struct pci_bus *bus) { } |
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h index df28af5cef21..67064145d76e 100644 --- a/include/linux/pci-aspm.h +++ b/include/linux/pci-aspm.h | |||
| @@ -24,11 +24,12 @@ | |||
| 24 | #define PCIE_LINK_STATE_CLKPM 4 | 24 | #define PCIE_LINK_STATE_CLKPM 4 |
| 25 | 25 | ||
| 26 | #ifdef CONFIG_PCIEASPM | 26 | #ifdef CONFIG_PCIEASPM |
| 27 | void pci_disable_link_state(struct pci_dev *pdev, int state); | 27 | int pci_disable_link_state(struct pci_dev *pdev, int state); |
| 28 | void pci_disable_link_state_locked(struct pci_dev *pdev, int state); | 28 | int pci_disable_link_state_locked(struct pci_dev *pdev, int state); |
| 29 | void pcie_no_aspm(void); | 29 | void pcie_no_aspm(void); |
| 30 | #else | 30 | #else |
| 31 | static inline void pci_disable_link_state(struct pci_dev *pdev, int state) { } | 31 | static inline int pci_disable_link_state(struct pci_dev *pdev, int state) |
| 32 | { return 0; } | ||
| 32 | static inline void pcie_no_aspm(void) { } | 33 | static inline void pcie_no_aspm(void) { } |
| 33 | #endif | 34 | #endif |
| 34 | 35 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index dd436da7eccc..2972793e3028 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -151,6 +151,8 @@ static inline const char *pci_power_name(pci_power_t state) | |||
| 151 | #define PCI_PM_BUS_WAIT 50 | 151 | #define PCI_PM_BUS_WAIT 50 |
| 152 | 152 | ||
| 153 | /** | 153 | /** |
| 154 | * typedef pci_channel_state_t | ||
| 155 | * | ||
| 154 | * The pci_channel state describes connectivity between the CPU and | 156 | * The pci_channel state describes connectivity between the CPU and |
| 155 | * the PCI device. If some PCI bus between here and the PCI device | 157 | * the PCI device. If some PCI bus between here and the PCI device |
| 156 | * has crashed or locked up, this info is reflected here. | 158 | * has crashed or locked up, this info is reflected here. |
| @@ -258,6 +260,7 @@ enum pci_bus_speed { | |||
| 258 | PCIE_SPEED_5_0GT = 0x15, | 260 | PCIE_SPEED_5_0GT = 0x15, |
| 259 | PCIE_SPEED_8_0GT = 0x16, | 261 | PCIE_SPEED_8_0GT = 0x16, |
| 260 | PCIE_SPEED_16_0GT = 0x17, | 262 | PCIE_SPEED_16_0GT = 0x17, |
| 263 | PCIE_SPEED_32_0GT = 0x18, | ||
| 261 | PCI_SPEED_UNKNOWN = 0xff, | 264 | PCI_SPEED_UNKNOWN = 0xff, |
| 262 | }; | 265 | }; |
| 263 | 266 | ||
| @@ -383,7 +386,7 @@ struct pci_dev { | |||
| 383 | 386 | ||
| 384 | unsigned int is_busmaster:1; /* Is busmaster */ | 387 | unsigned int is_busmaster:1; /* Is busmaster */ |
| 385 | unsigned int no_msi:1; /* May not use MSI */ | 388 | unsigned int no_msi:1; /* May not use MSI */ |
| 386 | unsigned int no_64bit_msi:1; /* May only use 32-bit MSIs */ | 389 | unsigned int no_64bit_msi:1; /* May only use 32-bit MSIs */ |
| 387 | unsigned int block_cfg_access:1; /* Config space access blocked */ | 390 | unsigned int block_cfg_access:1; /* Config space access blocked */ |
| 388 | unsigned int broken_parity_status:1; /* Generates false positive parity */ | 391 | unsigned int broken_parity_status:1; /* Generates false positive parity */ |
| 389 | unsigned int irq_reroute_variant:2; /* Needs IRQ rerouting variant */ | 392 | unsigned int irq_reroute_variant:2; /* Needs IRQ rerouting variant */ |
| @@ -506,6 +509,8 @@ struct pci_host_bridge { | |||
| 506 | unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */ | 509 | unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */ |
| 507 | unsigned int native_pme:1; /* OS may use PCIe PME */ | 510 | unsigned int native_pme:1; /* OS may use PCIe PME */ |
| 508 | unsigned int native_ltr:1; /* OS may use PCIe LTR */ | 511 | unsigned int native_ltr:1; /* OS may use PCIe LTR */ |
| 512 | unsigned int preserve_config:1; /* Preserve FW resource setup */ | ||
| 513 | |||
| 509 | /* Resource alignment requirements */ | 514 | /* Resource alignment requirements */ |
| 510 | resource_size_t (*align_resource)(struct pci_dev *dev, | 515 | resource_size_t (*align_resource)(struct pci_dev *dev, |
| 511 | const struct resource *res, | 516 | const struct resource *res, |
| @@ -776,6 +781,50 @@ struct pci_error_handlers { | |||
| 776 | 781 | ||
| 777 | 782 | ||
| 778 | struct module; | 783 | struct module; |
| 784 | |||
| 785 | /** | ||
| 786 | * struct pci_driver - PCI driver structure | ||
| 787 | * @node: List of driver structures. | ||
| 788 | * @name: Driver name. | ||
| 789 | * @id_table: Pointer to table of device IDs the driver is | ||
| 790 | * interested in. Most drivers should export this | ||
| 791 | * table using MODULE_DEVICE_TABLE(pci,...). | ||
| 792 | * @probe: This probing function gets called (during execution | ||
| 793 | * of pci_register_driver() for already existing | ||
| 794 | * devices or later if a new device gets inserted) for | ||
| 795 | * all PCI devices which match the ID table and are not | ||
| 796 | * "owned" by the other drivers yet. This function gets | ||
| 797 | * passed a "struct pci_dev \*" for each device whose | ||
| 798 | * entry in the ID table matches the device. The probe | ||
| 799 | * function returns zero when the driver chooses to | ||
| 800 | * take "ownership" of the device or an error code | ||
| 801 | * (negative number) otherwise. | ||
| 802 | * The probe function always gets called from process | ||
| 803 | * context, so it can sleep. | ||
| 804 | * @remove: The remove() function gets called whenever a device | ||
| 805 | * being handled by this driver is removed (either during | ||
| 806 | * deregistration of the driver or when it's manually | ||
| 807 | * pulled out of a hot-pluggable slot). | ||
| 808 | * The remove function always gets called from process | ||
| 809 | * context, so it can sleep. | ||
| 810 | * @suspend: Put device into low power state. | ||
| 811 | * @suspend_late: Put device into low power state. | ||
| 812 | * @resume_early: Wake device from low power state. | ||
| 813 | * @resume: Wake device from low power state. | ||
| 814 | * (Please see Documentation/power/pci.rst for descriptions | ||
| 815 | * of PCI Power Management and the related functions.) | ||
| 816 | * @shutdown: Hook into reboot_notifier_list (kernel/sys.c). | ||
| 817 | * Intended to stop any idling DMA operations. | ||
| 818 | * Useful for enabling wake-on-lan (NIC) or changing | ||
| 819 | * the power state of a device before reboot. | ||
| 820 | * e.g. drivers/net/e100.c. | ||
| 821 | * @sriov_configure: Optional driver callback to allow configuration of | ||
| 822 | * number of VFs to enable via sysfs "sriov_numvfs" file. | ||
| 823 | * @err_handler: See Documentation/PCI/pci-error-recovery.rst | ||
| 824 | * @groups: Sysfs attribute groups. | ||
| 825 | * @driver: Driver model structure. | ||
| 826 | * @dynids: List of dynamically added device IDs. | ||
| 827 | */ | ||
| 779 | struct pci_driver { | 828 | struct pci_driver { |
| 780 | struct list_head node; | 829 | struct list_head node; |
| 781 | const char *name; | 830 | const char *name; |
| @@ -2207,7 +2256,7 @@ static inline u8 pci_vpd_srdt_tag(const u8 *srdt) | |||
| 2207 | 2256 | ||
| 2208 | /** | 2257 | /** |
| 2209 | * pci_vpd_info_field_size - Extracts the information field length | 2258 | * pci_vpd_info_field_size - Extracts the information field length |
| 2210 | * @lrdt: Pointer to the beginning of an information field header | 2259 | * @info_field: Pointer to the beginning of an information field header |
| 2211 | * | 2260 | * |
| 2212 | * Returns the extracted information field length. | 2261 | * Returns the extracted information field length. |
| 2213 | */ | 2262 | */ |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 70e86148cb1e..40015609c4b5 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -1112,7 +1112,7 @@ | |||
| 1112 | 1112 | ||
| 1113 | #define PCI_VENDOR_ID_AL 0x10b9 | 1113 | #define PCI_VENDOR_ID_AL 0x10b9 |
| 1114 | #define PCI_DEVICE_ID_AL_M1533 0x1533 | 1114 | #define PCI_DEVICE_ID_AL_M1533 0x1533 |
| 1115 | #define PCI_DEVICE_ID_AL_M1535 0x1535 | 1115 | #define PCI_DEVICE_ID_AL_M1535 0x1535 |
| 1116 | #define PCI_DEVICE_ID_AL_M1541 0x1541 | 1116 | #define PCI_DEVICE_ID_AL_M1541 0x1541 |
| 1117 | #define PCI_DEVICE_ID_AL_M1563 0x1563 | 1117 | #define PCI_DEVICE_ID_AL_M1563 0x1563 |
| 1118 | #define PCI_DEVICE_ID_AL_M1621 0x1621 | 1118 | #define PCI_DEVICE_ID_AL_M1621 0x1621 |
| @@ -1336,6 +1336,7 @@ | |||
| 1336 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752 | 1336 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752 |
| 1337 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 | 1337 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 |
| 1338 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 | 1338 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 |
| 1339 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE_320M 0x08A0 | ||
| 1339 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2 | 1340 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2 |
| 1340 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA 0x0D85 | 1341 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA 0x0D85 |
| 1341 | 1342 | ||
| @@ -1752,7 +1753,7 @@ | |||
| 1752 | #define PCI_VENDOR_ID_STALLION 0x124d | 1753 | #define PCI_VENDOR_ID_STALLION 0x124d |
| 1753 | 1754 | ||
| 1754 | /* Allied Telesyn */ | 1755 | /* Allied Telesyn */ |
| 1755 | #define PCI_VENDOR_ID_AT 0x1259 | 1756 | #define PCI_VENDOR_ID_AT 0x1259 |
| 1756 | #define PCI_SUBDEVICE_ID_AT_2700FX 0x2701 | 1757 | #define PCI_SUBDEVICE_ID_AT_2700FX 0x2701 |
| 1757 | #define PCI_SUBDEVICE_ID_AT_2701FX 0x2703 | 1758 | #define PCI_SUBDEVICE_ID_AT_2701FX 0x2703 |
| 1758 | 1759 | ||
| @@ -2550,7 +2551,7 @@ | |||
| 2550 | #define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700 | 2551 | #define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700 |
| 2551 | #define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff | 2552 | #define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff |
| 2552 | 2553 | ||
| 2553 | #define PCI_VENDOR_ID_HUAWEI 0x19e5 | 2554 | #define PCI_VENDOR_ID_HUAWEI 0x19e5 |
| 2554 | 2555 | ||
| 2555 | #define PCI_VENDOR_ID_NETRONOME 0x19ee | 2556 | #define PCI_VENDOR_ID_NETRONOME 0x19ee |
| 2556 | #define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000 | 2557 | #define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000 |
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h index b297cd1cd4f1..7aef0abc194a 100644 --- a/include/linux/percpu-refcount.h +++ b/include/linux/percpu-refcount.h | |||
| @@ -75,14 +75,21 @@ enum { | |||
| 75 | * operation using percpu_ref_switch_to_percpu(). If initialized | 75 | * operation using percpu_ref_switch_to_percpu(). If initialized |
| 76 | * with this flag, the ref will stay in atomic mode until | 76 | * with this flag, the ref will stay in atomic mode until |
| 77 | * percpu_ref_switch_to_percpu() is invoked on it. | 77 | * percpu_ref_switch_to_percpu() is invoked on it. |
| 78 | * Implies ALLOW_REINIT. | ||
| 78 | */ | 79 | */ |
| 79 | PERCPU_REF_INIT_ATOMIC = 1 << 0, | 80 | PERCPU_REF_INIT_ATOMIC = 1 << 0, |
| 80 | 81 | ||
| 81 | /* | 82 | /* |
| 82 | * Start dead w/ ref == 0 in atomic mode. Must be revived with | 83 | * Start dead w/ ref == 0 in atomic mode. Must be revived with |
| 83 | * percpu_ref_reinit() before used. Implies INIT_ATOMIC. | 84 | * percpu_ref_reinit() before used. Implies INIT_ATOMIC and |
| 85 | * ALLOW_REINIT. | ||
| 84 | */ | 86 | */ |
| 85 | PERCPU_REF_INIT_DEAD = 1 << 1, | 87 | PERCPU_REF_INIT_DEAD = 1 << 1, |
| 88 | |||
| 89 | /* | ||
| 90 | * Allow switching from atomic mode to percpu mode. | ||
| 91 | */ | ||
| 92 | PERCPU_REF_ALLOW_REINIT = 1 << 2, | ||
| 86 | }; | 93 | }; |
| 87 | 94 | ||
| 88 | struct percpu_ref { | 95 | struct percpu_ref { |
| @@ -95,6 +102,7 @@ struct percpu_ref { | |||
| 95 | percpu_ref_func_t *release; | 102 | percpu_ref_func_t *release; |
| 96 | percpu_ref_func_t *confirm_switch; | 103 | percpu_ref_func_t *confirm_switch; |
| 97 | bool force_atomic:1; | 104 | bool force_atomic:1; |
| 105 | bool allow_reinit:1; | ||
| 98 | struct rcu_head rcu; | 106 | struct rcu_head rcu; |
| 99 | }; | 107 | }; |
| 100 | 108 | ||
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h index 03cb4b6f842e..3998cdf9cd14 100644 --- a/include/linux/percpu-rwsem.h +++ b/include/linux/percpu-rwsem.h | |||
| @@ -17,14 +17,18 @@ struct percpu_rw_semaphore { | |||
| 17 | int readers_block; | 17 | int readers_block; |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | #define DEFINE_STATIC_PERCPU_RWSEM(name) \ | 20 | #define __DEFINE_PERCPU_RWSEM(name, is_static) \ |
| 21 | static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_rc_##name); \ | 21 | static DEFINE_PER_CPU(unsigned int, __percpu_rwsem_rc_##name); \ |
| 22 | static struct percpu_rw_semaphore name = { \ | 22 | is_static struct percpu_rw_semaphore name = { \ |
| 23 | .rss = __RCU_SYNC_INITIALIZER(name.rss, RCU_SCHED_SYNC), \ | 23 | .rss = __RCU_SYNC_INITIALIZER(name.rss), \ |
| 24 | .read_count = &__percpu_rwsem_rc_##name, \ | 24 | .read_count = &__percpu_rwsem_rc_##name, \ |
| 25 | .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \ | 25 | .rw_sem = __RWSEM_INITIALIZER(name.rw_sem), \ |
| 26 | .writer = __RCUWAIT_INITIALIZER(name.writer), \ | 26 | .writer = __RCUWAIT_INITIALIZER(name.writer), \ |
| 27 | } | 27 | } |
| 28 | #define DEFINE_PERCPU_RWSEM(name) \ | ||
| 29 | __DEFINE_PERCPU_RWSEM(name, /* not static */) | ||
| 30 | #define DEFINE_STATIC_PERCPU_RWSEM(name) \ | ||
| 31 | __DEFINE_PERCPU_RWSEM(name, static) | ||
| 28 | 32 | ||
| 29 | extern int __percpu_down_read(struct percpu_rw_semaphore *, int); | 33 | extern int __percpu_down_read(struct percpu_rw_semaphore *, int); |
| 30 | extern void __percpu_up_read(struct percpu_rw_semaphore *); | 34 | extern void __percpu_up_read(struct percpu_rw_semaphore *); |
| @@ -117,7 +121,7 @@ static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem, | |||
| 117 | lock_release(&sem->rw_sem.dep_map, 1, ip); | 121 | lock_release(&sem->rw_sem.dep_map, 1, ip); |
| 118 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER | 122 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 119 | if (!read) | 123 | if (!read) |
| 120 | sem->rw_sem.owner = RWSEM_OWNER_UNKNOWN; | 124 | atomic_long_set(&sem->rw_sem.owner, RWSEM_OWNER_UNKNOWN); |
| 121 | #endif | 125 | #endif |
| 122 | } | 126 | } |
| 123 | 127 | ||
| @@ -127,7 +131,7 @@ static inline void percpu_rwsem_acquire(struct percpu_rw_semaphore *sem, | |||
| 127 | lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip); | 131 | lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip); |
| 128 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER | 132 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 129 | if (!read) | 133 | if (!read) |
| 130 | sem->rw_sem.owner = current; | 134 | atomic_long_set(&sem->rw_sem.owner, (long)current); |
| 131 | #endif | 135 | #endif |
| 132 | } | 136 | } |
| 133 | 137 | ||
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index a9b0ee408fbd..71f525a35ac2 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h | |||
| @@ -171,4 +171,6 @@ void armpmu_free_irq(int irq, int cpu); | |||
| 171 | 171 | ||
| 172 | #endif /* CONFIG_ARM_PMU */ | 172 | #endif /* CONFIG_ARM_PMU */ |
| 173 | 173 | ||
| 174 | #define ARMV8_SPE_PDEV_NAME "arm,spe-v1" | ||
| 175 | |||
| 174 | #endif /* __ARM_PMU_H__ */ | 176 | #endif /* __ARM_PMU_H__ */ |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 2bca72f3028b..e8ad3c590a23 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -256,6 +256,7 @@ struct pmu { | |||
| 256 | struct module *module; | 256 | struct module *module; |
| 257 | struct device *dev; | 257 | struct device *dev; |
| 258 | const struct attribute_group **attr_groups; | 258 | const struct attribute_group **attr_groups; |
| 259 | const struct attribute_group **attr_update; | ||
| 259 | const char *name; | 260 | const char *name; |
| 260 | int type; | 261 | int type; |
| 261 | 262 | ||
| @@ -749,6 +750,11 @@ struct perf_event_context { | |||
| 749 | int nr_stat; | 750 | int nr_stat; |
| 750 | int nr_freq; | 751 | int nr_freq; |
| 751 | int rotate_disable; | 752 | int rotate_disable; |
| 753 | /* | ||
| 754 | * Set when nr_events != nr_active, except tolerant to events not | ||
| 755 | * necessary to be active due to scheduling constraints, such as cgroups. | ||
| 756 | */ | ||
| 757 | int rotate_necessary; | ||
| 752 | refcount_t refcount; | 758 | refcount_t refcount; |
| 753 | struct task_struct *task; | 759 | struct task_struct *task; |
| 754 | 760 | ||
| @@ -1049,6 +1055,11 @@ static inline int in_software_context(struct perf_event *event) | |||
| 1049 | return event->ctx->pmu->task_ctx_nr == perf_sw_context; | 1055 | return event->ctx->pmu->task_ctx_nr == perf_sw_context; |
| 1050 | } | 1056 | } |
| 1051 | 1057 | ||
| 1058 | static inline int is_exclusive_pmu(struct pmu *pmu) | ||
| 1059 | { | ||
| 1060 | return pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE; | ||
| 1061 | } | ||
| 1062 | |||
| 1052 | extern struct static_key perf_swevent_enabled[PERF_COUNT_SW_MAX]; | 1063 | extern struct static_key perf_swevent_enabled[PERF_COUNT_SW_MAX]; |
| 1053 | 1064 | ||
| 1054 | extern void ___perf_sw_event(u32, u64, struct pt_regs *, u64); | 1065 | extern void ___perf_sw_event(u32, u64, struct pt_regs *, u64); |
diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h index 3c202a11a79e..01e8037023f7 100644 --- a/include/linux/pfn_t.h +++ b/include/linux/pfn_t.h | |||
| @@ -66,13 +66,6 @@ static inline phys_addr_t pfn_t_to_phys(pfn_t pfn) | |||
| 66 | return PFN_PHYS(pfn_t_to_pfn(pfn)); | 66 | return PFN_PHYS(pfn_t_to_pfn(pfn)); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | static inline void *pfn_t_to_virt(pfn_t pfn) | ||
| 70 | { | ||
| 71 | if (pfn_t_has_page(pfn) && !is_device_private_page(pfn_t_to_page(pfn))) | ||
| 72 | return __va(pfn_t_to_phys(pfn)); | ||
| 73 | return NULL; | ||
| 74 | } | ||
| 75 | |||
| 76 | static inline pfn_t page_to_pfn_t(struct page *page) | 69 | static inline pfn_t page_to_pfn_t(struct page *page) |
| 77 | { | 70 | { |
| 78 | return pfn_to_pfn_t(page_to_pfn(page)); | 71 | return pfn_to_pfn_t(page_to_pfn(page)); |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 6424586fe2d6..462b90b73f93 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -55,6 +55,9 @@ extern __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_ini | |||
| 55 | #define PHY_10GBIT_FEC_FEATURES ((unsigned long *)&phy_10gbit_fec_features) | 55 | #define PHY_10GBIT_FEC_FEATURES ((unsigned long *)&phy_10gbit_fec_features) |
| 56 | #define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features) | 56 | #define PHY_10GBIT_FULL_FEATURES ((unsigned long *)&phy_10gbit_full_features) |
| 57 | 57 | ||
| 58 | extern const int phy_basic_ports_array[3]; | ||
| 59 | extern const int phy_fibre_port_array[1]; | ||
| 60 | extern const int phy_all_ports_features_array[7]; | ||
| 58 | extern const int phy_10_100_features_array[4]; | 61 | extern const int phy_10_100_features_array[4]; |
| 59 | extern const int phy_basic_t1_features_array[2]; | 62 | extern const int phy_basic_t1_features_array[2]; |
| 60 | extern const int phy_gbit_features_array[2]; | 63 | extern const int phy_gbit_features_array[2]; |
| @@ -98,6 +101,7 @@ typedef enum { | |||
| 98 | PHY_INTERFACE_MODE_XAUI, | 101 | PHY_INTERFACE_MODE_XAUI, |
| 99 | /* 10GBASE-KR, XFI, SFI - single lane 10G Serdes */ | 102 | /* 10GBASE-KR, XFI, SFI - single lane 10G Serdes */ |
| 100 | PHY_INTERFACE_MODE_10GKR, | 103 | PHY_INTERFACE_MODE_10GKR, |
| 104 | PHY_INTERFACE_MODE_USXGMII, | ||
| 101 | PHY_INTERFACE_MODE_MAX, | 105 | PHY_INTERFACE_MODE_MAX, |
| 102 | } phy_interface_t; | 106 | } phy_interface_t; |
| 103 | 107 | ||
| @@ -173,6 +177,8 @@ static inline const char *phy_modes(phy_interface_t interface) | |||
| 173 | return "xaui"; | 177 | return "xaui"; |
| 174 | case PHY_INTERFACE_MODE_10GKR: | 178 | case PHY_INTERFACE_MODE_10GKR: |
| 175 | return "10gbase-kr"; | 179 | return "10gbase-kr"; |
| 180 | case PHY_INTERFACE_MODE_USXGMII: | ||
| 181 | return "usxgmii"; | ||
| 176 | default: | 182 | default: |
| 177 | return "unknown"; | 183 | return "unknown"; |
| 178 | } | 184 | } |
| @@ -180,7 +186,6 @@ static inline const char *phy_modes(phy_interface_t interface) | |||
| 180 | 186 | ||
| 181 | 187 | ||
| 182 | #define PHY_INIT_TIMEOUT 100000 | 188 | #define PHY_INIT_TIMEOUT 100000 |
| 183 | #define PHY_STATE_TIME 1 | ||
| 184 | #define PHY_FORCE_TIMEOUT 10 | 189 | #define PHY_FORCE_TIMEOUT 10 |
| 185 | 190 | ||
| 186 | #define PHY_MAX_ADDR 32 | 191 | #define PHY_MAX_ADDR 32 |
| @@ -193,6 +198,8 @@ static inline const char *phy_modes(phy_interface_t interface) | |||
| 193 | /* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit | 198 | /* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit |
| 194 | IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ | 199 | IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ |
| 195 | #define MII_ADDR_C45 (1<<30) | 200 | #define MII_ADDR_C45 (1<<30) |
| 201 | #define MII_DEVADDR_C45_SHIFT 16 | ||
| 202 | #define MII_REGADDR_C45_MASK GENMASK(15, 0) | ||
| 196 | 203 | ||
| 197 | struct device; | 204 | struct device; |
| 198 | struct phylink; | 205 | struct phylink; |
| @@ -290,12 +297,6 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); | |||
| 290 | * - irq or timer will set RUNNING if link comes back | 297 | * - irq or timer will set RUNNING if link comes back |
| 291 | * - phy_stop moves to HALTED | 298 | * - phy_stop moves to HALTED |
| 292 | * | 299 | * |
| 293 | * FORCING: PHY is being configured with forced settings | ||
| 294 | * - if link is up, move to RUNNING | ||
| 295 | * - If link is down, we drop to the next highest setting, and | ||
| 296 | * retry (FORCING) after a timeout | ||
| 297 | * - phy_stop moves to HALTED | ||
| 298 | * | ||
| 299 | * RUNNING: PHY is currently up, running, and possibly sending | 300 | * RUNNING: PHY is currently up, running, and possibly sending |
| 300 | * and/or receiving packets | 301 | * and/or receiving packets |
| 301 | * - irq or timer will set NOLINK if link goes down | 302 | * - irq or timer will set NOLINK if link goes down |
| @@ -312,7 +313,6 @@ enum phy_state { | |||
| 312 | PHY_UP, | 313 | PHY_UP, |
| 313 | PHY_RUNNING, | 314 | PHY_RUNNING, |
| 314 | PHY_NOLINK, | 315 | PHY_NOLINK, |
| 315 | PHY_FORCING, | ||
| 316 | }; | 316 | }; |
| 317 | 317 | ||
| 318 | /** | 318 | /** |
| @@ -340,8 +340,6 @@ struct phy_c45_device_ids { | |||
| 340 | * loopback_enabled: Set true if this phy has been loopbacked successfully. | 340 | * loopback_enabled: Set true if this phy has been loopbacked successfully. |
| 341 | * state: state of the PHY for management purposes | 341 | * state: state of the PHY for management purposes |
| 342 | * dev_flags: Device-specific flags used by the PHY driver. | 342 | * dev_flags: Device-specific flags used by the PHY driver. |
| 343 | * link_timeout: The number of timer firings to wait before the | ||
| 344 | * giving up on the current attempt at acquiring a link | ||
| 345 | * irq: IRQ number of the PHY's interrupt (-1 if none) | 343 | * irq: IRQ number of the PHY's interrupt (-1 if none) |
| 346 | * phy_timer: The timer for handling the state machine | 344 | * phy_timer: The timer for handling the state machine |
| 347 | * attached_dev: The attached enet driver's device instance ptr | 345 | * attached_dev: The attached enet driver's device instance ptr |
| @@ -409,8 +407,6 @@ struct phy_device { | |||
| 409 | /* Energy efficient ethernet modes which should be prohibited */ | 407 | /* Energy efficient ethernet modes which should be prohibited */ |
| 410 | u32 eee_broken_modes; | 408 | u32 eee_broken_modes; |
| 411 | 409 | ||
| 412 | int link_timeout; | ||
| 413 | |||
| 414 | #ifdef CONFIG_LED_TRIGGER_PHY | 410 | #ifdef CONFIG_LED_TRIGGER_PHY |
| 415 | struct phy_led_trigger *phy_led_triggers; | 411 | struct phy_led_trigger *phy_led_triggers; |
| 416 | unsigned int phy_num_led_triggers; | 412 | unsigned int phy_num_led_triggers; |
| @@ -529,6 +525,9 @@ struct phy_driver { | |||
| 529 | */ | 525 | */ |
| 530 | int (*did_interrupt)(struct phy_device *phydev); | 526 | int (*did_interrupt)(struct phy_device *phydev); |
| 531 | 527 | ||
| 528 | /* Override default interrupt handling */ | ||
| 529 | int (*handle_interrupt)(struct phy_device *phydev); | ||
| 530 | |||
| 532 | /* Clears up any memory if needed */ | 531 | /* Clears up any memory if needed */ |
| 533 | void (*remove)(struct phy_device *phydev); | 532 | void (*remove)(struct phy_device *phydev); |
| 534 | 533 | ||
| @@ -1129,6 +1128,7 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner); | |||
| 1129 | int phy_drivers_register(struct phy_driver *new_driver, int n, | 1128 | int phy_drivers_register(struct phy_driver *new_driver, int n, |
| 1130 | struct module *owner); | 1129 | struct module *owner); |
| 1131 | void phy_state_machine(struct work_struct *work); | 1130 | void phy_state_machine(struct work_struct *work); |
| 1131 | void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies); | ||
| 1132 | void phy_mac_interrupt(struct phy_device *phydev); | 1132 | void phy_mac_interrupt(struct phy_device *phydev); |
| 1133 | void phy_start_machine(struct phy_device *phydev); | 1133 | void phy_start_machine(struct phy_device *phydev); |
| 1134 | void phy_stop_machine(struct phy_device *phydev); | 1134 | void phy_stop_machine(struct phy_device *phydev); |
| @@ -1139,6 +1139,7 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev, | |||
| 1139 | const struct ethtool_link_ksettings *cmd); | 1139 | const struct ethtool_link_ksettings *cmd); |
| 1140 | int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); | 1140 | int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); |
| 1141 | void phy_request_interrupt(struct phy_device *phydev); | 1141 | void phy_request_interrupt(struct phy_device *phydev); |
| 1142 | void phy_free_interrupt(struct phy_device *phydev); | ||
| 1142 | void phy_print_status(struct phy_device *phydev); | 1143 | void phy_print_status(struct phy_device *phydev); |
| 1143 | int phy_set_max_speed(struct phy_device *phydev, u32 max_speed); | 1144 | int phy_set_max_speed(struct phy_device *phydev, u32 max_speed); |
| 1144 | void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode); | 1145 | void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode); |
diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 2d2e55dfea94..300ecdb6790a 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h | |||
| @@ -54,6 +54,21 @@ struct phylink_link_state { | |||
| 54 | unsigned int an_complete:1; | 54 | unsigned int an_complete:1; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | enum phylink_op_type { | ||
| 58 | PHYLINK_NETDEV = 0, | ||
| 59 | PHYLINK_DEV, | ||
| 60 | }; | ||
| 61 | |||
| 62 | /** | ||
| 63 | * struct phylink_config - PHYLINK configuration structure | ||
| 64 | * @dev: a pointer to a struct device associated with the MAC | ||
| 65 | * @type: operation type of PHYLINK instance | ||
| 66 | */ | ||
| 67 | struct phylink_config { | ||
| 68 | struct device *dev; | ||
| 69 | enum phylink_op_type type; | ||
| 70 | }; | ||
| 71 | |||
| 57 | /** | 72 | /** |
| 58 | * struct phylink_mac_ops - MAC operations structure. | 73 | * struct phylink_mac_ops - MAC operations structure. |
| 59 | * @validate: Validate and update the link configuration. | 74 | * @validate: Validate and update the link configuration. |
| @@ -66,16 +81,17 @@ struct phylink_link_state { | |||
| 66 | * The individual methods are described more fully below. | 81 | * The individual methods are described more fully below. |
| 67 | */ | 82 | */ |
| 68 | struct phylink_mac_ops { | 83 | struct phylink_mac_ops { |
| 69 | void (*validate)(struct net_device *ndev, unsigned long *supported, | 84 | void (*validate)(struct phylink_config *config, |
| 85 | unsigned long *supported, | ||
| 70 | struct phylink_link_state *state); | 86 | struct phylink_link_state *state); |
| 71 | int (*mac_link_state)(struct net_device *ndev, | 87 | int (*mac_link_state)(struct phylink_config *config, |
| 72 | struct phylink_link_state *state); | 88 | struct phylink_link_state *state); |
| 73 | void (*mac_config)(struct net_device *ndev, unsigned int mode, | 89 | void (*mac_config)(struct phylink_config *config, unsigned int mode, |
| 74 | const struct phylink_link_state *state); | 90 | const struct phylink_link_state *state); |
| 75 | void (*mac_an_restart)(struct net_device *ndev); | 91 | void (*mac_an_restart)(struct phylink_config *config); |
| 76 | void (*mac_link_down)(struct net_device *ndev, unsigned int mode, | 92 | void (*mac_link_down)(struct phylink_config *config, unsigned int mode, |
| 77 | phy_interface_t interface); | 93 | phy_interface_t interface); |
| 78 | void (*mac_link_up)(struct net_device *ndev, unsigned int mode, | 94 | void (*mac_link_up)(struct phylink_config *config, unsigned int mode, |
| 79 | phy_interface_t interface, | 95 | phy_interface_t interface, |
| 80 | struct phy_device *phy); | 96 | struct phy_device *phy); |
| 81 | }; | 97 | }; |
| @@ -83,7 +99,7 @@ struct phylink_mac_ops { | |||
| 83 | #if 0 /* For kernel-doc purposes only. */ | 99 | #if 0 /* For kernel-doc purposes only. */ |
| 84 | /** | 100 | /** |
| 85 | * validate - Validate and update the link configuration | 101 | * validate - Validate and update the link configuration |
| 86 | * @ndev: a pointer to a &struct net_device for the MAC. | 102 | * @config: a pointer to a &struct phylink_config. |
| 87 | * @supported: ethtool bitmask for supported link modes. | 103 | * @supported: ethtool bitmask for supported link modes. |
| 88 | * @state: a pointer to a &struct phylink_link_state. | 104 | * @state: a pointer to a &struct phylink_link_state. |
| 89 | * | 105 | * |
| @@ -93,19 +109,26 @@ struct phylink_mac_ops { | |||
| 93 | * Note that the PHY may be able to transform from one connection | 109 | * Note that the PHY may be able to transform from one connection |
| 94 | * technology to another, so, eg, don't clear 1000BaseX just | 110 | * technology to another, so, eg, don't clear 1000BaseX just |
| 95 | * because the MAC is unable to BaseX mode. This is more about | 111 | * because the MAC is unable to BaseX mode. This is more about |
| 96 | * clearing unsupported speeds and duplex settings. | 112 | * clearing unsupported speeds and duplex settings. The port modes |
| 113 | * should not be cleared; phylink_set_port_modes() will help with this. | ||
| 97 | * | 114 | * |
| 98 | * If the @state->interface mode is %PHY_INTERFACE_MODE_1000BASEX | 115 | * If the @state->interface mode is %PHY_INTERFACE_MODE_1000BASEX |
| 99 | * or %PHY_INTERFACE_MODE_2500BASEX, select the appropriate mode | 116 | * or %PHY_INTERFACE_MODE_2500BASEX, select the appropriate mode |
| 100 | * based on @state->advertising and/or @state->speed and update | 117 | * based on @state->advertising and/or @state->speed and update |
| 101 | * @state->interface accordingly. | 118 | * @state->interface accordingly. See phylink_helper_basex_speed(). |
| 119 | * | ||
| 120 | * When @state->interface is %PHY_INTERFACE_MODE_NA, phylink expects the | ||
| 121 | * MAC driver to return all supported link modes. | ||
| 122 | * | ||
| 123 | * If the @state->interface mode is not supported, then the @supported | ||
| 124 | * mask must be cleared. | ||
| 102 | */ | 125 | */ |
| 103 | void validate(struct net_device *ndev, unsigned long *supported, | 126 | void validate(struct phylink_config *config, unsigned long *supported, |
| 104 | struct phylink_link_state *state); | 127 | struct phylink_link_state *state); |
| 105 | 128 | ||
| 106 | /** | 129 | /** |
| 107 | * mac_link_state() - Read the current link state from the hardware | 130 | * mac_link_state() - Read the current link state from the hardware |
| 108 | * @ndev: a pointer to a &struct net_device for the MAC. | 131 | * @config: a pointer to a &struct phylink_config. |
| 109 | * @state: a pointer to a &struct phylink_link_state. | 132 | * @state: a pointer to a &struct phylink_link_state. |
| 110 | * | 133 | * |
| 111 | * Read the current link state from the MAC, reporting the current | 134 | * Read the current link state from the MAC, reporting the current |
| @@ -114,12 +137,12 @@ void validate(struct net_device *ndev, unsigned long *supported, | |||
| 114 | * negotiation completion state in @state->an_complete, and link | 137 | * negotiation completion state in @state->an_complete, and link |
| 115 | * up state in @state->link. | 138 | * up state in @state->link. |
| 116 | */ | 139 | */ |
| 117 | int mac_link_state(struct net_device *ndev, | 140 | int mac_link_state(struct phylink_config *config, |
| 118 | struct phylink_link_state *state); | 141 | struct phylink_link_state *state); |
| 119 | 142 | ||
| 120 | /** | 143 | /** |
| 121 | * mac_config() - configure the MAC for the selected mode and state | 144 | * mac_config() - configure the MAC for the selected mode and state |
| 122 | * @ndev: a pointer to a &struct net_device for the MAC. | 145 | * @config: a pointer to a &struct phylink_config. |
| 123 | * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. | 146 | * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. |
| 124 | * @state: a pointer to a &struct phylink_link_state. | 147 | * @state: a pointer to a &struct phylink_link_state. |
| 125 | * | 148 | * |
| @@ -168,18 +191,18 @@ int mac_link_state(struct net_device *ndev, | |||
| 168 | * down. This "update" behaviour is critical to avoid bouncing the | 191 | * down. This "update" behaviour is critical to avoid bouncing the |
| 169 | * link up status. | 192 | * link up status. |
| 170 | */ | 193 | */ |
| 171 | void mac_config(struct net_device *ndev, unsigned int mode, | 194 | void mac_config(struct phylink_config *config, unsigned int mode, |
| 172 | const struct phylink_link_state *state); | 195 | const struct phylink_link_state *state); |
| 173 | 196 | ||
| 174 | /** | 197 | /** |
| 175 | * mac_an_restart() - restart 802.3z BaseX autonegotiation | 198 | * mac_an_restart() - restart 802.3z BaseX autonegotiation |
| 176 | * @ndev: a pointer to a &struct net_device for the MAC. | 199 | * @config: a pointer to a &struct phylink_config. |
| 177 | */ | 200 | */ |
| 178 | void mac_an_restart(struct net_device *ndev); | 201 | void mac_an_restart(struct phylink_config *config); |
| 179 | 202 | ||
| 180 | /** | 203 | /** |
| 181 | * mac_link_down() - take the link down | 204 | * mac_link_down() - take the link down |
| 182 | * @ndev: a pointer to a &struct net_device for the MAC. | 205 | * @config: a pointer to a &struct phylink_config. |
| 183 | * @mode: link autonegotiation mode | 206 | * @mode: link autonegotiation mode |
| 184 | * @interface: link &typedef phy_interface_t mode | 207 | * @interface: link &typedef phy_interface_t mode |
| 185 | * | 208 | * |
| @@ -188,12 +211,12 @@ void mac_an_restart(struct net_device *ndev); | |||
| 188 | * Energy Efficient Ethernet MAC configuration. Interface type | 211 | * Energy Efficient Ethernet MAC configuration. Interface type |
| 189 | * selection must be done in mac_config(). | 212 | * selection must be done in mac_config(). |
| 190 | */ | 213 | */ |
| 191 | void mac_link_down(struct net_device *ndev, unsigned int mode, | 214 | void mac_link_down(struct phylink_config *config, unsigned int mode, |
| 192 | phy_interface_t interface); | 215 | phy_interface_t interface); |
| 193 | 216 | ||
| 194 | /** | 217 | /** |
| 195 | * mac_link_up() - allow the link to come up | 218 | * mac_link_up() - allow the link to come up |
| 196 | * @ndev: a pointer to a &struct net_device for the MAC. | 219 | * @config: a pointer to a &struct phylink_config. |
| 197 | * @mode: link autonegotiation mode | 220 | * @mode: link autonegotiation mode |
| 198 | * @interface: link &typedef phy_interface_t mode | 221 | * @interface: link &typedef phy_interface_t mode |
| 199 | * @phy: any attached phy | 222 | * @phy: any attached phy |
| @@ -204,13 +227,14 @@ void mac_link_down(struct net_device *ndev, unsigned int mode, | |||
| 204 | * phy_init_eee() and perform appropriate MAC configuration for EEE. | 227 | * phy_init_eee() and perform appropriate MAC configuration for EEE. |
| 205 | * Interface type selection must be done in mac_config(). | 228 | * Interface type selection must be done in mac_config(). |
| 206 | */ | 229 | */ |
| 207 | void mac_link_up(struct net_device *ndev, unsigned int mode, | 230 | void mac_link_up(struct phylink_config *config, unsigned int mode, |
| 208 | phy_interface_t interface, | 231 | phy_interface_t interface, |
| 209 | struct phy_device *phy); | 232 | struct phy_device *phy); |
| 210 | #endif | 233 | #endif |
| 211 | 234 | ||
| 212 | struct phylink *phylink_create(struct net_device *, struct fwnode_handle *, | 235 | struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *, |
| 213 | phy_interface_t iface, const struct phylink_mac_ops *ops); | 236 | phy_interface_t iface, |
| 237 | const struct phylink_mac_ops *ops); | ||
| 214 | void phylink_destroy(struct phylink *); | 238 | void phylink_destroy(struct phylink *); |
| 215 | 239 | ||
| 216 | int phylink_connect_phy(struct phylink *, struct phy_device *); | 240 | int phylink_connect_phy(struct phylink *, struct phy_device *); |
diff --git a/include/linux/pid.h b/include/linux/pid.h index 3c8ef5a199ca..1484db6ca8d1 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | #define _LINUX_PID_H | 3 | #define _LINUX_PID_H |
| 4 | 4 | ||
| 5 | #include <linux/rculist.h> | 5 | #include <linux/rculist.h> |
| 6 | #include <linux/wait.h> | ||
| 6 | 7 | ||
| 7 | enum pid_type | 8 | enum pid_type |
| 8 | { | 9 | { |
| @@ -60,6 +61,8 @@ struct pid | |||
| 60 | unsigned int level; | 61 | unsigned int level; |
| 61 | /* lists of tasks that use this pid */ | 62 | /* lists of tasks that use this pid */ |
| 62 | struct hlist_head tasks[PIDTYPE_MAX]; | 63 | struct hlist_head tasks[PIDTYPE_MAX]; |
| 64 | /* wait queue for pidfd notifications */ | ||
| 65 | wait_queue_head_t wait_pidfd; | ||
| 63 | struct rcu_head rcu; | 66 | struct rcu_head rcu; |
| 64 | struct upid numbers[1]; | 67 | struct upid numbers[1]; |
| 65 | }; | 68 | }; |
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h index 6f260c1d3467..6aeb711f7cd1 100644 --- a/include/linux/pinctrl/pinconf-generic.h +++ b/include/linux/pinctrl/pinconf-generic.h | |||
| @@ -11,6 +11,12 @@ | |||
| 11 | #ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H | 11 | #ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H |
| 12 | #define __LINUX_PINCTRL_PINCONF_GENERIC_H | 12 | #define __LINUX_PINCTRL_PINCONF_GENERIC_H |
| 13 | 13 | ||
| 14 | #include <linux/device.h> | ||
| 15 | #include <linux/pinctrl/machine.h> | ||
| 16 | |||
| 17 | struct pinctrl_dev; | ||
| 18 | struct pinctrl_map; | ||
| 19 | |||
| 14 | /** | 20 | /** |
| 15 | * enum pin_config_param - possible pin configuration parameters | 21 | * enum pin_config_param - possible pin configuration parameters |
| 16 | * @PIN_CONFIG_BIAS_BUS_HOLD: the pin will be set to weakly latch so that it | 22 | * @PIN_CONFIG_BIAS_BUS_HOLD: the pin will be set to weakly latch so that it |
| @@ -54,6 +60,8 @@ | |||
| 54 | * push-pull mode, the argument is ignored. | 60 | * push-pull mode, the argument is ignored. |
| 55 | * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current | 61 | * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current |
| 56 | * passed as argument. The argument is in mA. | 62 | * passed as argument. The argument is in mA. |
| 63 | * @PIN_CONFIG_DRIVE_STRENGTH_UA: the pin will sink or source at most the current | ||
| 64 | * passed as argument. The argument is in uA. | ||
| 57 | * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, | 65 | * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, |
| 58 | * which means it will wait for signals to settle when reading inputs. The | 66 | * which means it will wait for signals to settle when reading inputs. The |
| 59 | * argument gives the debounce time in usecs. Setting the | 67 | * argument gives the debounce time in usecs. Setting the |
| @@ -111,6 +119,7 @@ enum pin_config_param { | |||
| 111 | PIN_CONFIG_DRIVE_OPEN_SOURCE, | 119 | PIN_CONFIG_DRIVE_OPEN_SOURCE, |
| 112 | PIN_CONFIG_DRIVE_PUSH_PULL, | 120 | PIN_CONFIG_DRIVE_PUSH_PULL, |
| 113 | PIN_CONFIG_DRIVE_STRENGTH, | 121 | PIN_CONFIG_DRIVE_STRENGTH, |
| 122 | PIN_CONFIG_DRIVE_STRENGTH_UA, | ||
| 114 | PIN_CONFIG_INPUT_DEBOUNCE, | 123 | PIN_CONFIG_INPUT_DEBOUNCE, |
| 115 | PIN_CONFIG_INPUT_ENABLE, | 124 | PIN_CONFIG_INPUT_ENABLE, |
| 116 | PIN_CONFIG_INPUT_SCHMITT, | 125 | PIN_CONFIG_INPUT_SCHMITT, |
| @@ -155,9 +164,6 @@ static inline unsigned long pinconf_to_config_packed(enum pin_config_param param | |||
| 155 | return PIN_CONF_PACKED(param, argument); | 164 | return PIN_CONF_PACKED(param, argument); |
| 156 | } | 165 | } |
| 157 | 166 | ||
| 158 | #ifdef CONFIG_GENERIC_PINCONF | ||
| 159 | |||
| 160 | #ifdef CONFIG_DEBUG_FS | ||
| 161 | #define PCONFDUMP(a, b, c, d) { \ | 167 | #define PCONFDUMP(a, b, c, d) { \ |
| 162 | .param = a, .display = b, .format = c, .has_arg = d \ | 168 | .param = a, .display = b, .format = c, .has_arg = d \ |
| 163 | } | 169 | } |
| @@ -168,14 +174,6 @@ struct pin_config_item { | |||
| 168 | const char * const format; | 174 | const char * const format; |
| 169 | bool has_arg; | 175 | bool has_arg; |
| 170 | }; | 176 | }; |
| 171 | #endif /* CONFIG_DEBUG_FS */ | ||
| 172 | |||
| 173 | #ifdef CONFIG_OF | ||
| 174 | |||
| 175 | #include <linux/device.h> | ||
| 176 | #include <linux/pinctrl/machine.h> | ||
| 177 | struct pinctrl_dev; | ||
| 178 | struct pinctrl_map; | ||
| 179 | 177 | ||
| 180 | struct pinconf_generic_params { | 178 | struct pinconf_generic_params { |
| 181 | const char * const property; | 179 | const char * const property; |
| @@ -220,8 +218,5 @@ static inline int pinconf_generic_dt_node_to_map_all( | |||
| 220 | return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps, | 218 | return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps, |
| 221 | PIN_MAP_TYPE_INVALID); | 219 | PIN_MAP_TYPE_INVALID); |
| 222 | } | 220 | } |
| 223 | #endif | ||
| 224 | |||
| 225 | #endif /* CONFIG_GENERIC_PINCONF */ | ||
| 226 | 221 | ||
| 227 | #endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */ | 222 | #endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */ |
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h index 514414a5ad01..f8a8215e9021 100644 --- a/include/linux/pinctrl/pinconf.h +++ b/include/linux/pinctrl/pinconf.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #ifndef __LINUX_PINCTRL_PINCONF_H | 11 | #ifndef __LINUX_PINCTRL_PINCONF_H |
| 12 | #define __LINUX_PINCTRL_PINCONF_H | 12 | #define __LINUX_PINCTRL_PINCONF_H |
| 13 | 13 | ||
| 14 | #ifdef CONFIG_PINCONF | 14 | #include <linux/types.h> |
| 15 | 15 | ||
| 16 | struct pinctrl_dev; | 16 | struct pinctrl_dev; |
| 17 | struct seq_file; | 17 | struct seq_file; |
| @@ -64,6 +64,4 @@ struct pinconf_ops { | |||
| 64 | unsigned long config); | 64 | unsigned long config); |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #endif /* __LINUX_PINCTRL_PINCONF_H */ | 67 | #endif /* __LINUX_PINCTRL_PINCONF_H */ |
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h index a0e785815a64..635d97e9285e 100644 --- a/include/linux/pinctrl/pinctrl-state.h +++ b/include/linux/pinctrl/pinctrl-state.h | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | * Standard pin control state definitions | 3 | * Standard pin control state definitions |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #ifndef __LINUX_PINCTRL_PINCTRL_STATE_H | ||
| 7 | #define __LINUX_PINCTRL_PINCTRL_STATE_H | ||
| 8 | |||
| 6 | /** | 9 | /** |
| 7 | * @PINCTRL_STATE_DEFAULT: the state the pinctrl handle shall be put | 10 | * @PINCTRL_STATE_DEFAULT: the state the pinctrl handle shall be put |
| 8 | * into as default, usually this means the pins are up and ready to | 11 | * into as default, usually this means the pins are up and ready to |
| @@ -31,3 +34,5 @@ | |||
| 31 | #define PINCTRL_STATE_INIT "init" | 34 | #define PINCTRL_STATE_INIT "init" |
| 32 | #define PINCTRL_STATE_IDLE "idle" | 35 | #define PINCTRL_STATE_IDLE "idle" |
| 33 | #define PINCTRL_STATE_SLEEP "sleep" | 36 | #define PINCTRL_STATE_SLEEP "sleep" |
| 37 | |||
| 38 | #endif /* __LINUX_PINCTRL_PINCTRL_STATE_H */ | ||
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index e429e5d92dd6..7ce23450a1cb 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h | |||
| @@ -11,8 +11,6 @@ | |||
| 11 | #ifndef __LINUX_PINCTRL_PINCTRL_H | 11 | #ifndef __LINUX_PINCTRL_PINCTRL_H |
| 12 | #define __LINUX_PINCTRL_PINCTRL_H | 12 | #define __LINUX_PINCTRL_PINCTRL_H |
| 13 | 13 | ||
| 14 | #ifdef CONFIG_PINCTRL | ||
| 15 | |||
| 16 | #include <linux/radix-tree.h> | 14 | #include <linux/radix-tree.h> |
| 17 | #include <linux/list.h> | 15 | #include <linux/list.h> |
| 18 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
| @@ -124,6 +122,10 @@ struct pinctrl_ops { | |||
| 124 | * the hardware description | 122 | * the hardware description |
| 125 | * @custom_conf_items: Information how to print @params in debugfs, must be | 123 | * @custom_conf_items: Information how to print @params in debugfs, must be |
| 126 | * the same size as the @custom_params, i.e. @num_custom_params | 124 | * the same size as the @custom_params, i.e. @num_custom_params |
| 125 | * @link_consumers: If true create a device link between pinctrl and its | ||
| 126 | * consumers (i.e. the devices requesting pin control states). This is | ||
| 127 | * sometimes necessary to ascertain the right suspend/resume order for | ||
| 128 | * example. | ||
| 127 | */ | 129 | */ |
| 128 | struct pinctrl_desc { | 130 | struct pinctrl_desc { |
| 129 | const char *name; | 131 | const char *name; |
| @@ -138,6 +140,7 @@ struct pinctrl_desc { | |||
| 138 | const struct pinconf_generic_params *custom_params; | 140 | const struct pinconf_generic_params *custom_params; |
| 139 | const struct pin_config_item *custom_conf_items; | 141 | const struct pin_config_item *custom_conf_items; |
| 140 | #endif | 142 | #endif |
| 143 | bool link_consumers; | ||
| 141 | }; | 144 | }; |
| 142 | 145 | ||
| 143 | /* External interface to pin controller */ | 146 | /* External interface to pin controller */ |
| @@ -166,7 +169,6 @@ extern struct pinctrl_dev *devm_pinctrl_register(struct device *dev, | |||
| 166 | extern void devm_pinctrl_unregister(struct device *dev, | 169 | extern void devm_pinctrl_unregister(struct device *dev, |
| 167 | struct pinctrl_dev *pctldev); | 170 | struct pinctrl_dev *pctldev); |
| 168 | 171 | ||
| 169 | extern bool pin_is_valid(struct pinctrl_dev *pctldev, int pin); | ||
| 170 | extern void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev, | 172 | extern void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev, |
| 171 | struct pinctrl_gpio_range *range); | 173 | struct pinctrl_gpio_range *range); |
| 172 | extern void pinctrl_add_gpio_ranges(struct pinctrl_dev *pctldev, | 174 | extern void pinctrl_add_gpio_ranges(struct pinctrl_dev *pctldev, |
| @@ -197,16 +199,5 @@ struct pinctrl_dev *of_pinctrl_get(struct device_node *np) | |||
| 197 | extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev); | 199 | extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev); |
| 198 | extern const char *pinctrl_dev_get_devname(struct pinctrl_dev *pctldev); | 200 | extern const char *pinctrl_dev_get_devname(struct pinctrl_dev *pctldev); |
| 199 | extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev); | 201 | extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev); |
| 200 | #else | ||
| 201 | |||
| 202 | struct pinctrl_dev; | ||
| 203 | |||
| 204 | /* Sufficiently stupid default functions when pinctrl is not in use */ | ||
| 205 | static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin) | ||
| 206 | { | ||
| 207 | return pin >= 0; | ||
| 208 | } | ||
| 209 | |||
| 210 | #endif /* !CONFIG_PINCTRL */ | ||
| 211 | 202 | ||
| 212 | #endif /* __LINUX_PINCTRL_PINCTRL_H */ | 203 | #endif /* __LINUX_PINCTRL_PINCTRL_H */ |
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h index e873ed97d79e..9a647fa5c8f1 100644 --- a/include/linux/pinctrl/pinmux.h +++ b/include/linux/pinctrl/pinmux.h | |||
| @@ -15,8 +15,6 @@ | |||
| 15 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
| 16 | #include <linux/pinctrl/pinctrl.h> | 16 | #include <linux/pinctrl/pinctrl.h> |
| 17 | 17 | ||
| 18 | #ifdef CONFIG_PINMUX | ||
| 19 | |||
| 20 | struct pinctrl_dev; | 18 | struct pinctrl_dev; |
| 21 | 19 | ||
| 22 | /** | 20 | /** |
| @@ -84,6 +82,4 @@ struct pinmux_ops { | |||
| 84 | bool strict; | 82 | bool strict; |
| 85 | }; | 83 | }; |
| 86 | 84 | ||
| 87 | #endif /* CONFIG_PINMUX */ | ||
| 88 | |||
| 89 | #endif /* __LINUX_PINCTRL_PINMUX_H */ | 85 | #endif /* __LINUX_PINCTRL_PINMUX_H */ |
diff --git a/include/linux/platform_data/fsa9480.h b/include/linux/platform_data/fsa9480.h deleted file mode 100644 index dea8d84448ec..000000000000 --- a/include/linux/platform_data/fsa9480.h +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2010 Samsung Electronics | ||
| 4 | * Minkyu Kang <mk7.kang@samsung.com> | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef _FSA9480_H_ | ||
| 8 | #define _FSA9480_H_ | ||
| 9 | |||
| 10 | #define FSA9480_ATTACHED 1 | ||
| 11 | #define FSA9480_DETACHED 0 | ||
| 12 | |||
| 13 | struct fsa9480_platform_data { | ||
| 14 | void (*cfg_gpio) (void); | ||
| 15 | void (*usb_cb) (u8 attached); | ||
| 16 | void (*uart_cb) (u8 attached); | ||
| 17 | void (*charger_cb) (u8 attached); | ||
| 18 | void (*jig_cb) (u8 attached); | ||
| 19 | void (*reset_cb) (void); | ||
| 20 | void (*usb_power) (u8 on); | ||
| 21 | int wakeup; | ||
| 22 | }; | ||
| 23 | |||
| 24 | #endif /* _FSA9480_H_ */ | ||
diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h index 17edc43201d2..8b30b14b47d3 100644 --- a/include/linux/platform_data/gpio-omap.h +++ b/include/linux/platform_data/gpio-omap.h | |||
| @@ -186,7 +186,7 @@ struct omap_gpio_platform_data { | |||
| 186 | bool is_mpuio; /* whether the bank is of type MPUIO */ | 186 | bool is_mpuio; /* whether the bank is of type MPUIO */ |
| 187 | u32 non_wakeup_gpios; | 187 | u32 non_wakeup_gpios; |
| 188 | 188 | ||
| 189 | struct omap_gpio_reg_offs *regs; | 189 | const struct omap_gpio_reg_offs *regs; |
| 190 | 190 | ||
| 191 | /* Return context loss count due to PM states changing */ | 191 | /* Return context loss count due to PM states changing */ |
| 192 | int (*get_context_loss_count)(struct device *dev); | 192 | int (*get_context_loss_count)(struct device *dev); |
diff --git a/include/linux/platform_data/i2c-mux-gpio.h b/include/linux/platform_data/i2c-mux-gpio.h index 9f6ca406505b..5e4c2c272a73 100644 --- a/include/linux/platform_data/i2c-mux-gpio.h +++ b/include/linux/platform_data/i2c-mux-gpio.h | |||
| @@ -19,10 +19,6 @@ | |||
| 19 | * position | 19 | * position |
| 20 | * @n_values: Number of multiplexer positions (busses to instantiate) | 20 | * @n_values: Number of multiplexer positions (busses to instantiate) |
| 21 | * @classes: Optional I2C auto-detection classes | 21 | * @classes: Optional I2C auto-detection classes |
| 22 | * @gpio_chip: Optional GPIO chip name; if set, GPIO pin numbers are given | ||
| 23 | * relative to the base GPIO number of that chip | ||
| 24 | * @gpios: Array of GPIO numbers used to control MUX | ||
| 25 | * @n_gpios: Number of GPIOs used to control MUX | ||
| 26 | * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used | 22 | * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used |
| 27 | */ | 23 | */ |
| 28 | struct i2c_mux_gpio_platform_data { | 24 | struct i2c_mux_gpio_platform_data { |
| @@ -31,9 +27,6 @@ struct i2c_mux_gpio_platform_data { | |||
| 31 | const unsigned *values; | 27 | const unsigned *values; |
| 32 | int n_values; | 28 | int n_values; |
| 33 | const unsigned *classes; | 29 | const unsigned *classes; |
| 34 | char *gpio_chip; | ||
| 35 | const unsigned *gpios; | ||
| 36 | int n_gpios; | ||
| 37 | unsigned idle; | 30 | unsigned idle; |
| 38 | }; | 31 | }; |
| 39 | 32 | ||
diff --git a/include/linux/platform_data/media/mmp-camera.h b/include/linux/platform_data/media/mmp-camera.h index d2d3a443eedf..53adaab64f28 100644 --- a/include/linux/platform_data/media/mmp-camera.h +++ b/include/linux/platform_data/media/mmp-camera.h | |||
| @@ -12,11 +12,7 @@ enum dphy3_algo { | |||
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | struct mmp_camera_platform_data { | 14 | struct mmp_camera_platform_data { |
| 15 | struct platform_device *i2c_device; | ||
| 16 | int sensor_power_gpio; | ||
| 17 | int sensor_reset_gpio; | ||
| 18 | enum v4l2_mbus_type bus_type; | 15 | enum v4l2_mbus_type bus_type; |
| 19 | int mclk_min; /* The minimal value of MCLK */ | ||
| 20 | int mclk_src; /* which clock source the MCLK derives from */ | 16 | int mclk_src; /* which clock source the MCLK derives from */ |
| 21 | int mclk_div; /* Clock Divider Value for MCLK */ | 17 | int mclk_div; /* Clock Divider Value for MCLK */ |
| 22 | /* | 18 | /* |
diff --git a/include/linux/platform_data/spi-mt65xx.h b/include/linux/platform_data/spi-mt65xx.h index 617a75336d56..f0e6d6483e62 100644 --- a/include/linux/platform_data/spi-mt65xx.h +++ b/include/linux/platform_data/spi-mt65xx.h | |||
| @@ -11,8 +11,6 @@ | |||
| 11 | 11 | ||
| 12 | /* Board specific platform_data */ | 12 | /* Board specific platform_data */ |
| 13 | struct mtk_chip_config { | 13 | struct mtk_chip_config { |
| 14 | u32 tx_mlsb; | ||
| 15 | u32 rx_mlsb; | ||
| 16 | u32 cs_pol; | 14 | u32 cs_pol; |
| 17 | u32 sample_sel; | 15 | u32 sample_sel; |
| 18 | }; | 16 | }; |
diff --git a/include/linux/platform_data/wilco-ec.h b/include/linux/platform_data/wilco-ec.h index 1ff224793c99..ad03b586a095 100644 --- a/include/linux/platform_data/wilco-ec.h +++ b/include/linux/platform_data/wilco-ec.h | |||
| @@ -13,12 +13,9 @@ | |||
| 13 | 13 | ||
| 14 | /* Message flags for using the mailbox() interface */ | 14 | /* Message flags for using the mailbox() interface */ |
| 15 | #define WILCO_EC_FLAG_NO_RESPONSE BIT(0) /* EC does not respond */ | 15 | #define WILCO_EC_FLAG_NO_RESPONSE BIT(0) /* EC does not respond */ |
| 16 | #define WILCO_EC_FLAG_EXTENDED_DATA BIT(1) /* EC returns 256 data bytes */ | ||
| 17 | 16 | ||
| 18 | /* Normal commands have a maximum 32 bytes of data */ | 17 | /* Normal commands have a maximum 32 bytes of data */ |
| 19 | #define EC_MAILBOX_DATA_SIZE 32 | 18 | #define EC_MAILBOX_DATA_SIZE 32 |
| 20 | /* Extended commands have 256 bytes of response data */ | ||
| 21 | #define EC_MAILBOX_DATA_SIZE_EXTENDED 256 | ||
| 22 | 19 | ||
| 23 | /** | 20 | /** |
| 24 | * struct wilco_ec_device - Wilco Embedded Controller handle. | 21 | * struct wilco_ec_device - Wilco Embedded Controller handle. |
| @@ -32,6 +29,7 @@ | |||
| 32 | * @data_size: Size of the data buffer used for EC communication. | 29 | * @data_size: Size of the data buffer used for EC communication. |
| 33 | * @debugfs_pdev: The child platform_device used by the debugfs sub-driver. | 30 | * @debugfs_pdev: The child platform_device used by the debugfs sub-driver. |
| 34 | * @rtc_pdev: The child platform_device used by the RTC sub-driver. | 31 | * @rtc_pdev: The child platform_device used by the RTC sub-driver. |
| 32 | * @telem_pdev: The child platform_device used by the telemetry sub-driver. | ||
| 35 | */ | 33 | */ |
| 36 | struct wilco_ec_device { | 34 | struct wilco_ec_device { |
| 37 | struct device *dev; | 35 | struct device *dev; |
| @@ -43,6 +41,7 @@ struct wilco_ec_device { | |||
| 43 | size_t data_size; | 41 | size_t data_size; |
| 44 | struct platform_device *debugfs_pdev; | 42 | struct platform_device *debugfs_pdev; |
| 45 | struct platform_device *rtc_pdev; | 43 | struct platform_device *rtc_pdev; |
| 44 | struct platform_device *telem_pdev; | ||
| 46 | }; | 45 | }; |
| 47 | 46 | ||
| 48 | /** | 47 | /** |
| @@ -85,14 +84,12 @@ struct wilco_ec_response { | |||
| 85 | * enum wilco_ec_msg_type - Message type to select a set of command codes. | 84 | * enum wilco_ec_msg_type - Message type to select a set of command codes. |
| 86 | * @WILCO_EC_MSG_LEGACY: Legacy EC messages for standard EC behavior. | 85 | * @WILCO_EC_MSG_LEGACY: Legacy EC messages for standard EC behavior. |
| 87 | * @WILCO_EC_MSG_PROPERTY: Get/Set/Sync EC controlled NVRAM property. | 86 | * @WILCO_EC_MSG_PROPERTY: Get/Set/Sync EC controlled NVRAM property. |
| 88 | * @WILCO_EC_MSG_TELEMETRY_SHORT: 32 bytes of telemetry data provided by the EC. | 87 | * @WILCO_EC_MSG_TELEMETRY: Request telemetry data from the EC. |
| 89 | * @WILCO_EC_MSG_TELEMETRY_LONG: 256 bytes of telemetry data provided by the EC. | ||
| 90 | */ | 88 | */ |
| 91 | enum wilco_ec_msg_type { | 89 | enum wilco_ec_msg_type { |
| 92 | WILCO_EC_MSG_LEGACY = 0x00f0, | 90 | WILCO_EC_MSG_LEGACY = 0x00f0, |
| 93 | WILCO_EC_MSG_PROPERTY = 0x00f2, | 91 | WILCO_EC_MSG_PROPERTY = 0x00f2, |
| 94 | WILCO_EC_MSG_TELEMETRY_SHORT = 0x00f5, | 92 | WILCO_EC_MSG_TELEMETRY = 0x00f5, |
| 95 | WILCO_EC_MSG_TELEMETRY_LONG = 0x00f6, | ||
| 96 | }; | 93 | }; |
| 97 | 94 | ||
| 98 | /** | 95 | /** |
| @@ -123,4 +120,87 @@ struct wilco_ec_message { | |||
| 123 | */ | 120 | */ |
| 124 | int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg); | 121 | int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg); |
| 125 | 122 | ||
| 123 | /* | ||
| 124 | * A Property is typically a data item that is stored to NVRAM | ||
| 125 | * by the EC. Each of these data items has an index associated | ||
| 126 | * with it, known as the Property ID (PID). Properties may have | ||
| 127 | * variable lengths, up to a max of WILCO_EC_PROPERTY_MAX_SIZE | ||
| 128 | * bytes. Properties can be simple integers, or they may be more | ||
| 129 | * complex binary data. | ||
| 130 | */ | ||
| 131 | |||
| 132 | #define WILCO_EC_PROPERTY_MAX_SIZE 4 | ||
| 133 | |||
| 134 | /** | ||
| 135 | * struct ec_property_set_msg - Message to get or set a property. | ||
| 136 | * @property_id: Which property to get or set. | ||
| 137 | * @length: Number of bytes of |data| that are used. | ||
| 138 | * @data: Actual property data. | ||
| 139 | */ | ||
| 140 | struct wilco_ec_property_msg { | ||
| 141 | u32 property_id; | ||
| 142 | int length; | ||
| 143 | u8 data[WILCO_EC_PROPERTY_MAX_SIZE]; | ||
| 144 | }; | ||
| 145 | |||
| 146 | /** | ||
| 147 | * wilco_ec_get_property() - Retrieve a property from the EC. | ||
| 148 | * @ec: Embedded Controller device. | ||
| 149 | * @prop_msg: Message for request and response. | ||
| 150 | * | ||
| 151 | * The property_id field of |prop_msg| should be filled before calling this | ||
| 152 | * function. The result will be stored in the data and length fields. | ||
| 153 | * | ||
| 154 | * Return: 0 on success, negative error code on failure. | ||
| 155 | */ | ||
| 156 | int wilco_ec_get_property(struct wilco_ec_device *ec, | ||
| 157 | struct wilco_ec_property_msg *prop_msg); | ||
| 158 | |||
| 159 | /** | ||
| 160 | * wilco_ec_set_property() - Store a property on the EC. | ||
| 161 | * @ec: Embedded Controller device. | ||
| 162 | * @prop_msg: Message for request and response. | ||
| 163 | * | ||
| 164 | * The property_id, length, and data fields of |prop_msg| should be | ||
| 165 | * filled before calling this function. | ||
| 166 | * | ||
| 167 | * Return: 0 on success, negative error code on failure. | ||
| 168 | */ | ||
| 169 | int wilco_ec_set_property(struct wilco_ec_device *ec, | ||
| 170 | struct wilco_ec_property_msg *prop_msg); | ||
| 171 | |||
| 172 | /** | ||
| 173 | * wilco_ec_get_byte_property() - Retrieve a byte-size property from the EC. | ||
| 174 | * @ec: Embedded Controller device. | ||
| 175 | * @property_id: Which property to retrieve. | ||
| 176 | * @val: The result value, will be filled by this function. | ||
| 177 | * | ||
| 178 | * Return: 0 on success, negative error code on failure. | ||
| 179 | */ | ||
| 180 | int wilco_ec_get_byte_property(struct wilco_ec_device *ec, u32 property_id, | ||
| 181 | u8 *val); | ||
| 182 | |||
| 183 | /** | ||
| 184 | * wilco_ec_get_byte_property() - Store a byte-size property on the EC. | ||
| 185 | * @ec: Embedded Controller device. | ||
| 186 | * @property_id: Which property to store. | ||
| 187 | * @val: Value to store. | ||
| 188 | * | ||
| 189 | * Return: 0 on success, negative error code on failure. | ||
| 190 | */ | ||
| 191 | int wilco_ec_set_byte_property(struct wilco_ec_device *ec, u32 property_id, | ||
| 192 | u8 val); | ||
| 193 | |||
| 194 | /** | ||
| 195 | * wilco_ec_add_sysfs() - Create sysfs entries | ||
| 196 | * @ec: Wilco EC device | ||
| 197 | * | ||
| 198 | * wilco_ec_remove_sysfs() needs to be called afterwards | ||
| 199 | * to perform the necessary cleanup. | ||
| 200 | * | ||
| 201 | * Return: 0 on success or negative error code on failure. | ||
| 202 | */ | ||
| 203 | int wilco_ec_add_sysfs(struct wilco_ec_device *ec); | ||
| 204 | void wilco_ec_remove_sysfs(struct wilco_ec_device *ec); | ||
| 205 | |||
| 126 | #endif /* WILCO_EC_H */ | 206 | #endif /* WILCO_EC_H */ |
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h index bfba245636a7..8551156b8dca 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h | |||
| @@ -18,8 +18,8 @@ | |||
| 18 | #define ASUS_WMI_METHODID_GDSP 0x50534447 /* Get DiSPlay output */ | 18 | #define ASUS_WMI_METHODID_GDSP 0x50534447 /* Get DiSPlay output */ |
| 19 | #define ASUS_WMI_METHODID_DEVP 0x50564544 /* DEVice Policy */ | 19 | #define ASUS_WMI_METHODID_DEVP 0x50564544 /* DEVice Policy */ |
| 20 | #define ASUS_WMI_METHODID_OSVR 0x5256534F /* OS VeRsion */ | 20 | #define ASUS_WMI_METHODID_OSVR 0x5256534F /* OS VeRsion */ |
| 21 | #define ASUS_WMI_METHODID_DSTS 0x53544344 /* Device STatuS */ | 21 | #define ASUS_WMI_METHODID_DCTS 0x53544344 /* Device status (DCTS) */ |
| 22 | #define ASUS_WMI_METHODID_DSTS2 0x53545344 /* Device STatuS #2*/ | 22 | #define ASUS_WMI_METHODID_DSTS 0x53545344 /* Device status (DSTS) */ |
| 23 | #define ASUS_WMI_METHODID_BSTS 0x53545342 /* Bios STatuS ? */ | 23 | #define ASUS_WMI_METHODID_BSTS 0x53545342 /* Bios STatuS ? */ |
| 24 | #define ASUS_WMI_METHODID_DEVS 0x53564544 /* DEVice Set */ | 24 | #define ASUS_WMI_METHODID_DEVS 0x53564544 /* DEVice Set */ |
| 25 | #define ASUS_WMI_METHODID_CFVS 0x53564643 /* CPU Frequency Volt Set */ | 25 | #define ASUS_WMI_METHODID_CFVS 0x53564643 /* CPU Frequency Volt Set */ |
| @@ -57,6 +57,7 @@ | |||
| 57 | #define ASUS_WMI_DEVID_KBD_BACKLIGHT 0x00050021 | 57 | #define ASUS_WMI_DEVID_KBD_BACKLIGHT 0x00050021 |
| 58 | #define ASUS_WMI_DEVID_LIGHT_SENSOR 0x00050022 /* ?? */ | 58 | #define ASUS_WMI_DEVID_LIGHT_SENSOR 0x00050022 /* ?? */ |
| 59 | #define ASUS_WMI_DEVID_LIGHTBAR 0x00050025 | 59 | #define ASUS_WMI_DEVID_LIGHTBAR 0x00050025 |
| 60 | #define ASUS_WMI_DEVID_FAN_MODE 0x00110018 | ||
| 60 | 61 | ||
| 61 | /* Misc */ | 62 | /* Misc */ |
| 62 | #define ASUS_WMI_DEVID_CAMERA 0x00060013 | 63 | #define ASUS_WMI_DEVID_CAMERA 0x00060013 |
diff --git a/include/linux/platform_data/xilinx-ll-temac.h b/include/linux/platform_data/xilinx-ll-temac.h index 368530f98176..f4a68136afa6 100644 --- a/include/linux/platform_data/xilinx-ll-temac.h +++ b/include/linux/platform_data/xilinx-ll-temac.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <linux/if_ether.h> | 5 | #include <linux/if_ether.h> |
| 6 | #include <linux/phy.h> | 6 | #include <linux/phy.h> |
| 7 | #include <linux/spinlock.h> | ||
| 7 | 8 | ||
| 8 | struct ll_temac_platform_data { | 9 | struct ll_temac_platform_data { |
| 9 | bool txcsum; /* Enable/disable TX checksum */ | 10 | bool txcsum; /* Enable/disable TX checksum */ |
| @@ -21,7 +22,7 @@ struct ll_temac_platform_data { | |||
| 21 | * TEMAC IP block, the same mutex should be passed here, as | 22 | * TEMAC IP block, the same mutex should be passed here, as |
| 22 | * they share the same DCR bus bridge. | 23 | * they share the same DCR bus bridge. |
| 23 | */ | 24 | */ |
| 24 | struct mutex *indirect_mutex; | 25 | spinlock_t *indirect_lock; |
| 25 | /* DMA channel control setup */ | 26 | /* DMA channel control setup */ |
| 26 | u8 tx_irq_timeout; /* TX Interrupt Delay Time-out */ | 27 | u8 tx_irq_timeout; /* TX Interrupt Delay Time-out */ |
| 27 | u8 tx_irq_count; /* TX Interrupt Coalescing Threshold Count */ | 28 | u8 tx_irq_count; /* TX Interrupt Coalescing Threshold Count */ |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index beb25f277889..9bc36b589827 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> | 5 | * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> |
| 6 | * | 6 | * |
| 7 | * See Documentation/driver-model/ for more information. | 7 | * See Documentation/driver-api/driver-model/ for more information. |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #ifndef _PLATFORM_DEVICE_H_ | 10 | #ifndef _PLATFORM_DEVICE_H_ |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 345d74a727e3..3619a870eaa4 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -271,7 +271,7 @@ typedef struct pm_message { | |||
| 271 | * actions to be performed by a device driver's callbacks generally depend on | 271 | * actions to be performed by a device driver's callbacks generally depend on |
| 272 | * the platform and subsystem the device belongs to. | 272 | * the platform and subsystem the device belongs to. |
| 273 | * | 273 | * |
| 274 | * Refer to Documentation/power/runtime_pm.txt for more information about the | 274 | * Refer to Documentation/power/runtime_pm.rst for more information about the |
| 275 | * role of the @runtime_suspend(), @runtime_resume() and @runtime_idle() | 275 | * role of the @runtime_suspend(), @runtime_resume() and @runtime_idle() |
| 276 | * callbacks in device runtime power management. | 276 | * callbacks in device runtime power management. |
| 277 | */ | 277 | */ |
| @@ -760,7 +760,6 @@ extern int pm_generic_poweroff_late(struct device *dev); | |||
| 760 | extern int pm_generic_poweroff(struct device *dev); | 760 | extern int pm_generic_poweroff(struct device *dev); |
| 761 | extern void pm_generic_complete(struct device *dev); | 761 | extern void pm_generic_complete(struct device *dev); |
| 762 | 762 | ||
| 763 | extern void dev_pm_skip_next_resume_phases(struct device *dev); | ||
| 764 | extern bool dev_pm_may_skip_resume(struct device *dev); | 763 | extern bool dev_pm_may_skip_resume(struct device *dev); |
| 765 | extern bool dev_pm_smart_suspend_and_suspended(struct device *dev); | 764 | extern bool dev_pm_smart_suspend_and_suspended(struct device *dev); |
| 766 | 765 | ||
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 5f3a1ee9c4c2..af5021f27cb7 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h | |||
| @@ -128,8 +128,8 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name); | |||
| 128 | void dev_pm_opp_put_clkname(struct opp_table *opp_table); | 128 | void dev_pm_opp_put_clkname(struct opp_table *opp_table); |
| 129 | struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); | 129 | struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); |
| 130 | void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); | 130 | void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); |
| 131 | struct opp_table *dev_pm_opp_set_genpd_virt_dev(struct device *dev, struct device *virt_dev, int index); | 131 | struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names); |
| 132 | void dev_pm_opp_put_genpd_virt_dev(struct opp_table *opp_table, struct device *virt_dev); | 132 | void dev_pm_opp_detach_genpd(struct opp_table *opp_table); |
| 133 | int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate); | 133 | int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate); |
| 134 | int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); | 134 | int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); |
| 135 | int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask); | 135 | int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask); |
| @@ -292,12 +292,12 @@ static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const | |||
| 292 | 292 | ||
| 293 | static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {} | 293 | static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {} |
| 294 | 294 | ||
| 295 | static inline struct opp_table *dev_pm_opp_set_genpd_virt_dev(struct device *dev, struct device *virt_dev, int index) | 295 | static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names) |
| 296 | { | 296 | { |
| 297 | return ERR_PTR(-ENOTSUPP); | 297 | return ERR_PTR(-ENOTSUPP); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | static inline void dev_pm_opp_put_genpd_virt_dev(struct opp_table *opp_table, struct device *virt_dev) {} | 300 | static inline void dev_pm_opp_detach_genpd(struct opp_table *opp_table) {} |
| 301 | 301 | ||
| 302 | static inline int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate) | 302 | static inline int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate) |
| 303 | { | 303 | { |
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index ce57771fab9b..91027602d137 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
| @@ -36,7 +36,7 @@ struct wake_irq; | |||
| 36 | * @expire_count: Number of times the wakeup source's timeout has expired. | 36 | * @expire_count: Number of times the wakeup source's timeout has expired. |
| 37 | * @wakeup_count: Number of times the wakeup source might abort suspend. | 37 | * @wakeup_count: Number of times the wakeup source might abort suspend. |
| 38 | * @active: Status of the wakeup source. | 38 | * @active: Status of the wakeup source. |
| 39 | * @has_timeout: The wakeup source has been activated with a timeout. | 39 | * @autosleep_enabled: Autosleep is active, so update @prevent_sleep_time. |
| 40 | */ | 40 | */ |
| 41 | struct wakeup_source { | 41 | struct wakeup_source { |
| 42 | const char *name; | 42 | const char *name; |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 6f348b3ee2e0..28413f737e7d 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
| @@ -128,6 +128,8 @@ enum power_supply_property { | |||
| 128 | POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD, /* in percents! */ | 128 | POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD, /* in percents! */ |
| 129 | POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD, /* in percents! */ | 129 | POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD, /* in percents! */ |
| 130 | POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, | 130 | POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, |
| 131 | POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT, | ||
| 132 | POWER_SUPPLY_PROP_INPUT_POWER_LIMIT, | ||
| 131 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, | 133 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, |
| 132 | POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, | 134 | POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, |
| 133 | POWER_SUPPLY_PROP_ENERGY_FULL, | 135 | POWER_SUPPLY_PROP_ENERGY_FULL, |
| @@ -480,4 +482,17 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp) | |||
| 480 | return 0; | 482 | return 0; |
| 481 | } | 483 | } |
| 482 | 484 | ||
| 485 | #ifdef CONFIG_POWER_SUPPLY_HWMON | ||
| 486 | int power_supply_add_hwmon_sysfs(struct power_supply *psy); | ||
| 487 | void power_supply_remove_hwmon_sysfs(struct power_supply *psy); | ||
| 488 | #else | ||
| 489 | static inline int power_supply_add_hwmon_sysfs(struct power_supply *psy) | ||
| 490 | { | ||
| 491 | return 0; | ||
| 492 | } | ||
| 493 | |||
| 494 | static inline | ||
| 495 | void power_supply_remove_hwmon_sysfs(struct power_supply *psy) {} | ||
| 496 | #endif | ||
| 497 | |||
| 483 | #endif /* __LINUX_POWER_SUPPLY_H__ */ | 498 | #endif /* __LINUX_POWER_SUPPLY_H__ */ |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 52a283ba0465..a705aa2d03f9 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
| @@ -75,6 +75,15 @@ struct proc_dir_entry *proc_create_net_single_write(const char *name, umode_t mo | |||
| 75 | void *data); | 75 | void *data); |
| 76 | extern struct pid *tgid_pidfd_to_pid(const struct file *file); | 76 | extern struct pid *tgid_pidfd_to_pid(const struct file *file); |
| 77 | 77 | ||
| 78 | #ifdef CONFIG_PROC_PID_ARCH_STATUS | ||
| 79 | /* | ||
| 80 | * The architecture which selects CONFIG_PROC_PID_ARCH_STATUS must | ||
| 81 | * provide proc_pid_arch_status() definition. | ||
| 82 | */ | ||
| 83 | int proc_pid_arch_status(struct seq_file *m, struct pid_namespace *ns, | ||
| 84 | struct pid *pid, struct task_struct *task); | ||
| 85 | #endif /* CONFIG_PROC_PID_ARCH_STATUS */ | ||
| 86 | |||
| 78 | #else /* CONFIG_PROC_FS */ | 87 | #else /* CONFIG_PROC_FS */ |
| 79 | 88 | ||
| 80 | static inline void proc_root_init(void) | 89 | static inline void proc_root_init(void) |
diff --git a/include/linux/processor.h b/include/linux/processor.h index dbc952eec869..dc78bdc7079a 100644 --- a/include/linux/processor.h +++ b/include/linux/processor.h | |||
| @@ -32,15 +32,6 @@ | |||
| 32 | #define spin_cpu_relax() cpu_relax() | 32 | #define spin_cpu_relax() cpu_relax() |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | /* | ||
| 36 | * spin_cpu_yield may be called to yield (undirected) to the hypervisor if | ||
| 37 | * necessary. This should be used if the wait is expected to take longer | ||
| 38 | * than context switch overhead, but we can't sleep or do a directed yield. | ||
| 39 | */ | ||
| 40 | #ifndef spin_cpu_yield | ||
| 41 | #define spin_cpu_yield() cpu_relax_yield() | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #ifndef spin_end | 35 | #ifndef spin_end |
| 45 | #define spin_end() | 36 | #define spin_end() |
| 46 | #endif | 37 | #endif |
diff --git a/include/linux/property.h b/include/linux/property.h index e9caa290cda5..5a910ad79591 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
| @@ -76,6 +76,10 @@ int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, | |||
| 76 | unsigned int nargs, unsigned int index, | 76 | unsigned int nargs, unsigned int index, |
| 77 | struct fwnode_reference_args *args); | 77 | struct fwnode_reference_args *args); |
| 78 | 78 | ||
| 79 | struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode, | ||
| 80 | const char *name, | ||
| 81 | unsigned int index); | ||
| 82 | |||
| 79 | struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode); | 83 | struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode); |
| 80 | struct fwnode_handle *fwnode_get_next_parent( | 84 | struct fwnode_handle *fwnode_get_next_parent( |
| 81 | struct fwnode_handle *fwnode); | 85 | struct fwnode_handle *fwnode); |
| @@ -141,6 +145,26 @@ static inline int device_property_read_u64(struct device *dev, | |||
| 141 | return device_property_read_u64_array(dev, propname, val, 1); | 145 | return device_property_read_u64_array(dev, propname, val, 1); |
| 142 | } | 146 | } |
| 143 | 147 | ||
| 148 | static inline int device_property_count_u8(struct device *dev, const char *propname) | ||
| 149 | { | ||
| 150 | return device_property_read_u8_array(dev, propname, NULL, 0); | ||
| 151 | } | ||
| 152 | |||
| 153 | static inline int device_property_count_u16(struct device *dev, const char *propname) | ||
| 154 | { | ||
| 155 | return device_property_read_u16_array(dev, propname, NULL, 0); | ||
| 156 | } | ||
| 157 | |||
| 158 | static inline int device_property_count_u32(struct device *dev, const char *propname) | ||
| 159 | { | ||
| 160 | return device_property_read_u32_array(dev, propname, NULL, 0); | ||
| 161 | } | ||
| 162 | |||
| 163 | static inline int device_property_count_u64(struct device *dev, const char *propname) | ||
| 164 | { | ||
| 165 | return device_property_read_u64_array(dev, propname, NULL, 0); | ||
| 166 | } | ||
| 167 | |||
| 144 | static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode, | 168 | static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode, |
| 145 | const char *propname) | 169 | const char *propname) |
| 146 | { | 170 | { |
| @@ -171,6 +195,30 @@ static inline int fwnode_property_read_u64(const struct fwnode_handle *fwnode, | |||
| 171 | return fwnode_property_read_u64_array(fwnode, propname, val, 1); | 195 | return fwnode_property_read_u64_array(fwnode, propname, val, 1); |
| 172 | } | 196 | } |
| 173 | 197 | ||
| 198 | static inline int fwnode_property_count_u8(const struct fwnode_handle *fwnode, | ||
| 199 | const char *propname) | ||
| 200 | { | ||
| 201 | return fwnode_property_read_u8_array(fwnode, propname, NULL, 0); | ||
| 202 | } | ||
| 203 | |||
| 204 | static inline int fwnode_property_count_u16(const struct fwnode_handle *fwnode, | ||
| 205 | const char *propname) | ||
| 206 | { | ||
| 207 | return fwnode_property_read_u16_array(fwnode, propname, NULL, 0); | ||
| 208 | } | ||
| 209 | |||
| 210 | static inline int fwnode_property_count_u32(const struct fwnode_handle *fwnode, | ||
| 211 | const char *propname) | ||
| 212 | { | ||
| 213 | return fwnode_property_read_u32_array(fwnode, propname, NULL, 0); | ||
| 214 | } | ||
| 215 | |||
| 216 | static inline int fwnode_property_count_u64(const struct fwnode_handle *fwnode, | ||
| 217 | const char *propname) | ||
| 218 | { | ||
| 219 | return fwnode_property_read_u64_array(fwnode, propname, NULL, 0); | ||
| 220 | } | ||
| 221 | |||
| 174 | /** | 222 | /** |
| 175 | * struct property_entry - "Built-in" device property representation. | 223 | * struct property_entry - "Built-in" device property representation. |
| 176 | * @name: Name of the property. | 224 | * @name: Name of the property. |
| @@ -329,7 +377,54 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, | |||
| 329 | /* -------------------------------------------------------------------------- */ | 377 | /* -------------------------------------------------------------------------- */ |
| 330 | /* Software fwnode support - when HW description is incomplete or missing */ | 378 | /* Software fwnode support - when HW description is incomplete or missing */ |
| 331 | 379 | ||
| 380 | struct software_node; | ||
| 381 | |||
| 382 | /** | ||
| 383 | * struct software_node_ref_args - Reference with additional arguments | ||
| 384 | * @node: Reference to a software node | ||
| 385 | * @nargs: Number of elements in @args array | ||
| 386 | * @args: Integer arguments | ||
| 387 | */ | ||
| 388 | struct software_node_ref_args { | ||
| 389 | const struct software_node *node; | ||
| 390 | unsigned int nargs; | ||
| 391 | u64 args[NR_FWNODE_REFERENCE_ARGS]; | ||
| 392 | }; | ||
| 393 | |||
| 394 | /** | ||
| 395 | * struct software_node_reference - Named software node reference property | ||
| 396 | * @name: Name of the property | ||
| 397 | * @nrefs: Number of elements in @refs array | ||
| 398 | * @refs: Array of references with optional arguments | ||
| 399 | */ | ||
| 400 | struct software_node_reference { | ||
| 401 | const char *name; | ||
| 402 | unsigned int nrefs; | ||
| 403 | const struct software_node_ref_args *refs; | ||
| 404 | }; | ||
| 405 | |||
| 406 | /** | ||
| 407 | * struct software_node - Software node description | ||
| 408 | * @name: Name of the software node | ||
| 409 | * @parent: Parent of the software node | ||
| 410 | * @properties: Array of device properties | ||
| 411 | * @references: Array of software node reference properties | ||
| 412 | */ | ||
| 413 | struct software_node { | ||
| 414 | const char *name; | ||
| 415 | const struct software_node *parent; | ||
| 416 | const struct property_entry *properties; | ||
| 417 | const struct software_node_reference *references; | ||
| 418 | }; | ||
| 419 | |||
| 332 | bool is_software_node(const struct fwnode_handle *fwnode); | 420 | bool is_software_node(const struct fwnode_handle *fwnode); |
| 421 | const struct software_node *to_software_node(struct fwnode_handle *fwnode); | ||
| 422 | struct fwnode_handle *software_node_fwnode(const struct software_node *node); | ||
| 423 | |||
| 424 | int software_node_register_nodes(const struct software_node *nodes); | ||
| 425 | void software_node_unregister_nodes(const struct software_node *nodes); | ||
| 426 | |||
| 427 | int software_node_register(const struct software_node *node); | ||
| 333 | 428 | ||
| 334 | int software_node_notify(struct device *dev, unsigned long action); | 429 | int software_node_notify(struct device *dev, unsigned long action); |
| 335 | 430 | ||
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h index 28eb9c792522..93cc4f1d444a 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h | |||
| @@ -213,6 +213,14 @@ extern void ptp_clock_event(struct ptp_clock *ptp, | |||
| 213 | extern int ptp_clock_index(struct ptp_clock *ptp); | 213 | extern int ptp_clock_index(struct ptp_clock *ptp); |
| 214 | 214 | ||
| 215 | /** | 215 | /** |
| 216 | * scaled_ppm_to_ppb() - convert scaled ppm to ppb | ||
| 217 | * | ||
| 218 | * @ppm: Parts per million, but with a 16 bit binary fractional field | ||
| 219 | */ | ||
| 220 | |||
| 221 | extern s32 scaled_ppm_to_ppb(long ppm); | ||
| 222 | |||
| 223 | /** | ||
| 216 | * ptp_find_pin() - obtain the pin index of a given auxiliary function | 224 | * ptp_find_pin() - obtain the pin index of a given auxiliary function |
| 217 | * | 225 | * |
| 218 | * @ptp: The clock obtained from ptp_clock_register(). | 226 | * @ptp: The clock obtained from ptp_clock_register(). |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index d5084ebd9f03..2a9df80ea887 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -355,7 +355,7 @@ static inline void user_single_step_report(struct pt_regs *regs) | |||
| 355 | info.si_code = SI_USER; | 355 | info.si_code = SI_USER; |
| 356 | info.si_pid = 0; | 356 | info.si_pid = 0; |
| 357 | info.si_uid = 0; | 357 | info.si_uid = 0; |
| 358 | force_sig_info(info.si_signo, &info, current); | 358 | force_sig_info(&info); |
| 359 | } | 359 | } |
| 360 | #endif | 360 | #endif |
| 361 | 361 | ||
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index eaa5c6e3fc9f..24632a7a7d11 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h | |||
| @@ -405,12 +405,16 @@ struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc, | |||
| 405 | const struct of_phandle_args *args); | 405 | const struct of_phandle_args *args); |
| 406 | 406 | ||
| 407 | struct pwm_device *pwm_get(struct device *dev, const char *con_id); | 407 | struct pwm_device *pwm_get(struct device *dev, const char *con_id); |
| 408 | struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id); | 408 | struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np, |
| 409 | const char *con_id); | ||
| 409 | void pwm_put(struct pwm_device *pwm); | 410 | void pwm_put(struct pwm_device *pwm); |
| 410 | 411 | ||
| 411 | struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id); | 412 | struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id); |
| 412 | struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np, | 413 | struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np, |
| 413 | const char *con_id); | 414 | const char *con_id); |
| 415 | struct pwm_device *devm_fwnode_pwm_get(struct device *dev, | ||
| 416 | struct fwnode_handle *fwnode, | ||
| 417 | const char *con_id); | ||
| 414 | void devm_pwm_put(struct device *dev, struct pwm_device *pwm); | 418 | void devm_pwm_put(struct device *dev, struct pwm_device *pwm); |
| 415 | #else | 419 | #else |
| 416 | static inline struct pwm_device *pwm_request(int pwm_id, const char *label) | 420 | static inline struct pwm_device *pwm_request(int pwm_id, const char *label) |
| @@ -493,7 +497,8 @@ static inline struct pwm_device *pwm_get(struct device *dev, | |||
| 493 | return ERR_PTR(-ENODEV); | 497 | return ERR_PTR(-ENODEV); |
| 494 | } | 498 | } |
| 495 | 499 | ||
| 496 | static inline struct pwm_device *of_pwm_get(struct device_node *np, | 500 | static inline struct pwm_device *of_pwm_get(struct device *dev, |
| 501 | struct device_node *np, | ||
| 497 | const char *con_id) | 502 | const char *con_id) |
| 498 | { | 503 | { |
| 499 | return ERR_PTR(-ENODEV); | 504 | return ERR_PTR(-ENODEV); |
| @@ -516,6 +521,13 @@ static inline struct pwm_device *devm_of_pwm_get(struct device *dev, | |||
| 516 | return ERR_PTR(-ENODEV); | 521 | return ERR_PTR(-ENODEV); |
| 517 | } | 522 | } |
| 518 | 523 | ||
| 524 | static inline struct pwm_device * | ||
| 525 | devm_fwnode_pwm_get(struct device *dev, struct fwnode_handle *fwnode, | ||
| 526 | const char *con_id) | ||
| 527 | { | ||
| 528 | return ERR_PTR(-ENODEV); | ||
| 529 | } | ||
| 530 | |||
| 519 | static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm) | 531 | static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm) |
| 520 | { | 532 | { |
| 521 | } | 533 | } |
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h index 48841e5dab90..eef02e64b422 100644 --- a/include/linux/qed/qed_if.h +++ b/include/linux/qed/qed_if.h | |||
| @@ -907,7 +907,8 @@ struct qed_common_ops { | |||
| 907 | 907 | ||
| 908 | u32 (*sb_release)(struct qed_dev *cdev, | 908 | u32 (*sb_release)(struct qed_dev *cdev, |
| 909 | struct qed_sb_info *sb_info, | 909 | struct qed_sb_info *sb_info, |
| 910 | u16 sb_id); | 910 | u16 sb_id, |
| 911 | enum qed_sb_type type); | ||
| 911 | 912 | ||
| 912 | void (*simd_handler_config)(struct qed_dev *cdev, | 913 | void (*simd_handler_config)(struct qed_dev *cdev, |
| 913 | void *token, | 914 | void *token, |
| @@ -1123,6 +1124,13 @@ struct qed_common_ops { | |||
| 1123 | */ | 1124 | */ |
| 1124 | int (*read_module_eeprom)(struct qed_dev *cdev, | 1125 | int (*read_module_eeprom)(struct qed_dev *cdev, |
| 1125 | char *buf, u8 dev_addr, u32 offset, u32 len); | 1126 | char *buf, u8 dev_addr, u32 offset, u32 len); |
| 1127 | |||
| 1128 | /** | ||
| 1129 | * @brief get_affin_hwfn_idx | ||
| 1130 | * | ||
| 1131 | * @param cdev | ||
| 1132 | */ | ||
| 1133 | u8 (*get_affin_hwfn_idx)(struct qed_dev *cdev); | ||
| 1126 | }; | 1134 | }; |
| 1127 | 1135 | ||
| 1128 | #define MASK_FIELD(_name, _value) \ | 1136 | #define MASK_FIELD(_name, _value) \ |
diff --git a/include/linux/qed/qed_rdma_if.h b/include/linux/qed/qed_rdma_if.h index d15f8e4815e3..898f595ea3d6 100644 --- a/include/linux/qed/qed_rdma_if.h +++ b/include/linux/qed/qed_rdma_if.h | |||
| @@ -670,6 +670,8 @@ struct qed_rdma_ops { | |||
| 670 | int (*ll2_set_mac_filter)(struct qed_dev *cdev, | 670 | int (*ll2_set_mac_filter)(struct qed_dev *cdev, |
| 671 | u8 *old_mac_address, u8 *new_mac_address); | 671 | u8 *old_mac_address, u8 *new_mac_address); |
| 672 | 672 | ||
| 673 | int (*iwarp_set_engine_affin)(struct qed_dev *cdev, bool b_reset); | ||
| 674 | |||
| 673 | int (*iwarp_connect)(void *rdma_cxt, | 675 | int (*iwarp_connect)(void *rdma_cxt, |
| 674 | struct qed_iwarp_connect_in *iparams, | 676 | struct qed_iwarp_connect_in *iparams, |
| 675 | struct qed_iwarp_connect_out *oparams); | 677 | struct qed_iwarp_connect_out *oparams); |
diff --git a/include/linux/rcu_sync.h b/include/linux/rcu_sync.h index 6fc53a1345b3..9b83865d24f9 100644 --- a/include/linux/rcu_sync.h +++ b/include/linux/rcu_sync.h | |||
| @@ -13,62 +13,44 @@ | |||
| 13 | #include <linux/wait.h> | 13 | #include <linux/wait.h> |
| 14 | #include <linux/rcupdate.h> | 14 | #include <linux/rcupdate.h> |
| 15 | 15 | ||
| 16 | enum rcu_sync_type { RCU_SYNC, RCU_SCHED_SYNC, RCU_BH_SYNC }; | ||
| 17 | |||
| 18 | /* Structure to mediate between updaters and fastpath-using readers. */ | 16 | /* Structure to mediate between updaters and fastpath-using readers. */ |
| 19 | struct rcu_sync { | 17 | struct rcu_sync { |
| 20 | int gp_state; | 18 | int gp_state; |
| 21 | int gp_count; | 19 | int gp_count; |
| 22 | wait_queue_head_t gp_wait; | 20 | wait_queue_head_t gp_wait; |
| 23 | 21 | ||
| 24 | int cb_state; | ||
| 25 | struct rcu_head cb_head; | 22 | struct rcu_head cb_head; |
| 26 | |||
| 27 | enum rcu_sync_type gp_type; | ||
| 28 | }; | 23 | }; |
| 29 | 24 | ||
| 30 | extern void rcu_sync_lockdep_assert(struct rcu_sync *); | ||
| 31 | |||
| 32 | /** | 25 | /** |
| 33 | * rcu_sync_is_idle() - Are readers permitted to use their fastpaths? | 26 | * rcu_sync_is_idle() - Are readers permitted to use their fastpaths? |
| 34 | * @rsp: Pointer to rcu_sync structure to use for synchronization | 27 | * @rsp: Pointer to rcu_sync structure to use for synchronization |
| 35 | * | 28 | * |
| 36 | * Returns true if readers are permitted to use their fastpaths. | 29 | * Returns true if readers are permitted to use their fastpaths. Must be |
| 37 | * Must be invoked within an RCU read-side critical section whose | 30 | * invoked within some flavor of RCU read-side critical section. |
| 38 | * flavor matches that of the rcu_sync struture. | ||
| 39 | */ | 31 | */ |
| 40 | static inline bool rcu_sync_is_idle(struct rcu_sync *rsp) | 32 | static inline bool rcu_sync_is_idle(struct rcu_sync *rsp) |
| 41 | { | 33 | { |
| 42 | #ifdef CONFIG_PROVE_RCU | 34 | RCU_LOCKDEP_WARN(!rcu_read_lock_held() && |
| 43 | rcu_sync_lockdep_assert(rsp); | 35 | !rcu_read_lock_bh_held() && |
| 44 | #endif | 36 | !rcu_read_lock_sched_held(), |
| 45 | return !rsp->gp_state; /* GP_IDLE */ | 37 | "suspicious rcu_sync_is_idle() usage"); |
| 38 | return !READ_ONCE(rsp->gp_state); /* GP_IDLE */ | ||
| 46 | } | 39 | } |
| 47 | 40 | ||
| 48 | extern void rcu_sync_init(struct rcu_sync *, enum rcu_sync_type); | 41 | extern void rcu_sync_init(struct rcu_sync *); |
| 49 | extern void rcu_sync_enter_start(struct rcu_sync *); | 42 | extern void rcu_sync_enter_start(struct rcu_sync *); |
| 50 | extern void rcu_sync_enter(struct rcu_sync *); | 43 | extern void rcu_sync_enter(struct rcu_sync *); |
| 51 | extern void rcu_sync_exit(struct rcu_sync *); | 44 | extern void rcu_sync_exit(struct rcu_sync *); |
| 52 | extern void rcu_sync_dtor(struct rcu_sync *); | 45 | extern void rcu_sync_dtor(struct rcu_sync *); |
| 53 | 46 | ||
| 54 | #define __RCU_SYNC_INITIALIZER(name, type) { \ | 47 | #define __RCU_SYNC_INITIALIZER(name) { \ |
| 55 | .gp_state = 0, \ | 48 | .gp_state = 0, \ |
| 56 | .gp_count = 0, \ | 49 | .gp_count = 0, \ |
| 57 | .gp_wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.gp_wait), \ | 50 | .gp_wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.gp_wait), \ |
| 58 | .cb_state = 0, \ | ||
| 59 | .gp_type = type, \ | ||
| 60 | } | 51 | } |
| 61 | 52 | ||
| 62 | #define __DEFINE_RCU_SYNC(name, type) \ | 53 | #define DEFINE_RCU_SYNC(name) \ |
| 63 | struct rcu_sync_struct name = __RCU_SYNC_INITIALIZER(name, type) | 54 | struct rcu_sync name = __RCU_SYNC_INITIALIZER(name) |
| 64 | |||
| 65 | #define DEFINE_RCU_SYNC(name) \ | ||
| 66 | __DEFINE_RCU_SYNC(name, RCU_SYNC) | ||
| 67 | |||
| 68 | #define DEFINE_RCU_SCHED_SYNC(name) \ | ||
| 69 | __DEFINE_RCU_SYNC(name, RCU_SCHED_SYNC) | ||
| 70 | |||
| 71 | #define DEFINE_RCU_BH_SYNC(name) \ | ||
| 72 | __DEFINE_RCU_SYNC(name, RCU_BH_SYNC) | ||
| 73 | 55 | ||
| 74 | #endif /* _LINUX_RCU_SYNC_H_ */ | 56 | #endif /* _LINUX_RCU_SYNC_H_ */ |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index b25d20822e75..8f7167478c1d 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -365,16 +365,15 @@ static inline void rcu_preempt_sleep_check(void) { } | |||
| 365 | * other macros that it invokes. | 365 | * other macros that it invokes. |
| 366 | */ | 366 | */ |
| 367 | #define rcu_assign_pointer(p, v) \ | 367 | #define rcu_assign_pointer(p, v) \ |
| 368 | ({ \ | 368 | do { \ |
| 369 | uintptr_t _r_a_p__v = (uintptr_t)(v); \ | 369 | uintptr_t _r_a_p__v = (uintptr_t)(v); \ |
| 370 | rcu_check_sparse(p, __rcu); \ | 370 | rcu_check_sparse(p, __rcu); \ |
| 371 | \ | 371 | \ |
| 372 | if (__builtin_constant_p(v) && (_r_a_p__v) == (uintptr_t)NULL) \ | 372 | if (__builtin_constant_p(v) && (_r_a_p__v) == (uintptr_t)NULL) \ |
| 373 | WRITE_ONCE((p), (typeof(p))(_r_a_p__v)); \ | 373 | WRITE_ONCE((p), (typeof(p))(_r_a_p__v)); \ |
| 374 | else \ | 374 | else \ |
| 375 | smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \ | 375 | smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \ |
| 376 | _r_a_p__v; \ | 376 | } while (0) |
| 377 | }) | ||
| 378 | 377 | ||
| 379 | /** | 378 | /** |
| 380 | * rcu_swap_protected() - swap an RCU and a regular pointer | 379 | * rcu_swap_protected() - swap an RCU and a regular pointer |
| @@ -586,7 +585,7 @@ static inline void rcu_preempt_sleep_check(void) { } | |||
| 586 | * read-side critical sections may be preempted and they may also block, but | 585 | * read-side critical sections may be preempted and they may also block, but |
| 587 | * only when acquiring spinlocks that are subject to priority inheritance. | 586 | * only when acquiring spinlocks that are subject to priority inheritance. |
| 588 | */ | 587 | */ |
| 589 | static inline void rcu_read_lock(void) | 588 | static __always_inline void rcu_read_lock(void) |
| 590 | { | 589 | { |
| 591 | __rcu_read_lock(); | 590 | __rcu_read_lock(); |
| 592 | __acquire(RCU); | 591 | __acquire(RCU); |
| @@ -803,7 +802,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
| 803 | /** | 802 | /** |
| 804 | * kfree_rcu() - kfree an object after a grace period. | 803 | * kfree_rcu() - kfree an object after a grace period. |
| 805 | * @ptr: pointer to kfree | 804 | * @ptr: pointer to kfree |
| 806 | * @rcu_head: the name of the struct rcu_head within the type of @ptr. | 805 | * @rhf: the name of the struct rcu_head within the type of @ptr. |
| 807 | * | 806 | * |
| 808 | * Many rcu callbacks functions just call kfree() on the base structure. | 807 | * Many rcu callbacks functions just call kfree() on the base structure. |
| 809 | * These functions are trivial, but their size adds up, and furthermore | 808 | * These functions are trivial, but their size adds up, and furthermore |
| @@ -826,9 +825,13 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
| 826 | * The BUILD_BUG_ON check must not involve any function calls, hence the | 825 | * The BUILD_BUG_ON check must not involve any function calls, hence the |
| 827 | * checks are done in macros here. | 826 | * checks are done in macros here. |
| 828 | */ | 827 | */ |
| 829 | #define kfree_rcu(ptr, rcu_head) \ | 828 | #define kfree_rcu(ptr, rhf) \ |
| 830 | __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) | 829 | do { \ |
| 831 | 830 | typeof (ptr) ___p = (ptr); \ | |
| 831 | \ | ||
| 832 | if (___p) \ | ||
| 833 | __kfree_rcu(&((___p)->rhf), offsetof(typeof(*(ptr)), rhf)); \ | ||
| 834 | } while (0) | ||
| 832 | 835 | ||
| 833 | /* | 836 | /* |
| 834 | * Place this after a lock-acquisition primitive to guarantee that | 837 | * Place this after a lock-acquisition primitive to guarantee that |
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index d3dea823af8e..dfe493ac692d 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
| @@ -22,6 +22,7 @@ struct module; | |||
| 22 | struct clk; | 22 | struct clk; |
| 23 | struct device; | 23 | struct device; |
| 24 | struct i2c_client; | 24 | struct i2c_client; |
| 25 | struct i3c_device; | ||
| 25 | struct irq_domain; | 26 | struct irq_domain; |
| 26 | struct slim_device; | 27 | struct slim_device; |
| 27 | struct spi_device; | 28 | struct spi_device; |
| @@ -109,7 +110,7 @@ struct reg_sequence { | |||
| 109 | * @cond: Break condition (usually involving @val) | 110 | * @cond: Break condition (usually involving @val) |
| 110 | * @sleep_us: Maximum time to sleep between reads in us (0 | 111 | * @sleep_us: Maximum time to sleep between reads in us (0 |
| 111 | * tight-loops). Should be less than ~20ms since usleep_range | 112 | * tight-loops). Should be less than ~20ms since usleep_range |
| 112 | * is used (see Documentation/timers/timers-howto.txt). | 113 | * is used (see Documentation/timers/timers-howto.rst). |
| 113 | * @timeout_us: Timeout in us, 0 means never timeout | 114 | * @timeout_us: Timeout in us, 0 means never timeout |
| 114 | * | 115 | * |
| 115 | * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read | 116 | * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read |
| @@ -151,7 +152,7 @@ struct reg_sequence { | |||
| 151 | * @cond: Break condition (usually involving @val) | 152 | * @cond: Break condition (usually involving @val) |
| 152 | * @sleep_us: Maximum time to sleep between reads in us (0 | 153 | * @sleep_us: Maximum time to sleep between reads in us (0 |
| 153 | * tight-loops). Should be less than ~20ms since usleep_range | 154 | * tight-loops). Should be less than ~20ms since usleep_range |
| 154 | * is used (see Documentation/timers/timers-howto.txt). | 155 | * is used (see Documentation/timers/timers-howto.rst). |
| 155 | * @timeout_us: Timeout in us, 0 means never timeout | 156 | * @timeout_us: Timeout in us, 0 means never timeout |
| 156 | * | 157 | * |
| 157 | * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read | 158 | * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read |
| @@ -621,6 +622,10 @@ struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus, | |||
| 621 | const struct regmap_config *config, | 622 | const struct regmap_config *config, |
| 622 | struct lock_class_key *lock_key, | 623 | struct lock_class_key *lock_key, |
| 623 | const char *lock_name); | 624 | const char *lock_name); |
| 625 | struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c, | ||
| 626 | const struct regmap_config *config, | ||
| 627 | struct lock_class_key *lock_key, | ||
| 628 | const char *lock_name); | ||
| 624 | /* | 629 | /* |
| 625 | * Wrapper for regmap_init macros to include a unique lockdep key and name | 630 | * Wrapper for regmap_init macros to include a unique lockdep key and name |
| 626 | * for each call. No-op if CONFIG_LOCKDEP is not set. | 631 | * for each call. No-op if CONFIG_LOCKDEP is not set. |
| @@ -979,6 +984,21 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
| 979 | #define devm_regmap_init_slimbus(slimbus, config) \ | 984 | #define devm_regmap_init_slimbus(slimbus, config) \ |
| 980 | __regmap_lockdep_wrapper(__devm_regmap_init_slimbus, #config, \ | 985 | __regmap_lockdep_wrapper(__devm_regmap_init_slimbus, #config, \ |
| 981 | slimbus, config) | 986 | slimbus, config) |
| 987 | |||
| 988 | /** | ||
| 989 | * devm_regmap_init_i3c() - Initialise managed register map | ||
| 990 | * | ||
| 991 | * @i3c: Device that will be interacted with | ||
| 992 | * @config: Configuration for register map | ||
| 993 | * | ||
| 994 | * The return value will be an ERR_PTR() on error or a valid pointer | ||
| 995 | * to a struct regmap. The regmap will be automatically freed by the | ||
| 996 | * device management code. | ||
| 997 | */ | ||
| 998 | #define devm_regmap_init_i3c(i3c, config) \ | ||
| 999 | __regmap_lockdep_wrapper(__devm_regmap_init_i3c, #config, \ | ||
| 1000 | i3c, config) | ||
| 1001 | |||
| 982 | int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk); | 1002 | int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk); |
| 983 | void regmap_mmio_detach_clk(struct regmap *map); | 1003 | void regmap_mmio_detach_clk(struct regmap *map); |
| 984 | void regmap_exit(struct regmap *map); | 1004 | void regmap_exit(struct regmap *map); |
diff --git a/include/linux/regulator/coupler.h b/include/linux/regulator/coupler.h new file mode 100644 index 000000000000..0212d6255e4e --- /dev/null +++ b/include/linux/regulator/coupler.h | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * coupler.h -- SoC Regulator support, coupler API. | ||
| 4 | * | ||
| 5 | * Regulator Coupler Interface. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef __LINUX_REGULATOR_COUPLER_H_ | ||
| 9 | #define __LINUX_REGULATOR_COUPLER_H_ | ||
| 10 | |||
| 11 | #include <linux/kernel.h> | ||
| 12 | #include <linux/suspend.h> | ||
| 13 | |||
| 14 | struct regulator_coupler; | ||
| 15 | struct regulator_dev; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * struct regulator_coupler - customized regulator's coupler | ||
| 19 | * | ||
| 20 | * Regulator's coupler allows to customize coupling algorithm. | ||
| 21 | * | ||
| 22 | * @list: couplers list entry | ||
| 23 | * @attach_regulator: Callback invoked on creation of a coupled regulator, | ||
| 24 | * couples are unresolved at this point. The callee should | ||
| 25 | * check that it could handle the regulator and return 0 on | ||
| 26 | * success, -errno on failure and 1 if given regulator is | ||
| 27 | * not suitable for this coupler (case of having multiple | ||
| 28 | * regulators in a system). Callback shall be implemented. | ||
| 29 | * @detach_regulator: Callback invoked on destruction of a coupled regulator. | ||
| 30 | * This callback is optional and could be NULL. | ||
| 31 | * @balance_voltage: Callback invoked when voltage of a coupled regulator is | ||
| 32 | * changing. Called with all of the coupled rdev's being held | ||
| 33 | * under "consumer lock". The callee should perform voltage | ||
| 34 | * balancing, changing voltage of the coupled regulators as | ||
| 35 | * needed. It's up to the coupler to verify the voltage | ||
| 36 | * before changing it in hardware, i.e. coupler should | ||
| 37 | * check consumer's min/max and etc. This callback is | ||
| 38 | * optional and could be NULL, in which case a generic | ||
| 39 | * voltage balancer will be used. | ||
| 40 | */ | ||
| 41 | struct regulator_coupler { | ||
| 42 | struct list_head list; | ||
| 43 | |||
| 44 | int (*attach_regulator)(struct regulator_coupler *coupler, | ||
| 45 | struct regulator_dev *rdev); | ||
| 46 | int (*detach_regulator)(struct regulator_coupler *coupler, | ||
| 47 | struct regulator_dev *rdev); | ||
| 48 | int (*balance_voltage)(struct regulator_coupler *coupler, | ||
| 49 | struct regulator_dev *rdev, | ||
| 50 | suspend_state_t state); | ||
| 51 | }; | ||
| 52 | |||
| 53 | #ifdef CONFIG_REGULATOR | ||
| 54 | int regulator_coupler_register(struct regulator_coupler *coupler); | ||
| 55 | const char *rdev_get_name(struct regulator_dev *rdev); | ||
| 56 | int regulator_check_consumers(struct regulator_dev *rdev, | ||
| 57 | int *min_uV, int *max_uV, | ||
| 58 | suspend_state_t state); | ||
| 59 | int regulator_check_voltage(struct regulator_dev *rdev, | ||
| 60 | int *min_uV, int *max_uV); | ||
| 61 | int regulator_get_voltage_rdev(struct regulator_dev *rdev); | ||
| 62 | int regulator_set_voltage_rdev(struct regulator_dev *rdev, | ||
| 63 | int min_uV, int max_uV, | ||
| 64 | suspend_state_t state); | ||
| 65 | #else | ||
| 66 | static inline int regulator_coupler_register(struct regulator_coupler *coupler) | ||
| 67 | { | ||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | static inline const char *rdev_get_name(struct regulator_dev *rdev) | ||
| 71 | { | ||
| 72 | return NULL; | ||
| 73 | } | ||
| 74 | static inline int regulator_check_consumers(struct regulator_dev *rdev, | ||
| 75 | int *min_uV, int *max_uV, | ||
| 76 | suspend_state_t state) | ||
| 77 | { | ||
| 78 | return -EINVAL; | ||
| 79 | } | ||
| 80 | static inline int regulator_check_voltage(struct regulator_dev *rdev, | ||
| 81 | int *min_uV, int *max_uV) | ||
| 82 | { | ||
| 83 | return -EINVAL; | ||
| 84 | } | ||
| 85 | static inline int regulator_get_voltage_rdev(struct regulator_dev *rdev) | ||
| 86 | { | ||
| 87 | return -EINVAL; | ||
| 88 | } | ||
| 89 | static inline int regulator_set_voltage_rdev(struct regulator_dev *rdev, | ||
| 90 | int min_uV, int max_uV, | ||
| 91 | suspend_state_t state) | ||
| 92 | { | ||
| 93 | return -EINVAL; | ||
| 94 | } | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #endif | ||
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index d45ab52c91c9..9a911bb5fb61 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -12,8 +12,6 @@ | |||
| 12 | #ifndef __LINUX_REGULATOR_DRIVER_H_ | 12 | #ifndef __LINUX_REGULATOR_DRIVER_H_ |
| 13 | #define __LINUX_REGULATOR_DRIVER_H_ | 13 | #define __LINUX_REGULATOR_DRIVER_H_ |
| 14 | 14 | ||
| 15 | #define MAX_COUPLED 2 | ||
| 16 | |||
| 17 | #include <linux/device.h> | 15 | #include <linux/device.h> |
| 18 | #include <linux/notifier.h> | 16 | #include <linux/notifier.h> |
| 19 | #include <linux/regulator/consumer.h> | 17 | #include <linux/regulator/consumer.h> |
| @@ -283,6 +281,11 @@ enum regulator_type { | |||
| 283 | * @vsel_range_mask: Mask for register bitfield used for range selector | 281 | * @vsel_range_mask: Mask for register bitfield used for range selector |
| 284 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ | 282 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ |
| 285 | * @vsel_mask: Mask for register bitfield used for selector | 283 | * @vsel_mask: Mask for register bitfield used for selector |
| 284 | * @vsel_step: Specify the resolution of selector stepping when setting | ||
| 285 | * voltage. If 0, then no stepping is done (requested selector is | ||
| 286 | * set directly), if >0 then the regulator API will ramp the | ||
| 287 | * voltage up/down gradually each time increasing/decreasing the | ||
| 288 | * selector by the specified step value. | ||
| 286 | * @csel_reg: Register for current limit selector using regmap set_current_limit | 289 | * @csel_reg: Register for current limit selector using regmap set_current_limit |
| 287 | * @csel_mask: Mask for register bitfield used for current limit selector | 290 | * @csel_mask: Mask for register bitfield used for current limit selector |
| 288 | * @apply_reg: Register for initiate voltage change on the output when | 291 | * @apply_reg: Register for initiate voltage change on the output when |
| @@ -357,6 +360,7 @@ struct regulator_desc { | |||
| 357 | unsigned int vsel_range_mask; | 360 | unsigned int vsel_range_mask; |
| 358 | unsigned int vsel_reg; | 361 | unsigned int vsel_reg; |
| 359 | unsigned int vsel_mask; | 362 | unsigned int vsel_mask; |
| 363 | unsigned int vsel_step; | ||
| 360 | unsigned int csel_reg; | 364 | unsigned int csel_reg; |
| 361 | unsigned int csel_mask; | 365 | unsigned int csel_mask; |
| 362 | unsigned int apply_reg; | 366 | unsigned int apply_reg; |
| @@ -423,7 +427,8 @@ struct regulator_config { | |||
| 423 | * incremented. | 427 | * incremented. |
| 424 | */ | 428 | */ |
| 425 | struct coupling_desc { | 429 | struct coupling_desc { |
| 426 | struct regulator_dev *coupled_rdevs[MAX_COUPLED]; | 430 | struct regulator_dev **coupled_rdevs; |
| 431 | struct regulator_coupler *coupler; | ||
| 427 | int n_resolved; | 432 | int n_resolved; |
| 428 | int n_coupled; | 433 | int n_coupled; |
| 429 | }; | 434 | }; |
| @@ -549,4 +554,5 @@ void regulator_unlock(struct regulator_dev *rdev); | |||
| 549 | */ | 554 | */ |
| 550 | int regulator_desc_list_voltage_linear_range(const struct regulator_desc *desc, | 555 | int regulator_desc_list_voltage_linear_range(const struct regulator_desc *desc, |
| 551 | unsigned int selector); | 556 | unsigned int selector); |
| 557 | |||
| 552 | #endif | 558 | #endif |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 5539efa76d26..a84cc8879c3e 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
| @@ -153,7 +153,7 @@ struct regulation_constraints { | |||
| 153 | int system_load; | 153 | int system_load; |
| 154 | 154 | ||
| 155 | /* used for coupled regulators */ | 155 | /* used for coupled regulators */ |
| 156 | int max_spread; | 156 | u32 *max_spread; |
| 157 | 157 | ||
| 158 | /* used for changing voltage in steps */ | 158 | /* used for changing voltage in steps */ |
| 159 | int max_uV_step; | 159 | int max_uV_step; |
diff --git a/include/linux/regulator/max8952.h b/include/linux/regulator/max8952.h index ebd99d2e62ad..8712c091abf0 100644 --- a/include/linux/regulator/max8952.h +++ b/include/linux/regulator/max8952.h | |||
| @@ -105,9 +105,6 @@ enum { | |||
| 105 | #define MAX8952_NUM_DVS_MODE 4 | 105 | #define MAX8952_NUM_DVS_MODE 4 |
| 106 | 106 | ||
| 107 | struct max8952_platform_data { | 107 | struct max8952_platform_data { |
| 108 | int gpio_vid0; | ||
| 109 | int gpio_vid1; | ||
| 110 | |||
| 111 | u32 default_mode; | 108 | u32 default_mode; |
| 112 | u32 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */ | 109 | u32 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */ |
| 113 | 110 | ||
diff --git a/include/linux/reservation.h b/include/linux/reservation.h index ee750765cc94..644a22dbe53b 100644 --- a/include/linux/reservation.h +++ b/include/linux/reservation.h | |||
| @@ -216,8 +216,12 @@ reservation_object_unlock(struct reservation_object *obj) | |||
| 216 | { | 216 | { |
| 217 | #ifdef CONFIG_DEBUG_MUTEXES | 217 | #ifdef CONFIG_DEBUG_MUTEXES |
| 218 | /* Test shared fence slot reservation */ | 218 | /* Test shared fence slot reservation */ |
| 219 | if (obj->fence) | 219 | if (rcu_access_pointer(obj->fence)) { |
| 220 | obj->fence->shared_max = obj->fence->shared_count; | 220 | struct reservation_object_list *fence = |
| 221 | reservation_object_get_list(obj); | ||
| 222 | |||
| 223 | fence->shared_max = fence->shared_count; | ||
| 224 | } | ||
| 221 | #endif | 225 | #endif |
| 222 | ww_mutex_unlock(&obj->lock); | 226 | ww_mutex_unlock(&obj->lock); |
| 223 | } | 227 | } |
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index 9f8bc06d4136..beb9a9da1699 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h | |||
| @@ -352,37 +352,38 @@ static inline void rht_unlock(struct bucket_table *tbl, | |||
| 352 | static inline struct rhash_head __rcu *__rht_ptr( | 352 | static inline struct rhash_head __rcu *__rht_ptr( |
| 353 | struct rhash_lock_head *const *bkt) | 353 | struct rhash_lock_head *const *bkt) |
| 354 | { | 354 | { |
| 355 | return (struct rhash_head __rcu *)((unsigned long)*bkt & ~BIT(0)); | 355 | return (struct rhash_head __rcu *) |
| 356 | ((unsigned long)*bkt & ~BIT(0) ?: | ||
| 357 | (unsigned long)RHT_NULLS_MARKER(bkt)); | ||
| 356 | } | 358 | } |
| 357 | 359 | ||
| 358 | /* | 360 | /* |
| 359 | * Where 'bkt' is a bucket and might be locked: | 361 | * Where 'bkt' is a bucket and might be locked: |
| 360 | * rht_ptr() dereferences that pointer and clears the lock bit. | 362 | * rht_ptr_rcu() dereferences that pointer and clears the lock bit. |
| 363 | * rht_ptr() dereferences in a context where the bucket is locked. | ||
| 361 | * rht_ptr_exclusive() dereferences in a context where exclusive | 364 | * rht_ptr_exclusive() dereferences in a context where exclusive |
| 362 | * access is guaranteed, such as when destroying the table. | 365 | * access is guaranteed, such as when destroying the table. |
| 363 | */ | 366 | */ |
| 367 | static inline struct rhash_head *rht_ptr_rcu( | ||
| 368 | struct rhash_lock_head *const *bkt) | ||
| 369 | { | ||
| 370 | struct rhash_head __rcu *p = __rht_ptr(bkt); | ||
| 371 | |||
| 372 | return rcu_dereference(p); | ||
| 373 | } | ||
| 374 | |||
| 364 | static inline struct rhash_head *rht_ptr( | 375 | static inline struct rhash_head *rht_ptr( |
| 365 | struct rhash_lock_head *const *bkt, | 376 | struct rhash_lock_head *const *bkt, |
| 366 | struct bucket_table *tbl, | 377 | struct bucket_table *tbl, |
| 367 | unsigned int hash) | 378 | unsigned int hash) |
| 368 | { | 379 | { |
| 369 | struct rhash_head __rcu *p = __rht_ptr(bkt); | 380 | return rht_dereference_bucket(__rht_ptr(bkt), tbl, hash); |
| 370 | |||
| 371 | if (!p) | ||
| 372 | return RHT_NULLS_MARKER(bkt); | ||
| 373 | |||
| 374 | return rht_dereference_bucket_rcu(p, tbl, hash); | ||
| 375 | } | 381 | } |
| 376 | 382 | ||
| 377 | static inline struct rhash_head *rht_ptr_exclusive( | 383 | static inline struct rhash_head *rht_ptr_exclusive( |
| 378 | struct rhash_lock_head *const *bkt) | 384 | struct rhash_lock_head *const *bkt) |
| 379 | { | 385 | { |
| 380 | struct rhash_head __rcu *p = __rht_ptr(bkt); | 386 | return rcu_dereference_protected(__rht_ptr(bkt), 1); |
| 381 | |||
| 382 | if (!p) | ||
| 383 | return RHT_NULLS_MARKER(bkt); | ||
| 384 | |||
| 385 | return rcu_dereference_protected(p, 1); | ||
| 386 | } | 387 | } |
| 387 | 388 | ||
| 388 | static inline void rht_assign_locked(struct rhash_lock_head **bkt, | 389 | static inline void rht_assign_locked(struct rhash_lock_head **bkt, |
| @@ -509,7 +510,7 @@ static inline void rht_assign_unlock(struct bucket_table *tbl, | |||
| 509 | */ | 510 | */ |
| 510 | #define rht_for_each_rcu(pos, tbl, hash) \ | 511 | #define rht_for_each_rcu(pos, tbl, hash) \ |
| 511 | for (({barrier(); }), \ | 512 | for (({barrier(); }), \ |
| 512 | pos = rht_ptr(rht_bucket(tbl, hash), tbl, hash); \ | 513 | pos = rht_ptr_rcu(rht_bucket(tbl, hash)); \ |
| 513 | !rht_is_a_nulls(pos); \ | 514 | !rht_is_a_nulls(pos); \ |
| 514 | pos = rcu_dereference_raw(pos->next)) | 515 | pos = rcu_dereference_raw(pos->next)) |
| 515 | 516 | ||
| @@ -546,8 +547,7 @@ static inline void rht_assign_unlock(struct bucket_table *tbl, | |||
| 546 | */ | 547 | */ |
| 547 | #define rht_for_each_entry_rcu(tpos, pos, tbl, hash, member) \ | 548 | #define rht_for_each_entry_rcu(tpos, pos, tbl, hash, member) \ |
| 548 | rht_for_each_entry_rcu_from(tpos, pos, \ | 549 | rht_for_each_entry_rcu_from(tpos, pos, \ |
| 549 | rht_ptr(rht_bucket(tbl, hash), \ | 550 | rht_ptr_rcu(rht_bucket(tbl, hash)), \ |
| 550 | tbl, hash), \ | ||
| 551 | tbl, hash, member) | 551 | tbl, hash, member) |
| 552 | 552 | ||
| 553 | /** | 553 | /** |
| @@ -603,7 +603,7 @@ restart: | |||
| 603 | hash = rht_key_hashfn(ht, tbl, key, params); | 603 | hash = rht_key_hashfn(ht, tbl, key, params); |
| 604 | bkt = rht_bucket(tbl, hash); | 604 | bkt = rht_bucket(tbl, hash); |
| 605 | do { | 605 | do { |
| 606 | rht_for_each_rcu_from(he, rht_ptr(bkt, tbl, hash), tbl, hash) { | 606 | rht_for_each_rcu_from(he, rht_ptr_rcu(bkt), tbl, hash) { |
| 607 | if (params.obj_cmpfn ? | 607 | if (params.obj_cmpfn ? |
| 608 | params.obj_cmpfn(&arg, rht_obj(ht, he)) : | 608 | params.obj_cmpfn(&arg, rht_obj(ht, he)) : |
| 609 | rhashtable_compare(&arg, rht_obj(ht, he))) | 609 | rhashtable_compare(&arg, rht_obj(ht, he))) |
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 2ea18a3def04..9d9c663987d8 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h | |||
| @@ -34,12 +34,13 @@ | |||
| 34 | */ | 34 | */ |
| 35 | struct rw_semaphore { | 35 | struct rw_semaphore { |
| 36 | atomic_long_t count; | 36 | atomic_long_t count; |
| 37 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER | ||
| 38 | /* | 37 | /* |
| 39 | * Write owner. Used as a speculative check to see | 38 | * Write owner or one of the read owners as well flags regarding |
| 40 | * if the owner is running on the cpu. | 39 | * the current state of the rwsem. Can be used as a speculative |
| 40 | * check to see if the write owner is running on the cpu. | ||
| 41 | */ | 41 | */ |
| 42 | struct task_struct *owner; | 42 | atomic_long_t owner; |
| 43 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER | ||
| 43 | struct optimistic_spin_queue osq; /* spinner MCS lock */ | 44 | struct optimistic_spin_queue osq; /* spinner MCS lock */ |
| 44 | #endif | 45 | #endif |
| 45 | raw_spinlock_t wait_lock; | 46 | raw_spinlock_t wait_lock; |
| @@ -50,10 +51,10 @@ struct rw_semaphore { | |||
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | /* | 53 | /* |
| 53 | * Setting bit 1 of the owner field but not bit 0 will indicate | 54 | * Setting all bits of the owner field except bit 0 will indicate |
| 54 | * that the rwsem is writer-owned with an unknown owner. | 55 | * that the rwsem is writer-owned with an unknown owner. |
| 55 | */ | 56 | */ |
| 56 | #define RWSEM_OWNER_UNKNOWN ((struct task_struct *)-2L) | 57 | #define RWSEM_OWNER_UNKNOWN (-2L) |
| 57 | 58 | ||
| 58 | /* In all implementations count != 0 means locked */ | 59 | /* In all implementations count != 0 means locked */ |
| 59 | static inline int rwsem_is_locked(struct rw_semaphore *sem) | 60 | static inline int rwsem_is_locked(struct rw_semaphore *sem) |
| @@ -73,13 +74,14 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) | |||
| 73 | #endif | 74 | #endif |
| 74 | 75 | ||
| 75 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER | 76 | #ifdef CONFIG_RWSEM_SPIN_ON_OWNER |
| 76 | #define __RWSEM_OPT_INIT(lockname) , .osq = OSQ_LOCK_UNLOCKED, .owner = NULL | 77 | #define __RWSEM_OPT_INIT(lockname) , .osq = OSQ_LOCK_UNLOCKED |
| 77 | #else | 78 | #else |
| 78 | #define __RWSEM_OPT_INIT(lockname) | 79 | #define __RWSEM_OPT_INIT(lockname) |
| 79 | #endif | 80 | #endif |
| 80 | 81 | ||
| 81 | #define __RWSEM_INITIALIZER(name) \ | 82 | #define __RWSEM_INITIALIZER(name) \ |
| 82 | { __RWSEM_INIT_COUNT(name), \ | 83 | { __RWSEM_INIT_COUNT(name), \ |
| 84 | .owner = ATOMIC_LONG_INIT(0), \ | ||
| 83 | .wait_list = LIST_HEAD_INIT((name).wait_list), \ | 85 | .wait_list = LIST_HEAD_INIT((name).wait_list), \ |
| 84 | .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock) \ | 86 | .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock) \ |
| 85 | __RWSEM_OPT_INIT(name) \ | 87 | __RWSEM_OPT_INIT(name) \ |
| @@ -158,7 +160,7 @@ extern void downgrade_write(struct rw_semaphore *sem); | |||
| 158 | * static then another method for expressing nested locking is | 160 | * static then another method for expressing nested locking is |
| 159 | * the explicit definition of lock class keys and the use of | 161 | * the explicit definition of lock class keys and the use of |
| 160 | * lockdep_set_class() at lock initialization time. | 162 | * lockdep_set_class() at lock initialization time. |
| 161 | * See Documentation/locking/lockdep-design.txt for more details.) | 163 | * See Documentation/locking/lockdep-design.rst for more details.) |
| 162 | */ | 164 | */ |
| 163 | extern void down_read_nested(struct rw_semaphore *sem, int subclass); | 165 | extern void down_read_nested(struct rw_semaphore *sem, int subclass); |
| 164 | extern void down_write_nested(struct rw_semaphore *sem, int subclass); | 166 | extern void down_write_nested(struct rw_semaphore *sem, int subclass); |
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 30a9a55c28ba..6eec50fb36c8 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
| @@ -266,10 +266,11 @@ int sg_split(struct scatterlist *in, const int in_mapped_nents, | |||
| 266 | typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t); | 266 | typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t); |
| 267 | typedef void (sg_free_fn)(struct scatterlist *, unsigned int); | 267 | typedef void (sg_free_fn)(struct scatterlist *, unsigned int); |
| 268 | 268 | ||
| 269 | void __sg_free_table(struct sg_table *, unsigned int, bool, sg_free_fn *); | 269 | void __sg_free_table(struct sg_table *, unsigned int, unsigned int, |
| 270 | sg_free_fn *); | ||
| 270 | void sg_free_table(struct sg_table *); | 271 | void sg_free_table(struct sg_table *); |
| 271 | int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, | 272 | int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, |
| 272 | struct scatterlist *, gfp_t, sg_alloc_fn *); | 273 | struct scatterlist *, unsigned int, gfp_t, sg_alloc_fn *); |
| 273 | int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); | 274 | int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); |
| 274 | int __sg_alloc_table_from_pages(struct sg_table *sgt, struct page **pages, | 275 | int __sg_alloc_table_from_pages(struct sg_table *sgt, struct page **pages, |
| 275 | unsigned int n_pages, unsigned int offset, | 276 | unsigned int n_pages, unsigned int offset, |
| @@ -331,9 +332,11 @@ size_t sg_zero_buffer(struct scatterlist *sgl, unsigned int nents, | |||
| 331 | #endif | 332 | #endif |
| 332 | 333 | ||
| 333 | #ifdef CONFIG_SG_POOL | 334 | #ifdef CONFIG_SG_POOL |
| 334 | void sg_free_table_chained(struct sg_table *table, bool first_chunk); | 335 | void sg_free_table_chained(struct sg_table *table, |
| 336 | unsigned nents_first_chunk); | ||
| 335 | int sg_alloc_table_chained(struct sg_table *table, int nents, | 337 | int sg_alloc_table_chained(struct sg_table *table, int nents, |
| 336 | struct scatterlist *first_chunk); | 338 | struct scatterlist *first_chunk, |
| 339 | unsigned nents_first_chunk); | ||
| 337 | #endif | 340 | #endif |
| 338 | 341 | ||
| 339 | /* | 342 | /* |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 11837410690f..8dc1811487f5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -35,6 +35,7 @@ struct audit_context; | |||
| 35 | struct backing_dev_info; | 35 | struct backing_dev_info; |
| 36 | struct bio_list; | 36 | struct bio_list; |
| 37 | struct blk_plug; | 37 | struct blk_plug; |
| 38 | struct capture_control; | ||
| 38 | struct cfs_rq; | 39 | struct cfs_rq; |
| 39 | struct fs_struct; | 40 | struct fs_struct; |
| 40 | struct futex_pi_state; | 41 | struct futex_pi_state; |
| @@ -47,8 +48,9 @@ struct pid_namespace; | |||
| 47 | struct pipe_inode_info; | 48 | struct pipe_inode_info; |
| 48 | struct rcu_node; | 49 | struct rcu_node; |
| 49 | struct reclaim_state; | 50 | struct reclaim_state; |
| 50 | struct capture_control; | ||
| 51 | struct robust_list_head; | 51 | struct robust_list_head; |
| 52 | struct root_domain; | ||
| 53 | struct rq; | ||
| 52 | struct sched_attr; | 54 | struct sched_attr; |
| 53 | struct sched_param; | 55 | struct sched_param; |
| 54 | struct seq_file; | 56 | struct seq_file; |
| @@ -281,6 +283,18 @@ struct vtime { | |||
| 281 | u64 gtime; | 283 | u64 gtime; |
| 282 | }; | 284 | }; |
| 283 | 285 | ||
| 286 | /* | ||
| 287 | * Utilization clamp constraints. | ||
| 288 | * @UCLAMP_MIN: Minimum utilization | ||
| 289 | * @UCLAMP_MAX: Maximum utilization | ||
| 290 | * @UCLAMP_CNT: Utilization clamp constraints count | ||
| 291 | */ | ||
| 292 | enum uclamp_id { | ||
| 293 | UCLAMP_MIN = 0, | ||
| 294 | UCLAMP_MAX, | ||
| 295 | UCLAMP_CNT | ||
| 296 | }; | ||
| 297 | |||
| 284 | struct sched_info { | 298 | struct sched_info { |
| 285 | #ifdef CONFIG_SCHED_INFO | 299 | #ifdef CONFIG_SCHED_INFO |
| 286 | /* Cumulative counters: */ | 300 | /* Cumulative counters: */ |
| @@ -312,6 +326,10 @@ struct sched_info { | |||
| 312 | # define SCHED_FIXEDPOINT_SHIFT 10 | 326 | # define SCHED_FIXEDPOINT_SHIFT 10 |
| 313 | # define SCHED_FIXEDPOINT_SCALE (1L << SCHED_FIXEDPOINT_SHIFT) | 327 | # define SCHED_FIXEDPOINT_SCALE (1L << SCHED_FIXEDPOINT_SHIFT) |
| 314 | 328 | ||
| 329 | /* Increase resolution of cpu_capacity calculations */ | ||
| 330 | # define SCHED_CAPACITY_SHIFT SCHED_FIXEDPOINT_SHIFT | ||
| 331 | # define SCHED_CAPACITY_SCALE (1L << SCHED_CAPACITY_SHIFT) | ||
| 332 | |||
| 315 | struct load_weight { | 333 | struct load_weight { |
| 316 | unsigned long weight; | 334 | unsigned long weight; |
| 317 | u32 inv_weight; | 335 | u32 inv_weight; |
| @@ -560,12 +578,47 @@ struct sched_dl_entity { | |||
| 560 | struct hrtimer inactive_timer; | 578 | struct hrtimer inactive_timer; |
| 561 | }; | 579 | }; |
| 562 | 580 | ||
| 581 | #ifdef CONFIG_UCLAMP_TASK | ||
| 582 | /* Number of utilization clamp buckets (shorter alias) */ | ||
| 583 | #define UCLAMP_BUCKETS CONFIG_UCLAMP_BUCKETS_COUNT | ||
| 584 | |||
| 585 | /* | ||
| 586 | * Utilization clamp for a scheduling entity | ||
| 587 | * @value: clamp value "assigned" to a se | ||
| 588 | * @bucket_id: bucket index corresponding to the "assigned" value | ||
| 589 | * @active: the se is currently refcounted in a rq's bucket | ||
| 590 | * @user_defined: the requested clamp value comes from user-space | ||
| 591 | * | ||
| 592 | * The bucket_id is the index of the clamp bucket matching the clamp value | ||
| 593 | * which is pre-computed and stored to avoid expensive integer divisions from | ||
| 594 | * the fast path. | ||
| 595 | * | ||
| 596 | * The active bit is set whenever a task has got an "effective" value assigned, | ||
| 597 | * which can be different from the clamp value "requested" from user-space. | ||
| 598 | * This allows to know a task is refcounted in the rq's bucket corresponding | ||
| 599 | * to the "effective" bucket_id. | ||
| 600 | * | ||
| 601 | * The user_defined bit is set whenever a task has got a task-specific clamp | ||
| 602 | * value requested from userspace, i.e. the system defaults apply to this task | ||
| 603 | * just as a restriction. This allows to relax default clamps when a less | ||
| 604 | * restrictive task-specific value has been requested, thus allowing to | ||
| 605 | * implement a "nice" semantic. For example, a task running with a 20% | ||
| 606 | * default boost can still drop its own boosting to 0%. | ||
| 607 | */ | ||
| 608 | struct uclamp_se { | ||
| 609 | unsigned int value : bits_per(SCHED_CAPACITY_SCALE); | ||
| 610 | unsigned int bucket_id : bits_per(UCLAMP_BUCKETS); | ||
| 611 | unsigned int active : 1; | ||
| 612 | unsigned int user_defined : 1; | ||
| 613 | }; | ||
| 614 | #endif /* CONFIG_UCLAMP_TASK */ | ||
| 615 | |||
| 563 | union rcu_special { | 616 | union rcu_special { |
| 564 | struct { | 617 | struct { |
| 565 | u8 blocked; | 618 | u8 blocked; |
| 566 | u8 need_qs; | 619 | u8 need_qs; |
| 567 | u8 exp_hint; /* Hint for performance. */ | 620 | u8 exp_hint; /* Hint for performance. */ |
| 568 | u8 pad; /* No garbage from compiler! */ | 621 | u8 deferred_qs; |
| 569 | } b; /* Bits. */ | 622 | } b; /* Bits. */ |
| 570 | u32 s; /* Set of bits. */ | 623 | u32 s; /* Set of bits. */ |
| 571 | }; | 624 | }; |
| @@ -640,6 +693,13 @@ struct task_struct { | |||
| 640 | #endif | 693 | #endif |
| 641 | struct sched_dl_entity dl; | 694 | struct sched_dl_entity dl; |
| 642 | 695 | ||
| 696 | #ifdef CONFIG_UCLAMP_TASK | ||
| 697 | /* Clamp values requested for a scheduling entity */ | ||
| 698 | struct uclamp_se uclamp_req[UCLAMP_CNT]; | ||
| 699 | /* Effective clamp values used for a scheduling entity */ | ||
| 700 | struct uclamp_se uclamp[UCLAMP_CNT]; | ||
| 701 | #endif | ||
| 702 | |||
| 643 | #ifdef CONFIG_PREEMPT_NOTIFIERS | 703 | #ifdef CONFIG_PREEMPT_NOTIFIERS |
| 644 | /* List of struct preempt_notifier: */ | 704 | /* List of struct preempt_notifier: */ |
| 645 | struct hlist_head preempt_notifiers; | 705 | struct hlist_head preempt_notifiers; |
| @@ -651,7 +711,8 @@ struct task_struct { | |||
| 651 | 711 | ||
| 652 | unsigned int policy; | 712 | unsigned int policy; |
| 653 | int nr_cpus_allowed; | 713 | int nr_cpus_allowed; |
| 654 | cpumask_t cpus_allowed; | 714 | const cpumask_t *cpus_ptr; |
| 715 | cpumask_t cpus_mask; | ||
| 655 | 716 | ||
| 656 | #ifdef CONFIG_PREEMPT_RCU | 717 | #ifdef CONFIG_PREEMPT_RCU |
| 657 | int rcu_read_lock_nesting; | 718 | int rcu_read_lock_nesting; |
| @@ -831,6 +892,11 @@ struct task_struct { | |||
| 831 | /* Effective (overridable) subjective task credentials (COW): */ | 892 | /* Effective (overridable) subjective task credentials (COW): */ |
| 832 | const struct cred __rcu *cred; | 893 | const struct cred __rcu *cred; |
| 833 | 894 | ||
| 895 | #ifdef CONFIG_KEYS | ||
| 896 | /* Cached requested key. */ | ||
| 897 | struct key *cached_requested_key; | ||
| 898 | #endif | ||
| 899 | |||
| 834 | /* | 900 | /* |
| 835 | * executable name, excluding path. | 901 | * executable name, excluding path. |
| 836 | * | 902 | * |
| @@ -1399,7 +1465,7 @@ extern struct pid *cad_pid; | |||
| 1399 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ | 1465 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ |
| 1400 | #define PF_MEMSTALL 0x01000000 /* Stalled due to lack of memory */ | 1466 | #define PF_MEMSTALL 0x01000000 /* Stalled due to lack of memory */ |
| 1401 | #define PF_UMH 0x02000000 /* I'm an Usermodehelper process */ | 1467 | #define PF_UMH 0x02000000 /* I'm an Usermodehelper process */ |
| 1402 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ | 1468 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ |
| 1403 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ | 1469 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
| 1404 | #define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ | 1470 | #define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ |
| 1405 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ | 1471 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ |
| @@ -1518,10 +1584,6 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p, const struct cpuma | |||
| 1518 | } | 1584 | } |
| 1519 | #endif | 1585 | #endif |
| 1520 | 1586 | ||
| 1521 | #ifndef cpu_relax_yield | ||
| 1522 | #define cpu_relax_yield() cpu_relax() | ||
| 1523 | #endif | ||
| 1524 | |||
| 1525 | extern int yield_to(struct task_struct *p, bool preempt); | 1587 | extern int yield_to(struct task_struct *p, bool preempt); |
| 1526 | extern void set_user_nice(struct task_struct *p, long nice); | 1588 | extern void set_user_nice(struct task_struct *p, long nice); |
| 1527 | extern int task_prio(const struct task_struct *p); | 1589 | extern int task_prio(const struct task_struct *p); |
| @@ -1919,4 +1981,16 @@ static inline void rseq_syscall(struct pt_regs *regs) | |||
| 1919 | 1981 | ||
| 1920 | #endif | 1982 | #endif |
| 1921 | 1983 | ||
| 1984 | const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq); | ||
| 1985 | char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len); | ||
| 1986 | int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq); | ||
| 1987 | |||
| 1988 | const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq); | ||
| 1989 | const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq); | ||
| 1990 | const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq); | ||
| 1991 | |||
| 1992 | int sched_trace_rq_cpu(struct rq *rq); | ||
| 1993 | |||
| 1994 | const struct cpumask *sched_trace_rd_span(struct root_domain *rd); | ||
| 1995 | |||
| 1922 | #endif | 1996 | #endif |
diff --git a/include/linux/sched/nohz.h b/include/linux/sched/nohz.h index b36f4cf38111..1abe91ff6e4a 100644 --- a/include/linux/sched/nohz.h +++ b/include/linux/sched/nohz.h | |||
| @@ -7,14 +7,6 @@ | |||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) | 9 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) |
| 10 | extern void cpu_load_update_nohz_start(void); | ||
| 11 | extern void cpu_load_update_nohz_stop(void); | ||
| 12 | #else | ||
| 13 | static inline void cpu_load_update_nohz_start(void) { } | ||
| 14 | static inline void cpu_load_update_nohz_stop(void) { } | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) | ||
| 18 | extern void nohz_balance_enter_idle(int cpu); | 10 | extern void nohz_balance_enter_idle(int cpu); |
| 19 | extern int get_nohz_timer_target(void); | 11 | extern int get_nohz_timer_target(void); |
| 20 | #else | 12 | #else |
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h index 38a0f0785323..532458698bde 100644 --- a/include/linux/sched/signal.h +++ b/include/linux/sched/signal.h | |||
| @@ -307,16 +307,19 @@ static inline void kernel_signal_stop(void) | |||
| 307 | # define ___ARCH_SI_IA64(_a1, _a2, _a3) | 307 | # define ___ARCH_SI_IA64(_a1, _a2, _a3) |
| 308 | #endif | 308 | #endif |
| 309 | 309 | ||
| 310 | int force_sig_fault(int sig, int code, void __user *addr | 310 | int force_sig_fault_to_task(int sig, int code, void __user *addr |
| 311 | ___ARCH_SI_TRAPNO(int trapno) | 311 | ___ARCH_SI_TRAPNO(int trapno) |
| 312 | ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) | 312 | ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) |
| 313 | , struct task_struct *t); | 313 | , struct task_struct *t); |
| 314 | int force_sig_fault(int sig, int code, void __user *addr | ||
| 315 | ___ARCH_SI_TRAPNO(int trapno) | ||
| 316 | ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)); | ||
| 314 | int send_sig_fault(int sig, int code, void __user *addr | 317 | int send_sig_fault(int sig, int code, void __user *addr |
| 315 | ___ARCH_SI_TRAPNO(int trapno) | 318 | ___ARCH_SI_TRAPNO(int trapno) |
| 316 | ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) | 319 | ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) |
| 317 | , struct task_struct *t); | 320 | , struct task_struct *t); |
| 318 | 321 | ||
| 319 | int force_sig_mceerr(int code, void __user *, short, struct task_struct *); | 322 | int force_sig_mceerr(int code, void __user *, short); |
| 320 | int send_sig_mceerr(int code, void __user *, short, struct task_struct *); | 323 | int send_sig_mceerr(int code, void __user *, short, struct task_struct *); |
| 321 | 324 | ||
| 322 | int force_sig_bnderr(void __user *addr, void __user *lower, void __user *upper); | 325 | int force_sig_bnderr(void __user *addr, void __user *lower, void __user *upper); |
| @@ -325,17 +328,17 @@ int force_sig_pkuerr(void __user *addr, u32 pkey); | |||
| 325 | int force_sig_ptrace_errno_trap(int errno, void __user *addr); | 328 | int force_sig_ptrace_errno_trap(int errno, void __user *addr); |
| 326 | 329 | ||
| 327 | extern int send_sig_info(int, struct kernel_siginfo *, struct task_struct *); | 330 | extern int send_sig_info(int, struct kernel_siginfo *, struct task_struct *); |
| 328 | extern void force_sigsegv(int sig, struct task_struct *p); | 331 | extern void force_sigsegv(int sig); |
| 329 | extern int force_sig_info(int, struct kernel_siginfo *, struct task_struct *); | 332 | extern int force_sig_info(struct kernel_siginfo *); |
| 330 | extern int __kill_pgrp_info(int sig, struct kernel_siginfo *info, struct pid *pgrp); | 333 | extern int __kill_pgrp_info(int sig, struct kernel_siginfo *info, struct pid *pgrp); |
| 331 | extern int kill_pid_info(int sig, struct kernel_siginfo *info, struct pid *pid); | 334 | extern int kill_pid_info(int sig, struct kernel_siginfo *info, struct pid *pid); |
| 332 | extern int kill_pid_info_as_cred(int, struct kernel_siginfo *, struct pid *, | 335 | extern int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr, struct pid *, |
| 333 | const struct cred *); | 336 | const struct cred *); |
| 334 | extern int kill_pgrp(struct pid *pid, int sig, int priv); | 337 | extern int kill_pgrp(struct pid *pid, int sig, int priv); |
| 335 | extern int kill_pid(struct pid *pid, int sig, int priv); | 338 | extern int kill_pid(struct pid *pid, int sig, int priv); |
| 336 | extern __must_check bool do_notify_parent(struct task_struct *, int); | 339 | extern __must_check bool do_notify_parent(struct task_struct *, int); |
| 337 | extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); | 340 | extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); |
| 338 | extern void force_sig(int, struct task_struct *); | 341 | extern void force_sig(int); |
| 339 | extern int send_sig(int, struct task_struct *, int); | 342 | extern int send_sig(int, struct task_struct *, int); |
| 340 | extern int zap_other_threads(struct task_struct *p); | 343 | extern int zap_other_threads(struct task_struct *p); |
| 341 | extern struct sigqueue *sigqueue_alloc(void); | 344 | extern struct sigqueue *sigqueue_alloc(void); |
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index 99ce6d728df7..d4f6215ee03f 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h | |||
| @@ -56,6 +56,11 @@ int sched_proc_update_handler(struct ctl_table *table, int write, | |||
| 56 | extern unsigned int sysctl_sched_rt_period; | 56 | extern unsigned int sysctl_sched_rt_period; |
| 57 | extern int sysctl_sched_rt_runtime; | 57 | extern int sysctl_sched_rt_runtime; |
| 58 | 58 | ||
| 59 | #ifdef CONFIG_UCLAMP_TASK | ||
| 60 | extern unsigned int sysctl_sched_uclamp_util_min; | ||
| 61 | extern unsigned int sysctl_sched_uclamp_util_max; | ||
| 62 | #endif | ||
| 63 | |||
| 59 | #ifdef CONFIG_CFS_BANDWIDTH | 64 | #ifdef CONFIG_CFS_BANDWIDTH |
| 60 | extern unsigned int sysctl_sched_cfs_bandwidth_slice; | 65 | extern unsigned int sysctl_sched_cfs_bandwidth_slice; |
| 61 | #endif | 66 | #endif |
| @@ -75,6 +80,12 @@ extern int sched_rt_handler(struct ctl_table *table, int write, | |||
| 75 | void __user *buffer, size_t *lenp, | 80 | void __user *buffer, size_t *lenp, |
| 76 | loff_t *ppos); | 81 | loff_t *ppos); |
| 77 | 82 | ||
| 83 | #ifdef CONFIG_UCLAMP_TASK | ||
| 84 | extern int sysctl_sched_uclamp_handler(struct ctl_table *table, int write, | ||
| 85 | void __user *buffer, size_t *lenp, | ||
| 86 | loff_t *ppos); | ||
| 87 | #endif | ||
| 88 | |||
| 78 | extern int sysctl_numa_balancing(struct ctl_table *table, int write, | 89 | extern int sysctl_numa_balancing(struct ctl_table *table, int write, |
| 79 | void __user *buffer, size_t *lenp, | 90 | void __user *buffer, size_t *lenp, |
| 80 | loff_t *ppos); | 91 | loff_t *ppos); |
diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index f1227f2c38a4..0497091e40c1 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h | |||
| @@ -8,11 +8,26 @@ | |||
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
| 11 | #include <linux/uaccess.h> | ||
| 11 | 12 | ||
| 12 | struct task_struct; | 13 | struct task_struct; |
| 13 | struct rusage; | 14 | struct rusage; |
| 14 | union thread_union; | 15 | union thread_union; |
| 15 | 16 | ||
| 17 | /* All the bits taken by the old clone syscall. */ | ||
| 18 | #define CLONE_LEGACY_FLAGS 0xffffffffULL | ||
| 19 | |||
| 20 | struct kernel_clone_args { | ||
| 21 | u64 flags; | ||
| 22 | int __user *pidfd; | ||
| 23 | int __user *child_tid; | ||
| 24 | int __user *parent_tid; | ||
| 25 | int exit_signal; | ||
| 26 | unsigned long stack; | ||
| 27 | unsigned long stack_size; | ||
| 28 | unsigned long tls; | ||
| 29 | }; | ||
| 30 | |||
| 16 | /* | 31 | /* |
| 17 | * This serializes "schedule()" and also protects | 32 | * This serializes "schedule()" and also protects |
| 18 | * the run-queue from deletions/modifications (but | 33 | * the run-queue from deletions/modifications (but |
| @@ -73,7 +88,8 @@ extern void do_group_exit(int); | |||
| 73 | extern void exit_files(struct task_struct *); | 88 | extern void exit_files(struct task_struct *); |
| 74 | extern void exit_itimers(struct signal_struct *); | 89 | extern void exit_itimers(struct signal_struct *); |
| 75 | 90 | ||
| 76 | extern long _do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *, unsigned long); | 91 | extern long _do_fork(struct kernel_clone_args *kargs); |
| 92 | extern bool legacy_clone_args_valid(const struct kernel_clone_args *kargs); | ||
| 77 | extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); | 93 | extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); |
| 78 | struct task_struct *fork_idle(int); | 94 | struct task_struct *fork_idle(int); |
| 79 | struct mm_struct *copy_init_mm(void); | 95 | struct mm_struct *copy_init_mm(void); |
diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index cfc0a89a7159..7863bb62d2ab 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h | |||
| @@ -7,12 +7,6 @@ | |||
| 7 | #include <linux/sched/idle.h> | 7 | #include <linux/sched/idle.h> |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| 10 | * Increase resolution of cpu_capacity calculations | ||
| 11 | */ | ||
| 12 | #define SCHED_CAPACITY_SHIFT SCHED_FIXEDPOINT_SHIFT | ||
| 13 | #define SCHED_CAPACITY_SCALE (1L << SCHED_CAPACITY_SHIFT) | ||
| 14 | |||
| 15 | /* | ||
| 16 | * sched-domains (multiprocessor balancing) declarations: | 10 | * sched-domains (multiprocessor balancing) declarations: |
| 17 | */ | 11 | */ |
| 18 | #ifdef CONFIG_SMP | 12 | #ifdef CONFIG_SMP |
| @@ -84,11 +78,6 @@ struct sched_domain { | |||
| 84 | unsigned int busy_factor; /* less balancing by factor if busy */ | 78 | unsigned int busy_factor; /* less balancing by factor if busy */ |
| 85 | unsigned int imbalance_pct; /* No balance until over watermark */ | 79 | unsigned int imbalance_pct; /* No balance until over watermark */ |
| 86 | unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */ | 80 | unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */ |
| 87 | unsigned int busy_idx; | ||
| 88 | unsigned int idle_idx; | ||
| 89 | unsigned int newidle_idx; | ||
| 90 | unsigned int wake_idx; | ||
| 91 | unsigned int forkexec_idx; | ||
| 92 | 81 | ||
| 93 | int nohz_idle; /* NOHZ IDLE status */ | 82 | int nohz_idle; /* NOHZ IDLE status */ |
| 94 | int flags; /* See SD_* */ | 83 | int flags; /* See SD_* */ |
| @@ -201,14 +190,6 @@ extern void set_sched_topology(struct sched_domain_topology_level *tl); | |||
| 201 | # define SD_INIT_NAME(type) | 190 | # define SD_INIT_NAME(type) |
| 202 | #endif | 191 | #endif |
| 203 | 192 | ||
| 204 | #ifndef arch_scale_cpu_capacity | ||
| 205 | static __always_inline | ||
| 206 | unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu) | ||
| 207 | { | ||
| 208 | return SCHED_CAPACITY_SCALE; | ||
| 209 | } | ||
| 210 | #endif | ||
| 211 | |||
| 212 | #else /* CONFIG_SMP */ | 193 | #else /* CONFIG_SMP */ |
| 213 | 194 | ||
| 214 | struct sched_domain_attr; | 195 | struct sched_domain_attr; |
| @@ -224,16 +205,16 @@ static inline bool cpus_share_cache(int this_cpu, int that_cpu) | |||
| 224 | return true; | 205 | return true; |
| 225 | } | 206 | } |
| 226 | 207 | ||
| 208 | #endif /* !CONFIG_SMP */ | ||
| 209 | |||
| 227 | #ifndef arch_scale_cpu_capacity | 210 | #ifndef arch_scale_cpu_capacity |
| 228 | static __always_inline | 211 | static __always_inline |
| 229 | unsigned long arch_scale_cpu_capacity(void __always_unused *sd, int cpu) | 212 | unsigned long arch_scale_cpu_capacity(int cpu) |
| 230 | { | 213 | { |
| 231 | return SCHED_CAPACITY_SCALE; | 214 | return SCHED_CAPACITY_SCALE; |
| 232 | } | 215 | } |
| 233 | #endif | 216 | #endif |
| 234 | 217 | ||
| 235 | #endif /* !CONFIG_SMP */ | ||
| 236 | |||
| 237 | static inline int task_node(const struct task_struct *p) | 218 | static inline int task_node(const struct task_struct *p) |
| 238 | { | 219 | { |
| 239 | return cpu_to_node(task_cpu(p)); | 220 | return cpu_to_node(task_cpu(p)); |
diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h index 468d2565a9fe..917d88edb7b9 100644 --- a/include/linux/sched/user.h +++ b/include/linux/sched/user.h | |||
| @@ -7,8 +7,6 @@ | |||
| 7 | #include <linux/refcount.h> | 7 | #include <linux/refcount.h> |
| 8 | #include <linux/ratelimit.h> | 8 | #include <linux/ratelimit.h> |
| 9 | 9 | ||
| 10 | struct key; | ||
| 11 | |||
| 12 | /* | 10 | /* |
| 13 | * Some day this will be a full-fledged user tracking system.. | 11 | * Some day this will be a full-fledged user tracking system.. |
| 14 | */ | 12 | */ |
| @@ -30,18 +28,6 @@ struct user_struct { | |||
| 30 | unsigned long unix_inflight; /* How many files in flight in unix sockets */ | 28 | unsigned long unix_inflight; /* How many files in flight in unix sockets */ |
| 31 | atomic_long_t pipe_bufs; /* how many pages are allocated in pipe buffers */ | 29 | atomic_long_t pipe_bufs; /* how many pages are allocated in pipe buffers */ |
| 32 | 30 | ||
| 33 | #ifdef CONFIG_KEYS | ||
| 34 | /* | ||
| 35 | * These pointers can only change from NULL to a non-NULL value once. | ||
| 36 | * Writes are protected by key_user_keyring_mutex. | ||
| 37 | * Unlocked readers should use READ_ONCE() unless they know that | ||
| 38 | * install_user_keyrings() has been called successfully (which sets | ||
| 39 | * these members to non-NULL values, preventing further modifications). | ||
| 40 | */ | ||
| 41 | struct key *uid_keyring; /* UID specific keyring */ | ||
| 42 | struct key *session_keyring; /* UID's default session keyring */ | ||
| 43 | #endif | ||
| 44 | |||
| 45 | /* Hash table maintenance information */ | 31 | /* Hash table maintenance information */ |
| 46 | struct hlist_node uidhash_node; | 32 | struct hlist_node uidhash_node; |
| 47 | kuid_t uid; | 33 | kuid_t uid; |
diff --git a/include/linux/sched/wake_q.h b/include/linux/sched/wake_q.h index ad826d2a4557..26a2013ac39c 100644 --- a/include/linux/sched/wake_q.h +++ b/include/linux/sched/wake_q.h | |||
| @@ -51,6 +51,11 @@ static inline void wake_q_init(struct wake_q_head *head) | |||
| 51 | head->lastp = &head->first; | 51 | head->lastp = &head->first; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | static inline bool wake_q_empty(struct wake_q_head *head) | ||
| 55 | { | ||
| 56 | return head->first == WAKE_Q_TAIL; | ||
| 57 | } | ||
| 58 | |||
| 54 | extern void wake_q_add(struct wake_q_head *head, struct task_struct *task); | 59 | extern void wake_q_add(struct wake_q_head *head, struct task_struct *task); |
| 55 | extern void wake_q_add_safe(struct wake_q_head *head, struct task_struct *task); | 60 | extern void wake_q_add_safe(struct wake_q_head *head, struct task_struct *task); |
| 56 | extern void wake_up_q(struct wake_q_head *head); | 61 | extern void wake_up_q(struct wake_q_head *head); |
diff --git a/include/linux/security.h b/include/linux/security.h index 659071c2e57c..5f7441abbf42 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -189,9 +189,9 @@ static inline const char *kernel_load_data_id_str(enum kernel_load_data_id id) | |||
| 189 | 189 | ||
| 190 | #ifdef CONFIG_SECURITY | 190 | #ifdef CONFIG_SECURITY |
| 191 | 191 | ||
| 192 | int call_lsm_notifier(enum lsm_event event, void *data); | 192 | int call_blocking_lsm_notifier(enum lsm_event event, void *data); |
| 193 | int register_lsm_notifier(struct notifier_block *nb); | 193 | int register_blocking_lsm_notifier(struct notifier_block *nb); |
| 194 | int unregister_lsm_notifier(struct notifier_block *nb); | 194 | int unregister_blocking_lsm_notifier(struct notifier_block *nb); |
| 195 | 195 | ||
| 196 | /* prototypes */ | 196 | /* prototypes */ |
| 197 | extern int security_init(void); | 197 | extern int security_init(void); |
| @@ -394,17 +394,17 @@ int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen); | |||
| 394 | int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen); | 394 | int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen); |
| 395 | #else /* CONFIG_SECURITY */ | 395 | #else /* CONFIG_SECURITY */ |
| 396 | 396 | ||
| 397 | static inline int call_lsm_notifier(enum lsm_event event, void *data) | 397 | static inline int call_blocking_lsm_notifier(enum lsm_event event, void *data) |
| 398 | { | 398 | { |
| 399 | return 0; | 399 | return 0; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | static inline int register_lsm_notifier(struct notifier_block *nb) | 402 | static inline int register_blocking_lsm_notifier(struct notifier_block *nb) |
| 403 | { | 403 | { |
| 404 | return 0; | 404 | return 0; |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | static inline int unregister_lsm_notifier(struct notifier_block *nb) | 407 | static inline int unregister_blocking_lsm_notifier(struct notifier_block *nb) |
| 408 | { | 408 | { |
| 409 | return 0; | 409 | return 0; |
| 410 | } | 410 | } |
diff --git a/include/linux/sed-opal.h b/include/linux/sed-opal.h index 3e76b6d7d97f..53c28d750a45 100644 --- a/include/linux/sed-opal.h +++ b/include/linux/sed-opal.h | |||
| @@ -39,6 +39,9 @@ static inline bool is_sed_ioctl(unsigned int cmd) | |||
| 39 | case IOC_OPAL_ENABLE_DISABLE_MBR: | 39 | case IOC_OPAL_ENABLE_DISABLE_MBR: |
| 40 | case IOC_OPAL_ERASE_LR: | 40 | case IOC_OPAL_ERASE_LR: |
| 41 | case IOC_OPAL_SECURE_ERASE_LR: | 41 | case IOC_OPAL_SECURE_ERASE_LR: |
| 42 | case IOC_OPAL_PSID_REVERT_TPR: | ||
| 43 | case IOC_OPAL_MBR_DONE: | ||
| 44 | case IOC_OPAL_WRITE_SHADOW_MBR: | ||
| 42 | return true; | 45 | return true; |
| 43 | } | 46 | } |
| 44 | return false; | 47 | return false; |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index a121982af0f5..5998e1f4ff06 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
| @@ -127,6 +127,7 @@ void seq_put_hex_ll(struct seq_file *m, const char *delimiter, | |||
| 127 | unsigned long long v, unsigned int width); | 127 | unsigned long long v, unsigned int width); |
| 128 | 128 | ||
| 129 | void seq_escape(struct seq_file *m, const char *s, const char *esc); | 129 | void seq_escape(struct seq_file *m, const char *s, const char *esc); |
| 130 | void seq_escape_mem_ascii(struct seq_file *m, const char *src, size_t isz); | ||
| 130 | 131 | ||
| 131 | void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type, | 132 | void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type, |
| 132 | int rowsize, int groupsize, const void *buf, size_t len, | 133 | int rowsize, int groupsize, const void *buf, size_t len, |
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 5e0b59422a68..bb2bc99388ca 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
| @@ -110,6 +110,7 @@ struct uart_8250_port { | |||
| 110 | * if no_console_suspend | 110 | * if no_console_suspend |
| 111 | */ | 111 | */ |
| 112 | unsigned char probe; | 112 | unsigned char probe; |
| 113 | struct mctrl_gpios *gpios; | ||
| 113 | #define UART_PROBE_RSA (1 << 0) | 114 | #define UART_PROBE_RSA (1 << 0) |
| 114 | 115 | ||
| 115 | /* | 116 | /* |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 05b179015d6c..2b78cc734719 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -32,7 +32,7 @@ struct device; | |||
| 32 | 32 | ||
| 33 | /* | 33 | /* |
| 34 | * This structure describes all the operations that can be done on the | 34 | * This structure describes all the operations that can be done on the |
| 35 | * physical hardware. See Documentation/serial/driver.rst for details. | 35 | * physical hardware. See Documentation/driver-api/serial/driver.rst for details. |
| 36 | */ | 36 | */ |
| 37 | struct uart_ops { | 37 | struct uart_ops { |
| 38 | unsigned int (*tx_empty)(struct uart_port *); | 38 | unsigned int (*tx_empty)(struct uart_port *); |
diff --git a/include/linux/sfp.h b/include/linux/sfp.h index d9d9de3fcf8e..1c35428e98bc 100644 --- a/include/linux/sfp.h +++ b/include/linux/sfp.h | |||
| @@ -464,11 +464,14 @@ enum { | |||
| 464 | struct fwnode_handle; | 464 | struct fwnode_handle; |
| 465 | struct ethtool_eeprom; | 465 | struct ethtool_eeprom; |
| 466 | struct ethtool_modinfo; | 466 | struct ethtool_modinfo; |
| 467 | struct net_device; | ||
| 468 | struct sfp_bus; | 467 | struct sfp_bus; |
| 469 | 468 | ||
| 470 | /** | 469 | /** |
| 471 | * struct sfp_upstream_ops - upstream operations structure | 470 | * struct sfp_upstream_ops - upstream operations structure |
| 471 | * @attach: called when the sfp socket driver is bound to the upstream | ||
| 472 | * (mandatory). | ||
| 473 | * @detach: called when the sfp socket driver is unbound from the upstream | ||
| 474 | * (mandatory). | ||
| 472 | * @module_insert: called after a module has been detected to determine | 475 | * @module_insert: called after a module has been detected to determine |
| 473 | * whether the module is supported for the upstream device. | 476 | * whether the module is supported for the upstream device. |
| 474 | * @module_remove: called after the module has been removed. | 477 | * @module_remove: called after the module has been removed. |
| @@ -481,6 +484,8 @@ struct sfp_bus; | |||
| 481 | * been removed. | 484 | * been removed. |
| 482 | */ | 485 | */ |
| 483 | struct sfp_upstream_ops { | 486 | struct sfp_upstream_ops { |
| 487 | void (*attach)(void *priv, struct sfp_bus *bus); | ||
| 488 | void (*detach)(void *priv, struct sfp_bus *bus); | ||
| 484 | int (*module_insert)(void *priv, const struct sfp_eeprom_id *id); | 489 | int (*module_insert)(void *priv, const struct sfp_eeprom_id *id); |
| 485 | void (*module_remove)(void *priv); | 490 | void (*module_remove)(void *priv); |
| 486 | void (*link_down)(void *priv); | 491 | void (*link_down)(void *priv); |
| @@ -504,7 +509,7 @@ int sfp_get_module_eeprom(struct sfp_bus *bus, struct ethtool_eeprom *ee, | |||
| 504 | void sfp_upstream_start(struct sfp_bus *bus); | 509 | void sfp_upstream_start(struct sfp_bus *bus); |
| 505 | void sfp_upstream_stop(struct sfp_bus *bus); | 510 | void sfp_upstream_stop(struct sfp_bus *bus); |
| 506 | struct sfp_bus *sfp_register_upstream(struct fwnode_handle *fwnode, | 511 | struct sfp_bus *sfp_register_upstream(struct fwnode_handle *fwnode, |
| 507 | struct net_device *ndev, void *upstream, | 512 | void *upstream, |
| 508 | const struct sfp_upstream_ops *ops); | 513 | const struct sfp_upstream_ops *ops); |
| 509 | void sfp_unregister_upstream(struct sfp_bus *bus); | 514 | void sfp_unregister_upstream(struct sfp_bus *bus); |
| 510 | #else | 515 | #else |
| @@ -549,8 +554,7 @@ static inline void sfp_upstream_stop(struct sfp_bus *bus) | |||
| 549 | } | 554 | } |
| 550 | 555 | ||
| 551 | static inline struct sfp_bus *sfp_register_upstream( | 556 | static inline struct sfp_bus *sfp_register_upstream( |
| 552 | struct fwnode_handle *fwnode, | 557 | struct fwnode_handle *fwnode, void *upstream, |
| 553 | struct net_device *ndev, void *upstream, | ||
| 554 | const struct sfp_upstream_ops *ops) | 558 | const struct sfp_upstream_ops *ops) |
| 555 | { | 559 | { |
| 556 | return (struct sfp_bus *)-1; | 560 | return (struct sfp_bus *)-1; |
diff --git a/include/linux/siox.h b/include/linux/siox.h index a860cb8c1f9d..da7225bf1877 100644 --- a/include/linux/siox.h +++ b/include/linux/siox.h | |||
| @@ -72,3 +72,13 @@ static inline void siox_driver_unregister(struct siox_driver *sdriver) | |||
| 72 | { | 72 | { |
| 73 | return driver_unregister(&sdriver->driver); | 73 | return driver_unregister(&sdriver->driver); |
| 74 | } | 74 | } |
| 75 | |||
| 76 | /* | ||
| 77 | * module_siox_driver() - Helper macro for drivers that don't do | ||
| 78 | * anything special in module init/exit. This eliminates a lot of | ||
| 79 | * boilerplate. Each module may only use this macro once, and | ||
| 80 | * calling it replaces module_init() and module_exit() | ||
| 81 | */ | ||
| 82 | #define module_siox_driver(__siox_driver) \ | ||
| 83 | module_driver(__siox_driver, siox_driver_register, \ | ||
| 84 | siox_driver_unregister) | ||
diff --git a/include/linux/sizes.h b/include/linux/sizes.h index 1cbb4c4d016e..9874f6f67537 100644 --- a/include/linux/sizes.h +++ b/include/linux/sizes.h | |||
| @@ -44,5 +44,6 @@ | |||
| 44 | #define SZ_2G 0x80000000 | 44 | #define SZ_2G 0x80000000 |
| 45 | 45 | ||
| 46 | #define SZ_4G _AC(0x100000000, ULL) | 46 | #define SZ_4G _AC(0x100000000, ULL) |
| 47 | #define SZ_64T _AC(0x400000000000, ULL) | ||
| 47 | 48 | ||
| 48 | #endif /* __LINUX_SIZES_H__ */ | 49 | #endif /* __LINUX_SIZES_H__ */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 056f557d5194..d8af86d995d6 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -1024,6 +1024,7 @@ static inline bool skb_unref(struct sk_buff *skb) | |||
| 1024 | void skb_release_head_state(struct sk_buff *skb); | 1024 | void skb_release_head_state(struct sk_buff *skb); |
| 1025 | void kfree_skb(struct sk_buff *skb); | 1025 | void kfree_skb(struct sk_buff *skb); |
| 1026 | void kfree_skb_list(struct sk_buff *segs); | 1026 | void kfree_skb_list(struct sk_buff *segs); |
| 1027 | void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt); | ||
| 1027 | void skb_tx_error(struct sk_buff *skb); | 1028 | void skb_tx_error(struct sk_buff *skb); |
| 1028 | void consume_skb(struct sk_buff *skb); | 1029 | void consume_skb(struct sk_buff *skb); |
| 1029 | void __consume_stateless_skb(struct sk_buff *skb); | 1030 | void __consume_stateless_skb(struct sk_buff *skb); |
| @@ -1059,6 +1060,7 @@ struct sk_buff *alloc_skb_with_frags(unsigned long header_len, | |||
| 1059 | int max_page_order, | 1060 | int max_page_order, |
| 1060 | int *errcode, | 1061 | int *errcode, |
| 1061 | gfp_t gfp_mask); | 1062 | gfp_t gfp_mask); |
| 1063 | struct sk_buff *alloc_skb_for_msg(struct sk_buff *first); | ||
| 1062 | 1064 | ||
| 1063 | /* Layout of fast clones : [skb1][skb2][fclone_ref] */ | 1065 | /* Layout of fast clones : [skb1][skb2][fclone_ref] */ |
| 1064 | struct sk_buff_fclones { | 1066 | struct sk_buff_fclones { |
| @@ -1319,6 +1321,20 @@ skb_flow_dissect_flow_keys_basic(const struct net *net, | |||
| 1319 | data, proto, nhoff, hlen, flags); | 1321 | data, proto, nhoff, hlen, flags); |
| 1320 | } | 1322 | } |
| 1321 | 1323 | ||
| 1324 | void skb_flow_dissect_meta(const struct sk_buff *skb, | ||
| 1325 | struct flow_dissector *flow_dissector, | ||
| 1326 | void *target_container); | ||
| 1327 | |||
| 1328 | /* Gets a skb connection tracking info, ctinfo map should be a | ||
| 1329 | * a map of mapsize to translate enum ip_conntrack_info states | ||
| 1330 | * to user states. | ||
| 1331 | */ | ||
| 1332 | void | ||
| 1333 | skb_flow_dissect_ct(const struct sk_buff *skb, | ||
| 1334 | struct flow_dissector *flow_dissector, | ||
| 1335 | void *target_container, | ||
| 1336 | u16 *ctinfo_map, | ||
| 1337 | size_t mapsize); | ||
| 1322 | void | 1338 | void |
| 1323 | skb_flow_dissect_tunnel_info(const struct sk_buff *skb, | 1339 | skb_flow_dissect_tunnel_info(const struct sk_buff *skb, |
| 1324 | struct flow_dissector *flow_dissector, | 1340 | struct flow_dissector *flow_dissector, |
| @@ -3441,6 +3457,10 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len); | |||
| 3441 | int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci); | 3457 | int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci); |
| 3442 | int skb_vlan_pop(struct sk_buff *skb); | 3458 | int skb_vlan_pop(struct sk_buff *skb); |
| 3443 | int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); | 3459 | int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); |
| 3460 | int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto); | ||
| 3461 | int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto); | ||
| 3462 | int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); | ||
| 3463 | int skb_mpls_dec_ttl(struct sk_buff *skb); | ||
| 3444 | struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy, | 3464 | struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy, |
| 3445 | gfp_t gfp); | 3465 | gfp_t gfp); |
| 3446 | 3466 | ||
| @@ -3914,18 +3934,16 @@ static inline bool __skb_checksum_convert_check(struct sk_buff *skb) | |||
| 3914 | return (skb->ip_summed == CHECKSUM_NONE && skb->csum_valid); | 3934 | return (skb->ip_summed == CHECKSUM_NONE && skb->csum_valid); |
| 3915 | } | 3935 | } |
| 3916 | 3936 | ||
| 3917 | static inline void __skb_checksum_convert(struct sk_buff *skb, | 3937 | static inline void __skb_checksum_convert(struct sk_buff *skb, __wsum pseudo) |
| 3918 | __sum16 check, __wsum pseudo) | ||
| 3919 | { | 3938 | { |
| 3920 | skb->csum = ~pseudo; | 3939 | skb->csum = ~pseudo; |
| 3921 | skb->ip_summed = CHECKSUM_COMPLETE; | 3940 | skb->ip_summed = CHECKSUM_COMPLETE; |
| 3922 | } | 3941 | } |
| 3923 | 3942 | ||
| 3924 | #define skb_checksum_try_convert(skb, proto, check, compute_pseudo) \ | 3943 | #define skb_checksum_try_convert(skb, proto, compute_pseudo) \ |
| 3925 | do { \ | 3944 | do { \ |
| 3926 | if (__skb_checksum_convert_check(skb)) \ | 3945 | if (__skb_checksum_convert_check(skb)) \ |
| 3927 | __skb_checksum_convert(skb, check, \ | 3946 | __skb_checksum_convert(skb, compute_pseudo(skb, proto)); \ |
| 3928 | compute_pseudo(skb, proto)); \ | ||
| 3929 | } while (0) | 3947 | } while (0) |
| 3930 | 3948 | ||
| 3931 | static inline void skb_remcsum_adjust_partial(struct sk_buff *skb, void *ptr, | 3949 | static inline void skb_remcsum_adjust_partial(struct sk_buff *skb, void *ptr, |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 9449b19c5f10..56c9c7eed34e 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/overflow.h> | 16 | #include <linux/overflow.h> |
| 17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
| 18 | #include <linux/workqueue.h> | 18 | #include <linux/workqueue.h> |
| 19 | #include <linux/percpu-refcount.h> | ||
| 19 | 20 | ||
| 20 | 21 | ||
| 21 | /* | 22 | /* |
| @@ -115,6 +116,10 @@ | |||
| 115 | /* Objects are reclaimable */ | 116 | /* Objects are reclaimable */ |
| 116 | #define SLAB_RECLAIM_ACCOUNT ((slab_flags_t __force)0x00020000U) | 117 | #define SLAB_RECLAIM_ACCOUNT ((slab_flags_t __force)0x00020000U) |
| 117 | #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ | 118 | #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ |
| 119 | |||
| 120 | /* Slab deactivation flag */ | ||
| 121 | #define SLAB_DEACTIVATED ((slab_flags_t __force)0x10000000U) | ||
| 122 | |||
| 118 | /* | 123 | /* |
| 119 | * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests. | 124 | * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests. |
| 120 | * | 125 | * |
| @@ -151,8 +156,7 @@ void kmem_cache_destroy(struct kmem_cache *); | |||
| 151 | int kmem_cache_shrink(struct kmem_cache *); | 156 | int kmem_cache_shrink(struct kmem_cache *); |
| 152 | 157 | ||
| 153 | void memcg_create_kmem_cache(struct mem_cgroup *, struct kmem_cache *); | 158 | void memcg_create_kmem_cache(struct mem_cgroup *, struct kmem_cache *); |
| 154 | void memcg_deactivate_kmem_caches(struct mem_cgroup *); | 159 | void memcg_deactivate_kmem_caches(struct mem_cgroup *, struct mem_cgroup *); |
| 155 | void memcg_destroy_kmem_caches(struct mem_cgroup *); | ||
| 156 | 160 | ||
| 157 | /* | 161 | /* |
| 158 | * Please use this macro to create slab caches. Simply specify the | 162 | * Please use this macro to create slab caches. Simply specify the |
| @@ -184,6 +188,7 @@ void * __must_check __krealloc(const void *, size_t, gfp_t); | |||
| 184 | void * __must_check krealloc(const void *, size_t, gfp_t); | 188 | void * __must_check krealloc(const void *, size_t, gfp_t); |
| 185 | void kfree(const void *); | 189 | void kfree(const void *); |
| 186 | void kzfree(const void *); | 190 | void kzfree(const void *); |
| 191 | size_t __ksize(const void *); | ||
| 187 | size_t ksize(const void *); | 192 | size_t ksize(const void *); |
| 188 | 193 | ||
| 189 | #ifdef CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR | 194 | #ifdef CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR |
| @@ -641,11 +646,12 @@ struct memcg_cache_params { | |||
| 641 | struct mem_cgroup *memcg; | 646 | struct mem_cgroup *memcg; |
| 642 | struct list_head children_node; | 647 | struct list_head children_node; |
| 643 | struct list_head kmem_caches_node; | 648 | struct list_head kmem_caches_node; |
| 649 | struct percpu_ref refcnt; | ||
| 644 | 650 | ||
| 645 | void (*deact_fn)(struct kmem_cache *); | 651 | void (*work_fn)(struct kmem_cache *); |
| 646 | union { | 652 | union { |
| 647 | struct rcu_head deact_rcu_head; | 653 | struct rcu_head rcu_head; |
| 648 | struct work_struct deact_work; | 654 | struct work_struct work; |
| 649 | }; | 655 | }; |
| 650 | }; | 656 | }; |
| 651 | }; | 657 | }; |
diff --git a/include/linux/smp.h b/include/linux/smp.h index a56f08ff3097..6fc856c9eda5 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
| @@ -35,7 +35,7 @@ int smp_call_function_single(int cpuid, smp_call_func_t func, void *info, | |||
| 35 | /* | 35 | /* |
| 36 | * Call a function on all processors | 36 | * Call a function on all processors |
| 37 | */ | 37 | */ |
| 38 | int on_each_cpu(smp_call_func_t func, void *info, int wait); | 38 | void on_each_cpu(smp_call_func_t func, void *info, int wait); |
| 39 | 39 | ||
| 40 | /* | 40 | /* |
| 41 | * Call a function on processors specified by mask, which might include | 41 | * Call a function on processors specified by mask, which might include |
| @@ -101,7 +101,7 @@ extern void smp_cpus_done(unsigned int max_cpus); | |||
| 101 | /* | 101 | /* |
| 102 | * Call a function on all other processors | 102 | * Call a function on all other processors |
| 103 | */ | 103 | */ |
| 104 | int smp_call_function(smp_call_func_t func, void *info, int wait); | 104 | void smp_call_function(smp_call_func_t func, void *info, int wait); |
| 105 | void smp_call_function_many(const struct cpumask *mask, | 105 | void smp_call_function_many(const struct cpumask *mask, |
| 106 | smp_call_func_t func, void *info, bool wait); | 106 | smp_call_func_t func, void *info, bool wait); |
| 107 | 107 | ||
| @@ -144,9 +144,8 @@ static inline void smp_send_stop(void) { } | |||
| 144 | * These macros fold the SMP functionality into a single CPU system | 144 | * These macros fold the SMP functionality into a single CPU system |
| 145 | */ | 145 | */ |
| 146 | #define raw_smp_processor_id() 0 | 146 | #define raw_smp_processor_id() 0 |
| 147 | static inline int up_smp_call_function(smp_call_func_t func, void *info) | 147 | static inline void up_smp_call_function(smp_call_func_t func, void *info) |
| 148 | { | 148 | { |
| 149 | return 0; | ||
| 150 | } | 149 | } |
| 151 | #define smp_call_function(func, info, wait) \ | 150 | #define smp_call_function(func, info, wait) \ |
| 152 | (up_smp_call_function(func, info)) | 151 | (up_smp_call_function(func, info)) |
| @@ -181,29 +180,46 @@ static inline int get_boot_cpu_id(void) | |||
| 181 | 180 | ||
| 182 | #endif /* !SMP */ | 181 | #endif /* !SMP */ |
| 183 | 182 | ||
| 184 | /* | 183 | /** |
| 185 | * smp_processor_id(): get the current CPU ID. | 184 | * raw_processor_id() - get the current (unstable) CPU id |
| 185 | * | ||
| 186 | * For then you know what you are doing and need an unstable | ||
| 187 | * CPU id. | ||
| 188 | */ | ||
| 189 | |||
| 190 | /** | ||
| 191 | * smp_processor_id() - get the current (stable) CPU id | ||
| 192 | * | ||
| 193 | * This is the normal accessor to the CPU id and should be used | ||
| 194 | * whenever possible. | ||
| 186 | * | 195 | * |
| 187 | * if DEBUG_PREEMPT is enabled then we check whether it is | 196 | * The CPU id is stable when: |
| 188 | * used in a preemption-safe way. (smp_processor_id() is safe | ||
| 189 | * if it's used in a preemption-off critical section, or in | ||
| 190 | * a thread that is bound to the current CPU.) | ||
| 191 | * | 197 | * |
| 192 | * NOTE: raw_smp_processor_id() is for internal use only | 198 | * - IRQs are disabled; |
| 193 | * (smp_processor_id() is the preferred variant), but in rare | 199 | * - preemption is disabled; |
| 194 | * instances it might also be used to turn off false positives | 200 | * - the task is CPU affine. |
| 195 | * (i.e. smp_processor_id() use that the debugging code reports but | 201 | * |
| 196 | * which use for some reason is legal). Don't use this to hack around | 202 | * When CONFIG_DEBUG_PREEMPT; we verify these assumption and WARN |
| 197 | * the warning message, as your code might not work under PREEMPT. | 203 | * when smp_processor_id() is used when the CPU id is not stable. |
| 204 | */ | ||
| 205 | |||
| 206 | /* | ||
| 207 | * Allow the architecture to differentiate between a stable and unstable read. | ||
| 208 | * For example, x86 uses an IRQ-safe asm-volatile read for the unstable but a | ||
| 209 | * regular asm read for the stable. | ||
| 198 | */ | 210 | */ |
| 211 | #ifndef __smp_processor_id | ||
| 212 | #define __smp_processor_id(x) raw_smp_processor_id(x) | ||
| 213 | #endif | ||
| 214 | |||
| 199 | #ifdef CONFIG_DEBUG_PREEMPT | 215 | #ifdef CONFIG_DEBUG_PREEMPT |
| 200 | extern unsigned int debug_smp_processor_id(void); | 216 | extern unsigned int debug_smp_processor_id(void); |
| 201 | # define smp_processor_id() debug_smp_processor_id() | 217 | # define smp_processor_id() debug_smp_processor_id() |
| 202 | #else | 218 | #else |
| 203 | # define smp_processor_id() raw_smp_processor_id() | 219 | # define smp_processor_id() __smp_processor_id() |
| 204 | #endif | 220 | #endif |
| 205 | 221 | ||
| 206 | #define get_cpu() ({ preempt_disable(); smp_processor_id(); }) | 222 | #define get_cpu() ({ preempt_disable(); __smp_processor_id(); }) |
| 207 | #define put_cpu() preempt_enable() | 223 | #define put_cpu() preempt_enable() |
| 208 | 224 | ||
| 209 | /* | 225 | /* |
diff --git a/include/linux/socket.h b/include/linux/socket.h index b57cd8bf96e2..97523818cb14 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | struct pid; | 13 | struct pid; |
| 14 | struct cred; | 14 | struct cred; |
| 15 | struct socket; | ||
| 15 | 16 | ||
| 16 | #define __sockaddr_check_size(size) \ | 17 | #define __sockaddr_check_size(size) \ |
| 17 | BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage))) | 18 | BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage))) |
| @@ -374,6 +375,12 @@ extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, | |||
| 374 | extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, | 375 | extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, |
| 375 | unsigned int vlen, unsigned int flags, | 376 | unsigned int vlen, unsigned int flags, |
| 376 | bool forbid_cmsg_compat); | 377 | bool forbid_cmsg_compat); |
| 378 | extern long __sys_sendmsg_sock(struct socket *sock, | ||
| 379 | struct user_msghdr __user *msg, | ||
| 380 | unsigned int flags); | ||
| 381 | extern long __sys_recvmsg_sock(struct socket *sock, | ||
| 382 | struct user_msghdr __user *msg, | ||
| 383 | unsigned int flags); | ||
| 377 | 384 | ||
| 378 | /* helpers which do the actual work for syscalls */ | 385 | /* helpers which do the actual work for syscalls */ |
| 379 | extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size, | 386 | extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size, |
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 35662d9c2c62..bea46bd8b6ce 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h | |||
| @@ -41,6 +41,31 @@ struct sdw_slave; | |||
| 41 | #define SDW_DAI_ID_RANGE_START 100 | 41 | #define SDW_DAI_ID_RANGE_START 100 |
| 42 | #define SDW_DAI_ID_RANGE_END 200 | 42 | #define SDW_DAI_ID_RANGE_END 200 |
| 43 | 43 | ||
| 44 | enum { | ||
| 45 | SDW_PORT_DIRN_SINK = 0, | ||
| 46 | SDW_PORT_DIRN_SOURCE, | ||
| 47 | SDW_PORT_DIRN_MAX, | ||
| 48 | }; | ||
| 49 | |||
| 50 | /* | ||
| 51 | * constants for flow control, ports and transport | ||
| 52 | * | ||
| 53 | * these are bit masks as devices can have multiple capabilities | ||
| 54 | */ | ||
| 55 | |||
| 56 | /* | ||
| 57 | * flow modes for SDW port. These can be isochronous, tx controlled, | ||
| 58 | * rx controlled or async | ||
| 59 | */ | ||
| 60 | #define SDW_PORT_FLOW_MODE_ISOCH 0 | ||
| 61 | #define SDW_PORT_FLOW_MODE_TX_CNTRL BIT(0) | ||
| 62 | #define SDW_PORT_FLOW_MODE_RX_CNTRL BIT(1) | ||
| 63 | #define SDW_PORT_FLOW_MODE_ASYNC GENMASK(1, 0) | ||
| 64 | |||
| 65 | /* sample packaging for block. It can be per port or per channel */ | ||
| 66 | #define SDW_BLOCK_PACKG_PER_PORT BIT(0) | ||
| 67 | #define SDW_BLOCK_PACKG_PER_CH BIT(1) | ||
| 68 | |||
| 44 | /** | 69 | /** |
| 45 | * enum sdw_slave_status - Slave status | 70 | * enum sdw_slave_status - Slave status |
| 46 | * @SDW_SLAVE_UNATTACHED: Slave is not attached with the bus. | 71 | * @SDW_SLAVE_UNATTACHED: Slave is not attached with the bus. |
| @@ -76,6 +101,14 @@ enum sdw_command_response { | |||
| 76 | SDW_CMD_FAIL_OTHER = 4, | 101 | SDW_CMD_FAIL_OTHER = 4, |
| 77 | }; | 102 | }; |
| 78 | 103 | ||
| 104 | /* block group count enum */ | ||
| 105 | enum sdw_dpn_grouping { | ||
| 106 | SDW_BLK_GRP_CNT_1 = 0, | ||
| 107 | SDW_BLK_GRP_CNT_2 = 1, | ||
| 108 | SDW_BLK_GRP_CNT_3 = 2, | ||
| 109 | SDW_BLK_GRP_CNT_4 = 3, | ||
| 110 | }; | ||
| 111 | |||
| 79 | /** | 112 | /** |
| 80 | * enum sdw_stream_type: data stream type | 113 | * enum sdw_stream_type: data stream type |
| 81 | * | 114 | * |
| @@ -100,6 +133,26 @@ enum sdw_data_direction { | |||
| 100 | SDW_DATA_DIR_TX = 1, | 133 | SDW_DATA_DIR_TX = 1, |
| 101 | }; | 134 | }; |
| 102 | 135 | ||
| 136 | /** | ||
| 137 | * enum sdw_port_data_mode: Data Port mode | ||
| 138 | * | ||
| 139 | * @SDW_PORT_DATA_MODE_NORMAL: Normal data mode where audio data is received | ||
| 140 | * and transmitted. | ||
| 141 | * @SDW_PORT_DATA_MODE_STATIC_1: Simple test mode which uses static value of | ||
| 142 | * logic 1. The encoding will result in signal transitions at every bitslot | ||
| 143 | * owned by this Port | ||
| 144 | * @SDW_PORT_DATA_MODE_STATIC_0: Simple test mode which uses static value of | ||
| 145 | * logic 0. The encoding will result in no signal transitions | ||
| 146 | * @SDW_PORT_DATA_MODE_PRBS: Test mode which uses a PRBS generator to produce | ||
| 147 | * a pseudo random data pattern that is transferred | ||
| 148 | */ | ||
| 149 | enum sdw_port_data_mode { | ||
| 150 | SDW_PORT_DATA_MODE_NORMAL = 0, | ||
| 151 | SDW_PORT_DATA_MODE_STATIC_1 = 1, | ||
| 152 | SDW_PORT_DATA_MODE_STATIC_0 = 2, | ||
| 153 | SDW_PORT_DATA_MODE_PRBS = 3, | ||
| 154 | }; | ||
| 155 | |||
| 103 | /* | 156 | /* |
| 104 | * SDW properties, defined in MIPI DisCo spec v1.0 | 157 | * SDW properties, defined in MIPI DisCo spec v1.0 |
| 105 | */ | 158 | */ |
| @@ -153,10 +206,11 @@ enum sdw_clk_stop_mode { | |||
| 153 | * (inclusive) | 206 | * (inclusive) |
| 154 | * @num_words: number of wordlengths supported | 207 | * @num_words: number of wordlengths supported |
| 155 | * @words: wordlengths supported | 208 | * @words: wordlengths supported |
| 156 | * @flow_controlled: Slave implementation results in an OK_NotReady | 209 | * @BRA_flow_controlled: Slave implementation results in an OK_NotReady |
| 157 | * response | 210 | * response |
| 158 | * @simple_ch_prep_sm: If channel prepare sequence is required | 211 | * @simple_ch_prep_sm: If channel prepare sequence is required |
| 159 | * @device_interrupts: If implementation-defined interrupts are supported | 212 | * @imp_def_interrupts: If set, each bit corresponds to support for |
| 213 | * implementation-defined interrupts | ||
| 160 | * | 214 | * |
| 161 | * The wordlengths are specified by Spec as max, min AND number of | 215 | * The wordlengths are specified by Spec as max, min AND number of |
| 162 | * discrete values, implementation can define based on the wordlengths they | 216 | * discrete values, implementation can define based on the wordlengths they |
| @@ -167,9 +221,9 @@ struct sdw_dp0_prop { | |||
| 167 | u32 min_word; | 221 | u32 min_word; |
| 168 | u32 num_words; | 222 | u32 num_words; |
| 169 | u32 *words; | 223 | u32 *words; |
| 170 | bool flow_controlled; | 224 | bool BRA_flow_controlled; |
| 171 | bool simple_ch_prep_sm; | 225 | bool simple_ch_prep_sm; |
| 172 | bool device_interrupts; | 226 | bool imp_def_interrupts; |
| 173 | }; | 227 | }; |
| 174 | 228 | ||
| 175 | /** | 229 | /** |
| @@ -219,7 +273,7 @@ struct sdw_dpn_audio_mode { | |||
| 219 | * @simple_ch_prep_sm: If the port supports simplified channel prepare state | 273 | * @simple_ch_prep_sm: If the port supports simplified channel prepare state |
| 220 | * machine | 274 | * machine |
| 221 | * @ch_prep_timeout: Port-specific timeout value, in milliseconds | 275 | * @ch_prep_timeout: Port-specific timeout value, in milliseconds |
| 222 | * @device_interrupts: If set, each bit corresponds to support for | 276 | * @imp_def_interrupts: If set, each bit corresponds to support for |
| 223 | * implementation-defined interrupts | 277 | * implementation-defined interrupts |
| 224 | * @max_ch: Maximum channels supported | 278 | * @max_ch: Maximum channels supported |
| 225 | * @min_ch: Minimum channels supported | 279 | * @min_ch: Minimum channels supported |
| @@ -244,7 +298,7 @@ struct sdw_dpn_prop { | |||
| 244 | u32 max_grouping; | 298 | u32 max_grouping; |
| 245 | bool simple_ch_prep_sm; | 299 | bool simple_ch_prep_sm; |
| 246 | u32 ch_prep_timeout; | 300 | u32 ch_prep_timeout; |
| 247 | u32 device_interrupts; | 301 | u32 imp_def_interrupts; |
| 248 | u32 max_ch; | 302 | u32 max_ch; |
| 249 | u32 min_ch; | 303 | u32 min_ch; |
| 250 | u32 num_ch; | 304 | u32 num_ch; |
| @@ -311,36 +365,32 @@ struct sdw_slave_prop { | |||
| 311 | /** | 365 | /** |
| 312 | * struct sdw_master_prop - Master properties | 366 | * struct sdw_master_prop - Master properties |
| 313 | * @revision: MIPI spec version of the implementation | 367 | * @revision: MIPI spec version of the implementation |
| 314 | * @master_count: Number of masters | 368 | * @clk_stop_modes: Bitmap, bit N set when clock-stop-modeN supported |
| 315 | * @clk_stop_mode: Bitmap for Clock Stop modes supported | 369 | * @max_clk_freq: Maximum Bus clock frequency, in Hz |
| 316 | * @max_freq: Maximum Bus clock frequency, in Hz | ||
| 317 | * @num_clk_gears: Number of clock gears supported | 370 | * @num_clk_gears: Number of clock gears supported |
| 318 | * @clk_gears: Clock gears supported | 371 | * @clk_gears: Clock gears supported |
| 319 | * @num_freq: Number of clock frequencies supported, in Hz | 372 | * @num_clk_freq: Number of clock frequencies supported, in Hz |
| 320 | * @freq: Clock frequencies supported, in Hz | 373 | * @clk_freq: Clock frequencies supported, in Hz |
| 321 | * @default_frame_rate: Controller default Frame rate, in Hz | 374 | * @default_frame_rate: Controller default Frame rate, in Hz |
| 322 | * @default_row: Number of rows | 375 | * @default_row: Number of rows |
| 323 | * @default_col: Number of columns | 376 | * @default_col: Number of columns |
| 324 | * @dynamic_frame: Dynamic frame supported | 377 | * @dynamic_frame: Dynamic frame shape supported |
| 325 | * @err_threshold: Number of times that software may retry sending a single | 378 | * @err_threshold: Number of times that software may retry sending a single |
| 326 | * command | 379 | * command |
| 327 | * @dpn_prop: Data Port N properties | ||
| 328 | */ | 380 | */ |
| 329 | struct sdw_master_prop { | 381 | struct sdw_master_prop { |
| 330 | u32 revision; | 382 | u32 revision; |
| 331 | u32 master_count; | 383 | u32 clk_stop_modes; |
| 332 | enum sdw_clk_stop_mode clk_stop_mode; | 384 | u32 max_clk_freq; |
| 333 | u32 max_freq; | ||
| 334 | u32 num_clk_gears; | 385 | u32 num_clk_gears; |
| 335 | u32 *clk_gears; | 386 | u32 *clk_gears; |
| 336 | u32 num_freq; | 387 | u32 num_clk_freq; |
| 337 | u32 *freq; | 388 | u32 *clk_freq; |
| 338 | u32 default_frame_rate; | 389 | u32 default_frame_rate; |
| 339 | u32 default_row; | 390 | u32 default_row; |
| 340 | u32 default_col; | 391 | u32 default_col; |
| 341 | bool dynamic_frame; | 392 | bool dynamic_frame; |
| 342 | u32 err_threshold; | 393 | u32 err_threshold; |
| 343 | struct sdw_dpn_prop *dpn_prop; | ||
| 344 | }; | 394 | }; |
| 345 | 395 | ||
| 346 | int sdw_master_read_prop(struct sdw_bus *bus); | 396 | int sdw_master_read_prop(struct sdw_bus *bus); |
diff --git a/include/linux/soundwire/sdw_type.h b/include/linux/soundwire/sdw_type.h index 9c756b5a0dfe..aaa7f4267c14 100644 --- a/include/linux/soundwire/sdw_type.h +++ b/include/linux/soundwire/sdw_type.h | |||
| @@ -16,4 +16,15 @@ void sdw_unregister_driver(struct sdw_driver *drv); | |||
| 16 | 16 | ||
| 17 | int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size); | 17 | int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size); |
| 18 | 18 | ||
| 19 | /** | ||
| 20 | * module_sdw_driver() - Helper macro for registering a Soundwire driver | ||
| 21 | * @__sdw_driver: soundwire slave driver struct | ||
| 22 | * | ||
| 23 | * Helper macro for Soundwire drivers which do not do anything special in | ||
| 24 | * module init/exit. This eliminates a lot of boilerplate. Each module may only | ||
| 25 | * use this macro once, and calling it replaces module_init() and module_exit() | ||
| 26 | */ | ||
| 27 | #define module_sdw_driver(__sdw_driver) \ | ||
| 28 | module_driver(__sdw_driver, sdw_register_driver, \ | ||
| 29 | sdw_unregister_driver) | ||
| 19 | #endif /* __SOUNDWIRE_TYPES_H */ | 30 | #endif /* __SOUNDWIRE_TYPES_H */ |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 053abd22ad31..af4f265d0f67 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -109,6 +109,7 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, | |||
| 109 | * This may be changed by the device's driver, or left at the | 109 | * This may be changed by the device's driver, or left at the |
| 110 | * default (0) indicating protocol words are eight bit bytes. | 110 | * default (0) indicating protocol words are eight bit bytes. |
| 111 | * The spi_transfer.bits_per_word can override this for each transfer. | 111 | * The spi_transfer.bits_per_word can override this for each transfer. |
| 112 | * @rt: Make the pump thread real time priority. | ||
| 112 | * @irq: Negative, or the number passed to request_irq() to receive | 113 | * @irq: Negative, or the number passed to request_irq() to receive |
| 113 | * interrupts from this device. | 114 | * interrupts from this device. |
| 114 | * @controller_state: Controller's runtime state | 115 | * @controller_state: Controller's runtime state |
| @@ -143,6 +144,7 @@ struct spi_device { | |||
| 143 | u32 max_speed_hz; | 144 | u32 max_speed_hz; |
| 144 | u8 chip_select; | 145 | u8 chip_select; |
| 145 | u8 bits_per_word; | 146 | u8 bits_per_word; |
| 147 | bool rt; | ||
| 146 | u32 mode; | 148 | u32 mode; |
| 147 | #define SPI_CPHA 0x01 /* clock phase */ | 149 | #define SPI_CPHA 0x01 /* clock phase */ |
| 148 | #define SPI_CPOL 0x02 /* clock polarity */ | 150 | #define SPI_CPOL 0x02 /* clock polarity */ |
| @@ -735,6 +737,9 @@ extern void spi_res_release(struct spi_controller *ctlr, | |||
| 735 | * @bits_per_word: select a bits_per_word other than the device default | 737 | * @bits_per_word: select a bits_per_word other than the device default |
| 736 | * for this transfer. If 0 the default (from @spi_device) is used. | 738 | * for this transfer. If 0 the default (from @spi_device) is used. |
| 737 | * @cs_change: affects chipselect after this transfer completes | 739 | * @cs_change: affects chipselect after this transfer completes |
| 740 | * @cs_change_delay: delay between cs deassert and assert when | ||
| 741 | * @cs_change is set and @spi_transfer is not the last in @spi_message | ||
| 742 | * @cs_change_delay_unit: unit of cs_change_delay | ||
| 738 | * @delay_usecs: microseconds to delay after this transfer before | 743 | * @delay_usecs: microseconds to delay after this transfer before |
| 739 | * (optionally) changing the chipselect status, then starting | 744 | * (optionally) changing the chipselect status, then starting |
| 740 | * the next transfer or completing this @spi_message. | 745 | * the next transfer or completing this @spi_message. |
| @@ -742,6 +747,9 @@ extern void spi_res_release(struct spi_controller *ctlr, | |||
| 742 | * (set by bits_per_word) transmission. | 747 | * (set by bits_per_word) transmission. |
| 743 | * @word_delay: clock cycles to inter word delay after each word size | 748 | * @word_delay: clock cycles to inter word delay after each word size |
| 744 | * (set by bits_per_word) transmission. | 749 | * (set by bits_per_word) transmission. |
| 750 | * @effective_speed_hz: the effective SCK-speed that was used to | ||
| 751 | * transfer this transfer. Set to 0 if the spi bus driver does | ||
| 752 | * not support it. | ||
| 745 | * @transfer_list: transfers are sequenced through @spi_message.transfers | 753 | * @transfer_list: transfers are sequenced through @spi_message.transfers |
| 746 | * @tx_sg: Scatterlist for transmit, currently not for client use | 754 | * @tx_sg: Scatterlist for transmit, currently not for client use |
| 747 | * @rx_sg: Scatterlist for receive, currently not for client use | 755 | * @rx_sg: Scatterlist for receive, currently not for client use |
| @@ -824,9 +832,16 @@ struct spi_transfer { | |||
| 824 | u8 bits_per_word; | 832 | u8 bits_per_word; |
| 825 | u8 word_delay_usecs; | 833 | u8 word_delay_usecs; |
| 826 | u16 delay_usecs; | 834 | u16 delay_usecs; |
| 835 | u16 cs_change_delay; | ||
| 836 | u8 cs_change_delay_unit; | ||
| 837 | #define SPI_DELAY_UNIT_USECS 0 | ||
| 838 | #define SPI_DELAY_UNIT_NSECS 1 | ||
| 839 | #define SPI_DELAY_UNIT_SCK 2 | ||
| 827 | u32 speed_hz; | 840 | u32 speed_hz; |
| 828 | u16 word_delay; | 841 | u16 word_delay; |
| 829 | 842 | ||
| 843 | u32 effective_speed_hz; | ||
| 844 | |||
| 830 | struct list_head transfer_list; | 845 | struct list_head transfer_list; |
| 831 | }; | 846 | }; |
| 832 | 847 | ||
| @@ -967,6 +982,8 @@ static inline void spi_message_free(struct spi_message *m) | |||
| 967 | kfree(m); | 982 | kfree(m); |
| 968 | } | 983 | } |
| 969 | 984 | ||
| 985 | extern void spi_set_cs_timing(struct spi_device *spi, u8 setup, u8 hold, u8 inactive_dly); | ||
| 986 | |||
| 970 | extern int spi_setup(struct spi_device *spi); | 987 | extern int spi_setup(struct spi_device *spi); |
| 971 | extern int spi_async(struct spi_device *spi, struct spi_message *message); | 988 | extern int spi_async(struct spi_device *spi, struct spi_message *message); |
| 972 | extern int spi_async_locked(struct spi_device *spi, | 989 | extern int spi_async_locked(struct spi_device *spi, |
| @@ -997,6 +1014,26 @@ spi_max_transfer_size(struct spi_device *spi) | |||
| 997 | return min(tr_max, msg_max); | 1014 | return min(tr_max, msg_max); |
| 998 | } | 1015 | } |
| 999 | 1016 | ||
| 1017 | /** | ||
| 1018 | * spi_is_bpw_supported - Check if bits per word is supported | ||
| 1019 | * @spi: SPI device | ||
| 1020 | * @bpw: Bits per word | ||
| 1021 | * | ||
| 1022 | * This function checks to see if the SPI controller supports @bpw. | ||
| 1023 | * | ||
| 1024 | * Returns: | ||
| 1025 | * True if @bpw is supported, false otherwise. | ||
| 1026 | */ | ||
| 1027 | static inline bool spi_is_bpw_supported(struct spi_device *spi, u32 bpw) | ||
| 1028 | { | ||
| 1029 | u32 bpw_mask = spi->master->bits_per_word_mask; | ||
| 1030 | |||
| 1031 | if (bpw == 8 || (bpw <= 32 && bpw_mask & SPI_BPW_MASK(bpw))) | ||
| 1032 | return true; | ||
| 1033 | |||
| 1034 | return false; | ||
| 1035 | } | ||
| 1036 | |||
| 1000 | /*---------------------------------------------------------------------------*/ | 1037 | /*---------------------------------------------------------------------------*/ |
| 1001 | 1038 | ||
| 1002 | /* SPI transfer replacement methods which make use of spi_res */ | 1039 | /* SPI transfer replacement methods which make use of spi_res */ |
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index 7f7c8c050f63..9cfcc8a756ae 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h | |||
| @@ -120,9 +120,17 @@ struct srcu_struct { | |||
| 120 | * | 120 | * |
| 121 | * See include/linux/percpu-defs.h for the rules on per-CPU variables. | 121 | * See include/linux/percpu-defs.h for the rules on per-CPU variables. |
| 122 | */ | 122 | */ |
| 123 | #define __DEFINE_SRCU(name, is_static) \ | 123 | #ifdef MODULE |
| 124 | static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data);\ | 124 | # define __DEFINE_SRCU(name, is_static) \ |
| 125 | is_static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name##_srcu_data) | 125 | is_static struct srcu_struct name; \ |
| 126 | struct srcu_struct * const __srcu_struct_##name \ | ||
| 127 | __section("___srcu_struct_ptrs") = &name | ||
| 128 | #else | ||
| 129 | # define __DEFINE_SRCU(name, is_static) \ | ||
| 130 | static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data); \ | ||
| 131 | is_static struct srcu_struct name = \ | ||
| 132 | __SRCU_STRUCT_INIT(name, name##_srcu_data) | ||
| 133 | #endif | ||
| 126 | #define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */) | 134 | #define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */) |
| 127 | #define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static) | 135 | #define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static) |
| 128 | 136 | ||
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 1a0bb622cf10..7d06241582dd 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h | |||
| @@ -78,14 +78,9 @@ | |||
| 78 | /* Platfrom data for platform device structure's platform_data field */ | 78 | /* Platfrom data for platform device structure's platform_data field */ |
| 79 | 79 | ||
| 80 | struct stmmac_mdio_bus_data { | 80 | struct stmmac_mdio_bus_data { |
| 81 | int (*phy_reset)(void *priv); | ||
| 82 | unsigned int phy_mask; | 81 | unsigned int phy_mask; |
| 83 | int *irqs; | 82 | int *irqs; |
| 84 | int probed_phy_irq; | 83 | int probed_phy_irq; |
| 85 | #ifdef CONFIG_OF | ||
| 86 | int reset_gpio, active_low; | ||
| 87 | u32 delays[3]; | ||
| 88 | #endif | ||
| 89 | }; | 84 | }; |
| 90 | 85 | ||
| 91 | struct stmmac_dma_cfg { | 86 | struct stmmac_dma_cfg { |
| @@ -137,6 +132,7 @@ struct plat_stmmacenet_data { | |||
| 137 | int interface; | 132 | int interface; |
| 138 | struct stmmac_mdio_bus_data *mdio_bus_data; | 133 | struct stmmac_mdio_bus_data *mdio_bus_data; |
| 139 | struct device_node *phy_node; | 134 | struct device_node *phy_node; |
| 135 | struct device_node *phylink_node; | ||
| 140 | struct device_node *mdio_node; | 136 | struct device_node *mdio_node; |
| 141 | struct stmmac_dma_cfg *dma_cfg; | 137 | struct stmmac_dma_cfg *dma_cfg; |
| 142 | int clk_csr; | 138 | int clk_csr; |
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index 6d3635c86dbe..f9a0c6189852 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h | |||
| @@ -36,6 +36,7 @@ int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); | |||
| 36 | int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); | 36 | int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); |
| 37 | void stop_machine_park(int cpu); | 37 | void stop_machine_park(int cpu); |
| 38 | void stop_machine_unpark(int cpu); | 38 | void stop_machine_unpark(int cpu); |
| 39 | void stop_machine_yield(const struct cpumask *cpumask); | ||
| 39 | 40 | ||
| 40 | #else /* CONFIG_SMP */ | 41 | #else /* CONFIG_SMP */ |
| 41 | 42 | ||
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index d23c5030901a..c28955132234 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h | |||
| @@ -54,6 +54,9 @@ static inline int string_unescape_any_inplace(char *buf) | |||
| 54 | int string_escape_mem(const char *src, size_t isz, char *dst, size_t osz, | 54 | int string_escape_mem(const char *src, size_t isz, char *dst, size_t osz, |
| 55 | unsigned int flags, const char *only); | 55 | unsigned int flags, const char *only); |
| 56 | 56 | ||
| 57 | int string_escape_mem_ascii(const char *src, size_t isz, char *dst, | ||
| 58 | size_t osz); | ||
| 59 | |||
| 57 | static inline int string_escape_mem_any_np(const char *src, size_t isz, | 60 | static inline int string_escape_mem_any_np(const char *src, size_t isz, |
| 58 | char *dst, size_t osz, const char *only) | 61 | char *dst, size_t osz, const char *only) |
| 59 | { | 62 | { |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 9ee3970ba59c..8a87d8bcb197 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
| @@ -164,6 +164,13 @@ xdr_decode_opaque_fixed(__be32 *p, void *ptr, unsigned int len) | |||
| 164 | return p + XDR_QUADLEN(len); | 164 | return p + XDR_QUADLEN(len); |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | static inline void xdr_netobj_dup(struct xdr_netobj *dst, | ||
| 168 | struct xdr_netobj *src, gfp_t gfp_mask) | ||
| 169 | { | ||
| 170 | dst->data = kmemdup(src->data, src->len, gfp_mask); | ||
| 171 | dst->len = src->len; | ||
| 172 | } | ||
| 173 | |||
| 167 | /* | 174 | /* |
| 168 | * Adjust kvec to reflect end of xdr'ed data (RPC client XDR) | 175 | * Adjust kvec to reflect end of xdr'ed data (RPC client XDR) |
| 169 | */ | 176 | */ |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index f0d262ad7b78..9c0ad1a3a727 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
| @@ -304,7 +304,7 @@ static inline bool idle_should_enter_s2idle(void) | |||
| 304 | return unlikely(s2idle_state == S2IDLE_STATE_ENTER); | 304 | return unlikely(s2idle_state == S2IDLE_STATE_ENTER); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | extern bool pm_suspend_via_s2idle(void); | 307 | extern bool pm_suspend_default_s2idle(void); |
| 308 | extern void __init pm_states_init(void); | 308 | extern void __init pm_states_init(void); |
| 309 | extern void s2idle_set_ops(const struct platform_s2idle_ops *ops); | 309 | extern void s2idle_set_ops(const struct platform_s2idle_ops *ops); |
| 310 | extern void s2idle_wake(void); | 310 | extern void s2idle_wake(void); |
| @@ -336,7 +336,7 @@ static inline void pm_set_suspend_via_firmware(void) {} | |||
| 336 | static inline void pm_set_resume_via_firmware(void) {} | 336 | static inline void pm_set_resume_via_firmware(void) {} |
| 337 | static inline bool pm_suspend_via_firmware(void) { return false; } | 337 | static inline bool pm_suspend_via_firmware(void) { return false; } |
| 338 | static inline bool pm_resume_via_firmware(void) { return false; } | 338 | static inline bool pm_resume_via_firmware(void) { return false; } |
| 339 | static inline bool pm_suspend_via_s2idle(void) { return false; } | 339 | static inline bool pm_suspend_default_s2idle(void) { return false; } |
| 340 | 340 | ||
| 341 | static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} | 341 | static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} |
| 342 | static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } | 342 | static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } |
| @@ -448,6 +448,7 @@ extern bool system_entering_hibernation(void); | |||
| 448 | extern bool hibernation_available(void); | 448 | extern bool hibernation_available(void); |
| 449 | asmlinkage int swsusp_save(void); | 449 | asmlinkage int swsusp_save(void); |
| 450 | extern struct pbe *restore_pblist; | 450 | extern struct pbe *restore_pblist; |
| 451 | int pfn_is_nosave(unsigned long pfn); | ||
| 451 | #else /* CONFIG_HIBERNATION */ | 452 | #else /* CONFIG_HIBERNATION */ |
| 452 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} | 453 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} |
| 453 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} | 454 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 4bfb5c4ac108..de2c67a33b7e 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -148,7 +148,7 @@ struct zone; | |||
| 148 | * We always assume that blocks are of size PAGE_SIZE. | 148 | * We always assume that blocks are of size PAGE_SIZE. |
| 149 | */ | 149 | */ |
| 150 | struct swap_extent { | 150 | struct swap_extent { |
| 151 | struct list_head list; | 151 | struct rb_node rb_node; |
| 152 | pgoff_t start_page; | 152 | pgoff_t start_page; |
| 153 | pgoff_t nr_pages; | 153 | pgoff_t nr_pages; |
| 154 | sector_t start_block; | 154 | sector_t start_block; |
| @@ -175,8 +175,9 @@ enum { | |||
| 175 | SWP_PAGE_DISCARD = (1 << 10), /* freed swap page-cluster discards */ | 175 | SWP_PAGE_DISCARD = (1 << 10), /* freed swap page-cluster discards */ |
| 176 | SWP_STABLE_WRITES = (1 << 11), /* no overwrite PG_writeback pages */ | 176 | SWP_STABLE_WRITES = (1 << 11), /* no overwrite PG_writeback pages */ |
| 177 | SWP_SYNCHRONOUS_IO = (1 << 12), /* synchronous IO is efficient */ | 177 | SWP_SYNCHRONOUS_IO = (1 << 12), /* synchronous IO is efficient */ |
| 178 | SWP_VALID = (1 << 13), /* swap is valid to be operated on? */ | ||
| 178 | /* add others here before... */ | 179 | /* add others here before... */ |
| 179 | SWP_SCANNING = (1 << 13), /* refcount in scan_swap_map */ | 180 | SWP_SCANNING = (1 << 14), /* refcount in scan_swap_map */ |
| 180 | }; | 181 | }; |
| 181 | 182 | ||
| 182 | #define SWAP_CLUSTER_MAX 32UL | 183 | #define SWAP_CLUSTER_MAX 32UL |
| @@ -247,8 +248,7 @@ struct swap_info_struct { | |||
| 247 | unsigned int cluster_next; /* likely index for next allocation */ | 248 | unsigned int cluster_next; /* likely index for next allocation */ |
| 248 | unsigned int cluster_nr; /* countdown to next cluster search */ | 249 | unsigned int cluster_nr; /* countdown to next cluster search */ |
| 249 | struct percpu_cluster __percpu *percpu_cluster; /* per cpu's swap location */ | 250 | struct percpu_cluster __percpu *percpu_cluster; /* per cpu's swap location */ |
| 250 | struct swap_extent *curr_swap_extent; | 251 | struct rb_root swap_extent_root;/* root of the swap extent rbtree */ |
| 251 | struct swap_extent first_swap_extent; | ||
| 252 | struct block_device *bdev; /* swap device or bdev of swap file */ | 252 | struct block_device *bdev; /* swap device or bdev of swap file */ |
| 253 | struct file *swap_file; /* seldom referenced */ | 253 | struct file *swap_file; /* seldom referenced */ |
| 254 | unsigned int old_block_size; /* seldom referenced */ | 254 | unsigned int old_block_size; /* seldom referenced */ |
| @@ -460,7 +460,7 @@ extern unsigned int count_swap_pages(int, int); | |||
| 460 | extern sector_t map_swap_page(struct page *, struct block_device **); | 460 | extern sector_t map_swap_page(struct page *, struct block_device **); |
| 461 | extern sector_t swapdev_block(int, pgoff_t); | 461 | extern sector_t swapdev_block(int, pgoff_t); |
| 462 | extern int page_swapcount(struct page *); | 462 | extern int page_swapcount(struct page *); |
| 463 | extern int __swap_count(struct swap_info_struct *si, swp_entry_t entry); | 463 | extern int __swap_count(swp_entry_t entry); |
| 464 | extern int __swp_swapcount(swp_entry_t entry); | 464 | extern int __swp_swapcount(swp_entry_t entry); |
| 465 | extern int swp_swapcount(swp_entry_t entry); | 465 | extern int swp_swapcount(swp_entry_t entry); |
| 466 | extern struct swap_info_struct *page_swap_info(struct page *); | 466 | extern struct swap_info_struct *page_swap_info(struct page *); |
| @@ -470,6 +470,12 @@ extern int try_to_free_swap(struct page *); | |||
| 470 | struct backing_dev_info; | 470 | struct backing_dev_info; |
| 471 | extern int init_swap_address_space(unsigned int type, unsigned long nr_pages); | 471 | extern int init_swap_address_space(unsigned int type, unsigned long nr_pages); |
| 472 | extern void exit_swap_address_space(unsigned int type); | 472 | extern void exit_swap_address_space(unsigned int type); |
| 473 | extern struct swap_info_struct *get_swap_device(swp_entry_t entry); | ||
| 474 | |||
| 475 | static inline void put_swap_device(struct swap_info_struct *si) | ||
| 476 | { | ||
| 477 | rcu_read_unlock(); | ||
| 478 | } | ||
| 473 | 479 | ||
| 474 | #else /* CONFIG_SWAP */ | 480 | #else /* CONFIG_SWAP */ |
| 475 | 481 | ||
| @@ -576,7 +582,7 @@ static inline int page_swapcount(struct page *page) | |||
| 576 | return 0; | 582 | return 0; |
| 577 | } | 583 | } |
| 578 | 584 | ||
| 579 | static inline int __swap_count(struct swap_info_struct *si, swp_entry_t entry) | 585 | static inline int __swap_count(swp_entry_t entry) |
| 580 | { | 586 | { |
| 581 | return 0; | 587 | return 0; |
| 582 | } | 588 | } |
diff --git a/include/linux/swapops.h b/include/linux/swapops.h index 4d961668e5fc..15bdb6fe71e5 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h | |||
| @@ -129,12 +129,6 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry) | |||
| 129 | { | 129 | { |
| 130 | return pfn_to_page(swp_offset(entry)); | 130 | return pfn_to_page(swp_offset(entry)); |
| 131 | } | 131 | } |
| 132 | |||
| 133 | vm_fault_t device_private_entry_fault(struct vm_area_struct *vma, | ||
| 134 | unsigned long addr, | ||
| 135 | swp_entry_t entry, | ||
| 136 | unsigned int flags, | ||
| 137 | pmd_t *pmdp); | ||
| 138 | #else /* CONFIG_DEVICE_PRIVATE */ | 132 | #else /* CONFIG_DEVICE_PRIVATE */ |
| 139 | static inline swp_entry_t make_device_private_entry(struct page *page, bool write) | 133 | static inline swp_entry_t make_device_private_entry(struct page *page, bool write) |
| 140 | { | 134 | { |
| @@ -164,15 +158,6 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry) | |||
| 164 | { | 158 | { |
| 165 | return NULL; | 159 | return NULL; |
| 166 | } | 160 | } |
| 167 | |||
| 168 | static inline vm_fault_t device_private_entry_fault(struct vm_area_struct *vma, | ||
| 169 | unsigned long addr, | ||
| 170 | swp_entry_t entry, | ||
| 171 | unsigned int flags, | ||
| 172 | pmd_t *pmdp) | ||
| 173 | { | ||
| 174 | return VM_FAULT_SIGBUS; | ||
| 175 | } | ||
| 176 | #endif /* CONFIG_DEVICE_PRIVATE */ | 161 | #endif /* CONFIG_DEVICE_PRIVATE */ |
| 177 | 162 | ||
| 178 | #ifdef CONFIG_MIGRATION | 163 | #ifdef CONFIG_MIGRATION |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 2bcef4c70183..b01d54a5732e 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -68,6 +68,7 @@ struct sigaltstack; | |||
| 68 | struct rseq; | 68 | struct rseq; |
| 69 | union bpf_attr; | 69 | union bpf_attr; |
| 70 | struct io_uring_params; | 70 | struct io_uring_params; |
| 71 | struct clone_args; | ||
| 71 | 72 | ||
| 72 | #include <linux/types.h> | 73 | #include <linux/types.h> |
| 73 | #include <linux/aio_abi.h> | 74 | #include <linux/aio_abi.h> |
| @@ -264,7 +265,7 @@ static inline void addr_limit_user_check(void) | |||
| 264 | 265 | ||
| 265 | if (CHECK_DATA_CORRUPTION(!segment_eq(get_fs(), USER_DS), | 266 | if (CHECK_DATA_CORRUPTION(!segment_eq(get_fs(), USER_DS), |
| 266 | "Invalid address limit on user-mode return")) | 267 | "Invalid address limit on user-mode return")) |
| 267 | force_sig(SIGKILL, current); | 268 | force_sig(SIGKILL); |
| 268 | 269 | ||
| 269 | #ifdef TIF_FSCHECK | 270 | #ifdef TIF_FSCHECK |
| 270 | clear_thread_flag(TIF_FSCHECK); | 271 | clear_thread_flag(TIF_FSCHECK); |
| @@ -850,6 +851,9 @@ asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, | |||
| 850 | int __user *, unsigned long); | 851 | int __user *, unsigned long); |
| 851 | #endif | 852 | #endif |
| 852 | #endif | 853 | #endif |
| 854 | |||
| 855 | asmlinkage long sys_clone3(struct clone_args __user *uargs, size_t size); | ||
| 856 | |||
| 853 | asmlinkage long sys_execve(const char __user *filename, | 857 | asmlinkage long sys_execve(const char __user *filename, |
| 854 | const char __user *const __user *argv, | 858 | const char __user *const __user *argv, |
| 855 | const char __user *const __user *envp); | 859 | const char __user *const __user *envp); |
| @@ -927,6 +931,7 @@ asmlinkage long sys_clock_adjtime32(clockid_t which_clock, | |||
| 927 | struct old_timex32 __user *tx); | 931 | struct old_timex32 __user *tx); |
| 928 | asmlinkage long sys_syncfs(int fd); | 932 | asmlinkage long sys_syncfs(int fd); |
| 929 | asmlinkage long sys_setns(int fd, int nstype); | 933 | asmlinkage long sys_setns(int fd, int nstype); |
| 934 | asmlinkage long sys_pidfd_open(pid_t pid, unsigned int flags); | ||
| 930 | asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg, | 935 | asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg, |
| 931 | unsigned int vlen, unsigned flags); | 936 | unsigned int vlen, unsigned flags); |
| 932 | asmlinkage long sys_process_vm_readv(pid_t pid, | 937 | asmlinkage long sys_process_vm_readv(pid_t pid, |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 786816cf4aa5..965236795750 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -268,6 +268,8 @@ int __must_check sysfs_create_group(struct kobject *kobj, | |||
| 268 | const struct attribute_group *grp); | 268 | const struct attribute_group *grp); |
| 269 | int __must_check sysfs_create_groups(struct kobject *kobj, | 269 | int __must_check sysfs_create_groups(struct kobject *kobj, |
| 270 | const struct attribute_group **groups); | 270 | const struct attribute_group **groups); |
| 271 | int __must_check sysfs_update_groups(struct kobject *kobj, | ||
| 272 | const struct attribute_group **groups); | ||
| 271 | int sysfs_update_group(struct kobject *kobj, | 273 | int sysfs_update_group(struct kobject *kobj, |
| 272 | const struct attribute_group *grp); | 274 | const struct attribute_group *grp); |
| 273 | void sysfs_remove_group(struct kobject *kobj, | 275 | void sysfs_remove_group(struct kobject *kobj, |
| @@ -433,6 +435,12 @@ static inline int sysfs_create_groups(struct kobject *kobj, | |||
| 433 | return 0; | 435 | return 0; |
| 434 | } | 436 | } |
| 435 | 437 | ||
| 438 | static inline int sysfs_update_groups(struct kobject *kobj, | ||
| 439 | const struct attribute_group **groups) | ||
| 440 | { | ||
| 441 | return 0; | ||
| 442 | } | ||
| 443 | |||
| 436 | static inline int sysfs_update_group(struct kobject *kobj, | 444 | static inline int sysfs_update_group(struct kobject *kobj, |
| 437 | const struct attribute_group *grp) | 445 | const struct attribute_group *grp) |
| 438 | { | 446 | { |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 9a478a0cd3a2..f3a85a7fb4b1 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
| @@ -58,12 +58,7 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb) | |||
| 58 | 58 | ||
| 59 | /* TCP Fast Open Cookie as stored in memory */ | 59 | /* TCP Fast Open Cookie as stored in memory */ |
| 60 | struct tcp_fastopen_cookie { | 60 | struct tcp_fastopen_cookie { |
| 61 | union { | 61 | __le64 val[DIV_ROUND_UP(TCP_FASTOPEN_COOKIE_MAX, sizeof(u64))]; |
| 62 | u8 val[TCP_FASTOPEN_COOKIE_MAX]; | ||
| 63 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 64 | struct in6_addr addr; | ||
| 65 | #endif | ||
| 66 | }; | ||
| 67 | s8 len; | 62 | s8 len; |
| 68 | bool exp; /* In RFC6994 experimental option format */ | 63 | bool exp; /* In RFC6994 experimental option format */ |
| 69 | }; | 64 | }; |
| @@ -245,6 +240,7 @@ struct tcp_sock { | |||
| 245 | syn_smc:1; /* SYN includes SMC */ | 240 | syn_smc:1; /* SYN includes SMC */ |
| 246 | u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ | 241 | u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ |
| 247 | 242 | ||
| 243 | u32 tcp_tx_delay; /* delay (in usec) added to TX packets */ | ||
| 248 | u64 tcp_wstamp_ns; /* departure time for next sent data packet */ | 244 | u64 tcp_wstamp_ns; /* departure time for next sent data packet */ |
| 249 | u64 tcp_clock_cache; /* cache last tcp_clock_ns() (see tcp_mstamp_refresh()) */ | 245 | u64 tcp_clock_cache; /* cache last tcp_clock_ns() (see tcp_mstamp_refresh()) */ |
| 250 | 246 | ||
| @@ -436,6 +432,7 @@ struct tcp_timewait_sock { | |||
| 436 | u32 tw_last_oow_ack_time; | 432 | u32 tw_last_oow_ack_time; |
| 437 | 433 | ||
| 438 | int tw_ts_recent_stamp; | 434 | int tw_ts_recent_stamp; |
| 435 | u32 tw_tx_delay; | ||
| 439 | #ifdef CONFIG_TCP_MD5SIG | 436 | #ifdef CONFIG_TCP_MD5SIG |
| 440 | struct tcp_md5sig_key *tw_md5_key; | 437 | struct tcp_md5sig_key *tw_md5_key; |
| 441 | #endif | 438 | #endif |
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index a8ab0f143ac4..b27e2ffa96c1 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
| @@ -113,6 +113,34 @@ static inline ktime_t ktime_get_coarse_clocktai(void) | |||
| 113 | return ktime_get_coarse_with_offset(TK_OFFS_TAI); | 113 | return ktime_get_coarse_with_offset(TK_OFFS_TAI); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static inline ktime_t ktime_get_coarse(void) | ||
| 117 | { | ||
| 118 | struct timespec64 ts; | ||
| 119 | |||
| 120 | ktime_get_coarse_ts64(&ts); | ||
| 121 | return timespec64_to_ktime(ts); | ||
| 122 | } | ||
| 123 | |||
| 124 | static inline u64 ktime_get_coarse_ns(void) | ||
| 125 | { | ||
| 126 | return ktime_to_ns(ktime_get_coarse()); | ||
| 127 | } | ||
| 128 | |||
| 129 | static inline u64 ktime_get_coarse_real_ns(void) | ||
| 130 | { | ||
| 131 | return ktime_to_ns(ktime_get_coarse_real()); | ||
| 132 | } | ||
| 133 | |||
| 134 | static inline u64 ktime_get_coarse_boottime_ns(void) | ||
| 135 | { | ||
| 136 | return ktime_to_ns(ktime_get_coarse_boottime()); | ||
| 137 | } | ||
| 138 | |||
| 139 | static inline u64 ktime_get_coarse_clocktai_ns(void) | ||
| 140 | { | ||
| 141 | return ktime_to_ns(ktime_get_coarse_clocktai()); | ||
| 142 | } | ||
| 143 | |||
| 116 | /** | 144 | /** |
| 117 | * ktime_mono_to_real - Convert monotonic time to clock realtime | 145 | * ktime_mono_to_real - Convert monotonic time to clock realtime |
| 118 | */ | 146 | */ |
| @@ -131,12 +159,12 @@ static inline u64 ktime_get_real_ns(void) | |||
| 131 | return ktime_to_ns(ktime_get_real()); | 159 | return ktime_to_ns(ktime_get_real()); |
| 132 | } | 160 | } |
| 133 | 161 | ||
| 134 | static inline u64 ktime_get_boot_ns(void) | 162 | static inline u64 ktime_get_boottime_ns(void) |
| 135 | { | 163 | { |
| 136 | return ktime_to_ns(ktime_get_boottime()); | 164 | return ktime_to_ns(ktime_get_boottime()); |
| 137 | } | 165 | } |
| 138 | 166 | ||
| 139 | static inline u64 ktime_get_tai_ns(void) | 167 | static inline u64 ktime_get_clocktai_ns(void) |
| 140 | { | 168 | { |
| 141 | return ktime_to_ns(ktime_get_clocktai()); | 169 | return ktime_to_ns(ktime_get_clocktai()); |
| 142 | } | 170 | } |
diff --git a/include/linux/timer.h b/include/linux/timer.h index 7b066fd38248..282e4f2a532a 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
| @@ -36,19 +36,30 @@ struct timer_list { | |||
| 36 | #define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) | 36 | #define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| 39 | /* | 39 | /** |
| 40 | * A deferrable timer will work normally when the system is busy, but | 40 | * @TIMER_DEFERRABLE: A deferrable timer will work normally when the |
| 41 | * will not cause a CPU to come out of idle just to service it; instead, | 41 | * system is busy, but will not cause a CPU to come out of idle just |
| 42 | * the timer will be serviced when the CPU eventually wakes up with a | 42 | * to service it; instead, the timer will be serviced when the CPU |
| 43 | * subsequent non-deferrable timer. | 43 | * eventually wakes up with a subsequent non-deferrable timer. |
| 44 | * | 44 | * |
| 45 | * An irqsafe timer is executed with IRQ disabled and it's safe to wait for | 45 | * @TIMER_IRQSAFE: An irqsafe timer is executed with IRQ disabled and |
| 46 | * the completion of the running instance from IRQ handlers, for example, | 46 | * it's safe to wait for the completion of the running instance from |
| 47 | * by calling del_timer_sync(). | 47 | * IRQ handlers, for example, by calling del_timer_sync(). |
| 48 | * | 48 | * |
| 49 | * Note: The irq disabled callback execution is a special case for | 49 | * Note: The irq disabled callback execution is a special case for |
| 50 | * workqueue locking issues. It's not meant for executing random crap | 50 | * workqueue locking issues. It's not meant for executing random crap |
| 51 | * with interrupts disabled. Abuse is monitored! | 51 | * with interrupts disabled. Abuse is monitored! |
| 52 | * | ||
| 53 | * @TIMER_PINNED: A pinned timer will not be affected by any timer | ||
| 54 | * placement heuristics (like, NOHZ) and will always expire on the CPU | ||
| 55 | * on which the timer was enqueued. | ||
| 56 | * | ||
| 57 | * Note: Because enqueuing of timers can migrate the timer from one | ||
| 58 | * CPU to another, pinned timers are not guaranteed to stay on the | ||
| 59 | * initialy selected CPU. They move to the CPU on which the enqueue | ||
| 60 | * function is invoked via mod_timer() or add_timer(). If the timer | ||
| 61 | * should be placed on a particular CPU, then add_timer_on() has to be | ||
| 62 | * used. | ||
| 52 | */ | 63 | */ |
| 53 | #define TIMER_CPUMASK 0x0003FFFF | 64 | #define TIMER_CPUMASK 0x0003FFFF |
| 54 | #define TIMER_MIGRATING 0x00040000 | 65 | #define TIMER_MIGRATING 0x00040000 |
diff --git a/include/linux/topology.h b/include/linux/topology.h index cb0775e1ee4b..47a3e3c08036 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
| @@ -184,6 +184,9 @@ static inline int cpu_to_mem(int cpu) | |||
| 184 | #ifndef topology_physical_package_id | 184 | #ifndef topology_physical_package_id |
| 185 | #define topology_physical_package_id(cpu) ((void)(cpu), -1) | 185 | #define topology_physical_package_id(cpu) ((void)(cpu), -1) |
| 186 | #endif | 186 | #endif |
| 187 | #ifndef topology_die_id | ||
| 188 | #define topology_die_id(cpu) ((void)(cpu), -1) | ||
| 189 | #endif | ||
| 187 | #ifndef topology_core_id | 190 | #ifndef topology_core_id |
| 188 | #define topology_core_id(cpu) ((void)(cpu), 0) | 191 | #define topology_core_id(cpu) ((void)(cpu), 0) |
| 189 | #endif | 192 | #endif |
| @@ -193,6 +196,9 @@ static inline int cpu_to_mem(int cpu) | |||
| 193 | #ifndef topology_core_cpumask | 196 | #ifndef topology_core_cpumask |
| 194 | #define topology_core_cpumask(cpu) cpumask_of(cpu) | 197 | #define topology_core_cpumask(cpu) cpumask_of(cpu) |
| 195 | #endif | 198 | #endif |
| 199 | #ifndef topology_die_cpumask | ||
| 200 | #define topology_die_cpumask(cpu) cpumask_of(cpu) | ||
| 201 | #endif | ||
| 196 | 202 | ||
| 197 | #ifdef CONFIG_SCHED_SMT | 203 | #ifdef CONFIG_SCHED_SMT |
| 198 | static inline const struct cpumask *cpu_smt_mask(int cpu) | 204 | static inline const struct cpumask *cpu_smt_mask(int cpu) |
diff --git a/include/linux/torture.h b/include/linux/torture.h index 23d80db426d7..a620118385bb 100644 --- a/include/linux/torture.h +++ b/include/linux/torture.h | |||
| @@ -66,7 +66,7 @@ int torture_shutdown_init(int ssecs, void (*cleanup)(void)); | |||
| 66 | 66 | ||
| 67 | /* Task stuttering, which forces load/no-load transitions. */ | 67 | /* Task stuttering, which forces load/no-load transitions. */ |
| 68 | bool stutter_wait(const char *title); | 68 | bool stutter_wait(const char *title); |
| 69 | int torture_stutter_init(int s); | 69 | int torture_stutter_init(int s, int sgap); |
| 70 | 70 | ||
| 71 | /* Initialization and cleanup. */ | 71 | /* Initialization and cleanup. */ |
| 72 | bool torture_init_begin(char *ttype, int v); | 72 | bool torture_init_begin(char *ttype, int v); |
diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h index 81519f163211..63238c84dc0b 100644 --- a/include/linux/tpm_eventlog.h +++ b/include/linux/tpm_eventlog.h | |||
| @@ -112,4 +112,156 @@ struct tcg_pcr_event2_head { | |||
| 112 | struct tpm_digest digests[]; | 112 | struct tpm_digest digests[]; |
| 113 | } __packed; | 113 | } __packed; |
| 114 | 114 | ||
| 115 | struct tcg_algorithm_size { | ||
| 116 | u16 algorithm_id; | ||
| 117 | u16 algorithm_size; | ||
| 118 | }; | ||
| 119 | |||
| 120 | struct tcg_algorithm_info { | ||
| 121 | u8 signature[16]; | ||
| 122 | u32 platform_class; | ||
| 123 | u8 spec_version_minor; | ||
| 124 | u8 spec_version_major; | ||
| 125 | u8 spec_errata; | ||
| 126 | u8 uintn_size; | ||
| 127 | u32 number_of_algorithms; | ||
| 128 | struct tcg_algorithm_size digest_sizes[]; | ||
| 129 | }; | ||
| 130 | |||
| 131 | #ifndef TPM_MEMREMAP | ||
| 132 | #define TPM_MEMREMAP(start, size) NULL | ||
| 133 | #endif | ||
| 134 | |||
| 135 | #ifndef TPM_MEMUNMAP | ||
| 136 | #define TPM_MEMUNMAP(start, size) do{} while(0) | ||
| 137 | #endif | ||
| 138 | |||
| 139 | /** | ||
| 140 | * __calc_tpm2_event_size - calculate the size of a TPM2 event log entry | ||
| 141 | * @event: Pointer to the event whose size should be calculated | ||
| 142 | * @event_header: Pointer to the initial event containing the digest lengths | ||
| 143 | * @do_mapping: Whether or not the event needs to be mapped | ||
| 144 | * | ||
| 145 | * The TPM2 event log format can contain multiple digests corresponding to | ||
| 146 | * separate PCR banks, and also contains a variable length of the data that | ||
| 147 | * was measured. This requires knowledge of how long each digest type is, | ||
| 148 | * and this information is contained within the first event in the log. | ||
| 149 | * | ||
| 150 | * We calculate the length by examining the number of events, and then looking | ||
| 151 | * at each event in turn to determine how much space is used for events in | ||
| 152 | * total. Once we've done this we know the offset of the data length field, | ||
| 153 | * and can calculate the total size of the event. | ||
| 154 | * | ||
| 155 | * Return: size of the event on success, <0 on failure | ||
| 156 | */ | ||
| 157 | |||
| 158 | static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, | ||
| 159 | struct tcg_pcr_event *event_header, | ||
| 160 | bool do_mapping) | ||
| 161 | { | ||
| 162 | struct tcg_efi_specid_event_head *efispecid; | ||
| 163 | struct tcg_event_field *event_field; | ||
| 164 | void *mapping = NULL; | ||
| 165 | int mapping_size; | ||
| 166 | void *marker; | ||
| 167 | void *marker_start; | ||
| 168 | u32 halg_size; | ||
| 169 | size_t size; | ||
| 170 | u16 halg; | ||
| 171 | int i; | ||
| 172 | int j; | ||
| 173 | |||
| 174 | marker = event; | ||
| 175 | marker_start = marker; | ||
| 176 | marker = marker + sizeof(event->pcr_idx) + sizeof(event->event_type) | ||
| 177 | + sizeof(event->count); | ||
| 178 | |||
| 179 | /* Map the event header */ | ||
| 180 | if (do_mapping) { | ||
| 181 | mapping_size = marker - marker_start; | ||
| 182 | mapping = TPM_MEMREMAP((unsigned long)marker_start, | ||
| 183 | mapping_size); | ||
| 184 | if (!mapping) { | ||
| 185 | size = 0; | ||
| 186 | goto out; | ||
| 187 | } | ||
| 188 | } else { | ||
| 189 | mapping = marker_start; | ||
| 190 | } | ||
| 191 | |||
| 192 | event = (struct tcg_pcr_event2_head *)mapping; | ||
| 193 | |||
| 194 | efispecid = (struct tcg_efi_specid_event_head *)event_header->event; | ||
| 195 | |||
| 196 | /* Check if event is malformed. */ | ||
| 197 | if (event->count > efispecid->num_algs) { | ||
| 198 | size = 0; | ||
| 199 | goto out; | ||
| 200 | } | ||
| 201 | |||
| 202 | for (i = 0; i < event->count; i++) { | ||
| 203 | halg_size = sizeof(event->digests[i].alg_id); | ||
| 204 | |||
| 205 | /* Map the digest's algorithm identifier */ | ||
| 206 | if (do_mapping) { | ||
| 207 | TPM_MEMUNMAP(mapping, mapping_size); | ||
| 208 | mapping_size = halg_size; | ||
| 209 | mapping = TPM_MEMREMAP((unsigned long)marker, | ||
| 210 | mapping_size); | ||
| 211 | if (!mapping) { | ||
| 212 | size = 0; | ||
| 213 | goto out; | ||
| 214 | } | ||
| 215 | } else { | ||
| 216 | mapping = marker; | ||
| 217 | } | ||
| 218 | |||
| 219 | memcpy(&halg, mapping, halg_size); | ||
| 220 | marker = marker + halg_size; | ||
| 221 | |||
| 222 | for (j = 0; j < efispecid->num_algs; j++) { | ||
| 223 | if (halg == efispecid->digest_sizes[j].alg_id) { | ||
| 224 | marker += | ||
| 225 | efispecid->digest_sizes[j].digest_size; | ||
| 226 | break; | ||
| 227 | } | ||
| 228 | } | ||
| 229 | /* Algorithm without known length. Such event is unparseable. */ | ||
| 230 | if (j == efispecid->num_algs) { | ||
| 231 | size = 0; | ||
| 232 | goto out; | ||
| 233 | } | ||
| 234 | } | ||
| 235 | |||
| 236 | /* | ||
| 237 | * Map the event size - we don't read from the event itself, so | ||
| 238 | * we don't need to map it | ||
| 239 | */ | ||
| 240 | if (do_mapping) { | ||
| 241 | TPM_MEMUNMAP(mapping, mapping_size); | ||
| 242 | mapping_size += sizeof(event_field->event_size); | ||
| 243 | mapping = TPM_MEMREMAP((unsigned long)marker, | ||
| 244 | mapping_size); | ||
| 245 | if (!mapping) { | ||
| 246 | size = 0; | ||
| 247 | goto out; | ||
| 248 | } | ||
| 249 | } else { | ||
| 250 | mapping = marker; | ||
| 251 | } | ||
| 252 | |||
| 253 | event_field = (struct tcg_event_field *)mapping; | ||
| 254 | |||
| 255 | marker = marker + sizeof(event_field->event_size) | ||
| 256 | + event_field->event_size; | ||
| 257 | size = marker - marker_start; | ||
| 258 | |||
| 259 | if ((event->event_type == 0) && (event_field->event_size == 0)) | ||
| 260 | size = 0; | ||
| 261 | out: | ||
| 262 | if (do_mapping) | ||
| 263 | TPM_MEMUNMAP(mapping, mapping_size); | ||
| 264 | return size; | ||
| 265 | } | ||
| 266 | |||
| 115 | #endif | 267 | #endif |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 09d678433fc0..8446573cc682 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
| @@ -184,6 +184,13 @@ static inline void tracehook_notify_resume(struct pt_regs *regs) | |||
| 184 | if (unlikely(current->task_works)) | 184 | if (unlikely(current->task_works)) |
| 185 | task_work_run(); | 185 | task_work_run(); |
| 186 | 186 | ||
| 187 | #ifdef CONFIG_KEYS_REQUEST_CACHE | ||
| 188 | if (unlikely(current->cached_requested_key)) { | ||
| 189 | key_put(current->cached_requested_key); | ||
| 190 | current->cached_requested_key = NULL; | ||
| 191 | } | ||
| 192 | #endif | ||
| 193 | |||
| 187 | mem_cgroup_handle_over_high(); | 194 | mem_cgroup_handle_over_high(); |
| 188 | blkcg_maybe_throttle_current(); | 195 | blkcg_maybe_throttle_current(); |
| 189 | } | 196 | } |
diff --git a/include/linux/types.h b/include/linux/types.h index 231114ae38f4..05030f608be3 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
| @@ -174,7 +174,7 @@ typedef struct { | |||
| 174 | 174 | ||
| 175 | #ifdef CONFIG_64BIT | 175 | #ifdef CONFIG_64BIT |
| 176 | typedef struct { | 176 | typedef struct { |
| 177 | long counter; | 177 | s64 counter; |
| 178 | } atomic64_t; | 178 | } atomic64_t; |
| 179 | #endif | 179 | #endif |
| 180 | 180 | ||
diff --git a/include/linux/uio.h b/include/linux/uio.h index 2c90a0842ee8..ab5f523bc0df 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
| @@ -19,9 +19,6 @@ struct kvec { | |||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | enum iter_type { | 21 | enum iter_type { |
| 22 | /* set if ITER_BVEC doesn't hold a bv_page ref */ | ||
| 23 | ITER_BVEC_FLAG_NO_REF = 2, | ||
| 24 | |||
| 25 | /* iter types */ | 22 | /* iter types */ |
| 26 | ITER_IOVEC = 4, | 23 | ITER_IOVEC = 4, |
| 27 | ITER_KVEC = 8, | 24 | ITER_KVEC = 8, |
| @@ -56,7 +53,7 @@ struct iov_iter { | |||
| 56 | 53 | ||
| 57 | static inline enum iter_type iov_iter_type(const struct iov_iter *i) | 54 | static inline enum iter_type iov_iter_type(const struct iov_iter *i) |
| 58 | { | 55 | { |
| 59 | return i->type & ~(READ | WRITE | ITER_BVEC_FLAG_NO_REF); | 56 | return i->type & ~(READ | WRITE); |
| 60 | } | 57 | } |
| 61 | 58 | ||
| 62 | static inline bool iter_is_iovec(const struct iov_iter *i) | 59 | static inline bool iter_is_iovec(const struct iov_iter *i) |
| @@ -89,11 +86,6 @@ static inline unsigned char iov_iter_rw(const struct iov_iter *i) | |||
| 89 | return i->type & (READ | WRITE); | 86 | return i->type & (READ | WRITE); |
| 90 | } | 87 | } |
| 91 | 88 | ||
| 92 | static inline bool iov_iter_bvec_no_ref(const struct iov_iter *i) | ||
| 93 | { | ||
| 94 | return (i->type & ITER_BVEC_FLAG_NO_REF) != 0; | ||
| 95 | } | ||
| 96 | |||
| 97 | /* | 89 | /* |
| 98 | * Total number of bytes covered by an iovec. | 90 | * Total number of bytes covered by an iovec. |
| 99 | * | 91 | * |
| @@ -275,13 +267,13 @@ bool csum_and_copy_from_iter_full(void *addr, size_t bytes, __wsum *csum, struct | |||
| 275 | size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp, | 267 | size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp, |
| 276 | struct iov_iter *i); | 268 | struct iov_iter *i); |
| 277 | 269 | ||
| 278 | int import_iovec(int type, const struct iovec __user * uvector, | 270 | ssize_t import_iovec(int type, const struct iovec __user * uvector, |
| 279 | unsigned nr_segs, unsigned fast_segs, | 271 | unsigned nr_segs, unsigned fast_segs, |
| 280 | struct iovec **iov, struct iov_iter *i); | 272 | struct iovec **iov, struct iov_iter *i); |
| 281 | 273 | ||
| 282 | #ifdef CONFIG_COMPAT | 274 | #ifdef CONFIG_COMPAT |
| 283 | struct compat_iovec; | 275 | struct compat_iovec; |
| 284 | int compat_import_iovec(int type, const struct compat_iovec __user * uvector, | 276 | ssize_t compat_import_iovec(int type, const struct compat_iovec __user * uvector, |
| 285 | unsigned nr_segs, unsigned fast_segs, | 277 | unsigned nr_segs, unsigned fast_segs, |
| 286 | struct iovec **iov, struct iov_iter *i); | 278 | struct iovec **iov, struct iov_iter *i); |
| 287 | #endif | 279 | #endif |
diff --git a/include/linux/unicode.h b/include/linux/unicode.h index aec2c6d800aa..990aa97d8049 100644 --- a/include/linux/unicode.h +++ b/include/linux/unicode.h | |||
| @@ -17,6 +17,9 @@ int utf8_strncmp(const struct unicode_map *um, | |||
| 17 | 17 | ||
| 18 | int utf8_strncasecmp(const struct unicode_map *um, | 18 | int utf8_strncasecmp(const struct unicode_map *um, |
| 19 | const struct qstr *s1, const struct qstr *s2); | 19 | const struct qstr *s1, const struct qstr *s2); |
| 20 | int utf8_strncasecmp_folded(const struct unicode_map *um, | ||
| 21 | const struct qstr *cf, | ||
| 22 | const struct qstr *s1); | ||
| 20 | 23 | ||
| 21 | int utf8_normalize(const struct unicode_map *um, const struct qstr *str, | 24 | int utf8_normalize(const struct unicode_map *um, const struct qstr *str, |
| 22 | unsigned char *dest, size_t dlen); | 25 | unsigned char *dest, size_t dlen); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index ae82d9d1112b..83d35d993e8c 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -578,6 +578,7 @@ struct usb3_lpm_parameters { | |||
| 578 | * @bus_mA: Current available from the bus | 578 | * @bus_mA: Current available from the bus |
| 579 | * @portnum: parent port number (origin 1) | 579 | * @portnum: parent port number (origin 1) |
| 580 | * @level: number of USB hub ancestors | 580 | * @level: number of USB hub ancestors |
| 581 | * @devaddr: device address, XHCI: assigned by HW, others: same as devnum | ||
| 581 | * @can_submit: URBs may be submitted | 582 | * @can_submit: URBs may be submitted |
| 582 | * @persist_enabled: USB_PERSIST enabled for this device | 583 | * @persist_enabled: USB_PERSIST enabled for this device |
| 583 | * @have_langid: whether string_langid is valid | 584 | * @have_langid: whether string_langid is valid |
| @@ -661,6 +662,7 @@ struct usb_device { | |||
| 661 | unsigned short bus_mA; | 662 | unsigned short bus_mA; |
| 662 | u8 portnum; | 663 | u8 portnum; |
| 663 | u8 level; | 664 | u8 level; |
| 665 | u8 devaddr; | ||
| 664 | 666 | ||
| 665 | unsigned can_submit:1; | 667 | unsigned can_submit:1; |
| 666 | unsigned persist_enabled:1; | 668 | unsigned persist_enabled:1; |
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index 911e05af671e..edd89b7c8f18 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h | |||
| @@ -61,6 +61,7 @@ struct ci_hdrc_platform_data { | |||
| 61 | #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */ | 61 | #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */ |
| 62 | #define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13) | 62 | #define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13) |
| 63 | #define CI_HDRC_IMX_IS_HSIC BIT(14) | 63 | #define CI_HDRC_IMX_IS_HSIC BIT(14) |
| 64 | #define CI_HDRC_PMQOS BIT(15) | ||
| 64 | enum usb_dr_mode dr_mode; | 65 | enum usb_dr_mode dr_mode; |
| 65 | #define CI_HDRC_CONTROLLER_RESET_EVENT 0 | 66 | #define CI_HDRC_CONTROLLER_RESET_EVENT 0 |
| 66 | #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 | 67 | #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 |
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 7595056b96c1..fb19141151d8 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
| @@ -310,7 +310,8 @@ struct usb_gadget_ops { | |||
| 310 | int (*pullup) (struct usb_gadget *, int is_on); | 310 | int (*pullup) (struct usb_gadget *, int is_on); |
| 311 | int (*ioctl)(struct usb_gadget *, | 311 | int (*ioctl)(struct usb_gadget *, |
| 312 | unsigned code, unsigned long param); | 312 | unsigned code, unsigned long param); |
| 313 | void (*get_config_params)(struct usb_dcd_config_params *); | 313 | void (*get_config_params)(struct usb_gadget *, |
| 314 | struct usb_dcd_config_params *); | ||
| 314 | int (*udc_start)(struct usb_gadget *, | 315 | int (*udc_start)(struct usb_gadget *, |
| 315 | struct usb_gadget_driver *); | 316 | struct usb_gadget_driver *); |
| 316 | int (*udc_stop)(struct usb_gadget *); | 317 | int (*udc_stop)(struct usb_gadget *); |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index bb57b5af4700..bab27ccc8ff5 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
| @@ -216,6 +216,9 @@ struct usb_hcd { | |||
| 216 | #define HC_IS_RUNNING(state) ((state) & __ACTIVE) | 216 | #define HC_IS_RUNNING(state) ((state) & __ACTIVE) |
| 217 | #define HC_IS_SUSPENDED(state) ((state) & __SUSPEND) | 217 | #define HC_IS_SUSPENDED(state) ((state) & __SUSPEND) |
| 218 | 218 | ||
| 219 | /* memory pool for HCs having local memory, or %NULL */ | ||
| 220 | struct gen_pool *localmem_pool; | ||
| 221 | |||
| 219 | /* more shared queuing code would be good; it should support | 222 | /* more shared queuing code would be good; it should support |
| 220 | * smarter scheduling, handle transaction translators, etc; | 223 | * smarter scheduling, handle transaction translators, etc; |
| 221 | * input size of periodic table to an interrupt scheduler. | 224 | * input size of periodic table to an interrupt scheduler. |
| @@ -253,7 +256,6 @@ struct hc_driver { | |||
| 253 | 256 | ||
| 254 | int flags; | 257 | int flags; |
| 255 | #define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ | 258 | #define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ |
| 256 | #define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */ | ||
| 257 | #define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */ | 259 | #define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */ |
| 258 | #define HCD_USB11 0x0010 /* USB 1.1 */ | 260 | #define HCD_USB11 0x0010 /* USB 1.1 */ |
| 259 | #define HCD_USB2 0x0020 /* USB 2.0 */ | 261 | #define HCD_USB2 0x0020 /* USB 2.0 */ |
| @@ -461,6 +463,8 @@ extern int usb_add_hcd(struct usb_hcd *hcd, | |||
| 461 | unsigned int irqnum, unsigned long irqflags); | 463 | unsigned int irqnum, unsigned long irqflags); |
| 462 | extern void usb_remove_hcd(struct usb_hcd *hcd); | 464 | extern void usb_remove_hcd(struct usb_hcd *hcd); |
| 463 | extern int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1); | 465 | extern int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1); |
| 466 | int usb_hcd_setup_local_mem(struct usb_hcd *hcd, phys_addr_t phys_addr, | ||
| 467 | dma_addr_t dma, size_t size); | ||
| 464 | 468 | ||
| 465 | struct platform_device; | 469 | struct platform_device; |
| 466 | extern void usb_hcd_platform_shutdown(struct platform_device *dev); | 470 | extern void usb_hcd_platform_shutdown(struct platform_device *dev); |
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index 53924f8e840c..6914475bbc86 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | * Renesas USB | 3 | * Renesas USB |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2011 Renesas Solutions Corp. | 5 | * Copyright (C) 2011 Renesas Solutions Corp. |
| 6 | * Copyright (C) 2019 Renesas Electronics Corporation | ||
| 6 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 7 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 7 | * | 8 | * |
| 8 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
| @@ -33,17 +34,6 @@ enum { | |||
| 33 | }; | 34 | }; |
| 34 | 35 | ||
| 35 | /* | 36 | /* |
| 36 | * callback functions table for driver | ||
| 37 | * | ||
| 38 | * These functions are called from platform for driver. | ||
| 39 | * Callback function's pointer will be set before | ||
| 40 | * renesas_usbhs_platform_callback :: hardware_init was called | ||
| 41 | */ | ||
| 42 | struct renesas_usbhs_driver_callback { | ||
| 43 | int (*notify_hotplug)(struct platform_device *pdev); | ||
| 44 | }; | ||
| 45 | |||
| 46 | /* | ||
| 47 | * callback functions for platform | 37 | * callback functions for platform |
| 48 | * | 38 | * |
| 49 | * These functions are called from driver for platform | 39 | * These functions are called from driver for platform |
| @@ -180,23 +170,20 @@ struct renesas_usbhs_driver_param { | |||
| 180 | */ | 170 | */ |
| 181 | int pio_dma_border; /* default is 64byte */ | 171 | int pio_dma_border; /* default is 64byte */ |
| 182 | 172 | ||
| 183 | uintptr_t type; | ||
| 184 | u32 enable_gpio; | 173 | u32 enable_gpio; |
| 185 | 174 | ||
| 186 | /* | 175 | /* |
| 187 | * option: | 176 | * option: |
| 188 | */ | 177 | */ |
| 189 | u32 has_otg:1; /* for controlling PWEN/EXTLP */ | ||
| 190 | u32 has_sudmac:1; /* for SUDMAC */ | ||
| 191 | u32 has_usb_dmac:1; /* for USB-DMAC */ | 178 | u32 has_usb_dmac:1; /* for USB-DMAC */ |
| 179 | u32 runtime_pwctrl:1; | ||
| 180 | u32 has_cnen:1; | ||
| 181 | u32 cfifo_byte_addr:1; /* CFIFO is byte addressable */ | ||
| 192 | #define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */ | 182 | #define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */ |
| 183 | u32 multi_clks:1; | ||
| 184 | u32 has_new_pipe_configs:1; | ||
| 193 | }; | 185 | }; |
| 194 | 186 | ||
| 195 | #define USBHS_TYPE_RCAR_GEN2 1 | ||
| 196 | #define USBHS_TYPE_RCAR_GEN3 2 | ||
| 197 | #define USBHS_TYPE_RCAR_GEN3_WITH_PLL 3 | ||
| 198 | #define USBHS_TYPE_RZA1 4 | ||
| 199 | |||
| 200 | /* | 187 | /* |
| 201 | * option: | 188 | * option: |
| 202 | * | 189 | * |
| @@ -212,12 +199,6 @@ struct renesas_usbhs_platform_info { | |||
| 212 | struct renesas_usbhs_platform_callback platform_callback; | 199 | struct renesas_usbhs_platform_callback platform_callback; |
| 213 | 200 | ||
| 214 | /* | 201 | /* |
| 215 | * driver set these callback functions pointer. | ||
| 216 | * platform can use it on callback functions | ||
| 217 | */ | ||
| 218 | struct renesas_usbhs_driver_callback driver_callback; | ||
| 219 | |||
| 220 | /* | ||
| 221 | * option: | 202 | * option: |
| 222 | * | 203 | * |
| 223 | * driver use these param for some register | 204 | * driver use these param for some register |
| @@ -230,12 +211,4 @@ struct renesas_usbhs_platform_info { | |||
| 230 | */ | 211 | */ |
| 231 | #define renesas_usbhs_get_info(pdev)\ | 212 | #define renesas_usbhs_get_info(pdev)\ |
| 232 | ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data) | 213 | ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data) |
| 233 | |||
| 234 | #define renesas_usbhs_call_notify_hotplug(pdev) \ | ||
| 235 | ({ \ | ||
| 236 | struct renesas_usbhs_driver_callback *dc; \ | ||
| 237 | dc = &(renesas_usbhs_get_info(pdev)->driver_callback); \ | ||
| 238 | if (dc && dc->notify_hotplug) \ | ||
| 239 | dc->notify_hotplug(pdev); \ | ||
| 240 | }) | ||
| 241 | #endif /* RENESAS_USB_H */ | 214 | #endif /* RENESAS_USB_H */ |
diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h index 43f40685e53c..873ace5b0cf8 100644 --- a/include/linux/usb/typec_mux.h +++ b/include/linux/usb/typec_mux.h | |||
| @@ -3,54 +3,48 @@ | |||
| 3 | #ifndef __USB_TYPEC_MUX | 3 | #ifndef __USB_TYPEC_MUX |
| 4 | #define __USB_TYPEC_MUX | 4 | #define __USB_TYPEC_MUX |
| 5 | 5 | ||
| 6 | #include <linux/list.h> | ||
| 7 | #include <linux/usb/typec.h> | 6 | #include <linux/usb/typec.h> |
| 8 | 7 | ||
| 9 | struct device; | 8 | struct device; |
| 9 | struct typec_mux; | ||
| 10 | struct typec_switch; | ||
| 11 | struct fwnode_handle; | ||
| 10 | 12 | ||
| 11 | /** | 13 | typedef int (*typec_switch_set_fn_t)(struct typec_switch *sw, |
| 12 | * struct typec_switch - USB Type-C cable orientation switch | 14 | enum typec_orientation orientation); |
| 13 | * @dev: Switch device | ||
| 14 | * @entry: List entry | ||
| 15 | * @set: Callback to the driver for setting the orientation | ||
| 16 | * | ||
| 17 | * USB Type-C pin flipper switch routing the correct data pairs from the | ||
| 18 | * connector to the USB controller depending on the orientation of the cable | ||
| 19 | * plug. | ||
| 20 | */ | ||
| 21 | struct typec_switch { | ||
| 22 | struct device *dev; | ||
| 23 | struct list_head entry; | ||
| 24 | |||
| 25 | int (*set)(struct typec_switch *sw, enum typec_orientation orientation); | ||
| 26 | }; | ||
| 27 | 15 | ||
| 28 | /** | 16 | struct typec_switch_desc { |
| 29 | * struct typec_switch - USB Type-C connector pin mux | 17 | struct fwnode_handle *fwnode; |
| 30 | * @dev: Mux device | 18 | typec_switch_set_fn_t set; |
| 31 | * @entry: List entry | 19 | void *drvdata; |
| 32 | * @set: Callback to the driver for setting the state of the mux | ||
| 33 | * | ||
| 34 | * Pin Multiplexer/DeMultiplexer switch routing the USB Type-C connector pins to | ||
| 35 | * different components depending on the requested mode of operation. Used with | ||
| 36 | * Accessory/Alternate modes. | ||
| 37 | */ | ||
| 38 | struct typec_mux { | ||
| 39 | struct device *dev; | ||
| 40 | struct list_head entry; | ||
| 41 | |||
| 42 | int (*set)(struct typec_mux *mux, int state); | ||
| 43 | }; | 20 | }; |
| 44 | 21 | ||
| 45 | struct typec_switch *typec_switch_get(struct device *dev); | 22 | struct typec_switch *typec_switch_get(struct device *dev); |
| 46 | void typec_switch_put(struct typec_switch *sw); | 23 | void typec_switch_put(struct typec_switch *sw); |
| 47 | int typec_switch_register(struct typec_switch *sw); | 24 | struct typec_switch * |
| 25 | typec_switch_register(struct device *parent, | ||
| 26 | const struct typec_switch_desc *desc); | ||
| 48 | void typec_switch_unregister(struct typec_switch *sw); | 27 | void typec_switch_unregister(struct typec_switch *sw); |
| 49 | 28 | ||
| 29 | void typec_switch_set_drvdata(struct typec_switch *sw, void *data); | ||
| 30 | void *typec_switch_get_drvdata(struct typec_switch *sw); | ||
| 31 | |||
| 32 | typedef int (*typec_mux_set_fn_t)(struct typec_mux *mux, int state); | ||
| 33 | |||
| 34 | struct typec_mux_desc { | ||
| 35 | struct fwnode_handle *fwnode; | ||
| 36 | typec_mux_set_fn_t set; | ||
| 37 | void *drvdata; | ||
| 38 | }; | ||
| 39 | |||
| 50 | struct typec_mux * | 40 | struct typec_mux * |
| 51 | typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc); | 41 | typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc); |
| 52 | void typec_mux_put(struct typec_mux *mux); | 42 | void typec_mux_put(struct typec_mux *mux); |
| 53 | int typec_mux_register(struct typec_mux *mux); | 43 | struct typec_mux * |
| 44 | typec_mux_register(struct device *parent, const struct typec_mux_desc *desc); | ||
| 54 | void typec_mux_unregister(struct typec_mux *mux); | 45 | void typec_mux_unregister(struct typec_mux *mux); |
| 55 | 46 | ||
| 47 | void typec_mux_set_drvdata(struct typec_mux *mux, void *data); | ||
| 48 | void *typec_mux_get_drvdata(struct typec_mux *mux); | ||
| 49 | |||
| 56 | #endif /* __USB_TYPEC_MUX */ | 50 | #endif /* __USB_TYPEC_MUX */ |
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index d6b74b91096b..fb9f4f799554 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h | |||
| @@ -64,10 +64,20 @@ struct user_namespace { | |||
| 64 | struct ns_common ns; | 64 | struct ns_common ns; |
| 65 | unsigned long flags; | 65 | unsigned long flags; |
| 66 | 66 | ||
| 67 | #ifdef CONFIG_KEYS | ||
| 68 | /* List of joinable keyrings in this namespace. Modification access of | ||
| 69 | * these pointers is controlled by keyring_sem. Once | ||
| 70 | * user_keyring_register is set, it won't be changed, so it can be | ||
| 71 | * accessed directly with READ_ONCE(). | ||
| 72 | */ | ||
| 73 | struct list_head keyring_name_list; | ||
| 74 | struct key *user_keyring_register; | ||
| 75 | struct rw_semaphore keyring_sem; | ||
| 76 | #endif | ||
| 77 | |||
| 67 | /* Register of per-UID persistent keyrings for this namespace */ | 78 | /* Register of per-UID persistent keyrings for this namespace */ |
| 68 | #ifdef CONFIG_PERSISTENT_KEYRINGS | 79 | #ifdef CONFIG_PERSISTENT_KEYRINGS |
| 69 | struct key *persistent_keyring_register; | 80 | struct key *persistent_keyring_register; |
| 70 | struct rw_semaphore persistent_keyring_register_sem; | ||
| 71 | #endif | 81 | #endif |
| 72 | struct work_struct work; | 82 | struct work_struct work; |
| 73 | #ifdef CONFIG_SYSCTL | 83 | #ifdef CONFIG_SYSCTL |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 51e131245379..9b21d0047710 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
| @@ -72,10 +72,12 @@ extern void vm_unmap_aliases(void); | |||
| 72 | 72 | ||
| 73 | #ifdef CONFIG_MMU | 73 | #ifdef CONFIG_MMU |
| 74 | extern void __init vmalloc_init(void); | 74 | extern void __init vmalloc_init(void); |
| 75 | extern unsigned long vmalloc_nr_pages(void); | ||
| 75 | #else | 76 | #else |
| 76 | static inline void vmalloc_init(void) | 77 | static inline void vmalloc_init(void) |
| 77 | { | 78 | { |
| 78 | } | 79 | } |
| 80 | static inline unsigned long vmalloc_nr_pages(void) { return 0; } | ||
| 79 | #endif | 81 | #endif |
| 80 | 82 | ||
| 81 | extern void *vmalloc(unsigned long size); | 83 | extern void *vmalloc(unsigned long size); |
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h index 61e6fddfb26f..6d28bc433c1c 100644 --- a/include/linux/vmpressure.h +++ b/include/linux/vmpressure.h | |||
| @@ -17,7 +17,7 @@ struct vmpressure { | |||
| 17 | unsigned long tree_scanned; | 17 | unsigned long tree_scanned; |
| 18 | unsigned long tree_reclaimed; | 18 | unsigned long tree_reclaimed; |
| 19 | /* The lock is used to keep the scanned/reclaimed above in sync. */ | 19 | /* The lock is used to keep the scanned/reclaimed above in sync. */ |
| 20 | struct spinlock sr_lock; | 20 | spinlock_t sr_lock; |
| 21 | 21 | ||
| 22 | /* The list of vmpressure_event structs. */ | 22 | /* The list of vmpressure_event structs. */ |
| 23 | struct list_head events; | 23 | struct list_head events; |
diff --git a/include/linux/vmw_vmci_defs.h b/include/linux/vmw_vmci_defs.h index 77ac9c7b9483..fefb5292403b 100644 --- a/include/linux/vmw_vmci_defs.h +++ b/include/linux/vmw_vmci_defs.h | |||
| @@ -62,9 +62,18 @@ enum { | |||
| 62 | 62 | ||
| 63 | /* | 63 | /* |
| 64 | * A single VMCI device has an upper limit of 128MB on the amount of | 64 | * A single VMCI device has an upper limit of 128MB on the amount of |
| 65 | * memory that can be used for queue pairs. | 65 | * memory that can be used for queue pairs. Since each queue pair |
| 66 | * consists of at least two pages, the memory limit also dictates the | ||
| 67 | * number of queue pairs a guest can create. | ||
| 66 | */ | 68 | */ |
| 67 | #define VMCI_MAX_GUEST_QP_MEMORY (128 * 1024 * 1024) | 69 | #define VMCI_MAX_GUEST_QP_MEMORY (128 * 1024 * 1024) |
| 70 | #define VMCI_MAX_GUEST_QP_COUNT (VMCI_MAX_GUEST_QP_MEMORY / PAGE_SIZE / 2) | ||
| 71 | |||
| 72 | /* | ||
| 73 | * There can be at most PAGE_SIZE doorbells since there is one doorbell | ||
| 74 | * per byte in the doorbell bitmap page. | ||
| 75 | */ | ||
| 76 | #define VMCI_MAX_GUEST_DOORBELL_COUNT PAGE_SIZE | ||
| 68 | 77 | ||
| 69 | /* | 78 | /* |
| 70 | * Queues with pre-mapped data pages must be small, so that we don't pin | 79 | * Queues with pre-mapped data pages must be small, so that we don't pin |
| @@ -430,8 +439,8 @@ enum { | |||
| 430 | struct vmci_queue_header { | 439 | struct vmci_queue_header { |
| 431 | /* All fields are 64bit and aligned. */ | 440 | /* All fields are 64bit and aligned. */ |
| 432 | struct vmci_handle handle; /* Identifier. */ | 441 | struct vmci_handle handle; /* Identifier. */ |
| 433 | atomic64_t producer_tail; /* Offset in this queue. */ | 442 | u64 producer_tail; /* Offset in this queue. */ |
| 434 | atomic64_t consumer_head; /* Offset in peer queue. */ | 443 | u64 consumer_head; /* Offset in peer queue. */ |
| 435 | }; | 444 | }; |
| 436 | 445 | ||
| 437 | /* | 446 | /* |
| @@ -732,13 +741,9 @@ static inline void *vmci_event_data_payload(struct vmci_event_data *ev_data) | |||
| 732 | * prefix will be used, so correctness isn't an issue, but using a | 741 | * prefix will be used, so correctness isn't an issue, but using a |
| 733 | * 64bit operation still adds unnecessary overhead. | 742 | * 64bit operation still adds unnecessary overhead. |
| 734 | */ | 743 | */ |
| 735 | static inline u64 vmci_q_read_pointer(atomic64_t *var) | 744 | static inline u64 vmci_q_read_pointer(u64 *var) |
| 736 | { | 745 | { |
| 737 | #if defined(CONFIG_X86_32) | 746 | return READ_ONCE(*(unsigned long *)var); |
| 738 | return atomic_read((atomic_t *)var); | ||
| 739 | #else | ||
| 740 | return atomic64_read(var); | ||
| 741 | #endif | ||
| 742 | } | 747 | } |
| 743 | 748 | ||
| 744 | /* | 749 | /* |
| @@ -747,23 +752,17 @@ static inline u64 vmci_q_read_pointer(atomic64_t *var) | |||
| 747 | * never exceeds a 32bit value in this case. On 32bit SMP, using a | 752 | * never exceeds a 32bit value in this case. On 32bit SMP, using a |
| 748 | * locked cmpxchg8b adds unnecessary overhead. | 753 | * locked cmpxchg8b adds unnecessary overhead. |
| 749 | */ | 754 | */ |
| 750 | static inline void vmci_q_set_pointer(atomic64_t *var, | 755 | static inline void vmci_q_set_pointer(u64 *var, u64 new_val) |
| 751 | u64 new_val) | ||
| 752 | { | 756 | { |
| 753 | #if defined(CONFIG_X86_32) | 757 | /* XXX buggered on big-endian */ |
| 754 | return atomic_set((atomic_t *)var, (u32)new_val); | 758 | WRITE_ONCE(*(unsigned long *)var, (unsigned long)new_val); |
| 755 | #else | ||
| 756 | return atomic64_set(var, new_val); | ||
| 757 | #endif | ||
| 758 | } | 759 | } |
| 759 | 760 | ||
| 760 | /* | 761 | /* |
| 761 | * Helper to add a given offset to a head or tail pointer. Wraps the | 762 | * Helper to add a given offset to a head or tail pointer. Wraps the |
| 762 | * value of the pointer around the max size of the queue. | 763 | * value of the pointer around the max size of the queue. |
| 763 | */ | 764 | */ |
| 764 | static inline void vmci_qp_add_pointer(atomic64_t *var, | 765 | static inline void vmci_qp_add_pointer(u64 *var, size_t add, u64 size) |
| 765 | size_t add, | ||
| 766 | u64 size) | ||
| 767 | { | 766 | { |
| 768 | u64 new_val = vmci_q_read_pointer(var); | 767 | u64 new_val = vmci_q_read_pointer(var); |
| 769 | 768 | ||
| @@ -840,8 +839,8 @@ static inline void vmci_q_header_init(struct vmci_queue_header *q_header, | |||
| 840 | const struct vmci_handle handle) | 839 | const struct vmci_handle handle) |
| 841 | { | 840 | { |
| 842 | q_header->handle = handle; | 841 | q_header->handle = handle; |
| 843 | atomic64_set(&q_header->producer_tail, 0); | 842 | q_header->producer_tail = 0; |
| 844 | atomic64_set(&q_header->consumer_head, 0); | 843 | q_header->consumer_head = 0; |
| 845 | } | 844 | } |
| 846 | 845 | ||
| 847 | /* | 846 | /* |
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h deleted file mode 100644 index f6358558f9f5..000000000000 --- a/include/linux/wanrouter.h +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * wanrouter.h Legacy declarations kept around until X25 is removed | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef _ROUTER_H | ||
| 7 | #define _ROUTER_H | ||
| 8 | |||
| 9 | #include <uapi/linux/wanrouter.h> | ||
| 10 | |||
| 11 | #endif /* _ROUTER_H */ | ||
diff --git a/include/linux/wmi.h b/include/linux/wmi.h index fcc9d029f67a..8ef7e7faea1e 100644 --- a/include/linux/wmi.h +++ b/include/linux/wmi.h | |||
| @@ -36,7 +36,7 @@ struct wmi_driver { | |||
| 36 | struct device_driver driver; | 36 | struct device_driver driver; |
| 37 | const struct wmi_device_id *id_table; | 37 | const struct wmi_device_id *id_table; |
| 38 | 38 | ||
| 39 | int (*probe)(struct wmi_device *wdev); | 39 | int (*probe)(struct wmi_device *wdev, const void *context); |
| 40 | int (*remove)(struct wmi_device *wdev); | 40 | int (*remove)(struct wmi_device *wdev); |
| 41 | void (*notify)(struct wmi_device *device, union acpi_object *data); | 41 | void (*notify)(struct wmi_device *device, union acpi_object *data); |
| 42 | long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd, | 42 | long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd, |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index d59525fca4d3..b7c585b5ec1c 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
| @@ -435,10 +435,6 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, | |||
| 435 | 435 | ||
| 436 | extern void destroy_workqueue(struct workqueue_struct *wq); | 436 | extern void destroy_workqueue(struct workqueue_struct *wq); |
| 437 | 437 | ||
| 438 | struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask); | ||
| 439 | void free_workqueue_attrs(struct workqueue_attrs *attrs); | ||
| 440 | int apply_workqueue_attrs(struct workqueue_struct *wq, | ||
| 441 | const struct workqueue_attrs *attrs); | ||
| 442 | int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); | 438 | int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); |
| 443 | 439 | ||
| 444 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, | 440 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 738a0c24874f..8945aac31392 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/flex_proportions.h> | 11 | #include <linux/flex_proportions.h> |
| 12 | #include <linux/backing-dev-defs.h> | 12 | #include <linux/backing-dev-defs.h> |
| 13 | #include <linux/blk_types.h> | 13 | #include <linux/blk_types.h> |
| 14 | #include <linux/blk-cgroup.h> | ||
| 14 | 15 | ||
| 15 | struct bio; | 16 | struct bio; |
| 16 | 17 | ||
| @@ -68,6 +69,17 @@ struct writeback_control { | |||
| 68 | unsigned for_reclaim:1; /* Invoked from the page allocator */ | 69 | unsigned for_reclaim:1; /* Invoked from the page allocator */ |
| 69 | unsigned range_cyclic:1; /* range_start is cyclic */ | 70 | unsigned range_cyclic:1; /* range_start is cyclic */ |
| 70 | unsigned for_sync:1; /* sync(2) WB_SYNC_ALL writeback */ | 71 | unsigned for_sync:1; /* sync(2) WB_SYNC_ALL writeback */ |
| 72 | |||
| 73 | /* | ||
| 74 | * When writeback IOs are bounced through async layers, only the | ||
| 75 | * initial synchronous phase should be accounted towards inode | ||
| 76 | * cgroup ownership arbitration to avoid confusion. Later stages | ||
| 77 | * can set the following flag to disable the accounting. | ||
| 78 | */ | ||
| 79 | unsigned no_cgroup_owner:1; | ||
| 80 | |||
| 81 | unsigned punt_to_cgroup:1; /* cgrp punting, see __REQ_CGROUP_PUNT */ | ||
| 82 | |||
| 71 | #ifdef CONFIG_CGROUP_WRITEBACK | 83 | #ifdef CONFIG_CGROUP_WRITEBACK |
| 72 | struct bdi_writeback *wb; /* wb this writeback is issued under */ | 84 | struct bdi_writeback *wb; /* wb this writeback is issued under */ |
| 73 | struct inode *inode; /* inode being written out */ | 85 | struct inode *inode; /* inode being written out */ |
| @@ -84,12 +96,27 @@ struct writeback_control { | |||
| 84 | 96 | ||
| 85 | static inline int wbc_to_write_flags(struct writeback_control *wbc) | 97 | static inline int wbc_to_write_flags(struct writeback_control *wbc) |
| 86 | { | 98 | { |
| 99 | int flags = 0; | ||
| 100 | |||
| 101 | if (wbc->punt_to_cgroup) | ||
| 102 | flags = REQ_CGROUP_PUNT; | ||
| 103 | |||
| 87 | if (wbc->sync_mode == WB_SYNC_ALL) | 104 | if (wbc->sync_mode == WB_SYNC_ALL) |
| 88 | return REQ_SYNC; | 105 | flags |= REQ_SYNC; |
| 89 | else if (wbc->for_kupdate || wbc->for_background) | 106 | else if (wbc->for_kupdate || wbc->for_background) |
| 90 | return REQ_BACKGROUND; | 107 | flags |= REQ_BACKGROUND; |
| 91 | 108 | ||
| 92 | return 0; | 109 | return flags; |
| 110 | } | ||
| 111 | |||
| 112 | static inline struct cgroup_subsys_state * | ||
| 113 | wbc_blkcg_css(struct writeback_control *wbc) | ||
| 114 | { | ||
| 115 | #ifdef CONFIG_CGROUP_WRITEBACK | ||
| 116 | if (wbc->wb) | ||
| 117 | return wbc->wb->blkcg_css; | ||
| 118 | #endif | ||
| 119 | return blkcg_root_css; | ||
| 93 | } | 120 | } |
| 94 | 121 | ||
| 95 | /* | 122 | /* |
| @@ -188,8 +215,8 @@ void wbc_attach_and_unlock_inode(struct writeback_control *wbc, | |||
| 188 | struct inode *inode) | 215 | struct inode *inode) |
| 189 | __releases(&inode->i_lock); | 216 | __releases(&inode->i_lock); |
| 190 | void wbc_detach_inode(struct writeback_control *wbc); | 217 | void wbc_detach_inode(struct writeback_control *wbc); |
| 191 | void wbc_account_io(struct writeback_control *wbc, struct page *page, | 218 | void wbc_account_cgroup_owner(struct writeback_control *wbc, struct page *page, |
| 192 | size_t bytes); | 219 | size_t bytes); |
| 193 | void cgroup_writeback_umount(void); | 220 | void cgroup_writeback_umount(void); |
| 194 | 221 | ||
| 195 | /** | 222 | /** |
| @@ -291,8 +318,8 @@ static inline void wbc_init_bio(struct writeback_control *wbc, struct bio *bio) | |||
| 291 | { | 318 | { |
| 292 | } | 319 | } |
| 293 | 320 | ||
| 294 | static inline void wbc_account_io(struct writeback_control *wbc, | 321 | static inline void wbc_account_cgroup_owner(struct writeback_control *wbc, |
| 295 | struct page *page, size_t bytes) | 322 | struct page *page, size_t bytes) |
| 296 | { | 323 | { |
| 297 | } | 324 | } |
| 298 | 325 | ||
diff --git a/include/media/cec-notifier.h b/include/media/cec-notifier.h index 57b3a9f6ea1d..f161f8a493ac 100644 --- a/include/media/cec-notifier.h +++ b/include/media/cec-notifier.h | |||
| @@ -43,6 +43,60 @@ struct cec_notifier *cec_notifier_get_conn(struct device *dev, | |||
| 43 | void cec_notifier_put(struct cec_notifier *n); | 43 | void cec_notifier_put(struct cec_notifier *n); |
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| 46 | * cec_notifier_conn_register - find or create a new cec_notifier for the given | ||
| 47 | * HDMI device and connector tuple. | ||
| 48 | * @hdmi_dev: HDMI device that sends the events. | ||
| 49 | * @conn_name: the connector name from which the event occurs. May be NULL | ||
| 50 | * if there is always only one HDMI connector created by the HDMI device. | ||
| 51 | * @conn_info: the connector info from which the event occurs (may be NULL) | ||
| 52 | * | ||
| 53 | * If a notifier for device @dev and connector @conn_name already exists, then | ||
| 54 | * increase the refcount and return that notifier. | ||
| 55 | * | ||
| 56 | * If it doesn't exist, then allocate a new notifier struct and return a | ||
| 57 | * pointer to that new struct. | ||
| 58 | * | ||
| 59 | * Return NULL if the memory could not be allocated. | ||
| 60 | */ | ||
| 61 | struct cec_notifier * | ||
| 62 | cec_notifier_conn_register(struct device *hdmi_dev, const char *conn_name, | ||
| 63 | const struct cec_connector_info *conn_info); | ||
| 64 | |||
| 65 | /** | ||
| 66 | * cec_notifier_conn_unregister - decrease refcount and delete when the | ||
| 67 | * refcount reaches 0. | ||
| 68 | * @n: notifier. If NULL, then this function does nothing. | ||
| 69 | */ | ||
| 70 | void cec_notifier_conn_unregister(struct cec_notifier *n); | ||
| 71 | |||
| 72 | /** | ||
| 73 | * cec_notifier_cec_adap_register - find or create a new cec_notifier for the | ||
| 74 | * given device. | ||
| 75 | * @hdmi_dev: HDMI device that sends the events. | ||
| 76 | * @conn_name: the connector name from which the event occurs. May be NULL | ||
| 77 | * if there is always only one HDMI connector created by the HDMI device. | ||
| 78 | * @adap: the cec adapter that registered this notifier. | ||
| 79 | * | ||
| 80 | * If a notifier for device @dev and connector @conn_name already exists, then | ||
| 81 | * increase the refcount and return that notifier. | ||
| 82 | * | ||
| 83 | * If it doesn't exist, then allocate a new notifier struct and return a | ||
| 84 | * pointer to that new struct. | ||
| 85 | * | ||
| 86 | * Return NULL if the memory could not be allocated. | ||
| 87 | */ | ||
| 88 | struct cec_notifier * | ||
| 89 | cec_notifier_cec_adap_register(struct device *hdmi_dev, const char *conn_name, | ||
| 90 | struct cec_adapter *adap); | ||
| 91 | |||
| 92 | /** | ||
| 93 | * cec_notifier_cec_adap_unregister - decrease refcount and delete when the | ||
| 94 | * refcount reaches 0. | ||
| 95 | * @n: notifier. If NULL, then this function does nothing. | ||
| 96 | */ | ||
| 97 | void cec_notifier_cec_adap_unregister(struct cec_notifier *n); | ||
| 98 | |||
| 99 | /** | ||
| 46 | * cec_notifier_set_phys_addr - set a new physical address. | 100 | * cec_notifier_set_phys_addr - set a new physical address. |
| 47 | * @n: the CEC notifier | 101 | * @n: the CEC notifier |
| 48 | * @pa: the CEC physical address | 102 | * @pa: the CEC physical address |
| @@ -64,30 +118,6 @@ void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, | |||
| 64 | const struct edid *edid); | 118 | const struct edid *edid); |
| 65 | 119 | ||
| 66 | /** | 120 | /** |
| 67 | * cec_notifier_register - register a callback with the notifier | ||
| 68 | * @n: the CEC notifier | ||
| 69 | * @adap: the CEC adapter, passed as argument to the callback function | ||
| 70 | * @callback: the callback function | ||
| 71 | */ | ||
| 72 | void cec_notifier_register(struct cec_notifier *n, | ||
| 73 | struct cec_adapter *adap, | ||
| 74 | void (*callback)(struct cec_adapter *adap, u16 pa)); | ||
| 75 | |||
| 76 | /** | ||
| 77 | * cec_notifier_unregister - unregister the callback from the notifier. | ||
| 78 | * @n: the CEC notifier | ||
| 79 | */ | ||
| 80 | void cec_notifier_unregister(struct cec_notifier *n); | ||
| 81 | |||
| 82 | /** | ||
| 83 | * cec_register_cec_notifier - register the notifier with the cec adapter. | ||
| 84 | * @adap: the CEC adapter | ||
| 85 | * @notifier: the CEC notifier | ||
| 86 | */ | ||
| 87 | void cec_register_cec_notifier(struct cec_adapter *adap, | ||
| 88 | struct cec_notifier *notifier); | ||
| 89 | |||
| 90 | /** | ||
| 91 | * cec_notifier_parse_hdmi_phandle - find the hdmi device from "hdmi-phandle" | 121 | * cec_notifier_parse_hdmi_phandle - find the hdmi device from "hdmi-phandle" |
| 92 | * @dev: the device with the "hdmi-phandle" device tree property | 122 | * @dev: the device with the "hdmi-phandle" device tree property |
| 93 | * | 123 | * |
| @@ -110,27 +140,36 @@ static inline void cec_notifier_put(struct cec_notifier *n) | |||
| 110 | { | 140 | { |
| 111 | } | 141 | } |
| 112 | 142 | ||
| 113 | static inline void cec_notifier_set_phys_addr(struct cec_notifier *n, u16 pa) | 143 | static inline struct cec_notifier * |
| 144 | cec_notifier_conn_register(struct device *hdmi_dev, const char *conn_name, | ||
| 145 | const struct cec_connector_info *conn_info) | ||
| 114 | { | 146 | { |
| 147 | /* A non-NULL pointer is expected on success */ | ||
| 148 | return (struct cec_notifier *)0xdeadfeed; | ||
| 115 | } | 149 | } |
| 116 | 150 | ||
| 117 | static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, | 151 | static inline void cec_notifier_conn_unregister(struct cec_notifier *n) |
| 118 | const struct edid *edid) | 152 | { |
| 153 | } | ||
| 154 | |||
| 155 | static inline struct cec_notifier * | ||
| 156 | cec_notifier_cec_adap_register(struct device *hdmi_dev, const char *conn_name, | ||
| 157 | struct cec_adapter *adap) | ||
| 119 | { | 158 | { |
| 159 | /* A non-NULL pointer is expected on success */ | ||
| 160 | return (struct cec_notifier *)0xdeadfeed; | ||
| 120 | } | 161 | } |
| 121 | 162 | ||
| 122 | static inline void cec_notifier_register(struct cec_notifier *n, | 163 | static inline void cec_notifier_cec_adap_unregister(struct cec_notifier *n) |
| 123 | struct cec_adapter *adap, | ||
| 124 | void (*callback)(struct cec_adapter *adap, u16 pa)) | ||
| 125 | { | 164 | { |
| 126 | } | 165 | } |
| 127 | 166 | ||
| 128 | static inline void cec_notifier_unregister(struct cec_notifier *n) | 167 | static inline void cec_notifier_set_phys_addr(struct cec_notifier *n, u16 pa) |
| 129 | { | 168 | { |
| 130 | } | 169 | } |
| 131 | 170 | ||
| 132 | static inline void cec_register_cec_notifier(struct cec_adapter *adap, | 171 | static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, |
| 133 | struct cec_notifier *notifier) | 172 | const struct edid *edid) |
| 134 | { | 173 | { |
| 135 | } | 174 | } |
| 136 | 175 | ||
diff --git a/include/media/cec.h b/include/media/cec.h index 707411ef8ba2..4d59387bc61b 100644 --- a/include/media/cec.h +++ b/include/media/cec.h | |||
| @@ -17,7 +17,9 @@ | |||
| 17 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
| 18 | #include <linux/cec-funcs.h> | 18 | #include <linux/cec-funcs.h> |
| 19 | #include <media/rc-core.h> | 19 | #include <media/rc-core.h> |
| 20 | #include <media/cec-notifier.h> | 20 | |
| 21 | /* CEC_ADAP_G_CONNECTOR_INFO is available */ | ||
| 22 | #define CEC_CAP_CONNECTOR_INFO (1 << 8) | ||
| 21 | 23 | ||
| 22 | #define CEC_CAP_DEFAULTS (CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | \ | 24 | #define CEC_CAP_DEFAULTS (CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | \ |
| 23 | CEC_CAP_PASSTHROUGH | CEC_CAP_RC) | 25 | CEC_CAP_PASSTHROUGH | CEC_CAP_RC) |
| @@ -53,6 +55,7 @@ struct cec_devnode { | |||
| 53 | struct cec_adapter; | 55 | struct cec_adapter; |
| 54 | struct cec_data; | 56 | struct cec_data; |
| 55 | struct cec_pin; | 57 | struct cec_pin; |
| 58 | struct cec_notifier; | ||
| 56 | 59 | ||
| 57 | struct cec_data { | 60 | struct cec_data { |
| 58 | struct list_head list; | 61 | struct list_head list; |
| @@ -144,6 +147,34 @@ struct cec_adap_ops { | |||
| 144 | */ | 147 | */ |
| 145 | #define CEC_MAX_MSG_TX_QUEUE_SZ (18 * 1) | 148 | #define CEC_MAX_MSG_TX_QUEUE_SZ (18 * 1) |
| 146 | 149 | ||
| 150 | /** | ||
| 151 | * struct cec_drm_connector_info - tells which drm connector is | ||
| 152 | * associated with the CEC adapter. | ||
| 153 | * @card_no: drm card number | ||
| 154 | * @connector_id: drm connector ID | ||
| 155 | */ | ||
| 156 | struct cec_drm_connector_info { | ||
| 157 | __u32 card_no; | ||
| 158 | __u32 connector_id; | ||
| 159 | }; | ||
| 160 | |||
| 161 | #define CEC_CONNECTOR_TYPE_NO_CONNECTOR 0 | ||
| 162 | #define CEC_CONNECTOR_TYPE_DRM 1 | ||
| 163 | |||
| 164 | /** | ||
| 165 | * struct cec_connector_info - tells if and which connector is | ||
| 166 | * associated with the CEC adapter. | ||
| 167 | * @type: connector type (if any) | ||
| 168 | * @drm: drm connector info | ||
| 169 | */ | ||
| 170 | struct cec_connector_info { | ||
| 171 | __u32 type; | ||
| 172 | union { | ||
| 173 | struct cec_drm_connector_info drm; | ||
| 174 | __u32 raw[16]; | ||
| 175 | }; | ||
| 176 | }; | ||
| 177 | |||
| 147 | struct cec_adapter { | 178 | struct cec_adapter { |
| 148 | struct module *owner; | 179 | struct module *owner; |
| 149 | char name[32]; | 180 | char name[32]; |
| @@ -182,6 +213,7 @@ struct cec_adapter { | |||
| 182 | struct cec_fh *cec_initiator; | 213 | struct cec_fh *cec_initiator; |
| 183 | bool passthrough; | 214 | bool passthrough; |
| 184 | struct cec_log_addrs log_addrs; | 215 | struct cec_log_addrs log_addrs; |
| 216 | struct cec_connector_info conn_info; | ||
| 185 | 217 | ||
| 186 | u32 tx_timeouts; | 218 | u32 tx_timeouts; |
| 187 | 219 | ||
| @@ -233,6 +265,7 @@ static inline bool cec_is_registered(const struct cec_adapter *adap) | |||
| 233 | ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf | 265 | ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf |
| 234 | 266 | ||
| 235 | struct edid; | 267 | struct edid; |
| 268 | struct drm_connector; | ||
| 236 | 269 | ||
| 237 | #if IS_REACHABLE(CONFIG_CEC_CORE) | 270 | #if IS_REACHABLE(CONFIG_CEC_CORE) |
| 238 | struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, | 271 | struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, |
| @@ -247,6 +280,8 @@ void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, | |||
| 247 | bool block); | 280 | bool block); |
| 248 | void cec_s_phys_addr_from_edid(struct cec_adapter *adap, | 281 | void cec_s_phys_addr_from_edid(struct cec_adapter *adap, |
| 249 | const struct edid *edid); | 282 | const struct edid *edid); |
| 283 | void cec_s_conn_info(struct cec_adapter *adap, | ||
| 284 | const struct cec_connector_info *conn_info); | ||
| 250 | int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, | 285 | int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, |
| 251 | bool block); | 286 | bool block); |
| 252 | 287 | ||
| @@ -331,6 +366,9 @@ void cec_queue_pin_5v_event(struct cec_adapter *adap, bool is_high, ktime_t ts); | |||
| 331 | u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size, | 366 | u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size, |
| 332 | unsigned int *offset); | 367 | unsigned int *offset); |
| 333 | 368 | ||
| 369 | void cec_fill_conn_info_from_drm(struct cec_connector_info *conn_info, | ||
| 370 | const struct drm_connector *connector); | ||
| 371 | |||
| 334 | #else | 372 | #else |
| 335 | 373 | ||
| 336 | static inline int cec_register_adapter(struct cec_adapter *adap, | 374 | static inline int cec_register_adapter(struct cec_adapter *adap, |
| @@ -365,6 +403,64 @@ static inline u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size, | |||
| 365 | return CEC_PHYS_ADDR_INVALID; | 403 | return CEC_PHYS_ADDR_INVALID; |
| 366 | } | 404 | } |
| 367 | 405 | ||
| 406 | static inline void cec_s_conn_info(struct cec_adapter *adap, | ||
| 407 | const struct cec_connector_info *conn_info) | ||
| 408 | { | ||
| 409 | } | ||
| 410 | |||
| 411 | static inline void | ||
| 412 | cec_fill_conn_info_from_drm(struct cec_connector_info *conn_info, | ||
| 413 | const struct drm_connector *connector) | ||
| 414 | { | ||
| 415 | memset(conn_info, 0, sizeof(*conn_info)); | ||
| 416 | } | ||
| 417 | |||
| 418 | #endif | ||
| 419 | |||
| 420 | #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER) | ||
| 421 | |||
| 422 | /** | ||
| 423 | * cec_notifier_register - register a callback with the notifier | ||
| 424 | * @n: the CEC notifier | ||
| 425 | * @adap: the CEC adapter, passed as argument to the callback function | ||
| 426 | * @callback: the callback function | ||
| 427 | */ | ||
| 428 | void cec_notifier_register(struct cec_notifier *n, | ||
| 429 | struct cec_adapter *adap, | ||
| 430 | void (*callback)(struct cec_adapter *adap, u16 pa)); | ||
| 431 | |||
| 432 | /** | ||
| 433 | * cec_notifier_unregister - unregister the callback from the notifier. | ||
| 434 | * @n: the CEC notifier | ||
| 435 | */ | ||
| 436 | void cec_notifier_unregister(struct cec_notifier *n); | ||
| 437 | |||
| 438 | /** | ||
| 439 | * cec_register_cec_notifier - register the notifier with the cec adapter. | ||
| 440 | * @adap: the CEC adapter | ||
| 441 | * @notifier: the CEC notifier | ||
| 442 | */ | ||
| 443 | void cec_register_cec_notifier(struct cec_adapter *adap, | ||
| 444 | struct cec_notifier *notifier); | ||
| 445 | |||
| 446 | #else | ||
| 447 | |||
| 448 | static inline void | ||
| 449 | cec_notifier_register(struct cec_notifier *n, | ||
| 450 | struct cec_adapter *adap, | ||
| 451 | void (*callback)(struct cec_adapter *adap, u16 pa)) | ||
| 452 | { | ||
| 453 | } | ||
| 454 | |||
| 455 | static inline void cec_notifier_unregister(struct cec_notifier *n) | ||
| 456 | { | ||
| 457 | } | ||
| 458 | |||
| 459 | static inline void cec_register_cec_notifier(struct cec_adapter *adap, | ||
| 460 | struct cec_notifier *notifier) | ||
| 461 | { | ||
| 462 | } | ||
| 463 | |||
| 368 | #endif | 464 | #endif |
| 369 | 465 | ||
| 370 | /** | 466 | /** |
diff --git a/include/media/drv-intf/cx25840.h b/include/media/drv-intf/cx25840.h index 328ddb359fdf..ba69bc525382 100644 --- a/include/media/drv-intf/cx25840.h +++ b/include/media/drv-intf/cx25840.h | |||
| @@ -1,25 +1,31 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | /* | ||
| 3 | cx25840.h - definition for cx25840/1/2/3 inputs | ||
| 4 | |||
| 5 | Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
| 6 | 2 | ||
| 7 | */ | 3 | /* |
| 4 | * cx25840.h - definition for cx25840/1/2/3 inputs | ||
| 5 | * | ||
| 6 | * Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
| 7 | */ | ||
| 8 | 8 | ||
| 9 | #ifndef _CX25840_H_ | 9 | #ifndef _CX25840_H_ |
| 10 | #define _CX25840_H_ | 10 | #define _CX25840_H_ |
| 11 | 11 | ||
| 12 | /* Note that the cx25840 driver requires that the bridge driver calls the | 12 | /* |
| 13 | v4l2_subdev's init operation in order to load the driver's firmware. | 13 | * Note that the cx25840 driver requires that the bridge driver calls the |
| 14 | Without this the audio standard detection will fail and you will | 14 | * v4l2_subdev's load_fw operation in order to load the driver's firmware. |
| 15 | only get mono. | 15 | * This will load the firmware on the first invocation (further ones are NOP). |
| 16 | 16 | * Without this the audio standard detection will fail and you will | |
| 17 | Since loading the firmware is often problematic when the driver is | 17 | * only get mono. |
| 18 | compiled into the kernel I recommend postponing calling this function | 18 | * Alternatively, you can call the reset operation (this can be done |
| 19 | until the first open of the video device. Another reason for | 19 | * multiple times if needed, each invocation will fully reinitialize |
| 20 | postponing it is that loading this firmware takes a long time (seconds) | 20 | * the device). |
| 21 | due to the slow i2c bus speed. So it will speed up the boot process if | 21 | * |
| 22 | you can avoid loading the fw as long as the video device isn't used. */ | 22 | * Since loading the firmware is often problematic when the driver is |
| 23 | * compiled into the kernel I recommend postponing calling this function | ||
| 24 | * until the first open of the video device. Another reason for | ||
| 25 | * postponing it is that loading this firmware takes a long time (seconds) | ||
| 26 | * due to the slow i2c bus speed. So it will speed up the boot process if | ||
| 27 | * you can avoid loading the fw as long as the video device isn't used. | ||
| 28 | */ | ||
| 23 | 29 | ||
| 24 | enum cx25840_video_input { | 30 | enum cx25840_video_input { |
| 25 | /* Composite video inputs In1-In8 */ | 31 | /* Composite video inputs In1-In8 */ |
| @@ -32,8 +38,10 @@ enum cx25840_video_input { | |||
| 32 | CX25840_COMPOSITE7, | 38 | CX25840_COMPOSITE7, |
| 33 | CX25840_COMPOSITE8, | 39 | CX25840_COMPOSITE8, |
| 34 | 40 | ||
| 35 | /* S-Video inputs consist of one luma input (In1-In8) ORed with one | 41 | /* |
| 36 | chroma input (In5-In8) */ | 42 | * S-Video inputs consist of one luma input (In1-In8) ORed with one |
| 43 | * chroma input (In5-In8) | ||
| 44 | */ | ||
| 37 | CX25840_SVIDEO_LUMA1 = 0x10, | 45 | CX25840_SVIDEO_LUMA1 = 0x10, |
| 38 | CX25840_SVIDEO_LUMA2 = 0x20, | 46 | CX25840_SVIDEO_LUMA2 = 0x20, |
| 39 | CX25840_SVIDEO_LUMA3 = 0x30, | 47 | CX25840_SVIDEO_LUMA3 = 0x30, |
| @@ -76,6 +84,81 @@ enum cx25840_video_input { | |||
| 76 | CX25840_DIF_ON = 0x80000400, | 84 | CX25840_DIF_ON = 0x80000400, |
| 77 | }; | 85 | }; |
| 78 | 86 | ||
| 87 | /* | ||
| 88 | * The defines below are used to set the chip video output settings | ||
| 89 | * in the generic mode that can be enabled by calling the subdevice | ||
| 90 | * init core op. | ||
| 91 | * | ||
| 92 | * The requested settings can be passed to the init core op as | ||
| 93 | * @val parameter and to the s_routing video op as @config parameter. | ||
| 94 | * | ||
| 95 | * For details please refer to the section 3.7 Video Output Formatting and | ||
| 96 | * to Video Out Control 1 to 4 registers in the section 5.6 Video Decoder Core | ||
| 97 | * of the chip datasheet. | ||
| 98 | */ | ||
| 99 | #define CX25840_VCONFIG_FMT_SHIFT 0 | ||
| 100 | #define CX25840_VCONFIG_FMT_MASK GENMASK(2, 0) | ||
| 101 | #define CX25840_VCONFIG_FMT_BT601 BIT(0) | ||
| 102 | #define CX25840_VCONFIG_FMT_BT656 BIT(1) | ||
| 103 | #define CX25840_VCONFIG_FMT_VIP11 GENMASK(1, 0) | ||
| 104 | #define CX25840_VCONFIG_FMT_VIP2 BIT(2) | ||
| 105 | |||
| 106 | #define CX25840_VCONFIG_RES_SHIFT 3 | ||
| 107 | #define CX25840_VCONFIG_RES_MASK GENMASK(4, 3) | ||
| 108 | #define CX25840_VCONFIG_RES_8BIT BIT(3) | ||
| 109 | #define CX25840_VCONFIG_RES_10BIT BIT(4) | ||
| 110 | |||
| 111 | #define CX25840_VCONFIG_VBIRAW_SHIFT 5 | ||
| 112 | #define CX25840_VCONFIG_VBIRAW_MASK GENMASK(6, 5) | ||
| 113 | #define CX25840_VCONFIG_VBIRAW_DISABLED BIT(5) | ||
| 114 | #define CX25840_VCONFIG_VBIRAW_ENABLED BIT(6) | ||
| 115 | |||
| 116 | #define CX25840_VCONFIG_ANCDATA_SHIFT 7 | ||
| 117 | #define CX25840_VCONFIG_ANCDATA_MASK GENMASK(8, 7) | ||
| 118 | #define CX25840_VCONFIG_ANCDATA_DISABLED BIT(7) | ||
| 119 | #define CX25840_VCONFIG_ANCDATA_ENABLED BIT(8) | ||
| 120 | |||
| 121 | #define CX25840_VCONFIG_TASKBIT_SHIFT 9 | ||
| 122 | #define CX25840_VCONFIG_TASKBIT_MASK GENMASK(10, 9) | ||
| 123 | #define CX25840_VCONFIG_TASKBIT_ZERO BIT(9) | ||
| 124 | #define CX25840_VCONFIG_TASKBIT_ONE BIT(10) | ||
| 125 | |||
| 126 | #define CX25840_VCONFIG_ACTIVE_SHIFT 11 | ||
| 127 | #define CX25840_VCONFIG_ACTIVE_MASK GENMASK(12, 11) | ||
| 128 | #define CX25840_VCONFIG_ACTIVE_COMPOSITE BIT(11) | ||
| 129 | #define CX25840_VCONFIG_ACTIVE_HORIZONTAL BIT(12) | ||
| 130 | |||
| 131 | #define CX25840_VCONFIG_VALID_SHIFT 13 | ||
| 132 | #define CX25840_VCONFIG_VALID_MASK GENMASK(14, 13) | ||
| 133 | #define CX25840_VCONFIG_VALID_NORMAL BIT(13) | ||
| 134 | #define CX25840_VCONFIG_VALID_ANDACTIVE BIT(14) | ||
| 135 | |||
| 136 | #define CX25840_VCONFIG_HRESETW_SHIFT 15 | ||
| 137 | #define CX25840_VCONFIG_HRESETW_MASK GENMASK(16, 15) | ||
| 138 | #define CX25840_VCONFIG_HRESETW_NORMAL BIT(15) | ||
| 139 | #define CX25840_VCONFIG_HRESETW_PIXCLK BIT(16) | ||
| 140 | |||
| 141 | #define CX25840_VCONFIG_CLKGATE_SHIFT 17 | ||
| 142 | #define CX25840_VCONFIG_CLKGATE_MASK GENMASK(18, 17) | ||
| 143 | #define CX25840_VCONFIG_CLKGATE_NONE BIT(17) | ||
| 144 | #define CX25840_VCONFIG_CLKGATE_VALID BIT(18) | ||
| 145 | #define CX25840_VCONFIG_CLKGATE_VALIDACTIVE GENMASK(18, 17) | ||
| 146 | |||
| 147 | #define CX25840_VCONFIG_DCMODE_SHIFT 19 | ||
| 148 | #define CX25840_VCONFIG_DCMODE_MASK GENMASK(20, 19) | ||
| 149 | #define CX25840_VCONFIG_DCMODE_DWORDS BIT(19) | ||
| 150 | #define CX25840_VCONFIG_DCMODE_BYTES BIT(20) | ||
| 151 | |||
| 152 | #define CX25840_VCONFIG_IDID0S_SHIFT 21 | ||
| 153 | #define CX25840_VCONFIG_IDID0S_MASK GENMASK(22, 21) | ||
| 154 | #define CX25840_VCONFIG_IDID0S_NORMAL BIT(21) | ||
| 155 | #define CX25840_VCONFIG_IDID0S_LINECNT BIT(22) | ||
| 156 | |||
| 157 | #define CX25840_VCONFIG_VIPCLAMP_SHIFT 23 | ||
| 158 | #define CX25840_VCONFIG_VIPCLAMP_MASK GENMASK(24, 23) | ||
| 159 | #define CX25840_VCONFIG_VIPCLAMP_ENABLED BIT(23) | ||
| 160 | #define CX25840_VCONFIG_VIPCLAMP_DISABLED BIT(24) | ||
| 161 | |||
| 79 | enum cx25840_audio_input { | 162 | enum cx25840_audio_input { |
| 80 | /* Audio inputs: serial or In4-In8 */ | 163 | /* Audio inputs: serial or In4-In8 */ |
| 81 | CX25840_AUDIO_SERIAL, | 164 | CX25840_AUDIO_SERIAL, |
| @@ -103,7 +186,7 @@ enum cx25840_io_pin { | |||
| 103 | }; | 186 | }; |
| 104 | 187 | ||
| 105 | enum cx25840_io_pad { | 188 | enum cx25840_io_pad { |
| 106 | /* Output pads */ | 189 | /* Output pads, these must match the actual chip register values */ |
| 107 | CX25840_PAD_DEFAULT = 0, | 190 | CX25840_PAD_DEFAULT = 0, |
| 108 | CX25840_PAD_ACTIVE, | 191 | CX25840_PAD_ACTIVE, |
| 109 | CX25840_PAD_VACTIVE, | 192 | CX25840_PAD_VACTIVE, |
| @@ -162,13 +245,16 @@ enum cx23885_io_pad { | |||
| 162 | CX23885_PAD_GPIO16, | 245 | CX23885_PAD_GPIO16, |
| 163 | }; | 246 | }; |
| 164 | 247 | ||
| 165 | /* pvr150_workaround activates a workaround for a hardware bug that is | 248 | /* |
| 166 | present in Hauppauge PVR-150 (and possibly PVR-500) cards that have | 249 | * pvr150_workaround activates a workaround for a hardware bug that is |
| 167 | certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The | 250 | * present in Hauppauge PVR-150 (and possibly PVR-500) cards that have |
| 168 | audio autodetect fails on some channels for these models and the workaround | 251 | * certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The |
| 169 | is to select the audio standard explicitly. Many thanks to Hauppauge for | 252 | * audio autodetect fails on some channels for these models and the workaround |
| 170 | providing this information. | 253 | * is to select the audio standard explicitly. Many thanks to Hauppauge for |
| 171 | This platform data only needs to be supplied by the ivtv driver. */ | 254 | * providing this information. |
| 255 | * | ||
| 256 | * This platform data only needs to be supplied by the ivtv driver. | ||
| 257 | */ | ||
| 172 | struct cx25840_platform_data { | 258 | struct cx25840_platform_data { |
| 173 | int pvr150_workaround; | 259 | int pvr150_workaround; |
| 174 | }; | 260 | }; |
diff --git a/include/media/dvbdev.h b/include/media/dvbdev.h index 881ca461b7bb..551325858de3 100644 --- a/include/media/dvbdev.h +++ b/include/media/dvbdev.h | |||
| @@ -86,8 +86,8 @@ struct dvb_frontend; | |||
| 86 | * @priv: private data | 86 | * @priv: private data |
| 87 | * @device: pointer to struct device | 87 | * @device: pointer to struct device |
| 88 | * @module: pointer to struct module | 88 | * @module: pointer to struct module |
| 89 | * @mfe_shared: mfe shared: indicates mutually exclusive frontends | 89 | * @mfe_shared: indicates mutually exclusive frontends. |
| 90 | * Thie usage of this flag is currently deprecated | 90 | * Use of this flag is currently deprecated. |
| 91 | * @mfe_dvbdev: Frontend device in use, in the case of MFE | 91 | * @mfe_dvbdev: Frontend device in use, in the case of MFE |
| 92 | * @mfe_lock: Lock to prevent using the other frontends when MFE is | 92 | * @mfe_lock: Lock to prevent using the other frontends when MFE is |
| 93 | * used. | 93 | * used. |
diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h new file mode 100644 index 000000000000..e1404d78d6ff --- /dev/null +++ b/include/media/h264-ctrls.h | |||
| @@ -0,0 +1,197 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * These are the H.264 state controls for use with stateless H.264 | ||
| 4 | * codec drivers. | ||
| 5 | * | ||
| 6 | * It turns out that these structs are not stable yet and will undergo | ||
| 7 | * more changes. So keep them private until they are stable and ready to | ||
| 8 | * become part of the official public API. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef _H264_CTRLS_H_ | ||
| 12 | #define _H264_CTRLS_H_ | ||
| 13 | |||
| 14 | #include <linux/videodev2.h> | ||
| 15 | |||
| 16 | /* Our pixel format isn't stable at the moment */ | ||
| 17 | #define V4L2_PIX_FMT_H264_SLICE_RAW v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */ | ||
| 18 | |||
| 19 | /* | ||
| 20 | * This is put insanely high to avoid conflicting with controls that | ||
| 21 | * would be added during the phase where those controls are not | ||
| 22 | * stable. It should be fixed eventually. | ||
| 23 | */ | ||
| 24 | #define V4L2_CID_MPEG_VIDEO_H264_SPS (V4L2_CID_MPEG_BASE+1000) | ||
| 25 | #define V4L2_CID_MPEG_VIDEO_H264_PPS (V4L2_CID_MPEG_BASE+1001) | ||
| 26 | #define V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX (V4L2_CID_MPEG_BASE+1002) | ||
| 27 | #define V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS (V4L2_CID_MPEG_BASE+1003) | ||
| 28 | #define V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS (V4L2_CID_MPEG_BASE+1004) | ||
| 29 | |||
| 30 | /* enum v4l2_ctrl_type type values */ | ||
| 31 | #define V4L2_CTRL_TYPE_H264_SPS 0x0110 | ||
| 32 | #define V4L2_CTRL_TYPE_H264_PPS 0x0111 | ||
| 33 | #define V4L2_CTRL_TYPE_H264_SCALING_MATRIX 0x0112 | ||
| 34 | #define V4L2_CTRL_TYPE_H264_SLICE_PARAMS 0x0113 | ||
| 35 | #define V4L2_CTRL_TYPE_H264_DECODE_PARAMS 0x0114 | ||
| 36 | |||
| 37 | #define V4L2_H264_SPS_CONSTRAINT_SET0_FLAG 0x01 | ||
| 38 | #define V4L2_H264_SPS_CONSTRAINT_SET1_FLAG 0x02 | ||
| 39 | #define V4L2_H264_SPS_CONSTRAINT_SET2_FLAG 0x04 | ||
| 40 | #define V4L2_H264_SPS_CONSTRAINT_SET3_FLAG 0x08 | ||
| 41 | #define V4L2_H264_SPS_CONSTRAINT_SET4_FLAG 0x10 | ||
| 42 | #define V4L2_H264_SPS_CONSTRAINT_SET5_FLAG 0x20 | ||
| 43 | |||
| 44 | #define V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE 0x01 | ||
| 45 | #define V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS 0x02 | ||
| 46 | #define V4L2_H264_SPS_FLAG_DELTA_PIC_ORDER_ALWAYS_ZERO 0x04 | ||
| 47 | #define V4L2_H264_SPS_FLAG_GAPS_IN_FRAME_NUM_VALUE_ALLOWED 0x08 | ||
| 48 | #define V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY 0x10 | ||
| 49 | #define V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD 0x20 | ||
| 50 | #define V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE 0x40 | ||
| 51 | |||
| 52 | struct v4l2_ctrl_h264_sps { | ||
| 53 | __u8 profile_idc; | ||
| 54 | __u8 constraint_set_flags; | ||
| 55 | __u8 level_idc; | ||
| 56 | __u8 seq_parameter_set_id; | ||
| 57 | __u8 chroma_format_idc; | ||
| 58 | __u8 bit_depth_luma_minus8; | ||
| 59 | __u8 bit_depth_chroma_minus8; | ||
| 60 | __u8 log2_max_frame_num_minus4; | ||
| 61 | __u8 pic_order_cnt_type; | ||
| 62 | __u8 log2_max_pic_order_cnt_lsb_minus4; | ||
| 63 | __u8 max_num_ref_frames; | ||
| 64 | __u8 num_ref_frames_in_pic_order_cnt_cycle; | ||
| 65 | __s32 offset_for_ref_frame[255]; | ||
| 66 | __s32 offset_for_non_ref_pic; | ||
| 67 | __s32 offset_for_top_to_bottom_field; | ||
| 68 | __u16 pic_width_in_mbs_minus1; | ||
| 69 | __u16 pic_height_in_map_units_minus1; | ||
| 70 | __u32 flags; | ||
| 71 | }; | ||
| 72 | |||
| 73 | #define V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE 0x0001 | ||
| 74 | #define V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT 0x0002 | ||
| 75 | #define V4L2_H264_PPS_FLAG_WEIGHTED_PRED 0x0004 | ||
| 76 | #define V4L2_H264_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT 0x0008 | ||
| 77 | #define V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED 0x0010 | ||
| 78 | #define V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT 0x0020 | ||
| 79 | #define V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE 0x0040 | ||
| 80 | #define V4L2_H264_PPS_FLAG_PIC_SCALING_MATRIX_PRESENT 0x0080 | ||
| 81 | |||
| 82 | struct v4l2_ctrl_h264_pps { | ||
| 83 | __u8 pic_parameter_set_id; | ||
| 84 | __u8 seq_parameter_set_id; | ||
| 85 | __u8 num_slice_groups_minus1; | ||
| 86 | __u8 num_ref_idx_l0_default_active_minus1; | ||
| 87 | __u8 num_ref_idx_l1_default_active_minus1; | ||
| 88 | __u8 weighted_bipred_idc; | ||
| 89 | __s8 pic_init_qp_minus26; | ||
| 90 | __s8 pic_init_qs_minus26; | ||
| 91 | __s8 chroma_qp_index_offset; | ||
| 92 | __s8 second_chroma_qp_index_offset; | ||
| 93 | __u16 flags; | ||
| 94 | }; | ||
| 95 | |||
| 96 | struct v4l2_ctrl_h264_scaling_matrix { | ||
| 97 | __u8 scaling_list_4x4[6][16]; | ||
| 98 | __u8 scaling_list_8x8[6][64]; | ||
| 99 | }; | ||
| 100 | |||
| 101 | struct v4l2_h264_weight_factors { | ||
| 102 | __s16 luma_weight[32]; | ||
| 103 | __s16 luma_offset[32]; | ||
| 104 | __s16 chroma_weight[32][2]; | ||
| 105 | __s16 chroma_offset[32][2]; | ||
| 106 | }; | ||
| 107 | |||
| 108 | struct v4l2_h264_pred_weight_table { | ||
| 109 | __u16 luma_log2_weight_denom; | ||
| 110 | __u16 chroma_log2_weight_denom; | ||
| 111 | struct v4l2_h264_weight_factors weight_factors[2]; | ||
| 112 | }; | ||
| 113 | |||
| 114 | #define V4L2_H264_SLICE_TYPE_P 0 | ||
| 115 | #define V4L2_H264_SLICE_TYPE_B 1 | ||
| 116 | #define V4L2_H264_SLICE_TYPE_I 2 | ||
| 117 | #define V4L2_H264_SLICE_TYPE_SP 3 | ||
| 118 | #define V4L2_H264_SLICE_TYPE_SI 4 | ||
| 119 | |||
| 120 | #define V4L2_H264_SLICE_FLAG_FIELD_PIC 0x01 | ||
| 121 | #define V4L2_H264_SLICE_FLAG_BOTTOM_FIELD 0x02 | ||
| 122 | #define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x04 | ||
| 123 | #define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x08 | ||
| 124 | |||
| 125 | struct v4l2_ctrl_h264_slice_params { | ||
| 126 | /* Size in bytes, including header */ | ||
| 127 | __u32 size; | ||
| 128 | /* Offset in bits to slice_data() from the beginning of this slice. */ | ||
| 129 | __u32 header_bit_size; | ||
| 130 | |||
| 131 | __u16 first_mb_in_slice; | ||
| 132 | __u8 slice_type; | ||
| 133 | __u8 pic_parameter_set_id; | ||
| 134 | __u8 colour_plane_id; | ||
| 135 | __u8 redundant_pic_cnt; | ||
| 136 | __u16 frame_num; | ||
| 137 | __u16 idr_pic_id; | ||
| 138 | __u16 pic_order_cnt_lsb; | ||
| 139 | __s32 delta_pic_order_cnt_bottom; | ||
| 140 | __s32 delta_pic_order_cnt0; | ||
| 141 | __s32 delta_pic_order_cnt1; | ||
| 142 | |||
| 143 | struct v4l2_h264_pred_weight_table pred_weight_table; | ||
| 144 | /* Size in bits of dec_ref_pic_marking() syntax element. */ | ||
| 145 | __u32 dec_ref_pic_marking_bit_size; | ||
| 146 | /* Size in bits of pic order count syntax. */ | ||
| 147 | __u32 pic_order_cnt_bit_size; | ||
| 148 | |||
| 149 | __u8 cabac_init_idc; | ||
| 150 | __s8 slice_qp_delta; | ||
| 151 | __s8 slice_qs_delta; | ||
| 152 | __u8 disable_deblocking_filter_idc; | ||
| 153 | __s8 slice_alpha_c0_offset_div2; | ||
| 154 | __s8 slice_beta_offset_div2; | ||
| 155 | __u8 num_ref_idx_l0_active_minus1; | ||
| 156 | __u8 num_ref_idx_l1_active_minus1; | ||
| 157 | __u32 slice_group_change_cycle; | ||
| 158 | |||
| 159 | /* | ||
| 160 | * Entries on each list are indices into | ||
| 161 | * v4l2_ctrl_h264_decode_params.dpb[]. | ||
| 162 | */ | ||
| 163 | __u8 ref_pic_list0[32]; | ||
| 164 | __u8 ref_pic_list1[32]; | ||
| 165 | |||
| 166 | __u32 flags; | ||
| 167 | }; | ||
| 168 | |||
| 169 | #define V4L2_H264_DPB_ENTRY_FLAG_VALID 0x01 | ||
| 170 | #define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE 0x02 | ||
| 171 | #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM 0x04 | ||
| 172 | |||
| 173 | struct v4l2_h264_dpb_entry { | ||
| 174 | __u64 reference_ts; | ||
| 175 | __u16 frame_num; | ||
| 176 | __u16 pic_num; | ||
| 177 | /* Note that field is indicated by v4l2_buffer.field */ | ||
| 178 | __s32 top_field_order_cnt; | ||
| 179 | __s32 bottom_field_order_cnt; | ||
| 180 | __u32 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */ | ||
| 181 | }; | ||
| 182 | |||
| 183 | #define V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC 0x01 | ||
| 184 | |||
| 185 | struct v4l2_ctrl_h264_decode_params { | ||
| 186 | struct v4l2_h264_dpb_entry dpb[16]; | ||
| 187 | __u16 num_slices; | ||
| 188 | __u16 nal_ref_idc; | ||
| 189 | __u8 ref_pic_list_p0[32]; | ||
| 190 | __u8 ref_pic_list_b0[32]; | ||
| 191 | __u8 ref_pic_list_b1[32]; | ||
| 192 | __s32 top_field_order_cnt; | ||
| 193 | __s32 bottom_field_order_cnt; | ||
| 194 | __u32 flags; /* V4L2_H264_DECODE_PARAM_FLAG_* */ | ||
| 195 | }; | ||
| 196 | |||
| 197 | #endif | ||
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 3a1ef141ec07..6b319d0d73ad 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
| @@ -408,9 +408,11 @@ struct v4l2_format_info { | |||
| 408 | 408 | ||
| 409 | const struct v4l2_format_info *v4l2_format_info(u32 format); | 409 | const struct v4l2_format_info *v4l2_format_info(u32 format); |
| 410 | 410 | ||
| 411 | int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, int pixelformat, | 411 | void v4l2_apply_frmsize_constraints(u32 *width, u32 *height, |
| 412 | int width, int height); | 412 | const struct v4l2_frmsize_stepwise *frmsize); |
| 413 | int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, int pixelformat, | 413 | int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, u32 pixelformat, |
| 414 | int width, int height); | 414 | u32 width, u32 height); |
| 415 | int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, u32 pixelformat, | ||
| 416 | u32 width, u32 height); | ||
| 415 | 417 | ||
| 416 | #endif /* V4L2_COMMON_H_ */ | 418 | #endif /* V4L2_COMMON_H_ */ |
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index bfa2a4527040..b4433483af23 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
| @@ -14,11 +14,12 @@ | |||
| 14 | #include <media/media-request.h> | 14 | #include <media/media-request.h> |
| 15 | 15 | ||
| 16 | /* | 16 | /* |
| 17 | * Include the mpeg2 and fwht stateless codec compound control definitions. | 17 | * Include the stateless codec compound control definitions. |
| 18 | * This will move to the public headers once this API is fully stable. | 18 | * This will move to the public headers once this API is fully stable. |
| 19 | */ | 19 | */ |
| 20 | #include <media/mpeg2-ctrls.h> | 20 | #include <media/mpeg2-ctrls.h> |
| 21 | #include <media/fwht-ctrls.h> | 21 | #include <media/fwht-ctrls.h> |
| 22 | #include <media/h264-ctrls.h> | ||
| 22 | 23 | ||
| 23 | /* forward references */ | 24 | /* forward references */ |
| 24 | struct file; | 25 | struct file; |
| @@ -42,6 +43,11 @@ struct poll_table_struct; | |||
| 42 | * @p_mpeg2_slice_params: Pointer to a MPEG2 slice parameters structure. | 43 | * @p_mpeg2_slice_params: Pointer to a MPEG2 slice parameters structure. |
| 43 | * @p_mpeg2_quantization: Pointer to a MPEG2 quantization data structure. | 44 | * @p_mpeg2_quantization: Pointer to a MPEG2 quantization data structure. |
| 44 | * @p_fwht_params: Pointer to a FWHT stateless parameters structure. | 45 | * @p_fwht_params: Pointer to a FWHT stateless parameters structure. |
| 46 | * @p_h264_sps: Pointer to a struct v4l2_ctrl_h264_sps. | ||
| 47 | * @p_h264_pps: Pointer to a struct v4l2_ctrl_h264_pps. | ||
| 48 | * @p_h264_scaling_matrix: Pointer to a struct v4l2_ctrl_h264_scaling_matrix. | ||
| 49 | * @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params. | ||
| 50 | * @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params. | ||
| 45 | * @p: Pointer to a compound value. | 51 | * @p: Pointer to a compound value. |
| 46 | */ | 52 | */ |
| 47 | union v4l2_ctrl_ptr { | 53 | union v4l2_ctrl_ptr { |
| @@ -54,6 +60,11 @@ union v4l2_ctrl_ptr { | |||
| 54 | struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params; | 60 | struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params; |
| 55 | struct v4l2_ctrl_mpeg2_quantization *p_mpeg2_quantization; | 61 | struct v4l2_ctrl_mpeg2_quantization *p_mpeg2_quantization; |
| 56 | struct v4l2_ctrl_fwht_params *p_fwht_params; | 62 | struct v4l2_ctrl_fwht_params *p_fwht_params; |
| 63 | struct v4l2_ctrl_h264_sps *p_h264_sps; | ||
| 64 | struct v4l2_ctrl_h264_pps *p_h264_pps; | ||
| 65 | struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix; | ||
| 66 | struct v4l2_ctrl_h264_slice_params *p_h264_slice_params; | ||
| 67 | struct v4l2_ctrl_h264_decode_params *p_h264_decode_params; | ||
| 57 | void *p; | 68 | void *p; |
| 58 | }; | 69 | }; |
| 59 | 70 | ||
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 8533ece5026e..400f2e46c108 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h | |||
| @@ -26,19 +26,13 @@ struct v4l2_fh; | |||
| 26 | * :ref:`VIDIOC_QUERYCAP <vidioc_querycap>` ioctl | 26 | * :ref:`VIDIOC_QUERYCAP <vidioc_querycap>` ioctl |
| 27 | * @vidioc_enum_fmt_vid_cap: pointer to the function that implements | 27 | * @vidioc_enum_fmt_vid_cap: pointer to the function that implements |
| 28 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic | 28 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic |
| 29 | * for video capture in single plane mode | 29 | * for video capture in single and multi plane mode |
| 30 | * @vidioc_enum_fmt_vid_overlay: pointer to the function that implements | 30 | * @vidioc_enum_fmt_vid_overlay: pointer to the function that implements |
| 31 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic | 31 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic |
| 32 | * for video overlay | 32 | * for video overlay |
| 33 | * @vidioc_enum_fmt_vid_out: pointer to the function that implements | 33 | * @vidioc_enum_fmt_vid_out: pointer to the function that implements |
| 34 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic | 34 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic |
| 35 | * for video output in single plane mode | 35 | * for video output in single and multi plane mode |
| 36 | * @vidioc_enum_fmt_vid_cap_mplane: pointer to the function that implements | ||
| 37 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic | ||
| 38 | * for video capture in multiplane mode | ||
| 39 | * @vidioc_enum_fmt_vid_out_mplane: pointer to the function that implements | ||
| 40 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic | ||
| 41 | * for video output in multiplane mode | ||
| 42 | * @vidioc_enum_fmt_sdr_cap: pointer to the function that implements | 36 | * @vidioc_enum_fmt_sdr_cap: pointer to the function that implements |
| 43 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic | 37 | * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic |
| 44 | * for Software Defined Radio capture | 38 | * for Software Defined Radio capture |
| @@ -313,10 +307,6 @@ struct v4l2_ioctl_ops { | |||
| 313 | struct v4l2_fmtdesc *f); | 307 | struct v4l2_fmtdesc *f); |
| 314 | int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh, | 308 | int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh, |
| 315 | struct v4l2_fmtdesc *f); | 309 | struct v4l2_fmtdesc *f); |
| 316 | int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh, | ||
| 317 | struct v4l2_fmtdesc *f); | ||
| 318 | int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh, | ||
| 319 | struct v4l2_fmtdesc *f); | ||
| 320 | int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh, | 310 | int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh, |
| 321 | struct v4l2_fmtdesc *f); | 311 | struct v4l2_fmtdesc *f); |
| 322 | int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh, | 312 | int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh, |
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index 864c26dfb854..0b9c3a287061 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h | |||
| @@ -668,6 +668,10 @@ int v4l2_m2m_ioctl_streamon(struct file *file, void *fh, | |||
| 668 | enum v4l2_buf_type type); | 668 | enum v4l2_buf_type type); |
| 669 | int v4l2_m2m_ioctl_streamoff(struct file *file, void *fh, | 669 | int v4l2_m2m_ioctl_streamoff(struct file *file, void *fh, |
| 670 | enum v4l2_buf_type type); | 670 | enum v4l2_buf_type type); |
| 671 | int v4l2_m2m_ioctl_try_encoder_cmd(struct file *file, void *fh, | ||
| 672 | struct v4l2_encoder_cmd *ec); | ||
| 673 | int v4l2_m2m_ioctl_try_decoder_cmd(struct file *file, void *fh, | ||
| 674 | struct v4l2_decoder_cmd *dc); | ||
| 671 | int v4l2_m2m_fop_mmap(struct file *file, struct vm_area_struct *vma); | 675 | int v4l2_m2m_fop_mmap(struct file *file, struct vm_area_struct *vma); |
| 672 | __poll_t v4l2_m2m_fop_poll(struct file *file, poll_table *wait); | 676 | __poll_t v4l2_m2m_fop_poll(struct file *file, poll_table *wait); |
| 673 | 677 | ||
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 7168311e8ecc..71f1f2f0da53 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
| @@ -1082,6 +1082,8 @@ void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config *cfg); | |||
| 1082 | void v4l2_subdev_init(struct v4l2_subdev *sd, | 1082 | void v4l2_subdev_init(struct v4l2_subdev *sd, |
| 1083 | const struct v4l2_subdev_ops *ops); | 1083 | const struct v4l2_subdev_ops *ops); |
| 1084 | 1084 | ||
| 1085 | extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers; | ||
| 1086 | |||
| 1085 | /** | 1087 | /** |
| 1086 | * v4l2_subdev_call - call an operation of a v4l2_subdev. | 1088 | * v4l2_subdev_call - call an operation of a v4l2_subdev. |
| 1087 | * | 1089 | * |
| @@ -1103,6 +1105,10 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, | |||
| 1103 | __result = -ENODEV; \ | 1105 | __result = -ENODEV; \ |
| 1104 | else if (!(__sd->ops->o && __sd->ops->o->f)) \ | 1106 | else if (!(__sd->ops->o && __sd->ops->o->f)) \ |
| 1105 | __result = -ENOIOCTLCMD; \ | 1107 | __result = -ENOIOCTLCMD; \ |
| 1108 | else if (v4l2_subdev_call_wrappers.o && \ | ||
| 1109 | v4l2_subdev_call_wrappers.o->f) \ | ||
| 1110 | __result = v4l2_subdev_call_wrappers.o->f( \ | ||
| 1111 | __sd, ##args); \ | ||
| 1106 | else \ | 1112 | else \ |
| 1107 | __result = __sd->ops->o->f(__sd, ##args); \ | 1113 | __result = __sd->ops->o->f(__sd, ##args); \ |
| 1108 | __result; \ | 1114 | __result; \ |
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 22f3ff76a8b5..640aabe69450 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
| @@ -54,7 +54,8 @@ struct vb2_threadio_data; | |||
| 54 | * will then be passed as @buf_priv argument to other ops in this | 54 | * will then be passed as @buf_priv argument to other ops in this |
| 55 | * structure. Additional gfp_flags to use when allocating the | 55 | * structure. Additional gfp_flags to use when allocating the |
| 56 | * are also passed to this operation. These flags are from the | 56 | * are also passed to this operation. These flags are from the |
| 57 | * gfp_flags field of vb2_queue. | 57 | * gfp_flags field of vb2_queue. The size argument to this function |
| 58 | * shall be *page aligned*. | ||
| 58 | * @put: inform the allocator that the buffer will no longer be used; | 59 | * @put: inform the allocator that the buffer will no longer be used; |
| 59 | * usually will result in the allocator freeing the buffer (if | 60 | * usually will result in the allocator freeing the buffer (if |
| 60 | * no other users of this buffer are present); the @buf_priv | 61 | * no other users of this buffer are present); the @buf_priv |
| @@ -1162,6 +1163,24 @@ static inline void vb2_clear_last_buffer_dequeued(struct vb2_queue *q) | |||
| 1162 | q->last_buffer_dequeued = false; | 1163 | q->last_buffer_dequeued = false; |
| 1163 | } | 1164 | } |
| 1164 | 1165 | ||
| 1166 | /** | ||
| 1167 | * vb2_get_buffer() - get a buffer from a queue | ||
| 1168 | * @q: pointer to &struct vb2_queue with videobuf2 queue. | ||
| 1169 | * @index: buffer index | ||
| 1170 | * | ||
| 1171 | * This function obtains a buffer from a queue, by its index. | ||
| 1172 | * Keep in mind that there is no refcounting involved in this | ||
| 1173 | * operation, so the buffer lifetime should be taken into | ||
| 1174 | * consideration. | ||
| 1175 | */ | ||
| 1176 | static inline struct vb2_buffer *vb2_get_buffer(struct vb2_queue *q, | ||
| 1177 | unsigned int index) | ||
| 1178 | { | ||
| 1179 | if (index < q->num_buffers) | ||
| 1180 | return q->bufs[index]; | ||
| 1181 | return NULL; | ||
| 1182 | } | ||
| 1183 | |||
| 1165 | /* | 1184 | /* |
| 1166 | * The following functions are not part of the vb2 core API, but are useful | 1185 | * The following functions are not part of the vb2 core API, but are useful |
| 1167 | * functions for videobuf2-*. | 1186 | * functions for videobuf2-*. |
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h index 4b5b84f93538..cd4a46331531 100644 --- a/include/media/videobuf2-memops.h +++ b/include/media/videobuf2-memops.h | |||
| @@ -34,8 +34,7 @@ struct vb2_vmarea_handler { | |||
| 34 | extern const struct vm_operations_struct vb2_common_vm_ops; | 34 | extern const struct vm_operations_struct vb2_common_vm_ops; |
| 35 | 35 | ||
| 36 | struct frame_vector *vb2_create_framevec(unsigned long start, | 36 | struct frame_vector *vb2_create_framevec(unsigned long start, |
| 37 | unsigned long length, | 37 | unsigned long length); |
| 38 | bool write); | ||
| 39 | void vb2_destroy_framevec(struct frame_vector *vec); | 38 | void vb2_destroy_framevec(struct frame_vector *vec); |
| 40 | 39 | ||
| 41 | #endif | 40 | #endif |
diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h index 5c4b4916e6be..06dd5839e438 100644 --- a/include/misc/ocxl.h +++ b/include/misc/ocxl.h | |||
| @@ -32,7 +32,10 @@ struct ocxl_afu_config { | |||
| 32 | u8 pp_mmio_bar; /* per-process MMIO area */ | 32 | u8 pp_mmio_bar; /* per-process MMIO area */ |
| 33 | u64 pp_mmio_offset; | 33 | u64 pp_mmio_offset; |
| 34 | u32 pp_mmio_stride; | 34 | u32 pp_mmio_stride; |
| 35 | u8 log_mem_size; | 35 | u64 lpc_mem_offset; |
| 36 | u64 lpc_mem_size; | ||
| 37 | u64 special_purpose_mem_offset; | ||
| 38 | u64 special_purpose_mem_size; | ||
| 36 | u8 pasid_supported_log; | 39 | u8 pasid_supported_log; |
| 37 | u16 actag_supported; | 40 | u16 actag_supported; |
| 38 | }; | 41 | }; |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 9a5330eed794..5bc1e30dedde 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -1143,6 +1143,26 @@ struct hci_cp_write_sc_support { | |||
| 1143 | __u8 support; | 1143 | __u8 support; |
| 1144 | } __packed; | 1144 | } __packed; |
| 1145 | 1145 | ||
| 1146 | #define HCI_OP_READ_AUTH_PAYLOAD_TO 0x0c7b | ||
| 1147 | struct hci_cp_read_auth_payload_to { | ||
| 1148 | __le16 handle; | ||
| 1149 | } __packed; | ||
| 1150 | struct hci_rp_read_auth_payload_to { | ||
| 1151 | __u8 status; | ||
| 1152 | __le16 handle; | ||
| 1153 | __le16 timeout; | ||
| 1154 | } __packed; | ||
| 1155 | |||
| 1156 | #define HCI_OP_WRITE_AUTH_PAYLOAD_TO 0x0c7c | ||
| 1157 | struct hci_cp_write_auth_payload_to { | ||
| 1158 | __le16 handle; | ||
| 1159 | __le16 timeout; | ||
| 1160 | } __packed; | ||
| 1161 | struct hci_rp_write_auth_payload_to { | ||
| 1162 | __u8 status; | ||
| 1163 | __le16 handle; | ||
| 1164 | } __packed; | ||
| 1165 | |||
| 1146 | #define HCI_OP_READ_LOCAL_OOB_EXT_DATA 0x0c7d | 1166 | #define HCI_OP_READ_LOCAL_OOB_EXT_DATA 0x0c7d |
| 1147 | struct hci_rp_read_local_oob_ext_data { | 1167 | struct hci_rp_read_local_oob_ext_data { |
| 1148 | __u8 status; | 1168 | __u8 status; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 05b1b96f4d9e..ded574b32c20 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -199,6 +199,8 @@ struct adv_info { | |||
| 199 | /* Default min/max age of connection information (1s/3s) */ | 199 | /* Default min/max age of connection information (1s/3s) */ |
| 200 | #define DEFAULT_CONN_INFO_MIN_AGE 1000 | 200 | #define DEFAULT_CONN_INFO_MIN_AGE 1000 |
| 201 | #define DEFAULT_CONN_INFO_MAX_AGE 3000 | 201 | #define DEFAULT_CONN_INFO_MAX_AGE 3000 |
| 202 | /* Default authenticated payload timeout 30s */ | ||
| 203 | #define DEFAULT_AUTH_PAYLOAD_TIMEOUT 0x0bb8 | ||
| 202 | 204 | ||
| 203 | struct amp_assoc { | 205 | struct amp_assoc { |
| 204 | __u16 len; | 206 | __u16 len; |
| @@ -275,6 +277,7 @@ struct hci_dev { | |||
| 275 | __u16 discov_interleaved_timeout; | 277 | __u16 discov_interleaved_timeout; |
| 276 | __u16 conn_info_min_age; | 278 | __u16 conn_info_min_age; |
| 277 | __u16 conn_info_max_age; | 279 | __u16 conn_info_max_age; |
| 280 | __u16 auth_payload_timeout; | ||
| 278 | __u8 ssp_debug_mode; | 281 | __u8 ssp_debug_mode; |
| 279 | __u8 hw_error_code; | 282 | __u8 hw_error_code; |
| 280 | __u32 clock; | 283 | __u32 clock; |
| @@ -481,6 +484,7 @@ struct hci_conn { | |||
| 481 | __u16 disc_timeout; | 484 | __u16 disc_timeout; |
| 482 | __u16 conn_timeout; | 485 | __u16 conn_timeout; |
| 483 | __u16 setting; | 486 | __u16 setting; |
| 487 | __u16 auth_payload_timeout; | ||
| 484 | __u16 le_conn_min_interval; | 488 | __u16 le_conn_min_interval; |
| 485 | __u16 le_conn_max_interval; | 489 | __u16 le_conn_max_interval; |
| 486 | __u16 le_conn_interval; | 490 | __u16 le_conn_interval; |
diff --git a/include/net/bond_options.h b/include/net/bond_options.h index 2a05cc349018..9d382f2f0bc5 100644 --- a/include/net/bond_options.h +++ b/include/net/bond_options.h | |||
| @@ -63,6 +63,7 @@ enum { | |||
| 63 | BOND_OPT_AD_ACTOR_SYSTEM, | 63 | BOND_OPT_AD_ACTOR_SYSTEM, |
| 64 | BOND_OPT_AD_USER_PORT_KEY, | 64 | BOND_OPT_AD_USER_PORT_KEY, |
| 65 | BOND_OPT_NUM_PEER_NOTIF_ALIAS, | 65 | BOND_OPT_NUM_PEER_NOTIF_ALIAS, |
| 66 | BOND_OPT_PEER_NOTIF_DELAY, | ||
| 66 | BOND_OPT_LAST | 67 | BOND_OPT_LAST |
| 67 | }; | 68 | }; |
| 68 | 69 | ||
diff --git a/include/net/bonding.h b/include/net/bonding.h index b46d68acf701..f7fe45689142 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h | |||
| @@ -38,6 +38,15 @@ | |||
| 38 | #define __long_aligned __attribute__((aligned((sizeof(long))))) | 38 | #define __long_aligned __attribute__((aligned((sizeof(long))))) |
| 39 | #endif | 39 | #endif |
| 40 | 40 | ||
| 41 | #define slave_info(bond_dev, slave_dev, fmt, ...) \ | ||
| 42 | netdev_info(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__) | ||
| 43 | #define slave_warn(bond_dev, slave_dev, fmt, ...) \ | ||
| 44 | netdev_warn(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__) | ||
| 45 | #define slave_dbg(bond_dev, slave_dev, fmt, ...) \ | ||
| 46 | netdev_dbg(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__) | ||
| 47 | #define slave_err(bond_dev, slave_dev, fmt, ...) \ | ||
| 48 | netdev_err(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__) | ||
| 49 | |||
| 41 | #define BOND_MODE(bond) ((bond)->params.mode) | 50 | #define BOND_MODE(bond) ((bond)->params.mode) |
| 42 | 51 | ||
| 43 | /* slave list primitives */ | 52 | /* slave list primitives */ |
| @@ -114,6 +123,7 @@ struct bond_params { | |||
| 114 | int fail_over_mac; | 123 | int fail_over_mac; |
| 115 | int updelay; | 124 | int updelay; |
| 116 | int downdelay; | 125 | int downdelay; |
| 126 | int peer_notif_delay; | ||
| 117 | int lacp_fast; | 127 | int lacp_fast; |
| 118 | unsigned int min_links; | 128 | unsigned int min_links; |
| 119 | int ad_select; | 129 | int ad_select; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 8fb5be3ca0ca..88c27153a4bc 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -379,16 +379,18 @@ ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband, | |||
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | /** | 381 | /** |
| 382 | * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA | 382 | * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype |
| 383 | * @sband: the sband to search for the STA on | 383 | * @sband: the sband to search for the iftype on |
| 384 | * @iftype: enum nl80211_iftype | ||
| 384 | * | 385 | * |
| 385 | * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found | 386 | * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found |
| 386 | */ | 387 | */ |
| 387 | static inline const struct ieee80211_sta_he_cap * | 388 | static inline const struct ieee80211_sta_he_cap * |
| 388 | ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband) | 389 | ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband, |
| 390 | u8 iftype) | ||
| 389 | { | 391 | { |
| 390 | const struct ieee80211_sband_iftype_data *data = | 392 | const struct ieee80211_sband_iftype_data *data = |
| 391 | ieee80211_get_sband_iftype_data(sband, NL80211_IFTYPE_STATION); | 393 | ieee80211_get_sband_iftype_data(sband, iftype); |
| 392 | 394 | ||
| 393 | if (data && data->he_cap.has_he) | 395 | if (data && data->he_cap.has_he) |
| 394 | return &data->he_cap; | 396 | return &data->he_cap; |
| @@ -397,6 +399,18 @@ ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband) | |||
| 397 | } | 399 | } |
| 398 | 400 | ||
| 399 | /** | 401 | /** |
| 402 | * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA | ||
| 403 | * @sband: the sband to search for the STA on | ||
| 404 | * | ||
| 405 | * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found | ||
| 406 | */ | ||
| 407 | static inline const struct ieee80211_sta_he_cap * | ||
| 408 | ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband) | ||
| 409 | { | ||
| 410 | return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION); | ||
| 411 | } | ||
| 412 | |||
| 413 | /** | ||
| 400 | * wiphy_read_of_freq_limits - read frequency limits from device tree | 414 | * wiphy_read_of_freq_limits - read frequency limits from device tree |
| 401 | * | 415 | * |
| 402 | * @wiphy: the wireless device to get extra limits for | 416 | * @wiphy: the wireless device to get extra limits for |
| @@ -739,6 +753,9 @@ struct survey_info { | |||
| 739 | * CFG80211_MAX_WEP_KEYS WEP keys | 753 | * CFG80211_MAX_WEP_KEYS WEP keys |
| 740 | * @wep_tx_key: key index (0..3) of the default TX static WEP key | 754 | * @wep_tx_key: key index (0..3) of the default TX static WEP key |
| 741 | * @psk: PSK (for devices supporting 4-way-handshake offload) | 755 | * @psk: PSK (for devices supporting 4-way-handshake offload) |
| 756 | * @sae_pwd: password for SAE authentication (for devices supporting SAE | ||
| 757 | * offload) | ||
| 758 | * @sae_pwd_len: length of SAE password (for devices supporting SAE offload) | ||
| 742 | */ | 759 | */ |
| 743 | struct cfg80211_crypto_settings { | 760 | struct cfg80211_crypto_settings { |
| 744 | u32 wpa_versions; | 761 | u32 wpa_versions; |
| @@ -754,6 +771,8 @@ struct cfg80211_crypto_settings { | |||
| 754 | struct key_params *wep_keys; | 771 | struct key_params *wep_keys; |
| 755 | int wep_tx_key; | 772 | int wep_tx_key; |
| 756 | const u8 *psk; | 773 | const u8 *psk; |
| 774 | const u8 *sae_pwd; | ||
| 775 | u8 sae_pwd_len; | ||
| 757 | }; | 776 | }; |
| 758 | 777 | ||
| 759 | /** | 778 | /** |
| @@ -875,6 +894,7 @@ enum cfg80211_ap_settings_flags { | |||
| 875 | * @he_cap: HE capabilities (or %NULL if HE isn't enabled) | 894 | * @he_cap: HE capabilities (or %NULL if HE isn't enabled) |
| 876 | * @ht_required: stations must support HT | 895 | * @ht_required: stations must support HT |
| 877 | * @vht_required: stations must support VHT | 896 | * @vht_required: stations must support VHT |
| 897 | * @twt_responder: Enable Target Wait Time | ||
| 878 | * @flags: flags, as defined in enum cfg80211_ap_settings_flags | 898 | * @flags: flags, as defined in enum cfg80211_ap_settings_flags |
| 879 | */ | 899 | */ |
| 880 | struct cfg80211_ap_settings { | 900 | struct cfg80211_ap_settings { |
| @@ -901,6 +921,7 @@ struct cfg80211_ap_settings { | |||
| 901 | const struct ieee80211_vht_cap *vht_cap; | 921 | const struct ieee80211_vht_cap *vht_cap; |
| 902 | const struct ieee80211_he_cap_elem *he_cap; | 922 | const struct ieee80211_he_cap_elem *he_cap; |
| 903 | bool ht_required, vht_required; | 923 | bool ht_required, vht_required; |
| 924 | bool twt_responder; | ||
| 904 | u32 flags; | 925 | u32 flags; |
| 905 | }; | 926 | }; |
| 906 | 927 | ||
| @@ -2007,7 +2028,7 @@ enum cfg80211_signal_type { | |||
| 2007 | * received by the device (not just by the host, in case it was | 2028 | * received by the device (not just by the host, in case it was |
| 2008 | * buffered on the device) and be accurate to about 10ms. | 2029 | * buffered on the device) and be accurate to about 10ms. |
| 2009 | * If the frame isn't buffered, just passing the return value of | 2030 | * If the frame isn't buffered, just passing the return value of |
| 2010 | * ktime_get_boot_ns() is likely appropriate. | 2031 | * ktime_get_boottime_ns() is likely appropriate. |
| 2011 | * @parent_tsf: the time at the start of reception of the first octet of the | 2032 | * @parent_tsf: the time at the start of reception of the first octet of the |
| 2012 | * timestamp field of the frame. The time is the TSF of the BSS specified | 2033 | * timestamp field of the frame. The time is the TSF of the BSS specified |
| 2013 | * by %parent_bssid. | 2034 | * by %parent_bssid. |
| @@ -4149,6 +4170,8 @@ struct sta_opmode_info { | |||
| 4149 | u8 rx_nss; | 4170 | u8 rx_nss; |
| 4150 | }; | 4171 | }; |
| 4151 | 4172 | ||
| 4173 | #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)ERR_PTR(-ENODATA)) | ||
| 4174 | |||
| 4152 | /** | 4175 | /** |
| 4153 | * struct wiphy_vendor_command - vendor command definition | 4176 | * struct wiphy_vendor_command - vendor command definition |
| 4154 | * @info: vendor command identifying information, as used in nl80211 | 4177 | * @info: vendor command identifying information, as used in nl80211 |
| @@ -4159,6 +4182,10 @@ struct sta_opmode_info { | |||
| 4159 | * @dumpit: dump callback, for transferring bigger/multiple items. The | 4182 | * @dumpit: dump callback, for transferring bigger/multiple items. The |
| 4160 | * @storage points to cb->args[5], ie. is preserved over the multiple | 4183 | * @storage points to cb->args[5], ie. is preserved over the multiple |
| 4161 | * dumpit calls. | 4184 | * dumpit calls. |
| 4185 | * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA. | ||
| 4186 | * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the | ||
| 4187 | * attribute is just raw data (e.g. a firmware command). | ||
| 4188 | * @maxattr: highest attribute number in policy | ||
| 4162 | * It's recommended to not have the same sub command with both @doit and | 4189 | * It's recommended to not have the same sub command with both @doit and |
| 4163 | * @dumpit, so that userspace can assume certain ones are get and others | 4190 | * @dumpit, so that userspace can assume certain ones are get and others |
| 4164 | * are used with dump requests. | 4191 | * are used with dump requests. |
| @@ -4171,6 +4198,8 @@ struct wiphy_vendor_command { | |||
| 4171 | int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, | 4198 | int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 4172 | struct sk_buff *skb, const void *data, int data_len, | 4199 | struct sk_buff *skb, const void *data, int data_len, |
| 4173 | unsigned long *storage); | 4200 | unsigned long *storage); |
| 4201 | const struct nla_policy *policy; | ||
| 4202 | unsigned int maxattr; | ||
| 4174 | }; | 4203 | }; |
| 4175 | 4204 | ||
| 4176 | /** | 4205 | /** |
| @@ -5719,6 +5748,26 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); | |||
| 5719 | */ | 5748 | */ |
| 5720 | void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); | 5749 | void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); |
| 5721 | 5750 | ||
| 5751 | /** | ||
| 5752 | * cfg80211_bss_iter - iterate all BSS entries | ||
| 5753 | * | ||
| 5754 | * This function iterates over the BSS entries associated with the given wiphy | ||
| 5755 | * and calls the callback for the iterated BSS. The iterator function is not | ||
| 5756 | * allowed to call functions that might modify the internal state of the BSS DB. | ||
| 5757 | * | ||
| 5758 | * @wiphy: the wiphy | ||
| 5759 | * @chandef: if given, the iterator function will be called only if the channel | ||
| 5760 | * of the currently iterated BSS is a subset of the given channel. | ||
| 5761 | * @iter: the iterator function to call | ||
| 5762 | * @iter_data: an argument to the iterator function | ||
| 5763 | */ | ||
| 5764 | void cfg80211_bss_iter(struct wiphy *wiphy, | ||
| 5765 | struct cfg80211_chan_def *chandef, | ||
| 5766 | void (*iter)(struct wiphy *wiphy, | ||
| 5767 | struct cfg80211_bss *bss, | ||
| 5768 | void *data), | ||
| 5769 | void *iter_data); | ||
| 5770 | |||
| 5722 | static inline enum nl80211_bss_scan_width | 5771 | static inline enum nl80211_bss_scan_width |
| 5723 | cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) | 5772 | cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) |
| 5724 | { | 5773 | { |
| @@ -6229,8 +6278,11 @@ struct cfg80211_fils_resp_params { | |||
| 6229 | * case. | 6278 | * case. |
| 6230 | * @bssid: The BSSID of the AP (may be %NULL) | 6279 | * @bssid: The BSSID of the AP (may be %NULL) |
| 6231 | * @bss: Entry of bss to which STA got connected to, can be obtained through | 6280 | * @bss: Entry of bss to which STA got connected to, can be obtained through |
| 6232 | * cfg80211_get_bss() (may be %NULL). Only one parameter among @bssid and | 6281 | * cfg80211_get_bss() (may be %NULL). But it is recommended to store the |
| 6233 | * @bss needs to be specified. | 6282 | * bss from the connect_request and hold a reference to it and return |
| 6283 | * through this param to avoid a warning if the bss is expired during the | ||
| 6284 | * connection, esp. for those drivers implementing connect op. | ||
| 6285 | * Only one parameter among @bssid and @bss needs to be specified. | ||
| 6234 | * @req_ie: Association request IEs (may be %NULL) | 6286 | * @req_ie: Association request IEs (may be %NULL) |
| 6235 | * @req_ie_len: Association request IEs length | 6287 | * @req_ie_len: Association request IEs length |
| 6236 | * @resp_ie: Association response IEs (may be %NULL) | 6288 | * @resp_ie: Association response IEs (may be %NULL) |
| @@ -6278,8 +6330,12 @@ void cfg80211_connect_done(struct net_device *dev, | |||
| 6278 | * | 6330 | * |
| 6279 | * @dev: network device | 6331 | * @dev: network device |
| 6280 | * @bssid: the BSSID of the AP | 6332 | * @bssid: the BSSID of the AP |
| 6281 | * @bss: entry of bss to which STA got connected to, can be obtained | 6333 | * @bss: Entry of bss to which STA got connected to, can be obtained through |
| 6282 | * through cfg80211_get_bss (may be %NULL) | 6334 | * cfg80211_get_bss() (may be %NULL). But it is recommended to store the |
| 6335 | * bss from the connect_request and hold a reference to it and return | ||
| 6336 | * through this param to avoid a warning if the bss is expired during the | ||
| 6337 | * connection, esp. for those drivers implementing connect op. | ||
| 6338 | * Only one parameter among @bssid and @bss needs to be specified. | ||
| 6283 | * @req_ie: association request IEs (maybe be %NULL) | 6339 | * @req_ie: association request IEs (maybe be %NULL) |
| 6284 | * @req_ie_len: association request IEs length | 6340 | * @req_ie_len: association request IEs length |
| 6285 | * @resp_ie: association response IEs (may be %NULL) | 6341 | * @resp_ie: association response IEs (may be %NULL) |
| @@ -6490,6 +6546,16 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, | |||
| 6490 | gfp_t gfp); | 6546 | gfp_t gfp); |
| 6491 | 6547 | ||
| 6492 | /** | 6548 | /** |
| 6549 | * cfg80211_tx_mgmt_expired - tx_mgmt duration expired | ||
| 6550 | * @wdev: wireless device | ||
| 6551 | * @cookie: the requested cookie | ||
| 6552 | * @chan: The current channel (from tx_mgmt request) | ||
| 6553 | * @gfp: allocation flags | ||
| 6554 | */ | ||
| 6555 | void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie, | ||
| 6556 | struct ieee80211_channel *chan, gfp_t gfp); | ||
| 6557 | |||
| 6558 | /** | ||
| 6493 | * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics. | 6559 | * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics. |
| 6494 | * | 6560 | * |
| 6495 | * @sinfo: the station information | 6561 | * @sinfo: the station information |
diff --git a/include/net/devlink.h b/include/net/devlink.h index c9fbeb5b701f..bc36f942a7d5 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
| 14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
| 15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| 16 | #include <linux/workqueue.h> | ||
| 16 | #include <net/net_namespace.h> | 17 | #include <net/net_namespace.h> |
| 17 | #include <uapi/linux/devlink.h> | 18 | #include <uapi/linux/devlink.h> |
| 18 | 19 | ||
| @@ -37,14 +38,34 @@ struct devlink { | |||
| 37 | char priv[0] __aligned(NETDEV_ALIGN); | 38 | char priv[0] __aligned(NETDEV_ALIGN); |
| 38 | }; | 39 | }; |
| 39 | 40 | ||
| 41 | struct devlink_port_phys_attrs { | ||
| 42 | u32 port_number; /* Same value as "split group". | ||
| 43 | * A physical port which is visible to the user | ||
| 44 | * for a given port flavour. | ||
| 45 | */ | ||
| 46 | u32 split_subport_number; | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct devlink_port_pci_pf_attrs { | ||
| 50 | u16 pf; /* Associated PCI PF for this port. */ | ||
| 51 | }; | ||
| 52 | |||
| 53 | struct devlink_port_pci_vf_attrs { | ||
| 54 | u16 pf; /* Associated PCI PF for this port. */ | ||
| 55 | u16 vf; /* Associated PCI VF for of the PCI PF for this port. */ | ||
| 56 | }; | ||
| 57 | |||
| 40 | struct devlink_port_attrs { | 58 | struct devlink_port_attrs { |
| 41 | u8 set:1, | 59 | u8 set:1, |
| 42 | split:1, | 60 | split:1, |
| 43 | switch_port:1; | 61 | switch_port:1; |
| 44 | enum devlink_port_flavour flavour; | 62 | enum devlink_port_flavour flavour; |
| 45 | u32 port_number; /* same value as "split group" */ | ||
| 46 | u32 split_subport_number; | ||
| 47 | struct netdev_phys_item_id switch_id; | 63 | struct netdev_phys_item_id switch_id; |
| 64 | union { | ||
| 65 | struct devlink_port_phys_attrs phys; | ||
| 66 | struct devlink_port_pci_pf_attrs pci_pf; | ||
| 67 | struct devlink_port_pci_vf_attrs pci_vf; | ||
| 68 | }; | ||
| 48 | }; | 69 | }; |
| 49 | 70 | ||
| 50 | struct devlink_port { | 71 | struct devlink_port { |
| @@ -60,6 +81,7 @@ struct devlink_port { | |||
| 60 | enum devlink_port_type desired_type; | 81 | enum devlink_port_type desired_type; |
| 61 | void *type_dev; | 82 | void *type_dev; |
| 62 | struct devlink_port_attrs attrs; | 83 | struct devlink_port_attrs attrs; |
| 84 | struct delayed_work type_warn_dw; | ||
| 63 | }; | 85 | }; |
| 64 | 86 | ||
| 65 | struct devlink_sb_pool_info { | 87 | struct devlink_sb_pool_info { |
| @@ -526,8 +548,10 @@ struct devlink_ops { | |||
| 526 | int (*eswitch_inline_mode_get)(struct devlink *devlink, u8 *p_inline_mode); | 548 | int (*eswitch_inline_mode_get)(struct devlink *devlink, u8 *p_inline_mode); |
| 527 | int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode, | 549 | int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode, |
| 528 | struct netlink_ext_ack *extack); | 550 | struct netlink_ext_ack *extack); |
| 529 | int (*eswitch_encap_mode_get)(struct devlink *devlink, u8 *p_encap_mode); | 551 | int (*eswitch_encap_mode_get)(struct devlink *devlink, |
| 530 | int (*eswitch_encap_mode_set)(struct devlink *devlink, u8 encap_mode, | 552 | enum devlink_eswitch_encap_mode *p_encap_mode); |
| 553 | int (*eswitch_encap_mode_set)(struct devlink *devlink, | ||
| 554 | enum devlink_eswitch_encap_mode encap_mode, | ||
| 531 | struct netlink_ext_ack *extack); | 555 | struct netlink_ext_ack *extack); |
| 532 | int (*info_get)(struct devlink *devlink, struct devlink_info_req *req, | 556 | int (*info_get)(struct devlink *devlink, struct devlink_info_req *req, |
| 533 | struct netlink_ext_ack *extack); | 557 | struct netlink_ext_ack *extack); |
| @@ -586,6 +610,13 @@ void devlink_port_attrs_set(struct devlink_port *devlink_port, | |||
| 586 | u32 split_subport_number, | 610 | u32 split_subport_number, |
| 587 | const unsigned char *switch_id, | 611 | const unsigned char *switch_id, |
| 588 | unsigned char switch_id_len); | 612 | unsigned char switch_id_len); |
| 613 | void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, | ||
| 614 | const unsigned char *switch_id, | ||
| 615 | unsigned char switch_id_len, u16 pf); | ||
| 616 | void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port, | ||
| 617 | const unsigned char *switch_id, | ||
| 618 | unsigned char switch_id_len, | ||
| 619 | u16 pf, u16 vf); | ||
| 589 | int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, | 620 | int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, |
| 590 | u32 size, u16 ingress_pools_count, | 621 | u32 size, u16 ingress_pools_count, |
| 591 | u16 egress_pools_count, u16 ingress_tc_count, | 622 | u16 egress_pools_count, u16 ingress_tc_count, |
| @@ -735,6 +766,14 @@ void | |||
| 735 | devlink_health_reporter_state_update(struct devlink_health_reporter *reporter, | 766 | devlink_health_reporter_state_update(struct devlink_health_reporter *reporter, |
| 736 | enum devlink_health_reporter_state state); | 767 | enum devlink_health_reporter_state state); |
| 737 | 768 | ||
| 769 | void devlink_flash_update_begin_notify(struct devlink *devlink); | ||
| 770 | void devlink_flash_update_end_notify(struct devlink *devlink); | ||
| 771 | void devlink_flash_update_status_notify(struct devlink *devlink, | ||
| 772 | const char *status_msg, | ||
| 773 | const char *component, | ||
| 774 | unsigned long done, | ||
| 775 | unsigned long total); | ||
| 776 | |||
| 738 | #if IS_ENABLED(CONFIG_NET_DEVLINK) | 777 | #if IS_ENABLED(CONFIG_NET_DEVLINK) |
| 739 | 778 | ||
| 740 | void devlink_compat_running_version(struct net_device *dev, | 779 | void devlink_compat_running_version(struct net_device *dev, |
diff --git a/include/net/dsa.h b/include/net/dsa.h index ba6dfff98196..1e8650fa8acc 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/net_tstamp.h> | 18 | #include <linux/net_tstamp.h> |
| 19 | #include <linux/phy.h> | 19 | #include <linux/phy.h> |
| 20 | #include <linux/platform_data/dsa.h> | 20 | #include <linux/platform_data/dsa.h> |
| 21 | #include <linux/phylink.h> | ||
| 21 | #include <net/devlink.h> | 22 | #include <net/devlink.h> |
| 22 | #include <net/switchdev.h> | 23 | #include <net/switchdev.h> |
| 23 | 24 | ||
| @@ -180,7 +181,7 @@ struct dsa_port { | |||
| 180 | struct dsa_switch *ds; | 181 | struct dsa_switch *ds; |
| 181 | unsigned int index; | 182 | unsigned int index; |
| 182 | const char *name; | 183 | const char *name; |
| 183 | const struct dsa_port *cpu_dp; | 184 | struct dsa_port *cpu_dp; |
| 184 | const char *mac; | 185 | const char *mac; |
| 185 | struct device_node *dn; | 186 | struct device_node *dn; |
| 186 | unsigned int ageing_time; | 187 | unsigned int ageing_time; |
| @@ -189,6 +190,7 @@ struct dsa_port { | |||
| 189 | struct net_device *bridge_dev; | 190 | struct net_device *bridge_dev; |
| 190 | struct devlink_port devlink_port; | 191 | struct devlink_port devlink_port; |
| 191 | struct phylink *pl; | 192 | struct phylink *pl; |
| 193 | struct phylink_config pl_config; | ||
| 192 | 194 | ||
| 193 | struct work_struct xmit_work; | 195 | struct work_struct xmit_work; |
| 194 | struct sk_buff_head xmit_queue; | 196 | struct sk_buff_head xmit_queue; |
| @@ -355,6 +357,7 @@ struct dsa_switch_ops { | |||
| 355 | int port); | 357 | int port); |
| 356 | 358 | ||
| 357 | int (*setup)(struct dsa_switch *ds); | 359 | int (*setup)(struct dsa_switch *ds); |
| 360 | void (*teardown)(struct dsa_switch *ds); | ||
| 358 | u32 (*get_phy_flags)(struct dsa_switch *ds, int port); | 361 | u32 (*get_phy_flags)(struct dsa_switch *ds, int port); |
| 359 | 362 | ||
| 360 | /* | 363 | /* |
diff --git a/include/net/dst.h b/include/net/dst.h index 12b31c602cb0..fe62fe2eb781 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -183,7 +183,7 @@ static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val) | |||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | /* Kernel-internal feature bits that are unallocated in user space. */ | 185 | /* Kernel-internal feature bits that are unallocated in user space. */ |
| 186 | #define DST_FEATURE_ECN_CA (1 << 31) | 186 | #define DST_FEATURE_ECN_CA (1U << 31) |
| 187 | 187 | ||
| 188 | #define DST_FEATURE_MASK (DST_FEATURE_ECN_CA) | 188 | #define DST_FEATURE_MASK (DST_FEATURE_ECN_CA) |
| 189 | #define DST_FEATURE_ECN_MASK (DST_FEATURE_ECN_CA | RTAX_FEATURE_ECN) | 189 | #define DST_FEATURE_ECN_MASK (DST_FEATURE_ECN_CA | RTAX_FEATURE_ECN) |
| @@ -302,8 +302,9 @@ static inline bool dst_hold_safe(struct dst_entry *dst) | |||
| 302 | * @skb: buffer | 302 | * @skb: buffer |
| 303 | * | 303 | * |
| 304 | * If dst is not yet refcounted and not destroyed, grab a ref on it. | 304 | * If dst is not yet refcounted and not destroyed, grab a ref on it. |
| 305 | * Returns true if dst is refcounted. | ||
| 305 | */ | 306 | */ |
| 306 | static inline void skb_dst_force(struct sk_buff *skb) | 307 | static inline bool skb_dst_force(struct sk_buff *skb) |
| 307 | { | 308 | { |
| 308 | if (skb_dst_is_noref(skb)) { | 309 | if (skb_dst_is_noref(skb)) { |
| 309 | struct dst_entry *dst = skb_dst(skb); | 310 | struct dst_entry *dst = skb_dst(skb); |
| @@ -314,6 +315,8 @@ static inline void skb_dst_force(struct sk_buff *skb) | |||
| 314 | 315 | ||
| 315 | skb->_skb_refdst = (unsigned long)dst; | 316 | skb->_skb_refdst = (unsigned long)dst; |
| 316 | } | 317 | } |
| 318 | |||
| 319 | return skb->_skb_refdst != 0UL; | ||
| 317 | } | 320 | } |
| 318 | 321 | ||
| 319 | 322 | ||
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index b473df5b9512..20dcadd8eed9 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
| @@ -103,6 +103,7 @@ struct fib_rule_notifier_info { | |||
| 103 | }; | 103 | }; |
| 104 | 104 | ||
| 105 | #define FRA_GENERIC_POLICY \ | 105 | #define FRA_GENERIC_POLICY \ |
| 106 | [FRA_UNSPEC] = { .strict_start_type = FRA_DPORT_RANGE + 1 }, \ | ||
| 106 | [FRA_IIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ | 107 | [FRA_IIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ |
| 107 | [FRA_OIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ | 108 | [FRA_OIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ |
| 108 | [FRA_PRIORITY] = { .type = NLA_U32 }, \ | 109 | [FRA_PRIORITY] = { .type = NLA_U32 }, \ |
| @@ -179,9 +180,9 @@ static inline bool fib_rule_port_range_compare(struct fib_rule_port_range *a, | |||
| 179 | 180 | ||
| 180 | static inline bool fib_rule_requires_fldissect(struct fib_rule *rule) | 181 | static inline bool fib_rule_requires_fldissect(struct fib_rule *rule) |
| 181 | { | 182 | { |
| 182 | return rule->ip_proto || | 183 | return rule->iifindex != LOOPBACK_IFINDEX && (rule->ip_proto || |
| 183 | fib_rule_port_range_set(&rule->sport_range) || | 184 | fib_rule_port_range_set(&rule->sport_range) || |
| 184 | fib_rule_port_range_set(&rule->dport_range); | 185 | fib_rule_port_range_set(&rule->dport_range)); |
| 185 | } | 186 | } |
| 186 | 187 | ||
| 187 | struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, | 188 | struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, |
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index dfabc0503446..90bd210be060 100644 --- a/include/net/flow_dissector.h +++ b/include/net/flow_dissector.h | |||
| @@ -200,6 +200,28 @@ struct flow_dissector_key_ip { | |||
| 200 | __u8 ttl; | 200 | __u8 ttl; |
| 201 | }; | 201 | }; |
| 202 | 202 | ||
| 203 | /** | ||
| 204 | * struct flow_dissector_key_meta: | ||
| 205 | * @ingress_ifindex: ingress ifindex | ||
| 206 | */ | ||
| 207 | struct flow_dissector_key_meta { | ||
| 208 | int ingress_ifindex; | ||
| 209 | }; | ||
| 210 | |||
| 211 | /** | ||
| 212 | * struct flow_dissector_key_ct: | ||
| 213 | * @ct_state: conntrack state after converting with map | ||
| 214 | * @ct_mark: conttrack mark | ||
| 215 | * @ct_zone: conntrack zone | ||
| 216 | * @ct_labels: conntrack labels | ||
| 217 | */ | ||
| 218 | struct flow_dissector_key_ct { | ||
| 219 | u16 ct_state; | ||
| 220 | u16 ct_zone; | ||
| 221 | u32 ct_mark; | ||
| 222 | u32 ct_labels[4]; | ||
| 223 | }; | ||
| 224 | |||
| 203 | enum flow_dissector_key_id { | 225 | enum flow_dissector_key_id { |
| 204 | FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */ | 226 | FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */ |
| 205 | FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */ | 227 | FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */ |
| @@ -225,14 +247,15 @@ enum flow_dissector_key_id { | |||
| 225 | FLOW_DISSECTOR_KEY_CVLAN, /* struct flow_dissector_key_vlan */ | 247 | FLOW_DISSECTOR_KEY_CVLAN, /* struct flow_dissector_key_vlan */ |
| 226 | FLOW_DISSECTOR_KEY_ENC_IP, /* struct flow_dissector_key_ip */ | 248 | FLOW_DISSECTOR_KEY_ENC_IP, /* struct flow_dissector_key_ip */ |
| 227 | FLOW_DISSECTOR_KEY_ENC_OPTS, /* struct flow_dissector_key_enc_opts */ | 249 | FLOW_DISSECTOR_KEY_ENC_OPTS, /* struct flow_dissector_key_enc_opts */ |
| 250 | FLOW_DISSECTOR_KEY_META, /* struct flow_dissector_key_meta */ | ||
| 251 | FLOW_DISSECTOR_KEY_CT, /* struct flow_dissector_key_ct */ | ||
| 228 | 252 | ||
| 229 | FLOW_DISSECTOR_KEY_MAX, | 253 | FLOW_DISSECTOR_KEY_MAX, |
| 230 | }; | 254 | }; |
| 231 | 255 | ||
| 232 | #define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0) | 256 | #define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0) |
| 233 | #define FLOW_DISSECTOR_F_STOP_AT_L3 BIT(1) | 257 | #define FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL BIT(1) |
| 234 | #define FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL BIT(2) | 258 | #define FLOW_DISSECTOR_F_STOP_AT_ENCAP BIT(2) |
| 235 | #define FLOW_DISSECTOR_F_STOP_AT_ENCAP BIT(3) | ||
| 236 | 259 | ||
| 237 | struct flow_dissector_key { | 260 | struct flow_dissector_key { |
| 238 | enum flow_dissector_key_id key_id; | 261 | enum flow_dissector_key_id key_id; |
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index a2df99f9b196..db337299e81e 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | #ifndef _NET_FLOW_OFFLOAD_H | 1 | #ifndef _NET_FLOW_OFFLOAD_H |
| 2 | #define _NET_FLOW_OFFLOAD_H | 2 | #define _NET_FLOW_OFFLOAD_H |
| 3 | 3 | ||
| 4 | #include <linux/kernel.h> | ||
| 4 | #include <net/flow_dissector.h> | 5 | #include <net/flow_dissector.h> |
| 6 | #include <net/sch_generic.h> | ||
| 5 | 7 | ||
| 6 | struct flow_match { | 8 | struct flow_match { |
| 7 | struct flow_dissector *dissector; | 9 | struct flow_dissector *dissector; |
| @@ -9,6 +11,10 @@ struct flow_match { | |||
| 9 | void *key; | 11 | void *key; |
| 10 | }; | 12 | }; |
| 11 | 13 | ||
| 14 | struct flow_match_meta { | ||
| 15 | struct flow_dissector_key_meta *key, *mask; | ||
| 16 | }; | ||
| 17 | |||
| 12 | struct flow_match_basic { | 18 | struct flow_match_basic { |
| 13 | struct flow_dissector_key_basic *key, *mask; | 19 | struct flow_dissector_key_basic *key, *mask; |
| 14 | }; | 20 | }; |
| @@ -63,6 +69,8 @@ struct flow_match_enc_opts { | |||
| 63 | 69 | ||
| 64 | struct flow_rule; | 70 | struct flow_rule; |
| 65 | 71 | ||
| 72 | void flow_rule_match_meta(const struct flow_rule *rule, | ||
| 73 | struct flow_match_meta *out); | ||
| 66 | void flow_rule_match_basic(const struct flow_rule *rule, | 74 | void flow_rule_match_basic(const struct flow_rule *rule, |
| 67 | struct flow_match_basic *out); | 75 | struct flow_match_basic *out); |
| 68 | void flow_rule_match_control(const struct flow_rule *rule, | 76 | void flow_rule_match_control(const struct flow_rule *rule, |
| @@ -122,6 +130,7 @@ enum flow_action_id { | |||
| 122 | FLOW_ACTION_QUEUE, | 130 | FLOW_ACTION_QUEUE, |
| 123 | FLOW_ACTION_SAMPLE, | 131 | FLOW_ACTION_SAMPLE, |
| 124 | FLOW_ACTION_POLICE, | 132 | FLOW_ACTION_POLICE, |
| 133 | FLOW_ACTION_CT, | ||
| 125 | }; | 134 | }; |
| 126 | 135 | ||
| 127 | /* This is mirroring enum pedit_header_type definition for easy mapping between | 136 | /* This is mirroring enum pedit_header_type definition for easy mapping between |
| @@ -171,6 +180,10 @@ struct flow_action_entry { | |||
| 171 | s64 burst; | 180 | s64 burst; |
| 172 | u64 rate_bytes_ps; | 181 | u64 rate_bytes_ps; |
| 173 | } police; | 182 | } police; |
| 183 | struct { /* FLOW_ACTION_CT */ | ||
| 184 | int action; | ||
| 185 | u16 zone; | ||
| 186 | } ct; | ||
| 174 | }; | 187 | }; |
| 175 | }; | 188 | }; |
| 176 | 189 | ||
| @@ -225,4 +238,99 @@ static inline void flow_stats_update(struct flow_stats *flow_stats, | |||
| 225 | flow_stats->lastused = max_t(u64, flow_stats->lastused, lastused); | 238 | flow_stats->lastused = max_t(u64, flow_stats->lastused, lastused); |
| 226 | } | 239 | } |
| 227 | 240 | ||
| 241 | enum flow_block_command { | ||
| 242 | FLOW_BLOCK_BIND, | ||
| 243 | FLOW_BLOCK_UNBIND, | ||
| 244 | }; | ||
| 245 | |||
| 246 | enum flow_block_binder_type { | ||
| 247 | FLOW_BLOCK_BINDER_TYPE_UNSPEC, | ||
| 248 | FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS, | ||
| 249 | FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS, | ||
| 250 | }; | ||
| 251 | |||
| 252 | struct netlink_ext_ack; | ||
| 253 | |||
| 254 | struct flow_block_offload { | ||
| 255 | enum flow_block_command command; | ||
| 256 | enum flow_block_binder_type binder_type; | ||
| 257 | bool block_shared; | ||
| 258 | struct net *net; | ||
| 259 | struct list_head cb_list; | ||
| 260 | struct list_head *driver_block_list; | ||
| 261 | struct netlink_ext_ack *extack; | ||
| 262 | }; | ||
| 263 | |||
| 264 | struct flow_block_cb { | ||
| 265 | struct list_head driver_list; | ||
| 266 | struct list_head list; | ||
| 267 | struct net *net; | ||
| 268 | tc_setup_cb_t *cb; | ||
| 269 | void *cb_ident; | ||
| 270 | void *cb_priv; | ||
| 271 | void (*release)(void *cb_priv); | ||
| 272 | unsigned int refcnt; | ||
| 273 | }; | ||
| 274 | |||
| 275 | struct flow_block_cb *flow_block_cb_alloc(struct net *net, tc_setup_cb_t *cb, | ||
| 276 | void *cb_ident, void *cb_priv, | ||
| 277 | void (*release)(void *cb_priv)); | ||
| 278 | void flow_block_cb_free(struct flow_block_cb *block_cb); | ||
| 279 | |||
| 280 | struct flow_block_cb *flow_block_cb_lookup(struct flow_block_offload *offload, | ||
| 281 | tc_setup_cb_t *cb, void *cb_ident); | ||
| 282 | |||
| 283 | void *flow_block_cb_priv(struct flow_block_cb *block_cb); | ||
| 284 | void flow_block_cb_incref(struct flow_block_cb *block_cb); | ||
| 285 | unsigned int flow_block_cb_decref(struct flow_block_cb *block_cb); | ||
| 286 | |||
| 287 | static inline void flow_block_cb_add(struct flow_block_cb *block_cb, | ||
| 288 | struct flow_block_offload *offload) | ||
| 289 | { | ||
| 290 | list_add_tail(&block_cb->list, &offload->cb_list); | ||
| 291 | } | ||
| 292 | |||
| 293 | static inline void flow_block_cb_remove(struct flow_block_cb *block_cb, | ||
| 294 | struct flow_block_offload *offload) | ||
| 295 | { | ||
| 296 | list_move(&block_cb->list, &offload->cb_list); | ||
| 297 | } | ||
| 298 | |||
| 299 | bool flow_block_cb_is_busy(tc_setup_cb_t *cb, void *cb_ident, | ||
| 300 | struct list_head *driver_block_list); | ||
| 301 | |||
| 302 | int flow_block_cb_setup_simple(struct flow_block_offload *f, | ||
| 303 | struct list_head *driver_list, tc_setup_cb_t *cb, | ||
| 304 | void *cb_ident, void *cb_priv, bool ingress_only); | ||
| 305 | |||
| 306 | enum flow_cls_command { | ||
| 307 | FLOW_CLS_REPLACE, | ||
| 308 | FLOW_CLS_DESTROY, | ||
| 309 | FLOW_CLS_STATS, | ||
| 310 | FLOW_CLS_TMPLT_CREATE, | ||
| 311 | FLOW_CLS_TMPLT_DESTROY, | ||
| 312 | }; | ||
| 313 | |||
| 314 | struct flow_cls_common_offload { | ||
| 315 | u32 chain_index; | ||
| 316 | __be16 protocol; | ||
| 317 | u32 prio; | ||
| 318 | struct netlink_ext_ack *extack; | ||
| 319 | }; | ||
| 320 | |||
| 321 | struct flow_cls_offload { | ||
| 322 | struct flow_cls_common_offload common; | ||
| 323 | enum flow_cls_command command; | ||
| 324 | unsigned long cookie; | ||
| 325 | struct flow_rule *rule; | ||
| 326 | struct flow_stats stats; | ||
| 327 | u32 classid; | ||
| 328 | }; | ||
| 329 | |||
| 330 | static inline struct flow_rule * | ||
| 331 | flow_cls_offload_flow_rule(struct flow_cls_offload *flow_cmd) | ||
| 332 | { | ||
| 333 | return flow_cmd->rule; | ||
| 334 | } | ||
| 335 | |||
| 228 | #endif /* _NET_FLOW_OFFLOAD_H */ | 336 | #endif /* _NET_FLOW_OFFLOAD_H */ |
diff --git a/include/net/gue.h b/include/net/gue.h index fdad41469b65..3a6595bfa641 100644 --- a/include/net/gue.h +++ b/include/net/gue.h | |||
| @@ -60,7 +60,7 @@ struct guehdr { | |||
| 60 | 60 | ||
| 61 | /* Private flags in the private option extension */ | 61 | /* Private flags in the private option extension */ |
| 62 | 62 | ||
| 63 | #define GUE_PFLAG_REMCSUM htonl(1 << 31) | 63 | #define GUE_PFLAG_REMCSUM htonl(1U << 31) |
| 64 | #define GUE_PLEN_REMCSUM 4 | 64 | #define GUE_PLEN_REMCSUM 4 |
| 65 | 65 | ||
| 66 | #define GUE_PFLAGS_ALL (GUE_PFLAG_REMCSUM) | 66 | #define GUE_PFLAGS_ALL (GUE_PFLAG_REMCSUM) |
diff --git a/include/net/hwbm.h b/include/net/hwbm.h index 89085e2e2da5..81643cf8a1c4 100644 --- a/include/net/hwbm.h +++ b/include/net/hwbm.h | |||
| @@ -12,18 +12,18 @@ struct hwbm_pool { | |||
| 12 | /* constructor called during alocation */ | 12 | /* constructor called during alocation */ |
| 13 | int (*construct)(struct hwbm_pool *bm_pool, void *buf); | 13 | int (*construct)(struct hwbm_pool *bm_pool, void *buf); |
| 14 | /* protect acces to the buffer counter*/ | 14 | /* protect acces to the buffer counter*/ |
| 15 | spinlock_t lock; | 15 | struct mutex buf_lock; |
| 16 | /* private data */ | 16 | /* private data */ |
| 17 | void *priv; | 17 | void *priv; |
| 18 | }; | 18 | }; |
| 19 | #ifdef CONFIG_HWBM | 19 | #ifdef CONFIG_HWBM |
| 20 | void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf); | 20 | void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf); |
| 21 | int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp); | 21 | int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp); |
| 22 | int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp); | 22 | int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num); |
| 23 | #else | 23 | #else |
| 24 | void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {} | 24 | void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {} |
| 25 | int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; } | 25 | int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; } |
| 26 | int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp) | 26 | int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num) |
| 27 | { return 0; } | 27 | { return 0; } |
| 28 | #endif /* CONFIG_HWBM */ | 28 | #endif /* CONFIG_HWBM */ |
| 29 | #endif /* _HWBM_H */ | 29 | #endif /* _HWBM_H */ |
diff --git a/include/net/inet_common.h b/include/net/inet_common.h index 975901a95c0f..ae2ba897675c 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h | |||
| @@ -25,6 +25,7 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr, | |||
| 25 | int addr_len, int flags); | 25 | int addr_len, int flags); |
| 26 | int inet_accept(struct socket *sock, struct socket *newsock, int flags, | 26 | int inet_accept(struct socket *sock, struct socket *newsock, int flags, |
| 27 | bool kern); | 27 | bool kern); |
| 28 | int inet_send_prepare(struct sock *sk); | ||
| 28 | int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size); | 29 | int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size); |
| 29 | ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, | 30 | ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, |
| 30 | size_t size, int flags); | 31 | size_t size, int flags); |
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 378904ee9129..010f26b31c89 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
| @@ -3,19 +3,24 @@ | |||
| 3 | #define __NET_FRAG_H__ | 3 | #define __NET_FRAG_H__ |
| 4 | 4 | ||
| 5 | #include <linux/rhashtable-types.h> | 5 | #include <linux/rhashtable-types.h> |
| 6 | #include <linux/completion.h> | ||
| 6 | 7 | ||
| 7 | struct netns_frags { | 8 | /* Per netns frag queues directory */ |
| 9 | struct fqdir { | ||
| 8 | /* sysctls */ | 10 | /* sysctls */ |
| 9 | long high_thresh; | 11 | long high_thresh; |
| 10 | long low_thresh; | 12 | long low_thresh; |
| 11 | int timeout; | 13 | int timeout; |
| 12 | int max_dist; | 14 | int max_dist; |
| 13 | struct inet_frags *f; | 15 | struct inet_frags *f; |
| 16 | struct net *net; | ||
| 17 | bool dead; | ||
| 14 | 18 | ||
| 15 | struct rhashtable rhashtable ____cacheline_aligned_in_smp; | 19 | struct rhashtable rhashtable ____cacheline_aligned_in_smp; |
| 16 | 20 | ||
| 17 | /* Keep atomic mem on separate cachelines in structs that include it */ | 21 | /* Keep atomic mem on separate cachelines in structs that include it */ |
| 18 | atomic_long_t mem ____cacheline_aligned_in_smp; | 22 | atomic_long_t mem ____cacheline_aligned_in_smp; |
| 23 | struct work_struct destroy_work; | ||
| 19 | }; | 24 | }; |
| 20 | 25 | ||
| 21 | /** | 26 | /** |
| @@ -24,11 +29,13 @@ struct netns_frags { | |||
| 24 | * @INET_FRAG_FIRST_IN: first fragment has arrived | 29 | * @INET_FRAG_FIRST_IN: first fragment has arrived |
| 25 | * @INET_FRAG_LAST_IN: final fragment has arrived | 30 | * @INET_FRAG_LAST_IN: final fragment has arrived |
| 26 | * @INET_FRAG_COMPLETE: frag queue has been processed and is due for destruction | 31 | * @INET_FRAG_COMPLETE: frag queue has been processed and is due for destruction |
| 32 | * @INET_FRAG_HASH_DEAD: inet_frag_kill() has not removed fq from rhashtable | ||
| 27 | */ | 33 | */ |
| 28 | enum { | 34 | enum { |
| 29 | INET_FRAG_FIRST_IN = BIT(0), | 35 | INET_FRAG_FIRST_IN = BIT(0), |
| 30 | INET_FRAG_LAST_IN = BIT(1), | 36 | INET_FRAG_LAST_IN = BIT(1), |
| 31 | INET_FRAG_COMPLETE = BIT(2), | 37 | INET_FRAG_COMPLETE = BIT(2), |
| 38 | INET_FRAG_HASH_DEAD = BIT(3), | ||
| 32 | }; | 39 | }; |
| 33 | 40 | ||
| 34 | struct frag_v4_compare_key { | 41 | struct frag_v4_compare_key { |
| @@ -64,7 +71,7 @@ struct frag_v6_compare_key { | |||
| 64 | * @meat: length of received fragments so far | 71 | * @meat: length of received fragments so far |
| 65 | * @flags: fragment queue flags | 72 | * @flags: fragment queue flags |
| 66 | * @max_size: maximum received fragment size | 73 | * @max_size: maximum received fragment size |
| 67 | * @net: namespace that this frag belongs to | 74 | * @fqdir: pointer to struct fqdir |
| 68 | * @rcu: rcu head for freeing deferall | 75 | * @rcu: rcu head for freeing deferall |
| 69 | */ | 76 | */ |
| 70 | struct inet_frag_queue { | 77 | struct inet_frag_queue { |
| @@ -84,7 +91,7 @@ struct inet_frag_queue { | |||
| 84 | int meat; | 91 | int meat; |
| 85 | __u8 flags; | 92 | __u8 flags; |
| 86 | u16 max_size; | 93 | u16 max_size; |
| 87 | struct netns_frags *net; | 94 | struct fqdir *fqdir; |
| 88 | struct rcu_head rcu; | 95 | struct rcu_head rcu; |
| 89 | }; | 96 | }; |
| 90 | 97 | ||
| @@ -98,21 +105,25 @@ struct inet_frags { | |||
| 98 | struct kmem_cache *frags_cachep; | 105 | struct kmem_cache *frags_cachep; |
| 99 | const char *frags_cache_name; | 106 | const char *frags_cache_name; |
| 100 | struct rhashtable_params rhash_params; | 107 | struct rhashtable_params rhash_params; |
| 108 | refcount_t refcnt; | ||
| 109 | struct completion completion; | ||
| 101 | }; | 110 | }; |
| 102 | 111 | ||
| 103 | int inet_frags_init(struct inet_frags *); | 112 | int inet_frags_init(struct inet_frags *); |
| 104 | void inet_frags_fini(struct inet_frags *); | 113 | void inet_frags_fini(struct inet_frags *); |
| 105 | 114 | ||
| 106 | static inline int inet_frags_init_net(struct netns_frags *nf) | 115 | int fqdir_init(struct fqdir **fqdirp, struct inet_frags *f, struct net *net); |
| 116 | |||
| 117 | static inline void fqdir_pre_exit(struct fqdir *fqdir) | ||
| 107 | { | 118 | { |
| 108 | atomic_long_set(&nf->mem, 0); | 119 | fqdir->high_thresh = 0; /* prevent creation of new frags */ |
| 109 | return rhashtable_init(&nf->rhashtable, &nf->f->rhash_params); | 120 | fqdir->dead = true; |
| 110 | } | 121 | } |
| 111 | void inet_frags_exit_net(struct netns_frags *nf); | 122 | void fqdir_exit(struct fqdir *fqdir); |
| 112 | 123 | ||
| 113 | void inet_frag_kill(struct inet_frag_queue *q); | 124 | void inet_frag_kill(struct inet_frag_queue *q); |
| 114 | void inet_frag_destroy(struct inet_frag_queue *q); | 125 | void inet_frag_destroy(struct inet_frag_queue *q); |
| 115 | struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, void *key); | 126 | struct inet_frag_queue *inet_frag_find(struct fqdir *fqdir, void *key); |
| 116 | 127 | ||
| 117 | /* Free all skbs in the queue; return the sum of their truesizes. */ | 128 | /* Free all skbs in the queue; return the sum of their truesizes. */ |
| 118 | unsigned int inet_frag_rbtree_purge(struct rb_root *root); | 129 | unsigned int inet_frag_rbtree_purge(struct rb_root *root); |
| @@ -125,19 +136,19 @@ static inline void inet_frag_put(struct inet_frag_queue *q) | |||
| 125 | 136 | ||
| 126 | /* Memory Tracking Functions. */ | 137 | /* Memory Tracking Functions. */ |
| 127 | 138 | ||
| 128 | static inline long frag_mem_limit(const struct netns_frags *nf) | 139 | static inline long frag_mem_limit(const struct fqdir *fqdir) |
| 129 | { | 140 | { |
| 130 | return atomic_long_read(&nf->mem); | 141 | return atomic_long_read(&fqdir->mem); |
| 131 | } | 142 | } |
| 132 | 143 | ||
| 133 | static inline void sub_frag_mem_limit(struct netns_frags *nf, long val) | 144 | static inline void sub_frag_mem_limit(struct fqdir *fqdir, long val) |
| 134 | { | 145 | { |
| 135 | atomic_long_sub(val, &nf->mem); | 146 | atomic_long_sub(val, &fqdir->mem); |
| 136 | } | 147 | } |
| 137 | 148 | ||
| 138 | static inline void add_frag_mem_limit(struct netns_frags *nf, long val) | 149 | static inline void add_frag_mem_limit(struct fqdir *fqdir, long val) |
| 139 | { | 150 | { |
| 140 | atomic_long_add(val, &nf->mem); | 151 | atomic_long_add(val, &fqdir->mem); |
| 141 | } | 152 | } |
| 142 | 153 | ||
| 143 | /* RFC 3168 support : | 154 | /* RFC 3168 support : |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index c2f756aedc54..aef38c140014 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
| @@ -70,6 +70,7 @@ struct inet_timewait_sock { | |||
| 70 | tw_flowlabel : 20, | 70 | tw_flowlabel : 20, |
| 71 | tw_pad : 2, /* 2 bits hole */ | 71 | tw_pad : 2, /* 2 bits hole */ |
| 72 | tw_tos : 8; | 72 | tw_tos : 8; |
| 73 | u32 tw_txhash; | ||
| 73 | struct timer_list tw_timer; | 74 | struct timer_list tw_timer; |
| 74 | struct inet_bind_bucket *tw_tb; | 75 | struct inet_bind_bucket *tw_tb; |
| 75 | }; | 76 | }; |
diff --git a/include/net/ip.h b/include/net/ip.h index 49c672c8cdae..29d89de39822 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -161,6 +161,44 @@ int ip_output(struct net *net, struct sock *sk, struct sk_buff *skb); | |||
| 161 | int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb); | 161 | int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb); |
| 162 | int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, | 162 | int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, |
| 163 | int (*output)(struct net *, struct sock *, struct sk_buff *)); | 163 | int (*output)(struct net *, struct sock *, struct sk_buff *)); |
| 164 | |||
| 165 | struct ip_fraglist_iter { | ||
| 166 | struct sk_buff *frag; | ||
| 167 | struct iphdr *iph; | ||
| 168 | int offset; | ||
| 169 | unsigned int hlen; | ||
| 170 | }; | ||
| 171 | |||
| 172 | void ip_fraglist_init(struct sk_buff *skb, struct iphdr *iph, | ||
| 173 | unsigned int hlen, struct ip_fraglist_iter *iter); | ||
| 174 | void ip_fraglist_prepare(struct sk_buff *skb, struct ip_fraglist_iter *iter); | ||
| 175 | |||
| 176 | static inline struct sk_buff *ip_fraglist_next(struct ip_fraglist_iter *iter) | ||
| 177 | { | ||
| 178 | struct sk_buff *skb = iter->frag; | ||
| 179 | |||
| 180 | iter->frag = skb->next; | ||
| 181 | skb_mark_not_on_list(skb); | ||
| 182 | |||
| 183 | return skb; | ||
| 184 | } | ||
| 185 | |||
| 186 | struct ip_frag_state { | ||
| 187 | struct iphdr *iph; | ||
| 188 | unsigned int hlen; | ||
| 189 | unsigned int ll_rs; | ||
| 190 | unsigned int mtu; | ||
| 191 | unsigned int left; | ||
| 192 | int offset; | ||
| 193 | int ptr; | ||
| 194 | __be16 not_last_frag; | ||
| 195 | }; | ||
| 196 | |||
| 197 | void ip_frag_init(struct sk_buff *skb, unsigned int hlen, unsigned int ll_rs, | ||
| 198 | unsigned int mtu, struct ip_frag_state *state); | ||
| 199 | struct sk_buff *ip_frag_next(struct sk_buff *skb, | ||
| 200 | struct ip_frag_state *state); | ||
| 201 | |||
| 164 | void ip_send_check(struct iphdr *ip); | 202 | void ip_send_check(struct iphdr *ip); |
| 165 | int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb); | 203 | int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb); |
| 166 | int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb); | 204 | int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb); |
| @@ -241,7 +279,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, | |||
| 241 | const struct ip_options *sopt, | 279 | const struct ip_options *sopt, |
| 242 | __be32 daddr, __be32 saddr, | 280 | __be32 daddr, __be32 saddr, |
| 243 | const struct ip_reply_arg *arg, | 281 | const struct ip_reply_arg *arg, |
| 244 | unsigned int len); | 282 | unsigned int len, u64 transmit_time); |
| 245 | 283 | ||
| 246 | #define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field) | 284 | #define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field) |
| 247 | #define __IP_INC_STATS(net, field) __SNMP_INC_STATS64((net)->mib.ip_statistics, field) | 285 | #define __IP_INC_STATS(net, field) __SNMP_INC_STATS64((net)->mib.ip_statistics, field) |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 855b352b660f..4b5656c71abc 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
| @@ -49,6 +49,7 @@ struct fib6_config { | |||
| 49 | u16 fc_delete_all_nh : 1, | 49 | u16 fc_delete_all_nh : 1, |
| 50 | fc_ignore_dev_down:1, | 50 | fc_ignore_dev_down:1, |
| 51 | __unused : 14; | 51 | __unused : 14; |
| 52 | u32 fc_nh_id; | ||
| 52 | 53 | ||
| 53 | struct in6_addr fc_dst; | 54 | struct in6_addr fc_dst; |
| 54 | struct in6_addr fc_src; | 55 | struct in6_addr fc_src; |
| @@ -127,6 +128,9 @@ struct fib6_nh { | |||
| 127 | #ifdef CONFIG_IPV6_ROUTER_PREF | 128 | #ifdef CONFIG_IPV6_ROUTER_PREF |
| 128 | unsigned long last_probe; | 129 | unsigned long last_probe; |
| 129 | #endif | 130 | #endif |
| 131 | |||
| 132 | struct rt6_info * __percpu *rt6i_pcpu; | ||
| 133 | struct rt6_exception_bucket __rcu *rt6i_exception_bucket; | ||
| 130 | }; | 134 | }; |
| 131 | 135 | ||
| 132 | struct fib6_info { | 136 | struct fib6_info { |
| @@ -139,7 +143,10 @@ struct fib6_info { | |||
| 139 | * destination, but not the same gateway. nsiblings is just a cache | 143 | * destination, but not the same gateway. nsiblings is just a cache |
| 140 | * to speed up lookup. | 144 | * to speed up lookup. |
| 141 | */ | 145 | */ |
| 142 | struct list_head fib6_siblings; | 146 | union { |
| 147 | struct list_head fib6_siblings; | ||
| 148 | struct list_head nh_list; | ||
| 149 | }; | ||
| 143 | unsigned int fib6_nsiblings; | 150 | unsigned int fib6_nsiblings; |
| 144 | 151 | ||
| 145 | refcount_t fib6_ref; | 152 | refcount_t fib6_ref; |
| @@ -152,22 +159,19 @@ struct fib6_info { | |||
| 152 | struct rt6key fib6_src; | 159 | struct rt6key fib6_src; |
| 153 | struct rt6key fib6_prefsrc; | 160 | struct rt6key fib6_prefsrc; |
| 154 | 161 | ||
| 155 | struct rt6_info * __percpu *rt6i_pcpu; | ||
| 156 | struct rt6_exception_bucket __rcu *rt6i_exception_bucket; | ||
| 157 | |||
| 158 | u32 fib6_metric; | 162 | u32 fib6_metric; |
| 159 | u8 fib6_protocol; | 163 | u8 fib6_protocol; |
| 160 | u8 fib6_type; | 164 | u8 fib6_type; |
| 161 | u8 exception_bucket_flushed:1, | 165 | u8 should_flush:1, |
| 162 | should_flush:1, | ||
| 163 | dst_nocount:1, | 166 | dst_nocount:1, |
| 164 | dst_nopolicy:1, | 167 | dst_nopolicy:1, |
| 165 | dst_host:1, | 168 | dst_host:1, |
| 166 | fib6_destroying:1, | 169 | fib6_destroying:1, |
| 167 | unused:2; | 170 | unused:3; |
| 168 | 171 | ||
| 169 | struct fib6_nh fib6_nh; | ||
| 170 | struct rcu_head rcu; | 172 | struct rcu_head rcu; |
| 173 | struct nexthop *nh; | ||
| 174 | struct fib6_nh fib6_nh[0]; | ||
| 171 | }; | 175 | }; |
| 172 | 176 | ||
| 173 | struct rt6_info { | 177 | struct rt6_info { |
| @@ -276,7 +280,7 @@ static inline void ip6_rt_put(struct rt6_info *rt) | |||
| 276 | dst_release(&rt->dst); | 280 | dst_release(&rt->dst); |
| 277 | } | 281 | } |
| 278 | 282 | ||
| 279 | struct fib6_info *fib6_info_alloc(gfp_t gfp_flags); | 283 | struct fib6_info *fib6_info_alloc(gfp_t gfp_flags, bool with_fib6_nh); |
| 280 | void fib6_info_destroy_rcu(struct rcu_head *head); | 284 | void fib6_info_destroy_rcu(struct rcu_head *head); |
| 281 | 285 | ||
| 282 | static inline void fib6_info_hold(struct fib6_info *f6i) | 286 | static inline void fib6_info_hold(struct fib6_info *f6i) |
| @@ -312,6 +316,7 @@ struct fib6_walker { | |||
| 312 | enum fib6_walk_state state; | 316 | enum fib6_walk_state state; |
| 313 | unsigned int skip; | 317 | unsigned int skip; |
| 314 | unsigned int count; | 318 | unsigned int count; |
| 319 | unsigned int skip_in_node; | ||
| 315 | int (*func)(struct fib6_walker *); | 320 | int (*func)(struct fib6_walker *); |
| 316 | void *args; | 321 | void *args; |
| 317 | }; | 322 | }; |
| @@ -373,6 +378,7 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *, | |||
| 373 | struct fib6_entry_notifier_info { | 378 | struct fib6_entry_notifier_info { |
| 374 | struct fib_notifier_info info; /* must be first */ | 379 | struct fib_notifier_info info; /* must be first */ |
| 375 | struct fib6_info *rt; | 380 | struct fib6_info *rt; |
| 381 | unsigned int nsiblings; | ||
| 376 | }; | 382 | }; |
| 377 | 383 | ||
| 378 | /* | 384 | /* |
| @@ -437,16 +443,22 @@ void rt6_get_prefsrc(const struct rt6_info *rt, struct in6_addr *addr) | |||
| 437 | rcu_read_unlock(); | 443 | rcu_read_unlock(); |
| 438 | } | 444 | } |
| 439 | 445 | ||
| 440 | static inline struct net_device *fib6_info_nh_dev(const struct fib6_info *f6i) | ||
| 441 | { | ||
| 442 | return f6i->fib6_nh.fib_nh_dev; | ||
| 443 | } | ||
| 444 | |||
| 445 | int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh, | 446 | int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh, |
| 446 | struct fib6_config *cfg, gfp_t gfp_flags, | 447 | struct fib6_config *cfg, gfp_t gfp_flags, |
| 447 | struct netlink_ext_ack *extack); | 448 | struct netlink_ext_ack *extack); |
| 448 | void fib6_nh_release(struct fib6_nh *fib6_nh); | 449 | void fib6_nh_release(struct fib6_nh *fib6_nh); |
| 449 | 450 | ||
| 451 | int call_fib6_entry_notifiers(struct net *net, | ||
| 452 | enum fib_event_type event_type, | ||
| 453 | struct fib6_info *rt, | ||
| 454 | struct netlink_ext_ack *extack); | ||
| 455 | int call_fib6_multipath_entry_notifiers(struct net *net, | ||
| 456 | enum fib_event_type event_type, | ||
| 457 | struct fib6_info *rt, | ||
| 458 | unsigned int nsiblings, | ||
| 459 | struct netlink_ext_ack *extack); | ||
| 460 | void fib6_rt_update(struct net *net, struct fib6_info *rt, | ||
| 461 | struct nl_info *info); | ||
| 450 | void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info, | 462 | void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info, |
| 451 | unsigned int flags); | 463 | unsigned int flags); |
| 452 | 464 | ||
| @@ -480,6 +492,7 @@ int fib6_tables_dump(struct net *net, struct notifier_block *nb); | |||
| 480 | 492 | ||
| 481 | void fib6_update_sernum(struct net *net, struct fib6_info *rt); | 493 | void fib6_update_sernum(struct net *net, struct fib6_info *rt); |
| 482 | void fib6_update_sernum_upto_root(struct net *net, struct fib6_info *rt); | 494 | void fib6_update_sernum_upto_root(struct net *net, struct fib6_info *rt); |
| 495 | void fib6_update_sernum_stub(struct net *net, struct fib6_info *f6i); | ||
| 483 | 496 | ||
| 484 | void fib6_metric_set(struct fib6_info *f6i, int metric, u32 val); | 497 | void fib6_metric_set(struct fib6_info *f6i, int metric, u32 val); |
| 485 | static inline bool fib6_metric_locked(struct fib6_info *f6i, int metric) | 498 | static inline bool fib6_metric_locked(struct fib6_info *f6i, int metric) |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index ee7405e759ba..b69c16cbbf71 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
| @@ -27,6 +27,7 @@ struct route_info { | |||
| 27 | #include <linux/ip.h> | 27 | #include <linux/ip.h> |
| 28 | #include <linux/ipv6.h> | 28 | #include <linux/ipv6.h> |
| 29 | #include <linux/route.h> | 29 | #include <linux/route.h> |
| 30 | #include <net/nexthop.h> | ||
| 30 | 31 | ||
| 31 | #define RT6_LOOKUP_F_IFACE 0x00000001 | 32 | #define RT6_LOOKUP_F_IFACE 0x00000001 |
| 32 | #define RT6_LOOKUP_F_REACHABLE 0x00000002 | 33 | #define RT6_LOOKUP_F_REACHABLE 0x00000002 |
| @@ -35,6 +36,7 @@ struct route_info { | |||
| 35 | #define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 | 36 | #define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 |
| 36 | #define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 | 37 | #define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 |
| 37 | #define RT6_LOOKUP_F_IGNORE_LINKSTATE 0x00000040 | 38 | #define RT6_LOOKUP_F_IGNORE_LINKSTATE 0x00000040 |
| 39 | #define RT6_LOOKUP_F_DST_NOREF 0x00000080 | ||
| 38 | 40 | ||
| 39 | /* We do not (yet ?) support IPv6 jumbograms (RFC 2675) | 41 | /* We do not (yet ?) support IPv6 jumbograms (RFC 2675) |
| 40 | * Unlike IPv4, hdr->seg_len doesn't include the IPv6 header | 42 | * Unlike IPv4, hdr->seg_len doesn't include the IPv6 header |
| @@ -66,11 +68,14 @@ static inline bool rt6_need_strict(const struct in6_addr *daddr) | |||
| 66 | (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK); | 68 | (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK); |
| 67 | } | 69 | } |
| 68 | 70 | ||
| 71 | /* fib entries using a nexthop object can not be coalesced into | ||
| 72 | * a multipath route | ||
| 73 | */ | ||
| 69 | static inline bool rt6_qualify_for_ecmp(const struct fib6_info *f6i) | 74 | static inline bool rt6_qualify_for_ecmp(const struct fib6_info *f6i) |
| 70 | { | 75 | { |
| 71 | /* the RTF_ADDRCONF flag filters out RA's */ | 76 | /* the RTF_ADDRCONF flag filters out RA's */ |
| 72 | return !(f6i->fib6_flags & RTF_ADDRCONF) && | 77 | return !(f6i->fib6_flags & RTF_ADDRCONF) && !f6i->nh && |
| 73 | f6i->fib6_nh.fib_nh_gw_family; | 78 | f6i->fib6_nh->fib_nh_gw_family; |
| 74 | } | 79 | } |
| 75 | 80 | ||
| 76 | void ip6_route_input(struct sk_buff *skb); | 81 | void ip6_route_input(struct sk_buff *skb); |
| @@ -79,6 +84,10 @@ struct dst_entry *ip6_route_input_lookup(struct net *net, | |||
| 79 | struct flowi6 *fl6, | 84 | struct flowi6 *fl6, |
| 80 | const struct sk_buff *skb, int flags); | 85 | const struct sk_buff *skb, int flags); |
| 81 | 86 | ||
| 87 | struct dst_entry *ip6_route_output_flags_noref(struct net *net, | ||
| 88 | const struct sock *sk, | ||
| 89 | struct flowi6 *fl6, int flags); | ||
| 90 | |||
| 82 | struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk, | 91 | struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk, |
| 83 | struct flowi6 *fl6, int flags); | 92 | struct flowi6 *fl6, int flags); |
| 84 | 93 | ||
| @@ -89,6 +98,16 @@ static inline struct dst_entry *ip6_route_output(struct net *net, | |||
| 89 | return ip6_route_output_flags(net, sk, fl6, 0); | 98 | return ip6_route_output_flags(net, sk, fl6, 0); |
| 90 | } | 99 | } |
| 91 | 100 | ||
| 101 | /* Only conditionally release dst if flags indicates | ||
| 102 | * !RT6_LOOKUP_F_DST_NOREF or dst is in uncached_list. | ||
| 103 | */ | ||
| 104 | static inline void ip6_rt_put_flags(struct rt6_info *rt, int flags) | ||
| 105 | { | ||
| 106 | if (!(flags & RT6_LOOKUP_F_DST_NOREF) || | ||
| 107 | !list_empty(&rt->rt6i_uncached)) | ||
| 108 | ip6_rt_put(rt); | ||
| 109 | } | ||
| 110 | |||
| 92 | struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6, | 111 | struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6, |
| 93 | const struct sk_buff *skb, int flags); | 112 | const struct sk_buff *skb, int flags); |
| 94 | struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, | 113 | struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, |
| @@ -178,7 +197,7 @@ struct rt6_rtnl_dump_arg { | |||
| 178 | struct fib_dump_filter filter; | 197 | struct fib_dump_filter filter; |
| 179 | }; | 198 | }; |
| 180 | 199 | ||
| 181 | int rt6_dump_route(struct fib6_info *f6i, void *p_arg); | 200 | int rt6_dump_route(struct fib6_info *f6i, void *p_arg, unsigned int skip); |
| 182 | void rt6_mtu_change(struct net_device *dev, unsigned int mtu); | 201 | void rt6_mtu_change(struct net_device *dev, unsigned int mtu); |
| 183 | void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); | 202 | void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); |
| 184 | void rt6_clean_tohost(struct net *net, struct in6_addr *gateway); | 203 | void rt6_clean_tohost(struct net *net, struct in6_addr *gateway); |
| @@ -275,8 +294,13 @@ static inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt, | |||
| 275 | 294 | ||
| 276 | static inline bool rt6_duplicate_nexthop(struct fib6_info *a, struct fib6_info *b) | 295 | static inline bool rt6_duplicate_nexthop(struct fib6_info *a, struct fib6_info *b) |
| 277 | { | 296 | { |
| 278 | struct fib6_nh *nha = &a->fib6_nh, *nhb = &b->fib6_nh; | 297 | struct fib6_nh *nha, *nhb; |
| 298 | |||
| 299 | if (a->nh || b->nh) | ||
| 300 | return nexthop_cmp(a->nh, b->nh); | ||
| 279 | 301 | ||
| 302 | nha = a->fib6_nh; | ||
| 303 | nhb = b->fib6_nh; | ||
| 280 | return nha->fib_nh_dev == nhb->fib_nh_dev && | 304 | return nha->fib_nh_dev == nhb->fib_nh_dev && |
| 281 | ipv6_addr_equal(&nha->fib_nh_gw6, &nhb->fib_nh_gw6) && | 305 | ipv6_addr_equal(&nha->fib_nh_gw6, &nhb->fib_nh_gw6) && |
| 282 | !lwtunnel_cmp_encap(nha->fib_nh_lws, nhb->fib_nh_lws); | 306 | !lwtunnel_cmp_encap(nha->fib_nh_lws, nhb->fib_nh_lws); |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index bbeff32fb6cb..4c81846ccce8 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
| @@ -40,6 +40,7 @@ struct fib_config { | |||
| 40 | u32 fc_flags; | 40 | u32 fc_flags; |
| 41 | u32 fc_priority; | 41 | u32 fc_priority; |
| 42 | __be32 fc_prefsrc; | 42 | __be32 fc_prefsrc; |
| 43 | u32 fc_nh_id; | ||
| 43 | struct nlattr *fc_mx; | 44 | struct nlattr *fc_mx; |
| 44 | struct rtnexthop *fc_mp; | 45 | struct rtnexthop *fc_mp; |
| 45 | int fc_mx_len; | 46 | int fc_mx_len; |
| @@ -125,9 +126,12 @@ struct fib_nh { | |||
| 125 | * This structure contains data shared by many of routes. | 126 | * This structure contains data shared by many of routes. |
| 126 | */ | 127 | */ |
| 127 | 128 | ||
| 129 | struct nexthop; | ||
| 130 | |||
| 128 | struct fib_info { | 131 | struct fib_info { |
| 129 | struct hlist_node fib_hash; | 132 | struct hlist_node fib_hash; |
| 130 | struct hlist_node fib_lhash; | 133 | struct hlist_node fib_lhash; |
| 134 | struct list_head nh_list; | ||
| 131 | struct net *fib_net; | 135 | struct net *fib_net; |
| 132 | int fib_treeref; | 136 | int fib_treeref; |
| 133 | refcount_t fib_clntref; | 137 | refcount_t fib_clntref; |
| @@ -146,9 +150,10 @@ struct fib_info { | |||
| 146 | #define fib_advmss fib_metrics->metrics[RTAX_ADVMSS-1] | 150 | #define fib_advmss fib_metrics->metrics[RTAX_ADVMSS-1] |
| 147 | int fib_nhs; | 151 | int fib_nhs; |
| 148 | bool fib_nh_is_v6; | 152 | bool fib_nh_is_v6; |
| 153 | bool nh_updated; | ||
| 154 | struct nexthop *nh; | ||
| 149 | struct rcu_head rcu; | 155 | struct rcu_head rcu; |
| 150 | struct fib_nh fib_nh[0]; | 156 | struct fib_nh fib_nh[0]; |
| 151 | #define fib_dev fib_nh[0].fib_nh_dev | ||
| 152 | }; | 157 | }; |
| 153 | 158 | ||
| 154 | 159 | ||
| @@ -185,18 +190,14 @@ struct fib_result_nl { | |||
| 185 | int err; | 190 | int err; |
| 186 | }; | 191 | }; |
| 187 | 192 | ||
| 188 | static inline struct fib_nh_common *fib_info_nhc(struct fib_info *fi, int nhsel) | ||
| 189 | { | ||
| 190 | return &fi->fib_nh[nhsel].nh_common; | ||
| 191 | } | ||
| 192 | |||
| 193 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 193 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
| 194 | #define FIB_TABLE_HASHSZ 256 | 194 | #define FIB_TABLE_HASHSZ 256 |
| 195 | #else | 195 | #else |
| 196 | #define FIB_TABLE_HASHSZ 2 | 196 | #define FIB_TABLE_HASHSZ 2 |
| 197 | #endif | 197 | #endif |
| 198 | 198 | ||
| 199 | __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); | 199 | __be32 fib_info_update_nhc_saddr(struct net *net, struct fib_nh_common *nhc, |
| 200 | unsigned char scope); | ||
| 200 | __be32 fib_result_prefsrc(struct net *net, struct fib_result *res); | 201 | __be32 fib_result_prefsrc(struct net *net, struct fib_result *res); |
| 201 | 202 | ||
| 202 | #define FIB_RES_NHC(res) ((res).nhc) | 203 | #define FIB_RES_NHC(res) ((res).nhc) |
| @@ -227,6 +228,7 @@ int call_fib4_notifiers(struct net *net, enum fib_event_type event_type, | |||
| 227 | int __net_init fib4_notifier_init(struct net *net); | 228 | int __net_init fib4_notifier_init(struct net *net); |
| 228 | void __net_exit fib4_notifier_exit(struct net *net); | 229 | void __net_exit fib4_notifier_exit(struct net *net); |
| 229 | 230 | ||
| 231 | void fib_info_notify_update(struct net *net, struct nl_info *info); | ||
| 230 | void fib_notify(struct net *net, struct notifier_block *nb); | 232 | void fib_notify(struct net *net, struct notifier_block *nb); |
| 231 | 233 | ||
| 232 | struct fib_table { | 234 | struct fib_table { |
| @@ -243,6 +245,8 @@ struct fib_dump_filter { | |||
| 243 | /* filter_set is an optimization that an entry is set */ | 245 | /* filter_set is an optimization that an entry is set */ |
| 244 | bool filter_set; | 246 | bool filter_set; |
| 245 | bool dump_all_families; | 247 | bool dump_all_families; |
| 248 | bool dump_routes; | ||
| 249 | bool dump_exceptions; | ||
| 246 | unsigned char protocol; | 250 | unsigned char protocol; |
| 247 | unsigned char rt_type; | 251 | unsigned char rt_type; |
| 248 | unsigned int flags; | 252 | unsigned int flags; |
| @@ -425,11 +429,14 @@ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); | |||
| 425 | int fib_sync_down_addr(struct net_device *dev, __be32 local); | 429 | int fib_sync_down_addr(struct net_device *dev, __be32 local); |
| 426 | int fib_sync_up(struct net_device *dev, unsigned char nh_flags); | 430 | int fib_sync_up(struct net_device *dev, unsigned char nh_flags); |
| 427 | void fib_sync_mtu(struct net_device *dev, u32 orig_mtu); | 431 | void fib_sync_mtu(struct net_device *dev, u32 orig_mtu); |
| 432 | void fib_nhc_update_mtu(struct fib_nh_common *nhc, u32 new, u32 orig); | ||
| 428 | 433 | ||
| 429 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 434 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
| 430 | int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4, | 435 | int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4, |
| 431 | const struct sk_buff *skb, struct flow_keys *flkeys); | 436 | const struct sk_buff *skb, struct flow_keys *flkeys); |
| 432 | #endif | 437 | #endif |
| 438 | int fib_check_nh(struct net *net, struct fib_nh *nh, u32 table, u8 scope, | ||
| 439 | struct netlink_ext_ack *extack); | ||
| 433 | void fib_select_multipath(struct fib_result *res, int hash); | 440 | void fib_select_multipath(struct fib_result *res, int hash); |
| 434 | void fib_select_path(struct net *net, struct fib_result *res, | 441 | void fib_select_path(struct net *net, struct fib_result *res, |
| 435 | struct flowi4 *fl4, const struct sk_buff *skb); | 442 | struct flowi4 *fl4, const struct sk_buff *skb); |
| @@ -451,11 +458,18 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res) | |||
| 451 | { | 458 | { |
| 452 | #ifdef CONFIG_IP_ROUTE_CLASSID | 459 | #ifdef CONFIG_IP_ROUTE_CLASSID |
| 453 | struct fib_nh_common *nhc = res->nhc; | 460 | struct fib_nh_common *nhc = res->nhc; |
| 454 | struct fib_nh *nh = container_of(nhc, struct fib_nh, nh_common); | ||
| 455 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 461 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
| 456 | u32 rtag; | 462 | u32 rtag; |
| 457 | #endif | 463 | #endif |
| 458 | *itag = nh->nh_tclassid << 16; | 464 | if (nhc->nhc_family == AF_INET) { |
| 465 | struct fib_nh *nh; | ||
| 466 | |||
| 467 | nh = container_of(nhc, struct fib_nh, nh_common); | ||
| 468 | *itag = nh->nh_tclassid << 16; | ||
| 469 | } else { | ||
| 470 | *itag = 0; | ||
| 471 | } | ||
| 472 | |||
| 459 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 473 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
| 460 | rtag = res->tclassid; | 474 | rtag = res->tclassid; |
| 461 | if (*itag == 0) | 475 | if (*itag == 0) |
| @@ -465,6 +479,7 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res) | |||
| 465 | #endif | 479 | #endif |
| 466 | } | 480 | } |
| 467 | 481 | ||
| 482 | void fib_flush(struct net *net); | ||
| 468 | void free_fib_info(struct fib_info *fi); | 483 | void free_fib_info(struct fib_info *fi); |
| 469 | 484 | ||
| 470 | static inline void fib_info_hold(struct fib_info *fi) | 485 | static inline void fib_info_hold(struct fib_info *fi) |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 2ac40135b576..3759167f91f5 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -603,6 +603,7 @@ struct ip_vs_dest_user_kern { | |||
| 603 | 603 | ||
| 604 | u16 tun_type; /* tunnel type */ | 604 | u16 tun_type; /* tunnel type */ |
| 605 | __be16 tun_port; /* tunnel port */ | 605 | __be16 tun_port; /* tunnel port */ |
| 606 | u16 tun_flags; /* tunnel flags */ | ||
| 606 | }; | 607 | }; |
| 607 | 608 | ||
| 608 | 609 | ||
| @@ -665,6 +666,7 @@ struct ip_vs_dest { | |||
| 665 | atomic_t last_weight; /* server latest weight */ | 666 | atomic_t last_weight; /* server latest weight */ |
| 666 | __u16 tun_type; /* tunnel type */ | 667 | __u16 tun_type; /* tunnel type */ |
| 667 | __be16 tun_port; /* tunnel port */ | 668 | __be16 tun_port; /* tunnel port */ |
| 669 | __u16 tun_flags; /* tunnel flags */ | ||
| 668 | 670 | ||
| 669 | refcount_t refcnt; /* reference counter */ | 671 | refcount_t refcnt; /* reference counter */ |
| 670 | struct ip_vs_stats stats; /* statistics */ | 672 | struct ip_vs_stats stats; /* statistics */ |
| @@ -808,11 +810,12 @@ struct ipvs_master_sync_state { | |||
| 808 | struct ip_vs_sync_buff *sync_buff; | 810 | struct ip_vs_sync_buff *sync_buff; |
| 809 | unsigned long sync_queue_len; | 811 | unsigned long sync_queue_len; |
| 810 | unsigned int sync_queue_delay; | 812 | unsigned int sync_queue_delay; |
| 811 | struct task_struct *master_thread; | ||
| 812 | struct delayed_work master_wakeup_work; | 813 | struct delayed_work master_wakeup_work; |
| 813 | struct netns_ipvs *ipvs; | 814 | struct netns_ipvs *ipvs; |
| 814 | }; | 815 | }; |
| 815 | 816 | ||
| 817 | struct ip_vs_sync_thread_data; | ||
| 818 | |||
| 816 | /* How much time to keep dests in trash */ | 819 | /* How much time to keep dests in trash */ |
| 817 | #define IP_VS_DEST_TRASH_PERIOD (120 * HZ) | 820 | #define IP_VS_DEST_TRASH_PERIOD (120 * HZ) |
| 818 | 821 | ||
| @@ -943,7 +946,8 @@ struct netns_ipvs { | |||
| 943 | spinlock_t sync_lock; | 946 | spinlock_t sync_lock; |
| 944 | struct ipvs_master_sync_state *ms; | 947 | struct ipvs_master_sync_state *ms; |
| 945 | spinlock_t sync_buff_lock; | 948 | spinlock_t sync_buff_lock; |
| 946 | struct task_struct **backup_threads; | 949 | struct ip_vs_sync_thread_data *master_tinfo; |
| 950 | struct ip_vs_sync_thread_data *backup_tinfo; | ||
| 947 | int threads_mask; | 951 | int threads_mask; |
| 948 | volatile int sync_state; | 952 | volatile int sync_state; |
| 949 | struct mutex sync_mutex; | 953 | struct mutex sync_mutex; |
| @@ -1404,6 +1408,9 @@ bool ip_vs_has_real_service(struct netns_ipvs *ipvs, int af, __u16 protocol, | |||
| 1404 | struct ip_vs_dest * | 1408 | struct ip_vs_dest * |
| 1405 | ip_vs_find_real_service(struct netns_ipvs *ipvs, int af, __u16 protocol, | 1409 | ip_vs_find_real_service(struct netns_ipvs *ipvs, int af, __u16 protocol, |
| 1406 | const union nf_inet_addr *daddr, __be16 dport); | 1410 | const union nf_inet_addr *daddr, __be16 dport); |
| 1411 | struct ip_vs_dest *ip_vs_find_tunnel(struct netns_ipvs *ipvs, int af, | ||
| 1412 | const union nf_inet_addr *daddr, | ||
| 1413 | __be16 tun_port); | ||
| 1407 | 1414 | ||
| 1408 | int ip_vs_use_count_inc(void); | 1415 | int ip_vs_use_count_inc(void); |
| 1409 | void ip_vs_use_count_dec(void); | 1416 | void ip_vs_use_count_dec(void); |
| @@ -1497,6 +1504,9 @@ static inline int ip_vs_todrop(struct netns_ipvs *ipvs) | |||
| 1497 | static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; } | 1504 | static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; } |
| 1498 | #endif | 1505 | #endif |
| 1499 | 1506 | ||
| 1507 | #define IP_VS_DFWD_METHOD(dest) (atomic_read(&(dest)->conn_flags) & \ | ||
| 1508 | IP_VS_CONN_F_FWD_MASK) | ||
| 1509 | |||
| 1500 | /* ip_vs_fwd_tag returns the forwarding tag of the connection */ | 1510 | /* ip_vs_fwd_tag returns the forwarding tag of the connection */ |
| 1501 | #define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK) | 1511 | #define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK) |
| 1502 | 1512 | ||
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 60d9480bc4d1..8dfc65639aa4 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/hardirq.h> | 13 | #include <linux/hardirq.h> |
| 14 | #include <linux/jhash.h> | 14 | #include <linux/jhash.h> |
| 15 | #include <linux/refcount.h> | 15 | #include <linux/refcount.h> |
| 16 | #include <linux/jump_label_ratelimit.h> | ||
| 16 | #include <net/if_inet6.h> | 17 | #include <net/if_inet6.h> |
| 17 | #include <net/ndisc.h> | 18 | #include <net/ndisc.h> |
| 18 | #include <net/flow.h> | 19 | #include <net/flow.h> |
| @@ -150,6 +151,49 @@ struct frag_hdr { | |||
| 150 | #define IP6_MF 0x0001 | 151 | #define IP6_MF 0x0001 |
| 151 | #define IP6_OFFSET 0xFFF8 | 152 | #define IP6_OFFSET 0xFFF8 |
| 152 | 153 | ||
| 154 | struct ip6_fraglist_iter { | ||
| 155 | struct ipv6hdr *tmp_hdr; | ||
| 156 | struct sk_buff *frag; | ||
| 157 | int offset; | ||
| 158 | unsigned int hlen; | ||
| 159 | __be32 frag_id; | ||
| 160 | u8 nexthdr; | ||
| 161 | }; | ||
| 162 | |||
| 163 | int ip6_fraglist_init(struct sk_buff *skb, unsigned int hlen, u8 *prevhdr, | ||
| 164 | u8 nexthdr, __be32 frag_id, | ||
| 165 | struct ip6_fraglist_iter *iter); | ||
| 166 | void ip6_fraglist_prepare(struct sk_buff *skb, struct ip6_fraglist_iter *iter); | ||
| 167 | |||
| 168 | static inline struct sk_buff *ip6_fraglist_next(struct ip6_fraglist_iter *iter) | ||
| 169 | { | ||
| 170 | struct sk_buff *skb = iter->frag; | ||
| 171 | |||
| 172 | iter->frag = skb->next; | ||
| 173 | skb_mark_not_on_list(skb); | ||
| 174 | |||
| 175 | return skb; | ||
| 176 | } | ||
| 177 | |||
| 178 | struct ip6_frag_state { | ||
| 179 | u8 *prevhdr; | ||
| 180 | unsigned int hlen; | ||
| 181 | unsigned int mtu; | ||
| 182 | unsigned int left; | ||
| 183 | int offset; | ||
| 184 | int ptr; | ||
| 185 | int hroom; | ||
| 186 | int troom; | ||
| 187 | __be32 frag_id; | ||
| 188 | u8 nexthdr; | ||
| 189 | }; | ||
| 190 | |||
| 191 | void ip6_frag_init(struct sk_buff *skb, unsigned int hlen, unsigned int mtu, | ||
| 192 | unsigned short needed_tailroom, int hdr_room, u8 *prevhdr, | ||
| 193 | u8 nexthdr, __be32 frag_id, struct ip6_frag_state *state); | ||
| 194 | struct sk_buff *ip6_frag_next(struct sk_buff *skb, | ||
| 195 | struct ip6_frag_state *state); | ||
| 196 | |||
| 153 | #define IP6_REPLY_MARK(net, mark) \ | 197 | #define IP6_REPLY_MARK(net, mark) \ |
| 154 | ((net)->ipv6.sysctl.fwmark_reflect ? (mark) : 0) | 198 | ((net)->ipv6.sysctl.fwmark_reflect ? (mark) : 0) |
| 155 | 199 | ||
| @@ -258,6 +302,13 @@ struct ipv6_txoptions { | |||
| 258 | /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ | 302 | /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ |
| 259 | }; | 303 | }; |
| 260 | 304 | ||
| 305 | /* flowlabel_reflect sysctl values */ | ||
| 306 | enum flowlabel_reflect { | ||
| 307 | FLOWLABEL_REFLECT_ESTABLISHED = 1, | ||
| 308 | FLOWLABEL_REFLECT_TCP_RESET = 2, | ||
| 309 | FLOWLABEL_REFLECT_ICMPV6_ECHO_REPLIES = 4, | ||
| 310 | }; | ||
| 311 | |||
| 261 | struct ip6_flowlabel { | 312 | struct ip6_flowlabel { |
| 262 | struct ip6_flowlabel __rcu *next; | 313 | struct ip6_flowlabel __rcu *next; |
| 263 | __be32 label; | 314 | __be32 label; |
| @@ -339,7 +390,18 @@ static inline void txopt_put(struct ipv6_txoptions *opt) | |||
| 339 | kfree_rcu(opt, rcu); | 390 | kfree_rcu(opt, rcu); |
| 340 | } | 391 | } |
| 341 | 392 | ||
| 342 | struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); | 393 | struct ip6_flowlabel *__fl6_sock_lookup(struct sock *sk, __be32 label); |
| 394 | |||
| 395 | extern struct static_key_false_deferred ipv6_flowlabel_exclusive; | ||
| 396 | static inline struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, | ||
| 397 | __be32 label) | ||
| 398 | { | ||
| 399 | if (static_branch_unlikely(&ipv6_flowlabel_exclusive.key)) | ||
| 400 | return __fl6_sock_lookup(sk, label) ? : ERR_PTR(-ENOENT); | ||
| 401 | |||
| 402 | return NULL; | ||
| 403 | } | ||
| 404 | |||
| 343 | struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space, | 405 | struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space, |
| 344 | struct ip6_flowlabel *fl, | 406 | struct ip6_flowlabel *fl, |
| 345 | struct ipv6_txoptions *fopt); | 407 | struct ipv6_txoptions *fopt); |
diff --git a/include/net/ipv6_frag.h b/include/net/ipv6_frag.h index 1f77fb4dc79d..a21e8b1381a1 100644 --- a/include/net/ipv6_frag.h +++ b/include/net/ipv6_frag.h | |||
| @@ -67,6 +67,8 @@ ip6frag_expire_frag_queue(struct net *net, struct frag_queue *fq) | |||
| 67 | struct sk_buff *head; | 67 | struct sk_buff *head; |
| 68 | 68 | ||
| 69 | rcu_read_lock(); | 69 | rcu_read_lock(); |
| 70 | if (fq->q.fqdir->dead) | ||
| 71 | goto out_rcu_unlock; | ||
| 70 | spin_lock(&fq->q.lock); | 72 | spin_lock(&fq->q.lock); |
| 71 | 73 | ||
| 72 | if (fq->q.flags & INET_FRAG_COMPLETE) | 74 | if (fq->q.flags & INET_FRAG_COMPLETE) |
diff --git a/include/net/ipv6_stubs.h b/include/net/ipv6_stubs.h index 6c0c4fde16f8..5c93e942c50b 100644 --- a/include/net/ipv6_stubs.h +++ b/include/net/ipv6_stubs.h | |||
| @@ -45,6 +45,11 @@ struct ipv6_stub { | |||
| 45 | struct fib6_config *cfg, gfp_t gfp_flags, | 45 | struct fib6_config *cfg, gfp_t gfp_flags, |
| 46 | struct netlink_ext_ack *extack); | 46 | struct netlink_ext_ack *extack); |
| 47 | void (*fib6_nh_release)(struct fib6_nh *fib6_nh); | 47 | void (*fib6_nh_release)(struct fib6_nh *fib6_nh); |
| 48 | void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt); | ||
| 49 | int (*ip6_del_rt)(struct net *net, struct fib6_info *rt); | ||
| 50 | void (*fib6_rt_update)(struct net *net, struct fib6_info *rt, | ||
| 51 | struct nl_info *info); | ||
| 52 | |||
| 48 | void (*udpv6_encap_enable)(void); | 53 | void (*udpv6_encap_enable)(void); |
| 49 | void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr, | 54 | void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr, |
| 50 | const struct in6_addr *solicited_addr, | 55 | const struct in6_addr *solicited_addr, |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 456f2edf78dc..d26da013f7c0 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -314,6 +314,7 @@ struct ieee80211_vif_chanctx_switch { | |||
| 314 | * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface | 314 | * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface |
| 315 | * @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder | 315 | * @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder |
| 316 | * functionality changed for this BSS (AP mode). | 316 | * functionality changed for this BSS (AP mode). |
| 317 | * @BSS_CHANGED_TWT: TWT status changed | ||
| 317 | * | 318 | * |
| 318 | */ | 319 | */ |
| 319 | enum ieee80211_bss_change { | 320 | enum ieee80211_bss_change { |
| @@ -344,6 +345,7 @@ enum ieee80211_bss_change { | |||
| 344 | BSS_CHANGED_KEEP_ALIVE = 1<<24, | 345 | BSS_CHANGED_KEEP_ALIVE = 1<<24, |
| 345 | BSS_CHANGED_MCAST_RATE = 1<<25, | 346 | BSS_CHANGED_MCAST_RATE = 1<<25, |
| 346 | BSS_CHANGED_FTM_RESPONDER = 1<<26, | 347 | BSS_CHANGED_FTM_RESPONDER = 1<<26, |
| 348 | BSS_CHANGED_TWT = 1<<27, | ||
| 347 | 349 | ||
| 348 | /* when adding here, make sure to change ieee80211_reconfig */ | 350 | /* when adding here, make sure to change ieee80211_reconfig */ |
| 349 | }; | 351 | }; |
| @@ -501,6 +503,8 @@ struct ieee80211_ftm_responder_params { | |||
| 501 | * @he_support: does this BSS support HE | 503 | * @he_support: does this BSS support HE |
| 502 | * @twt_requester: does this BSS support TWT requester (relevant for managed | 504 | * @twt_requester: does this BSS support TWT requester (relevant for managed |
| 503 | * mode only, set if the AP advertises TWT responder role) | 505 | * mode only, set if the AP advertises TWT responder role) |
| 506 | * @twt_responder: does this BSS support TWT requester (relevant for managed | ||
| 507 | * mode only, set if the AP advertises TWT responder role) | ||
| 504 | * @assoc: association status | 508 | * @assoc: association status |
| 505 | * @ibss_joined: indicates whether this station is part of an IBSS | 509 | * @ibss_joined: indicates whether this station is part of an IBSS |
| 506 | * or not | 510 | * or not |
| @@ -608,6 +612,7 @@ struct ieee80211_bss_conf { | |||
| 608 | u16 frame_time_rts_th; | 612 | u16 frame_time_rts_th; |
| 609 | bool he_support; | 613 | bool he_support; |
| 610 | bool twt_requester; | 614 | bool twt_requester; |
| 615 | bool twt_responder; | ||
| 611 | /* association related data */ | 616 | /* association related data */ |
| 612 | bool assoc, ibss_joined; | 617 | bool assoc, ibss_joined; |
| 613 | bool ibss_creator; | 618 | bool ibss_creator; |
| @@ -2266,6 +2271,9 @@ struct ieee80211_txq { | |||
| 2266 | * @IEEE80211_HW_EXT_KEY_ID_NATIVE: Driver and hardware are supporting Extended | 2271 | * @IEEE80211_HW_EXT_KEY_ID_NATIVE: Driver and hardware are supporting Extended |
| 2267 | * Key ID and can handle two unicast keys per station for Rx and Tx. | 2272 | * Key ID and can handle two unicast keys per station for Rx and Tx. |
| 2268 | * | 2273 | * |
| 2274 | * @IEEE80211_HW_NO_AMPDU_KEYBORDER_SUPPORT: The card/driver can't handle | ||
| 2275 | * active Tx A-MPDU sessions with Extended Key IDs during rekey. | ||
| 2276 | * | ||
| 2269 | * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays | 2277 | * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays |
| 2270 | */ | 2278 | */ |
| 2271 | enum ieee80211_hw_flags { | 2279 | enum ieee80211_hw_flags { |
| @@ -2318,6 +2326,7 @@ enum ieee80211_hw_flags { | |||
| 2318 | IEEE80211_HW_SUPPORTS_MULTI_BSSID, | 2326 | IEEE80211_HW_SUPPORTS_MULTI_BSSID, |
| 2319 | IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, | 2327 | IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, |
| 2320 | IEEE80211_HW_EXT_KEY_ID_NATIVE, | 2328 | IEEE80211_HW_EXT_KEY_ID_NATIVE, |
| 2329 | IEEE80211_HW_NO_AMPDU_KEYBORDER_SUPPORT, | ||
| 2321 | 2330 | ||
| 2322 | /* keep last, obviously */ | 2331 | /* keep last, obviously */ |
| 2323 | NUM_IEEE80211_HW_FLAGS | 2332 | NUM_IEEE80211_HW_FLAGS |
| @@ -5948,29 +5957,6 @@ static inline int rate_supported(struct ieee80211_sta *sta, | |||
| 5948 | return (sta == NULL || sta->supp_rates[band] & BIT(index)); | 5957 | return (sta == NULL || sta->supp_rates[band] & BIT(index)); |
| 5949 | } | 5958 | } |
| 5950 | 5959 | ||
| 5951 | /** | ||
| 5952 | * rate_control_send_low - helper for drivers for management/no-ack frames | ||
| 5953 | * | ||
| 5954 | * Rate control algorithms that agree to use the lowest rate to | ||
| 5955 | * send management frames and NO_ACK data with the respective hw | ||
| 5956 | * retries should use this in the beginning of their mac80211 get_rate | ||
| 5957 | * callback. If true is returned the rate control can simply return. | ||
| 5958 | * If false is returned we guarantee that sta and sta and priv_sta is | ||
| 5959 | * not null. | ||
| 5960 | * | ||
| 5961 | * Rate control algorithms wishing to do more intelligent selection of | ||
| 5962 | * rate for multicast/broadcast frames may choose to not use this. | ||
| 5963 | * | ||
| 5964 | * @sta: &struct ieee80211_sta pointer to the target destination. Note | ||
| 5965 | * that this may be null. | ||
| 5966 | * @priv_sta: private rate control structure. This may be null. | ||
| 5967 | * @txrc: rate control information we sholud populate for mac80211. | ||
| 5968 | */ | ||
| 5969 | bool rate_control_send_low(struct ieee80211_sta *sta, | ||
| 5970 | void *priv_sta, | ||
| 5971 | struct ieee80211_tx_rate_control *txrc); | ||
| 5972 | |||
| 5973 | |||
| 5974 | static inline s8 | 5960 | static inline s8 |
| 5975 | rate_lowest_index(struct ieee80211_supported_band *sband, | 5961 | rate_lowest_index(struct ieee80211_supported_band *sband, |
| 5976 | struct ieee80211_sta *sta) | 5962 | struct ieee80211_sta *sta) |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 12689ddfc24c..4a9da951a794 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <net/netns/packet.h> | 19 | #include <net/netns/packet.h> |
| 20 | #include <net/netns/ipv4.h> | 20 | #include <net/netns/ipv4.h> |
| 21 | #include <net/netns/ipv6.h> | 21 | #include <net/netns/ipv6.h> |
| 22 | #include <net/netns/nexthop.h> | ||
| 22 | #include <net/netns/ieee802154_6lowpan.h> | 23 | #include <net/netns/ieee802154_6lowpan.h> |
| 23 | #include <net/netns/sctp.h> | 24 | #include <net/netns/sctp.h> |
| 24 | #include <net/netns/dccp.h> | 25 | #include <net/netns/dccp.h> |
| @@ -71,6 +72,9 @@ struct net { | |||
| 71 | */ | 72 | */ |
| 72 | struct llist_node cleanup_list; /* namespaces on death row */ | 73 | struct llist_node cleanup_list; /* namespaces on death row */ |
| 73 | 74 | ||
| 75 | #ifdef CONFIG_KEYS | ||
| 76 | struct key_tag *key_domain; /* Key domain of operation tag */ | ||
| 77 | #endif | ||
| 74 | struct user_namespace *user_ns; /* Owning user namespace */ | 78 | struct user_namespace *user_ns; /* Owning user namespace */ |
| 75 | struct ucounts *ucounts; | 79 | struct ucounts *ucounts; |
| 76 | spinlock_t nsid_lock; | 80 | spinlock_t nsid_lock; |
| @@ -108,6 +112,7 @@ struct net { | |||
| 108 | struct netns_mib mib; | 112 | struct netns_mib mib; |
| 109 | struct netns_packet packet; | 113 | struct netns_packet packet; |
| 110 | struct netns_unix unx; | 114 | struct netns_unix unx; |
| 115 | struct netns_nexthop nexthop; | ||
| 111 | struct netns_ipv4 ipv4; | 116 | struct netns_ipv4 ipv4; |
| 112 | #if IS_ENABLED(CONFIG_IPV6) | 117 | #if IS_ENABLED(CONFIG_IPV6) |
| 113 | struct netns_ipv6 ipv6; | 118 | struct netns_ipv6 ipv6; |
| @@ -353,8 +358,13 @@ struct pernet_operations { | |||
| 353 | * synchronize_rcu() related to these pernet_operations, | 358 | * synchronize_rcu() related to these pernet_operations, |
| 354 | * instead of separate synchronize_rcu() for every net. | 359 | * instead of separate synchronize_rcu() for every net. |
| 355 | * Please, avoid synchronize_rcu() at all, where it's possible. | 360 | * Please, avoid synchronize_rcu() at all, where it's possible. |
| 361 | * | ||
| 362 | * Note that a combination of pre_exit() and exit() can | ||
| 363 | * be used, since a synchronize_rcu() is guaranteed between | ||
| 364 | * the calls. | ||
| 356 | */ | 365 | */ |
| 357 | int (*init)(struct net *net); | 366 | int (*init)(struct net *net); |
| 367 | void (*pre_exit)(struct net *net); | ||
| 358 | void (*exit)(struct net *net); | 368 | void (*exit)(struct net *net); |
| 359 | void (*exit_batch)(struct list_head *net_exit_list); | 369 | void (*exit_batch)(struct list_head *net_exit_list); |
| 360 | unsigned int *id; | 370 | unsigned int *id; |
diff --git a/include/net/netfilter/br_netfilter.h b/include/net/netfilter/br_netfilter.h index 89808ce293c4..302fcd3aade2 100644 --- a/include/net/netfilter/br_netfilter.h +++ b/include/net/netfilter/br_netfilter.h | |||
| @@ -42,7 +42,8 @@ static inline struct rtable *bridge_parent_rtable(const struct net_device *dev) | |||
| 42 | return port ? &port->br->fake_rtable : NULL; | 42 | return port ? &port->br->fake_rtable : NULL; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | struct net_device *setup_pre_routing(struct sk_buff *skb); | 45 | struct net_device *setup_pre_routing(struct sk_buff *skb, |
| 46 | const struct net *net); | ||
| 46 | 47 | ||
| 47 | #if IS_ENABLED(CONFIG_IPV6) | 48 | #if IS_ENABLED(CONFIG_IPV6) |
| 48 | int br_validate_ipv6(struct net *net, struct sk_buff *skb); | 49 | int br_validate_ipv6(struct net *net, struct sk_buff *skb); |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index d2bc733a2ef1..c86657d99630 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
| @@ -49,6 +49,7 @@ union nf_conntrack_expect_proto { | |||
| 49 | struct nf_conntrack_net { | 49 | struct nf_conntrack_net { |
| 50 | unsigned int users4; | 50 | unsigned int users4; |
| 51 | unsigned int users6; | 51 | unsigned int users6; |
| 52 | unsigned int users_bridge; | ||
| 52 | }; | 53 | }; |
| 53 | 54 | ||
| 54 | #include <linux/types.h> | 55 | #include <linux/types.h> |
| @@ -69,7 +70,8 @@ struct nf_conn { | |||
| 69 | struct nf_conntrack ct_general; | 70 | struct nf_conntrack ct_general; |
| 70 | 71 | ||
| 71 | spinlock_t lock; | 72 | spinlock_t lock; |
| 72 | u16 cpu; | 73 | /* jiffies32 when this ct is considered dead */ |
| 74 | u32 timeout; | ||
| 73 | 75 | ||
| 74 | #ifdef CONFIG_NF_CONNTRACK_ZONES | 76 | #ifdef CONFIG_NF_CONNTRACK_ZONES |
| 75 | struct nf_conntrack_zone zone; | 77 | struct nf_conntrack_zone zone; |
| @@ -81,9 +83,7 @@ struct nf_conn { | |||
| 81 | /* Have we seen traffic both ways yet? (bitset) */ | 83 | /* Have we seen traffic both ways yet? (bitset) */ |
| 82 | unsigned long status; | 84 | unsigned long status; |
| 83 | 85 | ||
| 84 | /* jiffies32 when this ct is considered dead */ | 86 | u16 cpu; |
| 85 | u32 timeout; | ||
| 86 | |||
| 87 | possible_net_t ct_net; | 87 | possible_net_t ct_net; |
| 88 | 88 | ||
| 89 | #if IS_ENABLED(CONFIG_NF_NAT) | 89 | #if IS_ENABLED(CONFIG_NF_NAT) |
diff --git a/include/net/netfilter/nf_conntrack_bridge.h b/include/net/netfilter/nf_conntrack_bridge.h new file mode 100644 index 000000000000..9a5514d5bc51 --- /dev/null +++ b/include/net/netfilter/nf_conntrack_bridge.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #ifndef NF_CONNTRACK_BRIDGE_ | ||
| 2 | #define NF_CONNTRACK_BRIDGE_ | ||
| 3 | |||
| 4 | struct nf_ct_bridge_info { | ||
| 5 | struct nf_hook_ops *ops; | ||
| 6 | unsigned int ops_size; | ||
| 7 | struct module *me; | ||
| 8 | }; | ||
| 9 | |||
| 10 | void nf_ct_bridge_register(struct nf_ct_bridge_info *info); | ||
| 11 | void nf_ct_bridge_unregister(struct nf_ct_bridge_info *info); | ||
| 12 | |||
| 13 | struct nf_ct_bridge_frag_data { | ||
| 14 | char mac[ETH_HLEN]; | ||
| 15 | bool vlan_present; | ||
| 16 | u16 vlan_tci; | ||
| 17 | __be16 vlan_proto; | ||
| 18 | }; | ||
| 19 | |||
| 20 | #endif | ||
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index ae41e92251dd..de10faf2ce91 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
| @@ -64,6 +64,9 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb) | |||
| 64 | return ret; | 64 | return ret; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | unsigned int nf_confirm(struct sk_buff *skb, unsigned int protoff, | ||
| 68 | struct nf_conn *ct, enum ip_conntrack_info ctinfo); | ||
| 69 | |||
| 67 | void print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, | 70 | void print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, |
| 68 | const struct nf_conntrack_l4proto *proto); | 71 | const struct nf_conntrack_l4proto *proto); |
| 69 | 72 | ||
diff --git a/include/net/netfilter/nf_conntrack_synproxy.h b/include/net/netfilter/nf_conntrack_synproxy.h index 2c7559a54092..8f00125b06f4 100644 --- a/include/net/netfilter/nf_conntrack_synproxy.h +++ b/include/net/netfilter/nf_conntrack_synproxy.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #ifndef _NF_CONNTRACK_SYNPROXY_H | 2 | #ifndef _NF_CONNTRACK_SYNPROXY_H |
| 3 | #define _NF_CONNTRACK_SYNPROXY_H | 3 | #define _NF_CONNTRACK_SYNPROXY_H |
| 4 | 4 | ||
| 5 | #include <net/netfilter/nf_conntrack_seqadj.h> | ||
| 5 | #include <net/netns/generic.h> | 6 | #include <net/netns/generic.h> |
| 6 | 7 | ||
| 7 | struct nf_conn_synproxy { | 8 | struct nf_conn_synproxy { |
| @@ -72,21 +73,12 @@ struct synproxy_options { | |||
| 72 | }; | 73 | }; |
| 73 | 74 | ||
| 74 | struct tcphdr; | 75 | struct tcphdr; |
| 75 | struct xt_synproxy_info; | 76 | struct nf_synproxy_info; |
| 76 | bool synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, | 77 | bool synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, |
| 77 | const struct tcphdr *th, | 78 | const struct tcphdr *th, |
| 78 | struct synproxy_options *opts); | 79 | struct synproxy_options *opts); |
| 79 | unsigned int synproxy_options_size(const struct synproxy_options *opts); | ||
| 80 | void synproxy_build_options(struct tcphdr *th, | ||
| 81 | const struct synproxy_options *opts); | ||
| 82 | 80 | ||
| 83 | void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info, | 81 | void synproxy_init_timestamp_cookie(const struct nf_synproxy_info *info, |
| 84 | struct synproxy_options *opts); | 82 | struct synproxy_options *opts); |
| 85 | void synproxy_check_timestamp_cookie(struct synproxy_options *opts); | ||
| 86 | |||
| 87 | unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff, | ||
| 88 | struct tcphdr *th, struct nf_conn *ct, | ||
| 89 | enum ip_conntrack_info ctinfo, | ||
| 90 | const struct nf_conn_synproxy *synproxy); | ||
| 91 | 83 | ||
| 92 | #endif /* _NF_CONNTRACK_SYNPROXY_H */ | 84 | #endif /* _NF_CONNTRACK_SYNPROXY_H */ |
diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h index 3e370cb36263..d8c187936bec 100644 --- a/include/net/netfilter/nf_flow_table.h +++ b/include/net/netfilter/nf_flow_table.h | |||
| @@ -53,8 +53,6 @@ struct flow_offload_tuple { | |||
| 53 | u8 l4proto; | 53 | u8 l4proto; |
| 54 | u8 dir; | 54 | u8 dir; |
| 55 | 55 | ||
| 56 | int oifidx; | ||
| 57 | |||
| 58 | u16 mtu; | 56 | u16 mtu; |
| 59 | 57 | ||
| 60 | struct dst_entry *dst_cache; | 58 | struct dst_entry *dst_cache; |
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index 7239105d9d2e..3cb6dcf53a4e 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h | |||
| @@ -120,6 +120,5 @@ nfqueue_hash(const struct sk_buff *skb, u16 queue, u16 queues_total, u8 family, | |||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | int nf_queue(struct sk_buff *skb, struct nf_hook_state *state, | 122 | int nf_queue(struct sk_buff *skb, struct nf_hook_state *state, |
| 123 | const struct nf_hook_entries *entries, unsigned int index, | 123 | unsigned int index, unsigned int verdict); |
| 124 | unsigned int verdict); | ||
| 125 | #endif /* _NF_QUEUE_H */ | 124 | #endif /* _NF_QUEUE_H */ |
diff --git a/include/net/netfilter/nf_synproxy.h b/include/net/netfilter/nf_synproxy.h new file mode 100644 index 000000000000..87d73fb5279d --- /dev/null +++ b/include/net/netfilter/nf_synproxy.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _NF_SYNPROXY_SHARED_H | ||
| 3 | #define _NF_SYNPROXY_SHARED_H | ||
| 4 | |||
| 5 | #include <linux/module.h> | ||
| 6 | #include <linux/skbuff.h> | ||
| 7 | #include <net/ip6_checksum.h> | ||
| 8 | #include <net/ip6_route.h> | ||
| 9 | #include <net/tcp.h> | ||
| 10 | |||
| 11 | #include <net/netfilter/nf_conntrack_seqadj.h> | ||
| 12 | #include <net/netfilter/nf_conntrack_synproxy.h> | ||
| 13 | |||
| 14 | void synproxy_send_client_synack(struct net *net, const struct sk_buff *skb, | ||
| 15 | const struct tcphdr *th, | ||
| 16 | const struct synproxy_options *opts); | ||
| 17 | |||
| 18 | bool synproxy_recv_client_ack(struct net *net, | ||
| 19 | const struct sk_buff *skb, | ||
| 20 | const struct tcphdr *th, | ||
| 21 | struct synproxy_options *opts, u32 recv_seq); | ||
| 22 | |||
| 23 | unsigned int ipv4_synproxy_hook(void *priv, struct sk_buff *skb, | ||
| 24 | const struct nf_hook_state *nhs); | ||
| 25 | int nf_synproxy_ipv4_init(struct synproxy_net *snet, struct net *net); | ||
| 26 | void nf_synproxy_ipv4_fini(struct synproxy_net *snet, struct net *net); | ||
| 27 | |||
| 28 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 29 | void synproxy_send_client_synack_ipv6(struct net *net, | ||
| 30 | const struct sk_buff *skb, | ||
| 31 | const struct tcphdr *th, | ||
| 32 | const struct synproxy_options *opts); | ||
| 33 | |||
| 34 | bool synproxy_recv_client_ack_ipv6(struct net *net, const struct sk_buff *skb, | ||
| 35 | const struct tcphdr *th, | ||
| 36 | struct synproxy_options *opts, u32 recv_seq); | ||
| 37 | |||
| 38 | unsigned int ipv6_synproxy_hook(void *priv, struct sk_buff *skb, | ||
| 39 | const struct nf_hook_state *nhs); | ||
| 40 | int nf_synproxy_ipv6_init(struct synproxy_net *snet, struct net *net); | ||
| 41 | void nf_synproxy_ipv6_fini(struct synproxy_net *snet, struct net *net); | ||
| 42 | #else | ||
| 43 | static inline int | ||
| 44 | nf_synproxy_ipv6_init(struct synproxy_net *snet, struct net *net) { return 0; } | ||
| 45 | static inline void | ||
| 46 | nf_synproxy_ipv6_fini(struct synproxy_net *snet, struct net *net) {}; | ||
| 47 | #endif /* CONFIG_IPV6 */ | ||
| 48 | |||
| 49 | #endif /* _NF_SYNPROXY_SHARED_H */ | ||
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 5b8624ae4a27..35dfdd9f69b3 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
| @@ -161,6 +161,7 @@ struct nft_ctx { | |||
| 161 | const struct nlattr * const *nla; | 161 | const struct nlattr * const *nla; |
| 162 | u32 portid; | 162 | u32 portid; |
| 163 | u32 seq; | 163 | u32 seq; |
| 164 | u16 flags; | ||
| 164 | u8 family; | 165 | u8 family; |
| 165 | u8 level; | 166 | u8 level; |
| 166 | bool report; | 167 | bool report; |
| @@ -636,7 +637,7 @@ static inline struct nft_object **nft_set_ext_obj(const struct nft_set_ext *ext) | |||
| 636 | void *nft_set_elem_init(const struct nft_set *set, | 637 | void *nft_set_elem_init(const struct nft_set *set, |
| 637 | const struct nft_set_ext_tmpl *tmpl, | 638 | const struct nft_set_ext_tmpl *tmpl, |
| 638 | const u32 *key, const u32 *data, | 639 | const u32 *key, const u32 *data, |
| 639 | u64 timeout, gfp_t gfp); | 640 | u64 timeout, u64 expiration, gfp_t gfp); |
| 640 | void nft_set_elem_destroy(const struct nft_set *set, void *elem, | 641 | void nft_set_elem_destroy(const struct nft_set *set, void *elem, |
| 641 | bool destroy_expr); | 642 | bool destroy_expr); |
| 642 | 643 | ||
| @@ -735,6 +736,9 @@ enum nft_trans_phase { | |||
| 735 | NFT_TRANS_RELEASE | 736 | NFT_TRANS_RELEASE |
| 736 | }; | 737 | }; |
| 737 | 738 | ||
| 739 | struct nft_flow_rule; | ||
| 740 | struct nft_offload_ctx; | ||
| 741 | |||
| 738 | /** | 742 | /** |
| 739 | * struct nft_expr_ops - nf_tables expression operations | 743 | * struct nft_expr_ops - nf_tables expression operations |
| 740 | * | 744 | * |
| @@ -777,6 +781,10 @@ struct nft_expr_ops { | |||
| 777 | const struct nft_data **data); | 781 | const struct nft_data **data); |
| 778 | bool (*gc)(struct net *net, | 782 | bool (*gc)(struct net *net, |
| 779 | const struct nft_expr *expr); | 783 | const struct nft_expr *expr); |
| 784 | int (*offload)(struct nft_offload_ctx *ctx, | ||
| 785 | struct nft_flow_rule *flow, | ||
| 786 | const struct nft_expr *expr); | ||
| 787 | u32 offload_flags; | ||
| 780 | const struct nft_expr_type *type; | 788 | const struct nft_expr_type *type; |
| 781 | void *data; | 789 | void *data; |
| 782 | }; | 790 | }; |
| @@ -859,6 +867,7 @@ static inline struct nft_userdata *nft_userdata(const struct nft_rule *rule) | |||
| 859 | 867 | ||
| 860 | enum nft_chain_flags { | 868 | enum nft_chain_flags { |
| 861 | NFT_BASE_CHAIN = 0x1, | 869 | NFT_BASE_CHAIN = 0x1, |
| 870 | NFT_CHAIN_HW_OFFLOAD = 0x2, | ||
| 862 | }; | 871 | }; |
| 863 | 872 | ||
| 864 | /** | 873 | /** |
| @@ -942,6 +951,7 @@ struct nft_stats { | |||
| 942 | * @stats: per-cpu chain stats | 951 | * @stats: per-cpu chain stats |
| 943 | * @chain: the chain | 952 | * @chain: the chain |
| 944 | * @dev_name: device name that this base chain is attached to (if any) | 953 | * @dev_name: device name that this base chain is attached to (if any) |
| 954 | * @cb_list: list of flow block callbacks (for hardware offload) | ||
| 945 | */ | 955 | */ |
| 946 | struct nft_base_chain { | 956 | struct nft_base_chain { |
| 947 | struct nf_hook_ops ops; | 957 | struct nf_hook_ops ops; |
| @@ -951,6 +961,7 @@ struct nft_base_chain { | |||
| 951 | struct nft_stats __percpu *stats; | 961 | struct nft_stats __percpu *stats; |
| 952 | struct nft_chain chain; | 962 | struct nft_chain chain; |
| 953 | char dev_name[IFNAMSIZ]; | 963 | char dev_name[IFNAMSIZ]; |
| 964 | struct list_head cb_list; | ||
| 954 | }; | 965 | }; |
| 955 | 966 | ||
| 956 | static inline struct nft_base_chain *nft_base_chain(const struct nft_chain *chain) | 967 | static inline struct nft_base_chain *nft_base_chain(const struct nft_chain *chain) |
| @@ -1322,11 +1333,14 @@ struct nft_trans { | |||
| 1322 | 1333 | ||
| 1323 | struct nft_trans_rule { | 1334 | struct nft_trans_rule { |
| 1324 | struct nft_rule *rule; | 1335 | struct nft_rule *rule; |
| 1336 | struct nft_flow_rule *flow; | ||
| 1325 | u32 rule_id; | 1337 | u32 rule_id; |
| 1326 | }; | 1338 | }; |
| 1327 | 1339 | ||
| 1328 | #define nft_trans_rule(trans) \ | 1340 | #define nft_trans_rule(trans) \ |
| 1329 | (((struct nft_trans_rule *)trans->data)->rule) | 1341 | (((struct nft_trans_rule *)trans->data)->rule) |
| 1342 | #define nft_trans_flow_rule(trans) \ | ||
| 1343 | (((struct nft_trans_rule *)trans->data)->flow) | ||
| 1330 | #define nft_trans_rule_id(trans) \ | 1344 | #define nft_trans_rule_id(trans) \ |
| 1331 | (((struct nft_trans_rule *)trans->data)->rule_id) | 1345 | (((struct nft_trans_rule *)trans->data)->rule_id) |
| 1332 | 1346 | ||
diff --git a/include/net/netfilter/nf_tables_offload.h b/include/net/netfilter/nf_tables_offload.h new file mode 100644 index 000000000000..3196663a10e3 --- /dev/null +++ b/include/net/netfilter/nf_tables_offload.h | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | #ifndef _NET_NF_TABLES_OFFLOAD_H | ||
| 2 | #define _NET_NF_TABLES_OFFLOAD_H | ||
| 3 | |||
| 4 | #include <net/flow_offload.h> | ||
| 5 | #include <net/netfilter/nf_tables.h> | ||
| 6 | |||
| 7 | struct nft_offload_reg { | ||
| 8 | u32 key; | ||
| 9 | u32 len; | ||
| 10 | u32 base_offset; | ||
| 11 | u32 offset; | ||
| 12 | struct nft_data mask; | ||
| 13 | }; | ||
| 14 | |||
| 15 | enum nft_offload_dep_type { | ||
| 16 | NFT_OFFLOAD_DEP_UNSPEC = 0, | ||
| 17 | NFT_OFFLOAD_DEP_NETWORK, | ||
| 18 | NFT_OFFLOAD_DEP_TRANSPORT, | ||
| 19 | }; | ||
| 20 | |||
| 21 | struct nft_offload_ctx { | ||
| 22 | struct { | ||
| 23 | enum nft_offload_dep_type type; | ||
| 24 | __be16 l3num; | ||
| 25 | u8 protonum; | ||
| 26 | } dep; | ||
| 27 | unsigned int num_actions; | ||
| 28 | struct nft_offload_reg regs[NFT_REG32_15 + 1]; | ||
| 29 | }; | ||
| 30 | |||
| 31 | void nft_offload_set_dependency(struct nft_offload_ctx *ctx, | ||
| 32 | enum nft_offload_dep_type type); | ||
| 33 | void nft_offload_update_dependency(struct nft_offload_ctx *ctx, | ||
| 34 | const void *data, u32 len); | ||
| 35 | |||
| 36 | struct nft_flow_key { | ||
| 37 | struct flow_dissector_key_basic basic; | ||
| 38 | union { | ||
| 39 | struct flow_dissector_key_ipv4_addrs ipv4; | ||
| 40 | struct flow_dissector_key_ipv6_addrs ipv6; | ||
| 41 | }; | ||
| 42 | struct flow_dissector_key_ports tp; | ||
| 43 | struct flow_dissector_key_ip ip; | ||
| 44 | struct flow_dissector_key_vlan vlan; | ||
| 45 | struct flow_dissector_key_eth_addrs eth_addrs; | ||
| 46 | } __aligned(BITS_PER_LONG / 8); /* Ensure that we can do comparisons as longs. */ | ||
| 47 | |||
| 48 | struct nft_flow_match { | ||
| 49 | struct flow_dissector dissector; | ||
| 50 | struct nft_flow_key key; | ||
| 51 | struct nft_flow_key mask; | ||
| 52 | }; | ||
| 53 | |||
| 54 | struct nft_flow_rule { | ||
| 55 | __be16 proto; | ||
| 56 | struct nft_flow_match match; | ||
| 57 | struct flow_rule *rule; | ||
| 58 | }; | ||
| 59 | |||
| 60 | #define NFT_OFFLOAD_F_ACTION (1 << 0) | ||
| 61 | |||
| 62 | struct nft_rule; | ||
| 63 | struct nft_flow_rule *nft_flow_rule_create(const struct nft_rule *rule); | ||
| 64 | void nft_flow_rule_destroy(struct nft_flow_rule *flow); | ||
| 65 | int nft_flow_rule_offload_commit(struct net *net); | ||
| 66 | |||
| 67 | #define NFT_OFFLOAD_MATCH(__key, __base, __field, __len, __reg) \ | ||
| 68 | (__reg)->base_offset = \ | ||
| 69 | offsetof(struct nft_flow_key, __base); \ | ||
| 70 | (__reg)->offset = \ | ||
| 71 | offsetof(struct nft_flow_key, __base.__field); \ | ||
| 72 | (__reg)->len = __len; \ | ||
| 73 | (__reg)->key = __key; \ | ||
| 74 | memset(&(__reg)->mask, 0xff, (__reg)->len); | ||
| 75 | |||
| 76 | #endif | ||
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h new file mode 100644 index 000000000000..5c69e9b09388 --- /dev/null +++ b/include/net/netfilter/nft_meta.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _NFT_META_H_ | ||
| 3 | #define _NFT_META_H_ | ||
| 4 | |||
| 5 | struct nft_meta { | ||
| 6 | enum nft_meta_keys key:8; | ||
| 7 | union { | ||
| 8 | enum nft_registers dreg:8; | ||
| 9 | enum nft_registers sreg:8; | ||
| 10 | }; | ||
| 11 | }; | ||
| 12 | |||
| 13 | extern const struct nla_policy nft_meta_policy[]; | ||
| 14 | |||
| 15 | int nft_meta_get_init(const struct nft_ctx *ctx, | ||
| 16 | const struct nft_expr *expr, | ||
| 17 | const struct nlattr * const tb[]); | ||
| 18 | |||
| 19 | int nft_meta_set_init(const struct nft_ctx *ctx, | ||
| 20 | const struct nft_expr *expr, | ||
| 21 | const struct nlattr * const tb[]); | ||
| 22 | |||
| 23 | int nft_meta_get_dump(struct sk_buff *skb, | ||
| 24 | const struct nft_expr *expr); | ||
| 25 | |||
| 26 | int nft_meta_set_dump(struct sk_buff *skb, | ||
| 27 | const struct nft_expr *expr); | ||
| 28 | |||
| 29 | void nft_meta_get_eval(const struct nft_expr *expr, | ||
| 30 | struct nft_regs *regs, | ||
| 31 | const struct nft_pktinfo *pkt); | ||
| 32 | |||
| 33 | void nft_meta_set_eval(const struct nft_expr *expr, | ||
| 34 | struct nft_regs *regs, | ||
| 35 | const struct nft_pktinfo *pkt); | ||
| 36 | |||
| 37 | void nft_meta_set_destroy(const struct nft_ctx *ctx, | ||
| 38 | const struct nft_expr *expr); | ||
| 39 | |||
| 40 | int nft_meta_set_validate(const struct nft_ctx *ctx, | ||
| 41 | const struct nft_expr *expr, | ||
| 42 | const struct nft_data **data); | ||
| 43 | |||
| 44 | #endif | ||
diff --git a/include/net/netlink.h b/include/net/netlink.h index 395b4406f4b0..e4650e5b64a1 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
| @@ -378,13 +378,17 @@ struct nla_policy { | |||
| 378 | /** | 378 | /** |
| 379 | * struct nl_info - netlink source information | 379 | * struct nl_info - netlink source information |
| 380 | * @nlh: Netlink message header of original request | 380 | * @nlh: Netlink message header of original request |
| 381 | * @nl_net: Network namespace | ||
| 381 | * @portid: Netlink PORTID of requesting application | 382 | * @portid: Netlink PORTID of requesting application |
| 383 | * @skip_notify: Skip netlink notifications to user space | ||
| 384 | * @skip_notify_kernel: Skip selected in-kernel notifications | ||
| 382 | */ | 385 | */ |
| 383 | struct nl_info { | 386 | struct nl_info { |
| 384 | struct nlmsghdr *nlh; | 387 | struct nlmsghdr *nlh; |
| 385 | struct net *nl_net; | 388 | struct net *nl_net; |
| 386 | u32 portid; | 389 | u32 portid; |
| 387 | bool skip_notify; | 390 | u8 skip_notify:1, |
| 391 | skip_notify_kernel:1; | ||
| 388 | }; | 392 | }; |
| 389 | 393 | ||
| 390 | /** | 394 | /** |
| @@ -1755,6 +1759,15 @@ static inline int __nla_validate_nested(const struct nlattr *start, int maxtype, | |||
| 1755 | } | 1759 | } |
| 1756 | 1760 | ||
| 1757 | static inline int | 1761 | static inline int |
| 1762 | nl80211_validate_nested(const struct nlattr *start, int maxtype, | ||
| 1763 | const struct nla_policy *policy, | ||
| 1764 | struct netlink_ext_ack *extack) | ||
| 1765 | { | ||
| 1766 | return __nla_validate_nested(start, maxtype, policy, | ||
| 1767 | NL_VALIDATE_STRICT, extack); | ||
| 1768 | } | ||
| 1769 | |||
| 1770 | static inline int | ||
| 1758 | nla_validate_nested_deprecated(const struct nlattr *start, int maxtype, | 1771 | nla_validate_nested_deprecated(const struct nlattr *start, int maxtype, |
| 1759 | const struct nla_policy *policy, | 1772 | const struct nla_policy *policy, |
| 1760 | struct netlink_ext_ack *extack) | 1773 | struct netlink_ext_ack *extack) |
diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h index 736aeac52f56..95406e1342cb 100644 --- a/include/net/netns/ieee802154_6lowpan.h +++ b/include/net/netns/ieee802154_6lowpan.h | |||
| @@ -16,7 +16,7 @@ struct netns_sysctl_lowpan { | |||
| 16 | 16 | ||
| 17 | struct netns_ieee802154_lowpan { | 17 | struct netns_ieee802154_lowpan { |
| 18 | struct netns_sysctl_lowpan sysctl; | 18 | struct netns_sysctl_lowpan sysctl; |
| 19 | struct netns_frags frags; | 19 | struct fqdir *fqdir; |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | #endif | 22 | #endif |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 623cfbb7b8dc..bc24a8ec1ce5 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
| @@ -72,7 +72,7 @@ struct netns_ipv4 { | |||
| 72 | 72 | ||
| 73 | struct inet_peer_base *peers; | 73 | struct inet_peer_base *peers; |
| 74 | struct sock * __percpu *tcp_sk; | 74 | struct sock * __percpu *tcp_sk; |
| 75 | struct netns_frags frags; | 75 | struct fqdir *fqdir; |
| 76 | #ifdef CONFIG_NETFILTER | 76 | #ifdef CONFIG_NETFILTER |
| 77 | struct xt_table *iptable_filter; | 77 | struct xt_table *iptable_filter; |
| 78 | struct xt_table *iptable_mangle; | 78 | struct xt_table *iptable_mangle; |
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 5e61b5a8635d..022a0fd1a5a4 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h | |||
| @@ -58,7 +58,7 @@ struct netns_ipv6 { | |||
| 58 | struct ipv6_devconf *devconf_all; | 58 | struct ipv6_devconf *devconf_all; |
| 59 | struct ipv6_devconf *devconf_dflt; | 59 | struct ipv6_devconf *devconf_dflt; |
| 60 | struct inet_peer_base *peers; | 60 | struct inet_peer_base *peers; |
| 61 | struct netns_frags frags; | 61 | struct fqdir *fqdir; |
| 62 | #ifdef CONFIG_NETFILTER | 62 | #ifdef CONFIG_NETFILTER |
| 63 | struct xt_table *ip6table_filter; | 63 | struct xt_table *ip6table_filter; |
| 64 | struct xt_table *ip6table_mangle; | 64 | struct xt_table *ip6table_mangle; |
| @@ -116,7 +116,7 @@ struct netns_ipv6 { | |||
| 116 | 116 | ||
| 117 | #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) | 117 | #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) |
| 118 | struct netns_nf_frag { | 118 | struct netns_nf_frag { |
| 119 | struct netns_frags frags; | 119 | struct fqdir *fqdir; |
| 120 | }; | 120 | }; |
| 121 | #endif | 121 | #endif |
| 122 | 122 | ||
diff --git a/include/net/netns/nexthop.h b/include/net/netns/nexthop.h new file mode 100644 index 000000000000..c712ee5eebd9 --- /dev/null +++ b/include/net/netns/nexthop.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * nexthops in net namespaces | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef __NETNS_NEXTHOP_H__ | ||
| 7 | #define __NETNS_NEXTHOP_H__ | ||
| 8 | |||
| 9 | #include <linux/rbtree.h> | ||
| 10 | |||
| 11 | struct netns_nexthop { | ||
| 12 | struct rb_root rb_root; /* tree of nexthops by id */ | ||
| 13 | struct hlist_head *devhash; /* nexthops by device */ | ||
| 14 | |||
| 15 | unsigned int seq; /* protected by rtnl_mutex */ | ||
| 16 | u32 last_id_allocated; | ||
| 17 | }; | ||
| 18 | #endif | ||
diff --git a/include/net/nexthop.h b/include/net/nexthop.h new file mode 100644 index 000000000000..25f1f9a8419b --- /dev/null +++ b/include/net/nexthop.h | |||
| @@ -0,0 +1,312 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Generic nexthop implementation | ||
| 4 | * | ||
| 5 | * Copyright (c) 2017-19 Cumulus Networks | ||
| 6 | * Copyright (c) 2017-19 David Ahern <dsa@cumulusnetworks.com> | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __LINUX_NEXTHOP_H | ||
| 10 | #define __LINUX_NEXTHOP_H | ||
| 11 | |||
| 12 | #include <linux/netdevice.h> | ||
| 13 | #include <linux/route.h> | ||
| 14 | #include <linux/types.h> | ||
| 15 | #include <net/ip_fib.h> | ||
| 16 | #include <net/ip6_fib.h> | ||
| 17 | #include <net/netlink.h> | ||
| 18 | |||
| 19 | #define NEXTHOP_VALID_USER_FLAGS RTNH_F_ONLINK | ||
| 20 | |||
| 21 | struct nexthop; | ||
| 22 | |||
| 23 | struct nh_config { | ||
| 24 | u32 nh_id; | ||
| 25 | |||
| 26 | u8 nh_family; | ||
| 27 | u8 nh_protocol; | ||
| 28 | u8 nh_blackhole; | ||
| 29 | u32 nh_flags; | ||
| 30 | |||
| 31 | int nh_ifindex; | ||
| 32 | struct net_device *dev; | ||
| 33 | |||
| 34 | union { | ||
| 35 | __be32 ipv4; | ||
| 36 | struct in6_addr ipv6; | ||
| 37 | } gw; | ||
| 38 | |||
| 39 | struct nlattr *nh_grp; | ||
| 40 | u16 nh_grp_type; | ||
| 41 | |||
| 42 | struct nlattr *nh_encap; | ||
| 43 | u16 nh_encap_type; | ||
| 44 | |||
| 45 | u32 nlflags; | ||
| 46 | struct nl_info nlinfo; | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct nh_info { | ||
| 50 | struct hlist_node dev_hash; /* entry on netns devhash */ | ||
| 51 | struct nexthop *nh_parent; | ||
| 52 | |||
| 53 | u8 family; | ||
| 54 | bool reject_nh; | ||
| 55 | |||
| 56 | union { | ||
| 57 | struct fib_nh_common fib_nhc; | ||
| 58 | struct fib_nh fib_nh; | ||
| 59 | struct fib6_nh fib6_nh; | ||
| 60 | }; | ||
| 61 | }; | ||
| 62 | |||
| 63 | struct nh_grp_entry { | ||
| 64 | struct nexthop *nh; | ||
| 65 | u8 weight; | ||
| 66 | atomic_t upper_bound; | ||
| 67 | |||
| 68 | struct list_head nh_list; | ||
| 69 | struct nexthop *nh_parent; /* nexthop of group with this entry */ | ||
| 70 | }; | ||
| 71 | |||
| 72 | struct nh_group { | ||
| 73 | u16 num_nh; | ||
| 74 | bool mpath; | ||
| 75 | bool has_v4; | ||
| 76 | struct nh_grp_entry nh_entries[0]; | ||
| 77 | }; | ||
| 78 | |||
| 79 | struct nexthop { | ||
| 80 | struct rb_node rb_node; /* entry on netns rbtree */ | ||
| 81 | struct list_head fi_list; /* v4 entries using nh */ | ||
| 82 | struct list_head f6i_list; /* v6 entries using nh */ | ||
| 83 | struct list_head grp_list; /* nh group entries using this nh */ | ||
| 84 | struct net *net; | ||
| 85 | |||
| 86 | u32 id; | ||
| 87 | |||
| 88 | u8 protocol; /* app managing this nh */ | ||
| 89 | u8 nh_flags; | ||
| 90 | bool is_group; | ||
| 91 | |||
| 92 | refcount_t refcnt; | ||
| 93 | struct rcu_head rcu; | ||
| 94 | |||
| 95 | union { | ||
| 96 | struct nh_info __rcu *nh_info; | ||
| 97 | struct nh_group __rcu *nh_grp; | ||
| 98 | }; | ||
| 99 | }; | ||
| 100 | |||
| 101 | /* caller is holding rcu or rtnl; no reference taken to nexthop */ | ||
| 102 | struct nexthop *nexthop_find_by_id(struct net *net, u32 id); | ||
| 103 | void nexthop_free_rcu(struct rcu_head *head); | ||
| 104 | |||
| 105 | static inline bool nexthop_get(struct nexthop *nh) | ||
| 106 | { | ||
| 107 | return refcount_inc_not_zero(&nh->refcnt); | ||
| 108 | } | ||
| 109 | |||
| 110 | static inline void nexthop_put(struct nexthop *nh) | ||
| 111 | { | ||
| 112 | if (refcount_dec_and_test(&nh->refcnt)) | ||
| 113 | call_rcu(&nh->rcu, nexthop_free_rcu); | ||
| 114 | } | ||
| 115 | |||
| 116 | static inline bool nexthop_cmp(const struct nexthop *nh1, | ||
| 117 | const struct nexthop *nh2) | ||
| 118 | { | ||
| 119 | return nh1 == nh2; | ||
| 120 | } | ||
| 121 | |||
| 122 | static inline bool nexthop_is_multipath(const struct nexthop *nh) | ||
| 123 | { | ||
| 124 | if (nh->is_group) { | ||
| 125 | struct nh_group *nh_grp; | ||
| 126 | |||
| 127 | nh_grp = rcu_dereference_rtnl(nh->nh_grp); | ||
| 128 | return nh_grp->mpath; | ||
| 129 | } | ||
| 130 | return false; | ||
| 131 | } | ||
| 132 | |||
| 133 | struct nexthop *nexthop_select_path(struct nexthop *nh, int hash); | ||
| 134 | |||
| 135 | static inline unsigned int nexthop_num_path(const struct nexthop *nh) | ||
| 136 | { | ||
| 137 | unsigned int rc = 1; | ||
| 138 | |||
| 139 | if (nexthop_is_multipath(nh)) { | ||
| 140 | struct nh_group *nh_grp; | ||
| 141 | |||
| 142 | nh_grp = rcu_dereference_rtnl(nh->nh_grp); | ||
| 143 | rc = nh_grp->num_nh; | ||
| 144 | } else { | ||
| 145 | const struct nh_info *nhi; | ||
| 146 | |||
| 147 | nhi = rcu_dereference_rtnl(nh->nh_info); | ||
| 148 | if (nhi->reject_nh) | ||
| 149 | rc = 0; | ||
| 150 | } | ||
| 151 | |||
| 152 | return rc; | ||
| 153 | } | ||
| 154 | |||
| 155 | static inline | ||
| 156 | struct nexthop *nexthop_mpath_select(const struct nexthop *nh, int nhsel) | ||
| 157 | { | ||
| 158 | const struct nh_group *nhg = rcu_dereference_rtnl(nh->nh_grp); | ||
| 159 | |||
| 160 | /* for_nexthops macros in fib_semantics.c grabs a pointer to | ||
| 161 | * the nexthop before checking nhsel | ||
| 162 | */ | ||
| 163 | if (nhsel >= nhg->num_nh) | ||
| 164 | return NULL; | ||
| 165 | |||
| 166 | return nhg->nh_entries[nhsel].nh; | ||
| 167 | } | ||
| 168 | |||
| 169 | static inline | ||
| 170 | int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh) | ||
| 171 | { | ||
| 172 | struct nh_group *nhg = rtnl_dereference(nh->nh_grp); | ||
| 173 | int i; | ||
| 174 | |||
| 175 | for (i = 0; i < nhg->num_nh; i++) { | ||
| 176 | struct nexthop *nhe = nhg->nh_entries[i].nh; | ||
| 177 | struct nh_info *nhi = rcu_dereference_rtnl(nhe->nh_info); | ||
| 178 | struct fib_nh_common *nhc = &nhi->fib_nhc; | ||
| 179 | int weight = nhg->nh_entries[i].weight; | ||
| 180 | |||
| 181 | if (fib_add_nexthop(skb, nhc, weight) < 0) | ||
| 182 | return -EMSGSIZE; | ||
| 183 | } | ||
| 184 | |||
| 185 | return 0; | ||
| 186 | } | ||
| 187 | |||
| 188 | /* called with rcu lock */ | ||
| 189 | static inline bool nexthop_is_blackhole(const struct nexthop *nh) | ||
| 190 | { | ||
| 191 | const struct nh_info *nhi; | ||
| 192 | |||
| 193 | if (nexthop_is_multipath(nh)) { | ||
| 194 | if (nexthop_num_path(nh) > 1) | ||
| 195 | return false; | ||
| 196 | nh = nexthop_mpath_select(nh, 0); | ||
| 197 | if (!nh) | ||
| 198 | return false; | ||
| 199 | } | ||
| 200 | |||
| 201 | nhi = rcu_dereference_rtnl(nh->nh_info); | ||
| 202 | return nhi->reject_nh; | ||
| 203 | } | ||
| 204 | |||
| 205 | static inline void nexthop_path_fib_result(struct fib_result *res, int hash) | ||
| 206 | { | ||
| 207 | struct nh_info *nhi; | ||
| 208 | struct nexthop *nh; | ||
| 209 | |||
| 210 | nh = nexthop_select_path(res->fi->nh, hash); | ||
| 211 | nhi = rcu_dereference(nh->nh_info); | ||
| 212 | res->nhc = &nhi->fib_nhc; | ||
| 213 | } | ||
| 214 | |||
| 215 | /* called with rcu read lock or rtnl held */ | ||
| 216 | static inline | ||
| 217 | struct fib_nh_common *nexthop_fib_nhc(struct nexthop *nh, int nhsel) | ||
| 218 | { | ||
| 219 | struct nh_info *nhi; | ||
| 220 | |||
| 221 | BUILD_BUG_ON(offsetof(struct fib_nh, nh_common) != 0); | ||
| 222 | BUILD_BUG_ON(offsetof(struct fib6_nh, nh_common) != 0); | ||
| 223 | |||
| 224 | if (nexthop_is_multipath(nh)) { | ||
| 225 | nh = nexthop_mpath_select(nh, nhsel); | ||
| 226 | if (!nh) | ||
| 227 | return NULL; | ||
| 228 | } | ||
| 229 | |||
| 230 | nhi = rcu_dereference_rtnl(nh->nh_info); | ||
| 231 | return &nhi->fib_nhc; | ||
| 232 | } | ||
| 233 | |||
| 234 | static inline unsigned int fib_info_num_path(const struct fib_info *fi) | ||
| 235 | { | ||
| 236 | if (unlikely(fi->nh)) | ||
| 237 | return nexthop_num_path(fi->nh); | ||
| 238 | |||
| 239 | return fi->fib_nhs; | ||
| 240 | } | ||
| 241 | |||
| 242 | int fib_check_nexthop(struct nexthop *nh, u8 scope, | ||
| 243 | struct netlink_ext_ack *extack); | ||
| 244 | |||
| 245 | static inline struct fib_nh_common *fib_info_nhc(struct fib_info *fi, int nhsel) | ||
| 246 | { | ||
| 247 | if (unlikely(fi->nh)) | ||
| 248 | return nexthop_fib_nhc(fi->nh, nhsel); | ||
| 249 | |||
| 250 | return &fi->fib_nh[nhsel].nh_common; | ||
| 251 | } | ||
| 252 | |||
| 253 | /* only used when fib_nh is built into fib_info */ | ||
| 254 | static inline struct fib_nh *fib_info_nh(struct fib_info *fi, int nhsel) | ||
| 255 | { | ||
| 256 | WARN_ON(fi->nh); | ||
| 257 | |||
| 258 | return &fi->fib_nh[nhsel]; | ||
| 259 | } | ||
| 260 | |||
| 261 | /* | ||
| 262 | * IPv6 variants | ||
| 263 | */ | ||
| 264 | int fib6_check_nexthop(struct nexthop *nh, struct fib6_config *cfg, | ||
| 265 | struct netlink_ext_ack *extack); | ||
| 266 | |||
| 267 | static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh) | ||
| 268 | { | ||
| 269 | struct nh_info *nhi; | ||
| 270 | |||
| 271 | if (nexthop_is_multipath(nh)) { | ||
| 272 | nh = nexthop_mpath_select(nh, 0); | ||
| 273 | if (!nh) | ||
| 274 | return NULL; | ||
| 275 | } | ||
| 276 | |||
| 277 | nhi = rcu_dereference_rtnl(nh->nh_info); | ||
| 278 | if (nhi->family == AF_INET6) | ||
| 279 | return &nhi->fib6_nh; | ||
| 280 | |||
| 281 | return NULL; | ||
| 282 | } | ||
| 283 | |||
| 284 | static inline struct net_device *fib6_info_nh_dev(struct fib6_info *f6i) | ||
| 285 | { | ||
| 286 | struct fib6_nh *fib6_nh; | ||
| 287 | |||
| 288 | fib6_nh = f6i->nh ? nexthop_fib6_nh(f6i->nh) : f6i->fib6_nh; | ||
| 289 | return fib6_nh->fib_nh_dev; | ||
| 290 | } | ||
| 291 | |||
| 292 | static inline void nexthop_path_fib6_result(struct fib6_result *res, int hash) | ||
| 293 | { | ||
| 294 | struct nexthop *nh = res->f6i->nh; | ||
| 295 | struct nh_info *nhi; | ||
| 296 | |||
| 297 | nh = nexthop_select_path(nh, hash); | ||
| 298 | |||
| 299 | nhi = rcu_dereference_rtnl(nh->nh_info); | ||
| 300 | if (nhi->reject_nh) { | ||
| 301 | res->fib6_type = RTN_BLACKHOLE; | ||
| 302 | res->fib6_flags |= RTF_REJECT; | ||
| 303 | res->nh = nexthop_fib6_nh(nh); | ||
| 304 | } else { | ||
| 305 | res->nh = &nhi->fib6_nh; | ||
| 306 | } | ||
| 307 | } | ||
| 308 | |||
| 309 | int nexthop_for_each_fib6_nh(struct nexthop *nh, | ||
| 310 | int (*cb)(struct fib6_nh *nh, void *arg), | ||
| 311 | void *arg); | ||
| 312 | #endif | ||
diff --git a/include/net/page_pool.h b/include/net/page_pool.h index 694d055e01ef..2cbcdbdec254 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h | |||
| @@ -16,14 +16,16 @@ | |||
| 16 | * page_pool_alloc_pages() call. Drivers should likely use | 16 | * page_pool_alloc_pages() call. Drivers should likely use |
| 17 | * page_pool_dev_alloc_pages() replacing dev_alloc_pages(). | 17 | * page_pool_dev_alloc_pages() replacing dev_alloc_pages(). |
| 18 | * | 18 | * |
| 19 | * If page_pool handles DMA mapping (use page->private), then API user | 19 | * API keeps track of in-flight pages, in-order to let API user know |
| 20 | * is responsible for invoking page_pool_put_page() once. In-case of | 20 | * when it is safe to dealloactor page_pool object. Thus, API users |
| 21 | * elevated refcnt, the DMA state is released, assuming other users of | 21 | * must make sure to call page_pool_release_page() when a page is |
| 22 | * the page will eventually call put_page(). | 22 | * "leaving" the page_pool. Or call page_pool_put_page() where |
| 23 | * appropiate. For maintaining correct accounting. | ||
| 23 | * | 24 | * |
| 24 | * If no DMA mapping is done, then it can act as shim-layer that | 25 | * API user must only call page_pool_put_page() once on a page, as it |
| 25 | * fall-through to alloc_page. As no state is kept on the page, the | 26 | * will either recycle the page, or in case of elevated refcnt, it |
| 26 | * regular put_page() call is sufficient. | 27 | * will release the DMA mapping and in-flight state accounting. We |
| 28 | * hope to lift this requirement in the future. | ||
| 27 | */ | 29 | */ |
| 28 | #ifndef _NET_PAGE_POOL_H | 30 | #ifndef _NET_PAGE_POOL_H |
| 29 | #define _NET_PAGE_POOL_H | 31 | #define _NET_PAGE_POOL_H |
| @@ -66,9 +68,10 @@ struct page_pool_params { | |||
| 66 | }; | 68 | }; |
| 67 | 69 | ||
| 68 | struct page_pool { | 70 | struct page_pool { |
| 69 | struct rcu_head rcu; | ||
| 70 | struct page_pool_params p; | 71 | struct page_pool_params p; |
| 71 | 72 | ||
| 73 | u32 pages_state_hold_cnt; | ||
| 74 | |||
| 72 | /* | 75 | /* |
| 73 | * Data structure for allocation side | 76 | * Data structure for allocation side |
| 74 | * | 77 | * |
| @@ -96,6 +99,14 @@ struct page_pool { | |||
| 96 | * TODO: Implement bulk return pages into this structure. | 99 | * TODO: Implement bulk return pages into this structure. |
| 97 | */ | 100 | */ |
| 98 | struct ptr_ring ring; | 101 | struct ptr_ring ring; |
| 102 | |||
| 103 | atomic_t pages_state_release_cnt; | ||
| 104 | |||
| 105 | /* A page_pool is strictly tied to a single RX-queue being | ||
| 106 | * protected by NAPI, due to above pp_alloc_cache. This | ||
| 107 | * refcnt serves purpose is to simplify drivers error handling. | ||
| 108 | */ | ||
| 109 | refcount_t user_cnt; | ||
| 99 | }; | 110 | }; |
| 100 | 111 | ||
| 101 | struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp); | 112 | struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp); |
| @@ -107,9 +118,36 @@ static inline struct page *page_pool_dev_alloc_pages(struct page_pool *pool) | |||
| 107 | return page_pool_alloc_pages(pool, gfp); | 118 | return page_pool_alloc_pages(pool, gfp); |
| 108 | } | 119 | } |
| 109 | 120 | ||
| 121 | /* get the stored dma direction. A driver might decide to treat this locally and | ||
| 122 | * avoid the extra cache line from page_pool to determine the direction | ||
| 123 | */ | ||
| 124 | static | ||
| 125 | inline enum dma_data_direction page_pool_get_dma_dir(struct page_pool *pool) | ||
| 126 | { | ||
| 127 | return pool->p.dma_dir; | ||
| 128 | } | ||
| 129 | |||
| 110 | struct page_pool *page_pool_create(const struct page_pool_params *params); | 130 | struct page_pool *page_pool_create(const struct page_pool_params *params); |
| 111 | 131 | ||
| 112 | void page_pool_destroy(struct page_pool *pool); | 132 | void __page_pool_free(struct page_pool *pool); |
| 133 | static inline void page_pool_free(struct page_pool *pool) | ||
| 134 | { | ||
| 135 | /* When page_pool isn't compiled-in, net/core/xdp.c doesn't | ||
| 136 | * allow registering MEM_TYPE_PAGE_POOL, but shield linker. | ||
| 137 | */ | ||
| 138 | #ifdef CONFIG_PAGE_POOL | ||
| 139 | __page_pool_free(pool); | ||
| 140 | #endif | ||
| 141 | } | ||
| 142 | |||
| 143 | /* Drivers use this instead of page_pool_free */ | ||
| 144 | static inline void page_pool_destroy(struct page_pool *pool) | ||
| 145 | { | ||
| 146 | if (!pool) | ||
| 147 | return; | ||
| 148 | |||
| 149 | page_pool_free(pool); | ||
| 150 | } | ||
| 113 | 151 | ||
| 114 | /* Never call this directly, use helpers below */ | 152 | /* Never call this directly, use helpers below */ |
| 115 | void __page_pool_put_page(struct page_pool *pool, | 153 | void __page_pool_put_page(struct page_pool *pool, |
| @@ -132,6 +170,43 @@ static inline void page_pool_recycle_direct(struct page_pool *pool, | |||
| 132 | __page_pool_put_page(pool, page, true); | 170 | __page_pool_put_page(pool, page, true); |
| 133 | } | 171 | } |
| 134 | 172 | ||
| 173 | /* API user MUST have disconnected alloc-side (not allowed to call | ||
| 174 | * page_pool_alloc_pages()) before calling this. The free-side can | ||
| 175 | * still run concurrently, to handle in-flight packet-pages. | ||
| 176 | * | ||
| 177 | * A request to shutdown can fail (with false) if there are still | ||
| 178 | * in-flight packet-pages. | ||
| 179 | */ | ||
| 180 | bool __page_pool_request_shutdown(struct page_pool *pool); | ||
| 181 | static inline bool page_pool_request_shutdown(struct page_pool *pool) | ||
| 182 | { | ||
| 183 | bool safe_to_remove = false; | ||
| 184 | |||
| 185 | #ifdef CONFIG_PAGE_POOL | ||
| 186 | safe_to_remove = __page_pool_request_shutdown(pool); | ||
| 187 | #endif | ||
| 188 | return safe_to_remove; | ||
| 189 | } | ||
| 190 | |||
| 191 | /* Disconnects a page (from a page_pool). API users can have a need | ||
| 192 | * to disconnect a page (from a page_pool), to allow it to be used as | ||
| 193 | * a regular page (that will eventually be returned to the normal | ||
| 194 | * page-allocator via put_page). | ||
| 195 | */ | ||
| 196 | void page_pool_unmap_page(struct page_pool *pool, struct page *page); | ||
| 197 | static inline void page_pool_release_page(struct page_pool *pool, | ||
| 198 | struct page *page) | ||
| 199 | { | ||
| 200 | #ifdef CONFIG_PAGE_POOL | ||
| 201 | page_pool_unmap_page(pool, page); | ||
| 202 | #endif | ||
| 203 | } | ||
| 204 | |||
| 205 | static inline dma_addr_t page_pool_get_dma_addr(struct page *page) | ||
| 206 | { | ||
| 207 | return page->dma_addr; | ||
| 208 | } | ||
| 209 | |||
| 135 | static inline bool is_page_pool_compiled_in(void) | 210 | static inline bool is_page_pool_compiled_in(void) |
| 136 | { | 211 | { |
| 137 | #ifdef CONFIG_PAGE_POOL | 212 | #ifdef CONFIG_PAGE_POOL |
| @@ -141,4 +216,14 @@ static inline bool is_page_pool_compiled_in(void) | |||
| 141 | #endif | 216 | #endif |
| 142 | } | 217 | } |
| 143 | 218 | ||
| 219 | static inline void page_pool_get(struct page_pool *pool) | ||
| 220 | { | ||
| 221 | refcount_inc(&pool->user_cnt); | ||
| 222 | } | ||
| 223 | |||
| 224 | static inline bool page_pool_put(struct page_pool *pool) | ||
| 225 | { | ||
| 226 | return refcount_dec_and_test(&pool->user_cnt); | ||
| 227 | } | ||
| 228 | |||
| 144 | #endif /* _NET_PAGE_POOL_H */ | 229 | #endif /* _NET_PAGE_POOL_H */ |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 514e3c80ecc1..841faadceb6e 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
| @@ -7,9 +7,10 @@ | |||
| 7 | #include <net/sch_generic.h> | 7 | #include <net/sch_generic.h> |
| 8 | #include <net/act_api.h> | 8 | #include <net/act_api.h> |
| 9 | #include <net/flow_offload.h> | 9 | #include <net/flow_offload.h> |
| 10 | #include <net/net_namespace.h> | ||
| 10 | 11 | ||
| 11 | /* TC action not accessible from user space */ | 12 | /* TC action not accessible from user space */ |
| 12 | #define TC_ACT_REINSERT (TC_ACT_VALUE_MAX + 1) | 13 | #define TC_ACT_CONSUMED (TC_ACT_VALUE_MAX + 1) |
| 13 | 14 | ||
| 14 | /* Basic packet classifier frontend definitions. */ | 15 | /* Basic packet classifier frontend definitions. */ |
| 15 | 16 | ||
| @@ -25,14 +26,8 @@ struct tcf_walker { | |||
| 25 | int register_tcf_proto_ops(struct tcf_proto_ops *ops); | 26 | int register_tcf_proto_ops(struct tcf_proto_ops *ops); |
| 26 | int unregister_tcf_proto_ops(struct tcf_proto_ops *ops); | 27 | int unregister_tcf_proto_ops(struct tcf_proto_ops *ops); |
| 27 | 28 | ||
| 28 | enum tcf_block_binder_type { | ||
| 29 | TCF_BLOCK_BINDER_TYPE_UNSPEC, | ||
| 30 | TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS, | ||
| 31 | TCF_BLOCK_BINDER_TYPE_CLSACT_EGRESS, | ||
| 32 | }; | ||
| 33 | |||
| 34 | struct tcf_block_ext_info { | 29 | struct tcf_block_ext_info { |
| 35 | enum tcf_block_binder_type binder_type; | 30 | enum flow_block_binder_type binder_type; |
| 36 | tcf_chain_head_change_t *chain_head_change; | 31 | tcf_chain_head_change_t *chain_head_change; |
| 37 | void *chain_head_change_priv; | 32 | void *chain_head_change_priv; |
| 38 | u32 block_index; | 33 | u32 block_index; |
| @@ -65,28 +60,17 @@ static inline bool tcf_block_shared(struct tcf_block *block) | |||
| 65 | return block->index; | 60 | return block->index; |
| 66 | } | 61 | } |
| 67 | 62 | ||
| 63 | static inline bool tcf_block_non_null_shared(struct tcf_block *block) | ||
| 64 | { | ||
| 65 | return block && block->index; | ||
| 66 | } | ||
| 67 | |||
| 68 | static inline struct Qdisc *tcf_block_q(struct tcf_block *block) | 68 | static inline struct Qdisc *tcf_block_q(struct tcf_block *block) |
| 69 | { | 69 | { |
| 70 | WARN_ON(tcf_block_shared(block)); | 70 | WARN_ON(tcf_block_shared(block)); |
| 71 | return block->q; | 71 | return block->q; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | void *tcf_block_cb_priv(struct tcf_block_cb *block_cb); | ||
| 75 | struct tcf_block_cb *tcf_block_cb_lookup(struct tcf_block *block, | ||
| 76 | tc_setup_cb_t *cb, void *cb_ident); | ||
| 77 | void tcf_block_cb_incref(struct tcf_block_cb *block_cb); | ||
| 78 | unsigned int tcf_block_cb_decref(struct tcf_block_cb *block_cb); | ||
| 79 | struct tcf_block_cb *__tcf_block_cb_register(struct tcf_block *block, | ||
| 80 | tc_setup_cb_t *cb, void *cb_ident, | ||
| 81 | void *cb_priv, | ||
| 82 | struct netlink_ext_ack *extack); | ||
| 83 | int tcf_block_cb_register(struct tcf_block *block, | ||
| 84 | tc_setup_cb_t *cb, void *cb_ident, | ||
| 85 | void *cb_priv, struct netlink_ext_ack *extack); | ||
| 86 | void __tcf_block_cb_unregister(struct tcf_block *block, | ||
| 87 | struct tcf_block_cb *block_cb); | ||
| 88 | void tcf_block_cb_unregister(struct tcf_block *block, | ||
| 89 | tc_setup_cb_t *cb, void *cb_ident); | ||
| 90 | int __tc_indr_block_cb_register(struct net_device *dev, void *cb_priv, | 74 | int __tc_indr_block_cb_register(struct net_device *dev, void *cb_priv, |
| 91 | tc_indr_block_bind_cb_t *cb, void *cb_ident); | 75 | tc_indr_block_bind_cb_t *cb, void *cb_ident); |
| 92 | int tc_indr_block_cb_register(struct net_device *dev, void *cb_priv, | 76 | int tc_indr_block_cb_register(struct net_device *dev, void *cb_priv, |
| @@ -105,6 +89,11 @@ static inline bool tcf_block_shared(struct tcf_block *block) | |||
| 105 | return false; | 89 | return false; |
| 106 | } | 90 | } |
| 107 | 91 | ||
| 92 | static inline bool tcf_block_non_null_shared(struct tcf_block *block) | ||
| 93 | { | ||
| 94 | return false; | ||
| 95 | } | ||
| 96 | |||
| 108 | static inline | 97 | static inline |
| 109 | int tcf_block_get(struct tcf_block **p_block, | 98 | int tcf_block_get(struct tcf_block **p_block, |
| 110 | struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q, | 99 | struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q, |
| @@ -150,59 +139,6 @@ void tc_setup_cb_block_unregister(struct tcf_block *block, tc_setup_cb_t *cb, | |||
| 150 | } | 139 | } |
| 151 | 140 | ||
| 152 | static inline | 141 | static inline |
| 153 | void *tcf_block_cb_priv(struct tcf_block_cb *block_cb) | ||
| 154 | { | ||
| 155 | return NULL; | ||
| 156 | } | ||
| 157 | |||
| 158 | static inline | ||
| 159 | struct tcf_block_cb *tcf_block_cb_lookup(struct tcf_block *block, | ||
| 160 | tc_setup_cb_t *cb, void *cb_ident) | ||
| 161 | { | ||
| 162 | return NULL; | ||
| 163 | } | ||
| 164 | |||
| 165 | static inline | ||
| 166 | void tcf_block_cb_incref(struct tcf_block_cb *block_cb) | ||
| 167 | { | ||
| 168 | } | ||
| 169 | |||
| 170 | static inline | ||
| 171 | unsigned int tcf_block_cb_decref(struct tcf_block_cb *block_cb) | ||
| 172 | { | ||
| 173 | return 0; | ||
| 174 | } | ||
| 175 | |||
| 176 | static inline | ||
| 177 | struct tcf_block_cb *__tcf_block_cb_register(struct tcf_block *block, | ||
| 178 | tc_setup_cb_t *cb, void *cb_ident, | ||
| 179 | void *cb_priv, | ||
| 180 | struct netlink_ext_ack *extack) | ||
| 181 | { | ||
| 182 | return NULL; | ||
| 183 | } | ||
| 184 | |||
| 185 | static inline | ||
| 186 | int tcf_block_cb_register(struct tcf_block *block, | ||
| 187 | tc_setup_cb_t *cb, void *cb_ident, | ||
| 188 | void *cb_priv, struct netlink_ext_ack *extack) | ||
| 189 | { | ||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | |||
| 193 | static inline | ||
| 194 | void __tcf_block_cb_unregister(struct tcf_block *block, | ||
| 195 | struct tcf_block_cb *block_cb) | ||
| 196 | { | ||
| 197 | } | ||
| 198 | |||
| 199 | static inline | ||
| 200 | void tcf_block_cb_unregister(struct tcf_block *block, | ||
| 201 | tc_setup_cb_t *cb, void *cb_ident) | ||
| 202 | { | ||
| 203 | } | ||
| 204 | |||
| 205 | static inline | ||
| 206 | int __tc_indr_block_cb_register(struct net_device *dev, void *cb_priv, | 142 | int __tc_indr_block_cb_register(struct net_device *dev, void *cb_priv, |
| 207 | tc_indr_block_bind_cb_t *cb, void *cb_ident) | 143 | tc_indr_block_bind_cb_t *cb, void *cb_ident) |
| 208 | { | 144 | { |
| @@ -576,9 +512,6 @@ static inline int tcf_valid_offset(const struct sk_buff *skb, | |||
| 576 | (ptr <= (ptr + len))); | 512 | (ptr <= (ptr + len))); |
| 577 | } | 513 | } |
| 578 | 514 | ||
| 579 | #ifdef CONFIG_NET_CLS_IND | ||
| 580 | #include <net/net_namespace.h> | ||
| 581 | |||
| 582 | static inline int | 515 | static inline int |
| 583 | tcf_change_indev(struct net *net, struct nlattr *indev_tlv, | 516 | tcf_change_indev(struct net *net, struct nlattr *indev_tlv, |
| 584 | struct netlink_ext_ack *extack) | 517 | struct netlink_ext_ack *extack) |
| @@ -605,7 +538,6 @@ tcf_match_indev(struct sk_buff *skb, int ifindex) | |||
| 605 | return false; | 538 | return false; |
| 606 | return ifindex == skb->skb_iif; | 539 | return ifindex == skb->skb_iif; |
| 607 | } | 540 | } |
| 608 | #endif /* CONFIG_NET_CLS_IND */ | ||
| 609 | 541 | ||
| 610 | int tc_setup_flow_action(struct flow_action *flow_action, | 542 | int tc_setup_flow_action(struct flow_action *flow_action, |
| 611 | const struct tcf_exts *exts); | 543 | const struct tcf_exts *exts); |
| @@ -613,25 +545,6 @@ int tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type, | |||
| 613 | void *type_data, bool err_stop); | 545 | void *type_data, bool err_stop); |
| 614 | unsigned int tcf_exts_num_actions(struct tcf_exts *exts); | 546 | unsigned int tcf_exts_num_actions(struct tcf_exts *exts); |
| 615 | 547 | ||
| 616 | enum tc_block_command { | ||
| 617 | TC_BLOCK_BIND, | ||
| 618 | TC_BLOCK_UNBIND, | ||
| 619 | }; | ||
| 620 | |||
| 621 | struct tc_block_offload { | ||
| 622 | enum tc_block_command command; | ||
| 623 | enum tcf_block_binder_type binder_type; | ||
| 624 | struct tcf_block *block; | ||
| 625 | struct netlink_ext_ack *extack; | ||
| 626 | }; | ||
| 627 | |||
| 628 | struct tc_cls_common_offload { | ||
| 629 | u32 chain_index; | ||
| 630 | __be16 protocol; | ||
| 631 | u32 prio; | ||
| 632 | struct netlink_ext_ack *extack; | ||
| 633 | }; | ||
| 634 | |||
| 635 | struct tc_cls_u32_knode { | 548 | struct tc_cls_u32_knode { |
| 636 | struct tcf_exts *exts; | 549 | struct tcf_exts *exts; |
| 637 | struct tcf_result *res; | 550 | struct tcf_result *res; |
| @@ -659,7 +572,7 @@ enum tc_clsu32_command { | |||
| 659 | }; | 572 | }; |
| 660 | 573 | ||
| 661 | struct tc_cls_u32_offload { | 574 | struct tc_cls_u32_offload { |
| 662 | struct tc_cls_common_offload common; | 575 | struct flow_cls_common_offload common; |
| 663 | /* knode values */ | 576 | /* knode values */ |
| 664 | enum tc_clsu32_command command; | 577 | enum tc_clsu32_command command; |
| 665 | union { | 578 | union { |
| @@ -686,7 +599,7 @@ static inline bool tc_can_offload_extack(const struct net_device *dev, | |||
| 686 | 599 | ||
| 687 | static inline bool | 600 | static inline bool |
| 688 | tc_cls_can_offload_and_chain0(const struct net_device *dev, | 601 | tc_cls_can_offload_and_chain0(const struct net_device *dev, |
| 689 | struct tc_cls_common_offload *common) | 602 | struct flow_cls_common_offload *common) |
| 690 | { | 603 | { |
| 691 | if (!tc_can_offload_extack(dev, common->extack)) | 604 | if (!tc_can_offload_extack(dev, common->extack)) |
| 692 | return false; | 605 | return false; |
| @@ -728,7 +641,7 @@ static inline bool tc_in_hw(u32 flags) | |||
| 728 | } | 641 | } |
| 729 | 642 | ||
| 730 | static inline void | 643 | static inline void |
| 731 | tc_cls_common_offload_init(struct tc_cls_common_offload *cls_common, | 644 | tc_cls_common_offload_init(struct flow_cls_common_offload *cls_common, |
| 732 | const struct tcf_proto *tp, u32 flags, | 645 | const struct tcf_proto *tp, u32 flags, |
| 733 | struct netlink_ext_ack *extack) | 646 | struct netlink_ext_ack *extack) |
| 734 | { | 647 | { |
| @@ -739,29 +652,6 @@ tc_cls_common_offload_init(struct tc_cls_common_offload *cls_common, | |||
| 739 | cls_common->extack = extack; | 652 | cls_common->extack = extack; |
| 740 | } | 653 | } |
| 741 | 654 | ||
| 742 | enum tc_fl_command { | ||
| 743 | TC_CLSFLOWER_REPLACE, | ||
| 744 | TC_CLSFLOWER_DESTROY, | ||
| 745 | TC_CLSFLOWER_STATS, | ||
| 746 | TC_CLSFLOWER_TMPLT_CREATE, | ||
| 747 | TC_CLSFLOWER_TMPLT_DESTROY, | ||
| 748 | }; | ||
| 749 | |||
| 750 | struct tc_cls_flower_offload { | ||
| 751 | struct tc_cls_common_offload common; | ||
| 752 | enum tc_fl_command command; | ||
| 753 | unsigned long cookie; | ||
| 754 | struct flow_rule *rule; | ||
| 755 | struct flow_stats stats; | ||
| 756 | u32 classid; | ||
| 757 | }; | ||
| 758 | |||
| 759 | static inline struct flow_rule * | ||
| 760 | tc_cls_flower_offload_flow_rule(struct tc_cls_flower_offload *tc_flow_cmd) | ||
| 761 | { | ||
| 762 | return tc_flow_cmd->rule; | ||
| 763 | } | ||
| 764 | |||
| 765 | enum tc_matchall_command { | 655 | enum tc_matchall_command { |
| 766 | TC_CLSMATCHALL_REPLACE, | 656 | TC_CLSMATCHALL_REPLACE, |
| 767 | TC_CLSMATCHALL_DESTROY, | 657 | TC_CLSMATCHALL_DESTROY, |
| @@ -769,7 +659,7 @@ enum tc_matchall_command { | |||
| 769 | }; | 659 | }; |
| 770 | 660 | ||
| 771 | struct tc_cls_matchall_offload { | 661 | struct tc_cls_matchall_offload { |
| 772 | struct tc_cls_common_offload common; | 662 | struct flow_cls_common_offload common; |
| 773 | enum tc_matchall_command command; | 663 | enum tc_matchall_command command; |
| 774 | struct flow_rule *rule; | 664 | struct flow_rule *rule; |
| 775 | struct flow_stats stats; | 665 | struct flow_stats stats; |
| @@ -782,7 +672,7 @@ enum tc_clsbpf_command { | |||
| 782 | }; | 672 | }; |
| 783 | 673 | ||
| 784 | struct tc_cls_bpf_offload { | 674 | struct tc_cls_bpf_offload { |
| 785 | struct tc_cls_common_offload common; | 675 | struct flow_cls_common_offload common; |
| 786 | enum tc_clsbpf_command command; | 676 | enum tc_clsbpf_command command; |
| 787 | struct tcf_exts *exts; | 677 | struct tcf_exts *exts; |
| 788 | struct bpf_prog *prog; | 678 | struct bpf_prog *prog; |
diff --git a/include/net/route.h b/include/net/route.h index 55ff71ffb796..630a0493f1f3 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
| @@ -231,6 +231,10 @@ void fib_modify_prefix_metric(struct in_ifaddr *ifa, u32 new_metric); | |||
| 231 | void rt_add_uncached_list(struct rtable *rt); | 231 | void rt_add_uncached_list(struct rtable *rt); |
| 232 | void rt_del_uncached_list(struct rtable *rt); | 232 | void rt_del_uncached_list(struct rtable *rt); |
| 233 | 233 | ||
| 234 | int fib_dump_info_fnhe(struct sk_buff *skb, struct netlink_callback *cb, | ||
| 235 | u32 table_id, struct fib_info *fi, | ||
| 236 | int *fa_index, int fa_start); | ||
| 237 | |||
| 234 | static inline void ip_rt_put(struct rtable *rt) | 238 | static inline void ip_rt_put(struct rtable *rt) |
| 235 | { | 239 | { |
| 236 | /* dst_release() accepts a NULL parameter. | 240 | /* dst_release() accepts a NULL parameter. |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 21f434f3ac9e..855167bbc372 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
| @@ -279,7 +279,7 @@ struct tcf_result { | |||
| 279 | }; | 279 | }; |
| 280 | const struct tcf_proto *goto_tp; | 280 | const struct tcf_proto *goto_tp; |
| 281 | 281 | ||
| 282 | /* used by the TC_ACT_REINSERT action */ | 282 | /* used in the skb_tc_reinsert function */ |
| 283 | struct { | 283 | struct { |
| 284 | bool ingress; | 284 | bool ingress; |
| 285 | struct gnet_stats_queue *qstats; | 285 | struct gnet_stats_queue *qstats; |
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h index 314699333bec..5a9bb09f32b6 100644 --- a/include/net/sctp/checksum.h +++ b/include/net/sctp/checksum.h | |||
| @@ -43,19 +43,21 @@ static inline __wsum sctp_csum_combine(__wsum csum, __wsum csum2, | |||
| 43 | (__force __u32)csum2, len); | 43 | (__force __u32)csum2, len); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | static const struct skb_checksum_ops sctp_csum_ops = { | ||
| 47 | .update = sctp_csum_update, | ||
| 48 | .combine = sctp_csum_combine, | ||
| 49 | }; | ||
| 50 | |||
| 46 | static inline __le32 sctp_compute_cksum(const struct sk_buff *skb, | 51 | static inline __le32 sctp_compute_cksum(const struct sk_buff *skb, |
| 47 | unsigned int offset) | 52 | unsigned int offset) |
| 48 | { | 53 | { |
| 49 | struct sctphdr *sh = (struct sctphdr *)(skb->data + offset); | 54 | struct sctphdr *sh = (struct sctphdr *)(skb->data + offset); |
| 50 | const struct skb_checksum_ops ops = { | ||
| 51 | .update = sctp_csum_update, | ||
| 52 | .combine = sctp_csum_combine, | ||
| 53 | }; | ||
| 54 | __le32 old = sh->checksum; | 55 | __le32 old = sh->checksum; |
| 55 | __wsum new; | 56 | __wsum new; |
| 56 | 57 | ||
| 57 | sh->checksum = 0; | 58 | sh->checksum = 0; |
| 58 | new = ~__skb_checksum(skb, offset, skb->len - offset, ~(__wsum)0, &ops); | 59 | new = ~__skb_checksum(skb, offset, skb->len - offset, ~(__wsum)0, |
| 60 | &sctp_csum_ops); | ||
| 59 | sh->checksum = old; | 61 | sh->checksum = old; |
| 60 | 62 | ||
| 61 | return cpu_to_le32((__force __u32)new); | 63 | return cpu_to_le32((__force __u32)new); |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 0767701ef362..ba5c4f6eede5 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
| @@ -219,7 +219,6 @@ struct sctp_sock { | |||
| 219 | disable_fragments:1, | 219 | disable_fragments:1, |
| 220 | v4mapped:1, | 220 | v4mapped:1, |
| 221 | frag_interleave:1, | 221 | frag_interleave:1, |
| 222 | strm_interleave:1, | ||
| 223 | recvrcvinfo:1, | 222 | recvrcvinfo:1, |
| 224 | recvnxtinfo:1, | 223 | recvnxtinfo:1, |
| 225 | data_ready_signalled:1; | 224 | data_ready_signalled:1; |
| @@ -1324,6 +1323,7 @@ struct sctp_endpoint { | |||
| 1324 | struct list_head endpoint_shared_keys; | 1323 | struct list_head endpoint_shared_keys; |
| 1325 | __u16 active_key_id; | 1324 | __u16 active_key_id; |
| 1326 | __u8 auth_enable:1, | 1325 | __u8 auth_enable:1, |
| 1326 | intl_enable:1, | ||
| 1327 | prsctp_enable:1, | 1327 | prsctp_enable:1, |
| 1328 | reconf_enable:1; | 1328 | reconf_enable:1; |
| 1329 | 1329 | ||
| @@ -1679,28 +1679,30 @@ struct sctp_association { | |||
| 1679 | __be16 addip_disabled_mask; | 1679 | __be16 addip_disabled_mask; |
| 1680 | 1680 | ||
| 1681 | /* These are capabilities which our peer advertised. */ | 1681 | /* These are capabilities which our peer advertised. */ |
| 1682 | __u8 ecn_capable:1, /* Can peer do ECN? */ | 1682 | __u16 ecn_capable:1, /* Can peer do ECN? */ |
| 1683 | ipv4_address:1, /* Peer understands IPv4 addresses? */ | 1683 | ipv4_address:1, /* Peer understands IPv4 addresses? */ |
| 1684 | ipv6_address:1, /* Peer understands IPv6 addresses? */ | 1684 | ipv6_address:1, /* Peer understands IPv6 addresses? */ |
| 1685 | hostname_address:1, /* Peer understands DNS addresses? */ | 1685 | hostname_address:1, /* Peer understands DNS addresses? */ |
| 1686 | asconf_capable:1, /* Does peer support ADDIP? */ | 1686 | asconf_capable:1, /* Does peer support ADDIP? */ |
| 1687 | prsctp_capable:1, /* Can peer do PR-SCTP? */ | 1687 | prsctp_capable:1, /* Can peer do PR-SCTP? */ |
| 1688 | reconf_capable:1, /* Can peer do RE-CONFIG? */ | 1688 | reconf_capable:1, /* Can peer do RE-CONFIG? */ |
| 1689 | auth_capable:1; /* Is peer doing SCTP-AUTH? */ | 1689 | intl_capable:1, /* Can peer do INTERLEAVE */ |
| 1690 | 1690 | auth_capable:1, /* Is peer doing SCTP-AUTH? */ | |
| 1691 | /* sack_needed : This flag indicates if the next received | 1691 | /* sack_needed: |
| 1692 | * : packet is to be responded to with a | 1692 | * This flag indicates if the next received |
| 1693 | * : SACK. This is initialized to 0. When a packet | 1693 | * packet is to be responded to with a |
| 1694 | * : is received sack_cnt is incremented. If this value | 1694 | * SACK. This is initialized to 0. When a packet |
| 1695 | * : reaches 2 or more, a SACK is sent and the | 1695 | * is received sack_cnt is incremented. If this value |
| 1696 | * : value is reset to 0. Note: This is used only | 1696 | * reaches 2 or more, a SACK is sent and the |
| 1697 | * : when no DATA chunks are received out of | 1697 | * value is reset to 0. Note: This is used only |
| 1698 | * : order. When DATA chunks are out of order, | 1698 | * when no DATA chunks are received out of |
| 1699 | * : SACK's are not delayed (see Section 6). | 1699 | * order. When DATA chunks are out of order, |
| 1700 | */ | 1700 | * SACK's are not delayed (see Section 6). |
| 1701 | __u8 sack_needed:1, /* Do we need to sack the peer? */ | 1701 | */ |
| 1702 | sack_needed:1, /* Do we need to sack the peer? */ | ||
| 1702 | sack_generation:1, | 1703 | sack_generation:1, |
| 1703 | zero_window_announced:1; | 1704 | zero_window_announced:1; |
| 1705 | |||
| 1704 | __u32 sack_cnt; | 1706 | __u32 sack_cnt; |
| 1705 | 1707 | ||
| 1706 | __u32 adaptation_ind; /* Adaptation Code point. */ | 1708 | __u32 adaptation_ind; /* Adaptation Code point. */ |
| @@ -2049,10 +2051,7 @@ struct sctp_association { | |||
| 2049 | 2051 | ||
| 2050 | __u8 need_ecne:1, /* Need to send an ECNE Chunk? */ | 2052 | __u8 need_ecne:1, /* Need to send an ECNE Chunk? */ |
| 2051 | temp:1, /* Is it a temporary association? */ | 2053 | temp:1, /* Is it a temporary association? */ |
| 2052 | force_delay:1, | 2054 | force_delay:1; |
| 2053 | intl_enable:1, | ||
| 2054 | prsctp_enable:1, | ||
| 2055 | reconf_enable:1; | ||
| 2056 | 2055 | ||
| 2057 | __u8 strreset_enable; | 2056 | __u8 strreset_enable; |
| 2058 | __u8 strreset_outstanding; /* request param count on the fly */ | 2057 | __u8 strreset_outstanding; /* request param count on the fly */ |
diff --git a/include/net/sock.h b/include/net/sock.h index 6cbc16136357..228db3998e46 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -1822,7 +1822,7 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) | |||
| 1822 | { | 1822 | { |
| 1823 | WARN_ON(parent->sk); | 1823 | WARN_ON(parent->sk); |
| 1824 | write_lock_bh(&sk->sk_callback_lock); | 1824 | write_lock_bh(&sk->sk_callback_lock); |
| 1825 | rcu_assign_pointer(sk->sk_wq, parent->wq); | 1825 | rcu_assign_pointer(sk->sk_wq, &parent->wq); |
| 1826 | parent->sk = sk; | 1826 | parent->sk = sk; |
| 1827 | sk_set_socket(sk, parent); | 1827 | sk_set_socket(sk, parent); |
| 1828 | sk->sk_uid = SOCK_INODE(parent)->i_uid; | 1828 | sk->sk_uid = SOCK_INODE(parent)->i_uid; |
| @@ -2100,7 +2100,7 @@ static inline void sock_poll_wait(struct file *filp, struct socket *sock, | |||
| 2100 | poll_table *p) | 2100 | poll_table *p) |
| 2101 | { | 2101 | { |
| 2102 | if (!poll_does_not_wait(p)) { | 2102 | if (!poll_does_not_wait(p)) { |
| 2103 | poll_wait(filp, &sock->wq->wait, p); | 2103 | poll_wait(filp, &sock->wq.wait, p); |
| 2104 | /* We need to be sure we are in sync with the | 2104 | /* We need to be sure we are in sync with the |
| 2105 | * socket flags modification. | 2105 | * socket flags modification. |
| 2106 | * | 2106 | * |
diff --git a/include/net/sock_reuseport.h b/include/net/sock_reuseport.h index 8a5f70c7cdf2..d9112de85261 100644 --- a/include/net/sock_reuseport.h +++ b/include/net/sock_reuseport.h | |||
| @@ -35,6 +35,8 @@ extern struct sock *reuseport_select_sock(struct sock *sk, | |||
| 35 | struct sk_buff *skb, | 35 | struct sk_buff *skb, |
| 36 | int hdr_len); | 36 | int hdr_len); |
| 37 | extern int reuseport_attach_prog(struct sock *sk, struct bpf_prog *prog); | 37 | extern int reuseport_attach_prog(struct sock *sk, struct bpf_prog *prog); |
| 38 | extern int reuseport_detach_prog(struct sock *sk); | ||
| 39 | |||
| 38 | int reuseport_get_id(struct sock_reuseport *reuse); | 40 | int reuseport_get_id(struct sock_reuseport *reuse); |
| 39 | 41 | ||
| 40 | #endif /* _SOCK_REUSEPORT_H */ | 42 | #endif /* _SOCK_REUSEPORT_H */ |
diff --git a/include/net/tc_act/tc_ct.h b/include/net/tc_act/tc_ct.h new file mode 100644 index 000000000000..bdc20ab3b88d --- /dev/null +++ b/include/net/tc_act/tc_ct.h | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __NET_TC_CT_H | ||
| 3 | #define __NET_TC_CT_H | ||
| 4 | |||
| 5 | #include <net/act_api.h> | ||
| 6 | #include <uapi/linux/tc_act/tc_ct.h> | ||
| 7 | |||
| 8 | #if IS_ENABLED(CONFIG_NF_CONNTRACK) | ||
| 9 | #include <net/netfilter/nf_nat.h> | ||
| 10 | #include <net/netfilter/nf_conntrack_labels.h> | ||
| 11 | |||
| 12 | struct tcf_ct_params { | ||
| 13 | struct nf_conn *tmpl; | ||
| 14 | u16 zone; | ||
| 15 | |||
| 16 | u32 mark; | ||
| 17 | u32 mark_mask; | ||
| 18 | |||
| 19 | u32 labels[NF_CT_LABELS_MAX_SIZE / sizeof(u32)]; | ||
| 20 | u32 labels_mask[NF_CT_LABELS_MAX_SIZE / sizeof(u32)]; | ||
| 21 | |||
| 22 | struct nf_nat_range2 range; | ||
| 23 | bool ipv4_range; | ||
| 24 | |||
| 25 | u16 ct_action; | ||
| 26 | |||
| 27 | struct rcu_head rcu; | ||
| 28 | }; | ||
| 29 | |||
| 30 | struct tcf_ct { | ||
| 31 | struct tc_action common; | ||
| 32 | struct tcf_ct_params __rcu *params; | ||
| 33 | }; | ||
| 34 | |||
| 35 | #define to_ct(a) ((struct tcf_ct *)a) | ||
| 36 | #define to_ct_params(a) ((struct tcf_ct_params *) \ | ||
| 37 | rtnl_dereference((to_ct(a)->params))) | ||
| 38 | |||
| 39 | static inline uint16_t tcf_ct_zone(const struct tc_action *a) | ||
| 40 | { | ||
| 41 | return to_ct_params(a)->zone; | ||
| 42 | } | ||
| 43 | |||
| 44 | static inline int tcf_ct_action(const struct tc_action *a) | ||
| 45 | { | ||
| 46 | return to_ct_params(a)->ct_action; | ||
| 47 | } | ||
| 48 | |||
| 49 | #else | ||
| 50 | static inline uint16_t tcf_ct_zone(const struct tc_action *a) { return 0; } | ||
| 51 | static inline int tcf_ct_action(const struct tc_action *a) { return 0; } | ||
| 52 | #endif /* CONFIG_NF_CONNTRACK */ | ||
| 53 | |||
| 54 | static inline bool is_tcf_ct(const struct tc_action *a) | ||
| 55 | { | ||
| 56 | #if defined(CONFIG_NET_CLS_ACT) && IS_ENABLED(CONFIG_NF_CONNTRACK) | ||
| 57 | if (a->ops && a->ops->id == TCA_ID_CT) | ||
| 58 | return true; | ||
| 59 | #endif | ||
| 60 | return false; | ||
| 61 | } | ||
| 62 | |||
| 63 | #endif /* __NET_TC_CT_H */ | ||
diff --git a/include/net/tc_act/tc_ctinfo.h b/include/net/tc_act/tc_ctinfo.h new file mode 100644 index 000000000000..f071c1d70a25 --- /dev/null +++ b/include/net/tc_act/tc_ctinfo.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __NET_TC_CTINFO_H | ||
| 3 | #define __NET_TC_CTINFO_H | ||
| 4 | |||
| 5 | #include <net/act_api.h> | ||
| 6 | |||
| 7 | struct tcf_ctinfo_params { | ||
| 8 | struct rcu_head rcu; | ||
| 9 | struct net *net; | ||
| 10 | u32 dscpmask; | ||
| 11 | u32 dscpstatemask; | ||
| 12 | u32 cpmarkmask; | ||
| 13 | u16 zone; | ||
| 14 | u8 mode; | ||
| 15 | u8 dscpmaskshift; | ||
| 16 | }; | ||
| 17 | |||
| 18 | struct tcf_ctinfo { | ||
| 19 | struct tc_action common; | ||
| 20 | struct tcf_ctinfo_params __rcu *params; | ||
| 21 | u64 stats_dscp_set; | ||
| 22 | u64 stats_dscp_error; | ||
| 23 | u64 stats_cpmark_set; | ||
| 24 | }; | ||
| 25 | |||
| 26 | enum { | ||
| 27 | CTINFO_MODE_DSCP = BIT(0), | ||
| 28 | CTINFO_MODE_CPMARK = BIT(1) | ||
| 29 | }; | ||
| 30 | |||
| 31 | #define to_ctinfo(a) ((struct tcf_ctinfo *)a) | ||
| 32 | |||
| 33 | #endif /* __NET_TC_CTINFO_H */ | ||
diff --git a/include/net/tc_act/tc_mpls.h b/include/net/tc_act/tc_mpls.h new file mode 100644 index 000000000000..4bc3d9250ef0 --- /dev/null +++ b/include/net/tc_act/tc_mpls.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ | ||
| 2 | /* Copyright (C) 2019 Netronome Systems, Inc. */ | ||
| 3 | |||
| 4 | #ifndef __NET_TC_MPLS_H | ||
| 5 | #define __NET_TC_MPLS_H | ||
| 6 | |||
| 7 | #include <linux/tc_act/tc_mpls.h> | ||
| 8 | #include <net/act_api.h> | ||
| 9 | |||
| 10 | struct tcf_mpls_params { | ||
| 11 | int tcfm_action; | ||
| 12 | u32 tcfm_label; | ||
| 13 | u8 tcfm_tc; | ||
| 14 | u8 tcfm_ttl; | ||
| 15 | u8 tcfm_bos; | ||
| 16 | __be16 tcfm_proto; | ||
| 17 | struct rcu_head rcu; | ||
| 18 | }; | ||
| 19 | |||
| 20 | #define ACT_MPLS_TC_NOT_SET 0xff | ||
| 21 | #define ACT_MPLS_BOS_NOT_SET 0xff | ||
| 22 | #define ACT_MPLS_LABEL_NOT_SET 0xffffffff | ||
| 23 | |||
| 24 | struct tcf_mpls { | ||
| 25 | struct tc_action common; | ||
| 26 | struct tcf_mpls_params __rcu *mpls_p; | ||
| 27 | }; | ||
| 28 | #define to_mpls(a) ((struct tcf_mpls *)a) | ||
| 29 | |||
| 30 | #endif /* __NET_TC_MPLS_H */ | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index 582c0caa9811..cca3c59b98bf 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #include <linux/seq_file.h> | 43 | #include <linux/seq_file.h> |
| 44 | #include <linux/memcontrol.h> | 44 | #include <linux/memcontrol.h> |
| 45 | #include <linux/bpf-cgroup.h> | 45 | #include <linux/bpf-cgroup.h> |
| 46 | #include <linux/siphash.h> | ||
| 46 | 47 | ||
| 47 | extern struct inet_hashinfo tcp_hashinfo; | 48 | extern struct inet_hashinfo tcp_hashinfo; |
| 48 | 49 | ||
| @@ -1612,7 +1613,7 @@ void tcp_free_fastopen_req(struct tcp_sock *tp); | |||
| 1612 | void tcp_fastopen_destroy_cipher(struct sock *sk); | 1613 | void tcp_fastopen_destroy_cipher(struct sock *sk); |
| 1613 | void tcp_fastopen_ctx_destroy(struct net *net); | 1614 | void tcp_fastopen_ctx_destroy(struct net *net); |
| 1614 | int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk, | 1615 | int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk, |
| 1615 | void *key, unsigned int len); | 1616 | void *primary_key, void *backup_key); |
| 1616 | void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb); | 1617 | void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb); |
| 1617 | struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, | 1618 | struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, |
| 1618 | struct request_sock *req, | 1619 | struct request_sock *req, |
| @@ -1622,13 +1623,16 @@ void tcp_fastopen_init_key_once(struct net *net); | |||
| 1622 | bool tcp_fastopen_cookie_check(struct sock *sk, u16 *mss, | 1623 | bool tcp_fastopen_cookie_check(struct sock *sk, u16 *mss, |
| 1623 | struct tcp_fastopen_cookie *cookie); | 1624 | struct tcp_fastopen_cookie *cookie); |
| 1624 | bool tcp_fastopen_defer_connect(struct sock *sk, int *err); | 1625 | bool tcp_fastopen_defer_connect(struct sock *sk, int *err); |
| 1625 | #define TCP_FASTOPEN_KEY_LENGTH 16 | 1626 | #define TCP_FASTOPEN_KEY_LENGTH sizeof(siphash_key_t) |
| 1627 | #define TCP_FASTOPEN_KEY_MAX 2 | ||
| 1628 | #define TCP_FASTOPEN_KEY_BUF_LENGTH \ | ||
| 1629 | (TCP_FASTOPEN_KEY_LENGTH * TCP_FASTOPEN_KEY_MAX) | ||
| 1626 | 1630 | ||
| 1627 | /* Fastopen key context */ | 1631 | /* Fastopen key context */ |
| 1628 | struct tcp_fastopen_context { | 1632 | struct tcp_fastopen_context { |
| 1629 | struct crypto_cipher *tfm; | 1633 | siphash_key_t key[TCP_FASTOPEN_KEY_MAX]; |
| 1630 | __u8 key[TCP_FASTOPEN_KEY_LENGTH]; | 1634 | int num; |
| 1631 | struct rcu_head rcu; | 1635 | struct rcu_head rcu; |
| 1632 | }; | 1636 | }; |
| 1633 | 1637 | ||
| 1634 | extern unsigned int sysctl_tcp_fastopen_blackhole_timeout; | 1638 | extern unsigned int sysctl_tcp_fastopen_blackhole_timeout; |
| @@ -1637,6 +1641,35 @@ bool tcp_fastopen_active_should_disable(struct sock *sk); | |||
| 1637 | void tcp_fastopen_active_disable_ofo_check(struct sock *sk); | 1641 | void tcp_fastopen_active_disable_ofo_check(struct sock *sk); |
| 1638 | void tcp_fastopen_active_detect_blackhole(struct sock *sk, bool expired); | 1642 | void tcp_fastopen_active_detect_blackhole(struct sock *sk, bool expired); |
| 1639 | 1643 | ||
| 1644 | /* Caller needs to wrap with rcu_read_(un)lock() */ | ||
| 1645 | static inline | ||
| 1646 | struct tcp_fastopen_context *tcp_fastopen_get_ctx(const struct sock *sk) | ||
| 1647 | { | ||
| 1648 | struct tcp_fastopen_context *ctx; | ||
| 1649 | |||
| 1650 | ctx = rcu_dereference(inet_csk(sk)->icsk_accept_queue.fastopenq.ctx); | ||
| 1651 | if (!ctx) | ||
| 1652 | ctx = rcu_dereference(sock_net(sk)->ipv4.tcp_fastopen_ctx); | ||
| 1653 | return ctx; | ||
| 1654 | } | ||
| 1655 | |||
| 1656 | static inline | ||
| 1657 | bool tcp_fastopen_cookie_match(const struct tcp_fastopen_cookie *foc, | ||
| 1658 | const struct tcp_fastopen_cookie *orig) | ||
| 1659 | { | ||
| 1660 | if (orig->len == TCP_FASTOPEN_COOKIE_SIZE && | ||
| 1661 | orig->len == foc->len && | ||
| 1662 | !memcmp(orig->val, foc->val, foc->len)) | ||
| 1663 | return true; | ||
| 1664 | return false; | ||
| 1665 | } | ||
| 1666 | |||
| 1667 | static inline | ||
| 1668 | int tcp_fastopen_context_len(const struct tcp_fastopen_context *ctx) | ||
| 1669 | { | ||
| 1670 | return ctx->num; | ||
| 1671 | } | ||
| 1672 | |||
| 1640 | /* Latencies incurred by various limits for a sender. They are | 1673 | /* Latencies incurred by various limits for a sender. They are |
| 1641 | * chronograph-like stats that are mutually exclusive. | 1674 | * chronograph-like stats that are mutually exclusive. |
| 1642 | */ | 1675 | */ |
| @@ -2188,6 +2221,12 @@ static inline bool tcp_bpf_ca_needs_ecn(struct sock *sk) | |||
| 2188 | return (tcp_call_bpf(sk, BPF_SOCK_OPS_NEEDS_ECN, 0, NULL) == 1); | 2221 | return (tcp_call_bpf(sk, BPF_SOCK_OPS_NEEDS_ECN, 0, NULL) == 1); |
| 2189 | } | 2222 | } |
| 2190 | 2223 | ||
| 2224 | static inline void tcp_bpf_rtt(struct sock *sk) | ||
| 2225 | { | ||
| 2226 | if (BPF_SOCK_OPS_TEST_FLAG(tcp_sk(sk), BPF_SOCK_OPS_RTT_CB_FLAG)) | ||
| 2227 | tcp_call_bpf(sk, BPF_SOCK_OPS_RTT_CB, 0, NULL); | ||
| 2228 | } | ||
| 2229 | |||
| 2191 | #if IS_ENABLED(CONFIG_SMC) | 2230 | #if IS_ENABLED(CONFIG_SMC) |
| 2192 | extern struct static_key_false tcp_have_smc; | 2231 | extern struct static_key_false tcp_have_smc; |
| 2193 | #endif | 2232 | #endif |
| @@ -2199,4 +2238,26 @@ void clean_acked_data_disable(struct inet_connection_sock *icsk); | |||
| 2199 | void clean_acked_data_flush(void); | 2238 | void clean_acked_data_flush(void); |
| 2200 | #endif | 2239 | #endif |
| 2201 | 2240 | ||
| 2241 | DECLARE_STATIC_KEY_FALSE(tcp_tx_delay_enabled); | ||
| 2242 | static inline void tcp_add_tx_delay(struct sk_buff *skb, | ||
| 2243 | const struct tcp_sock *tp) | ||
| 2244 | { | ||
| 2245 | if (static_branch_unlikely(&tcp_tx_delay_enabled)) | ||
| 2246 | skb->skb_mstamp_ns += (u64)tp->tcp_tx_delay * NSEC_PER_USEC; | ||
| 2247 | } | ||
| 2248 | |||
| 2249 | /* Compute Earliest Departure Time for some control packets | ||
| 2250 | * like ACK or RST for TIME_WAIT or non ESTABLISHED sockets. | ||
| 2251 | */ | ||
| 2252 | static inline u64 tcp_transmit_time(const struct sock *sk) | ||
| 2253 | { | ||
| 2254 | if (static_branch_unlikely(&tcp_tx_delay_enabled)) { | ||
| 2255 | u32 delay = (sk->sk_state == TCP_TIME_WAIT) ? | ||
| 2256 | tcp_twsk(sk)->tw_tx_delay : tcp_sk(sk)->tcp_tx_delay; | ||
| 2257 | |||
| 2258 | return tcp_clock_ns() + (u64)delay * NSEC_PER_USEC; | ||
| 2259 | } | ||
| 2260 | return 0; | ||
| 2261 | } | ||
| 2262 | |||
| 2202 | #endif /* _TCP_H */ | 2263 | #endif /* _TCP_H */ |
diff --git a/include/net/tls.h b/include/net/tls.h index 53d96bca220d..584609174fe0 100644 --- a/include/net/tls.h +++ b/include/net/tls.h | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include <linux/socket.h> | 40 | #include <linux/socket.h> |
| 41 | #include <linux/tcp.h> | 41 | #include <linux/tcp.h> |
| 42 | #include <linux/skmsg.h> | 42 | #include <linux/skmsg.h> |
| 43 | #include <linux/netdevice.h> | ||
| 43 | 44 | ||
| 44 | #include <net/tcp.h> | 45 | #include <net/tcp.h> |
| 45 | #include <net/strparser.h> | 46 | #include <net/strparser.h> |
| @@ -61,6 +62,7 @@ | |||
| 61 | #define TLS_DEVICE_NAME_MAX 32 | 62 | #define TLS_DEVICE_NAME_MAX 32 |
| 62 | 63 | ||
| 63 | #define MAX_IV_SIZE 16 | 64 | #define MAX_IV_SIZE 16 |
| 65 | #define TLS_MAX_REC_SEQ_SIZE 8 | ||
| 64 | 66 | ||
| 65 | /* For AES-CCM, the full 16-bytes of IV is made of '4' fields of given sizes. | 67 | /* For AES-CCM, the full 16-bytes of IV is made of '4' fields of given sizes. |
| 66 | * | 68 | * |
| @@ -197,20 +199,24 @@ struct tls_offload_context_tx { | |||
| 197 | 199 | ||
| 198 | struct scatterlist sg_tx_data[MAX_SKB_FRAGS]; | 200 | struct scatterlist sg_tx_data[MAX_SKB_FRAGS]; |
| 199 | void (*sk_destruct)(struct sock *sk); | 201 | void (*sk_destruct)(struct sock *sk); |
| 200 | u8 driver_state[]; | 202 | u8 driver_state[] __aligned(8); |
| 201 | /* The TLS layer reserves room for driver specific state | 203 | /* The TLS layer reserves room for driver specific state |
| 202 | * Currently the belief is that there is not enough | 204 | * Currently the belief is that there is not enough |
| 203 | * driver specific state to justify another layer of indirection | 205 | * driver specific state to justify another layer of indirection |
| 204 | */ | 206 | */ |
| 205 | #define TLS_DRIVER_STATE_SIZE (max_t(size_t, 8, sizeof(void *))) | 207 | #define TLS_DRIVER_STATE_SIZE_TX 16 |
| 206 | }; | 208 | }; |
| 207 | 209 | ||
| 208 | #define TLS_OFFLOAD_CONTEXT_SIZE_TX \ | 210 | #define TLS_OFFLOAD_CONTEXT_SIZE_TX \ |
| 209 | (ALIGN(sizeof(struct tls_offload_context_tx), sizeof(void *)) + \ | 211 | (sizeof(struct tls_offload_context_tx) + TLS_DRIVER_STATE_SIZE_TX) |
| 210 | TLS_DRIVER_STATE_SIZE) | ||
| 211 | 212 | ||
| 212 | enum tls_context_flags { | 213 | enum tls_context_flags { |
| 213 | TLS_RX_SYNC_RUNNING = 0, | 214 | TLS_RX_SYNC_RUNNING = 0, |
| 215 | /* Unlike RX where resync is driven entirely by the core in TX only | ||
| 216 | * the driver knows when things went out of sync, so we need the flag | ||
| 217 | * to be atomic. | ||
| 218 | */ | ||
| 219 | TLS_TX_SYNC_SCHED = 1, | ||
| 214 | }; | 220 | }; |
| 215 | 221 | ||
| 216 | struct cipher_context { | 222 | struct cipher_context { |
| @@ -240,34 +246,32 @@ struct tls_prot_info { | |||
| 240 | }; | 246 | }; |
| 241 | 247 | ||
| 242 | struct tls_context { | 248 | struct tls_context { |
| 249 | /* read-only cache line */ | ||
| 243 | struct tls_prot_info prot_info; | 250 | struct tls_prot_info prot_info; |
| 244 | 251 | ||
| 245 | union tls_crypto_context crypto_send; | 252 | u8 tx_conf:3; |
| 246 | union tls_crypto_context crypto_recv; | 253 | u8 rx_conf:3; |
| 247 | 254 | ||
| 248 | struct list_head list; | 255 | int (*push_pending_record)(struct sock *sk, int flags); |
| 249 | struct net_device *netdev; | 256 | void (*sk_write_space)(struct sock *sk); |
| 250 | refcount_t refcount; | ||
| 251 | 257 | ||
| 252 | void *priv_ctx_tx; | 258 | void *priv_ctx_tx; |
| 253 | void *priv_ctx_rx; | 259 | void *priv_ctx_rx; |
| 254 | 260 | ||
| 255 | u8 tx_conf:3; | 261 | struct net_device *netdev; |
| 256 | u8 rx_conf:3; | ||
| 257 | 262 | ||
| 263 | /* rw cache line */ | ||
| 258 | struct cipher_context tx; | 264 | struct cipher_context tx; |
| 259 | struct cipher_context rx; | 265 | struct cipher_context rx; |
| 260 | 266 | ||
| 261 | struct scatterlist *partially_sent_record; | 267 | struct scatterlist *partially_sent_record; |
| 262 | u16 partially_sent_offset; | 268 | u16 partially_sent_offset; |
| 263 | 269 | ||
| 264 | unsigned long flags; | ||
| 265 | bool in_tcp_sendpages; | 270 | bool in_tcp_sendpages; |
| 266 | bool pending_open_record_frags; | 271 | bool pending_open_record_frags; |
| 272 | unsigned long flags; | ||
| 267 | 273 | ||
| 268 | int (*push_pending_record)(struct sock *sk, int flags); | 274 | /* cache cold stuff */ |
| 269 | |||
| 270 | void (*sk_write_space)(struct sock *sk); | ||
| 271 | void (*sk_destruct)(struct sock *sk); | 275 | void (*sk_destruct)(struct sock *sk); |
| 272 | void (*sk_proto_close)(struct sock *sk, long timeout); | 276 | void (*sk_proto_close)(struct sock *sk, long timeout); |
| 273 | 277 | ||
| @@ -279,6 +283,12 @@ struct tls_context { | |||
| 279 | int __user *optlen); | 283 | int __user *optlen); |
| 280 | int (*hash)(struct sock *sk); | 284 | int (*hash)(struct sock *sk); |
| 281 | void (*unhash)(struct sock *sk); | 285 | void (*unhash)(struct sock *sk); |
| 286 | |||
| 287 | union tls_crypto_context crypto_send; | ||
| 288 | union tls_crypto_context crypto_recv; | ||
| 289 | |||
| 290 | struct list_head list; | ||
| 291 | refcount_t refcount; | ||
| 282 | }; | 292 | }; |
| 283 | 293 | ||
| 284 | enum tls_offload_ctx_dir { | 294 | enum tls_offload_ctx_dir { |
| @@ -294,25 +304,50 @@ struct tlsdev_ops { | |||
| 294 | void (*tls_dev_del)(struct net_device *netdev, | 304 | void (*tls_dev_del)(struct net_device *netdev, |
| 295 | struct tls_context *ctx, | 305 | struct tls_context *ctx, |
| 296 | enum tls_offload_ctx_dir direction); | 306 | enum tls_offload_ctx_dir direction); |
| 297 | void (*tls_dev_resync_rx)(struct net_device *netdev, | 307 | int (*tls_dev_resync)(struct net_device *netdev, |
| 298 | struct sock *sk, u32 seq, u64 rcd_sn); | 308 | struct sock *sk, u32 seq, u8 *rcd_sn, |
| 309 | enum tls_offload_ctx_dir direction); | ||
| 299 | }; | 310 | }; |
| 300 | 311 | ||
| 312 | enum tls_offload_sync_type { | ||
| 313 | TLS_OFFLOAD_SYNC_TYPE_DRIVER_REQ = 0, | ||
| 314 | TLS_OFFLOAD_SYNC_TYPE_CORE_NEXT_HINT = 1, | ||
| 315 | }; | ||
| 316 | |||
| 317 | #define TLS_DEVICE_RESYNC_NH_START_IVAL 2 | ||
| 318 | #define TLS_DEVICE_RESYNC_NH_MAX_IVAL 128 | ||
| 319 | |||
| 301 | struct tls_offload_context_rx { | 320 | struct tls_offload_context_rx { |
| 302 | /* sw must be the first member of tls_offload_context_rx */ | 321 | /* sw must be the first member of tls_offload_context_rx */ |
| 303 | struct tls_sw_context_rx sw; | 322 | struct tls_sw_context_rx sw; |
| 304 | atomic64_t resync_req; | 323 | enum tls_offload_sync_type resync_type; |
| 305 | u8 driver_state[]; | 324 | /* this member is set regardless of resync_type, to avoid branches */ |
| 325 | u8 resync_nh_reset:1; | ||
| 326 | /* CORE_NEXT_HINT-only member, but use the hole here */ | ||
| 327 | u8 resync_nh_do_now:1; | ||
| 328 | union { | ||
| 329 | /* TLS_OFFLOAD_SYNC_TYPE_DRIVER_REQ */ | ||
| 330 | struct { | ||
| 331 | atomic64_t resync_req; | ||
| 332 | }; | ||
| 333 | /* TLS_OFFLOAD_SYNC_TYPE_CORE_NEXT_HINT */ | ||
| 334 | struct { | ||
| 335 | u32 decrypted_failed; | ||
| 336 | u32 decrypted_tgt; | ||
| 337 | } resync_nh; | ||
| 338 | }; | ||
| 339 | u8 driver_state[] __aligned(8); | ||
| 306 | /* The TLS layer reserves room for driver specific state | 340 | /* The TLS layer reserves room for driver specific state |
| 307 | * Currently the belief is that there is not enough | 341 | * Currently the belief is that there is not enough |
| 308 | * driver specific state to justify another layer of indirection | 342 | * driver specific state to justify another layer of indirection |
| 309 | */ | 343 | */ |
| 344 | #define TLS_DRIVER_STATE_SIZE_RX 8 | ||
| 310 | }; | 345 | }; |
| 311 | 346 | ||
| 312 | #define TLS_OFFLOAD_CONTEXT_SIZE_RX \ | 347 | #define TLS_OFFLOAD_CONTEXT_SIZE_RX \ |
| 313 | (ALIGN(sizeof(struct tls_offload_context_rx), sizeof(void *)) + \ | 348 | (sizeof(struct tls_offload_context_rx) + TLS_DRIVER_STATE_SIZE_RX) |
| 314 | TLS_DRIVER_STATE_SIZE) | ||
| 315 | 349 | ||
| 350 | void tls_ctx_free(struct tls_context *ctx); | ||
| 316 | int wait_on_pending_writer(struct sock *sk, long *timeo); | 351 | int wait_on_pending_writer(struct sock *sk, long *timeo); |
| 317 | int tls_sk_query(struct sock *sk, int optname, char __user *optval, | 352 | int tls_sk_query(struct sock *sk, int optname, char __user *optval, |
| 318 | int __user *optlen); | 353 | int __user *optlen); |
| @@ -431,19 +466,15 @@ static inline struct tls_context *tls_get_ctx(const struct sock *sk) | |||
| 431 | } | 466 | } |
| 432 | 467 | ||
| 433 | static inline void tls_advance_record_sn(struct sock *sk, | 468 | static inline void tls_advance_record_sn(struct sock *sk, |
| 434 | struct cipher_context *ctx, | 469 | struct tls_prot_info *prot, |
| 435 | int version) | 470 | struct cipher_context *ctx) |
| 436 | { | 471 | { |
| 437 | struct tls_context *tls_ctx = tls_get_ctx(sk); | ||
| 438 | struct tls_prot_info *prot = &tls_ctx->prot_info; | ||
| 439 | |||
| 440 | if (tls_bigint_increment(ctx->rec_seq, prot->rec_seq_size)) | 472 | if (tls_bigint_increment(ctx->rec_seq, prot->rec_seq_size)) |
| 441 | tls_err_abort(sk, EBADMSG); | 473 | tls_err_abort(sk, EBADMSG); |
| 442 | 474 | ||
| 443 | if (version != TLS_1_3_VERSION) { | 475 | if (prot->version != TLS_1_3_VERSION) |
| 444 | tls_bigint_increment(ctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, | 476 | tls_bigint_increment(ctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, |
| 445 | prot->iv_size); | 477 | prot->iv_size); |
| 446 | } | ||
| 447 | } | 478 | } |
| 448 | 479 | ||
| 449 | static inline void tls_fill_prepend(struct tls_context *ctx, | 480 | static inline void tls_fill_prepend(struct tls_context *ctx, |
| @@ -545,6 +576,23 @@ tls_offload_ctx_rx(const struct tls_context *tls_ctx) | |||
| 545 | return (struct tls_offload_context_rx *)tls_ctx->priv_ctx_rx; | 576 | return (struct tls_offload_context_rx *)tls_ctx->priv_ctx_rx; |
| 546 | } | 577 | } |
| 547 | 578 | ||
| 579 | #if IS_ENABLED(CONFIG_TLS_DEVICE) | ||
| 580 | static inline void *__tls_driver_ctx(struct tls_context *tls_ctx, | ||
| 581 | enum tls_offload_ctx_dir direction) | ||
| 582 | { | ||
| 583 | if (direction == TLS_OFFLOAD_CTX_DIR_TX) | ||
| 584 | return tls_offload_ctx_tx(tls_ctx)->driver_state; | ||
| 585 | else | ||
| 586 | return tls_offload_ctx_rx(tls_ctx)->driver_state; | ||
| 587 | } | ||
| 588 | |||
| 589 | static inline void * | ||
| 590 | tls_driver_ctx(const struct sock *sk, enum tls_offload_ctx_dir direction) | ||
| 591 | { | ||
| 592 | return __tls_driver_ctx(tls_get_ctx(sk), direction); | ||
| 593 | } | ||
| 594 | #endif | ||
| 595 | |||
| 548 | /* The TLS context is valid until sk_destruct is called */ | 596 | /* The TLS context is valid until sk_destruct is called */ |
| 549 | static inline void tls_offload_rx_resync_request(struct sock *sk, __be32 seq) | 597 | static inline void tls_offload_rx_resync_request(struct sock *sk, __be32 seq) |
| 550 | { | 598 | { |
| @@ -554,6 +602,31 @@ static inline void tls_offload_rx_resync_request(struct sock *sk, __be32 seq) | |||
| 554 | atomic64_set(&rx_ctx->resync_req, ((u64)ntohl(seq) << 32) | 1); | 602 | atomic64_set(&rx_ctx->resync_req, ((u64)ntohl(seq) << 32) | 1); |
| 555 | } | 603 | } |
| 556 | 604 | ||
| 605 | static inline void | ||
| 606 | tls_offload_rx_resync_set_type(struct sock *sk, enum tls_offload_sync_type type) | ||
| 607 | { | ||
| 608 | struct tls_context *tls_ctx = tls_get_ctx(sk); | ||
| 609 | |||
| 610 | tls_offload_ctx_rx(tls_ctx)->resync_type = type; | ||
| 611 | } | ||
| 612 | |||
| 613 | static inline void tls_offload_tx_resync_request(struct sock *sk) | ||
| 614 | { | ||
| 615 | struct tls_context *tls_ctx = tls_get_ctx(sk); | ||
| 616 | |||
| 617 | WARN_ON(test_and_set_bit(TLS_TX_SYNC_SCHED, &tls_ctx->flags)); | ||
| 618 | } | ||
| 619 | |||
| 620 | /* Driver's seq tracking has to be disabled until resync succeeded */ | ||
| 621 | static inline bool tls_offload_tx_resync_pending(struct sock *sk) | ||
| 622 | { | ||
| 623 | struct tls_context *tls_ctx = tls_get_ctx(sk); | ||
| 624 | bool ret; | ||
| 625 | |||
| 626 | ret = test_bit(TLS_TX_SYNC_SCHED, &tls_ctx->flags); | ||
| 627 | smp_mb__after_atomic(); | ||
| 628 | return ret; | ||
| 629 | } | ||
| 557 | 630 | ||
| 558 | int tls_proccess_cmsg(struct sock *sk, struct msghdr *msg, | 631 | int tls_proccess_cmsg(struct sock *sk, struct msghdr *msg, |
| 559 | unsigned char *record_type); | 632 | unsigned char *record_type); |
| @@ -562,6 +635,7 @@ void tls_unregister_device(struct tls_device *device); | |||
| 562 | int tls_device_decrypted(struct sock *sk, struct sk_buff *skb); | 635 | int tls_device_decrypted(struct sock *sk, struct sk_buff *skb); |
| 563 | int decrypt_skb(struct sock *sk, struct sk_buff *skb, | 636 | int decrypt_skb(struct sock *sk, struct sk_buff *skb, |
| 564 | struct scatterlist *sgout); | 637 | struct scatterlist *sgout); |
| 638 | struct sk_buff *tls_encrypt_skb(struct sk_buff *skb); | ||
| 565 | 639 | ||
| 566 | struct sk_buff *tls_validate_xmit_skb(struct sock *sk, | 640 | struct sk_buff *tls_validate_xmit_skb(struct sock *sk, |
| 567 | struct net_device *dev, | 641 | struct net_device *dev, |
| @@ -574,6 +648,6 @@ int tls_sw_fallback_init(struct sock *sk, | |||
| 574 | int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx); | 648 | int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx); |
| 575 | 649 | ||
| 576 | void tls_device_offload_cleanup_rx(struct sock *sk); | 650 | void tls_device_offload_cleanup_rx(struct sock *sk); |
| 577 | void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn); | 651 | void tls_device_rx_resync_new_rec(struct sock *sk, u32 rcd_len, u32 seq); |
| 578 | 652 | ||
| 579 | #endif /* _TLS_OFFLOAD_H */ | 653 | #endif /* _TLS_OFFLOAD_H */ |
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index 83b5999a2587..dc1583a1fb8a 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h | |||
| @@ -242,7 +242,7 @@ struct vxlan_dev { | |||
| 242 | struct vxlan_rdst default_dst; /* default destination */ | 242 | struct vxlan_rdst default_dst; /* default destination */ |
| 243 | 243 | ||
| 244 | struct timer_list age_timer; | 244 | struct timer_list age_timer; |
| 245 | spinlock_t hash_lock; | 245 | spinlock_t hash_lock[FDB_HASH_SIZE]; |
| 246 | unsigned int addrcnt; | 246 | unsigned int addrcnt; |
| 247 | struct gro_cells gro_cells; | 247 | struct gro_cells gro_cells; |
| 248 | 248 | ||
diff --git a/include/net/xdp.h b/include/net/xdp.h index 8e0deddef35c..40c6d3398458 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h | |||
| @@ -129,6 +129,21 @@ void xdp_return_frame(struct xdp_frame *xdpf); | |||
| 129 | void xdp_return_frame_rx_napi(struct xdp_frame *xdpf); | 129 | void xdp_return_frame_rx_napi(struct xdp_frame *xdpf); |
| 130 | void xdp_return_buff(struct xdp_buff *xdp); | 130 | void xdp_return_buff(struct xdp_buff *xdp); |
| 131 | 131 | ||
| 132 | /* When sending xdp_frame into the network stack, then there is no | ||
| 133 | * return point callback, which is needed to release e.g. DMA-mapping | ||
| 134 | * resources with page_pool. Thus, have explicit function to release | ||
| 135 | * frame resources. | ||
| 136 | */ | ||
| 137 | void __xdp_release_frame(void *data, struct xdp_mem_info *mem); | ||
| 138 | static inline void xdp_release_frame(struct xdp_frame *xdpf) | ||
| 139 | { | ||
| 140 | struct xdp_mem_info *mem = &xdpf->mem; | ||
| 141 | |||
| 142 | /* Curr only page_pool needs this */ | ||
| 143 | if (mem->type == MEM_TYPE_PAGE_POOL) | ||
| 144 | __xdp_release_frame(xdpf->data, mem); | ||
| 145 | } | ||
| 146 | |||
| 132 | int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq, | 147 | int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq, |
| 133 | struct net_device *dev, u32 queue_index); | 148 | struct net_device *dev, u32 queue_index); |
| 134 | void xdp_rxq_info_unreg(struct xdp_rxq_info *xdp_rxq); | 149 | void xdp_rxq_info_unreg(struct xdp_rxq_info *xdp_rxq); |
diff --git a/include/net/xdp_priv.h b/include/net/xdp_priv.h new file mode 100644 index 000000000000..6a8cba6ea79a --- /dev/null +++ b/include/net/xdp_priv.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __LINUX_NET_XDP_PRIV_H__ | ||
| 3 | #define __LINUX_NET_XDP_PRIV_H__ | ||
| 4 | |||
| 5 | #include <linux/rhashtable.h> | ||
| 6 | |||
| 7 | /* Private to net/core/xdp.c, but used by trace/events/xdp.h */ | ||
| 8 | struct xdp_mem_allocator { | ||
| 9 | struct xdp_mem_info mem; | ||
| 10 | union { | ||
| 11 | void *allocator; | ||
| 12 | struct page_pool *page_pool; | ||
| 13 | struct zero_copy_allocator *zc_alloc; | ||
| 14 | }; | ||
| 15 | int disconnect_cnt; | ||
| 16 | unsigned long defer_start; | ||
| 17 | struct rhash_head node; | ||
| 18 | struct rcu_head rcu; | ||
| 19 | struct delayed_work defer_wq; | ||
| 20 | unsigned long defer_warn; | ||
| 21 | }; | ||
| 22 | |||
| 23 | #endif /* __LINUX_NET_XDP_PRIV_H__ */ | ||
diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h index d074b6d60f8a..69796d264f06 100644 --- a/include/net/xdp_sock.h +++ b/include/net/xdp_sock.h | |||
| @@ -58,15 +58,22 @@ struct xdp_sock { | |||
| 58 | struct xdp_umem *umem; | 58 | struct xdp_umem *umem; |
| 59 | struct list_head flush_node; | 59 | struct list_head flush_node; |
| 60 | u16 queue_id; | 60 | u16 queue_id; |
| 61 | struct xsk_queue *tx ____cacheline_aligned_in_smp; | ||
| 62 | struct list_head list; | ||
| 63 | bool zc; | 61 | bool zc; |
| 62 | enum { | ||
| 63 | XSK_READY = 0, | ||
| 64 | XSK_BOUND, | ||
| 65 | XSK_UNBOUND, | ||
| 66 | } state; | ||
| 64 | /* Protects multiple processes in the control path */ | 67 | /* Protects multiple processes in the control path */ |
| 65 | struct mutex mutex; | 68 | struct mutex mutex; |
| 69 | struct xsk_queue *tx ____cacheline_aligned_in_smp; | ||
| 70 | struct list_head list; | ||
| 66 | /* Mutual exclusion of NAPI TX thread and sendmsg error paths | 71 | /* Mutual exclusion of NAPI TX thread and sendmsg error paths |
| 67 | * in the SKB destructor callback. | 72 | * in the SKB destructor callback. |
| 68 | */ | 73 | */ |
| 69 | spinlock_t tx_completion_lock; | 74 | spinlock_t tx_completion_lock; |
| 75 | /* Protects generic receive. */ | ||
| 76 | spinlock_t rx_lock; | ||
| 70 | u64 rx_dropped; | 77 | u64 rx_dropped; |
| 71 | }; | 78 | }; |
| 72 | 79 | ||
| @@ -77,10 +84,11 @@ int xsk_rcv(struct xdp_sock *xs, struct xdp_buff *xdp); | |||
| 77 | void xsk_flush(struct xdp_sock *xs); | 84 | void xsk_flush(struct xdp_sock *xs); |
| 78 | bool xsk_is_setup_for_bpf_map(struct xdp_sock *xs); | 85 | bool xsk_is_setup_for_bpf_map(struct xdp_sock *xs); |
| 79 | /* Used from netdev driver */ | 86 | /* Used from netdev driver */ |
| 87 | bool xsk_umem_has_addrs(struct xdp_umem *umem, u32 cnt); | ||
| 80 | u64 *xsk_umem_peek_addr(struct xdp_umem *umem, u64 *addr); | 88 | u64 *xsk_umem_peek_addr(struct xdp_umem *umem, u64 *addr); |
| 81 | void xsk_umem_discard_addr(struct xdp_umem *umem); | 89 | void xsk_umem_discard_addr(struct xdp_umem *umem); |
| 82 | void xsk_umem_complete_tx(struct xdp_umem *umem, u32 nb_entries); | 90 | void xsk_umem_complete_tx(struct xdp_umem *umem, u32 nb_entries); |
| 83 | bool xsk_umem_consume_tx(struct xdp_umem *umem, dma_addr_t *dma, u32 *len); | 91 | bool xsk_umem_consume_tx(struct xdp_umem *umem, struct xdp_desc *desc); |
| 84 | void xsk_umem_consume_tx_done(struct xdp_umem *umem); | 92 | void xsk_umem_consume_tx_done(struct xdp_umem *umem); |
| 85 | struct xdp_umem_fq_reuse *xsk_reuseq_prepare(u32 nentries); | 93 | struct xdp_umem_fq_reuse *xsk_reuseq_prepare(u32 nentries); |
| 86 | struct xdp_umem_fq_reuse *xsk_reuseq_swap(struct xdp_umem *umem, | 94 | struct xdp_umem_fq_reuse *xsk_reuseq_swap(struct xdp_umem *umem, |
| @@ -99,6 +107,16 @@ static inline dma_addr_t xdp_umem_get_dma(struct xdp_umem *umem, u64 addr) | |||
| 99 | } | 107 | } |
| 100 | 108 | ||
| 101 | /* Reuse-queue aware version of FILL queue helpers */ | 109 | /* Reuse-queue aware version of FILL queue helpers */ |
| 110 | static inline bool xsk_umem_has_addrs_rq(struct xdp_umem *umem, u32 cnt) | ||
| 111 | { | ||
| 112 | struct xdp_umem_fq_reuse *rq = umem->fq_reuse; | ||
| 113 | |||
| 114 | if (rq->length >= cnt) | ||
| 115 | return true; | ||
| 116 | |||
| 117 | return xsk_umem_has_addrs(umem, cnt - rq->length); | ||
| 118 | } | ||
| 119 | |||
| 102 | static inline u64 *xsk_umem_peek_addr_rq(struct xdp_umem *umem, u64 *addr) | 120 | static inline u64 *xsk_umem_peek_addr_rq(struct xdp_umem *umem, u64 *addr) |
| 103 | { | 121 | { |
| 104 | struct xdp_umem_fq_reuse *rq = umem->fq_reuse; | 122 | struct xdp_umem_fq_reuse *rq = umem->fq_reuse; |
| @@ -146,6 +164,11 @@ static inline bool xsk_is_setup_for_bpf_map(struct xdp_sock *xs) | |||
| 146 | return false; | 164 | return false; |
| 147 | } | 165 | } |
| 148 | 166 | ||
| 167 | static inline bool xsk_umem_has_addrs(struct xdp_umem *umem, u32 cnt) | ||
| 168 | { | ||
| 169 | return false; | ||
| 170 | } | ||
| 171 | |||
| 149 | static inline u64 *xsk_umem_peek_addr(struct xdp_umem *umem, u64 *addr) | 172 | static inline u64 *xsk_umem_peek_addr(struct xdp_umem *umem, u64 *addr) |
| 150 | { | 173 | { |
| 151 | return NULL; | 174 | return NULL; |
| @@ -159,8 +182,8 @@ static inline void xsk_umem_complete_tx(struct xdp_umem *umem, u32 nb_entries) | |||
| 159 | { | 182 | { |
| 160 | } | 183 | } |
| 161 | 184 | ||
| 162 | static inline bool xsk_umem_consume_tx(struct xdp_umem *umem, dma_addr_t *dma, | 185 | static inline bool xsk_umem_consume_tx(struct xdp_umem *umem, |
| 163 | u32 *len) | 186 | struct xdp_desc *desc) |
| 164 | { | 187 | { |
| 165 | return false; | 188 | return false; |
| 166 | } | 189 | } |
| @@ -200,6 +223,11 @@ static inline dma_addr_t xdp_umem_get_dma(struct xdp_umem *umem, u64 addr) | |||
| 200 | return 0; | 223 | return 0; |
| 201 | } | 224 | } |
| 202 | 225 | ||
| 226 | static inline bool xsk_umem_has_addrs_rq(struct xdp_umem *umem, u32 cnt) | ||
| 227 | { | ||
| 228 | return false; | ||
| 229 | } | ||
| 230 | |||
| 203 | static inline u64 *xsk_umem_peek_addr_rq(struct xdp_umem *umem, u64 *addr) | 231 | static inline u64 *xsk_umem_peek_addr_rq(struct xdp_umem *umem, u64 *addr) |
| 204 | { | 232 | { |
| 205 | return NULL; | 233 | return NULL; |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index a2907873ed56..b22db30c3d88 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -346,22 +346,19 @@ void km_state_expired(struct xfrm_state *x, int hard, u32 portid); | |||
| 346 | int __xfrm_state_delete(struct xfrm_state *x); | 346 | int __xfrm_state_delete(struct xfrm_state *x); |
| 347 | 347 | ||
| 348 | struct xfrm_state_afinfo { | 348 | struct xfrm_state_afinfo { |
| 349 | unsigned int family; | 349 | u8 family; |
| 350 | unsigned int proto; | 350 | u8 proto; |
| 351 | __be16 eth_proto; | 351 | |
| 352 | struct module *owner; | 352 | const struct xfrm_type_offload *type_offload_esp; |
| 353 | const struct xfrm_type *type_map[IPPROTO_MAX]; | 353 | |
| 354 | const struct xfrm_type_offload *type_offload_map[IPPROTO_MAX]; | 354 | const struct xfrm_type *type_esp; |
| 355 | 355 | const struct xfrm_type *type_ipip; | |
| 356 | int (*init_flags)(struct xfrm_state *x); | 356 | const struct xfrm_type *type_ipip6; |
| 357 | void (*init_tempsel)(struct xfrm_selector *sel, | 357 | const struct xfrm_type *type_comp; |
| 358 | const struct flowi *fl); | 358 | const struct xfrm_type *type_ah; |
| 359 | void (*init_temprop)(struct xfrm_state *x, | 359 | const struct xfrm_type *type_routing; |
| 360 | const struct xfrm_tmpl *tmpl, | 360 | const struct xfrm_type *type_dstopts; |
| 361 | const xfrm_address_t *daddr, | 361 | |
| 362 | const xfrm_address_t *saddr); | ||
| 363 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); | ||
| 364 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); | ||
| 365 | int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb); | 362 | int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb); |
| 366 | int (*output_finish)(struct sock *sk, struct sk_buff *skb); | 363 | int (*output_finish)(struct sock *sk, struct sk_buff *skb); |
| 367 | int (*extract_input)(struct xfrm_state *x, | 364 | int (*extract_input)(struct xfrm_state *x, |
| @@ -407,12 +404,10 @@ struct xfrm_type { | |||
| 407 | int (*reject)(struct xfrm_state *, struct sk_buff *, | 404 | int (*reject)(struct xfrm_state *, struct sk_buff *, |
| 408 | const struct flowi *); | 405 | const struct flowi *); |
| 409 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); | 406 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); |
| 410 | /* Estimate maximal size of result of transformation of a dgram */ | ||
| 411 | u32 (*get_mtu)(struct xfrm_state *, int size); | ||
| 412 | }; | 407 | }; |
| 413 | 408 | ||
| 414 | int xfrm_register_type(const struct xfrm_type *type, unsigned short family); | 409 | int xfrm_register_type(const struct xfrm_type *type, unsigned short family); |
| 415 | int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family); | 410 | void xfrm_unregister_type(const struct xfrm_type *type, unsigned short family); |
| 416 | 411 | ||
| 417 | struct xfrm_type_offload { | 412 | struct xfrm_type_offload { |
| 418 | char *description; | 413 | char *description; |
| @@ -424,7 +419,7 @@ struct xfrm_type_offload { | |||
| 424 | }; | 419 | }; |
| 425 | 420 | ||
| 426 | int xfrm_register_type_offload(const struct xfrm_type_offload *type, unsigned short family); | 421 | int xfrm_register_type_offload(const struct xfrm_type_offload *type, unsigned short family); |
| 427 | int xfrm_unregister_type_offload(const struct xfrm_type_offload *type, unsigned short family); | 422 | void xfrm_unregister_type_offload(const struct xfrm_type_offload *type, unsigned short family); |
| 428 | 423 | ||
| 429 | static inline int xfrm_af2proto(unsigned int family) | 424 | static inline int xfrm_af2proto(unsigned int family) |
| 430 | { | 425 | { |
| @@ -1508,21 +1503,19 @@ struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark, | |||
| 1508 | u8 proto, | 1503 | u8 proto, |
| 1509 | unsigned short family); | 1504 | unsigned short family); |
| 1510 | #ifdef CONFIG_XFRM_SUB_POLICY | 1505 | #ifdef CONFIG_XFRM_SUB_POLICY |
| 1511 | int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n, | 1506 | void xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n, |
| 1512 | unsigned short family, struct net *net); | ||
| 1513 | int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n, | ||
| 1514 | unsigned short family); | 1507 | unsigned short family); |
| 1508 | void xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n, | ||
| 1509 | unsigned short family); | ||
| 1515 | #else | 1510 | #else |
| 1516 | static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, | 1511 | static inline void xfrm_tmpl_sort(struct xfrm_tmpl **d, struct xfrm_tmpl **s, |
| 1517 | int n, unsigned short family, struct net *net) | 1512 | int n, unsigned short family) |
| 1518 | { | 1513 | { |
| 1519 | return -ENOSYS; | ||
| 1520 | } | 1514 | } |
| 1521 | 1515 | ||
| 1522 | static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, | 1516 | static inline void xfrm_state_sort(struct xfrm_state **d, struct xfrm_state **s, |
| 1523 | int n, unsigned short family) | 1517 | int n, unsigned short family) |
| 1524 | { | 1518 | { |
| 1525 | return -ENOSYS; | ||
| 1526 | } | 1519 | } |
| 1527 | #endif | 1520 | #endif |
| 1528 | 1521 | ||
| @@ -1551,7 +1544,7 @@ void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); | |||
| 1551 | void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); | 1544 | void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); |
| 1552 | u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); | 1545 | u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); |
| 1553 | int xfrm_init_replay(struct xfrm_state *x); | 1546 | int xfrm_init_replay(struct xfrm_state *x); |
| 1554 | int xfrm_state_mtu(struct xfrm_state *x, int mtu); | 1547 | u32 xfrm_state_mtu(struct xfrm_state *x, int mtu); |
| 1555 | int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload); | 1548 | int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload); |
| 1556 | int xfrm_init_state(struct xfrm_state *x); | 1549 | int xfrm_init_state(struct xfrm_state *x); |
| 1557 | int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type); | 1550 | int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type); |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 0f42a7b82d18..b7a8de88b3c0 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
| @@ -36,7 +36,7 @@ struct config_t; | |||
| 36 | struct net_device; | 36 | struct net_device; |
| 37 | 37 | ||
| 38 | /* dynamic device IDs for PCMCIA device drivers. See | 38 | /* dynamic device IDs for PCMCIA device drivers. See |
| 39 | * Documentation/pcmcia/driver.txt for details. | 39 | * Documentation/pcmcia/driver.rst for details. |
| 40 | */ | 40 | */ |
| 41 | struct pcmcia_dynids { | 41 | struct pcmcia_dynids { |
| 42 | struct mutex lock; | 42 | struct mutex lock; |
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 4039cb117733..7cf7dbbfa131 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h | |||
| @@ -187,7 +187,7 @@ struct pcmcia_socket { | |||
| 187 | unsigned int sysfs_events; | 187 | unsigned int sysfs_events; |
| 188 | 188 | ||
| 189 | /* For the non-trivial interaction between these locks, | 189 | /* For the non-trivial interaction between these locks, |
| 190 | * see Documentation/pcmcia/locking.txt */ | 190 | * see Documentation/pcmcia/locking.rst */ |
| 191 | struct mutex skt_mutex; | 191 | struct mutex skt_mutex; |
| 192 | struct mutex ops_mutex; | 192 | struct mutex ops_mutex; |
| 193 | 193 | ||
diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h index 040d853077c6..1052d0d62be7 100644 --- a/include/rdma/ib_umem.h +++ b/include/rdma/ib_umem.h | |||
| @@ -46,7 +46,6 @@ struct ib_umem { | |||
| 46 | struct mm_struct *owning_mm; | 46 | struct mm_struct *owning_mm; |
| 47 | size_t length; | 47 | size_t length; |
| 48 | unsigned long address; | 48 | unsigned long address; |
| 49 | int page_shift; | ||
| 50 | u32 writable : 1; | 49 | u32 writable : 1; |
| 51 | u32 is_odp : 1; | 50 | u32 is_odp : 1; |
| 52 | struct work_struct work; | 51 | struct work_struct work; |
| @@ -58,24 +57,14 @@ struct ib_umem { | |||
| 58 | /* Returns the offset of the umem start relative to the first page. */ | 57 | /* Returns the offset of the umem start relative to the first page. */ |
| 59 | static inline int ib_umem_offset(struct ib_umem *umem) | 58 | static inline int ib_umem_offset(struct ib_umem *umem) |
| 60 | { | 59 | { |
| 61 | return umem->address & (BIT(umem->page_shift) - 1); | 60 | return umem->address & ~PAGE_MASK; |
| 62 | } | ||
| 63 | |||
| 64 | /* Returns the first page of an ODP umem. */ | ||
| 65 | static inline unsigned long ib_umem_start(struct ib_umem *umem) | ||
| 66 | { | ||
| 67 | return umem->address - ib_umem_offset(umem); | ||
| 68 | } | ||
| 69 | |||
| 70 | /* Returns the address of the page after the last one of an ODP umem. */ | ||
| 71 | static inline unsigned long ib_umem_end(struct ib_umem *umem) | ||
| 72 | { | ||
| 73 | return ALIGN(umem->address + umem->length, BIT(umem->page_shift)); | ||
| 74 | } | 61 | } |
| 75 | 62 | ||
| 76 | static inline size_t ib_umem_num_pages(struct ib_umem *umem) | 63 | static inline size_t ib_umem_num_pages(struct ib_umem *umem) |
| 77 | { | 64 | { |
| 78 | return (ib_umem_end(umem) - ib_umem_start(umem)) >> umem->page_shift; | 65 | return (ALIGN(umem->address + umem->length, PAGE_SIZE) - |
| 66 | ALIGN_DOWN(umem->address, PAGE_SIZE)) >> | ||
| 67 | PAGE_SHIFT; | ||
| 79 | } | 68 | } |
| 80 | 69 | ||
| 81 | #ifdef CONFIG_INFINIBAND_USER_MEM | 70 | #ifdef CONFIG_INFINIBAND_USER_MEM |
diff --git a/include/rdma/ib_umem_odp.h b/include/rdma/ib_umem_odp.h index eeec4e53c448..479db5c98ff6 100644 --- a/include/rdma/ib_umem_odp.h +++ b/include/rdma/ib_umem_odp.h | |||
| @@ -76,6 +76,7 @@ struct ib_umem_odp { | |||
| 76 | 76 | ||
| 77 | struct completion notifier_completion; | 77 | struct completion notifier_completion; |
| 78 | int dying; | 78 | int dying; |
| 79 | unsigned int page_shift; | ||
| 79 | struct work_struct work; | 80 | struct work_struct work; |
| 80 | }; | 81 | }; |
| 81 | 82 | ||
| @@ -84,6 +85,25 @@ static inline struct ib_umem_odp *to_ib_umem_odp(struct ib_umem *umem) | |||
| 84 | return container_of(umem, struct ib_umem_odp, umem); | 85 | return container_of(umem, struct ib_umem_odp, umem); |
| 85 | } | 86 | } |
| 86 | 87 | ||
| 88 | /* Returns the first page of an ODP umem. */ | ||
| 89 | static inline unsigned long ib_umem_start(struct ib_umem_odp *umem_odp) | ||
| 90 | { | ||
| 91 | return ALIGN_DOWN(umem_odp->umem.address, 1UL << umem_odp->page_shift); | ||
| 92 | } | ||
| 93 | |||
| 94 | /* Returns the address of the page after the last one of an ODP umem. */ | ||
| 95 | static inline unsigned long ib_umem_end(struct ib_umem_odp *umem_odp) | ||
| 96 | { | ||
| 97 | return ALIGN(umem_odp->umem.address + umem_odp->umem.length, | ||
| 98 | 1UL << umem_odp->page_shift); | ||
| 99 | } | ||
| 100 | |||
| 101 | static inline size_t ib_umem_odp_num_pages(struct ib_umem_odp *umem_odp) | ||
| 102 | { | ||
| 103 | return (ib_umem_end(umem_odp) - ib_umem_start(umem_odp)) >> | ||
| 104 | umem_odp->page_shift; | ||
| 105 | } | ||
| 106 | |||
| 87 | /* | 107 | /* |
| 88 | * The lower 2 bits of the DMA address signal the R/W permissions for | 108 | * The lower 2 bits of the DMA address signal the R/W permissions for |
| 89 | * the entry. To upgrade the permissions, provide the appropriate | 109 | * the entry. To upgrade the permissions, provide the appropriate |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 54873085f2da..c5f8a9f17063 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
| @@ -61,8 +61,11 @@ | |||
| 61 | #include <linux/cgroup_rdma.h> | 61 | #include <linux/cgroup_rdma.h> |
| 62 | #include <linux/irqflags.h> | 62 | #include <linux/irqflags.h> |
| 63 | #include <linux/preempt.h> | 63 | #include <linux/preempt.h> |
| 64 | #include <linux/dim.h> | ||
| 64 | #include <uapi/rdma/ib_user_verbs.h> | 65 | #include <uapi/rdma/ib_user_verbs.h> |
| 66 | #include <rdma/rdma_counter.h> | ||
| 65 | #include <rdma/restrack.h> | 67 | #include <rdma/restrack.h> |
| 68 | #include <rdma/signature.h> | ||
| 66 | #include <uapi/rdma/rdma_user_ioctl.h> | 69 | #include <uapi/rdma/rdma_user_ioctl.h> |
| 67 | #include <uapi/rdma/ib_user_ioctl_verbs.h> | 70 | #include <uapi/rdma/ib_user_ioctl_verbs.h> |
| 68 | 71 | ||
| @@ -132,17 +135,6 @@ struct ib_gid_attr { | |||
| 132 | u8 port_num; | 135 | u8 port_num; |
| 133 | }; | 136 | }; |
| 134 | 137 | ||
| 135 | enum rdma_node_type { | ||
| 136 | /* IB values map to NodeInfo:NodeType. */ | ||
| 137 | RDMA_NODE_IB_CA = 1, | ||
| 138 | RDMA_NODE_IB_SWITCH, | ||
| 139 | RDMA_NODE_IB_ROUTER, | ||
| 140 | RDMA_NODE_RNIC, | ||
| 141 | RDMA_NODE_USNIC, | ||
| 142 | RDMA_NODE_USNIC_UDP, | ||
| 143 | RDMA_NODE_UNSPECIFIED, | ||
| 144 | }; | ||
| 145 | |||
| 146 | enum { | 138 | enum { |
| 147 | /* set the local administered indication */ | 139 | /* set the local administered indication */ |
| 148 | IB_SA_WELL_KNOWN_GUID = BIT_ULL(57) | 2, | 140 | IB_SA_WELL_KNOWN_GUID = BIT_ULL(57) | 2, |
| @@ -164,7 +156,7 @@ enum rdma_protocol_type { | |||
| 164 | }; | 156 | }; |
| 165 | 157 | ||
| 166 | __attribute_const__ enum rdma_transport_type | 158 | __attribute_const__ enum rdma_transport_type |
| 167 | rdma_node_get_transport(enum rdma_node_type node_type); | 159 | rdma_node_get_transport(unsigned int node_type); |
| 168 | 160 | ||
| 169 | enum rdma_network_type { | 161 | enum rdma_network_type { |
| 170 | RDMA_NETWORK_IB, | 162 | RDMA_NETWORK_IB, |
| @@ -263,7 +255,7 @@ enum ib_device_cap_flags { | |||
| 263 | */ | 255 | */ |
| 264 | IB_DEVICE_CROSS_CHANNEL = (1 << 27), | 256 | IB_DEVICE_CROSS_CHANNEL = (1 << 27), |
| 265 | IB_DEVICE_MANAGED_FLOW_STEERING = (1 << 29), | 257 | IB_DEVICE_MANAGED_FLOW_STEERING = (1 << 29), |
| 266 | IB_DEVICE_SIGNATURE_HANDOVER = (1 << 30), | 258 | IB_DEVICE_INTEGRITY_HANDOVER = (1 << 30), |
| 267 | IB_DEVICE_ON_DEMAND_PAGING = (1ULL << 31), | 259 | IB_DEVICE_ON_DEMAND_PAGING = (1ULL << 31), |
| 268 | IB_DEVICE_SG_GAPS_REG = (1ULL << 32), | 260 | IB_DEVICE_SG_GAPS_REG = (1ULL << 32), |
| 269 | IB_DEVICE_VIRTUAL_FUNCTION = (1ULL << 33), | 261 | IB_DEVICE_VIRTUAL_FUNCTION = (1ULL << 33), |
| @@ -275,17 +267,6 @@ enum ib_device_cap_flags { | |||
| 275 | IB_DEVICE_ALLOW_USER_UNREG = (1ULL << 37), | 267 | IB_DEVICE_ALLOW_USER_UNREG = (1ULL << 37), |
| 276 | }; | 268 | }; |
| 277 | 269 | ||
| 278 | enum ib_signature_prot_cap { | ||
| 279 | IB_PROT_T10DIF_TYPE_1 = 1, | ||
| 280 | IB_PROT_T10DIF_TYPE_2 = 1 << 1, | ||
| 281 | IB_PROT_T10DIF_TYPE_3 = 1 << 2, | ||
| 282 | }; | ||
| 283 | |||
| 284 | enum ib_signature_guard_cap { | ||
| 285 | IB_GUARD_T10DIF_CRC = 1, | ||
| 286 | IB_GUARD_T10DIF_CSUM = 1 << 1, | ||
| 287 | }; | ||
| 288 | |||
| 289 | enum ib_atomic_cap { | 270 | enum ib_atomic_cap { |
| 290 | IB_ATOMIC_NONE, | 271 | IB_ATOMIC_NONE, |
| 291 | IB_ATOMIC_HCA, | 272 | IB_ATOMIC_HCA, |
| @@ -327,8 +308,8 @@ struct ib_rss_caps { | |||
| 327 | }; | 308 | }; |
| 328 | 309 | ||
| 329 | enum ib_tm_cap_flags { | 310 | enum ib_tm_cap_flags { |
| 330 | /* Support tag matching on RC transport */ | 311 | /* Support tag matching with rendezvous offload for RC transport */ |
| 331 | IB_TM_CAP_RC = 1 << 0, | 312 | IB_TM_CAP_RNDV_RC = 1 << 0, |
| 332 | }; | 313 | }; |
| 333 | 314 | ||
| 334 | struct ib_tm_caps { | 315 | struct ib_tm_caps { |
| @@ -411,6 +392,7 @@ struct ib_device_attr { | |||
| 411 | int max_srq_wr; | 392 | int max_srq_wr; |
| 412 | int max_srq_sge; | 393 | int max_srq_sge; |
| 413 | unsigned int max_fast_reg_page_list_len; | 394 | unsigned int max_fast_reg_page_list_len; |
| 395 | unsigned int max_pi_fast_reg_page_list_len; | ||
| 414 | u16 max_pkeys; | 396 | u16 max_pkeys; |
| 415 | u8 local_ca_ack_delay; | 397 | u8 local_ca_ack_delay; |
| 416 | int sig_prot_cap; | 398 | int sig_prot_cap; |
| @@ -796,118 +778,26 @@ __attribute_const__ int ib_rate_to_mbps(enum ib_rate rate); | |||
| 796 | * enum ib_mr_type - memory region type | 778 | * enum ib_mr_type - memory region type |
| 797 | * @IB_MR_TYPE_MEM_REG: memory region that is used for | 779 | * @IB_MR_TYPE_MEM_REG: memory region that is used for |
| 798 | * normal registration | 780 | * normal registration |
| 799 | * @IB_MR_TYPE_SIGNATURE: memory region that is used for | ||
| 800 | * signature operations (data-integrity | ||
| 801 | * capable regions) | ||
| 802 | * @IB_MR_TYPE_SG_GAPS: memory region that is capable to | 781 | * @IB_MR_TYPE_SG_GAPS: memory region that is capable to |
| 803 | * register any arbitrary sg lists (without | 782 | * register any arbitrary sg lists (without |
| 804 | * the normal mr constraints - see | 783 | * the normal mr constraints - see |
| 805 | * ib_map_mr_sg) | 784 | * ib_map_mr_sg) |
| 785 | * @IB_MR_TYPE_DM: memory region that is used for device | ||
| 786 | * memory registration | ||
| 787 | * @IB_MR_TYPE_USER: memory region that is used for the user-space | ||
| 788 | * application | ||
| 789 | * @IB_MR_TYPE_DMA: memory region that is used for DMA operations | ||
| 790 | * without address translations (VA=PA) | ||
| 791 | * @IB_MR_TYPE_INTEGRITY: memory region that is used for | ||
| 792 | * data integrity operations | ||
| 806 | */ | 793 | */ |
| 807 | enum ib_mr_type { | 794 | enum ib_mr_type { |
| 808 | IB_MR_TYPE_MEM_REG, | 795 | IB_MR_TYPE_MEM_REG, |
| 809 | IB_MR_TYPE_SIGNATURE, | ||
| 810 | IB_MR_TYPE_SG_GAPS, | 796 | IB_MR_TYPE_SG_GAPS, |
| 811 | }; | 797 | IB_MR_TYPE_DM, |
| 812 | 798 | IB_MR_TYPE_USER, | |
| 813 | /** | 799 | IB_MR_TYPE_DMA, |
| 814 | * Signature types | 800 | IB_MR_TYPE_INTEGRITY, |
| 815 | * IB_SIG_TYPE_NONE: Unprotected. | ||
| 816 | * IB_SIG_TYPE_T10_DIF: Type T10-DIF | ||
| 817 | */ | ||
| 818 | enum ib_signature_type { | ||
| 819 | IB_SIG_TYPE_NONE, | ||
| 820 | IB_SIG_TYPE_T10_DIF, | ||
| 821 | }; | ||
| 822 | |||
| 823 | /** | ||
| 824 | * Signature T10-DIF block-guard types | ||
| 825 | * IB_T10DIF_CRC: Corresponds to T10-PI mandated CRC checksum rules. | ||
| 826 | * IB_T10DIF_CSUM: Corresponds to IP checksum rules. | ||
| 827 | */ | ||
| 828 | enum ib_t10_dif_bg_type { | ||
| 829 | IB_T10DIF_CRC, | ||
| 830 | IB_T10DIF_CSUM | ||
| 831 | }; | ||
| 832 | |||
| 833 | /** | ||
| 834 | * struct ib_t10_dif_domain - Parameters specific for T10-DIF | ||
| 835 | * domain. | ||
| 836 | * @bg_type: T10-DIF block guard type (CRC|CSUM) | ||
| 837 | * @pi_interval: protection information interval. | ||
| 838 | * @bg: seed of guard computation. | ||
| 839 | * @app_tag: application tag of guard block | ||
| 840 | * @ref_tag: initial guard block reference tag. | ||
| 841 | * @ref_remap: Indicate wethear the reftag increments each block | ||
| 842 | * @app_escape: Indicate to skip block check if apptag=0xffff | ||
| 843 | * @ref_escape: Indicate to skip block check if reftag=0xffffffff | ||
| 844 | * @apptag_check_mask: check bitmask of application tag. | ||
| 845 | */ | ||
| 846 | struct ib_t10_dif_domain { | ||
| 847 | enum ib_t10_dif_bg_type bg_type; | ||
| 848 | u16 pi_interval; | ||
| 849 | u16 bg; | ||
| 850 | u16 app_tag; | ||
| 851 | u32 ref_tag; | ||
| 852 | bool ref_remap; | ||
| 853 | bool app_escape; | ||
| 854 | bool ref_escape; | ||
| 855 | u16 apptag_check_mask; | ||
| 856 | }; | ||
| 857 | |||
| 858 | /** | ||
| 859 | * struct ib_sig_domain - Parameters for signature domain | ||
| 860 | * @sig_type: specific signauture type | ||
| 861 | * @sig: union of all signature domain attributes that may | ||
| 862 | * be used to set domain layout. | ||
| 863 | */ | ||
| 864 | struct ib_sig_domain { | ||
| 865 | enum ib_signature_type sig_type; | ||
| 866 | union { | ||
| 867 | struct ib_t10_dif_domain dif; | ||
| 868 | } sig; | ||
| 869 | }; | ||
| 870 | |||
| 871 | /** | ||
| 872 | * struct ib_sig_attrs - Parameters for signature handover operation | ||
| 873 | * @check_mask: bitmask for signature byte check (8 bytes) | ||
| 874 | * @mem: memory domain layout desciptor. | ||
| 875 | * @wire: wire domain layout desciptor. | ||
| 876 | */ | ||
| 877 | struct ib_sig_attrs { | ||
| 878 | u8 check_mask; | ||
| 879 | struct ib_sig_domain mem; | ||
| 880 | struct ib_sig_domain wire; | ||
| 881 | }; | ||
| 882 | |||
| 883 | enum ib_sig_err_type { | ||
| 884 | IB_SIG_BAD_GUARD, | ||
| 885 | IB_SIG_BAD_REFTAG, | ||
| 886 | IB_SIG_BAD_APPTAG, | ||
| 887 | }; | ||
| 888 | |||
| 889 | /** | ||
| 890 | * Signature check masks (8 bytes in total) according to the T10-PI standard: | ||
| 891 | * -------- -------- ------------ | ||
| 892 | * | GUARD | APPTAG | REFTAG | | ||
| 893 | * | 2B | 2B | 4B | | ||
| 894 | * -------- -------- ------------ | ||
| 895 | */ | ||
| 896 | enum { | ||
| 897 | IB_SIG_CHECK_GUARD = 0xc0, | ||
| 898 | IB_SIG_CHECK_APPTAG = 0x30, | ||
| 899 | IB_SIG_CHECK_REFTAG = 0x0f, | ||
| 900 | }; | ||
| 901 | |||
| 902 | /** | ||
| 903 | * struct ib_sig_err - signature error descriptor | ||
| 904 | */ | ||
| 905 | struct ib_sig_err { | ||
| 906 | enum ib_sig_err_type err_type; | ||
| 907 | u32 expected; | ||
| 908 | u32 actual; | ||
| 909 | u64 sig_err_offset; | ||
| 910 | u32 key; | ||
| 911 | }; | 801 | }; |
| 912 | 802 | ||
| 913 | enum ib_mr_status_check { | 803 | enum ib_mr_status_check { |
| @@ -1164,7 +1054,7 @@ enum ib_qp_create_flags { | |||
| 1164 | IB_QP_CREATE_MANAGED_SEND = 1 << 3, | 1054 | IB_QP_CREATE_MANAGED_SEND = 1 << 3, |
| 1165 | IB_QP_CREATE_MANAGED_RECV = 1 << 4, | 1055 | IB_QP_CREATE_MANAGED_RECV = 1 << 4, |
| 1166 | IB_QP_CREATE_NETIF_QP = 1 << 5, | 1056 | IB_QP_CREATE_NETIF_QP = 1 << 5, |
| 1167 | IB_QP_CREATE_SIGNATURE_EN = 1 << 6, | 1057 | IB_QP_CREATE_INTEGRITY_EN = 1 << 6, |
| 1168 | /* FREE = 1 << 7, */ | 1058 | /* FREE = 1 << 7, */ |
| 1169 | IB_QP_CREATE_SCATTER_FCS = 1 << 8, | 1059 | IB_QP_CREATE_SCATTER_FCS = 1 << 8, |
| 1170 | IB_QP_CREATE_CVLAN_STRIPPING = 1 << 9, | 1060 | IB_QP_CREATE_CVLAN_STRIPPING = 1 << 9, |
| @@ -1343,7 +1233,7 @@ enum ib_wr_opcode { | |||
| 1343 | 1233 | ||
| 1344 | /* These are kernel only and can not be issued by userspace */ | 1234 | /* These are kernel only and can not be issued by userspace */ |
| 1345 | IB_WR_REG_MR = 0x20, | 1235 | IB_WR_REG_MR = 0x20, |
| 1346 | IB_WR_REG_SIG_MR, | 1236 | IB_WR_REG_MR_INTEGRITY, |
| 1347 | 1237 | ||
| 1348 | /* reserve values for low level drivers' internal use. | 1238 | /* reserve values for low level drivers' internal use. |
| 1349 | * These values will not be used at all in the ib core layer. | 1239 | * These values will not be used at all in the ib core layer. |
| @@ -1453,20 +1343,6 @@ static inline const struct ib_reg_wr *reg_wr(const struct ib_send_wr *wr) | |||
| 1453 | return container_of(wr, struct ib_reg_wr, wr); | 1343 | return container_of(wr, struct ib_reg_wr, wr); |
| 1454 | } | 1344 | } |
| 1455 | 1345 | ||
| 1456 | struct ib_sig_handover_wr { | ||
| 1457 | struct ib_send_wr wr; | ||
| 1458 | struct ib_sig_attrs *sig_attrs; | ||
| 1459 | struct ib_mr *sig_mr; | ||
| 1460 | int access_flags; | ||
| 1461 | struct ib_sge *prot; | ||
| 1462 | }; | ||
| 1463 | |||
| 1464 | static inline const struct ib_sig_handover_wr * | ||
| 1465 | sig_handover_wr(const struct ib_send_wr *wr) | ||
| 1466 | { | ||
| 1467 | return container_of(wr, struct ib_sig_handover_wr, wr); | ||
| 1468 | } | ||
| 1469 | |||
| 1470 | struct ib_recv_wr { | 1346 | struct ib_recv_wr { |
| 1471 | struct ib_recv_wr *next; | 1347 | struct ib_recv_wr *next; |
| 1472 | union { | 1348 | union { |
| @@ -1634,6 +1510,7 @@ struct ib_cq { | |||
| 1634 | struct work_struct work; | 1510 | struct work_struct work; |
| 1635 | }; | 1511 | }; |
| 1636 | struct workqueue_struct *comp_wq; | 1512 | struct workqueue_struct *comp_wq; |
| 1513 | struct dim *dim; | ||
| 1637 | /* | 1514 | /* |
| 1638 | * Implementation details of the RDMA core, don't use in drivers: | 1515 | * Implementation details of the RDMA core, don't use in drivers: |
| 1639 | */ | 1516 | */ |
| @@ -1818,10 +1695,14 @@ struct ib_qp { | |||
| 1818 | struct ib_qp_security *qp_sec; | 1695 | struct ib_qp_security *qp_sec; |
| 1819 | u8 port; | 1696 | u8 port; |
| 1820 | 1697 | ||
| 1698 | bool integrity_en; | ||
| 1821 | /* | 1699 | /* |
| 1822 | * Implementation details of the RDMA core, don't use in drivers: | 1700 | * Implementation details of the RDMA core, don't use in drivers: |
| 1823 | */ | 1701 | */ |
| 1824 | struct rdma_restrack_entry res; | 1702 | struct rdma_restrack_entry res; |
| 1703 | |||
| 1704 | /* The counter the qp is bind to */ | ||
| 1705 | struct rdma_counter *counter; | ||
| 1825 | }; | 1706 | }; |
| 1826 | 1707 | ||
| 1827 | struct ib_dm { | 1708 | struct ib_dm { |
| @@ -1840,6 +1721,7 @@ struct ib_mr { | |||
| 1840 | u64 iova; | 1721 | u64 iova; |
| 1841 | u64 length; | 1722 | u64 length; |
| 1842 | unsigned int page_size; | 1723 | unsigned int page_size; |
| 1724 | enum ib_mr_type type; | ||
| 1843 | bool need_inval; | 1725 | bool need_inval; |
| 1844 | union { | 1726 | union { |
| 1845 | struct ib_uobject *uobject; /* user */ | 1727 | struct ib_uobject *uobject; /* user */ |
| @@ -1847,7 +1729,7 @@ struct ib_mr { | |||
| 1847 | }; | 1729 | }; |
| 1848 | 1730 | ||
| 1849 | struct ib_dm *dm; | 1731 | struct ib_dm *dm; |
| 1850 | 1732 | struct ib_sig_attrs *sig_attrs; /* only for IB_MR_TYPE_INTEGRITY MRs */ | |
| 1851 | /* | 1733 | /* |
| 1852 | * Implementation details of the RDMA core, don't use in drivers: | 1734 | * Implementation details of the RDMA core, don't use in drivers: |
| 1853 | */ | 1735 | */ |
| @@ -2243,6 +2125,8 @@ struct ib_port_data { | |||
| 2243 | spinlock_t netdev_lock; | 2125 | spinlock_t netdev_lock; |
| 2244 | struct net_device __rcu *netdev; | 2126 | struct net_device __rcu *netdev; |
| 2245 | struct hlist_node ndev_hash_link; | 2127 | struct hlist_node ndev_hash_link; |
| 2128 | struct rdma_port_counter port_counter; | ||
| 2129 | struct rdma_hw_stats *hw_stats; | ||
| 2246 | }; | 2130 | }; |
| 2247 | 2131 | ||
| 2248 | /* rdma netdev type - specifies protocol type */ | 2132 | /* rdma netdev type - specifies protocol type */ |
| @@ -2329,6 +2213,11 @@ struct iw_cm_conn_param; | |||
| 2329 | * need to define the supported operations, otherwise they will be set to null. | 2213 | * need to define the supported operations, otherwise they will be set to null. |
| 2330 | */ | 2214 | */ |
| 2331 | struct ib_device_ops { | 2215 | struct ib_device_ops { |
| 2216 | struct module *owner; | ||
| 2217 | enum rdma_driver_id driver_id; | ||
| 2218 | u32 uverbs_abi_ver; | ||
| 2219 | unsigned int uverbs_no_driver_id_binding:1; | ||
| 2220 | |||
| 2332 | int (*post_send)(struct ib_qp *qp, const struct ib_send_wr *send_wr, | 2221 | int (*post_send)(struct ib_qp *qp, const struct ib_send_wr *send_wr, |
| 2333 | const struct ib_send_wr **bad_send_wr); | 2222 | const struct ib_send_wr **bad_send_wr); |
| 2334 | int (*post_recv)(struct ib_qp *qp, const struct ib_recv_wr *recv_wr, | 2223 | int (*post_recv)(struct ib_qp *qp, const struct ib_recv_wr *recv_wr, |
| @@ -2454,11 +2343,10 @@ struct ib_device_ops { | |||
| 2454 | int (*query_qp)(struct ib_qp *qp, struct ib_qp_attr *qp_attr, | 2343 | int (*query_qp)(struct ib_qp *qp, struct ib_qp_attr *qp_attr, |
| 2455 | int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); | 2344 | int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); |
| 2456 | int (*destroy_qp)(struct ib_qp *qp, struct ib_udata *udata); | 2345 | int (*destroy_qp)(struct ib_qp *qp, struct ib_udata *udata); |
| 2457 | struct ib_cq *(*create_cq)(struct ib_device *device, | 2346 | int (*create_cq)(struct ib_cq *cq, const struct ib_cq_init_attr *attr, |
| 2458 | const struct ib_cq_init_attr *attr, | 2347 | struct ib_udata *udata); |
| 2459 | struct ib_udata *udata); | ||
| 2460 | int (*modify_cq)(struct ib_cq *cq, u16 cq_count, u16 cq_period); | 2348 | int (*modify_cq)(struct ib_cq *cq, u16 cq_count, u16 cq_period); |
| 2461 | int (*destroy_cq)(struct ib_cq *cq, struct ib_udata *udata); | 2349 | void (*destroy_cq)(struct ib_cq *cq, struct ib_udata *udata); |
| 2462 | int (*resize_cq)(struct ib_cq *cq, int cqe, struct ib_udata *udata); | 2350 | int (*resize_cq)(struct ib_cq *cq, int cqe, struct ib_udata *udata); |
| 2463 | struct ib_mr *(*get_dma_mr)(struct ib_pd *pd, int mr_access_flags); | 2351 | struct ib_mr *(*get_dma_mr)(struct ib_pd *pd, int mr_access_flags); |
| 2464 | struct ib_mr *(*reg_user_mr)(struct ib_pd *pd, u64 start, u64 length, | 2352 | struct ib_mr *(*reg_user_mr)(struct ib_pd *pd, u64 start, u64 length, |
| @@ -2470,6 +2358,9 @@ struct ib_device_ops { | |||
| 2470 | int (*dereg_mr)(struct ib_mr *mr, struct ib_udata *udata); | 2358 | int (*dereg_mr)(struct ib_mr *mr, struct ib_udata *udata); |
| 2471 | struct ib_mr *(*alloc_mr)(struct ib_pd *pd, enum ib_mr_type mr_type, | 2359 | struct ib_mr *(*alloc_mr)(struct ib_pd *pd, enum ib_mr_type mr_type, |
| 2472 | u32 max_num_sg, struct ib_udata *udata); | 2360 | u32 max_num_sg, struct ib_udata *udata); |
| 2361 | struct ib_mr *(*alloc_mr_integrity)(struct ib_pd *pd, | ||
| 2362 | u32 max_num_data_sg, | ||
| 2363 | u32 max_num_meta_sg); | ||
| 2473 | int (*advise_mr)(struct ib_pd *pd, | 2364 | int (*advise_mr)(struct ib_pd *pd, |
| 2474 | enum ib_uverbs_advise_mr_advice advice, u32 flags, | 2365 | enum ib_uverbs_advise_mr_advice advice, u32 flags, |
| 2475 | struct ib_sge *sg_list, u32 num_sge, | 2366 | struct ib_sge *sg_list, u32 num_sge, |
| @@ -2516,7 +2407,7 @@ struct ib_device_ops { | |||
| 2516 | struct ib_wq *(*create_wq)(struct ib_pd *pd, | 2407 | struct ib_wq *(*create_wq)(struct ib_pd *pd, |
| 2517 | struct ib_wq_init_attr *init_attr, | 2408 | struct ib_wq_init_attr *init_attr, |
| 2518 | struct ib_udata *udata); | 2409 | struct ib_udata *udata); |
| 2519 | int (*destroy_wq)(struct ib_wq *wq, struct ib_udata *udata); | 2410 | void (*destroy_wq)(struct ib_wq *wq, struct ib_udata *udata); |
| 2520 | int (*modify_wq)(struct ib_wq *wq, struct ib_wq_attr *attr, | 2411 | int (*modify_wq)(struct ib_wq *wq, struct ib_wq_attr *attr, |
| 2521 | u32 wq_attr_mask, struct ib_udata *udata); | 2412 | u32 wq_attr_mask, struct ib_udata *udata); |
| 2522 | struct ib_rwq_ind_table *(*create_rwq_ind_table)( | 2413 | struct ib_rwq_ind_table *(*create_rwq_ind_table)( |
| @@ -2538,6 +2429,11 @@ struct ib_device_ops { | |||
| 2538 | int (*read_counters)(struct ib_counters *counters, | 2429 | int (*read_counters)(struct ib_counters *counters, |
| 2539 | struct ib_counters_read_attr *counters_read_attr, | 2430 | struct ib_counters_read_attr *counters_read_attr, |
| 2540 | struct uverbs_attr_bundle *attrs); | 2431 | struct uverbs_attr_bundle *attrs); |
| 2432 | int (*map_mr_sg_pi)(struct ib_mr *mr, struct scatterlist *data_sg, | ||
| 2433 | int data_sg_nents, unsigned int *data_sg_offset, | ||
| 2434 | struct scatterlist *meta_sg, int meta_sg_nents, | ||
| 2435 | unsigned int *meta_sg_offset); | ||
| 2436 | |||
| 2541 | /** | 2437 | /** |
| 2542 | * alloc_hw_stats - Allocate a struct rdma_hw_stats and fill in the | 2438 | * alloc_hw_stats - Allocate a struct rdma_hw_stats and fill in the |
| 2543 | * driver initialized data. The struct is kfree()'ed by the sysfs | 2439 | * driver initialized data. The struct is kfree()'ed by the sysfs |
| @@ -2595,8 +2491,34 @@ struct ib_device_ops { | |||
| 2595 | u8 pdata_len); | 2491 | u8 pdata_len); |
| 2596 | int (*iw_create_listen)(struct iw_cm_id *cm_id, int backlog); | 2492 | int (*iw_create_listen)(struct iw_cm_id *cm_id, int backlog); |
| 2597 | int (*iw_destroy_listen)(struct iw_cm_id *cm_id); | 2493 | int (*iw_destroy_listen)(struct iw_cm_id *cm_id); |
| 2494 | /** | ||
| 2495 | * counter_bind_qp - Bind a QP to a counter. | ||
| 2496 | * @counter - The counter to be bound. If counter->id is zero then | ||
| 2497 | * the driver needs to allocate a new counter and set counter->id | ||
| 2498 | */ | ||
| 2499 | int (*counter_bind_qp)(struct rdma_counter *counter, struct ib_qp *qp); | ||
| 2500 | /** | ||
| 2501 | * counter_unbind_qp - Unbind the qp from the dynamically-allocated | ||
| 2502 | * counter and bind it onto the default one | ||
| 2503 | */ | ||
| 2504 | int (*counter_unbind_qp)(struct ib_qp *qp); | ||
| 2505 | /** | ||
| 2506 | * counter_dealloc -De-allocate the hw counter | ||
| 2507 | */ | ||
| 2508 | int (*counter_dealloc)(struct rdma_counter *counter); | ||
| 2509 | /** | ||
| 2510 | * counter_alloc_stats - Allocate a struct rdma_hw_stats and fill in | ||
| 2511 | * the driver initialized data. | ||
| 2512 | */ | ||
| 2513 | struct rdma_hw_stats *(*counter_alloc_stats)( | ||
| 2514 | struct rdma_counter *counter); | ||
| 2515 | /** | ||
| 2516 | * counter_update_stats - Query the stats value of this counter | ||
| 2517 | */ | ||
| 2518 | int (*counter_update_stats)(struct rdma_counter *counter); | ||
| 2598 | 2519 | ||
| 2599 | DECLARE_RDMA_OBJ_SIZE(ib_ah); | 2520 | DECLARE_RDMA_OBJ_SIZE(ib_ah); |
| 2521 | DECLARE_RDMA_OBJ_SIZE(ib_cq); | ||
| 2600 | DECLARE_RDMA_OBJ_SIZE(ib_pd); | 2522 | DECLARE_RDMA_OBJ_SIZE(ib_pd); |
| 2601 | DECLARE_RDMA_OBJ_SIZE(ib_srq); | 2523 | DECLARE_RDMA_OBJ_SIZE(ib_srq); |
| 2602 | DECLARE_RDMA_OBJ_SIZE(ib_ucontext); | 2524 | DECLARE_RDMA_OBJ_SIZE(ib_ucontext); |
| @@ -2636,7 +2558,6 @@ struct ib_device { | |||
| 2636 | 2558 | ||
| 2637 | int num_comp_vectors; | 2559 | int num_comp_vectors; |
| 2638 | 2560 | ||
| 2639 | struct module *owner; | ||
| 2640 | union { | 2561 | union { |
| 2641 | struct device dev; | 2562 | struct device dev; |
| 2642 | struct ib_core_device coredev; | 2563 | struct ib_core_device coredev; |
| @@ -2648,7 +2569,6 @@ struct ib_device { | |||
| 2648 | */ | 2569 | */ |
| 2649 | const struct attribute_group *groups[3]; | 2570 | const struct attribute_group *groups[3]; |
| 2650 | 2571 | ||
| 2651 | int uverbs_abi_ver; | ||
| 2652 | u64 uverbs_cmd_mask; | 2572 | u64 uverbs_cmd_mask; |
| 2653 | u64 uverbs_ex_cmd_mask; | 2573 | u64 uverbs_ex_cmd_mask; |
| 2654 | 2574 | ||
| @@ -2658,6 +2578,8 @@ struct ib_device { | |||
| 2658 | u16 is_switch:1; | 2578 | u16 is_switch:1; |
| 2659 | /* Indicates kernel verbs support, should not be used in drivers */ | 2579 | /* Indicates kernel verbs support, should not be used in drivers */ |
| 2660 | u16 kverbs_provider:1; | 2580 | u16 kverbs_provider:1; |
| 2581 | /* CQ adaptive moderation (RDMA DIM) */ | ||
| 2582 | u16 use_cq_dim:1; | ||
| 2661 | u8 node_type; | 2583 | u8 node_type; |
| 2662 | u8 phys_port_cnt; | 2584 | u8 phys_port_cnt; |
| 2663 | struct ib_device_attr attrs; | 2585 | struct ib_device_attr attrs; |
| @@ -2672,7 +2594,6 @@ struct ib_device { | |||
| 2672 | struct rdma_restrack_root *res; | 2594 | struct rdma_restrack_root *res; |
| 2673 | 2595 | ||
| 2674 | const struct uapi_definition *driver_def; | 2596 | const struct uapi_definition *driver_def; |
| 2675 | enum rdma_driver_id driver_id; | ||
| 2676 | 2597 | ||
| 2677 | /* | 2598 | /* |
| 2678 | * Positive refcount indicates that the device is currently | 2599 | * Positive refcount indicates that the device is currently |
| @@ -2694,11 +2615,15 @@ struct ib_device { | |||
| 2694 | u32 iw_driver_flags; | 2615 | u32 iw_driver_flags; |
| 2695 | }; | 2616 | }; |
| 2696 | 2617 | ||
| 2618 | struct ib_client_nl_info; | ||
| 2697 | struct ib_client { | 2619 | struct ib_client { |
| 2698 | const char *name; | 2620 | const char *name; |
| 2699 | void (*add) (struct ib_device *); | 2621 | void (*add) (struct ib_device *); |
| 2700 | void (*remove)(struct ib_device *, void *client_data); | 2622 | void (*remove)(struct ib_device *, void *client_data); |
| 2701 | void (*rename)(struct ib_device *dev, void *client_data); | 2623 | void (*rename)(struct ib_device *dev, void *client_data); |
| 2624 | int (*get_nl_info)(struct ib_device *ibdev, void *client_data, | ||
| 2625 | struct ib_client_nl_info *res); | ||
| 2626 | int (*get_global_nl_info)(struct ib_client_nl_info *res); | ||
| 2702 | 2627 | ||
| 2703 | /* Returns the net_dev belonging to this ib_client and matching the | 2628 | /* Returns the net_dev belonging to this ib_client and matching the |
| 2704 | * given parameters. | 2629 | * given parameters. |
| @@ -3859,9 +3784,9 @@ int ib_destroy_cq_user(struct ib_cq *cq, struct ib_udata *udata); | |||
| 3859 | * | 3784 | * |
| 3860 | * NOTE: for user cq use ib_destroy_cq_user with valid udata! | 3785 | * NOTE: for user cq use ib_destroy_cq_user with valid udata! |
| 3861 | */ | 3786 | */ |
| 3862 | static inline int ib_destroy_cq(struct ib_cq *cq) | 3787 | static inline void ib_destroy_cq(struct ib_cq *cq) |
| 3863 | { | 3788 | { |
| 3864 | return ib_destroy_cq_user(cq, NULL); | 3789 | ib_destroy_cq_user(cq, NULL); |
| 3865 | } | 3790 | } |
| 3866 | 3791 | ||
| 3867 | /** | 3792 | /** |
| @@ -4148,6 +4073,10 @@ static inline struct ib_mr *ib_alloc_mr(struct ib_pd *pd, | |||
| 4148 | return ib_alloc_mr_user(pd, mr_type, max_num_sg, NULL); | 4073 | return ib_alloc_mr_user(pd, mr_type, max_num_sg, NULL); |
| 4149 | } | 4074 | } |
| 4150 | 4075 | ||
| 4076 | struct ib_mr *ib_alloc_mr_integrity(struct ib_pd *pd, | ||
| 4077 | u32 max_num_data_sg, | ||
| 4078 | u32 max_num_meta_sg); | ||
| 4079 | |||
| 4151 | /** | 4080 | /** |
| 4152 | * ib_update_fast_reg_key - updates the key portion of the fast_reg MR | 4081 | * ib_update_fast_reg_key - updates the key portion of the fast_reg MR |
| 4153 | * R_Key and L_Key. | 4082 | * R_Key and L_Key. |
| @@ -4332,6 +4261,10 @@ int ib_destroy_rwq_ind_table(struct ib_rwq_ind_table *wq_ind_table); | |||
| 4332 | 4261 | ||
| 4333 | int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, | 4262 | int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, |
| 4334 | unsigned int *sg_offset, unsigned int page_size); | 4263 | unsigned int *sg_offset, unsigned int page_size); |
| 4264 | int ib_map_mr_sg_pi(struct ib_mr *mr, struct scatterlist *data_sg, | ||
| 4265 | int data_sg_nents, unsigned int *data_sg_offset, | ||
| 4266 | struct scatterlist *meta_sg, int meta_sg_nents, | ||
| 4267 | unsigned int *meta_sg_offset, unsigned int page_size); | ||
| 4335 | 4268 | ||
| 4336 | static inline int | 4269 | static inline int |
| 4337 | ib_map_mr_sg_zbva(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, | 4270 | ib_map_mr_sg_zbva(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, |
diff --git a/include/rdma/mr_pool.h b/include/rdma/mr_pool.h index 83763ef82354..e77123bcb43b 100644 --- a/include/rdma/mr_pool.h +++ b/include/rdma/mr_pool.h | |||
| @@ -11,7 +11,7 @@ struct ib_mr *ib_mr_pool_get(struct ib_qp *qp, struct list_head *list); | |||
| 11 | void ib_mr_pool_put(struct ib_qp *qp, struct list_head *list, struct ib_mr *mr); | 11 | void ib_mr_pool_put(struct ib_qp *qp, struct list_head *list, struct ib_mr *mr); |
| 12 | 12 | ||
| 13 | int ib_mr_pool_init(struct ib_qp *qp, struct list_head *list, int nr, | 13 | int ib_mr_pool_init(struct ib_qp *qp, struct list_head *list, int nr, |
| 14 | enum ib_mr_type type, u32 max_num_sg); | 14 | enum ib_mr_type type, u32 max_num_sg, u32 max_num_meta_sg); |
| 15 | void ib_mr_pool_destroy(struct ib_qp *qp, struct list_head *list); | 15 | void ib_mr_pool_destroy(struct ib_qp *qp, struct list_head *list); |
| 16 | 16 | ||
| 17 | #endif /* _RDMA_MR_POOL_H */ | 17 | #endif /* _RDMA_MR_POOL_H */ |
diff --git a/include/rdma/rdma_counter.h b/include/rdma/rdma_counter.h new file mode 100644 index 000000000000..eb99856e8b30 --- /dev/null +++ b/include/rdma/rdma_counter.h | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2019 Mellanox Technologies. All rights reserved. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef _RDMA_COUNTER_H_ | ||
| 7 | #define _RDMA_COUNTER_H_ | ||
| 8 | |||
| 9 | #include <linux/mutex.h> | ||
| 10 | #include <linux/pid_namespace.h> | ||
| 11 | |||
| 12 | #include <rdma/restrack.h> | ||
| 13 | #include <rdma/rdma_netlink.h> | ||
| 14 | |||
| 15 | struct ib_device; | ||
| 16 | struct ib_qp; | ||
| 17 | |||
| 18 | struct auto_mode_param { | ||
| 19 | int qp_type; | ||
| 20 | }; | ||
| 21 | |||
| 22 | struct rdma_counter_mode { | ||
| 23 | enum rdma_nl_counter_mode mode; | ||
| 24 | enum rdma_nl_counter_mask mask; | ||
| 25 | struct auto_mode_param param; | ||
| 26 | }; | ||
| 27 | |||
| 28 | struct rdma_port_counter { | ||
| 29 | struct rdma_counter_mode mode; | ||
| 30 | struct rdma_hw_stats *hstats; | ||
| 31 | unsigned int num_counters; | ||
| 32 | struct mutex lock; | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct rdma_counter { | ||
| 36 | struct rdma_restrack_entry res; | ||
| 37 | struct ib_device *device; | ||
| 38 | uint32_t id; | ||
| 39 | struct kref kref; | ||
| 40 | struct rdma_counter_mode mode; | ||
| 41 | struct mutex lock; | ||
| 42 | struct rdma_hw_stats *stats; | ||
| 43 | u8 port; | ||
| 44 | }; | ||
| 45 | |||
| 46 | void rdma_counter_init(struct ib_device *dev); | ||
| 47 | void rdma_counter_release(struct ib_device *dev); | ||
| 48 | int rdma_counter_set_auto_mode(struct ib_device *dev, u8 port, | ||
| 49 | bool on, enum rdma_nl_counter_mask mask); | ||
| 50 | int rdma_counter_bind_qp_auto(struct ib_qp *qp, u8 port); | ||
| 51 | int rdma_counter_unbind_qp(struct ib_qp *qp, bool force); | ||
| 52 | |||
| 53 | int rdma_counter_query_stats(struct rdma_counter *counter); | ||
| 54 | u64 rdma_counter_get_hwstat_value(struct ib_device *dev, u8 port, u32 index); | ||
| 55 | int rdma_counter_bind_qpn(struct ib_device *dev, u8 port, | ||
| 56 | u32 qp_num, u32 counter_id); | ||
| 57 | int rdma_counter_bind_qpn_alloc(struct ib_device *dev, u8 port, | ||
| 58 | u32 qp_num, u32 *counter_id); | ||
| 59 | int rdma_counter_unbind_qpn(struct ib_device *dev, u8 port, | ||
| 60 | u32 qp_num, u32 counter_id); | ||
| 61 | int rdma_counter_get_mode(struct ib_device *dev, u8 port, | ||
| 62 | enum rdma_nl_counter_mode *mode, | ||
| 63 | enum rdma_nl_counter_mask *mask); | ||
| 64 | |||
| 65 | #endif /* _RDMA_COUNTER_H_ */ | ||
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h index 10732ab31ba2..6631624e4d7c 100644 --- a/include/rdma/rdma_netlink.h +++ b/include/rdma/rdma_netlink.h | |||
| @@ -6,6 +6,12 @@ | |||
| 6 | #include <linux/netlink.h> | 6 | #include <linux/netlink.h> |
| 7 | #include <uapi/rdma/rdma_netlink.h> | 7 | #include <uapi/rdma/rdma_netlink.h> |
| 8 | 8 | ||
| 9 | enum { | ||
| 10 | RDMA_NLDEV_ATTR_EMPTY_STRING = 1, | ||
| 11 | RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16, | ||
| 12 | RDMA_NLDEV_ATTR_CHARDEV_TYPE_SIZE = 32, | ||
| 13 | }; | ||
| 14 | |||
| 9 | struct rdma_nl_cbs { | 15 | struct rdma_nl_cbs { |
| 10 | int (*doit)(struct sk_buff *skb, struct nlmsghdr *nlh, | 16 | int (*doit)(struct sk_buff *skb, struct nlmsghdr *nlh, |
| 11 | struct netlink_ext_ack *extack); | 17 | struct netlink_ext_ack *extack); |
| @@ -110,4 +116,6 @@ void rdma_link_register(struct rdma_link_ops *ops); | |||
| 110 | void rdma_link_unregister(struct rdma_link_ops *ops); | 116 | void rdma_link_unregister(struct rdma_link_ops *ops); |
| 111 | 117 | ||
| 112 | #define MODULE_ALIAS_RDMA_LINK(type) MODULE_ALIAS("rdma-link-" type) | 118 | #define MODULE_ALIAS_RDMA_LINK(type) MODULE_ALIAS("rdma-link-" type) |
| 119 | #define MODULE_ALIAS_RDMA_CLIENT(type) MODULE_ALIAS("rdma-client-" type) | ||
| 120 | |||
| 113 | #endif /* _RDMA_NETLINK_H */ | 121 | #endif /* _RDMA_NETLINK_H */ |
diff --git a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h index b9cd06db1a71..525848e227dc 100644 --- a/include/rdma/rdma_vt.h +++ b/include/rdma/rdma_vt.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define DEF_RDMA_VT_H | 2 | #define DEF_RDMA_VT_H |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | * Copyright(c) 2016 - 2018 Intel Corporation. | 5 | * Copyright(c) 2016 - 2019 Intel Corporation. |
| 6 | * | 6 | * |
| 7 | * This file is provided under a dual BSD/GPLv2 license. When using or | 7 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 8 | * redistributing this file, you may do so under either license. | 8 | * redistributing this file, you may do so under either license. |
| @@ -202,7 +202,6 @@ struct rvt_pd { | |||
| 202 | struct rvt_ah { | 202 | struct rvt_ah { |
| 203 | struct ib_ah ibah; | 203 | struct ib_ah ibah; |
| 204 | struct rdma_ah_attr attr; | 204 | struct rdma_ah_attr attr; |
| 205 | atomic_t refcount; | ||
| 206 | u8 vl; | 205 | u8 vl; |
| 207 | u8 log_pmtu; | 206 | u8 log_pmtu; |
| 208 | }; | 207 | }; |
| @@ -555,7 +554,7 @@ static inline u16 rvt_get_pkey(struct rvt_dev_info *rdi, | |||
| 555 | 554 | ||
| 556 | struct rvt_dev_info *rvt_alloc_device(size_t size, int nports); | 555 | struct rvt_dev_info *rvt_alloc_device(size_t size, int nports); |
| 557 | void rvt_dealloc_device(struct rvt_dev_info *rdi); | 556 | void rvt_dealloc_device(struct rvt_dev_info *rdi); |
| 558 | int rvt_register_device(struct rvt_dev_info *rvd, u32 driver_id); | 557 | int rvt_register_device(struct rvt_dev_info *rvd); |
| 559 | void rvt_unregister_device(struct rvt_dev_info *rvd); | 558 | void rvt_unregister_device(struct rvt_dev_info *rvd); |
| 560 | int rvt_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr); | 559 | int rvt_check_ah(struct ib_device *ibdev, struct rdma_ah_attr *ah_attr); |
| 561 | int rvt_init_port(struct rvt_dev_info *rdi, struct rvt_ibport *port, | 560 | int rvt_init_port(struct rvt_dev_info *rdi, struct rvt_ibport *port, |
diff --git a/include/rdma/rdmavt_cq.h b/include/rdma/rdmavt_cq.h index 75dc65c0bfb8..04c519ef6d71 100644 --- a/include/rdma/rdmavt_cq.h +++ b/include/rdma/rdmavt_cq.h | |||
| @@ -61,18 +61,27 @@ | |||
| 61 | #define RVT_CQ_NONE (IB_CQ_NEXT_COMP + 1) | 61 | #define RVT_CQ_NONE (IB_CQ_NEXT_COMP + 1) |
| 62 | 62 | ||
| 63 | /* | 63 | /* |
| 64 | * Define read macro that apply smp_load_acquire memory barrier | ||
| 65 | * when reading indice of circular buffer that mmaped to user space. | ||
| 66 | */ | ||
| 67 | #define RDMA_READ_UAPI_ATOMIC(member) smp_load_acquire(&(member).val) | ||
| 68 | |||
| 69 | /* | ||
| 70 | * Define write macro that uses smp_store_release memory barrier | ||
| 71 | * when writing indice of circular buffer that mmaped to user space. | ||
| 72 | */ | ||
| 73 | #define RDMA_WRITE_UAPI_ATOMIC(member, x) smp_store_release(&(member).val, x) | ||
| 74 | #include <rdma/rvt-abi.h> | ||
| 75 | |||
| 76 | /* | ||
| 64 | * This structure is used to contain the head pointer, tail pointer, | 77 | * This structure is used to contain the head pointer, tail pointer, |
| 65 | * and completion queue entries as a single memory allocation so | 78 | * and completion queue entries as a single memory allocation so |
| 66 | * it can be mmap'ed into user space. | 79 | * it can be mmap'ed into user space. |
| 67 | */ | 80 | */ |
| 68 | struct rvt_cq_wc { | 81 | struct rvt_k_cq_wc { |
| 69 | u32 head; /* index of next entry to fill */ | 82 | u32 head; /* index of next entry to fill */ |
| 70 | u32 tail; /* index of next ib_poll_cq() entry */ | 83 | u32 tail; /* index of next ib_poll_cq() entry */ |
| 71 | union { | 84 | struct ib_wc kqueue[]; |
| 72 | /* these are actually size ibcq.cqe + 1 */ | ||
| 73 | struct ib_uverbs_wc uqueue[0]; | ||
| 74 | struct ib_wc kqueue[0]; | ||
| 75 | }; | ||
| 76 | }; | 85 | }; |
| 77 | 86 | ||
| 78 | /* | 87 | /* |
| @@ -84,10 +93,12 @@ struct rvt_cq { | |||
| 84 | spinlock_t lock; /* protect changes in this struct */ | 93 | spinlock_t lock; /* protect changes in this struct */ |
| 85 | u8 notify; | 94 | u8 notify; |
| 86 | u8 triggered; | 95 | u8 triggered; |
| 96 | u8 cq_full; | ||
| 87 | int comp_vector_cpu; | 97 | int comp_vector_cpu; |
| 88 | struct rvt_dev_info *rdi; | 98 | struct rvt_dev_info *rdi; |
| 89 | struct rvt_cq_wc *queue; | 99 | struct rvt_cq_wc *queue; |
| 90 | struct rvt_mmap_info *ip; | 100 | struct rvt_mmap_info *ip; |
| 101 | struct rvt_k_cq_wc *kqueue; | ||
| 91 | }; | 102 | }; |
| 92 | 103 | ||
| 93 | static inline struct rvt_cq *ibcq_to_rvtcq(struct ib_cq *ibcq) | 104 | static inline struct rvt_cq *ibcq_to_rvtcq(struct ib_cq *ibcq) |
| @@ -95,6 +106,6 @@ static inline struct rvt_cq *ibcq_to_rvtcq(struct ib_cq *ibcq) | |||
| 95 | return container_of(ibcq, struct rvt_cq, ibcq); | 106 | return container_of(ibcq, struct rvt_cq, ibcq); |
| 96 | } | 107 | } |
| 97 | 108 | ||
| 98 | void rvt_cq_enter(struct rvt_cq *cq, struct ib_wc *entry, bool solicited); | 109 | bool rvt_cq_enter(struct rvt_cq *cq, struct ib_wc *entry, bool solicited); |
| 99 | 110 | ||
| 100 | #endif /* DEF_RDMAVT_INCCQH */ | 111 | #endif /* DEF_RDMAVT_INCCQH */ |
diff --git a/include/rdma/rdmavt_qp.h b/include/rdma/rdmavt_qp.h index 68e38c20afc0..0eeea520a853 100644 --- a/include/rdma/rdmavt_qp.h +++ b/include/rdma/rdmavt_qp.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define DEF_RDMAVT_INCQP_H | 2 | #define DEF_RDMAVT_INCQP_H |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | * Copyright(c) 2016 - 2018 Intel Corporation. | 5 | * Copyright(c) 2016 - 2019 Intel Corporation. |
| 6 | * | 6 | * |
| 7 | * This file is provided under a dual BSD/GPLv2 license. When using or | 7 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 8 | * redistributing this file, you may do so under either license. | 8 | * redistributing this file, you may do so under either license. |
| @@ -52,6 +52,7 @@ | |||
| 52 | #include <rdma/ib_pack.h> | 52 | #include <rdma/ib_pack.h> |
| 53 | #include <rdma/ib_verbs.h> | 53 | #include <rdma/ib_verbs.h> |
| 54 | #include <rdma/rdmavt_cq.h> | 54 | #include <rdma/rdmavt_cq.h> |
| 55 | #include <rdma/rvt-abi.h> | ||
| 55 | /* | 56 | /* |
| 56 | * Atomic bit definitions for r_aflags. | 57 | * Atomic bit definitions for r_aflags. |
| 57 | */ | 58 | */ |
| @@ -156,6 +157,22 @@ | |||
| 156 | #define RVT_SEND_RESERVE_USED IB_SEND_RESERVED_START | 157 | #define RVT_SEND_RESERVE_USED IB_SEND_RESERVED_START |
| 157 | #define RVT_SEND_COMPLETION_ONLY (IB_SEND_RESERVED_START << 1) | 158 | #define RVT_SEND_COMPLETION_ONLY (IB_SEND_RESERVED_START << 1) |
| 158 | 159 | ||
| 160 | /** | ||
| 161 | * rvt_ud_wr - IB UD work plus AH cache | ||
| 162 | * @wr: valid IB work request | ||
| 163 | * @attr: pointer to an allocated AH attribute | ||
| 164 | * | ||
| 165 | * Special case the UD WR so we can keep track of the AH attributes. | ||
| 166 | * | ||
| 167 | * NOTE: This data structure is stricly ordered wr then attr. I.e the attr | ||
| 168 | * MUST come after wr. The ib_ud_wr is sized and copied in rvt_post_one_wr. | ||
| 169 | * The copy assumes that wr is first. | ||
| 170 | */ | ||
| 171 | struct rvt_ud_wr { | ||
| 172 | struct ib_ud_wr wr; | ||
| 173 | struct rdma_ah_attr *attr; | ||
| 174 | }; | ||
| 175 | |||
| 159 | /* | 176 | /* |
| 160 | * Send work request queue entry. | 177 | * Send work request queue entry. |
| 161 | * The size of the sg_list is determined when the QP is created and stored | 178 | * The size of the sg_list is determined when the QP is created and stored |
| @@ -164,7 +181,7 @@ | |||
| 164 | struct rvt_swqe { | 181 | struct rvt_swqe { |
| 165 | union { | 182 | union { |
| 166 | struct ib_send_wr wr; /* don't use wr.sg_list */ | 183 | struct ib_send_wr wr; /* don't use wr.sg_list */ |
| 167 | struct ib_ud_wr ud_wr; | 184 | struct rvt_ud_wr ud_wr; |
| 168 | struct ib_reg_wr reg_wr; | 185 | struct ib_reg_wr reg_wr; |
| 169 | struct ib_rdma_wr rdma_wr; | 186 | struct ib_rdma_wr rdma_wr; |
| 170 | struct ib_atomic_wr atomic_wr; | 187 | struct ib_atomic_wr atomic_wr; |
| @@ -177,33 +194,84 @@ struct rvt_swqe { | |||
| 177 | struct rvt_sge sg_list[0]; | 194 | struct rvt_sge sg_list[0]; |
| 178 | }; | 195 | }; |
| 179 | 196 | ||
| 180 | /* | 197 | /** |
| 181 | * Receive work request queue entry. | 198 | * struct rvt_krwq - kernel struct receive work request |
| 182 | * The size of the sg_list is determined when the QP (or SRQ) is created | 199 | * @p_lock: lock to protect producer of the kernel buffer |
| 183 | * and stored in qp->r_rq.max_sge (or srq->rq.max_sge). | 200 | * @head: index of next entry to fill |
| 201 | * @c_lock:lock to protect consumer of the kernel buffer | ||
| 202 | * @tail: index of next entry to pull | ||
| 203 | * @count: count is aproximate of total receive enteries posted | ||
| 204 | * @rvt_rwqe: struct of receive work request queue entry | ||
| 205 | * | ||
| 206 | * This structure is used to contain the head pointer, | ||
| 207 | * tail pointer and receive work queue entries for kernel | ||
| 208 | * mode user. | ||
| 184 | */ | 209 | */ |
| 185 | struct rvt_rwqe { | 210 | struct rvt_krwq { |
| 186 | u64 wr_id; | 211 | spinlock_t p_lock; /* protect producer */ |
| 187 | u8 num_sge; | ||
| 188 | struct ib_sge sg_list[0]; | ||
| 189 | }; | ||
| 190 | |||
| 191 | /* | ||
| 192 | * This structure is used to contain the head pointer, tail pointer, | ||
| 193 | * and receive work queue entries as a single memory allocation so | ||
| 194 | * it can be mmap'ed into user space. | ||
| 195 | * Note that the wq array elements are variable size so you can't | ||
| 196 | * just index into the array to get the N'th element; | ||
| 197 | * use get_rwqe_ptr() instead. | ||
| 198 | */ | ||
| 199 | struct rvt_rwq { | ||
| 200 | u32 head; /* new work requests posted to the head */ | 212 | u32 head; /* new work requests posted to the head */ |
| 213 | |||
| 214 | /* protect consumer */ | ||
| 215 | spinlock_t c_lock ____cacheline_aligned_in_smp; | ||
| 201 | u32 tail; /* receives pull requests from here. */ | 216 | u32 tail; /* receives pull requests from here. */ |
| 202 | struct rvt_rwqe wq[0]; | 217 | u32 count; /* approx count of receive entries posted */ |
| 218 | struct rvt_rwqe *curr_wq; | ||
| 219 | struct rvt_rwqe wq[]; | ||
| 203 | }; | 220 | }; |
| 204 | 221 | ||
| 222 | /* | ||
| 223 | * rvt_get_swqe_ah - Return the pointer to the struct rvt_ah | ||
| 224 | * @swqe: valid Send WQE | ||
| 225 | * | ||
| 226 | */ | ||
| 227 | static inline struct rvt_ah *rvt_get_swqe_ah(struct rvt_swqe *swqe) | ||
| 228 | { | ||
| 229 | return ibah_to_rvtah(swqe->ud_wr.wr.ah); | ||
| 230 | } | ||
| 231 | |||
| 232 | /** | ||
| 233 | * rvt_get_swqe_ah_attr - Return the cached ah attribute information | ||
| 234 | * @swqe: valid Send WQE | ||
| 235 | * | ||
| 236 | */ | ||
| 237 | static inline struct rdma_ah_attr *rvt_get_swqe_ah_attr(struct rvt_swqe *swqe) | ||
| 238 | { | ||
| 239 | return swqe->ud_wr.attr; | ||
| 240 | } | ||
| 241 | |||
| 242 | /** | ||
| 243 | * rvt_get_swqe_remote_qpn - Access the remote QPN value | ||
| 244 | * @swqe: valid Send WQE | ||
| 245 | * | ||
| 246 | */ | ||
| 247 | static inline u32 rvt_get_swqe_remote_qpn(struct rvt_swqe *swqe) | ||
| 248 | { | ||
| 249 | return swqe->ud_wr.wr.remote_qpn; | ||
| 250 | } | ||
| 251 | |||
| 252 | /** | ||
| 253 | * rvt_get_swqe_remote_qkey - Acces the remote qkey value | ||
| 254 | * @swqe: valid Send WQE | ||
| 255 | * | ||
| 256 | */ | ||
| 257 | static inline u32 rvt_get_swqe_remote_qkey(struct rvt_swqe *swqe) | ||
| 258 | { | ||
| 259 | return swqe->ud_wr.wr.remote_qkey; | ||
| 260 | } | ||
| 261 | |||
| 262 | /** | ||
| 263 | * rvt_get_swqe_pkey_index - Access the pkey index | ||
| 264 | * @swqe: valid Send WQE | ||
| 265 | * | ||
| 266 | */ | ||
| 267 | static inline u16 rvt_get_swqe_pkey_index(struct rvt_swqe *swqe) | ||
| 268 | { | ||
| 269 | return swqe->ud_wr.wr.pkey_index; | ||
| 270 | } | ||
| 271 | |||
| 205 | struct rvt_rq { | 272 | struct rvt_rq { |
| 206 | struct rvt_rwq *wq; | 273 | struct rvt_rwq *wq; |
| 274 | struct rvt_krwq *kwq; | ||
| 207 | u32 size; /* size of RWQE array */ | 275 | u32 size; /* size of RWQE array */ |
| 208 | u8 max_sge; | 276 | u8 max_sge; |
| 209 | /* protect changes in this struct */ | 277 | /* protect changes in this struct */ |
| @@ -472,7 +540,7 @@ static inline struct rvt_swqe *rvt_get_swqe_ptr(struct rvt_qp *qp, | |||
| 472 | static inline struct rvt_rwqe *rvt_get_rwqe_ptr(struct rvt_rq *rq, unsigned n) | 540 | static inline struct rvt_rwqe *rvt_get_rwqe_ptr(struct rvt_rq *rq, unsigned n) |
| 473 | { | 541 | { |
| 474 | return (struct rvt_rwqe *) | 542 | return (struct rvt_rwqe *) |
| 475 | ((char *)rq->wq->wq + | 543 | ((char *)rq->kwq->curr_wq + |
| 476 | (sizeof(struct rvt_rwqe) + | 544 | (sizeof(struct rvt_rwqe) + |
| 477 | rq->max_sge * sizeof(struct ib_sge)) * n); | 545 | rq->max_sge * sizeof(struct ib_sge)) * n); |
| 478 | } | 546 | } |
| @@ -565,42 +633,6 @@ static inline void rvt_qp_wqe_unreserve( | |||
| 565 | 633 | ||
| 566 | extern const enum ib_wc_opcode ib_rvt_wc_opcode[]; | 634 | extern const enum ib_wc_opcode ib_rvt_wc_opcode[]; |
| 567 | 635 | ||
| 568 | /** | ||
| 569 | * rvt_qp_swqe_complete() - insert send completion | ||
| 570 | * @qp - the qp | ||
| 571 | * @wqe - the send wqe | ||
| 572 | * @status - completion status | ||
| 573 | * | ||
| 574 | * Insert a send completion into the completion | ||
| 575 | * queue if the qp indicates it should be done. | ||
| 576 | * | ||
| 577 | * See IBTA 10.7.3.1 for info on completion | ||
| 578 | * control. | ||
| 579 | */ | ||
| 580 | static inline void rvt_qp_swqe_complete( | ||
| 581 | struct rvt_qp *qp, | ||
| 582 | struct rvt_swqe *wqe, | ||
| 583 | enum ib_wc_opcode opcode, | ||
| 584 | enum ib_wc_status status) | ||
| 585 | { | ||
| 586 | if (unlikely(wqe->wr.send_flags & RVT_SEND_RESERVE_USED)) | ||
| 587 | return; | ||
| 588 | if (!(qp->s_flags & RVT_S_SIGNAL_REQ_WR) || | ||
| 589 | (wqe->wr.send_flags & IB_SEND_SIGNALED) || | ||
| 590 | status != IB_WC_SUCCESS) { | ||
| 591 | struct ib_wc wc; | ||
| 592 | |||
| 593 | memset(&wc, 0, sizeof(wc)); | ||
| 594 | wc.wr_id = wqe->wr.wr_id; | ||
| 595 | wc.status = status; | ||
| 596 | wc.opcode = opcode; | ||
| 597 | wc.qp = &qp->ibqp; | ||
| 598 | wc.byte_len = wqe->length; | ||
| 599 | rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.send_cq), &wc, | ||
| 600 | status != IB_WC_SUCCESS); | ||
| 601 | } | ||
| 602 | } | ||
| 603 | |||
| 604 | /* | 636 | /* |
| 605 | * Compare the lower 24 bits of the msn values. | 637 | * Compare the lower 24 bits of the msn values. |
| 606 | * Returns an integer <, ==, or > than zero. | 638 | * Returns an integer <, ==, or > than zero. |
| @@ -734,7 +766,119 @@ static inline void rvt_put_qp_swqe(struct rvt_qp *qp, struct rvt_swqe *wqe) | |||
| 734 | { | 766 | { |
| 735 | rvt_put_swqe(wqe); | 767 | rvt_put_swqe(wqe); |
| 736 | if (qp->allowed_ops == IB_OPCODE_UD) | 768 | if (qp->allowed_ops == IB_OPCODE_UD) |
| 737 | atomic_dec(&ibah_to_rvtah(wqe->ud_wr.ah)->refcount); | 769 | rdma_destroy_ah_attr(wqe->ud_wr.attr); |
| 770 | } | ||
| 771 | |||
| 772 | /** | ||
| 773 | * rvt_qp_sqwe_incr - increment ring index | ||
| 774 | * @qp: the qp | ||
| 775 | * @val: the starting value | ||
| 776 | * | ||
| 777 | * Return: the new value wrapping as appropriate | ||
| 778 | */ | ||
| 779 | static inline u32 | ||
| 780 | rvt_qp_swqe_incr(struct rvt_qp *qp, u32 val) | ||
| 781 | { | ||
| 782 | if (++val >= qp->s_size) | ||
| 783 | val = 0; | ||
| 784 | return val; | ||
| 785 | } | ||
| 786 | |||
| 787 | int rvt_error_qp(struct rvt_qp *qp, enum ib_wc_status err); | ||
| 788 | |||
| 789 | /** | ||
| 790 | * rvt_recv_cq - add a new entry to completion queue | ||
| 791 | * by receive queue | ||
| 792 | * @qp: receive queue | ||
| 793 | * @wc: work completion entry to add | ||
| 794 | * @solicited: true if @entry is solicited | ||
| 795 | * | ||
| 796 | * This is wrapper function for rvt_enter_cq function call by | ||
| 797 | * receive queue. If rvt_cq_enter return false, it means cq is | ||
| 798 | * full and the qp is put into error state. | ||
| 799 | */ | ||
| 800 | static inline void rvt_recv_cq(struct rvt_qp *qp, struct ib_wc *wc, | ||
| 801 | bool solicited) | ||
| 802 | { | ||
| 803 | struct rvt_cq *cq = ibcq_to_rvtcq(qp->ibqp.recv_cq); | ||
| 804 | |||
| 805 | if (unlikely(!rvt_cq_enter(cq, wc, solicited))) | ||
| 806 | rvt_error_qp(qp, IB_WC_LOC_QP_OP_ERR); | ||
| 807 | } | ||
| 808 | |||
| 809 | /** | ||
| 810 | * rvt_send_cq - add a new entry to completion queue | ||
| 811 | * by send queue | ||
| 812 | * @qp: send queue | ||
| 813 | * @wc: work completion entry to add | ||
| 814 | * @solicited: true if @entry is solicited | ||
| 815 | * | ||
| 816 | * This is wrapper function for rvt_enter_cq function call by | ||
| 817 | * send queue. If rvt_cq_enter return false, it means cq is | ||
| 818 | * full and the qp is put into error state. | ||
| 819 | */ | ||
| 820 | static inline void rvt_send_cq(struct rvt_qp *qp, struct ib_wc *wc, | ||
| 821 | bool solicited) | ||
| 822 | { | ||
| 823 | struct rvt_cq *cq = ibcq_to_rvtcq(qp->ibqp.send_cq); | ||
| 824 | |||
| 825 | if (unlikely(!rvt_cq_enter(cq, wc, solicited))) | ||
| 826 | rvt_error_qp(qp, IB_WC_LOC_QP_OP_ERR); | ||
| 827 | } | ||
| 828 | |||
| 829 | /** | ||
| 830 | * rvt_qp_complete_swqe - insert send completion | ||
| 831 | * @qp - the qp | ||
| 832 | * @wqe - the send wqe | ||
| 833 | * @opcode - wc operation (driver dependent) | ||
| 834 | * @status - completion status | ||
| 835 | * | ||
| 836 | * Update the s_last information, and then insert a send | ||
| 837 | * completion into the completion | ||
| 838 | * queue if the qp indicates it should be done. | ||
| 839 | * | ||
| 840 | * See IBTA 10.7.3.1 for info on completion | ||
| 841 | * control. | ||
| 842 | * | ||
| 843 | * Return: new last | ||
| 844 | */ | ||
| 845 | static inline u32 | ||
| 846 | rvt_qp_complete_swqe(struct rvt_qp *qp, | ||
| 847 | struct rvt_swqe *wqe, | ||
| 848 | enum ib_wc_opcode opcode, | ||
| 849 | enum ib_wc_status status) | ||
| 850 | { | ||
| 851 | bool need_completion; | ||
| 852 | u64 wr_id; | ||
| 853 | u32 byte_len, last; | ||
| 854 | int flags = wqe->wr.send_flags; | ||
| 855 | |||
| 856 | rvt_put_qp_swqe(qp, wqe); | ||
| 857 | |||
| 858 | need_completion = | ||
| 859 | !(flags & RVT_SEND_RESERVE_USED) && | ||
| 860 | (!(qp->s_flags & RVT_S_SIGNAL_REQ_WR) || | ||
| 861 | (flags & IB_SEND_SIGNALED) || | ||
| 862 | status != IB_WC_SUCCESS); | ||
| 863 | if (need_completion) { | ||
| 864 | wr_id = wqe->wr.wr_id; | ||
| 865 | byte_len = wqe->length; | ||
| 866 | /* above fields required before writing s_last */ | ||
| 867 | } | ||
| 868 | last = rvt_qp_swqe_incr(qp, qp->s_last); | ||
| 869 | /* see rvt_qp_is_avail() */ | ||
| 870 | smp_store_release(&qp->s_last, last); | ||
| 871 | if (need_completion) { | ||
| 872 | struct ib_wc w = { | ||
| 873 | .wr_id = wr_id, | ||
| 874 | .status = status, | ||
| 875 | .opcode = opcode, | ||
| 876 | .qp = &qp->ibqp, | ||
| 877 | .byte_len = byte_len, | ||
| 878 | }; | ||
| 879 | rvt_send_cq(qp, &w, status != IB_WC_SUCCESS); | ||
| 880 | } | ||
| 881 | return last; | ||
| 738 | } | 882 | } |
| 739 | 883 | ||
| 740 | extern const int ib_rvt_state_ops[]; | 884 | extern const int ib_rvt_state_ops[]; |
| @@ -742,7 +886,6 @@ extern const int ib_rvt_state_ops[]; | |||
| 742 | struct rvt_dev_info; | 886 | struct rvt_dev_info; |
| 743 | int rvt_get_rwqe(struct rvt_qp *qp, bool wr_id_only); | 887 | int rvt_get_rwqe(struct rvt_qp *qp, bool wr_id_only); |
| 744 | void rvt_comm_est(struct rvt_qp *qp); | 888 | void rvt_comm_est(struct rvt_qp *qp); |
| 745 | int rvt_error_qp(struct rvt_qp *qp, enum ib_wc_status err); | ||
| 746 | void rvt_rc_error(struct rvt_qp *qp, enum ib_wc_status err); | 889 | void rvt_rc_error(struct rvt_qp *qp, enum ib_wc_status err); |
| 747 | unsigned long rvt_rnr_tbl_to_usec(u32 index); | 890 | unsigned long rvt_rnr_tbl_to_usec(u32 index); |
| 748 | enum hrtimer_restart rvt_rc_rnr_retry(struct hrtimer *t); | 891 | enum hrtimer_restart rvt_rc_rnr_retry(struct hrtimer *t); |
| @@ -784,6 +927,53 @@ struct rvt_qp_iter { | |||
| 784 | int n; | 927 | int n; |
| 785 | }; | 928 | }; |
| 786 | 929 | ||
| 930 | /** | ||
| 931 | * ib_cq_tail - Return tail index of cq buffer | ||
| 932 | * @send_cq - The cq for send | ||
| 933 | * | ||
| 934 | * This is called in qp_iter_print to get tail | ||
| 935 | * of cq buffer. | ||
| 936 | */ | ||
| 937 | static inline u32 ib_cq_tail(struct ib_cq *send_cq) | ||
| 938 | { | ||
| 939 | struct rvt_cq *cq = ibcq_to_rvtcq(send_cq); | ||
| 940 | |||
| 941 | return ibcq_to_rvtcq(send_cq)->ip ? | ||
| 942 | RDMA_READ_UAPI_ATOMIC(cq->queue->tail) : | ||
| 943 | ibcq_to_rvtcq(send_cq)->kqueue->tail; | ||
| 944 | } | ||
| 945 | |||
| 946 | /** | ||
| 947 | * ib_cq_head - Return head index of cq buffer | ||
| 948 | * @send_cq - The cq for send | ||
| 949 | * | ||
| 950 | * This is called in qp_iter_print to get head | ||
| 951 | * of cq buffer. | ||
| 952 | */ | ||
| 953 | static inline u32 ib_cq_head(struct ib_cq *send_cq) | ||
| 954 | { | ||
| 955 | struct rvt_cq *cq = ibcq_to_rvtcq(send_cq); | ||
| 956 | |||
| 957 | return ibcq_to_rvtcq(send_cq)->ip ? | ||
| 958 | RDMA_READ_UAPI_ATOMIC(cq->queue->head) : | ||
| 959 | ibcq_to_rvtcq(send_cq)->kqueue->head; | ||
| 960 | } | ||
| 961 | |||
| 962 | /** | ||
| 963 | * rvt_free_rq - free memory allocated for rvt_rq struct | ||
| 964 | * @rvt_rq: request queue data structure | ||
| 965 | * | ||
| 966 | * This function should only be called if the rvt_mmap_info() | ||
| 967 | * has not succeeded. | ||
| 968 | */ | ||
| 969 | static inline void rvt_free_rq(struct rvt_rq *rq) | ||
| 970 | { | ||
| 971 | kvfree(rq->kwq); | ||
| 972 | rq->kwq = NULL; | ||
| 973 | vfree(rq->wq); | ||
| 974 | rq->wq = NULL; | ||
| 975 | } | ||
| 976 | |||
| 787 | struct rvt_qp_iter *rvt_qp_iter_init(struct rvt_dev_info *rdi, | 977 | struct rvt_qp_iter *rvt_qp_iter_init(struct rvt_dev_info *rdi, |
| 788 | u64 v, | 978 | u64 v, |
| 789 | void (*cb)(struct rvt_qp *qp, u64 v)); | 979 | void (*cb)(struct rvt_qp *qp, u64 v)); |
diff --git a/include/rdma/restrack.h b/include/rdma/restrack.h index ecf3c7702a4f..b0fc6b26bdf5 100644 --- a/include/rdma/restrack.h +++ b/include/rdma/restrack.h | |||
| @@ -14,6 +14,9 @@ | |||
| 14 | #include <uapi/rdma/rdma_netlink.h> | 14 | #include <uapi/rdma/rdma_netlink.h> |
| 15 | #include <linux/xarray.h> | 15 | #include <linux/xarray.h> |
| 16 | 16 | ||
| 17 | struct ib_device; | ||
| 18 | struct sk_buff; | ||
| 19 | |||
| 17 | /** | 20 | /** |
| 18 | * enum rdma_restrack_type - HW objects to track | 21 | * enum rdma_restrack_type - HW objects to track |
| 19 | */ | 22 | */ |
| @@ -43,13 +46,15 @@ enum rdma_restrack_type { | |||
| 43 | */ | 46 | */ |
| 44 | RDMA_RESTRACK_CTX, | 47 | RDMA_RESTRACK_CTX, |
| 45 | /** | 48 | /** |
| 49 | * @RDMA_RESTRACK_COUNTER: Statistic Counter | ||
| 50 | */ | ||
| 51 | RDMA_RESTRACK_COUNTER, | ||
| 52 | /** | ||
| 46 | * @RDMA_RESTRACK_MAX: Last entry, used for array dclarations | 53 | * @RDMA_RESTRACK_MAX: Last entry, used for array dclarations |
| 47 | */ | 54 | */ |
| 48 | RDMA_RESTRACK_MAX | 55 | RDMA_RESTRACK_MAX |
| 49 | }; | 56 | }; |
| 50 | 57 | ||
| 51 | struct ib_device; | ||
| 52 | |||
| 53 | /** | 58 | /** |
| 54 | * struct rdma_restrack_entry - metadata per-entry | 59 | * struct rdma_restrack_entry - metadata per-entry |
| 55 | */ | 60 | */ |
diff --git a/include/rdma/rw.h b/include/rdma/rw.h index 494f79ca3e62..6ad9dc836c10 100644 --- a/include/rdma/rw.h +++ b/include/rdma/rw.h | |||
| @@ -39,15 +39,6 @@ struct rdma_rw_ctx { | |||
| 39 | struct ib_send_wr inv_wr; | 39 | struct ib_send_wr inv_wr; |
| 40 | struct ib_mr *mr; | 40 | struct ib_mr *mr; |
| 41 | } *reg; | 41 | } *reg; |
| 42 | |||
| 43 | struct { | ||
| 44 | struct rdma_rw_reg_ctx data; | ||
| 45 | struct rdma_rw_reg_ctx prot; | ||
| 46 | struct ib_send_wr sig_inv_wr; | ||
| 47 | struct ib_mr *sig_mr; | ||
| 48 | struct ib_sge sig_sge; | ||
| 49 | struct ib_sig_handover_wr sig_wr; | ||
| 50 | } *sig; | ||
| 51 | }; | 42 | }; |
| 52 | }; | 43 | }; |
| 53 | 44 | ||
diff --git a/include/rdma/signature.h b/include/rdma/signature.h new file mode 100644 index 000000000000..f24cc2a1d3c5 --- /dev/null +++ b/include/rdma/signature.h | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | /* SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2017-2018 Mellanox Technologies. All rights reserved. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef _RDMA_SIGNATURE_H_ | ||
| 7 | #define _RDMA_SIGNATURE_H_ | ||
| 8 | |||
| 9 | enum ib_signature_prot_cap { | ||
| 10 | IB_PROT_T10DIF_TYPE_1 = 1, | ||
| 11 | IB_PROT_T10DIF_TYPE_2 = 1 << 1, | ||
| 12 | IB_PROT_T10DIF_TYPE_3 = 1 << 2, | ||
| 13 | }; | ||
| 14 | |||
| 15 | enum ib_signature_guard_cap { | ||
| 16 | IB_GUARD_T10DIF_CRC = 1, | ||
| 17 | IB_GUARD_T10DIF_CSUM = 1 << 1, | ||
| 18 | }; | ||
| 19 | |||
| 20 | /** | ||
| 21 | * enum ib_signature_type - Signature types | ||
| 22 | * @IB_SIG_TYPE_NONE: Unprotected. | ||
| 23 | * @IB_SIG_TYPE_T10_DIF: Type T10-DIF | ||
| 24 | */ | ||
| 25 | enum ib_signature_type { | ||
| 26 | IB_SIG_TYPE_NONE, | ||
| 27 | IB_SIG_TYPE_T10_DIF, | ||
| 28 | }; | ||
| 29 | |||
| 30 | /** | ||
| 31 | * enum ib_t10_dif_bg_type - Signature T10-DIF block-guard types | ||
| 32 | * @IB_T10DIF_CRC: Corresponds to T10-PI mandated CRC checksum rules. | ||
| 33 | * @IB_T10DIF_CSUM: Corresponds to IP checksum rules. | ||
| 34 | */ | ||
| 35 | enum ib_t10_dif_bg_type { | ||
| 36 | IB_T10DIF_CRC, | ||
| 37 | IB_T10DIF_CSUM, | ||
| 38 | }; | ||
| 39 | |||
| 40 | /** | ||
| 41 | * struct ib_t10_dif_domain - Parameters specific for T10-DIF | ||
| 42 | * domain. | ||
| 43 | * @bg_type: T10-DIF block guard type (CRC|CSUM) | ||
| 44 | * @pi_interval: protection information interval. | ||
| 45 | * @bg: seed of guard computation. | ||
| 46 | * @app_tag: application tag of guard block | ||
| 47 | * @ref_tag: initial guard block reference tag. | ||
| 48 | * @ref_remap: Indicate wethear the reftag increments each block | ||
| 49 | * @app_escape: Indicate to skip block check if apptag=0xffff | ||
| 50 | * @ref_escape: Indicate to skip block check if reftag=0xffffffff | ||
| 51 | * @apptag_check_mask: check bitmask of application tag. | ||
| 52 | */ | ||
| 53 | struct ib_t10_dif_domain { | ||
| 54 | enum ib_t10_dif_bg_type bg_type; | ||
| 55 | u16 pi_interval; | ||
| 56 | u16 bg; | ||
| 57 | u16 app_tag; | ||
| 58 | u32 ref_tag; | ||
| 59 | bool ref_remap; | ||
| 60 | bool app_escape; | ||
| 61 | bool ref_escape; | ||
| 62 | u16 apptag_check_mask; | ||
| 63 | }; | ||
| 64 | |||
| 65 | /** | ||
| 66 | * struct ib_sig_domain - Parameters for signature domain | ||
| 67 | * @sig_type: specific signauture type | ||
| 68 | * @sig: union of all signature domain attributes that may | ||
| 69 | * be used to set domain layout. | ||
| 70 | */ | ||
| 71 | struct ib_sig_domain { | ||
| 72 | enum ib_signature_type sig_type; | ||
| 73 | union { | ||
| 74 | struct ib_t10_dif_domain dif; | ||
| 75 | } sig; | ||
| 76 | }; | ||
| 77 | |||
| 78 | /** | ||
| 79 | * struct ib_sig_attrs - Parameters for signature handover operation | ||
| 80 | * @check_mask: bitmask for signature byte check (8 bytes) | ||
| 81 | * @mem: memory domain layout descriptor. | ||
| 82 | * @wire: wire domain layout descriptor. | ||
| 83 | * @meta_length: metadata length | ||
| 84 | */ | ||
| 85 | struct ib_sig_attrs { | ||
| 86 | u8 check_mask; | ||
| 87 | struct ib_sig_domain mem; | ||
| 88 | struct ib_sig_domain wire; | ||
| 89 | int meta_length; | ||
| 90 | }; | ||
| 91 | |||
| 92 | enum ib_sig_err_type { | ||
| 93 | IB_SIG_BAD_GUARD, | ||
| 94 | IB_SIG_BAD_REFTAG, | ||
| 95 | IB_SIG_BAD_APPTAG, | ||
| 96 | }; | ||
| 97 | |||
| 98 | /* | ||
| 99 | * Signature check masks (8 bytes in total) according to the T10-PI standard: | ||
| 100 | * -------- -------- ------------ | ||
| 101 | * | GUARD | APPTAG | REFTAG | | ||
| 102 | * | 2B | 2B | 4B | | ||
| 103 | * -------- -------- ------------ | ||
| 104 | */ | ||
| 105 | enum { | ||
| 106 | IB_SIG_CHECK_GUARD = 0xc0, | ||
| 107 | IB_SIG_CHECK_APPTAG = 0x30, | ||
| 108 | IB_SIG_CHECK_REFTAG = 0x0f, | ||
| 109 | }; | ||
| 110 | |||
| 111 | /* | ||
| 112 | * struct ib_sig_err - signature error descriptor | ||
| 113 | */ | ||
| 114 | struct ib_sig_err { | ||
| 115 | enum ib_sig_err_type err_type; | ||
| 116 | u32 expected; | ||
| 117 | u32 actual; | ||
| 118 | u64 sig_err_offset; | ||
| 119 | u32 key; | ||
| 120 | }; | ||
| 121 | |||
| 122 | #endif /* _RDMA_SIGNATURE_H_ */ | ||
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h index 9710254fd98c..e0a3423ba09e 100644 --- a/include/scsi/fc/fc_fip.h +++ b/include/scsi/fc/fc_fip.h | |||
| @@ -1,18 +1,6 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright 2008 Cisco Systems, Inc. All rights reserved. | 3 | * Copyright 2008 Cisco Systems, Inc. All rights reserved. |
| 3 | * | ||
| 4 | * This program is free software; you may redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; version 2 of the License. | ||
| 7 | * | ||
| 8 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 9 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 10 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 11 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 12 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 13 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 15 | * SOFTWARE. | ||
| 16 | */ | 4 | */ |
| 17 | #ifndef _FC_FIP_H_ | 5 | #ifndef _FC_FIP_H_ |
| 18 | #define _FC_FIP_H_ | 6 | #define _FC_FIP_H_ |
diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h index b1424dccf426..800d53dc9470 100644 --- a/include/scsi/fc/fc_ms.h +++ b/include/scsi/fc/fc_ms.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* * Copyright(c) 2011 Intel Corporation. All rights reserved. | 2 | /* |
| 3 | * Copyright(c) 2011 Intel Corporation. All rights reserved. | ||
| 3 | * | 4 | * |
| 4 | * Maintained at www.Open-FCoE.org | 5 | * Maintained at www.Open-FCoE.org |
| 5 | */ | 6 | */ |
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index 8b31588460d5..92b11c7e0b4f 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
| @@ -5,8 +5,6 @@ | |||
| 5 | * Copyright (C) 2005 Dmitry Yusupov | 5 | * Copyright (C) 2005 Dmitry Yusupov |
| 6 | * Copyright (C) 2005 Alex Aizman | 6 | * Copyright (C) 2005 Alex Aizman |
| 7 | * maintained by open-iscsi@googlegroups.com | 7 | * maintained by open-iscsi@googlegroups.com |
| 8 | * | ||
| 9 | * See the file COPYING included with this distribution for more details. | ||
| 10 | */ | 8 | */ |
| 11 | 9 | ||
| 12 | #ifndef ISCSI_IF_H | 10 | #ifndef ISCSI_IF_H |
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index aeb4980745ca..b71b5c4f418c 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h | |||
| @@ -5,8 +5,6 @@ | |||
| 5 | * Copyright (C) 2005 Dmitry Yusupov | 5 | * Copyright (C) 2005 Dmitry Yusupov |
| 6 | * Copyright (C) 2005 Alex Aizman | 6 | * Copyright (C) 2005 Alex Aizman |
| 7 | * maintained by open-iscsi@googlegroups.com | 7 | * maintained by open-iscsi@googlegroups.com |
| 8 | * | ||
| 9 | * See the file COPYING included with this distribution for more details. | ||
| 10 | */ | 8 | */ |
| 11 | 9 | ||
| 12 | #ifndef ISCSI_PROTO_H | 10 | #ifndef ISCSI_PROTO_H |
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h index 172f15e3dfd6..7c8ba9d7378b 100644 --- a/include/scsi/libiscsi_tcp.h +++ b/include/scsi/libiscsi_tcp.h | |||
| @@ -5,8 +5,6 @@ | |||
| 5 | * Copyright (C) 2008 Mike Christie | 5 | * Copyright (C) 2008 Mike Christie |
| 6 | * Copyright (C) 2008 Red Hat, Inc. All rights reserved. | 6 | * Copyright (C) 2008 Red Hat, Inc. All rights reserved. |
| 7 | * maintained by open-iscsi@googlegroups.com | 7 | * maintained by open-iscsi@googlegroups.com |
| 8 | * | ||
| 9 | * See the file COPYING included with this distribution for more details. | ||
| 10 | */ | 8 | */ |
| 11 | 9 | ||
| 12 | #ifndef LIBISCSI_TCP_H | 10 | #ifndef LIBISCSI_TCP_H |
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index e9664bb7d188..4e2d61e8fb1e 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * SAS host prototypes and structures header file | 3 | * SAS host prototypes and structures header file |
| 4 | * | 4 | * |
| @@ -207,8 +207,7 @@ struct sas_work { | |||
| 207 | struct work_struct work; | 207 | struct work_struct work; |
| 208 | }; | 208 | }; |
| 209 | 209 | ||
| 210 | /* Lots of code duplicates this in the SCSI tree, which can be factored out */ | 210 | static inline bool dev_is_expander(enum sas_device_type type) |
| 211 | static inline bool sas_dev_type_is_expander(enum sas_device_type type) | ||
| 212 | { | 211 | { |
| 213 | return type == SAS_EDGE_EXPANDER_DEVICE || | 212 | return type == SAS_EDGE_EXPANDER_DEVICE || |
| 214 | type == SAS_FANOUT_EXPANDER_DEVICE; | 213 | type == SAS_FANOUT_EXPANDER_DEVICE; |
diff --git a/include/scsi/sas.h b/include/scsi/sas.h index 97a0f6bd201c..a5d8ae49198c 100644 --- a/include/scsi/sas.h +++ b/include/scsi/sas.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * SAS structures and definitions header file | 3 | * SAS structures and definitions header file |
| 4 | * | 4 | * |
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h index 0580dce280a1..a0458bda3148 100644 --- a/include/scsi/scsi_transport.h +++ b/include/scsi/scsi_transport.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * Transport specific attributes. | 3 | * Transport specific attributes. |
| 4 | * | 4 | * |
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 43f09c7c25a2..7db2dd783834 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
| @@ -3,9 +3,6 @@ | |||
| 3 | * FiberChannel transport specific attributes exported to sysfs. | 3 | * FiberChannel transport specific attributes exported to sysfs. |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved. | 5 | * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved. |
| 6 | * | ||
| 7 | * ======== | ||
| 8 | * | ||
| 9 | * Copyright (C) 2004-2007 James Smart, Emulex Corporation | 6 | * Copyright (C) 2004-2007 James Smart, Emulex Corporation |
| 10 | * Rewrite for host, target, device, and remote port attributes, | 7 | * Rewrite for host, target, device, and remote port attributes, |
| 11 | * statistics, and service functions... | 8 | * statistics, and service functions... |
diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h index a7c602576b68..8f46ff3449d5 100644 --- a/include/sound/hda_codec.h +++ b/include/sound/hda_codec.h | |||
| @@ -18,6 +18,9 @@ | |||
| 18 | #include <sound/hda_verbs.h> | 18 | #include <sound/hda_verbs.h> |
| 19 | #include <sound/hda_regmap.h> | 19 | #include <sound/hda_regmap.h> |
| 20 | 20 | ||
| 21 | #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) | ||
| 22 | #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) | ||
| 23 | |||
| 21 | /* | 24 | /* |
| 22 | * Structures | 25 | * Structures |
| 23 | */ | 26 | */ |
| @@ -268,9 +271,6 @@ struct hda_codec { | |||
| 268 | unsigned long jackpoll_interval; /* In jiffies. Zero means no poll, rely on unsol events */ | 271 | unsigned long jackpoll_interval; /* In jiffies. Zero means no poll, rely on unsol events */ |
| 269 | struct delayed_work jackpoll_work; | 272 | struct delayed_work jackpoll_work; |
| 270 | 273 | ||
| 271 | /* jack detection */ | ||
| 272 | struct snd_array jacks; | ||
| 273 | |||
| 274 | int depop_delay; /* depop delay in ms, -1 for default delay time */ | 274 | int depop_delay; /* depop delay in ms, -1 for default delay time */ |
| 275 | 275 | ||
| 276 | /* fix-up list */ | 276 | /* fix-up list */ |
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index e8346784cf3f..612a17e375d0 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h | |||
| @@ -120,7 +120,7 @@ void snd_hdac_device_unregister(struct hdac_device *codec); | |||
| 120 | int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name); | 120 | int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name); |
| 121 | int snd_hdac_codec_modalias(struct hdac_device *hdac, char *buf, size_t size); | 121 | int snd_hdac_codec_modalias(struct hdac_device *hdac, char *buf, size_t size); |
| 122 | 122 | ||
| 123 | int snd_hdac_refresh_widgets(struct hdac_device *codec, bool sysfs); | 123 | int snd_hdac_refresh_widgets(struct hdac_device *codec); |
| 124 | 124 | ||
| 125 | unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid, | 125 | unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid, |
| 126 | unsigned int verb, unsigned int parm); | 126 | unsigned int verb, unsigned int parm); |
| @@ -358,6 +358,9 @@ struct hdac_bus { | |||
| 358 | bool align_bdle_4k:1; /* BDLE align 4K boundary */ | 358 | bool align_bdle_4k:1; /* BDLE align 4K boundary */ |
| 359 | bool reverse_assign:1; /* assign devices in reverse order */ | 359 | bool reverse_assign:1; /* assign devices in reverse order */ |
| 360 | bool corbrp_self_clear:1; /* CORBRP clears itself after reset */ | 360 | bool corbrp_self_clear:1; /* CORBRP clears itself after reset */ |
| 361 | bool polling_mode:1; | ||
| 362 | |||
| 363 | int poll_count; | ||
| 361 | 364 | ||
| 362 | int bdl_pos_adj; /* BDL position adjustment */ | 365 | int bdl_pos_adj; /* BDL position adjustment */ |
| 363 | 366 | ||
diff --git a/include/sound/madera-pdata.h b/include/sound/madera-pdata.h new file mode 100644 index 000000000000..e3060f48f108 --- /dev/null +++ b/include/sound/madera-pdata.h | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | /* | ||
| 3 | * Platform data for Madera codec driver | ||
| 4 | * | ||
| 5 | * Copyright (C) 2016-2019 Cirrus Logic, Inc. and | ||
| 6 | * Cirrus Logic International Semiconductor Ltd. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef MADERA_CODEC_PDATA_H | ||
| 10 | #define MADERA_CODEC_PDATA_H | ||
| 11 | |||
| 12 | #include <linux/kernel.h> | ||
| 13 | |||
| 14 | #define MADERA_MAX_INPUT 6 | ||
| 15 | #define MADERA_MAX_MUXED_CHANNELS 4 | ||
| 16 | #define MADERA_MAX_OUTPUT 6 | ||
| 17 | #define MADERA_MAX_AIF 4 | ||
| 18 | #define MADERA_MAX_PDM_SPK 2 | ||
| 19 | #define MADERA_MAX_DSP 7 | ||
| 20 | |||
| 21 | /** | ||
| 22 | * struct madera_codec_pdata | ||
| 23 | * | ||
| 24 | * @max_channels_clocked: Maximum number of channels that I2S clocks will be | ||
| 25 | * generated for. Useful when clock master for systems | ||
| 26 | * where the I2S bus has multiple data lines. | ||
| 27 | * @dmic_ref: Indicates how the MICBIAS pins have been externally | ||
| 28 | * connected to DMICs on each input. A value of 0 | ||
| 29 | * indicates MICVDD and is the default. Other values are: | ||
| 30 | * For CS47L35 one of the CS47L35_DMIC_REF_xxx values | ||
| 31 | * For all other codecs one of the MADERA_DMIC_REF_xxx | ||
| 32 | * Also see the datasheet for a description of the | ||
| 33 | * INn_DMIC_SUP field. | ||
| 34 | * @inmode: Mode for the ADC inputs. One of the MADERA_INMODE_xxx | ||
| 35 | * values. Two-dimensional array | ||
| 36 | * [input_number][channel number], with four slots per | ||
| 37 | * input in the order | ||
| 38 | * [n][0]=INnAL [n][1]=INnAR [n][2]=INnBL [n][3]=INnBR | ||
| 39 | * @out_mono: For each output set the value to TRUE to indicate that | ||
| 40 | * the output is mono. [0]=OUT1, [1]=OUT2, ... | ||
| 41 | * @pdm_fmt: PDM speaker data format. See the PDM_SPKn_FMT field in | ||
| 42 | * the datasheet for a description of this value. | ||
| 43 | * @pdm_mute: PDM mute format. See the PDM_SPKn_CTRL_1 register | ||
| 44 | * in the datasheet for a description of this value. | ||
| 45 | */ | ||
| 46 | struct madera_codec_pdata { | ||
| 47 | u32 max_channels_clocked[MADERA_MAX_AIF]; | ||
| 48 | |||
| 49 | u32 dmic_ref[MADERA_MAX_INPUT]; | ||
| 50 | |||
| 51 | u32 inmode[MADERA_MAX_INPUT][MADERA_MAX_MUXED_CHANNELS]; | ||
| 52 | |||
| 53 | bool out_mono[MADERA_MAX_OUTPUT]; | ||
| 54 | |||
| 55 | u32 pdm_fmt[MADERA_MAX_PDM_SPK]; | ||
| 56 | u32 pdm_mute[MADERA_MAX_PDM_SPK]; | ||
| 57 | }; | ||
| 58 | |||
| 59 | #endif | ||
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 3429888347e7..954563ee2277 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h | |||
| @@ -42,6 +42,7 @@ struct asoc_simple_priv { | |||
| 42 | struct simple_dai_props { | 42 | struct simple_dai_props { |
| 43 | struct asoc_simple_dai *cpu_dai; | 43 | struct asoc_simple_dai *cpu_dai; |
| 44 | struct asoc_simple_dai *codec_dai; | 44 | struct asoc_simple_dai *codec_dai; |
| 45 | struct snd_soc_dai_link_component cpus; /* single cpu */ | ||
| 45 | struct snd_soc_dai_link_component codecs; /* single codec */ | 46 | struct snd_soc_dai_link_component codecs; /* single codec */ |
| 46 | struct snd_soc_dai_link_component platforms; | 47 | struct snd_soc_dai_link_component platforms; |
| 47 | struct asoc_simple_data adata; | 48 | struct asoc_simple_data adata; |
| @@ -80,16 +81,12 @@ int asoc_simple_parse_card_name(struct snd_soc_card *card, | |||
| 80 | char *prefix); | 81 | char *prefix); |
| 81 | 82 | ||
| 82 | #define asoc_simple_parse_clk_cpu(dev, node, dai_link, simple_dai) \ | 83 | #define asoc_simple_parse_clk_cpu(dev, node, dai_link, simple_dai) \ |
| 83 | asoc_simple_parse_clk(dev, node, dai_link->cpu_of_node, simple_dai, \ | 84 | asoc_simple_parse_clk(dev, node, simple_dai, dai_link->cpus) |
| 84 | dai_link->cpu_dai_name, NULL) | ||
| 85 | #define asoc_simple_parse_clk_codec(dev, node, dai_link, simple_dai) \ | 85 | #define asoc_simple_parse_clk_codec(dev, node, dai_link, simple_dai) \ |
| 86 | asoc_simple_parse_clk(dev, node, dai_link->codec_of_node, simple_dai,\ | 86 | asoc_simple_parse_clk(dev, node, simple_dai, dai_link->codecs) |
| 87 | dai_link->codec_dai_name, dai_link->codecs) | ||
| 88 | int asoc_simple_parse_clk(struct device *dev, | 87 | int asoc_simple_parse_clk(struct device *dev, |
| 89 | struct device_node *node, | 88 | struct device_node *node, |
| 90 | struct device_node *dai_of_node, | ||
| 91 | struct asoc_simple_dai *simple_dai, | 89 | struct asoc_simple_dai *simple_dai, |
| 92 | const char *dai_name, | ||
| 93 | struct snd_soc_dai_link_component *dlc); | 90 | struct snd_soc_dai_link_component *dlc); |
| 94 | int asoc_simple_startup(struct snd_pcm_substream *substream); | 91 | int asoc_simple_startup(struct snd_pcm_substream *substream); |
| 95 | void asoc_simple_shutdown(struct snd_pcm_substream *substream); | 92 | void asoc_simple_shutdown(struct snd_pcm_substream *substream); |
| @@ -100,16 +97,11 @@ int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, | |||
| 100 | struct snd_pcm_hw_params *params); | 97 | struct snd_pcm_hw_params *params); |
| 101 | 98 | ||
| 102 | #define asoc_simple_parse_cpu(node, dai_link, is_single_link) \ | 99 | #define asoc_simple_parse_cpu(node, dai_link, is_single_link) \ |
| 103 | asoc_simple_parse_dai(node, NULL, \ | 100 | asoc_simple_parse_dai(node, dai_link->cpus, is_single_link) |
| 104 | &dai_link->cpu_of_node, \ | ||
| 105 | &dai_link->cpu_dai_name, is_single_link) | ||
| 106 | #define asoc_simple_parse_codec(node, dai_link) \ | 101 | #define asoc_simple_parse_codec(node, dai_link) \ |
| 107 | asoc_simple_parse_dai(node, dai_link->codecs, \ | 102 | asoc_simple_parse_dai(node, dai_link->codecs, NULL) |
| 108 | &dai_link->codec_of_node, \ | ||
| 109 | &dai_link->codec_dai_name, NULL) | ||
| 110 | #define asoc_simple_parse_platform(node, dai_link) \ | 103 | #define asoc_simple_parse_platform(node, dai_link) \ |
| 111 | asoc_simple_parse_dai(node, dai_link->platforms, \ | 104 | asoc_simple_parse_dai(node, dai_link->platforms, NULL) |
| 112 | &dai_link->platform_of_node, NULL, NULL) | ||
| 113 | 105 | ||
| 114 | #define asoc_simple_parse_tdm(np, dai) \ | 106 | #define asoc_simple_parse_tdm(np, dai) \ |
| 115 | snd_soc_of_parse_tdm_slot(np, &(dai)->tx_slot_mask, \ | 107 | snd_soc_of_parse_tdm_slot(np, &(dai)->tx_slot_mask, \ |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 482b4ea87c3c..4e8071269639 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
| @@ -901,74 +901,33 @@ struct snd_soc_dai_link { | |||
| 901 | const char *stream_name; /* Stream name */ | 901 | const char *stream_name; /* Stream name */ |
| 902 | 902 | ||
| 903 | /* | 903 | /* |
| 904 | * cpu_name | ||
| 905 | * cpu_of_node | ||
| 906 | * cpu_dai_name | ||
| 907 | * | ||
| 908 | * These are legacy style, and will be replaced to | ||
| 909 | * modern style (= snd_soc_dai_link_component) in the future, | ||
| 910 | * but, not yet supported so far. | ||
| 911 | * If modern style was supported for CPU, all driver will switch | ||
| 912 | * to use it, and, legacy style code will be removed from ALSA SoC. | ||
| 913 | */ | ||
| 914 | /* | ||
| 915 | * You MAY specify the link's CPU-side device, either by device name, | 904 | * You MAY specify the link's CPU-side device, either by device name, |
| 916 | * or by DT/OF node, but not both. If this information is omitted, | 905 | * or by DT/OF node, but not both. If this information is omitted, |
| 917 | * the CPU-side DAI is matched using .cpu_dai_name only, which hence | 906 | * the CPU-side DAI is matched using .cpu_dai_name only, which hence |
| 918 | * must be globally unique. These fields are currently typically used | 907 | * must be globally unique. These fields are currently typically used |
| 919 | * only for codec to codec links, or systems using device tree. | 908 | * only for codec to codec links, or systems using device tree. |
| 920 | */ | 909 | */ |
| 921 | const char *cpu_name; | ||
| 922 | struct device_node *cpu_of_node; | ||
| 923 | /* | 910 | /* |
| 924 | * You MAY specify the DAI name of the CPU DAI. If this information is | 911 | * You MAY specify the DAI name of the CPU DAI. If this information is |
| 925 | * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node | 912 | * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node |
| 926 | * only, which only works well when that device exposes a single DAI. | 913 | * only, which only works well when that device exposes a single DAI. |
| 927 | */ | 914 | */ |
| 928 | const char *cpu_dai_name; | 915 | struct snd_soc_dai_link_component *cpus; |
| 916 | unsigned int num_cpus; | ||
| 929 | 917 | ||
| 930 | /* | 918 | /* |
| 931 | * codec_name | ||
| 932 | * codec_of_node | ||
| 933 | * codec_dai_name | ||
| 934 | * | ||
| 935 | * These are legacy style, it will be converted to modern style | ||
| 936 | * (= snd_soc_dai_link_component) automatically in soc-core | ||
| 937 | * if driver is using legacy style. | ||
| 938 | * Driver shouldn't use both legacy and modern style in the same time. | ||
| 939 | * If modern style was supported for CPU, all driver will switch | ||
| 940 | * to use it, and, legacy style code will be removed from ALSA SoC. | ||
| 941 | */ | ||
| 942 | /* | ||
| 943 | * You MUST specify the link's codec, either by device name, or by | 919 | * You MUST specify the link's codec, either by device name, or by |
| 944 | * DT/OF node, but not both. | 920 | * DT/OF node, but not both. |
| 945 | */ | 921 | */ |
| 946 | const char *codec_name; | ||
| 947 | struct device_node *codec_of_node; | ||
| 948 | /* You MUST specify the DAI name within the codec */ | 922 | /* You MUST specify the DAI name within the codec */ |
| 949 | const char *codec_dai_name; | ||
| 950 | |||
| 951 | struct snd_soc_dai_link_component *codecs; | 923 | struct snd_soc_dai_link_component *codecs; |
| 952 | unsigned int num_codecs; | 924 | unsigned int num_codecs; |
| 953 | 925 | ||
| 954 | /* | 926 | /* |
| 955 | * platform_name | ||
| 956 | * platform_of_node | ||
| 957 | * | ||
| 958 | * These are legacy style, it will be converted to modern style | ||
| 959 | * (= snd_soc_dai_link_component) automatically in soc-core | ||
| 960 | * if driver is using legacy style. | ||
| 961 | * Driver shouldn't use both legacy and modern style in the same time. | ||
| 962 | * If modern style was supported for CPU, all driver will switch | ||
| 963 | * to use it, and, legacy style code will be removed from ALSA SoC. | ||
| 964 | */ | ||
| 965 | /* | ||
| 966 | * You MAY specify the link's platform/PCM/DMA driver, either by | 927 | * You MAY specify the link's platform/PCM/DMA driver, either by |
| 967 | * device name, or by DT/OF node, but not both. Some forms of link | 928 | * device name, or by DT/OF node, but not both. Some forms of link |
| 968 | * do not need a platform. | 929 | * do not need a platform. In such case, platforms are not mandatory. |
| 969 | */ | 930 | */ |
| 970 | const char *platform_name; | ||
| 971 | struct device_node *platform_of_node; | ||
| 972 | struct snd_soc_dai_link_component *platforms; | 931 | struct snd_soc_dai_link_component *platforms; |
| 973 | unsigned int num_platforms; | 932 | unsigned int num_platforms; |
| 974 | 933 | ||
| @@ -1030,12 +989,6 @@ struct snd_soc_dai_link { | |||
| 1030 | /* Do not create a PCM for this DAI link (Backend link) */ | 989 | /* Do not create a PCM for this DAI link (Backend link) */ |
| 1031 | unsigned int ignore:1; | 990 | unsigned int ignore:1; |
| 1032 | 991 | ||
| 1033 | /* | ||
| 1034 | * This driver uses legacy platform naming. Set by the core, machine | ||
| 1035 | * drivers should not modify this value. | ||
| 1036 | */ | ||
| 1037 | unsigned int legacy_platform:1; | ||
| 1038 | |||
| 1039 | struct list_head list; /* DAI link list of the soc card */ | 992 | struct list_head list; /* DAI link list of the soc card */ |
| 1040 | struct snd_soc_dobj dobj; /* For topology */ | 993 | struct snd_soc_dobj dobj; /* For topology */ |
| 1041 | }; | 994 | }; |
| @@ -1044,6 +997,100 @@ struct snd_soc_dai_link { | |||
| 1044 | ((i) < link->num_codecs) && ((codec) = &link->codecs[i]); \ | 997 | ((i) < link->num_codecs) && ((codec) = &link->codecs[i]); \ |
| 1045 | (i)++) | 998 | (i)++) |
| 1046 | 999 | ||
| 1000 | #define for_each_link_platforms(link, i, platform) \ | ||
| 1001 | for ((i) = 0; \ | ||
| 1002 | ((i) < link->num_platforms) && \ | ||
| 1003 | ((platform) = &link->platforms[i]); \ | ||
| 1004 | (i)++) | ||
| 1005 | |||
| 1006 | /* | ||
| 1007 | * Sample 1 : Single CPU/Codec/Platform | ||
| 1008 | * | ||
| 1009 | * SND_SOC_DAILINK_DEFS(test, | ||
| 1010 | * DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai")), | ||
| 1011 | * DAILINK_COMP_ARRAY(COMP_CODEC("codec", "codec_dai")), | ||
| 1012 | * DAILINK_COMP_ARRAY(COMP_PLATFORM("platform"))); | ||
| 1013 | * | ||
| 1014 | * struct snd_soc_dai_link link = { | ||
| 1015 | * ... | ||
| 1016 | * SND_SOC_DAILINK_REG(test), | ||
| 1017 | * }; | ||
| 1018 | * | ||
| 1019 | * Sample 2 : Multi CPU/Codec, no Platform | ||
| 1020 | * | ||
| 1021 | * SND_SOC_DAILINK_DEFS(test, | ||
| 1022 | * DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai1"), | ||
| 1023 | * COMP_CPU("cpu_dai2")), | ||
| 1024 | * DAILINK_COMP_ARRAY(COMP_CODEC("codec1", "codec_dai1"), | ||
| 1025 | * COMP_CODEC("codec2", "codec_dai2"))); | ||
| 1026 | * | ||
| 1027 | * struct snd_soc_dai_link link = { | ||
| 1028 | * ... | ||
| 1029 | * SND_SOC_DAILINK_REG(test), | ||
| 1030 | * }; | ||
| 1031 | * | ||
| 1032 | * Sample 3 : Define each CPU/Codec/Platform manually | ||
| 1033 | * | ||
| 1034 | * SND_SOC_DAILINK_DEF(test_cpu, | ||
| 1035 | * DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai1"), | ||
| 1036 | * COMP_CPU("cpu_dai2"))); | ||
| 1037 | * SND_SOC_DAILINK_DEF(test_codec, | ||
| 1038 | * DAILINK_COMP_ARRAY(COMP_CODEC("codec1", "codec_dai1"), | ||
| 1039 | * COMP_CODEC("codec2", "codec_dai2"))); | ||
| 1040 | * SND_SOC_DAILINK_DEF(test_platform, | ||
| 1041 | * DAILINK_COMP_ARRAY(COMP_PLATFORM("platform"))); | ||
| 1042 | * | ||
| 1043 | * struct snd_soc_dai_link link = { | ||
| 1044 | * ... | ||
| 1045 | * SND_SOC_DAILINK_REG(test_cpu, | ||
| 1046 | * test_codec, | ||
| 1047 | * test_platform), | ||
| 1048 | * }; | ||
| 1049 | * | ||
| 1050 | * Sample 4 : Sample3 without platform | ||
| 1051 | * | ||
| 1052 | * struct snd_soc_dai_link link = { | ||
| 1053 | * ... | ||
| 1054 | * SND_SOC_DAILINK_REG(test_cpu, | ||
| 1055 | * test_codec); | ||
| 1056 | * }; | ||
| 1057 | */ | ||
| 1058 | |||
| 1059 | #define SND_SOC_DAILINK_REG1(name) SND_SOC_DAILINK_REG3(name##_cpus, name##_codecs, name##_platforms) | ||
| 1060 | #define SND_SOC_DAILINK_REG2(cpu, codec) SND_SOC_DAILINK_REG3(cpu, codec, null_dailink_component) | ||
| 1061 | #define SND_SOC_DAILINK_REG3(cpu, codec, platform) \ | ||
| 1062 | .cpus = cpu, \ | ||
| 1063 | .num_cpus = ARRAY_SIZE(cpu), \ | ||
| 1064 | .codecs = codec, \ | ||
| 1065 | .num_codecs = ARRAY_SIZE(codec), \ | ||
| 1066 | .platforms = platform, \ | ||
| 1067 | .num_platforms = ARRAY_SIZE(platform) | ||
| 1068 | |||
| 1069 | #define SND_SOC_DAILINK_REGx(_1, _2, _3, func, ...) func | ||
| 1070 | #define SND_SOC_DAILINK_REG(...) \ | ||
| 1071 | SND_SOC_DAILINK_REGx(__VA_ARGS__, \ | ||
| 1072 | SND_SOC_DAILINK_REG3, \ | ||
| 1073 | SND_SOC_DAILINK_REG2, \ | ||
| 1074 | SND_SOC_DAILINK_REG1)(__VA_ARGS__) | ||
| 1075 | |||
| 1076 | #define SND_SOC_DAILINK_DEF(name, def...) \ | ||
| 1077 | static struct snd_soc_dai_link_component name[] = { def } | ||
| 1078 | |||
| 1079 | #define SND_SOC_DAILINK_DEFS(name, cpu, codec, platform...) \ | ||
| 1080 | SND_SOC_DAILINK_DEF(name##_cpus, cpu); \ | ||
| 1081 | SND_SOC_DAILINK_DEF(name##_codecs, codec); \ | ||
| 1082 | SND_SOC_DAILINK_DEF(name##_platforms, platform) | ||
| 1083 | |||
| 1084 | #define DAILINK_COMP_ARRAY(param...) param | ||
| 1085 | #define COMP_EMPTY() { } | ||
| 1086 | #define COMP_CPU(_dai) { .dai_name = _dai, } | ||
| 1087 | #define COMP_CODEC(_name, _dai) { .name = _name, .dai_name = _dai, } | ||
| 1088 | #define COMP_PLATFORM(_name) { .name = _name } | ||
| 1089 | #define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", } | ||
| 1090 | |||
| 1091 | extern struct snd_soc_dai_link_component null_dailink_component[0]; | ||
| 1092 | |||
| 1093 | |||
| 1047 | struct snd_soc_codec_conf { | 1094 | struct snd_soc_codec_conf { |
| 1048 | /* | 1095 | /* |
| 1049 | * specify device either by device name, or by | 1096 | * specify device either by device name, or by |
| @@ -1189,7 +1236,7 @@ struct snd_soc_card { | |||
| 1189 | (i)++) | 1236 | (i)++) |
| 1190 | 1237 | ||
| 1191 | #define for_each_card_links(card, link) \ | 1238 | #define for_each_card_links(card, link) \ |
| 1192 | list_for_each_entry(dai_link, &(card)->dai_link_list, list) | 1239 | list_for_each_entry(link, &(card)->dai_link_list, list) |
| 1193 | #define for_each_card_links_safe(card, link, _link) \ | 1240 | #define for_each_card_links_safe(card, link, _link) \ |
| 1194 | list_for_each_entry_safe(link, _link, &(card)->dai_link_list, list) | 1241 | list_for_each_entry_safe(link, _link, &(card)->dai_link_list, list) |
| 1195 | 1242 | ||
| @@ -1214,7 +1261,6 @@ struct snd_soc_pcm_runtime { | |||
| 1214 | 1261 | ||
| 1215 | /* Dynamic PCM BE runtime data */ | 1262 | /* Dynamic PCM BE runtime data */ |
| 1216 | struct snd_soc_dpcm_runtime dpcm[2]; | 1263 | struct snd_soc_dpcm_runtime dpcm[2]; |
| 1217 | int fe_compr; | ||
| 1218 | 1264 | ||
| 1219 | long pmdown_time; | 1265 | long pmdown_time; |
| 1220 | 1266 | ||
| @@ -1239,6 +1285,7 @@ struct snd_soc_pcm_runtime { | |||
| 1239 | /* bit field */ | 1285 | /* bit field */ |
| 1240 | unsigned int dev_registered:1; | 1286 | unsigned int dev_registered:1; |
| 1241 | unsigned int pop_wait:1; | 1287 | unsigned int pop_wait:1; |
| 1288 | unsigned int fe_compr:1; /* for Dynamic PCM */ | ||
| 1242 | }; | 1289 | }; |
| 1243 | #define for_each_rtd_codec_dai(rtd, i, dai)\ | 1290 | #define for_each_rtd_codec_dai(rtd, i, dai)\ |
| 1244 | for ((i) = 0; \ | 1291 | for ((i) = 0; \ |
| @@ -1607,15 +1654,11 @@ int snd_soc_fixup_dai_links_platform_name(struct snd_soc_card *card, | |||
| 1607 | if (!name) | 1654 | if (!name) |
| 1608 | return -ENOMEM; | 1655 | return -ENOMEM; |
| 1609 | 1656 | ||
| 1610 | if (dai_link->platforms) | 1657 | if (!dai_link->platforms) |
| 1611 | /* only single platform is supported for now */ | 1658 | return -EINVAL; |
| 1612 | dai_link->platforms->name = name; | 1659 | |
| 1613 | else | 1660 | /* only single platform is supported for now */ |
| 1614 | /* | 1661 | dai_link->platforms->name = name; |
| 1615 | * legacy mode, this case will be removed when all | ||
| 1616 | * derivers are switched to modern style dai_link. | ||
| 1617 | */ | ||
| 1618 | dai_link->platform_name = name; | ||
| 1619 | } | 1662 | } |
| 1620 | 1663 | ||
| 1621 | return 0; | 1664 | return 0; |
diff --git a/include/sound/sof/dai-intel.h b/include/sound/sof/dai-intel.h index 4bd83f7adddf..4bb8ee138ba7 100644 --- a/include/sound/sof/dai-intel.h +++ b/include/sound/sof/dai-intel.h | |||
| @@ -167,9 +167,10 @@ struct sof_ipc_dai_dmic_params { | |||
| 167 | 167 | ||
| 168 | uint32_t wake_up_time; /**< Time from clock start to data (us) */ | 168 | uint32_t wake_up_time; /**< Time from clock start to data (us) */ |
| 169 | uint32_t min_clock_on_time; /**< Min. time that clk is kept on (us) */ | 169 | uint32_t min_clock_on_time; /**< Min. time that clk is kept on (us) */ |
| 170 | uint32_t unmute_ramp_time; /**< Length of logarithmic gain ramp (ms) */ | ||
| 170 | 171 | ||
| 171 | /* reserved for future use */ | 172 | /* reserved for future use */ |
| 172 | uint32_t reserved[6]; | 173 | uint32_t reserved[5]; |
| 173 | 174 | ||
| 174 | /**< variable number of pdm controller config */ | 175 | /**< variable number of pdm controller config */ |
| 175 | struct sof_ipc_dai_dmic_pdm_ctrl pdm[0]; | 176 | struct sof_ipc_dai_dmic_pdm_ctrl pdm[0]; |
diff --git a/include/sound/sof/header.h b/include/sound/sof/header.h index 1efcf7b18ec2..12867bbd4372 100644 --- a/include/sound/sof/header.h +++ b/include/sound/sof/header.h | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | #define SOF_IPC_GLB_DAI_MSG SOF_GLB_TYPE(0x8U) | 49 | #define SOF_IPC_GLB_DAI_MSG SOF_GLB_TYPE(0x8U) |
| 50 | #define SOF_IPC_GLB_TRACE_MSG SOF_GLB_TYPE(0x9U) | 50 | #define SOF_IPC_GLB_TRACE_MSG SOF_GLB_TYPE(0x9U) |
| 51 | #define SOF_IPC_GLB_GDB_DEBUG SOF_GLB_TYPE(0xAU) | 51 | #define SOF_IPC_GLB_GDB_DEBUG SOF_GLB_TYPE(0xAU) |
| 52 | #define SOF_IPC_GLB_TEST_MSG SOF_GLB_TYPE(0xBU) | ||
| 52 | 53 | ||
| 53 | /* | 54 | /* |
| 54 | * DSP Command Message Types | 55 | * DSP Command Message Types |
| @@ -99,9 +100,13 @@ | |||
| 99 | #define SOF_IPC_STREAM_VORBIS_PARAMS SOF_CMD_TYPE(0x010) | 100 | #define SOF_IPC_STREAM_VORBIS_PARAMS SOF_CMD_TYPE(0x010) |
| 100 | #define SOF_IPC_STREAM_VORBIS_FREE SOF_CMD_TYPE(0x011) | 101 | #define SOF_IPC_STREAM_VORBIS_FREE SOF_CMD_TYPE(0x011) |
| 101 | 102 | ||
| 102 | /* trace and debug */ | 103 | /* trace */ |
| 103 | #define SOF_IPC_TRACE_DMA_PARAMS SOF_CMD_TYPE(0x001) | 104 | #define SOF_IPC_TRACE_DMA_PARAMS SOF_CMD_TYPE(0x001) |
| 104 | #define SOF_IPC_TRACE_DMA_POSITION SOF_CMD_TYPE(0x002) | 105 | #define SOF_IPC_TRACE_DMA_POSITION SOF_CMD_TYPE(0x002) |
| 106 | #define SOF_IPC_TRACE_DMA_PARAMS_EXT SOF_CMD_TYPE(0x003) | ||
| 107 | |||
| 108 | /* debug */ | ||
| 109 | #define SOF_IPC_TEST_IPC_FLOOD SOF_CMD_TYPE(0x001) | ||
| 105 | 110 | ||
| 106 | /* Get message component id */ | 111 | /* Get message component id */ |
| 107 | #define SOF_IPC_MESSAGE_ID(x) ((x) & 0xffff) | 112 | #define SOF_IPC_MESSAGE_ID(x) ((x) & 0xffff) |
diff --git a/include/sound/sof/topology.h b/include/sound/sof/topology.h index 46b2a7e63167..41dcabf89899 100644 --- a/include/sound/sof/topology.h +++ b/include/sound/sof/topology.h | |||
| @@ -35,6 +35,7 @@ enum sof_comp_type { | |||
| 35 | SOF_COMP_KEYWORD_DETECT, | 35 | SOF_COMP_KEYWORD_DETECT, |
| 36 | SOF_COMP_KPB, /* A key phrase buffer component */ | 36 | SOF_COMP_KPB, /* A key phrase buffer component */ |
| 37 | SOF_COMP_SELECTOR, /**< channel selector component */ | 37 | SOF_COMP_SELECTOR, /**< channel selector component */ |
| 38 | SOF_COMP_DEMUX, | ||
| 38 | /* keep FILEREAD/FILEWRITE as the last ones */ | 39 | /* keep FILEREAD/FILEWRITE as the last ones */ |
| 39 | SOF_COMP_FILEREAD = 10000, /**< host test based file IO */ | 40 | SOF_COMP_FILEREAD = 10000, /**< host test based file IO */ |
| 40 | SOF_COMP_FILEWRITE = 10001, /**< host test based file IO */ | 41 | SOF_COMP_FILEWRITE = 10001, /**< host test based file IO */ |
| @@ -83,9 +84,9 @@ struct sof_ipc_buffer { | |||
| 83 | struct sof_ipc_comp_config { | 84 | struct sof_ipc_comp_config { |
| 84 | struct sof_ipc_cmd_hdr hdr; | 85 | struct sof_ipc_cmd_hdr hdr; |
| 85 | uint32_t periods_sink; /**< 0 means variable */ | 86 | uint32_t periods_sink; /**< 0 means variable */ |
| 86 | uint32_t periods_source; /**< 0 means variable */ | 87 | uint32_t periods_source;/**< 0 means variable */ |
| 87 | uint32_t reserved1; /**< reserved */ | 88 | uint32_t reserved1; /**< reserved */ |
| 88 | uint32_t frame_fmt; /**< SOF_IPC_FRAME_ */ | 89 | uint32_t frame_fmt; /**< SOF_IPC_FRAME_ */ |
| 89 | uint32_t xrun_action; | 90 | uint32_t xrun_action; |
| 90 | 91 | ||
| 91 | /* reserved for future use */ | 92 | /* reserved for future use */ |
| @@ -175,6 +176,8 @@ enum sof_ipc_process_type { | |||
| 175 | SOF_PROCESS_KEYWORD_DETECT, /**< Keyword Detection */ | 176 | SOF_PROCESS_KEYWORD_DETECT, /**< Keyword Detection */ |
| 176 | SOF_PROCESS_KPB, /**< KeyPhrase Buffer Manager */ | 177 | SOF_PROCESS_KPB, /**< KeyPhrase Buffer Manager */ |
| 177 | SOF_PROCESS_CHAN_SELECTOR, /**< Channel Selector */ | 178 | SOF_PROCESS_CHAN_SELECTOR, /**< Channel Selector */ |
| 179 | SOF_PROCESS_MUX, | ||
| 180 | SOF_PROCESS_DEMUX, | ||
| 178 | }; | 181 | }; |
| 179 | 182 | ||
| 180 | /* generic "effect", "codec" or proprietary processing component */ | 183 | /* generic "effect", "codec" or proprietary processing component */ |
diff --git a/include/sound/sof/trace.h b/include/sound/sof/trace.h index 7d211f319a92..9257d5473d97 100644 --- a/include/sound/sof/trace.h +++ b/include/sound/sof/trace.h | |||
| @@ -19,12 +19,22 @@ | |||
| 19 | #define SOF_TRACE_FILENAME_SIZE 32 | 19 | #define SOF_TRACE_FILENAME_SIZE 32 |
| 20 | 20 | ||
| 21 | /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */ | 21 | /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */ |
| 22 | /* Deprecated - use sof_ipc_dma_trace_params_ext */ | ||
| 22 | struct sof_ipc_dma_trace_params { | 23 | struct sof_ipc_dma_trace_params { |
| 23 | struct sof_ipc_cmd_hdr hdr; | 24 | struct sof_ipc_cmd_hdr hdr; |
| 24 | struct sof_ipc_host_buffer buffer; | 25 | struct sof_ipc_host_buffer buffer; |
| 25 | uint32_t stream_tag; | 26 | uint32_t stream_tag; |
| 26 | } __packed; | 27 | } __packed; |
| 27 | 28 | ||
| 29 | /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS_EXT */ | ||
| 30 | struct sof_ipc_dma_trace_params_ext { | ||
| 31 | struct sof_ipc_cmd_hdr hdr; | ||
| 32 | struct sof_ipc_host_buffer buffer; | ||
| 33 | uint32_t stream_tag; | ||
| 34 | uint64_t timestamp_ns; /* in nanosecond */ | ||
| 35 | uint32_t reserved[8]; | ||
| 36 | } __packed; | ||
| 37 | |||
| 28 | /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */ | 38 | /* DMA for Trace params info - SOF_IPC_DEBUG_DMA_PARAMS */ |
| 29 | struct sof_ipc_dma_trace_posn { | 39 | struct sof_ipc_dma_trace_posn { |
| 30 | struct sof_ipc_reply rhdr; | 40 | struct sof_ipc_reply rhdr; |
| @@ -56,7 +66,9 @@ struct sof_ipc_dma_trace_posn { | |||
| 56 | #define SOF_IPC_PANIC_WFI (SOF_IPC_PANIC_MAGIC | 0xa) | 66 | #define SOF_IPC_PANIC_WFI (SOF_IPC_PANIC_MAGIC | 0xa) |
| 57 | #define SOF_IPC_PANIC_ASSERT (SOF_IPC_PANIC_MAGIC | 0xb) | 67 | #define SOF_IPC_PANIC_ASSERT (SOF_IPC_PANIC_MAGIC | 0xb) |
| 58 | 68 | ||
| 59 | /* panic info include filename and line number */ | 69 | /* panic info include filename and line number |
| 70 | * filename array will not include null terminator if fully filled | ||
| 71 | */ | ||
| 60 | struct sof_ipc_panic_info { | 72 | struct sof_ipc_panic_info { |
| 61 | struct sof_ipc_hdr hdr; | 73 | struct sof_ipc_hdr hdr; |
| 62 | uint32_t code; /* SOF_IPC_PANIC_ */ | 74 | uint32_t code; /* SOF_IPC_PANIC_ */ |
diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h index 51b1e0da2efc..d5ec4fac82ae 100644 --- a/include/trace/events/afs.h +++ b/include/trace/events/afs.h | |||
| @@ -27,6 +27,26 @@ enum afs_call_trace { | |||
| 27 | afs_call_trace_work, | 27 | afs_call_trace_work, |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | enum afs_server_trace { | ||
| 31 | afs_server_trace_alloc, | ||
| 32 | afs_server_trace_callback, | ||
| 33 | afs_server_trace_destroy, | ||
| 34 | afs_server_trace_free, | ||
| 35 | afs_server_trace_gc, | ||
| 36 | afs_server_trace_get_by_uuid, | ||
| 37 | afs_server_trace_get_caps, | ||
| 38 | afs_server_trace_get_install, | ||
| 39 | afs_server_trace_get_new_cbi, | ||
| 40 | afs_server_trace_give_up_cb, | ||
| 41 | afs_server_trace_put_call, | ||
| 42 | afs_server_trace_put_cbi, | ||
| 43 | afs_server_trace_put_find_rsq, | ||
| 44 | afs_server_trace_put_slist, | ||
| 45 | afs_server_trace_put_slist_isort, | ||
| 46 | afs_server_trace_put_uuid_rsq, | ||
| 47 | afs_server_trace_update, | ||
| 48 | }; | ||
| 49 | |||
| 30 | enum afs_fs_operation { | 50 | enum afs_fs_operation { |
| 31 | afs_FS_FetchData = 130, /* AFS Fetch file data */ | 51 | afs_FS_FetchData = 130, /* AFS Fetch file data */ |
| 32 | afs_FS_FetchACL = 131, /* AFS Fetch file ACL */ | 52 | afs_FS_FetchACL = 131, /* AFS Fetch file ACL */ |
| @@ -191,6 +211,17 @@ enum afs_flock_operation { | |||
| 191 | afs_flock_op_wake, | 211 | afs_flock_op_wake, |
| 192 | }; | 212 | }; |
| 193 | 213 | ||
| 214 | enum afs_cb_break_reason { | ||
| 215 | afs_cb_break_no_break, | ||
| 216 | afs_cb_break_for_callback, | ||
| 217 | afs_cb_break_for_deleted, | ||
| 218 | afs_cb_break_for_lapsed, | ||
| 219 | afs_cb_break_for_unlink, | ||
| 220 | afs_cb_break_for_vsbreak, | ||
| 221 | afs_cb_break_for_volume_callback, | ||
| 222 | afs_cb_break_for_zap, | ||
| 223 | }; | ||
| 224 | |||
| 194 | #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */ | 225 | #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */ |
| 195 | 226 | ||
| 196 | /* | 227 | /* |
| @@ -204,6 +235,25 @@ enum afs_flock_operation { | |||
| 204 | EM(afs_call_trace_wake, "WAKE ") \ | 235 | EM(afs_call_trace_wake, "WAKE ") \ |
| 205 | E_(afs_call_trace_work, "WORK ") | 236 | E_(afs_call_trace_work, "WORK ") |
| 206 | 237 | ||
| 238 | #define afs_server_traces \ | ||
| 239 | EM(afs_server_trace_alloc, "ALLOC ") \ | ||
| 240 | EM(afs_server_trace_callback, "CALLBACK ") \ | ||
| 241 | EM(afs_server_trace_destroy, "DESTROY ") \ | ||
| 242 | EM(afs_server_trace_free, "FREE ") \ | ||
| 243 | EM(afs_server_trace_gc, "GC ") \ | ||
| 244 | EM(afs_server_trace_get_by_uuid, "GET uuid ") \ | ||
| 245 | EM(afs_server_trace_get_caps, "GET caps ") \ | ||
| 246 | EM(afs_server_trace_get_install, "GET inst ") \ | ||
| 247 | EM(afs_server_trace_get_new_cbi, "GET cbi ") \ | ||
| 248 | EM(afs_server_trace_give_up_cb, "giveup-cb") \ | ||
| 249 | EM(afs_server_trace_put_call, "PUT call ") \ | ||
| 250 | EM(afs_server_trace_put_cbi, "PUT cbi ") \ | ||
| 251 | EM(afs_server_trace_put_find_rsq, "PUT f-rsq") \ | ||
| 252 | EM(afs_server_trace_put_slist, "PUT slist") \ | ||
| 253 | EM(afs_server_trace_put_slist_isort, "PUT isort") \ | ||
| 254 | EM(afs_server_trace_put_uuid_rsq, "PUT u-req") \ | ||
| 255 | E_(afs_server_trace_update, "UPDATE") | ||
| 256 | |||
| 207 | #define afs_fs_operations \ | 257 | #define afs_fs_operations \ |
| 208 | EM(afs_FS_FetchData, "FS.FetchData") \ | 258 | EM(afs_FS_FetchData, "FS.FetchData") \ |
| 209 | EM(afs_FS_FetchStatus, "FS.FetchStatus") \ | 259 | EM(afs_FS_FetchStatus, "FS.FetchStatus") \ |
| @@ -370,6 +420,16 @@ enum afs_flock_operation { | |||
| 370 | EM(afs_flock_op_unlock, "UNLOCK ") \ | 420 | EM(afs_flock_op_unlock, "UNLOCK ") \ |
| 371 | E_(afs_flock_op_wake, "WAKE ") | 421 | E_(afs_flock_op_wake, "WAKE ") |
| 372 | 422 | ||
| 423 | #define afs_cb_break_reasons \ | ||
| 424 | EM(afs_cb_break_no_break, "no-break") \ | ||
| 425 | EM(afs_cb_break_for_callback, "break-cb") \ | ||
| 426 | EM(afs_cb_break_for_deleted, "break-del") \ | ||
| 427 | EM(afs_cb_break_for_lapsed, "break-lapsed") \ | ||
| 428 | EM(afs_cb_break_for_unlink, "break-unlink") \ | ||
| 429 | EM(afs_cb_break_for_vsbreak, "break-vs") \ | ||
| 430 | EM(afs_cb_break_for_volume_callback, "break-v-cb") \ | ||
| 431 | E_(afs_cb_break_for_zap, "break-zap") | ||
| 432 | |||
| 373 | /* | 433 | /* |
| 374 | * Export enum symbols via userspace. | 434 | * Export enum symbols via userspace. |
| 375 | */ | 435 | */ |
| @@ -379,6 +439,7 @@ enum afs_flock_operation { | |||
| 379 | #define E_(a, b) TRACE_DEFINE_ENUM(a); | 439 | #define E_(a, b) TRACE_DEFINE_ENUM(a); |
| 380 | 440 | ||
| 381 | afs_call_traces; | 441 | afs_call_traces; |
| 442 | afs_server_traces; | ||
| 382 | afs_fs_operations; | 443 | afs_fs_operations; |
| 383 | afs_vl_operations; | 444 | afs_vl_operations; |
| 384 | afs_edit_dir_ops; | 445 | afs_edit_dir_ops; |
| @@ -388,6 +449,7 @@ afs_io_errors; | |||
| 388 | afs_file_errors; | 449 | afs_file_errors; |
| 389 | afs_flock_types; | 450 | afs_flock_types; |
| 390 | afs_flock_operations; | 451 | afs_flock_operations; |
| 452 | afs_cb_break_reasons; | ||
| 391 | 453 | ||
| 392 | /* | 454 | /* |
| 393 | * Now redefine the EM() and E_() macros to map the enums to the strings that | 455 | * Now redefine the EM() and E_() macros to map the enums to the strings that |
| @@ -1167,6 +1229,76 @@ TRACE_EVENT(afs_get_tree, | |||
| 1167 | __entry->cell, __entry->volume, __entry->vid) | 1229 | __entry->cell, __entry->volume, __entry->vid) |
| 1168 | ); | 1230 | ); |
| 1169 | 1231 | ||
| 1232 | TRACE_EVENT(afs_cb_break, | ||
| 1233 | TP_PROTO(struct afs_fid *fid, unsigned int cb_break, | ||
| 1234 | enum afs_cb_break_reason reason, bool skipped), | ||
| 1235 | |||
| 1236 | TP_ARGS(fid, cb_break, reason, skipped), | ||
| 1237 | |||
| 1238 | TP_STRUCT__entry( | ||
| 1239 | __field_struct(struct afs_fid, fid ) | ||
| 1240 | __field(unsigned int, cb_break ) | ||
| 1241 | __field(enum afs_cb_break_reason, reason ) | ||
| 1242 | __field(bool, skipped ) | ||
| 1243 | ), | ||
| 1244 | |||
| 1245 | TP_fast_assign( | ||
| 1246 | __entry->fid = *fid; | ||
| 1247 | __entry->cb_break = cb_break; | ||
| 1248 | __entry->reason = reason; | ||
| 1249 | __entry->skipped = skipped; | ||
| 1250 | ), | ||
| 1251 | |||
| 1252 | TP_printk("%llx:%llx:%x b=%x s=%u %s", | ||
| 1253 | __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique, | ||
| 1254 | __entry->cb_break, | ||
| 1255 | __entry->skipped, | ||
| 1256 | __print_symbolic(__entry->reason, afs_cb_break_reasons)) | ||
| 1257 | ); | ||
| 1258 | |||
| 1259 | TRACE_EVENT(afs_cb_miss, | ||
| 1260 | TP_PROTO(struct afs_fid *fid, enum afs_cb_break_reason reason), | ||
| 1261 | |||
| 1262 | TP_ARGS(fid, reason), | ||
| 1263 | |||
| 1264 | TP_STRUCT__entry( | ||
| 1265 | __field_struct(struct afs_fid, fid ) | ||
| 1266 | __field(enum afs_cb_break_reason, reason ) | ||
| 1267 | ), | ||
| 1268 | |||
| 1269 | TP_fast_assign( | ||
| 1270 | __entry->fid = *fid; | ||
| 1271 | __entry->reason = reason; | ||
| 1272 | ), | ||
| 1273 | |||
| 1274 | TP_printk(" %llx:%llx:%x %s", | ||
| 1275 | __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique, | ||
| 1276 | __print_symbolic(__entry->reason, afs_cb_break_reasons)) | ||
| 1277 | ); | ||
| 1278 | |||
| 1279 | TRACE_EVENT(afs_server, | ||
| 1280 | TP_PROTO(struct afs_server *server, int usage, enum afs_server_trace reason), | ||
| 1281 | |||
| 1282 | TP_ARGS(server, usage, reason), | ||
| 1283 | |||
| 1284 | TP_STRUCT__entry( | ||
| 1285 | __field(unsigned int, server ) | ||
| 1286 | __field(int, usage ) | ||
| 1287 | __field(int, reason ) | ||
| 1288 | ), | ||
| 1289 | |||
| 1290 | TP_fast_assign( | ||
| 1291 | __entry->server = server->debug_id; | ||
| 1292 | __entry->usage = usage; | ||
| 1293 | __entry->reason = reason; | ||
| 1294 | ), | ||
| 1295 | |||
| 1296 | TP_printk("s=%08x %s u=%d", | ||
| 1297 | __entry->server, | ||
| 1298 | __print_symbolic(__entry->reason, afs_server_traces), | ||
| 1299 | __entry->usage) | ||
| 1300 | ); | ||
| 1301 | |||
| 1170 | #endif /* _TRACE_AFS_H */ | 1302 | #endif /* _TRACE_AFS_H */ |
| 1171 | 1303 | ||
| 1172 | /* This part must be outside protection */ | 1304 | /* This part must be outside protection */ |
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index f9eff010fc7e..2f6a669408bb 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h | |||
| @@ -29,6 +29,7 @@ struct btrfs_qgroup_extent_record; | |||
| 29 | struct btrfs_qgroup; | 29 | struct btrfs_qgroup; |
| 30 | struct extent_io_tree; | 30 | struct extent_io_tree; |
| 31 | struct prelim_ref; | 31 | struct prelim_ref; |
| 32 | struct btrfs_space_info; | ||
| 32 | 33 | ||
| 33 | TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS_NR); | 34 | TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS_NR); |
| 34 | TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS); | 35 | TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS); |
| @@ -2091,6 +2092,45 @@ DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock); | |||
| 2091 | DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); | 2092 | DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); |
| 2092 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); | 2093 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); |
| 2093 | 2094 | ||
| 2095 | DECLARE_EVENT_CLASS(btrfs__space_info_update, | ||
| 2096 | |||
| 2097 | TP_PROTO(struct btrfs_fs_info *fs_info, | ||
| 2098 | struct btrfs_space_info *sinfo, u64 old, s64 diff), | ||
| 2099 | |||
| 2100 | TP_ARGS(fs_info, sinfo, old, diff), | ||
| 2101 | |||
| 2102 | TP_STRUCT__entry_btrfs( | ||
| 2103 | __field( u64, type ) | ||
| 2104 | __field( u64, old ) | ||
| 2105 | __field( s64, diff ) | ||
| 2106 | ), | ||
| 2107 | |||
| 2108 | TP_fast_assign_btrfs(fs_info, | ||
| 2109 | __entry->type = sinfo->flags; | ||
| 2110 | __entry->old = old; | ||
| 2111 | __entry->diff = diff; | ||
| 2112 | ), | ||
| 2113 | TP_printk_btrfs("type=%s old=%llu diff=%lld", | ||
| 2114 | __print_flags(__entry->type, "|", BTRFS_GROUP_FLAGS), | ||
| 2115 | __entry->old, __entry->diff) | ||
| 2116 | ); | ||
| 2117 | |||
| 2118 | DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use, | ||
| 2119 | |||
| 2120 | TP_PROTO(struct btrfs_fs_info *fs_info, | ||
| 2121 | struct btrfs_space_info *sinfo, u64 old, s64 diff), | ||
| 2122 | |||
| 2123 | TP_ARGS(fs_info, sinfo, old, diff) | ||
| 2124 | ); | ||
| 2125 | |||
| 2126 | DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned, | ||
| 2127 | |||
| 2128 | TP_PROTO(struct btrfs_fs_info *fs_info, | ||
| 2129 | struct btrfs_space_info *sinfo, u64 old, s64 diff), | ||
| 2130 | |||
| 2131 | TP_ARGS(fs_info, sinfo, old, diff) | ||
| 2132 | ); | ||
| 2133 | |||
| 2094 | #endif /* _TRACE_BTRFS_H */ | 2134 | #endif /* _TRACE_BTRFS_H */ |
| 2095 | 2135 | ||
| 2096 | /* This part must be outside protection */ | 2136 | /* This part must be outside protection */ |
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 53b96f12300c..1796ff99c3e9 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h | |||
| @@ -76,16 +76,7 @@ TRACE_DEFINE_ENUM(CP_TRIMMED); | |||
| 76 | #define show_bio_type(op,op_flags) show_bio_op(op), \ | 76 | #define show_bio_type(op,op_flags) show_bio_op(op), \ |
| 77 | show_bio_op_flags(op_flags) | 77 | show_bio_op_flags(op_flags) |
| 78 | 78 | ||
| 79 | #define show_bio_op(op) \ | 79 | #define show_bio_op(op) blk_op_str(op) |
| 80 | __print_symbolic(op, \ | ||
| 81 | { REQ_OP_READ, "READ" }, \ | ||
| 82 | { REQ_OP_WRITE, "WRITE" }, \ | ||
| 83 | { REQ_OP_FLUSH, "FLUSH" }, \ | ||
| 84 | { REQ_OP_DISCARD, "DISCARD" }, \ | ||
| 85 | { REQ_OP_SECURE_ERASE, "SECURE_ERASE" }, \ | ||
| 86 | { REQ_OP_ZONE_RESET, "ZONE_RESET" }, \ | ||
| 87 | { REQ_OP_WRITE_SAME, "WRITE_SAME" }, \ | ||
| 88 | { REQ_OP_WRITE_ZEROES, "WRITE_ZEROES" }) | ||
| 89 | 80 | ||
| 90 | #define show_bio_op_flags(flags) \ | 81 | #define show_bio_op_flags(flags) \ |
| 91 | __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \ | 82 | __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \ |
| @@ -1028,8 +1019,8 @@ DECLARE_EVENT_CLASS(f2fs__submit_page_bio, | |||
| 1028 | ), | 1019 | ), |
| 1029 | 1020 | ||
| 1030 | TP_fast_assign( | 1021 | TP_fast_assign( |
| 1031 | __entry->dev = page->mapping->host->i_sb->s_dev; | 1022 | __entry->dev = page_file_mapping(page)->host->i_sb->s_dev; |
| 1032 | __entry->ino = page->mapping->host->i_ino; | 1023 | __entry->ino = page_file_mapping(page)->host->i_ino; |
| 1033 | __entry->index = page->index; | 1024 | __entry->index = page->index; |
| 1034 | __entry->old_blkaddr = fio->old_blkaddr; | 1025 | __entry->old_blkaddr = fio->old_blkaddr; |
| 1035 | __entry->new_blkaddr = fio->new_blkaddr; | 1026 | __entry->new_blkaddr = fio->new_blkaddr; |
| @@ -1216,10 +1207,11 @@ DECLARE_EVENT_CLASS(f2fs__page, | |||
| 1216 | ), | 1207 | ), |
| 1217 | 1208 | ||
| 1218 | TP_fast_assign( | 1209 | TP_fast_assign( |
| 1219 | __entry->dev = page->mapping->host->i_sb->s_dev; | 1210 | __entry->dev = page_file_mapping(page)->host->i_sb->s_dev; |
| 1220 | __entry->ino = page->mapping->host->i_ino; | 1211 | __entry->ino = page_file_mapping(page)->host->i_ino; |
| 1221 | __entry->type = type; | 1212 | __entry->type = type; |
| 1222 | __entry->dir = S_ISDIR(page->mapping->host->i_mode); | 1213 | __entry->dir = |
| 1214 | S_ISDIR(page_file_mapping(page)->host->i_mode); | ||
| 1223 | __entry->index = page->index; | 1215 | __entry->index = page->index; |
| 1224 | __entry->dirty = PageDirty(page); | 1216 | __entry->dirty = PageDirty(page); |
| 1225 | __entry->uptodate = PageUptodate(page); | 1217 | __entry->uptodate = PageUptodate(page); |
diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h index fad7befa612d..4b735923f2ff 100644 --- a/include/trace/events/filelock.h +++ b/include/trace/events/filelock.h | |||
| @@ -203,6 +203,41 @@ TRACE_EVENT(generic_add_lease, | |||
| 203 | show_fl_type(__entry->fl_type)) | 203 | show_fl_type(__entry->fl_type)) |
| 204 | ); | 204 | ); |
| 205 | 205 | ||
| 206 | TRACE_EVENT(leases_conflict, | ||
| 207 | TP_PROTO(bool conflict, struct file_lock *lease, struct file_lock *breaker), | ||
| 208 | |||
| 209 | TP_ARGS(conflict, lease, breaker), | ||
| 210 | |||
| 211 | TP_STRUCT__entry( | ||
| 212 | __field(void *, lease) | ||
| 213 | __field(void *, breaker) | ||
| 214 | __field(unsigned int, l_fl_flags) | ||
| 215 | __field(unsigned int, b_fl_flags) | ||
| 216 | __field(unsigned char, l_fl_type) | ||
| 217 | __field(unsigned char, b_fl_type) | ||
| 218 | __field(bool, conflict) | ||
| 219 | ), | ||
| 220 | |||
| 221 | TP_fast_assign( | ||
| 222 | __entry->lease = lease; | ||
| 223 | __entry->l_fl_flags = lease->fl_flags; | ||
| 224 | __entry->l_fl_type = lease->fl_type; | ||
| 225 | __entry->breaker = breaker; | ||
| 226 | __entry->b_fl_flags = breaker->fl_flags; | ||
| 227 | __entry->b_fl_type = breaker->fl_type; | ||
| 228 | __entry->conflict = conflict; | ||
| 229 | ), | ||
| 230 | |||
| 231 | TP_printk("conflict %d: lease=0x%p fl_flags=%s fl_type=%s; breaker=0x%p fl_flags=%s fl_type=%s", | ||
| 232 | __entry->conflict, | ||
| 233 | __entry->lease, | ||
| 234 | show_fl_flags(__entry->l_fl_flags), | ||
| 235 | show_fl_type(__entry->l_fl_type), | ||
| 236 | __entry->breaker, | ||
| 237 | show_fl_flags(__entry->b_fl_flags), | ||
| 238 | show_fl_type(__entry->b_fl_type)) | ||
| 239 | ); | ||
| 240 | |||
| 206 | #endif /* _TRACE_FILELOCK_H */ | 241 | #endif /* _TRACE_FILELOCK_H */ |
| 207 | 242 | ||
| 208 | /* This part must be outside protection */ | 243 | /* This part must be outside protection */ |
diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h index 0bdb08557763..62bb17516713 100644 --- a/include/trace/events/neigh.h +++ b/include/trace/events/neigh.h | |||
| @@ -20,6 +20,55 @@ | |||
| 20 | { NUD_NOARP, "noarp" }, \ | 20 | { NUD_NOARP, "noarp" }, \ |
| 21 | { NUD_PERMANENT, "permanent"}) | 21 | { NUD_PERMANENT, "permanent"}) |
| 22 | 22 | ||
| 23 | TRACE_EVENT(neigh_create, | ||
| 24 | |||
| 25 | TP_PROTO(struct neigh_table *tbl, struct net_device *dev, | ||
| 26 | const void *pkey, const struct neighbour *n, | ||
| 27 | bool exempt_from_gc), | ||
| 28 | |||
| 29 | TP_ARGS(tbl, dev, pkey, n, exempt_from_gc), | ||
| 30 | |||
| 31 | TP_STRUCT__entry( | ||
| 32 | __field(u32, family) | ||
| 33 | __dynamic_array(char, dev, IFNAMSIZ ) | ||
| 34 | __field(int, entries) | ||
| 35 | __field(u8, created) | ||
| 36 | __field(u8, gc_exempt) | ||
| 37 | __array(u8, primary_key4, 4) | ||
| 38 | __array(u8, primary_key6, 16) | ||
| 39 | ), | ||
| 40 | |||
| 41 | TP_fast_assign( | ||
| 42 | struct in6_addr *pin6; | ||
| 43 | __be32 *p32; | ||
| 44 | |||
| 45 | __entry->family = tbl->family; | ||
| 46 | __assign_str(dev, (dev ? dev->name : "NULL")); | ||
| 47 | __entry->entries = atomic_read(&tbl->gc_entries); | ||
| 48 | __entry->created = n != NULL; | ||
| 49 | __entry->gc_exempt = exempt_from_gc; | ||
| 50 | pin6 = (struct in6_addr *)__entry->primary_key6; | ||
| 51 | p32 = (__be32 *)__entry->primary_key4; | ||
| 52 | |||
| 53 | if (tbl->family == AF_INET) | ||
| 54 | *p32 = *(__be32 *)pkey; | ||
| 55 | else | ||
| 56 | *p32 = 0; | ||
| 57 | |||
| 58 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 59 | if (tbl->family == AF_INET6) { | ||
| 60 | pin6 = (struct in6_addr *)__entry->primary_key6; | ||
| 61 | *pin6 = *(struct in6_addr *)pkey; | ||
| 62 | } | ||
| 63 | #endif | ||
| 64 | ), | ||
| 65 | |||
| 66 | TP_printk("family %d dev %s entries %d primary_key4 %pI4 primary_key6 %pI6c created %d gc_exempt %d", | ||
| 67 | __entry->family, __get_str(dev), __entry->entries, | ||
| 68 | __entry->primary_key4, __entry->primary_key6, | ||
| 69 | __entry->created, __entry->gc_exempt) | ||
| 70 | ); | ||
| 71 | |||
| 23 | TRACE_EVENT(neigh_update, | 72 | TRACE_EVENT(neigh_update, |
| 24 | 73 | ||
| 25 | TP_PROTO(struct neighbour *n, const u8 *lladdr, u8 new, | 74 | TP_PROTO(struct neighbour *n, const u8 *lladdr, u8 new, |
diff --git a/include/trace/events/page_pool.h b/include/trace/events/page_pool.h new file mode 100644 index 000000000000..47b5ee880aa9 --- /dev/null +++ b/include/trace/events/page_pool.h | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #undef TRACE_SYSTEM | ||
| 3 | #define TRACE_SYSTEM page_pool | ||
| 4 | |||
| 5 | #if !defined(_TRACE_PAGE_POOL_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 6 | #define _TRACE_PAGE_POOL_H | ||
| 7 | |||
| 8 | #include <linux/types.h> | ||
| 9 | #include <linux/tracepoint.h> | ||
| 10 | |||
| 11 | #include <net/page_pool.h> | ||
| 12 | |||
| 13 | TRACE_EVENT(page_pool_inflight, | ||
| 14 | |||
| 15 | TP_PROTO(const struct page_pool *pool, | ||
| 16 | s32 inflight, u32 hold, u32 release), | ||
| 17 | |||
| 18 | TP_ARGS(pool, inflight, hold, release), | ||
| 19 | |||
| 20 | TP_STRUCT__entry( | ||
| 21 | __field(const struct page_pool *, pool) | ||
| 22 | __field(s32, inflight) | ||
| 23 | __field(u32, hold) | ||
| 24 | __field(u32, release) | ||
| 25 | ), | ||
| 26 | |||
| 27 | TP_fast_assign( | ||
| 28 | __entry->pool = pool; | ||
| 29 | __entry->inflight = inflight; | ||
| 30 | __entry->hold = hold; | ||
| 31 | __entry->release = release; | ||
| 32 | ), | ||
| 33 | |||
| 34 | TP_printk("page_pool=%p inflight=%d hold=%u release=%u", | ||
| 35 | __entry->pool, __entry->inflight, __entry->hold, __entry->release) | ||
| 36 | ); | ||
| 37 | |||
| 38 | TRACE_EVENT(page_pool_state_release, | ||
| 39 | |||
| 40 | TP_PROTO(const struct page_pool *pool, | ||
| 41 | const struct page *page, u32 release), | ||
| 42 | |||
| 43 | TP_ARGS(pool, page, release), | ||
| 44 | |||
| 45 | TP_STRUCT__entry( | ||
| 46 | __field(const struct page_pool *, pool) | ||
| 47 | __field(const struct page *, page) | ||
| 48 | __field(u32, release) | ||
| 49 | ), | ||
| 50 | |||
| 51 | TP_fast_assign( | ||
| 52 | __entry->pool = pool; | ||
| 53 | __entry->page = page; | ||
| 54 | __entry->release = release; | ||
| 55 | ), | ||
| 56 | |||
| 57 | TP_printk("page_pool=%p page=%p release=%u", | ||
| 58 | __entry->pool, __entry->page, __entry->release) | ||
| 59 | ); | ||
| 60 | |||
| 61 | TRACE_EVENT(page_pool_state_hold, | ||
| 62 | |||
| 63 | TP_PROTO(const struct page_pool *pool, | ||
| 64 | const struct page *page, u32 hold), | ||
| 65 | |||
| 66 | TP_ARGS(pool, page, hold), | ||
| 67 | |||
| 68 | TP_STRUCT__entry( | ||
| 69 | __field(const struct page_pool *, pool) | ||
| 70 | __field(const struct page *, page) | ||
| 71 | __field(u32, hold) | ||
| 72 | ), | ||
| 73 | |||
| 74 | TP_fast_assign( | ||
| 75 | __entry->pool = pool; | ||
| 76 | __entry->page = page; | ||
| 77 | __entry->hold = hold; | ||
| 78 | ), | ||
| 79 | |||
| 80 | TP_printk("page_pool=%p page=%p hold=%u", | ||
| 81 | __entry->pool, __entry->page, __entry->hold) | ||
| 82 | ); | ||
| 83 | |||
| 84 | #endif /* _TRACE_PAGE_POOL_H */ | ||
| 85 | |||
| 86 | /* This part must be outside protection */ | ||
| 87 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h index d85816878a52..cc1d060cbf13 100644 --- a/include/trace/events/rxrpc.h +++ b/include/trace/events/rxrpc.h | |||
| @@ -1379,7 +1379,7 @@ TRACE_EVENT(rxrpc_rx_eproto, | |||
| 1379 | ), | 1379 | ), |
| 1380 | 1380 | ||
| 1381 | TP_fast_assign( | 1381 | TP_fast_assign( |
| 1382 | __entry->call = call->debug_id; | 1382 | __entry->call = call ? call->debug_id : 0; |
| 1383 | __entry->serial = serial; | 1383 | __entry->serial = serial; |
| 1384 | __entry->why = why; | 1384 | __entry->why = why; |
| 1385 | ), | 1385 | ), |
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index c8c7c7efb487..420e80e56e55 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
| @@ -594,6 +594,37 @@ TRACE_EVENT(sched_wake_idle_without_ipi, | |||
| 594 | 594 | ||
| 595 | TP_printk("cpu=%d", __entry->cpu) | 595 | TP_printk("cpu=%d", __entry->cpu) |
| 596 | ); | 596 | ); |
| 597 | |||
| 598 | /* | ||
| 599 | * Following tracepoints are not exported in tracefs and provide hooking | ||
| 600 | * mechanisms only for testing and debugging purposes. | ||
| 601 | * | ||
| 602 | * Postfixed with _tp to make them easily identifiable in the code. | ||
| 603 | */ | ||
| 604 | DECLARE_TRACE(pelt_cfs_tp, | ||
| 605 | TP_PROTO(struct cfs_rq *cfs_rq), | ||
| 606 | TP_ARGS(cfs_rq)); | ||
| 607 | |||
| 608 | DECLARE_TRACE(pelt_rt_tp, | ||
| 609 | TP_PROTO(struct rq *rq), | ||
| 610 | TP_ARGS(rq)); | ||
| 611 | |||
| 612 | DECLARE_TRACE(pelt_dl_tp, | ||
| 613 | TP_PROTO(struct rq *rq), | ||
| 614 | TP_ARGS(rq)); | ||
| 615 | |||
| 616 | DECLARE_TRACE(pelt_irq_tp, | ||
| 617 | TP_PROTO(struct rq *rq), | ||
| 618 | TP_ARGS(rq)); | ||
| 619 | |||
| 620 | DECLARE_TRACE(pelt_se_tp, | ||
| 621 | TP_PROTO(struct sched_entity *se), | ||
| 622 | TP_ARGS(se)); | ||
| 623 | |||
| 624 | DECLARE_TRACE(sched_overutilized_tp, | ||
| 625 | TP_PROTO(struct root_domain *rd, bool overutilized), | ||
| 626 | TP_ARGS(rd, overutilized)); | ||
| 627 | |||
| 597 | #endif /* _TRACE_SCHED_H */ | 628 | #endif /* _TRACE_SCHED_H */ |
| 598 | 629 | ||
| 599 | /* This part must be outside protection */ | 630 | /* This part must be outside protection */ |
diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h index e95cb86b65cf..68899fdc985b 100644 --- a/include/trace/events/xdp.h +++ b/include/trace/events/xdp.h | |||
| @@ -50,6 +50,35 @@ TRACE_EVENT(xdp_exception, | |||
| 50 | __entry->ifindex) | 50 | __entry->ifindex) |
| 51 | ); | 51 | ); |
| 52 | 52 | ||
| 53 | TRACE_EVENT(xdp_bulk_tx, | ||
| 54 | |||
| 55 | TP_PROTO(const struct net_device *dev, | ||
| 56 | int sent, int drops, int err), | ||
| 57 | |||
| 58 | TP_ARGS(dev, sent, drops, err), | ||
| 59 | |||
| 60 | TP_STRUCT__entry( | ||
| 61 | __field(int, ifindex) | ||
| 62 | __field(u32, act) | ||
| 63 | __field(int, drops) | ||
| 64 | __field(int, sent) | ||
| 65 | __field(int, err) | ||
| 66 | ), | ||
| 67 | |||
| 68 | TP_fast_assign( | ||
| 69 | __entry->ifindex = dev->ifindex; | ||
| 70 | __entry->act = XDP_TX; | ||
| 71 | __entry->drops = drops; | ||
| 72 | __entry->sent = sent; | ||
| 73 | __entry->err = err; | ||
| 74 | ), | ||
| 75 | |||
| 76 | TP_printk("ifindex=%d action=%s sent=%d drops=%d err=%d", | ||
| 77 | __entry->ifindex, | ||
| 78 | __print_symbolic(__entry->act, __XDP_ACT_SYM_TAB), | ||
| 79 | __entry->sent, __entry->drops, __entry->err) | ||
| 80 | ); | ||
| 81 | |||
| 53 | DECLARE_EVENT_CLASS(xdp_redirect_template, | 82 | DECLARE_EVENT_CLASS(xdp_redirect_template, |
| 54 | 83 | ||
| 55 | TP_PROTO(const struct net_device *dev, | 84 | TP_PROTO(const struct net_device *dev, |
| @@ -146,9 +175,8 @@ struct _bpf_dtab_netdev { | |||
| 146 | #endif /* __DEVMAP_OBJ_TYPE */ | 175 | #endif /* __DEVMAP_OBJ_TYPE */ |
| 147 | 176 | ||
| 148 | #define devmap_ifindex(fwd, map) \ | 177 | #define devmap_ifindex(fwd, map) \ |
| 149 | (!fwd ? 0 : \ | 178 | ((map->map_type == BPF_MAP_TYPE_DEVMAP) ? \ |
| 150 | ((map->map_type == BPF_MAP_TYPE_DEVMAP) ? \ | 179 | ((struct _bpf_dtab_netdev *)fwd)->dev->ifindex : 0) |
| 151 | ((struct _bpf_dtab_netdev *)fwd)->dev->ifindex : 0)) | ||
| 152 | 180 | ||
| 153 | #define _trace_xdp_redirect_map(dev, xdp, fwd, map, idx) \ | 181 | #define _trace_xdp_redirect_map(dev, xdp, fwd, map, idx) \ |
| 154 | trace_xdp_redirect_map(dev, xdp, devmap_ifindex(fwd, map), \ | 182 | trace_xdp_redirect_map(dev, xdp, devmap_ifindex(fwd, map), \ |
| @@ -269,6 +297,121 @@ TRACE_EVENT(xdp_devmap_xmit, | |||
| 269 | __entry->from_ifindex, __entry->to_ifindex, __entry->err) | 297 | __entry->from_ifindex, __entry->to_ifindex, __entry->err) |
| 270 | ); | 298 | ); |
| 271 | 299 | ||
| 300 | /* Expect users already include <net/xdp.h>, but not xdp_priv.h */ | ||
| 301 | #include <net/xdp_priv.h> | ||
| 302 | |||
| 303 | #define __MEM_TYPE_MAP(FN) \ | ||
| 304 | FN(PAGE_SHARED) \ | ||
| 305 | FN(PAGE_ORDER0) \ | ||
| 306 | FN(PAGE_POOL) \ | ||
| 307 | FN(ZERO_COPY) | ||
| 308 | |||
| 309 | #define __MEM_TYPE_TP_FN(x) \ | ||
| 310 | TRACE_DEFINE_ENUM(MEM_TYPE_##x); | ||
| 311 | #define __MEM_TYPE_SYM_FN(x) \ | ||
| 312 | { MEM_TYPE_##x, #x }, | ||
| 313 | #define __MEM_TYPE_SYM_TAB \ | ||
| 314 | __MEM_TYPE_MAP(__MEM_TYPE_SYM_FN) { -1, 0 } | ||
| 315 | __MEM_TYPE_MAP(__MEM_TYPE_TP_FN) | ||
| 316 | |||
| 317 | TRACE_EVENT(mem_disconnect, | ||
| 318 | |||
| 319 | TP_PROTO(const struct xdp_mem_allocator *xa, | ||
| 320 | bool safe_to_remove, bool force), | ||
| 321 | |||
| 322 | TP_ARGS(xa, safe_to_remove, force), | ||
| 323 | |||
| 324 | TP_STRUCT__entry( | ||
| 325 | __field(const struct xdp_mem_allocator *, xa) | ||
| 326 | __field(u32, mem_id) | ||
| 327 | __field(u32, mem_type) | ||
| 328 | __field(const void *, allocator) | ||
| 329 | __field(bool, safe_to_remove) | ||
| 330 | __field(bool, force) | ||
| 331 | __field(int, disconnect_cnt) | ||
| 332 | ), | ||
| 333 | |||
| 334 | TP_fast_assign( | ||
| 335 | __entry->xa = xa; | ||
| 336 | __entry->mem_id = xa->mem.id; | ||
| 337 | __entry->mem_type = xa->mem.type; | ||
| 338 | __entry->allocator = xa->allocator; | ||
| 339 | __entry->safe_to_remove = safe_to_remove; | ||
| 340 | __entry->force = force; | ||
| 341 | __entry->disconnect_cnt = xa->disconnect_cnt; | ||
| 342 | ), | ||
| 343 | |||
| 344 | TP_printk("mem_id=%d mem_type=%s allocator=%p" | ||
| 345 | " safe_to_remove=%s force=%s disconnect_cnt=%d", | ||
| 346 | __entry->mem_id, | ||
| 347 | __print_symbolic(__entry->mem_type, __MEM_TYPE_SYM_TAB), | ||
| 348 | __entry->allocator, | ||
| 349 | __entry->safe_to_remove ? "true" : "false", | ||
| 350 | __entry->force ? "true" : "false", | ||
| 351 | __entry->disconnect_cnt | ||
| 352 | ) | ||
| 353 | ); | ||
| 354 | |||
| 355 | TRACE_EVENT(mem_connect, | ||
| 356 | |||
| 357 | TP_PROTO(const struct xdp_mem_allocator *xa, | ||
| 358 | const struct xdp_rxq_info *rxq), | ||
| 359 | |||
| 360 | TP_ARGS(xa, rxq), | ||
| 361 | |||
| 362 | TP_STRUCT__entry( | ||
| 363 | __field(const struct xdp_mem_allocator *, xa) | ||
| 364 | __field(u32, mem_id) | ||
| 365 | __field(u32, mem_type) | ||
| 366 | __field(const void *, allocator) | ||
| 367 | __field(const struct xdp_rxq_info *, rxq) | ||
| 368 | __field(int, ifindex) | ||
| 369 | ), | ||
| 370 | |||
| 371 | TP_fast_assign( | ||
| 372 | __entry->xa = xa; | ||
| 373 | __entry->mem_id = xa->mem.id; | ||
| 374 | __entry->mem_type = xa->mem.type; | ||
| 375 | __entry->allocator = xa->allocator; | ||
| 376 | __entry->rxq = rxq; | ||
| 377 | __entry->ifindex = rxq->dev->ifindex; | ||
| 378 | ), | ||
| 379 | |||
| 380 | TP_printk("mem_id=%d mem_type=%s allocator=%p" | ||
| 381 | " ifindex=%d", | ||
| 382 | __entry->mem_id, | ||
| 383 | __print_symbolic(__entry->mem_type, __MEM_TYPE_SYM_TAB), | ||
| 384 | __entry->allocator, | ||
| 385 | __entry->ifindex | ||
| 386 | ) | ||
| 387 | ); | ||
| 388 | |||
| 389 | TRACE_EVENT(mem_return_failed, | ||
| 390 | |||
| 391 | TP_PROTO(const struct xdp_mem_info *mem, | ||
| 392 | const struct page *page), | ||
| 393 | |||
| 394 | TP_ARGS(mem, page), | ||
| 395 | |||
| 396 | TP_STRUCT__entry( | ||
| 397 | __field(const struct page *, page) | ||
| 398 | __field(u32, mem_id) | ||
| 399 | __field(u32, mem_type) | ||
| 400 | ), | ||
| 401 | |||
| 402 | TP_fast_assign( | ||
| 403 | __entry->page = page; | ||
| 404 | __entry->mem_id = mem->id; | ||
| 405 | __entry->mem_type = mem->type; | ||
| 406 | ), | ||
| 407 | |||
| 408 | TP_printk("mem_id=%d mem_type=%s page=%p", | ||
| 409 | __entry->mem_id, | ||
| 410 | __print_symbolic(__entry->mem_type, __MEM_TYPE_SYM_TAB), | ||
| 411 | __entry->page | ||
| 412 | ) | ||
| 413 | ); | ||
| 414 | |||
| 272 | #endif /* _TRACE_XDP_H */ | 415 | #endif /* _TRACE_XDP_H */ |
| 273 | 416 | ||
| 274 | #include <trace/define_trace.h> | 417 | #include <trace/define_trace.h> |
diff --git a/include/uapi/linux/Kbuild b/include/uapi/Kbuild index 34711c5d6968..61ee6e59c930 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/Kbuild | |||
| @@ -1,14 +1,14 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h),) | 2 | ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h),) |
| 3 | no-export-headers += a.out.h | 3 | no-export-headers += linux/a.out.h |
| 4 | endif | 4 | endif |
| 5 | 5 | ||
| 6 | ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h),) | 6 | ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h),) |
| 7 | no-export-headers += kvm.h | 7 | no-export-headers += linux/kvm.h |
| 8 | endif | 8 | endif |
| 9 | 9 | ||
| 10 | ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h),) | 10 | ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h),) |
| 11 | ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para.h),) | 11 | ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para.h),) |
| 12 | no-export-headers += kvm_para.h | 12 | no-export-headers += linux/kvm_para.h |
| 13 | endif | 13 | endif |
| 14 | endif | 14 | endif |
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h index 8c1391c89171..77f7c1638eb1 100644 --- a/include/uapi/asm-generic/socket.h +++ b/include/uapi/asm-generic/socket.h | |||
| @@ -117,6 +117,8 @@ | |||
| 117 | #define SO_RCVTIMEO_NEW 66 | 117 | #define SO_RCVTIMEO_NEW 66 |
| 118 | #define SO_SNDTIMEO_NEW 67 | 118 | #define SO_SNDTIMEO_NEW 67 |
| 119 | 119 | ||
| 120 | #define SO_DETACH_REUSEPORT_BPF 68 | ||
| 121 | |||
| 120 | #if !defined(__KERNEL__) | 122 | #if !defined(__KERNEL__) |
| 121 | 123 | ||
| 122 | #if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__)) | 124 | #if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__)) |
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index a87904daf103..1be0e798e362 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h | |||
| @@ -844,9 +844,15 @@ __SYSCALL(__NR_fsconfig, sys_fsconfig) | |||
| 844 | __SYSCALL(__NR_fsmount, sys_fsmount) | 844 | __SYSCALL(__NR_fsmount, sys_fsmount) |
| 845 | #define __NR_fspick 433 | 845 | #define __NR_fspick 433 |
| 846 | __SYSCALL(__NR_fspick, sys_fspick) | 846 | __SYSCALL(__NR_fspick, sys_fspick) |
| 847 | #define __NR_pidfd_open 434 | ||
| 848 | __SYSCALL(__NR_pidfd_open, sys_pidfd_open) | ||
| 849 | #ifdef __ARCH_WANT_SYS_CLONE3 | ||
| 850 | #define __NR_clone3 435 | ||
| 851 | __SYSCALL(__NR_clone3, sys_clone3) | ||
| 852 | #endif | ||
| 847 | 853 | ||
| 848 | #undef __NR_syscalls | 854 | #undef __NR_syscalls |
| 849 | #define __NR_syscalls 434 | 855 | #define __NR_syscalls 436 |
| 850 | 856 | ||
| 851 | /* | 857 | /* |
| 852 | * 32 bit systems traditionally used different | 858 | * 32 bit systems traditionally used different |
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 4788730dbe78..d799858b9e53 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h | |||
| @@ -912,6 +912,7 @@ struct drm_amdgpu_info_firmware { | |||
| 912 | #define AMDGPU_VRAM_TYPE_HBM 6 | 912 | #define AMDGPU_VRAM_TYPE_HBM 6 |
| 913 | #define AMDGPU_VRAM_TYPE_DDR3 7 | 913 | #define AMDGPU_VRAM_TYPE_DDR3 7 |
| 914 | #define AMDGPU_VRAM_TYPE_DDR4 8 | 914 | #define AMDGPU_VRAM_TYPE_DDR4 8 |
| 915 | #define AMDGPU_VRAM_TYPE_GDDR6 9 | ||
| 915 | 916 | ||
| 916 | struct drm_amdgpu_info_device { | 917 | struct drm_amdgpu_info_device { |
| 917 | /** PCI Device ID */ | 918 | /** PCI Device ID */ |
| @@ -991,6 +992,8 @@ struct drm_amdgpu_info_device { | |||
| 991 | __u64 high_va_offset; | 992 | __u64 high_va_offset; |
| 992 | /** The maximum high virtual address */ | 993 | /** The maximum high virtual address */ |
| 993 | __u64 high_va_max; | 994 | __u64 high_va_max; |
| 995 | /* gfx10 pa_sc_tile_steering_override */ | ||
| 996 | __u32 pa_sc_tile_steering_override; | ||
| 994 | }; | 997 | }; |
| 995 | 998 | ||
| 996 | struct drm_amdgpu_info_hw_ip { | 999 | struct drm_amdgpu_info_hw_ip { |
| @@ -1044,6 +1047,7 @@ struct drm_amdgpu_info_vce_clock_table { | |||
| 1044 | #define AMDGPU_FAMILY_CZ 135 /* Carrizo, Stoney */ | 1047 | #define AMDGPU_FAMILY_CZ 135 /* Carrizo, Stoney */ |
| 1045 | #define AMDGPU_FAMILY_AI 141 /* Vega10 */ | 1048 | #define AMDGPU_FAMILY_AI 141 /* Vega10 */ |
| 1046 | #define AMDGPU_FAMILY_RV 142 /* Raven */ | 1049 | #define AMDGPU_FAMILY_RV 142 /* Raven */ |
| 1050 | #define AMDGPU_FAMILY_NV 143 /* Navi10 */ | ||
| 1047 | 1051 | ||
| 1048 | #if defined(__cplusplus) | 1052 | #if defined(__cplusplus) |
| 1049 | } | 1053 | } |
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 661d73f9a919..8a5b2f8f8eb9 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h | |||
| @@ -50,6 +50,7 @@ typedef unsigned int drm_handle_t; | |||
| 50 | 50 | ||
| 51 | #else /* One of the BSDs */ | 51 | #else /* One of the BSDs */ |
| 52 | 52 | ||
| 53 | #include <stdint.h> | ||
| 53 | #include <sys/ioccom.h> | 54 | #include <sys/ioccom.h> |
| 54 | #include <sys/types.h> | 55 | #include <sys/types.h> |
| 55 | typedef int8_t __s8; | 56 | typedef int8_t __s8; |
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 83cd1636b9be..5ab331e5dc23 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h | |||
| @@ -33,6 +33,15 @@ | |||
| 33 | extern "C" { | 33 | extern "C" { |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | /** | ||
| 37 | * DOC: overview | ||
| 38 | * | ||
| 39 | * DRM exposes many UAPI and structure definition to have a consistent | ||
| 40 | * and standardized interface with user. | ||
| 41 | * Userspace can refer to these structure definitions and UAPI formats | ||
| 42 | * to communicate to driver | ||
| 43 | */ | ||
| 44 | |||
| 36 | #define DRM_CONNECTOR_NAME_LEN 32 | 45 | #define DRM_CONNECTOR_NAME_LEN 32 |
| 37 | #define DRM_DISPLAY_MODE_LEN 32 | 46 | #define DRM_DISPLAY_MODE_LEN 32 |
| 38 | #define DRM_PROP_NAME_LEN 32 | 47 | #define DRM_PROP_NAME_LEN 32 |
| @@ -630,6 +639,92 @@ struct drm_color_lut { | |||
| 630 | __u16 reserved; | 639 | __u16 reserved; |
| 631 | }; | 640 | }; |
| 632 | 641 | ||
| 642 | /** | ||
| 643 | * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data. | ||
| 644 | * | ||
| 645 | * HDR Metadata Infoframe as per CTA 861.G spec. This is expected | ||
| 646 | * to match exactly with the spec. | ||
| 647 | * | ||
| 648 | * Userspace is expected to pass the metadata information as per | ||
| 649 | * the format described in this structure. | ||
| 650 | */ | ||
| 651 | struct hdr_metadata_infoframe { | ||
| 652 | /** | ||
| 653 | * @eotf: Electro-Optical Transfer Function (EOTF) | ||
| 654 | * used in the stream. | ||
| 655 | */ | ||
| 656 | __u8 eotf; | ||
| 657 | /** | ||
| 658 | * @metadata_type: Static_Metadata_Descriptor_ID. | ||
| 659 | */ | ||
| 660 | __u8 metadata_type; | ||
| 661 | /** | ||
| 662 | * @display_primaries: Color Primaries of the Data. | ||
| 663 | * These are coded as unsigned 16-bit values in units of | ||
| 664 | * 0.00002, where 0x0000 represents zero and 0xC350 | ||
| 665 | * represents 1.0000. | ||
| 666 | * @display_primaries.x: X cordinate of color primary. | ||
| 667 | * @display_primaries.y: Y cordinate of color primary. | ||
| 668 | */ | ||
| 669 | struct { | ||
| 670 | __u16 x, y; | ||
| 671 | } display_primaries[3]; | ||
| 672 | /** | ||
| 673 | * @white_point: White Point of Colorspace Data. | ||
| 674 | * These are coded as unsigned 16-bit values in units of | ||
| 675 | * 0.00002, where 0x0000 represents zero and 0xC350 | ||
| 676 | * represents 1.0000. | ||
| 677 | * @white_point.x: X cordinate of whitepoint of color primary. | ||
| 678 | * @white_point.y: Y cordinate of whitepoint of color primary. | ||
| 679 | */ | ||
| 680 | struct { | ||
| 681 | __u16 x, y; | ||
| 682 | } white_point; | ||
| 683 | /** | ||
| 684 | * @max_display_mastering_luminance: Max Mastering Display Luminance. | ||
| 685 | * This value is coded as an unsigned 16-bit value in units of 1 cd/m2, | ||
| 686 | * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. | ||
| 687 | */ | ||
| 688 | __u16 max_display_mastering_luminance; | ||
| 689 | /** | ||
| 690 | * @min_display_mastering_luminance: Min Mastering Display Luminance. | ||
| 691 | * This value is coded as an unsigned 16-bit value in units of | ||
| 692 | * 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF | ||
| 693 | * represents 6.5535 cd/m2. | ||
| 694 | */ | ||
| 695 | __u16 min_display_mastering_luminance; | ||
| 696 | /** | ||
| 697 | * @max_cll: Max Content Light Level. | ||
| 698 | * This value is coded as an unsigned 16-bit value in units of 1 cd/m2, | ||
| 699 | * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. | ||
| 700 | */ | ||
| 701 | __u16 max_cll; | ||
| 702 | /** | ||
| 703 | * @max_fall: Max Frame Average Light Level. | ||
| 704 | * This value is coded as an unsigned 16-bit value in units of 1 cd/m2, | ||
| 705 | * where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. | ||
| 706 | */ | ||
| 707 | __u16 max_fall; | ||
| 708 | }; | ||
| 709 | |||
| 710 | /** | ||
| 711 | * struct hdr_output_metadata - HDR output metadata | ||
| 712 | * | ||
| 713 | * Metadata Information to be passed from userspace | ||
| 714 | */ | ||
| 715 | struct hdr_output_metadata { | ||
| 716 | /** | ||
| 717 | * @metadata_type: Static_Metadata_Descriptor_ID. | ||
| 718 | */ | ||
| 719 | __u32 metadata_type; | ||
| 720 | /** | ||
| 721 | * @hdmi_metadata_type1: HDR Metadata Infoframe. | ||
| 722 | */ | ||
| 723 | union { | ||
| 724 | struct hdr_metadata_infoframe hdmi_metadata_type1; | ||
| 725 | }; | ||
| 726 | }; | ||
| 727 | |||
| 633 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 | 728 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 |
| 634 | #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 | 729 | #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 |
| 635 | #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4 | 730 | #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4 |
| @@ -803,6 +898,10 @@ struct drm_format_modifier { | |||
| 803 | }; | 898 | }; |
| 804 | 899 | ||
| 805 | /** | 900 | /** |
| 901 | * struct drm_mode_create_blob - Create New block property | ||
| 902 | * @data: Pointer to data to copy. | ||
| 903 | * @length: Length of data to copy. | ||
| 904 | * @blob_id: new property ID. | ||
| 806 | * Create a new 'blob' data property, copying length bytes from data pointer, | 905 | * Create a new 'blob' data property, copying length bytes from data pointer, |
| 807 | * and returning new blob ID. | 906 | * and returning new blob ID. |
| 808 | */ | 907 | */ |
| @@ -816,6 +915,8 @@ struct drm_mode_create_blob { | |||
| 816 | }; | 915 | }; |
| 817 | 916 | ||
| 818 | /** | 917 | /** |
| 918 | * struct drm_mode_destroy_blob - Destroy user blob | ||
| 919 | * @blob_id: blob_id to destroy | ||
| 819 | * Destroy a user-created blob property. | 920 | * Destroy a user-created blob property. |
| 820 | */ | 921 | */ |
| 821 | struct drm_mode_destroy_blob { | 922 | struct drm_mode_destroy_blob { |
| @@ -823,6 +924,12 @@ struct drm_mode_destroy_blob { | |||
| 823 | }; | 924 | }; |
| 824 | 925 | ||
| 825 | /** | 926 | /** |
| 927 | * struct drm_mode_create_lease - Create lease | ||
| 928 | * @object_ids: Pointer to array of object ids. | ||
| 929 | * @object_count: Number of object ids. | ||
| 930 | * @flags: flags for new FD. | ||
| 931 | * @lessee_id: unique identifier for lessee. | ||
| 932 | * @fd: file descriptor to new drm_master file. | ||
| 826 | * Lease mode resources, creating another drm_master. | 933 | * Lease mode resources, creating another drm_master. |
| 827 | */ | 934 | */ |
| 828 | struct drm_mode_create_lease { | 935 | struct drm_mode_create_lease { |
| @@ -840,6 +947,10 @@ struct drm_mode_create_lease { | |||
| 840 | }; | 947 | }; |
| 841 | 948 | ||
| 842 | /** | 949 | /** |
| 950 | * struct drm_mode_list_lessees - List lessees | ||
| 951 | * @count_lessees: Number of lessees. | ||
| 952 | * @pad: pad. | ||
| 953 | * @lessees_ptr: Pointer to lessess. | ||
| 843 | * List lesses from a drm_master | 954 | * List lesses from a drm_master |
| 844 | */ | 955 | */ |
| 845 | struct drm_mode_list_lessees { | 956 | struct drm_mode_list_lessees { |
| @@ -860,6 +971,10 @@ struct drm_mode_list_lessees { | |||
| 860 | }; | 971 | }; |
| 861 | 972 | ||
| 862 | /** | 973 | /** |
| 974 | * struct drm_mode_get_lease - Get Lease | ||
| 975 | * @count_objects: Number of leased objects. | ||
| 976 | * @pad: pad. | ||
| 977 | * @objects_ptr: Pointer to objects. | ||
| 863 | * Get leased objects | 978 | * Get leased objects |
| 864 | */ | 979 | */ |
| 865 | struct drm_mode_get_lease { | 980 | struct drm_mode_get_lease { |
| @@ -880,6 +995,8 @@ struct drm_mode_get_lease { | |||
| 880 | }; | 995 | }; |
| 881 | 996 | ||
| 882 | /** | 997 | /** |
| 998 | * struct drm_mode_revoke_lease - Revoke lease | ||
| 999 | * @lessee_id: Unique ID of lessee. | ||
| 883 | * Revoke lease | 1000 | * Revoke lease |
| 884 | */ | 1001 | */ |
| 885 | struct drm_mode_revoke_lease { | 1002 | struct drm_mode_revoke_lease { |
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index 3a73f5316766..328d05e77d9f 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h | |||
| @@ -136,6 +136,8 @@ enum drm_i915_gem_engine_class { | |||
| 136 | struct i915_engine_class_instance { | 136 | struct i915_engine_class_instance { |
| 137 | __u16 engine_class; /* see enum drm_i915_gem_engine_class */ | 137 | __u16 engine_class; /* see enum drm_i915_gem_engine_class */ |
| 138 | __u16 engine_instance; | 138 | __u16 engine_instance; |
| 139 | #define I915_ENGINE_CLASS_INVALID_NONE -1 | ||
| 140 | #define I915_ENGINE_CLASS_INVALID_VIRTUAL -2 | ||
| 139 | }; | 141 | }; |
| 140 | 142 | ||
| 141 | /** | 143 | /** |
| @@ -355,6 +357,8 @@ typedef struct _drm_i915_sarea { | |||
| 355 | #define DRM_I915_PERF_ADD_CONFIG 0x37 | 357 | #define DRM_I915_PERF_ADD_CONFIG 0x37 |
| 356 | #define DRM_I915_PERF_REMOVE_CONFIG 0x38 | 358 | #define DRM_I915_PERF_REMOVE_CONFIG 0x38 |
| 357 | #define DRM_I915_QUERY 0x39 | 359 | #define DRM_I915_QUERY 0x39 |
| 360 | #define DRM_I915_GEM_VM_CREATE 0x3a | ||
| 361 | #define DRM_I915_GEM_VM_DESTROY 0x3b | ||
| 358 | /* Must be kept compact -- no holes */ | 362 | /* Must be kept compact -- no holes */ |
| 359 | 363 | ||
| 360 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 364 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
| @@ -415,6 +419,8 @@ typedef struct _drm_i915_sarea { | |||
| 415 | #define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config) | 419 | #define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config) |
| 416 | #define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64) | 420 | #define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64) |
| 417 | #define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query) | 421 | #define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query) |
| 422 | #define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control) | ||
| 423 | #define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control) | ||
| 418 | 424 | ||
| 419 | /* Allow drivers to submit batchbuffers directly to hardware, relying | 425 | /* Allow drivers to submit batchbuffers directly to hardware, relying |
| 420 | * on the security mechanisms provided by hardware. | 426 | * on the security mechanisms provided by hardware. |
| @@ -598,6 +604,12 @@ typedef struct drm_i915_irq_wait { | |||
| 598 | */ | 604 | */ |
| 599 | #define I915_PARAM_MMAP_GTT_COHERENT 52 | 605 | #define I915_PARAM_MMAP_GTT_COHERENT 52 |
| 600 | 606 | ||
| 607 | /* | ||
| 608 | * Query whether DRM_I915_GEM_EXECBUFFER2 supports coordination of parallel | ||
| 609 | * execution through use of explicit fence support. | ||
| 610 | * See I915_EXEC_FENCE_OUT and I915_EXEC_FENCE_SUBMIT. | ||
| 611 | */ | ||
| 612 | #define I915_PARAM_HAS_EXEC_SUBMIT_FENCE 53 | ||
| 601 | /* Must be kept compact -- no holes and well documented */ | 613 | /* Must be kept compact -- no holes and well documented */ |
| 602 | 614 | ||
| 603 | typedef struct drm_i915_getparam { | 615 | typedef struct drm_i915_getparam { |
| @@ -1120,7 +1132,16 @@ struct drm_i915_gem_execbuffer2 { | |||
| 1120 | */ | 1132 | */ |
| 1121 | #define I915_EXEC_FENCE_ARRAY (1<<19) | 1133 | #define I915_EXEC_FENCE_ARRAY (1<<19) |
| 1122 | 1134 | ||
| 1123 | #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_ARRAY<<1)) | 1135 | /* |
| 1136 | * Setting I915_EXEC_FENCE_SUBMIT implies that lower_32_bits(rsvd2) represent | ||
| 1137 | * a sync_file fd to wait upon (in a nonblocking manner) prior to executing | ||
| 1138 | * the batch. | ||
| 1139 | * | ||
| 1140 | * Returns -EINVAL if the sync_file fd cannot be found. | ||
| 1141 | */ | ||
| 1142 | #define I915_EXEC_FENCE_SUBMIT (1 << 20) | ||
| 1143 | |||
| 1144 | #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SUBMIT << 1)) | ||
| 1124 | 1145 | ||
| 1125 | #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) | 1146 | #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) |
| 1126 | #define i915_execbuffer2_set_context_id(eb2, context) \ | 1147 | #define i915_execbuffer2_set_context_id(eb2, context) \ |
| @@ -1464,8 +1485,9 @@ struct drm_i915_gem_context_create_ext { | |||
| 1464 | __u32 ctx_id; /* output: id of new context*/ | 1485 | __u32 ctx_id; /* output: id of new context*/ |
| 1465 | __u32 flags; | 1486 | __u32 flags; |
| 1466 | #define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS (1u << 0) | 1487 | #define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS (1u << 0) |
| 1488 | #define I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE (1u << 1) | ||
| 1467 | #define I915_CONTEXT_CREATE_FLAGS_UNKNOWN \ | 1489 | #define I915_CONTEXT_CREATE_FLAGS_UNKNOWN \ |
| 1468 | (-(I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS << 1)) | 1490 | (-(I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE << 1)) |
| 1469 | __u64 extensions; | 1491 | __u64 extensions; |
| 1470 | }; | 1492 | }; |
| 1471 | 1493 | ||
| @@ -1507,6 +1529,41 @@ struct drm_i915_gem_context_param { | |||
| 1507 | * On creation, all new contexts are marked as recoverable. | 1529 | * On creation, all new contexts are marked as recoverable. |
| 1508 | */ | 1530 | */ |
| 1509 | #define I915_CONTEXT_PARAM_RECOVERABLE 0x8 | 1531 | #define I915_CONTEXT_PARAM_RECOVERABLE 0x8 |
| 1532 | |||
| 1533 | /* | ||
| 1534 | * The id of the associated virtual memory address space (ppGTT) of | ||
| 1535 | * this context. Can be retrieved and passed to another context | ||
| 1536 | * (on the same fd) for both to use the same ppGTT and so share | ||
| 1537 | * address layouts, and avoid reloading the page tables on context | ||
| 1538 | * switches between themselves. | ||
| 1539 | * | ||
| 1540 | * See DRM_I915_GEM_VM_CREATE and DRM_I915_GEM_VM_DESTROY. | ||
| 1541 | */ | ||
| 1542 | #define I915_CONTEXT_PARAM_VM 0x9 | ||
| 1543 | |||
| 1544 | /* | ||
| 1545 | * I915_CONTEXT_PARAM_ENGINES: | ||
| 1546 | * | ||
| 1547 | * Bind this context to operate on this subset of available engines. Henceforth, | ||
| 1548 | * the I915_EXEC_RING selector for DRM_IOCTL_I915_GEM_EXECBUFFER2 operates as | ||
| 1549 | * an index into this array of engines; I915_EXEC_DEFAULT selecting engine[0] | ||
| 1550 | * and upwards. Slots 0...N are filled in using the specified (class, instance). | ||
| 1551 | * Use | ||
| 1552 | * engine_class: I915_ENGINE_CLASS_INVALID, | ||
| 1553 | * engine_instance: I915_ENGINE_CLASS_INVALID_NONE | ||
| 1554 | * to specify a gap in the array that can be filled in later, e.g. by a | ||
| 1555 | * virtual engine used for load balancing. | ||
| 1556 | * | ||
| 1557 | * Setting the number of engines bound to the context to 0, by passing a zero | ||
| 1558 | * sized argument, will revert back to default settings. | ||
| 1559 | * | ||
| 1560 | * See struct i915_context_param_engines. | ||
| 1561 | * | ||
| 1562 | * Extensions: | ||
| 1563 | * i915_context_engines_load_balance (I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE) | ||
| 1564 | * i915_context_engines_bond (I915_CONTEXT_ENGINES_EXT_BOND) | ||
| 1565 | */ | ||
| 1566 | #define I915_CONTEXT_PARAM_ENGINES 0xa | ||
| 1510 | /* Must be kept compact -- no holes and well documented */ | 1567 | /* Must be kept compact -- no holes and well documented */ |
| 1511 | 1568 | ||
| 1512 | __u64 value; | 1569 | __u64 value; |
| @@ -1540,9 +1597,10 @@ struct drm_i915_gem_context_param_sseu { | |||
| 1540 | struct i915_engine_class_instance engine; | 1597 | struct i915_engine_class_instance engine; |
| 1541 | 1598 | ||
| 1542 | /* | 1599 | /* |
| 1543 | * Unused for now. Must be cleared to zero. | 1600 | * Unknown flags must be cleared to zero. |
| 1544 | */ | 1601 | */ |
| 1545 | __u32 flags; | 1602 | __u32 flags; |
| 1603 | #define I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX (1u << 0) | ||
| 1546 | 1604 | ||
| 1547 | /* | 1605 | /* |
| 1548 | * Mask of slices to enable for the context. Valid values are a subset | 1606 | * Mask of slices to enable for the context. Valid values are a subset |
| @@ -1570,12 +1628,115 @@ struct drm_i915_gem_context_param_sseu { | |||
| 1570 | __u32 rsvd; | 1628 | __u32 rsvd; |
| 1571 | }; | 1629 | }; |
| 1572 | 1630 | ||
| 1631 | /* | ||
| 1632 | * i915_context_engines_load_balance: | ||
| 1633 | * | ||
| 1634 | * Enable load balancing across this set of engines. | ||
| 1635 | * | ||
| 1636 | * Into the I915_EXEC_DEFAULT slot [0], a virtual engine is created that when | ||
| 1637 | * used will proxy the execbuffer request onto one of the set of engines | ||
| 1638 | * in such a way as to distribute the load evenly across the set. | ||
| 1639 | * | ||
| 1640 | * The set of engines must be compatible (e.g. the same HW class) as they | ||
| 1641 | * will share the same logical GPU context and ring. | ||
| 1642 | * | ||
| 1643 | * To intermix rendering with the virtual engine and direct rendering onto | ||
| 1644 | * the backing engines (bypassing the load balancing proxy), the context must | ||
| 1645 | * be defined to use a single timeline for all engines. | ||
| 1646 | */ | ||
| 1647 | struct i915_context_engines_load_balance { | ||
| 1648 | struct i915_user_extension base; | ||
| 1649 | |||
| 1650 | __u16 engine_index; | ||
| 1651 | __u16 num_siblings; | ||
| 1652 | __u32 flags; /* all undefined flags must be zero */ | ||
| 1653 | |||
| 1654 | __u64 mbz64; /* reserved for future use; must be zero */ | ||
| 1655 | |||
| 1656 | struct i915_engine_class_instance engines[0]; | ||
| 1657 | } __attribute__((packed)); | ||
| 1658 | |||
| 1659 | #define I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(name__, N__) struct { \ | ||
| 1660 | struct i915_user_extension base; \ | ||
| 1661 | __u16 engine_index; \ | ||
| 1662 | __u16 num_siblings; \ | ||
| 1663 | __u32 flags; \ | ||
| 1664 | __u64 mbz64; \ | ||
| 1665 | struct i915_engine_class_instance engines[N__]; \ | ||
| 1666 | } __attribute__((packed)) name__ | ||
| 1667 | |||
| 1668 | /* | ||
| 1669 | * i915_context_engines_bond: | ||
| 1670 | * | ||
| 1671 | * Constructed bonded pairs for execution within a virtual engine. | ||
| 1672 | * | ||
| 1673 | * All engines are equal, but some are more equal than others. Given | ||
| 1674 | * the distribution of resources in the HW, it may be preferable to run | ||
| 1675 | * a request on a given subset of engines in parallel to a request on a | ||
| 1676 | * specific engine. We enable this selection of engines within a virtual | ||
| 1677 | * engine by specifying bonding pairs, for any given master engine we will | ||
| 1678 | * only execute on one of the corresponding siblings within the virtual engine. | ||
| 1679 | * | ||
| 1680 | * To execute a request in parallel on the master engine and a sibling requires | ||
| 1681 | * coordination with a I915_EXEC_FENCE_SUBMIT. | ||
| 1682 | */ | ||
| 1683 | struct i915_context_engines_bond { | ||
| 1684 | struct i915_user_extension base; | ||
| 1685 | |||
| 1686 | struct i915_engine_class_instance master; | ||
| 1687 | |||
| 1688 | __u16 virtual_index; /* index of virtual engine in ctx->engines[] */ | ||
| 1689 | __u16 num_bonds; | ||
| 1690 | |||
| 1691 | __u64 flags; /* all undefined flags must be zero */ | ||
| 1692 | __u64 mbz64[4]; /* reserved for future use; must be zero */ | ||
| 1693 | |||
| 1694 | struct i915_engine_class_instance engines[0]; | ||
| 1695 | } __attribute__((packed)); | ||
| 1696 | |||
| 1697 | #define I915_DEFINE_CONTEXT_ENGINES_BOND(name__, N__) struct { \ | ||
| 1698 | struct i915_user_extension base; \ | ||
| 1699 | struct i915_engine_class_instance master; \ | ||
| 1700 | __u16 virtual_index; \ | ||
| 1701 | __u16 num_bonds; \ | ||
| 1702 | __u64 flags; \ | ||
| 1703 | __u64 mbz64[4]; \ | ||
| 1704 | struct i915_engine_class_instance engines[N__]; \ | ||
| 1705 | } __attribute__((packed)) name__ | ||
| 1706 | |||
| 1707 | struct i915_context_param_engines { | ||
| 1708 | __u64 extensions; /* linked chain of extension blocks, 0 terminates */ | ||
| 1709 | #define I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE 0 /* see i915_context_engines_load_balance */ | ||
| 1710 | #define I915_CONTEXT_ENGINES_EXT_BOND 1 /* see i915_context_engines_bond */ | ||
| 1711 | struct i915_engine_class_instance engines[0]; | ||
| 1712 | } __attribute__((packed)); | ||
| 1713 | |||
| 1714 | #define I915_DEFINE_CONTEXT_PARAM_ENGINES(name__, N__) struct { \ | ||
| 1715 | __u64 extensions; \ | ||
| 1716 | struct i915_engine_class_instance engines[N__]; \ | ||
| 1717 | } __attribute__((packed)) name__ | ||
| 1718 | |||
| 1573 | struct drm_i915_gem_context_create_ext_setparam { | 1719 | struct drm_i915_gem_context_create_ext_setparam { |
| 1574 | #define I915_CONTEXT_CREATE_EXT_SETPARAM 0 | 1720 | #define I915_CONTEXT_CREATE_EXT_SETPARAM 0 |
| 1575 | struct i915_user_extension base; | 1721 | struct i915_user_extension base; |
| 1576 | struct drm_i915_gem_context_param param; | 1722 | struct drm_i915_gem_context_param param; |
| 1577 | }; | 1723 | }; |
| 1578 | 1724 | ||
| 1725 | struct drm_i915_gem_context_create_ext_clone { | ||
| 1726 | #define I915_CONTEXT_CREATE_EXT_CLONE 1 | ||
| 1727 | struct i915_user_extension base; | ||
| 1728 | __u32 clone_id; | ||
| 1729 | __u32 flags; | ||
| 1730 | #define I915_CONTEXT_CLONE_ENGINES (1u << 0) | ||
| 1731 | #define I915_CONTEXT_CLONE_FLAGS (1u << 1) | ||
| 1732 | #define I915_CONTEXT_CLONE_SCHEDATTR (1u << 2) | ||
| 1733 | #define I915_CONTEXT_CLONE_SSEU (1u << 3) | ||
| 1734 | #define I915_CONTEXT_CLONE_TIMELINE (1u << 4) | ||
| 1735 | #define I915_CONTEXT_CLONE_VM (1u << 5) | ||
| 1736 | #define I915_CONTEXT_CLONE_UNKNOWN -(I915_CONTEXT_CLONE_VM << 1) | ||
| 1737 | __u64 rsvd; | ||
| 1738 | }; | ||
| 1739 | |||
| 1579 | struct drm_i915_gem_context_destroy { | 1740 | struct drm_i915_gem_context_destroy { |
| 1580 | __u32 ctx_id; | 1741 | __u32 ctx_id; |
| 1581 | __u32 pad; | 1742 | __u32 pad; |
| @@ -1821,6 +1982,7 @@ struct drm_i915_perf_oa_config { | |||
| 1821 | struct drm_i915_query_item { | 1982 | struct drm_i915_query_item { |
| 1822 | __u64 query_id; | 1983 | __u64 query_id; |
| 1823 | #define DRM_I915_QUERY_TOPOLOGY_INFO 1 | 1984 | #define DRM_I915_QUERY_TOPOLOGY_INFO 1 |
| 1985 | #define DRM_I915_QUERY_ENGINE_INFO 2 | ||
| 1824 | /* Must be kept compact -- no holes and well documented */ | 1986 | /* Must be kept compact -- no holes and well documented */ |
| 1825 | 1987 | ||
| 1826 | /* | 1988 | /* |
| @@ -1919,6 +2081,47 @@ struct drm_i915_query_topology_info { | |||
| 1919 | __u8 data[]; | 2081 | __u8 data[]; |
| 1920 | }; | 2082 | }; |
| 1921 | 2083 | ||
| 2084 | /** | ||
| 2085 | * struct drm_i915_engine_info | ||
| 2086 | * | ||
| 2087 | * Describes one engine and it's capabilities as known to the driver. | ||
| 2088 | */ | ||
| 2089 | struct drm_i915_engine_info { | ||
| 2090 | /** Engine class and instance. */ | ||
| 2091 | struct i915_engine_class_instance engine; | ||
| 2092 | |||
| 2093 | /** Reserved field. */ | ||
| 2094 | __u32 rsvd0; | ||
| 2095 | |||
| 2096 | /** Engine flags. */ | ||
| 2097 | __u64 flags; | ||
| 2098 | |||
| 2099 | /** Capabilities of this engine. */ | ||
| 2100 | __u64 capabilities; | ||
| 2101 | #define I915_VIDEO_CLASS_CAPABILITY_HEVC (1 << 0) | ||
| 2102 | #define I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC (1 << 1) | ||
| 2103 | |||
| 2104 | /** Reserved fields. */ | ||
| 2105 | __u64 rsvd1[4]; | ||
| 2106 | }; | ||
| 2107 | |||
| 2108 | /** | ||
| 2109 | * struct drm_i915_query_engine_info | ||
| 2110 | * | ||
| 2111 | * Engine info query enumerates all engines known to the driver by filling in | ||
| 2112 | * an array of struct drm_i915_engine_info structures. | ||
| 2113 | */ | ||
| 2114 | struct drm_i915_query_engine_info { | ||
| 2115 | /** Number of struct drm_i915_engine_info structs following. */ | ||
| 2116 | __u32 num_engines; | ||
| 2117 | |||
| 2118 | /** MBZ */ | ||
| 2119 | __u32 rsvd[3]; | ||
| 2120 | |||
| 2121 | /** Marker for drm_i915_engine_info structures. */ | ||
| 2122 | struct drm_i915_engine_info engines[]; | ||
| 2123 | }; | ||
| 2124 | |||
| 1922 | #if defined(__cplusplus) | 2125 | #if defined(__cplusplus) |
| 1923 | } | 2126 | } |
| 1924 | #endif | 2127 | #endif |
diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h index a52e0283b90d..b5d370638846 100644 --- a/include/uapi/drm/panfrost_drm.h +++ b/include/uapi/drm/panfrost_drm.h | |||
| @@ -18,6 +18,8 @@ extern "C" { | |||
| 18 | #define DRM_PANFROST_MMAP_BO 0x03 | 18 | #define DRM_PANFROST_MMAP_BO 0x03 |
| 19 | #define DRM_PANFROST_GET_PARAM 0x04 | 19 | #define DRM_PANFROST_GET_PARAM 0x04 |
| 20 | #define DRM_PANFROST_GET_BO_OFFSET 0x05 | 20 | #define DRM_PANFROST_GET_BO_OFFSET 0x05 |
| 21 | #define DRM_PANFROST_PERFCNT_ENABLE 0x06 | ||
| 22 | #define DRM_PANFROST_PERFCNT_DUMP 0x07 | ||
| 21 | 23 | ||
| 22 | #define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) | 24 | #define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) |
| 23 | #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) | 25 | #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) |
| @@ -26,6 +28,15 @@ extern "C" { | |||
| 26 | #define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param) | 28 | #define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param) |
| 27 | #define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset) | 29 | #define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset) |
| 28 | 30 | ||
| 31 | /* | ||
| 32 | * Unstable ioctl(s): only exposed when the unsafe unstable_ioctls module | ||
| 33 | * param is set to true. | ||
| 34 | * All these ioctl(s) are subject to deprecation, so please don't rely on | ||
| 35 | * them for anything but debugging purpose. | ||
| 36 | */ | ||
| 37 | #define DRM_IOCTL_PANFROST_PERFCNT_ENABLE DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_ENABLE, struct drm_panfrost_perfcnt_enable) | ||
| 38 | #define DRM_IOCTL_PANFROST_PERFCNT_DUMP DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_DUMP, struct drm_panfrost_perfcnt_dump) | ||
| 39 | |||
| 29 | #define PANFROST_JD_REQ_FS (1 << 0) | 40 | #define PANFROST_JD_REQ_FS (1 << 0) |
| 30 | /** | 41 | /** |
| 31 | * struct drm_panfrost_submit - ioctl argument for submitting commands to the 3D | 42 | * struct drm_panfrost_submit - ioctl argument for submitting commands to the 3D |
| @@ -135,6 +146,19 @@ struct drm_panfrost_get_bo_offset { | |||
| 135 | __u64 offset; | 146 | __u64 offset; |
| 136 | }; | 147 | }; |
| 137 | 148 | ||
| 149 | struct drm_panfrost_perfcnt_enable { | ||
| 150 | __u32 enable; | ||
| 151 | /* | ||
| 152 | * On bifrost we have 2 sets of counters, this parameter defines the | ||
| 153 | * one to track. | ||
| 154 | */ | ||
| 155 | __u32 counterset; | ||
| 156 | }; | ||
| 157 | |||
| 158 | struct drm_panfrost_perfcnt_dump { | ||
| 159 | __u64 buf_ptr; | ||
| 160 | }; | ||
| 161 | |||
| 138 | #if defined(__cplusplus) | 162 | #if defined(__cplusplus) |
| 139 | } | 163 | } |
| 140 | #endif | 164 | #endif |
diff --git a/include/uapi/drm/v3d_drm.h b/include/uapi/drm/v3d_drm.h index ea70669d2138..58fbe48c91e9 100644 --- a/include/uapi/drm/v3d_drm.h +++ b/include/uapi/drm/v3d_drm.h | |||
| @@ -37,6 +37,7 @@ extern "C" { | |||
| 37 | #define DRM_V3D_GET_PARAM 0x04 | 37 | #define DRM_V3D_GET_PARAM 0x04 |
| 38 | #define DRM_V3D_GET_BO_OFFSET 0x05 | 38 | #define DRM_V3D_GET_BO_OFFSET 0x05 |
| 39 | #define DRM_V3D_SUBMIT_TFU 0x06 | 39 | #define DRM_V3D_SUBMIT_TFU 0x06 |
| 40 | #define DRM_V3D_SUBMIT_CSD 0x07 | ||
| 40 | 41 | ||
| 41 | #define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl) | 42 | #define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl) |
| 42 | #define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo) | 43 | #define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo) |
| @@ -45,6 +46,7 @@ extern "C" { | |||
| 45 | #define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param) | 46 | #define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param) |
| 46 | #define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset) | 47 | #define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset) |
| 47 | #define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu) | 48 | #define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu) |
| 49 | #define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd) | ||
| 48 | 50 | ||
| 49 | /** | 51 | /** |
| 50 | * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D | 52 | * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D |
| @@ -190,6 +192,7 @@ enum drm_v3d_param { | |||
| 190 | DRM_V3D_PARAM_V3D_CORE0_IDENT1, | 192 | DRM_V3D_PARAM_V3D_CORE0_IDENT1, |
| 191 | DRM_V3D_PARAM_V3D_CORE0_IDENT2, | 193 | DRM_V3D_PARAM_V3D_CORE0_IDENT2, |
| 192 | DRM_V3D_PARAM_SUPPORTS_TFU, | 194 | DRM_V3D_PARAM_SUPPORTS_TFU, |
| 195 | DRM_V3D_PARAM_SUPPORTS_CSD, | ||
| 193 | }; | 196 | }; |
| 194 | 197 | ||
| 195 | struct drm_v3d_get_param { | 198 | struct drm_v3d_get_param { |
| @@ -230,6 +233,31 @@ struct drm_v3d_submit_tfu { | |||
| 230 | __u32 out_sync; | 233 | __u32 out_sync; |
| 231 | }; | 234 | }; |
| 232 | 235 | ||
| 236 | /* Submits a compute shader for dispatch. This job will block on any | ||
| 237 | * previous compute shaders submitted on this fd, and any other | ||
| 238 | * synchronization must be performed with in_sync/out_sync. | ||
| 239 | */ | ||
| 240 | struct drm_v3d_submit_csd { | ||
| 241 | __u32 cfg[7]; | ||
| 242 | __u32 coef[4]; | ||
| 243 | |||
| 244 | /* Pointer to a u32 array of the BOs that are referenced by the job. | ||
| 245 | */ | ||
| 246 | __u64 bo_handles; | ||
| 247 | |||
| 248 | /* Number of BO handles passed in (size is that times 4). */ | ||
| 249 | __u32 bo_handle_count; | ||
| 250 | |||
| 251 | /* sync object to block on before running the CSD job. Each | ||
| 252 | * CSD job will execute in the order submitted to its FD. | ||
| 253 | * Synchronization against rendering/TFU jobs or CSD from | ||
| 254 | * other fds requires using sync objects. | ||
| 255 | */ | ||
| 256 | __u32 in_sync; | ||
| 257 | /* Sync object to signal when the CSD job is done. */ | ||
| 258 | __u32 out_sync; | ||
| 259 | }; | ||
| 260 | |||
| 233 | #if defined(__cplusplus) | 261 | #if defined(__cplusplus) |
| 234 | } | 262 | } |
| 235 | #endif | 263 | #endif |
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index a1280af20336..c89c6495983d 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h | |||
| @@ -281,6 +281,7 @@ | |||
| 281 | #define AUDIT_OBJ_GID 110 | 281 | #define AUDIT_OBJ_GID 110 |
| 282 | #define AUDIT_FIELD_COMPARE 111 | 282 | #define AUDIT_FIELD_COMPARE 111 |
| 283 | #define AUDIT_EXE 112 | 283 | #define AUDIT_EXE 112 |
| 284 | #define AUDIT_SADDR_FAM 113 | ||
| 284 | 285 | ||
| 285 | #define AUDIT_ARG0 200 | 286 | #define AUDIT_ARG0 200 |
| 286 | #define AUDIT_ARG1 (AUDIT_ARG0+1) | 287 | #define AUDIT_ARG1 (AUDIT_ARG0+1) |
diff --git a/include/uapi/linux/batadv_packet.h b/include/uapi/linux/batadv_packet.h index 4ebc2135e950..2a15f01c2243 100644 --- a/include/uapi/linux/batadv_packet.h +++ b/include/uapi/linux/batadv_packet.h | |||
| @@ -107,12 +107,20 @@ enum batadv_icmp_packettype { | |||
| 107 | * @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for | 107 | * @BATADV_MCAST_WANT_ALL_UNSNOOPABLES: we want all packets destined for |
| 108 | * 224.0.0.0/24 or ff02::1 | 108 | * 224.0.0.0/24 or ff02::1 |
| 109 | * @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets | 109 | * @BATADV_MCAST_WANT_ALL_IPV4: we want all IPv4 multicast packets |
| 110 | * (both link-local and routable ones) | ||
| 110 | * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets | 111 | * @BATADV_MCAST_WANT_ALL_IPV6: we want all IPv6 multicast packets |
| 112 | * (both link-local and routable ones) | ||
| 113 | * @BATADV_MCAST_WANT_NO_RTR4: we have no IPv4 multicast router and therefore | ||
| 114 | * only need routable IPv4 multicast packets we signed up for explicitly | ||
| 115 | * @BATADV_MCAST_WANT_NO_RTR6: we have no IPv6 multicast router and therefore | ||
| 116 | * only need routable IPv6 multicast packets we signed up for explicitly | ||
| 111 | */ | 117 | */ |
| 112 | enum batadv_mcast_flags { | 118 | enum batadv_mcast_flags { |
| 113 | BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0, | 119 | BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0, |
| 114 | BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1, | 120 | BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1, |
| 115 | BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2, | 121 | BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2, |
| 122 | BATADV_MCAST_WANT_NO_RTR4 = 1UL << 3, | ||
| 123 | BATADV_MCAST_WANT_NO_RTR6 = 1UL << 4, | ||
| 116 | }; | 124 | }; |
| 117 | 125 | ||
| 118 | /* tt data subtypes */ | 126 | /* tt data subtypes */ |
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index a8b823c30b43..82699845ef79 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
| @@ -170,6 +170,7 @@ enum bpf_prog_type { | |||
| 170 | BPF_PROG_TYPE_FLOW_DISSECTOR, | 170 | BPF_PROG_TYPE_FLOW_DISSECTOR, |
| 171 | BPF_PROG_TYPE_CGROUP_SYSCTL, | 171 | BPF_PROG_TYPE_CGROUP_SYSCTL, |
| 172 | BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, | 172 | BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, |
| 173 | BPF_PROG_TYPE_CGROUP_SOCKOPT, | ||
| 173 | }; | 174 | }; |
| 174 | 175 | ||
| 175 | enum bpf_attach_type { | 176 | enum bpf_attach_type { |
| @@ -194,6 +195,8 @@ enum bpf_attach_type { | |||
| 194 | BPF_CGROUP_SYSCTL, | 195 | BPF_CGROUP_SYSCTL, |
| 195 | BPF_CGROUP_UDP4_RECVMSG, | 196 | BPF_CGROUP_UDP4_RECVMSG, |
| 196 | BPF_CGROUP_UDP6_RECVMSG, | 197 | BPF_CGROUP_UDP6_RECVMSG, |
| 198 | BPF_CGROUP_GETSOCKOPT, | ||
| 199 | BPF_CGROUP_SETSOCKOPT, | ||
| 197 | __MAX_BPF_ATTACH_TYPE | 200 | __MAX_BPF_ATTACH_TYPE |
| 198 | }; | 201 | }; |
| 199 | 202 | ||
| @@ -262,6 +265,24 @@ enum bpf_attach_type { | |||
| 262 | */ | 265 | */ |
| 263 | #define BPF_F_ANY_ALIGNMENT (1U << 1) | 266 | #define BPF_F_ANY_ALIGNMENT (1U << 1) |
| 264 | 267 | ||
| 268 | /* BPF_F_TEST_RND_HI32 is used in BPF_PROG_LOAD command for testing purpose. | ||
| 269 | * Verifier does sub-register def/use analysis and identifies instructions whose | ||
| 270 | * def only matters for low 32-bit, high 32-bit is never referenced later | ||
| 271 | * through implicit zero extension. Therefore verifier notifies JIT back-ends | ||
| 272 | * that it is safe to ignore clearing high 32-bit for these instructions. This | ||
| 273 | * saves some back-ends a lot of code-gen. However such optimization is not | ||
| 274 | * necessary on some arches, for example x86_64, arm64 etc, whose JIT back-ends | ||
| 275 | * hence hasn't used verifier's analysis result. But, we really want to have a | ||
| 276 | * way to be able to verify the correctness of the described optimization on | ||
| 277 | * x86_64 on which testsuites are frequently exercised. | ||
| 278 | * | ||
| 279 | * So, this flag is introduced. Once it is set, verifier will randomize high | ||
| 280 | * 32-bit for those instructions who has been identified as safe to ignore them. | ||
| 281 | * Then, if verifier is not doing correct analysis, such randomization will | ||
| 282 | * regress tests to expose bugs. | ||
| 283 | */ | ||
| 284 | #define BPF_F_TEST_RND_HI32 (1U << 2) | ||
| 285 | |||
| 265 | /* When BPF ldimm64's insn[0].src_reg != 0 then this can have | 286 | /* When BPF ldimm64's insn[0].src_reg != 0 then this can have |
| 266 | * two extensions: | 287 | * two extensions: |
| 267 | * | 288 | * |
| @@ -785,7 +806,7 @@ union bpf_attr { | |||
| 785 | * based on a user-provided identifier for all traffic coming from | 806 | * based on a user-provided identifier for all traffic coming from |
| 786 | * the tasks belonging to the related cgroup. See also the related | 807 | * the tasks belonging to the related cgroup. See also the related |
| 787 | * kernel documentation, available from the Linux sources in file | 808 | * kernel documentation, available from the Linux sources in file |
| 788 | * *Documentation/cgroup-v1/net_cls.txt*. | 809 | * *Documentation/admin-guide/cgroup-v1/net_cls.rst*. |
| 789 | * | 810 | * |
| 790 | * The Linux kernel has two versions for cgroups: there are | 811 | * The Linux kernel has two versions for cgroups: there are |
| 791 | * cgroups v1 and cgroups v2. Both are available to users, who can | 812 | * cgroups v1 and cgroups v2. Both are available to users, who can |
| @@ -1550,8 +1571,11 @@ union bpf_attr { | |||
| 1550 | * but this is only implemented for native XDP (with driver | 1571 | * but this is only implemented for native XDP (with driver |
| 1551 | * support) as of this writing). | 1572 | * support) as of this writing). |
| 1552 | * | 1573 | * |
| 1553 | * All values for *flags* are reserved for future usage, and must | 1574 | * The lower two bits of *flags* are used as the return code if |
| 1554 | * be left at zero. | 1575 | * the map lookup fails. This is so that the return value can be |
| 1576 | * one of the XDP program return codes up to XDP_TX, as chosen by | ||
| 1577 | * the caller. Any higher bits in the *flags* argument must be | ||
| 1578 | * unset. | ||
| 1555 | * | 1579 | * |
| 1556 | * When used to redirect packets to net devices, this helper | 1580 | * When used to redirect packets to net devices, this helper |
| 1557 | * provides a high performance increase over **bpf_redirect**\ (). | 1581 | * provides a high performance increase over **bpf_redirect**\ (). |
| @@ -1746,6 +1770,7 @@ union bpf_attr { | |||
| 1746 | * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out) | 1770 | * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out) |
| 1747 | * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission) | 1771 | * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission) |
| 1748 | * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change) | 1772 | * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change) |
| 1773 | * * **BPF_SOCK_OPS_RTT_CB_FLAG** (every RTT) | ||
| 1749 | * | 1774 | * |
| 1750 | * Therefore, this function can be used to clear a callback flag by | 1775 | * Therefore, this function can be used to clear a callback flag by |
| 1751 | * setting the appropriate bit to zero. e.g. to disable the RTO | 1776 | * setting the appropriate bit to zero. e.g. to disable the RTO |
| @@ -2674,6 +2699,20 @@ union bpf_attr { | |||
| 2674 | * 0 on success. | 2699 | * 0 on success. |
| 2675 | * | 2700 | * |
| 2676 | * **-ENOENT** if the bpf-local-storage cannot be found. | 2701 | * **-ENOENT** if the bpf-local-storage cannot be found. |
| 2702 | * | ||
| 2703 | * int bpf_send_signal(u32 sig) | ||
| 2704 | * Description | ||
| 2705 | * Send signal *sig* to the current task. | ||
| 2706 | * Return | ||
| 2707 | * 0 on success or successfully queued. | ||
| 2708 | * | ||
| 2709 | * **-EBUSY** if work queue under nmi is full. | ||
| 2710 | * | ||
| 2711 | * **-EINVAL** if *sig* is invalid. | ||
| 2712 | * | ||
| 2713 | * **-EPERM** if no permission to send the *sig*. | ||
| 2714 | * | ||
| 2715 | * **-EAGAIN** if bpf program can try again. | ||
| 2677 | */ | 2716 | */ |
| 2678 | #define __BPF_FUNC_MAPPER(FN) \ | 2717 | #define __BPF_FUNC_MAPPER(FN) \ |
| 2679 | FN(unspec), \ | 2718 | FN(unspec), \ |
| @@ -2784,7 +2823,8 @@ union bpf_attr { | |||
| 2784 | FN(strtol), \ | 2823 | FN(strtol), \ |
| 2785 | FN(strtoul), \ | 2824 | FN(strtoul), \ |
| 2786 | FN(sk_storage_get), \ | 2825 | FN(sk_storage_get), \ |
| 2787 | FN(sk_storage_delete), | 2826 | FN(sk_storage_delete), \ |
| 2827 | FN(send_signal), | ||
| 2788 | 2828 | ||
| 2789 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper | 2829 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 2790 | * function eBPF program intends to call | 2830 | * function eBPF program intends to call |
| @@ -3033,6 +3073,12 @@ struct bpf_tcp_sock { | |||
| 3033 | * sum(delta(snd_una)), or how many bytes | 3073 | * sum(delta(snd_una)), or how many bytes |
| 3034 | * were acked. | 3074 | * were acked. |
| 3035 | */ | 3075 | */ |
| 3076 | __u32 dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups | ||
| 3077 | * total number of DSACK blocks received | ||
| 3078 | */ | ||
| 3079 | __u32 delivered; /* Total data packets delivered incl. rexmits */ | ||
| 3080 | __u32 delivered_ce; /* Like the above but only ECE marked packets */ | ||
| 3081 | __u32 icsk_retransmits; /* Number of unrecovered [RTO] timeouts */ | ||
| 3036 | }; | 3082 | }; |
| 3037 | 3083 | ||
| 3038 | struct bpf_sock_tuple { | 3084 | struct bpf_sock_tuple { |
| @@ -3052,6 +3098,10 @@ struct bpf_sock_tuple { | |||
| 3052 | }; | 3098 | }; |
| 3053 | }; | 3099 | }; |
| 3054 | 3100 | ||
| 3101 | struct bpf_xdp_sock { | ||
| 3102 | __u32 queue_id; | ||
| 3103 | }; | ||
| 3104 | |||
| 3055 | #define XDP_PACKET_HEADROOM 256 | 3105 | #define XDP_PACKET_HEADROOM 256 |
| 3056 | 3106 | ||
| 3057 | /* User return codes for XDP prog type. | 3107 | /* User return codes for XDP prog type. |
| @@ -3143,6 +3193,7 @@ struct bpf_prog_info { | |||
| 3143 | char name[BPF_OBJ_NAME_LEN]; | 3193 | char name[BPF_OBJ_NAME_LEN]; |
| 3144 | __u32 ifindex; | 3194 | __u32 ifindex; |
| 3145 | __u32 gpl_compatible:1; | 3195 | __u32 gpl_compatible:1; |
| 3196 | __u32 :31; /* alignment pad */ | ||
| 3146 | __u64 netns_dev; | 3197 | __u64 netns_dev; |
| 3147 | __u64 netns_ino; | 3198 | __u64 netns_ino; |
| 3148 | __u32 nr_jited_ksyms; | 3199 | __u32 nr_jited_ksyms; |
| @@ -3197,7 +3248,7 @@ struct bpf_sock_addr { | |||
| 3197 | __u32 user_ip4; /* Allows 1,2,4-byte read and 4-byte write. | 3248 | __u32 user_ip4; /* Allows 1,2,4-byte read and 4-byte write. |
| 3198 | * Stored in network byte order. | 3249 | * Stored in network byte order. |
| 3199 | */ | 3250 | */ |
| 3200 | __u32 user_ip6[4]; /* Allows 1,2,4-byte read an 4-byte write. | 3251 | __u32 user_ip6[4]; /* Allows 1,2,4-byte read and 4,8-byte write. |
| 3201 | * Stored in network byte order. | 3252 | * Stored in network byte order. |
| 3202 | */ | 3253 | */ |
| 3203 | __u32 user_port; /* Allows 4-byte read and write. | 3254 | __u32 user_port; /* Allows 4-byte read and write. |
| @@ -3206,12 +3257,13 @@ struct bpf_sock_addr { | |||
| 3206 | __u32 family; /* Allows 4-byte read, but no write */ | 3257 | __u32 family; /* Allows 4-byte read, but no write */ |
| 3207 | __u32 type; /* Allows 4-byte read, but no write */ | 3258 | __u32 type; /* Allows 4-byte read, but no write */ |
| 3208 | __u32 protocol; /* Allows 4-byte read, but no write */ | 3259 | __u32 protocol; /* Allows 4-byte read, but no write */ |
| 3209 | __u32 msg_src_ip4; /* Allows 1,2,4-byte read an 4-byte write. | 3260 | __u32 msg_src_ip4; /* Allows 1,2,4-byte read and 4-byte write. |
| 3210 | * Stored in network byte order. | 3261 | * Stored in network byte order. |
| 3211 | */ | 3262 | */ |
| 3212 | __u32 msg_src_ip6[4]; /* Allows 1,2,4-byte read an 4-byte write. | 3263 | __u32 msg_src_ip6[4]; /* Allows 1,2,4-byte read and 4,8-byte write. |
| 3213 | * Stored in network byte order. | 3264 | * Stored in network byte order. |
| 3214 | */ | 3265 | */ |
| 3266 | __bpf_md_ptr(struct bpf_sock *, sk); | ||
| 3215 | }; | 3267 | }; |
| 3216 | 3268 | ||
| 3217 | /* User bpf_sock_ops struct to access socket values and specify request ops | 3269 | /* User bpf_sock_ops struct to access socket values and specify request ops |
| @@ -3263,13 +3315,15 @@ struct bpf_sock_ops { | |||
| 3263 | __u32 sk_txhash; | 3315 | __u32 sk_txhash; |
| 3264 | __u64 bytes_received; | 3316 | __u64 bytes_received; |
| 3265 | __u64 bytes_acked; | 3317 | __u64 bytes_acked; |
| 3318 | __bpf_md_ptr(struct bpf_sock *, sk); | ||
| 3266 | }; | 3319 | }; |
| 3267 | 3320 | ||
| 3268 | /* Definitions for bpf_sock_ops_cb_flags */ | 3321 | /* Definitions for bpf_sock_ops_cb_flags */ |
| 3269 | #define BPF_SOCK_OPS_RTO_CB_FLAG (1<<0) | 3322 | #define BPF_SOCK_OPS_RTO_CB_FLAG (1<<0) |
| 3270 | #define BPF_SOCK_OPS_RETRANS_CB_FLAG (1<<1) | 3323 | #define BPF_SOCK_OPS_RETRANS_CB_FLAG (1<<1) |
| 3271 | #define BPF_SOCK_OPS_STATE_CB_FLAG (1<<2) | 3324 | #define BPF_SOCK_OPS_STATE_CB_FLAG (1<<2) |
| 3272 | #define BPF_SOCK_OPS_ALL_CB_FLAGS 0x7 /* Mask of all currently | 3325 | #define BPF_SOCK_OPS_RTT_CB_FLAG (1<<3) |
| 3326 | #define BPF_SOCK_OPS_ALL_CB_FLAGS 0xF /* Mask of all currently | ||
| 3273 | * supported cb flags | 3327 | * supported cb flags |
| 3274 | */ | 3328 | */ |
| 3275 | 3329 | ||
| @@ -3324,6 +3378,8 @@ enum { | |||
| 3324 | BPF_SOCK_OPS_TCP_LISTEN_CB, /* Called on listen(2), right after | 3378 | BPF_SOCK_OPS_TCP_LISTEN_CB, /* Called on listen(2), right after |
| 3325 | * socket transition to LISTEN state. | 3379 | * socket transition to LISTEN state. |
| 3326 | */ | 3380 | */ |
| 3381 | BPF_SOCK_OPS_RTT_CB, /* Called on every RTT. | ||
| 3382 | */ | ||
| 3327 | }; | 3383 | }; |
| 3328 | 3384 | ||
| 3329 | /* List of TCP states. There is a build check in net/ipv4/tcp.c to detect | 3385 | /* List of TCP states. There is a build check in net/ipv4/tcp.c to detect |
| @@ -3502,4 +3558,15 @@ struct bpf_sysctl { | |||
| 3502 | */ | 3558 | */ |
| 3503 | }; | 3559 | }; |
| 3504 | 3560 | ||
| 3561 | struct bpf_sockopt { | ||
| 3562 | __bpf_md_ptr(struct bpf_sock *, sk); | ||
| 3563 | __bpf_md_ptr(void *, optval); | ||
| 3564 | __bpf_md_ptr(void *, optval_end); | ||
| 3565 | |||
| 3566 | __s32 level; | ||
| 3567 | __s32 optname; | ||
| 3568 | __s32 optlen; | ||
| 3569 | __s32 retval; | ||
| 3570 | }; | ||
| 3571 | |||
| 3505 | #endif /* _UAPI__LINUX_BPF_H__ */ | 3572 | #endif /* _UAPI__LINUX_BPF_H__ */ |
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h index 421239b98db2..34d5b34286fa 100644 --- a/include/uapi/linux/btrfs_tree.h +++ b/include/uapi/linux/btrfs_tree.h | |||
| @@ -866,6 +866,8 @@ enum btrfs_raid_types { | |||
| 866 | #define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | \ | 866 | #define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | \ |
| 867 | BTRFS_BLOCK_GROUP_RAID6) | 867 | BTRFS_BLOCK_GROUP_RAID6) |
| 868 | 868 | ||
| 869 | #define BTRFS_BLOCK_GROUP_RAID1_MASK (BTRFS_BLOCK_GROUP_RAID1) | ||
| 870 | |||
| 869 | /* | 871 | /* |
| 870 | * We need a bit for restriper to be able to tell when chunks of type | 872 | * We need a bit for restriper to be able to tell when chunks of type |
| 871 | * SINGLE are available. This "extended" profile format is used in | 873 | * SINGLE are available. This "extended" profile format is used in |
diff --git a/include/uapi/linux/cec.h b/include/uapi/linux/cec.h index 3094af68b6e7..5704fa0292b5 100644 --- a/include/uapi/linux/cec.h +++ b/include/uapi/linux/cec.h | |||
| @@ -144,6 +144,7 @@ static inline void cec_msg_set_reply_to(struct cec_msg *msg, | |||
| 144 | 144 | ||
| 145 | /* cec_msg flags field */ | 145 | /* cec_msg flags field */ |
| 146 | #define CEC_MSG_FL_REPLY_TO_FOLLOWERS (1 << 0) | 146 | #define CEC_MSG_FL_REPLY_TO_FOLLOWERS (1 << 0) |
| 147 | #define CEC_MSG_FL_RAW (1 << 1) | ||
| 147 | 148 | ||
| 148 | /* cec_msg tx/rx_status field */ | 149 | /* cec_msg tx/rx_status field */ |
| 149 | #define CEC_TX_STATUS_OK (1 << 0) | 150 | #define CEC_TX_STATUS_OK (1 << 0) |
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index 5bb4ea67d84f..ffc993256527 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h | |||
| @@ -104,6 +104,8 @@ enum devlink_command { | |||
| 104 | DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR, | 104 | DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR, |
| 105 | 105 | ||
| 106 | DEVLINK_CMD_FLASH_UPDATE, | 106 | DEVLINK_CMD_FLASH_UPDATE, |
| 107 | DEVLINK_CMD_FLASH_UPDATE_END, /* notification only */ | ||
| 108 | DEVLINK_CMD_FLASH_UPDATE_STATUS, /* notification only */ | ||
| 107 | 109 | ||
| 108 | /* add new commands above here */ | 110 | /* add new commands above here */ |
| 109 | __DEVLINK_CMD_MAX, | 111 | __DEVLINK_CMD_MAX, |
| @@ -167,6 +169,14 @@ enum devlink_port_flavour { | |||
| 167 | DEVLINK_PORT_FLAVOUR_DSA, /* Distributed switch architecture | 169 | DEVLINK_PORT_FLAVOUR_DSA, /* Distributed switch architecture |
| 168 | * interconnect port. | 170 | * interconnect port. |
| 169 | */ | 171 | */ |
| 172 | DEVLINK_PORT_FLAVOUR_PCI_PF, /* Represents eswitch port for | ||
| 173 | * the PCI PF. It is an internal | ||
| 174 | * port that faces the PCI PF. | ||
| 175 | */ | ||
| 176 | DEVLINK_PORT_FLAVOUR_PCI_VF, /* Represents eswitch port | ||
| 177 | * for the PCI VF. It is an internal | ||
| 178 | * port that faces the PCI VF. | ||
| 179 | */ | ||
| 170 | }; | 180 | }; |
| 171 | 181 | ||
| 172 | enum devlink_param_cmode { | 182 | enum devlink_param_cmode { |
| @@ -331,6 +341,12 @@ enum devlink_attr { | |||
| 331 | 341 | ||
| 332 | DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME, /* string */ | 342 | DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME, /* string */ |
| 333 | DEVLINK_ATTR_FLASH_UPDATE_COMPONENT, /* string */ | 343 | DEVLINK_ATTR_FLASH_UPDATE_COMPONENT, /* string */ |
| 344 | DEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG, /* string */ | ||
| 345 | DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE, /* u64 */ | ||
| 346 | DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL, /* u64 */ | ||
| 347 | |||
| 348 | DEVLINK_ATTR_PORT_PCI_PF_NUMBER, /* u16 */ | ||
| 349 | DEVLINK_ATTR_PORT_PCI_VF_NUMBER, /* u16 */ | ||
| 334 | 350 | ||
| 335 | /* add new attributes above here, update the policy in devlink.c */ | 351 | /* add new attributes above here, update the policy in devlink.c */ |
| 336 | 352 | ||
diff --git a/include/uapi/linux/dma-buf.h b/include/uapi/linux/dma-buf.h index d75df5210a4a..dbc7092e04b5 100644 --- a/include/uapi/linux/dma-buf.h +++ b/include/uapi/linux/dma-buf.h | |||
| @@ -35,7 +35,10 @@ struct dma_buf_sync { | |||
| 35 | #define DMA_BUF_SYNC_VALID_FLAGS_MASK \ | 35 | #define DMA_BUF_SYNC_VALID_FLAGS_MASK \ |
| 36 | (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END) | 36 | (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END) |
| 37 | 37 | ||
| 38 | #define DMA_BUF_NAME_LEN 32 | ||
| 39 | |||
| 38 | #define DMA_BUF_BASE 'b' | 40 | #define DMA_BUF_BASE 'b' |
| 39 | #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync) | 41 | #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync) |
| 42 | #define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *) | ||
| 40 | 43 | ||
| 41 | #endif | 44 | #endif |
diff --git a/include/uapi/linux/dvb/audio.h b/include/uapi/linux/dvb/audio.h index afeae063e640..2f869da69171 100644 --- a/include/uapi/linux/dvb/audio.h +++ b/include/uapi/linux/dvb/audio.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ | 1 | /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ |
| 2 | /* | 2 | /* |
| 3 | * audio.h | 3 | * audio.h - DEPRECATED MPEG-TS audio decoder API |
| 4 | * | ||
| 5 | * NOTE: should not be used on future drivers | ||
| 4 | * | 6 | * |
| 5 | * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> | 7 | * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> |
| 6 | * & Marcus Metzler <marcus@convergence.de> | 8 | * & Marcus Metzler <marcus@convergence.de> |
| @@ -52,7 +54,7 @@ typedef enum { | |||
| 52 | typedef struct audio_mixer { | 54 | typedef struct audio_mixer { |
| 53 | unsigned int volume_left; | 55 | unsigned int volume_left; |
| 54 | unsigned int volume_right; | 56 | unsigned int volume_right; |
| 55 | // what else do we need? bass, pass-through, ... | 57 | /* what else do we need? bass, pass-through, ... */ |
| 56 | } audio_mixer_t; | 58 | } audio_mixer_t; |
| 57 | 59 | ||
| 58 | 60 | ||
diff --git a/include/uapi/linux/dvb/osd.h b/include/uapi/linux/dvb/osd.h index e163508b9ae8..858997c74043 100644 --- a/include/uapi/linux/dvb/osd.h +++ b/include/uapi/linux/dvb/osd.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ | 1 | /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ |
| 2 | /* | 2 | /* |
| 3 | * osd.h | 3 | * osd.h - DEPRECATED On Screen Display API |
| 4 | * | ||
| 5 | * NOTE: should not be used on future drivers | ||
| 4 | * | 6 | * |
| 5 | * Copyright (C) 2001 Ralph Metzler <ralph@convergence.de> | 7 | * Copyright (C) 2001 Ralph Metzler <ralph@convergence.de> |
| 6 | * & Marcus Metzler <marcus@convergence.de> | 8 | * & Marcus Metzler <marcus@convergence.de> |
| @@ -28,74 +30,108 @@ | |||
| 28 | #include <linux/compiler.h> | 30 | #include <linux/compiler.h> |
| 29 | 31 | ||
| 30 | typedef enum { | 32 | typedef enum { |
| 31 | // All functions return -2 on "not open" | 33 | /* All functions return -2 on "not open" */ |
| 32 | OSD_Close=1, // () | 34 | OSD_Close = 1, /* () */ |
| 33 | // Disables OSD and releases the buffers | 35 | /* |
| 34 | // returns 0 on success | 36 | * Disables OSD and releases the buffers |
| 35 | OSD_Open, // (x0,y0,x1,y1,BitPerPixel[2/4/8](color&0x0F),mix[0..15](color&0xF0)) | 37 | * returns 0 on success |
| 36 | // Opens OSD with this size and bit depth | 38 | */ |
| 37 | // returns 0 on success, -1 on DRAM allocation error, -2 on "already open" | 39 | OSD_Open, /* (x0,y0,x1,y1,BitPerPixel[2/4/8](color&0x0F),mix[0..15](color&0xF0)) */ |
| 38 | OSD_Show, // () | 40 | /* |
| 39 | // enables OSD mode | 41 | * Opens OSD with this size and bit depth |
| 40 | // returns 0 on success | 42 | * returns 0 on success, -1 on DRAM allocation error, -2 on "already open" |
| 41 | OSD_Hide, // () | 43 | */ |
| 42 | // disables OSD mode | 44 | OSD_Show, /* () */ |
| 43 | // returns 0 on success | 45 | /* |
| 44 | OSD_Clear, // () | 46 | * enables OSD mode |
| 45 | // Sets all pixel to color 0 | 47 | * returns 0 on success |
| 46 | // returns 0 on success | 48 | */ |
| 47 | OSD_Fill, // (color) | 49 | OSD_Hide, /* () */ |
| 48 | // Sets all pixel to color <col> | 50 | /* |
| 49 | // returns 0 on success | 51 | * disables OSD mode |
| 50 | OSD_SetColor, // (color,R{x0},G{y0},B{x1},opacity{y1}) | 52 | * returns 0 on success |
| 51 | // set palette entry <num> to <r,g,b>, <mix> and <trans> apply | 53 | */ |
| 52 | // R,G,B: 0..255 | 54 | OSD_Clear, /* () */ |
| 53 | // R=Red, G=Green, B=Blue | 55 | /* |
| 54 | // opacity=0: pixel opacity 0% (only video pixel shows) | 56 | * Sets all pixel to color 0 |
| 55 | // opacity=1..254: pixel opacity as specified in header | 57 | * returns 0 on success |
| 56 | // opacity=255: pixel opacity 100% (only OSD pixel shows) | 58 | */ |
| 57 | // returns 0 on success, -1 on error | 59 | OSD_Fill, /* (color) */ |
| 58 | OSD_SetPalette, // (firstcolor{color},lastcolor{x0},data) | 60 | /* |
| 59 | // Set a number of entries in the palette | 61 | * Sets all pixel to color <col> |
| 60 | // sets the entries "firstcolor" through "lastcolor" from the array "data" | 62 | * returns 0 on success |
| 61 | // data has 4 byte for each color: | 63 | */ |
| 62 | // R,G,B, and a opacity value: 0->transparent, 1..254->mix, 255->pixel | 64 | OSD_SetColor, /* (color,R{x0},G{y0},B{x1},opacity{y1}) */ |
| 63 | OSD_SetTrans, // (transparency{color}) | 65 | /* |
| 64 | // Sets transparency of mixed pixel (0..15) | 66 | * set palette entry <num> to <r,g,b>, <mix> and <trans> apply |
| 65 | // returns 0 on success | 67 | * R,G,B: 0..255 |
| 66 | OSD_SetPixel, // (x0,y0,color) | 68 | * R=Red, G=Green, B=Blue |
| 67 | // sets pixel <x>,<y> to color number <col> | 69 | * opacity=0: pixel opacity 0% (only video pixel shows) |
| 68 | // returns 0 on success, -1 on error | 70 | * opacity=1..254: pixel opacity as specified in header |
| 69 | OSD_GetPixel, // (x0,y0) | 71 | * opacity=255: pixel opacity 100% (only OSD pixel shows) |
| 70 | // returns color number of pixel <x>,<y>, or -1 | 72 | * returns 0 on success, -1 on error |
| 71 | OSD_SetRow, // (x0,y0,x1,data) | 73 | */ |
| 72 | // fills pixels x0,y through x1,y with the content of data[] | 74 | OSD_SetPalette, /* (firstcolor{color},lastcolor{x0},data) */ |
| 73 | // returns 0 on success, -1 on clipping all pixel (no pixel drawn) | 75 | /* |
| 74 | OSD_SetBlock, // (x0,y0,x1,y1,increment{color},data) | 76 | * Set a number of entries in the palette |
| 75 | // fills pixels x0,y0 through x1,y1 with the content of data[] | 77 | * sets the entries "firstcolor" through "lastcolor" from the array "data" |
| 76 | // inc contains the width of one line in the data block, | 78 | * data has 4 byte for each color: |
| 77 | // inc<=0 uses blockwidth as linewidth | 79 | * R,G,B, and a opacity value: 0->transparent, 1..254->mix, 255->pixel |
| 78 | // returns 0 on success, -1 on clipping all pixel | 80 | */ |
| 79 | OSD_FillRow, // (x0,y0,x1,color) | 81 | OSD_SetTrans, /* (transparency{color}) */ |
| 80 | // fills pixels x0,y through x1,y with the color <col> | 82 | /* |
| 81 | // returns 0 on success, -1 on clipping all pixel | 83 | * Sets transparency of mixed pixel (0..15) |
| 82 | OSD_FillBlock, // (x0,y0,x1,y1,color) | 84 | * returns 0 on success |
| 83 | // fills pixels x0,y0 through x1,y1 with the color <col> | 85 | */ |
| 84 | // returns 0 on success, -1 on clipping all pixel | 86 | OSD_SetPixel, /* (x0,y0,color) */ |
| 85 | OSD_Line, // (x0,y0,x1,y1,color) | 87 | /* |
| 86 | // draw a line from x0,y0 to x1,y1 with the color <col> | 88 | * sets pixel <x>,<y> to color number <col> |
| 87 | // returns 0 on success | 89 | * returns 0 on success, -1 on error |
| 88 | OSD_Query, // (x0,y0,x1,y1,xasp{color}}), yasp=11 | 90 | */ |
| 89 | // fills parameters with the picture dimensions and the pixel aspect ratio | 91 | OSD_GetPixel, /* (x0,y0) */ |
| 90 | // returns 0 on success | 92 | /* returns color number of pixel <x>,<y>, or -1 */ |
| 91 | OSD_Test, // () | 93 | OSD_SetRow, /* (x0,y0,x1,data) */ |
| 92 | // draws a test picture. for debugging purposes only | 94 | /* |
| 93 | // returns 0 on success | 95 | * fills pixels x0,y through x1,y with the content of data[] |
| 94 | // TODO: remove "test" in final version | 96 | * returns 0 on success, -1 on clipping all pixel (no pixel drawn) |
| 95 | OSD_Text, // (x0,y0,size,color,text) | 97 | */ |
| 96 | OSD_SetWindow, // (x0) set window with number 0<x0<8 as current | 98 | OSD_SetBlock, /* (x0,y0,x1,y1,increment{color},data) */ |
| 97 | OSD_MoveWindow, // move current window to (x0, y0) | 99 | /* |
| 98 | OSD_OpenRaw, // Open other types of OSD windows | 100 | * fills pixels x0,y0 through x1,y1 with the content of data[] |
| 101 | * inc contains the width of one line in the data block, | ||
| 102 | * inc<=0 uses blockwidth as linewidth | ||
| 103 | * returns 0 on success, -1 on clipping all pixel | ||
| 104 | */ | ||
| 105 | OSD_FillRow, /* (x0,y0,x1,color) */ | ||
| 106 | /* | ||
| 107 | * fills pixels x0,y through x1,y with the color <col> | ||
| 108 | * returns 0 on success, -1 on clipping all pixel | ||
| 109 | */ | ||
| 110 | OSD_FillBlock, /* (x0,y0,x1,y1,color) */ | ||
| 111 | /* | ||
| 112 | * fills pixels x0,y0 through x1,y1 with the color <col> | ||
| 113 | * returns 0 on success, -1 on clipping all pixel | ||
| 114 | */ | ||
| 115 | OSD_Line, /* (x0,y0,x1,y1,color) */ | ||
| 116 | /* | ||
| 117 | * draw a line from x0,y0 to x1,y1 with the color <col> | ||
| 118 | * returns 0 on success | ||
| 119 | */ | ||
| 120 | OSD_Query, /* (x0,y0,x1,y1,xasp{color}}), yasp=11 */ | ||
| 121 | /* | ||
| 122 | * fills parameters with the picture dimensions and the pixel aspect ratio | ||
| 123 | * returns 0 on success | ||
| 124 | */ | ||
| 125 | OSD_Test, /* () */ | ||
| 126 | /* | ||
| 127 | * draws a test picture. for debugging purposes only | ||
| 128 | * returns 0 on success | ||
| 129 | * TODO: remove "test" in final version | ||
| 130 | */ | ||
| 131 | OSD_Text, /* (x0,y0,size,color,text) */ | ||
| 132 | OSD_SetWindow, /* (x0) set window with number 0<x0<8 as current */ | ||
| 133 | OSD_MoveWindow, /* move current window to (x0, y0) */ | ||
| 134 | OSD_OpenRaw, /* Open other types of OSD windows */ | ||
| 99 | } OSD_Command; | 135 | } OSD_Command; |
| 100 | 136 | ||
| 101 | typedef struct osd_cmd_s { | 137 | typedef struct osd_cmd_s { |
diff --git a/include/uapi/linux/dvb/video.h b/include/uapi/linux/dvb/video.h index 43ba8b0a3d14..179f1ec60af6 100644 --- a/include/uapi/linux/dvb/video.h +++ b/include/uapi/linux/dvb/video.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ | 1 | /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ |
| 2 | /* | 2 | /* |
| 3 | * video.h | 3 | * video.h - DEPRECATED MPEG-TS video decoder API |
| 4 | * | ||
| 5 | * NOTE: should not be used on future drivers | ||
| 4 | * | 6 | * |
| 5 | * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> | 7 | * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> |
| 6 | * & Ralph Metzler <ralph@convergence.de> | 8 | * & Ralph Metzler <ralph@convergence.de> |
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index 3534ce157ae9..dd06302aa93e 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h | |||
| @@ -1483,6 +1483,8 @@ enum ethtool_link_mode_bit_indices { | |||
| 1483 | ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64, | 1483 | ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64, |
| 1484 | ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65, | 1484 | ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65, |
| 1485 | ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66, | 1485 | ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66, |
| 1486 | ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 67, | ||
| 1487 | ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 68, | ||
| 1486 | 1488 | ||
| 1487 | /* must be last entry */ | 1489 | /* must be last entry */ |
| 1488 | __ETHTOOL_LINK_MODE_MASK_NBITS | 1490 | __ETHTOOL_LINK_MODE_MASK_NBITS |
diff --git a/include/uapi/linux/flat.h b/include/uapi/linux/flat.h deleted file mode 100644 index 27e595e44fb7..000000000000 --- a/include/uapi/linux/flat.h +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com> | ||
| 4 | * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com> | ||
| 5 | * The Silver Hammer Group, Ltd. | ||
| 6 | * | ||
| 7 | * This file provides the definitions and structures needed to | ||
| 8 | * support uClinux flat-format executables. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef _UAPI_LINUX_FLAT_H | ||
| 12 | #define _UAPI_LINUX_FLAT_H | ||
| 13 | |||
| 14 | |||
| 15 | #define FLAT_VERSION 0x00000004L | ||
| 16 | |||
| 17 | #ifdef CONFIG_BINFMT_SHARED_FLAT | ||
| 18 | #define MAX_SHARED_LIBS (4) | ||
| 19 | #else | ||
| 20 | #define MAX_SHARED_LIBS (1) | ||
| 21 | #endif | ||
| 22 | |||
| 23 | /* | ||
| 24 | * To make everything easier to port and manage cross platform | ||
| 25 | * development, all fields are in network byte order. | ||
| 26 | */ | ||
| 27 | |||
| 28 | struct flat_hdr { | ||
| 29 | char magic[4]; | ||
| 30 | unsigned long rev; /* version (as above) */ | ||
| 31 | unsigned long entry; /* Offset of first executable instruction | ||
| 32 | with text segment from beginning of file */ | ||
| 33 | unsigned long data_start; /* Offset of data segment from beginning of | ||
| 34 | file */ | ||
| 35 | unsigned long data_end; /* Offset of end of data segment | ||
| 36 | from beginning of file */ | ||
| 37 | unsigned long bss_end; /* Offset of end of bss segment from beginning | ||
| 38 | of file */ | ||
| 39 | |||
| 40 | /* (It is assumed that data_end through bss_end forms the bss segment.) */ | ||
| 41 | |||
| 42 | unsigned long stack_size; /* Size of stack, in bytes */ | ||
| 43 | unsigned long reloc_start; /* Offset of relocation records from | ||
| 44 | beginning of file */ | ||
| 45 | unsigned long reloc_count; /* Number of relocation records */ | ||
| 46 | unsigned long flags; | ||
| 47 | unsigned long build_date; /* When the program/library was built */ | ||
| 48 | unsigned long filler[5]; /* Reservered, set to zero */ | ||
| 49 | }; | ||
| 50 | |||
| 51 | #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ | ||
| 52 | #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ | ||
| 53 | #define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ | ||
| 54 | #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ | ||
| 55 | #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ | ||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | #endif /* _UAPI_LINUX_FLAT_H */ | ||
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index 3158ba672b72..f6ceb2e63d1e 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h | |||
| @@ -91,6 +91,7 @@ | |||
| 91 | #define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */ | 91 | #define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */ |
| 92 | #define ETH_P_PREAUTH 0x88C7 /* 802.11 Preauthentication */ | 92 | #define ETH_P_PREAUTH 0x88C7 /* 802.11 Preauthentication */ |
| 93 | #define ETH_P_TIPC 0x88CA /* TIPC */ | 93 | #define ETH_P_TIPC 0x88CA /* TIPC */ |
| 94 | #define ETH_P_LLDP 0x88CC /* Link Layer Discovery Protocol */ | ||
| 94 | #define ETH_P_MACSEC 0x88E5 /* 802.1ae MACsec */ | 95 | #define ETH_P_MACSEC 0x88E5 /* 802.1ae MACsec */ |
| 95 | #define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ | 96 | #define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ |
| 96 | #define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ | 97 | #define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ |
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 5b225ff63b48..4a8c02cafa9a 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h | |||
| @@ -636,6 +636,7 @@ enum { | |||
| 636 | IFLA_BOND_AD_USER_PORT_KEY, | 636 | IFLA_BOND_AD_USER_PORT_KEY, |
| 637 | IFLA_BOND_AD_ACTOR_SYSTEM, | 637 | IFLA_BOND_AD_ACTOR_SYSTEM, |
| 638 | IFLA_BOND_TLB_DYNAMIC_LB, | 638 | IFLA_BOND_TLB_DYNAMIC_LB, |
| 639 | IFLA_BOND_PEER_NOTIF_DELAY, | ||
| 639 | __IFLA_BOND_MAX, | 640 | __IFLA_BOND_MAX, |
| 640 | }; | 641 | }; |
| 641 | 642 | ||
| @@ -694,6 +695,7 @@ enum { | |||
| 694 | IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */ | 695 | IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */ |
| 695 | IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */ | 696 | IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */ |
| 696 | IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */ | 697 | IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */ |
| 698 | IFLA_VF_BROADCAST, /* VF broadcast */ | ||
| 697 | __IFLA_VF_MAX, | 699 | __IFLA_VF_MAX, |
| 698 | }; | 700 | }; |
| 699 | 701 | ||
| @@ -704,6 +706,10 @@ struct ifla_vf_mac { | |||
| 704 | __u8 mac[32]; /* MAX_ADDR_LEN */ | 706 | __u8 mac[32]; /* MAX_ADDR_LEN */ |
| 705 | }; | 707 | }; |
| 706 | 708 | ||
| 709 | struct ifla_vf_broadcast { | ||
| 710 | __u8 broadcast[32]; | ||
| 711 | }; | ||
| 712 | |||
| 707 | struct ifla_vf_vlan { | 713 | struct ifla_vf_vlan { |
| 708 | __u32 vf; | 714 | __u32 vf; |
| 709 | __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ | 715 | __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ |
diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h index 467b654bd4c7..3d884d68eb30 100644 --- a/include/uapi/linux/if_packet.h +++ b/include/uapi/linux/if_packet.h | |||
| @@ -123,7 +123,7 @@ struct tpacket_auxdata { | |||
| 123 | /* Rx and Tx ring - header status */ | 123 | /* Rx and Tx ring - header status */ |
| 124 | #define TP_STATUS_TS_SOFTWARE (1 << 29) | 124 | #define TP_STATUS_TS_SOFTWARE (1 << 29) |
| 125 | #define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */ | 125 | #define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */ |
| 126 | #define TP_STATUS_TS_RAW_HARDWARE (1 << 31) | 126 | #define TP_STATUS_TS_RAW_HARDWARE (1U << 31) |
| 127 | 127 | ||
| 128 | /* Rx ring - feature request bits */ | 128 | /* Rx ring - feature request bits */ |
| 129 | #define TP_FT_REQ_FILL_RXHASH 0x1 | 129 | #define TP_FT_REQ_FILL_RXHASH 0x1 |
diff --git a/include/uapi/linux/if_xdp.h b/include/uapi/linux/if_xdp.h index caed8b1614ff..faaa5ca2a117 100644 --- a/include/uapi/linux/if_xdp.h +++ b/include/uapi/linux/if_xdp.h | |||
| @@ -46,6 +46,7 @@ struct xdp_mmap_offsets { | |||
| 46 | #define XDP_UMEM_FILL_RING 5 | 46 | #define XDP_UMEM_FILL_RING 5 |
| 47 | #define XDP_UMEM_COMPLETION_RING 6 | 47 | #define XDP_UMEM_COMPLETION_RING 6 |
| 48 | #define XDP_STATISTICS 7 | 48 | #define XDP_STATISTICS 7 |
| 49 | #define XDP_OPTIONS 8 | ||
| 49 | 50 | ||
| 50 | struct xdp_umem_reg { | 51 | struct xdp_umem_reg { |
| 51 | __u64 addr; /* Start of packet data area */ | 52 | __u64 addr; /* Start of packet data area */ |
| @@ -60,6 +61,13 @@ struct xdp_statistics { | |||
| 60 | __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */ | 61 | __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */ |
| 61 | }; | 62 | }; |
| 62 | 63 | ||
| 64 | struct xdp_options { | ||
| 65 | __u32 flags; | ||
| 66 | }; | ||
| 67 | |||
| 68 | /* Flags for the flags field of struct xdp_options */ | ||
| 69 | #define XDP_OPTIONS_ZEROCOPY (1 << 0) | ||
| 70 | |||
| 63 | /* Pgoff for mmaping the rings */ | 71 | /* Pgoff for mmaping the rings */ |
| 64 | #define XDP_PGOFF_RX_RING 0 | 72 | #define XDP_PGOFF_RX_RING 0 |
| 65 | #define XDP_PGOFF_TX_RING 0x80000000 | 73 | #define XDP_PGOFF_TX_RING 0x80000000 |
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index a0c460025036..1e1652f25cc1 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h | |||
| @@ -27,6 +27,7 @@ struct io_uring_sqe { | |||
| 27 | __u32 fsync_flags; | 27 | __u32 fsync_flags; |
| 28 | __u16 poll_events; | 28 | __u16 poll_events; |
| 29 | __u32 sync_range_flags; | 29 | __u32 sync_range_flags; |
| 30 | __u32 msg_flags; | ||
| 30 | }; | 31 | }; |
| 31 | __u64 user_data; /* data to be passed back at completion time */ | 32 | __u64 user_data; /* data to be passed back at completion time */ |
| 32 | union { | 33 | union { |
| @@ -40,6 +41,7 @@ struct io_uring_sqe { | |||
| 40 | */ | 41 | */ |
| 41 | #define IOSQE_FIXED_FILE (1U << 0) /* use fixed fileset */ | 42 | #define IOSQE_FIXED_FILE (1U << 0) /* use fixed fileset */ |
| 42 | #define IOSQE_IO_DRAIN (1U << 1) /* issue after inflight IO */ | 43 | #define IOSQE_IO_DRAIN (1U << 1) /* issue after inflight IO */ |
| 44 | #define IOSQE_IO_LINK (1U << 2) /* links next sqe */ | ||
| 43 | 45 | ||
| 44 | /* | 46 | /* |
| 45 | * io_uring_setup() flags | 47 | * io_uring_setup() flags |
| @@ -57,6 +59,8 @@ struct io_uring_sqe { | |||
| 57 | #define IORING_OP_POLL_ADD 6 | 59 | #define IORING_OP_POLL_ADD 6 |
| 58 | #define IORING_OP_POLL_REMOVE 7 | 60 | #define IORING_OP_POLL_REMOVE 7 |
| 59 | #define IORING_OP_SYNC_FILE_RANGE 8 | 61 | #define IORING_OP_SYNC_FILE_RANGE 8 |
| 62 | #define IORING_OP_SENDMSG 9 | ||
| 63 | #define IORING_OP_RECVMSG 10 | ||
| 60 | 64 | ||
| 61 | /* | 65 | /* |
| 62 | * sqe->fsync_flags | 66 | * sqe->fsync_flags |
diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h new file mode 100644 index 000000000000..fc00c5d4741b --- /dev/null +++ b/include/uapi/linux/iommu.h | |||
| @@ -0,0 +1,155 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* | ||
| 3 | * IOMMU user API definitions | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef _UAPI_IOMMU_H | ||
| 7 | #define _UAPI_IOMMU_H | ||
| 8 | |||
| 9 | #include <linux/types.h> | ||
| 10 | |||
| 11 | #define IOMMU_FAULT_PERM_READ (1 << 0) /* read */ | ||
| 12 | #define IOMMU_FAULT_PERM_WRITE (1 << 1) /* write */ | ||
| 13 | #define IOMMU_FAULT_PERM_EXEC (1 << 2) /* exec */ | ||
| 14 | #define IOMMU_FAULT_PERM_PRIV (1 << 3) /* privileged */ | ||
| 15 | |||
| 16 | /* Generic fault types, can be expanded IRQ remapping fault */ | ||
| 17 | enum iommu_fault_type { | ||
| 18 | IOMMU_FAULT_DMA_UNRECOV = 1, /* unrecoverable fault */ | ||
| 19 | IOMMU_FAULT_PAGE_REQ, /* page request fault */ | ||
| 20 | }; | ||
| 21 | |||
| 22 | enum iommu_fault_reason { | ||
| 23 | IOMMU_FAULT_REASON_UNKNOWN = 0, | ||
| 24 | |||
| 25 | /* Could not access the PASID table (fetch caused external abort) */ | ||
| 26 | IOMMU_FAULT_REASON_PASID_FETCH, | ||
| 27 | |||
| 28 | /* PASID entry is invalid or has configuration errors */ | ||
| 29 | IOMMU_FAULT_REASON_BAD_PASID_ENTRY, | ||
| 30 | |||
| 31 | /* | ||
| 32 | * PASID is out of range (e.g. exceeds the maximum PASID | ||
| 33 | * supported by the IOMMU) or disabled. | ||
| 34 | */ | ||
| 35 | IOMMU_FAULT_REASON_PASID_INVALID, | ||
| 36 | |||
| 37 | /* | ||
| 38 | * An external abort occurred fetching (or updating) a translation | ||
| 39 | * table descriptor | ||
| 40 | */ | ||
| 41 | IOMMU_FAULT_REASON_WALK_EABT, | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Could not access the page table entry (Bad address), | ||
| 45 | * actual translation fault | ||
| 46 | */ | ||
| 47 | IOMMU_FAULT_REASON_PTE_FETCH, | ||
| 48 | |||
| 49 | /* Protection flag check failed */ | ||
| 50 | IOMMU_FAULT_REASON_PERMISSION, | ||
| 51 | |||
| 52 | /* access flag check failed */ | ||
| 53 | IOMMU_FAULT_REASON_ACCESS, | ||
| 54 | |||
| 55 | /* Output address of a translation stage caused Address Size fault */ | ||
| 56 | IOMMU_FAULT_REASON_OOR_ADDRESS, | ||
| 57 | }; | ||
| 58 | |||
| 59 | /** | ||
| 60 | * struct iommu_fault_unrecoverable - Unrecoverable fault data | ||
| 61 | * @reason: reason of the fault, from &enum iommu_fault_reason | ||
| 62 | * @flags: parameters of this fault (IOMMU_FAULT_UNRECOV_* values) | ||
| 63 | * @pasid: Process Address Space ID | ||
| 64 | * @perm: requested permission access using by the incoming transaction | ||
| 65 | * (IOMMU_FAULT_PERM_* values) | ||
| 66 | * @addr: offending page address | ||
| 67 | * @fetch_addr: address that caused a fetch abort, if any | ||
| 68 | */ | ||
| 69 | struct iommu_fault_unrecoverable { | ||
| 70 | __u32 reason; | ||
| 71 | #define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0) | ||
| 72 | #define IOMMU_FAULT_UNRECOV_ADDR_VALID (1 << 1) | ||
| 73 | #define IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID (1 << 2) | ||
| 74 | __u32 flags; | ||
| 75 | __u32 pasid; | ||
| 76 | __u32 perm; | ||
| 77 | __u64 addr; | ||
| 78 | __u64 fetch_addr; | ||
| 79 | }; | ||
| 80 | |||
| 81 | /** | ||
| 82 | * struct iommu_fault_page_request - Page Request data | ||
| 83 | * @flags: encodes whether the corresponding fields are valid and whether this | ||
| 84 | * is the last page in group (IOMMU_FAULT_PAGE_REQUEST_* values) | ||
| 85 | * @pasid: Process Address Space ID | ||
| 86 | * @grpid: Page Request Group Index | ||
| 87 | * @perm: requested page permissions (IOMMU_FAULT_PERM_* values) | ||
| 88 | * @addr: page address | ||
| 89 | * @private_data: device-specific private information | ||
| 90 | */ | ||
| 91 | struct iommu_fault_page_request { | ||
| 92 | #define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0) | ||
| 93 | #define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1) | ||
| 94 | #define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2) | ||
| 95 | __u32 flags; | ||
| 96 | __u32 pasid; | ||
| 97 | __u32 grpid; | ||
| 98 | __u32 perm; | ||
| 99 | __u64 addr; | ||
| 100 | __u64 private_data[2]; | ||
| 101 | }; | ||
| 102 | |||
| 103 | /** | ||
| 104 | * struct iommu_fault - Generic fault data | ||
| 105 | * @type: fault type from &enum iommu_fault_type | ||
| 106 | * @padding: reserved for future use (should be zero) | ||
| 107 | * @event: fault event, when @type is %IOMMU_FAULT_DMA_UNRECOV | ||
| 108 | * @prm: Page Request message, when @type is %IOMMU_FAULT_PAGE_REQ | ||
| 109 | * @padding2: sets the fault size to allow for future extensions | ||
| 110 | */ | ||
| 111 | struct iommu_fault { | ||
| 112 | __u32 type; | ||
| 113 | __u32 padding; | ||
| 114 | union { | ||
| 115 | struct iommu_fault_unrecoverable event; | ||
| 116 | struct iommu_fault_page_request prm; | ||
| 117 | __u8 padding2[56]; | ||
| 118 | }; | ||
| 119 | }; | ||
| 120 | |||
| 121 | /** | ||
| 122 | * enum iommu_page_response_code - Return status of fault handlers | ||
| 123 | * @IOMMU_PAGE_RESP_SUCCESS: Fault has been handled and the page tables | ||
| 124 | * populated, retry the access. This is "Success" in PCI PRI. | ||
| 125 | * @IOMMU_PAGE_RESP_FAILURE: General error. Drop all subsequent faults from | ||
| 126 | * this device if possible. This is "Response Failure" in PCI PRI. | ||
| 127 | * @IOMMU_PAGE_RESP_INVALID: Could not handle this fault, don't retry the | ||
| 128 | * access. This is "Invalid Request" in PCI PRI. | ||
| 129 | */ | ||
| 130 | enum iommu_page_response_code { | ||
| 131 | IOMMU_PAGE_RESP_SUCCESS = 0, | ||
| 132 | IOMMU_PAGE_RESP_INVALID, | ||
| 133 | IOMMU_PAGE_RESP_FAILURE, | ||
| 134 | }; | ||
| 135 | |||
| 136 | /** | ||
| 137 | * struct iommu_page_response - Generic page response information | ||
| 138 | * @version: API version of this structure | ||
| 139 | * @flags: encodes whether the corresponding fields are valid | ||
| 140 | * (IOMMU_FAULT_PAGE_RESPONSE_* values) | ||
| 141 | * @pasid: Process Address Space ID | ||
| 142 | * @grpid: Page Request Group Index | ||
| 143 | * @code: response code from &enum iommu_page_response_code | ||
| 144 | */ | ||
| 145 | struct iommu_page_response { | ||
| 146 | #define IOMMU_PAGE_RESP_VERSION_1 1 | ||
| 147 | __u32 version; | ||
| 148 | #define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) | ||
| 149 | __u32 flags; | ||
| 150 | __u32 pasid; | ||
| 151 | __u32 grpid; | ||
| 152 | __u32 code; | ||
| 153 | }; | ||
| 154 | |||
| 155 | #endif /* _UAPI_IOMMU_H */ | ||
diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h index e34f436fc79d..4102ddcb4e14 100644 --- a/include/uapi/linux/ip_vs.h +++ b/include/uapi/linux/ip_vs.h | |||
| @@ -128,9 +128,15 @@ | |||
| 128 | enum { | 128 | enum { |
| 129 | IP_VS_CONN_F_TUNNEL_TYPE_IPIP = 0, /* IPIP */ | 129 | IP_VS_CONN_F_TUNNEL_TYPE_IPIP = 0, /* IPIP */ |
| 130 | IP_VS_CONN_F_TUNNEL_TYPE_GUE, /* GUE */ | 130 | IP_VS_CONN_F_TUNNEL_TYPE_GUE, /* GUE */ |
| 131 | IP_VS_CONN_F_TUNNEL_TYPE_GRE, /* GRE */ | ||
| 131 | IP_VS_CONN_F_TUNNEL_TYPE_MAX, | 132 | IP_VS_CONN_F_TUNNEL_TYPE_MAX, |
| 132 | }; | 133 | }; |
| 133 | 134 | ||
| 135 | /* Tunnel encapsulation flags */ | ||
| 136 | #define IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM (0) | ||
| 137 | #define IP_VS_TUNNEL_ENCAP_FLAG_CSUM (1 << 0) | ||
| 138 | #define IP_VS_TUNNEL_ENCAP_FLAG_REMCSUM (1 << 1) | ||
| 139 | |||
| 134 | /* | 140 | /* |
| 135 | * The struct ip_vs_service_user and struct ip_vs_dest_user are | 141 | * The struct ip_vs_service_user and struct ip_vs_dest_user are |
| 136 | * used to set IPVS rules through setsockopt. | 142 | * used to set IPVS rules through setsockopt. |
| @@ -403,6 +409,8 @@ enum { | |||
| 403 | 409 | ||
| 404 | IPVS_DEST_ATTR_TUN_PORT, /* tunnel port */ | 410 | IPVS_DEST_ATTR_TUN_PORT, /* tunnel port */ |
| 405 | 411 | ||
| 412 | IPVS_DEST_ATTR_TUN_FLAGS, /* tunnel flags */ | ||
| 413 | |||
| 406 | __IPVS_DEST_ATTR_MAX, | 414 | __IPVS_DEST_ATTR_MAX, |
| 407 | }; | 415 | }; |
| 408 | 416 | ||
diff --git a/include/uapi/linux/isdn.h b/include/uapi/linux/isdn.h deleted file mode 100644 index f371fd52ed75..000000000000 --- a/include/uapi/linux/isdn.h +++ /dev/null | |||
| @@ -1,144 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $ | ||
| 3 | * | ||
| 4 | * Main header for the Linux ISDN subsystem (linklevel). | ||
| 5 | * | ||
| 6 | * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) | ||
| 7 | * Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg | ||
| 8 | * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) | ||
| 9 | * | ||
| 10 | * This software may be used and distributed according to the terms | ||
| 11 | * of the GNU General Public License, incorporated herein by reference. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef _UAPI__ISDN_H__ | ||
| 16 | #define _UAPI__ISDN_H__ | ||
| 17 | |||
| 18 | #include <linux/ioctl.h> | ||
| 19 | #include <linux/tty.h> | ||
| 20 | |||
| 21 | #define ISDN_MAX_DRIVERS 32 | ||
| 22 | #define ISDN_MAX_CHANNELS 64 | ||
| 23 | |||
| 24 | /* New ioctl-codes */ | ||
| 25 | #define IIOCNETAIF _IO('I',1) | ||
| 26 | #define IIOCNETDIF _IO('I',2) | ||
| 27 | #define IIOCNETSCF _IO('I',3) | ||
| 28 | #define IIOCNETGCF _IO('I',4) | ||
| 29 | #define IIOCNETANM _IO('I',5) | ||
| 30 | #define IIOCNETDNM _IO('I',6) | ||
| 31 | #define IIOCNETGNM _IO('I',7) | ||
| 32 | #define IIOCGETSET _IO('I',8) /* no longer supported */ | ||
| 33 | #define IIOCSETSET _IO('I',9) /* no longer supported */ | ||
| 34 | #define IIOCSETVER _IO('I',10) | ||
| 35 | #define IIOCNETHUP _IO('I',11) | ||
| 36 | #define IIOCSETGST _IO('I',12) | ||
| 37 | #define IIOCSETBRJ _IO('I',13) | ||
| 38 | #define IIOCSIGPRF _IO('I',14) | ||
| 39 | #define IIOCGETPRF _IO('I',15) | ||
| 40 | #define IIOCSETPRF _IO('I',16) | ||
| 41 | #define IIOCGETMAP _IO('I',17) | ||
| 42 | #define IIOCSETMAP _IO('I',18) | ||
| 43 | #define IIOCNETASL _IO('I',19) | ||
| 44 | #define IIOCNETDIL _IO('I',20) | ||
| 45 | #define IIOCGETCPS _IO('I',21) | ||
| 46 | #define IIOCGETDVR _IO('I',22) | ||
| 47 | #define IIOCNETLCR _IO('I',23) /* dwabc ioctl for LCR from isdnlog */ | ||
| 48 | #define IIOCNETDWRSET _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */ | ||
| 49 | |||
| 50 | #define IIOCNETALN _IO('I',32) | ||
| 51 | #define IIOCNETDLN _IO('I',33) | ||
| 52 | |||
| 53 | #define IIOCNETGPN _IO('I',34) | ||
| 54 | |||
| 55 | #define IIOCDBGVAR _IO('I',127) | ||
| 56 | |||
| 57 | #define IIOCDRVCTL _IO('I',128) | ||
| 58 | |||
| 59 | /* cisco hdlck device private ioctls */ | ||
| 60 | #define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0) | ||
| 61 | #define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1) | ||
| 62 | #define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2) | ||
| 63 | #define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3) | ||
| 64 | |||
| 65 | /* Packet encapsulations for net-interfaces */ | ||
| 66 | #define ISDN_NET_ENCAP_ETHER 0 | ||
| 67 | #define ISDN_NET_ENCAP_RAWIP 1 | ||
| 68 | #define ISDN_NET_ENCAP_IPTYP 2 | ||
| 69 | #define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */ | ||
| 70 | #define ISDN_NET_ENCAP_SYNCPPP 4 | ||
| 71 | #define ISDN_NET_ENCAP_UIHDLC 5 | ||
| 72 | #define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */ | ||
| 73 | #define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt */ | ||
| 74 | #define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE | ||
| 75 | |||
| 76 | /* Facility which currently uses an ISDN-channel */ | ||
| 77 | #define ISDN_USAGE_NONE 0 | ||
| 78 | #define ISDN_USAGE_RAW 1 | ||
| 79 | #define ISDN_USAGE_MODEM 2 | ||
| 80 | #define ISDN_USAGE_NET 3 | ||
| 81 | #define ISDN_USAGE_VOICE 4 | ||
| 82 | #define ISDN_USAGE_FAX 5 | ||
| 83 | #define ISDN_USAGE_MASK 7 /* Mask to get plain usage */ | ||
| 84 | #define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */ | ||
| 85 | #define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */ | ||
| 86 | #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */ | ||
| 87 | |||
| 88 | #define ISDN_MODEM_NUMREG 24 /* Number of Modem-Registers */ | ||
| 89 | #define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */ | ||
| 90 | #define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */ | ||
| 91 | |||
| 92 | #define ISDN_MSNLEN 32 | ||
| 93 | #define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */ | ||
| 94 | #define TTY_DV 0x06 /* Data version for iprofd etc. */ | ||
| 95 | |||
| 96 | #define INF_DV 0x01 /* Data version for /dev/isdninfo */ | ||
| 97 | |||
| 98 | typedef struct { | ||
| 99 | char drvid[25]; | ||
| 100 | unsigned long arg; | ||
| 101 | } isdn_ioctl_struct; | ||
| 102 | |||
| 103 | typedef struct { | ||
| 104 | char name[10]; | ||
| 105 | char phone[ISDN_MSNLEN]; | ||
| 106 | int outgoing; | ||
| 107 | } isdn_net_ioctl_phone; | ||
| 108 | |||
| 109 | typedef struct { | ||
| 110 | char name[10]; /* Name of interface */ | ||
| 111 | char master[10]; /* Name of Master for Bundling */ | ||
| 112 | char slave[10]; /* Name of Slave for Bundling */ | ||
| 113 | char eaz[256]; /* EAZ/MSN */ | ||
| 114 | char drvid[25]; /* DriverId for Bindings */ | ||
| 115 | int onhtime; /* Hangup-Timeout */ | ||
| 116 | int charge; /* Charge-Units */ | ||
| 117 | int l2_proto; /* Layer-2 protocol */ | ||
| 118 | int l3_proto; /* Layer-3 protocol */ | ||
| 119 | int p_encap; /* Encapsulation */ | ||
| 120 | int exclusive; /* Channel, if bound exclusive */ | ||
| 121 | int dialmax; /* Dial Retry-Counter */ | ||
| 122 | int slavedelay; /* Delay until slave starts up */ | ||
| 123 | int cbdelay; /* Delay before Callback */ | ||
| 124 | int chargehup; /* Flag: Charge-Hangup */ | ||
| 125 | int ihup; /* Flag: Hangup-Timeout on incoming line */ | ||
| 126 | int secure; /* Flag: Secure */ | ||
| 127 | int callback; /* Flag: Callback */ | ||
| 128 | int cbhup; /* Flag: Reject Call before Callback */ | ||
| 129 | int pppbind; /* ippp device for bindings */ | ||
| 130 | int chargeint; /* Use fixed charge interval length */ | ||
| 131 | int triggercps; /* BogoCPS needed for triggering slave */ | ||
| 132 | int dialtimeout; /* Dial-Timeout */ | ||
| 133 | int dialwait; /* Time to wait after failed dial */ | ||
| 134 | int dialmode; /* Flag: off / on / auto */ | ||
| 135 | } isdn_net_ioctl_cfg; | ||
| 136 | |||
| 137 | #define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */ | ||
| 138 | #define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */ | ||
| 139 | #define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */ | ||
| 140 | #define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */ | ||
| 141 | #define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK) | ||
| 142 | |||
| 143 | |||
| 144 | #endif /* _UAPI__ISDN_H__ */ | ||
diff --git a/include/uapi/linux/isdn_divertif.h b/include/uapi/linux/isdn_divertif.h deleted file mode 100644 index 0a17bb1bcb1b..000000000000 --- a/include/uapi/linux/isdn_divertif.h +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ | ||
| 3 | * | ||
| 4 | * Header for the diversion supplementary interface for i4l. | ||
| 5 | * | ||
| 6 | * Author Werner Cornelius (werner@titro.de) | ||
| 7 | * Copyright by Werner Cornelius (werner@titro.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 | |||
| 14 | #ifndef _UAPI_LINUX_ISDN_DIVERTIF_H | ||
| 15 | #define _UAPI_LINUX_ISDN_DIVERTIF_H | ||
| 16 | |||
| 17 | /***********************************************************/ | ||
| 18 | /* magic value is also used to control version information */ | ||
| 19 | /***********************************************************/ | ||
| 20 | #define DIVERT_IF_MAGIC 0x25873401 | ||
| 21 | #define DIVERT_CMD_REG 0x00 /* register command */ | ||
| 22 | #define DIVERT_CMD_REL 0x01 /* release command */ | ||
| 23 | #define DIVERT_NO_ERR 0x00 /* return value no error */ | ||
| 24 | #define DIVERT_CMD_ERR 0x01 /* invalid cmd */ | ||
| 25 | #define DIVERT_VER_ERR 0x02 /* magic/version invalid */ | ||
| 26 | #define DIVERT_REG_ERR 0x03 /* module already registered */ | ||
| 27 | #define DIVERT_REL_ERR 0x04 /* module not registered */ | ||
| 28 | #define DIVERT_REG_NAME isdn_register_divert | ||
| 29 | |||
| 30 | |||
| 31 | #endif /* _UAPI_LINUX_ISDN_DIVERTIF_H */ | ||
diff --git a/include/uapi/linux/isdn_ppp.h b/include/uapi/linux/isdn_ppp.h deleted file mode 100644 index 0bdc4efaacb2..000000000000 --- a/include/uapi/linux/isdn_ppp.h +++ /dev/null | |||
| @@ -1,68 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ | ||
| 2 | /* Linux ISDN subsystem, sync PPP, interface to ipppd | ||
| 3 | * | ||
| 4 | * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de) | ||
| 5 | * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg | ||
| 6 | * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) | ||
| 7 | * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name) | ||
| 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 | |||
| 14 | #ifndef _UAPI_LINUX_ISDN_PPP_H | ||
| 15 | #define _UAPI_LINUX_ISDN_PPP_H | ||
| 16 | |||
| 17 | #define CALLTYPE_INCOMING 0x1 | ||
| 18 | #define CALLTYPE_OUTGOING 0x2 | ||
| 19 | #define CALLTYPE_CALLBACK 0x4 | ||
| 20 | |||
| 21 | #define IPPP_VERSION "2.2.0" | ||
| 22 | |||
| 23 | struct pppcallinfo | ||
| 24 | { | ||
| 25 | int calltype; | ||
| 26 | unsigned char local_num[64]; | ||
| 27 | unsigned char remote_num[64]; | ||
| 28 | int charge_units; | ||
| 29 | }; | ||
| 30 | |||
| 31 | #define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo) | ||
| 32 | #define PPPIOCBUNDLE _IOW('t',129,int) | ||
| 33 | #define PPPIOCGMPFLAGS _IOR('t',130,int) | ||
| 34 | #define PPPIOCSMPFLAGS _IOW('t',131,int) | ||
| 35 | #define PPPIOCSMPMTU _IOW('t',132,int) | ||
| 36 | #define PPPIOCSMPMRU _IOW('t',133,int) | ||
| 37 | #define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8]) | ||
| 38 | #define PPPIOCSCOMPRESSOR _IOW('t',135,int) | ||
| 39 | #define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] ) | ||
| 40 | |||
| 41 | |||
| 42 | #define SC_MP_PROT 0x00000200 | ||
| 43 | #define SC_REJ_MP_PROT 0x00000400 | ||
| 44 | #define SC_OUT_SHORT_SEQ 0x00000800 | ||
| 45 | #define SC_IN_SHORT_SEQ 0x00004000 | ||
| 46 | |||
| 47 | #define SC_DECOMP_ON 0x01 | ||
| 48 | #define SC_COMP_ON 0x02 | ||
| 49 | #define SC_DECOMP_DISCARD 0x04 | ||
| 50 | #define SC_COMP_DISCARD 0x08 | ||
| 51 | #define SC_LINK_DECOMP_ON 0x10 | ||
| 52 | #define SC_LINK_COMP_ON 0x20 | ||
| 53 | #define SC_LINK_DECOMP_DISCARD 0x40 | ||
| 54 | #define SC_LINK_COMP_DISCARD 0x80 | ||
| 55 | |||
| 56 | #define ISDN_PPP_COMP_MAX_OPTIONS 16 | ||
| 57 | |||
| 58 | #define IPPP_COMP_FLAG_XMIT 0x1 | ||
| 59 | #define IPPP_COMP_FLAG_LINK 0x2 | ||
| 60 | |||
| 61 | struct isdn_ppp_comp_data { | ||
| 62 | int num; | ||
| 63 | unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS]; | ||
| 64 | int optlen; | ||
| 65 | int flags; | ||
| 66 | }; | ||
| 67 | |||
| 68 | #endif /* _UAPI_LINUX_ISDN_PPP_H */ | ||
diff --git a/include/uapi/linux/isdnif.h b/include/uapi/linux/isdnif.h deleted file mode 100644 index 611a69196738..000000000000 --- a/include/uapi/linux/isdnif.h +++ /dev/null | |||
| @@ -1,57 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ | ||
| 2 | /* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $ | ||
| 3 | * | ||
| 4 | * Linux ISDN subsystem | ||
| 5 | * Definition of the interface between the subsystem and its low-level drivers. | ||
| 6 | * | ||
| 7 | * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) | ||
| 8 | * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg | ||
| 9 | * | ||
| 10 | * This software may be used and distributed according to the terms | ||
| 11 | * of the GNU General Public License, incorporated herein by reference. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef _UAPI__ISDNIF_H__ | ||
| 16 | #define _UAPI__ISDNIF_H__ | ||
| 17 | |||
| 18 | |||
| 19 | /* | ||
| 20 | * Values for general protocol-selection | ||
| 21 | */ | ||
| 22 | #define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */ | ||
| 23 | #define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */ | ||
| 24 | #define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */ | ||
| 25 | #define ISDN_PTYPE_LEASED 3 /* for leased lines */ | ||
| 26 | #define ISDN_PTYPE_NI1 4 /* US NI-1 protocol */ | ||
| 27 | #define ISDN_PTYPE_MAX 7 /* Max. 8 Protocols */ | ||
| 28 | |||
| 29 | /* | ||
| 30 | * Values for Layer-2-protocol-selection | ||
| 31 | */ | ||
| 32 | #define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */ | ||
| 33 | #define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */ | ||
| 34 | #define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */ | ||
| 35 | #define ISDN_PROTO_L2_HDLC 3 /* HDLC */ | ||
| 36 | #define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */ | ||
| 37 | #define ISDN_PROTO_L2_X25DTE 5 /* X25/LAPB DTE mode */ | ||
| 38 | #define ISDN_PROTO_L2_X25DCE 6 /* X25/LAPB DCE mode */ | ||
| 39 | #define ISDN_PROTO_L2_V11096 7 /* V.110 bitrate adaption 9600 Baud */ | ||
| 40 | #define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */ | ||
| 41 | #define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */ | ||
| 42 | #define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */ | ||
| 43 | #define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */ | ||
| 44 | #define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */ | ||
| 45 | #define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */ | ||
| 46 | |||
| 47 | /* | ||
| 48 | * Values for Layer-3-protocol-selection | ||
| 49 | */ | ||
| 50 | #define ISDN_PROTO_L3_TRANS 0 /* Transparent */ | ||
| 51 | #define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */ | ||
| 52 | #define ISDN_PROTO_L3_FCLASS2 2 /* Fax Group 2/3 CLASS 2 */ | ||
| 53 | #define ISDN_PROTO_L3_FCLASS1 3 /* Fax Group 2/3 CLASS 1 */ | ||
| 54 | #define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */ | ||
| 55 | |||
| 56 | |||
| 57 | #endif /* _UAPI__ISDNIF_H__ */ | ||
diff --git a/include/uapi/linux/isst_if.h b/include/uapi/linux/isst_if.h new file mode 100644 index 000000000000..d10b832c58c5 --- /dev/null +++ b/include/uapi/linux/isst_if.h | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Intel Speed Select Interface: OS to hardware Interface | ||
| 4 | * Copyright (c) 2019, Intel Corporation. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef __ISST_IF_H | ||
| 11 | #define __ISST_IF_H | ||
| 12 | |||
| 13 | #include <linux/types.h> | ||
| 14 | |||
| 15 | /** | ||
| 16 | * struct isst_if_platform_info - Define platform information | ||
| 17 | * @api_version: Version of the firmware document, which this driver | ||
| 18 | * can communicate | ||
| 19 | * @driver_version: Driver version, which will help user to send right | ||
| 20 | * commands. Even if the firmware is capable, driver may | ||
| 21 | * not be ready | ||
| 22 | * @max_cmds_per_ioctl: Returns the maximum number of commands driver will | ||
| 23 | * accept in a single ioctl | ||
| 24 | * @mbox_supported: Support of mail box interface | ||
| 25 | * @mmio_supported: Support of mmio interface for core-power feature | ||
| 26 | * | ||
| 27 | * Used to return output of IOCTL ISST_IF_GET_PLATFORM_INFO. This | ||
| 28 | * information can be used by the user space, to get the driver, firmware | ||
| 29 | * support and also number of commands to send in a single IOCTL request. | ||
| 30 | */ | ||
| 31 | struct isst_if_platform_info { | ||
| 32 | __u16 api_version; | ||
| 33 | __u16 driver_version; | ||
| 34 | __u16 max_cmds_per_ioctl; | ||
| 35 | __u8 mbox_supported; | ||
| 36 | __u8 mmio_supported; | ||
| 37 | }; | ||
| 38 | |||
| 39 | /** | ||
| 40 | * struct isst_if_cpu_map - CPU mapping between logical and physical CPU | ||
| 41 | * @logical_cpu: Linux logical CPU number | ||
| 42 | * @physical_cpu: PUNIT CPU number | ||
| 43 | * | ||
| 44 | * Used to convert from Linux logical CPU to PUNIT CPU numbering scheme. | ||
| 45 | * The PUNIT CPU number is different than APIC ID based CPU numbering. | ||
| 46 | */ | ||
| 47 | struct isst_if_cpu_map { | ||
| 48 | __u32 logical_cpu; | ||
| 49 | __u32 physical_cpu; | ||
| 50 | }; | ||
| 51 | |||
| 52 | /** | ||
| 53 | * struct isst_if_cpu_maps - structure for CPU map IOCTL | ||
| 54 | * @cmd_count: Number of CPU mapping command in cpu_map[] | ||
| 55 | * @cpu_map[]: Holds one or more CPU map data structure | ||
| 56 | * | ||
| 57 | * This structure used with ioctl ISST_IF_GET_PHY_ID to send | ||
| 58 | * one or more CPU mapping commands. Here IOCTL return value indicates | ||
| 59 | * number of commands sent or error number if no commands have been sent. | ||
| 60 | */ | ||
| 61 | struct isst_if_cpu_maps { | ||
| 62 | __u32 cmd_count; | ||
| 63 | struct isst_if_cpu_map cpu_map[1]; | ||
| 64 | }; | ||
| 65 | |||
| 66 | /** | ||
| 67 | * struct isst_if_io_reg - Read write PUNIT IO register | ||
| 68 | * @read_write: Value 0: Read, 1: Write | ||
| 69 | * @logical_cpu: Logical CPU number to get target PCI device. | ||
| 70 | * @reg: PUNIT register offset | ||
| 71 | * @value: For write operation value to write and for | ||
| 72 | * for read placeholder read value | ||
| 73 | * | ||
| 74 | * Structure to specify read/write data to PUNIT registers. | ||
| 75 | */ | ||
| 76 | struct isst_if_io_reg { | ||
| 77 | __u32 read_write; /* Read:0, Write:1 */ | ||
| 78 | __u32 logical_cpu; | ||
| 79 | __u32 reg; | ||
| 80 | __u32 value; | ||
| 81 | }; | ||
| 82 | |||
| 83 | /** | ||
| 84 | * struct isst_if_io_regs - structure for IO register commands | ||
| 85 | * @cmd_count: Number of io reg commands in io_reg[] | ||
| 86 | * @io_reg[]: Holds one or more io_reg command structure | ||
| 87 | * | ||
| 88 | * This structure used with ioctl ISST_IF_IO_CMD to send | ||
| 89 | * one or more read/write commands to PUNIT. Here IOCTL return value | ||
| 90 | * indicates number of requests sent or error number if no requests have | ||
| 91 | * been sent. | ||
| 92 | */ | ||
| 93 | struct isst_if_io_regs { | ||
| 94 | __u32 req_count; | ||
| 95 | struct isst_if_io_reg io_reg[1]; | ||
| 96 | }; | ||
| 97 | |||
| 98 | /** | ||
| 99 | * struct isst_if_mbox_cmd - Structure to define mail box command | ||
| 100 | * @logical_cpu: Logical CPU number to get target PCI device | ||
| 101 | * @parameter: Mailbox parameter value | ||
| 102 | * @req_data: Request data for the mailbox | ||
| 103 | * @resp_data: Response data for mailbox command response | ||
| 104 | * @command: Mailbox command value | ||
| 105 | * @sub_command: Mailbox sub command value | ||
| 106 | * @reserved: Unused, set to 0 | ||
| 107 | * | ||
| 108 | * Structure to specify mailbox command to be sent to PUNIT. | ||
| 109 | */ | ||
| 110 | struct isst_if_mbox_cmd { | ||
| 111 | __u32 logical_cpu; | ||
| 112 | __u32 parameter; | ||
| 113 | __u32 req_data; | ||
| 114 | __u32 resp_data; | ||
| 115 | __u16 command; | ||
| 116 | __u16 sub_command; | ||
| 117 | __u32 reserved; | ||
| 118 | }; | ||
| 119 | |||
| 120 | /** | ||
| 121 | * struct isst_if_mbox_cmds - structure for mailbox commands | ||
| 122 | * @cmd_count: Number of mailbox commands in mbox_cmd[] | ||
| 123 | * @mbox_cmd[]: Holds one or more mbox commands | ||
| 124 | * | ||
| 125 | * This structure used with ioctl ISST_IF_MBOX_COMMAND to send | ||
| 126 | * one or more mailbox commands to PUNIT. Here IOCTL return value | ||
| 127 | * indicates number of commands sent or error number if no commands have | ||
| 128 | * been sent. | ||
| 129 | */ | ||
| 130 | struct isst_if_mbox_cmds { | ||
| 131 | __u32 cmd_count; | ||
| 132 | struct isst_if_mbox_cmd mbox_cmd[1]; | ||
| 133 | }; | ||
| 134 | |||
| 135 | /** | ||
| 136 | * struct isst_if_msr_cmd - Structure to define msr command | ||
| 137 | * @read_write: Value 0: Read, 1: Write | ||
| 138 | * @logical_cpu: Logical CPU number | ||
| 139 | * @msr: MSR number | ||
| 140 | * @data: For write operation, data to write, for read | ||
| 141 | * place holder | ||
| 142 | * | ||
| 143 | * Structure to specify MSR command related to PUNIT. | ||
| 144 | */ | ||
| 145 | struct isst_if_msr_cmd { | ||
| 146 | __u32 read_write; /* Read:0, Write:1 */ | ||
| 147 | __u32 logical_cpu; | ||
| 148 | __u64 msr; | ||
| 149 | __u64 data; | ||
| 150 | }; | ||
| 151 | |||
| 152 | /** | ||
| 153 | * struct isst_if_msr_cmds - structure for msr commands | ||
| 154 | * @cmd_count: Number of mailbox commands in msr_cmd[] | ||
| 155 | * @msr_cmd[]: Holds one or more msr commands | ||
| 156 | * | ||
| 157 | * This structure used with ioctl ISST_IF_MSR_COMMAND to send | ||
| 158 | * one or more MSR commands. IOCTL return value indicates number of | ||
| 159 | * commands sent or error number if no commands have been sent. | ||
| 160 | */ | ||
| 161 | struct isst_if_msr_cmds { | ||
| 162 | __u32 cmd_count; | ||
| 163 | struct isst_if_msr_cmd msr_cmd[1]; | ||
| 164 | }; | ||
| 165 | |||
| 166 | #define ISST_IF_MAGIC 0xFE | ||
| 167 | #define ISST_IF_GET_PLATFORM_INFO _IOR(ISST_IF_MAGIC, 0, struct isst_if_platform_info *) | ||
| 168 | #define ISST_IF_GET_PHY_ID _IOWR(ISST_IF_MAGIC, 1, struct isst_if_cpu_map *) | ||
| 169 | #define ISST_IF_IO_CMD _IOW(ISST_IF_MAGIC, 2, struct isst_if_io_regs *) | ||
| 170 | #define ISST_IF_MBOX_COMMAND _IOWR(ISST_IF_MAGIC, 3, struct isst_if_mbox_cmds *) | ||
| 171 | #define ISST_IF_MSR_COMMAND _IOWR(ISST_IF_MAGIC, 4, struct isst_if_msr_cmds *) | ||
| 172 | #endif | ||
diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h index f45ee0f69c0c..ed3d5893830d 100644 --- a/include/uapi/linux/keyctl.h +++ b/include/uapi/linux/keyctl.h | |||
| @@ -67,6 +67,8 @@ | |||
| 67 | #define KEYCTL_PKEY_SIGN 27 /* Create a public key signature */ | 67 | #define KEYCTL_PKEY_SIGN 27 /* Create a public key signature */ |
| 68 | #define KEYCTL_PKEY_VERIFY 28 /* Verify a public key signature */ | 68 | #define KEYCTL_PKEY_VERIFY 28 /* Verify a public key signature */ |
| 69 | #define KEYCTL_RESTRICT_KEYRING 29 /* Restrict keys allowed to link to a keyring */ | 69 | #define KEYCTL_RESTRICT_KEYRING 29 /* Restrict keys allowed to link to a keyring */ |
| 70 | #define KEYCTL_MOVE 30 /* Move keys between keyrings */ | ||
| 71 | #define KEYCTL_CAPABILITIES 31 /* Find capabilities of keyrings subsystem */ | ||
| 70 | 72 | ||
| 71 | /* keyctl structures */ | 73 | /* keyctl structures */ |
| 72 | struct keyctl_dh_params { | 74 | struct keyctl_dh_params { |
| @@ -112,4 +114,21 @@ struct keyctl_pkey_params { | |||
| 112 | __u32 __spare[7]; | 114 | __u32 __spare[7]; |
| 113 | }; | 115 | }; |
| 114 | 116 | ||
| 117 | #define KEYCTL_MOVE_EXCL 0x00000001 /* Do not displace from the to-keyring */ | ||
| 118 | |||
| 119 | /* | ||
| 120 | * Capabilities flags. The capabilities list is an array of 8-bit integers; | ||
| 121 | * each integer can carry up to 8 flags. | ||
| 122 | */ | ||
| 123 | #define KEYCTL_CAPS0_CAPABILITIES 0x01 /* KEYCTL_CAPABILITIES supported */ | ||
| 124 | #define KEYCTL_CAPS0_PERSISTENT_KEYRINGS 0x02 /* Persistent keyrings enabled */ | ||
| 125 | #define KEYCTL_CAPS0_DIFFIE_HELLMAN 0x04 /* Diffie-Hellman computation enabled */ | ||
| 126 | #define KEYCTL_CAPS0_PUBLIC_KEY 0x08 /* Public key ops enabled */ | ||
| 127 | #define KEYCTL_CAPS0_BIG_KEY 0x10 /* big_key-type enabled */ | ||
| 128 | #define KEYCTL_CAPS0_INVALIDATE 0x20 /* KEYCTL_INVALIDATE supported */ | ||
| 129 | #define KEYCTL_CAPS0_RESTRICT_KEYRING 0x40 /* KEYCTL_RESTRICT_KEYRING supported */ | ||
| 130 | #define KEYCTL_CAPS0_MOVE 0x80 /* KEYCTL_MOVE supported */ | ||
| 131 | #define KEYCTL_CAPS1_NS_KEYRING_NAME 0x01 /* Keyring names are per-user_namespace */ | ||
| 132 | #define KEYCTL_CAPS1_NS_KEY_TAG 0x02 /* Key indexing can include a namespace tag */ | ||
| 133 | |||
| 115 | #endif /* _LINUX_KEYCTL_H */ | 134 | #endif /* _LINUX_KEYCTL_H */ |
diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h index dc067ed0b72d..070d1bc7e725 100644 --- a/include/uapi/linux/kfd_ioctl.h +++ b/include/uapi/linux/kfd_ioctl.h | |||
| @@ -35,9 +35,10 @@ struct kfd_ioctl_get_version_args { | |||
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | /* For kfd_ioctl_create_queue_args.queue_type. */ | 37 | /* For kfd_ioctl_create_queue_args.queue_type. */ |
| 38 | #define KFD_IOC_QUEUE_TYPE_COMPUTE 0 | 38 | #define KFD_IOC_QUEUE_TYPE_COMPUTE 0x0 |
| 39 | #define KFD_IOC_QUEUE_TYPE_SDMA 1 | 39 | #define KFD_IOC_QUEUE_TYPE_SDMA 0x1 |
| 40 | #define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 2 | 40 | #define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 0x2 |
| 41 | #define KFD_IOC_QUEUE_TYPE_SDMA_XGMI 0x3 | ||
| 41 | 42 | ||
| 42 | #define KFD_MAX_QUEUE_PERCENTAGE 100 | 43 | #define KFD_MAX_QUEUE_PERCENTAGE 100 |
| 43 | #define KFD_MAX_QUEUE_PRIORITY 15 | 44 | #define KFD_MAX_QUEUE_PRIORITY 15 |
| @@ -338,6 +339,7 @@ struct kfd_ioctl_acquire_vm_args { | |||
| 338 | #define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1) | 339 | #define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1) |
| 339 | #define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2) | 340 | #define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2) |
| 340 | #define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3) | 341 | #define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3) |
| 342 | #define KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP (1 << 4) | ||
| 341 | /* Allocation flags: attributes/access options */ | 343 | /* Allocation flags: attributes/access options */ |
| 342 | #define KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE (1 << 31) | 344 | #define KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE (1 << 31) |
| 343 | #define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE (1 << 30) | 345 | #define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE (1 << 30) |
| @@ -408,6 +410,21 @@ struct kfd_ioctl_unmap_memory_from_gpu_args { | |||
| 408 | __u32 n_success; /* to/from KFD */ | 410 | __u32 n_success; /* to/from KFD */ |
| 409 | }; | 411 | }; |
| 410 | 412 | ||
| 413 | /* Allocate GWS for specific queue | ||
| 414 | * | ||
| 415 | * @gpu_id: device identifier | ||
| 416 | * @queue_id: queue's id that GWS is allocated for | ||
| 417 | * @num_gws: how many GWS to allocate | ||
| 418 | * @first_gws: index of the first GWS allocated. | ||
| 419 | * only support contiguous GWS allocation | ||
| 420 | */ | ||
| 421 | struct kfd_ioctl_alloc_queue_gws_args { | ||
| 422 | __u32 gpu_id; /* to KFD */ | ||
| 423 | __u32 queue_id; /* to KFD */ | ||
| 424 | __u32 num_gws; /* to KFD */ | ||
| 425 | __u32 first_gws; /* from KFD */ | ||
| 426 | }; | ||
| 427 | |||
| 411 | struct kfd_ioctl_get_dmabuf_info_args { | 428 | struct kfd_ioctl_get_dmabuf_info_args { |
| 412 | __u64 size; /* from KFD */ | 429 | __u64 size; /* from KFD */ |
| 413 | __u64 metadata_ptr; /* to KFD */ | 430 | __u64 metadata_ptr; /* to KFD */ |
| @@ -426,6 +443,13 @@ struct kfd_ioctl_import_dmabuf_args { | |||
| 426 | __u32 dmabuf_fd; /* to KFD */ | 443 | __u32 dmabuf_fd; /* to KFD */ |
| 427 | }; | 444 | }; |
| 428 | 445 | ||
| 446 | /* Register offset inside the remapped mmio page | ||
| 447 | */ | ||
| 448 | enum kfd_mmio_remap { | ||
| 449 | KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL = 0, | ||
| 450 | KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL = 4, | ||
| 451 | }; | ||
| 452 | |||
| 429 | #define AMDKFD_IOCTL_BASE 'K' | 453 | #define AMDKFD_IOCTL_BASE 'K' |
| 430 | #define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr) | 454 | #define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr) |
| 431 | #define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type) | 455 | #define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type) |
| @@ -520,7 +544,10 @@ struct kfd_ioctl_import_dmabuf_args { | |||
| 520 | #define AMDKFD_IOC_IMPORT_DMABUF \ | 544 | #define AMDKFD_IOC_IMPORT_DMABUF \ |
| 521 | AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args) | 545 | AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args) |
| 522 | 546 | ||
| 547 | #define AMDKFD_IOC_ALLOC_QUEUE_GWS \ | ||
| 548 | AMDKFD_IOWR(0x1E, struct kfd_ioctl_alloc_queue_gws_args) | ||
| 549 | |||
| 523 | #define AMDKFD_COMMAND_START 0x01 | 550 | #define AMDKFD_COMMAND_START 0x01 |
| 524 | #define AMDKFD_COMMAND_END 0x1E | 551 | #define AMDKFD_COMMAND_END 0x1F |
| 525 | 552 | ||
| 526 | #endif | 553 | #endif |
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 2fe12b40d503..a7c19540ce21 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h | |||
| @@ -696,9 +696,11 @@ struct kvm_ioeventfd { | |||
| 696 | #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) | 696 | #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) |
| 697 | #define KVM_X86_DISABLE_EXITS_HLT (1 << 1) | 697 | #define KVM_X86_DISABLE_EXITS_HLT (1 << 1) |
| 698 | #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) | 698 | #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) |
| 699 | #define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3) | ||
| 699 | #define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | \ | 700 | #define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | \ |
| 700 | KVM_X86_DISABLE_EXITS_HLT | \ | 701 | KVM_X86_DISABLE_EXITS_HLT | \ |
| 701 | KVM_X86_DISABLE_EXITS_PAUSE) | 702 | KVM_X86_DISABLE_EXITS_PAUSE | \ |
| 703 | KVM_X86_DISABLE_EXITS_CSTATE) | ||
| 702 | 704 | ||
| 703 | /* for KVM_ENABLE_CAP */ | 705 | /* for KVM_ENABLE_CAP */ |
| 704 | struct kvm_enable_cap { | 706 | struct kvm_enable_cap { |
| @@ -993,6 +995,7 @@ struct kvm_ppc_resize_hpt { | |||
| 993 | #define KVM_CAP_ARM_SVE 170 | 995 | #define KVM_CAP_ARM_SVE 170 |
| 994 | #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171 | 996 | #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171 |
| 995 | #define KVM_CAP_ARM_PTRAUTH_GENERIC 172 | 997 | #define KVM_CAP_ARM_PTRAUTH_GENERIC 172 |
| 998 | #define KVM_CAP_PMU_EVENT_FILTER 173 | ||
| 996 | 999 | ||
| 997 | #ifdef KVM_CAP_IRQ_ROUTING | 1000 | #ifdef KVM_CAP_IRQ_ROUTING |
| 998 | 1001 | ||
| @@ -1327,6 +1330,8 @@ struct kvm_s390_ucas_mapping { | |||
| 1327 | #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info) | 1330 | #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info) |
| 1328 | /* Available with KVM_CAP_PPC_GET_CPU_CHAR */ | 1331 | /* Available with KVM_CAP_PPC_GET_CPU_CHAR */ |
| 1329 | #define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char) | 1332 | #define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char) |
| 1333 | /* Available with KVM_CAP_PMU_EVENT_FILTER */ | ||
| 1334 | #define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter) | ||
| 1330 | 1335 | ||
| 1331 | /* ioctl for vm fd */ | 1336 | /* ioctl for vm fd */ |
| 1332 | #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) | 1337 | #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) |
diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h index 6c0ce49931e5..8b86609849b9 100644 --- a/include/uapi/linux/kvm_para.h +++ b/include/uapi/linux/kvm_para.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #define KVM_HC_MIPS_CONSOLE_OUTPUT 8 | 28 | #define KVM_HC_MIPS_CONSOLE_OUTPUT 8 |
| 29 | #define KVM_HC_CLOCK_PAIRING 9 | 29 | #define KVM_HC_CLOCK_PAIRING 9 |
| 30 | #define KVM_HC_SEND_IPI 10 | 30 | #define KVM_HC_SEND_IPI 10 |
| 31 | #define KVM_HC_SCHED_YIELD 11 | ||
| 31 | 32 | ||
| 32 | /* | 33 | /* |
| 33 | * hypercalls use architecture specific | 34 | * hypercalls use architecture specific |
diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h index f8c00045d537..665e18627f78 100644 --- a/include/uapi/linux/magic.h +++ b/include/uapi/linux/magic.h | |||
| @@ -91,5 +91,6 @@ | |||
| 91 | #define UDF_SUPER_MAGIC 0x15013346 | 91 | #define UDF_SUPER_MAGIC 0x15013346 |
| 92 | #define BALLOON_KVM_MAGIC 0x13661366 | 92 | #define BALLOON_KVM_MAGIC 0x13661366 |
| 93 | #define ZSMALLOC_MAGIC 0x58295829 | 93 | #define ZSMALLOC_MAGIC 0x58295829 |
| 94 | #define DMA_BUF_MAGIC 0x444d4142 /* "DMAB" */ | ||
| 94 | 95 | ||
| 95 | #endif /* __LINUX_MAGIC_H__ */ | 96 | #endif /* __LINUX_MAGIC_H__ */ |
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 9aedb187bc48..383ac7b7d8f0 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h | |||
| @@ -146,7 +146,7 @@ struct media_device_info { | |||
| 146 | #define MEDIA_ENT_FL_CONNECTOR (1 << 1) | 146 | #define MEDIA_ENT_FL_CONNECTOR (1 << 1) |
| 147 | 147 | ||
| 148 | /* OR with the entity id value to find the next entity */ | 148 | /* OR with the entity id value to find the next entity */ |
| 149 | #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) | 149 | #define MEDIA_ENT_ID_FLAG_NEXT (1U << 31) |
| 150 | 150 | ||
| 151 | struct media_entity_desc { | 151 | struct media_entity_desc { |
| 152 | __u32 id; | 152 | __u32 id; |
diff --git a/include/uapi/linux/mii.h b/include/uapi/linux/mii.h index a506216591d6..51b48e4be1f2 100644 --- a/include/uapi/linux/mii.h +++ b/include/uapi/linux/mii.h | |||
| @@ -121,6 +121,8 @@ | |||
| 121 | #define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */ | 121 | #define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */ |
| 122 | #define EXPANSION_RESV 0xffe0 /* Unused... */ | 122 | #define EXPANSION_RESV 0xffe0 /* Unused... */ |
| 123 | 123 | ||
| 124 | #define ESTATUS_1000_XFULL 0x8000 /* Can do 1000BaseX Full */ | ||
| 125 | #define ESTATUS_1000_XHALF 0x4000 /* Can do 1000BaseX Half */ | ||
| 124 | #define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */ | 126 | #define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */ |
| 125 | #define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */ | 127 | #define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */ |
| 126 | 128 | ||
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h index ea69ca21ff23..eea166c52c36 100644 --- a/include/uapi/linux/netfilter/ipset/ip_set.h +++ b/include/uapi/linux/netfilter/ipset/ip_set.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 2 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 3 | * Patrick Schaaf <bof@bof.de> | 3 | * Patrick Schaaf <bof@bof.de> |
| 4 | * Martin Josefsson <gandalf@wlug.westbo.se> | 4 | * Martin Josefsson <gandalf@wlug.westbo.se> |
| 5 | * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/include/uapi/linux/netfilter/nf_synproxy.h b/include/uapi/linux/netfilter/nf_synproxy.h new file mode 100644 index 000000000000..6f3791c8946f --- /dev/null +++ b/include/uapi/linux/netfilter/nf_synproxy.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _NF_SYNPROXY_H | ||
| 3 | #define _NF_SYNPROXY_H | ||
| 4 | |||
| 5 | #include <linux/types.h> | ||
| 6 | |||
| 7 | #define NF_SYNPROXY_OPT_MSS 0x01 | ||
| 8 | #define NF_SYNPROXY_OPT_WSCALE 0x02 | ||
| 9 | #define NF_SYNPROXY_OPT_SACK_PERM 0x04 | ||
| 10 | #define NF_SYNPROXY_OPT_TIMESTAMP 0x08 | ||
| 11 | #define NF_SYNPROXY_OPT_ECN 0x10 | ||
| 12 | #define NF_SYNPROXY_OPT_MASK (NF_SYNPROXY_OPT_MSS | \ | ||
| 13 | NF_SYNPROXY_OPT_WSCALE | \ | ||
| 14 | NF_SYNPROXY_OPT_SACK_PERM | \ | ||
| 15 | NF_SYNPROXY_OPT_TIMESTAMP) | ||
| 16 | |||
| 17 | struct nf_synproxy_info { | ||
| 18 | __u8 options; | ||
| 19 | __u8 wscale; | ||
| 20 | __u16 mss; | ||
| 21 | }; | ||
| 22 | |||
| 23 | #endif /* _NF_SYNPROXY_H */ | ||
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h index 505393c6e959..82abaa183fc3 100644 --- a/include/uapi/linux/netfilter/nf_tables.h +++ b/include/uapi/linux/netfilter/nf_tables.h | |||
| @@ -192,6 +192,7 @@ enum nft_table_attributes { | |||
| 192 | * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32) | 192 | * @NFTA_CHAIN_USE: number of references to this chain (NLA_U32) |
| 193 | * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING) | 193 | * @NFTA_CHAIN_TYPE: type name of the string (NLA_NUL_STRING) |
| 194 | * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes) | 194 | * @NFTA_CHAIN_COUNTERS: counter specification of the chain (NLA_NESTED: nft_counter_attributes) |
| 195 | * @NFTA_CHAIN_FLAGS: chain flags | ||
| 195 | */ | 196 | */ |
| 196 | enum nft_chain_attributes { | 197 | enum nft_chain_attributes { |
| 197 | NFTA_CHAIN_UNSPEC, | 198 | NFTA_CHAIN_UNSPEC, |
| @@ -204,6 +205,7 @@ enum nft_chain_attributes { | |||
| 204 | NFTA_CHAIN_TYPE, | 205 | NFTA_CHAIN_TYPE, |
| 205 | NFTA_CHAIN_COUNTERS, | 206 | NFTA_CHAIN_COUNTERS, |
| 206 | NFTA_CHAIN_PAD, | 207 | NFTA_CHAIN_PAD, |
| 208 | NFTA_CHAIN_FLAGS, | ||
| 207 | __NFTA_CHAIN_MAX | 209 | __NFTA_CHAIN_MAX |
| 208 | }; | 210 | }; |
| 209 | #define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1) | 211 | #define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1) |
| @@ -730,10 +732,12 @@ enum nft_exthdr_flags { | |||
| 730 | * | 732 | * |
| 731 | * @NFT_EXTHDR_OP_IPV6: match against ipv6 extension headers | 733 | * @NFT_EXTHDR_OP_IPV6: match against ipv6 extension headers |
| 732 | * @NFT_EXTHDR_OP_TCP: match against tcp options | 734 | * @NFT_EXTHDR_OP_TCP: match against tcp options |
| 735 | * @NFT_EXTHDR_OP_IPV4: match against ipv4 options | ||
| 733 | */ | 736 | */ |
| 734 | enum nft_exthdr_op { | 737 | enum nft_exthdr_op { |
| 735 | NFT_EXTHDR_OP_IPV6, | 738 | NFT_EXTHDR_OP_IPV6, |
| 736 | NFT_EXTHDR_OP_TCPOPT, | 739 | NFT_EXTHDR_OP_TCPOPT, |
| 740 | NFT_EXTHDR_OP_IPV4, | ||
| 737 | __NFT_EXTHDR_OP_MAX | 741 | __NFT_EXTHDR_OP_MAX |
| 738 | }; | 742 | }; |
| 739 | #define NFT_EXTHDR_OP_MAX (__NFT_EXTHDR_OP_MAX - 1) | 743 | #define NFT_EXTHDR_OP_MAX (__NFT_EXTHDR_OP_MAX - 1) |
| @@ -793,6 +797,8 @@ enum nft_exthdr_attributes { | |||
| 793 | * @NFT_META_SECPATH: boolean, secpath_exists (!!skb->sp) | 797 | * @NFT_META_SECPATH: boolean, secpath_exists (!!skb->sp) |
| 794 | * @NFT_META_IIFKIND: packet input interface kind name (dev->rtnl_link_ops->kind) | 798 | * @NFT_META_IIFKIND: packet input interface kind name (dev->rtnl_link_ops->kind) |
| 795 | * @NFT_META_OIFKIND: packet output interface kind name (dev->rtnl_link_ops->kind) | 799 | * @NFT_META_OIFKIND: packet output interface kind name (dev->rtnl_link_ops->kind) |
| 800 | * @NFT_META_BRI_IIFPVID: packet input bridge port pvid | ||
| 801 | * @NFT_META_BRI_IIFVPROTO: packet input bridge vlan proto | ||
| 796 | */ | 802 | */ |
| 797 | enum nft_meta_keys { | 803 | enum nft_meta_keys { |
| 798 | NFT_META_LEN, | 804 | NFT_META_LEN, |
| @@ -823,6 +829,8 @@ enum nft_meta_keys { | |||
| 823 | NFT_META_SECPATH, | 829 | NFT_META_SECPATH, |
| 824 | NFT_META_IIFKIND, | 830 | NFT_META_IIFKIND, |
| 825 | NFT_META_OIFKIND, | 831 | NFT_META_OIFKIND, |
| 832 | NFT_META_BRI_IIFPVID, | ||
| 833 | NFT_META_BRI_IIFVPROTO, | ||
| 826 | }; | 834 | }; |
| 827 | 835 | ||
| 828 | /** | 836 | /** |
| @@ -1445,6 +1453,17 @@ enum nft_ct_timeout_timeout_attributes { | |||
| 1445 | }; | 1453 | }; |
| 1446 | #define NFTA_CT_TIMEOUT_MAX (__NFTA_CT_TIMEOUT_MAX - 1) | 1454 | #define NFTA_CT_TIMEOUT_MAX (__NFTA_CT_TIMEOUT_MAX - 1) |
| 1447 | 1455 | ||
| 1456 | enum nft_ct_expectation_attributes { | ||
| 1457 | NFTA_CT_EXPECT_UNSPEC, | ||
| 1458 | NFTA_CT_EXPECT_L3PROTO, | ||
| 1459 | NFTA_CT_EXPECT_L4PROTO, | ||
| 1460 | NFTA_CT_EXPECT_DPORT, | ||
| 1461 | NFTA_CT_EXPECT_TIMEOUT, | ||
| 1462 | NFTA_CT_EXPECT_SIZE, | ||
| 1463 | __NFTA_CT_EXPECT_MAX, | ||
| 1464 | }; | ||
| 1465 | #define NFTA_CT_EXPECT_MAX (__NFTA_CT_EXPECT_MAX - 1) | ||
| 1466 | |||
| 1448 | #define NFT_OBJECT_UNSPEC 0 | 1467 | #define NFT_OBJECT_UNSPEC 0 |
| 1449 | #define NFT_OBJECT_COUNTER 1 | 1468 | #define NFT_OBJECT_COUNTER 1 |
| 1450 | #define NFT_OBJECT_QUOTA 2 | 1469 | #define NFT_OBJECT_QUOTA 2 |
| @@ -1454,7 +1473,8 @@ enum nft_ct_timeout_timeout_attributes { | |||
| 1454 | #define NFT_OBJECT_TUNNEL 6 | 1473 | #define NFT_OBJECT_TUNNEL 6 |
| 1455 | #define NFT_OBJECT_CT_TIMEOUT 7 | 1474 | #define NFT_OBJECT_CT_TIMEOUT 7 |
| 1456 | #define NFT_OBJECT_SECMARK 8 | 1475 | #define NFT_OBJECT_SECMARK 8 |
| 1457 | #define __NFT_OBJECT_MAX 9 | 1476 | #define NFT_OBJECT_CT_EXPECT 9 |
| 1477 | #define __NFT_OBJECT_MAX 10 | ||
| 1458 | #define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1) | 1478 | #define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1) |
| 1459 | 1479 | ||
| 1460 | /** | 1480 | /** |
| @@ -1538,6 +1558,22 @@ enum nft_osf_flags { | |||
| 1538 | }; | 1558 | }; |
| 1539 | 1559 | ||
| 1540 | /** | 1560 | /** |
| 1561 | * enum nft_synproxy_attributes - nf_tables synproxy expression netlink attributes | ||
| 1562 | * | ||
| 1563 | * @NFTA_SYNPROXY_MSS: mss value sent to the backend (NLA_U16) | ||
| 1564 | * @NFTA_SYNPROXY_WSCALE: wscale value sent to the backend (NLA_U8) | ||
| 1565 | * @NFTA_SYNPROXY_FLAGS: flags (NLA_U32) | ||
| 1566 | */ | ||
| 1567 | enum nft_synproxy_attributes { | ||
| 1568 | NFTA_SYNPROXY_UNSPEC, | ||
| 1569 | NFTA_SYNPROXY_MSS, | ||
| 1570 | NFTA_SYNPROXY_WSCALE, | ||
| 1571 | NFTA_SYNPROXY_FLAGS, | ||
| 1572 | __NFTA_SYNPROXY_MAX, | ||
| 1573 | }; | ||
| 1574 | #define NFTA_SYNPROXY_MAX (__NFTA_SYNPROXY_MAX - 1) | ||
| 1575 | |||
| 1576 | /** | ||
| 1541 | * enum nft_device_attributes - nf_tables device netlink attributes | 1577 | * enum nft_device_attributes - nf_tables device netlink attributes |
| 1542 | * | 1578 | * |
| 1543 | * @NFTA_DEVICE_NAME: name of this device (NLA_STRING) | 1579 | * @NFTA_DEVICE_NAME: name of this device (NLA_STRING) |
diff --git a/include/uapi/linux/netfilter/xt_SYNPROXY.h b/include/uapi/linux/netfilter/xt_SYNPROXY.h index ea5eba15d4c1..19c04ed86172 100644 --- a/include/uapi/linux/netfilter/xt_SYNPROXY.h +++ b/include/uapi/linux/netfilter/xt_SYNPROXY.h | |||
| @@ -2,18 +2,14 @@ | |||
| 2 | #ifndef _XT_SYNPROXY_H | 2 | #ifndef _XT_SYNPROXY_H |
| 3 | #define _XT_SYNPROXY_H | 3 | #define _XT_SYNPROXY_H |
| 4 | 4 | ||
| 5 | #include <linux/types.h> | 5 | #include <linux/netfilter/nf_synproxy.h> |
| 6 | 6 | ||
| 7 | #define XT_SYNPROXY_OPT_MSS 0x01 | 7 | #define XT_SYNPROXY_OPT_MSS NF_SYNPROXY_OPT_MSS |
| 8 | #define XT_SYNPROXY_OPT_WSCALE 0x02 | 8 | #define XT_SYNPROXY_OPT_WSCALE NF_SYNPROXY_OPT_WSCALE |
| 9 | #define XT_SYNPROXY_OPT_SACK_PERM 0x04 | 9 | #define XT_SYNPROXY_OPT_SACK_PERM NF_SYNPROXY_OPT_SACK_PERM |
| 10 | #define XT_SYNPROXY_OPT_TIMESTAMP 0x08 | 10 | #define XT_SYNPROXY_OPT_TIMESTAMP NF_SYNPROXY_OPT_TIMESTAMP |
| 11 | #define XT_SYNPROXY_OPT_ECN 0x10 | 11 | #define XT_SYNPROXY_OPT_ECN NF_SYNPROXY_OPT_ECN |
| 12 | 12 | ||
| 13 | struct xt_synproxy_info { | 13 | #define xt_synproxy_info nf_synproxy_info |
| 14 | __u8 options; | ||
| 15 | __u8 wscale; | ||
| 16 | __u16 mss; | ||
| 17 | }; | ||
| 18 | 14 | ||
| 19 | #endif /* _XT_SYNPROXY_H */ | 15 | #endif /* _XT_SYNPROXY_H */ |
diff --git a/include/uapi/linux/netfilter/xt_owner.h b/include/uapi/linux/netfilter/xt_owner.h index fa3ad84957d5..5108df4d0313 100644 --- a/include/uapi/linux/netfilter/xt_owner.h +++ b/include/uapi/linux/netfilter/xt_owner.h | |||
| @@ -5,11 +5,17 @@ | |||
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | 6 | ||
| 7 | enum { | 7 | enum { |
| 8 | XT_OWNER_UID = 1 << 0, | 8 | XT_OWNER_UID = 1 << 0, |
| 9 | XT_OWNER_GID = 1 << 1, | 9 | XT_OWNER_GID = 1 << 1, |
| 10 | XT_OWNER_SOCKET = 1 << 2, | 10 | XT_OWNER_SOCKET = 1 << 2, |
| 11 | XT_OWNER_SUPPL_GROUPS = 1 << 3, | ||
| 11 | }; | 12 | }; |
| 12 | 13 | ||
| 14 | #define XT_OWNER_MASK (XT_OWNER_UID | \ | ||
| 15 | XT_OWNER_GID | \ | ||
| 16 | XT_OWNER_SOCKET | \ | ||
| 17 | XT_OWNER_SUPPL_GROUPS) | ||
| 18 | |||
| 13 | struct xt_owner_match_info { | 19 | struct xt_owner_match_info { |
| 14 | __u32 uid_min, uid_max; | 20 | __u32 uid_min, uid_max; |
| 15 | __u32 gid_min, gid_max; | 21 | __u32 gid_min, gid_max; |
diff --git a/include/uapi/linux/nexthop.h b/include/uapi/linux/nexthop.h new file mode 100644 index 000000000000..7b61867e9848 --- /dev/null +++ b/include/uapi/linux/nexthop.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | #ifndef _UAPI_LINUX_NEXTHOP_H | ||
| 3 | #define _UAPI_LINUX_NEXTHOP_H | ||
| 4 | |||
| 5 | #include <linux/types.h> | ||
| 6 | |||
| 7 | struct nhmsg { | ||
| 8 | unsigned char nh_family; | ||
| 9 | unsigned char nh_scope; /* return only */ | ||
| 10 | unsigned char nh_protocol; /* Routing protocol that installed nh */ | ||
| 11 | unsigned char resvd; | ||
| 12 | unsigned int nh_flags; /* RTNH_F flags */ | ||
| 13 | }; | ||
| 14 | |||
| 15 | /* entry in a nexthop group */ | ||
| 16 | struct nexthop_grp { | ||
| 17 | __u32 id; /* nexthop id - must exist */ | ||
| 18 | __u8 weight; /* weight of this nexthop */ | ||
| 19 | __u8 resvd1; | ||
| 20 | __u16 resvd2; | ||
| 21 | }; | ||
| 22 | |||
| 23 | enum { | ||
| 24 | NEXTHOP_GRP_TYPE_MPATH, /* default type if not specified */ | ||
| 25 | __NEXTHOP_GRP_TYPE_MAX, | ||
| 26 | }; | ||
| 27 | |||
| 28 | #define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1) | ||
| 29 | |||
| 30 | enum { | ||
| 31 | NHA_UNSPEC, | ||
| 32 | NHA_ID, /* u32; id for nexthop. id == 0 means auto-assign */ | ||
| 33 | |||
| 34 | NHA_GROUP, /* array of nexthop_grp */ | ||
| 35 | NHA_GROUP_TYPE, /* u16 one of NEXTHOP_GRP_TYPE */ | ||
| 36 | /* if NHA_GROUP attribute is added, no other attributes can be set */ | ||
| 37 | |||
| 38 | NHA_BLACKHOLE, /* flag; nexthop used to blackhole packets */ | ||
| 39 | /* if NHA_BLACKHOLE is added, OIF, GATEWAY, ENCAP can not be set */ | ||
| 40 | |||
| 41 | NHA_OIF, /* u32; nexthop device */ | ||
| 42 | NHA_GATEWAY, /* be32 (IPv4) or in6_addr (IPv6) gw address */ | ||
| 43 | NHA_ENCAP_TYPE, /* u16; lwt encap type */ | ||
| 44 | NHA_ENCAP, /* lwt encap data */ | ||
| 45 | |||
| 46 | /* NHA_OIF can be appended to dump request to return only | ||
| 47 | * nexthops using given device | ||
| 48 | */ | ||
| 49 | NHA_GROUPS, /* flag; only return nexthop groups in dump */ | ||
| 50 | NHA_MASTER, /* u32; only return nexthops with given master dev */ | ||
| 51 | |||
| 52 | __NHA_MAX, | ||
| 53 | }; | ||
| 54 | |||
| 55 | #define NHA_MAX (__NHA_MAX - 1) | ||
| 56 | #endif | ||
diff --git a/include/uapi/linux/nilfs2_ondisk.h b/include/uapi/linux/nilfs2_ondisk.h index a7e66ab11d1d..c23f91ae5fe8 100644 --- a/include/uapi/linux/nilfs2_ondisk.h +++ b/include/uapi/linux/nilfs2_ondisk.h | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
| 31 | #include <linux/magic.h> | 31 | #include <linux/magic.h> |
| 32 | 32 | #include <asm/byteorder.h> | |
| 33 | 33 | ||
| 34 | #define NILFS_INODE_BMAP_SIZE 7 | 34 | #define NILFS_INODE_BMAP_SIZE 7 |
| 35 | 35 | ||
| @@ -533,19 +533,19 @@ enum { | |||
| 533 | static inline void \ | 533 | static inline void \ |
| 534 | nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ | 534 | nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ |
| 535 | { \ | 535 | { \ |
| 536 | cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \ | 536 | cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) | \ |
| 537 | (1UL << NILFS_CHECKPOINT_##flag)); \ | 537 | (1UL << NILFS_CHECKPOINT_##flag)); \ |
| 538 | } \ | 538 | } \ |
| 539 | static inline void \ | 539 | static inline void \ |
| 540 | nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ | 540 | nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ |
| 541 | { \ | 541 | { \ |
| 542 | cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \ | 542 | cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) & \ |
| 543 | ~(1UL << NILFS_CHECKPOINT_##flag)); \ | 543 | ~(1UL << NILFS_CHECKPOINT_##flag)); \ |
| 544 | } \ | 544 | } \ |
| 545 | static inline int \ | 545 | static inline int \ |
| 546 | nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ | 546 | nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ |
| 547 | { \ | 547 | { \ |
| 548 | return !!(le32_to_cpu(cp->cp_flags) & \ | 548 | return !!(__le32_to_cpu(cp->cp_flags) & \ |
| 549 | (1UL << NILFS_CHECKPOINT_##flag)); \ | 549 | (1UL << NILFS_CHECKPOINT_##flag)); \ |
| 550 | } | 550 | } |
| 551 | 551 | ||
| @@ -595,20 +595,20 @@ enum { | |||
| 595 | static inline void \ | 595 | static inline void \ |
| 596 | nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \ | 596 | nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \ |
| 597 | { \ | 597 | { \ |
| 598 | su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | \ | 598 | su->su_flags = __cpu_to_le32(__le32_to_cpu(su->su_flags) | \ |
| 599 | (1UL << NILFS_SEGMENT_USAGE_##flag));\ | 599 | (1UL << NILFS_SEGMENT_USAGE_##flag));\ |
| 600 | } \ | 600 | } \ |
| 601 | static inline void \ | 601 | static inline void \ |
| 602 | nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \ | 602 | nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \ |
| 603 | { \ | 603 | { \ |
| 604 | su->su_flags = \ | 604 | su->su_flags = \ |
| 605 | cpu_to_le32(le32_to_cpu(su->su_flags) & \ | 605 | __cpu_to_le32(__le32_to_cpu(su->su_flags) & \ |
| 606 | ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ | 606 | ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ |
| 607 | } \ | 607 | } \ |
| 608 | static inline int \ | 608 | static inline int \ |
| 609 | nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \ | 609 | nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \ |
| 610 | { \ | 610 | { \ |
| 611 | return !!(le32_to_cpu(su->su_flags) & \ | 611 | return !!(__le32_to_cpu(su->su_flags) & \ |
| 612 | (1UL << NILFS_SEGMENT_USAGE_##flag)); \ | 612 | (1UL << NILFS_SEGMENT_USAGE_##flag)); \ |
| 613 | } | 613 | } |
| 614 | 614 | ||
| @@ -619,15 +619,15 @@ NILFS_SEGMENT_USAGE_FNS(ERROR, error) | |||
| 619 | static inline void | 619 | static inline void |
| 620 | nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su) | 620 | nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su) |
| 621 | { | 621 | { |
| 622 | su->su_lastmod = cpu_to_le64(0); | 622 | su->su_lastmod = __cpu_to_le64(0); |
| 623 | su->su_nblocks = cpu_to_le32(0); | 623 | su->su_nblocks = __cpu_to_le32(0); |
| 624 | su->su_flags = cpu_to_le32(0); | 624 | su->su_flags = __cpu_to_le32(0); |
| 625 | } | 625 | } |
| 626 | 626 | ||
| 627 | static inline int | 627 | static inline int |
| 628 | nilfs_segment_usage_clean(const struct nilfs_segment_usage *su) | 628 | nilfs_segment_usage_clean(const struct nilfs_segment_usage *su) |
| 629 | { | 629 | { |
| 630 | return !le32_to_cpu(su->su_flags); | 630 | return !__le32_to_cpu(su->su_flags); |
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | /** | 633 | /** |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 6f09d1500960..75758ec26c8b 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
| @@ -235,6 +235,15 @@ | |||
| 235 | */ | 235 | */ |
| 236 | 236 | ||
| 237 | /** | 237 | /** |
| 238 | * DOC: SAE authentication offload | ||
| 239 | * | ||
| 240 | * By setting @NL80211_EXT_FEATURE_SAE_OFFLOAD flag drivers can indicate they | ||
| 241 | * support offloading SAE authentication for WPA3-Personal networks. In | ||
| 242 | * %NL80211_CMD_CONNECT the password for SAE should be specified using | ||
| 243 | * %NL80211_ATTR_SAE_PASSWORD. | ||
| 244 | */ | ||
| 245 | |||
| 246 | /** | ||
| 238 | * enum nl80211_commands - supported nl80211 commands | 247 | * enum nl80211_commands - supported nl80211 commands |
| 239 | * | 248 | * |
| 240 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors | 249 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors |
| @@ -2341,6 +2350,12 @@ enum nl80211_commands { | |||
| 2341 | * should be picking up the lowest tx power, either tx power per-interface | 2350 | * should be picking up the lowest tx power, either tx power per-interface |
| 2342 | * or per-station. | 2351 | * or per-station. |
| 2343 | * | 2352 | * |
| 2353 | * @NL80211_ATTR_SAE_PASSWORD: attribute for passing SAE password material. It | ||
| 2354 | * is used with %NL80211_CMD_CONNECT to provide password for offloading | ||
| 2355 | * SAE authentication for WPA3-Personal networks. | ||
| 2356 | * | ||
| 2357 | * @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support. | ||
| 2358 | * | ||
| 2344 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available | 2359 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available |
| 2345 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 2360 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 2346 | * @__NL80211_ATTR_AFTER_LAST: internal use | 2361 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| @@ -2794,6 +2809,10 @@ enum nl80211_attrs { | |||
| 2794 | NL80211_ATTR_STA_TX_POWER_SETTING, | 2809 | NL80211_ATTR_STA_TX_POWER_SETTING, |
| 2795 | NL80211_ATTR_STA_TX_POWER, | 2810 | NL80211_ATTR_STA_TX_POWER, |
| 2796 | 2811 | ||
| 2812 | NL80211_ATTR_SAE_PASSWORD, | ||
| 2813 | |||
| 2814 | NL80211_ATTR_TWT_RESPONDER, | ||
| 2815 | |||
| 2797 | /* add attributes here, update the policy in nl80211.c */ | 2816 | /* add attributes here, update the policy in nl80211.c */ |
| 2798 | 2817 | ||
| 2799 | __NL80211_ATTR_AFTER_LAST, | 2818 | __NL80211_ATTR_AFTER_LAST, |
| @@ -4406,6 +4425,7 @@ enum nl80211_mfp { | |||
| 4406 | enum nl80211_wpa_versions { | 4425 | enum nl80211_wpa_versions { |
| 4407 | NL80211_WPA_VERSION_1 = 1 << 0, | 4426 | NL80211_WPA_VERSION_1 = 1 << 0, |
| 4408 | NL80211_WPA_VERSION_2 = 1 << 1, | 4427 | NL80211_WPA_VERSION_2 = 1 << 1, |
| 4428 | NL80211_WPA_VERSION_3 = 1 << 2, | ||
| 4409 | }; | 4429 | }; |
| 4410 | 4430 | ||
| 4411 | /** | 4431 | /** |
| @@ -5314,7 +5334,7 @@ enum nl80211_feature_flags { | |||
| 5314 | NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28, | 5334 | NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28, |
| 5315 | NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29, | 5335 | NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29, |
| 5316 | NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30, | 5336 | NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30, |
| 5317 | NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31, | 5337 | NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1U << 31, |
| 5318 | }; | 5338 | }; |
| 5319 | 5339 | ||
| 5320 | /** | 5340 | /** |
| @@ -5422,6 +5442,9 @@ enum nl80211_feature_flags { | |||
| 5422 | * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power | 5442 | * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power |
| 5423 | * to a station. | 5443 | * to a station. |
| 5424 | * | 5444 | * |
| 5445 | * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in | ||
| 5446 | * station mode (SAE password is passed as part of the connect command). | ||
| 5447 | * | ||
| 5425 | * @NUM_NL80211_EXT_FEATURES: number of extended features. | 5448 | * @NUM_NL80211_EXT_FEATURES: number of extended features. |
| 5426 | * @MAX_NL80211_EXT_FEATURES: highest extended feature index. | 5449 | * @MAX_NL80211_EXT_FEATURES: highest extended feature index. |
| 5427 | */ | 5450 | */ |
| @@ -5466,6 +5489,7 @@ enum nl80211_ext_feature_index { | |||
| 5466 | NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD, | 5489 | NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD, |
| 5467 | NL80211_EXT_FEATURE_EXT_KEY_ID, | 5490 | NL80211_EXT_FEATURE_EXT_KEY_ID, |
| 5468 | NL80211_EXT_FEATURE_STA_TX_PWR, | 5491 | NL80211_EXT_FEATURE_STA_TX_PWR, |
| 5492 | NL80211_EXT_FEATURE_SAE_OFFLOAD, | ||
| 5469 | 5493 | ||
| 5470 | /* add new features before the definition below */ | 5494 | /* add new features before the definition below */ |
| 5471 | NUM_NL80211_EXT_FEATURES, | 5495 | NUM_NL80211_EXT_FEATURES, |
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 27164769d184..f28e562d7ca8 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h | |||
| @@ -528,6 +528,7 @@ | |||
| 528 | #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002 /* LNKCAP2 SLS Vector bit 1 */ | 528 | #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002 /* LNKCAP2 SLS Vector bit 1 */ |
| 529 | #define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003 /* LNKCAP2 SLS Vector bit 2 */ | 529 | #define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003 /* LNKCAP2 SLS Vector bit 2 */ |
| 530 | #define PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004 /* LNKCAP2 SLS Vector bit 3 */ | 530 | #define PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004 /* LNKCAP2 SLS Vector bit 3 */ |
| 531 | #define PCI_EXP_LNKCAP_SLS_32_0GB 0x00000005 /* LNKCAP2 SLS Vector bit 4 */ | ||
| 531 | #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ | 532 | #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ |
| 532 | #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ | 533 | #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ |
| 533 | #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ | 534 | #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ |
| @@ -556,6 +557,7 @@ | |||
| 556 | #define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */ | 557 | #define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */ |
| 557 | #define PCI_EXP_LNKSTA_CLS_8_0GB 0x0003 /* Current Link Speed 8.0GT/s */ | 558 | #define PCI_EXP_LNKSTA_CLS_8_0GB 0x0003 /* Current Link Speed 8.0GT/s */ |
| 558 | #define PCI_EXP_LNKSTA_CLS_16_0GB 0x0004 /* Current Link Speed 16.0GT/s */ | 559 | #define PCI_EXP_LNKSTA_CLS_16_0GB 0x0004 /* Current Link Speed 16.0GT/s */ |
| 560 | #define PCI_EXP_LNKSTA_CLS_32_0GB 0x0005 /* Current Link Speed 32.0GT/s */ | ||
| 559 | #define PCI_EXP_LNKSTA_NLW 0x03f0 /* Negotiated Link Width */ | 561 | #define PCI_EXP_LNKSTA_NLW 0x03f0 /* Negotiated Link Width */ |
| 560 | #define PCI_EXP_LNKSTA_NLW_X1 0x0010 /* Current Link Width x1 */ | 562 | #define PCI_EXP_LNKSTA_NLW_X1 0x0010 /* Current Link Width x1 */ |
| 561 | #define PCI_EXP_LNKSTA_NLW_X2 0x0020 /* Current Link Width x2 */ | 563 | #define PCI_EXP_LNKSTA_NLW_X2 0x0020 /* Current Link Width x2 */ |
| @@ -661,6 +663,7 @@ | |||
| 661 | #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x00000004 /* Supported Speed 5GT/s */ | 663 | #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x00000004 /* Supported Speed 5GT/s */ |
| 662 | #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x00000008 /* Supported Speed 8GT/s */ | 664 | #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x00000008 /* Supported Speed 8GT/s */ |
| 663 | #define PCI_EXP_LNKCAP2_SLS_16_0GB 0x00000010 /* Supported Speed 16GT/s */ | 665 | #define PCI_EXP_LNKCAP2_SLS_16_0GB 0x00000010 /* Supported Speed 16GT/s */ |
| 666 | #define PCI_EXP_LNKCAP2_SLS_32_0GB 0x00000020 /* Supported Speed 32GT/s */ | ||
| 664 | #define PCI_EXP_LNKCAP2_CROSSLINK 0x00000100 /* Crosslink supported */ | 667 | #define PCI_EXP_LNKCAP2_CROSSLINK 0x00000100 /* Crosslink supported */ |
| 665 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ | 668 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ |
| 666 | #define PCI_EXP_LNKCTL2_TLS 0x000f | 669 | #define PCI_EXP_LNKCTL2_TLS 0x000f |
| @@ -668,6 +671,7 @@ | |||
| 668 | #define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002 /* Supported Speed 5GT/s */ | 671 | #define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002 /* Supported Speed 5GT/s */ |
| 669 | #define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003 /* Supported Speed 8GT/s */ | 672 | #define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003 /* Supported Speed 8GT/s */ |
| 670 | #define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004 /* Supported Speed 16GT/s */ | 673 | #define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004 /* Supported Speed 16GT/s */ |
| 674 | #define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005 /* Supported Speed 32GT/s */ | ||
| 671 | #define PCI_EXP_LNKSTA2 50 /* Link Status 2 */ | 675 | #define PCI_EXP_LNKSTA2 50 /* Link Status 2 */ |
| 672 | #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52 /* v2 endpoints with link end here */ | 676 | #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52 /* v2 endpoints with link end here */ |
| 673 | #define PCI_EXP_SLTCAP2 52 /* Slot Capabilities 2 */ | 677 | #define PCI_EXP_SLTCAP2 52 /* Slot Capabilities 2 */ |
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h index 51a0496f78ea..b057aeeb6338 100644 --- a/include/uapi/linux/pkt_cls.h +++ b/include/uapi/linux/pkt_cls.h | |||
| @@ -104,6 +104,9 @@ enum tca_id { | |||
| 104 | TCA_ID_SIMP = TCA_ACT_SIMP, | 104 | TCA_ID_SIMP = TCA_ACT_SIMP, |
| 105 | TCA_ID_IFE = TCA_ACT_IFE, | 105 | TCA_ID_IFE = TCA_ACT_IFE, |
| 106 | TCA_ID_SAMPLE = TCA_ACT_SAMPLE, | 106 | TCA_ID_SAMPLE = TCA_ACT_SAMPLE, |
| 107 | TCA_ID_CTINFO, | ||
| 108 | TCA_ID_MPLS, | ||
| 109 | TCA_ID_CT, | ||
| 107 | /* other actions go here */ | 110 | /* other actions go here */ |
| 108 | __TCA_ID_MAX = 255 | 111 | __TCA_ID_MAX = 255 |
| 109 | }; | 112 | }; |
| @@ -294,7 +297,7 @@ enum { | |||
| 294 | TCA_FW_UNSPEC, | 297 | TCA_FW_UNSPEC, |
| 295 | TCA_FW_CLASSID, | 298 | TCA_FW_CLASSID, |
| 296 | TCA_FW_POLICE, | 299 | TCA_FW_POLICE, |
| 297 | TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ | 300 | TCA_FW_INDEV, |
| 298 | TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ | 301 | TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ |
| 299 | TCA_FW_MASK, | 302 | TCA_FW_MASK, |
| 300 | __TCA_FW_MAX | 303 | __TCA_FW_MAX |
| @@ -534,12 +537,28 @@ enum { | |||
| 534 | TCA_FLOWER_KEY_PORT_DST_MIN, /* be16 */ | 537 | TCA_FLOWER_KEY_PORT_DST_MIN, /* be16 */ |
| 535 | TCA_FLOWER_KEY_PORT_DST_MAX, /* be16 */ | 538 | TCA_FLOWER_KEY_PORT_DST_MAX, /* be16 */ |
| 536 | 539 | ||
| 540 | TCA_FLOWER_KEY_CT_STATE, /* u16 */ | ||
| 541 | TCA_FLOWER_KEY_CT_STATE_MASK, /* u16 */ | ||
| 542 | TCA_FLOWER_KEY_CT_ZONE, /* u16 */ | ||
| 543 | TCA_FLOWER_KEY_CT_ZONE_MASK, /* u16 */ | ||
| 544 | TCA_FLOWER_KEY_CT_MARK, /* u32 */ | ||
| 545 | TCA_FLOWER_KEY_CT_MARK_MASK, /* u32 */ | ||
| 546 | TCA_FLOWER_KEY_CT_LABELS, /* u128 */ | ||
| 547 | TCA_FLOWER_KEY_CT_LABELS_MASK, /* u128 */ | ||
| 548 | |||
| 537 | __TCA_FLOWER_MAX, | 549 | __TCA_FLOWER_MAX, |
| 538 | }; | 550 | }; |
| 539 | 551 | ||
| 540 | #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1) | 552 | #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1) |
| 541 | 553 | ||
| 542 | enum { | 554 | enum { |
| 555 | TCA_FLOWER_KEY_CT_FLAGS_NEW = 1 << 0, /* Beginning of a new connection. */ | ||
| 556 | TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED = 1 << 1, /* Part of an existing connection. */ | ||
| 557 | TCA_FLOWER_KEY_CT_FLAGS_RELATED = 1 << 2, /* Related to an established connection. */ | ||
| 558 | TCA_FLOWER_KEY_CT_FLAGS_TRACKED = 1 << 3, /* Conntrack has occurred. */ | ||
| 559 | }; | ||
| 560 | |||
| 561 | enum { | ||
| 543 | TCA_FLOWER_KEY_ENC_OPTS_UNSPEC, | 562 | TCA_FLOWER_KEY_ENC_OPTS_UNSPEC, |
| 544 | TCA_FLOWER_KEY_ENC_OPTS_GENEVE, /* Nested | 563 | TCA_FLOWER_KEY_ENC_OPTS_GENEVE, /* Nested |
| 545 | * TCA_FLOWER_KEY_ENC_OPT_GENEVE_ | 564 | * TCA_FLOWER_KEY_ENC_OPT_GENEVE_ |
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index 8b2f993cbb77..1f623252abe8 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #ifndef __LINUX_PKT_SCHED_H | 2 | #ifndef __LINUX_PKT_SCHED_H |
| 3 | #define __LINUX_PKT_SCHED_H | 3 | #define __LINUX_PKT_SCHED_H |
| 4 | 4 | ||
| 5 | #include <linux/const.h> | ||
| 5 | #include <linux/types.h> | 6 | #include <linux/types.h> |
| 6 | 7 | ||
| 7 | /* Logical priority bands not depending on specific packet scheduler. | 8 | /* Logical priority bands not depending on specific packet scheduler. |
| @@ -988,8 +989,9 @@ struct tc_etf_qopt { | |||
| 988 | __s32 delta; | 989 | __s32 delta; |
| 989 | __s32 clockid; | 990 | __s32 clockid; |
| 990 | __u32 flags; | 991 | __u32 flags; |
| 991 | #define TC_ETF_DEADLINE_MODE_ON BIT(0) | 992 | #define TC_ETF_DEADLINE_MODE_ON _BITUL(0) |
| 992 | #define TC_ETF_OFFLOAD_ON BIT(1) | 993 | #define TC_ETF_OFFLOAD_ON _BITUL(1) |
| 994 | #define TC_ETF_SKIP_SOCK_CHECK _BITUL(2) | ||
| 993 | }; | 995 | }; |
| 994 | 996 | ||
| 995 | enum { | 997 | enum { |
| @@ -1158,6 +1160,8 @@ enum { | |||
| 1158 | * [TCA_TAPRIO_ATTR_SCHED_ENTRY_INTERVAL] | 1160 | * [TCA_TAPRIO_ATTR_SCHED_ENTRY_INTERVAL] |
| 1159 | */ | 1161 | */ |
| 1160 | 1162 | ||
| 1163 | #define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST 0x1 | ||
| 1164 | |||
| 1161 | enum { | 1165 | enum { |
| 1162 | TCA_TAPRIO_ATTR_UNSPEC, | 1166 | TCA_TAPRIO_ATTR_UNSPEC, |
| 1163 | TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */ | 1167 | TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */ |
| @@ -1169,6 +1173,8 @@ enum { | |||
| 1169 | TCA_TAPRIO_ATTR_ADMIN_SCHED, /* The admin sched, only used in dump */ | 1173 | TCA_TAPRIO_ATTR_ADMIN_SCHED, /* The admin sched, only used in dump */ |
| 1170 | TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME, /* s64 */ | 1174 | TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME, /* s64 */ |
| 1171 | TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION, /* s64 */ | 1175 | TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION, /* s64 */ |
| 1176 | TCA_TAPRIO_ATTR_FLAGS, /* u32 */ | ||
| 1177 | TCA_TAPRIO_ATTR_TXTIME_DELAY, /* s32 */ | ||
| 1172 | __TCA_TAPRIO_ATTR_MAX, | 1178 | __TCA_TAPRIO_ATTR_MAX, |
| 1173 | }; | 1179 | }; |
| 1174 | 1180 | ||
diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h index 5d0f76c780e5..fd6b5f66e2c5 100644 --- a/include/uapi/linux/rds.h +++ b/include/uapi/linux/rds.h | |||
| @@ -250,6 +250,7 @@ struct rds_info_rdma_connection { | |||
| 250 | __u32 rdma_mr_max; | 250 | __u32 rdma_mr_max; |
| 251 | __u32 rdma_mr_size; | 251 | __u32 rdma_mr_size; |
| 252 | __u8 tos; | 252 | __u8 tos; |
| 253 | __u32 cache_allocs; | ||
| 253 | }; | 254 | }; |
| 254 | 255 | ||
| 255 | struct rds6_info_rdma_connection { | 256 | struct rds6_info_rdma_connection { |
| @@ -264,6 +265,7 @@ struct rds6_info_rdma_connection { | |||
| 264 | __u32 rdma_mr_max; | 265 | __u32 rdma_mr_max; |
| 265 | __u32 rdma_mr_size; | 266 | __u32 rdma_mr_size; |
| 266 | __u8 tos; | 267 | __u8 tos; |
| 268 | __u32 cache_allocs; | ||
| 267 | }; | 269 | }; |
| 268 | 270 | ||
| 269 | /* RDS message Receive Path Latency points */ | 271 | /* RDS message Receive Path Latency points */ |
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index 46399367627f..ce2a623abb75 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h | |||
| @@ -157,6 +157,13 @@ enum { | |||
| 157 | RTM_GETCHAIN, | 157 | RTM_GETCHAIN, |
| 158 | #define RTM_GETCHAIN RTM_GETCHAIN | 158 | #define RTM_GETCHAIN RTM_GETCHAIN |
| 159 | 159 | ||
| 160 | RTM_NEWNEXTHOP = 104, | ||
| 161 | #define RTM_NEWNEXTHOP RTM_NEWNEXTHOP | ||
| 162 | RTM_DELNEXTHOP, | ||
| 163 | #define RTM_DELNEXTHOP RTM_DELNEXTHOP | ||
| 164 | RTM_GETNEXTHOP, | ||
| 165 | #define RTM_GETNEXTHOP RTM_GETNEXTHOP | ||
| 166 | |||
| 160 | __RTM_MAX, | 167 | __RTM_MAX, |
| 161 | #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) | 168 | #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) |
| 162 | }; | 169 | }; |
| @@ -342,6 +349,7 @@ enum rtattr_type_t { | |||
| 342 | RTA_IP_PROTO, | 349 | RTA_IP_PROTO, |
| 343 | RTA_SPORT, | 350 | RTA_SPORT, |
| 344 | RTA_DPORT, | 351 | RTA_DPORT, |
| 352 | RTA_NH_ID, | ||
| 345 | __RTA_MAX | 353 | __RTA_MAX |
| 346 | }; | 354 | }; |
| 347 | 355 | ||
| @@ -704,6 +712,8 @@ enum rtnetlink_groups { | |||
| 704 | #define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R | 712 | #define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R |
| 705 | RTNLGRP_IPV6_MROUTE_R, | 713 | RTNLGRP_IPV6_MROUTE_R, |
| 706 | #define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R | 714 | #define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R |
| 715 | RTNLGRP_NEXTHOP, | ||
| 716 | #define RTNLGRP_NEXTHOP RTNLGRP_NEXTHOP | ||
| 707 | __RTNLGRP_MAX | 717 | __RTNLGRP_MAX |
| 708 | }; | 718 | }; |
| 709 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) | 719 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) |
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h index ed4ee170bee2..b3105ac1381a 100644 --- a/include/uapi/linux/sched.h +++ b/include/uapi/linux/sched.h | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #ifndef _UAPI_LINUX_SCHED_H | 2 | #ifndef _UAPI_LINUX_SCHED_H |
| 3 | #define _UAPI_LINUX_SCHED_H | 3 | #define _UAPI_LINUX_SCHED_H |
| 4 | 4 | ||
| 5 | #include <linux/types.h> | ||
| 6 | |||
| 5 | /* | 7 | /* |
| 6 | * cloning flags: | 8 | * cloning flags: |
| 7 | */ | 9 | */ |
| @@ -32,6 +34,20 @@ | |||
| 32 | #define CLONE_IO 0x80000000 /* Clone io context */ | 34 | #define CLONE_IO 0x80000000 /* Clone io context */ |
| 33 | 35 | ||
| 34 | /* | 36 | /* |
| 37 | * Arguments for the clone3 syscall | ||
| 38 | */ | ||
| 39 | struct clone_args { | ||
| 40 | __aligned_u64 flags; | ||
| 41 | __aligned_u64 pidfd; | ||
| 42 | __aligned_u64 child_tid; | ||
| 43 | __aligned_u64 parent_tid; | ||
| 44 | __aligned_u64 exit_signal; | ||
| 45 | __aligned_u64 stack; | ||
| 46 | __aligned_u64 stack_size; | ||
| 47 | __aligned_u64 tls; | ||
| 48 | }; | ||
| 49 | |||
| 50 | /* | ||
| 35 | * Scheduling policies | 51 | * Scheduling policies |
| 36 | */ | 52 | */ |
| 37 | #define SCHED_NORMAL 0 | 53 | #define SCHED_NORMAL 0 |
| @@ -51,9 +67,21 @@ | |||
| 51 | #define SCHED_FLAG_RESET_ON_FORK 0x01 | 67 | #define SCHED_FLAG_RESET_ON_FORK 0x01 |
| 52 | #define SCHED_FLAG_RECLAIM 0x02 | 68 | #define SCHED_FLAG_RECLAIM 0x02 |
| 53 | #define SCHED_FLAG_DL_OVERRUN 0x04 | 69 | #define SCHED_FLAG_DL_OVERRUN 0x04 |
| 70 | #define SCHED_FLAG_KEEP_POLICY 0x08 | ||
| 71 | #define SCHED_FLAG_KEEP_PARAMS 0x10 | ||
| 72 | #define SCHED_FLAG_UTIL_CLAMP_MIN 0x20 | ||
| 73 | #define SCHED_FLAG_UTIL_CLAMP_MAX 0x40 | ||
| 74 | |||
| 75 | #define SCHED_FLAG_KEEP_ALL (SCHED_FLAG_KEEP_POLICY | \ | ||
| 76 | SCHED_FLAG_KEEP_PARAMS) | ||
| 77 | |||
| 78 | #define SCHED_FLAG_UTIL_CLAMP (SCHED_FLAG_UTIL_CLAMP_MIN | \ | ||
| 79 | SCHED_FLAG_UTIL_CLAMP_MAX) | ||
| 54 | 80 | ||
| 55 | #define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | \ | 81 | #define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | \ |
| 56 | SCHED_FLAG_RECLAIM | \ | 82 | SCHED_FLAG_RECLAIM | \ |
| 57 | SCHED_FLAG_DL_OVERRUN) | 83 | SCHED_FLAG_DL_OVERRUN | \ |
| 84 | SCHED_FLAG_KEEP_ALL | \ | ||
| 85 | SCHED_FLAG_UTIL_CLAMP) | ||
| 58 | 86 | ||
| 59 | #endif /* _UAPI_LINUX_SCHED_H */ | 87 | #endif /* _UAPI_LINUX_SCHED_H */ |
diff --git a/include/uapi/linux/sched/types.h b/include/uapi/linux/sched/types.h index 10fbb8031930..c852153ddb0d 100644 --- a/include/uapi/linux/sched/types.h +++ b/include/uapi/linux/sched/types.h | |||
| @@ -9,6 +9,7 @@ struct sched_param { | |||
| 9 | }; | 9 | }; |
| 10 | 10 | ||
| 11 | #define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */ | 11 | #define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */ |
| 12 | #define SCHED_ATTR_SIZE_VER1 56 /* add: util_{min,max} */ | ||
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| 14 | * Extended scheduling parameters data structure. | 15 | * Extended scheduling parameters data structure. |
| @@ -21,8 +22,33 @@ struct sched_param { | |||
| 21 | * the tasks may be useful for a wide variety of application fields, e.g., | 22 | * the tasks may be useful for a wide variety of application fields, e.g., |
| 22 | * multimedia, streaming, automation and control, and many others. | 23 | * multimedia, streaming, automation and control, and many others. |
| 23 | * | 24 | * |
| 24 | * This variant (sched_attr) is meant at describing a so-called | 25 | * This variant (sched_attr) allows to define additional attributes to |
| 25 | * sporadic time-constrained task. In such model a task is specified by: | 26 | * improve the scheduler knowledge about task requirements. |
| 27 | * | ||
| 28 | * Scheduling Class Attributes | ||
| 29 | * =========================== | ||
| 30 | * | ||
| 31 | * A subset of sched_attr attributes specifies the | ||
| 32 | * scheduling policy and relative POSIX attributes: | ||
| 33 | * | ||
| 34 | * @size size of the structure, for fwd/bwd compat. | ||
| 35 | * | ||
| 36 | * @sched_policy task's scheduling policy | ||
| 37 | * @sched_nice task's nice value (SCHED_NORMAL/BATCH) | ||
| 38 | * @sched_priority task's static priority (SCHED_FIFO/RR) | ||
| 39 | * | ||
| 40 | * Certain more advanced scheduling features can be controlled by a | ||
| 41 | * predefined set of flags via the attribute: | ||
| 42 | * | ||
| 43 | * @sched_flags for customizing the scheduler behaviour | ||
| 44 | * | ||
| 45 | * Sporadic Time-Constrained Task Attributes | ||
| 46 | * ========================================= | ||
| 47 | * | ||
| 48 | * A subset of sched_attr attributes allows to describe a so-called | ||
| 49 | * sporadic time-constrained task. | ||
| 50 | * | ||
| 51 | * In such a model a task is specified by: | ||
| 26 | * - the activation period or minimum instance inter-arrival time; | 52 | * - the activation period or minimum instance inter-arrival time; |
| 27 | * - the maximum (or average, depending on the actual scheduling | 53 | * - the maximum (or average, depending on the actual scheduling |
| 28 | * discipline) computation time of all instances, a.k.a. runtime; | 54 | * discipline) computation time of all instances, a.k.a. runtime; |
| @@ -34,14 +60,8 @@ struct sched_param { | |||
| 34 | * than the runtime and must be completed by time instant t equal to | 60 | * than the runtime and must be completed by time instant t equal to |
| 35 | * the instance activation time + the deadline. | 61 | * the instance activation time + the deadline. |
| 36 | * | 62 | * |
| 37 | * This is reflected by the actual fields of the sched_attr structure: | 63 | * This is reflected by the following fields of the sched_attr structure: |
| 38 | * | 64 | * |
| 39 | * @size size of the structure, for fwd/bwd compat. | ||
| 40 | * | ||
| 41 | * @sched_policy task's scheduling policy | ||
| 42 | * @sched_flags for customizing the scheduler behaviour | ||
| 43 | * @sched_nice task's nice value (SCHED_NORMAL/BATCH) | ||
| 44 | * @sched_priority task's static priority (SCHED_FIFO/RR) | ||
| 45 | * @sched_deadline representative of the task's deadline | 65 | * @sched_deadline representative of the task's deadline |
| 46 | * @sched_runtime representative of the task's runtime | 66 | * @sched_runtime representative of the task's runtime |
| 47 | * @sched_period representative of the task's period | 67 | * @sched_period representative of the task's period |
| @@ -53,6 +73,29 @@ struct sched_param { | |||
| 53 | * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the | 73 | * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the |
| 54 | * only user of this new interface. More information about the algorithm | 74 | * only user of this new interface. More information about the algorithm |
| 55 | * available in the scheduling class file or in Documentation/. | 75 | * available in the scheduling class file or in Documentation/. |
| 76 | * | ||
| 77 | * Task Utilization Attributes | ||
| 78 | * =========================== | ||
| 79 | * | ||
| 80 | * A subset of sched_attr attributes allows to specify the utilization | ||
| 81 | * expected for a task. These attributes allow to inform the scheduler about | ||
| 82 | * the utilization boundaries within which it should schedule the task. These | ||
| 83 | * boundaries are valuable hints to support scheduler decisions on both task | ||
| 84 | * placement and frequency selection. | ||
| 85 | * | ||
| 86 | * @sched_util_min represents the minimum utilization | ||
| 87 | * @sched_util_max represents the maximum utilization | ||
| 88 | * | ||
| 89 | * Utilization is a value in the range [0..SCHED_CAPACITY_SCALE]. It | ||
| 90 | * represents the percentage of CPU time used by a task when running at the | ||
| 91 | * maximum frequency on the highest capacity CPU of the system. For example, a | ||
| 92 | * 20% utilization task is a task running for 2ms every 10ms at maximum | ||
| 93 | * frequency. | ||
| 94 | * | ||
| 95 | * A task with a min utilization value bigger than 0 is more likely scheduled | ||
| 96 | * on a CPU with a capacity big enough to fit the specified value. | ||
| 97 | * A task with a max utilization value smaller than 1024 is more likely | ||
| 98 | * scheduled on a CPU with no more capacity than the specified value. | ||
| 56 | */ | 99 | */ |
| 57 | struct sched_attr { | 100 | struct sched_attr { |
| 58 | __u32 size; | 101 | __u32 size; |
| @@ -70,6 +113,11 @@ struct sched_attr { | |||
| 70 | __u64 sched_runtime; | 113 | __u64 sched_runtime; |
| 71 | __u64 sched_deadline; | 114 | __u64 sched_deadline; |
| 72 | __u64 sched_period; | 115 | __u64 sched_period; |
| 116 | |||
| 117 | /* Utilization hints */ | ||
| 118 | __u32 sched_util_min; | ||
| 119 | __u32 sched_util_max; | ||
| 120 | |||
| 73 | }; | 121 | }; |
| 74 | 122 | ||
| 75 | #endif /* _UAPI_LINUX_SCHED_TYPES_H */ | 123 | #endif /* _UAPI_LINUX_SCHED_TYPES_H */ |
diff --git a/include/uapi/linux/sed-opal.h b/include/uapi/linux/sed-opal.h index 33e53b80cd1f..c6d035fa1b6c 100644 --- a/include/uapi/linux/sed-opal.h +++ b/include/uapi/linux/sed-opal.h | |||
| @@ -20,6 +20,11 @@ enum opal_mbr { | |||
| 20 | OPAL_MBR_DISABLE = 0x01, | 20 | OPAL_MBR_DISABLE = 0x01, |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | enum opal_mbr_done_flag { | ||
| 24 | OPAL_MBR_NOT_DONE = 0x0, | ||
| 25 | OPAL_MBR_DONE = 0x01 | ||
| 26 | }; | ||
| 27 | |||
| 23 | enum opal_user { | 28 | enum opal_user { |
| 24 | OPAL_ADMIN1 = 0x0, | 29 | OPAL_ADMIN1 = 0x0, |
| 25 | OPAL_USER1 = 0x01, | 30 | OPAL_USER1 = 0x01, |
| @@ -95,6 +100,19 @@ struct opal_mbr_data { | |||
| 95 | __u8 __align[7]; | 100 | __u8 __align[7]; |
| 96 | }; | 101 | }; |
| 97 | 102 | ||
| 103 | struct opal_mbr_done { | ||
| 104 | struct opal_key key; | ||
| 105 | __u8 done_flag; | ||
| 106 | __u8 __align[7]; | ||
| 107 | }; | ||
| 108 | |||
| 109 | struct opal_shadow_mbr { | ||
| 110 | struct opal_key key; | ||
| 111 | const __u64 data; | ||
| 112 | __u64 offset; | ||
| 113 | __u64 size; | ||
| 114 | }; | ||
| 115 | |||
| 98 | #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock) | 116 | #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock) |
| 99 | #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock) | 117 | #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock) |
| 100 | #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key) | 118 | #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key) |
| @@ -107,5 +125,8 @@ struct opal_mbr_data { | |||
| 107 | #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data) | 125 | #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data) |
| 108 | #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info) | 126 | #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info) |
| 109 | #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info) | 127 | #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info) |
| 128 | #define IOC_OPAL_PSID_REVERT_TPR _IOW('p', 232, struct opal_key) | ||
| 129 | #define IOC_OPAL_MBR_DONE _IOW('p', 233, struct opal_mbr_done) | ||
| 130 | #define IOC_OPAL_WRITE_SHADOW_MBR _IOW('p', 234, struct opal_shadow_mbr) | ||
| 110 | 131 | ||
| 111 | #endif /* _UAPI_SED_OPAL_H */ | 132 | #endif /* _UAPI_SED_OPAL_H */ |
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h index 67c4aaaa2308..5642c05e0da0 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h | |||
| @@ -129,7 +129,7 @@ | |||
| 129 | /* Motorola i.MX SoC */ | 129 | /* Motorola i.MX SoC */ |
| 130 | #define PORT_IMX 62 | 130 | #define PORT_IMX 62 |
| 131 | 131 | ||
| 132 | /* Marvell MPSC */ | 132 | /* Marvell MPSC (obsolete unused) */ |
| 133 | #define PORT_MPSC 63 | 133 | #define PORT_MPSC 63 |
| 134 | 134 | ||
| 135 | /* TXX9 type number */ | 135 | /* TXX9 type number */ |
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h index fd42c1316d3d..549a31c29f7d 100644 --- a/include/uapi/linux/snmp.h +++ b/include/uapi/linux/snmp.h | |||
| @@ -284,6 +284,7 @@ enum | |||
| 284 | LINUX_MIB_TCPZEROWINDOWDROP, /* TCPZeroWindowDrop */ | 284 | LINUX_MIB_TCPZEROWINDOWDROP, /* TCPZeroWindowDrop */ |
| 285 | LINUX_MIB_TCPRCVQDROP, /* TCPRcvQDrop */ | 285 | LINUX_MIB_TCPRCVQDROP, /* TCPRcvQDrop */ |
| 286 | LINUX_MIB_TCPWQUEUETOOBIG, /* TCPWqueueTooBig */ | 286 | LINUX_MIB_TCPWQUEUETOOBIG, /* TCPWqueueTooBig */ |
| 287 | LINUX_MIB_TCPFASTOPENPASSIVEALTKEY, /* TCPFastOpenPassiveAltKey */ | ||
| 287 | __LINUX_MIB_MAX | 288 | __LINUX_MIB_MAX |
| 288 | }; | 289 | }; |
| 289 | 290 | ||
diff --git a/include/uapi/linux/tc_act/tc_ct.h b/include/uapi/linux/tc_act/tc_ct.h new file mode 100644 index 000000000000..5fb1d7ac1027 --- /dev/null +++ b/include/uapi/linux/tc_act/tc_ct.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | #ifndef __UAPI_TC_CT_H | ||
| 3 | #define __UAPI_TC_CT_H | ||
| 4 | |||
| 5 | #include <linux/types.h> | ||
| 6 | #include <linux/pkt_cls.h> | ||
| 7 | |||
| 8 | enum { | ||
| 9 | TCA_CT_UNSPEC, | ||
| 10 | TCA_CT_PARMS, | ||
| 11 | TCA_CT_TM, | ||
| 12 | TCA_CT_ACTION, /* u16 */ | ||
| 13 | TCA_CT_ZONE, /* u16 */ | ||
| 14 | TCA_CT_MARK, /* u32 */ | ||
| 15 | TCA_CT_MARK_MASK, /* u32 */ | ||
| 16 | TCA_CT_LABELS, /* u128 */ | ||
| 17 | TCA_CT_LABELS_MASK, /* u128 */ | ||
| 18 | TCA_CT_NAT_IPV4_MIN, /* be32 */ | ||
| 19 | TCA_CT_NAT_IPV4_MAX, /* be32 */ | ||
| 20 | TCA_CT_NAT_IPV6_MIN, /* struct in6_addr */ | ||
| 21 | TCA_CT_NAT_IPV6_MAX, /* struct in6_addr */ | ||
| 22 | TCA_CT_NAT_PORT_MIN, /* be16 */ | ||
| 23 | TCA_CT_NAT_PORT_MAX, /* be16 */ | ||
| 24 | TCA_CT_PAD, | ||
| 25 | __TCA_CT_MAX | ||
| 26 | }; | ||
| 27 | |||
| 28 | #define TCA_CT_MAX (__TCA_CT_MAX - 1) | ||
| 29 | |||
| 30 | #define TCA_CT_ACT_COMMIT (1 << 0) | ||
| 31 | #define TCA_CT_ACT_FORCE (1 << 1) | ||
| 32 | #define TCA_CT_ACT_CLEAR (1 << 2) | ||
| 33 | #define TCA_CT_ACT_NAT (1 << 3) | ||
| 34 | #define TCA_CT_ACT_NAT_SRC (1 << 4) | ||
| 35 | #define TCA_CT_ACT_NAT_DST (1 << 5) | ||
| 36 | |||
| 37 | struct tc_ct { | ||
| 38 | tc_gen; | ||
| 39 | }; | ||
| 40 | |||
| 41 | #endif /* __UAPI_TC_CT_H */ | ||
diff --git a/include/uapi/linux/tc_act/tc_ctinfo.h b/include/uapi/linux/tc_act/tc_ctinfo.h new file mode 100644 index 000000000000..f5f26d95d0e7 --- /dev/null +++ b/include/uapi/linux/tc_act/tc_ctinfo.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | #ifndef __UAPI_TC_CTINFO_H | ||
| 3 | #define __UAPI_TC_CTINFO_H | ||
| 4 | |||
| 5 | #include <linux/types.h> | ||
| 6 | #include <linux/pkt_cls.h> | ||
| 7 | |||
| 8 | struct tc_ctinfo { | ||
| 9 | tc_gen; | ||
| 10 | }; | ||
| 11 | |||
| 12 | enum { | ||
| 13 | TCA_CTINFO_UNSPEC, | ||
| 14 | TCA_CTINFO_PAD, | ||
| 15 | TCA_CTINFO_TM, | ||
| 16 | TCA_CTINFO_ACT, | ||
| 17 | TCA_CTINFO_ZONE, | ||
| 18 | TCA_CTINFO_PARMS_DSCP_MASK, | ||
| 19 | TCA_CTINFO_PARMS_DSCP_STATEMASK, | ||
| 20 | TCA_CTINFO_PARMS_CPMARK_MASK, | ||
| 21 | TCA_CTINFO_STATS_DSCP_SET, | ||
| 22 | TCA_CTINFO_STATS_DSCP_ERROR, | ||
| 23 | TCA_CTINFO_STATS_CPMARK_SET, | ||
| 24 | __TCA_CTINFO_MAX | ||
| 25 | }; | ||
| 26 | |||
| 27 | #define TCA_CTINFO_MAX (__TCA_CTINFO_MAX - 1) | ||
| 28 | |||
| 29 | #endif | ||
diff --git a/include/uapi/linux/tc_act/tc_mpls.h b/include/uapi/linux/tc_act/tc_mpls.h new file mode 100644 index 000000000000..9360e95273c7 --- /dev/null +++ b/include/uapi/linux/tc_act/tc_mpls.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* Copyright (C) 2019 Netronome Systems, Inc. */ | ||
| 3 | |||
| 4 | #ifndef __LINUX_TC_MPLS_H | ||
| 5 | #define __LINUX_TC_MPLS_H | ||
| 6 | |||
| 7 | #include <linux/pkt_cls.h> | ||
| 8 | |||
| 9 | #define TCA_MPLS_ACT_POP 1 | ||
| 10 | #define TCA_MPLS_ACT_PUSH 2 | ||
| 11 | #define TCA_MPLS_ACT_MODIFY 3 | ||
| 12 | #define TCA_MPLS_ACT_DEC_TTL 4 | ||
| 13 | |||
| 14 | struct tc_mpls { | ||
| 15 | tc_gen; /* generic TC action fields. */ | ||
| 16 | int m_action; /* action of type TCA_MPLS_ACT_*. */ | ||
| 17 | }; | ||
| 18 | |||
| 19 | enum { | ||
| 20 | TCA_MPLS_UNSPEC, | ||
| 21 | TCA_MPLS_TM, /* struct tcf_t; time values associated with action. */ | ||
| 22 | TCA_MPLS_PARMS, /* struct tc_mpls; action type and general TC fields. */ | ||
| 23 | TCA_MPLS_PAD, | ||
| 24 | TCA_MPLS_PROTO, /* be16; eth_type of pushed or next (for pop) header. */ | ||
| 25 | TCA_MPLS_LABEL, /* u32; MPLS label. Lower 20 bits are used. */ | ||
| 26 | TCA_MPLS_TC, /* u8; MPLS TC field. Lower 3 bits are used. */ | ||
| 27 | TCA_MPLS_TTL, /* u8; MPLS TTL field. Must not be 0. */ | ||
| 28 | TCA_MPLS_BOS, /* u8; MPLS BOS field. Either 1 or 0. */ | ||
| 29 | __TCA_MPLS_MAX, | ||
| 30 | }; | ||
| 31 | #define TCA_MPLS_MAX (__TCA_MPLS_MAX - 1) | ||
| 32 | |||
| 33 | #endif | ||
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h index b521464ea962..b3564f85a762 100644 --- a/include/uapi/linux/tcp.h +++ b/include/uapi/linux/tcp.h | |||
| @@ -127,6 +127,9 @@ enum { | |||
| 127 | 127 | ||
| 128 | #define TCP_CM_INQ TCP_INQ | 128 | #define TCP_CM_INQ TCP_INQ |
| 129 | 129 | ||
| 130 | #define TCP_TX_DELAY 37 /* delay outgoing packets by XX usec */ | ||
| 131 | |||
| 132 | |||
| 130 | #define TCP_REPAIR_ON 1 | 133 | #define TCP_REPAIR_ON 1 |
| 131 | #define TCP_REPAIR_OFF 0 | 134 | #define TCP_REPAIR_OFF 0 |
| 132 | #define TCP_REPAIR_OFF_NO_WP -1 /* Turn off without window probes */ | 135 | #define TCP_REPAIR_OFF_NO_WP -1 /* Turn off without window probes */ |
diff --git a/include/uapi/linux/unix_diag.h b/include/uapi/linux/unix_diag.h index 5c502fdf7a42..a1988576fa8a 100644 --- a/include/uapi/linux/unix_diag.h +++ b/include/uapi/linux/unix_diag.h | |||
| @@ -20,6 +20,7 @@ struct unix_diag_req { | |||
| 20 | #define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ | 20 | #define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ |
| 21 | #define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ | 21 | #define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ |
| 22 | #define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */ | 22 | #define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */ |
| 23 | #define UDIAG_SHOW_UID 0x00000040 /* show socket's UID */ | ||
| 23 | 24 | ||
| 24 | struct unix_diag_msg { | 25 | struct unix_diag_msg { |
| 25 | __u8 udiag_family; | 26 | __u8 udiag_family; |
| @@ -40,6 +41,7 @@ enum { | |||
| 40 | UNIX_DIAG_RQLEN, | 41 | UNIX_DIAG_RQLEN, |
| 41 | UNIX_DIAG_MEMINFO, | 42 | UNIX_DIAG_MEMINFO, |
| 42 | UNIX_DIAG_SHUTDOWN, | 43 | UNIX_DIAG_SHUTDOWN, |
| 44 | UNIX_DIAG_UID, | ||
| 43 | 45 | ||
| 44 | __UNIX_DIAG_MAX, | 46 | __UNIX_DIAG_MAX, |
| 45 | }; | 47 | }; |
diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h index ddc5396800aa..76b7c3f6cd0d 100644 --- a/include/uapi/linux/usb/audio.h +++ b/include/uapi/linux/usb/audio.h | |||
| @@ -450,6 +450,43 @@ static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_desc | |||
| 450 | } | 450 | } |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | /* | ||
| 454 | * Extension Unit (XU) has almost compatible layout with Processing Unit, but | ||
| 455 | * on UAC2, it has a different bmControls size (bControlSize); it's 1 byte for | ||
| 456 | * XU while 2 bytes for PU. The last iExtension field is a one-byte index as | ||
| 457 | * well as iProcessing field of PU. | ||
| 458 | */ | ||
| 459 | static inline __u8 uac_extension_unit_bControlSize(struct uac_processing_unit_descriptor *desc, | ||
| 460 | int protocol) | ||
| 461 | { | ||
| 462 | switch (protocol) { | ||
| 463 | case UAC_VERSION_1: | ||
| 464 | return desc->baSourceID[desc->bNrInPins + 4]; | ||
| 465 | case UAC_VERSION_2: | ||
| 466 | return 1; /* in UAC2, this value is constant */ | ||
| 467 | case UAC_VERSION_3: | ||
| 468 | return 4; /* in UAC3, this value is constant */ | ||
| 469 | default: | ||
| 470 | return 1; | ||
| 471 | } | ||
| 472 | } | ||
| 473 | |||
| 474 | static inline __u8 uac_extension_unit_iExtension(struct uac_processing_unit_descriptor *desc, | ||
| 475 | int protocol) | ||
| 476 | { | ||
| 477 | __u8 control_size = uac_extension_unit_bControlSize(desc, protocol); | ||
| 478 | |||
| 479 | switch (protocol) { | ||
| 480 | case UAC_VERSION_1: | ||
| 481 | case UAC_VERSION_2: | ||
| 482 | default: | ||
| 483 | return *(uac_processing_unit_bmControls(desc, protocol) | ||
| 484 | + control_size); | ||
| 485 | case UAC_VERSION_3: | ||
| 486 | return 0; /* UAC3 does not have this field */ | ||
| 487 | } | ||
| 488 | } | ||
| 489 | |||
| 453 | /* 4.5.2 Class-Specific AS Interface Descriptor */ | 490 | /* 4.5.2 Class-Specific AS Interface Descriptor */ |
| 454 | struct uac1_as_header_descriptor { | 491 | struct uac1_as_header_descriptor { |
| 455 | __u8 bLength; /* in bytes: 7 */ | 492 | __u8 bLength; /* in bytes: 7 */ |
diff --git a/include/uapi/linux/usbdevice_fs.h b/include/uapi/linux/usbdevice_fs.h index 964e87217be4..78efe870c2b7 100644 --- a/include/uapi/linux/usbdevice_fs.h +++ b/include/uapi/linux/usbdevice_fs.h | |||
| @@ -76,6 +76,26 @@ struct usbdevfs_connectinfo { | |||
| 76 | unsigned char slow; | 76 | unsigned char slow; |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | struct usbdevfs_conninfo_ex { | ||
| 80 | __u32 size; /* Size of the structure from the kernel's */ | ||
| 81 | /* point of view. Can be used by userspace */ | ||
| 82 | /* to determine how much data can be */ | ||
| 83 | /* used/trusted. */ | ||
| 84 | __u32 busnum; /* USB bus number, as enumerated by the */ | ||
| 85 | /* kernel, the device is connected to. */ | ||
| 86 | __u32 devnum; /* Device address on the bus. */ | ||
| 87 | __u32 speed; /* USB_SPEED_* constants from ch9.h */ | ||
| 88 | __u8 num_ports; /* Number of ports the device is connected */ | ||
| 89 | /* to on the way to the root hub. It may */ | ||
| 90 | /* be bigger than size of 'ports' array so */ | ||
| 91 | /* userspace can detect overflows. */ | ||
| 92 | __u8 ports[7]; /* List of ports on the way from the root */ | ||
| 93 | /* hub to the device. Current limit in */ | ||
| 94 | /* USB specification is 7 tiers (root hub, */ | ||
| 95 | /* 5 intermediate hubs, device), which */ | ||
| 96 | /* gives at most 6 port entries. */ | ||
| 97 | }; | ||
| 98 | |||
| 79 | #define USBDEVFS_URB_SHORT_NOT_OK 0x01 | 99 | #define USBDEVFS_URB_SHORT_NOT_OK 0x01 |
| 80 | #define USBDEVFS_URB_ISO_ASAP 0x02 | 100 | #define USBDEVFS_URB_ISO_ASAP 0x02 |
| 81 | #define USBDEVFS_URB_BULK_CONTINUATION 0x04 | 101 | #define USBDEVFS_URB_BULK_CONTINUATION 0x04 |
| @@ -137,6 +157,7 @@ struct usbdevfs_hub_portinfo { | |||
| 137 | #define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10 | 157 | #define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10 |
| 138 | #define USBDEVFS_CAP_MMAP 0x20 | 158 | #define USBDEVFS_CAP_MMAP 0x20 |
| 139 | #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40 | 159 | #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40 |
| 160 | #define USBDEVFS_CAP_CONNINFO_EX 0x80 | ||
| 140 | 161 | ||
| 141 | /* USBDEVFS_DISCONNECT_CLAIM flags & struct */ | 162 | /* USBDEVFS_DISCONNECT_CLAIM flags & struct */ |
| 142 | 163 | ||
| @@ -197,5 +218,10 @@ struct usbdevfs_streams { | |||
| 197 | #define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams) | 218 | #define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams) |
| 198 | #define USBDEVFS_DROP_PRIVILEGES _IOW('U', 30, __u32) | 219 | #define USBDEVFS_DROP_PRIVILEGES _IOW('U', 30, __u32) |
| 199 | #define USBDEVFS_GET_SPEED _IO('U', 31) | 220 | #define USBDEVFS_GET_SPEED _IO('U', 31) |
| 221 | /* | ||
| 222 | * Returns struct usbdevfs_conninfo_ex; length is variable to allow | ||
| 223 | * extending size of the data returned. | ||
| 224 | */ | ||
| 225 | #define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len) | ||
| 200 | 226 | ||
| 201 | #endif /* _UAPI_LINUX_USBDEVICE_FS_H */ | 227 | #endif /* _UAPI_LINUX_USBDEVICE_FS_H */ |
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 37807f23231e..a2669b79b294 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h | |||
| @@ -392,8 +392,13 @@ enum v4l2_mpeg_video_header_mode { | |||
| 392 | #define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221) | 392 | #define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221) |
| 393 | enum v4l2_mpeg_video_multi_slice_mode { | 393 | enum v4l2_mpeg_video_multi_slice_mode { |
| 394 | V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0, | 394 | V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0, |
| 395 | V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB = 1, | ||
| 396 | V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES = 2, | ||
| 397 | #ifndef __KERNEL__ | ||
| 398 | /* Kept for backwards compatibility reasons. Stupid typo... */ | ||
| 395 | V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1, | 399 | V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1, |
| 396 | V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, | 400 | V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, |
| 401 | #endif | ||
| 397 | }; | 402 | }; |
| 398 | #define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) | 403 | #define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) |
| 399 | #define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223) | 404 | #define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223) |
| @@ -404,6 +409,24 @@ enum v4l2_mpeg_video_multi_slice_mode { | |||
| 404 | #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228) | 409 | #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228) |
| 405 | #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229) | 410 | #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229) |
| 406 | 411 | ||
| 412 | /* CIDs for the MPEG-2 Part 2 (H.262) codec */ | ||
| 413 | #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_MPEG_BASE+270) | ||
| 414 | enum v4l2_mpeg_video_mpeg2_level { | ||
| 415 | V4L2_MPEG_VIDEO_MPEG2_LEVEL_LOW = 0, | ||
| 416 | V4L2_MPEG_VIDEO_MPEG2_LEVEL_MAIN = 1, | ||
| 417 | V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH_1440 = 2, | ||
| 418 | V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH = 3, | ||
| 419 | }; | ||
| 420 | #define V4L2_CID_MPEG_VIDEO_MPEG2_PROFILE (V4L2_CID_MPEG_BASE+271) | ||
| 421 | enum v4l2_mpeg_video_mpeg2_profile { | ||
| 422 | V4L2_MPEG_VIDEO_MPEG2_PROFILE_SIMPLE = 0, | ||
| 423 | V4L2_MPEG_VIDEO_MPEG2_PROFILE_MAIN = 1, | ||
| 424 | V4L2_MPEG_VIDEO_MPEG2_PROFILE_SNR_SCALABLE = 2, | ||
| 425 | V4L2_MPEG_VIDEO_MPEG2_PROFILE_SPATIALLY_SCALABLE = 3, | ||
| 426 | V4L2_MPEG_VIDEO_MPEG2_PROFILE_HIGH = 4, | ||
| 427 | V4L2_MPEG_VIDEO_MPEG2_PROFILE_MULTIVIEW = 5, | ||
| 428 | }; | ||
| 429 | |||
| 407 | /* CIDs for the FWHT codec as used by the vicodec driver. */ | 430 | /* CIDs for the FWHT codec as used by the vicodec driver. */ |
| 408 | #define V4L2_CID_FWHT_I_FRAME_QP (V4L2_CID_MPEG_BASE + 290) | 431 | #define V4L2_CID_FWHT_I_FRAME_QP (V4L2_CID_MPEG_BASE + 290) |
| 409 | #define V4L2_CID_FWHT_P_FRAME_QP (V4L2_CID_MPEG_BASE + 291) | 432 | #define V4L2_CID_FWHT_P_FRAME_QP (V4L2_CID_MPEG_BASE + 291) |
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 1050a75fb7ef..9d9705ceda76 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h | |||
| @@ -80,7 +80,7 @@ | |||
| 80 | /* Four-character-code (FOURCC) */ | 80 | /* Four-character-code (FOURCC) */ |
| 81 | #define v4l2_fourcc(a, b, c, d)\ | 81 | #define v4l2_fourcc(a, b, c, d)\ |
| 82 | ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) | 82 | ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) |
| 83 | #define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1 << 31)) | 83 | #define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1U << 31)) |
| 84 | 84 | ||
| 85 | /* | 85 | /* |
| 86 | * E N U M S | 86 | * E N U M S |
diff --git a/include/uapi/linux/wanrouter.h b/include/uapi/linux/wanrouter.h deleted file mode 100644 index 2f1216d00caa..000000000000 --- a/include/uapi/linux/wanrouter.h +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* | ||
| 3 | * wanrouter.h Legacy declarations kept around until X25 is removed | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef _UAPI_ROUTER_H | ||
| 7 | #define _UAPI_ROUTER_H | ||
| 8 | |||
| 9 | /* 'state' defines */ | ||
| 10 | enum wan_states | ||
| 11 | { | ||
| 12 | WAN_UNCONFIGURED, /* link/channel is not configured */ | ||
| 13 | WAN_DISCONNECTED, /* link/channel is disconnected */ | ||
| 14 | WAN_CONNECTING, /* connection is in progress */ | ||
| 15 | WAN_CONNECTED /* link/channel is operational */ | ||
| 16 | }; | ||
| 17 | |||
| 18 | #endif /* _UAPI_ROUTER_H */ | ||
diff --git a/include/uapi/misc/habanalabs.h b/include/uapi/misc/habanalabs.h index 204ab9b4ae67..3956c226ca35 100644 --- a/include/uapi/misc/habanalabs.h +++ b/include/uapi/misc/habanalabs.h | |||
| @@ -45,6 +45,30 @@ enum goya_queue_id { | |||
| 45 | GOYA_QUEUE_ID_SIZE | 45 | GOYA_QUEUE_ID_SIZE |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | /* | ||
| 49 | * Engine Numbering | ||
| 50 | * | ||
| 51 | * Used in the "busy_engines_mask" field in `struct hl_info_hw_idle' | ||
| 52 | */ | ||
| 53 | |||
| 54 | enum goya_engine_id { | ||
| 55 | GOYA_ENGINE_ID_DMA_0 = 0, | ||
| 56 | GOYA_ENGINE_ID_DMA_1, | ||
| 57 | GOYA_ENGINE_ID_DMA_2, | ||
| 58 | GOYA_ENGINE_ID_DMA_3, | ||
| 59 | GOYA_ENGINE_ID_DMA_4, | ||
| 60 | GOYA_ENGINE_ID_MME_0, | ||
| 61 | GOYA_ENGINE_ID_TPC_0, | ||
| 62 | GOYA_ENGINE_ID_TPC_1, | ||
| 63 | GOYA_ENGINE_ID_TPC_2, | ||
| 64 | GOYA_ENGINE_ID_TPC_3, | ||
| 65 | GOYA_ENGINE_ID_TPC_4, | ||
| 66 | GOYA_ENGINE_ID_TPC_5, | ||
| 67 | GOYA_ENGINE_ID_TPC_6, | ||
| 68 | GOYA_ENGINE_ID_TPC_7, | ||
| 69 | GOYA_ENGINE_ID_SIZE | ||
| 70 | }; | ||
| 71 | |||
| 48 | enum hl_device_status { | 72 | enum hl_device_status { |
| 49 | HL_DEVICE_STATUS_OPERATIONAL, | 73 | HL_DEVICE_STATUS_OPERATIONAL, |
| 50 | HL_DEVICE_STATUS_IN_RESET, | 74 | HL_DEVICE_STATUS_IN_RESET, |
| @@ -86,7 +110,11 @@ struct hl_info_dram_usage { | |||
| 86 | 110 | ||
| 87 | struct hl_info_hw_idle { | 111 | struct hl_info_hw_idle { |
| 88 | __u32 is_idle; | 112 | __u32 is_idle; |
| 89 | __u32 pad; | 113 | /* |
| 114 | * Bitmask of busy engines. | ||
| 115 | * Bits definition is according to `enum <chip>_enging_id'. | ||
| 116 | */ | ||
| 117 | __u32 busy_engines_mask; | ||
| 90 | }; | 118 | }; |
| 91 | 119 | ||
| 92 | struct hl_info_device_status { | 120 | struct hl_info_device_status { |
diff --git a/include/uapi/misc/ocxl.h b/include/uapi/misc/ocxl.h index 97937cfa3baa..6d29a60a896a 100644 --- a/include/uapi/misc/ocxl.h +++ b/include/uapi/misc/ocxl.h | |||
| @@ -33,23 +33,23 @@ struct ocxl_ioctl_attach { | |||
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | struct ocxl_ioctl_metadata { | 35 | struct ocxl_ioctl_metadata { |
| 36 | __u16 version; // struct version, always backwards compatible | 36 | __u16 version; /* struct version, always backwards compatible */ |
| 37 | 37 | ||
| 38 | // Version 0 fields | 38 | /* Version 0 fields */ |
| 39 | __u8 afu_version_major; | 39 | __u8 afu_version_major; |
| 40 | __u8 afu_version_minor; | 40 | __u8 afu_version_minor; |
| 41 | __u32 pasid; // PASID assigned to the current context | 41 | __u32 pasid; /* PASID assigned to the current context */ |
| 42 | 42 | ||
| 43 | __u64 pp_mmio_size; // Per PASID MMIO size | 43 | __u64 pp_mmio_size; /* Per PASID MMIO size */ |
| 44 | __u64 global_mmio_size; | 44 | __u64 global_mmio_size; |
| 45 | 45 | ||
| 46 | // End version 0 fields | 46 | /* End version 0 fields */ |
| 47 | 47 | ||
| 48 | __u64 reserved[13]; // Total of 16*u64 | 48 | __u64 reserved[13]; /* Total of 16*u64 */ |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | struct ocxl_ioctl_p9_wait { | 51 | struct ocxl_ioctl_p9_wait { |
| 52 | __u16 thread_id; // The thread ID required to wake this thread | 52 | __u16 thread_id; /* The thread ID required to wake this thread */ |
| 53 | __u16 reserved1; | 53 | __u16 reserved1; |
| 54 | __u32 reserved2; | 54 | __u32 reserved2; |
| 55 | __u64 reserved3[3]; | 55 | __u64 reserved3[3]; |
diff --git a/include/uapi/mtd/mtd-abi.h b/include/uapi/mtd/mtd-abi.h index aff5b5e59845..47ffe3208c27 100644 --- a/include/uapi/mtd/mtd-abi.h +++ b/include/uapi/mtd/mtd-abi.h | |||
| @@ -113,11 +113,11 @@ struct mtd_write_req { | |||
| 113 | #define MTD_CAP_NVRAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) | 113 | #define MTD_CAP_NVRAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) |
| 114 | 114 | ||
| 115 | /* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */ | 115 | /* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */ |
| 116 | #define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended) | 116 | #define MTD_NANDECC_OFF 0 /* Switch off ECC (Not recommended) */ |
| 117 | #define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode) | 117 | #define MTD_NANDECC_PLACE 1 /* Use the given placement in the structure (YAFFS1 legacy mode) */ |
| 118 | #define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme | 118 | #define MTD_NANDECC_AUTOPLACE 2 /* Use the default placement scheme */ |
| 119 | #define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read) | 119 | #define MTD_NANDECC_PLACEONLY 3 /* Use the given placement in the structure (Do not store ecc result on read) */ |
| 120 | #define MTD_NANDECC_AUTOPL_USR 4 // Use the given autoplacement scheme rather than using the default | 120 | #define MTD_NANDECC_AUTOPL_USR 4 /* Use the given autoplacement scheme rather than using the default */ |
| 121 | 121 | ||
| 122 | /* OTP mode selection */ | 122 | /* OTP mode selection */ |
| 123 | #define MTD_OTP_OFF 0 | 123 | #define MTD_OTP_OFF 0 |
diff --git a/include/uapi/rdma/ib_user_cm.h b/include/uapi/rdma/ib_user_cm.h deleted file mode 100644 index e2709bb8cb18..000000000000 --- a/include/uapi/rdma/ib_user_cm.h +++ /dev/null | |||
| @@ -1,326 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2005 Topspin Communications. All rights reserved. | ||
| 4 | * Copyright (c) 2005 Intel Corporation. All rights reserved. | ||
| 5 | * | ||
| 6 | * This software is available to you under a choice of one of two | ||
| 7 | * licenses. You may choose to be licensed under the terms of the GNU | ||
| 8 | * General Public License (GPL) Version 2, available from the file | ||
| 9 | * COPYING in the main directory of this source tree, or the | ||
| 10 | * OpenIB.org BSD license below: | ||
| 11 | * | ||
| 12 | * Redistribution and use in source and binary forms, with or | ||
| 13 | * without modification, are permitted provided that the following | ||
| 14 | * conditions are met: | ||
| 15 | * | ||
| 16 | * - Redistributions of source code must retain the above | ||
| 17 | * copyright notice, this list of conditions and the following | ||
| 18 | * disclaimer. | ||
| 19 | * | ||
| 20 | * - Redistributions in binary form must reproduce the above | ||
| 21 | * copyright notice, this list of conditions and the following | ||
| 22 | * disclaimer in the documentation and/or other materials | ||
| 23 | * provided with the distribution. | ||
| 24 | * | ||
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 32 | * SOFTWARE. | ||
| 33 | */ | ||
| 34 | |||
| 35 | #ifndef IB_USER_CM_H | ||
| 36 | #define IB_USER_CM_H | ||
| 37 | |||
| 38 | #include <linux/types.h> | ||
| 39 | #include <rdma/ib_user_sa.h> | ||
| 40 | |||
| 41 | #define IB_USER_CM_ABI_VERSION 5 | ||
| 42 | |||
| 43 | enum { | ||
| 44 | IB_USER_CM_CMD_CREATE_ID, | ||
| 45 | IB_USER_CM_CMD_DESTROY_ID, | ||
| 46 | IB_USER_CM_CMD_ATTR_ID, | ||
| 47 | |||
| 48 | IB_USER_CM_CMD_LISTEN, | ||
| 49 | IB_USER_CM_CMD_NOTIFY, | ||
| 50 | |||
| 51 | IB_USER_CM_CMD_SEND_REQ, | ||
| 52 | IB_USER_CM_CMD_SEND_REP, | ||
| 53 | IB_USER_CM_CMD_SEND_RTU, | ||
| 54 | IB_USER_CM_CMD_SEND_DREQ, | ||
| 55 | IB_USER_CM_CMD_SEND_DREP, | ||
| 56 | IB_USER_CM_CMD_SEND_REJ, | ||
| 57 | IB_USER_CM_CMD_SEND_MRA, | ||
| 58 | IB_USER_CM_CMD_SEND_LAP, | ||
| 59 | IB_USER_CM_CMD_SEND_APR, | ||
| 60 | IB_USER_CM_CMD_SEND_SIDR_REQ, | ||
| 61 | IB_USER_CM_CMD_SEND_SIDR_REP, | ||
| 62 | |||
| 63 | IB_USER_CM_CMD_EVENT, | ||
| 64 | IB_USER_CM_CMD_INIT_QP_ATTR, | ||
| 65 | }; | ||
| 66 | /* | ||
| 67 | * command ABI structures. | ||
| 68 | */ | ||
| 69 | struct ib_ucm_cmd_hdr { | ||
| 70 | __u32 cmd; | ||
| 71 | __u16 in; | ||
| 72 | __u16 out; | ||
| 73 | }; | ||
| 74 | |||
| 75 | struct ib_ucm_create_id { | ||
| 76 | __aligned_u64 uid; | ||
| 77 | __aligned_u64 response; | ||
| 78 | }; | ||
| 79 | |||
| 80 | struct ib_ucm_create_id_resp { | ||
| 81 | __u32 id; | ||
| 82 | }; | ||
| 83 | |||
| 84 | struct ib_ucm_destroy_id { | ||
| 85 | __aligned_u64 response; | ||
| 86 | __u32 id; | ||
| 87 | __u32 reserved; | ||
| 88 | }; | ||
| 89 | |||
| 90 | struct ib_ucm_destroy_id_resp { | ||
| 91 | __u32 events_reported; | ||
| 92 | }; | ||
| 93 | |||
| 94 | struct ib_ucm_attr_id { | ||
| 95 | __aligned_u64 response; | ||
| 96 | __u32 id; | ||
| 97 | __u32 reserved; | ||
| 98 | }; | ||
| 99 | |||
| 100 | struct ib_ucm_attr_id_resp { | ||
| 101 | __be64 service_id; | ||
| 102 | __be64 service_mask; | ||
| 103 | __be32 local_id; | ||
| 104 | __be32 remote_id; | ||
| 105 | }; | ||
| 106 | |||
| 107 | struct ib_ucm_init_qp_attr { | ||
| 108 | __aligned_u64 response; | ||
| 109 | __u32 id; | ||
| 110 | __u32 qp_state; | ||
| 111 | }; | ||
| 112 | |||
| 113 | struct ib_ucm_listen { | ||
| 114 | __be64 service_id; | ||
| 115 | __be64 service_mask; | ||
| 116 | __u32 id; | ||
| 117 | __u32 reserved; | ||
| 118 | }; | ||
| 119 | |||
| 120 | struct ib_ucm_notify { | ||
| 121 | __u32 id; | ||
| 122 | __u32 event; | ||
| 123 | }; | ||
| 124 | |||
| 125 | struct ib_ucm_private_data { | ||
| 126 | __aligned_u64 data; | ||
| 127 | __u32 id; | ||
| 128 | __u8 len; | ||
| 129 | __u8 reserved[3]; | ||
| 130 | }; | ||
| 131 | |||
| 132 | struct ib_ucm_req { | ||
| 133 | __u32 id; | ||
| 134 | __u32 qpn; | ||
| 135 | __u32 qp_type; | ||
| 136 | __u32 psn; | ||
| 137 | __be64 sid; | ||
| 138 | __aligned_u64 data; | ||
| 139 | __aligned_u64 primary_path; | ||
| 140 | __aligned_u64 alternate_path; | ||
| 141 | __u8 len; | ||
| 142 | __u8 peer_to_peer; | ||
| 143 | __u8 responder_resources; | ||
| 144 | __u8 initiator_depth; | ||
| 145 | __u8 remote_cm_response_timeout; | ||
| 146 | __u8 flow_control; | ||
| 147 | __u8 local_cm_response_timeout; | ||
| 148 | __u8 retry_count; | ||
| 149 | __u8 rnr_retry_count; | ||
| 150 | __u8 max_cm_retries; | ||
| 151 | __u8 srq; | ||
| 152 | __u8 reserved[5]; | ||
| 153 | }; | ||
| 154 | |||
| 155 | struct ib_ucm_rep { | ||
| 156 | __aligned_u64 uid; | ||
| 157 | __aligned_u64 data; | ||
| 158 | __u32 id; | ||
| 159 | __u32 qpn; | ||
| 160 | __u32 psn; | ||
| 161 | __u8 len; | ||
| 162 | __u8 responder_resources; | ||
| 163 | __u8 initiator_depth; | ||
| 164 | __u8 target_ack_delay; | ||
| 165 | __u8 failover_accepted; | ||
| 166 | __u8 flow_control; | ||
| 167 | __u8 rnr_retry_count; | ||
| 168 | __u8 srq; | ||
| 169 | __u8 reserved[4]; | ||
| 170 | }; | ||
| 171 | |||
| 172 | struct ib_ucm_info { | ||
| 173 | __u32 id; | ||
| 174 | __u32 status; | ||
| 175 | __aligned_u64 info; | ||
| 176 | __aligned_u64 data; | ||
| 177 | __u8 info_len; | ||
| 178 | __u8 data_len; | ||
| 179 | __u8 reserved[6]; | ||
| 180 | }; | ||
| 181 | |||
| 182 | struct ib_ucm_mra { | ||
| 183 | __aligned_u64 data; | ||
| 184 | __u32 id; | ||
| 185 | __u8 len; | ||
| 186 | __u8 timeout; | ||
| 187 | __u8 reserved[2]; | ||
| 188 | }; | ||
| 189 | |||
| 190 | struct ib_ucm_lap { | ||
| 191 | __aligned_u64 path; | ||
| 192 | __aligned_u64 data; | ||
| 193 | __u32 id; | ||
| 194 | __u8 len; | ||
| 195 | __u8 reserved[3]; | ||
| 196 | }; | ||
| 197 | |||
| 198 | struct ib_ucm_sidr_req { | ||
| 199 | __u32 id; | ||
| 200 | __u32 timeout; | ||
| 201 | __be64 sid; | ||
| 202 | __aligned_u64 data; | ||
| 203 | __aligned_u64 path; | ||
| 204 | __u16 reserved_pkey; | ||
| 205 | __u8 len; | ||
| 206 | __u8 max_cm_retries; | ||
| 207 | __u8 reserved[4]; | ||
| 208 | }; | ||
| 209 | |||
| 210 | struct ib_ucm_sidr_rep { | ||
| 211 | __u32 id; | ||
| 212 | __u32 qpn; | ||
| 213 | __u32 qkey; | ||
| 214 | __u32 status; | ||
| 215 | __aligned_u64 info; | ||
| 216 | __aligned_u64 data; | ||
| 217 | __u8 info_len; | ||
| 218 | __u8 data_len; | ||
| 219 | __u8 reserved[6]; | ||
| 220 | }; | ||
| 221 | /* | ||
| 222 | * event notification ABI structures. | ||
| 223 | */ | ||
| 224 | struct ib_ucm_event_get { | ||
| 225 | __aligned_u64 response; | ||
| 226 | __aligned_u64 data; | ||
| 227 | __aligned_u64 info; | ||
| 228 | __u8 data_len; | ||
| 229 | __u8 info_len; | ||
| 230 | __u8 reserved[6]; | ||
| 231 | }; | ||
| 232 | |||
| 233 | struct ib_ucm_req_event_resp { | ||
| 234 | struct ib_user_path_rec primary_path; | ||
| 235 | struct ib_user_path_rec alternate_path; | ||
| 236 | __be64 remote_ca_guid; | ||
| 237 | __u32 remote_qkey; | ||
| 238 | __u32 remote_qpn; | ||
| 239 | __u32 qp_type; | ||
| 240 | __u32 starting_psn; | ||
| 241 | __u8 responder_resources; | ||
| 242 | __u8 initiator_depth; | ||
| 243 | __u8 local_cm_response_timeout; | ||
| 244 | __u8 flow_control; | ||
| 245 | __u8 remote_cm_response_timeout; | ||
| 246 | __u8 retry_count; | ||
| 247 | __u8 rnr_retry_count; | ||
| 248 | __u8 srq; | ||
| 249 | __u8 port; | ||
| 250 | __u8 reserved[7]; | ||
| 251 | }; | ||
| 252 | |||
| 253 | struct ib_ucm_rep_event_resp { | ||
| 254 | __be64 remote_ca_guid; | ||
| 255 | __u32 remote_qkey; | ||
| 256 | __u32 remote_qpn; | ||
| 257 | __u32 starting_psn; | ||
| 258 | __u8 responder_resources; | ||
| 259 | __u8 initiator_depth; | ||
| 260 | __u8 target_ack_delay; | ||
| 261 | __u8 failover_accepted; | ||
| 262 | __u8 flow_control; | ||
| 263 | __u8 rnr_retry_count; | ||
| 264 | __u8 srq; | ||
| 265 | __u8 reserved[5]; | ||
| 266 | }; | ||
| 267 | |||
| 268 | struct ib_ucm_rej_event_resp { | ||
| 269 | __u32 reason; | ||
| 270 | /* ari in ib_ucm_event_get info field. */ | ||
| 271 | }; | ||
| 272 | |||
| 273 | struct ib_ucm_mra_event_resp { | ||
| 274 | __u8 timeout; | ||
| 275 | __u8 reserved[3]; | ||
| 276 | }; | ||
| 277 | |||
| 278 | struct ib_ucm_lap_event_resp { | ||
| 279 | struct ib_user_path_rec path; | ||
| 280 | }; | ||
| 281 | |||
| 282 | struct ib_ucm_apr_event_resp { | ||
| 283 | __u32 status; | ||
| 284 | /* apr info in ib_ucm_event_get info field. */ | ||
| 285 | }; | ||
| 286 | |||
| 287 | struct ib_ucm_sidr_req_event_resp { | ||
| 288 | __u16 pkey; | ||
| 289 | __u8 port; | ||
| 290 | __u8 reserved; | ||
| 291 | }; | ||
| 292 | |||
| 293 | struct ib_ucm_sidr_rep_event_resp { | ||
| 294 | __u32 status; | ||
| 295 | __u32 qkey; | ||
| 296 | __u32 qpn; | ||
| 297 | /* info in ib_ucm_event_get info field. */ | ||
| 298 | }; | ||
| 299 | |||
| 300 | #define IB_UCM_PRES_DATA 0x01 | ||
| 301 | #define IB_UCM_PRES_INFO 0x02 | ||
| 302 | #define IB_UCM_PRES_PRIMARY 0x04 | ||
| 303 | #define IB_UCM_PRES_ALTERNATE 0x08 | ||
| 304 | |||
| 305 | struct ib_ucm_event_resp { | ||
| 306 | __aligned_u64 uid; | ||
| 307 | __u32 id; | ||
| 308 | __u32 event; | ||
| 309 | __u32 present; | ||
| 310 | __u32 reserved; | ||
| 311 | union { | ||
| 312 | struct ib_ucm_req_event_resp req_resp; | ||
| 313 | struct ib_ucm_rep_event_resp rep_resp; | ||
| 314 | struct ib_ucm_rej_event_resp rej_resp; | ||
| 315 | struct ib_ucm_mra_event_resp mra_resp; | ||
| 316 | struct ib_ucm_lap_event_resp lap_resp; | ||
| 317 | struct ib_ucm_apr_event_resp apr_resp; | ||
| 318 | |||
| 319 | struct ib_ucm_sidr_req_event_resp sidr_req_resp; | ||
| 320 | struct ib_ucm_sidr_rep_event_resp sidr_rep_resp; | ||
| 321 | |||
| 322 | __u32 send_status; | ||
| 323 | } u; | ||
| 324 | }; | ||
| 325 | |||
| 326 | #endif /* IB_USER_CM_H */ | ||
diff --git a/include/uapi/rdma/mlx5_user_ioctl_cmds.h b/include/uapi/rdma/mlx5_user_ioctl_cmds.h index d404c951954c..d0da070cf0ab 100644 --- a/include/uapi/rdma/mlx5_user_ioctl_cmds.h +++ b/include/uapi/rdma/mlx5_user_ioctl_cmds.h | |||
| @@ -51,6 +51,7 @@ enum mlx5_ib_devx_methods { | |||
| 51 | MLX5_IB_METHOD_DEVX_OTHER = (1U << UVERBS_ID_NS_SHIFT), | 51 | MLX5_IB_METHOD_DEVX_OTHER = (1U << UVERBS_ID_NS_SHIFT), |
| 52 | MLX5_IB_METHOD_DEVX_QUERY_UAR, | 52 | MLX5_IB_METHOD_DEVX_QUERY_UAR, |
| 53 | MLX5_IB_METHOD_DEVX_QUERY_EQN, | 53 | MLX5_IB_METHOD_DEVX_QUERY_EQN, |
| 54 | MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT, | ||
| 54 | }; | 55 | }; |
| 55 | 56 | ||
| 56 | enum mlx5_ib_devx_other_attrs { | 57 | enum mlx5_ib_devx_other_attrs { |
| @@ -93,6 +94,14 @@ enum mlx5_ib_devx_obj_query_async_attrs { | |||
| 93 | MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_OUT_LEN, | 94 | MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_OUT_LEN, |
| 94 | }; | 95 | }; |
| 95 | 96 | ||
| 97 | enum mlx5_ib_devx_subscribe_event_attrs { | ||
| 98 | MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_HANDLE = (1U << UVERBS_ID_NS_SHIFT), | ||
| 99 | MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_OBJ_HANDLE, | ||
| 100 | MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_TYPE_NUM_LIST, | ||
| 101 | MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_NUM, | ||
| 102 | MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_COOKIE, | ||
| 103 | }; | ||
| 104 | |||
| 96 | enum mlx5_ib_devx_query_eqn_attrs { | 105 | enum mlx5_ib_devx_query_eqn_attrs { |
| 97 | MLX5_IB_ATTR_DEVX_QUERY_EQN_USER_VEC = (1U << UVERBS_ID_NS_SHIFT), | 106 | MLX5_IB_ATTR_DEVX_QUERY_EQN_USER_VEC = (1U << UVERBS_ID_NS_SHIFT), |
| 98 | MLX5_IB_ATTR_DEVX_QUERY_EQN_DEV_EQN, | 107 | MLX5_IB_ATTR_DEVX_QUERY_EQN_DEV_EQN, |
| @@ -127,16 +136,26 @@ enum mlx5_ib_devx_async_cmd_fd_alloc_attrs { | |||
| 127 | MLX5_IB_ATTR_DEVX_ASYNC_CMD_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), | 136 | MLX5_IB_ATTR_DEVX_ASYNC_CMD_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), |
| 128 | }; | 137 | }; |
| 129 | 138 | ||
| 139 | enum mlx5_ib_devx_async_event_fd_alloc_attrs { | ||
| 140 | MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), | ||
| 141 | MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_FLAGS, | ||
| 142 | }; | ||
| 143 | |||
| 130 | enum mlx5_ib_devx_async_cmd_fd_methods { | 144 | enum mlx5_ib_devx_async_cmd_fd_methods { |
| 131 | MLX5_IB_METHOD_DEVX_ASYNC_CMD_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT), | 145 | MLX5_IB_METHOD_DEVX_ASYNC_CMD_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT), |
| 132 | }; | 146 | }; |
| 133 | 147 | ||
| 148 | enum mlx5_ib_devx_async_event_fd_methods { | ||
| 149 | MLX5_IB_METHOD_DEVX_ASYNC_EVENT_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT), | ||
| 150 | }; | ||
| 151 | |||
| 134 | enum mlx5_ib_objects { | 152 | enum mlx5_ib_objects { |
| 135 | MLX5_IB_OBJECT_DEVX = (1U << UVERBS_ID_NS_SHIFT), | 153 | MLX5_IB_OBJECT_DEVX = (1U << UVERBS_ID_NS_SHIFT), |
| 136 | MLX5_IB_OBJECT_DEVX_OBJ, | 154 | MLX5_IB_OBJECT_DEVX_OBJ, |
| 137 | MLX5_IB_OBJECT_DEVX_UMEM, | 155 | MLX5_IB_OBJECT_DEVX_UMEM, |
| 138 | MLX5_IB_OBJECT_FLOW_MATCHER, | 156 | MLX5_IB_OBJECT_FLOW_MATCHER, |
| 139 | MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD, | 157 | MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD, |
| 158 | MLX5_IB_OBJECT_DEVX_ASYNC_EVENT_FD, | ||
| 140 | }; | 159 | }; |
| 141 | 160 | ||
| 142 | enum mlx5_ib_flow_matcher_create_attrs { | 161 | enum mlx5_ib_flow_matcher_create_attrs { |
diff --git a/include/uapi/rdma/mlx5_user_ioctl_verbs.h b/include/uapi/rdma/mlx5_user_ioctl_verbs.h index a8f34c237458..7e9900b0e746 100644 --- a/include/uapi/rdma/mlx5_user_ioctl_verbs.h +++ b/include/uapi/rdma/mlx5_user_ioctl_verbs.h | |||
| @@ -63,5 +63,14 @@ enum mlx5_ib_uapi_dm_type { | |||
| 63 | MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_SW_ICM, | 63 | MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_SW_ICM, |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | enum mlx5_ib_uapi_devx_create_event_channel_flags { | ||
| 67 | MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0, | ||
| 68 | }; | ||
| 69 | |||
| 70 | struct mlx5_ib_uapi_devx_async_event_hdr { | ||
| 71 | __aligned_u64 cookie; | ||
| 72 | __u8 out_data[]; | ||
| 73 | }; | ||
| 74 | |||
| 66 | #endif | 75 | #endif |
| 67 | 76 | ||
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h index 41db51367efa..8e277783fa96 100644 --- a/include/uapi/rdma/rdma_netlink.h +++ b/include/uapi/rdma/rdma_netlink.h | |||
| @@ -147,6 +147,18 @@ enum { | |||
| 147 | IWPM_NLA_HELLO_MAX | 147 | IWPM_NLA_HELLO_MAX |
| 148 | }; | 148 | }; |
| 149 | 149 | ||
| 150 | /* For RDMA_NLDEV_ATTR_DEV_NODE_TYPE */ | ||
| 151 | enum { | ||
| 152 | /* IB values map to NodeInfo:NodeType. */ | ||
| 153 | RDMA_NODE_IB_CA = 1, | ||
| 154 | RDMA_NODE_IB_SWITCH, | ||
| 155 | RDMA_NODE_IB_ROUTER, | ||
| 156 | RDMA_NODE_RNIC, | ||
| 157 | RDMA_NODE_USNIC, | ||
| 158 | RDMA_NODE_USNIC_UDP, | ||
| 159 | RDMA_NODE_UNSPECIFIED, | ||
| 160 | }; | ||
| 161 | |||
| 150 | /* | 162 | /* |
| 151 | * Local service operations: | 163 | * Local service operations: |
| 152 | * RESOLVE - The client requests the local service to resolve a path. | 164 | * RESOLVE - The client requests the local service to resolve a path. |
| @@ -267,11 +279,15 @@ enum rdma_nldev_command { | |||
| 267 | 279 | ||
| 268 | RDMA_NLDEV_CMD_RES_PD_GET, /* can dump */ | 280 | RDMA_NLDEV_CMD_RES_PD_GET, /* can dump */ |
| 269 | 281 | ||
| 270 | RDMA_NLDEV_NUM_OPS | 282 | RDMA_NLDEV_CMD_GET_CHARDEV, |
| 271 | }; | ||
| 272 | 283 | ||
| 273 | enum { | 284 | RDMA_NLDEV_CMD_STAT_SET, |
| 274 | RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16, | 285 | |
| 286 | RDMA_NLDEV_CMD_STAT_GET, /* can dump */ | ||
| 287 | |||
| 288 | RDMA_NLDEV_CMD_STAT_DEL, | ||
| 289 | |||
| 290 | RDMA_NLDEV_NUM_OPS | ||
| 275 | }; | 291 | }; |
| 276 | 292 | ||
| 277 | enum rdma_nldev_print_type { | 293 | enum rdma_nldev_print_type { |
| @@ -478,10 +494,72 @@ enum rdma_nldev_attr { | |||
| 478 | * File descriptor handle of the net namespace object | 494 | * File descriptor handle of the net namespace object |
| 479 | */ | 495 | */ |
| 480 | RDMA_NLDEV_NET_NS_FD, /* u32 */ | 496 | RDMA_NLDEV_NET_NS_FD, /* u32 */ |
| 497 | /* | ||
| 498 | * Information about a chardev. | ||
| 499 | * CHARDEV_TYPE is the name of the chardev ABI (ie uverbs, umad, etc) | ||
| 500 | * CHARDEV_ABI signals the ABI revision (historical) | ||
| 501 | * CHARDEV_NAME is the kernel name for the /dev/ file (no directory) | ||
| 502 | * CHARDEV is the 64 bit dev_t for the inode | ||
| 503 | */ | ||
| 504 | RDMA_NLDEV_ATTR_CHARDEV_TYPE, /* string */ | ||
| 505 | RDMA_NLDEV_ATTR_CHARDEV_NAME, /* string */ | ||
| 506 | RDMA_NLDEV_ATTR_CHARDEV_ABI, /* u64 */ | ||
| 507 | RDMA_NLDEV_ATTR_CHARDEV, /* u64 */ | ||
| 508 | RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID, /* u64 */ | ||
| 509 | /* | ||
| 510 | * Counter-specific attributes. | ||
| 511 | */ | ||
| 512 | RDMA_NLDEV_ATTR_STAT_MODE, /* u32 */ | ||
| 513 | RDMA_NLDEV_ATTR_STAT_RES, /* u32 */ | ||
| 514 | RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK, /* u32 */ | ||
| 515 | RDMA_NLDEV_ATTR_STAT_COUNTER, /* nested table */ | ||
| 516 | RDMA_NLDEV_ATTR_STAT_COUNTER_ENTRY, /* nested table */ | ||
| 517 | RDMA_NLDEV_ATTR_STAT_COUNTER_ID, /* u32 */ | ||
| 518 | RDMA_NLDEV_ATTR_STAT_HWCOUNTERS, /* nested table */ | ||
| 519 | RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY, /* nested table */ | ||
| 520 | RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME, /* string */ | ||
| 521 | RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE, /* u64 */ | ||
| 522 | |||
| 523 | /* | ||
| 524 | * CQ adaptive moderatio (DIM) | ||
| 525 | */ | ||
| 526 | RDMA_NLDEV_ATTR_DEV_DIM, /* u8 */ | ||
| 481 | 527 | ||
| 482 | /* | 528 | /* |
| 483 | * Always the end | 529 | * Always the end |
| 484 | */ | 530 | */ |
| 485 | RDMA_NLDEV_ATTR_MAX | 531 | RDMA_NLDEV_ATTR_MAX |
| 486 | }; | 532 | }; |
| 533 | |||
| 534 | /* | ||
| 535 | * Supported counter bind modes. All modes are mutual-exclusive. | ||
| 536 | */ | ||
| 537 | enum rdma_nl_counter_mode { | ||
| 538 | RDMA_COUNTER_MODE_NONE, | ||
| 539 | |||
| 540 | /* | ||
| 541 | * A qp is bound with a counter automatically during initialization | ||
| 542 | * based on the auto mode (e.g., qp type, ...) | ||
| 543 | */ | ||
| 544 | RDMA_COUNTER_MODE_AUTO, | ||
| 545 | |||
| 546 | /* | ||
| 547 | * Which qp are bound with which counter is explicitly specified | ||
| 548 | * by the user | ||
| 549 | */ | ||
| 550 | RDMA_COUNTER_MODE_MANUAL, | ||
| 551 | |||
| 552 | /* | ||
| 553 | * Always the end | ||
| 554 | */ | ||
| 555 | RDMA_COUNTER_MODE_MAX, | ||
| 556 | }; | ||
| 557 | |||
| 558 | /* | ||
| 559 | * Supported criteria in counter auto mode. | ||
| 560 | * Currently only "qp type" is supported | ||
| 561 | */ | ||
| 562 | enum rdma_nl_counter_mask { | ||
| 563 | RDMA_COUNTER_MASK_QP_TYPE = 1, | ||
| 564 | }; | ||
| 487 | #endif /* _UAPI_RDMA_NETLINK_H */ | 565 | #endif /* _UAPI_RDMA_NETLINK_H */ |
diff --git a/include/uapi/rdma/rdma_user_ioctl_cmds.h b/include/uapi/rdma/rdma_user_ioctl_cmds.h index 26213f49f5c8..b8bb285f6b2a 100644 --- a/include/uapi/rdma/rdma_user_ioctl_cmds.h +++ b/include/uapi/rdma/rdma_user_ioctl_cmds.h | |||
| @@ -36,7 +36,7 @@ | |||
| 36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
| 37 | #include <linux/ioctl.h> | 37 | #include <linux/ioctl.h> |
| 38 | 38 | ||
| 39 | /* Documentation/ioctl/ioctl-number.txt */ | 39 | /* Documentation/ioctl/ioctl-number.rst */ |
| 40 | #define RDMA_IOCTL_MAGIC 0x1b | 40 | #define RDMA_IOCTL_MAGIC 0x1b |
| 41 | #define RDMA_VERBS_IOCTL \ | 41 | #define RDMA_VERBS_IOCTL \ |
| 42 | _IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr) | 42 | _IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr) |
| @@ -103,6 +103,7 @@ enum rdma_driver_id { | |||
| 103 | RDMA_DRIVER_HFI1, | 103 | RDMA_DRIVER_HFI1, |
| 104 | RDMA_DRIVER_QIB, | 104 | RDMA_DRIVER_QIB, |
| 105 | RDMA_DRIVER_EFA, | 105 | RDMA_DRIVER_EFA, |
| 106 | RDMA_DRIVER_SIW, | ||
| 106 | }; | 107 | }; |
| 107 | 108 | ||
| 108 | #endif | 109 | #endif |
diff --git a/include/uapi/rdma/rvt-abi.h b/include/uapi/rdma/rvt-abi.h new file mode 100644 index 000000000000..7328293c715c --- /dev/null +++ b/include/uapi/rdma/rvt-abi.h | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * This file contains defines, structures, etc. that are used | ||
| 5 | * to communicate between kernel and user code. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef RVT_ABI_USER_H | ||
| 9 | #define RVT_ABI_USER_H | ||
| 10 | |||
| 11 | #include <linux/types.h> | ||
| 12 | #include <rdma/ib_user_verbs.h> | ||
| 13 | #ifndef RDMA_ATOMIC_UAPI | ||
| 14 | #define RDMA_ATOMIC_UAPI(_type, _name) struct{ _type val; } _name | ||
| 15 | #endif | ||
| 16 | |||
| 17 | struct rvt_wqe_sge { | ||
| 18 | __aligned_u64 addr; | ||
| 19 | __u32 length; | ||
| 20 | __u32 lkey; | ||
| 21 | }; | ||
| 22 | |||
| 23 | /* | ||
| 24 | * This structure is used to contain the head pointer, tail pointer, | ||
| 25 | * and completion queue entries as a single memory allocation so | ||
| 26 | * it can be mmap'ed into user space. | ||
| 27 | */ | ||
| 28 | struct rvt_cq_wc { | ||
| 29 | /* index of next entry to fill */ | ||
| 30 | RDMA_ATOMIC_UAPI(__u32, head); | ||
| 31 | /* index of next ib_poll_cq() entry */ | ||
| 32 | RDMA_ATOMIC_UAPI(__u32, tail); | ||
| 33 | |||
| 34 | /* these are actually size ibcq.cqe + 1 */ | ||
| 35 | struct ib_uverbs_wc uqueue[]; | ||
| 36 | }; | ||
| 37 | |||
| 38 | /* | ||
| 39 | * Receive work request queue entry. | ||
| 40 | * The size of the sg_list is determined when the QP (or SRQ) is created | ||
| 41 | * and stored in qp->r_rq.max_sge (or srq->rq.max_sge). | ||
| 42 | */ | ||
| 43 | struct rvt_rwqe { | ||
| 44 | __u64 wr_id; | ||
| 45 | __u8 num_sge; | ||
| 46 | __u8 padding[7]; | ||
| 47 | struct rvt_wqe_sge sg_list[]; | ||
| 48 | }; | ||
| 49 | |||
| 50 | /* | ||
| 51 | * This structure is used to contain the head pointer, tail pointer, | ||
| 52 | * and receive work queue entries as a single memory allocation so | ||
| 53 | * it can be mmap'ed into user space. | ||
| 54 | * Note that the wq array elements are variable size so you can't | ||
| 55 | * just index into the array to get the N'th element; | ||
| 56 | * use get_rwqe_ptr() for user space and rvt_get_rwqe_ptr() | ||
| 57 | * for kernel space. | ||
| 58 | */ | ||
| 59 | struct rvt_rwq { | ||
| 60 | /* new work requests posted to the head */ | ||
| 61 | RDMA_ATOMIC_UAPI(__u32, head); | ||
| 62 | /* receives pull requests from here. */ | ||
| 63 | RDMA_ATOMIC_UAPI(__u32, tail); | ||
| 64 | struct rvt_rwqe wq[]; | ||
| 65 | }; | ||
| 66 | #endif /* RVT_ABI_USER_H */ | ||
diff --git a/include/uapi/rdma/siw-abi.h b/include/uapi/rdma/siw-abi.h new file mode 100644 index 000000000000..3dd8071ace7b --- /dev/null +++ b/include/uapi/rdma/siw-abi.h | |||
| @@ -0,0 +1,185 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ | ||
| 2 | |||
| 3 | /* Authors: Bernard Metzler <bmt@zurich.ibm.com> */ | ||
| 4 | /* Copyright (c) 2008-2019, IBM Corporation */ | ||
| 5 | |||
| 6 | #ifndef _SIW_USER_H | ||
| 7 | #define _SIW_USER_H | ||
| 8 | |||
| 9 | #include <linux/types.h> | ||
| 10 | |||
| 11 | #define SIW_NODE_DESC_COMMON "Software iWARP stack" | ||
| 12 | #define SIW_ABI_VERSION 1 | ||
| 13 | #define SIW_MAX_SGE 6 | ||
| 14 | #define SIW_UOBJ_MAX_KEY 0x08FFFF | ||
| 15 | #define SIW_INVAL_UOBJ_KEY (SIW_UOBJ_MAX_KEY + 1) | ||
| 16 | |||
| 17 | struct siw_uresp_create_cq { | ||
| 18 | __u32 cq_id; | ||
| 19 | __u32 num_cqe; | ||
| 20 | __aligned_u64 cq_key; | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct siw_uresp_create_qp { | ||
| 24 | __u32 qp_id; | ||
| 25 | __u32 num_sqe; | ||
| 26 | __u32 num_rqe; | ||
| 27 | __u32 pad; | ||
| 28 | __aligned_u64 sq_key; | ||
| 29 | __aligned_u64 rq_key; | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct siw_ureq_reg_mr { | ||
| 33 | __u8 stag_key; | ||
| 34 | __u8 reserved[3]; | ||
| 35 | __u32 pad; | ||
| 36 | }; | ||
| 37 | |||
| 38 | struct siw_uresp_reg_mr { | ||
| 39 | __u32 stag; | ||
| 40 | __u32 pad; | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct siw_uresp_create_srq { | ||
| 44 | __u32 num_rqe; | ||
| 45 | __u32 pad; | ||
| 46 | __aligned_u64 srq_key; | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct siw_uresp_alloc_ctx { | ||
| 50 | __u32 dev_id; | ||
| 51 | __u32 pad; | ||
| 52 | }; | ||
| 53 | |||
| 54 | enum siw_opcode { | ||
| 55 | SIW_OP_WRITE, | ||
| 56 | SIW_OP_READ, | ||
| 57 | SIW_OP_READ_LOCAL_INV, | ||
| 58 | SIW_OP_SEND, | ||
| 59 | SIW_OP_SEND_WITH_IMM, | ||
| 60 | SIW_OP_SEND_REMOTE_INV, | ||
| 61 | |||
| 62 | /* Unsupported */ | ||
| 63 | SIW_OP_FETCH_AND_ADD, | ||
| 64 | SIW_OP_COMP_AND_SWAP, | ||
| 65 | |||
| 66 | SIW_OP_RECEIVE, | ||
| 67 | /* provider internal SQE */ | ||
| 68 | SIW_OP_READ_RESPONSE, | ||
| 69 | /* | ||
| 70 | * below opcodes valid for | ||
| 71 | * in-kernel clients only | ||
| 72 | */ | ||
| 73 | SIW_OP_INVAL_STAG, | ||
| 74 | SIW_OP_REG_MR, | ||
| 75 | SIW_NUM_OPCODES | ||
| 76 | }; | ||
| 77 | |||
| 78 | /* Keep it same as ibv_sge to allow for memcpy */ | ||
| 79 | struct siw_sge { | ||
| 80 | __aligned_u64 laddr; | ||
| 81 | __u32 length; | ||
| 82 | __u32 lkey; | ||
| 83 | }; | ||
| 84 | |||
| 85 | /* | ||
| 86 | * Inline data are kept within the work request itself occupying | ||
| 87 | * the space of sge[1] .. sge[n]. Therefore, inline data cannot be | ||
| 88 | * supported if SIW_MAX_SGE is below 2 elements. | ||
| 89 | */ | ||
| 90 | #define SIW_MAX_INLINE (sizeof(struct siw_sge) * (SIW_MAX_SGE - 1)) | ||
| 91 | |||
| 92 | #if SIW_MAX_SGE < 2 | ||
| 93 | #error "SIW_MAX_SGE must be at least 2" | ||
| 94 | #endif | ||
| 95 | |||
| 96 | enum siw_wqe_flags { | ||
| 97 | SIW_WQE_VALID = 1, | ||
| 98 | SIW_WQE_INLINE = (1 << 1), | ||
| 99 | SIW_WQE_SIGNALLED = (1 << 2), | ||
| 100 | SIW_WQE_SOLICITED = (1 << 3), | ||
| 101 | SIW_WQE_READ_FENCE = (1 << 4), | ||
| 102 | SIW_WQE_REM_INVAL = (1 << 5), | ||
| 103 | SIW_WQE_COMPLETED = (1 << 6) | ||
| 104 | }; | ||
| 105 | |||
| 106 | /* Send Queue Element */ | ||
| 107 | struct siw_sqe { | ||
| 108 | __aligned_u64 id; | ||
| 109 | __u16 flags; | ||
| 110 | __u8 num_sge; | ||
| 111 | /* Contains enum siw_opcode values */ | ||
| 112 | __u8 opcode; | ||
| 113 | __u32 rkey; | ||
| 114 | union { | ||
| 115 | __aligned_u64 raddr; | ||
| 116 | __aligned_u64 base_mr; | ||
| 117 | }; | ||
| 118 | union { | ||
| 119 | struct siw_sge sge[SIW_MAX_SGE]; | ||
| 120 | __aligned_u64 access; | ||
| 121 | }; | ||
| 122 | }; | ||
| 123 | |||
| 124 | /* Receive Queue Element */ | ||
| 125 | struct siw_rqe { | ||
| 126 | __aligned_u64 id; | ||
| 127 | __u16 flags; | ||
| 128 | __u8 num_sge; | ||
| 129 | /* | ||
| 130 | * only used by kernel driver, | ||
| 131 | * ignored if set by user | ||
| 132 | */ | ||
| 133 | __u8 opcode; | ||
| 134 | __u32 unused; | ||
| 135 | struct siw_sge sge[SIW_MAX_SGE]; | ||
| 136 | }; | ||
| 137 | |||
| 138 | enum siw_notify_flags { | ||
| 139 | SIW_NOTIFY_NOT = (0), | ||
| 140 | SIW_NOTIFY_SOLICITED = (1 << 0), | ||
| 141 | SIW_NOTIFY_NEXT_COMPLETION = (1 << 1), | ||
| 142 | SIW_NOTIFY_MISSED_EVENTS = (1 << 2), | ||
| 143 | SIW_NOTIFY_ALL = SIW_NOTIFY_SOLICITED | SIW_NOTIFY_NEXT_COMPLETION | | ||
| 144 | SIW_NOTIFY_MISSED_EVENTS | ||
| 145 | }; | ||
| 146 | |||
| 147 | enum siw_wc_status { | ||
| 148 | SIW_WC_SUCCESS, | ||
| 149 | SIW_WC_LOC_LEN_ERR, | ||
| 150 | SIW_WC_LOC_PROT_ERR, | ||
| 151 | SIW_WC_LOC_QP_OP_ERR, | ||
| 152 | SIW_WC_WR_FLUSH_ERR, | ||
| 153 | SIW_WC_BAD_RESP_ERR, | ||
| 154 | SIW_WC_LOC_ACCESS_ERR, | ||
| 155 | SIW_WC_REM_ACCESS_ERR, | ||
| 156 | SIW_WC_REM_INV_REQ_ERR, | ||
| 157 | SIW_WC_GENERAL_ERR, | ||
| 158 | SIW_NUM_WC_STATUS | ||
| 159 | }; | ||
| 160 | |||
| 161 | struct siw_cqe { | ||
| 162 | __aligned_u64 id; | ||
| 163 | __u8 flags; | ||
| 164 | __u8 opcode; | ||
| 165 | __u16 status; | ||
| 166 | __u32 bytes; | ||
| 167 | union { | ||
| 168 | __aligned_u64 imm_data; | ||
| 169 | __u32 inval_stag; | ||
| 170 | }; | ||
| 171 | /* QP number or QP pointer */ | ||
| 172 | union { | ||
| 173 | struct ib_qp *base_qp; | ||
| 174 | __aligned_u64 qp_id; | ||
| 175 | }; | ||
| 176 | }; | ||
| 177 | |||
| 178 | /* | ||
| 179 | * Shared structure between user and kernel | ||
| 180 | * to control CQ arming. | ||
| 181 | */ | ||
| 182 | struct siw_cq_ctrl { | ||
| 183 | __aligned_u64 notify; | ||
| 184 | }; | ||
| 185 | #endif | ||
diff --git a/include/uapi/scsi/fc/fc_els.h b/include/uapi/scsi/fc/fc_els.h index a81c53508cc6..76f627f0d13b 100644 --- a/include/uapi/scsi/fc/fc_els.h +++ b/include/uapi/scsi/fc/fc_els.h | |||
| @@ -2,19 +2,6 @@ | |||
| 2 | /* | 2 | /* |
| 3 | * Copyright(c) 2007 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2007 Intel Corporation. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | * | ||
| 18 | * Maintained at www.Open-FCoE.org | 5 | * Maintained at www.Open-FCoE.org |
| 19 | */ | 6 | */ |
| 20 | 7 | ||
diff --git a/include/uapi/scsi/fc/fc_fs.h b/include/uapi/scsi/fc/fc_fs.h index 8c0a292a61ed..0dab49dbb2f7 100644 --- a/include/uapi/scsi/fc/fc_fs.h +++ b/include/uapi/scsi/fc/fc_fs.h | |||
| @@ -2,19 +2,6 @@ | |||
| 2 | /* | 2 | /* |
| 3 | * Copyright(c) 2007 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2007 Intel Corporation. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | * | ||
| 18 | * Maintained at www.Open-FCoE.org | 5 | * Maintained at www.Open-FCoE.org |
| 19 | */ | 6 | */ |
| 20 | 7 | ||
diff --git a/include/uapi/scsi/fc/fc_gs.h b/include/uapi/scsi/fc/fc_gs.h index 2153f3524555..effb4c662fe5 100644 --- a/include/uapi/scsi/fc/fc_gs.h +++ b/include/uapi/scsi/fc/fc_gs.h | |||
| @@ -2,19 +2,6 @@ | |||
| 2 | /* | 2 | /* |
| 3 | * Copyright(c) 2007 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2007 Intel Corporation. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | * | ||
| 18 | * Maintained at www.Open-FCoE.org | 5 | * Maintained at www.Open-FCoE.org |
| 19 | */ | 6 | */ |
| 20 | 7 | ||
diff --git a/include/uapi/scsi/fc/fc_ns.h b/include/uapi/scsi/fc/fc_ns.h index 015e5e1ce8f1..4cf0a40a099a 100644 --- a/include/uapi/scsi/fc/fc_ns.h +++ b/include/uapi/scsi/fc/fc_ns.h | |||
| @@ -2,19 +2,6 @@ | |||
| 2 | /* | 2 | /* |
| 3 | * Copyright(c) 2007 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2007 Intel Corporation. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | * | ||
| 18 | * Maintained at www.Open-FCoE.org | 5 | * Maintained at www.Open-FCoE.org |
| 19 | */ | 6 | */ |
| 20 | 7 | ||
diff --git a/include/uapi/scsi/scsi_bsg_fc.h b/include/uapi/scsi/scsi_bsg_fc.h index 62597d86beed..52f32a60d056 100644 --- a/include/uapi/scsi/scsi_bsg_fc.h +++ b/include/uapi/scsi/scsi_bsg_fc.h | |||
| @@ -3,21 +3,6 @@ | |||
| 3 | * FC Transport BSG Interface | 3 | * FC Transport BSG Interface |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2008 James Smart, Emulex Corporation | 5 | * Copyright (C) 2008 James Smart, Emulex Corporation |
| 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 | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or | ||
| 10 | * (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 20 | * | ||
| 21 | */ | 6 | */ |
| 22 | 7 | ||
| 23 | #ifndef SCSI_BSG_FC_H | 8 | #ifndef SCSI_BSG_FC_H |
diff --git a/include/uapi/scsi/scsi_netlink.h b/include/uapi/scsi/scsi_netlink.h index 5ccc2333acab..5dd382054e45 100644 --- a/include/uapi/scsi/scsi_netlink.h +++ b/include/uapi/scsi/scsi_netlink.h | |||
| @@ -4,21 +4,6 @@ | |||
| 4 | * Used for the posting of outbound SCSI transport events | 4 | * Used for the posting of outbound SCSI transport events |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2006 James Smart, Emulex Corporation | 6 | * Copyright (C) 2006 James Smart, Emulex Corporation |
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2 of the License, or | ||
| 11 | * (at your option) any later version. | ||
| 12 | * | ||
| 13 | * This program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with this program; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 21 | * | ||
| 22 | */ | 7 | */ |
| 23 | #ifndef SCSI_NETLINK_H | 8 | #ifndef SCSI_NETLINK_H |
| 24 | #define SCSI_NETLINK_H | 9 | #define SCSI_NETLINK_H |
diff --git a/include/uapi/scsi/scsi_netlink_fc.h b/include/uapi/scsi/scsi_netlink_fc.h index 060f563c38a2..a39023579051 100644 --- a/include/uapi/scsi/scsi_netlink_fc.h +++ b/include/uapi/scsi/scsi_netlink_fc.h | |||
| @@ -3,21 +3,6 @@ | |||
| 3 | * FC Transport Netlink Interface | 3 | * FC Transport Netlink Interface |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2006 James Smart, Emulex Corporation | 5 | * Copyright (C) 2006 James Smart, Emulex Corporation |
| 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 | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or | ||
| 10 | * (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 20 | * | ||
| 21 | */ | 6 | */ |
| 22 | #ifndef SCSI_NETLINK_FC_H | 7 | #ifndef SCSI_NETLINK_FC_H |
| 23 | #define SCSI_NETLINK_FC_H | 8 | #define SCSI_NETLINK_FC_H |
diff --git a/include/uapi/sound/sof/abi.h b/include/uapi/sound/sof/abi.h index 0868eb47acf7..4a9c24434f42 100644 --- a/include/uapi/sound/sof/abi.h +++ b/include/uapi/sound/sof/abi.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | /* SOF ABI version major, minor and patch numbers */ | 27 | /* SOF ABI version major, minor and patch numbers */ |
| 28 | #define SOF_ABI_MAJOR 3 | 28 | #define SOF_ABI_MAJOR 3 |
| 29 | #define SOF_ABI_MINOR 6 | 29 | #define SOF_ABI_MINOR 8 |
| 30 | #define SOF_ABI_PATCH 0 | 30 | #define SOF_ABI_PATCH 0 |
| 31 | 31 | ||
| 32 | /* SOF ABI version number. Format within 32bit word is MMmmmppp */ | 32 | /* SOF ABI version number. Format within 32bit word is MMmmmppp */ |
diff --git a/include/uapi/sound/sof/eq.h b/include/uapi/sound/sof/eq.h deleted file mode 100644 index 666c2b6a3229..000000000000 --- a/include/uapi/sound/sof/eq.h +++ /dev/null | |||
| @@ -1,172 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ | ||
| 2 | /* | ||
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
| 4 | * redistributing this file, you may do so under either license. | ||
| 5 | * | ||
| 6 | * Copyright(c) 2018 Intel Corporation. All rights reserved. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_EQ_H__ | ||
| 10 | #define __INCLUDE_UAPI_SOUND_SOF_USER_EQ_H__ | ||
| 11 | |||
| 12 | /* FIR EQ type */ | ||
| 13 | |||
| 14 | #define SOF_EQ_FIR_IDX_SWITCH 0 | ||
| 15 | |||
| 16 | #define SOF_EQ_FIR_MAX_SIZE 4096 /* Max size allowed for coef data in bytes */ | ||
| 17 | |||
| 18 | #define SOF_EQ_FIR_MAX_LENGTH 192 /* Max length for individual filter */ | ||
| 19 | |||
| 20 | #define SOF_EQ_FIR_MAX_RESPONSES 8 /* A blob can define max 8 FIR EQs */ | ||
| 21 | |||
| 22 | /* | ||
| 23 | * eq_fir_configuration data structure contains this information | ||
| 24 | * uint32_t size | ||
| 25 | * This is the number of bytes need to store the received EQ | ||
| 26 | * configuration. | ||
| 27 | * uint16_t channels_in_config | ||
| 28 | * This describes the number of channels in this EQ config data. It | ||
| 29 | * can be different from PLATFORM_MAX_CHANNELS. | ||
| 30 | * uint16_t number_of_responses | ||
| 31 | * 0=no responses, 1=one response defined, 2=two responses defined, etc. | ||
| 32 | * int16_t data[] | ||
| 33 | * assign_response[channels_in_config] | ||
| 34 | * 0 = use first response, 1 = use 2nd response, etc. | ||
| 35 | * E.g. {0, 0, 0, 0, 1, 1, 1, 1} would apply to channels 0-3 the | ||
| 36 | * same first defined response and for to channels 4-7 the second. | ||
| 37 | * coef_data[] | ||
| 38 | * Repeated data | ||
| 39 | * { filter_length, output_shift, h[] } | ||
| 40 | * for every EQ response defined where vector h has filter_length | ||
| 41 | * number of coefficients. Coefficients in h[] are in Q1.15 format. | ||
| 42 | * E.g. 16384 (Q1.15) = 0.5. The shifts are number of right shifts. | ||
| 43 | * | ||
| 44 | * NOTE: The channels_in_config must be even to have coef_data aligned to | ||
| 45 | * 32 bit word in RAM. Therefore a mono EQ assign must be duplicated to 2ch | ||
| 46 | * even if it would never used. Similarly a 5ch EQ assign must be increased | ||
| 47 | * to 6ch. EQ init will return an error if this is not met. | ||
| 48 | * | ||
| 49 | * NOTE: The filter_length must be multiple of four. Therefore the filter must | ||
| 50 | * be padded from the end with zeros have this condition met. | ||
| 51 | */ | ||
| 52 | |||
| 53 | struct sof_eq_fir_config { | ||
| 54 | uint32_t size; | ||
| 55 | uint16_t channels_in_config; | ||
| 56 | uint16_t number_of_responses; | ||
| 57 | |||
| 58 | /* reserved */ | ||
| 59 | uint32_t reserved[4]; | ||
| 60 | |||
| 61 | int16_t data[]; | ||
| 62 | } __packed; | ||
| 63 | |||
| 64 | struct sof_eq_fir_coef_data { | ||
| 65 | int16_t length; /* Number of FIR taps */ | ||
| 66 | int16_t out_shift; /* Amount of right shifts at output */ | ||
| 67 | |||
| 68 | /* reserved */ | ||
| 69 | uint32_t reserved[4]; | ||
| 70 | |||
| 71 | int16_t coef[]; /* FIR coefficients */ | ||
| 72 | } __packed; | ||
| 73 | |||
| 74 | /* In the struct above there's two 16 bit words (length, shift) and four | ||
| 75 | * reserved 32 bit words before the actual FIR coefficients. This information | ||
| 76 | * is used in parsing of the configuration blob. | ||
| 77 | */ | ||
| 78 | #define SOF_EQ_FIR_COEF_NHEADER \ | ||
| 79 | (sizeof(struct sof_eq_fir_coef_data) / sizeof(int16_t)) | ||
| 80 | |||
| 81 | /* IIR EQ type */ | ||
| 82 | |||
| 83 | #define SOF_EQ_IIR_IDX_SWITCH 0 | ||
| 84 | |||
| 85 | #define SOF_EQ_IIR_MAX_SIZE 1024 /* Max size allowed for coef data in bytes */ | ||
| 86 | |||
| 87 | #define SOF_EQ_IIR_MAX_RESPONSES 8 /* A blob can define max 8 IIR EQs */ | ||
| 88 | |||
| 89 | /* eq_iir_configuration | ||
| 90 | * uint32_t channels_in_config | ||
| 91 | * This describes the number of channels in this EQ config data. It | ||
| 92 | * can be different from PLATFORM_MAX_CHANNELS. | ||
| 93 | * uint32_t number_of_responses_defined | ||
| 94 | * 0=no responses, 1=one response defined, 2=two responses defined, etc. | ||
| 95 | * int32_t data[] | ||
| 96 | * Data consist of two parts. First is the response assign vector that | ||
| 97 | * has length of channels_in_config. The latter part is coefficient | ||
| 98 | * data. | ||
| 99 | * uint32_t assign_response[channels_in_config] | ||
| 100 | * -1 = not defined, 0 = use first response, 1 = use 2nd, etc. | ||
| 101 | * E.g. {0, 0, 0, 0, -1, -1, -1, -1} would apply to channels 0-3 the | ||
| 102 | * same first defined response and leave channels 4-7 unequalized. | ||
| 103 | * coefficient_data[] | ||
| 104 | * <1st EQ> | ||
| 105 | * uint32_t num_biquads | ||
| 106 | * uint32_t num_biquads_in_series | ||
| 107 | * <1st biquad> | ||
| 108 | * int32_t coef_a2 Q2.30 format | ||
| 109 | * int32_t coef_a1 Q2.30 format | ||
| 110 | * int32_t coef_b2 Q2.30 format | ||
| 111 | * int32_t coef_b1 Q2.30 format | ||
| 112 | * int32_t coef_b0 Q2.30 format | ||
| 113 | * int32_t output_shift number of shifts right, shift left is negative | ||
| 114 | * int32_t output_gain Q2.14 format | ||
| 115 | * <2nd biquad> | ||
| 116 | * ... | ||
| 117 | * <2nd EQ> | ||
| 118 | * | ||
| 119 | * Note: A flat response biquad can be made with a section set to | ||
| 120 | * b0 = 1.0, gain = 1.0, and other parameters set to 0 | ||
| 121 | * {0, 0, 0, 0, 1073741824, 0, 16484} | ||
| 122 | */ | ||
| 123 | |||
| 124 | struct sof_eq_iir_config { | ||
| 125 | uint32_t size; | ||
| 126 | uint32_t channels_in_config; | ||
| 127 | uint32_t number_of_responses; | ||
| 128 | |||
| 129 | /* reserved */ | ||
| 130 | uint32_t reserved[4]; | ||
| 131 | |||
| 132 | int32_t data[]; /* eq_assign[channels], eq 0, eq 1, ... */ | ||
| 133 | } __packed; | ||
| 134 | |||
| 135 | struct sof_eq_iir_header_df2t { | ||
| 136 | uint32_t num_sections; | ||
| 137 | uint32_t num_sections_in_series; | ||
| 138 | |||
| 139 | /* reserved */ | ||
| 140 | uint32_t reserved[4]; | ||
| 141 | |||
| 142 | int32_t biquads[]; /* Repeated biquad coefficients */ | ||
| 143 | } __packed; | ||
| 144 | |||
| 145 | struct sof_eq_iir_biquad_df2t { | ||
| 146 | int32_t a2; /* Q2.30 */ | ||
| 147 | int32_t a1; /* Q2.30 */ | ||
| 148 | int32_t b2; /* Q2.30 */ | ||
| 149 | int32_t b1; /* Q2.30 */ | ||
| 150 | int32_t b0; /* Q2.30 */ | ||
| 151 | int32_t output_shift; /* Number of right shifts */ | ||
| 152 | int32_t output_gain; /* Q2.14 */ | ||
| 153 | } __packed; | ||
| 154 | |||
| 155 | /* A full 22th order equalizer with 11 biquads cover octave bands 1-11 in | ||
| 156 | * in the 0 - 20 kHz bandwidth. | ||
| 157 | */ | ||
| 158 | #define SOF_EQ_IIR_DF2T_BIQUADS_MAX 11 | ||
| 159 | |||
| 160 | /* The number of int32_t words in sof_eq_iir_header_df2t: | ||
| 161 | * num_sections, num_sections_in_series, reserved[4] | ||
| 162 | */ | ||
| 163 | #define SOF_EQ_IIR_NHEADER_DF2T \ | ||
| 164 | (sizeof(struct sof_eq_iir_header_df2t) / sizeof(int32_t)) | ||
| 165 | |||
| 166 | /* The number of int32_t words in sof_eq_iir_biquad_df2t: | ||
| 167 | * a2, a1, b2, b1, b0, output_shift, output_gain | ||
| 168 | */ | ||
| 169 | #define SOF_EQ_IIR_NBIQUAD_DF2T \ | ||
| 170 | (sizeof(struct sof_eq_iir_biquad_df2t) / sizeof(int32_t)) | ||
| 171 | |||
| 172 | #endif | ||
diff --git a/include/uapi/sound/sof/manifest.h b/include/uapi/sound/sof/manifest.h deleted file mode 100644 index 2009ee30fad0..000000000000 --- a/include/uapi/sound/sof/manifest.h +++ /dev/null | |||
| @@ -1,188 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ | ||
| 2 | /* | ||
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
| 4 | * redistributing this file, you may do so under either license. | ||
| 5 | * | ||
| 6 | * Copyright(c) 2018 Intel Corporation. All rights reserved. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_MANIFEST_H__ | ||
| 10 | #define __INCLUDE_UAPI_SOUND_SOF_USER_MANIFEST_H__ | ||
| 11 | |||
| 12 | /* start offset for base FW module */ | ||
| 13 | #define SOF_MAN_ELF_TEXT_OFFSET 0x2000 | ||
| 14 | |||
| 15 | /* FW Extended Manifest Header id = $AE1 */ | ||
| 16 | #define SOF_MAN_EXT_HEADER_MAGIC 0x31454124 | ||
| 17 | |||
| 18 | /* module type load type */ | ||
| 19 | #define SOF_MAN_MOD_TYPE_BUILTIN 0 | ||
| 20 | #define SOF_MAN_MOD_TYPE_MODULE 1 | ||
| 21 | |||
| 22 | struct sof_man_module_type { | ||
| 23 | uint32_t load_type:4; /* SOF_MAN_MOD_TYPE_ */ | ||
| 24 | uint32_t auto_start:1; | ||
| 25 | uint32_t domain_ll:1; | ||
| 26 | uint32_t domain_dp:1; | ||
| 27 | uint32_t rsvd_:25; | ||
| 28 | }; | ||
| 29 | |||
| 30 | /* segment flags.type */ | ||
| 31 | #define SOF_MAN_SEGMENT_TEXT 0 | ||
| 32 | #define SOF_MAN_SEGMENT_RODATA 1 | ||
| 33 | #define SOF_MAN_SEGMENT_DATA 1 | ||
| 34 | #define SOF_MAN_SEGMENT_BSS 2 | ||
| 35 | #define SOF_MAN_SEGMENT_EMPTY 15 | ||
| 36 | |||
| 37 | union sof_man_segment_flags { | ||
| 38 | uint32_t ul; | ||
| 39 | struct { | ||
| 40 | uint32_t contents:1; | ||
| 41 | uint32_t alloc:1; | ||
| 42 | uint32_t load:1; | ||
| 43 | uint32_t readonly:1; | ||
| 44 | uint32_t code:1; | ||
| 45 | uint32_t data:1; | ||
| 46 | uint32_t _rsvd0:2; | ||
| 47 | uint32_t type:4; /* MAN_SEGMENT_ */ | ||
| 48 | uint32_t _rsvd1:4; | ||
| 49 | uint32_t length:16; /* of segment in pages */ | ||
| 50 | } r; | ||
| 51 | } __packed; | ||
| 52 | |||
| 53 | /* | ||
| 54 | * Module segment descriptor. Used by ROM - Immutable. | ||
| 55 | */ | ||
| 56 | struct sof_man_segment_desc { | ||
| 57 | union sof_man_segment_flags flags; | ||
| 58 | uint32_t v_base_addr; | ||
| 59 | uint32_t file_offset; | ||
| 60 | } __packed; | ||
| 61 | |||
| 62 | /* | ||
| 63 | * The firmware binary can be split into several modules. | ||
| 64 | */ | ||
| 65 | |||
| 66 | #define SOF_MAN_MOD_ID_LEN 4 | ||
| 67 | #define SOF_MAN_MOD_NAME_LEN 8 | ||
| 68 | #define SOF_MAN_MOD_SHA256_LEN 32 | ||
| 69 | #define SOF_MAN_MOD_ID {'$', 'A', 'M', 'E'} | ||
| 70 | |||
| 71 | /* | ||
| 72 | * Each module has an entry in the FW header. Used by ROM - Immutable. | ||
| 73 | */ | ||
| 74 | struct sof_man_module { | ||
| 75 | uint8_t struct_id[SOF_MAN_MOD_ID_LEN]; /* SOF_MAN_MOD_ID */ | ||
| 76 | uint8_t name[SOF_MAN_MOD_NAME_LEN]; | ||
| 77 | uint8_t uuid[16]; | ||
| 78 | struct sof_man_module_type type; | ||
| 79 | uint8_t hash[SOF_MAN_MOD_SHA256_LEN]; | ||
| 80 | uint32_t entry_point; | ||
| 81 | uint16_t cfg_offset; | ||
| 82 | uint16_t cfg_count; | ||
| 83 | uint32_t affinity_mask; | ||
| 84 | uint16_t instance_max_count; /* max number of instances */ | ||
| 85 | uint16_t instance_bss_size; /* instance (pages) */ | ||
| 86 | struct sof_man_segment_desc segment[3]; | ||
| 87 | } __packed; | ||
| 88 | |||
| 89 | /* | ||
| 90 | * Each module has a configuration in the FW header. Used by ROM - Immutable. | ||
| 91 | */ | ||
| 92 | struct sof_man_mod_config { | ||
| 93 | uint32_t par[4]; /* module parameters */ | ||
| 94 | uint32_t is_pages; /* actual size of instance .bss (pages) */ | ||
| 95 | uint32_t cps; /* cycles per second */ | ||
| 96 | uint32_t ibs; /* input buffer size (bytes) */ | ||
| 97 | uint32_t obs; /* output buffer size (bytes) */ | ||
| 98 | uint32_t module_flags; /* flags, reserved for future use */ | ||
| 99 | uint32_t cpc; /* cycles per single run */ | ||
| 100 | uint32_t obls; /* output block size, reserved for future use */ | ||
| 101 | } __packed; | ||
| 102 | |||
| 103 | /* | ||
| 104 | * FW Manifest Header | ||
| 105 | */ | ||
| 106 | |||
| 107 | #define SOF_MAN_FW_HDR_FW_NAME_LEN 8 | ||
| 108 | #define SOF_MAN_FW_HDR_ID {'$', 'A', 'M', '1'} | ||
| 109 | #define SOF_MAN_FW_HDR_NAME "ADSPFW" | ||
| 110 | #define SOF_MAN_FW_HDR_FLAGS 0x0 | ||
| 111 | #define SOF_MAN_FW_HDR_FEATURES 0xff | ||
| 112 | |||
| 113 | /* | ||
| 114 | * The firmware has a standard header that is checked by the ROM on firmware | ||
| 115 | * loading. preload_page_count is used by DMA code loader and is entire | ||
| 116 | * image size on CNL. i.e. CNL: total size of the binary’s .text and .rodata | ||
| 117 | * Used by ROM - Immutable. | ||
| 118 | */ | ||
| 119 | struct sof_man_fw_header { | ||
| 120 | uint8_t header_id[4]; | ||
| 121 | uint32_t header_len; | ||
| 122 | uint8_t name[SOF_MAN_FW_HDR_FW_NAME_LEN]; | ||
| 123 | /* number of pages of preloaded image loaded by driver */ | ||
| 124 | uint32_t preload_page_count; | ||
| 125 | uint32_t fw_image_flags; | ||
| 126 | uint32_t feature_mask; | ||
| 127 | uint16_t major_version; | ||
| 128 | uint16_t minor_version; | ||
| 129 | uint16_t hotfix_version; | ||
| 130 | uint16_t build_version; | ||
| 131 | uint32_t num_module_entries; | ||
| 132 | uint32_t hw_buf_base_addr; | ||
| 133 | uint32_t hw_buf_length; | ||
| 134 | /* target address for binary loading as offset in IMR - must be == base offset */ | ||
| 135 | uint32_t load_offset; | ||
| 136 | } __packed; | ||
| 137 | |||
| 138 | /* | ||
| 139 | * Firmware manifest descriptor. This can contain N modules and N module | ||
| 140 | * configs. Used by ROM - Immutable. | ||
| 141 | */ | ||
| 142 | struct sof_man_fw_desc { | ||
| 143 | struct sof_man_fw_header header; | ||
| 144 | |||
| 145 | /* Warning - hack for module arrays. For some unknown reason the we | ||
| 146 | * have a variable size array of struct man_module followed by a | ||
| 147 | * variable size array of struct mod_config. These should have been | ||
| 148 | * merged into a variable array of a parent structure. We have to hack | ||
| 149 | * around this in many places.... | ||
| 150 | * | ||
| 151 | * struct sof_man_module man_module[]; | ||
| 152 | * struct sof_man_mod_config mod_config[]; | ||
| 153 | */ | ||
| 154 | |||
| 155 | } __packed; | ||
| 156 | |||
| 157 | /* | ||
| 158 | * Component Descriptor. Used by ROM - Immutable. | ||
| 159 | */ | ||
| 160 | struct sof_man_component_desc { | ||
| 161 | uint32_t reserved[2]; /* all 0 */ | ||
| 162 | uint32_t version; | ||
| 163 | uint8_t hash[SOF_MAN_MOD_SHA256_LEN]; | ||
| 164 | uint32_t base_offset; | ||
| 165 | uint32_t limit_offset; | ||
| 166 | uint32_t attributes[4]; | ||
| 167 | } __packed; | ||
| 168 | |||
| 169 | /* | ||
| 170 | * Audio DSP extended metadata. Used by ROM - Immutable. | ||
| 171 | */ | ||
| 172 | struct sof_man_adsp_meta_file_ext { | ||
| 173 | uint32_t ext_type; /* always 17 for ADSP extension */ | ||
| 174 | uint32_t ext_len; | ||
| 175 | uint32_t imr_type; | ||
| 176 | uint8_t reserved[16]; /* all 0 */ | ||
| 177 | struct sof_man_component_desc comp_desc[1]; | ||
| 178 | } __packed; | ||
| 179 | |||
| 180 | /* | ||
| 181 | * Module Manifest for rimage module metadata. Not used by ROM. | ||
| 182 | */ | ||
| 183 | struct sof_man_module_manifest { | ||
| 184 | struct sof_man_module module; | ||
| 185 | uint32_t text_size; | ||
| 186 | } __packed; | ||
| 187 | |||
| 188 | #endif | ||
diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h index 53ea94bf1c08..dc1b27daaac6 100644 --- a/include/uapi/sound/sof/tokens.h +++ b/include/uapi/sound/sof/tokens.h | |||
| @@ -85,6 +85,7 @@ | |||
| 85 | #define SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE 605 | 85 | #define SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE 605 |
| 86 | #define SOF_TKN_INTEL_DMIC_SAMPLE_RATE 608 | 86 | #define SOF_TKN_INTEL_DMIC_SAMPLE_RATE 608 |
| 87 | #define SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH 609 | 87 | #define SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH 609 |
| 88 | #define SOF_TKN_INTEL_DMIC_UNMUTE_RAMP_TIME_MS 610 | ||
| 88 | 89 | ||
| 89 | /* DMIC PDM */ | 90 | /* DMIC PDM */ |
| 90 | #define SOF_TKN_INTEL_DMIC_PDM_CTRL_ID 700 | 91 | #define SOF_TKN_INTEL_DMIC_PDM_CTRL_ID 700 |
diff --git a/include/uapi/sound/sof/tone.h b/include/uapi/sound/sof/tone.h deleted file mode 100644 index d7c6e5d8317e..000000000000 --- a/include/uapi/sound/sof/tone.h +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ | ||
| 2 | /* | ||
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
| 4 | * redistributing this file, you may do so under either license. | ||
| 5 | * | ||
| 6 | * Copyright(c) 2018 Intel Corporation. All rights reserved. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_TONE_H__ | ||
| 10 | #define __INCLUDE_UAPI_SOUND_SOF_USER_TONE_H__ | ||
| 11 | |||
| 12 | #define SOF_TONE_IDX_FREQUENCY 0 | ||
| 13 | #define SOF_TONE_IDX_AMPLITUDE 1 | ||
| 14 | #define SOF_TONE_IDX_FREQ_MULT 2 | ||
| 15 | #define SOF_TONE_IDX_AMPL_MULT 3 | ||
| 16 | #define SOF_TONE_IDX_LENGTH 4 | ||
| 17 | #define SOF_TONE_IDX_PERIOD 5 | ||
| 18 | #define SOF_TONE_IDX_REPEATS 6 | ||
| 19 | #define SOF_TONE_IDX_LIN_RAMP_STEP 7 | ||
| 20 | |||
| 21 | #endif | ||
diff --git a/include/uapi/sound/sof/trace.h b/include/uapi/sound/sof/trace.h deleted file mode 100644 index ffa7288a0f16..000000000000 --- a/include/uapi/sound/sof/trace.h +++ /dev/null | |||
| @@ -1,66 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ | ||
| 2 | /* | ||
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
| 4 | * redistributing this file, you may do so under either license. | ||
| 5 | * | ||
| 6 | * Copyright(c) 2018 Intel Corporation. All rights reserved. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_TRACE_H__ | ||
| 10 | #define __INCLUDE_UAPI_SOUND_SOF_USER_TRACE_H__ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * Host system time. | ||
| 14 | * | ||
| 15 | * This property is used by the driver to pass down information about | ||
| 16 | * current system time. It is expressed in us. | ||
| 17 | * FW translates timestamps (in log entries, probe pockets) to this time | ||
| 18 | * domain. | ||
| 19 | * | ||
| 20 | * (cavs: SystemTime). | ||
| 21 | */ | ||
| 22 | struct system_time { | ||
| 23 | uint32_t val_l; /* Lower dword of current host time value */ | ||
| 24 | uint32_t val_u; /* Upper dword of current host time value */ | ||
| 25 | } __packed; | ||
| 26 | |||
| 27 | #define LOG_ENABLE 1 /* Enable logging */ | ||
| 28 | #define LOG_DISABLE 0 /* Disable logging */ | ||
| 29 | |||
| 30 | #define LOG_LEVEL_CRITICAL 1 /* (FDK fatal) */ | ||
| 31 | #define LOG_LEVEL_VERBOSE 2 | ||
| 32 | |||
| 33 | /* | ||
| 34 | * Layout of a log fifo. | ||
| 35 | */ | ||
| 36 | struct log_buffer_layout { | ||
| 37 | uint32_t read_ptr; /*read pointer */ | ||
| 38 | uint32_t write_ptr; /* write pointer */ | ||
| 39 | uint32_t buffer[0]; /* buffer */ | ||
| 40 | } __packed; | ||
| 41 | |||
| 42 | /* | ||
| 43 | * Log buffer status reported by FW. | ||
| 44 | */ | ||
| 45 | struct log_buffer_status { | ||
| 46 | uint32_t core_id; /* ID of core that logged to other half */ | ||
| 47 | } __packed; | ||
| 48 | |||
| 49 | #define TRACE_ID_LENGTH 12 | ||
| 50 | |||
| 51 | /* | ||
| 52 | * Log entry header. | ||
| 53 | * | ||
| 54 | * The header is followed by an array of arguments (uint32_t[]). | ||
| 55 | * Number of arguments is specified by the params_num field of log_entry | ||
| 56 | */ | ||
| 57 | struct log_entry_header { | ||
| 58 | uint32_t id_0 : TRACE_ID_LENGTH; /* e.g. Pipeline ID */ | ||
| 59 | uint32_t id_1 : TRACE_ID_LENGTH; /* e.g. Component ID */ | ||
| 60 | uint32_t core_id : 8; /* Reporting core's id */ | ||
| 61 | |||
| 62 | uint64_t timestamp; /* Timestamp (in dsp ticks) */ | ||
| 63 | uint32_t log_entry_address; /* Address of log entry in ELF */ | ||
| 64 | } __packed; | ||
| 65 | |||
| 66 | #endif | ||
diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h new file mode 100644 index 000000000000..2e302c0f41f7 --- /dev/null +++ b/include/vdso/datapage.h | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __VDSO_DATAPAGE_H | ||
| 3 | #define __VDSO_DATAPAGE_H | ||
| 4 | |||
| 5 | #ifndef __ASSEMBLY__ | ||
| 6 | |||
| 7 | #include <linux/bits.h> | ||
| 8 | #include <linux/time.h> | ||
| 9 | #include <linux/types.h> | ||
| 10 | |||
| 11 | #define VDSO_BASES (CLOCK_TAI + 1) | ||
| 12 | #define VDSO_HRES (BIT(CLOCK_REALTIME) | \ | ||
| 13 | BIT(CLOCK_MONOTONIC) | \ | ||
| 14 | BIT(CLOCK_BOOTTIME) | \ | ||
| 15 | BIT(CLOCK_TAI)) | ||
| 16 | #define VDSO_COARSE (BIT(CLOCK_REALTIME_COARSE) | \ | ||
| 17 | BIT(CLOCK_MONOTONIC_COARSE)) | ||
| 18 | #define VDSO_RAW (BIT(CLOCK_MONOTONIC_RAW)) | ||
| 19 | |||
| 20 | #define CS_HRES_COARSE 0 | ||
| 21 | #define CS_RAW 1 | ||
| 22 | #define CS_BASES (CS_RAW + 1) | ||
| 23 | |||
| 24 | /** | ||
| 25 | * struct vdso_timestamp - basetime per clock_id | ||
| 26 | * @sec: seconds | ||
| 27 | * @nsec: nanoseconds | ||
| 28 | * | ||
| 29 | * There is one vdso_timestamp object in vvar for each vDSO-accelerated | ||
| 30 | * clock_id. For high-resolution clocks, this encodes the time | ||
| 31 | * corresponding to vdso_data.cycle_last. For coarse clocks this encodes | ||
| 32 | * the actual time. | ||
| 33 | * | ||
| 34 | * To be noticed that for highres clocks nsec is left-shifted by | ||
| 35 | * vdso_data.cs[x].shift. | ||
| 36 | */ | ||
| 37 | struct vdso_timestamp { | ||
| 38 | u64 sec; | ||
| 39 | u64 nsec; | ||
| 40 | }; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * struct vdso_data - vdso datapage representation | ||
| 44 | * @seq: timebase sequence counter | ||
| 45 | * @clock_mode: clock mode | ||
| 46 | * @cycle_last: timebase at clocksource init | ||
| 47 | * @mask: clocksource mask | ||
| 48 | * @mult: clocksource multiplier | ||
| 49 | * @shift: clocksource shift | ||
| 50 | * @basetime[clock_id]: basetime per clock_id | ||
| 51 | * @tz_minuteswest: minutes west of Greenwich | ||
| 52 | * @tz_dsttime: type of DST correction | ||
| 53 | * @hrtimer_res: hrtimer resolution | ||
| 54 | * @__unused: unused | ||
| 55 | * | ||
| 56 | * vdso_data will be accessed by 64 bit and compat code at the same time | ||
| 57 | * so we should be careful before modifying this structure. | ||
| 58 | */ | ||
| 59 | struct vdso_data { | ||
| 60 | u32 seq; | ||
| 61 | |||
| 62 | s32 clock_mode; | ||
| 63 | u64 cycle_last; | ||
| 64 | u64 mask; | ||
| 65 | u32 mult; | ||
| 66 | u32 shift; | ||
| 67 | |||
| 68 | struct vdso_timestamp basetime[VDSO_BASES]; | ||
| 69 | |||
| 70 | s32 tz_minuteswest; | ||
| 71 | s32 tz_dsttime; | ||
| 72 | u32 hrtimer_res; | ||
| 73 | u32 __unused; | ||
| 74 | }; | ||
| 75 | |||
| 76 | /* | ||
| 77 | * We use the hidden visibility to prevent the compiler from generating a GOT | ||
| 78 | * relocation. Not only is going through a GOT useless (the entry couldn't and | ||
| 79 | * must not be overridden by another library), it does not even work: the linker | ||
| 80 | * cannot generate an absolute address to the data page. | ||
| 81 | * | ||
| 82 | * With the hidden visibility, the compiler simply generates a PC-relative | ||
| 83 | * relocation, and this is what we need. | ||
| 84 | */ | ||
| 85 | extern struct vdso_data _vdso_data[CS_BASES] __attribute__((visibility("hidden"))); | ||
| 86 | |||
| 87 | #endif /* !__ASSEMBLY__ */ | ||
| 88 | |||
| 89 | #endif /* __VDSO_DATAPAGE_H */ | ||
diff --git a/include/vdso/helpers.h b/include/vdso/helpers.h new file mode 100644 index 000000000000..01641dbb68ef --- /dev/null +++ b/include/vdso/helpers.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __VDSO_HELPERS_H | ||
| 3 | #define __VDSO_HELPERS_H | ||
| 4 | |||
| 5 | #ifndef __ASSEMBLY__ | ||
| 6 | |||
| 7 | #include <vdso/datapage.h> | ||
| 8 | |||
| 9 | static __always_inline u32 vdso_read_begin(const struct vdso_data *vd) | ||
| 10 | { | ||
| 11 | u32 seq; | ||
| 12 | |||
| 13 | while ((seq = READ_ONCE(vd->seq)) & 1) | ||
| 14 | cpu_relax(); | ||
| 15 | |||
| 16 | smp_rmb(); | ||
| 17 | return seq; | ||
| 18 | } | ||
| 19 | |||
| 20 | static __always_inline u32 vdso_read_retry(const struct vdso_data *vd, | ||
| 21 | u32 start) | ||
| 22 | { | ||
| 23 | u32 seq; | ||
| 24 | |||
| 25 | smp_rmb(); | ||
| 26 | seq = READ_ONCE(vd->seq); | ||
| 27 | return seq != start; | ||
| 28 | } | ||
| 29 | |||
| 30 | static __always_inline void vdso_write_begin(struct vdso_data *vd) | ||
| 31 | { | ||
| 32 | /* | ||
| 33 | * WRITE_ONCE it is required otherwise the compiler can validly tear | ||
| 34 | * updates to vd[x].seq and it is possible that the value seen by the | ||
| 35 | * reader it is inconsistent. | ||
| 36 | */ | ||
| 37 | WRITE_ONCE(vd[CS_HRES_COARSE].seq, vd[CS_HRES_COARSE].seq + 1); | ||
| 38 | WRITE_ONCE(vd[CS_RAW].seq, vd[CS_RAW].seq + 1); | ||
| 39 | smp_wmb(); | ||
| 40 | } | ||
| 41 | |||
| 42 | static __always_inline void vdso_write_end(struct vdso_data *vd) | ||
| 43 | { | ||
| 44 | smp_wmb(); | ||
| 45 | /* | ||
| 46 | * WRITE_ONCE it is required otherwise the compiler can validly tear | ||
| 47 | * updates to vd[x].seq and it is possible that the value seen by the | ||
| 48 | * reader it is inconsistent. | ||
| 49 | */ | ||
| 50 | WRITE_ONCE(vd[CS_HRES_COARSE].seq, vd[CS_HRES_COARSE].seq + 1); | ||
| 51 | WRITE_ONCE(vd[CS_RAW].seq, vd[CS_RAW].seq + 1); | ||
| 52 | } | ||
| 53 | |||
| 54 | #endif /* !__ASSEMBLY__ */ | ||
| 55 | |||
| 56 | #endif /* __VDSO_HELPERS_H */ | ||
diff --git a/include/vdso/vsyscall.h b/include/vdso/vsyscall.h new file mode 100644 index 000000000000..2c6134e0c23d --- /dev/null +++ b/include/vdso/vsyscall.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __VDSO_VSYSCALL_H | ||
| 3 | #define __VDSO_VSYSCALL_H | ||
| 4 | |||
| 5 | #ifndef __ASSEMBLY__ | ||
| 6 | |||
| 7 | #include <asm/vdso/vsyscall.h> | ||
| 8 | |||
| 9 | #endif /* !__ASSEMBLY__ */ | ||
| 10 | |||
| 11 | #endif /* __VDSO_VSYSCALL_H */ | ||
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h index b03fafa1ff58..06b0b57e996c 100644 --- a/include/video/imx-ipu-v3.h +++ b/include/video/imx-ipu-v3.h | |||
| @@ -387,20 +387,64 @@ enum ipu_ic_task { | |||
| 387 | IC_NUM_TASKS, | 387 | IC_NUM_TASKS, |
| 388 | }; | 388 | }; |
| 389 | 389 | ||
| 390 | /* | ||
| 391 | * The parameters that describe a colorspace according to the | ||
| 392 | * Image Converter: | ||
| 393 | * - Y'CbCr encoding | ||
| 394 | * - quantization | ||
| 395 | * - "colorspace" (RGB or YUV). | ||
| 396 | */ | ||
| 397 | struct ipu_ic_colorspace { | ||
| 398 | enum v4l2_ycbcr_encoding enc; | ||
| 399 | enum v4l2_quantization quant; | ||
| 400 | enum ipu_color_space cs; | ||
| 401 | }; | ||
| 402 | |||
| 403 | static inline void | ||
| 404 | ipu_ic_fill_colorspace(struct ipu_ic_colorspace *ic_cs, | ||
| 405 | enum v4l2_ycbcr_encoding enc, | ||
| 406 | enum v4l2_quantization quant, | ||
| 407 | enum ipu_color_space cs) | ||
| 408 | { | ||
| 409 | ic_cs->enc = enc; | ||
| 410 | ic_cs->quant = quant; | ||
| 411 | ic_cs->cs = cs; | ||
| 412 | } | ||
| 413 | |||
| 414 | struct ipu_ic_csc_params { | ||
| 415 | s16 coeff[3][3]; /* signed 9-bit integer coefficients */ | ||
| 416 | s16 offset[3]; /* signed 11+2-bit fixed point offset */ | ||
| 417 | u8 scale:2; /* scale coefficients * 2^(scale-1) */ | ||
| 418 | bool sat:1; /* saturate to (16, 235(Y) / 240(U, V)) */ | ||
| 419 | }; | ||
| 420 | |||
| 421 | struct ipu_ic_csc { | ||
| 422 | struct ipu_ic_colorspace in_cs; | ||
| 423 | struct ipu_ic_colorspace out_cs; | ||
| 424 | struct ipu_ic_csc_params params; | ||
| 425 | }; | ||
| 426 | |||
| 390 | struct ipu_ic; | 427 | struct ipu_ic; |
| 428 | |||
| 429 | int __ipu_ic_calc_csc(struct ipu_ic_csc *csc); | ||
| 430 | int ipu_ic_calc_csc(struct ipu_ic_csc *csc, | ||
| 431 | enum v4l2_ycbcr_encoding in_enc, | ||
| 432 | enum v4l2_quantization in_quant, | ||
| 433 | enum ipu_color_space in_cs, | ||
| 434 | enum v4l2_ycbcr_encoding out_enc, | ||
| 435 | enum v4l2_quantization out_quant, | ||
| 436 | enum ipu_color_space out_cs); | ||
| 391 | int ipu_ic_task_init(struct ipu_ic *ic, | 437 | int ipu_ic_task_init(struct ipu_ic *ic, |
| 438 | const struct ipu_ic_csc *csc, | ||
| 392 | int in_width, int in_height, | 439 | int in_width, int in_height, |
| 393 | int out_width, int out_height, | 440 | int out_width, int out_height); |
| 394 | enum ipu_color_space in_cs, | ||
| 395 | enum ipu_color_space out_cs); | ||
| 396 | int ipu_ic_task_init_rsc(struct ipu_ic *ic, | 441 | int ipu_ic_task_init_rsc(struct ipu_ic *ic, |
| 442 | const struct ipu_ic_csc *csc, | ||
| 397 | int in_width, int in_height, | 443 | int in_width, int in_height, |
| 398 | int out_width, int out_height, | 444 | int out_width, int out_height, |
| 399 | enum ipu_color_space in_cs, | ||
| 400 | enum ipu_color_space out_cs, | ||
| 401 | u32 rsc); | 445 | u32 rsc); |
| 402 | int ipu_ic_task_graphics_init(struct ipu_ic *ic, | 446 | int ipu_ic_task_graphics_init(struct ipu_ic *ic, |
| 403 | enum ipu_color_space in_g_cs, | 447 | const struct ipu_ic_colorspace *g_in_cs, |
| 404 | bool galpha_en, u32 galpha, | 448 | bool galpha_en, u32 galpha, |
| 405 | bool colorkey_en, u32 colorkey); | 449 | bool colorkey_en, u32 colorkey); |
| 406 | void ipu_ic_task_enable(struct ipu_ic *ic); | 450 | void ipu_ic_task_enable(struct ipu_ic *ic); |
diff --git a/include/video/omapfb_dss.h b/include/video/omapfb_dss.h index a167b839eccb..e8eaac2cb7b8 100644 --- a/include/video/omapfb_dss.h +++ b/include/video/omapfb_dss.h | |||
| @@ -114,11 +114,6 @@ enum omap_dss_trans_key_type { | |||
| 114 | OMAP_DSS_COLOR_KEY_VID_SRC = 1, | 114 | OMAP_DSS_COLOR_KEY_VID_SRC = 1, |
| 115 | }; | 115 | }; |
| 116 | 116 | ||
| 117 | enum omap_rfbi_te_mode { | ||
| 118 | OMAP_DSS_RFBI_TE_MODE_1 = 1, | ||
| 119 | OMAP_DSS_RFBI_TE_MODE_2 = 2, | ||
| 120 | }; | ||
| 121 | |||
| 122 | enum omap_dss_signal_level { | 117 | enum omap_dss_signal_level { |
| 123 | OMAPDSS_SIG_ACTIVE_LOW, | 118 | OMAPDSS_SIG_ACTIVE_LOW, |
| 124 | OMAPDSS_SIG_ACTIVE_HIGH, | 119 | OMAPDSS_SIG_ACTIVE_HIGH, |
| @@ -189,27 +184,6 @@ enum omap_dss_output_id { | |||
| 189 | OMAP_DSS_OUTPUT_HDMI = 1 << 6, | 184 | OMAP_DSS_OUTPUT_HDMI = 1 << 6, |
| 190 | }; | 185 | }; |
| 191 | 186 | ||
| 192 | /* RFBI */ | ||
| 193 | |||
| 194 | struct rfbi_timings { | ||
| 195 | int cs_on_time; | ||
| 196 | int cs_off_time; | ||
| 197 | int we_on_time; | ||
| 198 | int we_off_time; | ||
| 199 | int re_on_time; | ||
| 200 | int re_off_time; | ||
| 201 | int we_cycle_time; | ||
| 202 | int re_cycle_time; | ||
| 203 | int cs_pulse_width; | ||
| 204 | int access_time; | ||
| 205 | |||
| 206 | int clk_div; | ||
| 207 | |||
| 208 | u32 tim[5]; /* set by rfbi_convert_timings() */ | ||
| 209 | |||
| 210 | int converted; | ||
| 211 | }; | ||
| 212 | |||
| 213 | /* DSI */ | 187 | /* DSI */ |
| 214 | 188 | ||
| 215 | enum omap_dss_dsi_trans_mode { | 189 | enum omap_dss_dsi_trans_mode { |
| @@ -641,11 +615,6 @@ struct omap_dss_device { | |||
| 641 | } dpi; | 615 | } dpi; |
| 642 | 616 | ||
| 643 | struct { | 617 | struct { |
| 644 | u8 channel; | ||
| 645 | u8 data_lines; | ||
| 646 | } rfbi; | ||
| 647 | |||
| 648 | struct { | ||
| 649 | u8 datapairs; | 618 | u8 datapairs; |
| 650 | } sdi; | 619 | } sdi; |
| 651 | 620 | ||
| @@ -668,7 +637,6 @@ struct omap_dss_device { | |||
| 668 | 637 | ||
| 669 | struct { | 638 | struct { |
| 670 | u8 pixel_size; | 639 | u8 pixel_size; |
| 671 | struct rfbi_timings rfbi_timings; | ||
| 672 | } ctrl; | 640 | } ctrl; |
| 673 | 641 | ||
| 674 | const char *name; | 642 | const char *name; |
