From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Likely Subject: Re: [PATCH v9 06/21] ACPI: fix acpi_os_ioremap for arm64 Date: Fri, 06 Mar 2015 20:30:39 +0000 Message-ID: <20150306203039.833AFC40AA9@trevor.secretlab.ca> References: <1424853601-6675-1-git-send-email-hanjun.guo@linaro.org> <1424853601-6675-7-git-send-email-hanjun.guo@linaro.org> Return-path: Received: from mail-we0-f170.google.com ([74.125.82.170]:39733 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751254AbbCFUap (ORCPT ); Fri, 6 Mar 2015 15:30:45 -0500 Received: by wesu56 with SMTP id u56so18271975wes.6 for ; Fri, 06 Mar 2015 12:30:44 -0800 (PST) In-Reply-To: <1424853601-6675-7-git-send-email-hanjun.guo@linaro.org> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Catalin Marinas , "Rafael J. Wysocki" , Will Deacon , Olof Johansson Cc: Lorenzo Pieralisi , Arnd Bergmann , Mark Rutland , Graeme Gregory , Sudeep Holla , Jon Masters , Marc Zyngier , Mark Brown , Robert Richter , Timur Tabi , Ashwin Chaugule , suravee.suthikulpanit@amd.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Mark Salter , Hanjun Guo On Wed, 25 Feb 2015 16:39:46 +0800 , Hanjun Guo wrote: > From: Mark Salter > > The acpi_os_ioremap() function may be used to map normal RAM or IO > regions. The current implementation simply uses ioremap_cache(). This > will work for some architectures, but arm64 ioremap_cache() cannot be > used to map IO regions which don't support caching. So for arm64, use > ioremap() for non-RAM regions. > > CC: Rafael J Wysocki > CC: Catalin Marinas > Tested-by: Robert Richter > Acked-by: Robert Richter > Signed-off-by: Mark Salter > Signed-off-by: Hanjun Guo Reviewed-by: Grant Likely > --- > arch/arm64/include/asm/acpi.h | 13 +++++++++++++ > include/acpi/acpi_io.h | 4 ++++ > 2 files changed, 17 insertions(+) > > diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h > index 8b837ab..40e0924 100644 > --- a/arch/arm64/include/asm/acpi.h > +++ b/arch/arm64/include/asm/acpi.h > @@ -12,8 +12,21 @@ > #ifndef _ASM_ACPI_H > #define _ASM_ACPI_H > > +#include > + > /* Basic configuration for ACPI */ > #ifdef CONFIG_ACPI > +/* ACPI table mapping after acpi_gbl_permanent_mmap is set */ > +static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, > + acpi_size size) > +{ > + if (!page_is_ram(phys >> PAGE_SHIFT)) > + return ioremap(phys, size); > + > + return ioremap_cache(phys, size); > +} > +#define acpi_os_ioremap acpi_os_ioremap > + > #define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */ > extern int acpi_disabled; > extern int acpi_noirq; > diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h > index 444671e..dd86c5f 100644 > --- a/include/acpi/acpi_io.h > +++ b/include/acpi/acpi_io.h > @@ -3,11 +3,15 @@ > > #include > > +#include > + > +#ifndef acpi_os_ioremap > static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, > acpi_size size) > { > return ioremap_cache(phys, size); > } > +#endif > > void __iomem *__init_refok > acpi_os_map_iomem(acpi_physical_address phys, acpi_size size); > -- > 1.9.1 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756517AbbCFUas (ORCPT ); Fri, 6 Mar 2015 15:30:48 -0500 Received: from mail-wi0-f170.google.com ([209.85.212.170]:45205 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753049AbbCFUap (ORCPT ); Fri, 6 Mar 2015 15:30:45 -0500 From: Grant Likely Subject: Re: [PATCH v9 06/21] ACPI: fix acpi_os_ioremap for arm64 To: Hanjun Guo , Catalin Marinas , "Rafael J. Wysocki" , Will Deacon , Olof Johansson Cc: Lorenzo Pieralisi , Arnd Bergmann , Mark Rutland , Graeme Gregory , Sudeep Holla , Jon Masters , Marc Zyngier , Mark Brown , Robert Richter , Timur Tabi , Ashwin Chaugule , suravee.suthikulpanit@amd.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Mark Salter , Hanjun Guo In-Reply-To: <1424853601-6675-7-git-send-email-hanjun.guo@linaro.org> References: <1424853601-6675-1-git-send-email-hanjun.guo@linaro.org> <1424853601-6675-7-git-send-email-hanjun.guo@linaro.org> Date: Fri, 06 Mar 2015 20:30:39 +0000 Message-Id: <20150306203039.833AFC40AA9@trevor.secretlab.ca> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Feb 2015 16:39:46 +0800 , Hanjun Guo wrote: > From: Mark Salter > > The acpi_os_ioremap() function may be used to map normal RAM or IO > regions. The current implementation simply uses ioremap_cache(). This > will work for some architectures, but arm64 ioremap_cache() cannot be > used to map IO regions which don't support caching. So for arm64, use > ioremap() for non-RAM regions. > > CC: Rafael J Wysocki > CC: Catalin Marinas > Tested-by: Robert Richter > Acked-by: Robert Richter > Signed-off-by: Mark Salter > Signed-off-by: Hanjun Guo Reviewed-by: Grant Likely > --- > arch/arm64/include/asm/acpi.h | 13 +++++++++++++ > include/acpi/acpi_io.h | 4 ++++ > 2 files changed, 17 insertions(+) > > diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h > index 8b837ab..40e0924 100644 > --- a/arch/arm64/include/asm/acpi.h > +++ b/arch/arm64/include/asm/acpi.h > @@ -12,8 +12,21 @@ > #ifndef _ASM_ACPI_H > #define _ASM_ACPI_H > > +#include > + > /* Basic configuration for ACPI */ > #ifdef CONFIG_ACPI > +/* ACPI table mapping after acpi_gbl_permanent_mmap is set */ > +static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, > + acpi_size size) > +{ > + if (!page_is_ram(phys >> PAGE_SHIFT)) > + return ioremap(phys, size); > + > + return ioremap_cache(phys, size); > +} > +#define acpi_os_ioremap acpi_os_ioremap > + > #define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */ > extern int acpi_disabled; > extern int acpi_noirq; > diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h > index 444671e..dd86c5f 100644 > --- a/include/acpi/acpi_io.h > +++ b/include/acpi/acpi_io.h > @@ -3,11 +3,15 @@ > > #include > > +#include > + > +#ifndef acpi_os_ioremap > static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, > acpi_size size) > { > return ioremap_cache(phys, size); > } > +#endif > > void __iomem *__init_refok > acpi_os_map_iomem(acpi_physical_address phys, acpi_size size); > -- > 1.9.1 > From mboxrd@z Thu Jan 1 00:00:00 1970 From: grant.likely@linaro.org (Grant Likely) Date: Fri, 06 Mar 2015 20:30:39 +0000 Subject: [PATCH v9 06/21] ACPI: fix acpi_os_ioremap for arm64 In-Reply-To: <1424853601-6675-7-git-send-email-hanjun.guo@linaro.org> References: <1424853601-6675-1-git-send-email-hanjun.guo@linaro.org> <1424853601-6675-7-git-send-email-hanjun.guo@linaro.org> Message-ID: <20150306203039.833AFC40AA9@trevor.secretlab.ca> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, 25 Feb 2015 16:39:46 +0800 , Hanjun Guo wrote: > From: Mark Salter > > The acpi_os_ioremap() function may be used to map normal RAM or IO > regions. The current implementation simply uses ioremap_cache(). This > will work for some architectures, but arm64 ioremap_cache() cannot be > used to map IO regions which don't support caching. So for arm64, use > ioremap() for non-RAM regions. > > CC: Rafael J Wysocki > CC: Catalin Marinas > Tested-by: Robert Richter > Acked-by: Robert Richter > Signed-off-by: Mark Salter > Signed-off-by: Hanjun Guo Reviewed-by: Grant Likely > --- > arch/arm64/include/asm/acpi.h | 13 +++++++++++++ > include/acpi/acpi_io.h | 4 ++++ > 2 files changed, 17 insertions(+) > > diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h > index 8b837ab..40e0924 100644 > --- a/arch/arm64/include/asm/acpi.h > +++ b/arch/arm64/include/asm/acpi.h > @@ -12,8 +12,21 @@ > #ifndef _ASM_ACPI_H > #define _ASM_ACPI_H > > +#include > + > /* Basic configuration for ACPI */ > #ifdef CONFIG_ACPI > +/* ACPI table mapping after acpi_gbl_permanent_mmap is set */ > +static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, > + acpi_size size) > +{ > + if (!page_is_ram(phys >> PAGE_SHIFT)) > + return ioremap(phys, size); > + > + return ioremap_cache(phys, size); > +} > +#define acpi_os_ioremap acpi_os_ioremap > + > #define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */ > extern int acpi_disabled; > extern int acpi_noirq; > diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h > index 444671e..dd86c5f 100644 > --- a/include/acpi/acpi_io.h > +++ b/include/acpi/acpi_io.h > @@ -3,11 +3,15 @@ > > #include > > +#include > + > +#ifndef acpi_os_ioremap > static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, > acpi_size size) > { > return ioremap_cache(phys, size); > } > +#endif > > void __iomem *__init_refok > acpi_os_map_iomem(acpi_physical_address phys, acpi_size size); > -- > 1.9.1 >