* Re: [PATCH v3 6/6] iommu/virtio: Enable x86 support
@ 2020-08-28 3:26 kernel test robot
0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2020-08-28 3:26 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 5488 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200821131540.2801801-7-jean-philippe@linaro.org>
References: <20200821131540.2801801-7-jean-philippe@linaro.org>
TO: "Jean-Philippe Brucker" <jean-philippe@linaro.org>
TO: iommu(a)lists.linux-foundation.org
TO: virtualization(a)lists.linux-foundation.org
TO: virtio-dev(a)lists.oasis-open.org
TO: linux-pci(a)vger.kernel.org
CC: joro(a)8bytes.org
CC: bhelgaas(a)google.com
CC: mst(a)redhat.com
CC: jasowang(a)redhat.com
CC: kevin.tian(a)intel.com
CC: sebastien.boeuf(a)intel.com
Hi Jean-Philippe,
I love your patch! Perhaps something to improve:
[auto build test WARNING on pci/next]
[also build test WARNING on linus/master v5.9-rc2 next-20200827]
[cannot apply to iommu/next vhost/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jean-Philippe-Brucker/Add-virtio-iommu-built-in-topology/20200821-211904
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago
config: i386-randconfig-m021-20200828 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/iommu/virtio/topology-helpers.c:142 virt_dma_configure() warn: passing zero to 'PTR_ERR'
drivers/iommu/virtio/topology.c:70 viommu_parse_node() warn: passing zero to 'ERR_PTR'
# https://github.com/0day-ci/linux/commit/2b45717082f8603e400de954e1a465dd508028af
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jean-Philippe-Brucker/Add-virtio-iommu-built-in-topology/20200821-211904
git checkout 2b45717082f8603e400de954e1a465dd508028af
vim +/PTR_ERR +142 drivers/iommu/virtio/topology-helpers.c
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 125
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 126 /**
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 127 * virt_dma_configure - Configure DMA of virtualized devices
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 128 * @dev: the endpoint
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 129 *
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 130 * Setup the DMA and IOMMU ops of a virtual device, for platforms without DT or
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 131 * ACPI.
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 132 *
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 133 * Return: -EPROBE_DEFER if the device is managed by an IOMMU that hasn't been
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 134 * probed yet, 0 otherwise
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 135 */
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 136 int virt_dma_configure(struct device *dev)
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 137 {
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 138 const struct iommu_ops *iommu_ops;
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 139
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 140 iommu_ops = virt_iommu_setup(dev);
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 141 if (IS_ERR_OR_NULL(iommu_ops)) {
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 @142 int ret = PTR_ERR(iommu_ops);
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 143
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 144 if (ret == -EPROBE_DEFER || ret == 0)
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 145 return ret;
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 146 dev_err(dev, "error %d while setting up virt IOMMU\n", ret);
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 147 return 0;
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 148 }
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 149
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 150 /*
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 151 * If we have reason to believe the IOMMU driver missed the initial
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 152 * add_device callback for dev, replay it to get things in order.
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 153 */
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 154 if (dev->bus && !device_iommu_mapped(dev))
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 155 iommu_probe_device(dev);
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 156
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 157 /* Assume coherent, as well as full 64-bit addresses. */
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 158 #ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 159 arch_setup_dma_ops(dev, 0, ~0ULL, iommu_ops, true);
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 160 #else
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 161 iommu_setup_dma_ops(dev, 0, ~0ULL);
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 162 #endif
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 163 return 0;
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 164 }
fd1c41b616087e Jean-Philippe Brucker 2020-08-21 165
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31906 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 0/6] Add support for ACPI VIOT
@ 2021-06-02 15:44 Jean-Philippe Brucker
2021-06-02 15:44 ` Jean-Philippe Brucker
0 siblings, 1 reply; 8+ messages in thread
From: Jean-Philippe Brucker @ 2021-06-02 15:44 UTC (permalink / raw)
To: rjw, lenb, joro, mst
Cc: will, catalin.marinas, baolu.lu, dwmw2, linux-acpi, iommu,
virtualization, linux-arm-kernel, eric.auger, sebastien.boeuf,
robin.murphy, kevin.tian, lorenzo.pieralisi, guohanjun,
sudeep.holla, jean-philippe
Add a driver for the ACPI VIOT table, which provides topology
information for para-virtual IOMMUs. Enable virtio-iommu on
non-devicetree platforms, including x86.
Since v2 [1] I tried to improve commit messages and comments. More
feedback and review are always welcome. Joerg offered to take this
series through the IOMMU tree, which requires acks for patches 1-3.
You can find a QEMU implementation at [2], with extra support for
testing all VIOT nodes including MMIO-based endpoints and IOMMU.
This series is at [3].
[1] https://lore.kernel.org/linux-iommu/20210423113836.3974972-1-jean-philippe@linaro.org/
[2] https://jpbrucker.net/git/qemu/log/?h=virtio-iommu/acpi
[3] https://jpbrucker.net/git/linux/log/?h=virtio-iommu/acpi
Jean-Philippe Brucker (6):
ACPI: arm64: Move DMA setup operations out of IORT
ACPI: Move IOMMU setup code out of IORT
ACPI: Add driver for the VIOT table
iommu/dma: Pass address limit rather than size to
iommu_setup_dma_ops()
iommu/dma: Simplify calls to iommu_setup_dma_ops()
iommu/virtio: Enable x86 support
drivers/acpi/Kconfig | 3 +
drivers/iommu/Kconfig | 4 +-
drivers/acpi/Makefile | 2 +
drivers/acpi/arm64/Makefile | 1 +
include/acpi/acpi_bus.h | 3 +
include/linux/acpi.h | 3 +
include/linux/acpi_iort.h | 14 +-
include/linux/acpi_viot.h | 19 ++
include/linux/dma-iommu.h | 4 +-
arch/arm64/mm/dma-mapping.c | 2 +-
drivers/acpi/arm64/dma.c | 50 +++++
drivers/acpi/arm64/iort.c | 129 ++-----------
drivers/acpi/bus.c | 2 +
drivers/acpi/scan.c | 60 +++++-
drivers/acpi/viot.c | 364 +++++++++++++++++++++++++++++++++++
drivers/iommu/amd/iommu.c | 9 +-
drivers/iommu/dma-iommu.c | 17 +-
drivers/iommu/intel/iommu.c | 10 +-
drivers/iommu/virtio-iommu.c | 8 +
MAINTAINERS | 8 +
20 files changed, 562 insertions(+), 150 deletions(-)
create mode 100644 include/linux/acpi_viot.h
create mode 100644 drivers/acpi/arm64/dma.c
create mode 100644 drivers/acpi/viot.c
--
2.31.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 6/6] iommu/virtio: Enable x86 support
2021-06-02 15:44 [PATCH v3 0/6] Add support for ACPI VIOT Jean-Philippe Brucker
2021-06-02 15:44 ` Jean-Philippe Brucker
(?)
@ 2021-06-02 15:44 ` Jean-Philippe Brucker
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Philippe Brucker @ 2021-06-02 15:44 UTC (permalink / raw)
To: rjw, lenb, joro, mst
Cc: will, catalin.marinas, baolu.lu, dwmw2, linux-acpi, iommu,
virtualization, linux-arm-kernel, eric.auger, sebastien.boeuf,
robin.murphy, kevin.tian, lorenzo.pieralisi, guohanjun,
sudeep.holla, jean-philippe
With the VIOT support in place, x86 platforms can now use the
virtio-iommu.
Because the other x86 IOMMU drivers aren't yet ready to use the
acpi_dma_setup() path, x86 doesn't implement arch_setup_dma_ops() at the
moment. Similarly to Vt-d and AMD IOMMU, call iommu_setup_dma_ops() from
probe_finalize().
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
drivers/iommu/Kconfig | 3 ++-
drivers/iommu/dma-iommu.c | 1 +
drivers/iommu/virtio-iommu.c | 8 ++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index aff8a4830dd1..07b7c25cbed8 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -400,8 +400,9 @@ config HYPERV_IOMMU
config VIRTIO_IOMMU
tristate "Virtio IOMMU driver"
depends on VIRTIO
- depends on ARM64
+ depends on (ARM64 || X86)
select IOMMU_API
+ select IOMMU_DMA
select INTERVAL_TREE
select ACPI_VIOT if ACPI
help
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 175f8eaeb5b3..46ed43c400cf 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -1332,6 +1332,7 @@ void iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 dma_limit)
pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n",
dev_name(dev));
}
+EXPORT_SYMBOL_GPL(iommu_setup_dma_ops);
static struct iommu_dma_msi_page *iommu_dma_get_msi_page(struct device *dev,
phys_addr_t msi_addr, struct iommu_domain *domain)
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 218fe8560e8d..77aee1207ced 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -1026,6 +1026,13 @@ static struct iommu_device *viommu_probe_device(struct device *dev)
return ERR_PTR(ret);
}
+static void viommu_probe_finalize(struct device *dev)
+{
+#ifndef CONFIG_ARCH_HAS_SETUP_DMA_OPS
+ iommu_setup_dma_ops(dev, 0, U64_MAX);
+#endif
+}
+
static void viommu_release_device(struct device *dev)
{
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
@@ -1062,6 +1069,7 @@ static struct iommu_ops viommu_ops = {
.iova_to_phys = viommu_iova_to_phys,
.iotlb_sync = viommu_iotlb_sync,
.probe_device = viommu_probe_device,
+ .probe_finalize = viommu_probe_finalize,
.release_device = viommu_release_device,
.device_group = viommu_device_group,
.get_resv_regions = viommu_get_resv_regions,
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 6/6] iommu/virtio: Enable x86 support
@ 2021-06-02 15:44 ` Jean-Philippe Brucker
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Philippe Brucker @ 2021-06-02 15:44 UTC (permalink / raw)
To: rjw, lenb, joro, mst
Cc: will, catalin.marinas, baolu.lu, dwmw2, linux-acpi, iommu,
virtualization, linux-arm-kernel, eric.auger, sebastien.boeuf,
robin.murphy, kevin.tian, lorenzo.pieralisi, guohanjun,
sudeep.holla, jean-philippe
With the VIOT support in place, x86 platforms can now use the
virtio-iommu.
Because the other x86 IOMMU drivers aren't yet ready to use the
acpi_dma_setup() path, x86 doesn't implement arch_setup_dma_ops() at the
moment. Similarly to Vt-d and AMD IOMMU, call iommu_setup_dma_ops() from
probe_finalize().
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
drivers/iommu/Kconfig | 3 ++-
drivers/iommu/dma-iommu.c | 1 +
drivers/iommu/virtio-iommu.c | 8 ++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index aff8a4830dd1..07b7c25cbed8 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -400,8 +400,9 @@ config HYPERV_IOMMU
config VIRTIO_IOMMU
tristate "Virtio IOMMU driver"
depends on VIRTIO
- depends on ARM64
+ depends on (ARM64 || X86)
select IOMMU_API
+ select IOMMU_DMA
select INTERVAL_TREE
select ACPI_VIOT if ACPI
help
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 175f8eaeb5b3..46ed43c400cf 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -1332,6 +1332,7 @@ void iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 dma_limit)
pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n",
dev_name(dev));
}
+EXPORT_SYMBOL_GPL(iommu_setup_dma_ops);
static struct iommu_dma_msi_page *iommu_dma_get_msi_page(struct device *dev,
phys_addr_t msi_addr, struct iommu_domain *domain)
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 218fe8560e8d..77aee1207ced 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -1026,6 +1026,13 @@ static struct iommu_device *viommu_probe_device(struct device *dev)
return ERR_PTR(ret);
}
+static void viommu_probe_finalize(struct device *dev)
+{
+#ifndef CONFIG_ARCH_HAS_SETUP_DMA_OPS
+ iommu_setup_dma_ops(dev, 0, U64_MAX);
+#endif
+}
+
static void viommu_release_device(struct device *dev)
{
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
@@ -1062,6 +1069,7 @@ static struct iommu_ops viommu_ops = {
.iova_to_phys = viommu_iova_to_phys,
.iotlb_sync = viommu_iotlb_sync,
.probe_device = viommu_probe_device,
+ .probe_finalize = viommu_probe_finalize,
.release_device = viommu_release_device,
.device_group = viommu_device_group,
.get_resv_regions = viommu_get_resv_regions,
--
2.31.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 6/6] iommu/virtio: Enable x86 support
@ 2021-06-02 15:44 ` Jean-Philippe Brucker
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Philippe Brucker @ 2021-06-02 15:44 UTC (permalink / raw)
To: rjw, lenb, joro, mst
Cc: jean-philippe, lorenzo.pieralisi, eric.auger, catalin.marinas,
sudeep.holla, robin.murphy, virtualization, linux-acpi, iommu,
sebastien.boeuf, guohanjun, will, dwmw2, linux-arm-kernel,
baolu.lu
With the VIOT support in place, x86 platforms can now use the
virtio-iommu.
Because the other x86 IOMMU drivers aren't yet ready to use the
acpi_dma_setup() path, x86 doesn't implement arch_setup_dma_ops() at the
moment. Similarly to Vt-d and AMD IOMMU, call iommu_setup_dma_ops() from
probe_finalize().
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
drivers/iommu/Kconfig | 3 ++-
drivers/iommu/dma-iommu.c | 1 +
drivers/iommu/virtio-iommu.c | 8 ++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index aff8a4830dd1..07b7c25cbed8 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -400,8 +400,9 @@ config HYPERV_IOMMU
config VIRTIO_IOMMU
tristate "Virtio IOMMU driver"
depends on VIRTIO
- depends on ARM64
+ depends on (ARM64 || X86)
select IOMMU_API
+ select IOMMU_DMA
select INTERVAL_TREE
select ACPI_VIOT if ACPI
help
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 175f8eaeb5b3..46ed43c400cf 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -1332,6 +1332,7 @@ void iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 dma_limit)
pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n",
dev_name(dev));
}
+EXPORT_SYMBOL_GPL(iommu_setup_dma_ops);
static struct iommu_dma_msi_page *iommu_dma_get_msi_page(struct device *dev,
phys_addr_t msi_addr, struct iommu_domain *domain)
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 218fe8560e8d..77aee1207ced 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -1026,6 +1026,13 @@ static struct iommu_device *viommu_probe_device(struct device *dev)
return ERR_PTR(ret);
}
+static void viommu_probe_finalize(struct device *dev)
+{
+#ifndef CONFIG_ARCH_HAS_SETUP_DMA_OPS
+ iommu_setup_dma_ops(dev, 0, U64_MAX);
+#endif
+}
+
static void viommu_release_device(struct device *dev)
{
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
@@ -1062,6 +1069,7 @@ static struct iommu_ops viommu_ops = {
.iova_to_phys = viommu_iova_to_phys,
.iotlb_sync = viommu_iotlb_sync,
.probe_device = viommu_probe_device,
+ .probe_finalize = viommu_probe_finalize,
.release_device = viommu_release_device,
.device_group = viommu_device_group,
.get_resv_regions = viommu_get_resv_regions,
--
2.31.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 6/6] iommu/virtio: Enable x86 support
@ 2021-06-02 15:44 ` Jean-Philippe Brucker
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Philippe Brucker @ 2021-06-02 15:44 UTC (permalink / raw)
To: rjw, lenb, joro, mst
Cc: jean-philippe, kevin.tian, catalin.marinas, sudeep.holla,
robin.murphy, virtualization, linux-acpi, iommu, sebastien.boeuf,
guohanjun, will, dwmw2, linux-arm-kernel
With the VIOT support in place, x86 platforms can now use the
virtio-iommu.
Because the other x86 IOMMU drivers aren't yet ready to use the
acpi_dma_setup() path, x86 doesn't implement arch_setup_dma_ops() at the
moment. Similarly to Vt-d and AMD IOMMU, call iommu_setup_dma_ops() from
probe_finalize().
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
drivers/iommu/Kconfig | 3 ++-
drivers/iommu/dma-iommu.c | 1 +
drivers/iommu/virtio-iommu.c | 8 ++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index aff8a4830dd1..07b7c25cbed8 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -400,8 +400,9 @@ config HYPERV_IOMMU
config VIRTIO_IOMMU
tristate "Virtio IOMMU driver"
depends on VIRTIO
- depends on ARM64
+ depends on (ARM64 || X86)
select IOMMU_API
+ select IOMMU_DMA
select INTERVAL_TREE
select ACPI_VIOT if ACPI
help
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 175f8eaeb5b3..46ed43c400cf 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -1332,6 +1332,7 @@ void iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 dma_limit)
pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n",
dev_name(dev));
}
+EXPORT_SYMBOL_GPL(iommu_setup_dma_ops);
static struct iommu_dma_msi_page *iommu_dma_get_msi_page(struct device *dev,
phys_addr_t msi_addr, struct iommu_domain *domain)
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 218fe8560e8d..77aee1207ced 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -1026,6 +1026,13 @@ static struct iommu_device *viommu_probe_device(struct device *dev)
return ERR_PTR(ret);
}
+static void viommu_probe_finalize(struct device *dev)
+{
+#ifndef CONFIG_ARCH_HAS_SETUP_DMA_OPS
+ iommu_setup_dma_ops(dev, 0, U64_MAX);
+#endif
+}
+
static void viommu_release_device(struct device *dev)
{
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
@@ -1062,6 +1069,7 @@ static struct iommu_ops viommu_ops = {
.iova_to_phys = viommu_iova_to_phys,
.iotlb_sync = viommu_iotlb_sync,
.probe_device = viommu_probe_device,
+ .probe_finalize = viommu_probe_finalize,
.release_device = viommu_release_device,
.device_group = viommu_device_group,
.get_resv_regions = viommu_get_resv_regions,
--
2.31.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 0/6] Add virtio-iommu built-in topology
@ 2020-08-21 13:15 Jean-Philippe Brucker
2020-08-21 13:15 ` Jean-Philippe Brucker
0 siblings, 1 reply; 8+ messages in thread
From: Jean-Philippe Brucker @ 2020-08-21 13:15 UTC (permalink / raw)
To: iommu, virtualization, virtio-dev, linux-pci
Cc: joro, bhelgaas, mst, jasowang, kevin.tian, sebastien.boeuf,
eric.auger, lorenzo.pieralisi, Jean-Philippe Brucker
Add a topology description to the virtio-iommu driver and enable x86
platforms.
Since [v2] we have made some progress on adding ACPI support for
virtio-iommu, which is the preferred boot method on x86. It will be a
new vendor-agnostic table describing para-virtual topologies in a
minimal format. However some platforms don't use either ACPI or DT for
booting (for example microvm), and will need the alternative topology
description method proposed here. In addition, since the process to get
a new ACPI table will take a long time, this provides a boot method even
to ACPI-based platforms, if only temporarily for testing and
development.
v3:
* Add patch 1 that moves virtio-iommu to a subfolder.
* Split the rest:
* Patch 2 adds topology-helper.c, which will be shared with the ACPI
support.
* Patch 4 adds definitions.
* Patch 5 adds parser in topology.c.
* Address other comments.
Linux and QEMU patches available at:
https://jpbrucker.net/git/linux virtio-iommu/devel
https://jpbrucker.net/git/qemu virtio-iommu/devel
[spec] https://lists.oasis-open.org/archives/virtio-dev/202008/msg00067.html
[v2] https://lore.kernel.org/linux-iommu/20200228172537.377327-1-jean-philippe@linaro.org/
[v1] https://lore.kernel.org/linux-iommu/20200214160413.1475396-1-jean-philippe@linaro.org/
[rfc] https://lore.kernel.org/linux-iommu/20191122105000.800410-1-jean-philippe@linaro.org/
Jean-Philippe Brucker (6):
iommu/virtio: Move to drivers/iommu/virtio/
iommu/virtio: Add topology helpers
PCI: Add DMA configuration for virtual platforms
iommu/virtio: Add topology definitions
iommu/virtio: Support topology description in config space
iommu/virtio: Enable x86 support
drivers/iommu/Kconfig | 18 +-
drivers/iommu/Makefile | 3 +-
drivers/iommu/virtio/Makefile | 4 +
drivers/iommu/virtio/topology-helpers.h | 50 +++++
include/linux/virt_iommu.h | 15 ++
include/uapi/linux/virtio_iommu.h | 44 ++++
drivers/iommu/virtio/topology-helpers.c | 196 ++++++++++++++++
drivers/iommu/virtio/topology.c | 259 ++++++++++++++++++++++
drivers/iommu/{ => virtio}/virtio-iommu.c | 4 +
drivers/pci/pci-driver.c | 5 +
MAINTAINERS | 3 +-
11 files changed, 597 insertions(+), 4 deletions(-)
create mode 100644 drivers/iommu/virtio/Makefile
create mode 100644 drivers/iommu/virtio/topology-helpers.h
create mode 100644 include/linux/virt_iommu.h
create mode 100644 drivers/iommu/virtio/topology-helpers.c
create mode 100644 drivers/iommu/virtio/topology.c
rename drivers/iommu/{ => virtio}/virtio-iommu.c (99%)
--
2.28.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 6/6] iommu/virtio: Enable x86 support
2020-08-21 13:15 [PATCH v3 0/6] Add virtio-iommu built-in topology Jean-Philippe Brucker
2020-08-21 13:15 ` Jean-Philippe Brucker
@ 2020-08-21 13:15 ` Jean-Philippe Brucker
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Philippe Brucker @ 2020-08-21 13:15 UTC (permalink / raw)
To: iommu, virtualization, virtio-dev, linux-pci
Cc: joro, bhelgaas, mst, jasowang, kevin.tian, sebastien.boeuf,
eric.auger, lorenzo.pieralisi, Jean-Philippe Brucker
With the built-in topology description in place, x86 platforms can now
use the virtio-iommu.
Architectures that use the generic iommu_dma_ops should normally select
CONFIG_IOMMU_DMA themselves (from arch/*/Kconfig). Since not all x86
drivers have been converted yet, it's currently up to the IOMMU Kconfig
to select it.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
drivers/iommu/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 98d28fdbc19a..d7cf158745eb 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -383,8 +383,9 @@ config HYPERV_IOMMU
config VIRTIO_IOMMU
tristate "Virtio IOMMU driver"
depends on VIRTIO
- depends on ARM64
+ depends on (ARM64 || X86)
select IOMMU_API
+ select IOMMU_DMA if X86
select INTERVAL_TREE
help
Para-virtualised IOMMU driver with virtio.
--
2.28.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 6/6] iommu/virtio: Enable x86 support
@ 2020-08-21 13:15 ` Jean-Philippe Brucker
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Philippe Brucker @ 2020-08-21 13:15 UTC (permalink / raw)
To: iommu, virtualization, virtio-dev, linux-pci
Cc: Jean-Philippe Brucker, lorenzo.pieralisi, mst, joro, eric.auger,
sebastien.boeuf, bhelgaas
With the built-in topology description in place, x86 platforms can now
use the virtio-iommu.
Architectures that use the generic iommu_dma_ops should normally select
CONFIG_IOMMU_DMA themselves (from arch/*/Kconfig). Since not all x86
drivers have been converted yet, it's currently up to the IOMMU Kconfig
to select it.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
drivers/iommu/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 98d28fdbc19a..d7cf158745eb 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -383,8 +383,9 @@ config HYPERV_IOMMU
config VIRTIO_IOMMU
tristate "Virtio IOMMU driver"
depends on VIRTIO
- depends on ARM64
+ depends on (ARM64 || X86)
select IOMMU_API
+ select IOMMU_DMA if X86
select INTERVAL_TREE
help
Para-virtualised IOMMU driver with virtio.
--
2.28.0
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 6/6] iommu/virtio: Enable x86 support
@ 2020-08-21 13:15 ` Jean-Philippe Brucker
0 siblings, 0 replies; 8+ messages in thread
From: Jean-Philippe Brucker @ 2020-08-21 13:15 UTC (permalink / raw)
To: iommu, virtualization, virtio-dev, linux-pci
Cc: Jean-Philippe Brucker, kevin.tian, mst, sebastien.boeuf,
bhelgaas, jasowang
With the built-in topology description in place, x86 platforms can now
use the virtio-iommu.
Architectures that use the generic iommu_dma_ops should normally select
CONFIG_IOMMU_DMA themselves (from arch/*/Kconfig). Since not all x86
drivers have been converted yet, it's currently up to the IOMMU Kconfig
to select it.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
drivers/iommu/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 98d28fdbc19a..d7cf158745eb 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -383,8 +383,9 @@ config HYPERV_IOMMU
config VIRTIO_IOMMU
tristate "Virtio IOMMU driver"
depends on VIRTIO
- depends on ARM64
+ depends on (ARM64 || X86)
select IOMMU_API
+ select IOMMU_DMA if X86
select INTERVAL_TREE
help
Para-virtualised IOMMU driver with virtio.
--
2.28.0
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-06-02 15:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 3:26 [PATCH v3 6/6] iommu/virtio: Enable x86 support kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2021-06-02 15:44 [PATCH v3 0/6] Add support for ACPI VIOT Jean-Philippe Brucker
2021-06-02 15:44 ` [PATCH v3 6/6] iommu/virtio: Enable x86 support Jean-Philippe Brucker
2021-06-02 15:44 ` Jean-Philippe Brucker
2021-06-02 15:44 ` Jean-Philippe Brucker
2021-06-02 15:44 ` Jean-Philippe Brucker
2020-08-21 13:15 [PATCH v3 0/6] Add virtio-iommu built-in topology Jean-Philippe Brucker
2020-08-21 13:15 ` [PATCH v3 6/6] iommu/virtio: Enable x86 support Jean-Philippe Brucker
2020-08-21 13:15 ` Jean-Philippe Brucker
2020-08-21 13:15 ` Jean-Philippe Brucker
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.