[PATCH 05/30] pcd: use blk_mq_alloc_disk

2021-06-01 Thread Christoph Hellwig
Use the blk_mq_alloc_disk API to simplify the gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/block/paride/pcd.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c

[PATCH 03/30] blk-mq: add the blk_mq_alloc_disk APIs

2021-06-01 Thread Christoph Hellwig
Add a new API to allocate a gendisk including the request_queue for use with blk-mq based drivers. This is to avoid boilerplate code in drivers. Signed-off-by: Christoph Hellwig --- block/blk-mq.c | 19 +++ include/linux/blk-mq.h | 12 2 files changed, 31

[PATCH 04/30] virtio-blk: use blk_mq_alloc_disk

2021-06-01 Thread Christoph Hellwig
Use the blk_mq_alloc_disk API to simplify the gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/block/virtio_blk.c | 26 +++--- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block

[PATCH 02/30] blk-mq: improve the blk_mq_init_allocated_queue interface

2021-06-01 Thread Christoph Hellwig
Don't return the passed in request_queue but a normal error code, and drop the elevator_init argument in favor of just calling elevator_init_mq directly from dm-rq. Signed-off-by: Christoph Hellwig --- block/blk-mq.c | 36 ++-- block/

simplify gendisk and request_queue allocation for blk-mq based drivers

2021-06-01 Thread Christoph Hellwig
Hi all, this series is the scond part of cleaning up lifetimes and allocation of the gendisk and request_queue structure. It adds a new interface to allocate the disk and queue together for blk based drivers, and uses that in all drivers that do not have any caveats in their gendisk and request_q

[PATCH 01/30] blk-mq: factor out a blk_mq_alloc_sq_tag_set helper

2021-06-01 Thread Christoph Hellwig
Factour out a helper to initialize a simple single hw queue tag_set from blk_mq_init_sq_queue. This will allow to phase out blk_mq_init_sq_queue in favor of a more symmetric and general API. Signed-off-by: Christoph Hellwig --- block/blk-mq.c | 32

Re: [PATCH v8 00/15] Restricted DMA

2021-05-27 Thread Christoph Hellwig
I just finished reviewing v7, sorry. Let me find some time to see what difference this version makes.

Re: [PATCH v7 13/15] dma-direct: Allocate memory from restricted DMA pool if available

2021-05-27 Thread Christoph Hellwig
> +#ifdef CONFIG_DMA_RESTRICTED_POOL > + if (swiotlb_free(dev, page, size)) > + return; > +#endif Please avoid the ifdefs by either stubbing out the function to be a no-op or by using IS_ENABLED. > +#ifdef CONFIG_DMA_RESTRICTED_POOL > + page = swiotlb_alloc(dev, size); > +

Re: [PATCH v7 07/15] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-05-27 Thread Christoph Hellwig
> + if (is_swiotlb_active(NULL)) { Passing a NULL argument to this doesn't make sense. They all should have a struct device at hand, you'll just need to dig for it. And this function should be about to go away anyway, but until then we need to do this properly.

Re: [PATCH v7 04/15] swiotlb: Add restricted DMA pool initialization

2021-05-27 Thread Christoph Hellwig
I'd still much prefer to always have the pointer in struct device. Especially as we're also looking into things like a global 64-bit bounce buffer. Something like this untested patch ontop of your series: diff --git a/drivers/base/core.c b/drivers/base/core.c index 628e33939aca..3cb95fa29f70 100

Re: [PATCH v7 04/15] swiotlb: Add restricted DMA pool initialization

2021-05-27 Thread Christoph Hellwig
On Mon, May 24, 2021 at 11:49:34AM -0400, Konrad Rzeszutek Wilk wrote: > rmem_swiotlb_setup > > ? > > Which is ARM specific and inside the generic code? I don't think it is arm specific at all. It is OF specific, but just about every platform but x86 uses OF. And I can think of an ACPI version

Re: [PATCH v7 03/15] swiotlb: Add DMA_RESTRICTED_POOL

2021-05-27 Thread Christoph Hellwig
On Tue, May 18, 2021 at 02:42:03PM +0800, Claire Chang wrote: > Add a new kconfig symbol, DMA_RESTRICTED_POOL, for restricted DMA pool. Please merge this with the actual code that is getting added.

Re: [PATCH v7 02/15] swiotlb: Refactor swiotlb_create_debugfs

2021-05-27 Thread Christoph Hellwig
On Tue, May 18, 2021 at 02:42:02PM +0800, Claire Chang wrote: > struct io_tlb_mem *io_tlb_default_mem; > +static struct dentry *debugfs_dir; > > /* > * Max segment that we can provide which (if pages are contingous) will > @@ -662,18 +663,30 @@ EXPORT_SYMBOL_GPL(is_swiotlb_active); > > #if

Re: [PATCH v7 01/15] swiotlb: Refactor swiotlb init functions

2021-05-27 Thread Christoph Hellwig
On Wed, May 19, 2021 at 11:50:07AM -0700, Florian Fainelli wrote: > You convert this call site with swiotlb_init_io_tlb_mem() which did not > do the set_memory_decrypted()+memset(). Is this okay or should > swiotlb_init_io_tlb_mem() add an additional argument to do this > conditionally? The zeroin

Re: simplify gendisk and request_queue allocation for bio based drivers

2021-05-25 Thread Christoph Hellwig
On Wed, May 26, 2021 at 12:41:37AM +0200, Ulf Hansson wrote: > On Fri, 21 May 2021 at 07:51, Christoph Hellwig wrote: > > > > Hi all, > > > > this series is the first part of cleaning up lifetimes and allocation of > > the gendisk and request_queue struc

Re: [PATCH 18/26] nvme-multipath: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-24 Thread Christoph Hellwig
On Sun, May 23, 2021 at 10:20:27AM +0200, Hannes Reinecke wrote: > What about the check for GENHD_FL_UP a bit further up in line 766? > Can this still happen with the new allocation scheme, ie is there still a > difference in lifetime between ->disk and ->disk->queue? Yes, nvme_free_ns_head can s

Re: [PATCH 14/26] md: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-24 Thread Christoph Hellwig
On Sun, May 23, 2021 at 10:12:49AM +0200, Hannes Reinecke wrote: >> +blk_set_stacking_limits(&mddev->queue->limits); >> blk_queue_write_cache(mddev->queue, true, true); >> /* Allow extended partitions. This makes the >> * 'mdp' device redundant, but we can't really >> > Wouldn'

Re: [PATCH 13/26] dm: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-24 Thread Christoph Hellwig
On Sun, May 23, 2021 at 10:10:34AM +0200, Hannes Reinecke wrote: > Can't these conditionals be merged into a single 'if (md->disk)'? > Eg like: > > if (md->disk) { > spin_lock(&_minor_lock); > md->disk->private_data = NULL; > spin_unlock(&_minor_lock)

Re: [PATCH 06/26] brd: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-24 Thread Christoph Hellwig
On Sun, May 23, 2021 at 09:58:48AM +0200, Hannes Reinecke wrote: >> +/* >> + * This is so fdisk will align partitions on 4k, because of >> + * direct_access API needing 4k alignment, returning a PFN >> + * (This is only a problem on very small devices <= 4M, >> + * otherwise fd

Re: [dm-devel] [PATCH 05/26] block: add blk_alloc_disk and blk_cleanup_disk APIs

2021-05-24 Thread Christoph Hellwig
On Fri, May 21, 2021 at 05:44:07PM +, Luis Chamberlain wrote: > Its not obvious to me why using this new API requires you then to > set minors explicitly to 1, and yet here underneath we see the minors > argument passed is 0. > > Nor is it clear from the documentation. Basically for all new d

Re: [PATCH 01/26] block: refactor device number setup in __device_add_disk

2021-05-24 Thread Christoph Hellwig
On Sun, May 23, 2021 at 09:46:01AM +0200, Hannes Reinecke wrote: > ... and also fixes an issue with GENHD_FL_UP remained set in an error path > in __device_add_disk(). Well, the error path in __device_add_disk is a complete disaster right now, but Luis is looking into it fortunately.

Re: [dm-devel] [PATCH 01/26] block: refactor device number setup in __device_add_disk

2021-05-24 Thread Christoph Hellwig
On Fri, May 21, 2021 at 05:16:46PM +, Luis Chamberlain wrote: > > - /* in consecutive minor range? */ > > - if (bdev->bd_partno < disk->minors) { > > - *devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); > > - return 0; > > - } > > - > > It is not obvious

Re: [PATCH 12/26] bcache: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
On Fri, May 21, 2021 at 02:15:32PM +0800, Coly Li wrote: > The above 2 lines are added on purpose to prevent an refcount > underflow. It is from commit 86da9f736740 ("bcache: fix refcount > underflow in bcache_device_free()"). > > Maybe add a parameter to blk_cleanup_disk() or checking (disk->fla

[PATCH 26/26] block: unexport blk_alloc_queue

2021-05-20 Thread Christoph Hellwig
blk_alloc_queue is just an internal helper now, unexport it and remove it from the public header. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 1 - block/blk.h| 2 ++ include/linux/blkdev.h | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block

[PATCH 25/26] null_blk: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the null_blk driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Note that the blk-mq mode is left with its own allocations scheme, to be handled later. Signed-off-by: Christoph Hellwig --- drivers/block/null_blk/main.c | 38

[PATCH 24/26] xpram: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the xpram driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/s390/block/xpram.c | 26 +- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a

[PATCH 23/26] dcssblk: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the dcssblk driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/s390/block/dcssblk.c | 26 -- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a

[PATCH 22/26] ps3vram: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the ps3vram driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/block/ps3vram.c | 31 --- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a

[PATCH 21/26] n64cart: convert to blk_alloc_disk

2021-05-20 Thread Christoph Hellwig
Convert the n64cart driver to use the blk_alloc_disk helper to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/block/n64cart.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/block/n64cart.c b/drivers/block/n64cart.c

[PATCH 20/26] simdisk: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the simdisk driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- arch/xtensa/platforms/iss/simdisk.c | 29 +++-- 1 file changed, 7 insertions(+), 22 deletions(-) diff

[PATCH 19/26] nfblock: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the nfblock driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- arch/m68k/emu/nfblock.c | 20 +--- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/arch/m68k

[PATCH 18/26] nvme-multipath: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the nvme-multipath driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/nvdimm/pmem.c | 1 - drivers/nvme/host/multipath.c | 45 ++- 2 files

[PATCH 17/26] nvdimm-pmem: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the nvdimm-pmem driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/nvdimm/pmem.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/nvdimm

[PATCH 16/26] nvdimm-btt: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the nvdimm-btt driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/nvdimm/btt.c | 24 +++- drivers/nvdimm/btt.h | 2 -- 2 files changed, 7 insertions(+), 19

[PATCH 15/26] nvdimm-blk: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the nvdimm-blk driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/nvdimm/blk.c | 26 ++ 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a

[PATCH 14/26] md: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the md driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/md/md.c | 25 + 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/md/md.c b

[PATCH 13/26] dm: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the dm driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/md/dm.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md

[PATCH 12/26] bcache: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the bcache driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/md/bcache/super.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/md

[PATCH 11/26] lightnvm: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the lightnvm driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/lightnvm/core.c | 23 +-- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers

[PATCH 10/26] zram: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the zram driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/block/zram/zram_drv.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers

[PATCH 09/26] rsxx: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the rsxx driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/block/rsxx/dev.c | 39 +- drivers/block/rsxx/rsxx_priv.h | 1 - 2 files changed

[PATCH 08/26] pktcdvd: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the pktcdvd driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/block/pktcdvd.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/block

[PATCH 07/26] drbd: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
Convert the drbd driver to use the blk_alloc_disk and blk_cleanup_disk helpers to simplify gendisk and request_queue allocation. Signed-off-by: Christoph Hellwig --- drivers/block/drbd/drbd_main.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a

[PATCH 06/26] brd: convert to blk_alloc_disk/blk_cleanup_disk

2021-05-20 Thread Christoph Hellwig
from blk_alloc_disk. Signed-off-by: Christoph Hellwig --- drivers/block/brd.c | 94 - 1 file changed, 33 insertions(+), 61 deletions(-) diff --git a/drivers/block/brd.c b/drivers/block/brd.c index 7562cf30b14e..95694113e38e 100644 --- a/drivers/block

[PATCH 03/26] block: automatically enable GENHD_FL_EXT_DEVT

2021-05-20 Thread Christoph Hellwig
Automatically set the GENHD_FL_EXT_DEVT flag for all disks allocated without an explicit number of minors. This is what all new block drivers should do, so make sure it is the default without boilerplate code. Signed-off-by: Christoph Hellwig --- block/genhd.c| 2 +- block

[PATCH 05/26] block: add blk_alloc_disk and blk_cleanup_disk APIs

2021-05-20 Thread Christoph Hellwig
Add two new APIs to allocate and free a gendisk including the request_queue for use with BIO based drivers. This is to avoid boilerplate code in drivers. Signed-off-by: Christoph Hellwig --- block/genhd.c | 35 +++ include/linux/genhd.h | 22

[PATCH 04/26] block: add a flag to make put_disk on partially initalized disks safer

2021-05-20 Thread Christoph Hellwig
Add a flag to indicate that __device_add_disk did grab a queue reference so that disk_release only drops it if we actually had it. This sort out one of the major pitfals with partially initialized gendisk that a lot of drivers did get wrong or still do. Signed-off-by: Christoph Hellwig

[PATCH 02/26] block: move the DISK_MAX_PARTS sanity check into __device_add_disk

2021-05-20 Thread Christoph Hellwig
Keep this together with the first place that actually looks at ->minors and prepare for not passing a minors argument to alloc_disk. Signed-off-by: Christoph Hellwig --- block/genhd.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/block/genhd.c b/block/genh

simplify gendisk and request_queue allocation for bio based drivers

2021-05-20 Thread Christoph Hellwig
Hi all, this series is the first part of cleaning up lifetimes and allocation of the gendisk and request_queue structure. It adds a new interface to allocate the disk and queue together for bio based drivers, and a helper for cleanup/free them when a driver is unloaded or a device is removed. To

simplify gendisk and request_queue allocation for bio based drivers

2021-05-20 Thread Christoph Hellwig
Hi all, this series is the first part of cleaning up lifetimes and allocation of the gendisk and request_queue structure. It adds a new interface to allocate the disk and queue together for bio based drivers, and a helper for cleanup/free them when a driver is unloaded or a device is removed. To

[PATCH 01/26] block: refactor device number setup in __device_add_disk

2021-05-20 Thread Christoph Hellwig
Untangle the mess around blk_alloc_devt by moving the check for the used allocation scheme into the callers. Signed-off-by: Christoph Hellwig --- block/blk.h | 4 +- block/genhd.c | 96 - block/partitions/core.c | 15 +-- 3

Re: [PATCH v6 08/15] swiotlb: Bounce data from/to restricted DMA pool if available

2021-05-10 Thread Christoph Hellwig
> +static inline bool is_dev_swiotlb_force(struct device *dev) > +{ > +#ifdef CONFIG_DMA_RESTRICTED_POOL > + if (dev->dma_io_tlb_mem) > + return true; > +#endif /* CONFIG_DMA_RESTRICTED_POOL */ > + return false; > +} > + > /* If SWIOTLB is active, use its maximum mapping

Re: [PATCH v6 05/15] swiotlb: Add a new get_io_tlb_mem getter

2021-05-10 Thread Christoph Hellwig
> +static inline struct io_tlb_mem *get_io_tlb_mem(struct device *dev) > +{ > +#ifdef CONFIG_DMA_RESTRICTED_POOL > + if (dev && dev->dma_io_tlb_mem) > + return dev->dma_io_tlb_mem; > +#endif /* CONFIG_DMA_RESTRICTED_POOL */ > + > + return io_tlb_default_mem; Given that we're al

Re: [PATCH v6 04/15] swiotlb: Add restricted DMA pool initialization

2021-05-10 Thread Christoph Hellwig
> +#ifdef CONFIG_DMA_RESTRICTED_POOL > +#include > +#include > +#include > +#include > +#include > +#endif I don't think any of this belongs into swiotlb.c. Marking swiotlb_init_io_tlb_mem non-static and having all this code in a separate file is probably a better idea. > +#ifdef CONFIG_DMA

Re: [PATCH v6 02/15] swiotlb: Refactor swiotlb_create_debugfs

2021-05-10 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig

Re: [PATCH v6 01/15] swiotlb: Refactor swiotlb init functions

2021-05-10 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig

Re: [PATCH] vfio/pci: Revert nvlink removal uAPI breakage

2021-05-04 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig

Re: remove the nvlink2 pci_vfio subdriver v2

2021-05-04 Thread Christoph Hellwig
On Tue, May 04, 2021 at 02:59:07PM +0200, Greg Kroah-Hartman wrote: > > Hi Christoph, > > > > FYI, these uapi changes break build of QEMU. > > What uapi changes? > > What exactly breaks? > > Why does QEMU require kernel driver stuff? Looks like it pull in the uapi struct definitions unconditio

Re: [PATCH v5 01/16] swiotlb: Fix the type of index

2021-04-23 Thread Christoph Hellwig
On Thu, Apr 22, 2021 at 04:14:53PM +0800, Claire Chang wrote: > Fix the type of index from unsigned int to int since find_slots() might > return -1. > > Fixes: 0774983bc923 ("swiotlb: refactor swiotlb_tbl_map_single") > Signed-off-by: Claire Chang Looks good: Revie

[PATCH 6/7] swiotlb: replace default_nslabs with a byte value

2021-04-22 Thread Christoph Hellwig
Replace the default_nslabs variable with one that stores the size in bytes as that is what all the users actually expect. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma

[PATCH 1/7] swiotlb: pass bytes instead of nslabs to swiotlb_init_with_tbl

2021-04-22 Thread Christoph Hellwig
Pass the actual allocation size to swiotlb_init_with_tbl, which simplifies things quite a bit. Signed-off-by: Christoph Hellwig --- arch/mips/cavium-octeon/dma-octeon.c | 2 +- arch/powerpc/platforms/pseries/svm.c | 3 +-- drivers/xen/swiotlb-xen.c| 2 +- include/linux/swiotlb.h

[PATCH 7/7] swiotlb: don't override the command line in swiotlb_adjust_size

2021-04-22 Thread Christoph Hellwig
When the user specified an explicit swiotlb size on the command line, the achitecture code should not override it. Fixes: 2cbc2776efe4 ("swiotlb: remove swiotlb_nr_tbl") Reported-by: Tom Lendacky Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 6 +- 1 file changed, 5

[PATCH 2/7] swiotlb: use swiotlb_size_or_default in swiotlb_init

2021-04-22 Thread Christoph Hellwig
Use swiotlb_size_or_default to calculate the buffer size insted of open coding it. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index c7b3dd86db7f56..27461fd63e0330

[PATCH 4/7] powerpc/pseries: simplify svm_swiotlb_init

2021-04-22 Thread Christoph Hellwig
The value returned by swiotlb_size_or_default is always properly aligned now, so don't duplicate the work. Signed-off-by: Christoph Hellwig --- arch/powerpc/platforms/pseries/svm.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/ps

cleanup and fix swiotlb sizing

2021-04-22 Thread Christoph Hellwig
Hi all, based on a report from Tom that overriding the default sizing provided by the x86 SEV code on the command line doesn't work anymore, this series cleans up how we handle default and command line sizes for the swiotlb buffer and then fixes the recently introduced bug in a straight-forward wa

[PATCH 3/7] swiotlb: use swiotlb_adjust_size in setup_io_tlb_npages

2021-04-22 Thread Christoph Hellwig
Use the proper helper to do the proper alignment of the buffer size to the requirements of the swiotlb allocator instead of open coding the logic. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/kernel/dma

[PATCH 5/7] MIPS/octeon: simplify swiotlb initialization

2021-04-22 Thread Christoph Hellwig
Just use swiotlb_adjust_size and swiotlb_init to initialize swiotlb instead of doing a lot of manual work. Signed-off-by: Christoph Hellwig --- arch/mips/cavium-octeon/dma-octeon.c | 16 ++-- arch/mips/include/asm/octeon/pci-octeon.h | 1 - arch/mips/pci/pci-octeon.c

Re: swiotlb cleanups v3

2021-04-20 Thread Christoph Hellwig
On Sat, Apr 17, 2021 at 11:39:22AM -0500, Tom Lendacky wrote: > Somewhere between the 1st and 2nd patch, specifying a specific swiotlb > for an SEV guest is no longer honored. For example, if I start an SEV > guest with 16GB of memory and specify swiotlb=131072 I used to get a > 256MB SWIOTLB. Howe

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-18 Thread Christoph Hellwig
On Fri, Apr 16, 2021 at 04:27:55PM +0100, Matthew Wilcox wrote: > On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote: > > See below patch. Where I swap32 the dma address to satisfy > > page->compound having bit zero cleared. (It is the simplest fix I could > > come up with). >

[PATCH 3/5] uapi: merge the 32-bit mips struct flock into the generic one

2021-04-12 Thread Christoph Hellwig
Add a new __ARCH_FLOCK_EXTRA_SYSID macro following the style of __ARCH_FLOCK_PAD to avoid having a separate definition just for one architecture. Signed-off-by: Christoph Hellwig --- arch/mips/include/uapi/asm/fcntl.h | 26 +++--- include/uapi/asm-generic/fcntl.h

[PATCH 1/5] uapi: remove the unused HAVE_ARCH_STRUCT_FLOCK64 define

2021-04-12 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- include/uapi/asm-generic/fcntl.h | 2 -- tools/include/uapi/asm-generic/fcntl.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h index 9dc0bf0c5a6ee8..fb454bb629d114 100644 --- a

consolidate the flock uapi definitions

2021-04-12 Thread Christoph Hellwig
Hi all, currently we deal with the slight differents in the various architecture variants of the flock and flock64 stuctures in a very cruft way. This series switches to just use small arch hooks and define the rest in asm-generic and linux/compat.h instead. Diffstat: arch/arm64/include/asm/com

[PATCH 4/5] uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h

2021-04-12 Thread Christoph Hellwig
other. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/compat.h| 4 arch/mips/include/asm/compat.h | 4 arch/mips/include/uapi/asm/fcntl.h | 2 -- arch/powerpc/include/asm/compat.h | 4 arch/s390/include/asm/compat.h | 4 arch/sparc/in

[PATCH 2/5] uapi: simplify __ARCH_FLOCK{,64}_PAD a little

2021-04-12 Thread Christoph Hellwig
Don't bother to define emtpty versions of the macros if the architecture doesn't define them. Signed-off-by: Christoph Hellwig --- include/uapi/asm-generic/fcntl.h | 12 tools/include/uapi/asm-generic/fcntl.h | 12 2 files changed, 8 insertions(+), 16

[PATCH 5/5] compat: consolidate the compat_flock{,64} definition

2021-04-12 Thread Christoph Hellwig
Provide a single common definition for the compat_flock and compat_flock64 structures using the same tricks as for the native variants. An extra define is added for the packing required on x86. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/compat.h | 16 arch

[PATCH] swim3: support highmem

2021-04-05 Thread Christoph Hellwig
buffering. Signed-off-by: Christoph Hellwig --- drivers/block/swim3.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index c2d922d125e281..a515d0c1d2cb8e 100644 --- a/drivers/block/swim3.c +++ b

[PATCH 20/20] iommu: remove iommu_domain_{get,set}_attr

2021-04-01 Thread Christoph Hellwig
Remove the now unused iommu attr infrastructure. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon --- drivers/iommu/iommu.c | 26 -- include/linux/iommu.h | 36 2 files changed, 62 deletions(-) diff --git a/drivers/iommu

[PATCH 19/20] iommu: remove DOMAIN_ATTR_IO_PGTABLE_CFG

2021-04-01 Thread Christoph Hellwig
Use an explicit set_pgtable_quirks method instead that just passes the actual quirk bitmask instead. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 5 +- drivers/iommu/arm/arm-smmu/arm-smmu.c | 64

[PATCH 18/20] iommu: remove DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE

2021-04-01 Thread Christoph Hellwig
flushing a new IOMMU_CMD_LINE_STRICT is used to turn the value into a tristate to represent the default if not overriden by an explicit parameter. Signed-off-by: Robin Murphy . [ported on top of the other iommu_attr changes and added a few small missing bits] Signed-off-by: Christoph Hellwig

[PATCH 17/20] iommu: remove iommu_set_cmd_line_dma_api and iommu_cmd_line_dma_api

2021-04-01 Thread Christoph Hellwig
Don't obsfucate the trivial bit flag check. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon --- drivers/iommu/iommu.c | 23 +-- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 58d1d11a8

[PATCH 16/20] iommu: remove DOMAIN_ATTR_NESTING

2021-04-01 Thread Christoph Hellwig
Use an explicit enable_nesting method instead. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 43 - drivers/iommu/arm/arm-smmu/arm-smmu.c | 30 +++--- drivers/iommu/intel/iommu.c

[PATCH 15/20] iommu: remove DOMAIN_ATTR_GEOMETRY

2021-04-01 Thread Christoph Hellwig
The geometry information can be trivially queried from the iommu_domain struture. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/iommu/iommu.c | 20 +++- drivers/vfio/vfio_iommu_type1.c | 26 -- drivers

[PATCH 14/20] iommu: remove DOMAIN_ATTR_PAGING

2021-04-01 Thread Christoph Hellwig
DOMAIN_ATTR_PAGING is never used. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/iommu/iommu.c | 5 - include/linux/iommu.h | 1 - 2 files changed, 6 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index b212bf0261820b

[PATCH 13/20] iommu/fsl_pamu: hardcode the window address and size in pamu_config_ppaace

2021-04-01 Thread Christoph Hellwig
The win_addr and win_size parameters are always set to 0 and 1 << 36 respectively, so just hard code them. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu.c| 23 --- drivers/iommu/fsl_pamu.h| 3 +-- drivers/iommu/fsl_pamu_domain.

[PATCH 12/20] iommu/fsl_pamu: remove the rpn and snoop_id arguments to pamu_config_ppaac

2021-04-01 Thread Christoph Hellwig
These are always wired to fixed values, so don't bother passing them as arguments. Signed-off-by: Christoph Hellwig --- drivers/iommu/fsl_pamu.c| 14 +++--- drivers/iommu/fsl_pamu.h| 3 +-- drivers/iommu/fsl_pamu_domain.c | 6 +++--- 3 files changed, 7 inser

[PATCH 11/20] iommu/fsl_pamu: remove the snoop_id field

2021-04-01 Thread Christoph Hellwig
The snoop_id is always set to ~(u32)0. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/iommu/fsl_pamu_domain.c | 5 ++--- drivers/iommu/fsl_pamu_domain.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/fsl_pamu_domain.c

[PATCH 10/20] iommu/fsl_pamu: enable the liodn when attaching a device

2021-04-01 Thread Christoph Hellwig
Instead of a separate call to enable all devices from the list, just enable the liodn once the device is attached to the iommu domain. This also remove the DOMAIN_ATTR_FSL_PAMU_ENABLE iommu_attr. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/iommu

[PATCH 09/20] iommu/fsl_pamu: merge handle_attach_device into fsl_pamu_attach_device

2021-04-01 Thread Christoph Hellwig
No good reason to split this functionality over two functions. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/iommu/fsl_pamu_domain.c | 59 +++-- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/drivers/iommu

[PATCH 08/20] iommu/fsl_pamu: merge pamu_set_liodn and map_liodn

2021-04-01 Thread Christoph Hellwig
Merge the two fuctions that configure the ppaace into a single coherent function. I somehow doubt we need the two pamu_config_ppaace calls, but keep the existing behavior just to be on the safe side. Signed-off-by: Christoph Hellwig Acked-by: Li Yang --- drivers/iommu/fsl_pamu_domain.c | 65

[PATCH 07/20] iommu/fsl_pamu: replace DOMAIN_ATTR_FSL_PAMU_STASH with a direct call

2021-04-01 Thread Christoph Hellwig
Add a fsl_pamu_configure_l1_stash API that qman_portal can call directly instead of indirecting through the iommu attr API. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- arch/powerpc/include/asm/fsl_pamu_stash.h | 12 +++- drivers/iommu/fsl_pamu_domain.c

cleanup unused or almost unused IOMMU APIs and the FSL PAMU driver v3

2021-04-01 Thread Christoph Hellwig
Hi all, there are a bunch of IOMMU APIs that are entirely unused, or only used as a private communication channel between the FSL PAMU driver and it's only consumer, the qbman portal driver. So this series drops a huge chunk of entirely unused FSL PAMU functionality, then drops all kinds of unuse

[PATCH 01/20] iommu: remove the unused domain_window_disable method

2021-04-01 Thread Christoph Hellwig
domain_window_disable is wired up by fsl_pamu, but never actually called. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/iommu/fsl_pamu_domain.c | 48 - include/linux/iommu.h | 2 -- 2 files changed, 50 deletions

[PATCH 06/20] iommu/fsl_pamu: remove ->domain_window_enable

2021-04-01 Thread Christoph Hellwig
use the iommu_domain_geometry structure instead. Remove the now unused ->domain_window_enable iommu method. Signed-off-by: Christoph Hellwig Acked-by: Li Yang --- drivers/iommu/fsl_pamu_domain.c | 182 +++- drivers/iommu/fsl_pamu_domain.h | 15 --- drivers/io

[PATCH 04/20] iommu/fsl_pamu: merge iommu_alloc_dma_domain into fsl_pamu_domain_alloc

2021-04-01 Thread Christoph Hellwig
Keep the functionality to allocate the domain together. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/iommu/fsl_pamu_domain.c | 34 ++--- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/iommu

[PATCH 05/20] iommu/fsl_pamu: remove support for multiple windows

2021-04-01 Thread Christoph Hellwig
The only domains allocated forces use of a single window. Remove all the code related to multiple window support, as well as the need for qman_portal to force a single window. Remove the now unused DOMAIN_ATTR_WINDOWS iommu_attr. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by

[PATCH 03/20] iommu/fsl_pamu: remove support for setting DOMAIN_ATTR_GEOMETRY

2021-04-01 Thread Christoph Hellwig
The default geometry is the same as the one set by qman_port given that FSL_PAMU depends on having 64-bit physical and thus DMA addresses. Remove the support to update the geometry and remove the now pointless geom_size field. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li

[PATCH 02/20] iommu/fsl_pamu: remove fsl_pamu_get_domain_attr

2021-04-01 Thread Christoph Hellwig
None of the values returned by this function are ever queried. Also remove the DOMAIN_ATTR_FSL_PAMUV1 enum value that is not otherwise used. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon Acked-by: Li Yang --- drivers/iommu/fsl_pamu_domain.c | 30

Re: [PATCH 16/18] iommu: remove DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE

2021-04-01 Thread Christoph Hellwig
For now I'll just pass the iommu_domain to iommu_get_dma_strict, so that we can check for it. We can do additional cleanups on top of that later.

Re: [PATCH 11/18] iommu/fsl_pamu: remove the snoop_id field

2021-04-01 Thread Christoph Hellwig
On Tue, Mar 30, 2021 at 01:58:17PM +0100, Will Deacon wrote: > pamu_config_ppaace() takes quite a few useless parameters at this stage, > but anyway: I'll see it it makes sense to throw in another patch at the end to cut it down a bit more. > Acked-by: Will Deacon > > Do you know if this driver

Re: [PATCH 08/18] iommu/fsl_pamu: merge pamu_set_liodn and map_liodn

2021-04-01 Thread Christoph Hellwig
On Tue, Mar 30, 2021 at 01:46:51PM +0100, Will Deacon wrote: > > + ret = pamu_config_ppaace(liodn, geom->aperture_start, > > +geom->aperture_end - 1, ~(u32)0, > > +0, dma_domain->snoop_id, dma_domain->stash_id, > > +

<    1   2   3   4   5   6   7   8   9   10   >