Re: [tip: x86/urgent] x86/dma: Tear down DMA ops on driver unbind

2021-04-19 Thread Jean-Philippe Brucker
On Sat, Apr 17, 2021 at 02:06:44PM +0200, Borislav Petkov wrote: > Nope, sorry, no joy. Zapping it from tip. > > With that patch, it fails booting on my test box with messages like > (typing up from video I took): > > ... > ata: softreset failed (1st FIS failed) > ahci :03:00:1: AMD-Vi: Event

[tip: x86/urgent] x86/dma: Tear down DMA ops on driver unbind

2021-04-15 Thread tip-bot2 for Jean-Philippe Brucker
The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 9f8614f5567eb4e38579422d38a1bdfeeb648ffc Gitweb: https://git.kernel.org/tip/9f8614f5567eb4e38579422d38a1bdfeeb648ffc Author:Jean-Philippe Brucker AuthorDate:Wed, 14 Apr 2021 10:26:34 +02:00

[PATCH] x86/dma: Tear down DMA ops on driver unbind

2021-04-14 Thread Jean-Philippe Brucker
eardown_dma_ops() on x86 to clear the device's dma_ops pointer during driver unbind. Fixes: 08a27c1c3ecf ("iommu: Add support to change default domain of an iommu group") Signed-off-by: Jean-Philippe Brucker --- arch/x86/Kconfig | 1 + arch/x86/kernel/pci-dma.c | 7 +

Re: [PATCH 1/2] iommu/sva: Tighten SVA bind API with explicit flags

2021-04-09 Thread Jean-Philippe Brucker
gt; Link: https://lore.kernel.org/linux-iommu/YFhiMLR35WWMW%2FHu@myrica/ > Suggested-by: Jean-Philippe Brucker > Signed-off-by: Jacob Pan > --- > drivers/dma/idxd/cdev.c | 2 +- > drivers/dma/idxd/init.c | 6 +++--- > drivers/iommu

Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-09 Thread Jean-Philippe Brucker
On Thu, Apr 08, 2021 at 10:08:56AM -0700, Jacob Pan wrote: > diff --git a/drivers/iommu/iommu-sva-lib.c b/drivers/iommu/iommu-sva-lib.c > index bd41405..bd99f6b 100644 > --- a/drivers/iommu/iommu-sva-lib.c > +++ b/drivers/iommu/iommu-sva-lib.c > @@ -12,27 +12,33 @@ static DECLARE_IOASID_SET(iommu_s

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-08 Thread Jean-Philippe Brucker
On Wed, Apr 07, 2021 at 04:36:54PM -0300, Jason Gunthorpe wrote: > On Wed, Apr 07, 2021 at 08:43:50PM +0200, Jean-Philippe Brucker wrote: > > > * Get a container handle out of /dev/ioasid (or /dev/iommu, really.) > > No operation available since we don't know wh

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-07 Thread Jean-Philippe Brucker
On Wed, Apr 07, 2021 at 08:17:50AM +, Tian, Kevin wrote: > btw this discussion was raised when discussing the I/O page fault handling > process. Currently the IOMMU layer implements a per-device fault reporting > mechanism, which requires VFIO to register a handler to receive all faults > on i

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-01 Thread Jean-Philippe Brucker
On Thu, Apr 01, 2021 at 07:04:01AM +, Liu, Yi L wrote: > > - how about AMD and ARM's vSVA support? Their PASID allocation and page > > table > > happens within guest. They only need to bind the guest PASID table to > > host. In this case each VM has its own IOASID space, and the host IOASID

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-30 Thread Jean-Philippe Brucker
On Tue, Mar 30, 2021 at 10:07:55AM -0300, Jason Gunthorpe wrote: > On Fri, Mar 26, 2021 at 09:06:42AM +0100, Jean-Philippe Brucker wrote: > > > It's not inconceivable to have a control queue doing DMA tagged with > > PASID. The devices I know either use untagged DMA, or hav

Re: [PATCH RFC v1 02/15] iommu: Add a simple PASID table library

2021-03-29 Thread Jean-Philippe Brucker
On Fri, Mar 12, 2021 at 06:17:55PM +0530, Vivek Kumar Gautam wrote: > > Regarding the overall design, I was initially assigning page directories > > instead of whole PASID tables, which would simplify the driver and host > > implementation. A major complication, however, is SMMUv3 accesses PASID >

Re: [PATCH RFC v1 15/15] iommu/virtio: Update fault type and reason info for viommu fault

2021-03-29 Thread Jean-Philippe Brucker
On Fri, Mar 12, 2021 at 06:39:05PM +0530, Vivek Kumar Gautam wrote: > To complete the page request we would also need to send the response back to > the host from virtio backend when handling page request. So the virtio > command should also be accompanied with a vfio api to send the page request >

Re: [PATCH RFC v1 13/15] iommu/virtio: Attach Arm PASID tables when available

2021-03-29 Thread Jean-Philippe Brucker
On Fri, Mar 12, 2021 at 06:59:17PM +0530, Vivek Kumar Gautam wrote: > > > + /* XXX HACK: set feature bit ARM_SMMU_FEAT_2_LVL_CDTAB */ > > > + pst_cfg->vendor.cfg.feat_flag |= (1 << 1); > > > > Oh right, this flag is missing. I'll add > > > >#define VIRTIO_IOMMU_PST_ARM_SMMU3_F_CD2L (1ULL << 1

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-26 Thread Jean-Philippe Brucker
On Thu, Mar 25, 2021 at 02:16:45PM -0300, Jason Gunthorpe wrote: > On Thu, Mar 25, 2021 at 10:02:36AM -0700, Jacob Pan wrote: > > Hi Jean-Philippe, > > > > On Thu, 25 Mar 2021 11:21:40 +0100, Jean-Philippe Brucker > > wrote: > > > > > On Wed, Mar 24,

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-25 Thread Jean-Philippe Brucker
On Wed, Mar 24, 2021 at 10:02:46AM -0700, Jacob Pan wrote: > > And a flag IOMMU_SVA_BIND_SUPERVISOR (not that I plan to implement it in > > the SMMU, but I think we need to clean the current usage) > > > You mean move #define SVM_FLAG_SUPERVISOR_MODE out of Intel code to be a > generic flag in iom

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-25 Thread Jean-Philippe Brucker
On Wed, Mar 24, 2021 at 03:12:30PM -0700, Jacob Pan wrote: > Hi Jason, > > On Wed, 24 Mar 2021 14:03:38 -0300, Jason Gunthorpe wrote: > > > On Wed, Mar 24, 2021 at 10:02:46AM -0700, Jacob Pan wrote: > > > > Also wondering about device driver allocating auxiliary domains for > > > > their private

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-22 Thread Jean-Philippe Brucker
On Fri, Mar 19, 2021 at 11:22:21AM -0700, Jacob Pan wrote: > Hi Jason, > > On Fri, 19 Mar 2021 10:54:32 -0300, Jason Gunthorpe wrote: > > > On Fri, Mar 19, 2021 at 02:41:32PM +0100, Jean-Philippe Brucker wrote: > > > On Fri, Mar 19, 2021 at 09:46:45AM -0300, Jason Gu

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-19 Thread Jean-Philippe Brucker
On Fri, Mar 19, 2021 at 09:46:45AM -0300, Jason Gunthorpe wrote: > On Fri, Mar 19, 2021 at 10:58:41AM +0100, Jean-Philippe Brucker wrote: > > > Although there is no use for it at the moment (only two upstream users and > > it looks like amdkfd always uses current too), I quite l

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-19 Thread Jean-Philippe Brucker
Hi Jacob, On Thu, Mar 18, 2021 at 05:22:34PM -0700, Jacob Pan wrote: > Hi Jean, > > Slightly off the title. As we are moving to use cgroup to limit PASID > allocations, it would be much simpler if we enforce on the current task. Yes I think we should do that. Is there a problem with charging the

Re: [PATCH 1/1] drm/amdkfd: fix build error with AMD_IOMMU_V2=m

2021-03-09 Thread Jean-Philippe Brucker
Hi Felix, On Tue, Mar 09, 2021 at 11:30:19AM -0500, Felix Kuehling wrote: > > I think the proper fix would be to not rely on custom hooks into a > > particular > > IOMMU driver, but to instead ensure that the amdgpu driver can do everything > > it needs through the regular linux/iommu.h interface

Re: [RFC PATCH 15/18] cgroup: Introduce ioasids controller

2021-03-05 Thread Jean-Philippe Brucker
On Fri, Mar 05, 2021 at 09:30:49AM +0100, Jean-Philippe Brucker wrote: > That works but isn't perfect, because the hardware resource of shared > address spaces can be much lower that PID limit - 16k ASIDs on Arm. To Sorry I meant 16-bit here - 64k Thanks, Jean

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 15/18] cgroup: Introduce ioasids controller

2021-03-05 Thread Jean-Philippe Brucker
On Thu, Mar 04, 2021 at 09:46:03AM -0800, Jacob Pan wrote: > Hi Jean-Philippe, > > On Thu, 4 Mar 2021 10:49:37 +0100, Jean-Philippe Brucker > wrote: > > > On Wed, Mar 03, 2021 at 04:02:05PM -0800, Jacob Pan wrote: > > > Hi Jacob, > > > > > &

Re: [RFC PATCH 15/18] cgroup: Introduce ioasids controller

2021-03-04 Thread Jean-Philippe Brucker
On Wed, Mar 03, 2021 at 04:02:05PM -0800, Jacob Pan wrote: > Hi Jacob, > > On Wed, 3 Mar 2021 13:17:26 -0800, Jacob Pan > wrote: > > > Hi Tejun, > > > > On Wed, 3 Mar 2021 10:44:28 -0500, Tejun Heo wrote: > > > > > On Sat, Feb 27, 2021 at 02:01:23PM -0800, Jacob Pan wrote: > > > > IOASIDs a

Re: [PATCH RFC v1 13/15] iommu/virtio: Attach Arm PASID tables when available

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:40PM +0530, Vivek Gautam wrote: [...] > +static int viommu_setup_pgtable(struct viommu_endpoint *vdev, > + struct viommu_domain *vdomain) > +{ > + int ret, id; > + u32 asid; > + enum io_pgtable_fmt fmt; > + struct io_pgtable_

Re: [PATCH RFC v1 15/15] iommu/virtio: Update fault type and reason info for viommu fault

2021-03-03 Thread Jean-Philippe Brucker
gned-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Michael S. Tsirkin > Cc: Robin Murphy > Cc: Jean-Philippe Brucker > Cc: Eric Auger > Cc: Alex Williamson > Cc: Kevin Tian > Cc: Jacob Pan > Cc: Liu Yi L > Cc: Lorenzo Pieralisi > Cc: Sh

Re: [PATCH RFC v1 09/15] iommu/virtio: Update table format probing header

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:36PM +0530, Vivek Gautam wrote: > Add info about asid_bits and additional flags to table format > probing header. > > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Michael S. Tsirkin > Cc: Robin Murphy > Cc:

Re: [PATCH RFC v1 08/15] iommu: Add asid_bits to arm smmu-v3 stage1 table info

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:35PM +0530, Vivek Gautam wrote: > aisd_bits data is required to prepare stage-1 tables for arm-smmu-v3. > > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy > Cc: Jean-Philippe Brucker > Cc: Eric Auge

Re: [PATCH RFC v1 06/15] iommu/virtio: Add headers for table format probing

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:33PM +0530, Vivek Gautam wrote: > From: Jean-Philippe Brucker > > Add required UAPI defines for probing table format for underlying > iommu hardware. The device may provide information about hardware > tables and additional capabilities for each

Re: [PATCH RFC v1 05/15] iommu/arm-smmu-v3: Set sync op from consumer driver of cd-lib

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:32PM +0530, Vivek Gautam wrote: > Te change allows different consumers of arm-smmu-v3-cd-lib to set > their respective sync op for pasid entries. > > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy > C

Re: [PATCH RFC v1 04/15] iommu/arm-smmu-v3: Update CD base address info for user-space

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:31PM +0530, Vivek Gautam wrote: > Update base address information in vendor pasid table info to pass that > to user-space for stage1 table management. > > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy

Re: [PATCH RFC v1 02/15] iommu: Add a simple PASID table library

2021-03-03 Thread Jean-Philippe Brucker
;t too invasive. Even if we called directly into the SMMU driver from the virtio one, we'd still need patch 3 and separate TLB invalidations ops. > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy > Cc: Jean-Philippe Brucker > Cc:

Re: [PATCH v6 08/12] fork: Clear PASID for new mm

2021-03-02 Thread Jean-Philippe Brucker
On Mon, Mar 01, 2021 at 03:00:11PM -0800, Jacob Pan wrote: > > functionality is not a problem without this patch on x86. But I think > I feel the reason that x86 doesn't care is that mm->pasid is not used > unless bind_mm is called. I think vt-d also maintains the global_svm_list, that tells wheth

[PATCH] mm/fork: Clear PASID for new mm

2021-03-02 Thread Jean-Philippe Brucker
From: Fenghua Yu When a new mm is created, its PASID should be cleared, i.e. the PASID is initialized to its init state 0 on both ARM and X86. Reviewed-by: Tony Luck Signed-off-by: Fenghua Yu Signed-off-by: Jean-Philippe Brucker --- This patch was part of the series introducing mm->pa

Re: [PATCH v6 08/12] fork: Clear PASID for new mm

2021-02-24 Thread Jean-Philippe Brucker
Hi Fenghua, [Trimmed the Cc list] On Mon, Jul 13, 2020 at 04:48:03PM -0700, Fenghua Yu wrote: > When a new mm is created, its PASID should be cleared, i.e. the PASID is > initialized to its init state 0 on both ARM and X86. I just noticed this patch was dropped in v7, and am wondering whether we

Re: [RFC PATCH v1 0/4] vfio: Add IOPF support for VFIO passthrough

2021-02-05 Thread Jean-Philippe Brucker
Hi, On Thu, Feb 04, 2021 at 06:52:10AM +, Tian, Kevin wrote: > > >>> The static pinning and mapping problem in VFIO and possible solutions > > >>> have been discussed a lot [1, 2]. One of the solutions is to add I/O > > >>> page fault support for VFIO devices. Different from those relatively >

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 v4 2/3] iommu/iova: Avoid double-negatives in magazine helpers

2021-01-18 Thread Jean-Philippe Brucker
On Mon, Jan 18, 2021 at 10:55:52AM +, John Garry wrote: > On 18/01/2021 10:08, Jean-Philippe Brucker wrote: > > > > Any idea why that's happening? This fix seems ok but if we're expecting > > > > allocation failures for the loaded magazine then we could

Re: [PATCH v4 2/3] iommu/iova: Avoid double-negatives in magazine helpers

2021-01-18 Thread Jean-Philippe Brucker
On Mon, Jan 18, 2021 at 09:24:17AM +, John Garry wrote: > On 15/01/2021 17:30, Jean-Philippe Brucker wrote: > > On Thu, Dec 10, 2020 at 02:23:08AM +0800, John Garry wrote: > > > A similar crash to the following could be observed if initial CPU rcache > > > m

Re: [PATCH v4 3/3] iommu/iova: Flush CPU rcache for when a depot fills

2021-01-15 Thread Jean-Philippe Brucker
On Thu, Dec 10, 2020 at 02:23:09AM +0800, John Garry wrote: > Leizhen reported some time ago that IOVA performance may degrade over time > [0], but unfortunately his solution to fix this problem was not given > attention. > > To summarize, the issue is that as time goes by, the CPU rcache and depo

Re: [PATCH v4 2/3] iommu/iova: Avoid double-negatives in magazine helpers

2021-01-15 Thread Jean-Philippe Brucker
On Thu, Dec 10, 2020 at 02:23:08AM +0800, John Garry wrote: > A similar crash to the following could be observed if initial CPU rcache > magazine allocations fail in init_iova_rcaches(): Any idea why that's happening? This fix seems ok but if we're expecting allocation failures for the loaded mag

Re: [PATCH v4 1/3] iommu/iova: Add free_all_cpu_cached_iovas()

2021-01-15 Thread Jean-Philippe Brucker
> > Signed-off-by: John Garry > Tested-by: Xiang Chen > Reviewed-by: Zhen Lei Reviewed-by: Jean-Philippe Brucker (unless we find a better solution for patch 3) > --- > drivers/iommu/iova.c | 13 + > 1 file changed, 9 insertions(+), 4 deletions(-) > > d

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 bpf-next 2/2] selftests: bpf: Add a new test for bare tracepoints

2021-01-13 Thread Jean-Philippe Brucker
On Wed, Jan 13, 2021 at 10:21:31AM +, Qais Yousef wrote: > On 01/12/21 12:07, Andrii Nakryiko wrote: > > > > > $ sudo ./test_progs -v -t module_attach > > > > > > > > use -vv when debugging stuff like that with test_progs, it will output > > > > libbpf detailed logs, that often are very

Re: [PATCH] PCI: Add a quirk to enable SVA for HiSilicon chip

2021-01-13 Thread Jean-Philippe Brucker
On Wed, Jan 13, 2021 at 08:05:11PM +0800, Zhangfei Gao wrote: > > > + /* Device-tree can set the stall property */ > > > + if (!pdev->dev.of_node && > > > + device_add_properties(&pdev->dev, properties)) > > Does this mean "dma-can-stall" *can* be set via DT, and if it is, this > > quirk is not

Re: [PATCH AUTOSEL 5.4 08/10] selftests/bpf: Fix array access with signed variable test

2020-12-20 Thread Jean-Philippe Brucker
Hi, On Sat, Dec 19, 2020 at 10:34:55PM -0500, Sasha Levin wrote: > From: Jean-Philippe Brucker > > [ Upstream commit 77ce220c0549dcc3db8226c61c60e83fc59dfafc ] > > The test fails because of a recent fix to the verifier, even though this That fix is commit b02709587ea3 ("

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: [PATCH v6 2/5] iommu: Use bus iommu ops for aux related callback

2020-10-30 Thread Jean-Philippe Brucker
On Fri, Oct 30, 2020 at 05:55:53AM +, Tian, Kevin wrote: > > From: Lu Baolu > > Sent: Friday, October 30, 2020 12:58 PM > > > > The aux-domain apis were designed for macro driver where the subdevices > > are created and used inside a device driver. Use the device's bus iommu > > ops instead o

Re: [PATCH v3 01/14] docs: Document IO Address Space ID (IOASID) APIs

2020-10-30 Thread Jean-Philippe Brucker
On Mon, Oct 26, 2020 at 02:05:06PM -0700, Jacob Pan wrote: > > This looks good to me, with small comments below. > > > Can I add your Reviewed-by tag after addressing the comments? Yes sure, this took forever to review so I'm happy not to do another pass :) > > > +Each IOASID set is created wit

Re: [PATCH v1 2/3] iommu: Fix an issue in iommu_page_response() flags check

2020-10-28 Thread Jean-Philippe Brucker
Hi, On Wed, Oct 28, 2020 at 09:36:57AM +0800, Yi Sun wrote: > From: Jacob Pan > > original code fails when LAST_PAGE is set in flags. LAST_PAGE is not documented to be a valid flags for page_response. So isn't failing the right thing to do? > > Signed-off-by: Jacob Pan > Signed-off-by: Liu Y

Re: [PATCH v6 13/29] arm64/build: Assert for unwanted sections

2020-10-27 Thread Jean-Philippe Brucker
Hi, On Mon, Oct 26, 2020 at 06:38:46PM +0100, Ard Biesheuvel wrote: > > > > Note that even on plain be2881824ae9eb92, I get: > > > > > > > > aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected! > > > > aarch64-linux-gnu-ld: Unexpected run-time procedure linkages > > > > detected! >

Re: [RFC PATCH 0/2] iommu: Avoid unnecessary PRI queue flushes

2020-10-23 Thread Jean-Philippe Brucker
On Mon, Oct 19, 2020 at 02:16:08PM -0700, Raj, Ashok wrote: > Hi Jean > > On Mon, Oct 19, 2020 at 04:08:24PM +0200, Jean-Philippe Brucker wrote: > > On Sat, Oct 17, 2020 at 04:25:25AM -0700, Raj, Ashok wrote: > > > > For devices that *don't* use a

Re: [RFC PATCH 0/2] iommu: Avoid unnecessary PRI queue flushes

2020-10-23 Thread Jean-Philippe Brucker
On Mon, Oct 19, 2020 at 11:33:16AM -0700, Jacob Pan wrote: > Hi Jean-Philippe, > > On Mon, 19 Oct 2020 16:08:24 +0200, Jean-Philippe Brucker > wrote: > > > On Sat, Oct 17, 2020 at 04:25:25AM -0700, Raj, Ashok wrote: > > > > For devices that *don't*

Re: [PATCH v3 11/14] iommu/ioasid: Support mm type ioasid_set notifications

2020-10-23 Thread Jean-Philippe Brucker
nb); I think it's possible for ioasid_set_put_locked() to free the set right after we release the lock, then this unregister() will be use-after-free. Best keep holding the lock for this. > + } > + kfree(curr); > + return; > +

Re: [PATCH v3 10/14] iommu/ioasid: Introduce notification APIs

2020-10-23 Thread Jean-Philippe Brucker
ter(&ioasid_notifier, nb); > +} > +EXPORT_SYMBOL_GPL(ioasid_register_notifier); > + Here as well, a comment saying that a reference to the set must be held, though maybe that's obvious. Thanks, Jean > +void ioasid_unregister_notifier(struct ioasid_set *set, > + struct notifier_blo

Re: [PATCH v3 09/14] iommu/ioasid: Introduce ioasid_set private ID

2020-10-23 Thread Jean-Philippe Brucker
On Mon, Sep 28, 2020 at 02:38:36PM -0700, Jacob Pan wrote: > When an IOASID set is used for guest SVA, each VM will acquire its > ioasid_set for IOASID allocations. IOASIDs within the VM must have a > host/physical IOASID backing, mapping between guest and host IOASIDs can > be non-identical. IOASI

Re: [PATCH v3 07/14] iommu/ioasid: Add an iterator API for ioasid_set

2020-10-21 Thread Jean-Philippe Brucker
gt; when the ioasid_set is freed, the user might perform the same cleanup > operation on each IOASID. > > This patch adds an API to iterate all the IOASIDs within the set. > > Signed-off-by: Jacob Pan Could add a short description of the function parameters, but Reviewed-by: Jean-Philippe

Re: [PATCH v3 08/14] iommu/ioasid: Add reference couting functions

2020-10-21 Thread Jean-Philippe Brucker
On Mon, Sep 28, 2020 at 02:38:35PM -0700, Jacob Pan wrote: > There can be multiple users of an IOASID, each user could have hardware > contexts associated with the IOASID. In order to align lifecycles, > reference counting is introduced in this patch. It is expected that when > an IOASID is being f

Re: [PATCH v3 06/14] iommu/ioasid: Introduce API to adjust the quota of an ioasid_set

2020-10-21 Thread Jean-Philippe Brucker
SIDs already allocated within the set. The extra quota > will be returned to the system-wide IOASID pool if the new quota is > smaller than the existing one. > > Signed-off-by: Jacob Pan Minor comments below, but Reviewed-by: Jean-Philippe Brucker > --- >

Re: [PATCH v3 05/14] iommu/ioasid: Redefine IOASID set and allocation APIs

2020-10-21 Thread Jean-Philippe Brucker
On Mon, Sep 28, 2020 at 02:38:32PM -0700, Jacob Pan wrote: > ioasid_set was introduced as an arbitrary token that is shared by a > group of IOASIDs. For example, two IOASIDs allocated via the same > ioasid_set pointer belong to the same set. > > For guest SVA usages, system-wide IOASID resources n

Re: [PATCH v3 04/14] iommu/ioasid: Support setting system-wide capacity

2020-10-21 Thread Jean-Philippe Brucker
VT-d this is set during boot as part of the Intel IOMMU > initialization. > > Signed-off-by: Jacob Pan Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/intel/iommu.c | 5 + > drivers/iommu/ioasid.c | 20 > include/linux/ioasid.h |

Re: [PATCH v3 03/14] iommu/ioasid: Add a separate function for detach data

2020-10-21 Thread Jean-Philippe Brucker
() can > then be used under spinlocks. In addition, this change makes the API > symmetrical. > > Signed-off-by: Jacob Pan A typo below, but Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/intel/svm.c | 4 ++-- > drivers/iommu/ioasid.c| 54 > +

Re: [PATCH v3 01/14] docs: Document IO Address Space ID (IOASID) APIs

2020-10-20 Thread Jean-Philippe Brucker
On Mon, Sep 28, 2020 at 02:38:28PM -0700, Jacob Pan wrote: > IOASID is used to identify address spaces that can be targeted by device > DMA. It is a system-wide resource that is essential to its many users. > This document is an attempt to help developers from all vendors navigate > the APIs. At th

Re: [RFC PATCH 0/2] iommu: Avoid unnecessary PRI queue flushes

2020-10-19 Thread Jean-Philippe Brucker
On Sat, Oct 17, 2020 at 04:25:25AM -0700, Raj, Ashok wrote: > > For devices that *don't* use a stop marker, the PCIe spec says (10.4.1.2): > > > > To stop [using a PASID] without using a Stop Marker Message, the > > function shall: > > 1. Stop queueing new Page Request Messages for this PASI

Re: [RFC PATCH 0/2] iommu: Avoid unnecessary PRI queue flushes

2020-10-16 Thread Jean-Philippe Brucker
On Thu, Oct 15, 2020 at 11:22:11AM -0700, Raj, Ashok wrote: > Hi Jean > > + Baolu who is looking into this. > > > On Thu, Oct 15, 2020 at 11:00:27AM +0200, Jean-Philippe Brucker wrote: > > Add a parameter to iommu_sva_unbind_device() that tells the IOMMU driver > &g

[RFC PATCH 2/2] iommu: Add IOMMU_UNBIND_FAULT_PENDING flag

2020-10-15 Thread Jean-Philippe Brucker
. Add the IOMMU_UNBIND_FAULT_PENDING flags to unbind(), to tell the IOMMU driver whether it's worth flushing the queue. Signed-off-by: Jean-Philippe Brucker --- include/linux/iommu.h | 31 +++ drivers/iommu/intel/svm.c | 3 ++- drivers/iommu/iommu.c | 5

[RFC PATCH 1/2] iommu: Add flags to sva_unbind()

2020-10-15 Thread Jean-Philippe Brucker
Provide a way for device drivers to tell IOMMU drivers about the device state and the cleanup work to be done, when unbinding. No functional change. Signed-off-by: Jean-Philippe Brucker --- include/linux/intel-iommu.h | 2 +- include/linux/iommu.h | 7 --- drivers/iommu/intel/svm.c

[RFC PATCH 0/2] iommu: Avoid unnecessary PRI queue flushes

2020-10-15 Thread Jean-Philippe Brucker
hould return whether faults are pending. This can be added later once uacce has an actual PCIe user, but we need to remember to do it. Jean-Philippe Brucker (2): iommu: Add flags to sva_unbind() iommu: Add IOMMU_UNBIND_FAULT_PENDING flag include/linux/intel-iommu.h | 2 +- i

Re: [PATCH v11 5/6] iommu/uapi: Handle data and argsz filled by users

2020-09-25 Thread Jean-Philippe Brucker
in padding, flags, and version are also checked. > Details are documented in Documentation/userspace-api/iommu.rst > > Signed-off-by: Liu Yi L > Signed-off-by: Jacob Pan Reviewed-by: Jean-Philippe Brucker Some comments below in case you're resending,

Re: [PATCH v2] arm64: bpf: Fix branch offset in JIT

2020-09-16 Thread Jean-Philippe Brucker
On Wed, Sep 16, 2020 at 03:39:37PM +0300, Yauheni Kaliuta wrote: > If you start to amend extables, could you consider a change like > > 05a68e892e89 ("s390/kernel: expand exception table logic to allow new > handling options") > > and implementation of BPF_PROBE_MEM then? Commit 800834285361 ("

Re: [PATCH v2] arm64: bpf: Fix branch offset in JIT

2020-09-15 Thread Jean-Philippe Brucker
On Tue, Sep 15, 2020 at 02:11:03PM +0100, Will Deacon wrote: > > ret = build_insn(insn, ctx, extra_pass); > > if (ret > 0) { > > i++; > > if (ctx->image == NULL) > > - ctx->offset[i] = ctx->idx; > > +

Re: [PATCH v2 6/9] iommu/ioasid: Introduce notification APIs

2020-08-25 Thread Jean-Philippe Brucker
spin_unlock(&ioasid_nb_lock); > + return; > +} > +EXPORT_SYMBOL_GPL(ioasid_unregister_notifier_mm); > + > +/** > + * ioasid_notify - Send notification on a given IOASID for status change. > + * Used by publishers when the status change may affect > + *

Re: [PATCH v2 5/9] iommu/ioasid: Introduce ioasid_set private ID

2020-08-25 Thread Jean-Philippe Brucker
On Fri, Aug 21, 2020 at 09:35:14PM -0700, Jacob Pan wrote: > When an IOASID set is used for guest SVA, each VM will acquire its > ioasid_set for IOASID allocations. IOASIDs within the VM must have a > host/physical IOASID backing, mapping between guest and host IOASIDs can > be non-identical. IOASI

Re: [PATCH v2 4/9] iommu/ioasid: Add reference couting functions

2020-08-25 Thread Jean-Philippe Brucker
On Mon, Aug 24, 2020 at 10:26:55AM +0800, Lu Baolu wrote: > Hi Jacob, > > On 8/22/20 12:35 PM, Jacob Pan wrote: > > There can be multiple users of an IOASID, each user could have hardware > > contexts associated with the IOASID. In order to align lifecycles, > > reference counting is introduced in

Re: [PATCH v2 4/9] iommu/ioasid: Add reference couting functions

2020-08-25 Thread Jean-Philippe Brucker
On Fri, Aug 21, 2020 at 09:35:13PM -0700, Jacob Pan wrote: > There can be multiple users of an IOASID, each user could have hardware > contexts associated with the IOASID. In order to align lifecycles, > reference counting is introduced in this patch. It is expected that when > an IOASID is being f

Re: [PATCH v2 2/9] iommu/ioasid: Rename ioasid_set_data()

2020-08-24 Thread Jean-Philippe Brucker
On Fri, Aug 21, 2020 at 09:35:11PM -0700, Jacob Pan wrote: > Rename ioasid_set_data() to ioasid_attach_data() to avoid confusion with > struct ioasid_set. ioasid_set is a group of IOASIDs that share a common > token. > > Signed-off-by: Jacob Pan Reviewed-by: Jean-P

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-08-24 Thread Jean-Philippe Brucker
On Fri, Aug 21, 2020 at 09:35:12PM -0700, Jacob Pan wrote: > ioasid_set was introduced as an arbitrary token that are shared by a > group of IOASIDs. For example, if IOASID #1 and #2 are allocated via the > same ioasid_set*, they are viewed as to belong to the same set. > > For guest SVA usages, s

Re: [PATCH v2 1/9] docs: Document IO Address Space ID (IOASID) APIs

2020-08-24 Thread Jean-Philippe Brucker
On Fri, Aug 21, 2020 at 09:35:10PM -0700, Jacob Pan wrote: > IOASID is used to identify address spaces that can be targeted by device > DMA. It is a system-wide resource that is essential to its many users. > This document is an attempt to help developers from all vendors navigate > the APIs. At th

Re: [PATCH v2 12/24] virtio_iommu: correct tags for config space fields

2020-08-04 Thread Jean-Philippe Brucker
On Mon, Aug 03, 2020 at 04:59:27PM -0400, Michael S. Tsirkin wrote: > Since this is a modern-only device, > tag config space fields as having little endian-ness. > > Signed-off-by: Michael S. Tsirkin Reviewed-by: Jean-Philippe Brucker And tested with the latest sparse > ---

Re: [PATCH bpf-next 1/1] arm64: bpf: Add BPF exception tables

2020-07-30 Thread Jean-Philippe Brucker
On Thu, Jul 30, 2020 at 09:47:39PM +0200, Daniel Borkmann wrote: > On 7/30/20 4:22 PM, Jean-Philippe Brucker wrote: > > On Thu, Jul 30, 2020 at 08:28:56AM -0400, Qian Cai wrote: > > > On Tue, Jul 28, 2020 at 05:21:26PM +0200, Jean-Philippe Brucker wrote: > > > > When

Re: [PATCH bpf-next 1/1] arm64: bpf: Add BPF exception tables

2020-07-30 Thread Jean-Philippe Brucker
On Thu, Jul 30, 2020 at 08:28:56AM -0400, Qian Cai wrote: > On Tue, Jul 28, 2020 at 05:21:26PM +0200, Jean-Philippe Brucker wrote: > > When a tracing BPF program attempts to read memory without using the > > bpf_probe_read() helper, the verifier marks the load instructi

Re: [PATCH v5 03/15] iommu/smmu: Report empty domain nesting info

2020-07-17 Thread Jean-Philippe Brucker
On Thu, Jul 16, 2020 at 10:38:17PM +0200, Auger Eric wrote: > Hi Jean, > > On 7/16/20 5:39 PM, Jean-Philippe Brucker wrote: > > On Tue, Jul 14, 2020 at 10:12:49AM +, Liu, Yi L wrote: > >>> Have you verified that this doesn't break the existing usage of >

Re: [PATCH v5 03/15] iommu/smmu: Report empty domain nesting info

2020-07-16 Thread Jean-Philippe Brucker
On Tue, Jul 14, 2020 at 10:12:49AM +, Liu, Yi L wrote: > > Have you verified that this doesn't break the existing usage of > > DOMAIN_ATTR_NESTING in drivers/vfio/vfio_iommu_type1.c? > > I didn't have ARM machine on my hand. But I contacted with Jean > Philippe, he confirmed no compiling issue

Re: [PATCH v2 3/4] iommu/vt-d: Report page request faults for guest SVA

2020-07-07 Thread Jean-Philippe Brucker
On Mon, Jul 06, 2020 at 08:25:34AM +0800, Lu Baolu wrote: > A pasid might be bound to a page table from a VM guest via the iommu > ops.sva_bind_gpasid. In this case, when a DMA page fault is detected > on the physical IOMMU, we need to inject the page fault request into > the guest. After the guest

Re: [PATCH v2 1/6] iommu/arm-smmu: Add auxiliary domain support for arm-smmuv2

2020-07-07 Thread Jean-Philippe Brucker
Hi Jordan, On Fri, Jun 26, 2020 at 02:04:09PM -0600, Jordan Crouse wrote: > Support auxiliary domains for arm-smmu-v2 to initialize and support > multiple pagetables for a single SMMU context bank. Since the smmu-v2 > hardware doesn't have any built in support for switching the pagetable > base it

Re: [PATCH v3 02/14] iommu: Report domain nesting info

2020-06-26 Thread Jean-Philippe Brucker
n > CC: Jacob Pan > Cc: Alex Williamson > Cc: Eric Auger > Cc: Jean-Philippe Brucker > Cc: Joerg Roedel > Cc: Lu Baolu > Signed-off-by: Liu Yi L > Signed-off-by: Jacob Pan > --- > drivers/iommu/arm-smmu-v3.c | 29 -- > drivers/iommu/ar

Re: [PATCH v2 02/15] iommu: Report domain nesting info

2020-06-17 Thread Jean-Philippe Brucker
x Williamson > Cc: Eric Auger > Cc: Jean-Philippe Brucker > Cc: Joerg Roedel > Cc: Lu Baolu > Signed-off-by: Liu Yi L > Signed-off-by: Jacob Pan > --- > @Jean, Eric: as nesting was introduced for ARM, but looks like no actual > user of it. right? So I'm

Re: [PATCH] uacce: remove uacce_vma_fault

2020-06-17 Thread Jean-Philippe Brucker
ed as well, > required by __do_fault. > > Reported-by: Jean-Philippe Brucker > Signed-off-by: Zhangfei Gao Reviewed-by: Jean-Philippe Brucker > --- > drivers/misc/uacce/uacce.c | 9 - > 1 file changed, 9 deletions(-) > > diff --git a/drivers/misc/uacce/uac

Re: [PATCH v2 08/12] mm: Define pasid in mm

2020-06-16 Thread Jean-Philippe Brucker
On Fri, Jun 12, 2020 at 05:41:29PM -0700, Fenghua Yu wrote: > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index 64ede5f150dc..5778db3aa42d 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -538,6 +538,10 @@ struct mm_struct { > atomic

Re: [RFC PATCH] PCI: Remove End-End TLP as PASID dependency

2020-06-10 Thread Jean-Philippe Brucker
On Wed, Jun 10, 2020 at 12:18:14PM +0800, Zhangfei Gao wrote: > Some platform devices appear as PCI and have PCI cfg space, > but are actually on the AMBA bus. > They can support PASID via smmu stall feature, but does not > support tlp since they are not real pci devices. > So remove tlp as a PASID

[PATCH] tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes

2020-06-08 Thread Jean-Philippe Brucker
y used by the bpf_task_fd_query() syscall handler to collect information about a perf event. Fixes: 60d53e2c3b75 ("tracing/probe: Split trace_event related data from trace_probe") Signed-off-by: Jean-Philippe Brucker --- Found while trying to run the task_fd_query BPF sample. I intend to try

Re: [RFC PATCH] iommu/arm-smmu: Add module parameter to set msi iova address

2020-05-28 Thread Jean-Philippe Brucker
[+ Shameer] On Thu, May 28, 2020 at 09:43:46AM +0200, Auger Eric wrote: > Hi, > > On 5/28/20 9:23 AM, Jean-Philippe Brucker wrote: > > On Thu, May 28, 2020 at 10:45:14AM +0530, Srinath Mannam wrote: > >> On Wed, May 27, 2020 at 11:00 PM Robin Murphy wrote: > >>&

Re: [RFC PATCH] iommu/arm-smmu: Add module parameter to set msi iova address

2020-05-28 Thread Jean-Philippe Brucker
On Thu, May 28, 2020 at 10:45:14AM +0530, Srinath Mannam wrote: > On Wed, May 27, 2020 at 11:00 PM Robin Murphy wrote: > > > Thanks Robin for your quick response. > > On 2020-05-27 17:03, Srinath Mannam wrote: > > > This patch gives the provision to change default value of MSI IOVA base > > > to p

Re: [PATCH v6] iommu/virtio: Use page size bitmap supported by endpoint

2020-05-14 Thread Jean-Philippe Brucker
On Thu, May 14, 2020 at 05:31:00AM -0400, Michael S. Tsirkin wrote: > On Thu, May 14, 2020 at 01:22:37PM +0530, Bharat Bhushan wrote: > > Different endpoint can support different page size, probe > > endpoint if it supports specific page size otherwise use > > global page sizes. > > > > Device att

Re: [EXT] Re: [PATCH v5] iommu/virtio: Use page size bitmap supported by endpoint

2020-05-13 Thread Jean-Philippe Brucker
On Wed, May 13, 2020 at 09:15:22AM +, Bharat Bhushan wrote: > Hi Jean, > > > -Original Message- > > From: Michael S. Tsirkin > > Sent: Wednesday, May 6, 2020 5:53 AM > > To: Bharat Bhushan > > Cc: jean-phili...@linaro.org; j...@8bytes.org; jasow...@redhat.com; > > virtualizat...@list

Re: [PATCH v5] iommu/virtio: Use page size bitmap supported by endpoint

2020-05-12 Thread Jean-Philippe Brucker
On Tue, May 12, 2020 at 10:53:39AM -0400, Michael S. Tsirkin wrote: > > static int viommu_add_resv_mem(struct viommu_endpoint *vdev, > >struct virtio_iommu_probe_resv_mem *mem, > >size_t len) > > @@ -499,6 +513,9 @@ static int viommu_probe_en

Re: [PATCH] iommu/virtio: reverse arguments to list_add

2020-05-06 Thread Jean-Philippe Brucker
ng more than one item would break the list. Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/virtio-iommu.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c > index d5cac4f46ca5..4e1d

Re: [PATCH v3 3/4] iommu/ioasid: Add custom allocators

2019-10-02 Thread Jean-Philippe Brucker
Hi Jacob, There seem to be a mix-up here, the changes from your v2 are lost and patches 1 and 3 are back to v1. Assuming this isn't intended, I'll review v2 of this patch since it looked good to me overall. Thanks, Jean

Re: [PATCH 2/4] iommu: Add I/O ASID allocator

2019-09-20 Thread Jean-Philippe Brucker
On Wed, Sep 18, 2019 at 04:26:32PM -0700, Jacob Pan wrote: > From: Jean-Philippe Brucker > > Some devices might support multiple DMA address spaces, in particular > those that have the PCI PASID feature. PASID (Process Address Space ID) > allows to share process address spaces wi

Re: [PATCH 8/8] iommu/arm-smmu-v3: Add support for PCI PASID

2019-09-19 Thread Jean-Philippe Brucker
On Mon, Jul 08, 2019 at 09:58:16AM +0200, Auger Eric wrote: > > + ret = pci_enable_pasid(pdev, features); > > + if (!ret) > > + master->ssid_bits = min_t(u8, ilog2(num_pasids), > > + master->smmu->ssid_bits); > I don't really get why this setting is

  1   2   3   >