From patchwork Fri Sep 9 03:18:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 9322363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 22DC360231 for ; Fri, 9 Sep 2016 03:11:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1476529B26 for ; Fri, 9 Sep 2016 03:11:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 087D529B34; Fri, 9 Sep 2016 03:11:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9014729B26 for ; Fri, 9 Sep 2016 03:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750908AbcIIDLd (ORCPT ); Thu, 8 Sep 2016 23:11:33 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:34479 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751382AbcIIDLb (ORCPT ); Thu, 8 Sep 2016 23:11:31 -0400 Received: by mail-pf0-f172.google.com with SMTP id p64so24599875pfb.1 for ; Thu, 08 Sep 2016 20:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lirQhmzJw7j9DatML15+BBlVD+EzPepLuqWXkR/FuFI=; b=WRnrltOz5YSOtyorulq0GW6qNT7vBcBhhQdPmJQy/dQLD9oYNufcW/MgrRaImnOPMp eyg7kzlk8bKZiPmdAzMnc9FI7MuDeeAjmE590qGjypFQVsjlyhhZwA6vqbwwMVvvDaLH obxcLrMf8XfPZ7+kvj6NYoMBt8vSCMK4dq6SU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=lirQhmzJw7j9DatML15+BBlVD+EzPepLuqWXkR/FuFI=; b=fK4mC3pIn+w+xjnfTMI5n66HvxHMaMqeIYn3nGqjE37/ceIatohccOCmgHfsQdqRg8 tU/adX9qxm5I8gP3VmVoF7jTEuo4UcQX6jbwZaZWgbB5hJtfEIyRgOaFlcLEO0MIvHN7 y4je6diDZ+58EVOIKZhwy/ww237eds29NdpDOL77xzkx1lCEb615EAu8JN6P2WotJdRH 26xJVO0hVlIXfV7agBA0sQvvJpHF0NDckdNWYzzLTG7SkXFox4sjYwYfwN8Gbb+EaL90 lW5ZmOe15LHTn7k7yKk8rUqNjTfdYfAXF6FECY12LWT6bog47VcMi4ie7BAdT5pbYZSY B5xg== X-Gm-Message-State: AE9vXwOlPa8A7/OoWbZE8HBma4WvVSzuraYpzKYVrfLdYZHYKLCSsUlwgREZxReDk4r5YVtW X-Received: by 10.98.37.130 with SMTP id l124mr2476021pfl.60.1473390690256; Thu, 08 Sep 2016 20:11:30 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id w81sm886918pfa.54.2016.09.08.20.11.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Sep 2016 20:11:29 -0700 (PDT) Date: Fri, 9 Sep 2016 12:18:11 +0900 From: AKASHI Takahiro To: James Morse Cc: Arnd Bergmann , Guenter Roeck , Hoan Tran , Jean Delvare , Jonathan Corbet , Rob Herring , Jassi Brar , Ashwin Chaugule , Duc Dang , lho@apm.com, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Catalin Marinas , Will Deacon Subject: Re: [PATCH v3 2/3] hwmon: xgene: Add hwmon driver Message-ID: <20160909031809.GG16712@linaro.org> Mail-Followup-To: AKASHI Takahiro , James Morse , Arnd Bergmann , Guenter Roeck , Hoan Tran , Jean Delvare , Jonathan Corbet , Rob Herring , Jassi Brar , Ashwin Chaugule , Duc Dang , lho@apm.com, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Catalin Marinas , Will Deacon References: <1469134557-26869-1-git-send-email-hotran@apm.com> <13081573.BbD3TmEU5Y@wuerfel> <20160907223705.GA31582@roeck-us.net> <2992356.ULGoZEEDZp@wuerfel> <57D141DF.2010603@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <57D141DF.2010603@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Sep 08, 2016 at 11:47:59AM +0100, James Morse wrote: > Hi, > > On 08/09/16 09:14, Arnd Bergmann wrote: > > On Wednesday, September 7, 2016 3:37:05 PM CEST Guenter Roeck wrote: > >> On Wed, Sep 07, 2016 at 11:41:44PM +0200, Arnd Bergmann wrote: > >>> On Thursday, July 21, 2016 1:55:56 PM CEST Hoan Tran wrote: > >>>> + ctx->comm_base_addr = cppc_ss->base_address; > >>>> + if (ctx->comm_base_addr) { > >>>> + ctx->pcc_comm_addr = > >>>> + acpi_os_ioremap(ctx->comm_base_addr, > >>>> + cppc_ss->length); > >>>> > >>> > >>> This causes the arm64 allmodconfig build to fail now, according to > >>> kernelci: > >>> > >>> 1 ERROR: "memblock_is_memory" [drivers/hwmon/xgene-hwmon.ko] undefined! > >>> > >>> Should this perhaps call ioremap() or memremap() instead? > >>> > >> Hmmm ... almost sounds to me like blaming the messenger. e7cd190385d1 ("arm64: > >> mark reserved memblock regions explicitly in iomem") starts using a function > >> in acpi_os_ioremap() which is not exported. On top of that, memblock_is_memory() > >> is declared as __init_memblock, which makes me really uncomfortable. > >> If acpi_os_ioremap() must not be used by modules, and possibly only during > >> early (?) initialization, maybe its declaration should state those limitations ? > > > > Ah, I didn't notice that. I guess both patches were correct individually and > > got added to linux-next around the same time but caused allmodconfig to blow up > > when used together. > > > > Adding everyone who was involved in the memblock patch to Cc here, maybe one > > of them has an idea what the correct fix is. There are only two other drivers > > using acpi_os_ioremap() and one of them is x86-specific, so it's still likely > > that drivers are not actually supposed to use this symbol. Making > > acpi_os_ioremap() an exported function in arm64 would also work. > > You could use acpi_os_map_iomem()/acpi_os_unmap_iomem() from acpi/acpi_io.h. > If there isn't an existing mapping these end up in acpi_os_ioremap(), and are > already EXPORT_SYMBOL_GPL(). acpi_os_ioremap() is re-defined in arm64/include/asm/acpi.h. The problem is that, as memblock_is_memory() is declared as __init, we cannot build any drivers which call acpi_os_ioremap() as modules. As far as this specific issue is concerned, if we make a change like: diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c ===>8=== The build error will be gone. (and still kdump should work.) But I don't know how we should distinguish IORESOURCE_MEM and IORESOURCE_SYSTEM_RAM. Thanks, -Takahiro AKASHI > (I'm still waiting for allmodconfig on linux-next to finish building) > > > Thanks, > > James > > --- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ===8<=== --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -207,7 +207,7 @@ static void __init request_standard_resources(void) res = alloc_bootmem_low(sizeof(*res)); if (memblock_is_nomap(region)) { res->name = "reserved"; - res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; + res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; } else { res->name = "System RAM"; res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; ===>8=== and revert the following hunk from the commit: ===8<=== --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -12,7 +12,7 @@ #ifndef _ASM_ACPI_H #define _ASM_ACPI_H -#include +#include #include #include @@ -32,7 +32,11 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) { - if (!page_is_ram(phys >> PAGE_SHIFT)) + /* + * EFI's reserve_regions() call adds memory with the WB attribute + * to memblock via early_init_dt_add_memory_arch(). + */ + if (!memblock_is_memory(phys)) return ioremap(phys, size); return ioremap_cache(phys, size);