public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm•com>
To: Baruch Siach <baruch@tkos•co.il>
Cc: linux-s390@vger•kernel.org, "Ramon Fried" <ramon@neureality•ai>,
	"Petr Tesařík" <petr@tesarici•cz>,
	"Will Deacon" <will@kernel•org>,
	linuxppc-dev@lists•ozlabs.org, linux-kernel@vger•kernel.org,
	iommu@lists•linux.dev, "Elad Nachman" <enachman@marvell•com>,
	"Robin Murphy" <robin.murphy@arm•com>,
	"Christoph Hellwig" <hch@lst•de>,
	linux-arm-kernel@lists•infradead.org,
	"Marek Szyprowski" <m.szyprowski@samsung•com>
Subject: Re: [PATCH v4 2/2] dma: replace zone_dma_bits by zone_dma_limit
Date: Thu, 1 Aug 2024 11:30:46 +0100	[thread overview]
Message-ID: <Zqtj1iCyRJqh_xeL@arm.com> (raw)
In-Reply-To: <f05178048096908a13379a61ca56f0035a5cdb2d.1722499975.git.baruch@tkos.co.il>

On Thu, Aug 01, 2024 at 11:25:07AM +0300, Baruch Siach wrote:
> diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c
> index d10613eb0f63..a6e15db9d1e7 100644
> --- a/kernel/dma/pool.c
> +++ b/kernel/dma/pool.c
> @@ -70,9 +70,10 @@ static bool cma_in_zone(gfp_t gfp)
>  	/* CMA can't cross zone boundaries, see cma_activate_area() */
>  	end = cma_get_base(cma) + size - 1;
>  	if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA))
> -		return end <= DMA_BIT_MASK(zone_dma_bits);
> +		return end <= zone_dma_limit;
> +	/* Account for possible zone_dma_limit > DMA_BIT_MASK(32) */
>  	if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32))
> -		return end <= DMA_BIT_MASK(32);
> +		return end <= DMA_BIT_MASK(32) || end <= zone_dma_limit;
>  	return true;
>  }
>  
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 043b0ecd3e8d..53595eb41922 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -450,7 +450,7 @@ int swiotlb_init_late(size_t size, gfp_t gfp_mask,
>  	if (!remap)
>  		io_tlb_default_mem.can_grow = true;
>  	if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp_mask & __GFP_DMA))
> -		io_tlb_default_mem.phys_limit = DMA_BIT_MASK(zone_dma_bits);
> +		io_tlb_default_mem.phys_limit = zone_dma_limit;
>  	else if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp_mask & __GFP_DMA32))
>  		io_tlb_default_mem.phys_limit = DMA_BIT_MASK(32);

I think this needs some adjustment as the cma_in_zone() case. Maybe just
use max(DMA_BIT_MASK(32), zone_dma_limit) in both cases for consistency.

-- 
Catalin

      parent reply	other threads:[~2024-08-01 10:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01  8:25 [PATCH v4 0/2] dma: support DMA zone starting above 4GB Baruch Siach
2024-08-01  8:25 ` [PATCH v4 1/2] dma: improve DMA zone selection Baruch Siach
2024-08-01  8:56   ` Catalin Marinas
2024-08-01  8:25 ` [PATCH v4 2/2] dma: replace zone_dma_bits by zone_dma_limit Baruch Siach
2024-08-01 10:09   ` Catalin Marinas
2024-08-01 10:30   ` Catalin Marinas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zqtj1iCyRJqh_xeL@arm.com \
    --to=catalin.marinas@arm$(echo .)com \
    --cc=baruch@tkos$(echo .)co.il \
    --cc=enachman@marvell$(echo .)com \
    --cc=hch@lst$(echo .)de \
    --cc=iommu@lists$(echo .)linux.dev \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-s390@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=m.szyprowski@samsung$(echo .)com \
    --cc=petr@tesarici$(echo .)cz \
    --cc=ramon@neureality$(echo .)ai \
    --cc=robin.murphy@arm$(echo .)com \
    --cc=will@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox