[PATCH v8 5/5] mmc: queue: Use bigger segments if DMA MAP layer can merge the segments

2019-07-22 Thread Yoshihiro Shimoda
When the max_segs of a mmc host is smaller than 512, the mmc subsystem tries to use 512 segments if DMA MAP layer can merge the segments, and then the mmc subsystem exposes such information to the block layer by using blk_queue_can_use_dma_map_merging(). Signed-off-by: Yoshihiro Shimoda

[PATCH v8 3/5] block: sort headers on blk-setting.c

2019-07-22 Thread Yoshihiro Shimoda
This patch sorts the headers in alphabetic order to ease the maintenance for this part. Signed-off-by: Yoshihiro Shimoda Reviewed-by: Wolfram Sang --- block/blk-settings.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/blk-settings.c

[PATCH v8 0/5] treewide: improve R-Car SDHI performance

2019-07-22 Thread Yoshihiro Shimoda
This patch series is based on linux-next.git / next-20190722 tag. Since SDHI host internal DMAC of the R-Car Gen3 cannot handle two or more segments, the performance rate (especially, eMMC HS400 reading) is not good. However, if IOMMU is enabled on the DMAC, since IOMMU will map multiple scatter

[PATCH v8 1/5] dma: Introduce dma_get_merge_boundary()

2019-07-22 Thread Yoshihiro Shimoda
This patch adds a new DMA API "dma_get_merge_boundary". This function returns the DMA merge boundary if the DMA layer can merge the segments. This patch also adds the implementation for a new dma_map_ops pointer. Signed-off-by: Yoshihiro Shimoda Reviewed-by: Christoph Hellwig ---

[PATCH v8 4/5] block: add a helper function to merge the segments

2019-07-22 Thread Yoshihiro Shimoda
This patch adds a helper function whether a queue can merge the segments by the DMA MAP layer (e.g. via IOMMU). Signed-off-by: Yoshihiro Shimoda Reviewed-by: Christoph Hellwig --- block/blk-settings.c | 22 ++ include/linux/blkdev.h | 2 ++ 2 files changed, 24

[PATCH v8 2/5] iommu/dma: Add a new dma_map_ops of get_merge_boundary()

2019-07-22 Thread Yoshihiro Shimoda
This patch adds a new dma_map_ops of get_merge_boundary() to expose the DMA merge boundary if the domain type is IOMMU_DOMAIN_DMA. Signed-off-by: Yoshihiro Shimoda --- drivers/iommu/dma-iommu.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/iommu/dma-iommu.c

Re: [PATCH v2 00/12] Clean up "mediatek,larb" after adding device_link

2019-07-22 Thread CK Hu
Hi, Yong: I've added log in mtk_smi_clk_enable() and mtk_smi_clk_disable(), and I boot MT8183 with display, the log is [4.020340] mtk-smi-common 14019000.smi: mtk_smi_clk_enable() [4.331371] mtk-smi-common 14019000.smi: mtk_smi_clk_disable() [4.429578] mtk-smi-common 14019000.smi:

Re: [PATCH] powerpc/dma: Fix invalid DMA mmap behavior

2019-07-22 Thread Michael Ellerman
Shawn Anastasio writes: > On 7/22/19 7:16 AM, Michael Ellerman wrote: >> Arnd Bergmann writes: >>> On Thu, Jul 18, 2019 at 11:52 AM Christoph Hellwig wrote: On Thu, Jul 18, 2019 at 10:49:34AM +0200, Christoph Hellwig wrote: > On Thu, Jul 18, 2019 at 01:45:16PM +1000, Oliver O'Halloran

Re: [PATCH] powerpc/dma: Fix invalid DMA mmap behavior

2019-07-22 Thread Shawn Anastasio via iommu
On 7/22/19 7:16 AM, Michael Ellerman wrote: Arnd Bergmann writes: On Thu, Jul 18, 2019 at 11:52 AM Christoph Hellwig wrote: On Thu, Jul 18, 2019 at 10:49:34AM +0200, Christoph Hellwig wrote: On Thu, Jul 18, 2019 at 01:45:16PM +1000, Oliver O'Halloran wrote: Other than m68k, mips, and

Re: [PATCH v2] dma-mapping: Use dma_get_mask in dma_addressing_limited

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 06:56:49PM +0200, Auger Eric wrote: > Hi Christoph, > > On 7/22/19 6:51 PM, Eric Auger wrote: > > We currently have cases where the dma_addressing_limited() gets > > called with dma_mask unset. This causes a NULL pointer dereference. > > > > Use dma_get_mask() accessor to

Re: [PATCH v2] dma-mapping: Use dma_get_mask in dma_addressing_limited

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 06:51:49PM +0200, Eric Auger wrote: > We currently have cases where the dma_addressing_limited() gets > called with dma_mask unset. This causes a NULL pointer dereference. > > Use dma_get_mask() accessor to prevent the crash. > > Fixes: b866455423e0 ("dma-mapping: add a

Re: [PATCH v2] dma-mapping: Use dma_get_mask in dma_addressing_limited

2019-07-22 Thread Auger Eric
Hi Christoph, On 7/22/19 6:51 PM, Eric Auger wrote: > We currently have cases where the dma_addressing_limited() gets > called with dma_mask unset. This causes a NULL pointer dereference. > > Use dma_get_mask() accessor to prevent the crash. > > Fixes: b866455423e0 ("dma-mapping: add a

[PATCH v2] dma-mapping: Use dma_get_mask in dma_addressing_limited

2019-07-22 Thread Eric Auger
We currently have cases where the dma_addressing_limited() gets called with dma_mask unset. This causes a NULL pointer dereference. Use dma_get_mask() accessor to prevent the crash. Fixes: b866455423e0 ("dma-mapping: add a dma_addressing_limited helper") Signed-off-by: Eric Auger --- v1 ->

Re: [PATCH v2] iommu: add support for drivers that manage iommu explicitly

2019-07-22 Thread Rob Clark
On Mon, Jul 22, 2019 at 8:48 AM Joerg Roedel wrote: > > On Mon, Jul 22, 2019 at 08:41:34AM -0700, Rob Clark wrote: > > It is set by the driver: > > > > https://patchwork.freedesktop.org/patch/315291/ > > > > (This doesn't really belong in devicetree, since it isn't a > > description of the

Re: [PATCH] iommu/vt-d: Print pasid table entries MSB to LSB in debugfs

2019-07-22 Thread Joerg Roedel
On Sun, Jul 21, 2019 at 05:22:07PM -0700, Sai Praneeth Prakhya wrote: > --- > drivers/iommu/intel-iommu-debugfs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Added a Fixes-tag and applied to iommu/fixes. ___ iommu mailing list

Re: [PATCH] iommu/iova: Remove stale cached32_node

2019-07-22 Thread Joerg Roedel
On Sat, Jul 20, 2019 at 07:08:48PM +0100, Chris Wilson wrote: > --- > drivers/iommu/iova.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Applied to iommu/fixes. ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH v2] iommu: add support for drivers that manage iommu explicitly

2019-07-22 Thread Joerg Roedel
On Mon, Jul 22, 2019 at 08:41:34AM -0700, Rob Clark wrote: > It is set by the driver: > > https://patchwork.freedesktop.org/patch/315291/ > > (This doesn't really belong in devicetree, since it isn't a > description of the hardware, so the driver is really the only place to > set this.. which is

Re: [PATCH 1/2] dma-mapping: Protect dma_addressing_limited against NULL dma_mask

2019-07-22 Thread Auger Eric
Hi Christoph, On 7/22/19 5:26 PM, Christoph Hellwig wrote: >> static inline bool dma_addressing_limited(struct device *dev) >> { >> -return min_not_zero(*dev->dma_mask, dev->bus_dma_mask) < >> -dma_get_required_mask(dev); >> +return WARN_ON_ONCE(!dev->dma_mask) ? false : >>

Re: [PATCH 2/2] virtio/virtio_ring: Fix the dma_max_mapping_size call

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 04:36:09PM +0100, Robin Murphy wrote: > On 22/07/2019 15:55, Eric Auger wrote: > > Do not call dma_max_mapping_size for devices that have no DMA > > mask set, otherwise we can hit a NULL pointer dereference. > > > > This occurs when a virtio-blk-pci device is protected

Re: [PATCH 1/2] iommu/vt-d: Don't queue_iova() if there is no flush queue

2019-07-22 Thread Joerg Roedel
On Tue, Jul 16, 2019 at 10:38:05PM +0100, Dmitry Safonov wrote: > BUG: spinlock bad magic on CPU#6, swapper/0/1 Applied both patches to iommu/fixes.

Re: [PATCH v2] iommu: add support for drivers that manage iommu explicitly

2019-07-22 Thread Rob Clark
On Mon, Jul 22, 2019 at 7:28 AM Joerg Roedel wrote: > > On Wed, Jul 10, 2019 at 11:28:30AM -0700, Rob Clark wrote: > > --- a/include/linux/device.h > > +++ b/include/linux/device.h > > @@ -282,7 +282,8 @@ struct device_driver { > > struct module *owner; > > const char

Re: [PATCH 2/2] virtio/virtio_ring: Fix the dma_max_mapping_size call

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 05:27:10PM +0200, Christoph Hellwig wrote: > On Mon, Jul 22, 2019 at 04:55:09PM +0200, Eric Auger wrote: > > Do not call dma_max_mapping_size for devices that have no DMA > > mask set, otherwise we can hit a NULL pointer dereference. > > > > This occurs when a

Re: [PATCH 2/2] virtio/virtio_ring: Fix the dma_max_mapping_size call

2019-07-22 Thread Robin Murphy
On 22/07/2019 15:55, Eric Auger wrote: Do not call dma_max_mapping_size for devices that have no DMA mask set, otherwise we can hit a NULL pointer dereference. This occurs when a virtio-blk-pci device is protected with a virtual IOMMU. Fixes: e6d6dd6c875e ("virtio: Introduce

Re: [PATCH 2/2] virtio/virtio_ring: Fix the dma_max_mapping_size call

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 04:55:09PM +0200, Eric Auger wrote: > Do not call dma_max_mapping_size for devices that have no DMA > mask set, otherwise we can hit a NULL pointer dereference. > > This occurs when a virtio-blk-pci device is protected with > a virtual IOMMU. > > Fixes: e6d6dd6c875e

Re: [PATCH 2/2] virtio/virtio_ring: Fix the dma_max_mapping_size call

2019-07-22 Thread Christoph Hellwig
On Mon, Jul 22, 2019 at 04:55:09PM +0200, Eric Auger wrote: > Do not call dma_max_mapping_size for devices that have no DMA > mask set, otherwise we can hit a NULL pointer dereference. > > This occurs when a virtio-blk-pci device is protected with > a virtual IOMMU. > > Fixes: e6d6dd6c875e

Re: [PATCH 1/2] dma-mapping: Protect dma_addressing_limited against NULL dma_mask

2019-07-22 Thread Christoph Hellwig
> static inline bool dma_addressing_limited(struct device *dev) > { > - return min_not_zero(*dev->dma_mask, dev->bus_dma_mask) < > - dma_get_required_mask(dev); > + return WARN_ON_ONCE(!dev->dma_mask) ? false : > + min_not_zero(*dev->dma_mask, dev->bus_dma_mask) <

Re: [PATCH] iommu/virtio: Update to most recent specification

2019-07-22 Thread Joerg Roedel
On Mon, Jul 22, 2019 at 11:16:08AM -0400, Michael S. Tsirkin wrote: > I'm merging this for this release, unless someone objects. No objections from me. Acked-by: Joerg Roedel ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH] iommu/virtio: Update to most recent specification

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 03:40:07PM +0100, Jean-Philippe Brucker wrote: > Following specification review a few things were changed in v8 of the > virtio-iommu series [1], but have been omitted when merging the base > driver. Add them now: > > * Remove the EXEC flag. > * Add feature bit for the

Re: [PATCH RFC 1/4] iommu/vt-d: Modify device_def_domain_type() to use at runtime

2019-07-22 Thread Joerg Roedel
On Tue, Jul 02, 2019 at 06:53:59PM -0700, Sai Praneeth Prakhya wrote: > device_def_domain_type() determines the domain type a device could have and > it's called only during boot. But, to change the domain of a group through > sysfs, kernel has to call this function during runtime. Hence, add an >

Re: [PATCH] iommu/virtio: Update to most recent specification

2019-07-22 Thread Auger Eric
Hi Jean, On 7/22/19 4:40 PM, Jean-Philippe Brucker wrote: > Following specification review a few things were changed in v8 of the > virtio-iommu series [1], but have been omitted when merging the base > driver. Add them now: > > * Remove the EXEC flag. > * Add feature bit for the MMIO flag. > *

[PATCH 1/2] dma-mapping: Protect dma_addressing_limited against NULL dma_mask

2019-07-22 Thread Eric Auger
dma_addressing_limited() should not be called on a device with a NULL dma_mask. If this occurs let's WARN_ON_ONCE and immediately return. Existing call sites are updated separately. Fixes: b866455423e0 ("dma-mapping: add a dma_addressing_limited helper") Signed-off-by: Eric Auger --- v1 -> v2:

[PATCH 2/2] virtio/virtio_ring: Fix the dma_max_mapping_size call

2019-07-22 Thread Eric Auger
Do not call dma_max_mapping_size for devices that have no DMA mask set, otherwise we can hit a NULL pointer dereference. This occurs when a virtio-blk-pci device is protected with a virtual IOMMU. Fixes: e6d6dd6c875e ("virtio: Introduce virtio_max_dma_size()") Signed-off-by: Eric Auger

[PATCH 0/2] Fix NULL pointer dereference with virtio-blk-pci and virtual IOMMU

2019-07-22 Thread Eric Auger
When running a guest featuring a virtio-blk-pci protected with a virtual IOMMU we hit a NULL pointer dereference. This series removes the dma_max_mapping_size() call in virtio_max_dma_size when the device does not have any dma_mask set. A check is also added to early return in

Re: [PATCH RFC 0/4] iommu: Add support to change default domain of a group

2019-07-22 Thread Joerg Roedel
On Tue, Jul 02, 2019 at 06:53:58PM -0700, Sai Praneeth Prakhya wrote: > Assume a use case where-in the priviliged user would want to use the device in > pass-through mode when the device is used for host but would want to switch to > dma protected mode when switching for VFIO in user space.

[PATCH] iommu/virtio: Update to most recent specification

2019-07-22 Thread Jean-Philippe Brucker
Following specification review a few things were changed in v8 of the virtio-iommu series [1], but have been omitted when merging the base driver. Add them now: * Remove the EXEC flag. * Add feature bit for the MMIO flag. * Change domain_bits to domain_range. * Add NOMEM status flag. [1]

Re: [PATCH v2] iommu: add support for drivers that manage iommu explicitly

2019-07-22 Thread Joerg Roedel
On Wed, Jul 10, 2019 at 11:28:30AM -0700, Rob Clark wrote: > --- a/include/linux/device.h > +++ b/include/linux/device.h > @@ -282,7 +282,8 @@ struct device_driver { > struct module *owner; > const char *mod_name; /* used for built-in modules */ > > -

Re: [PATCH v2 7/7] iommu/vt-d: Consolidate domain_init() to avoid duplication

2019-07-22 Thread Joerg Roedel
On Sat, Jul 20, 2019 at 09:15:58AM +0800, Lu Baolu wrote: > Okay. I agree wit you. Let's revert this commit first. Reverted the patch and queued it to my iommu/fixes branch. Regards, Joerg

[PATCH] MAINTAINERS: Update my email address

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

Re: [PATCH] MAINTAINERS: Update my email address

2019-07-22 Thread Will Deacon
On Mon, Jul 22, 2019 at 02:44:40PM +0100, Jean-Philippe Brucker wrote: > Update MAINTAINERS and .mailmap with my @linaro.org address, since I > don't have access to my @arm.com address anymore. > > Signed-off-by: Jean-Philippe Brucker > --- > .mailmap| 1 + > MAINTAINERS | 2 +- > 2 files

Re: [PATCH v2] iommu/amd: fix a crash in iova_magazine_free_pfns

2019-07-22 Thread Joerg Roedel
Hi Linus, On Sun, Jul 21, 2019 at 09:58:04AM -0700, Linus Torvalds wrote: > This one seems to have fallen through the cracks. > > Applied directly. Thanks! > Maybe it's hiding in some fixes tree that I haven't gotten a pull > request for yet? No, I havn't had it applied anywhere yet. I

RE: [RFC v1 4/4] vfio/type1: bind guest pasid (guest page tables) to host

2019-07-22 Thread Liu, Yi L
> From: Auger Eric [mailto:eric.au...@redhat.com] > Sent: Thursday, July 18, 2019 6:17 PM > To: Liu, Yi L ; alex.william...@redhat.com > Subject: Re: [RFC v1 4/4] vfio/type1: bind guest pasid (guest page tables) to > host > > Yi, > > On 7/5/19 1:06 PM, Liu, Yi L wrote: > > From: Liu Yi L > > >

Re: [PATCH] powerpc/dma: Fix invalid DMA mmap behavior

2019-07-22 Thread Michael Ellerman
Arnd Bergmann writes: > On Thu, Jul 18, 2019 at 11:52 AM Christoph Hellwig wrote: >> On Thu, Jul 18, 2019 at 10:49:34AM +0200, Christoph Hellwig wrote: >> > On Thu, Jul 18, 2019 at 01:45:16PM +1000, Oliver O'Halloran wrote: >> > > > Other than m68k, mips, and arm64, everybody else that doesn't

Re: [PATCH] dma-mapping: Protect dma_addressing_limited against NULL dma_mask

2019-07-22 Thread Christoph Hellwig
I posted a fix that takes care of this in SCSI this morning: https://marc.info/?l=linux-scsi=156378725427719=2 I suspect for virtio-blk we should do the same. > static inline bool dma_addressing_limited(struct device *dev) > { > - return min_not_zero(*dev->dma_mask, dev->bus_dma_mask) < >

[PATCH] dma-mapping: Protect dma_addressing_limited against NULL dma_mask

2019-07-22 Thread Eric Auger
There are cases when the helper gets called when the dma_mask is NULL. This is observed when running virtio-block-pci devices protected by a virtual IOMMU. Guest crashes with NULL pointer dereference. Fixes: b866455423e0 ("dma-mapping: add a dma_addressing_limited helper") Signed-off-by: Eric

Re: [PATCH] iommu/iova: Remove stale cached32_node

2019-07-22 Thread Chris Wilson
Quoting Robin Murphy (2019-07-22 11:13:49) > Hi Chris, > > On 20/07/2019 19:08, Chris Wilson wrote: > > Since the cached32_node is allowed to be advanced above dma_32bit_pfn > > (to provide a shortcut into the limited range), we need to be careful to > > remove the to be freed node if it is the

Re: [PATCH] iommu/iova: Remove stale cached32_node

2019-07-22 Thread Robin Murphy
Hi Chris, On 20/07/2019 19:08, Chris Wilson wrote: Since the cached32_node is allowed to be advanced above dma_32bit_pfn (to provide a shortcut into the limited range), we need to be careful to remove the to be freed node if it is the cached32_node. Thanks for digging in - just to confirm my

Re: [PATCH 0/2] media: add support for DW9768 VCM driver

2019-07-22 Thread Tomasz Figa
On Mon, Jul 8, 2019 at 7:12 PM wrote: > > From: Dongchun Zhu > > Hello, > > Add a v4l2 sub-device driver for Dongwoon's DW9768 lens voice coil. > This is a voice coil module using the i2c bus to control the focus position. > > The DW9768 can control the position with 10 bits value and > consists