Re: [PATCH 0/5] Convert virtio-iommu to domain_alloc_paging()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2025-02-12 6:50 pm, Jacob Pan wrote:
Hi Jason,

On Wed, 12 Feb 2025 08:50:07 -0400
Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:

On Tue, Feb 11, 2025 at 04:41:51PM -0800, Jacob Pan wrote:

I see the same on arm64 with v9.0, assigned an ixgbe nic via VFIO.

Huh, I figured it worked on ARM..

There is no requirement that an iommu driver implement identity, this
is all an optimization. If it doesn't work in alot of cases can we
just remove it? It would simplfy a lot..

Currently, identity domain type can be set via sysfs. To prevent that,
maybe we need this?

+static int viommu_def_domain_type(struct device *dev)
+{
+  	return IOMMU_DOMAIN_DMA;

Ugh, please no more of that.


Yes, a user can *request* to set an identity domain via sysfs, and if the driver does not support identity domains then:

iommu_group_store_type()
    iommu_setup_default_domain()
        iommu_group_alloc_default_domain()
            __iommu_group_alloc_default_domain()
                __iommu_alloc_identity_domain()

will return failure, and everything will remain fine (well, except on apple-dart for now...) Find an s390 system and try it yourself* ;)

Thanks,
Robin.



*quickly, before the patches land and that gains identity support too!

+}
+
  static struct iommu_ops viommu_ops = {
         .identity_domain        = &viommu_identity_domain.domain,
         .capable                = viommu_capable,
@@ -1096,6 +1106,7 @@ static struct iommu_ops viommu_ops = {
         .device_group           = viommu_device_group,
         .get_resv_regions       = viommu_get_resv_regions,
         .of_xlate               = viommu_of_xlate,
+       .def_domain_type = viommu_def_domain_type,
         .owner                  = THIS_MODULE,






[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux