Re: PROBLEM: intel_iommu=on under 4.13 breaks resume from suspend on my Thinkpad T560

2017-09-28 Thread Lu Baolu
ation > etc again to reinitialize those states. > > will have someone look into it soon. I will look into it. But we will have a holiday till Oct. 8. We probably won't see any progress before I am back. Best regards, Lu Baolu > > > Cheers, > Ashok > > On Thu, Sep 28, 2017

[PATCH 2/3] iommu/vt-d: Clear Page Request Overflow fault bit

2017-10-18 Thread Lu Baolu
Currently Page Request Overflow bit in IOMMU Fault Status register is not cleared. Not clearing this bit would mean that any future page-request is going to be automatically dropped by IOMMU. Suggested-by: Ashok Raj <ashok@intel.com> Signed-off-by: Lu Baolu <baolu...@linux.

[PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails

2017-10-18 Thread Lu Baolu
intel_svm_alloc_pasid_tables() might return an error but never be checked by the callers. Later when intel_svm_bind_mm() is called, there are no checks for valid pasid tables before enabling them. Signed-off-by: Ashok Raj <ashok@intel.com> Signed-off-by: Lu Baolu <baolu...@linux.

[PATCH 3/3] iommu/vt-d: Clear pasid table entry when memory unbound

2017-10-18 Thread Lu Baolu
In intel_svm_unbind_mm(), pasid table entry must be cleared during svm free. Otherwise, hardware may be set up with a wild pointer. Suggested-by: Ashok Raj <ashok@intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- drivers/iommu/intel-svm.c | 2 ++ 1 file changed,

Re: [PATCH v3 07/16] iommu/vt-d: assign PFSID in device TLB invalidation

2017-12-04 Thread Lu Baolu
ed, which should be set to 0. > + */ > + if (!ecap_dit(info->iommu->ecap)) > + info->pfsid = 0; > + else if (pdev && pdev->is_virtfn) { > + if (ecap_dit(info->iommu->ecap)) Isn't this condition always true when it comes here

Re: [PATCH v3 06/16] iommu/vt-d: add svm/sva invalidate function

2017-12-04 Thread Lu Baolu
int iommu_prot) > @@ -5304,7 +5481,7 @@ static int intel_iommu_bind_pasid_table(struct > iommu_domain *domain, > iommu = device_to_iommu(dev, , ); > if (!iommu) > return -ENODEV; > - /* VT-d spec 9.4 says pasid table size is encoded as 2^(x+5) */ &

Re: [PATCH v3 13/16] iommu/intel-svm: notify page request to guest

2017-12-04 Thread Lu Baolu
; sdev = NULL; > > - if (sdev && sdev->ops && sdev->ops->fault_cb) { > - int rwxp = (req->rd_req << 3) | (req->wr_req << 2) | > - (req->exe_req <

Re: [PATCH v3 10/16] iommu: introduce device fault report API

2017-12-04 Thread Lu Baolu
gt; +EXPORT_SYMBOL_GPL(iommu_unregister_device_fault_handler); > + > + > +int iommu_report_device_fault(struct device *dev, struct iommu_fault_event > *evt) > +{ > + /* we only report device fault if there is a handler registered */ > + if (!dev->iommu_param || !dev-&

Re: [PATCH v3 12/16] iommu/vt-d: report unrecoverable device faults

2017-12-04 Thread Lu Baolu
Hi, On 11/18/2017 02:55 AM, Jacob Pan wrote: > Currently, when device DMA faults are detected by IOMMU the fault > reasons are printed but the driver of the offending device is "... but the driver of the offending device is not involved in ..." Best regards, Lu Baolu >

Re: [PATCH 1/2] mm: Add kernel MMU notifier to manage IOTLB/DEVTLB

2017-12-13 Thread Lu Baolu
Hi, On 12/14/2017 11:10 AM, Bob Liu wrote: > On 2017/12/14 9:02, Lu Baolu wrote: >> > From: Huang Ying <ying.hu...@intel.com> >> > >> > Shared Virtual Memory (SVM) allows a kernel memory mapping to be >> > shared between CPU and and a device which re

[PATCH 2/2] iommu/vt-d: Register kernel MMU notifier to manage IOTLB/DEVTLB

2017-12-13 Thread Lu Baolu
m> Cc: Vegard Nossum <vegard.nos...@oracle.com> Cc: x...@kernel.org Cc: linux...@kvack.org Cc: iommu@lists.linux-foundation.org Cc: David Woodhouse <dw...@infradead.org> CC: Jean-Phillipe Brucker <jean-philippe.bruc...@arm.com> Signed-off-by: Ashok

[PATCH 1/2] mm: Add kernel MMU notifier to manage IOTLB/DEVTLB

2017-12-13 Thread Lu Baolu
: Vegard Nossum <vegard.nos...@oracle.com> Cc: x...@kernel.org Cc: linux...@kvack.org Tested-by: CQ Tang <cq.t...@intel.com> Signed-off-by: Huang Ying <ying.hu...@intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- arch/x86/mm/tlb.c| 2 ++ include/l

[PATCH 0/2] Kernel MMU notifier for IOTLB/DEVTLB management

2017-12-13 Thread Lu Baolu
Shared Virtual Memory (SVM) allows a kernel memory mapping to be shared between CPU and and a device which requested a supervisor PASID. Both devices and IOMMU units have TLBs that cache entries from CPU's page tables. We need to get a chance to flush them at the same time when we flush the CPU

Re: [PATCH v3 2/6] iommu/vt-d: Add Intel IOMMU debugfs to show context internals

2017-12-12 Thread Lu Baolu
Hi, Sorry for late reply. On 12/08/2017 04:19 AM, Mehta, Sohil wrote: > On Wed, 2017-12-06 at 16:16 +0800, Lu Baolu wrote: >> Hi, >> >> On 12/06/2017 11:43 AM, Sohil Mehta wrote: >>> From: Gayatri Kammela <gayatri.kamm...@intel.com> >>> >>

Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails

2017-11-06 Thread Lu Baolu
Hi, On 11/07/2017 04:13 AM, Alex Williamson wrote: > On Thu, 19 Oct 2017 08:39:14 +0800 > Lu Baolu <baolu...@linux.intel.com> wrote: > >> intel_svm_alloc_pasid_tables() might return an error but never be >> checked by the callers. Later when intel_svm_bind_mm() is cal

Re: [PATCH v3 2/6] iommu/vt-d: Add Intel IOMMU debugfs to show context internals

2017-12-06 Thread Lu Baolu
Hi, On 12/06/2017 11:43 AM, Sohil Mehta wrote: > From: Gayatri Kammela > > IOMMU internals states such as root and context can be exported to the > userspace. > > Example of such dump in Kabylake: > > root@OTC-KBLH-01:~# cat >

Re: [PATCH v3 3/6] iommu/vt-d: Add Intel IOMMU debugfs to show extended context internals

2017-12-06 Thread Lu Baolu
High > [80]:00:0a.00 4016f3a05 102 > Higher Context tbl entries for Bus: 0 Do you mind changing "tbl entries" to "table entries" so that it could be consistent with above lower one? Best regards, Lu Baolu > [80]:00:0a.00 4015c 671b800

Re: [PATCH v3 3/6] iommu/vt-d: Add Intel IOMMU debugfs to show extended context internals

2017-12-06 Thread Lu Baolu
ctx, iommu->segment, bus, PCI_SLOT(ctx), > PCI_FUNC(ctx), context[0].lo, context[0].hi); > + > + ext_ctx_tbl_entry_show(m, unused, iommu, bus, ctx, > +context, new_ext); How about + if (new_ext) + ext_ctx_tbl_entry_show(m, unused, iommu, bus, ctx, context); and remove checking new_ext in ext_ctx_tbl_entry_show()? Best regards, Lu Baolu ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

[PATCH 4/4] iommu/vt-d: Remove unnecessary parentheses

2018-05-03 Thread Lu Baolu
Remove unnecessary parentheses to comply with preferred coding style. Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- drivers/iommu/intel-svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index e8cd984..4

[PATCH 1/4] iommu: Clean up the comments for iommu_group_alloc

2018-05-03 Thread Lu Baolu
@name parameter has been removed. Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- drivers/iommu/iommu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index d2aa2320..d87e7c2 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/i

Re: [PATCH v5 14/23] iommu: introduce page response function

2018-05-14 Thread Lu Baolu
page_req_group_id == evt->page_req_group_id) { > + msg->private_data = evt->iommu_private; > + ret = domain->ops->page_response(dev, msg); > + list_del(>list); > + kfree(evt); > +

Re: [PATCH v5 11/23] driver core: add per device iommu param

2018-05-13 Thread Lu Baolu
is to create a parent pointer under device struct and move previous iommu_group and iommu_fwspec together with the iommu fault related data into it. Best regards, Lu Baolu > > Suggested-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> > Reviewed-by: Greg Kroah-Hartman <gre...@linu

Re: [PATCH v5 15/23] iommu: handle page response timeout

2018-05-14 Thread Lu Baolu
1, F2, F3 timeout won't be handled until the timer expires again at 20s. That means a fault might be pending there until about (2 * prq_timeout) seconds later. Out of curiosity, Why not adding a timer in iommu_fault_event, starting it in iommu_report_device_fault() and removing it in iommu_page_response()? Best regards, Lu B

Re: [PATCH v5 17/23] iommu/vt-d: report non-recoverable faults to device

2018-05-14 Thread Lu Baolu
ble_iommu; > } > #endif > - ret = dmar_set_interrupt(iommu); > + ret = dmar_set_interrupt(iommu, true); > if (ret) > goto disable_iommu; > > diff --git a/include/linux/dmar.h b/include/linux/dmar.h > index e2433bc..21f2162 100644 > --- a/in

Re: [PATCH v5 13/23] iommu: introduce device fault report API

2018-05-14 Thread Lu Baolu
r_t handler, > + void *data); > + > +extern int iommu_unregister_device_fault_handler(struct device *dev); > + > +extern int iommu_report_device_fault(struct device *dev, struct > iommu_fault_event *evt); > + > extern int iommu_group_id(struct iommu_group *group); > extern struct iommu_group *iommu_group_get_for_dev(struct device *dev); > extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *); > @@ -727,6 +741,23 @@ static inline int iommu_group_unregister_notifier(struct > iommu_group *group, > return 0; > } > > +static inline int iommu_register_device_fault_handler(struct device *dev, > + iommu_dev_fault_handler_t > handler, > + void *data) > +{ > + return -ENODEV; > +} > + > +static inline int iommu_unregister_device_fault_handler(struct device *dev) > +{ > + return 0; > +} > + > +static inline int iommu_report_device_fault(struct device *dev, struct > iommu_fault_event *evt) > +{ > + return -ENODEV; > +} > + > static inline int iommu_group_id(struct iommu_group *group) > { > return -ENODEV; Best regards, Lu Baolu ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v5 09/23] iommu/vt-d: add svm/sva invalidate function

2018-05-13 Thread Lu Baolu
> +out_unlock: > + spin_unlock(>lock); > + spin_unlock_irqrestore(_domain_lock, flags); > + > + return ret; > +} > + > static int intel_iommu_map(struct iommu_domain *domain, > unsigned long iova, phys_addr_t hpa, > size_t size, int iommu_prot) > @@ -5401,6 +5529,7 @@ const struct iommu_ops intel_iommu_ops = { > #ifdef CONFIG_INTEL_IOMMU_SVM > .bind_pasid_table = intel_iommu_bind_pasid_table, > .unbind_pasid_table = intel_iommu_unbind_pasid_table, > + .sva_invalidate = intel_iommu_sva_invalidate, > #endif > .map= intel_iommu_map, > .unmap = intel_iommu_unmap, Best regards, Lu Baolu ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v5 13/23] iommu: introduce device fault report API

2018-05-15 Thread Lu Baolu
Hi, On 05/15/2018 04:55 AM, Jacob Pan wrote: > On Mon, 14 May 2018 14:01:06 +0800 > Lu Baolu <baolu...@linux.intel.com> wrote: > >> Hi, >> >> On 05/12/2018 04:54 AM, Jacob Pan wrote: >>> Traditionally, device specific faults are detected and handled >&

Re: [PATCH v5 04/23] iommu/vt-d: add bind_pasid_table function

2018-05-13 Thread Lu Baolu
iommu_ops = { > .domain_free= intel_iommu_domain_free, > .attach_dev = intel_iommu_attach_device, > .detach_dev = intel_iommu_detach_device, > +#ifdef CONFIG_INTEL_IOMMU_SVM > + .bind_pasid_table = intel_iommu_bind_pasid_table, &g

Re: [PATCH v5 03/23] iommu/vt-d: add a flag for pasid table bound status

2018-05-13 Thread Lu Baolu
nabled:1; > u8 ats_supported:1; > u8 ats_enabled:1; > + u8 pasid_table_bound:1; Can you please add some comments here? So that, people can understand the purpose for this bit exactly. Best regards, Lu Baolu > u8 ats_qdep; > u64 fault_mask; /* selected IOMMU fa

Re: [PATCH v5 03/23] iommu/vt-d: add a flag for pasid table bound status

2018-05-13 Thread Lu Baolu
Hi, On 05/12/2018 04:53 AM, Jacob Pan wrote: > Adding a flag in device domain into to track whether a guest or typo: ^^info Best regards, Lu Baolu > user PASID table is bound to a device. > > Signed-off-by: Jacob Pan <jacob.jun@

Re: [PATCH v5 06/23] iommu/vt-d: add definitions for PFSID

2018-05-13 Thread Lu Baolu
struct list_head global; /* link to global list */ > u8 bus; /* PCI bus number */ > u8 devfn; /* PCI devfn number */ > + u16 pfsid; /* SRIOV physical function source ID */ > u8 pasid_supported:3; > u8 pasid_enabled:1; > u8 pri_supported:1; Best regards, Lu Baolu ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v5 07/23] iommu/vt-d: fix dev iotlb pfsid use

2018-05-13 Thread Lu Baolu
unsigned int size_order, u64 type); > -extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep, > - u64 addr, unsigned mask); > - > +extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid, > +

Re: [PATCH v5 08/23] iommu/vt-d: support flushing more translation cache types

2018-05-13 Thread Lu Baolu
struct intel_iommu *iommu, u16 sid, u16 pfsid, > u16 qdep, u64 addr, unsigned mask); > + > +extern void qi_flush_dev_eiotlb(struct intel_iommu *iommu, u16 sid, > + u32 pasid, u16 qdep, u64 addr, unsigned size, u64 > granu); > +extern void qi_flush_pasid(struct intel_iommu *iommu, u16 did, u64 granu, > int pasid); > + > extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); > > extern int dmar_ir_support(void); Best regards, Lu Baolu ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v2 0/9] iommu/vt-d: Improve PASID id and table management

2018-05-16 Thread Lu Baolu
Hi Joerg, Thank you for looking at my patches. On 05/15/2018 10:11 PM, Joerg Roedel wrote: > On Fri, May 04, 2018 at 09:41:15AM +0800, Lu Baolu wrote: >> PATCH 4~9 implement per domain PASID table. Current per IOMMU >> PASID table implementation is insecure in the cases where >

Re: [PATCH v2 0/9] iommu/vt-d: Improve PASID id and table management

2018-05-16 Thread Lu Baolu
Hi, On 05/16/2018 04:56 PM, Tian, Kevin wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Wednesday, May 16, 2018 4:01 PM >> >> Hi Joerg, >> >> Thank you for looking at my patches. >> >> On 05/15/2018 10:11 PM, Joerg Roedel wrote:

[PATCH 1/1] iommu/vt-d: Remove unnecessary WARN_ON()

2018-06-18 Thread Lu Baolu
: DR2: [3.790904] DR3: DR6: fffe0ff0 DR7: 0400 This is caused by a unnecessary WARN_ON() in intel_svm_bind_mm(). Hence, remove it. Signed-off-by: Lu Baolu --- drivers/iommu/intel-svm.c | 2 +- 1 file changed, 1 insertion

[PATCH v3 7/9] iommu/vt-d: Allocate and free pasid table

2018-06-18 Thread Lu Baolu
This patch allocates a PASID table for a PCI device at the time when the dmar dev_info is attached to dev->archdata.iommu, and free it in the opposite case. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Liu Yi L --- drivers/iommu/intel-iomm

[PATCH v3 9/9] iommu/vt-d: Remove the obsolete per iommu pasid tables

2018-06-18 Thread Lu Baolu
The obsolete per iommu pasid tables are no longer used. Hence, clean up them. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Liu Yi L --- drivers/iommu/intel-iommu.c | 6 +++--- drivers/iommu/intel-svm.c | 17 ++--- include/linux

[PATCH v3 8/9] iommu/vt-d: Apply per pci device pasid table in SVA

2018-06-18 Thread Lu Baolu
This patch applies the per pci device pasid table in the Shared Virtual Address (SVA) implementation. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Liu Yi L --- drivers/iommu/intel-iommu.c | 29 + drivers/iommu

Re: [PATCH v2 0/9] iommu/vt-d: Improve PASID id and table management

2018-05-29 Thread Lu Baolu
Hi, On 05/29/2018 07:56 PM, Joerg Roedel wrote: > On Wed, May 16, 2018 at 04:01:00PM +0800, Lu Baolu wrote: >> You are right. System-wide pasid space is necessary, hence PATCH >> 1~3 implement it. But PATCH 4~9 don't go into the opposite direction, >> it's designed to addr

Re: [PATCH v5 15/23] iommu: handle page response timeout

2018-05-30 Thread Lu Baolu
Hi, On 05/30/2018 12:20 AM, Jacob Pan wrote: > On Mon, 14 May 2018 15:43:54 +0800 > Lu Baolu wrote: > >> Hi, >> >> On 05/12/2018 04:54 AM, Jacob Pan wrote: >>> When IO page faults are reported outside IOMMU subsystem, the page >>> request handl

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
gisters full of faults, hence new faults will be dropped without logging? And even worse, new faults will not generate interrupts? Best regards, Lu Baolu > > Cc: Alex Williamson <alex.william...@redhat.com> > Cc: David Woodhouse <dw...@infradead.org> > Cc: Ingo Molnar <

Re: [PATCH 8/9] iommu/vt-d: Use per-domain pasid table

2018-05-01 Thread Lu Baolu
Hi, On 05/01/2018 05:23 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Tuesday, April 17, 2018 11:03 AM >> >> This patch replaces current per iommu pasid table with >> the new added per domain pasid table. Each svm-capable >>

Re: [PATCH 6/9] iommu/vt-d: Allocate and free pasid table

2018-05-01 Thread Lu Baolu
Hi, On 05/01/2018 05:22 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Tuesday, April 17, 2018 11:03 AM >> >> This patch allocates PASID table for a domain at the time when >> it is being created (if any devices using this do

Re: [PATCH 5/9] iommu/vt-d: Per domain pasid table interfaces

2018-05-01 Thread Lu Baolu
Hi Yi, Thank you very much for reviewing my patches. On 05/01/2018 05:22 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Tuesday, April 17, 2018 11:03 AM >> >> This patch adds the interfaces for per domain pasid table >> managem

Re: [PATCH 9/9] iommu/vt-d: Clean up PASID talbe management for SVM

2018-05-01 Thread Lu Baolu
Hi, On 05/01/2018 05:24 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Tuesday, April 17, 2018 11:03 AM >> >> The previous per iommu pasid table alloc/free interfaces >> are no longer used. Clean up the driver by removing it. >

Re: [RESEND][PATCH] iommu/vt-d: fix shift-out-of-bounds in bug checking

2018-05-02 Thread Lu Baolu
> > [3.932382] cpuidle_enter_state+0xb4/0x470 > [3.936558] do_idle+0x222/0x310 > [3.939779] cpu_startup_entry+0x78/0x90 > [3.943693] start_secondary+0x205/0x2e0 > [3.947607] secondary_startup_64+0xa5/0xb0 > [3.951783] >

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/02/2018 08:38 PM, Dmitry Safonov wrote: > Hi Lu, > > On Wed, 2018-05-02 at 14:34 +0800, Lu Baolu wrote: >> Hi, >> >> On 03/31/2018 08:33 AM, Dmitry Safonov wrote: >>> Theoretically, on some machines faults might be generated faster >>> than

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/03/2018 08:52 AM, Dmitry Safonov wrote: > On Thu, 2018-05-03 at 07:49 +0800, Lu Baolu wrote: >> Hi, >> >> On 05/02/2018 08:38 PM, Dmitry Safonov wrote: >>> Hi Lu, >>> >>> On Wed, 2018-05-02 at 14:34 +0800, Lu Baolu wrote: >>>>

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/03/2018 09:59 AM, Dmitry Safonov wrote: > On Thu, 2018-05-03 at 09:32 +0800, Lu Baolu wrote: >> Hi, >> >> On 05/03/2018 08:52 AM, Dmitry Safonov wrote: >>> AFAICS, we're doing fault-clearing in a loop inside irq handler. >>> That means that while

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/03/2018 10:16 AM, Lu Baolu wrote: > Hi, > > On 05/03/2018 09:59 AM, Dmitry Safonov wrote: >> On Thu, 2018-05-03 at 09:32 +0800, Lu Baolu wrote: >>> Hi, >>> >>> On 05/03/2018 08:52 AM, Dmitry Safonov wrote: >>>> AFAICS, w

Re: [PATCHv4 2/2] iommu/vt-d: Limit number of faults to clear in irq handler

2018-05-02 Thread Lu Baolu
Hi, On 05/03/2018 10:34 AM, Dmitry Safonov wrote: > On Thu, 2018-05-03 at 10:16 +0800, Lu Baolu wrote: >> Hi, >> >> On 05/03/2018 09:59 AM, Dmitry Safonov wrote: >>> On Thu, 2018-05-03 at 09:32 +0800, Lu Baolu wrote: >>>> Hi, >>>> >>&

[PATCH v2 4/9] iommu/vt-d: Move device_domain_info to header

2018-05-03 Thread Lu Baolu
This allows the per device iommu data to be accessed from other files. Cc: Ashok Raj <ashok@intel.com> Cc: Jacob Pan <jacob.jun@linux.intel.com> Cc: Kevin Tian <kevin.t...@intel.com> Cc: Liu Yi L <yi.l@intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel

[PATCH v2 1/9] iommu/vt-d: Global PASID name space

2018-05-03 Thread Lu Baolu
reside behind two different IOMMU units. Cc: Ashok Raj <ashok@intel.com> Cc: Jacob Pan <jacob.jun@linux.intel.com> Cc: Kevin Tian <kevin.t...@intel.com> Cc: Liu Yi L <yi.l@intel.com> Suggested-by: Ashok Raj <ashok@intel.com> Signed-off-by: Lu B

[PATCH v2 3/9] iommu/vt-d: Use global PASID for SVM usage

2018-05-03 Thread Lu Baolu
This patch switches PASID management for SVM from per iommu idr to the global idr. Cc: Ashok Raj <ashok@intel.com> Cc: Jacob Pan <jacob.jun@linux.intel.com> Cc: Kevin Tian <kevin.t...@intel.com> Cc: Liu Yi L <yi.l@intel.com> Signed-off-by: Lu Baolu <baolu..

[PATCH v2 2/9] iommu/vt-d: Decouple idr bond pointer from svm

2018-05-03 Thread Lu Baolu
code. It's required to replace the SVM-specific idr with the global PASID idr. Cc: Ashok Raj <ashok@intel.com> Cc: Jacob Pan <jacob.jun@linux.intel.com> Cc: Kevin Tian <kevin.t...@intel.com> Cc: Liu Yi L <yi.l@intel.com> Signed-off-by: Lu Baolu <baolu..

[PATCH v2 0/9] iommu/vt-d: Improve PASID id and table management

2018-05-03 Thread Lu Baolu
achieve finer protection and isolation granularity. Best regards, Lu Baolu Change log: v1->v2: - Patches have been reviewed by "Liu Yi L <yi.l@intel.com>". - An error case handling was added in PATCH 6/9. - Some commit messages are refined to be more accurate. Lu Baol

[PATCH v2 7/9] iommu/vt-d: Calculate PTS value

2018-05-03 Thread Lu Baolu
Calculate PTS (PASID Table Size) value for the extended context entry from the real size of the PASID table for a domain. Cc: Ashok Raj <ashok@intel.com> Cc: Jacob Pan <jacob.jun@linux.intel.com> Cc: Kevin Tian <kevin.t...@intel.com> Cc: Liu Yi L <yi.l@intel.c

[PATCH v2 8/9] iommu/vt-d: Use per-domain pasid table

2018-05-03 Thread Lu Baolu
jacob.jun@linux.intel.com> Cc: Kevin Tian <kevin.t...@intel.com> Cc: Liu Yi L <yi.l@intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> Reviewed-by: Liu Yi L <yi.l@intel.com> --- drivers/iommu/intel-iommu.c | 6 +++--- drivers/iommu/intel-svm.c | 37

[PATCH v2 6/9] iommu/vt-d: Allocate and free pasid table

2018-05-03 Thread Lu Baolu
ian <kevin.t...@intel.com> Cc: Liu Yi L <yi.l@intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> Reviewed-by: Liu Yi L <yi.l@intel.com> --- drivers/iommu/intel-iommu.c | 19 +++ drivers/iommu/intel-svm.c | 8 include/linux/intel-iommu.h

[PATCH v2 5/9] iommu/vt-d: Per domain pasid table interfaces

2018-05-03 Thread Lu Baolu
finer protection and isolation granularity. Cc: Ashok Raj <ashok@intel.com> Cc: Jacob Pan <jacob.jun@linux.intel.com> Cc: Kevin Tian <kevin.t...@intel.com> Cc: Liu Yi L <yi.l@intel.com> Suggested-by: Ashok Raj <ashok@intel.com> Signed-off-by: Lu B

[PATCH v2 9/9] iommu/vt-d: Clean up PASID talbe management for SVM

2018-05-03 Thread Lu Baolu
The previous per iommu pasid table alloc/free interfaces are no longer used. Clean up the driver by removing it. Cc: Ashok Raj <ashok@intel.com> Cc: Jacob Pan <jacob.jun@linux.intel.com> Cc: Kevin Tian <kevin.t...@intel.com> Cc: Liu Yi L <yi.l@intel.com> Signed

Re: [PATCH v3 0/2] iommu/vt-d: Fix mapping PSI missing for iommu_map()

2018-05-04 Thread Lu Baolu
n mapping > will trigger the MAP PSI notifications. > > Without the patchset, nested device assignment (assign one device > firstly to L1 guest, then to L2 guest) won't work for QEMU. After > applying the patchset, it works. > > Please review. Thanks. Both patches l

[PATCH 2/4] iommu/vt-d: Clean up unused variable in find_or_alloc_domain

2018-05-03 Thread Lu Baolu
Remove it to make the code more concise. Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- drivers/iommu/intel-iommu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 749d8f2..9064607 100644 --- a/d

[PATCH 3/4] iommu/vt-d: Clean up pasid quirk for pre-production devices

2018-05-03 Thread Lu Baolu
The pasid28 quirk is needed only for some pre-production devices. Remove it to make the code concise. Signed-off-by: Ashok Raj <ashok@intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- drivers/iommu/intel-iommu.c | 32 ++-- include

[PATCH 0/4] iommu/vt-d: Several cleanup patches

2018-05-03 Thread Lu Baolu
Hi, This includes several cleanup patches which aim to make the code more concise and easier for reading. There aren't any functionality changes. Best regards, Lu Baolu Lu Baolu (4): iommu: Clean up the comments for iommu_group_alloc iommu/vt-d: Clean up unused variable

Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails

2017-10-19 Thread Lu Baolu
Hi Yi, On 10/19/2017 02:40 PM, Liu, Yi L wrote: > >> -Original Message- >> From: iommu-boun...@lists.linux-foundation.org [mailto:iommu- >> boun...@lists.linux-foundation.org] On Behalf Of Lu Baolu >> Sent: Thursday, October 19, 2017 8:39 AM >> To: j..

[PATCH 1/1] iommu/vt-d: Fix a potential memory leak

2018-02-23 Thread Lu Baolu
A memory block was allocated in intel_svm_bind_mm() but never freed in a failure path. This patch fixes this by free it to avoid memory leakage. Cc: Ashok Raj <ashok@intel.com> Cc: Jacob Pan <jacob.jun@linux.intel.com> Cc: <sta...@vger.kernel.org> # v4.4+ Signed-off-b

[PATCH v3 6/9] iommu/vt-d: Per PCI device pasid table interfaces

2018-06-18 Thread Lu Baolu
, we can achieve finer protection and isolation granularity. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Ashok Raj Signed-off-by: Lu Baolu Reviewed-by: Liu Yi L --- drivers/iommu/intel-iommu.c | 1 + drivers/iommu/intel-pasid.c | 178

[PATCH v3 5/9] iommu/vt-d: Add for_each_device_domain() helper

2018-06-18 Thread Lu Baolu
This adds a helper named for_each_device_domain() to iterate over the elements in device_domain_list and invoke a callback against each element. This allows to search the device_domain list in other source files. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu

[PATCH v3 0/9] iommu/vt-d: Improve PASID id and table management

2018-06-18 Thread Lu Baolu
achieve finer protection and isolation granularity. This has been discussed at https://lkml.org/lkml/2018/5/16/154. Best regards, Lu Baolu Change log: v1->v2: - Patches have been reviewed by "Liu Yi L ". - An error case handling was added in PATCH 6/9. - Some commit message

[PATCH v3 1/9] iommu/vt-d: Global PASID name space

2018-06-18 Thread Lu Baolu
reside behind two different IOMMU units. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Ashok Raj Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian Reviewed-by: Liu Yi L --- drivers/iommu/Makefile | 2 +- drivers/iommu/intel-iommu.c | 13 ++ drivers

[PATCH v3 4/9] iommu/vt-d: Move device_domain_info to header

2018-06-18 Thread Lu Baolu
This allows the per device iommu data and some helpers to be used in other files. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Liu Yi L --- drivers/iommu/intel-iommu.c | 62 +++-- include/linux/intel

[PATCH v3 3/9] iommu/vt-d: Apply global PASID in SVA

2018-06-18 Thread Lu Baolu
This patch applies the global pasid name space in the shared virtual address (SVA) implementation. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian Reviewed-by: Liu Yi L --- drivers/iommu/intel-svm.c | 22

[PATCH v3 2/9] iommu/vt-d: Avoid using idr_for_each_entry()

2018-06-18 Thread Lu Baolu
idr_for_each_entry() is used to iteratte over idr elements of a given type. It isn't suitable for the globle pasid idr since the pasid idr consumer could specify different types of pointers to bind with a pasid. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu

Re: Borken IOMMU+i915

2018-07-15 Thread Lu Baolu
Hi Peter, There is already a patch to revert that broken patch. https://patchwork.kernel.org/patch/10513017/ Best regards, Lu Baolu On 07/15/2018 04:29 PM, peter.ch...@data61.csiro.au wrote: > Hi Lu, > In recent kernels, i915 graphics with intel_iommu=on has been >

Re: [PATCH 1/1] Revert "iommu/vt-d: Clean up pasid quirk for pre-production devices"

2018-07-16 Thread Lu Baolu
Hi Joerg, The graphic guys are looking forward to having this in 4.18. Is it possible to take it in the following rcs? Best regards, Lu Baolu On 07/08/2018 02:23 PM, Lu Baolu wrote: > This reverts commit ab96746aaa344fb720a198245a837e266fad3b62. > > The commit ab96746aaa34 ("iom

[PATCH 04/10] iommu/vt-d: Add second level page table interface

2018-07-16 Thread Lu Baolu
This adds an interface to setup the structures for second level page table translation type. This includes the types of second level translation only and pass through. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu Reviewed

[PATCH 05/10] iommu/vt-d: Setup pasid entry for RID2PASID support

2018-07-16 Thread Lu Baolu
use the PASID 0 as a sort of design decision. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-iommu.c | 10 ++ drivers/iommu/intel-pasid.h | 1 + 2 files changed, 11 insertions

[PATCH 10/10] iommu/vt-d: Remove deferred invalidation

2018-07-16 Thread Lu Baolu
Deferred invalidation is an ECS specific feature. It will not be supported when IOMMU works in scalable mode. As we deprecated the ECS support, remove deferred invalidation and cleanup the code. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed

[PATCH 01/10] iommu/vt-d: Enumerate the scalable mode capability

2018-07-16 Thread Lu Baolu
). This patch adds enumeration for Scalable Mode and removes the deprecated ECS enumeration. It provides a boot time option to disable scalable mode in case it's required as a chicken bit option. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu

[PATCH 02/10] iommu/vt-d: Manage scalalble mode PASID tables

2018-07-16 Thread Lu Baolu
table entry according to the pasid value. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-iommu.c | 2 +- drivers/iommu/intel-pasid.c | 72 +++-- d

[PATCH 08/10] iommu/vt-d: Add first level page table interface

2018-07-16 Thread Lu Baolu
This adds an interface to setup the structures for first level page table translation type. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-pasid.c | 65

[PATCH 09/10] iommu/vt-d: Shared virtual address in scalable mode

2018-07-16 Thread Lu Baolu
This patch enables the current SVA (Shared Virtual Address) implementation to work in the scalable mode. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-iommu.c | 38

[PATCH 00/10] iommu/vt-d: Add scalable mode support

2018-07-16 Thread Lu Baolu
es/lc32018/00/LC3-SIOV-final.pdf [4] https://lkml.org/lkml/2018/7/14/69 Best regards, Lu Baolu Lu Baolu (10): iommu/vt-d: Enumerate the scalable mode capability iommu/vt-d: Manage scalalble mode PASID tables iommu/vt-d: Move page table helpers into header iommu/vt-d: Add second level page ta

[PATCH 03/10] iommu/vt-d: Move page table helpers into header

2018-07-16 Thread Lu Baolu
So that they could also be used in other source files. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-iommu.c | 43 --- include/linux/intel-iommu.h | 43

[PATCH 06/10] iommu/vt-d: Pass pasid table to context mapping

2018-07-16 Thread Lu Baolu
So that the pasid related info, such as the pasid table and the maximum of pasid could be used during setting up scalable mode context. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-iommu.c | 14

[PATCH 07/10] iommu/vt-d: Setup context and enable RID2PASID support

2018-07-16 Thread Lu Baolu
This patch enables the translation for requests without PASID in the scalable mode by setting up the root and context entries. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu Reviewed-by: Ashok Raj --- drivers/iommu/intel-iommu.c

Re: [RFC PATCH 02/10] iommu/vt-d: Alloc domain for a mediated device

2018-07-23 Thread Lu Baolu
Hi, On 07/23/2018 12:44 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Sunday, July 22, 2018 2:09 PM >> >> The PASID-granular 2nd level address translation makes it possible to >> isolate and >> protect a mediated device ex

Re: [RFC PATCH 01/10] iommu/vt-d: Get iommu device for a mediated device

2018-07-23 Thread Lu Baolu
g for reviewers. Please check below. > > Thanks, > Yi Liu > >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Sunday, July 22, 2018 2:09 PM >> >> This patch adds the support to get the iommu device for a mediated device. >> The >> assu

Re: [RFC PATCH 03/10] iommu/vt-d: Allocate groups for mediated devices

2018-07-23 Thread Lu Baolu
Hi, On 07/23/2018 12:44 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Sunday, July 22, 2018 2:09 PM >> >> With the Intel IOMMU supporting PASID granularity isolation and protection, a >> mediated device could be isolated and prote

Re: [RFC PATCH 05/10] iommu/vt-d: Setup DMA remapping for mediated devices

2018-07-23 Thread Lu Baolu
Hi, On 07/23/2018 12:44 PM, Liu, Yi L wrote: >> From: Lu Baolu [mailto:baolu...@linux.intel.com] >> Sent: Sunday, July 22, 2018 2:09 PM >> >> This configures the second level page table when external components request >> to >> allocate a domain for a

Re: [RFC PATCH 01/10] iommu/vt-d: Get iommu device for a mediated device

2018-07-24 Thread Lu Baolu
Hi Alex, On 07/25/2018 02:50 AM, Alex Williamson wrote: > On Sun, 22 Jul 2018 14:09:24 +0800 > Lu Baolu wrote: > >> This patch adds the support to get the iommu device for a mediated >> device. The assumption is that each mediated device is a minimal >> assignable s

Re: [RFC PATCH 03/10] iommu/vt-d: Allocate groups for mediated devices

2018-07-24 Thread Lu Baolu
Hi Jean, Pull Kevin in. Not sure why he was removed from cc list. On 07/24/2018 07:30 PM, Jean-Philippe Brucker wrote: > Hi Baolu, > > On 24/07/18 03:22, Lu Baolu wrote: >> Hi, >> >> On 07/23/2018 12:44 PM, Liu, Yi L wrote: >>>> From: Lu Baolu [mailto:baol

[RFC PATCH 10/10] vfio/type1: Allocate domain for mediated device

2018-07-22 Thread Lu Baolu
This allocates a domain for the mediated device if it is able to be isolated and protected individually by IOMMU. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu --- drivers/vfio/vfio_iommu_type1.c | 43

[RFC PATCH 09/10] vfio/mdev: Add mediated device domain type

2018-07-22 Thread Lu Baolu
possible to allocate a domain for each such device. This patch defines the domain types of a mediated device and allows the parent driver to specify this attribute after a mdev is actually created. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Kevin Tian Signed-off-by: Lu

[RFC PATCH 08/10] vfio/mdev: Set iommu ops for mdev bus

2018-07-22 Thread Lu Baolu
This sets the iommu ops for the mdev bus with iommu_set_bus(). With the iommu ops setting, a mediated device might be isolated and protected by an IOMMU unit. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu --- drivers/vfio/mdev

[RFC PATCH 05/10] iommu/vt-d: Setup DMA remapping for mediated devices

2018-07-22 Thread Lu Baolu
This configures the second level page table when external components request to allocate a domain for a mediated device. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 73

[RFC PATCH 06/10] iommu: Add iommu_set_bus API interface

2018-07-22 Thread Lu Baolu
/mdev bus when the mdev devices could be exclusively protected by the IOMMU units. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 23 +++ include/linux/iommu.h | 12 2 files changed, 35 insertions

[RFC PATCH 07/10] iommu/vt-d: Add set_bus iommu ops

2018-07-22 Thread Lu Baolu
This specifies the Intel IOMMU specific set_bus operation. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Signed-off-by: Sanjay Kumar Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/iommu/intel

  1   2   3   4   5   6   7   8   >