
* remotes/origin/tmp-0453f563cce0: FROMLIST: pwm: Convert period and duty cycle to u64 ANDROID: gki_defconfig: FW_CACHE to no FROMGIT: firmware_class: make firmware caching configurable ANDROID: gki_defconfig: removed CONFIG_PM_WAKELOCKS ANDROID: gki_defconfig: enable CONFIG_IKHEADERS as m ANDROID: update ABI representation FROMLIST: reboot: Export reboot_mode FROMLIST: iommu/arm-smmu: Update my email address in MODULE_AUTHOR() FROMLIST: iommu/arm-smmu: Allow building as a module FROMLIST: iommu/arm-smmu: Unregister IOMMU and bus ops on device removal FROMLIST: iommu/arm-smmu-v3: Allow building as a module FROMLIST: iommu/arm-smmu-v3: Unregister IOMMU and bus ops on device removal FROMLIST: iommu/arm-smmu: Prevent forced unbinding of Arm SMMU drivers FROMLIST: Revert "iommu/arm-smmu: Make arm-smmu explicitly non-modular" FROMLIST: Revert "iommu/arm-smmu: Make arm-smmu-v3 explicitly non-modular" FROMLIST: drivers/iommu: Allow IOMMU bus ops to be unregistered FROMLIST: iommu/of: Take a ref to the IOMMU driver during ->of_xlate() FROMLIST: drivers/iommu: Take a ref to the IOMMU driver prior to ->add_device() FROMLIST: PCI: Export pci_ats_disabled() as a GPL symbol to modules FROMLIST: iommu/of: Request ACS from the PCI core when configuring IOMMU linkage FROMLIST: drivers/iommu: Export core IOMMU API symbols to permit modular drivers FROMGIT: of: property: Add device link support for "iommu-map" Revert "FROMLIST: iommu: Export core IOMMU functions to kernel modules" Revert "FROMLIST: PCI: Export PCI ACS and DMA searching functions to modules" Revert "FROMLIST: of: Export of_phandle_iterator_args() to modules" ANDROID: initial branch preparations for 5.4 Linux 5.4 cramfs: fix usage on non-MTD device Revert "Input: synaptics - enable RMI mode for X1 Extreme 2nd Generation" afs: Fix large file support afs: Fix possible assert with callbacks from yfs servers r8152: avoid to call napi_disable twice MAINTAINERS: Add myself as maintainer of virtio-vsock udp: drop skb extensions before marking skb stateless net: rtnetlink: prevent underflows in do_setvfinfo() mm/ksm.c: don't WARN if page is still mapped in remove_stable_node() mm/memory_hotplug: don't access uninitialized memmaps in shrink_zone_span() Revert "fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()" can: m_can_platform: remove unnecessary m_can_class_resume() call can: m_can_platform: set net_device structure as driver data hv_netvsc: Fix send_table offset in case of a host bug hv_netvsc: Fix offset usage in netvsc_send_table() net-ipv6: IPV6_TRANSPARENT - check NET_RAW prior to NET_ADMIN ANDROID: gki_defconfig: disable FUNCTION_TRACER sfc: Only cancel the PPS workqueue if it exists nfc: port100: handle command failure cleanly drm/i915/fbdev: Restore physical addresses for fb_mmap() net-sysfs: fix netdev_queue_add_kobject() breakage ANDROID: update ABI representation ANDROID: add unstripped modules to the distribution Revert "drm/amd/display: enable S/G for RAVEN chip" drm/amdgpu: disable gfxoff on original raven drm/amdgpu: disable gfxoff when using register read interface drm/amd/powerplay: correct fine grained dpm force level setting drm/amd/powerplay: issue no PPSMC_MSG_GetCurrPkgPwr on unsupported ASICs drm/amdgpu: remove experimental flag for Navi14 r8152: Re-order napi_disable in rtl8152_close net: qca_spi: Move reset_count to struct qcaspi net: qca_spi: fix receive buffer size check net/ibmvnic: Ignore H_FUNCTION return from H_EOI to tolerate XIVE mode Revert "net/ibmvnic: Fix EOI when running in XIVE mode" net/mlxfw: Verify FSM error code translation doesn't exceed array size net/mlx5: Update the list of the PCI supported devices net/mlx5: Fix auto group size calculation net/mlx5e: Add missing capability bit check for IP-in-IP net/mlx5e: Do not use non-EXT link modes in EXT mode net/mlx5e: Fix set vf link state error flow net/mlx5: DR, Limit STE hash table enlarge based on bytemask net/mlx5: DR, Skip rehash for tables with byte mask zero net/mlx5: DR, Fix invalid EQ vector number on CQ creation net/mlx5e: Reorder mirrer action parsing to check for encap first net/mlx5e: Fix ingress rate configuration for representors net/mlx5e: Fix error flow cleanup in mlx5e_tc_tun_create_header_ipv4/6 s390/qeth: return proper errno on IO error s390/qeth: fix potential deadlock on workqueue flush ipv6/route: return if there is no fib_nh_gw_family net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject arm64: uaccess: Remove uaccess_*_not_uao asm macros arm64: uaccess: Ensure PAN is re-enabled after unhandled uaccess fault BACKPORT: FROMLIST: pwm: Add support for different PWM output types ANDROID: SoC: core: Introduce macro SOC_SINGLE_MULTI_EXT ANDROID: usb: gadget: configfs: fix compiler warning fork: fix pidfd_poll()'s return type PM: QoS: Invalidate frequency QoS requests after removal virtio_balloon: fix shrinker count virtio_balloon: fix shrinker scan number of pages mdio_bus: Fix init if CONFIG_RESET_CONTROLLER=n Revert "mdio_bus: fix mdio_register_device when RESET_CONTROLLER is disabled" net: hns3: fix a wrong reset interrupt status mask net: fec: fix clock count mis-match net/sched: act_pedit: fix WARN() in the traffic path net: phylink: fix link mode modification in PHY mode net: phylink: update documentation on create and destroy r8169: disable TSO on a single version of RTL8168c to fix performance MAINTAINERS: forcedeth: Change Zhu Yanjun's email address taprio: don't reject same mqprio settings net/tls: enable sk_msg redirect to tls socket egress afs: Fix missing timeout reset ANDROID: drivers: gpu: drm: add support to batch commands gve: fix dma sync bug where not all pages synced drm/i915: make pool objects read-only mdio_bus: Fix init if CONFIG_RESET_CONTROLLER=n nbd:fix memory leak in nbd_get_socket() virtio_console: allocate inbufs in add_port() only if it is needed virtio_ring: fix return code on DMA mapping fails mdio_bus: fix mdio_register_device when RESET_CONTROLLER is disabled net/ipv4: fix sysctl max for fib_multipath_hash_policy phy: mdio-sun4i: add missed regulator_disable in remove net/mlx4_en: Fix wrong limitation for number of TX rings net: sched: ensure opts_len <= IP_TUNNEL_OPTS_MAX in act_tunnel_key mlxsw: spectrum_router: Fix determining underlay for a GRE tunnel net: atm: Reduce the severity of logging in unlink_clip_vcc ANDROID: virtio_blk: Remove BUG_ON for discard/zero ops drm/i915: Protect request peeking with RCU drm/i915/userptr: Try to acquire the page lock around set_page_dirty() drm/i915/pmu: "Frequency" is reported as accumulated cycles drm/i915: Preload LUTs if the hw isn't currently using them drm/i915: Don't oops in dumb_create ioctl if we have no crtcs ANDROID: usb: gadget: configfs: Support multiple android instances Linux 5.4-rc8 net/mlx4_en: fix mlx4 ethtool -N insertion Revert "hwrng: core - Freeze khwrng thread during suspend" ipmr: Fix skb headroom in ipmr_get_route(). net: hns3: cleanup of stray struct hns3_link_mode_mapping net/smc: fix fastopen for non-blocking connect() rds: ib: update WR sizes when bringing up connection net: gemini: add missed free_netdev net: dsa: tag_8021q: Fix dsa_8021q_restore_pvid for an absent pvid seg6: fix skb transport_header after decap_and_validate() seg6: fix srh pointer in get_srh() net: stmmac: Use the correct style for SPDX License Identifier octeontx2-af: Use the correct style for SPDX License Identifier mm/debug.c: PageAnon() is true for PageKsm() pages mm/debug.c: __dump_page() prints an extra line mm/page_io.c: do not free shared swap slots mm/memory_hotplug: fix try_offline_node() mm,thp: recheck each page before collapsing file THP mm: slub: really fix slab walking for init_on_free mm: hugetlb: switch to css_tryget() in hugetlb_cgroup_charge_cgroup() mm: memcg: switch to css_tryget() in get_mem_cgroup_from_mm() lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations mm: fix trying to reclaim unevictable lru page when calling madvise_pageout mm: mempolicy: fix the wrong return value and potential pages leak of mbind ANDROID: ion: Fix buffer_lock mutex initialization Input: synaptics - enable RMI mode for X1 Extreme 2nd Generation i2c: core: fix use after free in of_i2c_notify i2c: acpi: Force bus speed to 400KHz if a Silead touchscreen is present ptp: Extend the test program to check the external time stamp flags. mlx5: Reject requests to enable time stamping on both edges. igb: Reject requests that fail to enable time stamping on both edges. dp83640: Reject requests to enable time stamping on both edges. mv88e6xxx: Reject requests to enable time stamping on both edges. ptp: Introduce strict checking of external time stamp options. renesas: reject unsupported external timestamp flags mlx5: reject unsupported external timestamp flags igb: reject unsupported external timestamp flags dp83640: reject unsupported external timestamp flags mv88e6xxx: reject unsupported external timestamp flags net: reject PTP periodic output requests with unsupported flags ptp: Validate requests to enable time stamping of external signals. net: ep93xx_eth: fix mismatch of request_mem_region in remove ax88172a: fix information leak on short answers selftests: mlxsw: Adjust test to recent changes Input: synaptics-rmi4 - destroy F54 poller workqueue when removing Input: ff-memless - kill timer in destroy() FROMGIT: driver core: Allow device link operations inside sync_state() afs: Fix race in commit bulk status fetch Revert "ANDROID: Revert "Merge tag 'modules-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux"" sched/uclamp: Fix incorrect condition KVM: Add a comment describing the /dev/kvm no_compat handling net: hns3: fix ETS bandwidth validation bug net: hns3: reallocate SSU' buffer size when pfc_en changes net: hns3: add compatible handling for MAC VLAN switch parameter configuration ravb: implement MTU change while device is up tipc: add back tipc prefix to log messages ANDROID: uid_sys_stats: avoid double accounting of dying threads ANDROID: drm: edid: add support for additional CEA extension blocks ANDROID: include: uapi: drm: add additional drm mode flags ANDROID: drivers: gpu: drm: fix bugs encountered while fuzzing ANDROID: driver: gpu: drm: add notifier for panel related events ANDROID: include: drm: add the definitions for DP Link Compliance tests ANDROID: drm: dsi: add two DSI mode flags for BLLP ANDROID: include: drm: support unicasting mipi cmds to dsi ctrls ANDROID: include: drm: increase DRM max property count to 64 ANDROID: drivers: gpu: drm: add support for secure framebuffer ANDROID: include: uapi: drm: add additional QCOM modifiers ANDROID: build kernels with llvm-nm and llvm-objcopy drm/amdgpu: fix null pointer deref in firmware header printing rsxx: add missed destroy_workqueue calls in remove iocost: check active_list of all the ancestors in iocg_activate() rbd: silence bogus uninitialized warning in rbd_object_map_update_finish() ceph: increment/decrement dio counter on async requests ceph: take the inode lock before acquiring cap refs ALSA: usb-audio: Fix incorrect size check for processing/extension units KVM: x86/mmu: Take slots_lock when using kvm_mmu_zap_all_fast() kbuild: tell sparse about the $ARCH sparc: vdso: fix build error of vdso32 block, bfq: deschedule empty bfq_queues not referred by any process mmc: sdhci-of-at91: fix quirk2 overwrite ALSA: usb-audio: Fix incorrect NULL check in create_yamaha_midi_quirk() slcan: Fix memory leak in error path io_uring: ensure registered buffer import returns the IO length net: cdc_ncm: Signedness bug in cdc_ncm_set_dgram_size() io_uring: Fix getting file for timeout ANDROID: scsi: ufs-qcom: Enable BROKEN_CRYPTO quirk flag ANDROID: scsi: ufs-hisi: Enable BROKEN_CRYPTO quirk flag ANDROID: scsi: ufs: Add quirk bit for controllers that don't play well with inline crypto ANDROID: scsi: ufs: UFS init should not require inline crypto gpiolib: acpi: Add Terra Pad 1061 to the run_edge_events_on_boot_blacklist drm/i915/tgl: MOCS table update Revert "drm/i915/ehl: Update MOCS table for EHL" slip: Fix memory leak in slip_open error path net: usb: qmi_wwan: add support for Foxconn T77W968 LTE modules KVM: Forbid /dev/kvm being opened by a compat task when CONFIG_KVM_COMPAT=n KVM: X86: Reset the three MSR list number variables to 0 in kvm_init_msr_list() selftests: kvm: fix build with glibc >= 2.30 kvm: x86: disable shattered huge page recovery for PREEMPT_RT. drm/sun4i: tcon: Set min division of TCON0_DCLK to 1. tools: gpio: Correctly add make dependencies for gpio_utils x86/resctrl: Fix potential lockdep warning scripts/tools-support-relr.sh: un-quote variables Revert "ANDROID: Revert "Merge tag 'modules-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux"" ALSA: pcm: Fix stream lock usage in snd_pcm_period_elapsed() ALSA: usb-audio: not submit urb for stopped endpoint can: j1939: warn if resources are still linked on destroy can: j1939: j1939_can_recv(): add priv refcounting can: j1939: transport: j1939_cancel_active_session(): use hrtimer_try_to_cancel() instead of hrtimer_cancel() can: j1939: make sure socket is held as long as session exists can: j1939: transport: make sure the aborted session will be deactivated only once can: j1939: socket: rework socket locking for j1939_sk_release() and j1939_sk_sendmsg() can: j1939: main: j1939_ndev_to_priv(): avoid crash if can_ml_priv is NULL can: j1939: move j1939_priv_put() into sk_destruct callback can: af_can: export can_sock_destruct() perf/core: Fix missing static inline on perf_cgroup_switch() perf/core: Consistently fail fork on allocation failures perf/aux: Disallow aux_output for kernel events perf/core: Reattach a misplaced comment perf/aux: Fix the aux_output group inheritance fix perf/core: Disallow uncore-cgroup events sched/pelt: Fix update of blocked PELT ordering sched/core: Avoid spurious lock dependencies dpaa2-eth: free already allocated channels on probe defer Input: cyttsp4_core - fix use after free bug Input: synaptics-rmi4 - clear IRQ enables for F54 Remove VirtualBox guest shared folders filesystem net/smc: fix refcount non-blocking connect() -part 2 drm/i915: update rawclk also on resume x86/quirks: Disable HPET on Intel Coffe Lake platforms block: check bi_size overflow before merge gpio: bd70528: Use correct unit for debounce times gpio: max77620: Fixup debounce delays KVM: MMU: Do not treat ZONE_DEVICE pages as being reserved KVM: VMX: Introduce pi_is_pir_empty() helper KVM: VMX: Do not change PID.NDST when loading a blocked vCPU KVM: VMX: Consider PID.PIR to determine if vCPU has pending interrupts KVM: VMX: Fix comment to specify PID.ON instead of PIR.ON KVM: X86: Fix initialization of MSR lists xfrm: release device reference for invalid state io_uring: make timeout sequence == 0 mean no sequence ntp/y2038: Remove incorrect time_t truncation mdio_bus: Fix PTR_ERR applied after initialization to constant NFC: nxp-nci: Fix NULL pointer dereference after I2C communication error mlxsw: core: Enable devlink reload only on probe FROMGIT: of: property: Add device link support for iommus, mboxes and io-channels FROMGIT: of: property: Make it easy to add device links from DT properties FROMGIT: of: property: Minor style clean up of of_link_to_phandle() Revert "ANDROID: of/property: Add device link support for iommus" devlink: Add method for time-stamp on reporter's dump net: ethernet: dwmac-sun8i: Use the correct function in exit path Btrfs: fix log context list corruption after rename exchange operation drm/i915/cmdparser: Fix jump whitelist clearing iommu/vt-d: Fix QI_DEV_IOTLB_PFSID and QI_DEV_EIOTLB_PFSID macros MAINTAINERS: Update for INTEL IOMMU (VT-d) entry KVM: fix placement of refcount initialization KVM: Fix NULL-ptr deref after kvm_create_vm fails ALSA: hda: hdmi - fix pin setup on Tigerlake ALSA: hda: Add Cometlake-S PCI ID Revert "Revert "sched: Rework pick_next_task() slow-path"" Linux 5.4-rc7 lib: Remove select of inexistant GENERIC_IO ecryptfs_lookup_interpose(): lower_dentry->d_parent is not stable either ecryptfs_lookup_interpose(): lower_dentry->d_inode is not stable ecryptfs: fix unlink and rmdir in face of underlying fs modifications audit_get_nd(): don't unlock parent too early exportfs_decode_fh(): negative pinned may become positive without the parent locked cgroup: don't put ERR_PTR() into fc->root tcp: remove redundant new line from tcp_event_sk_skb devlink: disallow reload operation during device cleanup ALSA: usb-audio: Fix missing error check at mixer resolution test ixgbe: need_wakeup flag might not be set for Tx i40e: need_wakeup flag might not be set for Tx igb/igc: use ktime accessors for skb->tstamp i40e: Fix for ethtool -m issue on X722 NIC iavf: initialize ITRN registers with correct values ice: fix potential infinite loop because loop counter being too small qede: fix NULL pointer deref in __qede_remove() net: fix data-race in neigh_event_send() sched: Fix pick_next_task() vs 'change' pattern race sched/core: Fix compilation error when cgroup not selected cgroup,writeback: don't switch wbs immediately on dead wbs if the memcg is dead vsock/virtio: fix sock refcnt holding during the shutdown iwlwifi: pcie: don't consider IV len in A-MSDU net: ethernet: octeon_mgmt: Account for second possible VLAN header pwm: bcm-iproc: Prevent unloading the driver module while in use block: drbd: remove a stray unlock in __drbd_send_protocol() cpufreq: intel_pstate: Fix invalid EPB setting mac80211: fix station inactive_time shortly after boot net/fq_impl: Switch to kvmalloc() for memory allocation mac80211: fix ieee80211_txq_setup_flows() failure path drm/i915/gvt: fix dropping obj reference twice ANDROID: Kconfig.gki: Add SND_SOC_COMPRESS ipv4: Fix table id reference in fib_sync_down_addr ipv6: fixes rt6_probe() and fib6_nh->last_probe init net: hns: Fix the stray netpoll locks causing deadlock in NAPI path Revert "ANDROID: Kconfig.gki: Add SND_SOC_COMPRESS" net: usb: qmi_wwan: add support for DW5821e with eSIM support CDC-NCM: handle incomplete transfer of MTU nfc: netlink: fix double device reference drop ANDROID: Kconfig.gki: Add SND_SOC_COMPRESS ceph: return -EINVAL if given fsc mount option on kernel w/o support staging: Fix error return code in vboxsf_fill_super() staging: vboxsf: fix dereference of pointer dentry before it is null checked staging: vboxsf: Remove unused including <linux/version.h> x86/speculation/taa: Fix printing of TAA_MSG_SMT on IBRS_ALL CPUs xfrm: Fix memleak on xfrm state destroy pinctrl: stmfx: fix valid_mask init sequence NFC: st21nfca: fix double free net: hns3: add compatible handling for command HCLGE_OPC_PF_RST_DONE r8169: fix page read in r8168g_mdio_read net: stmmac: Fix the TX IOC in xmit path net: stmmac: Fix TSO descriptor with Enhanced Addressing net: stmmac: Fix the packet count in stmmac_rx() net: stmmac: xgmac: Disable MMC interrupts by default net: stmmac: xgmac: Disable Flow Control when 1 or more queues are in AV net: stmmac: xgmac: Fix AV Feature detection net: stmmac: xgmac: Fix TSA selection net: stmmac: xgmac: Only get SPH header len if available net: stmmac: selftests: Prevent false positives in filter tests net: stmmac: xgmac: bitrev32 returns u32 net: stmmac: gmac4: bitrev32 returns u32 SMB3: Fix persistent handles reconnect drm/radeon: fix si_enable_smc_cac() failed issue drm/amdgpu/renoir: move gfxoff handling into gfx9 module drm/amdgpu: add warning for GRBM 1-cycle delay issue in gfx9 drm/amdgpu: add dummy read by engines for some GCVM status registers in gfx10 drm/amdgpu: register gpu instance before fan boost feature enablment drm/amd/swSMU: fix smu workload bit map error net/smc: fix ethernet interface refcounting selftests/tls: add test for concurrent recv and send net/tls: add a TX lock net/tls: don't pay attention to sk_write_pending when pushing partial records blkcg: make blkcg_print_stat() print stats only for online blkgs drm/shmem: Add docbook comments for drm_gem_shmem_object madvise fields net: mscc: ocelot: fix __ocelot_rmw_ix prototype bpf, offload: Unlock on error in bpf_offload_dev_create() net: mscc: ocelot: fix NULL pointer on LAG slave removal net: mscc: ocelot: don't handle netdev events for other netdevs net/mlx5e: Use correct enum to determine uplink port net/mlx5: DR, Fix memory leak during rule creation net/mlx5: DR, Fix memory leak in modify action destroy net/mlx5e: Fix eswitch debug print of max fdb flow HID: wacom: generic: Treat serial number and related fields as unsigned drm/amdgpu: add navi14 PCI ID Revert "drm/amd/display: setting the DIG_MODE to the correct value." drm/amd/display: Add ENGINE_ID_DIGD condition check for Navi14 drm/amdgpu: dont schedule jobs while in reset drm/amdgpu/arcturus: properly set BANK_SELECT and FRAGMENT_SIZE arm64: Do not mask out PTE_RDONLY in pte_same() ANDROID: nf: IDLETIMER: Fix possible use before initialization in idletimer_resume ANDROID: gki_defconfig: enable FW_LOADER configs net: bcmgenet: reapply manual settings to the PHY Revert "net: bcmgenet: soft reset 40nm EPHYs before MAC init" net: bcmgenet: use RGMII loopback for MAC reset drm/atomic: fix self-refresh helpers crtc state dereference RDMA/hns: Correct the value of srq_desc_size RDMA/hns: Correct the value of HNS_ROCE_HEM_CHUNK_LEN configfs: calculate the depth of parent item IB/hfi1: TID RDMA WRITE should not return IB_WC_RNR_RETRY_EXC_ERR IB/hfi1: Calculate flow weight based on QP MTU for TID RDMA IB/hfi1: Ensure r_tid_ack is valid before building TID RDMA ACK packet IB/hfi1: Ensure full Gen3 speed in a Gen4 system ALSA: timer: Fix incorrectly assigned timer instance mm: memcontrol: fix network errors from failing __GFP_ATOMIC charges mm/memory_hotplug: fix updating the node span scripts/gdb: fix debugging modules compiled with hot/cold partitioning mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly MAINTAINERS: update information for "MEMORY MANAGEMENT" dump_stack: avoid the livelock of the dump_lock zswap: add Vitaly to the maintainers list mm/page_alloc.c: ratelimit allocation failure warnings more aggressively mm/khugepaged: fix might_sleep() warn with CONFIG_HIGHPTE=y mm, vmstat: reduce zone->lock holding time by /proc/pagetypeinfo mm, vmstat: hide /proc/pagetypeinfo from normal users mm/mmu_notifiers: use the right return code for WARN_ON ocfs2: protect extent tree in ocfs2_prepare_inode_for_write() mm: thp: handle page cache THP correctly in PageTransCompoundMap mm, meminit: recalculate pcpu batch and high limits after init completes mm/gup_benchmark: fix MAP_HUGETLB case mm: memcontrol: fix NULL-ptr deref in percpu stats flush MAINTAINERS: update Cavium ThunderX2 maintainers ASoC: SOF: topology: Fix bytes control size checks ARM: dts: stm32: change joystick pinctrl definition on stm32mp157c-ev1 ARM: dts: stm32: remove OV5640 pinctrl definition on stm32mp157c-ev1 ARM: dts: stm32: Fix CAN RAM mapping on stm32mp157c ARM: dts: stm32: relax qspi pins slew-rate for stm32mp157 scsi: core: Handle drivers which set sg_tablesize to zero scsi: qla2xxx: fix NPIV tear down process scsi: sd_zbc: Fix sd_zbc_complete() Documentation: TLS: Add missing counter description NFC: fdp: fix incorrect free object net: prevent load/store tearing on sk->sk_stamp net: qualcomm: rmnet: Fix potential UAF when unregistering net/tls: fix sk_msg trim on fallback to copy mode mlx4_core: fix wrong comment about the reason of subtract one from the max_cqes net: dsa: bcm_sf2: Fix driver removal net: sched: prevent duplicate flower rules from tcf_proto destroy race net: hns3: Use the correct style for SPDX License Identifier bonding: fix state transition issue in link monitoring taprio: fix panic while hw offload sched list swap FROMLIST: overlayfs: override_creds=off option bypass creator_cred FROMLIST: overlayfs: internal getxattr operations without sepolicy checking FROMLIST: overlayfs: handle XATTR_NOSECURITY flag for get xattr method FROMLIST: Add flags option to get xattr method paired to __vfs_getxattr FROMLIST: afs: xattr: use scnprintf nvme: change nvme_passthru_cmd64 to explicitly mark rsvd drm/i915/gen8+: Add RC6 CTX corruption WA drm/i915: Lower RM timeout to avoid DSI hard hangs drm/i915/cmdparser: Ignore Length operands during command matching drm/i915/cmdparser: Add support for backward jumps drm/i915/cmdparser: Use explicit goto for error paths drm/i915: Add gen9 BCS cmdparsing drm/i915: Allow parsing of unsized batches drm/i915: Support ro ppgtt mapped cmdparser shadow buffers drm/i915: Add support for mandatory cmdparsing drm/i915: Remove Master tables from cmdparser drm/i915: Disable Secure Batches for gen6+ drm/i915: Rename gen7 cmdparser tables ALSA: hda: hdmi - add Tigerlake support ASoC: max98373: replace gpio_request with devm_gpio_request ASoC: stm32: sai: add restriction on mmap support watchdog: bd70528: Add MODULE_ALIAS to allow module auto loading watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format watchdog: meson: Fix the wrong value of left time watchdog: pm8916_wdt: fix pretimeout registration flow watchdog: cpwd: fix build regression nvme-multipath: fix crash in nvme_mpath_clear_ctrl_paths nvme-rdma: fix a segmentation fault during module unload clone3: validate stack arguments ceph: don't allow copy_file_range when stripe_count != 1 ceph: don't try to handle hashed dentries in non-O_CREAT atomic_open ALSA: hda/ca0132 - Fix possible workqueue stall scripts/nsdeps: make sure to pass all module source files to spatch perf tools: Fix time sorting can: don't use deprecated license identifiers can: mcp251x: mcp251x_restart_work_handler(): Fix potential force_quit race condition perf tools: Remove unused trace_find_next_event() perf scripting engines: Iterate on tep event arrays directly FROMGIT: of: property: Skip adding device links to suppliers that aren't devices x86/tsc: Respect tsc command line paraemeter for clocksource_tsc_early Input: synaptics-rmi4 - remove unused result_bits mask Input: synaptics-rmi4 - do not consume more data than we have (F11, F12) Input: synaptics-rmi4 - disable the relative position IRQ in the F12 driver Input: synaptics-rmi4 - fix video buffer size x86/dumpstack/64: Don't evaluate exception stacks before setup irq/irqdomain: Update __irq_domain_alloc_fwnode() function documentation x86/apic/32: Avoid bogus LDR warnings timekeeping/vsyscall: Update VDSO data unconditionally drm/i915/dp: Do not switch aux to TBT mode for non-TC ports drm/i915: Avoid HPD poll detect triggering a new detect cycle can: j1939: transport: j1939_xtp_rx_eoma_one(): Add sanity check for correct total message size can: j1939: transport: j1939_session_fresh_new(): make sure EOMA is send with the total message size set can: j1939: fix memory leak if filters was set can: j1939: fix resource leak of skb on error return paths can: ti_hecc: add missing state changes can: ti_hecc: properly report state changes can: ti_hecc: add fifo overflow error reporting can: ti_hecc: release the mailbox a bit earlier can: ti_hecc: keep MIM and MD set can: ti_hecc: ti_hecc_stop(): stop the CPK on down can: ti_hecc: ti_hecc_error(): increase error counters if skb enqueueing via can_rx_offload_queue_sorted() fails can: flexcan: increase error counters if skb enqueueing via can_rx_offload_queue_sorted() fails can: rx-offload: can_rx_offload_irq_offload_fifo(): continue on error can: rx-offload: can_rx_offload_irq_offload_timestamp(): continue on error can: rx-offload: can_rx_offload_offload_one(): use ERR_PTR() to propagate error value in case of errors can: rx-offload: can_rx_offload_offload_one(): increment rx_fifo_errors on queue overflow or OOM can: rx-offload: can_rx_offload_offload_one(): do not increase the skb_queue beyond skb_queue_len_max can: rx-offload: can_rx_offload_queue_tail(): fix error handling, avoid skb mem leak can: rx-offload: can_rx_offload_queue_sorted(): fix error handling, avoid skb mem leak can: xilinx_can: Fix flags field initialization for axi can can: c_can: C_CAN: add bus recovery events can: c_can: D_CAN: c_can_chip_config(): perform a sofware reset on open can: c_can: c_can_poll(): only read status register after status IRQ can: peak_usb: report bus recovery as well can: peak_usb: fix slab info leak can: peak_usb: fix a potential out-of-sync while decoding packets can: flexcan: disable completely the ECC mechanism can: usb_8dev: fix use-after-free on disconnect can: mcba_usb: fix use-after-free on disconnect can: gs_usb: gs_can_open(): prevent memory leak can: dev: add missing of_node_put() after calling of_get_child_by_name() btrfs: un-deprecate ioctls START_SYNC and WAIT_SYNC btrfs: save i_size to avoid double evaluation of i_size_read in compress_file_range stacktrace: Don't skip first entry on noncurrent tasks netfilter: nf_tables_offload: skip EBUSY on chain update netfilter: nf_tables: bogus EOPNOTSUPP on basechain update bridge: ebtables: don't crash when using dnat target in output chains netfilter: nf_tables: fix unexpected EOPNOTSUPP error netfilter: nf_tables: Align nft_expr private data to 64-bit netfilter: ipset: Fix nla_policies to fully support NL_VALIDATE_STRICT netfilter: ipset: Copy the right MAC address in hash:ip,mac IPv6 sets netfilter: ipset: Fix an error code in ip_set_sockfn_get() dccp: do not leak jiffies on the wire net: fec: add missed clk_disable_unprepare in remove Documentation: Add ITLB_MULTIHIT documentation kvm: x86: mmu: Recovery of shattered NX large pages MAINTAINERS: Remove Kevin as maintainer of BMIPS generic platforms clk: ti: clkctrl: Fix failed to enable error with double udelay timeout clk: ti: dra7-atl-clock: Remove ti_clk_add_alias call netfilter: nf_tables_offload: check for register data length mismatches intel_th: pci: Add Jasper Lake PCH support intel_th: pci: Add Comet Lake PCH support intel_th: msu: Fix possible memory leak in mode_store() intel_th: msu: Fix overflow in shift of an unsigned int intel_th: msu: Fix missing allocation failure check on a kstrndup intel_th: msu: Fix an uninitialized mutex intel_th: gth: Fix the window switching sequence ASoC: hdac_hda: fix race in device removal kvm: Add helper function for creating VM worker threads kvm: mmu: ITLB_MULTIHIT mitigation cpu/speculation: Uninline and export CPU mitigations helpers x86/cpu: Add Tremont to the cpu vulnerability whitelist x86/bugs: Add ITLB_MULTIHIT bug infrastructure fbdev: c2p: Fix link failure on non-inlining ALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire Pro i/o series arm64: dts: zii-ultra: fix ARM regulator GPIO handle Revert "gpio: merrifield: Pass irqchip when adding gpiochip" Revert "gpio: merrifield: Restore use of irq_base" Revert "gpio: merrifield: Move hardware initialization to callback" x86/resctrl: Prevent NULL pointer dereference when reading mondata idr: Fix idr_alloc_u32 on 32-bit systems idr: Fix integer overflow in idr_for_each_entry HID: i2c-hid: Send power-on command after reset radix tree: Remove radix_tree_iter_find idr: Fix idr_get_next_ul race with idr_remove powerpc/bpf: Fix tail call implementation MIPS: SGI-IP27: fix exception handler replication bpf: Change size to u64 for bpf_map_{area_alloc, charge_init}() samples/bpf: fix build by setting HAVE_ATTR_TEST to zero perf tools: Make usage of test_attr__* optional for perf-sys.h bpf: Allow narrow loads of bpf_sysctl fields with offset > 0 staging: Add VirtualBox guest shared folder (vboxsf) support ceph: add missing check in d_revalidate snapdir handling ceph: fix RCU case handling in ceph_d_revalidate() ceph: fix use-after-free in __ceph_remove_cap() bpf, doc: Add Andrii as official reviewer to BPF subsystem ARM: sunxi: Fix CPU powerdown on A83T ARM: dts: sun8i-a83t-tbs-a711: Fix WiFi resume from suspend clk: sunxi-ng: a80: fix the zero'ing of bits 16 and 18 clk: sunxi: Fix operator precedence in sunxi_divs_clk_setup clk: ast2600: Fix enabling of clocks clk: at91: avoid sleeping early ASoC: rockchip: rockchip_max98090: Enable SHDN to fix headset detection ASoC: ti: sdma-pcm: Add back the flags parameter for non standard dma names ASoC: SOF: ipc: Fix memory leak in sof_set_get_large_ctrl_data ASoC: SOF: Fix memory leak in sof_dfsentry_write ASoC: SOF: Intel: hda-stream: fix the CONFIG_ prefix missing arm64: dts: imx8mn: fix compatible string for sdma arm64: dts: imx8mm: fix compatible string for sdma reset: fix reset_control_ops kerneldoc comment clk: imx8m: Use SYS_PLL1_800M as intermediate parent of CLK_ARM x86/tsx: Add config options to set tsx=on|off|auto x86/speculation/taa: Add documentation for TSX Async Abort x86/tsx: Add "auto" option to the tsx= cmdline parameter kvm/x86: Export MDS_NO=0 to guests when TSX is enabled x86/speculation/taa: Add sysfs reporting for TSX Async Abort x86/speculation/taa: Add mitigation for TSX Async Abort x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default x86/cpu: Add a helper function x86_read_arch_cap_msr() x86/msr: Add the IA32_TSX_CTRL MSR ARM: dts: imx6-logicpd: Re-enable SNVS power key iio: adc: stm32-adc: fix stopping dma soc: imx: gpc: fix initialiser format ARM: dts: imx6qdl-sabreauto: Fix storm of accelerometer interrupts Btrfs: fix race leading to metadata space leak after task received signal btrfs: tree-checker: Fix wrong check on max devid btrfs: Consider system chunk array size for new SYSTEM chunks pinctrl: cherryview: Allocate IRQ chip dynamic clk: samsung: exynos5420: Preserve PLL configuration during suspend/resume arm64: dts: ls1028a: fix a compatible issue autofs: fix a leak in autofs_expire_indirect() soundwire: slave: fix scanf format reset: fix reset_control_get_exclusive kerneldoc comment reset: fix reset_control_lookup kerneldoc comment reset: fix of_reset_control_get_count kerneldoc comment reset: fix of_reset_simple_xlate kerneldoc comment ASoC: kirkwood: fix device remove ordering ASoC: rsnd: dma: fix SSI9 4/5/6/7 busif dma address ASoC: hdmi-codec: drop mutex locking again ASoC: kirkwood: fix external clock probe defer clk: samsung: exynos542x: Move G3D subsystem clocks to its sub-CMU clk: samsung: exynos5433: Fix error paths tools: gpio: Use !building_out_of_srctree to determine srctree iio: imu: inv_mpu6050: fix no data on MPU6050 reset: Fix memory leak in reset_control_array_put() aio: Fix io_pgetevents() struct __compat_aio_sigset layout pinctrl: cherryview: Fix irq_valid_mask calculation ASoC: compress: fix unsigned integer overflow check ASoC: msm8916-wcd-analog: Fix RX1 selection in RDAC2 MUX pinctrl: intel: Avoid potential glitches if pin is in GPIO mode soundwire: intel: fix intel_register_dai PDI offsets and numbers interconnect: Add locking in icc_set_tag() interconnect: qcom: Fix icc_onecell_data allocation clocksource/drivers/sh_mtu2: Do not loop using platform_get_irq_by_name() fs/namespace.c: fix use-after-free of mount in mnt_warn_timestamp_expiry() clocksource/drivers/mediatek: Fix error handling soundwire: depend on ACPI || OF soundwire: depend on ACPI iio: srf04: fix wrong limitation in distance measuring iio: imu: adis16480: make sure provided frequency is positive cgroup: freezer: call cgroup_enter_frozen() with preemption disabled in ptrace_stop() thunderbolt: Drop unnecessary read when writing LC command in Ice Lake thunderbolt: Fix lockdep circular locking depedency warning thunderbolt: Read DP IN adapter first two dwords in one go clk: at91: sam9x60: fix programmable clock clk: meson: g12a: set CLK_MUX_ROUND_CLOSEST on the cpu clock muxes clk: meson: g12a: fix cpu clock rate setting clk: meson: gxbb: let sar_adc_clk_div set the parent clock rate XArray: Fix xas_next() with a single entry at 0 Change-Id: I594a629aca56b3ff5a224d65f0d8d79fe4f4f34b Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
1172 lines
36 KiB
C
1172 lines
36 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
|
|
* Author: Joerg Roedel <joerg.roedel@amd.com>
|
|
*/
|
|
|
|
#ifndef __LINUX_IOMMU_H
|
|
#define __LINUX_IOMMU_H
|
|
|
|
#include <linux/scatterlist.h>
|
|
#include <linux/device.h>
|
|
#include <linux/types.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/err.h>
|
|
#include <linux/of.h>
|
|
#include <uapi/linux/iommu.h>
|
|
|
|
#define IOMMU_READ (1 << 0)
|
|
#define IOMMU_WRITE (1 << 1)
|
|
#define IOMMU_CACHE (1 << 2) /* DMA cache coherency */
|
|
#define IOMMU_NOEXEC (1 << 3)
|
|
#define IOMMU_MMIO (1 << 4) /* e.g. things like MSI doorbells */
|
|
/*
|
|
* Where the bus hardware includes a privilege level as part of its access type
|
|
* markings, and certain devices are capable of issuing transactions marked as
|
|
* either 'supervisor' or 'user', the IOMMU_PRIV flag requests that the other
|
|
* given permission flags only apply to accesses at the higher privilege level,
|
|
* and that unprivileged transactions should have as little access as possible.
|
|
* This would usually imply the same permissions as kernel mappings on the CPU,
|
|
* if the IOMMU page table format is equivalent.
|
|
*/
|
|
#define IOMMU_PRIV (1 << 5)
|
|
/*
|
|
* Non-coherent masters on few Qualcomm SoCs can use this page protection flag
|
|
* to set correct cacheability attributes to use an outer level of cache -
|
|
* last level cache, aka system cache.
|
|
*/
|
|
#define IOMMU_QCOM_SYS_CACHE (1 << 6)
|
|
/* Use upstream device's bus attribute */
|
|
#define IOMMU_USE_UPSTREAM_HINT (1 << 7)
|
|
|
|
/* Use upstream device's bus attribute with no write-allocate cache policy */
|
|
#define IOMMU_USE_LLC_NWA (1 << 8)
|
|
|
|
struct iommu_ops;
|
|
struct iommu_group;
|
|
struct bus_type;
|
|
struct device;
|
|
struct iommu_domain;
|
|
struct notifier_block;
|
|
struct iommu_sva;
|
|
struct iommu_fault_event;
|
|
|
|
/* iommu fault flags */
|
|
#define IOMMU_FAULT_READ (1 << 0)
|
|
#define IOMMU_FAULT_WRITE (1 << 1)
|
|
#define IOMMU_FAULT_TRANSLATION (1 << 2)
|
|
#define IOMMU_FAULT_PERMISSION (1 << 3)
|
|
#define IOMMU_FAULT_EXTERNAL (1 << 4)
|
|
#define IOMMU_FAULT_TRANSACTION_STALLED (1 << 5)
|
|
|
|
typedef int (*iommu_fault_handler_t)(struct iommu_domain *,
|
|
struct device *, unsigned long, int, void *);
|
|
typedef int (*iommu_mm_exit_handler_t)(struct device *dev, struct iommu_sva *,
|
|
void *);
|
|
typedef int (*iommu_dev_fault_handler_t)(struct iommu_fault *, void *);
|
|
|
|
struct iommu_domain_geometry {
|
|
dma_addr_t aperture_start; /* First address that can be mapped */
|
|
dma_addr_t aperture_end; /* Last address that can be mapped */
|
|
bool force_aperture; /* DMA only allowed in mappable range? */
|
|
};
|
|
|
|
struct iommu_pgtbl_info {
|
|
void *ops;
|
|
};
|
|
|
|
/* Domain feature flags */
|
|
#define __IOMMU_DOMAIN_PAGING (1U << 0) /* Support for iommu_map/unmap */
|
|
#define __IOMMU_DOMAIN_DMA_API (1U << 1) /* Domain for use in DMA-API
|
|
implementation */
|
|
#define __IOMMU_DOMAIN_PT (1U << 2) /* Domain is identity mapped */
|
|
|
|
/*
|
|
* This are the possible domain-types
|
|
*
|
|
* IOMMU_DOMAIN_BLOCKED - All DMA is blocked, can be used to isolate
|
|
* devices
|
|
* IOMMU_DOMAIN_IDENTITY - DMA addresses are system physical addresses
|
|
* IOMMU_DOMAIN_UNMANAGED - DMA mappings managed by IOMMU-API user, used
|
|
* for VMs
|
|
* IOMMU_DOMAIN_DMA - Internally used for DMA-API implementations.
|
|
* This flag allows IOMMU drivers to implement
|
|
* certain optimizations for these domains
|
|
*/
|
|
#define IOMMU_DOMAIN_BLOCKED (0U)
|
|
#define IOMMU_DOMAIN_IDENTITY (__IOMMU_DOMAIN_PT)
|
|
#define IOMMU_DOMAIN_UNMANAGED (__IOMMU_DOMAIN_PAGING)
|
|
#define IOMMU_DOMAIN_DMA (__IOMMU_DOMAIN_PAGING | \
|
|
__IOMMU_DOMAIN_DMA_API)
|
|
|
|
#define to_msm_iommu_ops(_iommu_ops) \
|
|
container_of(_iommu_ops, struct msm_iommu_ops, iommu_ops)
|
|
#define to_msm_iommu_domain(_iommu_domain) \
|
|
container_of(_iommu_domain, struct msm_iommu_domain, iommu_domain)
|
|
|
|
#define IOMMU_DOMAIN_NAME_LEN 32
|
|
struct iommu_domain {
|
|
unsigned type;
|
|
const struct iommu_ops *ops;
|
|
unsigned long pgsize_bitmap; /* Bitmap of page sizes in use */
|
|
iommu_fault_handler_t handler;
|
|
void *handler_token;
|
|
struct iommu_domain_geometry geometry;
|
|
void *iova_cookie;
|
|
};
|
|
|
|
struct msm_iommu_domain {
|
|
char name[IOMMU_DOMAIN_NAME_LEN];
|
|
struct iommu_domain iommu_domain;
|
|
};
|
|
|
|
enum iommu_cap {
|
|
IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA
|
|
transactions */
|
|
IOMMU_CAP_INTR_REMAP, /* IOMMU supports interrupt isolation */
|
|
IOMMU_CAP_NOEXEC, /* IOMMU_NOEXEC flag */
|
|
};
|
|
|
|
/*
|
|
* Following constraints are specifc to FSL_PAMUV1:
|
|
* -aperture must be power of 2, and naturally aligned
|
|
* -number of windows must be power of 2, and address space size
|
|
* of each window is determined by aperture size / # of windows
|
|
* -the actual size of the mapped region of a window must be power
|
|
* of 2 starting with 4KB and physical address must be naturally
|
|
* aligned.
|
|
* DOMAIN_ATTR_FSL_PAMUV1 corresponds to the above mentioned contraints.
|
|
* The caller can invoke iommu_domain_get_attr to check if the underlying
|
|
* iommu implementation supports these constraints.
|
|
*
|
|
* DOMAIN_ATTR_NO_CFRE
|
|
* Some bus implementations may enter a bad state if iommu reports an error
|
|
* on context fault. As context faults are not always fatal, this must be
|
|
* avoided.
|
|
*/
|
|
|
|
enum iommu_attr {
|
|
DOMAIN_ATTR_GEOMETRY,
|
|
DOMAIN_ATTR_PAGING,
|
|
DOMAIN_ATTR_WINDOWS,
|
|
DOMAIN_ATTR_FSL_PAMU_STASH,
|
|
DOMAIN_ATTR_FSL_PAMU_ENABLE,
|
|
DOMAIN_ATTR_FSL_PAMUV1,
|
|
DOMAIN_ATTR_NESTING, /* two stages of translation */
|
|
DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE,
|
|
DOMAIN_ATTR_MAX,
|
|
};
|
|
|
|
#define EXTENDED_ATTR_BASE (DOMAIN_ATTR_MAX + 16)
|
|
|
|
#define DOMAIN_ATTR_PT_BASE_ADDR (EXTENDED_ATTR_BASE + 0)
|
|
#define DOMAIN_ATTR_CONTEXT_BANK (EXTENDED_ATTR_BASE + 1)
|
|
#define DOMAIN_ATTR_DYNAMIC (EXTENDED_ATTR_BASE + 2)
|
|
#define DOMAIN_ATTR_TTBR0 (EXTENDED_ATTR_BASE + 3)
|
|
#define DOMAIN_ATTR_CONTEXTIDR (EXTENDED_ATTR_BASE + 4)
|
|
#define DOMAIN_ATTR_PROCID (EXTENDED_ATTR_BASE + 5)
|
|
#define DOMAIN_ATTR_NON_FATAL_FAULTS (EXTENDED_ATTR_BASE + 6)
|
|
#define DOMAIN_ATTR_S1_BYPASS (EXTENDED_ATTR_BASE + 7)
|
|
#define DOMAIN_ATTR_ATOMIC (EXTENDED_ATTR_BASE + 8)
|
|
#define DOMAIN_ATTR_SECURE_VMID (EXTENDED_ATTR_BASE + 9)
|
|
#define DOMAIN_ATTR_FAST (EXTENDED_ATTR_BASE + 10)
|
|
#define DOMAIN_ATTR_PGTBL_INFO (EXTENDED_ATTR_BASE + 11)
|
|
#define DOMAIN_ATTR_USE_UPSTREAM_HINT (EXTENDED_ATTR_BASE + 12)
|
|
#define DOMAIN_ATTR_EARLY_MAP (EXTENDED_ATTR_BASE + 13)
|
|
#define DOMAIN_ATTR_PAGE_TABLE_IS_COHERENT (EXTENDED_ATTR_BASE + 14)
|
|
#define DOMAIN_ATTR_PAGE_TABLE_FORCE_COHERENT (EXTENDED_ATTR_BASE + 15)
|
|
#define DOMAIN_ATTR_CB_STALL_DISABLE (EXTENDED_ATTR_BASE + 16)
|
|
#define DOMAIN_ATTR_USE_LLC_NWA (EXTENDED_ATTR_BASE + 17)
|
|
#define DOMAIN_ATTR_NO_CFRE (EXTENDED_ATTR_BASE + 18)
|
|
#define DOMAIN_ATTR_DEBUG (EXTENDED_ATTR_BASE + 19)
|
|
#define DOMAIN_ATTR_EXTENDED_MAX (EXTENDED_ATTR_BASE + 20)
|
|
|
|
/* These are the possible reserved region types */
|
|
enum iommu_resv_type {
|
|
/* Memory regions which must be mapped 1:1 at all times */
|
|
IOMMU_RESV_DIRECT,
|
|
/*
|
|
* Memory regions which are advertised to be 1:1 but are
|
|
* commonly considered relaxable in some conditions,
|
|
* for instance in device assignment use case (USB, Graphics)
|
|
*/
|
|
IOMMU_RESV_DIRECT_RELAXABLE,
|
|
/* Arbitrary "never map this or give it to a device" address ranges */
|
|
IOMMU_RESV_RESERVED,
|
|
/* Hardware MSI region (untranslated) */
|
|
IOMMU_RESV_MSI,
|
|
/* Software-managed MSI translation window */
|
|
IOMMU_RESV_SW_MSI,
|
|
};
|
|
|
|
/**
|
|
* struct iommu_resv_region - descriptor for a reserved memory region
|
|
* @list: Linked list pointers
|
|
* @start: System physical start address of the region
|
|
* @length: Length of the region in bytes
|
|
* @prot: IOMMU Protection flags (READ/WRITE/...)
|
|
* @type: Type of the reserved region
|
|
*/
|
|
struct iommu_resv_region {
|
|
struct list_head list;
|
|
phys_addr_t start;
|
|
size_t length;
|
|
int prot;
|
|
enum iommu_resv_type type;
|
|
};
|
|
|
|
extern struct dentry *iommu_debugfs_top;
|
|
/* Per device IOMMU features */
|
|
enum iommu_dev_features {
|
|
IOMMU_DEV_FEAT_AUX, /* Aux-domain feature */
|
|
IOMMU_DEV_FEAT_SVA, /* Shared Virtual Addresses */
|
|
};
|
|
|
|
#define IOMMU_PASID_INVALID (-1U)
|
|
|
|
/**
|
|
* struct iommu_sva_ops - device driver callbacks for an SVA context
|
|
*
|
|
* @mm_exit: called when the mm is about to be torn down by exit_mmap. After
|
|
* @mm_exit returns, the device must not issue any more transaction
|
|
* with the PASID given as argument.
|
|
*
|
|
* The @mm_exit handler is allowed to sleep. Be careful about the
|
|
* locks taken in @mm_exit, because they might lead to deadlocks if
|
|
* they are also held when dropping references to the mm. Consider the
|
|
* following call chain:
|
|
* mutex_lock(A); mmput(mm) -> exit_mm() -> @mm_exit() -> mutex_lock(A)
|
|
* Using mmput_async() prevents this scenario.
|
|
*
|
|
*/
|
|
struct iommu_sva_ops {
|
|
iommu_mm_exit_handler_t mm_exit;
|
|
};
|
|
|
|
#ifdef CONFIG_IOMMU_API
|
|
|
|
/**
|
|
* struct iommu_iotlb_gather - Range information for a pending IOTLB flush
|
|
*
|
|
* @start: IOVA representing the start of the range to be flushed
|
|
* @end: IOVA representing the end of the range to be flushed (exclusive)
|
|
* @pgsize: The interval at which to perform the flush
|
|
*
|
|
* This structure is intended to be updated by multiple calls to the
|
|
* ->unmap() function in struct iommu_ops before eventually being passed
|
|
* into ->iotlb_sync().
|
|
*/
|
|
struct iommu_iotlb_gather {
|
|
unsigned long start;
|
|
unsigned long end;
|
|
size_t pgsize;
|
|
};
|
|
|
|
/**
|
|
* struct iommu_ops - iommu ops and capabilities
|
|
* @capable: check capability
|
|
* @domain_alloc: allocate iommu domain
|
|
* @domain_free: free iommu domain
|
|
* @attach_dev: attach device to an iommu domain
|
|
* @detach_dev: detach device from an iommu domain
|
|
* @map: map a physically contiguous memory region to an iommu domain
|
|
* @unmap: unmap a physically contiguous memory region from an iommu domain
|
|
* @flush_iotlb_all: Synchronously flush all hardware TLBs for this domain
|
|
* @iotlb_sync_map: Sync mappings created recently using @map to the hardware
|
|
* @iotlb_sync: Flush all queued ranges from the hardware TLBs and empty flush
|
|
* queue
|
|
* @iova_to_phys: translate iova to physical address
|
|
* @add_device: add device to iommu grouping
|
|
* @remove_device: remove device from iommu grouping
|
|
* @device_group: find iommu group for a particular device
|
|
* @domain_get_attr: Query domain attributes
|
|
* @domain_set_attr: Change domain attributes
|
|
* @get_resv_regions: Request list of reserved regions for a device
|
|
* @put_resv_regions: Free list of reserved regions for a device
|
|
* @apply_resv_region: Temporary helper call-back for iova reserved ranges
|
|
* @domain_window_enable: Configure and enable a particular window for a domain
|
|
* @domain_window_disable: Disable a particular window for a domain
|
|
* @of_xlate: add OF master IDs to iommu grouping
|
|
* @is_attach_deferred: Check if domain attach should be deferred from iommu
|
|
* driver init to device driver init (default no)
|
|
* @dev_has/enable/disable_feat: per device entries to check/enable/disable
|
|
* iommu specific features.
|
|
* @dev_feat_enabled: check enabled feature
|
|
* @aux_attach/detach_dev: aux-domain specific attach/detach entries.
|
|
* @aux_get_pasid: get the pasid given an aux-domain
|
|
* @sva_bind: Bind process address space to device
|
|
* @sva_unbind: Unbind process address space from device
|
|
* @sva_get_pasid: Get PASID associated to a SVA handle
|
|
* @page_response: handle page request response
|
|
* @pgsize_bitmap: bitmap of all possible supported page sizes
|
|
* @owner: Driver module providing these ops
|
|
*/
|
|
struct iommu_ops {
|
|
bool (*capable)(enum iommu_cap);
|
|
|
|
/* Domain allocation and freeing by the iommu driver */
|
|
struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type);
|
|
void (*domain_free)(struct iommu_domain *);
|
|
|
|
int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
|
|
void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
|
|
int (*map)(struct iommu_domain *domain, unsigned long iova,
|
|
phys_addr_t paddr, size_t size, int prot);
|
|
size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
|
|
size_t size, struct iommu_iotlb_gather *iotlb_gather);
|
|
void (*flush_iotlb_all)(struct iommu_domain *domain);
|
|
void (*iotlb_sync_map)(struct iommu_domain *domain);
|
|
void (*iotlb_sync)(struct iommu_domain *domain,
|
|
struct iommu_iotlb_gather *iotlb_gather);
|
|
phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
|
|
int (*add_device)(struct device *dev);
|
|
void (*remove_device)(struct device *dev);
|
|
struct iommu_group *(*device_group)(struct device *dev);
|
|
int (*domain_get_attr)(struct iommu_domain *domain,
|
|
enum iommu_attr attr, void *data);
|
|
int (*domain_set_attr)(struct iommu_domain *domain,
|
|
enum iommu_attr attr, void *data);
|
|
|
|
/* Request/Free a list of reserved regions for a device */
|
|
void (*get_resv_regions)(struct device *dev, struct list_head *list);
|
|
void (*put_resv_regions)(struct device *dev, struct list_head *list);
|
|
void (*apply_resv_region)(struct device *dev,
|
|
struct iommu_domain *domain,
|
|
struct iommu_resv_region *region);
|
|
|
|
/* Window handling functions */
|
|
int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
|
|
phys_addr_t paddr, u64 size, int prot);
|
|
void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr);
|
|
|
|
int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
|
|
bool (*is_attach_deferred)(struct iommu_domain *domain, struct device *dev);
|
|
|
|
/* Per device IOMMU features */
|
|
bool (*dev_has_feat)(struct device *dev, enum iommu_dev_features f);
|
|
bool (*dev_feat_enabled)(struct device *dev, enum iommu_dev_features f);
|
|
int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f);
|
|
int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f);
|
|
|
|
/* Aux-domain specific attach/detach entries */
|
|
int (*aux_attach_dev)(struct iommu_domain *domain, struct device *dev);
|
|
void (*aux_detach_dev)(struct iommu_domain *domain, struct device *dev);
|
|
int (*aux_get_pasid)(struct iommu_domain *domain, struct device *dev);
|
|
|
|
struct iommu_sva *(*sva_bind)(struct device *dev, struct mm_struct *mm,
|
|
void *drvdata);
|
|
void (*sva_unbind)(struct iommu_sva *handle);
|
|
int (*sva_get_pasid)(struct iommu_sva *handle);
|
|
|
|
int (*page_response)(struct device *dev,
|
|
struct iommu_fault_event *evt,
|
|
struct iommu_page_response *msg);
|
|
|
|
unsigned long pgsize_bitmap;
|
|
struct module *owner;
|
|
};
|
|
|
|
/**
|
|
* struct msm_iommu_ops - standard iommu ops, as well as additional MSM
|
|
* specific iommu ops
|
|
* @map_sg: map a scatter-gather list of physically contiguous memory chunks
|
|
* to an iommu domain
|
|
* @iova_to_phys_hard: translate iova to physical address using IOMMU hardware
|
|
* @is_iova_coherent: checks coherency of the given iova
|
|
* @trigger_fault: trigger a fault on the device attached to an iommu domain
|
|
* @tlbi_domain: Invalidate all TLBs covering an iommu domain
|
|
* @enable_config_clocks: Enable all config clocks for this domain's IOMMU
|
|
* @disable_config_clocks: Disable all config clocks for this domain's IOMMU
|
|
* @iova_to_pte: translate iova to Page Table Entry (PTE).
|
|
* @iommu_ops: the standard iommu ops
|
|
*/
|
|
struct msm_iommu_ops {
|
|
size_t (*map_sg)(struct iommu_domain *domain, unsigned long iova,
|
|
struct scatterlist *sg, unsigned int nents, int prot);
|
|
phys_addr_t (*iova_to_phys_hard)(struct iommu_domain *domain,
|
|
dma_addr_t iova);
|
|
bool (*is_iova_coherent)(struct iommu_domain *domain, dma_addr_t iova);
|
|
void (*trigger_fault)(struct iommu_domain *domain, unsigned long flags);
|
|
void (*tlbi_domain)(struct iommu_domain *domain);
|
|
int (*enable_config_clocks)(struct iommu_domain *domain);
|
|
void (*disable_config_clocks)(struct iommu_domain *domain);
|
|
uint64_t (*iova_to_pte)(struct iommu_domain *domain, dma_addr_t iova);
|
|
struct iommu_ops iommu_ops;
|
|
};
|
|
|
|
/**
|
|
* struct iommu_device - IOMMU core representation of one IOMMU hardware
|
|
* instance
|
|
* @list: Used by the iommu-core to keep a list of registered iommus
|
|
* @ops: iommu-ops for talking to this iommu
|
|
* @dev: struct device for sysfs handling
|
|
*/
|
|
struct iommu_device {
|
|
struct list_head list;
|
|
const struct iommu_ops *ops;
|
|
struct fwnode_handle *fwnode;
|
|
struct device *dev;
|
|
};
|
|
|
|
/**
|
|
* struct iommu_fault_event - Generic fault event
|
|
*
|
|
* Can represent recoverable faults such as a page requests or
|
|
* unrecoverable faults such as DMA or IRQ remapping faults.
|
|
*
|
|
* @fault: fault descriptor
|
|
* @list: pending fault event list, used for tracking responses
|
|
*/
|
|
struct iommu_fault_event {
|
|
struct iommu_fault fault;
|
|
struct list_head list;
|
|
};
|
|
|
|
/**
|
|
* struct iommu_fault_param - per-device IOMMU fault data
|
|
* @handler: Callback function to handle IOMMU faults at device level
|
|
* @data: handler private data
|
|
* @faults: holds the pending faults which needs response
|
|
* @lock: protect pending faults list
|
|
*/
|
|
struct iommu_fault_param {
|
|
iommu_dev_fault_handler_t handler;
|
|
void *data;
|
|
struct list_head faults;
|
|
struct mutex lock;
|
|
};
|
|
|
|
/**
|
|
* struct iommu_param - collection of per-device IOMMU data
|
|
*
|
|
* @fault_param: IOMMU detected device fault reporting data
|
|
*
|
|
* TODO: migrate other per device data pointers under iommu_dev_data, e.g.
|
|
* struct iommu_group *iommu_group;
|
|
* struct iommu_fwspec *iommu_fwspec;
|
|
*/
|
|
struct iommu_param {
|
|
struct mutex lock;
|
|
struct iommu_fault_param *fault_param;
|
|
};
|
|
|
|
int iommu_device_register(struct iommu_device *iommu);
|
|
void iommu_device_unregister(struct iommu_device *iommu);
|
|
int iommu_device_sysfs_add(struct iommu_device *iommu,
|
|
struct device *parent,
|
|
const struct attribute_group **groups,
|
|
const char *fmt, ...) __printf(4, 5);
|
|
void iommu_device_sysfs_remove(struct iommu_device *iommu);
|
|
int iommu_device_link(struct iommu_device *iommu, struct device *link);
|
|
void iommu_device_unlink(struct iommu_device *iommu, struct device *link);
|
|
|
|
static inline void iommu_device_set_ops(struct iommu_device *iommu,
|
|
const struct iommu_ops *ops)
|
|
{
|
|
iommu->ops = ops;
|
|
}
|
|
|
|
static inline void iommu_device_set_fwnode(struct iommu_device *iommu,
|
|
struct fwnode_handle *fwnode)
|
|
{
|
|
iommu->fwnode = fwnode;
|
|
}
|
|
|
|
static inline struct iommu_device *dev_to_iommu_device(struct device *dev)
|
|
{
|
|
return (struct iommu_device *)dev_get_drvdata(dev);
|
|
}
|
|
|
|
static inline void iommu_iotlb_gather_init(struct iommu_iotlb_gather *gather)
|
|
{
|
|
*gather = (struct iommu_iotlb_gather) {
|
|
.start = ULONG_MAX,
|
|
};
|
|
}
|
|
|
|
#define IOMMU_GROUP_NOTIFY_ADD_DEVICE 1 /* Device added */
|
|
#define IOMMU_GROUP_NOTIFY_DEL_DEVICE 2 /* Pre Device removed */
|
|
#define IOMMU_GROUP_NOTIFY_BIND_DRIVER 3 /* Pre Driver bind */
|
|
#define IOMMU_GROUP_NOTIFY_BOUND_DRIVER 4 /* Post Driver bind */
|
|
#define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */
|
|
#define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */
|
|
|
|
extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
|
|
extern bool iommu_present(struct bus_type *bus);
|
|
extern bool iommu_capable(struct bus_type *bus, enum iommu_cap cap);
|
|
extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
|
|
extern struct iommu_group *iommu_group_get_by_id(int id);
|
|
extern void iommu_domain_free(struct iommu_domain *domain);
|
|
extern int iommu_attach_device(struct iommu_domain *domain,
|
|
struct device *dev);
|
|
extern void iommu_detach_device(struct iommu_domain *domain,
|
|
struct device *dev);
|
|
extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev);
|
|
extern size_t iommu_pgsize(unsigned long pgsize_bitmap,
|
|
unsigned long addr_merge, size_t size);
|
|
extern struct iommu_domain *iommu_get_dma_domain(struct device *dev);
|
|
extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
|
|
phys_addr_t paddr, size_t size, int prot);
|
|
extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
|
|
size_t size);
|
|
extern size_t iommu_unmap_fast(struct iommu_domain *domain,
|
|
unsigned long iova, size_t size,
|
|
struct iommu_iotlb_gather *iotlb_gather);
|
|
extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
|
|
struct scatterlist *sg,unsigned int nents, int prot);
|
|
extern size_t default_iommu_map_sg(struct iommu_domain *domain,
|
|
unsigned long iova, struct scatterlist *sg,
|
|
unsigned int nents, int prot);
|
|
extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
|
|
extern phys_addr_t iommu_iova_to_phys_hard(struct iommu_domain *domain,
|
|
dma_addr_t iova);
|
|
extern bool iommu_is_iova_coherent(struct iommu_domain *domain,
|
|
dma_addr_t iova);
|
|
extern void iommu_set_fault_handler(struct iommu_domain *domain,
|
|
iommu_fault_handler_t handler, void *token);
|
|
|
|
extern void iommu_get_resv_regions(struct device *dev, struct list_head *list);
|
|
extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
|
|
extern int iommu_request_dm_for_dev(struct device *dev);
|
|
extern int iommu_request_dma_domain_for_dev(struct device *dev);
|
|
extern void iommu_set_default_passthrough(bool cmd_line);
|
|
extern void iommu_set_default_translated(bool cmd_line);
|
|
extern bool iommu_default_passthrough(void);
|
|
extern struct iommu_resv_region *
|
|
iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot,
|
|
enum iommu_resv_type type);
|
|
extern int iommu_get_group_resv_regions(struct iommu_group *group,
|
|
struct list_head *head);
|
|
|
|
extern int iommu_attach_group(struct iommu_domain *domain,
|
|
struct iommu_group *group);
|
|
extern void iommu_detach_group(struct iommu_domain *domain,
|
|
struct iommu_group *group);
|
|
extern struct iommu_group *iommu_group_alloc(void);
|
|
extern void *iommu_group_get_iommudata(struct iommu_group *group);
|
|
extern void iommu_group_set_iommudata(struct iommu_group *group,
|
|
void *iommu_data,
|
|
void (*release)(void *iommu_data));
|
|
extern int iommu_group_set_name(struct iommu_group *group, const char *name);
|
|
extern int iommu_group_add_device(struct iommu_group *group,
|
|
struct device *dev);
|
|
extern void iommu_group_remove_device(struct device *dev);
|
|
extern int iommu_group_for_each_dev(struct iommu_group *group, void *data,
|
|
int (*fn)(struct device *, void *));
|
|
extern struct iommu_group *iommu_group_get(struct device *dev);
|
|
extern struct iommu_group *iommu_group_ref_get(struct iommu_group *group);
|
|
extern void iommu_group_put(struct iommu_group *group);
|
|
extern int iommu_group_register_notifier(struct iommu_group *group,
|
|
struct notifier_block *nb);
|
|
extern int iommu_group_unregister_notifier(struct iommu_group *group,
|
|
struct notifier_block *nb);
|
|
extern int iommu_register_device_fault_handler(struct device *dev,
|
|
iommu_dev_fault_handler_t handler,
|
|
void *data);
|
|
|
|
extern int iommu_unregister_device_fault_handler(struct device *dev);
|
|
|
|
extern int iommu_report_device_fault(struct device *dev,
|
|
struct iommu_fault_event *evt);
|
|
extern int iommu_page_response(struct device *dev,
|
|
struct iommu_page_response *msg);
|
|
|
|
extern int iommu_group_id(struct iommu_group *group);
|
|
extern struct iommu_group *iommu_group_get_for_dev(struct device *dev);
|
|
extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *);
|
|
|
|
extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr,
|
|
void *data);
|
|
extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
|
|
void *data);
|
|
|
|
/* Window handling function prototypes */
|
|
extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
|
|
phys_addr_t offset, u64 size,
|
|
int prot);
|
|
extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr);
|
|
|
|
extern uint64_t iommu_iova_to_pte(struct iommu_domain *domain,
|
|
dma_addr_t iova);
|
|
|
|
extern int report_iommu_fault(struct iommu_domain *domain, struct device *dev,
|
|
unsigned long iova, int flags);
|
|
|
|
static inline void iommu_flush_tlb_all(struct iommu_domain *domain)
|
|
{
|
|
if (domain->ops->flush_iotlb_all)
|
|
domain->ops->flush_iotlb_all(domain);
|
|
}
|
|
|
|
static inline void iommu_tlb_sync(struct iommu_domain *domain,
|
|
struct iommu_iotlb_gather *iotlb_gather)
|
|
{
|
|
if (domain->ops->iotlb_sync)
|
|
domain->ops->iotlb_sync(domain, iotlb_gather);
|
|
|
|
iommu_iotlb_gather_init(iotlb_gather);
|
|
}
|
|
|
|
static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain,
|
|
struct iommu_iotlb_gather *gather,
|
|
unsigned long iova, size_t size)
|
|
{
|
|
unsigned long start = iova, end = start + size;
|
|
|
|
/*
|
|
* If the new page is disjoint from the current range or is mapped at
|
|
* a different granularity, then sync the TLB so that the gather
|
|
* structure can be rewritten.
|
|
*/
|
|
if (gather->pgsize != size ||
|
|
end < gather->start || start > gather->end) {
|
|
if (gather->pgsize)
|
|
iommu_tlb_sync(domain, gather);
|
|
gather->pgsize = size;
|
|
}
|
|
|
|
if (gather->end < end)
|
|
gather->end = end;
|
|
|
|
if (gather->start > start)
|
|
gather->start = start;
|
|
}
|
|
|
|
extern void iommu_trigger_fault(struct iommu_domain *domain,
|
|
unsigned long flags);
|
|
|
|
/* PCI device grouping function */
|
|
extern struct iommu_group *pci_device_group(struct device *dev);
|
|
/* Generic device grouping function */
|
|
extern struct iommu_group *generic_device_group(struct device *dev);
|
|
/* FSL-MC device grouping function */
|
|
struct iommu_group *fsl_mc_device_group(struct device *dev);
|
|
|
|
static inline void iommu_tlbiall(struct iommu_domain *domain)
|
|
{
|
|
struct msm_iommu_ops *ops = to_msm_iommu_ops(domain->ops);
|
|
|
|
if (ops->tlbi_domain)
|
|
ops->tlbi_domain(domain);
|
|
}
|
|
|
|
static inline int iommu_enable_config_clocks(struct iommu_domain *domain)
|
|
{
|
|
struct msm_iommu_ops *ops = to_msm_iommu_ops(domain->ops);
|
|
|
|
if (ops->enable_config_clocks)
|
|
return ops->enable_config_clocks(domain);
|
|
return 0;
|
|
}
|
|
|
|
static inline void iommu_disable_config_clocks(struct iommu_domain *domain)
|
|
{
|
|
struct msm_iommu_ops *ops = to_msm_iommu_ops(domain->ops);
|
|
|
|
if (ops->disable_config_clocks)
|
|
ops->disable_config_clocks(domain);
|
|
}
|
|
|
|
/**
|
|
* struct iommu_fwspec - per-device IOMMU instance data
|
|
* @ops: ops for this device's IOMMU
|
|
* @iommu_fwnode: firmware handle for this device's IOMMU
|
|
* @iommu_priv: IOMMU driver private data for this device
|
|
* @num_ids: number of associated device IDs
|
|
* @ids: IDs which this device may present to the IOMMU
|
|
*/
|
|
struct iommu_fwspec {
|
|
const struct iommu_ops *ops;
|
|
struct fwnode_handle *iommu_fwnode;
|
|
void *iommu_priv;
|
|
u32 flags;
|
|
unsigned int num_ids;
|
|
u32 ids[1];
|
|
};
|
|
|
|
/* ATS is supported */
|
|
#define IOMMU_FWSPEC_PCI_RC_ATS (1 << 0)
|
|
|
|
/**
|
|
* struct iommu_sva - handle to a device-mm bond
|
|
*/
|
|
struct iommu_sva {
|
|
struct device *dev;
|
|
const struct iommu_sva_ops *ops;
|
|
};
|
|
|
|
int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode,
|
|
const struct iommu_ops *ops);
|
|
void iommu_fwspec_free(struct device *dev);
|
|
int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids);
|
|
const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode);
|
|
|
|
static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
|
|
{
|
|
return dev->iommu_fwspec;
|
|
}
|
|
|
|
static inline void dev_iommu_fwspec_set(struct device *dev,
|
|
struct iommu_fwspec *fwspec)
|
|
{
|
|
dev->iommu_fwspec = fwspec;
|
|
}
|
|
|
|
int iommu_probe_device(struct device *dev);
|
|
void iommu_release_device(struct device *dev);
|
|
|
|
bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features f);
|
|
int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features f);
|
|
int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features f);
|
|
bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features f);
|
|
int iommu_aux_attach_device(struct iommu_domain *domain, struct device *dev);
|
|
void iommu_aux_detach_device(struct iommu_domain *domain, struct device *dev);
|
|
int iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev);
|
|
|
|
struct iommu_sva *iommu_sva_bind_device(struct device *dev,
|
|
struct mm_struct *mm,
|
|
void *drvdata);
|
|
void iommu_sva_unbind_device(struct iommu_sva *handle);
|
|
int iommu_sva_set_ops(struct iommu_sva *handle,
|
|
const struct iommu_sva_ops *ops);
|
|
int iommu_sva_get_pasid(struct iommu_sva *handle);
|
|
|
|
#else /* CONFIG_IOMMU_API */
|
|
|
|
struct iommu_ops {};
|
|
struct iommu_group {};
|
|
struct iommu_fwspec {};
|
|
struct iommu_device {};
|
|
struct iommu_fault_param {};
|
|
struct iommu_iotlb_gather {};
|
|
|
|
static inline bool iommu_present(struct bus_type *bus)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline struct iommu_group *iommu_group_get_by_id(int id)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void iommu_domain_free(struct iommu_domain *domain)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_attach_device(struct iommu_domain *domain,
|
|
struct device *dev)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void iommu_detach_device(struct iommu_domain *domain,
|
|
struct device *dev)
|
|
{
|
|
}
|
|
|
|
static inline struct iommu_domain *iommu_get_domain_for_dev(struct device *dev)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline int iommu_map(struct iommu_domain *domain, unsigned long iova,
|
|
phys_addr_t paddr, size_t size, int prot)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline size_t iommu_unmap(struct iommu_domain *domain,
|
|
unsigned long iova, size_t size)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline size_t iommu_unmap_fast(struct iommu_domain *domain,
|
|
unsigned long iova, int gfp_order,
|
|
struct iommu_iotlb_gather *iotlb_gather)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline size_t iommu_map_sg(struct iommu_domain *domain,
|
|
unsigned long iova, struct scatterlist *sg,
|
|
unsigned int nents, int prot)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void iommu_flush_tlb_all(struct iommu_domain *domain)
|
|
{
|
|
}
|
|
|
|
static inline void iommu_tlb_sync(struct iommu_domain *domain,
|
|
struct iommu_iotlb_gather *iotlb_gather)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_domain_window_enable(struct iommu_domain *domain,
|
|
u32 wnd_nr, phys_addr_t paddr,
|
|
u64 size, int prot)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void iommu_domain_window_disable(struct iommu_domain *domain,
|
|
u32 wnd_nr)
|
|
{
|
|
}
|
|
|
|
static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline phys_addr_t iommu_iova_to_phys_hard(struct iommu_domain *domain,
|
|
dma_addr_t iova)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline bool iommu_is_iova_coherent(struct iommu_domain *domain,
|
|
dma_addr_t iova)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline void iommu_set_fault_handler(struct iommu_domain *domain,
|
|
iommu_fault_handler_t handler, void *token)
|
|
{
|
|
}
|
|
|
|
static inline void iommu_get_resv_regions(struct device *dev,
|
|
struct list_head *list)
|
|
{
|
|
}
|
|
|
|
static inline void iommu_put_resv_regions(struct device *dev,
|
|
struct list_head *list)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_get_group_resv_regions(struct iommu_group *group,
|
|
struct list_head *head)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int iommu_request_dm_for_dev(struct device *dev)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int iommu_request_dma_domain_for_dev(struct device *dev)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void iommu_set_default_passthrough(bool cmd_line)
|
|
{
|
|
}
|
|
|
|
static inline void iommu_set_default_translated(bool cmd_line)
|
|
{
|
|
}
|
|
|
|
static inline bool iommu_default_passthrough(void)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
static inline int iommu_attach_group(struct iommu_domain *domain,
|
|
struct iommu_group *group)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void iommu_detach_group(struct iommu_domain *domain,
|
|
struct iommu_group *group)
|
|
{
|
|
}
|
|
|
|
static inline struct iommu_group *iommu_group_alloc(void)
|
|
{
|
|
return ERR_PTR(-ENODEV);
|
|
}
|
|
|
|
static inline void *iommu_group_get_iommudata(struct iommu_group *group)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void iommu_group_set_iommudata(struct iommu_group *group,
|
|
void *iommu_data,
|
|
void (*release)(void *iommu_data))
|
|
{
|
|
}
|
|
|
|
static inline int iommu_group_set_name(struct iommu_group *group,
|
|
const char *name)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int iommu_group_add_device(struct iommu_group *group,
|
|
struct device *dev)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void iommu_group_remove_device(struct device *dev)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_group_for_each_dev(struct iommu_group *group,
|
|
void *data,
|
|
int (*fn)(struct device *, void *))
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline struct iommu_group *iommu_group_get(struct device *dev)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void iommu_group_put(struct iommu_group *group)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_group_register_notifier(struct iommu_group *group,
|
|
struct notifier_block *nb)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int iommu_group_unregister_notifier(struct iommu_group *group,
|
|
struct notifier_block *nb)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline
|
|
int iommu_register_device_fault_handler(struct device *dev,
|
|
iommu_dev_fault_handler_t handler,
|
|
void *data)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int iommu_unregister_device_fault_handler(struct device *dev)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline
|
|
int iommu_report_device_fault(struct device *dev, struct iommu_fault_event *evt)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int iommu_page_response(struct device *dev,
|
|
struct iommu_page_response *msg)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int iommu_group_id(struct iommu_group *group)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int iommu_domain_get_attr(struct iommu_domain *domain,
|
|
enum iommu_attr attr, void *data)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline int iommu_domain_set_attr(struct iommu_domain *domain,
|
|
enum iommu_attr attr, void *data)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline int iommu_device_register(struct iommu_device *iommu)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void iommu_device_set_ops(struct iommu_device *iommu,
|
|
const struct iommu_ops *ops)
|
|
{
|
|
}
|
|
|
|
static inline void iommu_device_set_fwnode(struct iommu_device *iommu,
|
|
struct fwnode_handle *fwnode)
|
|
{
|
|
}
|
|
|
|
static inline struct iommu_device *dev_to_iommu_device(struct device *dev)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void iommu_iotlb_gather_init(struct iommu_iotlb_gather *gather)
|
|
{
|
|
}
|
|
|
|
static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain,
|
|
struct iommu_iotlb_gather *gather,
|
|
unsigned long iova, size_t size)
|
|
{
|
|
}
|
|
|
|
static inline void iommu_device_unregister(struct iommu_device *iommu)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_device_sysfs_add(struct iommu_device *iommu,
|
|
struct device *parent,
|
|
const struct attribute_group **groups,
|
|
const char *fmt, ...)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void iommu_device_sysfs_remove(struct iommu_device *iommu)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_device_link(struct device *dev, struct device *link)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline void iommu_device_unlink(struct device *dev, struct device *link)
|
|
{
|
|
}
|
|
|
|
static inline void iommu_trigger_fault(struct iommu_domain *domain,
|
|
unsigned long flags)
|
|
{
|
|
}
|
|
|
|
static inline void iommu_tlbiall(struct iommu_domain *domain)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_enable_config_clocks(struct iommu_domain *domain)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void iommu_disable_config_clocks(struct iommu_domain *domain)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_fwspec_init(struct device *dev,
|
|
struct fwnode_handle *iommu_fwnode,
|
|
const struct iommu_ops *ops)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void iommu_fwspec_free(struct device *dev)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids,
|
|
int num_ids)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline
|
|
const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline bool
|
|
iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline bool
|
|
iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline int
|
|
iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int
|
|
iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline int
|
|
iommu_aux_attach_device(struct iommu_domain *domain, struct device *dev)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void
|
|
iommu_aux_detach_device(struct iommu_domain *domain, struct device *dev)
|
|
{
|
|
}
|
|
|
|
static inline int
|
|
iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline struct iommu_sva *
|
|
iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void *drvdata)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void iommu_sva_unbind_device(struct iommu_sva *handle)
|
|
{
|
|
}
|
|
|
|
static inline int iommu_sva_set_ops(struct iommu_sva *handle,
|
|
const struct iommu_sva_ops *ops)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline int iommu_sva_get_pasid(struct iommu_sva *handle)
|
|
{
|
|
return IOMMU_PASID_INVALID;
|
|
}
|
|
|
|
#endif /* CONFIG_IOMMU_API */
|
|
|
|
#ifdef CONFIG_IOMMU_DEBUGFS
|
|
extern struct dentry *iommu_debugfs_dir;
|
|
void iommu_debugfs_setup(void);
|
|
#else
|
|
static inline void iommu_debugfs_setup(void) {}
|
|
#endif
|
|
|
|
#endif /* __LINUX_IOMMU_H */
|