On 1/7/25 14:00, Nicolin Chen wrote:
On Tue, Jan 07, 2025 at 01:54:00PM +0800, Baolu Lu wrote:
On 1/7/25 12:36, Nicolin Chen wrote:
+static bool arm_vsmmu_supports_veventq(unsigned int type)
+{
+       return type == IOMMU_VIOMMU_TYPE_ARM_SMMUV3;
Do you need to check the hardware capabilities before reporting this? I
am not familiar with the ARM architecture, but typically it's better to
make it like this,

static bool arm_vsmmu_supports_veventq(struct iommufd_viommu *viommu,
                                        enum iommu_veventq_type type)
{
        if (type != IOMMU_VEVENTQ_TYPE_ARM_SMMUV3)
                return false;

        if (hardware_not_capable(viommu))
                return false;
I think the ARM version of viommu_alloc op has already implemented
enough capability checks and rejected any of hardware_not_capable.
So, viommu shouldn't be a thing that the driver could actually use
to call this helper 🙂

Okay, fair enough.

Reply via email to