Re: [PATCH] swiotlb: Allow swiotlb to live at pre-defined address

2020-03-30 Thread Baoquan He
On 03/30/20 at 10:42pm, Alexander Graf wrote: > > > On 30.03.20 15:40, Konrad Rzeszutek Wilk wrote: > > > > > > > > On Mon, Mar 30, 2020 at 02:06:01PM +0800, Kairui Song wrote: > > > On Sat, Mar 28, 2020 at 7:57 PM Dave Young wrote: > > > > > > > > On 03/26/20 at 05:29pm, Alexander Graf

RE: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-03-30 Thread Tian, Kevin
> From: Auger Eric > Sent: Monday, March 30, 2020 12:05 AM > > On 3/28/20 11:01 AM, Tian, Kevin wrote: > >> From: Jacob Pan > >> Sent: Saturday, March 21, 2020 7:28 AM > >> > >> When Shared Virtual Address (SVA) is enabled for a guest OS via > >> vIOMMU, we need to provide invalidation support

RE: [PATCH V10 05/11] iommu/vt-d: Add nested translation helper function

2020-03-30 Thread Tian, Kevin
> From: Jacob Pan > Sent: Tuesday, March 31, 2020 2:22 AM > > On Sun, 29 Mar 2020 16:03:36 +0800 > Lu Baolu wrote: > > > On 2020/3/27 20:21, Tian, Kevin wrote: > > >> From: Jacob Pan > > >> Sent: Saturday, March 21, 2020 7:28 AM > > >> > > >> Nested translation mode is supported in VT-d 3.0

RE: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-03-30 Thread Tian, Kevin
> From: Auger Eric > Sent: Sunday, March 29, 2020 11:34 PM > > Hi, > > On 3/28/20 11:01 AM, Tian, Kevin wrote: > >> From: Jacob Pan > >> Sent: Saturday, March 21, 2020 7:28 AM > >> > >> When Shared Virtual Address (SVA) is enabled for a guest OS via > >> vIOMMU, we need to provide invalidation

RE: [PATCH V10 06/11] iommu/vt-d: Add bind guest PASID support

2020-03-30 Thread Tian, Kevin
> From: Jacob Pan > Sent: Tuesday, March 31, 2020 4:52 AM > > On Sat, 28 Mar 2020 08:02:01 + > "Tian, Kevin" wrote: > > > > From: Jacob Pan > > > Sent: Saturday, March 21, 2020 7:28 AM > > > > > > When supporting guest SVA with emulated IOMMU, the guest PASID > > > table is shadowed in

Re: [PATCH] swiotlb: Allow swiotlb to live at pre-defined address

2020-03-30 Thread Dave Young
On 03/30/20 at 09:40am, Konrad Rzeszutek Wilk wrote: > On Mon, Mar 30, 2020 at 02:06:01PM +0800, Kairui Song wrote: > > On Sat, Mar 28, 2020 at 7:57 PM Dave Young wrote: > > > > > > On 03/26/20 at 05:29pm, Alexander Graf wrote: > > > > The swiotlb is a very convenient fallback mechanism for

RE: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free)

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Monday, March 30, 2020 10:37 PM > > > From: Tian, Kevin > > Sent: Monday, March 30, 2020 4:32 PM > > To: Liu, Yi L ; alex.william...@redhat.com; > > Subject: RE: [PATCH v1 1/8] vfio: Add > VFIO_IOMMU_PASID_REQUEST(alloc/free) > > > > > From: Liu, Yi L > > > Sent:

Re: [PATCH] swiotlb: Allow swiotlb to live at pre-defined address

2020-03-30 Thread Dave Young
Hi, [snip] > 2) Reuse the SWIOTLB from the previous boot on kexec/kdump We should only care about kdump > > I see little direct relation to SEV here. The only reason SEV makes it more > relevant, is that you need to have an SWIOTLB region available with SEV > while without you could live with

Re: [PATCH] swiotlb: Allow swiotlb to live at pre-defined address

2020-03-30 Thread Anthony Yznaga
On 3/30/20 1:42 PM, Alexander Graf wrote: > > > On 30.03.20 15:40, Konrad Rzeszutek Wilk wrote: >> >> >> >> On Mon, Mar 30, 2020 at 02:06:01PM +0800, Kairui Song wrote: >>> On Sat, Mar 28, 2020 at 7:57 PM Dave Young wrote: On 03/26/20 at 05:29pm, Alexander Graf wrote: > The

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-03-30 Thread Ashish Kalra
Hello Konrad, On Tue, Mar 03, 2020 at 12:03:53PM -0500, Konrad Rzeszutek Wilk wrote: > On Tue, Feb 04, 2020 at 07:35:00PM +, Ashish Kalra wrote: > > Hello Konrad, > > > > Looking fwd. to your feedback regarding support of other memory > > encryption architectures such as Power, S390, etc. >

Re: [PATCH V10 06/11] iommu/vt-d: Add bind guest PASID support

2020-03-30 Thread Jacob Pan
On Sun, 29 Mar 2020 15:40:22 +0200 Auger Eric wrote: > Hi, > > On 3/21/20 12:27 AM, Jacob Pan wrote: > > When supporting guest SVA with emulated IOMMU, the guest PASID > > table is shadowed in VMM. Updates to guest vIOMMU PASID table > > will result in PASID cache flush which will be passed

[PATCH] iommu/vt-d: Fix PASID cache flush

2020-03-30 Thread Jacob Pan
PASID cache type and shift of granularity bits are missing in the current code. Fixes: 6f7db75e1c46 ("iommu/vt-d: Add second level page table interface") Cc: Eric Auger Signed-off-by: Jacob Pan --- drivers/iommu/intel-pasid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

Re: [PATCH V10 07/11] iommu/vt-d: Support flushing more translation cache types

2020-03-30 Thread Jacob Pan
On Fri, 27 Mar 2020 15:46:23 +0100 Auger Eric wrote: > Hi Jacob, > > On 3/21/20 12:27 AM, Jacob Pan wrote: > > When Shared Virtual Memory is exposed to a guest via vIOMMU, > > scalable IOTLB invalidation may be passed down from outside IOMMU > > subsystems. This patch adds invalidation

Re: [PATCH v2 1/3] dt-bindings: remoteproc: qcom: Add iommus property

2020-03-30 Thread Rob Herring
On Tue, 17 Mar 2020 20:39:08 +0530, Sibi Sankar wrote: > Add iommus property to allow Q6 modem to boot on platforms which do > not have trustZone. > > Signed-off-by: Sibi Sankar > --- > Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt | 3 +++ > 1 file changed, 3 insertions(+) >

RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter for quota tuning

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Sunday, March 22, 2020 8:32 PM > > From: Liu Yi L > > This patch adds a module option to make the PASID quota tunable by > administrator. > > TODO: needs to think more on how to make the tuning to be per-process. > > Previous discussions: >

RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter for quota tuning

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Monday, March 30, 2020 4:53 PM > > > From: Tian, Kevin > > Sent: Monday, March 30, 2020 4:41 PM > > To: Liu, Yi L ; alex.william...@redhat.com; > > Subject: RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter > for quota > > tuning > > > > > From: Liu, Yi L

RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter for quota tuning

2020-03-30 Thread Liu, Yi L
> From: Tian, Kevin > Sent: Monday, March 30, 2020 4:41 PM > To: Liu, Yi L ; alex.william...@redhat.com; > Subject: RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter for > quota > tuning > > > From: Liu, Yi L > > Sent: Sunday, March 22, 2020 8:32 PM > > > > From: Liu Yi L > > > >

RE: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free)

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Sunday, March 22, 2020 8:32 PM > > From: Liu Yi L > > For a long time, devices have only one DMA address space from platform > IOMMU's point of view. This is true for both bare metal and directed- > access in virtualization environment. Reason is the source ID of DMA

RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter for quota tuning

2020-03-30 Thread Liu, Yi L
> From: Tian, Kevin > Sent: Monday, March 30, 2020 5:20 PM > To: Liu, Yi L ; alex.william...@redhat.com; > Subject: RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter for > quota > tuning > > > From: Liu, Yi L > > Sent: Monday, March 30, 2020 4:53 PM > > > > > From: Tian, Kevin > >

RE: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to userspace

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Sunday, March 22, 2020 8:32 PM > > From: Liu Yi L > > This patch reports PASID alloc/free availability to userspace (e.g. QEMU) > thus userspace could do a pre-check before utilizing this feature. > > Cc: Kevin Tian > CC: Jacob Pan > Cc: Alex Williamson > Cc: Eric

Re: [PATCH] swiotlb: Allow swiotlb to live at pre-defined address

2020-03-30 Thread Konrad Rzeszutek Wilk
On Mon, Mar 30, 2020 at 02:06:01PM +0800, Kairui Song wrote: > On Sat, Mar 28, 2020 at 7:57 PM Dave Young wrote: > > > > On 03/26/20 at 05:29pm, Alexander Graf wrote: > > > The swiotlb is a very convenient fallback mechanism for bounce buffering > > > of > > > DMAable data. It is usually used

RE: [PATCH v1 6/8] vfio/type1: Bind guest page tables to host

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Sunday, March 22, 2020 8:32 PM > > From: Liu Yi L > > VFIO_TYPE1_NESTING_IOMMU is an IOMMU type which is backed by > hardware > IOMMUs that have nesting DMA translation (a.k.a dual stage address > translation). For such hardware IOMMUs, there are two stages/levels of

Re: [PATCH] swiotlb: Allow swiotlb to live at pre-defined address

2020-03-30 Thread Mark Rutland
On Thu, Mar 26, 2020 at 06:11:31PM +0100, Alexander Graf wrote: > On 26.03.20 18:05, Christoph Hellwig wrote: > > > > On Thu, Mar 26, 2020 at 05:29:22PM +0100, Alexander Graf wrote: > > > The swiotlb is a very convenient fallback mechanism for bounce buffering > > > of > > > DMAable data. It is

RE: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free)

2020-03-30 Thread Liu, Yi L
> From: Tian, Kevin > Sent: Monday, March 30, 2020 4:32 PM > To: Liu, Yi L ; alex.william...@redhat.com; > Subject: RE: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free) > > > From: Liu, Yi L > > Sent: Sunday, March 22, 2020 8:32 PM > > > > From: Liu Yi L > > > > For a long time,

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-03-30 Thread Jacob Pan
On Mon, 30 Mar 2020 05:40:40 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 28, 2020 7:54 AM > > > > On Fri, 27 Mar 2020 00:47:02 -0700 > > Christoph Hellwig wrote: > > > > > On Fri, Mar 27, 2020 at 02:49:55AM +, Tian, Kevin wrote: > > > > If those API calls

Re: [PATCH V10 05/11] iommu/vt-d: Add nested translation helper function

2020-03-30 Thread Jacob Pan
On Sun, 29 Mar 2020 16:03:36 +0800 Lu Baolu wrote: > On 2020/3/27 20:21, Tian, Kevin wrote: > >> From: Jacob Pan > >> Sent: Saturday, March 21, 2020 7:28 AM > >> > >> Nested translation mode is supported in VT-d 3.0 Spec.CH 3.8. > > > > now the spec is already at rev3.1  > > Updated. >

Re: [PATCH] iommu/arm-smmu: Demote error messages to debug in shutdown callback

2020-03-30 Thread Doug Anderson
Hi, On Sat, Mar 28, 2020 at 12:35 AM Sai Prakash Ranjan wrote: > > > Of course the fact that in practice we'll *always* see the warning > > because there's no way to tear down the default DMA domains, and even > > if all devices *have* been nicely quiesced there's no way to tell, is > >

Re: [PATCH V10 03/11] iommu/vt-d: Add a helper function to skip agaw

2020-03-30 Thread Jacob Pan
On Sun, 29 Mar 2020 15:20:55 +0800 Lu Baolu wrote: > On 2020/3/27 19:53, Tian, Kevin wrote: > >> From: Jacob Pan > >> Sent: Saturday, March 21, 2020 7:28 AM > >> > >> Signed-off-by: Jacob Pan > > > > could you elaborate in which scenario this helper function is > > required? > > I added

RE: [PATCH v1 5/8] vfio/type1: Report 1st-level/stage-1 format to userspace

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Sunday, March 22, 2020 8:32 PM > > From: Liu Yi L > > VFIO exposes IOMMU nesting translation (a.k.a dual stage translation) > capability to userspace. Thus applications like QEMU could support > vIOMMU with hardware's nesting translation capability for pass-through >

RE: [PATCH v1 8/8] vfio/type1: Add vSVA support for IOMMU-backed mdevs

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Sunday, March 22, 2020 8:32 PM > > From: Liu Yi L > > Recent years, mediated device pass-through framework (e.g. vfio-mdev) > are used to achieve flexible device sharing across domains (e.g. VMs). are->is > Also there are hardware assisted mediated pass-through

RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter for quota tuning

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Monday, March 30, 2020 5:27 PM > > > From: Tian, Kevin > > Sent: Monday, March 30, 2020 5:20 PM > > To: Liu, Yi L ; alex.william...@redhat.com; > > Subject: RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter > for quota > > tuning > > > > > From: Liu, Yi L

RE: [PATCH v1 7/8] vfio/type1: Add VFIO_IOMMU_CACHE_INVALIDATE

2020-03-30 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Sunday, March 22, 2020 8:32 PM > > From: Liu Yi L > > For VFIO IOMMUs with the type VFIO_TYPE1_NESTING_IOMMU, guest > "owns" the > first-level/stage-1 translation structures, the host IOMMU driver has no > knowledge of first-level/stage-1 structure cache updates

Re: [PATCH] swiotlb: Allow swiotlb to live at pre-defined address

2020-03-30 Thread Kairui Song
On Sat, Mar 28, 2020 at 7:57 PM Dave Young wrote: > > On 03/26/20 at 05:29pm, Alexander Graf wrote: > > The swiotlb is a very convenient fallback mechanism for bounce buffering of > > DMAable data. It is usually used for the compatibility case where devices > > can only DMA to a "low region". > >

[PATCH 1/7] docs: x86: Add a documentation for ENQCMD

2020-03-30 Thread Fenghua Yu
From: Ashok Raj ENQCMD and Data Streaming Accelerator (DSA) and all of their associated features are a complicated stack with lots of interconnected pieces. This documentation provides a big picture overview for all of the features. Signed-off-by: Ashok Raj Co-developed-by: Fenghua Yu

[PATCH 7/7] x86/process: Clear PASID state for a newly forked/cloned thread

2020-03-30 Thread Fenghua Yu
The PASID state has to be cleared on forks, since the child has a different address space. The PASID is also cleared for thread clone. While it would be correct to inherit the PASID in this case, it is unknown whether the new task will use ENQCMD. Giving it the PASID "just in case" would have the

Re: [PATCH] swiotlb: Allow swiotlb to live at pre-defined address

2020-03-30 Thread Alexander Graf via iommu
On 30.03.20 15:40, Konrad Rzeszutek Wilk wrote: On Mon, Mar 30, 2020 at 02:06:01PM +0800, Kairui Song wrote: On Sat, Mar 28, 2020 at 7:57 PM Dave Young wrote: On 03/26/20 at 05:29pm, Alexander Graf wrote: The swiotlb is a very convenient fallback mechanism for bounce buffering of

Re: [PATCH V10 06/11] iommu/vt-d: Add bind guest PASID support

2020-03-30 Thread Jacob Pan
On Sat, 28 Mar 2020 08:02:01 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 21, 2020 7:28 AM > > > > When supporting guest SVA with emulated IOMMU, the guest PASID > > table is shadowed in VMM. Updates to guest vIOMMU PASID table > > will result in PASID cache flush

[PATCH 4/7] x86/msr-index: Define IA32_PASID MSR

2020-03-30 Thread Fenghua Yu
The IA32_PASID MSR (0xd93) contains the Process Address Space Identifier (PASID), a 20-bit value. Bit 31 must be set to indicate the value programmed in the MSR is valid. Hardware uses PASID to identify which process submits the work and direct responses to the right process. Signed-off-by:

[PATCH 0/7] x86: tag application address space for devices

2020-03-30 Thread Fenghua Yu
Typical hardware devices require a driver stack to translate application buffers to hardware addresses, and a kernel-user transition to notify the hardware of new work. What if both the translation and transition overhead could be eliminated? This is what Shared Virtual Address (SVA) and ENQCMD

[PATCH 3/7] x86/fpu/xstate: Add supervisor PASID state for ENQCMD feature

2020-03-30 Thread Fenghua Yu
From: Yu-cheng Yu The IA32_PASID MSR is used when a task submits work via the ENQCMD instruction. The per task MSR is stored in the task's supervisor FPU PASID state and is context switched by XSAVES/XRSTORS. Signed-off-by: Yu-cheng Yu Co-developed-by: Fenghua Yu Signed-off-by: Fenghua Yu

[PATCH 5/7] x86/mmu: Allocate/free PASID

2020-03-30 Thread Fenghua Yu
PASID is shared by all threads in a process. So the logical place to keep track of it is in the "mm". Add the field to the architecture specific mm_context_t structure. A PASID is allocated for an "mm" the first time any thread attaches to an SVM capable device. Later device atatches (whether to

[PATCH 6/7] x86/traps: Fix up invalid PASID

2020-03-30 Thread Fenghua Yu
A #GP fault is generated when ENQCMD instruction is executed without a valid PASID value programmed in. The #GP fault handler will initialize the current thread's PASID MSR. The following heuristic is used to avoid decoding the user instructions to determine the precise reason for the #GP fault:

[PATCH 2/7] x86/cpufeatures: Enumerate ENQCMD and ENQCMDS instructions

2020-03-30 Thread Fenghua Yu
A user space application can execute ENQCMD instruction to submit work to device. The kernel executes ENQCMDS instruction to submit work to device. There is a lot of other enabling needed for the instructions to actually be usable in user space and the kernel, and that enabling is coming later in