Hi Shuai and Fei,

On 10/29/2026 1:47 PM, Gong Shuai wrote:
> +    if (s->accel_state->viommu) {
> +        goto done;
> +    }
>
> +    if (!riscv_iommu_accel_alloc_viommu(s, idev, errp)) {
> +        error_append_hint(errp, "Unable to alloc vIOMMU: idev devid 0x%x: ",
> +                          idev->devid);
> +        return false;
> +    }

And in riscv_iommu_accel_alloc_viommu():

> +    /* Attach a HWPT based on ddtp.iommu_mode value */
> +    hwpt_id = riscv_iommu_accel_ddtp_hwpt(s, accel);
> +    if (!host_iommu_device_iommufd_attach_hwpt(idev, IOMMU_NO_PASID, hwpt_id,
> +                                               errp)) {
> +        goto free_bypass_hwpt;
> +    }

It looks like only the first VFIO device is attached to the abort/bypass
HWPT. Subsequent devices in different IOMMU groups may remain attached
to their original Stage-2 parent HWPT, potentially allowing DMA even
when DDTP.Mode is OFF.

Maybe we can follow ARM SMMUv3 and reattach all VFIO devices to the
appropriate abort/bypass HWPT during reset.

Thanks,
Tan Chi


Reply via email to