diff --git a/anolis/cmdline/loongarch64 b/anolis/cmdline/loongarch64 index 2a48fbe19c0d1b41852e0012647654bf5594171c..cc218653e7db69c01fedbb224c076ee0f02f270a 100644 --- a/anolis/cmdline/loongarch64 +++ b/anolis/cmdline/loongarch64 @@ -1,2 +1,3 @@ cgroup.memory=nokmem crashkernel=1024M +vfio_iommu_type1.allow_unsafe_interrupts=1 diff --git a/drivers/iommu/loongarch_iommu.c b/drivers/iommu/loongarch_iommu.c index 170a062c074ff1cd852c6148071acfb909016bbb..8c5ba580fc75891b875049508bdac324c51c172c 100644 --- a/drivers/iommu/loongarch_iommu.c +++ b/drivers/iommu/loongarch_iommu.c @@ -596,6 +596,7 @@ static struct iommu_domain *la_iommu_domain_alloc(unsigned int type) switch (type) { case IOMMU_DOMAIN_BLOCKED: + case IOMMU_DOMAIN_IDENTITY: case IOMMU_DOMAIN_UNMANAGED: info = alloc_dom_info(); if (info == NULL) @@ -847,7 +848,9 @@ static int la_iommu_attach_dev(struct iommu_domain *domain, struct device *dev) la_iommu_detach_dev(dev); - if (domain != NULL && domain->type == IOMMU_DOMAIN_BLOCKED) + if (domain != NULL && + (domain->type == IOMMU_DOMAIN_IDENTITY || + domain->type == IOMMU_DOMAIN_BLOCKED)) return 0; if (domain == NULL) @@ -1178,6 +1181,11 @@ static phys_addr_t la_iommu_iova_to_phys(struct iommu_domain *domain, return phys; } +static int la_iommu_def_domain_type(struct device *dev) +{ + return IOMMU_DOMAIN_IDENTITY; +} + const struct iommu_ops la_iommu_ops = { .capable = la_iommu_capable, .domain_alloc = la_iommu_domain_alloc, @@ -1185,6 +1193,7 @@ const struct iommu_ops la_iommu_ops = { .release_device = la_iommu_remove_device, .device_group = la_iommu_device_group, .pgsize_bitmap = LA_IOMMU_PGSIZE, + .def_domain_type = la_iommu_def_domain_type, .owner = THIS_MODULE, .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = la_iommu_attach_dev,