public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iomem: remove __weak ioremap_cache helper
Date: Thu, 27 Jul 2023 08:21:39 +0800	[thread overview]
Message-ID: <ZMG4kw3k1cCGTL2L@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20230726145432.1617809-1-arnd@kernel.org>

Hi Arnd,

On 07/26/23 at 04:54pm, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> No portable code calls into this function any more, and on
> architectures that don't use or define their own, it causes
> a warning:
> 
> kernel/iomem.c:10:22: warning: no previous prototype for 'ioremap_cache' [-Wmissing-prototypes]
>    10 | __weak void __iomem *ioremap_cache(resource_size_t offset, unsigned long size)
> 
> Fold it into the only caller that uses it on architectures
> without the #define.
> 
> Note that the fallback to ioremap is probably still wrong on
> those architectures, but this is what it's always done there.

Do we need to add a definition of ioremap_cache in asm-generic/io.h like
ioremap_wc|wt?

#ifndef ioremap_cache
#define ioremap_cahce ioremap
#endif

Unless it's for sure that drivers calling ioremap_cache are only built in
on those architecures defining it. Or we just want to see the breakage
on those ARCH-es so that they will add their own definition.

Not sure if I missed anything when understanding this.

drivers/acpi/apei/bert.c:       boot_error_region = ioremap_cache(bert_tab->address, region_len);
drivers/acpi/apei/einj.c:       trigger_tab = ioremap_cache(trigger_paddr, sizeof(*trigger_tab));
drivers/acpi/apei/einj.c:       trigger_tab = ioremap_cache(trigger_paddr, table_size);
drivers/acpi/apei/erst.c:       erst_erange.vaddr = ioremap_cache(erst_erange.base,
drivers/firmware/efi/memmap.c: * Setup a mapping of the EFI memory map using ioremap_cache(). This
drivers/firmware/meson/meson_sm.c:      return ioremap_cache(sm_phy_base, size);
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:                adev->mman.aper_base_kaddr = ioremap_cache(adev->gmc.aper_base,
drivers/gpu/drm/hyperv/hyperv_drm_drv.c:        hv->vram = ioremap_cache(hv->mem->start, hv->fb_size);
drivers/gpu/drm/ttm/ttm_bo_util.c:                      map->virtual = ioremap_cache(res, size);
drivers/gpu/drm/ttm/ttm_bo_util.c:                      vaddr_iomem = ioremap_cache(mem->bus.offset,
drivers/hv/hv.c:                /* Mask out vTOM bit. ioremap_cache() maps decrypted */
drivers/hv/hv.c:                        = (void *)ioremap_cache(base, HV_HYP_PAGE_SIZE);
drivers/hv/hv.c:                /* Mask out vTOM bit. ioremap_cache() maps decrypted */
drivers/hv/hv.c:                        = (void *)ioremap_cache(base, HV_HYP_PAGE_SIZE);
drivers/mtd/devices/bcm47xxsflash.c:            b47s->window = ioremap_cache(res->start, resource_size(res));
drivers/mtd/maps/pxa2xx-flash.c:        info->map.cached = ioremap_cache(info->map.phys, info->map.size);
drivers/soc/fsl/qbman/qman_ccsr.c:      void __iomem *tmpp = ioremap_cache(addr, sz);
drivers/video/fbdev/hyperv_fb.c:        fb_virt = ioremap_cache(par->mem->start, screen_fb_size);
include/acpi/acpi_io.h:       return ioremap_cache(phys, size);

> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  kernel/iomem.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/iomem.c b/kernel/iomem.c
> index 9682471e64717..dc2120776e1c3 100644
> --- a/kernel/iomem.c
> +++ b/kernel/iomem.c
> @@ -5,18 +5,14 @@
>  #include <linux/mm.h>
>  #include <linux/ioremap.h>
>  
> -#ifndef ioremap_cache
> -/* temporary while we convert existing ioremap_cache users to memremap */
> -__weak void __iomem *ioremap_cache(resource_size_t offset, unsigned long size)
> -{
> -	return ioremap(offset, size);
> -}
> -#endif
> -
>  #ifndef arch_memremap_wb
>  static void *arch_memremap_wb(resource_size_t offset, unsigned long size)
>  {
> +#ifdef ioremap_cache
>  	return (__force void *)ioremap_cache(offset, size);
> +#else
> +	return (__force void *)ioremap(offset, size);
> +#endif
>  }
>  #endif
>  
> -- 
> 2.39.2
> 


  reply	other threads:[~2023-07-27  0:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 14:54 [PATCH] iomem: remove __weak ioremap_cache helper Arnd Bergmann
2023-07-27  0:21 ` Baoquan He [this message]
2023-07-27  8:18   ` Arnd Bergmann
2023-07-27 10:21     ` Baoquan He
2023-07-27 10:22 ` Baoquan He
2023-08-01 11:08 ` Christoph Hellwig

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=ZMG4kw3k1cCGTL2L@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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