Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-08 Thread Jean-Philippe Brucker
On Wed, Dec 08, 2021 at 08:56:16AM -0400, Jason Gunthorpe wrote: > From a progress perspective I would like to start with simple 'page > tables in userspace', ie no PASID in this step. > > 'page tables in userspace' means an iommufd ioctl to create an > iommu_domain where the IOMMU HW is directly

Re: [RFC PATCH 4/5] iommu/arm-smmu-v3: Use pinned VMID for NESTED stage with BTM

2021-07-22 Thread Jean-Philippe Brucker
Hi Shameer, On Wed, Jul 21, 2021 at 08:54:00AM +, Shameerali Kolothum Thodi wrote: > > More generally I think this pinned VMID set conflicts with that of > > stage-2-only domains (which is the default state until a guest attaches a > > PASID table). Say you have one guest using DOMAIN_NESTED w

Re: [RFC PATCH 0/5] KVM: arm64: Pass PSCI to userspace

2021-07-21 Thread Jean-Philippe Brucker
On Tue, Jun 08, 2021 at 05:48:01PM +0200, Jean-Philippe Brucker wrote: > Allow userspace to request handling PSCI calls from guests. Our goal is > to enable a vCPU hot-add solution for Arm where the VMM presents > possible resources to the guest at boot, and controls which vCPUs can be

Re: [RFC PATCH 0/5] KVM: arm64: Pass PSCI to userspace

2021-07-21 Thread Jean-Philippe Brucker
On Mon, Jul 19, 2021 at 12:37:52PM -0700, Oliver Upton wrote: > On Mon, Jul 19, 2021 at 11:02 AM Jean-Philippe Brucker > wrote: > > We forward the whole PSCI function range, so it's either KVM or userspace. > > If KVM manages PSCI and the guest calls an unimplemented fun

Re: [RFC PATCH 0/5] KVM: arm64: Pass PSCI to userspace

2021-07-19 Thread Jean-Philippe Brucker
PEND. I'll take a closer look at the patches after I get > a > better understanding about what is going on. > > On 6/8/21 4:48 PM, Jean-Philippe Brucker wrote: > > Allow userspace to request handling PSCI calls from guests. Our goal is > > to enable a vCPU hot-add solutio

[RFC PATCH 4/5] KVM: arm64: Pass hypercalls to userspace

2021-06-08 Thread Jean-Philippe Brucker
Let userspace request to handle all hypercalls that aren't handled by KVM, by setting the KVM_CAP_ARM_HVC_TO_USER capability. With the help of another capability, this will allow userspace to handle PSCI calls. Suggested-by: James Morse Signed-off-by: Jean-Philippe Brucker --- Notes on

[RFC PATCH 5/5] KVM: arm64: Pass PSCI calls to userspace

2021-06-08 Thread Jean-Philippe Brucker
ters. The KVM_REG_ARM_PSCI_VERSION pseudo-register currently resets to either v0.1 if userspace doesn't set KVM_ARM_VCPU_PSCI_0_2, or KVM_ARM_PSCI_LATEST (1.0). Suggested-by: James Morse Signed-off-by: Jean-Philippe Brucker --- Documentation/virt/kvm/api.rst | 14 ++ Documen

[RFC PATCH 1/5] KVM: arm64: Replace power_off with mp_state in struct kvm_vcpu_arch

2021-06-08 Thread Jean-Philippe Brucker
In order to add a new "suspend" power state, replace power_off with mp_state in struct kvm_vcpu_arch. Factor the vcpu_off() function while we're here. No functional change intended. Signed-off-by: Jean-Philippe Brucker --- arch/arm64/include/asm/kvm_host.h | 6 -- arch/

[RFC PATCH 3/5] KVM: arm64: Allow userspace to request WFI

2021-06-08 Thread Jean-Philippe Brucker
it is consumed before returning to userspace. Signed-off-by: Jean-Philippe Brucker --- Documentation/virt/kvm/api.rst | 15 +-- include/uapi/linux/kvm.h | 1 + arch/arm64/kvm/arm.c | 11 ++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Documen

[RFC PATCH 0/5] KVM: arm64: Pass PSCI to userspace

2021-06-08 Thread Jean-Philippe Brucker
6202-2-git-send-email-guoh...@huawei.com/ [6] https://jpbrucker.net/git/linux/log/?h=cpuhp/devel https://jpbrucker.net/git/qemu/log/?h=cpuhp/devel Jean-Philippe Brucker (5): KVM: arm64: Replace power_off with mp_state in struct kvm_vcpu_arch KVM: arm64: Move WFI execution to check_vcpu_r

[RFC PATCH 2/5] KVM: arm64: Move WFI execution to check_vcpu_requests()

2021-06-08 Thread Jean-Philippe Brucker
place of HALTED, to prevent future breakage. Signed-off-by: Jean-Philippe Brucker --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/kvm/arm.c | 18 ++- arch/arm64/kvm/handle_exit.c | 3 +-- arch/arm64/kvm/psci.c | 37 +

Re: [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd approach)

2021-06-07 Thread Jean-Philippe Brucker
On Fri, Jun 04, 2021 at 04:27:39PM +0100, Marc Zyngier wrote: > > > Plus, I've found this nugget: > > > > > > > > max_pinned_vmids = NUM_USER_VMIDS - num_possible_cpus() - 2; > > > > > > > > > What is this "- 2"? My hunch is that it should really be "- 1" as VMID > > > 0 is reserved, and we h

Re: [PATCH] KVM: arm64: Skip CMOs when updating a PTE pointing to non-memory

2021-04-27 Thread Jean-Philippe Brucker
On Tue, Apr 27, 2021 at 03:52:46PM +0100, Alexandru Elisei wrote: > The comment [1] suggested that the panic is triggered during page aging. I think only with an out-of-tree patch applied https://jpbrucker.net/git/linux/commit/?h=sva/2021-03-01&id=d32d8baaf293aaefef8a1c9b8a4508ab2ec46c61 which pro

Re: [PATCH v14 00/13] SMMUv3 Nested Stage Setup (IOMMU part)

2021-04-23 Thread Jean-Philippe Brucker
Hi Sumit, On Thu, Apr 22, 2021 at 08:34:38PM +0530, Sumit Gupta wrote: > Had to revert patch "mm: notify remote TLBs when dirtying a PTE". Did that patch cause any issue, or is it just not needed on your system? It fixes an hypothetical problem with the way ATS is implemented. Maybe I actually ob

Re: [PATCH v12 03/13] vfio: VFIO_IOMMU_SET_MSI_BINDING

2021-03-05 Thread Jean-Philippe Brucker
Hi, On Tue, Feb 23, 2021 at 10:06:15PM +0100, Eric Auger wrote: > This patch adds the VFIO_IOMMU_SET_MSI_BINDING ioctl which aim > to (un)register the guest MSI binding to the host. This latter > then can use those stage 1 bindings to build a nested stage > binding targeting the physical MSIs. No

Re: [RFC PATCH 4/5] iommu/arm-smmu-v3: Use pinned VMID for NESTED stage with BTM

2021-03-04 Thread Jean-Philippe Brucker
Hi Shameer, On Mon, Feb 22, 2021 at 03:53:37PM +, Shameer Kolothum wrote: > If the SMMU supports BTM and the device belongs to NESTED domain > with shared pasid table, we need to use the VMID allocated by the > KVM for the s2 configuration. Hence, request a pinned VMID from KVM. > > Signed-of

Re: [RFC PATCH 01/11] iommu/arm-smmu-v3: Add feature detection for HTTU

2021-02-05 Thread Jean-Philippe Brucker
Hi Keqian, On Fri, Feb 05, 2021 at 05:13:50PM +0800, Keqian Zhu wrote: > > We need to accommodate the firmware override as well if we need this to be > > meaningful. Jean-Philippe is already carrying a suitable patch in the SVA > > stack[1]. > Robin, Thanks for pointing it out. > > Jean, I see

Re: [PATCH v13 03/15] iommu/arm-smmu-v3: Maintain a SID->device structure

2021-02-01 Thread Jean-Philippe Brucker
On Mon, Feb 01, 2021 at 08:26:41PM +0800, Keqian Zhu wrote: > > +static int arm_smmu_insert_master(struct arm_smmu_device *smmu, > > + struct arm_smmu_master *master) > > +{ > > + int i; > > + int ret = 0; > > + struct arm_smmu_stream *new_stream, *cur_stream; > >

Re: [PATCH v13 07/15] iommu/smmuv3: Allow stage 1 invalidation with unmanaged ASIDs

2021-01-14 Thread Jean-Philippe Brucker
Hi Eric, On Thu, Jan 14, 2021 at 05:58:27PM +0100, Auger Eric wrote: > >> The uacce-devel branches from > >>> https://github.com/Linaro/linux-kernel-uadk do provide this at the moment > >>> (they track the latest sva/zip-devel branch > >>> https://jpbrucker.net/git/linux/ which is roughly based o

Re: [PATCH v13 07/15] iommu/smmuv3: Allow stage 1 invalidation with unmanaged ASIDs

2020-12-04 Thread Jean-Philippe Brucker
Hi Shameer, On Thu, Dec 03, 2020 at 06:42:57PM +, Shameerali Kolothum Thodi wrote: > Hi Jean/zhangfei, > Is it possible to have a branch with minimum required SVA/UACCE related > patches > that are already public and can be a "stable" candidate for future respin of > Eric's series? > Please

Re: [RFC] Use SMMU HTTU for DMA dirty page tracking

2020-05-27 Thread Jean-Philippe Brucker
y 25, 2020 7:34 PM > > >> > > >> [+cc Kirti, Yan, Alex] > > >> > > >> On 2020/5/23 1:14, Jean-Philippe Brucker wrote: > > >>> Hi, > > >>> > > >>> On Tue, May 19, 2020 at 05:42:55PM +0800, Xiang Zheng wrote: > > >

Re: [RFC] Use SMMU HTTU for DMA dirty page tracking

2020-05-22 Thread Jean-Philippe Brucker
Hi, On Tue, May 19, 2020 at 05:42:55PM +0800, Xiang Zheng wrote: > Hi all, > > Is there any plan for enabling SMMU HTTU? Not outside of SVA, as far as I know. > I have seen the patch locates in the SVA series patch, which adds > support for HTTU: > https://www.spinics.net/lists/arm-kernel/m

Re: [PATCH RFC 11/14] arm64: Move the ASID allocator code in a separate file

2019-09-20 Thread Jean-Philippe Brucker
On Fri, Sep 20, 2019 at 08:07:38AM +0800, Guo Ren wrote: > On Thu, Sep 19, 2019 at 11:18 PM Jean-Philippe Brucker > wrote: > > > > > The SMMU does support PCI Virtual Function - an hypervisor can assign a > > VF to a guest, and let that guest partition the VF into sm

Re: [PATCH RFC 11/14] arm64: Move the ASID allocator code in a separate file

2019-09-19 Thread Jean-Philippe Brucker
On Thu, Sep 19, 2019 at 09:07:15PM +0800, Guo Ren wrote: > > The solution I had to this problem is pinning the ASID [1] used by the > > IOMMU, to prevent the CPU from recycling the ASID on rollover. This way > > the CPU doesn't have to wait for IOMMU invalidations to complete, when > > scheduling a

Re: [PATCH RFC 11/14] arm64: Move the ASID allocator code in a separate file

2019-09-16 Thread Jean-Philippe Brucker
Hi, On 13/09/2019 09:13, Guo Ren wrote: > Another idea is seperate remote TLB invalidate into two instructions: > >  - sfence.vma.b.asyc >  - sfence.vma.b.barrier // wait all async TLB invalidate operations > finished for all harts. It's not clear to me how this helps, but I probably don't have

[PATCH] MAINTAINERS: Update my email address

2019-07-22 Thread Jean-Philippe Brucker
Update MAINTAINERS and .mailmap with my @linaro.org address, since I don't have access to my @arm.com address anymore. Signed-off-by: Jean-Philippe Brucker --- .mailmap| 1 + MAINTAINERS | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-19 Thread Jean-Philippe Brucker
On 19/06/2019 01:19, Jacob Pan wrote: >>> I see this as a future extension due to limited testing, >> >> I'm wondering how we deal with: >> (1) old userspace that won't fill the new private_data field in >> page_response. A new kernel still has to support it. >> (2) old kernel that won't recogni

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-18 Thread Jean-Philippe Brucker
On 12/06/2019 19:53, Jacob Pan wrote: >>> You are right, the worst case of the spurious PS is to terminate the >>> group prematurely. Need to know the scope of the HW damage in case >>> of mdev where group IDs can be shared among mdevs belong to the >>> same PF. >> >> But from the IOMMU fault API

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-11 Thread Jean-Philippe Brucker
On 10/06/2019 22:31, Jacob Pan wrote: > On Mon, 10 Jun 2019 13:45:02 +0100 > Jean-Philippe Brucker wrote: > >> On 07/06/2019 18:43, Jacob Pan wrote: >>>>> So it seems we agree on the following: >>>>> - iommu_unregister_device_fault_handler() will

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-10 Thread Jean-Philippe Brucker
On 07/06/2019 18:43, Jacob Pan wrote: >>> So it seems we agree on the following: >>> - iommu_unregister_device_fault_handler() will never fail >>> - iommu driver cleans up all pending faults when handler is >>> unregistered >>> - assume device driver or guest not sending more page response >>> _aft

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-07 Thread Jean-Philippe Brucker
On 26/05/2019 17:10, Eric Auger wrote: > +int vfio_pci_iommu_dev_fault_handler(struct iommu_fault_event *evt, void > *data) > +{ > + struct vfio_pci_device *vdev = (struct vfio_pci_device *) data; > + struct vfio_region_fault_prod *prod_region = > + (struct vfio_region_fault_pr

Re: [PATCH v8 25/29] vfio-pci: Add a new VFIO_REGION_TYPE_NESTED region type

2019-06-07 Thread Jean-Philippe Brucker
On 07/06/2019 09:28, Auger Eric wrote: >>> +static const struct vfio_pci_fault_abi fault_abi_versions[] = { >>> + [0] = { >>> + .entry_size = sizeof(struct iommu_fault), >>> + }, >>> +}; >>> + >>> +#define NR_FAULT_ABIS ARRAY_SIZE(fault_abi_versions) >> >> This looks like it's leading

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-07 Thread Jean-Philippe Brucker
On 06/06/2019 21:29, Jacob Pan wrote: >> iommu_unregister_device_fault_handler(&vdev->pdev->dev); > > > But this can fail if there are pending faults which leaves a > device reference and then the system is broken :( This series only features unrecoverable errors an

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-06 Thread Jean-Philippe Brucker
On 05/06/2019 23:45, Jacob Pan wrote: > On Tue, 4 Jun 2019 18:11:08 +0200 > Auger Eric wrote: > >> Hi Alex, >> >> On 6/4/19 12:31 AM, Alex Williamson wrote: >>> On Sun, 26 May 2019 18:10:01 +0200 >>> Eric Auger wrote: >>> This patch registers a fault handler which records faults in

Re: [PATCH v8 05/29] iommu: Add a timeout parameter for PRQ response

2019-06-04 Thread Jean-Philippe Brucker
On 03/06/2019 23:32, Alex Williamson wrote: > It doesn't seem to make much sense to include this patch without also > including "iommu: handle page response timeout". Was that one lost? > Dropped? Lives elsewhere? The first 7 patches come from my sva/api branch, where I had forgotten to add the

Re: [virtio-dev] Re: [PATCH v8 2/7] dt-bindings: virtio: Add virtio-pci-iommu node

2019-05-31 Thread Jean-Philippe Brucker
On 30/05/2019 18:45, Michael S. Tsirkin wrote: > On Thu, May 30, 2019 at 06:09:24PM +0100, Jean-Philippe Brucker wrote: >> Some systems implement virtio-iommu as a PCI endpoint. The operating >> system needs to discover the relationship between IOMMU and masters long >> be

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

2019-05-30 Thread Jean-Philippe Brucker
virtio-iommu, because MSIs bypass it. Acked-by: Joerg Roedel Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 157 -- include/uapi/linux/virtio_iommu.h | 36 +++ 2 files changed, 187 insertions(+), 6 deletions

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

2019-05-30 Thread Jean-Philippe Brucker
corresponding virtio requests. Mappings are kept in an interval tree instead of page tables. A little more work is required for modular and x86 support, so for the moment the driver depends on CONFIG_VIRTIO=y and CONFIG_ARM64. Acked-by: Joerg Roedel Signed-off-by: Jean-Philippe Brucker --- MAINTAINERS

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

2019-05-30 Thread Jean-Philippe Brucker
: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 115 +++--- include/uapi/linux/virtio_iommu.h | 19 + 2 files changed, 125 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 5d4947c47420

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

2019-05-30 Thread Jean-Philippe Brucker
rwise, 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

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

2019-05-30 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 v8 3/7] of: Allow the iommu-map property to omit untranslated devices

2019-05-30 Thread Jean-Philippe Brucker
ed-by: Rob Herring Signed-off-by: Jean-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 20e0e7ee4edf..55e7f5bb0549 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2294,8 +2294

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

2019-05-30 Thread Jean-Philippe Brucker
Reviewed-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/d

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

2019-05-30 Thread Jean-Philippe Brucker
m.org/kvmtool-jpb.git virtio-iommu/v0.12 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: OF: Initialize dev->fwnode appropriately iommu: Add virt

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

2019-05-28 Thread Jean-Philippe Brucker
On 27/05/2019 16:15, Michael S. Tsirkin wrote: > On Mon, May 27, 2019 at 11:26:04AM +0200, Joerg Roedel wrote: >> On Sun, May 12, 2019 at 12:31:59PM -0400, Michael S. Tsirkin wrote: >>> OK this has been in next for a while. >>> >>> Last time IOMMU maintainers objected. Are objections >>> still in f

Re: [PATCH v7 04/23] iommu: Introduce attach/detach_pasid_table API

2019-05-15 Thread Jean-Philippe Brucker
On 15/05/2019 14:06, Auger Eric wrote: > Hi Jean-Philippe, > > On 5/15/19 2:09 PM, Jean-Philippe Brucker wrote: >> On 08/04/2019 13:18, Eric Auger wrote: >>> diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h >>> index edcc0dda7993..532a64075

Re: [PATCH v7 04/23] iommu: Introduce attach/detach_pasid_table API

2019-05-15 Thread Jean-Philippe Brucker
On 08/04/2019 13:18, Eric Auger wrote: > diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h > index edcc0dda7993..532a64075f23 100644 > --- a/include/uapi/linux/iommu.h > +++ b/include/uapi/linux/iommu.h > @@ -112,4 +112,51 @@ struct iommu_fault { > struct iommu_faul

Re: [PATCH v7 11/23] iommu/arm-smmu-v3: Maintain a SID->device structure

2019-05-08 Thread Jean-Philippe Brucker
On 08/05/2019 15:05, Robin Murphy wrote: > On 08/04/2019 13:18, Eric Auger wrote: >> From: Jean-Philippe Brucker >> >> When handling faults from the event or PRI queue, we need to find the >> struct device associated to a SID. Add a rb_tree to keep track of SIDs. >

Re: [PATCH v7 05/23] iommu: Introduce cache_invalidate API

2019-05-07 Thread Jean-Philippe Brucker
On 02/05/2019 17:46, Jacob Pan wrote: > On Thu, 2 May 2019 11:53:34 +0100 > Jean-Philippe Brucker wrote: > >> On 02/05/2019 07:58, Auger Eric wrote: >>> Hi Jean-Philippe, >>> >>> On 5/1/19 12:38 PM, Jean-Philippe Brucker wrote: >>>&g

Re: [PATCH v7 05/23] iommu: Introduce cache_invalidate API

2019-05-02 Thread Jean-Philippe Brucker
On 02/05/2019 07:58, Auger Eric wrote: > Hi Jean-Philippe, > > On 5/1/19 12:38 PM, Jean-Philippe Brucker wrote: >> On 08/04/2019 13:18, Eric Auger wrote: >>> +int iommu_cache_invalidate(struct iommu_domain *domain, struct device *dev, >>> + s

Re: [PATCH v7 05/23] iommu: Introduce cache_invalidate API

2019-05-01 Thread Jean-Philippe Brucker
) > + return -ENODEV; > + > + ret = domain->ops->cache_invalidate(domain, dev, inv_info); > + > + return ret; Nit: you don't really need ret The UAPI looks good to me, so Reviewed-by: Jean-Philippe Brucker

Re: [PATCH] vfio-pci: Fix MSI IRQ forwarding for without per-vector masking

2019-04-10 Thread Jean-Philippe Brucker
Hi Leo, On 22/03/2019 05:23, Leo Yan wrote: > If MSI doesn't support per-vector masking capability and > PCI_MSI_FLAGS_MASKBIT isn't set in message control field, the function > vfio_pci_msi_vector_write() will directly bail out for this case and > every vector's 'virt_state' keeps setting bit VFI

Re: [PATCH kvmtool v3 2/3] vfio-pci: Add new function for INTx one-time initialisation

2019-04-04 Thread Jean-Philippe Brucker
s. > > This patch move below three main operations for INTx one-time > initialisation from function vfio_pci_enable_intx() into function > vfio_pci_init_intx(): > > - Reserve 2 FDs for INTx; > - Sanity check with ioctl VFIO_DEVICE_GET_IRQ_INFO; > - Setup pdev->intx_gsi. &

Re: [PATCH kvmtool v3 3/3] vfio-pci: Re-enable INTx mode when disable MSI/MSIX

2019-04-04 Thread Jean-Philippe Brucker
abled, the pair functions can directly bail out > when detect INTx has been disabled and enabled respectively. > > Suggested-by: Jean-Philippe Brucker > Signed-off-by: Leo Yan > --- > vfio/pci.c | 41 ++--- > 1 file changed, 30 insertions(+),

Re: [PATCH kvmtool v2 3/3] vfio-pci: Re-enable INTx mode when disable MSI/MSIX

2019-03-25 Thread Jean-Philippe Brucker
On 20/03/2019 06:20, Leo Yan wrote: > Since PCI forbids enabling INTx, MSI or MSIX at the same time, it's by > default to disable INTx mode when enable MSI/MSIX mode; but this logic is > easily broken if the guest PCI driver detects the MSI/MSIX cannot work as > expected and tries to rollback to us

Re: [PATCH kvmtool v2 2/3] vfio-pci: Remove useless FDs reservation in vfio_pci_enable_intx()

2019-03-25 Thread Jean-Philippe Brucker
On 20/03/2019 06:20, Leo Yan wrote: > Since INTx only uses 2 FDs, it's not particularly useful to reserve FDs > in function vfio_pci_enable_intx(); so this patch is to remove FDs > reservation in this function. > > Signed-off-by: Leo Yan The main reason for this is that we want to call enable_in

Re: [PATCH kvmtool v2 1/3] vfio-pci: Release INTx's unmask eventfd properly

2019-03-25 Thread Jean-Philippe Brucker
ds field 'unmask_fd' in struct vfio_pci_device for > storing unmask eventfd and close it when disable INTx. > > Signed-off-by: Leo Yan Reviewed-by: Jean-Philippe Brucker > --- > include/kvm/vfio.h | 1 + > vfio/pci.c | 2 ++ > 2 files changed, 3 insertions

Re: [PATCH v6 05/22] iommu: Introduce cache_invalidate API

2019-03-21 Thread Jean-Philippe Brucker
On 21/03/2019 13:54, Auger Eric wrote: > Hi Jacob, Jean-Philippe, > > On 3/20/19 5:50 PM, Jean-Philippe Brucker wrote: >> On 20/03/2019 16:37, Jacob Pan wrote: >> [...] >>>> +struct iommu_inv_addr_info { >>>> +#define IOMMU_INV_A

Re: [PATCH v6 05/22] iommu: Introduce cache_invalidate API

2019-03-20 Thread Jean-Philippe Brucker
On 20/03/2019 16:37, Jacob Pan wrote: [...] >> +struct iommu_inv_addr_info { >> +#define IOMMU_INV_ADDR_FLAGS_PASID (1 << 0) >> +#define IOMMU_INV_ADDR_FLAGS_ARCHID (1 << 1) >> +#define IOMMU_INV_ADDR_FLAGS_LEAF (1 << 2) >> +__u32 flags; >> +__u32 archid; >> +__u64 pasid; >> +

Re: [PATCH v5 05/22] iommu: Introduce cache_invalidate API

2019-03-18 Thread Jean-Philippe Brucker
On 17/03/2019 16:43, Auger Eric wrote: >>> diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h >>> index 532a64075f23..e4c6a447e85a 100644 >>> --- a/include/uapi/linux/iommu.h >>> +++ b/include/uapi/linux/iommu.h >>> @@ -159,4 +159,75 @@ struct iommu_pasid_table_config { >>> };

Re: [PATCH kvmtool v1 2/2] vfio-pci: Fallback to INTx mode when disable MSI/MSIX

2019-03-15 Thread Jean-Philippe Brucker
On 15/03/2019 08:33, Leo Yan wrote: > Since PCI forbids enabling INTx, MSI or MSIX at the same time, it's by > default to disable INTx mode when enable MSI/MSIX mode; but this logic is > easily broken if the guest PCI driver detects the MSI/MSIX cannot work as > expected and tries to rollback to us

Re: [PATCH kvmtool v1 1/2] vfio-pci: Release INTx's guest to host eventfd properly

2019-03-15 Thread Jean-Philippe Brucker
Hi, On 15/03/2019 08:33, Leo Yan wrote: > The PCI device INTx uses event fd 'unmask_fd' to signal the deassertion > of the line from guest to host; but this eventfd isn't released properly > when disable INTx. > > When disable INTx this patch firstly unbinds interrupt signal by calling > ioctl VF

Re: [PATCH v4 03/22] iommu: introduce device fault report API

2019-03-07 Thread Jean-Philippe Brucker
On 06/03/2019 23:46, Jacob Pan wrote: > On Tue, 5 Mar 2019 15:03:41 + > Jean-Philippe Brucker wrote: > >> On 18/02/2019 13:54, Eric Auger wrote: >> [...]> +/** >> > + * iommu_register_device_fault_handler() - Register a device fault >> > handler &

Re: [PATCH v4 02/22] iommu: introduce device fault data

2019-03-06 Thread Jean-Philippe Brucker
On 06/03/2019 14:30, Auger Eric wrote: >>> +#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1) >>> +#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2) >>> + __u32 flags; >>> + __u32 pasid; >>> + __u32 grpid; >>> + __u32 perm; >>> + __u64 addr; >> >> Given that we'll be reporti

Re: [PATCH v4 02/22] iommu: introduce device fault data

2019-03-06 Thread Jean-Philippe Brucker
On 06/03/2019 09:38, Auger Eric wrote: >>> +struct iommu_fault_unrecoverable { >>> +    __u32   reason; /* enum iommu_fault_reason */ >>> +#define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0) >>> +#define IOMMU_FAULT_UNRECOV_PERM_VALID  (1 << 1) >> >> Not needed, since @perm is

Re: [PATCH v4 05/22] iommu: Introduce cache_invalidate API

2019-03-05 Thread Jean-Philippe Brucker
re, > model specific IOMMU drivers need to convert them into their own format. > > Signed-off-by: Liu, Yi L > Signed-off-by: Jean-Philippe Brucker > Signed-off-by: Jacob Pan > Signed-off-by: Ashok Raj > Signed-off-by: Eric Auger > > --- > v3 -> v4: > -

Re: [PATCH v4 04/22] iommu: Introduce attach/detach_pasid_table API

2019-03-05 Thread Jean-Philippe Brucker
iommu driver. > > This patch adds a new API to the iommu subsystem that allows > to set/unset the pasid table information. > > A generic iommu_pasid_table_config struct is introduced in > a new iommu.h uapi header. This is going to be used by the VFIO > user API. > > S

Re: [PATCH v4 03/22] iommu: introduce device fault report API

2019-03-05 Thread Jean-Philippe Brucker
On 18/02/2019 13:54, Eric Auger wrote: [...]> +/** > + * iommu_register_device_fault_handler() - Register a device fault handler > + * @dev: the device > + * @handler: the fault handler > + * @data: private data passed as argument to the handler > + * > + * When an IOMMU fault event is received, ca

Re: [PATCH v4 02/22] iommu: introduce device fault data

2019-03-05 Thread Jean-Philippe Brucker
ult or a page request, > also referred to as a recoverable fault. > > We only care about non internal faults that are likely to be reported > to an external subsystem. > > Signed-off-by: Jacob Pan > Signed-off-by: Jean-Philippe Brucker > Signed-off-by: Liu, Yi L >

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

2019-02-22 Thread Jean-Philippe Brucker
Hi Thiago, On 21/02/2019 22:18, Thiago Jung Bauermann wrote: > > Hello Jean-Philippe, > > Jean-Philippe Brucker writes: >> Makes sense, though I think other virtio devices have been developed a >> little more organically: device and driver code got upstreame

Re: [RFC v3 02/21] iommu: Introduce cache_invalidate API

2019-01-28 Thread Jean-Philippe Brucker
Hi Eric, On 25/01/2019 16:49, Auger Eric wrote: [...] >>> diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h >>> index 7a7cf7a3de7c..4605f5cfac84 100644 >>> --- a/include/uapi/linux/iommu.h >>> +++ b/include/uapi/linux/iommu.h >>> @@ -47,4 +47,99 @@ struct iommu_pasid_table_confi

Re: [RFC v3 01/21] iommu: Introduce set_pasid_table API

2019-01-25 Thread Jean-Philippe Brucker
On 25/01/2019 08:55, Auger Eric wrote: > Hi Jean-Philippe, > > On 1/25/19 9:39 AM, Auger Eric wrote: >> Hi Jean-Philippe, >> >> On 1/11/19 7:16 PM, Jean-Philippe Brucker wrote: >>> On 08/01/2019 10:26, Eric Auger wrote: >>>> From: Jacob Pan >&

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

2019-01-24 Thread Jean-Philippe Brucker
Hi Joerg, On 23/01/2019 08:34, Joerg Roedel wrote: > Hi Jean-Philippe, > > thanks for all your hard work on this! > > On Tue, Jan 15, 2019 at 12:19:52PM +, Jean-Philippe Brucker wrote: >> Implement the virtio-iommu driver, following specification v0.9 [1]. > >

Re: [PATCH kvmtool v2 00/13] Implement reset of virtio devices

2019-01-22 Thread Jean-Philippe Brucker
On 22/01/2019 07:07, Will Deacon wrote: > On Thu, Jan 10, 2019 at 02:12:37PM +, Julien Thierry wrote: >> This series was developped by Jean-Philippe and is needed for a series >> I'll be posting shortly after to load firmwares on arm kvmtool. >> >> Currently, when a guest tries to reset a devic

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

2019-01-21 Thread Jean-Philippe Brucker
Hi, On 18/01/2019 15:51, Michael S. Tsirkin wrote: > > On Tue, Jan 15, 2019 at 12:19:52PM +, Jean-Philippe Brucker wrote: >> Implement the virtio-iommu driver, following specification v0.9 [1]. >> >> This is a simple rebase onto Linux v5.0-rc2. We now use the >>

Re: [RFC v3 14/21] iommu: introduce device fault data

2019-01-16 Thread Jean-Philippe Brucker
On 15/01/2019 21:27, Auger Eric wrote: [...] /* iommu fault flags */ -#define IOMMU_FAULT_READ 0x0 -#define IOMMU_FAULT_WRITE 0x1 +#define IOMMU_FAULT_READ (1 << 0) +#define IOMMU_FAULT_WRITE (1 << 1) +#define IOMMU_FAULT_EXEC (1 << 2)

Re: [RFC v3 14/21] iommu: introduce device fault data

2019-01-16 Thread Jean-Philippe Brucker
On 14/01/2019 22:32, Jacob Pan wrote: >> [...] +/** + * struct iommu_fault - Generic fault data + * + * @type contains fault type + * @reason fault reasons if relevant outside IOMMU driver. + * IOMMU driver internal faults are not reported. + * @addr: tells the of

Re: [RFC v3 17/21] iommu/smmuv3: Report non recoverable faults

2019-01-16 Thread Jean-Philippe Brucker
On 15/01/2019 21:06, Auger Eric wrote: >>> + iommu_report_device_fault(master->dev, &event); >> >> We should return here if the fault is successfully injected > > Even if the fault gets injected in the guest can't it be still useful to > get the message below on host side? I don't think

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

2019-01-15 Thread Jean-Philippe Brucker
Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 115 +++--- include/uapi/linux/virtio_iommu.h | 19 + 2 files changed, 125 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index

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

2019-01-15 Thread Jean-Philippe Brucker
rwise, 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

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

2019-01-15 Thread Jean-Philippe Brucker
ed-by: Rob Herring Signed-off-by: Jean-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 5226e898476e..4d12b1cab55f 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2293,8 +2293

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

2019-01-15 Thread Jean-Philippe Brucker
Reviewed-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/d

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

2019-01-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 v7 5/7] iommu: Add virtio-iommu driver

2019-01-15 Thread Jean-Philippe Brucker
-off-by: Jean-Philippe Brucker --- MAINTAINERS | 7 + drivers/iommu/Kconfig | 11 + drivers/iommu/Makefile| 1 + drivers/iommu/virtio-iommu.c | 916 ++ include/uapi/linux/virtio_ids.h | 1 + include/uapi/linux

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

2019-01-15 Thread Jean-Philippe Brucker
virtio-iommu, because MSIs bypass it. Tested-by: Bharat Bhushan Tested-by: Eric Auger Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 157 -- include/uapi/linux/virtio_iommu.h | 36 +++ 2 files changed, 187

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

2019-01-15 Thread Jean-Philippe Brucker
-IOMMU device https://www.mail-archive.com/qemu-devel@nongnu.org/msg575578.html [5] [PATCH] iommu/of: Fix probe-deferral https://www.spinics.net/lists/arm-kernel/msg698371.html Jean-Philippe Brucker (7): dt-bindings: virtio-mmio: Add IOMMU description dt-bindings: virtio: Add vir

Re: [RFC v3 01/21] iommu: Introduce set_pasid_table API

2019-01-11 Thread Jean-Philippe Brucker
specializations of this struct, > for PASID table passing and ARM SMMUv3. Last sentence is a bit confusing. With SMMUv3 it is also used for the PASID table, even when it only has one entry and PASID is disabled. > Signed-off-by: Jean-Philippe Brucker > Signed-off-by: Liu, Yi L >

Re: [RFC v3 17/21] iommu/smmuv3: Report non recoverable faults

2019-01-11 Thread Jean-Philippe Brucker
On 08/01/2019 10:26, Eric Auger wrote: > When a stage 1 related fault event is read from the event queue, > let's propagate it to potential external fault listeners, ie. users > who registered a fault handler. > > Signed-off-by: Eric Auger > --- > drivers/iommu/arm-smmu-v3.c | 124 ++

Re: [RFC v3 11/21] iommu/smmuv3: Implement cache_invalidate

2019-01-11 Thread Jean-Philippe Brucker
On 08/01/2019 10:26, Eric Auger wrote: > Implement IOMMU_INV_TYPE_TLB invalidations. When > nr_pages is null we interpret this as a context > invalidation. > > Signed-off-by: Eric Auger > > --- > > The user API needs to be refined to discriminate context > invalidations from NH_VA invalidations

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

2019-01-11 Thread Jean-Philippe Brucker
Hi Eric, On 08/01/2019 10:26, Eric Auger wrote: > To allow nested stage support, we need to store both > stage 1 and stage 2 configurations (and remove the former > union). > > arm_smmu_write_strtab_ent() is modified to write both stage > fields in the STE. > > We add a nested_bypass field to th

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

2019-01-11 Thread Jean-Philippe Brucker
On 11/01/2019 12:28, Joerg Roedel wrote: > Hi Jean-Philippe, > > On Thu, Dec 13, 2018 at 12:50:29PM +0000, Jean-Philippe Brucker wrote: >> We already do deferred flush: UNMAP requests are added to the queue by >> iommu_unmap(), and then flushed out by iotlb_sync(). So we

Re: [RFC v3 14/21] iommu: introduce device fault data

2019-01-11 Thread Jean-Philippe Brucker
reported are grouped >> and generalized based common specifications such as PCI ATS. >> >> Signed-off-by: Jacob Pan >> Signed-off-by: Jean-Philippe Brucker >> Signed-off-by: Liu, Yi L >> Signed-off-by: Ashok Raj >> Signed-off-by: Eric Auger >> [

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

2018-12-20 Thread Jean-Philippe Brucker
On 19/12/2018 23:09, Michael S. Tsirkin wrote: > On Thu, Dec 13, 2018 at 12:50:29PM +0000, Jean-Philippe Brucker wrote: >>>> [3] git://linux-arm.org/linux-jpb.git virtio-iommu/v0.9.1 >>>> git://linux-arm.org/kvmtool-jpb.git virtio-iommu/v0.9 >>> >>&

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

2018-12-13 Thread Jean-Philippe Brucker
Hi Joerg, On 12/12/2018 10:35, Joerg Roedel wrote: > Hi, > > to make progress on this, we should first agree on the protocol used > between guest and host. I have a few points to discuss on the protocol > first. > > On Tue, Dec 11, 2018 at 06:20:57PM +, Jean-Philippe

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

2018-12-11 Thread Jean-Philippe Brucker
On 11/12/2018 18:31, Christoph Hellwig wrote: > On Tue, Dec 11, 2018 at 06:20:57PM +0000, Jean-Philippe Brucker wrote: >> Implement the virtio-iommu driver, following specification v0.9 [1]. >> >> Only minor changes since v5 [2]. I fixed issues reported by Michael and >&g

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

2018-12-11 Thread Jean-Philippe Brucker
virtio-iommu, because MSIs bypass it. Tested-by: Bharat Bhushan Tested-by: Eric Auger Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 156 -- include/uapi/linux/virtio_iommu.h | 36 +++ 2 files changed, 186

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

2018-12-11 Thread Jean-Philippe Brucker
-off-by: Jean-Philippe Brucker --- MAINTAINERS | 7 + drivers/iommu/Kconfig | 11 + drivers/iommu/Makefile| 1 + drivers/iommu/virtio-iommu.c | 916 ++ include/uapi/linux/virtio_ids.h | 1 + include/uapi/linux

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

2018-12-11 Thread Jean-Philippe Brucker
Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 115 +++--- include/uapi/linux/virtio_iommu.h | 19 + 2 files changed, 125 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index

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

2018-12-11 Thread Jean-Philippe Brucker
ed-by: Rob Herring Signed-off-by: Jean-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

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

2018-12-11 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

  1   2   3   >