• Nate Watterson's avatar
    iommu/arm-smmu-v3: Add in-kernel support for NVIDIA Tegra241 (Grace) CMDQV · 918eb5c8
    Nate Watterson authored
    NVIDIA's Tegra241 Soc has a CMDQ-Virtualization (CMDQV) hardware, extending
    the standard ARM SMMU v3 IP to support multiple VCMDQs with virtualization
    capabilities. In terms of command queue, they are very like a standard SMMU
    CMDQ (or ECMDQs), but only support CS_NONE in the CS field of CMD_SYNC.
    
    Add a new tegra241-cmdqv driver, and insert its structure pointer into the
    existing arm_smmu_device, and then add related function calls in the SMMUv3
    driver to interact with the CMDQV driver.
    
    In the CMDQV driver, add a minimal part for the in-kernel support: reserve
    VINTF0 for in-kernel use, and assign some of the VCMDQs to the VINTF0, and
    select one VCMDQ based on the current CPU ID to execute supported commands.
    This multi-queue design for in-kernel use gives some limited improvements:
    up to 20% reduction of invalidation time was measured by a multi-threaded
    DMA unmap benchmark, compared to a single queue.
    
    The other part of the CMDQV driver will be user-space support that gives a
    hypervisor running on the host OS to talk to the driver for virtualization
    use cases, allowing VMs to use VCMDQs without trappings, i.e. no VM Exits.
    This is designed based on IOMMUFD, and its RFC series is also under review.
    It will provide a guest OS a bigger improvement: 70% to 90% reductions of
    TLB invalidation time were measured by DMA unmap tests running in a guest,
    compared to nested SMMU CMDQ (with trappings).
    
    As the initial version, the CMDQV driver only supports ACPI configurations.
    Signed-off-by: default avatarNate Watterson <nwatterson@nvidia.com>
    Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
    Co-developed-by: default avatarNicolin Chen <nicolinc@nvidia.com>
    Signed-off-by: default avatarNicolin Chen <nicolinc@nvidia.com>
    Link: https://lore.kernel.org/r/dce50490b2c10b7254fb36aa73ed7ffd812b283a.1724970714.git.nicolinc@nvidia.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
    918eb5c8
tegra241-cmdqv.c 22.1 KB