All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] Add support for ACPI VIOT
@ 2021-06-02 15:44 ` Jean-Philippe Brucker
  0 siblings, 0 replies; 44+ 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] 44+ messages in thread
* Re: [PATCH v3 6/6] iommu/virtio: Enable x86 support
@ 2020-08-28  3:26 kernel test robot
  0 siblings, 0 replies; 44+ 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] 44+ 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; 44+ 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] 44+ messages in thread

end of thread, other threads:[~2021-06-10  7:28 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-06-02 15:44 ` Jean-Philippe Brucker
2021-06-02 15:44 ` [PATCH v3 1/6] ACPI: arm64: Move DMA setup operations out of IORT 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
2021-06-02 15:44 ` [PATCH v3 2/6] ACPI: Move IOMMU setup code " 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
2021-06-02 20:06   ` kernel test robot
2021-06-02 20:06     ` kernel test robot
2021-06-02 20:06     ` kernel test robot
2021-06-03  7:26     ` Jean-Philippe Brucker
2021-06-03  7:26       ` Jean-Philippe Brucker
2021-06-03  7:26       ` Jean-Philippe Brucker
2021-06-04 15:22       ` Joerg Roedel
2021-06-04 15:22         ` Joerg Roedel
2021-06-04 15:22         ` Joerg Roedel
2021-06-10  7:26         ` Jean-Philippe Brucker
2021-06-10  7:26           ` Jean-Philippe Brucker
2021-06-10  7:26           ` Jean-Philippe Brucker
2021-06-02 15:44 ` [PATCH v3 3/6] ACPI: Add driver for the VIOT table 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
2021-06-02 15:44 ` [PATCH v3 4/6] iommu/dma: Pass address limit rather than size to iommu_setup_dma_ops() 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
2021-06-02 15:44 ` [PATCH v3 5/6] iommu/dma: Simplify calls " 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
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
  -- strict thread matches above, loose matches on Subject: below --
2020-08-28  3:26 kernel test robot
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.