linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3] arm: xen: mm: use __GPF_DMA32 for arm64
@ 2019-09-16  9:51 Peng Fan
  2019-10-02  1:32 ` Stefano Stabellini
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan @ 2019-09-16  9:51 UTC (permalink / raw)
  To: sstabellini, linux, catalin.marinas, will, robin.murphy
  Cc: xen-devel, Peng Fan, dl-linux-imx, linux-arm-kernel

From: Peng Fan <peng.fan@nxp.com>

arm64 shares some code under arch/arm/xen, including mm.c.
However ZONE_DMA is removed by commit
ad67f5a6545("arm64: replace ZONE_DMA with ZONE_DMA32").

So add a check if CONFIG_ZONE_DMA32 is enabled use __GFP_DMA32.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V3:
 Use IS_ENABLED(CONFIG_ZONE_DMA32) and drop xen_set_gfp_dma.

V2:
 Follow suggestion from Stefano,
 introduce static inline void xen_set_gfp_dma(gfp_t *flags) for arm32/arm64, and
 for arm64 using __GFP_DMA for the former and __GFP_DMA32 for the latter.


 arch/arm/xen/mm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
index 2b2c208408bb..38fa917c8585 100644
--- a/arch/arm/xen/mm.c
+++ b/arch/arm/xen/mm.c
@@ -28,7 +28,10 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order)
 
 	for_each_memblock(memory, reg) {
 		if (reg->base < (phys_addr_t)0xffffffff) {
-			flags |= __GFP_DMA;
+			if (IS_ENABLED(CONFIG_ZONE_DMA32))
+				flags |= __GFP_DMA32;
+			else
+				flags |= __GFP_DMA;
 			break;
 		}
 	}
-- 
2.16.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V3] arm: xen: mm: use __GPF_DMA32 for arm64
  2019-09-16  9:51 [PATCH V3] arm: xen: mm: use __GPF_DMA32 for arm64 Peng Fan
@ 2019-10-02  1:32 ` Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2019-10-02  1:32 UTC (permalink / raw)
  To: Peng Fan
  Cc: sstabellini, catalin.marinas, linux, dl-linux-imx, xen-devel,
	will, linux-arm-kernel, robin.murphy

On Mon, 16 Sep 2019, Peng Fan wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> arm64 shares some code under arch/arm/xen, including mm.c.
> However ZONE_DMA is removed by commit
> ad67f5a6545("arm64: replace ZONE_DMA with ZONE_DMA32").
> 
> So add a check if CONFIG_ZONE_DMA32 is enabled use __GFP_DMA32.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> 
> V3:
>  Use IS_ENABLED(CONFIG_ZONE_DMA32) and drop xen_set_gfp_dma.
> 
> V2:
>  Follow suggestion from Stefano,
>  introduce static inline void xen_set_gfp_dma(gfp_t *flags) for arm32/arm64, and
>  for arm64 using __GFP_DMA for the former and __GFP_DMA32 for the latter.
> 
> 
>  arch/arm/xen/mm.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
> index 2b2c208408bb..38fa917c8585 100644
> --- a/arch/arm/xen/mm.c
> +++ b/arch/arm/xen/mm.c
> @@ -28,7 +28,10 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order)
>  
>  	for_each_memblock(memory, reg) {
>  		if (reg->base < (phys_addr_t)0xffffffff) {
> -			flags |= __GFP_DMA;
> +			if (IS_ENABLED(CONFIG_ZONE_DMA32))
> +				flags |= __GFP_DMA32;
> +			else
> +				flags |= __GFP_DMA;
>  			break;
>  		}
>  	}
> -- 
> 2.16.4
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-02  1:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-16  9:51 [PATCH V3] arm: xen: mm: use __GPF_DMA32 for arm64 Peng Fan
2019-10-02  1:32 ` Stefano Stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).