RE: [PATCH RFCv1 12/14] iommufd: Add IOMMUFD_OBJ_VQUEUE and IOMMUFD_CMD_VQUEUE_ALLOC

Tian, Kevin
2024-05-23T07:05:44Z

> From: Nicolin Chen <nicolinc@nvidia.com>
> Sent: Saturday, April 13, 2024 11:47 AM
> +
> +/**
> + * struct iommu_vqueue_tegra241_cmdqv - NVIDIA Tegra241's Virtual
> Command Queue
> + * for its CMDQV Extension for ARM SMMUv3
> + * (IOMMU_VQUEUE_DATA_TEGRA241_CMDQV)
> + * @vcmdq_id: logical ID of a virtual command queue in the VIOMMU
> instance
> + * @vcmdq_log2size: (1 << @vcmdq_log2size) will be the size of the vcmdq
> + * @vcmdq_base: guest physical address (IPA) to the vcmdq base address
> + */
> +struct iommu_vqueue_tegra241_cmdqv {
> + __u32 vcmdq_id;
> + __u32 vcmdq_log2size;
> + __aligned_u64 vcmdq_base;
> +};

Is there restriction that log2size cannot exceed 12?

According to patch14:

+ q_base = arm_smmu_domain_ipa_to_pa(vintf->s2_domain, arg.vcmdq_base);
+ vcmdq->cmdq.q.q_base = q_base & VCMDQ_ADDR;
+ vcmdq->cmdq.q.q_base |= arg.vcmdq_log2size;

It only converts the IPA to HPA for the starting page, assuming
continuous host pages backing a guest cmd queue including
multiple pages. but what guarantees it?