drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
Source file repositories/reference/linux-study-clean/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c- Extension
.c- Size
- 36703 bytes
- Lines
- 1294
- Domain
- Driver Families
- Bucket
- drivers/iommu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/dma-mapping.hlinux/interrupt.hlinux/iommu.hlinux/iommufd.hlinux/iopoll.hlinux/platform_device.huapi/linux/iommufd.harm-smmu-v3.h
Detected Declarations
struct tegra241_vcmdqstruct tegra241_vintfstruct tegra241_vintf_sidstruct tegra241_cmdqvfunction tegra241_cmdqv_write_configfunction cmdqv_write_configfunction vintf_write_configfunction vcmdq_write_configfunction tegra241_vintf_user_handle_errorfunction tegra241_vintf0_handle_errorfunction tegra241_cmdqv_isrfunction tegra241_guest_vcmdq_supports_cmdfunction tegra241_cmdqv_get_cmdqfunction tegra241_vcmdq_hw_flush_timeoutfunction tegra241_vcmdq_hw_deinitfunction tegra241_vcmdq_hw_initfunction tegra241_vcmdq_unmap_lvcmdqfunction tegra241_vintf_hw_deinitfunction tegra241_vcmdq_map_lvcmdqfunction tegra241_vintf_hw_initfunction tegra241_cmdqv_hw_resetfunction tegra241_vcmdq_alloc_smmu_cmdqfunction tegra241_vintf_deinit_lvcmdqfunction tegra241_vintf_init_lvcmdqfunction tegra241_vintf_free_lvcmdqfunction tegra241_vintf_alloc_lvcmdqfunction tegra241_cmdqv_deinit_vintffunction tegra241_cmdqv_init_vintffunction tegra241_cmdqv_remove_vintffunction tegra241_cmdqv_removefunction tegra241_cmdqv_get_vintf_sizefunction tegra241_cmdqv_init_structuresfunction __tegra241_cmdqv_probefunction tegra241_vintf_get_vcmdq_sizefunction tegra241_vcmdq_hw_init_userfunction tegra241_vintf_destroy_lvcmdq_userfunction tegra241_vintf_alloc_lvcmdq_userfunction tegra241_cmdqv_destroy_vintf_userfunction tegra241_vintf_destroy_vsidfunction tegra241_vintf_init_vsidfunction tegra241_cmdqv_init_vintf_user
Annotated Snippet
struct tegra241_vcmdq {
struct iommufd_hw_queue core;
u16 idx;
u16 lidx;
bool enabled;
struct tegra241_cmdqv *cmdqv;
struct tegra241_vintf *vintf;
struct tegra241_vcmdq *prev;
struct arm_smmu_cmdq cmdq;
void __iomem *page0;
void __iomem *page1;
};
#define hw_queue_to_vcmdq(v) container_of(v, struct tegra241_vcmdq, core)
/**
* struct tegra241_vintf - Virtual Interface
* @vsmmu: Embedded arm_vsmmu structure
* @idx: Global index in the CMDQV
* @enabled: Enable status
* @hyp_own: Owned by hypervisor (in-kernel)
* @cmdqv: Parent CMDQV pointer
* @lvcmdqs: List of logical VCMDQ pointers
* @lvcmdq_mutex: Lock to serialize user-allocated lvcmdqs
* @base: MMIO base address
* @mmap_offset: Offset argument for mmap() syscall
* @sids: Stream ID mapping resources
*/
struct tegra241_vintf {
struct arm_vsmmu vsmmu;
u16 idx;
bool enabled;
bool hyp_own;
struct tegra241_cmdqv *cmdqv;
struct tegra241_vcmdq **lvcmdqs;
struct mutex lvcmdq_mutex; /* user space race */
void __iomem *base;
unsigned long mmap_offset;
struct ida sids;
};
#define viommu_to_vintf(v) container_of(v, struct tegra241_vintf, vsmmu.core)
/**
* struct tegra241_vintf_sid - Virtual Interface Stream ID Mapping
* @core: Embedded iommufd_vdevice structure, holding virtual Stream ID
* @vintf: Parent VINTF pointer
* @sid: Physical Stream ID
* @idx: Mapping index in the VINTF
*/
struct tegra241_vintf_sid {
struct iommufd_vdevice core;
struct tegra241_vintf *vintf;
u32 sid;
u8 idx;
};
#define vdev_to_vsid(v) container_of(v, struct tegra241_vintf_sid, core)
/**
* struct tegra241_cmdqv - CMDQ-V for SMMUv3
* @smmu: SMMUv3 device
* @dev: CMDQV device
* @base: MMIO base address
* @base_phys: MMIO physical base address, for mmap
* @irq: IRQ number
* @num_vintfs: Total number of VINTFs
* @num_vcmdqs: Total number of VCMDQs
* @num_lvcmdqs_per_vintf: Number of logical VCMDQs per VINTF
* @num_sids_per_vintf: Total number of SID mappings per VINTF
* @vintf_ids: VINTF id allocator
* @vintfs: List of VINTFs
*/
struct tegra241_cmdqv {
struct arm_smmu_device smmu;
struct device *dev;
void __iomem *base;
phys_addr_t base_phys;
int irq;
/* CMDQV Hardware Params */
u16 num_vintfs;
u16 num_vcmdqs;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/dma-mapping.h`, `linux/interrupt.h`, `linux/iommu.h`, `linux/iommufd.h`, `linux/iopoll.h`, `linux/platform_device.h`, `uapi/linux/iommufd.h`.
- Detected declarations: `struct tegra241_vcmdq`, `struct tegra241_vintf`, `struct tegra241_vintf_sid`, `struct tegra241_cmdqv`, `function tegra241_cmdqv_write_config`, `function cmdqv_write_config`, `function vintf_write_config`, `function vcmdq_write_config`, `function tegra241_vintf_user_handle_error`, `function tegra241_vintf0_handle_error`.
- Atlas domain: Driver Families / drivers/iommu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.