Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1717784rwb; Wed, 26 Jul 2023 17:52:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlG0913qGD0l+uG8jGeIwijpIst5IMoOMk24QCMtS1/2yLHyPJp0ug3xXGN5Azr2Li3fSDlc X-Received: by 2002:a17:906:188:b0:994:56d3:8a42 with SMTP id 8-20020a170906018800b0099456d38a42mr572096ejb.27.1690419165929; Wed, 26 Jul 2023 17:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690419165; cv=none; d=google.com; s=arc-20160816; b=scUjLPgrUYkaWBquNESaNJs01lL64eYeYXx4yviGALBhr0d62Cx0YCqY1JVducGgo2 qq6gBBo/cQyYIysRUQiLK5Fa59gs7Yeo5Jakg8wFRNVwT3+fFrtsWDQfC4P2hVNbgAKE 3FllAiMjz/SSeH631aSF7a9diaYcBzSSYAvYIySe8BMPf+TvFrW1jx2A4EKWtVFY7ml2 EbaIy5lZH42uTlBudzIJc6WV12gARfGcsywD9ObDfzWCHawbKa4qX7JBQi6RNkXdNJeP mYw17DuimNBvvPxw6Id07Q92oL5zCops9NLoWk7pCiUj4hoNoZmBvrgE7jpwBVyIJz5N T+QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DNn/LZUJS32/scZrimiNriOR4WinuQhjPdO24euRKzc=; fh=5Ib3WqJ3OZ5XPmLEaC3VlQbuheTcvzReawW7Y71rx2I=; b=g7e9HJD1dJTvj720aP5fkfi1rMXPoxfOKLOXK2H7/+XXI+g6dxp7rVzlqVn4P4eDeC CpO2jxe2iEXD5ecbtPT1023v66YgrNXAKaT7gWmPN7qTl24oy6sh3A7aenQvozXMkuX2 /mZ229ELBDSHU4qbqVQCS9M3/rn6VFIyPyX+zvXfn03s+i4brCzeINUn8EY5Pc2RHc6w QmA5NkWFXf+HKYsW1zlM4SCvoykf6/lbwc1ivWTzBdQTEcgYqRHx+mgEx/omQzn1ZyJV cLpaTwh0+ah6rUb/yaiTbDcQ1oqtQf6hZcmYAjCsMMGg1fiRGhgN9cry7vJQabUXJPsU K94w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=goI9bAqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rl19-20020a170907217300b0099bcc37923esi118069ejb.690.2023.07.26.17.52.19; Wed, 26 Jul 2023 17:52:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=goI9bAqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbjG0AWh (ORCPT + 99 others); Wed, 26 Jul 2023 20:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbjG0AWg (ORCPT ); Wed, 26 Jul 2023 20:22:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D29D819B5 for ; Wed, 26 Jul 2023 17:21:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690417308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DNn/LZUJS32/scZrimiNriOR4WinuQhjPdO24euRKzc=; b=goI9bAqmX2lCTnbe0rd3ZxCoZQNIV9mdS8/tG/YgAqYNVjt8VXYGOASF0T/t9mQiqfJGiT +SNizM2ZQRViY7vT5XdroWeLpPCQWd0qdO0F6l37oayaz9YsqxW+O4BiQCFgN2tstzSdL8 FSYVnv990L96gB3dh2aQl4ajfHLTaPg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-HxyUzRBvPUiWkLLsENQVeQ-1; Wed, 26 Jul 2023 20:21:44 -0400 X-MC-Unique: HxyUzRBvPUiWkLLsENQVeQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 15B491011596; Thu, 27 Jul 2023 00:21:44 +0000 (UTC) Received: from localhost (unknown [10.72.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58F0D2166B25; Thu, 27 Jul 2023 00:21:42 +0000 (UTC) Date: Thu, 27 Jul 2023 08:21:39 +0800 From: Baoquan He To: Arnd Bergmann Cc: Andrew Morton , Arnd Bergmann , linux-kernel@vger.kernel.org Subject: Re: [PATCH] iomem: remove __weak ioremap_cache helper Message-ID: References: <20230726145432.1617809-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230726145432.1617809-1-arnd@kernel.org> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, On 07/26/23 at 04:54pm, Arnd Bergmann wrote: > From: Arnd Bergmann > > 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 > --- > 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 > #include > > -#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 >