[PATCH v3 4/6] ARM: add 32bit support to GICv3

2015-10-01 Thread Jean-Philippe Brucker
on 32bit architectures. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- arch/arm/include/asm/arch_gicv3.h | 188 + 1 file changed, 188 insertions(+) create mode 100644 arch/arm/include/asm/arch_gicv3.h diff --git a/arch/arm/inclu

[PATCH v3 6/6] arm/arm64: KVM: only allow 64bit hosts to build VGICv3

2015-10-01 Thread Jean-Philippe Brucker
, that is only enabled on the 64bit side. The selection is done unconditionally because CONFIG_ARM_GIC_V3 is always enabled on arm64. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- arch/arm64/kvm/Kconfig |4 include/kvm/arm_vgic.h |4 ++-- virt/kvm/arm/

[PATCH v3 1/6] arm64: GICv3: refactor the AArch64 specific parts

2015-10-01 Thread Jean-Philippe Brucker
This patch moves the GICv3 system register access helpers to arch/arm64/. Their 32bit counterparts will need to use mrc/mcr accesses instead of mrs_s/msr_s. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- arch/arm64/include/asm/arch_gicv3.h

[PATCH v3 2/6] arm64: GICv3: change unsigned types for AArch32 compatibility

2015-10-01 Thread Jean-Philippe Brucker
vGIC driver will need to split their values into two 32bit registers: LRn and LRCn. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- arch/arm64/include/asm/arch_gicv3.h | 35 --- drivers/irqchip/irq-gic-v3.c

[PATCH v3 0/6] GICv3: add 32bit compatibility

2015-10-01 Thread Jean-Philippe Brucker
the mistakes pointed out on the list, - add a patch to select ARM_GIC_V3 under ARCH_VIRT. Cheers, Jean [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-December/310124.html [2] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/327034.html Jean-Philippe Brucker (6

[PATCH v3 3/6] arm64: GICv3: Specialize readq and writeq accesses

2015-10-01 Thread Jean-Philippe Brucker
, this patch specializes the IROUTER and TYPER accesses. Since the latter is an ID register, it won't need to be read atomically, but we still avoid future confusion by using gic_read_typer instead of a generic gic_readq. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- arch

Re: [RFC v5 06/17] dma-reserved-iommu: iommu_get/put_single_reserved

2016-03-10 Thread Jean-Philippe Brucker
Hi Eric, On Tue, Mar 01, 2016 at 06:27:46PM +, Eric Auger wrote: >[...] > + > +int iommu_get_single_reserved(struct iommu_domain *domain, > + phys_addr_t addr, int prot, > + dma_addr_t *iova) > +{ > + unsigned long order =

Re: [PATCH v6 6/7] dma-reserved-iommu: iommu_get/put_single_reserved

2016-04-07 Thread Jean-Philippe Brucker
Hi Eric, On Thu, Apr 07, 2016 at 11:33:42AM +0200, Eric Auger wrote: > Alex, > On 04/07/2016 01:12 AM, Alex Williamson wrote: > > On Mon, 4 Apr 2016 08:07:01 + > > Eric Auger wrote: > > > >> This patch introduces iommu_get/put_single_reserved. > >> > >>

Re: [kvmtool PATCH v9 04/15] MSI-X: update GSI routing after changed MSI-X configuration

2017-03-29 Thread Jean-Philippe Brucker
On 02/02/17 16:32, Andre Przywara wrote: > When we set up GSI routing to map MSIs to KVM's GSI numbers, we > write the current device's MSI setup into the kernel routing table. > However the device driver in the guest can use PCI configuration space > accesses to change the MSI configuration

Re: [PATCH v2 07/11] KVM: arm/arm64: Register iodevs when setting redist base and creating VCPUs

2017-05-17 Thread Jean-Philippe Brucker
On 17/05/17 12:18, Christoffer Dall wrote: > Hi Jean, > > On Tue, May 16, 2017 at 12:23:52PM +0100, Jean-Philippe Brucker wrote: >> Hi, >> >> On 09/05/17 09:56, Christoffer Dall wrote: >>> Instead of waiting with registering KVM iodevs until the first VCP

Re: [PATCH v2 07/11] KVM: arm/arm64: Register iodevs when setting redist base and creating VCPUs

2017-05-16 Thread Jean-Philippe Brucker
Hi, On 09/05/17 09:56, Christoffer Dall wrote: > Instead of waiting with registering KVM iodevs until the first VCPU is > run, we can actually create the iodevs when the redist base address is > set. The only downside is that we must now also check if we need to do > this for VCPUs which are

Re: [virtio-dev] [RFC PATCH v2 4/5] ACPI/IORT: Support paravirtualized IOMMU

2017-11-29 Thread Jean-Philippe Brucker
On 17/11/17 18:52, Jean-Philippe Brucker wrote: > To describe the virtual topology in relation to a virtio-iommu device, > ACPI-based systems use a "paravirtualized IOMMU" IORT node. Add support > for it. > > This is a RFC because the IORT specification doesn't describe t

Re: [virtio-dev] [RFC PATCH v2 1/5] iommu: Add virtio-iommu driver

2017-11-29 Thread Jean-Philippe Brucker
On 17/11/17 18:52, Jean-Philippe Brucker wrote: [...] > +struct viommu_domain { > + struct iommu_domain domain; > + struct viommu_dev *viommu; > + struct mutexmutex; > + unsigned intid; > +

[RFC PATCH v2 4/5] ACPI/IORT: Support paravirtualized IOMMU

2017-11-17 Thread Jean-Philippe Brucker
s multiple remapping devices -- currently only ARM IOMMUs and MSI controllers, but it is easy to extend. IORT table and drivers are easiest to extend and they do the job, so rather than introducing a fourth solution to solve a generic problem, reuse what exists. Signed-off-by: Jean-Philippe Bru

[RFC PATCH v2 0/5] Add virtio-iommu driver

2017-11-17 Thread Jean-Philippe Brucker
://lists.gnu.org/archive/html/qemu-arm/2017-09/msg00413.html [4] git://linux-arm.org/kvmtool-jpb.git virtio-iommu/base [5] git://linux-arm.org/linux-jpb.git virtio-iommu/v0.5-dev Jean-Philippe Brucker (5): iommu: Add virtio-iommu driver iommu/virtio-iommu: Add probe request iommu/virtio-iommu: Add event

[RFC PATCH v2 1/5] iommu: Add virtio-iommu driver

2017-11-17 Thread Jean-Philippe Brucker
. Implementing the IOMMU API is fairly straightforward since the virtio-iommu MAP/UNMAP interface is almost identical. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- drivers/iommu/Kconfig | 11 + drivers/iommu/Makefile| 1 + drivers/iommu/

[RFC PATCH v2 5/5] ACPI/IORT: Move IORT to the ACPI folder

2017-11-17 Thread Jean-Philippe Brucker
specific to arm64 in the driver, it simply requires moving Makefile and Kconfig entries. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- drivers/acpi/Kconfig| 3 +++ drivers/acpi/Makefile | 1 + drivers/acpi/arm64/Kconfig | 3 --- drivers/acpi

[RFC PATCH v2 2/5] iommu/virtio-iommu: Add probe request

2017-11-17 Thread Jean-Philippe Brucker
in the virtio-iommu, because MSIs bypass it. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- drivers/iommu/virtio-iommu.c | 165 -- include/uapi/linux/virtio_iommu.h | 37 + 2 files changed, 195 insertions(+), 7 deletions(-)

[RFC PATCH v2 3/5] iommu/virtio-iommu: Add event queue

2017-11-17 Thread Jean-Philippe Brucker
The event queue offers a way for the device to report access faults from devices. It is implemented on virtqueue #1, whenever the host needs to signal a fault it fills one of the buffers offered by the guest and interrupts it. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.

[PATCH kvmtool 0/2] Add GICv2m support

2017-11-03 Thread Jean-Philippe Brucker
we create the IRQFD routes such that they inject the given SPI. [1] https://developer.arm.com/products/architecture/a-profile/docs/den0029/latest/server-base-system-architecture Jean-Philippe Brucker (2): Prevent segfault when kvm_pause is called too early Add GICv2m support Makefile

[PATCH kvmtool 2/2] Add GICv2m support

2017-11-03 Thread Jean-Philippe Brucker
-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- Makefile | 2 +- arm/aarch32/include/asm/kvm.h| 2 + arm/aarch64/include/asm/kvm.h| 2 + arm/gic.c| 1

[PATCH kvmtool 1/2] Prevent segfault when kvm_pause is called too early

2017-11-03 Thread Jean-Philippe Brucker
within core_init (level 0). The CPU array is initialized later in base_init (level 1). Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kvm.c b/kvm.c index 9078a026411b..7de825a9d063 100644 --- a

Re: [PATCH kvmtool 2/2] Add GICv2m support

2017-11-03 Thread Jean-Philippe Brucker
On 03/11/17 14:27, Andre Przywara wrote: > Hi, > > good stuff, thanks for doing this! > > On 03/11/17 11:38, Jean-Philippe Brucker wrote: >> GICv2m is a small extension to the GICv2 architecture, specified in the >> Server Base System Architecture (SBSA). It adds a set

[PATCH v6 kvmtool 01/13] pci: add config operations callbacks on the PCI header

2018-06-18 Thread Jean-Philippe Brucker
-by: Punit Agrawal Signed-off-by: Will Deacon [JPB: moved to a separate patch] Signed-off-by: Jean-Philippe Brucker --- include/kvm/pci.h | 72 +- pci.c | 89 ++- 2 files changed, 89 insertions(+), 72 deletions

[PATCH v6 kvmtool 00/13] Add vfio-pci support

2018-06-18 Thread Jean-Philippe Brucker
n/vfio.txt) This time around I also tested assignment of the x540 NIC on my old x86 desktop as well (previously only on AMD Seattle, an arm64 host). It worked smoothly. v6: git://linux-arm.org/kvmtool-jpb.git vfio/v6 v5: https://www.spinics.net/lists/kvm/msg166119.html Jean-Philippe Brucker (13):

[PATCH v6 kvmtool 02/13] pci: allow to specify IRQ type for PCI devices

2018-06-18 Thread Jean-Philippe Brucker
-Philippe Brucker --- arm/pci.c | 3 ++- include/kvm/pci.h | 6 ++ pci.c | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arm/pci.c b/arm/pci.c index 813df26a8..744b14c26 100644 --- a/arm/pci.c +++ b/arm/pci.c @@ -77,6 +77,7 @@ void

[PATCH v6 kvmtool 04/13] Extend memory bank API with memory types

2018-06-18 Thread Jean-Philippe Brucker
generating firmware information (that is, for x86 bios; DT supports reserved-memory description). Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe Brucker --- arm/kvm.c | 2 +- hw/pci-shmem.c| 4 ++-- hw/vesa.c | 2 +- include/kvm/

[PATCH v6 kvmtool 03/13] irq: add irqfd helpers

2018-06-18 Thread Jean-Philippe Brucker
, when the guest needs them Since we cannot setup IRQFD before (2), store the IRQFD routing for IRQ lines temporarily until we're ready to submit them. Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe Brucker --- arm/gic.c| 76 +++- arm

[PATCH v6 kvmtool 05/13] pci: add capability helpers

2018-06-18 Thread Jean-Philippe Brucker
Add a way to iterate over all capabilities in a config space. Add a search function for getting a specific capability. Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe Brucker --- include/kvm/pci.h | 14 ++ pci.c | 13 + 2 files changed, 27 insertions

[PATCH v6 kvmtool 10/13] vfio-pci: add MSI support

2018-06-18 Thread Jean-Philippe Brucker
enable MSI and MSI-X at the same time (forbidden by PCI). Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe Brucker --- include/kvm/pci.h | 23 ++ include/kvm/vfio.h | 1 + vfio/pci.c | 178 +++-- 3 files changed, 195 insertions(+), 7

[PATCH v6 kvmtool 06/13] Import VFIO headers

2018-06-18 Thread Jean-Philippe Brucker
To ensure consistency between kvmtool and the kernel, import the UAPI headers of the VFIO version we implement. This is from Linux v4.12. Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe Brucker --- include/linux/vfio.h | 719 +++ 1 file changed

[PATCH v6 kvmtool 07/13] Add fls_long and roundup_pow_of_two helpers

2018-06-18 Thread Jean-Philippe Brucker
It's always nice to have a log2 handy, and the vfio-pci code will need to perform power of two allocation from an arbitrary size. Add fls_long and roundup_pow_of_two, based on the GCC builtin. Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe Brucker --- include/kvm/util.h | 14

[PATCH v6 kvmtool 08/13] Add PCI device passthrough using VFIO

2018-06-18 Thread Jean-Philippe Brucker
r passing platform devices to guests. Reviewed-by: Punit Agrawal Signed-off-by: Will Deacon Signed-off-by: Robin Murphy Signed-off-by: Jean-Philippe Brucker --- Makefile | 2 + arm/pci.c| 1 + builtin-run.c| 5 + include/kvm/kvm-config.h | 3 + in

[PATCH v6 kvmtool 09/13] vfio-pci: add MSI-X support

2018-06-18 Thread Jean-Philippe Brucker
be injected if it was pending. At the moment no MSI is injected, we simply disconnect the IRQFD and all messages are lost. Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe Brucker --- include/kvm/vfio.h | 52 vfio/pci.c | 651 - 2 files

[PATCH v6 kvmtool 12/13] Introduce reserved memory regions

2018-06-18 Thread Jean-Philippe Brucker
ld kvmtool with different addresses or change its IOMMU resv regions if possible. Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe Brucker --- include/kvm/kvm.h | 10 +++ kvm.c | 68 +-- 2 files changed, 64 insertions(+), 14 deletions(-)

[PATCH v6 kvmtool 11/13] vfio: Support non-mmappable regions

2018-06-18 Thread Jean-Philippe Brucker
regions. For example when VFIO allows to mmap fragments of a PCI BAR and forbids accessing things like MSI-X tables. We don't support the sparse capability at the moment, so trap these regions instead (if VFIO rejects the mmap). Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe

[PATCH v6 kvmtool 13/13] vfio: check reserved regions before mapping DMA

2018-06-18 Thread Jean-Philippe Brucker
. Reviewed-by: Punit Agrawal Signed-off-by: Jean-Philippe Brucker --- vfio/core.c | 49 + 1 file changed, 49 insertions(+) diff --git a/vfio/core.c b/vfio/core.c index a4a257a70..17b5b0cfc 100644 --- a/vfio/core.c +++ b/vfio/core.c @@ -379,6 +379,51

Re: [virtio-dev] [PATCH v2 3/5] iommu/virtio: Add probe request

2018-06-26 Thread Jean-Philippe Brucker
On 21/06/18 20:06, Jean-Philippe Brucker wrote: > +static int viommu_add_resv_mem(struct viommu_endpoint *vdev, > +struct virtio_iommu_probe_resv_mem *mem, > +size_t len) > +{ > + struct iommu_resv_region *region = NULL; &

Re: [PATCH v2 1/5] dt-bindings: virtio: Specify #iommu-cells value for a virtio-iommu

2018-06-26 Thread Jean-Philippe Brucker
On 25/06/18 20:27, Rob Herring wrote: > On Thu, Jun 21, 2018 at 08:06:51PM +0100, Jean-Philippe Brucker wrote: >> A virtio-mmio node may represent a virtio-iommu device. This is discovered >> by the virtio driver at probe time, but the DMA topology isn't >> discoverable

Re: [PATCH v2 0/5] Add virtio-iommu driver

2018-06-27 Thread Jean-Philippe Brucker
On 26/06/18 19:07, Michael S. Tsirkin wrote: > So as I pointed out new virtio 0 device isn't really welcome ;) Agreed, virtio-iommu is expected to be implemented on virtio 1 and later. I'll remove the two legacy-related paragraph from the spec and add a check in the driver as you suggested, to

Re: [PATCH v2 2/5] iommu: Add virtio-iommu driver

2018-06-25 Thread Jean-Philippe Brucker
On 22/06/18 01:51, Michael S. Tsirkin wrote: >> +VIRTIO IOMMU DRIVER >> +M: Jean-Philippe Brucker >> +S: Maintained >> +F: drivers/iommu/virtio-iommu.c >> +F: include/uapi/linux/virtio_iommu.h >> + >> VIRTUAL BOX GUEST DEVICE DRIVER >> M: H

Re: [PATCH v2 3/5] iommu/virtio: Add probe request

2018-06-25 Thread Jean-Philippe Brucker
On 22/06/18 01:55, Michael S. Tsirkin wrote: >> +#define VIRTIO_IOMMU_RESV_MEM_T_RESERVED0 >> +#define VIRTIO_IOMMU_RESV_MEM_T_MSI 1 >> + >> +struct virtio_iommu_probe_resv_mem { >> +__u8subtype; >> +__u8

Re: [PATCH v1 01/16] virtio: Validate queue pfn for 32bit transports

2018-01-10 Thread Jean-Philippe Brucker
Hi Peter, On 10/01/18 11:19, Peter Maydell wrote: > On 10 January 2018 at 11:06, Michael S. Tsirkin wrote: >> For virtio-mmio? I don't seem to see that code in >> hw/virtio/virtio-mmio.c >> For example I still see handling for VIRTIO_MMIO_QUEUE_PFN >> there, and no handling for

Re: [RFC PATCH v2 2/5] iommu/virtio-iommu: Add probe request

2018-01-16 Thread Jean-Philippe Brucker
On 16/01/18 09:25, Auger Eric wrote: [...] >> +static int viommu_add_resv_mem(struct viommu_endpoint *vdev, >> + struct virtio_iommu_probe_resv_mem *mem, >> + size_t len) >> +{ >> +struct iommu_resv_region *region = NULL; >> +unsigned

Re: [RFC PATCH v2 3/5] iommu/virtio-iommu: Add event queue

2018-01-16 Thread Jean-Philippe Brucker
On 16/01/18 10:10, Auger Eric wrote: > Hi, > > On 17/11/17 19:52, Jean-Philippe Brucker wrote: >> The event queue offers a way for the device to report access faults from >> devices. > end points? Yes [...] >> +static void viommu_event_handler(struct virtqu

Re: [RFC PATCH v2 2/5] iommu/virtio-iommu: Add probe request

2018-01-19 Thread Jean-Philippe Brucker
On 16/01/18 23:26, Auger Eric wrote: [...] >> +switch (mem->subtype) { >> +case VIRTIO_IOMMU_RESV_MEM_T_MSI: >> +region = iommu_alloc_resv_region(addr, size, prot, >> + IOMMU_RESV_MSI); > if (!region) > return -ENOMEM; >> +

Re: [PATCH v1 01/16] virtio: Validate queue pfn for 32bit transports

2018-01-12 Thread Jean-Philippe Brucker
On 12/01/18 10:21, Peter Maydell wrote: > On 10 January 2018 at 11:25, Jean-Philippe Brucker > <jean-philippe.bruc...@arm.com> wrote: >> Hi Peter, >> >> On 10/01/18 11:19, Peter Maydell wrote: >>> Are there uses that make it worthwhile to get virtio-1 >&g

[PATCH 4/4] vfio: Allow type-1 IOMMU instantiation with a virtio-iommu

2018-02-14 Thread Jean-Philippe Brucker
When enabling both VFIO and VIRTIO_IOMMU modules, automatically select VFIO_IOMMU_TYPE1 as well. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- drivers/vfio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/Kconfig b/driver

[PATCH 1/4] iommu: Add virtio-iommu driver

2018-02-14 Thread Jean-Philippe Brucker
into corresponding virtio requests. Mappings are kept in an interval tree instead of page tables. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- MAINTAINERS | 6 + drivers/iommu/Kconfig | 11 + drivers/iommu/Makefile| 1 + d

[PATCH 0/4] Add virtio-iommu driver

2018-02-14 Thread Jean-Philippe Brucker
PATCH v2 0/5] Add virtio-iommu driver https://www.spinics.net/lists/kvm/msg159047.html [3] [RFC v6 00/22] VIRTIO-IOMMU device http://lists.gnu.org/archive/html/qemu-arm/2018-02/msg00274.html [4] git://linux-arm.org/kvmtool-jpb.git virtio-iommu/v0.6 Jean-Philippe Brucker (4): iommu: Add

[PATCH 2/4] iommu/virtio: Add probe request

2018-02-14 Thread Jean-Philippe Brucker
in the virtio-iommu, because MSIs bypass it. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> --- drivers/iommu/virtio-iommu.c | 163 -- include/uapi/linux/virtio_iommu.h | 37 + 2 files changed, 193 insertions(+), 7 deletions(-)

[PATCH 3/4] iommu/virtio: Add event queue

2018-02-14 Thread Jean-Philippe Brucker
The event queue offers a way for the device to report access faults from endpoints. It is implemented on virtqueue #1. Whenever the host needs to signal a fault, it fills one of the buffers offered by the guest and interrupts it. Signed-off-by: Jean-Philippe Brucker <jean-philippe.bruc...@arm.

Re: [PATCH 1/4] iommu: Add virtio-iommu driver

2018-02-22 Thread Jean-Philippe Brucker
On 21/02/18 20:12, kbuild test robot wrote: [...] > config: arm64-allmodconfig (attached as .config) [...] >aarch64-linux-gnu-ld: arch/arm64/kernel/head.o: relocation R_AARCH64_ABS32 > against `_kernel_offset_le_lo32' can not be used when making a shared object >arch/arm64/kernel/head.o:

Re: [PATCH 1/4] iommu: Add virtio-iommu driver

2018-02-20 Thread Jean-Philippe Brucker
On 19/02/18 12:23, Tomasz Nowicki wrote: [...] >> +static int viommu_receive_resp(struct viommu_dev *viommu, int nr_sent, >> + struct list_head *sent) >> +{ >> + >> +unsigned int len; >> +int nr_received = 0; >> +struct viommu_request *req, *pending; >> + >> +

[PATCH v2 2/5] iommu: Add virtio-iommu driver

2018-06-21 Thread Jean-Philippe Brucker
into corresponding virtio requests. Mappings are kept in an interval tree instead of page tables. Signed-off-by: Jean-Philippe Brucker --- MAINTAINERS | 6 + drivers/iommu/Kconfig | 11 + drivers/iommu/Makefile| 1 + drivers/iommu/virtio-iommu.c | 929

[PATCH v2 1/5] dt-bindings: virtio: Specify #iommu-cells value for a virtio-iommu

2018-06-21 Thread Jean-Philippe Brucker
-iommu.txt. Like many other IOMMUs, virtio-iommu distinguishes masters by their endpoint IDs, which requires one IOMMU cell in the "iommus" property. Signed-off-by: Jean-Philippe Brucker --- Documentation/devicetree/bindings/virtio/mmio.txt | 8 1 file changed, 8 insertions(+)

[PATCH v2 0/5] Add virtio-iommu driver

2018-06-21 Thread Jean-Philippe Brucker
complication and suggest we tackle one problem at a time. Since it is a luxury that requires changes to the IOMMU core, module support is left as a future improvement. --- Jean-Philippe Brucker (5): dt-bindings: virtio: Specify #iommu-cells value for a virtio-iommu

[PATCH v2 5/5] vfio: Allow type-1 IOMMU instantiation for ARM

2018-06-21 Thread Jean-Philippe Brucker
ARM platforms may implement several kinds of IOMMUs (various SMMU or SMMUv3 implementations, virtio-iommu). They are all type-1, so automatically select VFIO_IOMMU_TYPE1 on ARM if IOMMU is selected. Signed-off-by: Jean-Philippe Brucker --- drivers/vfio/Kconfig | 2 +- 1 file changed, 1

[PATCH v2 4/5] iommu/virtio: Add event queue

2018-06-21 Thread Jean-Philippe Brucker
The event queue offers a way for the device to report access faults from endpoints. It is implemented on virtqueue #1. Whenever the host needs to signal a fault, it fills one of the buffers offered by the guest and interrupts it. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio

[PATCH v2 3/5] iommu/virtio: Add probe request

2018-06-21 Thread Jean-Philippe Brucker
in the virtio-iommu, because MSIs bypass it. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 149 -- include/uapi/linux/virtio_iommu.h | 37 2 files changed, 180 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b

Re: [RFC 02/13] iommu: Introduce tlb_invalidate API

2018-08-31 Thread Jean-Philippe Brucker
On 23/08/18 13:17, Eric Auger wrote: > +/** > + * Translation cache invalidation information, contains generic IOMMU > + * data which can be parsed based on model ID by model specific drivers. > + * Since the invalidation of second level page tables are included in the > + * unmap operation, this

Re: [RFC 09/13] iommu/smmuv3: Get prepared for nested stage support

2018-08-31 Thread Jean-Philippe Brucker
On 23/08/18 13:17, Eric Auger wrote: > if (ste->s1_cfg) { > - BUG_ON(ste_live); Scary! :) The current code assumes that it can make modifications to the STE in any order and enable translation after a sync. So far I haven't been able to find anything that violates this rule in

Re: [RFC 01/13] iommu: Introduce bind_guest_stage API

2018-08-31 Thread Jean-Philippe Brucker
Hi Eric, On 23/08/18 16:25, Auger Eric wrote: >> +int iommu_bind_guest_stage(struct iommu_domain *domain, struct device *dev, >> + struct iommu_guest_stage_config *cfg) About the name change from iommu_bind_pasid_table: is the intent to reuse this API for SMMUv2, which

Re: [PATCH v2 0/5] Add virtio-iommu driver

2018-07-04 Thread Jean-Philippe Brucker
On 27/06/18 20:59, Michael S. Tsirkin wrote: >> Another reason to keep the MMIO transport option is that one >> virtio-iommu can manage DMA from endpoints on multiple PCI domains at >> the same time, as well as platform devices. Some VMMs might want that, >> in which case the IOMMU would be a

Re: [kvmtool PATCH 20/17] kvmtool: arm64: Switch memory layout

2018-04-03 Thread Jean-Philippe Brucker
Hi Suzuki, On 27/03/18 14:15, Suzuki K Poulose wrote: > If the guest wants to use a larger physical address space place > the RAM at upper half of the address space. Otherwise, it uses the > default layout. > > Signed-off-by: Suzuki K Poulose > --- >

Re: [PATCH 1/4] iommu: Add virtio-iommu driver

2018-04-11 Thread Jean-Philippe Brucker
On 23/03/18 14:48, Robin Murphy wrote: [..] >> + * Virtio driver for the paravirtualized IOMMU >> + * >> + * Copyright (C) 2018 ARM Limited >> + * Author: Jean-Philippe Brucker <jean-philippe.bruc...@arm.com> >> + * >> + * SPDX-License-Identifier:

Re: [PATCH 2/4] iommu/virtio: Add probe request

2018-04-11 Thread Jean-Philippe Brucker
On 23/03/18 15:00, Robin Murphy wrote: [...] >> +/* >> + * Treat unknown subtype as RESERVED, but urge users to update their >> + * driver. >> + */ >> +if (mem->subtype != VIRTIO_IOMMU_RESV_MEM_T_RESERVED && >> +mem->subtype != VIRTIO_IOMMU_RESV_MEM_T_MSI) >> +

Re: [PATCH 1/4] iommu: Add virtio-iommu driver

2018-04-11 Thread Jean-Philippe Brucker
On 23/03/18 08:27, Tian, Kevin wrote: >>> The host kernel needs to have *some* MSI region in place before the >>> guest can start configuring interrupts, otherwise it won't know what >>> address to give to the underlying hardware. However, as soon as the host >>> kernel has picked a region, host

Re: [PATCH 1/4] iommu: Add virtio-iommu driver

2018-03-21 Thread Jean-Philippe Brucker
On 21/03/18 06:43, Tian, Kevin wrote: [...] >> + >> +#include >> + >> +#define MSI_IOVA_BASE 0x800 >> +#define MSI_IOVA_LENGTH 0x10 > > this is ARM specific, and according to virtio-iommu spec isn't it > better probed on the endpoint instead of

[PATCH v3 0/7] Add virtio-iommu driver

2018-10-12 Thread Jean-Philippe Brucker
u/v0.8 git://linux-arm.org/kvmtool-jpb.git virtio-iommu/v0.8 Jean-Philippe Brucker (7): dt-bindings: virtio-mmio: Add IOMMU description dt-bindings: virtio: Add virtio-pci-iommu node PCI: OF: allow endpoints to bypass the iommu PCI: OF: Initialize dev->fwnode appropriately iommu: Add v

[PATCH v3 4/7] PCI: OF: Initialize dev->fwnode appropriately

2018-10-12 Thread Jean-Philippe Brucker
For PCI devices that have an OF node, set the fwnode as well. This way drivers that rely on fwnode don't need the special case described by commit f94277af03ea ("of/platform: Initialise dev->fwnode appropriately"). Signed-off-by: Jean-Philippe Brucker --- drivers/pci/of.c | 7 ++

[PATCH v3 2/7] dt-bindings: virtio: Add virtio-pci-iommu node

2018-10-12 Thread Jean-Philippe Brucker
Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bindings/virtio/iommu.txt | 66 +++ 1 file changed, 66 insertions(+) create mode 100644 Documentation/devicetree/bindings/virtio/iommu.txt diff --git a/Documentation/devicetree/bindings/virtio/iommu.txt b/Documentation

Re: [PATCH v3 5/7] iommu: Add virtio-iommu driver

2018-10-12 Thread Jean-Philippe Brucker
On 12/10/2018 17:35, Michael S. Tsirkin wrote: >> +list_del(>list); >> +kfree(req); > > So with DEBUG set, this will actually free memory that device still > DMA's into. Hardly pretty. I think you want to mark device broken, > queue the request and then wait for device to

[PATCH v3 5/7] iommu: Add virtio-iommu driver

2018-10-12 Thread Jean-Philippe Brucker
into corresponding virtio requests. Mappings are kept in an interval tree instead of page tables. Signed-off-by: Jean-Philippe Brucker --- MAINTAINERS | 7 + drivers/iommu/Kconfig | 11 + drivers/iommu/Makefile| 1 + drivers/iommu/virtio-iommu.c | 938

[PATCH v3 7/7] iommu/virtio: Add event queue

2018-10-12 Thread Jean-Philippe Brucker
The event queue offers a way for the device to report access faults from endpoints. It is implemented on virtqueue #1. Whenever the host needs to signal a fault, it fills one of the buffers offered by the guest and interrupts it. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio

[PATCH v3 6/7] iommu/virtio: Add probe request

2018-10-12 Thread Jean-Philippe Brucker
in the virtio-iommu, because MSIs bypass it. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 147 -- include/uapi/linux/virtio_iommu.h | 39 2 files changed, 180 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b

[PATCH v3 3/7] PCI: OF: Allow endpoints to bypass the iommu

2018-10-12 Thread Jean-Philippe Brucker
will error out later, when attempting to find an MSI domain for the device. Signed-off-by: Jean-Philippe Brucker --- drivers/pci/of.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 1836b8ddf292..2f5015bdb256 100644 --- a/drivers/pci

Re: [PATCH v3 0/7] Add virtio-iommu driver

2018-10-12 Thread Jean-Philippe Brucker
On 12/10/2018 18:00, Michael S. Tsirkin wrote: > This all looks good to me. Minor nits: > - I think DEBUG mode is best just removed for now > - Slightly wrong patch splitup causing a misaligned structure > in uapi until all patches are applied. Thanks a lot for the review, I'll fix these up and

Re: [PATCH v3 3/7] PCI: OF: Allow endpoints to bypass the iommu

2018-10-16 Thread Jean-philippe Brucker
[Replying with my personal address because we're having SMTP issues] On 15/10/2018 11:52, Michael S. Tsirkin wrote: > On Fri, Oct 12, 2018 at 02:41:59PM -0500, Bjorn Helgaas wrote: >> s/iommu/IOMMU/ in subject >> >> On Fri, Oct 12, 2018 at 03:59:13PM +0100, Jean-Philippe Bru

Re: [PATCH v3 3/7] PCI: OF: Allow endpoints to bypass the iommu

2018-10-16 Thread Jean-philippe Brucker
[Replying with my personal address because we're having SMTP issues] On 12/10/2018 20:41, Bjorn Helgaas wrote: > s/iommu/IOMMU/ in subject > > On Fri, Oct 12, 2018 at 03:59:13PM +0100, Jean-Philippe Brucker wrote: >> Using the iommu-map binding, endpoints in a given PCI domain ca

Re: [PATCH v3 0/7] Add virtio-iommu driver

2018-10-16 Thread Jean-Philippe Brucker
On 16/10/2018 10:25, Auger Eric wrote: > Hi Jean, > > On 10/12/18 4:59 PM, Jean-Philippe Brucker wrote: >> Implement the virtio-iommu driver, following specification v0.8 [1]. >> Changes since v2 [2]: >> >> * Patches 2-4 allow virtio-iommu to use the PCI tran

Re: [PATCH v3 3/7] PCI: OF: Allow endpoints to bypass the iommu

2018-10-22 Thread Jean-Philippe Brucker
On 17/10/2018 16:14, Michael S. Tsirkin wrote: >>> Thinking about this comment, I would like to ask: can't the >>> virtio device indicate the ranges in a portable way? >>> This would minimize the dependency on dt bindings and ACPI, >>> enabling support for systems that have neither but do >>> have

Re: [PATCH v3 0/7] Add virtio-iommu driver

2018-10-17 Thread Jean-Philippe Brucker
On 16/10/2018 21:31, Auger Eric wrote: > Hi Jean, > > On 10/16/18 8:44 PM, Jean-Philippe Brucker wrote: >> On 16/10/2018 10:25, Auger Eric wrote: >>> Hi Jean, >>> >>> On 10/12/18 4:59 PM, Jean-Philippe Brucker wrote: >>>> Implement th

Re: [PATCH v3 6/7] iommu/virtio: Add probe request

2018-11-15 Thread Jean-Philippe Brucker
Fixed all of these, thanks Jean On 15/11/2018 13:20, Auger Eric wrote: > Hi Jean, > On 10/12/18 4:59 PM, Jean-Philippe Brucker wrote: >> When the device offers the probe feature, send a probe request for each >> device managed by the IOMMU. Extract RESV_MEM information. Wh

[PATCH v4 6/7] iommu/virtio: Add probe request

2018-11-15 Thread Jean-Philippe Brucker
in the virtio-iommu, because MSIs bypass it. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 156 -- include/uapi/linux/virtio_iommu.h | 38 2 files changed, 188 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b

[PATCH v4 3/7] of: Allow the iommu-map property to omit untranslated devices

2018-11-15 Thread Jean-Philippe Brucker
-Philippe Brucker --- drivers/of/base.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 09692c9b32a7..99f6bfa9b898 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2237,8 +2237,12 @@ int of_map_rid(struct

[PATCH v4 4/7] PCI: OF: Initialize dev->fwnode appropriately

2018-11-15 Thread Jean-Philippe Brucker
For PCI devices that have an OF node, set the fwnode as well. This way drivers that rely on fwnode don't need the special case described by commit f94277af03ea ("of/platform: Initialise dev->fwnode appropriately"). Acked-by: Bjorn Helgaas Signed-off-by: Jean-Philippe Brucker ---

[PATCH v4 7/7] iommu/virtio: Add event queue

2018-11-15 Thread Jean-Philippe Brucker
The event queue offers a way for the device to report access faults from endpoints. It is implemented on virtqueue #1. Whenever the host needs to signal a fault, it fills one of the buffers offered by the guest and interrupts it. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio

[PATCH v4 5/7] iommu: Add virtio-iommu driver

2018-11-15 Thread Jean-Philippe Brucker
into corresponding virtio requests. Mappings are kept in an interval tree instead of page tables. Signed-off-by: Jean-Philippe Brucker --- MAINTAINERS | 7 + drivers/iommu/Kconfig | 11 + drivers/iommu/Makefile| 1 + drivers/iommu/virtio-iommu.c | 918

[PATCH v4 2/7] dt-bindings: virtio: Add virtio-pci-iommu node

2018-11-15 Thread Jean-Philippe Brucker
ewed-by: Rob Herring Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bindings/virtio/iommu.txt | 66 +++ 1 file changed, 66 insertions(+) create mode 100644 Documentation/devicetree/bindings/virtio/iommu.txt diff --git a/Documentation/device

[PATCH v4 0/7] Add virtio-iommu driver

2018-11-15 Thread Jean-Philippe Brucker
] [RFC v8 00/18] VIRTIO-IOMMU device https://www.mail-archive.com/qemu-devel@nongnu.org/msg572637.html Jean-Philippe Brucker (7): dt-bindings: virtio-mmio: Add IOMMU description dt-bindings: virtio: Add virtio-pci-iommu node of: Allow the iommu-map property to omit untranslated devices PCI

[PATCH v4 1/7] dt-bindings: virtio-mmio: Add IOMMU description

2018-11-15 Thread Jean-Philippe Brucker
Otherwise, the virtio-mmio device may perform DMA through an IOMMU, which requires an "iommus" property. Describe these requirements in the device-tree bindings documentation. Reviewed-by: Rob Herring Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bind

Re: [PATCH v3 6/7] iommu/virtio: Add probe request

2018-11-08 Thread Jean-Philippe Brucker
On 08/11/2018 14:48, Auger Eric wrote: >> +struct virtio_iommu_probe_property { >> +__le16 type; >> +__le16 length; > the value[] field has disappeared but still is documented in the v0.8 spec. Good catch. I removed value[]

Re: [PATCH v3 5/7] iommu: Add virtio-iommu driver

2018-11-08 Thread Jean-Philippe Brucker
On 08/11/2018 14:51, Auger Eric wrote: >>> +/* >>> + * viommu_replay_mappings - re-send MAP requests >>> + * >>> + * When reattaching a domain that was previously detached from all >>> endpoints, >>> + * mappings were deleted from the device. Re-create the mappings available >>> in >>> + * the

Re: [RFC 02/13] iommu: Introduce tlb_invalidate API

2018-09-03 Thread Jean-Philippe Brucker
On 31/08/2018 15:07, Auger Eric wrote: >> Since the ioctl will be used to combine invalidations (invalidate both >> ATC and TLB with a single call), we need an additional ASID field for >> the SMMU - ATC is invalidated by PASID, TLB by ASID. I used to call it >> "tag", but I'm leaning towards

Re: [RFC 09/13] iommu/smmuv3: Get prepared for nested stage support

2018-09-03 Thread Jean-Philippe Brucker
On 31/08/2018 15:11, Auger Eric wrote: > Yep this works with my setup but I was waiting for such kind of comments > to turn this prototype into something more "production level" ;-) Did > you send anything upstream, related to this branch? No I didn't have time to clean it up yet, and don't know

Re: [RFC 02/13] iommu: Introduce tlb_invalidate API

2018-09-03 Thread Jean-Philippe Brucker
On 03/09/2018 13:41, Auger Eric wrote: > Also what about CMD_CFI_CD(_ALL) propagation. Is it an > IOMMU_INV_TYPE_PASID invalidation? Yes, INV_TYPE_PASID corresponds to the config invalidation. CMD_CFGI_CD is granule INV_GRANU_PASID_SEL and CMD_CFGI_CD_ALL is granule INV_GRANU_ALL_PASID Thanks,

Re: [RFC 01/13] iommu: Introduce bind_guest_stage API

2018-09-03 Thread Jean-Philippe Brucker
On 31/08/2018 14:52, Auger Eric wrote: > Do we agree here we can get rid of the struct device * parameter? That's fine by me, in my opinion the bind operation should only be on the domain, like map/unmap. For the invalidation however, I think we need to keep the device as an optional parameter,

Re: [RFC 01/13] iommu: Introduce bind_guest_stage API

2018-09-04 Thread Jean-Philippe Brucker
On 04/09/2018 09:41, Auger Eric wrote: > I think the confusion comes from the different terminology used in VTD > and ARM SMMU spec. > > Your PASID table ~ ARM SMMU Context Descriptor (CD) table > Your Root Entry/Context Entry ~ ARM SMMU Stream Table Entry (STE) In past discussions we used

Re: [PATCH v4 5/7] iommu: Add virtio-iommu driver

2018-11-16 Thread Jean-Philippe Brucker
Hi Eric, On 16/11/2018 06:08, Auger Eric wrote: >> +struct viommu_domain { >> +struct iommu_domain domain; >> +struct viommu_dev *viommu; >> +struct mutexmutex; > same naming/comment as in smmu driver may help here > struct mutex

  1   2   3   >