RE: [PATCH v2 08/10] iommufd/device: Use iommu_group_replace_domain()
From: Tian, Kevin
Date: Wed Feb 15 2023 - 02:24:46 EST
> From: Nicolin Chen <nicolinc@xxxxxxxxxx>
> Sent: Wednesday, February 15, 2023 3:15 PM
>
> But things will be out of control, if user space continues mapping
> something onto domain1's iopt for idev2, even after it is attached
> covertly to domain2's iopt by the replace routine. I wonder how
> kernel should handle this and keep the consistency between IOMMUFD
> objects and iommu_group.
>
this is where I don't understand.
domain mapping just reflects what an address space has.
Take Qemu for example. w/o vIOMMU domain mappings is added/
removed according to the change in the GPA address space.
w/ vIOMMU then it is synced with guest page table.
why would userspace construct mappings for a specific device?
when device is moved from one domain to another domain, it just
bears with whatever the new domain allows it to access.