Re: [PATCH] Swiotlb: Add CONFIG_HAS_IOMEM check around memremap() in the swiotlb_mem_remap()

From: Christoph Hellwig
Date: Mon Jan 03 2022 - 02:54:56 EST


On Fri, Dec 31, 2021 at 11:56:40AM -0500, Tianyu Lan wrote:
> From: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>
>
> HAS_IOMEM option may not be selected on some platforms(e.g, s390) and this
> will cause compile error due to miss memremap() implementation. Fix it via
> adding HAS_IOMEM check around memremap() in the swiotlb.c.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Signed-off-by: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>
> ---
> kernel/dma/swiotlb.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index b36c1cdd0c4f..3de651ba38cc 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -167,6 +167,7 @@ static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes)
> {
> void *vaddr = NULL;
>
> +#ifdef CONFIG_HAS_IOMEM

Please stub out all of swiotlb_mem_remap instead of the ifdef inside the
function.