Re: [PATCH 3/4 V3] Remap the device table of IOMMU in encrypted manner for kdump

2018-06-21 Thread Baoquan He
On 06/21/18 at 01:42pm, lijiang wrote: > 在 2018年06月21日 00:42, Tom Lendacky 写道: > > On 6/16/2018 3:27 AM, Lianbo Jiang wrote: > >> In kdump mode, it will copy the device table of IOMMU from the old > >> device table, which is encrypted when SME is enabled in the first > >> kernel. So we must remap

Re: [PATCH 1/4 V3] Add a function(ioremap_encrypted) for kdump when AMD sme enabled

2018-06-21 Thread lijiang
在 2018年06月21日 00:00, Tom Lendacky 写道: > On 6/16/2018 3:27 AM, Lianbo Jiang wrote: >> It is convenient to remap the old memory encrypted to the second >> kernel by calling ioremap_encrypted(). >> >> Signed-off-by: Lianbo Jiang >> --- >> Some changes: >> 1. remove the sme_active() check in

Re: [PATCH 0/4 V3] Support kdump for AMD secure memory encryption(SME)

2018-06-21 Thread Baoquan He
On 06/21/18 at 11:18am, lijiang wrote: > 在 2018年06月21日 09:21, Baoquan He 写道: > > On 06/16/18 at 04:27pm, Lianbo Jiang wrote: > >> It is convenient to remap the old memory encrypted to the second kernel by > >> calling ioremap_encrypted(). > >> > >> When sme enabled on AMD server, we also need to

Re: [PATCH 3/4 V3] Remap the device table of IOMMU in encrypted manner for kdump

2018-06-21 Thread lijiang
在 2018年06月21日 16:39, Baoquan He 写道: > On 06/21/18 at 01:42pm, lijiang wrote: >> 在 2018年06月21日 00:42, Tom Lendacky 写道: >>> On 6/16/2018 3:27 AM, Lianbo Jiang wrote: In kdump mode, it will copy the device table of IOMMU from the old device table, which is encrypted when SME is enabled in

Re: [PATCH 2/4 V3] Allocate pages for kdump without encryption when SME is enabled

2018-06-21 Thread lijiang
在 2018年06月21日 18:23, Baoquan He 写道: > On 06/21/18 at 01:06pm, lijiang wrote: >> 在 2018年06月21日 09:53, Baoquan He 写道: >>> On 06/16/18 at 04:27pm, Lianbo Jiang wrote: When SME is enabled in the first kernel, we will allocate pages for kdump without encryption in order to be able to boot the

Re: [PATCH 2/4 V3] Allocate pages for kdump without encryption when SME is enabled

2018-06-21 Thread Baoquan He
On 06/21/18 at 01:06pm, lijiang wrote: > 在 2018年06月21日 09:53, Baoquan He 写道: > > On 06/16/18 at 04:27pm, Lianbo Jiang wrote: > >> When SME is enabled in the first kernel, we will allocate pages > >> for kdump without encryption in order to be able to boot the > >> second kernel in the same manner

Re: usb HC busted?

2018-06-21 Thread Mathias Nyman
On 21.06.2018 03:53, Sudip Mukherjee wrote: Hi Mathias, Andy, On Thu, Jun 07, 2018 at 10:40:03AM +0300, Mathias Nyman wrote: On 06.06.2018 19:45, Sudip Mukherjee wrote: Hi Andy, And we meet again. :) On Wed, Jun 06, 2018 at 06:36:35PM +0300, Andy Shevchenko wrote: On Wed, 2018-06-06 at

Re: [PATCH 3/4 V3] Remap the device table of IOMMU in encrypted manner for kdump

2018-06-21 Thread Tom Lendacky
On 6/21/2018 3:39 AM, Baoquan He wrote: > On 06/21/18 at 01:42pm, lijiang wrote: >> 在 2018年06月21日 00:42, Tom Lendacky 写道: >>> On 6/16/2018 3:27 AM, Lianbo Jiang wrote: In kdump mode, it will copy the device table of IOMMU from the old device table, which is encrypted when SME is enabled

Re: [PATCH 0/7 v5] Support for fsl-mc bus and its devices in SMMU

2018-06-21 Thread Will Deacon
Hi Nipun, On Thu, Jun 21, 2018 at 03:59:27AM +, Nipun Gupta wrote: > Will this patch-set be taken for the next kernel release (and via which > tree)? I think you need Acks from Robin and Joerg in order for this to be queued. Robin should be back at the beginning of next month, so there's

[RFC 2/3] iommu/iova: Make free_iova() atomic

2018-06-21 Thread Dmitry Safonov via iommu
find_iova() grabs rbtree's spinlock only for the search time. Nothing guaranties that returned iova still exist for __free_iova(). Prevent potential use-after-free and double-free by holding the spinlock all the time iova is being searched and freed. Cc: David Woodhouse Cc: Joerg Roedel Cc:

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

2018-06-21 Thread Jean-Philippe Brucker
When the device offers the probe feature, send a probe request for each device managed by the IOMMU. Extract RESV_MEM information. When we encounter a MSI doorbell region, set it up as a IOMMU_RESV_MSI region. This will tell other subsystems that there is no need to map the MSI doorbell in the

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

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

[RFC 0/3] iommu/iova: Unsafe locking in find_iova()

2018-06-21 Thread Dmitry Safonov via iommu
find_iova() looks to be using a bad locking practice: it locks the returned iova only for the search time. And looking in code, the element can be removed from the tree and freed under rbtree lock. That happens during memory hot-unplug and cleanup on module removal. Here I cleanup users of the

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

2018-06-21 Thread Jean-Philippe Brucker
Implement the base virtio-iommu driver, following version 0.7 of the specification [1]. Changes since last version [2]: * Address comments, thanks again for the review. * As suggested, add a DT binding description in patch 1. * Depend on VIRTIO_MMIO=y to fix a build failure¹ * Switch to v0.7 of

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

2018-06-21 Thread Jean-Philippe Brucker
The virtio IOMMU is a para-virtualized device, allowing to send IOMMU requests such as map/unmap over virtio-mmio transport without emulating page tables. This implementation handles ATTACH, DETACH, MAP and UNMAP requests. The bulk of the code transforms calls coming from the IOMMU API into

[RFC 1/3] iommu/iova: Find and split iova under rbtree's lock

2018-06-21 Thread Dmitry Safonov via iommu
find_iova() holds iova_rbtree_lock only during the traversing rbtree. After the lock is released, returned iova may be freed (e.g., during module's release). Hold the spinlock during search and removal of iova from the rbtree, eleminating possible use-after-free or/and double-free of iova. Cc:

[RFC 3/3] iommu/iova: Remove find_iova()

2018-06-21 Thread Dmitry Safonov via iommu
This function is potentially dangerous: nothing protects returned iova. As there is no user in tree anymore, delete it. Cc: David Woodhouse Cc: Joerg Roedel Cc: iommu@lists.linux-foundation.org Cc: Dmitry Safonov <0x7f454...@gmail.com> Signed-off-by: Dmitry Safonov --- drivers/iommu/iova.c |

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

2018-06-21 Thread Jean-Philippe Brucker
A virtio-mmio node may represent a virtio-iommu device. This is discovered by the virtio driver at probe time, but the DMA topology isn't discoverable and must be described by firmware. For DT the standard IOMMU description is used, as specified in bindings/iommu/iommu.txt and

Re: [PATCH 2/4 V3] Allocate pages for kdump without encryption when SME is enabled

2018-06-21 Thread Baoquan He
On 06/21/18 at 09:27pm, lijiang wrote: > 在 2018年06月21日 18:23, Baoquan He 写道: > > On 06/21/18 at 01:06pm, lijiang wrote: > >> 在 2018年06月21日 09:53, Baoquan He 写道: > >>> On 06/16/18 at 04:27pm, Lianbo Jiang wrote: > When SME is enabled in the first kernel, we will allocate pages > for kdump

Re: [PATCH 3/4 V3] Remap the device table of IOMMU in encrypted manner for kdump

2018-06-21 Thread Baoquan He
On 06/21/18 at 08:12am, Tom Lendacky wrote: > On 6/21/2018 3:39 AM, Baoquan He wrote: > > On 06/21/18 at 01:42pm, lijiang wrote: > >> 在 2018年06月21日 00:42, Tom Lendacky 写道: > >>> On 6/16/2018 3:27 AM, Lianbo Jiang wrote: > In kdump mode, it will copy the device table of IOMMU from the old >

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

2018-06-21 Thread Michael S. Tsirkin
On Thu, Jun 21, 2018 at 08:06:52PM +0100, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio-mmio transport without emulating > page tables. This implementation handles ATTACH, DETACH, MAP and UNMAP >

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

2018-06-21 Thread Michael S. Tsirkin
On Thu, Jun 21, 2018 at 08:06:53PM +0100, Jean-Philippe Brucker wrote: > When the device offers the probe feature, send a probe request for each > device managed by the IOMMU. Extract RESV_MEM information. When we > encounter a MSI doorbell region, set it up as a IOMMU_RESV_MSI region. > This will

Re: [PATCH 1/1] iommu/amd: make sure TLB to be flushed before IOVA freed

2018-06-21 Thread Leizhen (ThunderTown)
Hi Joerg: Can you take a look at it? On 2018/6/6 10:18, Zhen Lei wrote: > Although the mapping has already been removed in the page table, it maybe > still exist in TLB. Suppose the freed IOVAs is reused by others before the > flush operation completed, the new user can not correctly access to

Re: [PATCH v4] dt-bindings: mediatek: Add binding for mt2712 IOMMU and SMI

2018-06-21 Thread Yong Wu
Hi Matthias, A gentle ping on this. On Thu, 2018-05-24 at 20:35 +0800, Yong Wu wrote: > This patch adds decriptions for mt2712 IOMMU and SMI. > > In order to balance the bandwidth, mt2712 has two M4Us, two > smi-commons, 10 smi-larbs. and mt2712 is also MTK IOMMU gen2 which > uses ARM