All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/20] tree-wide convert to memremap()
@ 2015-10-09 22:15 ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-fbdev, Liam Girdwood, David Airlie, dri-devel,
	Jaroslav Kysela, Lv Zheng, H. Peter Anvin, Jeeja KP, linux-arch,
	Daniel Vetter, Rafael J. Wysocki, Bob Moore, Mike Waychison,
	Tomi Valkeinen, Geert Uytterhoeven, Russell King, Ross Zwisler,
	Jean-Christophe Plagniol-Villard, Len Brown, Joerg Roedel,
	Arnd Bergmann, intel-gfx, Jani Nikula, Mark Brown,
	Borislav Petkov, Thomas Gleixner, Ingo Molnar, linux-arm-kernel,
	Tony Luck, Takashi Iwai, Brian Norris, David Woodhouse

The memremap() api [1] was merged in 4.3 [2] with an initial
implementation for x86 and a conversion of the pmem driver. Complete the
conversion for the rest of the kernel.

Feel free to either ack or directly apply a conversion-patch as I will
defer the final removal patches until all the conversions have landed.

[1]: https://lwn.net/Articles/653585/
[2]: commit 92281dee825f arch: introduce memremap()

---

Dan Williams (20):
      x86: introduce arch_memremap()
      arm: introduce arch_memremap()
      ia64: introduce arch_memremap()
      sh: introduce arch_memremap()
      m68k: introduce arch_memremap()
      arm: switch from ioremap_cache to memremap
      x86: switch from ioremap_cache to memremap
      gma500: switch from acpi_os_ioremap to memremap
      i915: switch from acpi_os_ioremap to memremap
      acpi: switch from ioremap_cache to memremap
      sound, skylake: switch from ioremap_cache to memremap
      memconsole: fix __iomem mishandling, switch to memremap
      intel-iommu: switch from ioremap_cache to memremap
      pxa2xx-flash: switch from ioremap_cache to memremap
      sfi: switch from ioremap_cache to memremap
      fbdev: switch from ioremap_wt to memremap
      arch: kill ioremap_cached()
      arch: kill ioremap_fullcache()
      arch: remove ioremap_cache, replace with arch_memremap
      arch: remove ioremap_wt, optionally replace with arch_memremap


 Documentation/x86/pat.txt             |    6 +--
 arch/arc/include/asm/io.h             |    1 
 arch/arm/Kconfig                      |    1 
 arch/arm/include/asm/io.h             |    7 ---
 arch/arm/include/asm/xen/page.h       |    4 +-
 arch/arm/mm/ioremap.c                 |   12 ++++-
 arch/arm/mm/mmu.c                     |    2 -
 arch/arm/mm/nommu.c                   |   11 +++--
 arch/arm64/Kconfig                    |    1 
 arch/arm64/include/asm/acpi.h         |   11 -----
 arch/arm64/include/asm/dmi.h          |    8 ++--
 arch/arm64/include/asm/io.h           |    2 -
 arch/arm64/kernel/efi.c               |    9 ++--
 arch/arm64/kernel/smp_spin_table.c    |   19 ++++-----
 arch/arm64/mm/ioremap.c               |   20 +++------
 arch/avr32/include/asm/io.h           |    1 
 arch/frv/include/asm/io.h             |   12 -----
 arch/ia64/Kconfig                     |    1 
 arch/ia64/include/asm/io.h            |    6 ---
 arch/ia64/mm/ioremap.c                |   10 +++++
 arch/m32r/include/asm/io.h            |    1 
 arch/m68k/Kconfig                     |    1 
 arch/m68k/include/asm/io_mm.h         |   13 ------
 arch/m68k/include/asm/io_no.h         |   11 -----
 arch/m68k/include/asm/raw_io.h        |    1 
 arch/m68k/mm/kmap.c                   |   17 +++++++-
 arch/m68k/mm/sun3kmap.c               |    7 +++
 arch/metag/include/asm/io.h           |    6 ---
 arch/microblaze/include/asm/io.h      |    2 -
 arch/mn10300/include/asm/io.h         |    1 
 arch/nios2/include/asm/io.h           |    1 
 arch/s390/include/asm/io.h            |    1 
 arch/sh/Kconfig                       |    1 
 arch/sh/include/asm/io.h              |    7 ---
 arch/sh/mm/ioremap.c                  |    9 ++++
 arch/sparc/include/asm/io_32.h        |    1 
 arch/sparc/include/asm/io_64.h        |    1 
 arch/tile/include/asm/io.h            |    2 -
 arch/unicore32/include/asm/io.h       |    4 --
 arch/unicore32/mm/ioremap.c           |    8 ----
 arch/x86/Kconfig                      |    1 
 arch/x86/include/asm/efi.h            |    3 +
 arch/x86/include/asm/io.h             |    4 --
 arch/x86/kernel/crash_dump_64.c       |    6 +--
 arch/x86/kernel/kdebugfs.c            |    8 ++--
 arch/x86/kernel/ksysfs.c              |   28 ++++++-------
 arch/x86/mm/ioremap.c                 |   43 ++++++++-----------
 arch/xtensa/include/asm/io.h          |   12 -----
 drivers/acpi/apei/einj.c              |    9 ++--
 drivers/acpi/apei/erst.c              |    6 +--
 drivers/acpi/nvs.c                    |    6 +--
 drivers/acpi/osl.c                    |   70 +++++++++-----------------------
 drivers/firmware/google/memconsole.c  |    7 ++-
 drivers/gpu/drm/gma500/opregion.c     |    8 ++--
 drivers/gpu/drm/gma500/psb_drv.h      |    2 -
 drivers/gpu/drm/gma500/psb_lid.c      |    8 ++--
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 +++--
 drivers/gpu/drm/i915/intel_bios.c     |    7 +--
 drivers/gpu/drm/i915/intel_opregion.c |   73 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 drivers/iommu/intel-iommu.c           |   20 +++++----
 drivers/iommu/intel_irq_remapping.c   |    8 ++--
 drivers/mtd/maps/pxa2xx-flash.c       |    6 +--
 drivers/nvdimm/Kconfig                |    2 -
 drivers/sfi/sfi_core.c                |    4 +-
 drivers/video/fbdev/Kconfig           |    2 -
 drivers/video/fbdev/amifb.c           |    5 +-
 drivers/video/fbdev/atafb.c           |    5 +-
 drivers/video/fbdev/hpfb.c            |    6 +--
 include/acpi/acpi_io.h                |    6 +--
 include/asm-generic/io.h              |    8 ----
 include/asm-generic/iomap.h           |    4 --
 include/linux/io.h                    |    1 
 kernel/Makefile                       |    2 -
 kernel/memremap.c                     |   27 +++++-------
 lib/Kconfig                           |    6 ++-
 sound/soc/intel/skylake/skl-nhlt.c    |   10 ++---
 sound/soc/intel/skylake/skl.h         |    6 +--
 79 files changed, 284 insertions(+), 400 deletions(-)

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 00/20] tree-wide convert to memremap()
@ 2015-10-09 22:15 ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-fbdev, David Airlie, dri-devel, Jaroslav Kysela, Lv Zheng,
	H. Peter Anvin, Daniel Vetter, linux-arch, Rafael J. Wysocki,
	Bob Moore, Mike Waychison, Tomi Valkeinen, Geert Uytterhoeven,
	Russell King, Ross Zwisler, Jean-Christophe Plagniol-Villard,
	Len Brown, Jeeja KP, Joerg Roedel, Arnd Bergmann, intel-gfx,
	Mark Brown, Borislav Petkov, Takashi Iwai, Thomas

The memremap() api [1] was merged in 4.3 [2] with an initial
implementation for x86 and a conversion of the pmem driver. Complete the
conversion for the rest of the kernel.

Feel free to either ack or directly apply a conversion-patch as I will
defer the final removal patches until all the conversions have landed.

[1]: https://lwn.net/Articles/653585/
[2]: commit 92281dee825f arch: introduce memremap()

---

Dan Williams (20):
      x86: introduce arch_memremap()
      arm: introduce arch_memremap()
      ia64: introduce arch_memremap()
      sh: introduce arch_memremap()
      m68k: introduce arch_memremap()
      arm: switch from ioremap_cache to memremap
      x86: switch from ioremap_cache to memremap
      gma500: switch from acpi_os_ioremap to memremap
      i915: switch from acpi_os_ioremap to memremap
      acpi: switch from ioremap_cache to memremap
      sound, skylake: switch from ioremap_cache to memremap
      memconsole: fix __iomem mishandling, switch to memremap
      intel-iommu: switch from ioremap_cache to memremap
      pxa2xx-flash: switch from ioremap_cache to memremap
      sfi: switch from ioremap_cache to memremap
      fbdev: switch from ioremap_wt to memremap
      arch: kill ioremap_cached()
      arch: kill ioremap_fullcache()
      arch: remove ioremap_cache, replace with arch_memremap
      arch: remove ioremap_wt, optionally replace with arch_memremap


 Documentation/x86/pat.txt             |    6 +--
 arch/arc/include/asm/io.h             |    1 
 arch/arm/Kconfig                      |    1 
 arch/arm/include/asm/io.h             |    7 ---
 arch/arm/include/asm/xen/page.h       |    4 +-
 arch/arm/mm/ioremap.c                 |   12 ++++-
 arch/arm/mm/mmu.c                     |    2 -
 arch/arm/mm/nommu.c                   |   11 +++--
 arch/arm64/Kconfig                    |    1 
 arch/arm64/include/asm/acpi.h         |   11 -----
 arch/arm64/include/asm/dmi.h          |    8 ++--
 arch/arm64/include/asm/io.h           |    2 -
 arch/arm64/kernel/efi.c               |    9 ++--
 arch/arm64/kernel/smp_spin_table.c    |   19 ++++-----
 arch/arm64/mm/ioremap.c               |   20 +++------
 arch/avr32/include/asm/io.h           |    1 
 arch/frv/include/asm/io.h             |   12 -----
 arch/ia64/Kconfig                     |    1 
 arch/ia64/include/asm/io.h            |    6 ---
 arch/ia64/mm/ioremap.c                |   10 +++++
 arch/m32r/include/asm/io.h            |    1 
 arch/m68k/Kconfig                     |    1 
 arch/m68k/include/asm/io_mm.h         |   13 ------
 arch/m68k/include/asm/io_no.h         |   11 -----
 arch/m68k/include/asm/raw_io.h        |    1 
 arch/m68k/mm/kmap.c                   |   17 +++++++-
 arch/m68k/mm/sun3kmap.c               |    7 +++
 arch/metag/include/asm/io.h           |    6 ---
 arch/microblaze/include/asm/io.h      |    2 -
 arch/mn10300/include/asm/io.h         |    1 
 arch/nios2/include/asm/io.h           |    1 
 arch/s390/include/asm/io.h            |    1 
 arch/sh/Kconfig                       |    1 
 arch/sh/include/asm/io.h              |    7 ---
 arch/sh/mm/ioremap.c                  |    9 ++++
 arch/sparc/include/asm/io_32.h        |    1 
 arch/sparc/include/asm/io_64.h        |    1 
 arch/tile/include/asm/io.h            |    2 -
 arch/unicore32/include/asm/io.h       |    4 --
 arch/unicore32/mm/ioremap.c           |    8 ----
 arch/x86/Kconfig                      |    1 
 arch/x86/include/asm/efi.h            |    3 +
 arch/x86/include/asm/io.h             |    4 --
 arch/x86/kernel/crash_dump_64.c       |    6 +--
 arch/x86/kernel/kdebugfs.c            |    8 ++--
 arch/x86/kernel/ksysfs.c              |   28 ++++++-------
 arch/x86/mm/ioremap.c                 |   43 ++++++++-----------
 arch/xtensa/include/asm/io.h          |   12 -----
 drivers/acpi/apei/einj.c              |    9 ++--
 drivers/acpi/apei/erst.c              |    6 +--
 drivers/acpi/nvs.c                    |    6 +--
 drivers/acpi/osl.c                    |   70 +++++++++-----------------------
 drivers/firmware/google/memconsole.c  |    7 ++-
 drivers/gpu/drm/gma500/opregion.c     |    8 ++--
 drivers/gpu/drm/gma500/psb_drv.h      |    2 -
 drivers/gpu/drm/gma500/psb_lid.c      |    8 ++--
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 +++--
 drivers/gpu/drm/i915/intel_bios.c     |    7 +--
 drivers/gpu/drm/i915/intel_opregion.c |   73 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 drivers/iommu/intel-iommu.c           |   20 +++++----
 drivers/iommu/intel_irq_remapping.c   |    8 ++--
 drivers/mtd/maps/pxa2xx-flash.c       |    6 +--
 drivers/nvdimm/Kconfig                |    2 -
 drivers/sfi/sfi_core.c                |    4 +-
 drivers/video/fbdev/Kconfig           |    2 -
 drivers/video/fbdev/amifb.c           |    5 +-
 drivers/video/fbdev/atafb.c           |    5 +-
 drivers/video/fbdev/hpfb.c            |    6 +--
 include/acpi/acpi_io.h                |    6 +--
 include/asm-generic/io.h              |    8 ----
 include/asm-generic/iomap.h           |    4 --
 include/linux/io.h                    |    1 
 kernel/Makefile                       |    2 -
 kernel/memremap.c                     |   27 +++++-------
 lib/Kconfig                           |    6 ++-
 sound/soc/intel/skylake/skl-nhlt.c    |   10 ++---
 sound/soc/intel/skylake/skl.h         |    6 +--
 79 files changed, 284 insertions(+), 400 deletions(-)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 00/20] tree-wide convert to memremap()
@ 2015-10-09 22:15 ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-fbdev, David Airlie, dri-devel, Jaroslav Kysela, Lv Zheng,
	H. Peter Anvin, Daniel Vetter, linux-arch, Rafael J. Wysocki,
	Bob Moore, Mike Waychison, Tomi Valkeinen, Geert Uytterhoeven,
	Russell King, Ross Zwisler, Jean-Christophe Plagniol-Villard,
	Len Brown, Jeeja KP, Joerg Roedel, Arnd Bergmann, intel-gfx,
	Mark Brown, Borislav Petkov, Takashi Iwai, Thomas

The memremap() api [1] was merged in 4.3 [2] with an initial
implementation for x86 and a conversion of the pmem driver. Complete the
conversion for the rest of the kernel.

Feel free to either ack or directly apply a conversion-patch as I will
defer the final removal patches until all the conversions have landed.

[1]: https://lwn.net/Articles/653585/
[2]: commit 92281dee825f arch: introduce memremap()

---

Dan Williams (20):
      x86: introduce arch_memremap()
      arm: introduce arch_memremap()
      ia64: introduce arch_memremap()
      sh: introduce arch_memremap()
      m68k: introduce arch_memremap()
      arm: switch from ioremap_cache to memremap
      x86: switch from ioremap_cache to memremap
      gma500: switch from acpi_os_ioremap to memremap
      i915: switch from acpi_os_ioremap to memremap
      acpi: switch from ioremap_cache to memremap
      sound, skylake: switch from ioremap_cache to memremap
      memconsole: fix __iomem mishandling, switch to memremap
      intel-iommu: switch from ioremap_cache to memremap
      pxa2xx-flash: switch from ioremap_cache to memremap
      sfi: switch from ioremap_cache to memremap
      fbdev: switch from ioremap_wt to memremap
      arch: kill ioremap_cached()
      arch: kill ioremap_fullcache()
      arch: remove ioremap_cache, replace with arch_memremap
      arch: remove ioremap_wt, optionally replace with arch_memremap


 Documentation/x86/pat.txt             |    6 +--
 arch/arc/include/asm/io.h             |    1 
 arch/arm/Kconfig                      |    1 
 arch/arm/include/asm/io.h             |    7 ---
 arch/arm/include/asm/xen/page.h       |    4 +-
 arch/arm/mm/ioremap.c                 |   12 ++++-
 arch/arm/mm/mmu.c                     |    2 -
 arch/arm/mm/nommu.c                   |   11 +++--
 arch/arm64/Kconfig                    |    1 
 arch/arm64/include/asm/acpi.h         |   11 -----
 arch/arm64/include/asm/dmi.h          |    8 ++--
 arch/arm64/include/asm/io.h           |    2 -
 arch/arm64/kernel/efi.c               |    9 ++--
 arch/arm64/kernel/smp_spin_table.c    |   19 ++++-----
 arch/arm64/mm/ioremap.c               |   20 +++------
 arch/avr32/include/asm/io.h           |    1 
 arch/frv/include/asm/io.h             |   12 -----
 arch/ia64/Kconfig                     |    1 
 arch/ia64/include/asm/io.h            |    6 ---
 arch/ia64/mm/ioremap.c                |   10 +++++
 arch/m32r/include/asm/io.h            |    1 
 arch/m68k/Kconfig                     |    1 
 arch/m68k/include/asm/io_mm.h         |   13 ------
 arch/m68k/include/asm/io_no.h         |   11 -----
 arch/m68k/include/asm/raw_io.h        |    1 
 arch/m68k/mm/kmap.c                   |   17 +++++++-
 arch/m68k/mm/sun3kmap.c               |    7 +++
 arch/metag/include/asm/io.h           |    6 ---
 arch/microblaze/include/asm/io.h      |    2 -
 arch/mn10300/include/asm/io.h         |    1 
 arch/nios2/include/asm/io.h           |    1 
 arch/s390/include/asm/io.h            |    1 
 arch/sh/Kconfig                       |    1 
 arch/sh/include/asm/io.h              |    7 ---
 arch/sh/mm/ioremap.c                  |    9 ++++
 arch/sparc/include/asm/io_32.h        |    1 
 arch/sparc/include/asm/io_64.h        |    1 
 arch/tile/include/asm/io.h            |    2 -
 arch/unicore32/include/asm/io.h       |    4 --
 arch/unicore32/mm/ioremap.c           |    8 ----
 arch/x86/Kconfig                      |    1 
 arch/x86/include/asm/efi.h            |    3 +
 arch/x86/include/asm/io.h             |    4 --
 arch/x86/kernel/crash_dump_64.c       |    6 +--
 arch/x86/kernel/kdebugfs.c            |    8 ++--
 arch/x86/kernel/ksysfs.c              |   28 ++++++-------
 arch/x86/mm/ioremap.c                 |   43 ++++++++-----------
 arch/xtensa/include/asm/io.h          |   12 -----
 drivers/acpi/apei/einj.c              |    9 ++--
 drivers/acpi/apei/erst.c              |    6 +--
 drivers/acpi/nvs.c                    |    6 +--
 drivers/acpi/osl.c                    |   70 +++++++++-----------------------
 drivers/firmware/google/memconsole.c  |    7 ++-
 drivers/gpu/drm/gma500/opregion.c     |    8 ++--
 drivers/gpu/drm/gma500/psb_drv.h      |    2 -
 drivers/gpu/drm/gma500/psb_lid.c      |    8 ++--
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 +++--
 drivers/gpu/drm/i915/intel_bios.c     |    7 +--
 drivers/gpu/drm/i915/intel_opregion.c |   73 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 drivers/iommu/intel-iommu.c           |   20 +++++----
 drivers/iommu/intel_irq_remapping.c   |    8 ++--
 drivers/mtd/maps/pxa2xx-flash.c       |    6 +--
 drivers/nvdimm/Kconfig                |    2 -
 drivers/sfi/sfi_core.c                |    4 +-
 drivers/video/fbdev/Kconfig           |    2 -
 drivers/video/fbdev/amifb.c           |    5 +-
 drivers/video/fbdev/atafb.c           |    5 +-
 drivers/video/fbdev/hpfb.c            |    6 +--
 include/acpi/acpi_io.h                |    6 +--
 include/asm-generic/io.h              |    8 ----
 include/asm-generic/iomap.h           |    4 --
 include/linux/io.h                    |    1 
 kernel/Makefile                       |    2 -
 kernel/memremap.c                     |   27 +++++-------
 lib/Kconfig                           |    6 ++-
 sound/soc/intel/skylake/skl-nhlt.c    |   10 ++---
 sound/soc/intel/skylake/skl.h         |    6 +--
 79 files changed, 284 insertions(+), 400 deletions(-)

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 00/20] tree-wide convert to memremap()
@ 2015-10-09 22:15 ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-arm-kernel

The memremap() api [1] was merged in 4.3 [2] with an initial
implementation for x86 and a conversion of the pmem driver. Complete the
conversion for the rest of the kernel.

Feel free to either ack or directly apply a conversion-patch as I will
defer the final removal patches until all the conversions have landed.

[1]: https://lwn.net/Articles/653585/
[2]: commit 92281dee825f arch: introduce memremap()

---

Dan Williams (20):
      x86: introduce arch_memremap()
      arm: introduce arch_memremap()
      ia64: introduce arch_memremap()
      sh: introduce arch_memremap()
      m68k: introduce arch_memremap()
      arm: switch from ioremap_cache to memremap
      x86: switch from ioremap_cache to memremap
      gma500: switch from acpi_os_ioremap to memremap
      i915: switch from acpi_os_ioremap to memremap
      acpi: switch from ioremap_cache to memremap
      sound, skylake: switch from ioremap_cache to memremap
      memconsole: fix __iomem mishandling, switch to memremap
      intel-iommu: switch from ioremap_cache to memremap
      pxa2xx-flash: switch from ioremap_cache to memremap
      sfi: switch from ioremap_cache to memremap
      fbdev: switch from ioremap_wt to memremap
      arch: kill ioremap_cached()
      arch: kill ioremap_fullcache()
      arch: remove ioremap_cache, replace with arch_memremap
      arch: remove ioremap_wt, optionally replace with arch_memremap


 Documentation/x86/pat.txt             |    6 +--
 arch/arc/include/asm/io.h             |    1 
 arch/arm/Kconfig                      |    1 
 arch/arm/include/asm/io.h             |    7 ---
 arch/arm/include/asm/xen/page.h       |    4 +-
 arch/arm/mm/ioremap.c                 |   12 ++++-
 arch/arm/mm/mmu.c                     |    2 -
 arch/arm/mm/nommu.c                   |   11 +++--
 arch/arm64/Kconfig                    |    1 
 arch/arm64/include/asm/acpi.h         |   11 -----
 arch/arm64/include/asm/dmi.h          |    8 ++--
 arch/arm64/include/asm/io.h           |    2 -
 arch/arm64/kernel/efi.c               |    9 ++--
 arch/arm64/kernel/smp_spin_table.c    |   19 ++++-----
 arch/arm64/mm/ioremap.c               |   20 +++------
 arch/avr32/include/asm/io.h           |    1 
 arch/frv/include/asm/io.h             |   12 -----
 arch/ia64/Kconfig                     |    1 
 arch/ia64/include/asm/io.h            |    6 ---
 arch/ia64/mm/ioremap.c                |   10 +++++
 arch/m32r/include/asm/io.h            |    1 
 arch/m68k/Kconfig                     |    1 
 arch/m68k/include/asm/io_mm.h         |   13 ------
 arch/m68k/include/asm/io_no.h         |   11 -----
 arch/m68k/include/asm/raw_io.h        |    1 
 arch/m68k/mm/kmap.c                   |   17 +++++++-
 arch/m68k/mm/sun3kmap.c               |    7 +++
 arch/metag/include/asm/io.h           |    6 ---
 arch/microblaze/include/asm/io.h      |    2 -
 arch/mn10300/include/asm/io.h         |    1 
 arch/nios2/include/asm/io.h           |    1 
 arch/s390/include/asm/io.h            |    1 
 arch/sh/Kconfig                       |    1 
 arch/sh/include/asm/io.h              |    7 ---
 arch/sh/mm/ioremap.c                  |    9 ++++
 arch/sparc/include/asm/io_32.h        |    1 
 arch/sparc/include/asm/io_64.h        |    1 
 arch/tile/include/asm/io.h            |    2 -
 arch/unicore32/include/asm/io.h       |    4 --
 arch/unicore32/mm/ioremap.c           |    8 ----
 arch/x86/Kconfig                      |    1 
 arch/x86/include/asm/efi.h            |    3 +
 arch/x86/include/asm/io.h             |    4 --
 arch/x86/kernel/crash_dump_64.c       |    6 +--
 arch/x86/kernel/kdebugfs.c            |    8 ++--
 arch/x86/kernel/ksysfs.c              |   28 ++++++-------
 arch/x86/mm/ioremap.c                 |   43 ++++++++-----------
 arch/xtensa/include/asm/io.h          |   12 -----
 drivers/acpi/apei/einj.c              |    9 ++--
 drivers/acpi/apei/erst.c              |    6 +--
 drivers/acpi/nvs.c                    |    6 +--
 drivers/acpi/osl.c                    |   70 +++++++++-----------------------
 drivers/firmware/google/memconsole.c  |    7 ++-
 drivers/gpu/drm/gma500/opregion.c     |    8 ++--
 drivers/gpu/drm/gma500/psb_drv.h      |    2 -
 drivers/gpu/drm/gma500/psb_lid.c      |    8 ++--
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 +++--
 drivers/gpu/drm/i915/intel_bios.c     |    7 +--
 drivers/gpu/drm/i915/intel_opregion.c |   73 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 drivers/iommu/intel-iommu.c           |   20 +++++----
 drivers/iommu/intel_irq_remapping.c   |    8 ++--
 drivers/mtd/maps/pxa2xx-flash.c       |    6 +--
 drivers/nvdimm/Kconfig                |    2 -
 drivers/sfi/sfi_core.c                |    4 +-
 drivers/video/fbdev/Kconfig           |    2 -
 drivers/video/fbdev/amifb.c           |    5 +-
 drivers/video/fbdev/atafb.c           |    5 +-
 drivers/video/fbdev/hpfb.c            |    6 +--
 include/acpi/acpi_io.h                |    6 +--
 include/asm-generic/io.h              |    8 ----
 include/asm-generic/iomap.h           |    4 --
 include/linux/io.h                    |    1 
 kernel/Makefile                       |    2 -
 kernel/memremap.c                     |   27 +++++-------
 lib/Kconfig                           |    6 ++-
 sound/soc/intel/skylake/skl-nhlt.c    |   10 ++---
 sound/soc/intel/skylake/skl.h         |    6 +--
 79 files changed, 284 insertions(+), 400 deletions(-)

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 01/20] x86: introduce arch_memremap()
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:15   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Arnd Bergmann, Ingo Molnar, Borislav Petkov,
	H. Peter Anvin, Thomas Gleixner, Ross Zwisler, linux-arm-kernel

In preparation for removing ioremap_cache() introduce arch_memremap()
for x86.  For now, arch_memremap(..., MEMREMAP_WB) and
arch_memremap(..., MEMREMAP_WT) are aliases for ioremap_cache() and
ioremap_wt() respectively.  While the memremap() conversion patches are
filtering through the other sub-systems further development of the
memremap interface may proceed.

This also initiates the guarantee that a successful call to
memremap(..., MEMREMAP_WB) has indeed established a cached mapping and
has not silently fallen back to uncached.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/x86/pat.txt |    2 ++
 arch/x86/Kconfig          |    1 +
 arch/x86/mm/ioremap.c     |   17 +++++++++++++++++
 drivers/nvdimm/Kconfig    |    2 +-
 include/linux/io.h        |    1 +
 kernel/memremap.c         |   25 +++++++++++++------------
 lib/Kconfig               |    5 ++++-
 7 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt
index 54944c71b819..8c908fa5ea26 100644
--- a/Documentation/x86/pat.txt
+++ b/Documentation/x86/pat.txt
@@ -40,6 +40,8 @@ ioremap_nocache        |    --    |    UC-     |       UC-        |
                        |          |            |                  |
 ioremap_wc             |    --    |    --      |       WC         |
                        |          |            |                  |
+memremap(MEMREMAP_WB)  |    WB    |    WB      |       WB         |
+                       |          |            |                  |
 ioremap_wt             |    --    |    --      |       WT         |
                        |          |            |                  |
 set_memory_uc          |    UC-   |    --      |       --         |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 328c8352480c..488cb210d055 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -27,6 +27,7 @@ config X86
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_FAST_MULTIPLIER
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_MEMREMAP
 	select ARCH_HAS_PMEM_API		if X86_64
 	select ARCH_HAS_MMIO_FLUSH
 	select ARCH_HAS_SG_CHAIN
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index b9c78f3bcd67..123431ae702f 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -317,6 +317,23 @@ void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
 }
 EXPORT_SYMBOL(ioremap_cache);
 
+void *arch_memremap(resource_size_t phys_addr, size_t size,
+		unsigned long flags)
+{
+	int prot;
+
+	if (flags & MEMREMAP_WB)
+		prot = _PAGE_CACHE_MODE_WB;
+	else if (flags & MEMREMAP_WT)
+		prot = _PAGE_CACHE_MODE_WT;
+	else
+		return NULL;
+
+	return (void __force *) __ioremap_caller(phys_addr, size, prot,
+			__builtin_return_address(0));
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size,
 				unsigned long prot_val)
 {
diff --git a/drivers/nvdimm/Kconfig b/drivers/nvdimm/Kconfig
index 53c11621d5b1..b8e9d8b46f33 100644
--- a/drivers/nvdimm/Kconfig
+++ b/drivers/nvdimm/Kconfig
@@ -1,5 +1,6 @@
 menuconfig LIBNVDIMM
 	tristate "NVDIMM (Non-Volatile Memory Device) Support"
+	depends on ARCH_HAS_MEMREMAP
 	depends on PHYS_ADDR_T_64BIT
 	depends on BLK_DEV
 	help
@@ -19,7 +20,6 @@ if LIBNVDIMM
 config BLK_DEV_PMEM
 	tristate "PMEM: Persistent memory block device support"
 	default LIBNVDIMM
-	depends on HAS_IOMEM
 	select ND_BTT if BTT
 	select ND_PFN if NVDIMM_PFN
 	help
diff --git a/include/linux/io.h b/include/linux/io.h
index de64c1e53612..4f150781735d 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -153,5 +153,6 @@ enum {
 
 void *memremap(resource_size_t offset, size_t size, unsigned long flags);
 void memunmap(void *addr);
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags);
 
 #endif /* _LINUX_IO_H */
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 72b0c66628b6..8bd5fe05d4a4 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -24,6 +24,16 @@ __weak void __iomem *ioremap_cache(resource_size_t offset, unsigned long size)
 }
 #endif
 
+/* temporary while we convert arch implementations to arch_memremap */
+__weak void *arch_memremap(resource_size_t offset, size_t size,
+		unsigned long flags)
+{
+	if (flags & MEMREMAP_WB)
+		return (void __force *) ioremap_cache(offset, size);
+	else if (flags & MEMREMAP_WT)
+		return (void __force *) ioremap_wt(offset, size);
+}
+
 /**
  * memremap() - remap an iomem_resource as cacheable memory
  * @offset: iomem resource start address
@@ -48,7 +58,6 @@ __weak void __iomem *ioremap_cache(resource_size_t offset, unsigned long size)
 void *memremap(resource_size_t offset, size_t size, unsigned long flags)
 {
 	int is_ram = region_intersects(offset, size, "System RAM");
-	void *addr = NULL;
 
 	if (is_ram == REGION_MIXED) {
 		WARN_ONCE(1, "memremap attempted on mixed range %pa size: %#lx\n",
@@ -58,7 +67,6 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags)
 
 	/* Try all mapping types requested until one returns non-NULL */
 	if (flags & MEMREMAP_WB) {
-		flags &= ~MEMREMAP_WB;
 		/*
 		 * MEMREMAP_WB is special in that it can be satisifed
 		 * from the direct map.  Some archs depend on the
@@ -66,9 +74,7 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags)
 		 * the requested range is potentially in "System RAM"
 		 */
 		if (is_ram == REGION_INTERSECTS)
-			addr = __va(offset);
-		else
-			addr = ioremap_cache(offset, size);
+			return __va(offset);
 	}
 
 	/*
@@ -77,18 +83,13 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags)
 	 * address mapping.  Enforce that this mapping is not aliasing
 	 * "System RAM"
 	 */
-	if (!addr && is_ram == REGION_INTERSECTS && flags) {
+	if (is_ram == REGION_INTERSECTS) {
 		WARN_ONCE(1, "memremap attempted on ram %pa size: %#lx\n",
 				&offset, (unsigned long) size);
 		return NULL;
 	}
 
-	if (!addr && (flags & MEMREMAP_WT)) {
-		flags &= ~MEMREMAP_WT;
-		addr = ioremap_wt(offset, size);
-	}
-
-	return addr;
+	return arch_memremap(offset, size, flags);
 }
 EXPORT_SYMBOL(memremap);
 
diff --git a/lib/Kconfig b/lib/Kconfig
index 2e491ac15622..8d99b4e6a45b 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -520,7 +520,10 @@ config SG_SPLIT
 #
 
 config ARCH_HAS_SG_CHAIN
-	def_bool n
+	bool
+
+config ARCH_HAS_MEMREMAP
+	bool
 
 config ARCH_HAS_PMEM_API
 	bool


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 01/20] x86: introduce arch_memremap()
@ 2015-10-09 22:15   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for removing ioremap_cache() introduce arch_memremap()
for x86.  For now, arch_memremap(..., MEMREMAP_WB) and
arch_memremap(..., MEMREMAP_WT) are aliases for ioremap_cache() and
ioremap_wt() respectively.  While the memremap() conversion patches are
filtering through the other sub-systems further development of the
memremap interface may proceed.

This also initiates the guarantee that a successful call to
memremap(..., MEMREMAP_WB) has indeed established a cached mapping and
has not silently fallen back to uncached.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/x86/pat.txt |    2 ++
 arch/x86/Kconfig          |    1 +
 arch/x86/mm/ioremap.c     |   17 +++++++++++++++++
 drivers/nvdimm/Kconfig    |    2 +-
 include/linux/io.h        |    1 +
 kernel/memremap.c         |   25 +++++++++++++------------
 lib/Kconfig               |    5 ++++-
 7 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt
index 54944c71b819..8c908fa5ea26 100644
--- a/Documentation/x86/pat.txt
+++ b/Documentation/x86/pat.txt
@@ -40,6 +40,8 @@ ioremap_nocache        |    --    |    UC-     |       UC-        |
                        |          |            |                  |
 ioremap_wc             |    --    |    --      |       WC         |
                        |          |            |                  |
+memremap(MEMREMAP_WB)  |    WB    |    WB      |       WB         |
+                       |          |            |                  |
 ioremap_wt             |    --    |    --      |       WT         |
                        |          |            |                  |
 set_memory_uc          |    UC-   |    --      |       --         |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 328c8352480c..488cb210d055 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -27,6 +27,7 @@ config X86
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_FAST_MULTIPLIER
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_MEMREMAP
 	select ARCH_HAS_PMEM_API		if X86_64
 	select ARCH_HAS_MMIO_FLUSH
 	select ARCH_HAS_SG_CHAIN
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index b9c78f3bcd67..123431ae702f 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -317,6 +317,23 @@ void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
 }
 EXPORT_SYMBOL(ioremap_cache);
 
+void *arch_memremap(resource_size_t phys_addr, size_t size,
+		unsigned long flags)
+{
+	int prot;
+
+	if (flags & MEMREMAP_WB)
+		prot = _PAGE_CACHE_MODE_WB;
+	else if (flags & MEMREMAP_WT)
+		prot = _PAGE_CACHE_MODE_WT;
+	else
+		return NULL;
+
+	return (void __force *) __ioremap_caller(phys_addr, size, prot,
+			__builtin_return_address(0));
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size,
 				unsigned long prot_val)
 {
diff --git a/drivers/nvdimm/Kconfig b/drivers/nvdimm/Kconfig
index 53c11621d5b1..b8e9d8b46f33 100644
--- a/drivers/nvdimm/Kconfig
+++ b/drivers/nvdimm/Kconfig
@@ -1,5 +1,6 @@
 menuconfig LIBNVDIMM
 	tristate "NVDIMM (Non-Volatile Memory Device) Support"
+	depends on ARCH_HAS_MEMREMAP
 	depends on PHYS_ADDR_T_64BIT
 	depends on BLK_DEV
 	help
@@ -19,7 +20,6 @@ if LIBNVDIMM
 config BLK_DEV_PMEM
 	tristate "PMEM: Persistent memory block device support"
 	default LIBNVDIMM
-	depends on HAS_IOMEM
 	select ND_BTT if BTT
 	select ND_PFN if NVDIMM_PFN
 	help
diff --git a/include/linux/io.h b/include/linux/io.h
index de64c1e53612..4f150781735d 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -153,5 +153,6 @@ enum {
 
 void *memremap(resource_size_t offset, size_t size, unsigned long flags);
 void memunmap(void *addr);
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags);
 
 #endif /* _LINUX_IO_H */
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 72b0c66628b6..8bd5fe05d4a4 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -24,6 +24,16 @@ __weak void __iomem *ioremap_cache(resource_size_t offset, unsigned long size)
 }
 #endif
 
+/* temporary while we convert arch implementations to arch_memremap */
+__weak void *arch_memremap(resource_size_t offset, size_t size,
+		unsigned long flags)
+{
+	if (flags & MEMREMAP_WB)
+		return (void __force *) ioremap_cache(offset, size);
+	else if (flags & MEMREMAP_WT)
+		return (void __force *) ioremap_wt(offset, size);
+}
+
 /**
  * memremap() - remap an iomem_resource as cacheable memory
  * @offset: iomem resource start address
@@ -48,7 +58,6 @@ __weak void __iomem *ioremap_cache(resource_size_t offset, unsigned long size)
 void *memremap(resource_size_t offset, size_t size, unsigned long flags)
 {
 	int is_ram = region_intersects(offset, size, "System RAM");
-	void *addr = NULL;
 
 	if (is_ram == REGION_MIXED) {
 		WARN_ONCE(1, "memremap attempted on mixed range %pa size: %#lx\n",
@@ -58,7 +67,6 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags)
 
 	/* Try all mapping types requested until one returns non-NULL */
 	if (flags & MEMREMAP_WB) {
-		flags &= ~MEMREMAP_WB;
 		/*
 		 * MEMREMAP_WB is special in that it can be satisifed
 		 * from the direct map.  Some archs depend on the
@@ -66,9 +74,7 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags)
 		 * the requested range is potentially in "System RAM"
 		 */
 		if (is_ram == REGION_INTERSECTS)
-			addr = __va(offset);
-		else
-			addr = ioremap_cache(offset, size);
+			return __va(offset);
 	}
 
 	/*
@@ -77,18 +83,13 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags)
 	 * address mapping.  Enforce that this mapping is not aliasing
 	 * "System RAM"
 	 */
-	if (!addr && is_ram == REGION_INTERSECTS && flags) {
+	if (is_ram == REGION_INTERSECTS) {
 		WARN_ONCE(1, "memremap attempted on ram %pa size: %#lx\n",
 				&offset, (unsigned long) size);
 		return NULL;
 	}
 
-	if (!addr && (flags & MEMREMAP_WT)) {
-		flags &= ~MEMREMAP_WT;
-		addr = ioremap_wt(offset, size);
-	}
-
-	return addr;
+	return arch_memremap(offset, size, flags);
 }
 EXPORT_SYMBOL(memremap);
 
diff --git a/lib/Kconfig b/lib/Kconfig
index 2e491ac15622..8d99b4e6a45b 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -520,7 +520,10 @@ config SG_SPLIT
 #
 
 config ARCH_HAS_SG_CHAIN
-	def_bool n
+	bool
+
+config ARCH_HAS_MEMREMAP
+	bool
 
 config ARCH_HAS_PMEM_API
 	bool

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 02/20] arm: introduce arch_memremap()
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:15   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Russell King, Ross Zwisler, linux-arm-kernel, Arnd Bergmann

In preparation for removing ioremap_cache() introduce arch_memremap()
for arm.  For now, arch_memremap(..., MEMREMAP_WB) is an alias for
ioremap_cache().  Note that arch_memremap() is relying on memremap() to
handle remap requests to "System RAM".

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/arm/Kconfig          |    1 +
 arch/arm/include/asm/io.h |    1 +
 arch/arm/mm/ioremap.c     |   11 +++++++++++
 arch/arm/mm/nommu.c       |   10 ++++++++++
 arch/arm64/Kconfig        |    1 +
 arch/arm64/mm/ioremap.c   |   10 ++++++++++
 6 files changed, 34 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 72ad724c67ae..882771cfc63c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -3,6 +3,7 @@ config ARM
 	default y
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select ARCH_HAS_ELF_RANDOMIZE
+	select ARCH_HAS_MEMREMAP
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 485982084fe9..ca76d59cb6f3 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -356,6 +356,7 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from,
  * ioremap()		Device		n/a		n/a
  * ioremap_nocache()	Device		n/a		n/a
  * ioremap_cache()	Normal		Writeback	Read allocate
+ * memremap(WB)		Normal		Writeback	Read allocate
  * ioremap_wc()		Normal		Non-cacheable	n/a
  * ioremap_wt()		Normal		Non-cacheable	n/a
  *
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 0c81056c1dd7..f6249b98ed16 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -385,6 +385,17 @@ void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size)
 }
 EXPORT_SYMBOL(ioremap_cache);
 
+void *arch_memremap(resource_size_t res_cookie, size_t size,
+		unsigned long flags)
+{
+	if ((flags & MEMREMAP_WB) == 0)
+		return NULL;
+
+	return (void __force *) arch_ioremap_caller(res_cookie, size,
+			MT_DEVICE_CACHED, __builtin_return_address(0));
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size)
 {
 	return arch_ioremap_caller(res_cookie, size, MT_DEVICE_WC,
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 1dd10936d68d..d88353e1fe80 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -373,6 +373,16 @@ void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size)
 }
 EXPORT_SYMBOL(ioremap_cache);
 
+void *arch_memremap(resource_size_t res_cookie, size_t size, unsigned long flags)
+{
+	if ((flags & MEMREMAP_WB) == 0)
+		return NULL;
+
+	return (void __force *) __arm_ioremap_caller(res_cookie, size,
+			MT_DEVICE_CACHED, __builtin_return_address(0));
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size)
 {
 	return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_WC,
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 07d1811aa03f..54ea0688586f 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -6,6 +6,7 @@ config ARM64
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_MEMREMAP
 	select ARCH_HAS_SG_CHAIN
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_USE_CMPXCHG_LOCKREF
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index 01e88c8bcab0..9db5a12654a0 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -104,6 +104,16 @@ void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
 }
 EXPORT_SYMBOL(ioremap_cache);
 
+void *arch_memremap(phys_addr_t phys_addr, size_t size, unsigned long flags)
+{
+	if ((flags & MEMREMAP_WB) == 0)
+		return NULL;
+
+	return (void __force *) __ioremap_caller(phys_addr, size,
+			__pgprot(PROT_NORMAL), __builtin_return_address(0));
+}
+EXPORT_SYMBOL(arch_memremap);
+
 /*
  * Must be called after early_fixmap_init
  */


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 02/20] arm: introduce arch_memremap()
@ 2015-10-09 22:15   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for removing ioremap_cache() introduce arch_memremap()
for arm.  For now, arch_memremap(..., MEMREMAP_WB) is an alias for
ioremap_cache().  Note that arch_memremap() is relying on memremap() to
handle remap requests to "System RAM".

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/arm/Kconfig          |    1 +
 arch/arm/include/asm/io.h |    1 +
 arch/arm/mm/ioremap.c     |   11 +++++++++++
 arch/arm/mm/nommu.c       |   10 ++++++++++
 arch/arm64/Kconfig        |    1 +
 arch/arm64/mm/ioremap.c   |   10 ++++++++++
 6 files changed, 34 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 72ad724c67ae..882771cfc63c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -3,6 +3,7 @@ config ARM
 	default y
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select ARCH_HAS_ELF_RANDOMIZE
+	select ARCH_HAS_MEMREMAP
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 485982084fe9..ca76d59cb6f3 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -356,6 +356,7 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from,
  * ioremap()		Device		n/a		n/a
  * ioremap_nocache()	Device		n/a		n/a
  * ioremap_cache()	Normal		Writeback	Read allocate
+ * memremap(WB)		Normal		Writeback	Read allocate
  * ioremap_wc()		Normal		Non-cacheable	n/a
  * ioremap_wt()		Normal		Non-cacheable	n/a
  *
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 0c81056c1dd7..f6249b98ed16 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -385,6 +385,17 @@ void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size)
 }
 EXPORT_SYMBOL(ioremap_cache);
 
+void *arch_memremap(resource_size_t res_cookie, size_t size,
+		unsigned long flags)
+{
+	if ((flags & MEMREMAP_WB) == 0)
+		return NULL;
+
+	return (void __force *) arch_ioremap_caller(res_cookie, size,
+			MT_DEVICE_CACHED, __builtin_return_address(0));
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size)
 {
 	return arch_ioremap_caller(res_cookie, size, MT_DEVICE_WC,
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 1dd10936d68d..d88353e1fe80 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -373,6 +373,16 @@ void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size)
 }
 EXPORT_SYMBOL(ioremap_cache);
 
+void *arch_memremap(resource_size_t res_cookie, size_t size, unsigned long flags)
+{
+	if ((flags & MEMREMAP_WB) == 0)
+		return NULL;
+
+	return (void __force *) __arm_ioremap_caller(res_cookie, size,
+			MT_DEVICE_CACHED, __builtin_return_address(0));
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size)
 {
 	return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_WC,
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 07d1811aa03f..54ea0688586f 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -6,6 +6,7 @@ config ARM64
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_MEMREMAP
 	select ARCH_HAS_SG_CHAIN
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_USE_CMPXCHG_LOCKREF
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index 01e88c8bcab0..9db5a12654a0 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -104,6 +104,16 @@ void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
 }
 EXPORT_SYMBOL(ioremap_cache);
 
+void *arch_memremap(phys_addr_t phys_addr, size_t size, unsigned long flags)
+{
+	if ((flags & MEMREMAP_WB) == 0)
+		return NULL;
+
+	return (void __force *) __ioremap_caller(phys_addr, size,
+			__pgprot(PROT_NORMAL), __builtin_return_address(0));
+}
+EXPORT_SYMBOL(arch_memremap);
+
 /*
  * Must be called after early_fixmap_init
  */

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 03/20] ia64: introduce arch_memremap()
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:15   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Ross Zwisler, Tony Luck, linux-arm-kernel, Arnd Bergmann

In preparation for removing ioremap_cache() introduce arch_memremap()
for ia64.  Given that ia64 does not allow external control for caching
types, this simply aliases arch_memremap() with the ia64 ioremap()
implementation.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/ia64/Kconfig      |    1 +
 arch/ia64/mm/ioremap.c |   10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index eb0249e37981..b39bab1da7dd 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -52,6 +52,7 @@ config IA64
 	select HAVE_MOD_ARCH_SPECIFIC
 	select MODULES_USE_ELF_RELA
 	select ARCH_USE_CMPXCHG_LOCKREF
+	select ARCH_HAS_MEMREMAP
 	select HAVE_ARCH_AUDITSYSCALL
 	default y
 	help
diff --git a/arch/ia64/mm/ioremap.c b/arch/ia64/mm/ioremap.c
index 43964cde6214..53a1faa0e5da 100644
--- a/arch/ia64/mm/ioremap.c
+++ b/arch/ia64/mm/ioremap.c
@@ -101,6 +101,16 @@ ioremap (unsigned long phys_addr, unsigned long size)
 }
 EXPORT_SYMBOL(ioremap);
 
+/*
+ * Cache mapping-type is determined internal to ioremap and can't be
+ * externally specified
+ */
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags)
+{
+	return (void __force *) ioremap(offset, size);
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void __iomem *
 ioremap_nocache (unsigned long phys_addr, unsigned long size)
 {


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 03/20] ia64: introduce arch_memremap()
@ 2015-10-09 22:15   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for removing ioremap_cache() introduce arch_memremap()
for ia64.  Given that ia64 does not allow external control for caching
types, this simply aliases arch_memremap() with the ia64 ioremap()
implementation.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/ia64/Kconfig      |    1 +
 arch/ia64/mm/ioremap.c |   10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index eb0249e37981..b39bab1da7dd 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -52,6 +52,7 @@ config IA64
 	select HAVE_MOD_ARCH_SPECIFIC
 	select MODULES_USE_ELF_RELA
 	select ARCH_USE_CMPXCHG_LOCKREF
+	select ARCH_HAS_MEMREMAP
 	select HAVE_ARCH_AUDITSYSCALL
 	default y
 	help
diff --git a/arch/ia64/mm/ioremap.c b/arch/ia64/mm/ioremap.c
index 43964cde6214..53a1faa0e5da 100644
--- a/arch/ia64/mm/ioremap.c
+++ b/arch/ia64/mm/ioremap.c
@@ -101,6 +101,16 @@ ioremap (unsigned long phys_addr, unsigned long size)
 }
 EXPORT_SYMBOL(ioremap);
 
+/*
+ * Cache mapping-type is determined internal to ioremap and can't be
+ * externally specified
+ */
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags)
+{
+	return (void __force *) ioremap(offset, size);
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void __iomem *
 ioremap_nocache (unsigned long phys_addr, unsigned long size)
 {

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 04/20] sh: introduce arch_memremap()
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:15   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, Ross Zwisler, linux-arm-kernel, Arnd Bergmann

In preparation for removing ioremap_cache() introduce arch_memremap()
for sh.  This simply enforces that attempts to establish writethrough
mappings fail rather than silently fallback to uncached.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/sh/Kconfig      |    1 +
 arch/sh/mm/ioremap.c |    9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index d514df7e04dd..b5801ae0e952 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -54,6 +54,7 @@ config SUPERH32
 	def_bool ARCH = "sh"
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
+	select ARCH_HAS_MEMREMAP
 	select HAVE_IOREMAP_PROT if MMU && !X2TLB
 	select HAVE_FUNCTION_TRACER
 	select HAVE_FTRACE_MCOUNT_RECORD
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index 0c99ec2e7ed8..ce3819273368 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -86,6 +86,15 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
 }
 EXPORT_SYMBOL(__ioremap_caller);
 
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags)
+{
+	if ((flags & MEMREMAP_WB) == 0)
+		return NULL;
+
+	return (void __force *) __ioremap_mode(offset, size, PAGE_KERNEL);
+}
+EXPORT_SYMBOL(arch_memremap);
+
 /*
  * Simple checks for non-translatable mappings.
  */


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 04/20] sh: introduce arch_memremap()
@ 2015-10-09 22:15   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:15 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for removing ioremap_cache() introduce arch_memremap()
for sh.  This simply enforces that attempts to establish writethrough
mappings fail rather than silently fallback to uncached.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/sh/Kconfig      |    1 +
 arch/sh/mm/ioremap.c |    9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index d514df7e04dd..b5801ae0e952 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -54,6 +54,7 @@ config SUPERH32
 	def_bool ARCH = "sh"
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
+	select ARCH_HAS_MEMREMAP
 	select HAVE_IOREMAP_PROT if MMU && !X2TLB
 	select HAVE_FUNCTION_TRACER
 	select HAVE_FTRACE_MCOUNT_RECORD
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index 0c99ec2e7ed8..ce3819273368 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -86,6 +86,15 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
 }
 EXPORT_SYMBOL(__ioremap_caller);
 
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags)
+{
+	if ((flags & MEMREMAP_WB) == 0)
+		return NULL;
+
+	return (void __force *) __ioremap_mode(offset, size, PAGE_KERNEL);
+}
+EXPORT_SYMBOL(arch_memremap);
+
 /*
  * Simple checks for non-translatable mappings.
  */

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 05/20] m68k: introduce arch_memremap()
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Ross Zwisler, Geert Uytterhoeven, linux-arm-kernel,
	Arnd Bergmann

In preparation for removing ioremap_wt() introduce arch_memremap()
for m68k.  This simply enforces that attempts to establish writethrough
mappings fail rather than silently fall back to uncached.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/m68k/Kconfig       |    1 +
 arch/m68k/mm/kmap.c     |   17 ++++++++++++++++-
 arch/m68k/mm/sun3kmap.c |    7 +++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 498b567f007b..468b9ea6d042 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -9,6 +9,7 @@ config M68K
 	select GENERIC_ATOMIC64
 	select HAVE_UID16
 	select VIRT_TO_BUS
+	select ARCH_HAS_MEMREMAP
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
 	select GENERIC_CPU_DEVICES
 	select GENERIC_IOMAP
diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
index 6e4955bc542b..519c45865127 100644
--- a/arch/m68k/mm/kmap.c
+++ b/arch/m68k/mm/kmap.c
@@ -14,12 +14,12 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
+#include <linux/io.h>
 
 #include <asm/setup.h>
 #include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
-#include <asm/io.h>
 
 #undef DEBUG
 
@@ -223,6 +223,21 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
 }
 EXPORT_SYMBOL(__ioremap);
 
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags)
+{
+	int mode;
+
+	if (flags & MEMREMAP_WB)
+		mode = IOMAP_FULL_CACHING;
+	else if (flags & MEMREMAP_WT)
+		mode = IOMAP_WRITETHROUGH;
+	else
+		return NULL;
+
+	return (void __force *) __ioremap(offset, size, mode);
+}
+EXPORT_SYMBOL(arch_memremap);
+
 /*
  * Unmap an ioremap()ed region again
  */
diff --git a/arch/m68k/mm/sun3kmap.c b/arch/m68k/mm/sun3kmap.c
index 3dc41158c05e..981a9e423b23 100644
--- a/arch/m68k/mm/sun3kmap.c
+++ b/arch/m68k/mm/sun3kmap.c
@@ -116,6 +116,13 @@ void __iomem *__ioremap(unsigned long phys, unsigned long size, int cache)
 }
 EXPORT_SYMBOL(__ioremap);
 
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags)
+{
+	pr_err_once("sun3: no support for memremap\n");
+	return NULL;
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void iounmap(void __iomem *addr)
 {
 	vfree((void *)(PAGE_MASK & (unsigned long)addr));


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 05/20] m68k: introduce arch_memremap()
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for removing ioremap_wt() introduce arch_memremap()
for m68k.  This simply enforces that attempts to establish writethrough
mappings fail rather than silently fall back to uncached.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/m68k/Kconfig       |    1 +
 arch/m68k/mm/kmap.c     |   17 ++++++++++++++++-
 arch/m68k/mm/sun3kmap.c |    7 +++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 498b567f007b..468b9ea6d042 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -9,6 +9,7 @@ config M68K
 	select GENERIC_ATOMIC64
 	select HAVE_UID16
 	select VIRT_TO_BUS
+	select ARCH_HAS_MEMREMAP
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
 	select GENERIC_CPU_DEVICES
 	select GENERIC_IOMAP
diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
index 6e4955bc542b..519c45865127 100644
--- a/arch/m68k/mm/kmap.c
+++ b/arch/m68k/mm/kmap.c
@@ -14,12 +14,12 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
+#include <linux/io.h>
 
 #include <asm/setup.h>
 #include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
-#include <asm/io.h>
 
 #undef DEBUG
 
@@ -223,6 +223,21 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
 }
 EXPORT_SYMBOL(__ioremap);
 
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags)
+{
+	int mode;
+
+	if (flags & MEMREMAP_WB)
+		mode = IOMAP_FULL_CACHING;
+	else if (flags & MEMREMAP_WT)
+		mode = IOMAP_WRITETHROUGH;
+	else
+		return NULL;
+
+	return (void __force *) __ioremap(offset, size, mode);
+}
+EXPORT_SYMBOL(arch_memremap);
+
 /*
  * Unmap an ioremap()ed region again
  */
diff --git a/arch/m68k/mm/sun3kmap.c b/arch/m68k/mm/sun3kmap.c
index 3dc41158c05e..981a9e423b23 100644
--- a/arch/m68k/mm/sun3kmap.c
+++ b/arch/m68k/mm/sun3kmap.c
@@ -116,6 +116,13 @@ void __iomem *__ioremap(unsigned long phys, unsigned long size, int cache)
 }
 EXPORT_SYMBOL(__ioremap);
 
+void *arch_memremap(resource_size_t offset, size_t size, unsigned long flags)
+{
+	pr_err_once("sun3: no support for memremap\n");
+	return NULL;
+}
+EXPORT_SYMBOL(arch_memremap);
+
 void iounmap(void __iomem *addr)
 {
 	vfree((void *)(PAGE_MASK & (unsigned long)addr));

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 06/20] arm: switch from ioremap_cache to memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, Russell King, linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
arch/arm[64]/ to memremap.

Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/arm/include/asm/xen/page.h    |    4 ++--
 arch/arm64/include/asm/acpi.h      |    5 +----
 arch/arm64/include/asm/dmi.h       |    8 ++++----
 arch/arm64/kernel/efi.c            |    9 +++++----
 arch/arm64/kernel/smp_spin_table.c |   19 +++++++++----------
 5 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index 127956353b00..91ac751a5baa 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -103,8 +103,8 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
 	return __set_phys_to_machine(pfn, mfn);
 }
 
-#define xen_remap(cookie, size) ioremap_cache((cookie), (size))
-#define xen_unmap(cookie) iounmap((cookie))
+#define xen_remap(cookie, size) memremap((cookie), (size), MEMREMAP_WB)
+#define xen_unmap(cookie) memunmap((cookie))
 
 bool xen_arch_need_swiotlb(struct device *dev,
 			   unsigned long pfn,
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 208cec08a74f..a24a9b1cc91d 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -33,10 +33,7 @@
 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);
+	return memremap(phys, size, MEMREMAP_WB);
 }
 #define acpi_os_ioremap acpi_os_ioremap
 
diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
index 69d37d87b159..82682d27c6ee 100644
--- a/arch/arm64/include/asm/dmi.h
+++ b/arch/arm64/include/asm/dmi.h
@@ -22,10 +22,10 @@
  * request a virtual mapping for configuration tables such as SMBIOS.
  * This means we have to map them before use.
  */
-#define dmi_early_remap(x, l)		ioremap_cache(x, l)
-#define dmi_early_unmap(x, l)		iounmap(x)
-#define dmi_remap(x, l)			ioremap_cache(x, l)
-#define dmi_unmap(x)			iounmap(x)
+#define dmi_early_remap(x, l)		memremap(x, l, MEMREMAP_WB)
+#define dmi_early_unmap(x, l)		memunmap(x)
+#define dmi_remap(x, l)			memremap(x, l, MEMREMAP_WB)
+#define dmi_unmap(x)			memunmap(x)
 #define dmi_alloc(l)			kzalloc(l, GFP_KERNEL)
 
 #endif
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 13671a9cf016..7dd05eb2c186 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -26,6 +26,7 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
+#include <linux/io.h>
 
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
@@ -291,8 +292,8 @@ static int __init arm64_enable_runtime_services(void)
 	pr_info("Remapping and enabling EFI services.\n");
 
 	mapsize = memmap.map_end - memmap.map;
-	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
-						   mapsize);
+	memmap.map = memremap((phys_addr_t) memmap.phys_map, mapsize,
+			MEMREMAP_WB);
 	if (!memmap.map) {
 		pr_err("Failed to remap EFI memory map\n");
 		return -1;
@@ -300,8 +301,8 @@ static int __init arm64_enable_runtime_services(void)
 	memmap.map_end = memmap.map + mapsize;
 	efi.memmap = &memmap;
 
-	efi.systab = (__force void *)ioremap_cache(efi_system_table,
-						   sizeof(efi_system_table_t));
+	efi.systab = memremap(efi_system_table, sizeof(efi_system_table_t),
+			MEMREMAP_WB);
 	if (!efi.systab) {
 		pr_err("Failed to remap EFI System Table\n");
 		return -1;
diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index aef3605a8c47..2c06c1a36154 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -21,11 +21,11 @@
 #include <linux/of.h>
 #include <linux/smp.h>
 #include <linux/types.h>
+#include <linux/io.h>
 
 #include <asm/cacheflush.h>
 #include <asm/cpu_ops.h>
 #include <asm/cputype.h>
-#include <asm/io.h>
 #include <asm/smp_plat.h>
 
 extern void secondary_holding_pen(void);
@@ -73,19 +73,19 @@ static int smp_spin_table_cpu_init(unsigned int cpu)
 
 static int smp_spin_table_cpu_prepare(unsigned int cpu)
 {
-	__le64 __iomem *release_addr;
+	__le64 *release_addr;
 
 	if (!cpu_release_addr[cpu])
 		return -ENODEV;
 
 	/*
 	 * The cpu-release-addr may or may not be inside the linear mapping.
-	 * As ioremap_cache will either give us a new mapping or reuse the
-	 * existing linear mapping, we can use it to cover both cases. In
-	 * either case the memory will be MT_NORMAL.
+	 * As memremap will either give us a new mapping or reuse the existing
+	 * linear mapping, we can use it to cover both cases. In either case
+	 * the memory will be MT_NORMAL.
 	 */
-	release_addr = ioremap_cache(cpu_release_addr[cpu],
-				     sizeof(*release_addr));
+	release_addr = memremap(cpu_release_addr[cpu], sizeof(*release_addr),
+			MEMREMAP_WB);
 	if (!release_addr)
 		return -ENOMEM;
 
@@ -97,15 +97,14 @@ static int smp_spin_table_cpu_prepare(unsigned int cpu)
 	 * the boot protocol.
 	 */
 	writeq_relaxed(__pa(secondary_holding_pen), release_addr);
-	__flush_dcache_area((__force void *)release_addr,
-			    sizeof(*release_addr));
+	__flush_dcache_area(release_addr, sizeof(*release_addr));
 
 	/*
 	 * Send an event to wake up the secondary CPU.
 	 */
 	sev();
 
-	iounmap(release_addr);
+	memunmap(release_addr);
 
 	return 0;
 }


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 06/20] arm: switch from ioremap_cache to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
arch/arm[64]/ to memremap.

Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/arm/include/asm/xen/page.h    |    4 ++--
 arch/arm64/include/asm/acpi.h      |    5 +----
 arch/arm64/include/asm/dmi.h       |    8 ++++----
 arch/arm64/kernel/efi.c            |    9 +++++----
 arch/arm64/kernel/smp_spin_table.c |   19 +++++++++----------
 5 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index 127956353b00..91ac751a5baa 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -103,8 +103,8 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
 	return __set_phys_to_machine(pfn, mfn);
 }
 
-#define xen_remap(cookie, size) ioremap_cache((cookie), (size))
-#define xen_unmap(cookie) iounmap((cookie))
+#define xen_remap(cookie, size) memremap((cookie), (size), MEMREMAP_WB)
+#define xen_unmap(cookie) memunmap((cookie))
 
 bool xen_arch_need_swiotlb(struct device *dev,
 			   unsigned long pfn,
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 208cec08a74f..a24a9b1cc91d 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -33,10 +33,7 @@
 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);
+	return memremap(phys, size, MEMREMAP_WB);
 }
 #define acpi_os_ioremap acpi_os_ioremap
 
diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
index 69d37d87b159..82682d27c6ee 100644
--- a/arch/arm64/include/asm/dmi.h
+++ b/arch/arm64/include/asm/dmi.h
@@ -22,10 +22,10 @@
  * request a virtual mapping for configuration tables such as SMBIOS.
  * This means we have to map them before use.
  */
-#define dmi_early_remap(x, l)		ioremap_cache(x, l)
-#define dmi_early_unmap(x, l)		iounmap(x)
-#define dmi_remap(x, l)			ioremap_cache(x, l)
-#define dmi_unmap(x)			iounmap(x)
+#define dmi_early_remap(x, l)		memremap(x, l, MEMREMAP_WB)
+#define dmi_early_unmap(x, l)		memunmap(x)
+#define dmi_remap(x, l)			memremap(x, l, MEMREMAP_WB)
+#define dmi_unmap(x)			memunmap(x)
 #define dmi_alloc(l)			kzalloc(l, GFP_KERNEL)
 
 #endif
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 13671a9cf016..7dd05eb2c186 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -26,6 +26,7 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
+#include <linux/io.h>
 
 #include <asm/cacheflush.h>
 #include <asm/efi.h>
@@ -291,8 +292,8 @@ static int __init arm64_enable_runtime_services(void)
 	pr_info("Remapping and enabling EFI services.\n");
 
 	mapsize = memmap.map_end - memmap.map;
-	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
-						   mapsize);
+	memmap.map = memremap((phys_addr_t) memmap.phys_map, mapsize,
+			MEMREMAP_WB);
 	if (!memmap.map) {
 		pr_err("Failed to remap EFI memory map\n");
 		return -1;
@@ -300,8 +301,8 @@ static int __init arm64_enable_runtime_services(void)
 	memmap.map_end = memmap.map + mapsize;
 	efi.memmap = &memmap;
 
-	efi.systab = (__force void *)ioremap_cache(efi_system_table,
-						   sizeof(efi_system_table_t));
+	efi.systab = memremap(efi_system_table, sizeof(efi_system_table_t),
+			MEMREMAP_WB);
 	if (!efi.systab) {
 		pr_err("Failed to remap EFI System Table\n");
 		return -1;
diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index aef3605a8c47..2c06c1a36154 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -21,11 +21,11 @@
 #include <linux/of.h>
 #include <linux/smp.h>
 #include <linux/types.h>
+#include <linux/io.h>
 
 #include <asm/cacheflush.h>
 #include <asm/cpu_ops.h>
 #include <asm/cputype.h>
-#include <asm/io.h>
 #include <asm/smp_plat.h>
 
 extern void secondary_holding_pen(void);
@@ -73,19 +73,19 @@ static int smp_spin_table_cpu_init(unsigned int cpu)
 
 static int smp_spin_table_cpu_prepare(unsigned int cpu)
 {
-	__le64 __iomem *release_addr;
+	__le64 *release_addr;
 
 	if (!cpu_release_addr[cpu])
 		return -ENODEV;
 
 	/*
 	 * The cpu-release-addr may or may not be inside the linear mapping.
-	 * As ioremap_cache will either give us a new mapping or reuse the
-	 * existing linear mapping, we can use it to cover both cases. In
-	 * either case the memory will be MT_NORMAL.
+	 * As memremap will either give us a new mapping or reuse the existing
+	 * linear mapping, we can use it to cover both cases. In either case
+	 * the memory will be MT_NORMAL.
 	 */
-	release_addr = ioremap_cache(cpu_release_addr[cpu],
-				     sizeof(*release_addr));
+	release_addr = memremap(cpu_release_addr[cpu], sizeof(*release_addr),
+			MEMREMAP_WB);
 	if (!release_addr)
 		return -ENOMEM;
 
@@ -97,15 +97,14 @@ static int smp_spin_table_cpu_prepare(unsigned int cpu)
 	 * the boot protocol.
 	 */
 	writeq_relaxed(__pa(secondary_holding_pen), release_addr);
-	__flush_dcache_area((__force void *)release_addr,
-			    sizeof(*release_addr));
+	__flush_dcache_area(release_addr, sizeof(*release_addr));
 
 	/*
 	 * Send an event to wake up the secondary CPU.
 	 */
 	sev();
 
-	iounmap(release_addr);
+	memunmap(release_addr);
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 07/20] x86: switch from ioremap_cache to memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	Thomas Gleixner, linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
arch/x86/ to memremap.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/x86/include/asm/efi.h      |    3 ++-
 arch/x86/kernel/crash_dump_64.c |    6 +++---
 arch/x86/kernel/kdebugfs.c      |    8 ++++----
 arch/x86/kernel/ksysfs.c        |   28 ++++++++++++++--------------
 arch/x86/mm/ioremap.c           |   10 ++++------
 5 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index ae68be92f755..322dde9e0c3c 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -54,7 +54,8 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
 	kernel_fpu_end();						\
 })
 
-#define efi_ioremap(addr, size, type, attr)	ioremap_cache(addr, size)
+#define efi_ioremap(addr, size, type, attr)				\
+	memremap(addr, size, MEMREMAP_WB)
 
 #else /* !CONFIG_X86_32 */
 
diff --git a/arch/x86/kernel/crash_dump_64.c b/arch/x86/kernel/crash_dump_64.c
index afa64adb75ee..941609ab9aa9 100644
--- a/arch/x86/kernel/crash_dump_64.c
+++ b/arch/x86/kernel/crash_dump_64.c
@@ -31,19 +31,19 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 	if (!csize)
 		return 0;
 
-	vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE);
+	vaddr = memremap(pfn << PAGE_SHIFT, PAGE_SIZE, MEMREMAP_WB);
 	if (!vaddr)
 		return -ENOMEM;
 
 	if (userbuf) {
 		if (copy_to_user(buf, vaddr + offset, csize)) {
-			iounmap(vaddr);
+			memunmap(vaddr);
 			return -EFAULT;
 		}
 	} else
 		memcpy(buf, vaddr + offset, csize);
 
 	set_iounmap_nonlazy();
-	iounmap(vaddr);
+	memunmap(vaddr);
 	return csize;
 }
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c
index dc1404bf8e4b..fa30f85b4333 100644
--- a/arch/x86/kernel/kdebugfs.c
+++ b/arch/x86/kernel/kdebugfs.c
@@ -49,7 +49,7 @@ static ssize_t setup_data_read(struct file *file, char __user *user_buf,
 	pa = node->paddr + sizeof(struct setup_data) + pos;
 	pg = pfn_to_page((pa + count - 1) >> PAGE_SHIFT);
 	if (PageHighMem(pg)) {
-		p = ioremap_cache(pa, count);
+		p = memremap(pa, count, MEMREMAP_WB);
 		if (!p)
 			return -ENXIO;
 	} else
@@ -58,7 +58,7 @@ static ssize_t setup_data_read(struct file *file, char __user *user_buf,
 	remain = copy_to_user(user_buf, p, count);
 
 	if (PageHighMem(pg))
-		iounmap(p);
+		memunmap(p);
 
 	if (remain)
 		return -EFAULT;
@@ -128,7 +128,7 @@ static int __init create_setup_data_nodes(struct dentry *parent)
 
 		pg = pfn_to_page((pa_data+sizeof(*data)-1) >> PAGE_SHIFT);
 		if (PageHighMem(pg)) {
-			data = ioremap_cache(pa_data, sizeof(*data));
+			data = memremap(pa_data, sizeof(*data), MEMREMAP_WB);
 			if (!data) {
 				kfree(node);
 				error = -ENXIO;
@@ -144,7 +144,7 @@ static int __init create_setup_data_nodes(struct dentry *parent)
 		pa_data = data->next;
 
 		if (PageHighMem(pg))
-			iounmap(data);
+			memunmap(data);
 		if (error)
 			goto err_dir;
 		no++;
diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
index c2bedaea11f7..2d6ae3baafb8 100644
--- a/arch/x86/kernel/ksysfs.c
+++ b/arch/x86/kernel/ksysfs.c
@@ -16,8 +16,8 @@
 #include <linux/stat.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/setup.h>
 
 static ssize_t version_show(struct kobject *kobj,
@@ -79,12 +79,12 @@ static int get_setup_data_paddr(int nr, u64 *paddr)
 			*paddr = pa_data;
 			return 0;
 		}
-		data = ioremap_cache(pa_data, sizeof(*data));
+		data = memremap(pa_data, sizeof(*data), MEMREMAP_WB);
 		if (!data)
 			return -ENOMEM;
 
 		pa_data = data->next;
-		iounmap(data);
+		memunmap(data);
 		i++;
 	}
 	return -EINVAL;
@@ -97,17 +97,17 @@ static int __init get_setup_data_size(int nr, size_t *size)
 	u64 pa_data = boot_params.hdr.setup_data;
 
 	while (pa_data) {
-		data = ioremap_cache(pa_data, sizeof(*data));
+		data = memremap(pa_data, sizeof(*data), MEMREMAP_WB);
 		if (!data)
 			return -ENOMEM;
 		if (nr == i) {
 			*size = data->len;
-			iounmap(data);
+			memunmap(data);
 			return 0;
 		}
 
 		pa_data = data->next;
-		iounmap(data);
+		memunmap(data);
 		i++;
 	}
 	return -EINVAL;
@@ -127,12 +127,12 @@ static ssize_t type_show(struct kobject *kobj,
 	ret = get_setup_data_paddr(nr, &paddr);
 	if (ret)
 		return ret;
-	data = ioremap_cache(paddr, sizeof(*data));
+	data = memremap(paddr, sizeof(*data), MEMREMAP_WB);
 	if (!data)
 		return -ENOMEM;
 
 	ret = sprintf(buf, "0x%x\n", data->type);
-	iounmap(data);
+	memunmap(data);
 	return ret;
 }
 
@@ -154,7 +154,7 @@ static ssize_t setup_data_data_read(struct file *fp,
 	ret = get_setup_data_paddr(nr, &paddr);
 	if (ret)
 		return ret;
-	data = ioremap_cache(paddr, sizeof(*data));
+	data = memremap(paddr, sizeof(*data), MEMREMAP_WB);
 	if (!data)
 		return -ENOMEM;
 
@@ -170,15 +170,15 @@ static ssize_t setup_data_data_read(struct file *fp,
 		goto out;
 
 	ret = count;
-	p = ioremap_cache(paddr + sizeof(*data), data->len);
+	p = memremap(paddr + sizeof(*data), data->len, MEMREMAP_WB);
 	if (!p) {
 		ret = -ENOMEM;
 		goto out;
 	}
 	memcpy(buf, p + off, count);
-	iounmap(p);
+	memunmap(p);
 out:
-	iounmap(data);
+	memunmap(data);
 	return ret;
 }
 
@@ -250,13 +250,13 @@ static int __init get_setup_data_total_num(u64 pa_data, int *nr)
 	*nr = 0;
 	while (pa_data) {
 		*nr += 1;
-		data = ioremap_cache(pa_data, sizeof(*data));
+		data = memremap(pa_data, sizeof(*data), MEMREMAP_WB);
 		if (!data) {
 			ret = -ENOMEM;
 			goto out;
 		}
 		pa_data = data->next;
-		iounmap(data);
+		memunmap(data);
 	}
 
 out:
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 123431ae702f..3762ad93bd87 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -420,12 +420,10 @@ void *xlate_dev_mem_ptr(phys_addr_t phys)
 	if (page_is_ram(start >> PAGE_SHIFT))
 		return __va(phys);
 
-	vaddr = ioremap_cache(start, PAGE_SIZE);
-	/* Only add the offset on success and return NULL if the ioremap() failed: */
+	vaddr = memremap(start, PAGE_SIZE, MEMREMAP_WB);
 	if (vaddr)
-		vaddr += offset;
-
-	return vaddr;
+		return vaddr + offset;
+	return NULL;
 }
 
 void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
@@ -433,7 +431,7 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
 	if (page_is_ram(phys >> PAGE_SHIFT))
 		return;
 
-	iounmap((void __iomem *)((unsigned long)addr & PAGE_MASK));
+	memunmap((void *)((unsigned long)addr & PAGE_MASK));
 }
 
 static pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)] __page_aligned_bss;


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 07/20] x86: switch from ioremap_cache to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
arch/x86/ to memremap.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/x86/include/asm/efi.h      |    3 ++-
 arch/x86/kernel/crash_dump_64.c |    6 +++---
 arch/x86/kernel/kdebugfs.c      |    8 ++++----
 arch/x86/kernel/ksysfs.c        |   28 ++++++++++++++--------------
 arch/x86/mm/ioremap.c           |   10 ++++------
 5 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index ae68be92f755..322dde9e0c3c 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -54,7 +54,8 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
 	kernel_fpu_end();						\
 })
 
-#define efi_ioremap(addr, size, type, attr)	ioremap_cache(addr, size)
+#define efi_ioremap(addr, size, type, attr)				\
+	memremap(addr, size, MEMREMAP_WB)
 
 #else /* !CONFIG_X86_32 */
 
diff --git a/arch/x86/kernel/crash_dump_64.c b/arch/x86/kernel/crash_dump_64.c
index afa64adb75ee..941609ab9aa9 100644
--- a/arch/x86/kernel/crash_dump_64.c
+++ b/arch/x86/kernel/crash_dump_64.c
@@ -31,19 +31,19 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 	if (!csize)
 		return 0;
 
-	vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE);
+	vaddr = memremap(pfn << PAGE_SHIFT, PAGE_SIZE, MEMREMAP_WB);
 	if (!vaddr)
 		return -ENOMEM;
 
 	if (userbuf) {
 		if (copy_to_user(buf, vaddr + offset, csize)) {
-			iounmap(vaddr);
+			memunmap(vaddr);
 			return -EFAULT;
 		}
 	} else
 		memcpy(buf, vaddr + offset, csize);
 
 	set_iounmap_nonlazy();
-	iounmap(vaddr);
+	memunmap(vaddr);
 	return csize;
 }
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c
index dc1404bf8e4b..fa30f85b4333 100644
--- a/arch/x86/kernel/kdebugfs.c
+++ b/arch/x86/kernel/kdebugfs.c
@@ -49,7 +49,7 @@ static ssize_t setup_data_read(struct file *file, char __user *user_buf,
 	pa = node->paddr + sizeof(struct setup_data) + pos;
 	pg = pfn_to_page((pa + count - 1) >> PAGE_SHIFT);
 	if (PageHighMem(pg)) {
-		p = ioremap_cache(pa, count);
+		p = memremap(pa, count, MEMREMAP_WB);
 		if (!p)
 			return -ENXIO;
 	} else
@@ -58,7 +58,7 @@ static ssize_t setup_data_read(struct file *file, char __user *user_buf,
 	remain = copy_to_user(user_buf, p, count);
 
 	if (PageHighMem(pg))
-		iounmap(p);
+		memunmap(p);
 
 	if (remain)
 		return -EFAULT;
@@ -128,7 +128,7 @@ static int __init create_setup_data_nodes(struct dentry *parent)
 
 		pg = pfn_to_page((pa_data+sizeof(*data)-1) >> PAGE_SHIFT);
 		if (PageHighMem(pg)) {
-			data = ioremap_cache(pa_data, sizeof(*data));
+			data = memremap(pa_data, sizeof(*data), MEMREMAP_WB);
 			if (!data) {
 				kfree(node);
 				error = -ENXIO;
@@ -144,7 +144,7 @@ static int __init create_setup_data_nodes(struct dentry *parent)
 		pa_data = data->next;
 
 		if (PageHighMem(pg))
-			iounmap(data);
+			memunmap(data);
 		if (error)
 			goto err_dir;
 		no++;
diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
index c2bedaea11f7..2d6ae3baafb8 100644
--- a/arch/x86/kernel/ksysfs.c
+++ b/arch/x86/kernel/ksysfs.c
@@ -16,8 +16,8 @@
 #include <linux/stat.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/setup.h>
 
 static ssize_t version_show(struct kobject *kobj,
@@ -79,12 +79,12 @@ static int get_setup_data_paddr(int nr, u64 *paddr)
 			*paddr = pa_data;
 			return 0;
 		}
-		data = ioremap_cache(pa_data, sizeof(*data));
+		data = memremap(pa_data, sizeof(*data), MEMREMAP_WB);
 		if (!data)
 			return -ENOMEM;
 
 		pa_data = data->next;
-		iounmap(data);
+		memunmap(data);
 		i++;
 	}
 	return -EINVAL;
@@ -97,17 +97,17 @@ static int __init get_setup_data_size(int nr, size_t *size)
 	u64 pa_data = boot_params.hdr.setup_data;
 
 	while (pa_data) {
-		data = ioremap_cache(pa_data, sizeof(*data));
+		data = memremap(pa_data, sizeof(*data), MEMREMAP_WB);
 		if (!data)
 			return -ENOMEM;
 		if (nr == i) {
 			*size = data->len;
-			iounmap(data);
+			memunmap(data);
 			return 0;
 		}
 
 		pa_data = data->next;
-		iounmap(data);
+		memunmap(data);
 		i++;
 	}
 	return -EINVAL;
@@ -127,12 +127,12 @@ static ssize_t type_show(struct kobject *kobj,
 	ret = get_setup_data_paddr(nr, &paddr);
 	if (ret)
 		return ret;
-	data = ioremap_cache(paddr, sizeof(*data));
+	data = memremap(paddr, sizeof(*data), MEMREMAP_WB);
 	if (!data)
 		return -ENOMEM;
 
 	ret = sprintf(buf, "0x%x\n", data->type);
-	iounmap(data);
+	memunmap(data);
 	return ret;
 }
 
@@ -154,7 +154,7 @@ static ssize_t setup_data_data_read(struct file *fp,
 	ret = get_setup_data_paddr(nr, &paddr);
 	if (ret)
 		return ret;
-	data = ioremap_cache(paddr, sizeof(*data));
+	data = memremap(paddr, sizeof(*data), MEMREMAP_WB);
 	if (!data)
 		return -ENOMEM;
 
@@ -170,15 +170,15 @@ static ssize_t setup_data_data_read(struct file *fp,
 		goto out;
 
 	ret = count;
-	p = ioremap_cache(paddr + sizeof(*data), data->len);
+	p = memremap(paddr + sizeof(*data), data->len, MEMREMAP_WB);
 	if (!p) {
 		ret = -ENOMEM;
 		goto out;
 	}
 	memcpy(buf, p + off, count);
-	iounmap(p);
+	memunmap(p);
 out:
-	iounmap(data);
+	memunmap(data);
 	return ret;
 }
 
@@ -250,13 +250,13 @@ static int __init get_setup_data_total_num(u64 pa_data, int *nr)
 	*nr = 0;
 	while (pa_data) {
 		*nr += 1;
-		data = ioremap_cache(pa_data, sizeof(*data));
+		data = memremap(pa_data, sizeof(*data), MEMREMAP_WB);
 		if (!data) {
 			ret = -ENOMEM;
 			goto out;
 		}
 		pa_data = data->next;
-		iounmap(data);
+		memunmap(data);
 	}
 
 out:
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 123431ae702f..3762ad93bd87 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -420,12 +420,10 @@ void *xlate_dev_mem_ptr(phys_addr_t phys)
 	if (page_is_ram(start >> PAGE_SHIFT))
 		return __va(phys);
 
-	vaddr = ioremap_cache(start, PAGE_SIZE);
-	/* Only add the offset on success and return NULL if the ioremap() failed: */
+	vaddr = memremap(start, PAGE_SIZE, MEMREMAP_WB);
 	if (vaddr)
-		vaddr += offset;
-
-	return vaddr;
+		return vaddr + offset;
+	return NULL;
 }
 
 void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
@@ -433,7 +431,7 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
 	if (page_is_ram(phys >> PAGE_SHIFT))
 		return;
 
-	iounmap((void __iomem *)((unsigned long)addr & PAGE_MASK));
+	memunmap((void *)((unsigned long)addr & PAGE_MASK));
 }
 
 static pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)] __page_aligned_bss;

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 08/20] gma500: switch from acpi_os_ioremap to memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: David Airlie, linux-arch, linux-arm-kernel, dri-devel

gma500 expects the OpRegion to be cached (i.e. not __iomem), so
explicitly map it with memremap rather than the implied cache setting of
acpi_os_ioremap().

Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/gpu/drm/gma500/opregion.c |    8 ++++----
 drivers/gpu/drm/gma500/psb_drv.h  |    2 +-
 drivers/gpu/drm/gma500/psb_lid.c  |    8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/gma500/opregion.c b/drivers/gpu/drm/gma500/opregion.c
index ab696ca7eeec..7672ac4d4217 100644
--- a/drivers/gpu/drm/gma500/opregion.c
+++ b/drivers/gpu/drm/gma500/opregion.c
@@ -297,7 +297,7 @@ void psb_intel_opregion_fini(struct drm_device *dev)
 	cancel_work_sync(&opregion->asle_work);
 
 	/* just clear all opregion memory pointers now */
-	iounmap(opregion->header);
+	memunmap(opregion->header);
 	opregion->header = NULL;
 	opregion->acpi = NULL;
 	opregion->swsci = NULL;
@@ -310,8 +310,8 @@ int psb_intel_opregion_setup(struct drm_device *dev)
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	struct psb_intel_opregion *opregion = &dev_priv->opregion;
 	u32 opregion_phy, mboxes;
-	void __iomem *base;
 	int err = 0;
+	void *base;
 
 	pci_read_config_dword(dev->pdev, PCI_ASLS, &opregion_phy);
 	if (opregion_phy == 0) {
@@ -322,7 +322,7 @@ int psb_intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, psb_intel_opregion_asle_work);
 
 	DRM_DEBUG("OpRegion detected at 0x%8x\n", opregion_phy);
-	base = acpi_os_ioremap(opregion_phy, 8*1024);
+	base = memremap(opregion_phy, 8*1024, MEMREMAP_WB);
 	if (!base)
 		return -ENOMEM;
 
@@ -351,7 +351,7 @@ int psb_intel_opregion_setup(struct drm_device *dev)
 	return 0;
 
 err_out:
-	iounmap(base);
+	memunmap(base);
 	return err;
 }
 
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index e38057b91865..189f57135d47 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -253,7 +253,7 @@ struct psb_intel_opregion {
 	struct opregion_swsci *swsci;
 	struct opregion_asle *asle;
 	void *vbt;
-	u32 __iomem *lid_state;
+	u32 *lid_state;
 	struct work_struct asle_work;
 };
 
diff --git a/drivers/gpu/drm/gma500/psb_lid.c b/drivers/gpu/drm/gma500/psb_lid.c
index 1d2ebb5e530f..6b1b9d0741df 100644
--- a/drivers/gpu/drm/gma500/psb_lid.c
+++ b/drivers/gpu/drm/gma500/psb_lid.c
@@ -28,14 +28,14 @@ static void psb_lid_timer_func(unsigned long data)
 	struct drm_psb_private * dev_priv = (struct drm_psb_private *)data;
 	struct drm_device *dev = (struct drm_device *)dev_priv->dev;
 	struct timer_list *lid_timer = &dev_priv->lid_timer;
+	u32 *lid_state = dev_priv->opregion.lid_state;
 	unsigned long irq_flags;
-	u32 __iomem *lid_state = dev_priv->opregion.lid_state;
 	u32 pp_status;
 
-	if (readl(lid_state) == dev_priv->lid_last_state)
+	if (*lid_state == dev_priv->lid_last_state)
 		goto lid_timer_schedule;
 
-	if ((readl(lid_state)) & 0x01) {
+	if ((*lid_state) & 0x01) {
 		/*lid state is open*/
 		REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) | POWER_TARGET_ON);
 		do {
@@ -58,7 +58,7 @@ static void psb_lid_timer_func(unsigned long data)
 			pp_status = REG_READ(PP_STATUS);
 		} while ((pp_status & PP_ON) == 0);
 	}
-	dev_priv->lid_last_state =  readl(lid_state);
+	dev_priv->lid_last_state =  *lid_state;
 
 lid_timer_schedule:
 	spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 08/20] gma500: switch from acpi_os_ioremap to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

gma500 expects the OpRegion to be cached (i.e. not __iomem), so
explicitly map it with memremap rather than the implied cache setting of
acpi_os_ioremap().

Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/gpu/drm/gma500/opregion.c |    8 ++++----
 drivers/gpu/drm/gma500/psb_drv.h  |    2 +-
 drivers/gpu/drm/gma500/psb_lid.c  |    8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/gma500/opregion.c b/drivers/gpu/drm/gma500/opregion.c
index ab696ca7eeec..7672ac4d4217 100644
--- a/drivers/gpu/drm/gma500/opregion.c
+++ b/drivers/gpu/drm/gma500/opregion.c
@@ -297,7 +297,7 @@ void psb_intel_opregion_fini(struct drm_device *dev)
 	cancel_work_sync(&opregion->asle_work);
 
 	/* just clear all opregion memory pointers now */
-	iounmap(opregion->header);
+	memunmap(opregion->header);
 	opregion->header = NULL;
 	opregion->acpi = NULL;
 	opregion->swsci = NULL;
@@ -310,8 +310,8 @@ int psb_intel_opregion_setup(struct drm_device *dev)
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	struct psb_intel_opregion *opregion = &dev_priv->opregion;
 	u32 opregion_phy, mboxes;
-	void __iomem *base;
 	int err = 0;
+	void *base;
 
 	pci_read_config_dword(dev->pdev, PCI_ASLS, &opregion_phy);
 	if (opregion_phy == 0) {
@@ -322,7 +322,7 @@ int psb_intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, psb_intel_opregion_asle_work);
 
 	DRM_DEBUG("OpRegion detected at 0x%8x\n", opregion_phy);
-	base = acpi_os_ioremap(opregion_phy, 8*1024);
+	base = memremap(opregion_phy, 8*1024, MEMREMAP_WB);
 	if (!base)
 		return -ENOMEM;
 
@@ -351,7 +351,7 @@ int psb_intel_opregion_setup(struct drm_device *dev)
 	return 0;
 
 err_out:
-	iounmap(base);
+	memunmap(base);
 	return err;
 }
 
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index e38057b91865..189f57135d47 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -253,7 +253,7 @@ struct psb_intel_opregion {
 	struct opregion_swsci *swsci;
 	struct opregion_asle *asle;
 	void *vbt;
-	u32 __iomem *lid_state;
+	u32 *lid_state;
 	struct work_struct asle_work;
 };
 
diff --git a/drivers/gpu/drm/gma500/psb_lid.c b/drivers/gpu/drm/gma500/psb_lid.c
index 1d2ebb5e530f..6b1b9d0741df 100644
--- a/drivers/gpu/drm/gma500/psb_lid.c
+++ b/drivers/gpu/drm/gma500/psb_lid.c
@@ -28,14 +28,14 @@ static void psb_lid_timer_func(unsigned long data)
 	struct drm_psb_private * dev_priv = (struct drm_psb_private *)data;
 	struct drm_device *dev = (struct drm_device *)dev_priv->dev;
 	struct timer_list *lid_timer = &dev_priv->lid_timer;
+	u32 *lid_state = dev_priv->opregion.lid_state;
 	unsigned long irq_flags;
-	u32 __iomem *lid_state = dev_priv->opregion.lid_state;
 	u32 pp_status;
 
-	if (readl(lid_state) == dev_priv->lid_last_state)
+	if (*lid_state == dev_priv->lid_last_state)
 		goto lid_timer_schedule;
 
-	if ((readl(lid_state)) & 0x01) {
+	if ((*lid_state) & 0x01) {
 		/*lid state is open*/
 		REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) | POWER_TARGET_ON);
 		do {
@@ -58,7 +58,7 @@ static void psb_lid_timer_func(unsigned long data)
 			pp_status = REG_READ(PP_STATUS);
 		} while ((pp_status & PP_ON) == 0);
 	}
-	dev_priv->lid_last_state =  readl(lid_state);
+	dev_priv->lid_last_state =  *lid_state;
 
 lid_timer_schedule:
 	spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
  2015-10-09 22:15 ` Dan Williams
  (?)
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, David Airlie, intel-gfx, Jani Nikula, dri-devel,
	Daniel Vetter, linux-arm-kernel

i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
map it with memremap rather than the implied cache setting of
acpi_os_ioremap().

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 +++--
 drivers/gpu/drm/i915/intel_bios.c     |    7 +--
 drivers/gpu/drm/i915/intel_opregion.c |   73 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 5 files changed, 47 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e3ec9049081f..15989cc16e92 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
 		goto out;
 
 	if (opregion->header) {
-		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
+		memcpy(data, opregion->header, OPREGION_SIZE);
 		seq_write(m, data, OPREGION_SIZE);
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e1db8de52851..d8684634a31d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -444,14 +444,14 @@ struct opregion_swsci;
 struct opregion_asle;
 
 struct intel_opregion {
-	struct opregion_header __iomem *header;
-	struct opregion_acpi __iomem *acpi;
-	struct opregion_swsci __iomem *swsci;
+	struct opregion_header *header;
+	struct opregion_acpi *acpi;
+	struct opregion_swsci *swsci;
 	u32 swsci_gbda_sub_functions;
 	u32 swsci_sbcb_sub_functions;
-	struct opregion_asle __iomem *asle;
-	void __iomem *vbt;
-	u32 __iomem *lid_state;
+	struct opregion_asle *asle;
+	void *vbt;
+	u32 *lid_state;
 	struct work_struct asle_work;
 };
 #define OPREGION_SIZE            (8*1024)
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c19e669ffe50..1ee2f11d355d 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1238,11 +1238,10 @@ static const struct bdb_header *validate_vbt(const void __iomem *_base,
 {
 	/*
 	 * This is the one place where we explicitly discard the address space
-	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
-	 * From now on everything is based on 'base', and treated as regular
-	 * memory.
+	 * (__iomem) of the BIOS/VBT. From now on everything is based on
+	 * 'base', and treated as regular memory.
 	 */
-	const void *base = (const void *) _base;
+	const void *base = (const void __force *) _base;
 	size_t offset = _vbt - _base;
 	const struct vbt_header *vbt = base + offset;
 	const struct bdb_header *bdb;
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index cb1c65739425..4f65cdb38e1b 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -239,7 +239,7 @@ struct opregion_asle {
 static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
+	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
 	u32 main_function, sub_function, scic;
 	u16 pci_swsci;
 	u32 dslp;
@@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* Driver sleep timeout in ms. */
-	dslp = ioread32(&swsci->dslp);
+	dslp = swsci->dslp;
 	if (!dslp) {
 		/* The spec says 2ms should be the default, but it's too small
 		 * for some machines. */
@@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* The spec tells us to do this, but we are the only user... */
-	scic = ioread32(&swsci->scic);
+	scic = swsci->scic;
 	if (scic & SWSCI_SCIC_INDICATOR) {
 		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
 		return -EBUSY;
@@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 
 	scic = function | SWSCI_SCIC_INDICATOR;
 
-	iowrite32(parm, &swsci->parm);
-	iowrite32(scic, &swsci->scic);
+	swsci->parm = parm;
+	swsci->scic = scic;
 
 	/* Ensure SCI event is selected and event trigger is cleared. */
 	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
@@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
 
 	/* Poll for the result. */
-#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
+#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
 	if (wait_for(C, dslp)) {
 		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
 		return -ETIMEDOUT;
@@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	if (parm_out)
-		*parm_out = ioread32(&swsci->parm);
+		*parm_out = swsci->parm;
 
 	return 0;
 
@@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_connector *intel_connector;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
 
@@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
 	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
 		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
-	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
+	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
 
 	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 
@@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
 	struct drm_i915_private *dev_priv =
 		container_of(opregion, struct drm_i915_private, opregion);
 	struct drm_device *dev = dev_priv->dev;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 aslc_stat = 0;
 	u32 aslc_req;
 
 	if (!asle)
 		return;
 
-	aslc_req = ioread32(&asle->aslc);
+	aslc_req = asle->aslc;
 
 	if (!(aslc_req & ASLC_REQ_MSK)) {
 		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
@@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
 	}
 
 	if (aslc_req & ASLC_SET_ALS_ILLUM)
-		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
+		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
 
 	if (aslc_req & ASLC_SET_BACKLIGHT)
-		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
+		aslc_stat |= asle_set_backlight(dev, asle->bclp);
 
 	if (aslc_req & ASLC_SET_PFIT)
-		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
+		aslc_stat |= asle_set_pfit(dev, asle->pfit);
 
 	if (aslc_req & ASLC_SET_PWM_FREQ)
-		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
+		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
 
 	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
 		aslc_stat |= asle_set_supported_rotation_angles(dev,
-							ioread32(&asle->srot));
+							asle->srot);
 
 	if (aslc_req & ASLC_BUTTON_ARRAY)
-		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_button_array(dev, asle->iuer);
 
 	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
-		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_convertible(dev, asle->iuer);
 
 	if (aslc_req & ASLC_DOCKING_INDICATOR)
-		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_docking(dev, asle->iuer);
 
 	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
 		aslc_stat |= asle_isct_state(dev);
 
-	iowrite32(aslc_stat, &asle->aslc);
+	asle->aslc = aslc_stat;
 }
 
 void intel_opregion_asle_intr(struct drm_device *dev)
@@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 	   Linux, these are handled by the dock, button and video drivers.
 	*/
 
-	struct opregion_acpi __iomem *acpi;
 	struct acpi_bus_event *event = data;
+	struct opregion_acpi *acpi;
 	int ret = NOTIFY_OK;
 
 	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
@@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 
 	acpi = system_opregion->acpi;
 
-	if (event->type == 0x80 &&
-	    (ioread32(&acpi->cevt) & 1) == 0)
+	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
 		ret = NOTIFY_BAD;
 
-	iowrite32(0, &acpi->csts);
+	acpi->csts = 0;
 
 	return ret;
 }
@@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
 		/* Notify BIOS we are ready to handle ACPI video ext notifs.
 		 * Right now, all the events are handled by the ACPI video module.
 		 * We don't actually need to do anything with them. */
-		iowrite32(0, &opregion->acpi->csts);
-		iowrite32(1, &opregion->acpi->drdy);
+		opregion->acpi->csts = 0;
+		opregion->acpi->drdy = 1;
 
 		system_opregion = opregion;
 		register_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	if (opregion->asle) {
-		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
-		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
+		opregion->asle->tche = ASLE_TCHE_BLC_EN;
+		opregion->asle->ardy = ASLE_ARDY_READY;
 	}
 }
 
@@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
 		return;
 
 	if (opregion->asle)
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 
 	cancel_work_sync(&dev_priv->opregion.asle_work);
 
 	if (opregion->acpi) {
-		iowrite32(0, &opregion->acpi->drdy);
+		opregion->acpi->drdy = 0;
 
 		system_opregion = NULL;
 		unregister_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	/* just clear all opregion memory pointers now */
-	iounmap(opregion->header);
+	memunmap(opregion->header);
 	opregion->header = NULL;
 	opregion->acpi = NULL;
 	opregion->swsci = NULL;
@@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_opregion *opregion = &dev_priv->opregion;
-	void __iomem *base;
 	u32 asls, mboxes;
 	char buf[sizeof(OPREGION_SIGNATURE)];
 	int err = 0;
+	void *base;
 
 	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
 	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
@@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, asle_work);
 #endif
 
-	base = acpi_os_ioremap(asls, OPREGION_SIZE);
+	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
 	if (!base)
 		return -ENOMEM;
 
-	memcpy_fromio(buf, base, sizeof(buf));
+	memcpy(buf, base, sizeof(buf));
 
 	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
 		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
@@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
 
 	opregion->lid_state = base + ACPI_CLID;
 
-	mboxes = ioread32(&opregion->header->mboxes);
+	mboxes = opregion->header->mboxes;
 	if (mboxes & MBOX_ACPI) {
 		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
 		opregion->acpi = base + OPREGION_ACPI_OFFSET;
@@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
 		DRM_DEBUG_DRIVER("ASLE supported\n");
 		opregion->asle = base + OPREGION_ASLE_OFFSET;
 
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 	}
 
 	return 0;
 
 err_out:
-	iounmap(base);
+	memunmap(base);
 	return err;
 }
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index e2ab3f6ed022..c8444d5f549f 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
 
 	/* Assume that the BIOS does not lie through the OpRegion... */
 	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
-		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
+		return *(dev_priv->opregion.lid_state) & 0x1 ?
 			connector_status_connected :
 			connector_status_disconnected;
 	}


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, David Airlie, intel-gfx, dri-devel, Daniel Vetter,
	linux-arm-kernel

i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
map it with memremap rather than the implied cache setting of
acpi_os_ioremap().

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 +++--
 drivers/gpu/drm/i915/intel_bios.c     |    7 +--
 drivers/gpu/drm/i915/intel_opregion.c |   73 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 5 files changed, 47 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e3ec9049081f..15989cc16e92 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
 		goto out;
 
 	if (opregion->header) {
-		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
+		memcpy(data, opregion->header, OPREGION_SIZE);
 		seq_write(m, data, OPREGION_SIZE);
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e1db8de52851..d8684634a31d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -444,14 +444,14 @@ struct opregion_swsci;
 struct opregion_asle;
 
 struct intel_opregion {
-	struct opregion_header __iomem *header;
-	struct opregion_acpi __iomem *acpi;
-	struct opregion_swsci __iomem *swsci;
+	struct opregion_header *header;
+	struct opregion_acpi *acpi;
+	struct opregion_swsci *swsci;
 	u32 swsci_gbda_sub_functions;
 	u32 swsci_sbcb_sub_functions;
-	struct opregion_asle __iomem *asle;
-	void __iomem *vbt;
-	u32 __iomem *lid_state;
+	struct opregion_asle *asle;
+	void *vbt;
+	u32 *lid_state;
 	struct work_struct asle_work;
 };
 #define OPREGION_SIZE            (8*1024)
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c19e669ffe50..1ee2f11d355d 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1238,11 +1238,10 @@ static const struct bdb_header *validate_vbt(const void __iomem *_base,
 {
 	/*
 	 * This is the one place where we explicitly discard the address space
-	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
-	 * From now on everything is based on 'base', and treated as regular
-	 * memory.
+	 * (__iomem) of the BIOS/VBT. From now on everything is based on
+	 * 'base', and treated as regular memory.
 	 */
-	const void *base = (const void *) _base;
+	const void *base = (const void __force *) _base;
 	size_t offset = _vbt - _base;
 	const struct vbt_header *vbt = base + offset;
 	const struct bdb_header *bdb;
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index cb1c65739425..4f65cdb38e1b 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -239,7 +239,7 @@ struct opregion_asle {
 static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
+	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
 	u32 main_function, sub_function, scic;
 	u16 pci_swsci;
 	u32 dslp;
@@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* Driver sleep timeout in ms. */
-	dslp = ioread32(&swsci->dslp);
+	dslp = swsci->dslp;
 	if (!dslp) {
 		/* The spec says 2ms should be the default, but it's too small
 		 * for some machines. */
@@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* The spec tells us to do this, but we are the only user... */
-	scic = ioread32(&swsci->scic);
+	scic = swsci->scic;
 	if (scic & SWSCI_SCIC_INDICATOR) {
 		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
 		return -EBUSY;
@@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 
 	scic = function | SWSCI_SCIC_INDICATOR;
 
-	iowrite32(parm, &swsci->parm);
-	iowrite32(scic, &swsci->scic);
+	swsci->parm = parm;
+	swsci->scic = scic;
 
 	/* Ensure SCI event is selected and event trigger is cleared. */
 	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
@@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
 
 	/* Poll for the result. */
-#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
+#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
 	if (wait_for(C, dslp)) {
 		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
 		return -ETIMEDOUT;
@@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	if (parm_out)
-		*parm_out = ioread32(&swsci->parm);
+		*parm_out = swsci->parm;
 
 	return 0;
 
@@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_connector *intel_connector;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
 
@@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
 	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
 		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
-	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
+	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
 
 	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 
@@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
 	struct drm_i915_private *dev_priv =
 		container_of(opregion, struct drm_i915_private, opregion);
 	struct drm_device *dev = dev_priv->dev;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 aslc_stat = 0;
 	u32 aslc_req;
 
 	if (!asle)
 		return;
 
-	aslc_req = ioread32(&asle->aslc);
+	aslc_req = asle->aslc;
 
 	if (!(aslc_req & ASLC_REQ_MSK)) {
 		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
@@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
 	}
 
 	if (aslc_req & ASLC_SET_ALS_ILLUM)
-		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
+		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
 
 	if (aslc_req & ASLC_SET_BACKLIGHT)
-		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
+		aslc_stat |= asle_set_backlight(dev, asle->bclp);
 
 	if (aslc_req & ASLC_SET_PFIT)
-		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
+		aslc_stat |= asle_set_pfit(dev, asle->pfit);
 
 	if (aslc_req & ASLC_SET_PWM_FREQ)
-		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
+		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
 
 	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
 		aslc_stat |= asle_set_supported_rotation_angles(dev,
-							ioread32(&asle->srot));
+							asle->srot);
 
 	if (aslc_req & ASLC_BUTTON_ARRAY)
-		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_button_array(dev, asle->iuer);
 
 	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
-		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_convertible(dev, asle->iuer);
 
 	if (aslc_req & ASLC_DOCKING_INDICATOR)
-		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_docking(dev, asle->iuer);
 
 	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
 		aslc_stat |= asle_isct_state(dev);
 
-	iowrite32(aslc_stat, &asle->aslc);
+	asle->aslc = aslc_stat;
 }
 
 void intel_opregion_asle_intr(struct drm_device *dev)
@@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 	   Linux, these are handled by the dock, button and video drivers.
 	*/
 
-	struct opregion_acpi __iomem *acpi;
 	struct acpi_bus_event *event = data;
+	struct opregion_acpi *acpi;
 	int ret = NOTIFY_OK;
 
 	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
@@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 
 	acpi = system_opregion->acpi;
 
-	if (event->type == 0x80 &&
-	    (ioread32(&acpi->cevt) & 1) == 0)
+	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
 		ret = NOTIFY_BAD;
 
-	iowrite32(0, &acpi->csts);
+	acpi->csts = 0;
 
 	return ret;
 }
@@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
 		/* Notify BIOS we are ready to handle ACPI video ext notifs.
 		 * Right now, all the events are handled by the ACPI video module.
 		 * We don't actually need to do anything with them. */
-		iowrite32(0, &opregion->acpi->csts);
-		iowrite32(1, &opregion->acpi->drdy);
+		opregion->acpi->csts = 0;
+		opregion->acpi->drdy = 1;
 
 		system_opregion = opregion;
 		register_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	if (opregion->asle) {
-		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
-		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
+		opregion->asle->tche = ASLE_TCHE_BLC_EN;
+		opregion->asle->ardy = ASLE_ARDY_READY;
 	}
 }
 
@@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
 		return;
 
 	if (opregion->asle)
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 
 	cancel_work_sync(&dev_priv->opregion.asle_work);
 
 	if (opregion->acpi) {
-		iowrite32(0, &opregion->acpi->drdy);
+		opregion->acpi->drdy = 0;
 
 		system_opregion = NULL;
 		unregister_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	/* just clear all opregion memory pointers now */
-	iounmap(opregion->header);
+	memunmap(opregion->header);
 	opregion->header = NULL;
 	opregion->acpi = NULL;
 	opregion->swsci = NULL;
@@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_opregion *opregion = &dev_priv->opregion;
-	void __iomem *base;
 	u32 asls, mboxes;
 	char buf[sizeof(OPREGION_SIGNATURE)];
 	int err = 0;
+	void *base;
 
 	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
 	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
@@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, asle_work);
 #endif
 
-	base = acpi_os_ioremap(asls, OPREGION_SIZE);
+	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
 	if (!base)
 		return -ENOMEM;
 
-	memcpy_fromio(buf, base, sizeof(buf));
+	memcpy(buf, base, sizeof(buf));
 
 	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
 		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
@@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
 
 	opregion->lid_state = base + ACPI_CLID;
 
-	mboxes = ioread32(&opregion->header->mboxes);
+	mboxes = opregion->header->mboxes;
 	if (mboxes & MBOX_ACPI) {
 		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
 		opregion->acpi = base + OPREGION_ACPI_OFFSET;
@@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
 		DRM_DEBUG_DRIVER("ASLE supported\n");
 		opregion->asle = base + OPREGION_ASLE_OFFSET;
 
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 	}
 
 	return 0;
 
 err_out:
-	iounmap(base);
+	memunmap(base);
 	return err;
 }
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index e2ab3f6ed022..c8444d5f549f 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
 
 	/* Assume that the BIOS does not lie through the OpRegion... */
 	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
-		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
+		return *(dev_priv->opregion.lid_state) & 0x1 ?
 			connector_status_connected :
 			connector_status_disconnected;
 	}

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
map it with memremap rather than the implied cache setting of
acpi_os_ioremap().

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx at lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 +++--
 drivers/gpu/drm/i915/intel_bios.c     |    7 +--
 drivers/gpu/drm/i915/intel_opregion.c |   73 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 5 files changed, 47 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e3ec9049081f..15989cc16e92 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
 		goto out;
 
 	if (opregion->header) {
-		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
+		memcpy(data, opregion->header, OPREGION_SIZE);
 		seq_write(m, data, OPREGION_SIZE);
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e1db8de52851..d8684634a31d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -444,14 +444,14 @@ struct opregion_swsci;
 struct opregion_asle;
 
 struct intel_opregion {
-	struct opregion_header __iomem *header;
-	struct opregion_acpi __iomem *acpi;
-	struct opregion_swsci __iomem *swsci;
+	struct opregion_header *header;
+	struct opregion_acpi *acpi;
+	struct opregion_swsci *swsci;
 	u32 swsci_gbda_sub_functions;
 	u32 swsci_sbcb_sub_functions;
-	struct opregion_asle __iomem *asle;
-	void __iomem *vbt;
-	u32 __iomem *lid_state;
+	struct opregion_asle *asle;
+	void *vbt;
+	u32 *lid_state;
 	struct work_struct asle_work;
 };
 #define OPREGION_SIZE            (8*1024)
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c19e669ffe50..1ee2f11d355d 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1238,11 +1238,10 @@ static const struct bdb_header *validate_vbt(const void __iomem *_base,
 {
 	/*
 	 * This is the one place where we explicitly discard the address space
-	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
-	 * From now on everything is based on 'base', and treated as regular
-	 * memory.
+	 * (__iomem) of the BIOS/VBT. From now on everything is based on
+	 * 'base', and treated as regular memory.
 	 */
-	const void *base = (const void *) _base;
+	const void *base = (const void __force *) _base;
 	size_t offset = _vbt - _base;
 	const struct vbt_header *vbt = base + offset;
 	const struct bdb_header *bdb;
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index cb1c65739425..4f65cdb38e1b 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -239,7 +239,7 @@ struct opregion_asle {
 static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
+	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
 	u32 main_function, sub_function, scic;
 	u16 pci_swsci;
 	u32 dslp;
@@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* Driver sleep timeout in ms. */
-	dslp = ioread32(&swsci->dslp);
+	dslp = swsci->dslp;
 	if (!dslp) {
 		/* The spec says 2ms should be the default, but it's too small
 		 * for some machines. */
@@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* The spec tells us to do this, but we are the only user... */
-	scic = ioread32(&swsci->scic);
+	scic = swsci->scic;
 	if (scic & SWSCI_SCIC_INDICATOR) {
 		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
 		return -EBUSY;
@@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 
 	scic = function | SWSCI_SCIC_INDICATOR;
 
-	iowrite32(parm, &swsci->parm);
-	iowrite32(scic, &swsci->scic);
+	swsci->parm = parm;
+	swsci->scic = scic;
 
 	/* Ensure SCI event is selected and event trigger is cleared. */
 	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
@@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
 
 	/* Poll for the result. */
-#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
+#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
 	if (wait_for(C, dslp)) {
 		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
 		return -ETIMEDOUT;
@@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	if (parm_out)
-		*parm_out = ioread32(&swsci->parm);
+		*parm_out = swsci->parm;
 
 	return 0;
 
@@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_connector *intel_connector;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
 
@@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
 	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
 		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
-	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
+	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
 
 	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 
@@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
 	struct drm_i915_private *dev_priv =
 		container_of(opregion, struct drm_i915_private, opregion);
 	struct drm_device *dev = dev_priv->dev;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 aslc_stat = 0;
 	u32 aslc_req;
 
 	if (!asle)
 		return;
 
-	aslc_req = ioread32(&asle->aslc);
+	aslc_req = asle->aslc;
 
 	if (!(aslc_req & ASLC_REQ_MSK)) {
 		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
@@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
 	}
 
 	if (aslc_req & ASLC_SET_ALS_ILLUM)
-		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
+		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
 
 	if (aslc_req & ASLC_SET_BACKLIGHT)
-		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
+		aslc_stat |= asle_set_backlight(dev, asle->bclp);
 
 	if (aslc_req & ASLC_SET_PFIT)
-		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
+		aslc_stat |= asle_set_pfit(dev, asle->pfit);
 
 	if (aslc_req & ASLC_SET_PWM_FREQ)
-		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
+		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
 
 	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
 		aslc_stat |= asle_set_supported_rotation_angles(dev,
-							ioread32(&asle->srot));
+							asle->srot);
 
 	if (aslc_req & ASLC_BUTTON_ARRAY)
-		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_button_array(dev, asle->iuer);
 
 	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
-		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_convertible(dev, asle->iuer);
 
 	if (aslc_req & ASLC_DOCKING_INDICATOR)
-		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_docking(dev, asle->iuer);
 
 	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
 		aslc_stat |= asle_isct_state(dev);
 
-	iowrite32(aslc_stat, &asle->aslc);
+	asle->aslc = aslc_stat;
 }
 
 void intel_opregion_asle_intr(struct drm_device *dev)
@@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 	   Linux, these are handled by the dock, button and video drivers.
 	*/
 
-	struct opregion_acpi __iomem *acpi;
 	struct acpi_bus_event *event = data;
+	struct opregion_acpi *acpi;
 	int ret = NOTIFY_OK;
 
 	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
@@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 
 	acpi = system_opregion->acpi;
 
-	if (event->type == 0x80 &&
-	    (ioread32(&acpi->cevt) & 1) == 0)
+	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
 		ret = NOTIFY_BAD;
 
-	iowrite32(0, &acpi->csts);
+	acpi->csts = 0;
 
 	return ret;
 }
@@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
 		/* Notify BIOS we are ready to handle ACPI video ext notifs.
 		 * Right now, all the events are handled by the ACPI video module.
 		 * We don't actually need to do anything with them. */
-		iowrite32(0, &opregion->acpi->csts);
-		iowrite32(1, &opregion->acpi->drdy);
+		opregion->acpi->csts = 0;
+		opregion->acpi->drdy = 1;
 
 		system_opregion = opregion;
 		register_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	if (opregion->asle) {
-		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
-		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
+		opregion->asle->tche = ASLE_TCHE_BLC_EN;
+		opregion->asle->ardy = ASLE_ARDY_READY;
 	}
 }
 
@@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
 		return;
 
 	if (opregion->asle)
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 
 	cancel_work_sync(&dev_priv->opregion.asle_work);
 
 	if (opregion->acpi) {
-		iowrite32(0, &opregion->acpi->drdy);
+		opregion->acpi->drdy = 0;
 
 		system_opregion = NULL;
 		unregister_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	/* just clear all opregion memory pointers now */
-	iounmap(opregion->header);
+	memunmap(opregion->header);
 	opregion->header = NULL;
 	opregion->acpi = NULL;
 	opregion->swsci = NULL;
@@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_opregion *opregion = &dev_priv->opregion;
-	void __iomem *base;
 	u32 asls, mboxes;
 	char buf[sizeof(OPREGION_SIGNATURE)];
 	int err = 0;
+	void *base;
 
 	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
 	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
@@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, asle_work);
 #endif
 
-	base = acpi_os_ioremap(asls, OPREGION_SIZE);
+	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
 	if (!base)
 		return -ENOMEM;
 
-	memcpy_fromio(buf, base, sizeof(buf));
+	memcpy(buf, base, sizeof(buf));
 
 	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
 		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
@@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
 
 	opregion->lid_state = base + ACPI_CLID;
 
-	mboxes = ioread32(&opregion->header->mboxes);
+	mboxes = opregion->header->mboxes;
 	if (mboxes & MBOX_ACPI) {
 		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
 		opregion->acpi = base + OPREGION_ACPI_OFFSET;
@@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
 		DRM_DEBUG_DRIVER("ASLE supported\n");
 		opregion->asle = base + OPREGION_ASLE_OFFSET;
 
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 	}
 
 	return 0;
 
 err_out:
-	iounmap(base);
+	memunmap(base);
 	return err;
 }
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index e2ab3f6ed022..c8444d5f549f 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
 
 	/* Assume that the BIOS does not lie through the OpRegion... */
 	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
-		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
+		return *(dev_priv->opregion.lid_state) & 0x1 ?
 			connector_status_connected :
 			connector_status_disconnected;
 	}

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 10/20] acpi: switch from ioremap_cache to memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Rafael J. Wysocki, Bob Moore, Lv Zheng, Russell King,
	linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
drivers/acpi and include/acpi/ to memremap.  This includes dropping the
__iomem annotation throughout ACPI since the memremap can be treated as
a normal memory pointer.

Finally, memremap automatically handles requests to map normal memory
pages, so this also drops the calls to "should_use_kmap()".

It seems ARM had a local definition of acpi_os_ioremap() to handle RAM
addresses, but it can be deleted now that memremap() handles this
generically.

Cc: Bob Moore <robert.moore@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/arm64/include/asm/acpi.h |    8 -----
 drivers/acpi/apei/einj.c      |    9 +++--
 drivers/acpi/apei/erst.c      |    6 ++--
 drivers/acpi/nvs.c            |    6 ++--
 drivers/acpi/osl.c            |   70 +++++++++++------------------------------
 include/acpi/acpi_io.h        |    6 +---
 6 files changed, 32 insertions(+), 73 deletions(-)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index a24a9b1cc91d..197d02047d00 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -29,14 +29,6 @@
 
 /* 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)
-{
-	return memremap(phys, size, MEMREMAP_WB);
-}
-#define acpi_os_ioremap acpi_os_ioremap
-
 typedef u64 phys_cpuid_t;
 #define PHYS_CPUID_INVALID INVALID_HWID
 
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 0431883653be..9f71010f6339 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -314,7 +314,8 @@ static int __einj_error_trigger(u64 trigger_paddr, u32 type,
 			    sizeof(*trigger_tab) - 1);
 		goto out;
 	}
-	trigger_tab = ioremap_cache(trigger_paddr, sizeof(*trigger_tab));
+	trigger_tab = memremap(trigger_paddr, sizeof(*trigger_tab),
+			MEMREMAP_WB);
 	if (!trigger_tab) {
 		pr_err(EINJ_PFX "Failed to map trigger table!\n");
 		goto out_rel_header;
@@ -342,8 +343,8 @@ static int __einj_error_trigger(u64 trigger_paddr, u32 type,
 		       (unsigned long long)trigger_paddr + table_size - 1);
 		goto out_rel_header;
 	}
-	iounmap(trigger_tab);
-	trigger_tab = ioremap_cache(trigger_paddr, table_size);
+	memunmap(trigger_tab);
+	trigger_tab = memremap(trigger_paddr, table_size, MEMREMAP_WB);
 	if (!trigger_tab) {
 		pr_err(EINJ_PFX "Failed to map trigger table!\n");
 		goto out_rel_entry;
@@ -405,7 +406,7 @@ out_rel_header:
 	release_mem_region(trigger_paddr, sizeof(*trigger_tab));
 out:
 	if (trigger_tab)
-		iounmap(trigger_tab);
+		memunmap(trigger_tab);
 
 	return rc;
 }
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 6682c5daf742..4ef62b54fabf 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -73,7 +73,7 @@ static struct acpi_table_erst *erst_tab;
 static struct erst_erange {
 	u64 base;
 	u64 size;
-	void __iomem *vaddr;
+	void *vaddr;
 	u32 attr;
 } erst_erange;
 
@@ -1181,8 +1181,8 @@ static int __init erst_init(void)
 		goto err_unmap_reg;
 	}
 	rc = -ENOMEM;
-	erst_erange.vaddr = ioremap_cache(erst_erange.base,
-					  erst_erange.size);
+	erst_erange.vaddr = memremap(erst_erange.base, erst_erange.size,
+			MEMREMAP_WB);
 	if (!erst_erange.vaddr)
 		goto err_release_erange;
 
diff --git a/drivers/acpi/nvs.c b/drivers/acpi/nvs.c
index 85287b8fe3aa..e0e15af93b22 100644
--- a/drivers/acpi/nvs.c
+++ b/drivers/acpi/nvs.c
@@ -136,7 +136,7 @@ void suspend_nvs_free(void)
 			entry->data = NULL;
 			if (entry->kaddr) {
 				if (entry->unmap) {
-					iounmap(entry->kaddr);
+					memunmap(entry->kaddr);
 					entry->unmap = false;
 				} else {
 					acpi_os_unmap_iomem(entry->kaddr,
@@ -180,7 +180,7 @@ int suspend_nvs_save(void)
 
 			entry->kaddr = acpi_os_get_iomem(phys, size);
 			if (!entry->kaddr) {
-				entry->kaddr = acpi_os_ioremap(phys, size);
+				entry->kaddr = acpi_os_memremap(phys, size);
 				entry->unmap = !!entry->kaddr;
 			}
 			if (!entry->kaddr) {
@@ -197,7 +197,7 @@ int suspend_nvs_save(void)
  *	suspend_nvs_restore - restore NVS memory regions
  *
  *	This function is going to be called with interrupts disabled, so it
- *	cannot iounmap the virtual addresses used to access the NVS region.
+ *	cannot memunmap the virtual addresses used to access the NVS region.
  */
 void suspend_nvs_restore(void)
 {
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 739a4a6b3b9b..d629eef2a56e 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -27,7 +27,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
-#include <linux/highmem.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/kmod.h>
@@ -40,8 +39,8 @@
 #include <linux/list.h>
 #include <linux/jiffies.h>
 #include <linux/semaphore.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm-generic/io-64-nonatomic-lo-hi.h>
 
@@ -88,7 +87,7 @@ static bool acpi_os_initialized;
  */
 struct acpi_ioremap {
 	struct list_head list;
-	void __iomem *virt;
+	void *virt;
 	acpi_physical_address phys;
 	acpi_size size;
 	unsigned long refcount;
@@ -292,7 +291,7 @@ acpi_map_lookup(acpi_physical_address phys, acpi_size size)
 }
 
 /* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */
-static void __iomem *
+static void *
 acpi_map_vaddr_lookup(acpi_physical_address phys, unsigned int size)
 {
 	struct acpi_ioremap *map;
@@ -304,10 +303,10 @@ acpi_map_vaddr_lookup(acpi_physical_address phys, unsigned int size)
 	return NULL;
 }
 
-void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size)
+void *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size)
 {
 	struct acpi_ioremap *map;
-	void __iomem *virt = NULL;
+	void *virt = NULL;
 
 	mutex_lock(&acpi_ioremap_lock);
 	map = acpi_map_lookup(phys, size);
@@ -322,7 +321,7 @@ EXPORT_SYMBOL_GPL(acpi_os_get_iomem);
 
 /* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */
 static struct acpi_ioremap *
-acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
+acpi_map_lookup_virt(void *virt, acpi_size size)
 {
 	struct acpi_ioremap *map;
 
@@ -334,44 +333,13 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
 	return NULL;
 }
 
-#if defined(CONFIG_IA64) || defined(CONFIG_ARM64)
-/* ioremap will take care of cache attributes */
-#define should_use_kmap(pfn)   0
-#else
-#define should_use_kmap(pfn)   page_is_ram(pfn)
-#endif
-
-static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)
-{
-	unsigned long pfn;
-
-	pfn = pg_off >> PAGE_SHIFT;
-	if (should_use_kmap(pfn)) {
-		if (pg_sz > PAGE_SIZE)
-			return NULL;
-		return (void __iomem __force *)kmap(pfn_to_page(pfn));
-	} else
-		return acpi_os_ioremap(pg_off, pg_sz);
-}
-
-static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)
-{
-	unsigned long pfn;
-
-	pfn = pg_off >> PAGE_SHIFT;
-	if (should_use_kmap(pfn))
-		kunmap(pfn_to_page(pfn));
-	else
-		iounmap(vaddr);
-}
-
-void __iomem *__init_refok
+void *__init_refok
 acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
 {
 	struct acpi_ioremap *map;
-	void __iomem *virt;
 	acpi_physical_address pg_off;
 	acpi_size pg_sz;
+	void *virt;
 
 	if (phys > ULONG_MAX) {
 		printk(KERN_ERR PREFIX "Cannot map memory that high\n");
@@ -397,7 +365,7 @@ acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
 
 	pg_off = round_down(phys, PAGE_SIZE);
 	pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
-	virt = acpi_map(pg_off, pg_sz);
+	virt = acpi_os_memremap(pg_off, pg_sz);
 	if (!virt) {
 		mutex_unlock(&acpi_ioremap_lock);
 		kfree(map);
@@ -435,7 +403,7 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map)
 {
 	if (!map->refcount) {
 		synchronize_rcu_expedited();
-		acpi_unmap(map->phys, map->virt);
+		memunmap(map->virt);
 		kfree(map);
 	}
 }
@@ -948,7 +916,7 @@ EXPORT_SYMBOL(acpi_os_write_port);
 acpi_status
 acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
 {
-	void __iomem *virt_addr;
+	void *virt_addr;
 	unsigned int size = width / 8;
 	bool unmap = false;
 	u64 dummy;
@@ -957,7 +925,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
 	virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
 	if (!virt_addr) {
 		rcu_read_unlock();
-		virt_addr = acpi_os_ioremap(phys_addr, size);
+		virt_addr = acpi_os_memremap(phys_addr, size);
 		if (!virt_addr)
 			return AE_BAD_ADDRESS;
 		unmap = true;
@@ -968,23 +936,23 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
 
 	switch (width) {
 	case 8:
-		*(u8 *) value = readb(virt_addr);
+		*(u8 *) value = *(u8 *) virt_addr;
 		break;
 	case 16:
-		*(u16 *) value = readw(virt_addr);
+		*(u16 *) value = *(u16 *) virt_addr;
 		break;
 	case 32:
-		*(u32 *) value = readl(virt_addr);
+		*(u32 *) value = *(u32 *) virt_addr;
 		break;
 	case 64:
-		*(u64 *) value = readq(virt_addr);
+		*(u64 *) value = *(u64 *) virt_addr;
 		break;
 	default:
 		BUG();
 	}
 
 	if (unmap)
-		iounmap(virt_addr);
+		memunmap(virt_addr);
 	else
 		rcu_read_unlock();
 
@@ -1002,7 +970,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u64 value, u32 width)
 	virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
 	if (!virt_addr) {
 		rcu_read_unlock();
-		virt_addr = acpi_os_ioremap(phys_addr, size);
+		virt_addr = acpi_os_memremap(phys_addr, size);
 		if (!virt_addr)
 			return AE_BAD_ADDRESS;
 		unmap = true;
@@ -1026,7 +994,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u64 value, u32 width)
 	}
 
 	if (unmap)
-		iounmap(virt_addr);
+		memunmap(virt_addr);
 	else
 		rcu_read_unlock();
 
diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h
index dd86c5fc102d..646ce8714109 100644
--- a/include/acpi/acpi_io.h
+++ b/include/acpi/acpi_io.h
@@ -5,13 +5,11 @@
 
 #include <asm/acpi.h>
 
-#ifndef acpi_os_ioremap
-static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
+static inline void *acpi_os_memremap(acpi_physical_address phys,
 					    acpi_size size)
 {
-       return ioremap_cache(phys, size);
+       return memremap(phys, size, MEMREMAP_WB);
 }
-#endif
 
 void __iomem *__init_refok
 acpi_os_map_iomem(acpi_physical_address phys, acpi_size size);


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 10/20] acpi: switch from ioremap_cache to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
drivers/acpi and include/acpi/ to memremap.  This includes dropping the
__iomem annotation throughout ACPI since the memremap can be treated as
a normal memory pointer.

Finally, memremap automatically handles requests to map normal memory
pages, so this also drops the calls to "should_use_kmap()".

It seems ARM had a local definition of acpi_os_ioremap() to handle RAM
addresses, but it can be deleted now that memremap() handles this
generically.

Cc: Bob Moore <robert.moore@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/arm64/include/asm/acpi.h |    8 -----
 drivers/acpi/apei/einj.c      |    9 +++--
 drivers/acpi/apei/erst.c      |    6 ++--
 drivers/acpi/nvs.c            |    6 ++--
 drivers/acpi/osl.c            |   70 +++++++++++------------------------------
 include/acpi/acpi_io.h        |    6 +---
 6 files changed, 32 insertions(+), 73 deletions(-)

diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index a24a9b1cc91d..197d02047d00 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -29,14 +29,6 @@
 
 /* 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)
-{
-	return memremap(phys, size, MEMREMAP_WB);
-}
-#define acpi_os_ioremap acpi_os_ioremap
-
 typedef u64 phys_cpuid_t;
 #define PHYS_CPUID_INVALID INVALID_HWID
 
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 0431883653be..9f71010f6339 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -314,7 +314,8 @@ static int __einj_error_trigger(u64 trigger_paddr, u32 type,
 			    sizeof(*trigger_tab) - 1);
 		goto out;
 	}
-	trigger_tab = ioremap_cache(trigger_paddr, sizeof(*trigger_tab));
+	trigger_tab = memremap(trigger_paddr, sizeof(*trigger_tab),
+			MEMREMAP_WB);
 	if (!trigger_tab) {
 		pr_err(EINJ_PFX "Failed to map trigger table!\n");
 		goto out_rel_header;
@@ -342,8 +343,8 @@ static int __einj_error_trigger(u64 trigger_paddr, u32 type,
 		       (unsigned long long)trigger_paddr + table_size - 1);
 		goto out_rel_header;
 	}
-	iounmap(trigger_tab);
-	trigger_tab = ioremap_cache(trigger_paddr, table_size);
+	memunmap(trigger_tab);
+	trigger_tab = memremap(trigger_paddr, table_size, MEMREMAP_WB);
 	if (!trigger_tab) {
 		pr_err(EINJ_PFX "Failed to map trigger table!\n");
 		goto out_rel_entry;
@@ -405,7 +406,7 @@ out_rel_header:
 	release_mem_region(trigger_paddr, sizeof(*trigger_tab));
 out:
 	if (trigger_tab)
-		iounmap(trigger_tab);
+		memunmap(trigger_tab);
 
 	return rc;
 }
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 6682c5daf742..4ef62b54fabf 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -73,7 +73,7 @@ static struct acpi_table_erst *erst_tab;
 static struct erst_erange {
 	u64 base;
 	u64 size;
-	void __iomem *vaddr;
+	void *vaddr;
 	u32 attr;
 } erst_erange;
 
@@ -1181,8 +1181,8 @@ static int __init erst_init(void)
 		goto err_unmap_reg;
 	}
 	rc = -ENOMEM;
-	erst_erange.vaddr = ioremap_cache(erst_erange.base,
-					  erst_erange.size);
+	erst_erange.vaddr = memremap(erst_erange.base, erst_erange.size,
+			MEMREMAP_WB);
 	if (!erst_erange.vaddr)
 		goto err_release_erange;
 
diff --git a/drivers/acpi/nvs.c b/drivers/acpi/nvs.c
index 85287b8fe3aa..e0e15af93b22 100644
--- a/drivers/acpi/nvs.c
+++ b/drivers/acpi/nvs.c
@@ -136,7 +136,7 @@ void suspend_nvs_free(void)
 			entry->data = NULL;
 			if (entry->kaddr) {
 				if (entry->unmap) {
-					iounmap(entry->kaddr);
+					memunmap(entry->kaddr);
 					entry->unmap = false;
 				} else {
 					acpi_os_unmap_iomem(entry->kaddr,
@@ -180,7 +180,7 @@ int suspend_nvs_save(void)
 
 			entry->kaddr = acpi_os_get_iomem(phys, size);
 			if (!entry->kaddr) {
-				entry->kaddr = acpi_os_ioremap(phys, size);
+				entry->kaddr = acpi_os_memremap(phys, size);
 				entry->unmap = !!entry->kaddr;
 			}
 			if (!entry->kaddr) {
@@ -197,7 +197,7 @@ int suspend_nvs_save(void)
  *	suspend_nvs_restore - restore NVS memory regions
  *
  *	This function is going to be called with interrupts disabled, so it
- *	cannot iounmap the virtual addresses used to access the NVS region.
+ *	cannot memunmap the virtual addresses used to access the NVS region.
  */
 void suspend_nvs_restore(void)
 {
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 739a4a6b3b9b..d629eef2a56e 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -27,7 +27,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
-#include <linux/highmem.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/kmod.h>
@@ -40,8 +39,8 @@
 #include <linux/list.h>
 #include <linux/jiffies.h>
 #include <linux/semaphore.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm-generic/io-64-nonatomic-lo-hi.h>
 
@@ -88,7 +87,7 @@ static bool acpi_os_initialized;
  */
 struct acpi_ioremap {
 	struct list_head list;
-	void __iomem *virt;
+	void *virt;
 	acpi_physical_address phys;
 	acpi_size size;
 	unsigned long refcount;
@@ -292,7 +291,7 @@ acpi_map_lookup(acpi_physical_address phys, acpi_size size)
 }
 
 /* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */
-static void __iomem *
+static void *
 acpi_map_vaddr_lookup(acpi_physical_address phys, unsigned int size)
 {
 	struct acpi_ioremap *map;
@@ -304,10 +303,10 @@ acpi_map_vaddr_lookup(acpi_physical_address phys, unsigned int size)
 	return NULL;
 }
 
-void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size)
+void *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size)
 {
 	struct acpi_ioremap *map;
-	void __iomem *virt = NULL;
+	void *virt = NULL;
 
 	mutex_lock(&acpi_ioremap_lock);
 	map = acpi_map_lookup(phys, size);
@@ -322,7 +321,7 @@ EXPORT_SYMBOL_GPL(acpi_os_get_iomem);
 
 /* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */
 static struct acpi_ioremap *
-acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
+acpi_map_lookup_virt(void *virt, acpi_size size)
 {
 	struct acpi_ioremap *map;
 
@@ -334,44 +333,13 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
 	return NULL;
 }
 
-#if defined(CONFIG_IA64) || defined(CONFIG_ARM64)
-/* ioremap will take care of cache attributes */
-#define should_use_kmap(pfn)   0
-#else
-#define should_use_kmap(pfn)   page_is_ram(pfn)
-#endif
-
-static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)
-{
-	unsigned long pfn;
-
-	pfn = pg_off >> PAGE_SHIFT;
-	if (should_use_kmap(pfn)) {
-		if (pg_sz > PAGE_SIZE)
-			return NULL;
-		return (void __iomem __force *)kmap(pfn_to_page(pfn));
-	} else
-		return acpi_os_ioremap(pg_off, pg_sz);
-}
-
-static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)
-{
-	unsigned long pfn;
-
-	pfn = pg_off >> PAGE_SHIFT;
-	if (should_use_kmap(pfn))
-		kunmap(pfn_to_page(pfn));
-	else
-		iounmap(vaddr);
-}
-
-void __iomem *__init_refok
+void *__init_refok
 acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
 {
 	struct acpi_ioremap *map;
-	void __iomem *virt;
 	acpi_physical_address pg_off;
 	acpi_size pg_sz;
+	void *virt;
 
 	if (phys > ULONG_MAX) {
 		printk(KERN_ERR PREFIX "Cannot map memory that high\n");
@@ -397,7 +365,7 @@ acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
 
 	pg_off = round_down(phys, PAGE_SIZE);
 	pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
-	virt = acpi_map(pg_off, pg_sz);
+	virt = acpi_os_memremap(pg_off, pg_sz);
 	if (!virt) {
 		mutex_unlock(&acpi_ioremap_lock);
 		kfree(map);
@@ -435,7 +403,7 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map)
 {
 	if (!map->refcount) {
 		synchronize_rcu_expedited();
-		acpi_unmap(map->phys, map->virt);
+		memunmap(map->virt);
 		kfree(map);
 	}
 }
@@ -948,7 +916,7 @@ EXPORT_SYMBOL(acpi_os_write_port);
 acpi_status
 acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
 {
-	void __iomem *virt_addr;
+	void *virt_addr;
 	unsigned int size = width / 8;
 	bool unmap = false;
 	u64 dummy;
@@ -957,7 +925,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
 	virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
 	if (!virt_addr) {
 		rcu_read_unlock();
-		virt_addr = acpi_os_ioremap(phys_addr, size);
+		virt_addr = acpi_os_memremap(phys_addr, size);
 		if (!virt_addr)
 			return AE_BAD_ADDRESS;
 		unmap = true;
@@ -968,23 +936,23 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
 
 	switch (width) {
 	case 8:
-		*(u8 *) value = readb(virt_addr);
+		*(u8 *) value = *(u8 *) virt_addr;
 		break;
 	case 16:
-		*(u16 *) value = readw(virt_addr);
+		*(u16 *) value = *(u16 *) virt_addr;
 		break;
 	case 32:
-		*(u32 *) value = readl(virt_addr);
+		*(u32 *) value = *(u32 *) virt_addr;
 		break;
 	case 64:
-		*(u64 *) value = readq(virt_addr);
+		*(u64 *) value = *(u64 *) virt_addr;
 		break;
 	default:
 		BUG();
 	}
 
 	if (unmap)
-		iounmap(virt_addr);
+		memunmap(virt_addr);
 	else
 		rcu_read_unlock();
 
@@ -1002,7 +970,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u64 value, u32 width)
 	virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
 	if (!virt_addr) {
 		rcu_read_unlock();
-		virt_addr = acpi_os_ioremap(phys_addr, size);
+		virt_addr = acpi_os_memremap(phys_addr, size);
 		if (!virt_addr)
 			return AE_BAD_ADDRESS;
 		unmap = true;
@@ -1026,7 +994,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u64 value, u32 width)
 	}
 
 	if (unmap)
-		iounmap(virt_addr);
+		memunmap(virt_addr);
 	else
 		rcu_read_unlock();
 
diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h
index dd86c5fc102d..646ce8714109 100644
--- a/include/acpi/acpi_io.h
+++ b/include/acpi/acpi_io.h
@@ -5,13 +5,11 @@
 
 #include <asm/acpi.h>
 
-#ifndef acpi_os_ioremap
-static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
+static inline void *acpi_os_memremap(acpi_physical_address phys,
 					    acpi_size size)
 {
-       return ioremap_cache(phys, size);
+       return memremap(phys, size, MEMREMAP_WB);
 }
-#endif
 
 void __iomem *__init_refok
 acpi_os_map_iomem(acpi_physical_address phys, acpi_size size);

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Liam Girdwood, Takashi Iwai, Jaroslav Kysela,
	Mark Brown, Jeeja KP, linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
skl-nhlt to memremap.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 sound/soc/intel/skylake/skl-nhlt.c |   10 +++++-----
 sound/soc/intel/skylake/skl.h      |    6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
index 13036b19d7e5..b0c7bd113aac 100644
--- a/sound/soc/intel/skylake/skl-nhlt.c
+++ b/sound/soc/intel/skylake/skl-nhlt.c
@@ -25,7 +25,7 @@ static u8 OSC_UUID[16] = {0x6E, 0x88, 0x9F, 0xA6, 0xEB, 0x6C, 0x94, 0x45,
 
 #define DSDT_NHLT_PATH "\\_SB.PCI0.HDAS"
 
-void __iomem *skl_nhlt_init(struct device *dev)
+void *skl_nhlt_init(struct device *dev)
 {
 	acpi_handle handle;
 	union acpi_object *obj;
@@ -40,17 +40,17 @@ void __iomem *skl_nhlt_init(struct device *dev)
 	if (obj && obj->type == ACPI_TYPE_BUFFER) {
 		nhlt_ptr = (struct nhlt_resource_desc  *)obj->buffer.pointer;
 
-		return ioremap_cache(nhlt_ptr->min_addr, nhlt_ptr->length);
+		return memremap(nhlt_ptr->min_addr, nhlt_ptr->length,
+				MEMREMAP_WB);
 	}
 
 	dev_err(dev, "device specific method to extract NHLT blob failed\n");
 	return NULL;
 }
 
-void skl_nhlt_free(void __iomem *addr)
+void skl_nhlt_free(void *addr)
 {
-	iounmap(addr);
-	addr = NULL;
+	memunmap(addr);
 }
 
 static struct nhlt_specific_cfg *skl_get_specific_cfg(
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index f7fdbb02947f..551c6db25f34 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -55,7 +55,7 @@ struct skl {
 	unsigned int init_failed:1; /* delayed init failed */
 	struct platform_device *dmic_dev;
 
-	void __iomem *nhlt; /* nhlt ptr */
+	void *nhlt; /* nhlt ptr */
 	struct skl_sst *skl_sst; /* sst skl ctx */
 };
 
@@ -72,8 +72,8 @@ struct skl_dma_params {
 int skl_platform_unregister(struct device *dev);
 int skl_platform_register(struct device *dev);
 
-void __iomem *skl_nhlt_init(struct device *dev);
-void skl_nhlt_free(void __iomem *addr);
+void *skl_nhlt_init(struct device *dev);
+void skl_nhlt_free(void *addr);
 struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
 			u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn);
 


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
skl-nhlt to memremap.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 sound/soc/intel/skylake/skl-nhlt.c |   10 +++++-----
 sound/soc/intel/skylake/skl.h      |    6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
index 13036b19d7e5..b0c7bd113aac 100644
--- a/sound/soc/intel/skylake/skl-nhlt.c
+++ b/sound/soc/intel/skylake/skl-nhlt.c
@@ -25,7 +25,7 @@ static u8 OSC_UUID[16] = {0x6E, 0x88, 0x9F, 0xA6, 0xEB, 0x6C, 0x94, 0x45,
 
 #define DSDT_NHLT_PATH "\\_SB.PCI0.HDAS"
 
-void __iomem *skl_nhlt_init(struct device *dev)
+void *skl_nhlt_init(struct device *dev)
 {
 	acpi_handle handle;
 	union acpi_object *obj;
@@ -40,17 +40,17 @@ void __iomem *skl_nhlt_init(struct device *dev)
 	if (obj && obj->type == ACPI_TYPE_BUFFER) {
 		nhlt_ptr = (struct nhlt_resource_desc  *)obj->buffer.pointer;
 
-		return ioremap_cache(nhlt_ptr->min_addr, nhlt_ptr->length);
+		return memremap(nhlt_ptr->min_addr, nhlt_ptr->length,
+				MEMREMAP_WB);
 	}
 
 	dev_err(dev, "device specific method to extract NHLT blob failed\n");
 	return NULL;
 }
 
-void skl_nhlt_free(void __iomem *addr)
+void skl_nhlt_free(void *addr)
 {
-	iounmap(addr);
-	addr = NULL;
+	memunmap(addr);
 }
 
 static struct nhlt_specific_cfg *skl_get_specific_cfg(
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index f7fdbb02947f..551c6db25f34 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -55,7 +55,7 @@ struct skl {
 	unsigned int init_failed:1; /* delayed init failed */
 	struct platform_device *dmic_dev;
 
-	void __iomem *nhlt; /* nhlt ptr */
+	void *nhlt; /* nhlt ptr */
 	struct skl_sst *skl_sst; /* sst skl ctx */
 };
 
@@ -72,8 +72,8 @@ struct skl_dma_params {
 int skl_platform_unregister(struct device *dev);
 int skl_platform_register(struct device *dev);
 
-void __iomem *skl_nhlt_init(struct device *dev);
-void skl_nhlt_free(void __iomem *addr);
+void *skl_nhlt_init(struct device *dev);
+void skl_nhlt_free(void *addr);
 struct nhlt_specific_cfg *skl_get_ep_blob(struct skl *skl, u32 instance,
 			u8 link_type, u8 s_fmt, u8 no_ch, u32 s_rate, u8 dirn);
 

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 12/20] memconsole: fix __iomem mishandling, switch to memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, linux-arm-kernel, Mike Waychison

The memconsole driver is not using proper accessors for __iomem.  Switch
to memremap to fix this issue, and this also prepares the driver for the
removal of ioremap_cache.

Cc: Mike Waychison <mikew@google.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/firmware/google/memconsole.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/google/memconsole.c
index 2f569aaed4c7..fd5041716860 100644
--- a/drivers/firmware/google/memconsole.c
+++ b/drivers/firmware/google/memconsole.c
@@ -52,14 +52,15 @@ static ssize_t memconsole_read(struct file *filp, struct kobject *kobp,
 	char *memconsole;
 	ssize_t ret;
 
-	memconsole = ioremap_cache(memconsole_baseaddr, memconsole_length);
+	memconsole = memremap(memconsole_baseaddr, memconsole_length,
+			MEMREMAP_WB);
 	if (!memconsole) {
-		pr_err("memconsole: ioremap_cache failed\n");
+		pr_err("memconsole: memremap failed\n");
 		return -ENOMEM;
 	}
 	ret = memory_read_from_buffer(buf, count, &pos, memconsole,
 				      memconsole_length);
-	iounmap(memconsole);
+	memunmap(memconsole);
 	return ret;
 }
 


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 12/20] memconsole: fix __iomem mishandling, switch to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

The memconsole driver is not using proper accessors for __iomem.  Switch
to memremap to fix this issue, and this also prepares the driver for the
removal of ioremap_cache.

Cc: Mike Waychison <mikew@google.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/firmware/google/memconsole.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/google/memconsole.c
index 2f569aaed4c7..fd5041716860 100644
--- a/drivers/firmware/google/memconsole.c
+++ b/drivers/firmware/google/memconsole.c
@@ -52,14 +52,15 @@ static ssize_t memconsole_read(struct file *filp, struct kobject *kobp,
 	char *memconsole;
 	ssize_t ret;
 
-	memconsole = ioremap_cache(memconsole_baseaddr, memconsole_length);
+	memconsole = memremap(memconsole_baseaddr, memconsole_length,
+			MEMREMAP_WB);
 	if (!memconsole) {
-		pr_err("memconsole: ioremap_cache failed\n");
+		pr_err("memconsole: memremap failed\n");
 		return -ENOMEM;
 	}
 	ret = memory_read_from_buffer(buf, count, &pos, memconsole,
 				      memconsole_length);
-	iounmap(memconsole);
+	memunmap(memconsole);
 	return ret;
 }
 

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, Joerg Roedel, David Woodhouse, linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
intel-iommu to memremap.  This also eliminates the mishandling of the
__iomem annotation in the implementation.

Cc: David Woodhouse <dwmw2@infradead.org>
Acked-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/iommu/intel-iommu.c         |   20 +++++++++++---------
 drivers/iommu/intel_irq_remapping.c |    8 ++++----
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 041bc1810a86..a089177db372 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -34,6 +34,7 @@
 #include <linux/mempool.h>
 #include <linux/memory.h>
 #include <linux/timer.h>
+#include <linux/io.h>
 #include <linux/iova.h>
 #include <linux/iommu.h>
 #include <linux/intel-iommu.h>
@@ -2807,18 +2808,18 @@ static void intel_iommu_init_qi(struct intel_iommu *iommu)
 }
 
 static int copy_context_table(struct intel_iommu *iommu,
-			      struct root_entry __iomem *old_re,
+			      struct root_entry *old_re,
 			      struct context_entry **tbl,
 			      int bus, bool ext)
 {
 	int tbl_idx, pos = 0, idx, devfn, ret = 0, did;
-	struct context_entry __iomem *old_ce = NULL;
 	struct context_entry *new_ce = NULL, ce;
+	struct context_entry *old_ce = NULL;
 	struct root_entry re;
 	phys_addr_t old_ce_phys;
 
 	tbl_idx = ext ? bus * 2 : bus;
-	memcpy_fromio(&re, old_re, sizeof(re));
+	memcpy(&re, old_re, sizeof(re));
 
 	for (devfn = 0; devfn < 256; devfn++) {
 		/* First calculate the correct index */
@@ -2853,7 +2854,8 @@ static int copy_context_table(struct intel_iommu *iommu,
 			}
 
 			ret = -ENOMEM;
-			old_ce = ioremap_cache(old_ce_phys, PAGE_SIZE);
+			old_ce = memremap(old_ce_phys, PAGE_SIZE,
+					MEMREMAP_WB);
 			if (!old_ce)
 				goto out;
 
@@ -2865,7 +2867,7 @@ static int copy_context_table(struct intel_iommu *iommu,
 		}
 
 		/* Now copy the context entry */
-		memcpy_fromio(&ce, old_ce + idx, sizeof(ce));
+		memcpy(&ce, old_ce + idx, sizeof(ce));
 
 		if (!__context_present(&ce))
 			continue;
@@ -2901,7 +2903,7 @@ static int copy_context_table(struct intel_iommu *iommu,
 	__iommu_flush_cache(iommu, new_ce, VTD_PAGE_SIZE);
 
 out_unmap:
-	iounmap(old_ce);
+	memunmap(old_ce);
 
 out:
 	return ret;
@@ -2909,8 +2911,8 @@ out:
 
 static int copy_translation_tables(struct intel_iommu *iommu)
 {
-	struct root_entry __iomem *old_rt;
 	struct context_entry **ctxt_tbls;
+	struct root_entry *old_rt;
 	phys_addr_t old_rt_phys;
 	int ctxt_table_entries;
 	unsigned long flags;
@@ -2935,7 +2937,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
 	if (!old_rt_phys)
 		return -EINVAL;
 
-	old_rt = ioremap_cache(old_rt_phys, PAGE_SIZE);
+	old_rt = memremap(old_rt_phys, PAGE_SIZE, MEMREMAP_WB);
 	if (!old_rt)
 		return -ENOMEM;
 
@@ -2984,7 +2986,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
 	ret = 0;
 
 out_unmap:
-	iounmap(old_rt);
+	memunmap(old_rt);
 
 	return ret;
 }
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 9ec4e0d94ffd..bdc52cc6ed23 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -384,7 +384,7 @@ static int set_msi_sid(struct irte *irte, struct pci_dev *dev)
 
 static int iommu_load_old_irte(struct intel_iommu *iommu)
 {
-	struct irte __iomem *old_ir_table;
+	struct irte *old_ir_table;
 	phys_addr_t irt_phys;
 	unsigned int i;
 	size_t size;
@@ -408,12 +408,12 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
 	size     = INTR_REMAP_TABLE_ENTRIES*sizeof(struct irte);
 
 	/* Map the old IR table */
-	old_ir_table = ioremap_cache(irt_phys, size);
+	old_ir_table = memremap(irt_phys, size, MEMREMAP_WB);
 	if (!old_ir_table)
 		return -ENOMEM;
 
 	/* Copy data over */
-	memcpy_fromio(iommu->ir_table->base, old_ir_table, size);
+	memcpy(iommu->ir_table->base, old_ir_table, size);
 
 	__iommu_flush_cache(iommu, iommu->ir_table->base, size);
 
@@ -426,7 +426,7 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
 			bitmap_set(iommu->ir_table->bitmap, i, 1);
 	}
 
-	iounmap(old_ir_table);
+	memunmap(old_ir_table);
 
 	return 0;
 }


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
intel-iommu to memremap.  This also eliminates the mishandling of the
__iomem annotation in the implementation.

Cc: David Woodhouse <dwmw2@infradead.org>
Acked-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/iommu/intel-iommu.c         |   20 +++++++++++---------
 drivers/iommu/intel_irq_remapping.c |    8 ++++----
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 041bc1810a86..a089177db372 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -34,6 +34,7 @@
 #include <linux/mempool.h>
 #include <linux/memory.h>
 #include <linux/timer.h>
+#include <linux/io.h>
 #include <linux/iova.h>
 #include <linux/iommu.h>
 #include <linux/intel-iommu.h>
@@ -2807,18 +2808,18 @@ static void intel_iommu_init_qi(struct intel_iommu *iommu)
 }
 
 static int copy_context_table(struct intel_iommu *iommu,
-			      struct root_entry __iomem *old_re,
+			      struct root_entry *old_re,
 			      struct context_entry **tbl,
 			      int bus, bool ext)
 {
 	int tbl_idx, pos = 0, idx, devfn, ret = 0, did;
-	struct context_entry __iomem *old_ce = NULL;
 	struct context_entry *new_ce = NULL, ce;
+	struct context_entry *old_ce = NULL;
 	struct root_entry re;
 	phys_addr_t old_ce_phys;
 
 	tbl_idx = ext ? bus * 2 : bus;
-	memcpy_fromio(&re, old_re, sizeof(re));
+	memcpy(&re, old_re, sizeof(re));
 
 	for (devfn = 0; devfn < 256; devfn++) {
 		/* First calculate the correct index */
@@ -2853,7 +2854,8 @@ static int copy_context_table(struct intel_iommu *iommu,
 			}
 
 			ret = -ENOMEM;
-			old_ce = ioremap_cache(old_ce_phys, PAGE_SIZE);
+			old_ce = memremap(old_ce_phys, PAGE_SIZE,
+					MEMREMAP_WB);
 			if (!old_ce)
 				goto out;
 
@@ -2865,7 +2867,7 @@ static int copy_context_table(struct intel_iommu *iommu,
 		}
 
 		/* Now copy the context entry */
-		memcpy_fromio(&ce, old_ce + idx, sizeof(ce));
+		memcpy(&ce, old_ce + idx, sizeof(ce));
 
 		if (!__context_present(&ce))
 			continue;
@@ -2901,7 +2903,7 @@ static int copy_context_table(struct intel_iommu *iommu,
 	__iommu_flush_cache(iommu, new_ce, VTD_PAGE_SIZE);
 
 out_unmap:
-	iounmap(old_ce);
+	memunmap(old_ce);
 
 out:
 	return ret;
@@ -2909,8 +2911,8 @@ out:
 
 static int copy_translation_tables(struct intel_iommu *iommu)
 {
-	struct root_entry __iomem *old_rt;
 	struct context_entry **ctxt_tbls;
+	struct root_entry *old_rt;
 	phys_addr_t old_rt_phys;
 	int ctxt_table_entries;
 	unsigned long flags;
@@ -2935,7 +2937,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
 	if (!old_rt_phys)
 		return -EINVAL;
 
-	old_rt = ioremap_cache(old_rt_phys, PAGE_SIZE);
+	old_rt = memremap(old_rt_phys, PAGE_SIZE, MEMREMAP_WB);
 	if (!old_rt)
 		return -ENOMEM;
 
@@ -2984,7 +2986,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
 	ret = 0;
 
 out_unmap:
-	iounmap(old_rt);
+	memunmap(old_rt);
 
 	return ret;
 }
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 9ec4e0d94ffd..bdc52cc6ed23 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -384,7 +384,7 @@ static int set_msi_sid(struct irte *irte, struct pci_dev *dev)
 
 static int iommu_load_old_irte(struct intel_iommu *iommu)
 {
-	struct irte __iomem *old_ir_table;
+	struct irte *old_ir_table;
 	phys_addr_t irt_phys;
 	unsigned int i;
 	size_t size;
@@ -408,12 +408,12 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
 	size     = INTR_REMAP_TABLE_ENTRIES*sizeof(struct irte);
 
 	/* Map the old IR table */
-	old_ir_table = ioremap_cache(irt_phys, size);
+	old_ir_table = memremap(irt_phys, size, MEMREMAP_WB);
 	if (!old_ir_table)
 		return -ENOMEM;
 
 	/* Copy data over */
-	memcpy_fromio(iommu->ir_table->base, old_ir_table, size);
+	memcpy(iommu->ir_table->base, old_ir_table, size);
 
 	__iommu_flush_cache(iommu, iommu->ir_table->base, size);
 
@@ -426,7 +426,7 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
 			bitmap_set(iommu->ir_table->bitmap, i, 1);
 	}
 
-	iounmap(old_ir_table);
+	memunmap(old_ir_table);
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 14/20] pxa2xx-flash: switch from ioremap_cache to memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, Brian Norris, David Woodhouse, linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
pxa2xx-flash to memremap.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
[brian: also convert iounmap to memunmap]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/mtd/maps/pxa2xx-flash.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index 12fa75df5008..5ff6cc5b4844 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -71,8 +71,8 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
 		       info->map.name);
 		return -ENOMEM;
 	}
-	info->map.cached =
-		ioremap_cache(info->map.phys, info->map.size);
+	info->map.cached = memremap(info->map.phys, info->map.size,
+			MEMREMAP_WB);
 	if (!info->map.cached)
 		printk(KERN_WARNING "Failed to ioremap cached %s\n",
 		       info->map.name);
@@ -111,7 +111,7 @@ static int pxa2xx_flash_remove(struct platform_device *dev)
 	map_destroy(info->mtd);
 	iounmap(info->map.virt);
 	if (info->map.cached)
-		iounmap(info->map.cached);
+		memunmap(info->map.cached);
 	kfree(info);
 	return 0;
 }


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 14/20] pxa2xx-flash: switch from ioremap_cache to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in
pxa2xx-flash to memremap.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
[brian: also convert iounmap to memunmap]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/mtd/maps/pxa2xx-flash.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index 12fa75df5008..5ff6cc5b4844 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -71,8 +71,8 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
 		       info->map.name);
 		return -ENOMEM;
 	}
-	info->map.cached =
-		ioremap_cache(info->map.phys, info->map.size);
+	info->map.cached = memremap(info->map.phys, info->map.size,
+			MEMREMAP_WB);
 	if (!info->map.cached)
 		printk(KERN_WARNING "Failed to ioremap cached %s\n",
 		       info->map.name);
@@ -111,7 +111,7 @@ static int pxa2xx_flash_remove(struct platform_device *dev)
 	map_destroy(info->mtd);
 	iounmap(info->map.virt);
 	if (info->map.cached)
-		iounmap(info->map.cached);
+		memunmap(info->map.cached);
 	kfree(info);
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 15/20] sfi: switch from ioremap_cache to memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:16   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, linux-arm-kernel, Len Brown

In preparation for deprecating ioremap_cache() convert its usage in sfi
to memremap.  It's a bit awkward that we go and add back a fake __iomem
annotation, but this is to keep consistency with early_ioremap() which
does not have a 'memremap' flavor.

Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/sfi/sfi_core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/sfi/sfi_core.c b/drivers/sfi/sfi_core.c
index 296db7a69c27..d9430b845dfa 100644
--- a/drivers/sfi/sfi_core.c
+++ b/drivers/sfi/sfi_core.c
@@ -101,7 +101,7 @@ static void __iomem * __ref sfi_map_memory(u64 phys, u32 size)
 		return NULL;
 
 	if (sfi_use_ioremap)
-		return ioremap_cache(phys, size);
+		return (void __iomem *) memremap(phys, size, MEMREMAP_WB);
 	else
 		return early_ioremap(phys, size);
 }
@@ -112,7 +112,7 @@ static void __ref sfi_unmap_memory(void __iomem *virt, u32 size)
 		return;
 
 	if (sfi_use_ioremap)
-		iounmap(virt);
+		memunmap((void __force *) virt);
 	else
 		early_iounmap(virt, size);
 }


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 15/20] sfi: switch from ioremap_cache to memremap
@ 2015-10-09 22:16   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for deprecating ioremap_cache() convert its usage in sfi
to memremap.  It's a bit awkward that we go and add back a fake __iomem
annotation, but this is to keep consistency with early_ioremap() which
does not have a 'memremap' flavor.

Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/sfi/sfi_core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/sfi/sfi_core.c b/drivers/sfi/sfi_core.c
index 296db7a69c27..d9430b845dfa 100644
--- a/drivers/sfi/sfi_core.c
+++ b/drivers/sfi/sfi_core.c
@@ -101,7 +101,7 @@ static void __iomem * __ref sfi_map_memory(u64 phys, u32 size)
 		return NULL;
 
 	if (sfi_use_ioremap)
-		return ioremap_cache(phys, size);
+		return (void __iomem *) memremap(phys, size, MEMREMAP_WB);
 	else
 		return early_ioremap(phys, size);
 }
@@ -112,7 +112,7 @@ static void __ref sfi_unmap_memory(void __iomem *virt, u32 size)
 		return;
 
 	if (sfi_use_ioremap)
-		iounmap(virt);
+		memunmap((void __force *) virt);
 	else
 		early_iounmap(virt, size);
 }

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 16/20] fbdev: switch from ioremap_wt to memremap
  2015-10-09 22:15 ` Dan Williams
  (?)
@ 2015-10-09 22:17   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, linux-fbdev, Tomi Valkeinen,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel

In preparation for deprecating ioremap_wt() convert its usage in
drivers/video/fbdev to memremap.

Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/video/fbdev/amifb.c |    5 +++--
 drivers/video/fbdev/atafb.c |    5 +++--
 drivers/video/fbdev/hpfb.c  |    6 +++---
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
index 1d702e13aaff..0cde451046d0 100644
--- a/drivers/video/fbdev/amifb.c
+++ b/drivers/video/fbdev/amifb.c
@@ -52,6 +52,7 @@
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/uaccess.h>
+#include <linux/io.h>
 
 #include <asm/irq.h>
 #include <asm/amigahw.h>
@@ -3705,8 +3706,8 @@ default_chipset:
 	 * access the videomem with writethrough cache
 	 */
 	info->fix.smem_start = (u_long)ZTWO_PADDR(videomemory);
-	videomemory = (u_long)ioremap_wt(info->fix.smem_start,
-					 info->fix.smem_len);
+	videomemory = (u_long)memremap(info->fix.smem_start, info->fix.smem_len,
+			MEMREMAP_WT);
 	if (!videomemory) {
 		dev_warn(&pdev->dev,
 			 "Unable to map videomem cached writethrough\n");
diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
index d6ce613e12ad..5615e8c31ea2 100644
--- a/drivers/video/fbdev/atafb.c
+++ b/drivers/video/fbdev/atafb.c
@@ -55,12 +55,12 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 
 #include <asm/setup.h>
 #include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/irq.h>
-#include <asm/io.h>
 
 #include <asm/atarihw.h>
 #include <asm/atariints.h>
@@ -3185,7 +3185,8 @@ int __init atafb_init(void)
 		/* Map the video memory (physical address given) to somewhere
 		 * in the kernel address space.
 		 */
-		external_screen_base = ioremap_wt(external_addr, external_len);
+		external_screen_base = memremap(external_addr, external_len,
+				MEMREMAP_WT);
 		if (external_vgaiobase)
 			external_vgaiobase =
 			  (unsigned long)ioremap(external_vgaiobase, 0x10000);
diff --git a/drivers/video/fbdev/hpfb.c b/drivers/video/fbdev/hpfb.c
index 9476d196f510..d08c320b06fc 100644
--- a/drivers/video/fbdev/hpfb.c
+++ b/drivers/video/fbdev/hpfb.c
@@ -14,8 +14,8 @@
 #include <linux/init.h>
 #include <linux/fb.h>
 #include <linux/dio.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/uaccess.h>
 
 static struct fb_info fb_info = {
@@ -241,8 +241,8 @@ static int hpfb_init_one(unsigned long phys_base, unsigned long virt_base)
 	fb_info.fix.line_length = fb_width;
 	fb_height = (in_8(fb_regs + HPFB_FBHMSB) << 8) | in_8(fb_regs + HPFB_FBHLSB);
 	fb_info.fix.smem_len = fb_width * fb_height;
-	fb_start = (unsigned long)ioremap_wt(fb_info.fix.smem_start,
-					     fb_info.fix.smem_len);
+	fb_start = (unsigned long) memremap(fb_info.fix.smem_start,
+					     fb_info.fix.smem_len, MEMREMAP_WT);
 	hpfb_defined.xres = (in_8(fb_regs + HPFB_DWMSB) << 8) | in_8(fb_regs + HPFB_DWLSB);
 	hpfb_defined.yres = (in_8(fb_regs + HPFB_DHMSB) << 8) | in_8(fb_regs + HPFB_DHLSB);
 	hpfb_defined.xres_virtual = hpfb_defined.xres;


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 16/20] fbdev: switch from ioremap_wt to memremap
@ 2015-10-09 22:17   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, linux-fbdev, Tomi Valkeinen,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel

In preparation for deprecating ioremap_wt() convert its usage in
drivers/video/fbdev to memremap.

Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/video/fbdev/amifb.c |    5 +++--
 drivers/video/fbdev/atafb.c |    5 +++--
 drivers/video/fbdev/hpfb.c  |    6 +++---
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
index 1d702e13aaff..0cde451046d0 100644
--- a/drivers/video/fbdev/amifb.c
+++ b/drivers/video/fbdev/amifb.c
@@ -52,6 +52,7 @@
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/uaccess.h>
+#include <linux/io.h>
 
 #include <asm/irq.h>
 #include <asm/amigahw.h>
@@ -3705,8 +3706,8 @@ default_chipset:
 	 * access the videomem with writethrough cache
 	 */
 	info->fix.smem_start = (u_long)ZTWO_PADDR(videomemory);
-	videomemory = (u_long)ioremap_wt(info->fix.smem_start,
-					 info->fix.smem_len);
+	videomemory = (u_long)memremap(info->fix.smem_start, info->fix.smem_len,
+			MEMREMAP_WT);
 	if (!videomemory) {
 		dev_warn(&pdev->dev,
 			 "Unable to map videomem cached writethrough\n");
diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
index d6ce613e12ad..5615e8c31ea2 100644
--- a/drivers/video/fbdev/atafb.c
+++ b/drivers/video/fbdev/atafb.c
@@ -55,12 +55,12 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 
 #include <asm/setup.h>
 #include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/irq.h>
-#include <asm/io.h>
 
 #include <asm/atarihw.h>
 #include <asm/atariints.h>
@@ -3185,7 +3185,8 @@ int __init atafb_init(void)
 		/* Map the video memory (physical address given) to somewhere
 		 * in the kernel address space.
 		 */
-		external_screen_base = ioremap_wt(external_addr, external_len);
+		external_screen_base = memremap(external_addr, external_len,
+				MEMREMAP_WT);
 		if (external_vgaiobase)
 			external_vgaiobase  			  (unsigned long)ioremap(external_vgaiobase, 0x10000);
diff --git a/drivers/video/fbdev/hpfb.c b/drivers/video/fbdev/hpfb.c
index 9476d196f510..d08c320b06fc 100644
--- a/drivers/video/fbdev/hpfb.c
+++ b/drivers/video/fbdev/hpfb.c
@@ -14,8 +14,8 @@
 #include <linux/init.h>
 #include <linux/fb.h>
 #include <linux/dio.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/uaccess.h>
 
 static struct fb_info fb_info = {
@@ -241,8 +241,8 @@ static int hpfb_init_one(unsigned long phys_base, unsigned long virt_base)
 	fb_info.fix.line_length = fb_width;
 	fb_height = (in_8(fb_regs + HPFB_FBHMSB) << 8) | in_8(fb_regs + HPFB_FBHLSB);
 	fb_info.fix.smem_len = fb_width * fb_height;
-	fb_start = (unsigned long)ioremap_wt(fb_info.fix.smem_start,
-					     fb_info.fix.smem_len);
+	fb_start = (unsigned long) memremap(fb_info.fix.smem_start,
+					     fb_info.fix.smem_len, MEMREMAP_WT);
 	hpfb_defined.xres = (in_8(fb_regs + HPFB_DWMSB) << 8) | in_8(fb_regs + HPFB_DWLSB);
 	hpfb_defined.yres = (in_8(fb_regs + HPFB_DHMSB) << 8) | in_8(fb_regs + HPFB_DHLSB);
 	hpfb_defined.xres_virtual = hpfb_defined.xres;


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 16/20] fbdev: switch from ioremap_wt to memremap
@ 2015-10-09 22:17   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-arm-kernel

In preparation for deprecating ioremap_wt() convert its usage in
drivers/video/fbdev to memremap.

Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev at vger.kernel.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/video/fbdev/amifb.c |    5 +++--
 drivers/video/fbdev/atafb.c |    5 +++--
 drivers/video/fbdev/hpfb.c  |    6 +++---
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
index 1d702e13aaff..0cde451046d0 100644
--- a/drivers/video/fbdev/amifb.c
+++ b/drivers/video/fbdev/amifb.c
@@ -52,6 +52,7 @@
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/uaccess.h>
+#include <linux/io.h>
 
 #include <asm/irq.h>
 #include <asm/amigahw.h>
@@ -3705,8 +3706,8 @@ default_chipset:
 	 * access the videomem with writethrough cache
 	 */
 	info->fix.smem_start = (u_long)ZTWO_PADDR(videomemory);
-	videomemory = (u_long)ioremap_wt(info->fix.smem_start,
-					 info->fix.smem_len);
+	videomemory = (u_long)memremap(info->fix.smem_start, info->fix.smem_len,
+			MEMREMAP_WT);
 	if (!videomemory) {
 		dev_warn(&pdev->dev,
 			 "Unable to map videomem cached writethrough\n");
diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
index d6ce613e12ad..5615e8c31ea2 100644
--- a/drivers/video/fbdev/atafb.c
+++ b/drivers/video/fbdev/atafb.c
@@ -55,12 +55,12 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 
 #include <asm/setup.h>
 #include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/irq.h>
-#include <asm/io.h>
 
 #include <asm/atarihw.h>
 #include <asm/atariints.h>
@@ -3185,7 +3185,8 @@ int __init atafb_init(void)
 		/* Map the video memory (physical address given) to somewhere
 		 * in the kernel address space.
 		 */
-		external_screen_base = ioremap_wt(external_addr, external_len);
+		external_screen_base = memremap(external_addr, external_len,
+				MEMREMAP_WT);
 		if (external_vgaiobase)
 			external_vgaiobase =
 			  (unsigned long)ioremap(external_vgaiobase, 0x10000);
diff --git a/drivers/video/fbdev/hpfb.c b/drivers/video/fbdev/hpfb.c
index 9476d196f510..d08c320b06fc 100644
--- a/drivers/video/fbdev/hpfb.c
+++ b/drivers/video/fbdev/hpfb.c
@@ -14,8 +14,8 @@
 #include <linux/init.h>
 #include <linux/fb.h>
 #include <linux/dio.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/uaccess.h>
 
 static struct fb_info fb_info = {
@@ -241,8 +241,8 @@ static int hpfb_init_one(unsigned long phys_base, unsigned long virt_base)
 	fb_info.fix.line_length = fb_width;
 	fb_height = (in_8(fb_regs + HPFB_FBHMSB) << 8) | in_8(fb_regs + HPFB_FBHLSB);
 	fb_info.fix.smem_len = fb_width * fb_height;
-	fb_start = (unsigned long)ioremap_wt(fb_info.fix.smem_start,
-					     fb_info.fix.smem_len);
+	fb_start = (unsigned long) memremap(fb_info.fix.smem_start,
+					     fb_info.fix.smem_len, MEMREMAP_WT);
 	hpfb_defined.xres = (in_8(fb_regs + HPFB_DWMSB) << 8) | in_8(fb_regs + HPFB_DWLSB);
 	hpfb_defined.yres = (in_8(fb_regs + HPFB_DHMSB) << 8) | in_8(fb_regs + HPFB_DHLSB);
 	hpfb_defined.xres_virtual = hpfb_defined.xres;

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 17/20] arch: kill ioremap_cached()
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:17   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, linux-arm-kernel

Nothing calls this helper, and now that ioremap_cache() is being
deprecated these can also be removed.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/arm/mm/mmu.c               |    2 +-
 arch/metag/include/asm/io.h     |    3 ---
 arch/unicore32/include/asm/io.h |    4 +---
 arch/unicore32/mm/ioremap.c     |    8 --------
 4 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 7cd15143a507..da3ce68a89b3 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -259,7 +259,7 @@ static struct mem_type mem_types[] = {
 		.prot_sect	= PROT_SECT_DEVICE,
 		.domain		= DOMAIN_IO,
 	},
-	[MT_DEVICE_CACHED] = {	  /* ioremap_cached */
+	[MT_DEVICE_CACHED] = {	  /* memremap(MEMREMAP_WB) */
 		.prot_pte	= PROT_PTE_DEVICE | L_PTE_MT_DEV_CACHED,
 		.prot_l1	= PMD_TYPE_TABLE,
 		.prot_sect	= PROT_SECT_DEVICE | PMD_SECT_WB,
diff --git a/arch/metag/include/asm/io.h b/arch/metag/include/asm/io.h
index 9890f21eadbe..5432949e627e 100644
--- a/arch/metag/include/asm/io.h
+++ b/arch/metag/include/asm/io.h
@@ -154,9 +154,6 @@ extern void __iounmap(void __iomem *addr);
 #define ioremap_nocache(offset, size)           \
 	__ioremap((offset), (size), 0)
 
-#define ioremap_cached(offset, size)            \
-	__ioremap((offset), (size), _PAGE_CACHEABLE)
-
 #define ioremap_wc(offset, size)                \
 	__ioremap((offset), (size), _PAGE_WR_COMBINE)
 
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h
index cb1d8fd2b16b..1eea482b3cb9 100644
--- a/arch/unicore32/include/asm/io.h
+++ b/arch/unicore32/include/asm/io.h
@@ -21,10 +21,9 @@
 #include <asm-generic/io.h>
 
 /*
- * __uc32_ioremap and __uc32_ioremap_cached takes CPU physical address.
+ * __uc32_ioremap takes CPU physical address.
  */
 extern void __iomem *__uc32_ioremap(unsigned long, size_t);
-extern void __iomem *__uc32_ioremap_cached(unsigned long, size_t);
 extern void __uc32_iounmap(volatile void __iomem *addr);
 
 /*
@@ -35,7 +34,6 @@ extern void __uc32_iounmap(volatile void __iomem *addr);
  *
  */
 #define ioremap(cookie, size)		__uc32_ioremap(cookie, size)
-#define ioremap_cached(cookie, size)	__uc32_ioremap_cached(cookie, size)
 #define ioremap_nocache(cookie, size)	__uc32_ioremap(cookie, size)
 #define iounmap(cookie)			__uc32_iounmap(cookie)
 
diff --git a/arch/unicore32/mm/ioremap.c b/arch/unicore32/mm/ioremap.c
index bf012b2b71a9..f9b6d918de6f 100644
--- a/arch/unicore32/mm/ioremap.c
+++ b/arch/unicore32/mm/ioremap.c
@@ -224,14 +224,6 @@ __uc32_ioremap(unsigned long phys_addr, size_t size)
 }
 EXPORT_SYMBOL(__uc32_ioremap);
 
-void __iomem *
-__uc32_ioremap_cached(unsigned long phys_addr, size_t size)
-{
-	return __uc32_ioremap_caller(phys_addr, size, MT_DEVICE_CACHED,
-			__builtin_return_address(0));
-}
-EXPORT_SYMBOL(__uc32_ioremap_cached);
-
 void __uc32_iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 17/20] arch: kill ioremap_cached()
@ 2015-10-09 22:17   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-arm-kernel

Nothing calls this helper, and now that ioremap_cache() is being
deprecated these can also be removed.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/arm/mm/mmu.c               |    2 +-
 arch/metag/include/asm/io.h     |    3 ---
 arch/unicore32/include/asm/io.h |    4 +---
 arch/unicore32/mm/ioremap.c     |    8 --------
 4 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 7cd15143a507..da3ce68a89b3 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -259,7 +259,7 @@ static struct mem_type mem_types[] = {
 		.prot_sect	= PROT_SECT_DEVICE,
 		.domain		= DOMAIN_IO,
 	},
-	[MT_DEVICE_CACHED] = {	  /* ioremap_cached */
+	[MT_DEVICE_CACHED] = {	  /* memremap(MEMREMAP_WB) */
 		.prot_pte	= PROT_PTE_DEVICE | L_PTE_MT_DEV_CACHED,
 		.prot_l1	= PMD_TYPE_TABLE,
 		.prot_sect	= PROT_SECT_DEVICE | PMD_SECT_WB,
diff --git a/arch/metag/include/asm/io.h b/arch/metag/include/asm/io.h
index 9890f21eadbe..5432949e627e 100644
--- a/arch/metag/include/asm/io.h
+++ b/arch/metag/include/asm/io.h
@@ -154,9 +154,6 @@ extern void __iounmap(void __iomem *addr);
 #define ioremap_nocache(offset, size)           \
 	__ioremap((offset), (size), 0)
 
-#define ioremap_cached(offset, size)            \
-	__ioremap((offset), (size), _PAGE_CACHEABLE)
-
 #define ioremap_wc(offset, size)                \
 	__ioremap((offset), (size), _PAGE_WR_COMBINE)
 
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h
index cb1d8fd2b16b..1eea482b3cb9 100644
--- a/arch/unicore32/include/asm/io.h
+++ b/arch/unicore32/include/asm/io.h
@@ -21,10 +21,9 @@
 #include <asm-generic/io.h>
 
 /*
- * __uc32_ioremap and __uc32_ioremap_cached takes CPU physical address.
+ * __uc32_ioremap takes CPU physical address.
  */
 extern void __iomem *__uc32_ioremap(unsigned long, size_t);
-extern void __iomem *__uc32_ioremap_cached(unsigned long, size_t);
 extern void __uc32_iounmap(volatile void __iomem *addr);
 
 /*
@@ -35,7 +34,6 @@ extern void __uc32_iounmap(volatile void __iomem *addr);
  *
  */
 #define ioremap(cookie, size)		__uc32_ioremap(cookie, size)
-#define ioremap_cached(cookie, size)	__uc32_ioremap_cached(cookie, size)
 #define ioremap_nocache(cookie, size)	__uc32_ioremap(cookie, size)
 #define iounmap(cookie)			__uc32_iounmap(cookie)
 
diff --git a/arch/unicore32/mm/ioremap.c b/arch/unicore32/mm/ioremap.c
index bf012b2b71a9..f9b6d918de6f 100644
--- a/arch/unicore32/mm/ioremap.c
+++ b/arch/unicore32/mm/ioremap.c
@@ -224,14 +224,6 @@ __uc32_ioremap(unsigned long phys_addr, size_t size)
 }
 EXPORT_SYMBOL(__uc32_ioremap);
 
-void __iomem *
-__uc32_ioremap_cached(unsigned long phys_addr, size_t size)
-{
-	return __uc32_ioremap_caller(phys_addr, size, MT_DEVICE_CACHED,
-			__builtin_return_address(0));
-}
-EXPORT_SYMBOL(__uc32_ioremap_cached);
-
 void __uc32_iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 18/20] arch: kill ioremap_fullcache()
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:17   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, linux-arm-kernel

Nothing calls this helper, and now that ioremap_cache() is being
deprecated these can also be removed.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/frv/include/asm/io.h        |    5 -----
 arch/m68k/include/asm/io_mm.h    |    6 ------
 arch/m68k/include/asm/io_no.h    |    5 -----
 arch/microblaze/include/asm/io.h |    1 -
 arch/tile/include/asm/io.h       |    1 -
 5 files changed, 18 deletions(-)

diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h
index 70dfbea8c8d7..2b6ff56a2d2f 100644
--- a/arch/frv/include/asm/io.h
+++ b/arch/frv/include/asm/io.h
@@ -272,11 +272,6 @@ static inline void __iomem *ioremap_wt(unsigned long physaddr, unsigned long siz
 	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
 }
 
-static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
-}
-
 #define ioremap_wc ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index c98ac81582ac..89361b7bfafc 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -474,12 +474,6 @@ static inline void __iomem *ioremap_wt(unsigned long physaddr,
 {
 	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
 }
-static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
-				      unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
-}
-
 static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
 {
 	__builtin_memset((void __force *) addr, val, count);
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index ad7bd40e6742..2690fa99dc56 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -159,11 +159,6 @@ static inline void *ioremap_wt(unsigned long physaddr, unsigned long size)
 {
 	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
 }
-static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
-}
-
 #define	iounmap(addr)	do { } while(0)
 
 /*
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 39b6315db82e..5e0cbf4e4204 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -40,7 +40,6 @@ extern void iounmap(void __iomem *addr);
 
 extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
 #define ioremap_nocache(addr, size)		ioremap((addr), (size))
-#define ioremap_fullcache(addr, size)		ioremap((addr), (size))
 #define ioremap_wc(addr, size)			ioremap((addr), (size))
 #define ioremap_wt(addr, size)			ioremap((addr), (size))
 
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h
index 322b5fe94781..5879af3568c5 100644
--- a/arch/tile/include/asm/io.h
+++ b/arch/tile/include/asm/io.h
@@ -56,7 +56,6 @@ extern void iounmap(volatile void __iomem *addr);
 #define ioremap_wc(physaddr, size)		ioremap(physaddr, size)
 #define ioremap_wt(physaddr, size)		ioremap(physaddr, size)
 #define ioremap_uc(physaddr, size)		ioremap(physaddr, size)
-#define ioremap_fullcache(physaddr, size)	ioremap(physaddr, size)
 
 #define mmiowb()
 


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 18/20] arch: kill ioremap_fullcache()
@ 2015-10-09 22:17   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-arm-kernel

Nothing calls this helper, and now that ioremap_cache() is being
deprecated these can also be removed.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/frv/include/asm/io.h        |    5 -----
 arch/m68k/include/asm/io_mm.h    |    6 ------
 arch/m68k/include/asm/io_no.h    |    5 -----
 arch/microblaze/include/asm/io.h |    1 -
 arch/tile/include/asm/io.h       |    1 -
 5 files changed, 18 deletions(-)

diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h
index 70dfbea8c8d7..2b6ff56a2d2f 100644
--- a/arch/frv/include/asm/io.h
+++ b/arch/frv/include/asm/io.h
@@ -272,11 +272,6 @@ static inline void __iomem *ioremap_wt(unsigned long physaddr, unsigned long siz
 	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
 }
 
-static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
-}
-
 #define ioremap_wc ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index c98ac81582ac..89361b7bfafc 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -474,12 +474,6 @@ static inline void __iomem *ioremap_wt(unsigned long physaddr,
 {
 	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
 }
-static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
-				      unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
-}
-
 static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
 {
 	__builtin_memset((void __force *) addr, val, count);
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index ad7bd40e6742..2690fa99dc56 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -159,11 +159,6 @@ static inline void *ioremap_wt(unsigned long physaddr, unsigned long size)
 {
 	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
 }
-static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
-}
-
 #define	iounmap(addr)	do { } while(0)
 
 /*
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 39b6315db82e..5e0cbf4e4204 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -40,7 +40,6 @@ extern void iounmap(void __iomem *addr);
 
 extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
 #define ioremap_nocache(addr, size)		ioremap((addr), (size))
-#define ioremap_fullcache(addr, size)		ioremap((addr), (size))
 #define ioremap_wc(addr, size)			ioremap((addr), (size))
 #define ioremap_wt(addr, size)			ioremap((addr), (size))
 
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h
index 322b5fe94781..5879af3568c5 100644
--- a/arch/tile/include/asm/io.h
+++ b/arch/tile/include/asm/io.h
@@ -56,7 +56,6 @@ extern void iounmap(volatile void __iomem *addr);
 #define ioremap_wc(physaddr, size)		ioremap(physaddr, size)
 #define ioremap_wt(physaddr, size)		ioremap(physaddr, size)
 #define ioremap_uc(physaddr, size)		ioremap(physaddr, size)
-#define ioremap_fullcache(physaddr, size)	ioremap(physaddr, size)
 
 #define mmiowb()
 

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 19/20] arch: remove ioremap_cache, replace with arch_memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:17   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Tony Luck, Arnd Bergmann, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Russell King, Thomas Gleixner,
	linux-arm-kernel

Now that all call sites for ioremap_cache() have been converted to
memremap(MEMREMAP_WB) we can now proceed with removing the
implementation in the archs.  This amounts to replacing the per-arch
ioremap_cache() implementation with arch_memremap.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/x86/pat.txt    |    2 --
 arch/arm/include/asm/io.h    |    4 ----
 arch/arm/mm/ioremap.c        |    7 -------
 arch/arm/mm/nommu.c          |    7 -------
 arch/arm64/include/asm/io.h  |    1 -
 arch/arm64/mm/ioremap.c      |   18 +-----------------
 arch/ia64/include/asm/io.h   |    6 ------
 arch/sh/include/asm/io.h     |    7 -------
 arch/x86/include/asm/io.h    |    2 --
 arch/x86/mm/ioremap.c        |    7 -------
 arch/xtensa/include/asm/io.h |   11 -----------
 kernel/Makefile              |    2 +-
 kernel/memremap.c            |   18 +++++-------------
 lib/Kconfig                  |    1 +
 14 files changed, 8 insertions(+), 85 deletions(-)

diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt
index 8c908fa5ea26..73d3635f6a3f 100644
--- a/Documentation/x86/pat.txt
+++ b/Documentation/x86/pat.txt
@@ -32,8 +32,6 @@ API                    |    RAM   |  ACPI,...  |  Reserved/Holes  |
                        |          |            |                  |
 ioremap                |    --    |    UC-     |       UC-        |
                        |          |            |                  |
-ioremap_cache          |    --    |    WB      |       WB         |
-                       |          |            |                  |
 ioremap_uc             |    --    |    UC      |       UC         |
                        |          |            |                  |
 ioremap_nocache        |    --    |    UC-     |       UC-        |
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index ca76d59cb6f3..191d0f6eeead 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -355,7 +355,6 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from,
  * Function		Memory type	Cacheability	Cache hint
  * ioremap()		Device		n/a		n/a
  * ioremap_nocache()	Device		n/a		n/a
- * ioremap_cache()	Normal		Writeback	Read allocate
  * memremap(WB)		Normal		Writeback	Read allocate
  * ioremap_wc()		Normal		Non-cacheable	n/a
  * ioremap_wt()		Normal		Non-cacheable	n/a
@@ -393,9 +392,6 @@ void __iomem *ioremap(resource_size_t res_cookie, size_t size);
 #define ioremap ioremap
 #define ioremap_nocache ioremap
 
-void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size);
-#define ioremap_cache ioremap_cache
-
 void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size);
 #define ioremap_wc ioremap_wc
 #define ioremap_wt ioremap_wc
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index f6249b98ed16..991146fa0eba 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -378,13 +378,6 @@ void __iomem *ioremap(resource_size_t res_cookie, size_t size)
 }
 EXPORT_SYMBOL(ioremap);
 
-void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size)
-{
-	return arch_ioremap_caller(res_cookie, size, MT_DEVICE_CACHED,
-				   __builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_cache);
-
 void *arch_memremap(resource_size_t res_cookie, size_t size,
 		unsigned long flags)
 {
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index d88353e1fe80..84d033501553 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -366,13 +366,6 @@ void __iomem *ioremap(resource_size_t res_cookie, size_t size)
 }
 EXPORT_SYMBOL(ioremap);
 
-void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size)
-{
-	return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_CACHED,
-				    __builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_cache);
-
 void *arch_memremap(resource_size_t res_cookie, size_t size, unsigned long flags)
 {
 	if ((flags & MEMREMAP_WB) == 0)
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 44be1e03ed65..51376353a722 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -165,7 +165,6 @@ extern void __memset_io(volatile void __iomem *, int, size_t);
  */
 extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot);
 extern void __iounmap(volatile void __iomem *addr);
-extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
 
 #define ioremap(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define ioremap_nocache(addr, size)	__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index 9db5a12654a0..83b9db4672d1 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -84,26 +84,10 @@ void __iounmap(volatile void __iomem *io_addr)
 {
 	unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
 
-	/*
-	 * We could get an address outside vmalloc range in case
-	 * of ioremap_cache() reusing a RAM mapping.
-	 */
-	if (VMALLOC_START <= addr && addr < VMALLOC_END)
-		vunmap((void *)addr);
+	vunmap((void *)addr);
 }
 EXPORT_SYMBOL(__iounmap);
 
-void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
-{
-	/* For normal memory we already have a cacheable mapping. */
-	if (pfn_valid(__phys_to_pfn(phys_addr)))
-		return (void __iomem *)__phys_to_virt(phys_addr);
-
-	return __ioremap_caller(phys_addr, size, __pgprot(PROT_NORMAL),
-				__builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_cache);
-
 void *arch_memremap(phys_addr_t phys_addr, size_t size, unsigned long flags)
 {
 	if ((flags & MEMREMAP_WB) == 0)
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 9041bbe2b7b4..defcd10bbf54 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -431,12 +431,6 @@ extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size
 #define early_memremap(phys_addr, size)        early_ioremap(phys_addr, size)
 extern void early_iounmap (volatile void __iomem *addr, unsigned long size);
 #define early_memunmap(addr, size)             early_iounmap(addr, size)
-static inline void __iomem * ioremap_cache (unsigned long phys_addr, unsigned long size)
-{
-	return ioremap(phys_addr, size);
-}
-#define ioremap_cache ioremap_cache
-
 
 /*
  * String version of IO memory access ops:
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 3280a6bfa503..0d188164daf8 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -337,13 +337,6 @@ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
 	return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE);
 }
 
-static inline void __iomem *
-ioremap_cache(phys_addr_t offset, unsigned long size)
-{
-	return __ioremap_mode(offset, size, PAGE_KERNEL);
-}
-#define ioremap_cache ioremap_cache
-
 #ifdef CONFIG_HAVE_IOREMAP_PROT
 static inline void __iomem *
 ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags)
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index de25aad07853..e643a96f7c23 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -182,10 +182,8 @@ extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size)
 extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size);
 #define ioremap_uc ioremap_uc
 
-extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
 extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size,
 				unsigned long prot_val);
-
 /*
  * The default ioremap() behavior is non-cached:
  */
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 3762ad93bd87..4bfe8b490b9a 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -310,13 +310,6 @@ void __iomem *ioremap_wt(resource_size_t phys_addr, unsigned long size)
 }
 EXPORT_SYMBOL(ioremap_wt);
 
-void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
-{
-	return __ioremap_caller(phys_addr, size, _PAGE_CACHE_MODE_WB,
-				__builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_cache);
-
 void *arch_memremap(resource_size_t phys_addr, size_t size,
 		unsigned long flags)
 {
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 867840f5400f..9bfbecc0fc99 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -48,17 +48,6 @@ static inline void __iomem *ioremap_nocache(unsigned long offset,
 		BUG();
 }
 
-static inline void __iomem *ioremap_cache(unsigned long offset,
-		unsigned long size)
-{
-	if (offset >= XCHAL_KIO_PADDR
-	    && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
-		return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
-	else
-		BUG();
-}
-#define ioremap_cache ioremap_cache
-
 #define ioremap_wc ioremap_nocache
 #define ioremap_wt ioremap_nocache
 
diff --git a/kernel/Makefile b/kernel/Makefile
index 53abf008ecb3..323df949d803 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -102,7 +102,7 @@ obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o
 obj-$(CONFIG_TORTURE_TEST) += torture.o
 obj-$(CONFIG_MEMBARRIER) += membarrier.o
 
-obj-$(CONFIG_HAS_IOMEM) += memremap.o
+obj-$(CONFIG_ARCH_HAS_MEMREMAP) += memremap.o
 
 $(obj)/configs.o: $(obj)/config_data.h
 
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 8bd5fe05d4a4..68b5d54fff01 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -16,22 +16,14 @@
 #include <linux/mm.h>
 #include <linux/memory_hotplug.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
-
-/* temporary while we convert arch implementations to arch_memremap */
 __weak void *arch_memremap(resource_size_t offset, size_t size,
 		unsigned long flags)
 {
-	if (flags & MEMREMAP_WB)
-		return (void __force *) ioremap_cache(offset, size);
-	else if (flags & MEMREMAP_WT)
-		return (void __force *) ioremap_wt(offset, size);
+	if (!IS_ENABLED(CONFIG_MMU))
+		return (void *) (unsigned long) offset;
+	WARN_ONCE(1, "%s in %s should only be called in NOMMU configurations\n",
+			__func__, __FILE__);
+	return NULL;
 }
 
 /**
diff --git a/lib/Kconfig b/lib/Kconfig
index 8d99b4e6a45b..672c92e9dfe7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -523,6 +523,7 @@ config ARCH_HAS_SG_CHAIN
 	bool
 
 config ARCH_HAS_MEMREMAP
+	default !MMU
 	bool
 
 config ARCH_HAS_PMEM_API


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 19/20] arch: remove ioremap_cache, replace with arch_memremap
@ 2015-10-09 22:17   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-arm-kernel

Now that all call sites for ioremap_cache() have been converted to
memremap(MEMREMAP_WB) we can now proceed with removing the
implementation in the archs.  This amounts to replacing the per-arch
ioremap_cache() implementation with arch_memremap.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/x86/pat.txt    |    2 --
 arch/arm/include/asm/io.h    |    4 ----
 arch/arm/mm/ioremap.c        |    7 -------
 arch/arm/mm/nommu.c          |    7 -------
 arch/arm64/include/asm/io.h  |    1 -
 arch/arm64/mm/ioremap.c      |   18 +-----------------
 arch/ia64/include/asm/io.h   |    6 ------
 arch/sh/include/asm/io.h     |    7 -------
 arch/x86/include/asm/io.h    |    2 --
 arch/x86/mm/ioremap.c        |    7 -------
 arch/xtensa/include/asm/io.h |   11 -----------
 kernel/Makefile              |    2 +-
 kernel/memremap.c            |   18 +++++-------------
 lib/Kconfig                  |    1 +
 14 files changed, 8 insertions(+), 85 deletions(-)

diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt
index 8c908fa5ea26..73d3635f6a3f 100644
--- a/Documentation/x86/pat.txt
+++ b/Documentation/x86/pat.txt
@@ -32,8 +32,6 @@ API                    |    RAM   |  ACPI,...  |  Reserved/Holes  |
                        |          |            |                  |
 ioremap                |    --    |    UC-     |       UC-        |
                        |          |            |                  |
-ioremap_cache          |    --    |    WB      |       WB         |
-                       |          |            |                  |
 ioremap_uc             |    --    |    UC      |       UC         |
                        |          |            |                  |
 ioremap_nocache        |    --    |    UC-     |       UC-        |
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index ca76d59cb6f3..191d0f6eeead 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -355,7 +355,6 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from,
  * Function		Memory type	Cacheability	Cache hint
  * ioremap()		Device		n/a		n/a
  * ioremap_nocache()	Device		n/a		n/a
- * ioremap_cache()	Normal		Writeback	Read allocate
  * memremap(WB)		Normal		Writeback	Read allocate
  * ioremap_wc()		Normal		Non-cacheable	n/a
  * ioremap_wt()		Normal		Non-cacheable	n/a
@@ -393,9 +392,6 @@ void __iomem *ioremap(resource_size_t res_cookie, size_t size);
 #define ioremap ioremap
 #define ioremap_nocache ioremap
 
-void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size);
-#define ioremap_cache ioremap_cache
-
 void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size);
 #define ioremap_wc ioremap_wc
 #define ioremap_wt ioremap_wc
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index f6249b98ed16..991146fa0eba 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -378,13 +378,6 @@ void __iomem *ioremap(resource_size_t res_cookie, size_t size)
 }
 EXPORT_SYMBOL(ioremap);
 
-void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size)
-{
-	return arch_ioremap_caller(res_cookie, size, MT_DEVICE_CACHED,
-				   __builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_cache);
-
 void *arch_memremap(resource_size_t res_cookie, size_t size,
 		unsigned long flags)
 {
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index d88353e1fe80..84d033501553 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -366,13 +366,6 @@ void __iomem *ioremap(resource_size_t res_cookie, size_t size)
 }
 EXPORT_SYMBOL(ioremap);
 
-void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size)
-{
-	return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_CACHED,
-				    __builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_cache);
-
 void *arch_memremap(resource_size_t res_cookie, size_t size, unsigned long flags)
 {
 	if ((flags & MEMREMAP_WB) == 0)
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 44be1e03ed65..51376353a722 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -165,7 +165,6 @@ extern void __memset_io(volatile void __iomem *, int, size_t);
  */
 extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot);
 extern void __iounmap(volatile void __iomem *addr);
-extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
 
 #define ioremap(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define ioremap_nocache(addr, size)	__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index 9db5a12654a0..83b9db4672d1 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -84,26 +84,10 @@ void __iounmap(volatile void __iomem *io_addr)
 {
 	unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
 
-	/*
-	 * We could get an address outside vmalloc range in case
-	 * of ioremap_cache() reusing a RAM mapping.
-	 */
-	if (VMALLOC_START <= addr && addr < VMALLOC_END)
-		vunmap((void *)addr);
+	vunmap((void *)addr);
 }
 EXPORT_SYMBOL(__iounmap);
 
-void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
-{
-	/* For normal memory we already have a cacheable mapping. */
-	if (pfn_valid(__phys_to_pfn(phys_addr)))
-		return (void __iomem *)__phys_to_virt(phys_addr);
-
-	return __ioremap_caller(phys_addr, size, __pgprot(PROT_NORMAL),
-				__builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_cache);
-
 void *arch_memremap(phys_addr_t phys_addr, size_t size, unsigned long flags)
 {
 	if ((flags & MEMREMAP_WB) == 0)
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 9041bbe2b7b4..defcd10bbf54 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -431,12 +431,6 @@ extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size
 #define early_memremap(phys_addr, size)        early_ioremap(phys_addr, size)
 extern void early_iounmap (volatile void __iomem *addr, unsigned long size);
 #define early_memunmap(addr, size)             early_iounmap(addr, size)
-static inline void __iomem * ioremap_cache (unsigned long phys_addr, unsigned long size)
-{
-	return ioremap(phys_addr, size);
-}
-#define ioremap_cache ioremap_cache
-
 
 /*
  * String version of IO memory access ops:
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 3280a6bfa503..0d188164daf8 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -337,13 +337,6 @@ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
 	return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE);
 }
 
-static inline void __iomem *
-ioremap_cache(phys_addr_t offset, unsigned long size)
-{
-	return __ioremap_mode(offset, size, PAGE_KERNEL);
-}
-#define ioremap_cache ioremap_cache
-
 #ifdef CONFIG_HAVE_IOREMAP_PROT
 static inline void __iomem *
 ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags)
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index de25aad07853..e643a96f7c23 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -182,10 +182,8 @@ extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size)
 extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size);
 #define ioremap_uc ioremap_uc
 
-extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
 extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size,
 				unsigned long prot_val);
-
 /*
  * The default ioremap() behavior is non-cached:
  */
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 3762ad93bd87..4bfe8b490b9a 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -310,13 +310,6 @@ void __iomem *ioremap_wt(resource_size_t phys_addr, unsigned long size)
 }
 EXPORT_SYMBOL(ioremap_wt);
 
-void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
-{
-	return __ioremap_caller(phys_addr, size, _PAGE_CACHE_MODE_WB,
-				__builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_cache);
-
 void *arch_memremap(resource_size_t phys_addr, size_t size,
 		unsigned long flags)
 {
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 867840f5400f..9bfbecc0fc99 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -48,17 +48,6 @@ static inline void __iomem *ioremap_nocache(unsigned long offset,
 		BUG();
 }
 
-static inline void __iomem *ioremap_cache(unsigned long offset,
-		unsigned long size)
-{
-	if (offset >= XCHAL_KIO_PADDR
-	    && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
-		return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
-	else
-		BUG();
-}
-#define ioremap_cache ioremap_cache
-
 #define ioremap_wc ioremap_nocache
 #define ioremap_wt ioremap_nocache
 
diff --git a/kernel/Makefile b/kernel/Makefile
index 53abf008ecb3..323df949d803 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -102,7 +102,7 @@ obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o
 obj-$(CONFIG_TORTURE_TEST) += torture.o
 obj-$(CONFIG_MEMBARRIER) += membarrier.o
 
-obj-$(CONFIG_HAS_IOMEM) += memremap.o
+obj-$(CONFIG_ARCH_HAS_MEMREMAP) += memremap.o
 
 $(obj)/configs.o: $(obj)/config_data.h
 
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 8bd5fe05d4a4..68b5d54fff01 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -16,22 +16,14 @@
 #include <linux/mm.h>
 #include <linux/memory_hotplug.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
-
-/* temporary while we convert arch implementations to arch_memremap */
 __weak void *arch_memremap(resource_size_t offset, size_t size,
 		unsigned long flags)
 {
-	if (flags & MEMREMAP_WB)
-		return (void __force *) ioremap_cache(offset, size);
-	else if (flags & MEMREMAP_WT)
-		return (void __force *) ioremap_wt(offset, size);
+	if (!IS_ENABLED(CONFIG_MMU))
+		return (void *) (unsigned long) offset;
+	WARN_ONCE(1, "%s in %s should only be called in NOMMU configurations\n",
+			__func__, __FILE__);
+	return NULL;
 }
 
 /**
diff --git a/lib/Kconfig b/lib/Kconfig
index 8d99b4e6a45b..672c92e9dfe7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -523,6 +523,7 @@ config ARCH_HAS_SG_CHAIN
 	bool
 
 config ARCH_HAS_MEMREMAP
+	default !MMU
 	bool
 
 config ARCH_HAS_PMEM_API

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 20/20] arch: remove ioremap_wt, optionally replace with arch_memremap
  2015-10-09 22:15 ` Dan Williams
@ 2015-10-09 22:17   ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, Tony Luck, Arnd Bergmann, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, Russell King, Thomas Gleixner,
	linux-arm-kernel

Now that all call sites for ioremap_wt() have been converted to
memremap(MEMREMAP_WT) we can now proceed with removing the
implementation in the archs.  This amounts to replacing the per-arch
ioremap_wt() implementation with arch_memremap in the case where
ioremap_wt() was actually providing "writethrough" semantics.
Otherwise, ioremap_wt() support that falls back to ioremap() is simply
removed.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/x86/pat.txt        |    2 +-
 arch/arc/include/asm/io.h        |    1 -
 arch/arm/include/asm/io.h        |    2 --
 arch/arm64/include/asm/io.h      |    1 -
 arch/avr32/include/asm/io.h      |    1 -
 arch/frv/include/asm/io.h        |    7 -------
 arch/m32r/include/asm/io.h       |    1 -
 arch/m68k/include/asm/io_mm.h    |    7 -------
 arch/m68k/include/asm/io_no.h    |    6 ------
 arch/m68k/include/asm/raw_io.h   |    1 -
 arch/metag/include/asm/io.h      |    3 ---
 arch/microblaze/include/asm/io.h |    1 -
 arch/mn10300/include/asm/io.h    |    1 -
 arch/nios2/include/asm/io.h      |    1 -
 arch/s390/include/asm/io.h       |    1 -
 arch/sparc/include/asm/io_32.h   |    1 -
 arch/sparc/include/asm/io_64.h   |    1 -
 arch/tile/include/asm/io.h       |    1 -
 arch/x86/include/asm/io.h        |    2 --
 arch/x86/mm/ioremap.c            |   17 -----------------
 arch/xtensa/include/asm/io.h     |    1 -
 drivers/video/fbdev/Kconfig      |    2 +-
 include/asm-generic/io.h         |    8 --------
 include/asm-generic/iomap.h      |    4 ----
 24 files changed, 2 insertions(+), 71 deletions(-)

diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt
index 73d3635f6a3f..7e0e43c648f7 100644
--- a/Documentation/x86/pat.txt
+++ b/Documentation/x86/pat.txt
@@ -40,7 +40,7 @@ ioremap_wc             |    --    |    --      |       WC         |
                        |          |            |                  |
 memremap(MEMREMAP_WB)  |    WB    |    WB      |       WB         |
                        |          |            |                  |
-ioremap_wt             |    --    |    --      |       WT         |
+memremap(MEMREMAP_WT)  |    --    |    --      |       WT         |
                        |          |            |                  |
 set_memory_uc          |    UC-   |    --      |       --         |
  set_memory_wb         |          |            |                  |
diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index 694ece8a0243..00f97a2f5fa6 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -20,7 +20,6 @@ extern void iounmap(const void __iomem *addr);
 
 #define ioremap_nocache(phy, sz)	ioremap(phy, sz)
 #define ioremap_wc(phy, sz)		ioremap(phy, sz)
-#define ioremap_wt(phy, sz)		ioremap(phy, sz)
 
 /* Change struct page to physical address */
 #define page_to_phys(page)		(page_to_pfn(page) << PAGE_SHIFT)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 191d0f6eeead..5616c4f4304d 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -357,7 +357,6 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from,
  * ioremap_nocache()	Device		n/a		n/a
  * memremap(WB)		Normal		Writeback	Read allocate
  * ioremap_wc()		Normal		Non-cacheable	n/a
- * ioremap_wt()		Normal		Non-cacheable	n/a
  *
  * All device mappings have the following properties:
  * - no access speculation
@@ -394,7 +393,6 @@ void __iomem *ioremap(resource_size_t res_cookie, size_t size);
 
 void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size);
 #define ioremap_wc ioremap_wc
-#define ioremap_wt ioremap_wc
 
 void iounmap(volatile void __iomem *iomem_cookie);
 #define iounmap iounmap
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 51376353a722..054fb4def2c9 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -169,7 +169,6 @@ extern void __iounmap(volatile void __iomem *addr);
 #define ioremap(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define ioremap_nocache(addr, size)	__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define ioremap_wc(addr, size)		__ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
-#define ioremap_wt(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define iounmap				__iounmap
 
 /*
diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h
index f855646e0db7..1f8ca9bde930 100644
--- a/arch/avr32/include/asm/io.h
+++ b/arch/avr32/include/asm/io.h
@@ -296,7 +296,6 @@ extern void __iounmap(void __iomem *addr);
 	__iounmap(addr)
 
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
 #define cached(addr) P1SEGADDR(addr)
diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h
index 2b6ff56a2d2f..afc14a071582 100644
--- a/arch/frv/include/asm/io.h
+++ b/arch/frv/include/asm/io.h
@@ -17,8 +17,6 @@
 
 #ifdef __KERNEL__
 
-#define ARCH_HAS_IOREMAP_WT
-
 #include <linux/types.h>
 #include <asm/virtconvert.h>
 #include <asm/string.h>
@@ -267,11 +265,6 @@ static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned lon
 	return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
 
-static inline void __iomem *ioremap_wt(unsigned long physaddr, unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
-}
-
 #define ioremap_wc ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h
index 61b8931bc192..c458307a36ad 100644
--- a/arch/m32r/include/asm/io.h
+++ b/arch/m32r/include/asm/io.h
@@ -68,7 +68,6 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 extern void iounmap(volatile void __iomem *addr);
 #define ioremap_nocache(off,size) ioremap(off,size)
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
 /*
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index 89361b7bfafc..99cca82cb10c 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -20,8 +20,6 @@
 
 #ifdef __KERNEL__
 
-#define ARCH_HAS_IOREMAP_WT
-
 #include <linux/compiler.h>
 #include <asm/raw_io.h>
 #include <asm/virtconvert.h>
@@ -469,11 +467,6 @@ static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned lon
 	return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
 #define ioremap_uc ioremap_nocache
-static inline void __iomem *ioremap_wt(unsigned long physaddr,
-					 unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
-}
 static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
 {
 	__builtin_memset((void __force *) addr, val, count);
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index 2690fa99dc56..b5890e593961 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -3,8 +3,6 @@
 
 #ifdef __KERNEL__
 
-#define ARCH_HAS_IOREMAP_WT
-
 #include <asm/virtconvert.h>
 #include <asm-generic/iomap.h>
 
@@ -155,10 +153,6 @@ static inline void *ioremap_nocache(unsigned long physaddr, unsigned long size)
 {
 	return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
-static inline void *ioremap_wt(unsigned long physaddr, unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
-}
 #define	iounmap(addr)	do { } while(0)
 
 /*
diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h
index 932faa35655b..9f6e5a4e531b 100644
--- a/arch/m68k/include/asm/raw_io.h
+++ b/arch/m68k/include/asm/raw_io.h
@@ -25,7 +25,6 @@ extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
 		       int cacheflag);
 extern void __iounmap(void *addr, unsigned long size);
 
-
 /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates
  * two accesses to memory, which may be undesirable for some devices.
  */
diff --git a/arch/metag/include/asm/io.h b/arch/metag/include/asm/io.h
index 5432949e627e..482ef3b5f5ba 100644
--- a/arch/metag/include/asm/io.h
+++ b/arch/metag/include/asm/io.h
@@ -157,9 +157,6 @@ extern void __iounmap(void __iomem *addr);
 #define ioremap_wc(offset, size)                \
 	__ioremap((offset), (size), _PAGE_WR_COMBINE)
 
-#define ioremap_wt(offset, size)                \
-	__ioremap((offset), (size), 0)
-
 #define iounmap(addr)                           \
 	__iounmap(addr)
 
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 5e0cbf4e4204..df7ffb3d9898 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -41,7 +41,6 @@ extern void iounmap(void __iomem *addr);
 extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
 #define ioremap_nocache(addr, size)		ioremap((addr), (size))
 #define ioremap_wc(addr, size)			ioremap((addr), (size))
-#define ioremap_wt(addr, size)			ioremap((addr), (size))
 
 #endif /* CONFIG_MMU */
 
diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h
index 62189353d2f6..9d790fd00865 100644
--- a/arch/mn10300/include/asm/io.h
+++ b/arch/mn10300/include/asm/io.h
@@ -282,7 +282,6 @@ static inline void __iomem *ioremap_nocache(unsigned long offset, unsigned long
 }
 
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
 static inline void iounmap(void __iomem *addr)
diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
index c5a62da22cd2..6e24d7cceb0c 100644
--- a/arch/nios2/include/asm/io.h
+++ b/arch/nios2/include/asm/io.h
@@ -46,7 +46,6 @@ static inline void iounmap(void __iomem *addr)
 }
 
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 
 /* Pages to physical address... */
 #define page_to_phys(page)	virt_to_phys(page_to_virt(page))
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index 437e9af96688..6d4bb1b4a5b1 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -29,7 +29,6 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
 
 #define ioremap_nocache(addr, size)	ioremap(addr, size)
 #define ioremap_wc			ioremap_nocache
-#define ioremap_wt			ioremap_nocache
 
 static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 {
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index 57f26c398dc9..407ac14295f4 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -129,7 +129,6 @@ static inline void sbus_memcpy_toio(volatile void __iomem *dst,
 void __iomem *ioremap(unsigned long offset, unsigned long size);
 #define ioremap_nocache(X,Y)	ioremap((X),(Y))
 #define ioremap_wc(X,Y)		ioremap((X),(Y))
-#define ioremap_wt(X,Y)		ioremap((X),(Y))
 void iounmap(volatile void __iomem *addr);
 
 /* Create a virtual mapping cookie for an IO port range */
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index c32fa3f752c8..50d4840d9aeb 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -402,7 +402,6 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 
 #define ioremap_nocache(X,Y)		ioremap((X),(Y))
 #define ioremap_wc(X,Y)			ioremap((X),(Y))
-#define ioremap_wt(X,Y)			ioremap((X),(Y))
 
 static inline void iounmap(volatile void __iomem *addr)
 {
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h
index 5879af3568c5..8c4551ae70de 100644
--- a/arch/tile/include/asm/io.h
+++ b/arch/tile/include/asm/io.h
@@ -54,7 +54,6 @@ extern void iounmap(volatile void __iomem *addr);
 
 #define ioremap_nocache(physaddr, size)		ioremap(physaddr, size)
 #define ioremap_wc(physaddr, size)		ioremap(physaddr, size)
-#define ioremap_wt(physaddr, size)		ioremap(physaddr, size)
 #define ioremap_uc(physaddr, size)		ioremap(physaddr, size)
 
 #define mmiowb()
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index e643a96f7c23..746c1648dbd0 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -35,7 +35,6 @@
   */
 
 #define ARCH_HAS_IOREMAP_WC
-#define ARCH_HAS_IOREMAP_WT
 
 #include <linux/string.h>
 #include <linux/compiler.h>
@@ -321,7 +320,6 @@ extern void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
 extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
 				enum page_cache_mode pcm);
 extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size);
-extern void __iomem *ioremap_wt(resource_size_t offset, unsigned long size);
 
 extern bool is_early_ioremap_ptep(pte_t *ptep);
 
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 4bfe8b490b9a..f442c96ca8e4 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -293,23 +293,6 @@ void __iomem *ioremap_wc(resource_size_t phys_addr, unsigned long size)
 }
 EXPORT_SYMBOL(ioremap_wc);
 
-/**
- * ioremap_wt	-	map memory into CPU space write through
- * @phys_addr:	bus address of the memory
- * @size:	size of the resource to map
- *
- * This version of ioremap ensures that the memory is marked write through.
- * Write through stores data into memory while keeping the cache up-to-date.
- *
- * Must be freed with iounmap.
- */
-void __iomem *ioremap_wt(resource_size_t phys_addr, unsigned long size)
-{
-	return __ioremap_caller(phys_addr, size, _PAGE_CACHE_MODE_WT,
-					__builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_wt);
-
 void *arch_memremap(resource_size_t phys_addr, size_t size,
 		unsigned long flags)
 {
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 9bfbecc0fc99..aaafd90c70db 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -49,7 +49,6 @@ static inline void __iomem *ioremap_nocache(unsigned long offset,
 }
 
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 
 static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 {
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 8b1d371b5404..c1235ea427e8 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -699,7 +699,7 @@ config FB_MAC
 
 config FB_HP300
 	bool
-	depends on (FB = y) && DIO
+	depends on (FB = y) && DIO && ARCH_HAS_MEMREMAP
 	select FB_CFB_IMAGEBLIT
 	default y
 
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index eed3bbe88c8a..5196b8ad16fc 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -813,14 +813,6 @@ static inline void __iomem *ioremap_wc(phys_addr_t offset, size_t size)
 }
 #endif
 
-#ifndef ioremap_wt
-#define ioremap_wt ioremap_wt
-static inline void __iomem *ioremap_wt(phys_addr_t offset, size_t size)
-{
-	return ioremap_nocache(offset, size);
-}
-#endif
-
 #ifndef iounmap
 #define iounmap iounmap
 
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index d8f8622fa044..1b41011643a5 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -66,10 +66,6 @@ extern void ioport_unmap(void __iomem *);
 #define ioremap_wc ioremap_nocache
 #endif
 
-#ifndef ARCH_HAS_IOREMAP_WT
-#define ioremap_wt ioremap_nocache
-#endif
-
 #ifdef CONFIG_PCI
 /* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
 struct pci_dev;


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [PATCH 20/20] arch: remove ioremap_wt, optionally replace with arch_memremap
@ 2015-10-09 22:17   ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-09 22:17 UTC (permalink / raw)
  To: linux-arm-kernel

Now that all call sites for ioremap_wt() have been converted to
memremap(MEMREMAP_WT) we can now proceed with removing the
implementation in the archs.  This amounts to replacing the per-arch
ioremap_wt() implementation with arch_memremap in the case where
ioremap_wt() was actually providing "writethrough" semantics.
Otherwise, ioremap_wt() support that falls back to ioremap() is simply
removed.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/x86/pat.txt        |    2 +-
 arch/arc/include/asm/io.h        |    1 -
 arch/arm/include/asm/io.h        |    2 --
 arch/arm64/include/asm/io.h      |    1 -
 arch/avr32/include/asm/io.h      |    1 -
 arch/frv/include/asm/io.h        |    7 -------
 arch/m32r/include/asm/io.h       |    1 -
 arch/m68k/include/asm/io_mm.h    |    7 -------
 arch/m68k/include/asm/io_no.h    |    6 ------
 arch/m68k/include/asm/raw_io.h   |    1 -
 arch/metag/include/asm/io.h      |    3 ---
 arch/microblaze/include/asm/io.h |    1 -
 arch/mn10300/include/asm/io.h    |    1 -
 arch/nios2/include/asm/io.h      |    1 -
 arch/s390/include/asm/io.h       |    1 -
 arch/sparc/include/asm/io_32.h   |    1 -
 arch/sparc/include/asm/io_64.h   |    1 -
 arch/tile/include/asm/io.h       |    1 -
 arch/x86/include/asm/io.h        |    2 --
 arch/x86/mm/ioremap.c            |   17 -----------------
 arch/xtensa/include/asm/io.h     |    1 -
 drivers/video/fbdev/Kconfig      |    2 +-
 include/asm-generic/io.h         |    8 --------
 include/asm-generic/iomap.h      |    4 ----
 24 files changed, 2 insertions(+), 71 deletions(-)

diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt
index 73d3635f6a3f..7e0e43c648f7 100644
--- a/Documentation/x86/pat.txt
+++ b/Documentation/x86/pat.txt
@@ -40,7 +40,7 @@ ioremap_wc             |    --    |    --      |       WC         |
                        |          |            |                  |
 memremap(MEMREMAP_WB)  |    WB    |    WB      |       WB         |
                        |          |            |                  |
-ioremap_wt             |    --    |    --      |       WT         |
+memremap(MEMREMAP_WT)  |    --    |    --      |       WT         |
                        |          |            |                  |
 set_memory_uc          |    UC-   |    --      |       --         |
  set_memory_wb         |          |            |                  |
diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index 694ece8a0243..00f97a2f5fa6 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -20,7 +20,6 @@ extern void iounmap(const void __iomem *addr);
 
 #define ioremap_nocache(phy, sz)	ioremap(phy, sz)
 #define ioremap_wc(phy, sz)		ioremap(phy, sz)
-#define ioremap_wt(phy, sz)		ioremap(phy, sz)
 
 /* Change struct page to physical address */
 #define page_to_phys(page)		(page_to_pfn(page) << PAGE_SHIFT)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 191d0f6eeead..5616c4f4304d 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -357,7 +357,6 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from,
  * ioremap_nocache()	Device		n/a		n/a
  * memremap(WB)		Normal		Writeback	Read allocate
  * ioremap_wc()		Normal		Non-cacheable	n/a
- * ioremap_wt()		Normal		Non-cacheable	n/a
  *
  * All device mappings have the following properties:
  * - no access speculation
@@ -394,7 +393,6 @@ void __iomem *ioremap(resource_size_t res_cookie, size_t size);
 
 void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size);
 #define ioremap_wc ioremap_wc
-#define ioremap_wt ioremap_wc
 
 void iounmap(volatile void __iomem *iomem_cookie);
 #define iounmap iounmap
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 51376353a722..054fb4def2c9 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -169,7 +169,6 @@ extern void __iounmap(volatile void __iomem *addr);
 #define ioremap(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define ioremap_nocache(addr, size)	__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define ioremap_wc(addr, size)		__ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
-#define ioremap_wt(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
 #define iounmap				__iounmap
 
 /*
diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h
index f855646e0db7..1f8ca9bde930 100644
--- a/arch/avr32/include/asm/io.h
+++ b/arch/avr32/include/asm/io.h
@@ -296,7 +296,6 @@ extern void __iounmap(void __iomem *addr);
 	__iounmap(addr)
 
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
 #define cached(addr) P1SEGADDR(addr)
diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h
index 2b6ff56a2d2f..afc14a071582 100644
--- a/arch/frv/include/asm/io.h
+++ b/arch/frv/include/asm/io.h
@@ -17,8 +17,6 @@
 
 #ifdef __KERNEL__
 
-#define ARCH_HAS_IOREMAP_WT
-
 #include <linux/types.h>
 #include <asm/virtconvert.h>
 #include <asm/string.h>
@@ -267,11 +265,6 @@ static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned lon
 	return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
 
-static inline void __iomem *ioremap_wt(unsigned long physaddr, unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
-}
-
 #define ioremap_wc ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h
index 61b8931bc192..c458307a36ad 100644
--- a/arch/m32r/include/asm/io.h
+++ b/arch/m32r/include/asm/io.h
@@ -68,7 +68,6 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 extern void iounmap(volatile void __iomem *addr);
 #define ioremap_nocache(off,size) ioremap(off,size)
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
 /*
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index 89361b7bfafc..99cca82cb10c 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -20,8 +20,6 @@
 
 #ifdef __KERNEL__
 
-#define ARCH_HAS_IOREMAP_WT
-
 #include <linux/compiler.h>
 #include <asm/raw_io.h>
 #include <asm/virtconvert.h>
@@ -469,11 +467,6 @@ static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned lon
 	return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
 #define ioremap_uc ioremap_nocache
-static inline void __iomem *ioremap_wt(unsigned long physaddr,
-					 unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
-}
 static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
 {
 	__builtin_memset((void __force *) addr, val, count);
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index 2690fa99dc56..b5890e593961 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -3,8 +3,6 @@
 
 #ifdef __KERNEL__
 
-#define ARCH_HAS_IOREMAP_WT
-
 #include <asm/virtconvert.h>
 #include <asm-generic/iomap.h>
 
@@ -155,10 +153,6 @@ static inline void *ioremap_nocache(unsigned long physaddr, unsigned long size)
 {
 	return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
-static inline void *ioremap_wt(unsigned long physaddr, unsigned long size)
-{
-	return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
-}
 #define	iounmap(addr)	do { } while(0)
 
 /*
diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h
index 932faa35655b..9f6e5a4e531b 100644
--- a/arch/m68k/include/asm/raw_io.h
+++ b/arch/m68k/include/asm/raw_io.h
@@ -25,7 +25,6 @@ extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
 		       int cacheflag);
 extern void __iounmap(void *addr, unsigned long size);
 
-
 /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates
  * two accesses to memory, which may be undesirable for some devices.
  */
diff --git a/arch/metag/include/asm/io.h b/arch/metag/include/asm/io.h
index 5432949e627e..482ef3b5f5ba 100644
--- a/arch/metag/include/asm/io.h
+++ b/arch/metag/include/asm/io.h
@@ -157,9 +157,6 @@ extern void __iounmap(void __iomem *addr);
 #define ioremap_wc(offset, size)                \
 	__ioremap((offset), (size), _PAGE_WR_COMBINE)
 
-#define ioremap_wt(offset, size)                \
-	__ioremap((offset), (size), 0)
-
 #define iounmap(addr)                           \
 	__iounmap(addr)
 
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 5e0cbf4e4204..df7ffb3d9898 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -41,7 +41,6 @@ extern void iounmap(void __iomem *addr);
 extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
 #define ioremap_nocache(addr, size)		ioremap((addr), (size))
 #define ioremap_wc(addr, size)			ioremap((addr), (size))
-#define ioremap_wt(addr, size)			ioremap((addr), (size))
 
 #endif /* CONFIG_MMU */
 
diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h
index 62189353d2f6..9d790fd00865 100644
--- a/arch/mn10300/include/asm/io.h
+++ b/arch/mn10300/include/asm/io.h
@@ -282,7 +282,6 @@ static inline void __iomem *ioremap_nocache(unsigned long offset, unsigned long
 }
 
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
 static inline void iounmap(void __iomem *addr)
diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
index c5a62da22cd2..6e24d7cceb0c 100644
--- a/arch/nios2/include/asm/io.h
+++ b/arch/nios2/include/asm/io.h
@@ -46,7 +46,6 @@ static inline void iounmap(void __iomem *addr)
 }
 
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 
 /* Pages to physical address... */
 #define page_to_phys(page)	virt_to_phys(page_to_virt(page))
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index 437e9af96688..6d4bb1b4a5b1 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -29,7 +29,6 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
 
 #define ioremap_nocache(addr, size)	ioremap(addr, size)
 #define ioremap_wc			ioremap_nocache
-#define ioremap_wt			ioremap_nocache
 
 static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 {
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index 57f26c398dc9..407ac14295f4 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -129,7 +129,6 @@ static inline void sbus_memcpy_toio(volatile void __iomem *dst,
 void __iomem *ioremap(unsigned long offset, unsigned long size);
 #define ioremap_nocache(X,Y)	ioremap((X),(Y))
 #define ioremap_wc(X,Y)		ioremap((X),(Y))
-#define ioremap_wt(X,Y)		ioremap((X),(Y))
 void iounmap(volatile void __iomem *addr);
 
 /* Create a virtual mapping cookie for an IO port range */
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index c32fa3f752c8..50d4840d9aeb 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -402,7 +402,6 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 
 #define ioremap_nocache(X,Y)		ioremap((X),(Y))
 #define ioremap_wc(X,Y)			ioremap((X),(Y))
-#define ioremap_wt(X,Y)			ioremap((X),(Y))
 
 static inline void iounmap(volatile void __iomem *addr)
 {
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h
index 5879af3568c5..8c4551ae70de 100644
--- a/arch/tile/include/asm/io.h
+++ b/arch/tile/include/asm/io.h
@@ -54,7 +54,6 @@ extern void iounmap(volatile void __iomem *addr);
 
 #define ioremap_nocache(physaddr, size)		ioremap(physaddr, size)
 #define ioremap_wc(physaddr, size)		ioremap(physaddr, size)
-#define ioremap_wt(physaddr, size)		ioremap(physaddr, size)
 #define ioremap_uc(physaddr, size)		ioremap(physaddr, size)
 
 #define mmiowb()
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index e643a96f7c23..746c1648dbd0 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -35,7 +35,6 @@
   */
 
 #define ARCH_HAS_IOREMAP_WC
-#define ARCH_HAS_IOREMAP_WT
 
 #include <linux/string.h>
 #include <linux/compiler.h>
@@ -321,7 +320,6 @@ extern void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
 extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
 				enum page_cache_mode pcm);
 extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size);
-extern void __iomem *ioremap_wt(resource_size_t offset, unsigned long size);
 
 extern bool is_early_ioremap_ptep(pte_t *ptep);
 
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 4bfe8b490b9a..f442c96ca8e4 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -293,23 +293,6 @@ void __iomem *ioremap_wc(resource_size_t phys_addr, unsigned long size)
 }
 EXPORT_SYMBOL(ioremap_wc);
 
-/**
- * ioremap_wt	-	map memory into CPU space write through
- * @phys_addr:	bus address of the memory
- * @size:	size of the resource to map
- *
- * This version of ioremap ensures that the memory is marked write through.
- * Write through stores data into memory while keeping the cache up-to-date.
- *
- * Must be freed with iounmap.
- */
-void __iomem *ioremap_wt(resource_size_t phys_addr, unsigned long size)
-{
-	return __ioremap_caller(phys_addr, size, _PAGE_CACHE_MODE_WT,
-					__builtin_return_address(0));
-}
-EXPORT_SYMBOL(ioremap_wt);
-
 void *arch_memremap(resource_size_t phys_addr, size_t size,
 		unsigned long flags)
 {
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 9bfbecc0fc99..aaafd90c70db 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -49,7 +49,6 @@ static inline void __iomem *ioremap_nocache(unsigned long offset,
 }
 
 #define ioremap_wc ioremap_nocache
-#define ioremap_wt ioremap_nocache
 
 static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 {
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 8b1d371b5404..c1235ea427e8 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -699,7 +699,7 @@ config FB_MAC
 
 config FB_HP300
 	bool
-	depends on (FB = y) && DIO
+	depends on (FB = y) && DIO && ARCH_HAS_MEMREMAP
 	select FB_CFB_IMAGEBLIT
 	default y
 
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index eed3bbe88c8a..5196b8ad16fc 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -813,14 +813,6 @@ static inline void __iomem *ioremap_wc(phys_addr_t offset, size_t size)
 }
 #endif
 
-#ifndef ioremap_wt
-#define ioremap_wt ioremap_wt
-static inline void __iomem *ioremap_wt(phys_addr_t offset, size_t size)
-{
-	return ioremap_nocache(offset, size);
-}
-#endif
-
 #ifndef iounmap
 #define iounmap iounmap
 
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index d8f8622fa044..1b41011643a5 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -66,10 +66,6 @@ extern void ioport_unmap(void __iomem *);
 #define ioremap_wc ioremap_nocache
 #endif
 
-#ifndef ARCH_HAS_IOREMAP_WT
-#define ioremap_wt ioremap_nocache
-#endif
-
 #ifdef CONFIG_PCI
 /* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
 struct pci_dev;

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
  2015-10-09 22:16   ` Dan Williams
  (?)
@ 2015-10-12  7:01     ` Daniel Vetter
  -1 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2015-10-12  7:01 UTC (permalink / raw)
  To: Dan Williams
  Cc: linux-kernel, linux-arch, David Airlie, intel-gfx, dri-devel,
	Daniel Vetter, linux-arm-kernel

On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> map it with memremap rather than the implied cache setting of
> acpi_os_ioremap().
> 
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Assuming you've run sparse over this to make sure you've caught them all,
and with the nit below addressed this is

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Feel free to pull v2 into whatever tree you think it's suitable for (but
you can also resend and I'll pick it up).

> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index e2ab3f6ed022..c8444d5f549f 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
>  
>  	/* Assume that the BIOS does not lie through the OpRegion... */
>  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> +		return *(dev_priv->opregion.lid_state) & 0x1 ?

() are redundant now here.
-Daniel

>  			connector_status_connected :
>  			connector_status_disconnected;
>  	}
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-12  7:01     ` Daniel Vetter
  0 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2015-10-12  7:01 UTC (permalink / raw)
  To: Dan Williams
  Cc: linux-arch, intel-gfx, linux-kernel, dri-devel, Daniel Vetter,
	linux-arm-kernel

On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> map it with memremap rather than the implied cache setting of
> acpi_os_ioremap().
> 
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Assuming you've run sparse over this to make sure you've caught them all,
and with the nit below addressed this is

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Feel free to pull v2 into whatever tree you think it's suitable for (but
you can also resend and I'll pick it up).

> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index e2ab3f6ed022..c8444d5f549f 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
>  
>  	/* Assume that the BIOS does not lie through the OpRegion... */
>  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> +		return *(dev_priv->opregion.lid_state) & 0x1 ?

() are redundant now here.
-Daniel

>  			connector_status_connected :
>  			connector_status_disconnected;
>  	}
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-12  7:01     ` Daniel Vetter
  0 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2015-10-12  7:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> map it with memremap rather than the implied cache setting of
> acpi_os_ioremap().
> 
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx at lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel at lists.freedesktop.org
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Assuming you've run sparse over this to make sure you've caught them all,
and with the nit below addressed this is

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Feel free to pull v2 into whatever tree you think it's suitable for (but
you can also resend and I'll pick it up).

> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index e2ab3f6ed022..c8444d5f549f 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
>  
>  	/* Assume that the BIOS does not lie through the OpRegion... */
>  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> +		return *(dev_priv->opregion.lid_state) & 0x1 ?

() are redundant now here.
-Daniel

>  			connector_status_connected :
>  			connector_status_disconnected;
>  	}
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 14/20] pxa2xx-flash: switch from ioremap_cache to memremap
  2015-10-09 22:16   ` Dan Williams
@ 2015-10-12 17:58     ` Brian Norris
  -1 siblings, 0 replies; 90+ messages in thread
From: Brian Norris @ 2015-10-12 17:58 UTC (permalink / raw)
  To: Dan Williams
  Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel, linux-mtd

You missed linux-mtd again. Please use scripts/get_maintainer.pl next
time to at least get the relevant mailing list(s). (The individual CC's
are not always necessary, but the subsystem lists definitely are.)

Brian

On Fri, Oct 09, 2015 at 06:16:51PM -0400, Dan Williams wrote:
> In preparation for deprecating ioremap_cache() convert its usage in
> pxa2xx-flash to memremap.
> 
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Brian Norris <computersforpeace@gmail.com>
> [brian: also convert iounmap to memunmap]
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/mtd/maps/pxa2xx-flash.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
> index 12fa75df5008..5ff6cc5b4844 100644
> --- a/drivers/mtd/maps/pxa2xx-flash.c
> +++ b/drivers/mtd/maps/pxa2xx-flash.c
> @@ -71,8 +71,8 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
>  		       info->map.name);
>  		return -ENOMEM;
>  	}
> -	info->map.cached =
> -		ioremap_cache(info->map.phys, info->map.size);
> +	info->map.cached = memremap(info->map.phys, info->map.size,
> +			MEMREMAP_WB);
>  	if (!info->map.cached)
>  		printk(KERN_WARNING "Failed to ioremap cached %s\n",
>  		       info->map.name);
> @@ -111,7 +111,7 @@ static int pxa2xx_flash_remove(struct platform_device *dev)
>  	map_destroy(info->mtd);
>  	iounmap(info->map.virt);
>  	if (info->map.cached)
> -		iounmap(info->map.cached);
> +		memunmap(info->map.cached);
>  	kfree(info);
>  	return 0;
>  }
> 

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 14/20] pxa2xx-flash: switch from ioremap_cache to memremap
@ 2015-10-12 17:58     ` Brian Norris
  0 siblings, 0 replies; 90+ messages in thread
From: Brian Norris @ 2015-10-12 17:58 UTC (permalink / raw)
  To: linux-arm-kernel

You missed linux-mtd again. Please use scripts/get_maintainer.pl next
time to at least get the relevant mailing list(s). (The individual CC's
are not always necessary, but the subsystem lists definitely are.)

Brian

On Fri, Oct 09, 2015 at 06:16:51PM -0400, Dan Williams wrote:
> In preparation for deprecating ioremap_cache() convert its usage in
> pxa2xx-flash to memremap.
> 
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Brian Norris <computersforpeace@gmail.com>
> [brian: also convert iounmap to memunmap]
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/mtd/maps/pxa2xx-flash.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
> index 12fa75df5008..5ff6cc5b4844 100644
> --- a/drivers/mtd/maps/pxa2xx-flash.c
> +++ b/drivers/mtd/maps/pxa2xx-flash.c
> @@ -71,8 +71,8 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
>  		       info->map.name);
>  		return -ENOMEM;
>  	}
> -	info->map.cached =
> -		ioremap_cache(info->map.phys, info->map.size);
> +	info->map.cached = memremap(info->map.phys, info->map.size,
> +			MEMREMAP_WB);
>  	if (!info->map.cached)
>  		printk(KERN_WARNING "Failed to ioremap cached %s\n",
>  		       info->map.name);
> @@ -111,7 +111,7 @@ static int pxa2xx_flash_remove(struct platform_device *dev)
>  	map_destroy(info->mtd);
>  	iounmap(info->map.virt);
>  	if (info->map.cached)
> -		iounmap(info->map.cached);
> +		memunmap(info->map.cached);
>  	kfree(info);
>  	return 0;
>  }
> 

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 14/20] pxa2xx-flash: switch from ioremap_cache to memremap
  2015-10-12 17:58     ` Brian Norris
@ 2015-10-12 20:31       ` Brian Norris
  -1 siblings, 0 replies; 90+ messages in thread
From: Brian Norris @ 2015-10-12 20:31 UTC (permalink / raw)
  To: Dan Williams
  Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel, linux-mtd

On Mon, Oct 12, 2015 at 10:58:03AM -0700, Brian Norris wrote:
> You missed linux-mtd again. Please use scripts/get_maintainer.pl next
> time to at least get the relevant mailing list(s). (The individual CC's
> are not always necessary, but the subsystem lists definitely are.)

Anyway, pushed to l2-mtd.git.

Brian

> On Fri, Oct 09, 2015 at 06:16:51PM -0400, Dan Williams wrote:
> > In preparation for deprecating ioremap_cache() convert its usage in
> > pxa2xx-flash to memremap.
> > 
> > Cc: David Woodhouse <dwmw2@infradead.org>
> > Cc: Brian Norris <computersforpeace@gmail.com>
> > [brian: also convert iounmap to memunmap]
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> > ---
> >  drivers/mtd/maps/pxa2xx-flash.c |    6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
> > index 12fa75df5008..5ff6cc5b4844 100644
> > --- a/drivers/mtd/maps/pxa2xx-flash.c
> > +++ b/drivers/mtd/maps/pxa2xx-flash.c
> > @@ -71,8 +71,8 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
> >  		       info->map.name);
> >  		return -ENOMEM;
> >  	}
> > -	info->map.cached =
> > -		ioremap_cache(info->map.phys, info->map.size);
> > +	info->map.cached = memremap(info->map.phys, info->map.size,
> > +			MEMREMAP_WB);
> >  	if (!info->map.cached)
> >  		printk(KERN_WARNING "Failed to ioremap cached %s\n",
> >  		       info->map.name);
> > @@ -111,7 +111,7 @@ static int pxa2xx_flash_remove(struct platform_device *dev)
> >  	map_destroy(info->mtd);
> >  	iounmap(info->map.virt);
> >  	if (info->map.cached)
> > -		iounmap(info->map.cached);
> > +		memunmap(info->map.cached);
> >  	kfree(info);
> >  	return 0;
> >  }
> > 

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 14/20] pxa2xx-flash: switch from ioremap_cache to memremap
@ 2015-10-12 20:31       ` Brian Norris
  0 siblings, 0 replies; 90+ messages in thread
From: Brian Norris @ 2015-10-12 20:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 12, 2015 at 10:58:03AM -0700, Brian Norris wrote:
> You missed linux-mtd again. Please use scripts/get_maintainer.pl next
> time to at least get the relevant mailing list(s). (The individual CC's
> are not always necessary, but the subsystem lists definitely are.)

Anyway, pushed to l2-mtd.git.

Brian

> On Fri, Oct 09, 2015 at 06:16:51PM -0400, Dan Williams wrote:
> > In preparation for deprecating ioremap_cache() convert its usage in
> > pxa2xx-flash to memremap.
> > 
> > Cc: David Woodhouse <dwmw2@infradead.org>
> > Cc: Brian Norris <computersforpeace@gmail.com>
> > [brian: also convert iounmap to memunmap]
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> > ---
> >  drivers/mtd/maps/pxa2xx-flash.c |    6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
> > index 12fa75df5008..5ff6cc5b4844 100644
> > --- a/drivers/mtd/maps/pxa2xx-flash.c
> > +++ b/drivers/mtd/maps/pxa2xx-flash.c
> > @@ -71,8 +71,8 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
> >  		       info->map.name);
> >  		return -ENOMEM;
> >  	}
> > -	info->map.cached =
> > -		ioremap_cache(info->map.phys, info->map.size);
> > +	info->map.cached = memremap(info->map.phys, info->map.size,
> > +			MEMREMAP_WB);
> >  	if (!info->map.cached)
> >  		printk(KERN_WARNING "Failed to ioremap cached %s\n",
> >  		       info->map.name);
> > @@ -111,7 +111,7 @@ static int pxa2xx_flash_remove(struct platform_device *dev)
> >  	map_destroy(info->mtd);
> >  	iounmap(info->map.virt);
> >  	if (info->map.cached)
> > -		iounmap(info->map.cached);
> > +		memunmap(info->map.cached);
> >  	kfree(info);
> >  	return 0;
> >  }
> > 

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 14/20] pxa2xx-flash: switch from ioremap_cache to memremap
  2015-10-12 20:31       ` Brian Norris
  (?)
@ 2015-10-12 20:36         ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-12 20:36 UTC (permalink / raw)
  To: Brian Norris
  Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel, linux-mtd

On Mon, Oct 12, 2015 at 1:31 PM, Brian Norris
<computersforpeace@gmail.com> wrote:
> On Mon, Oct 12, 2015 at 10:58:03AM -0700, Brian Norris wrote:
>> You missed linux-mtd again. Please use scripts/get_maintainer.pl next
>> time to at least get the relevant mailing list(s). (The individual CC's
>> are not always necessary, but the subsystem lists definitely are.)
>
> Anyway, pushed to l2-mtd.git.
>

Thanks Brian, I'll watch out for that next time.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 14/20] pxa2xx-flash: switch from ioremap_cache to memremap
@ 2015-10-12 20:36         ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-12 20:36 UTC (permalink / raw)
  To: Brian Norris
  Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel, linux-mtd

On Mon, Oct 12, 2015 at 1:31 PM, Brian Norris
<computersforpeace@gmail.com> wrote:
> On Mon, Oct 12, 2015 at 10:58:03AM -0700, Brian Norris wrote:
>> You missed linux-mtd again. Please use scripts/get_maintainer.pl next
>> time to at least get the relevant mailing list(s). (The individual CC's
>> are not always necessary, but the subsystem lists definitely are.)
>
> Anyway, pushed to l2-mtd.git.
>

Thanks Brian, I'll watch out for that next time.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 14/20] pxa2xx-flash: switch from ioremap_cache to memremap
@ 2015-10-12 20:36         ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-12 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 12, 2015 at 1:31 PM, Brian Norris
<computersforpeace@gmail.com> wrote:
> On Mon, Oct 12, 2015 at 10:58:03AM -0700, Brian Norris wrote:
>> You missed linux-mtd again. Please use scripts/get_maintainer.pl next
>> time to at least get the relevant mailing list(s). (The individual CC's
>> are not always necessary, but the subsystem lists definitely are.)
>
> Anyway, pushed to l2-mtd.git.
>

Thanks Brian, I'll watch out for that next time.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
  2015-10-12  7:01     ` Daniel Vetter
  (?)
  (?)
@ 2015-10-12 21:12       ` Williams, Dan J
  -1 siblings, 0 replies; 90+ messages in thread
From: Williams, Dan J @ 2015-10-12 21:12 UTC (permalink / raw)
  To: daniel
  Cc: dri-devel, linux-kernel, linux-arch, linux-arm-kernel, intel-gfx,
	Vetter, Daniel, airlied

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 16234 bytes --]

On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> > map it with memremap rather than the implied cache setting of
> > acpi_os_ioremap().
> > 
> > Cc: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> 
> Assuming you've run sparse over this to make sure you've caught them all,
> and with the nit below addressed this is
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Indeed, re-running sparse again found a few conversions of ioread* I
missed as well as moving the force casting out of validate_vbt() to
find_vbt().

> Feel free to pull v2 into whatever tree you think it's suitable for (but
> you can also resend and I'll pick it up).

Please pick up v2 below.

> 
> > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > index e2ab3f6ed022..c8444d5f549f 100644
> > --- a/drivers/gpu/drm/i915/intel_panel.c
> > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
> >  
> >  	/* Assume that the BIOS does not lie through the OpRegion... */
> >  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> > -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> > +		return *(dev_priv->opregion.lid_state) & 0x1 ?
> 
> () are redundant now here.

Yup, fixed.

8<----
Subject: i915: switch from acpi_os_ioremap to memremap

From: Dan Williams <dan.j.williams@intel.com>

i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
map it with memremap rather than the implied cache setting of
acpi_os_ioremap().

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 ++---
 drivers/gpu/drm/i915/intel_bios.c     |   25 +++++-----
 drivers/gpu/drm/i915/intel_opregion.c |   83 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 5 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e3ec9049081f..15989cc16e92 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
 		goto out;
 
 	if (opregion->header) {
-		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
+		memcpy(data, opregion->header, OPREGION_SIZE);
 		seq_write(m, data, OPREGION_SIZE);
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e1db8de52851..d8684634a31d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -444,14 +444,14 @@ struct opregion_swsci;
 struct opregion_asle;
 
 struct intel_opregion {
-	struct opregion_header __iomem *header;
-	struct opregion_acpi __iomem *acpi;
-	struct opregion_swsci __iomem *swsci;
+	struct opregion_header *header;
+	struct opregion_acpi *acpi;
+	struct opregion_swsci *swsci;
 	u32 swsci_gbda_sub_functions;
 	u32 swsci_sbcb_sub_functions;
-	struct opregion_asle __iomem *asle;
-	void __iomem *vbt;
-	u32 __iomem *lid_state;
+	struct opregion_asle *asle;
+	void *vbt;
+	u32 *lid_state;
 	struct work_struct asle_work;
 };
 #define OPREGION_SIZE            (8*1024)
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c19e669ffe50..f6762a5faee8 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1231,20 +1231,13 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {
 	{ }
 };
 
-static const struct bdb_header *validate_vbt(const void __iomem *_base,
+static const struct bdb_header *validate_vbt(const void *base,
 					     size_t size,
-					     const void __iomem *_vbt,
+					     const void *_vbt,
 					     const char *source)
 {
-	/*
-	 * This is the one place where we explicitly discard the address space
-	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
-	 * From now on everything is based on 'base', and treated as regular
-	 * memory.
-	 */
-	const void *base = (const void *) _base;
-	size_t offset = _vbt - _base;
-	const struct vbt_header *vbt = base + offset;
+	size_t offset = _vbt - base;
+	const struct vbt_header *vbt = _vbt;
 	const struct bdb_header *bdb;
 
 	if (offset + sizeof(struct vbt_header) > size) {
@@ -1282,7 +1275,15 @@ static const struct bdb_header *find_vbt(void __iomem *bios, size_t size)
 	/* Scour memory looking for the VBT signature. */
 	for (i = 0; i + 4 < size; i++) {
 		if (ioread32(bios + i) == *((const u32 *) "$VBT")) {
-			bdb = validate_vbt(bios, size, bios + i, "PCI ROM");
+			/*
+			 * This is the one place where we explicitly discard the
+			 * address space (__iomem) of the BIOS/VBT. From now on
+			 * everything is based on 'base', and treated as regular
+			 * memory.
+			 */
+			void *_bios = (void __force *) bios;
+
+			bdb = validate_vbt(_bios, size, _bios + i, "PCI ROM");
 			break;
 		}
 	}
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index cb1c65739425..41d44a5ef626 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -239,7 +239,7 @@ struct opregion_asle {
 static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
+	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
 	u32 main_function, sub_function, scic;
 	u16 pci_swsci;
 	u32 dslp;
@@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* Driver sleep timeout in ms. */
-	dslp = ioread32(&swsci->dslp);
+	dslp = swsci->dslp;
 	if (!dslp) {
 		/* The spec says 2ms should be the default, but it's too small
 		 * for some machines. */
@@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* The spec tells us to do this, but we are the only user... */
-	scic = ioread32(&swsci->scic);
+	scic = swsci->scic;
 	if (scic & SWSCI_SCIC_INDICATOR) {
 		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
 		return -EBUSY;
@@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 
 	scic = function | SWSCI_SCIC_INDICATOR;
 
-	iowrite32(parm, &swsci->parm);
-	iowrite32(scic, &swsci->scic);
+	swsci->parm = parm;
+	swsci->scic = scic;
 
 	/* Ensure SCI event is selected and event trigger is cleared. */
 	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
@@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
 
 	/* Poll for the result. */
-#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
+#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
 	if (wait_for(C, dslp)) {
 		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
 		return -ETIMEDOUT;
@@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	if (parm_out)
-		*parm_out = ioread32(&swsci->parm);
+		*parm_out = swsci->parm;
 
 	return 0;
 
@@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_connector *intel_connector;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
 
@@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
 	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
 		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
-	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
+	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
 
 	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 
@@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
 	struct drm_i915_private *dev_priv =
 		container_of(opregion, struct drm_i915_private, opregion);
 	struct drm_device *dev = dev_priv->dev;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 aslc_stat = 0;
 	u32 aslc_req;
 
 	if (!asle)
 		return;
 
-	aslc_req = ioread32(&asle->aslc);
+	aslc_req = asle->aslc;
 
 	if (!(aslc_req & ASLC_REQ_MSK)) {
 		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
@@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
 	}
 
 	if (aslc_req & ASLC_SET_ALS_ILLUM)
-		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
+		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
 
 	if (aslc_req & ASLC_SET_BACKLIGHT)
-		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
+		aslc_stat |= asle_set_backlight(dev, asle->bclp);
 
 	if (aslc_req & ASLC_SET_PFIT)
-		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
+		aslc_stat |= asle_set_pfit(dev, asle->pfit);
 
 	if (aslc_req & ASLC_SET_PWM_FREQ)
-		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
+		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
 
 	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
 		aslc_stat |= asle_set_supported_rotation_angles(dev,
-							ioread32(&asle->srot));
+							asle->srot);
 
 	if (aslc_req & ASLC_BUTTON_ARRAY)
-		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_button_array(dev, asle->iuer);
 
 	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
-		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_convertible(dev, asle->iuer);
 
 	if (aslc_req & ASLC_DOCKING_INDICATOR)
-		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_docking(dev, asle->iuer);
 
 	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
 		aslc_stat |= asle_isct_state(dev);
 
-	iowrite32(aslc_stat, &asle->aslc);
+	asle->aslc = aslc_stat;
 }
 
 void intel_opregion_asle_intr(struct drm_device *dev)
@@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 	   Linux, these are handled by the dock, button and video drivers.
 	*/
 
-	struct opregion_acpi __iomem *acpi;
 	struct acpi_bus_event *event = data;
+	struct opregion_acpi *acpi;
 	int ret = NOTIFY_OK;
 
 	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
@@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 
 	acpi = system_opregion->acpi;
 
-	if (event->type == 0x80 &&
-	    (ioread32(&acpi->cevt) & 1) == 0)
+	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
 		ret = NOTIFY_BAD;
 
-	iowrite32(0, &acpi->csts);
+	acpi->csts = 0;
 
 	return ret;
 }
@@ -623,14 +622,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
 	u32 did;
 
 	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
-		did = ioread32(&opregion->acpi->didl[i]);
+		did = opregion->acpi->didl[i];
 	} else {
 		i -= ARRAY_SIZE(opregion->acpi->didl);
 
 		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
 			return 0;
 
-		did = ioread32(&opregion->acpi->did2[i]);
+		did = opregion->acpi->did2[i];
 	}
 
 	return did;
@@ -639,14 +638,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
 static void set_did(struct intel_opregion *opregion, int i, u32 val)
 {
 	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
-		iowrite32(val, &opregion->acpi->didl[i]);
+		opregion->acpi->didl[i] = val;
 	} else {
 		i -= ARRAY_SIZE(opregion->acpi->didl);
 
 		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
 			return;
 
-		iowrite32(val, &opregion->acpi->did2[i]);
+		opregion->acpi->did2[i] = val;
 	}
 }
 
@@ -768,7 +767,7 @@ static void intel_setup_cadls(struct drm_device *dev)
 	 * there are less than eight devices. */
 	do {
 		disp_id = get_did(opregion, i);
-		iowrite32(disp_id, &opregion->acpi->cadl[i]);
+		opregion->acpi->cadl[i] = disp_id;
 	} while (++i < 8 && disp_id != 0);
 }
 
@@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
 		/* Notify BIOS we are ready to handle ACPI video ext notifs.
 		 * Right now, all the events are handled by the ACPI video module.
 		 * We don't actually need to do anything with them. */
-		iowrite32(0, &opregion->acpi->csts);
-		iowrite32(1, &opregion->acpi->drdy);
+		opregion->acpi->csts = 0;
+		opregion->acpi->drdy = 1;
 
 		system_opregion = opregion;
 		register_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	if (opregion->asle) {
-		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
-		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
+		opregion->asle->tche = ASLE_TCHE_BLC_EN;
+		opregion->asle->ardy = ASLE_ARDY_READY;
 	}
 }
 
@@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
 		return;
 
 	if (opregion->asle)
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 
 	cancel_work_sync(&dev_priv->opregion.asle_work);
 
 	if (opregion->acpi) {
-		iowrite32(0, &opregion->acpi->drdy);
+		opregion->acpi->drdy = 0;
 
 		system_opregion = NULL;
 		unregister_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	/* just clear all opregion memory pointers now */
-	iounmap(opregion->header);
+	memunmap(opregion->header);
 	opregion->header = NULL;
 	opregion->acpi = NULL;
 	opregion->swsci = NULL;
@@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_opregion *opregion = &dev_priv->opregion;
-	void __iomem *base;
 	u32 asls, mboxes;
 	char buf[sizeof(OPREGION_SIGNATURE)];
 	int err = 0;
+	void *base;
 
 	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
 	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
@@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, asle_work);
 #endif
 
-	base = acpi_os_ioremap(asls, OPREGION_SIZE);
+	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
 	if (!base)
 		return -ENOMEM;
 
-	memcpy_fromio(buf, base, sizeof(buf));
+	memcpy(buf, base, sizeof(buf));
 
 	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
 		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
@@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
 
 	opregion->lid_state = base + ACPI_CLID;
 
-	mboxes = ioread32(&opregion->header->mboxes);
+	mboxes = opregion->header->mboxes;
 	if (mboxes & MBOX_ACPI) {
 		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
 		opregion->acpi = base + OPREGION_ACPI_OFFSET;
@@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
 		DRM_DEBUG_DRIVER("ASLE supported\n");
 		opregion->asle = base + OPREGION_ASLE_OFFSET;
 
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 	}
 
 	return 0;
 
 err_out:
-	iounmap(base);
+	memunmap(base);
 	return err;
 }
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index e2ab3f6ed022..efe5424b290c 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
 
 	/* Assume that the BIOS does not lie through the OpRegion... */
 	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
-		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
+		return *dev_priv->opregion.lid_state & 0x1 ?
 			connector_status_connected :
 			connector_status_disconnected;
 	}

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* Re: [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-12 21:12       ` Williams, Dan J
  0 siblings, 0 replies; 90+ messages in thread
From: Williams, Dan J @ 2015-10-12 21:12 UTC (permalink / raw)
  To: daniel
  Cc: linux-arch, airlied, intel-gfx, linux-kernel, dri-devel, Vetter,
	Daniel, linux-arm-kernel

On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> > map it with memremap rather than the implied cache setting of
> > acpi_os_ioremap().
> > 
> > Cc: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> 
> Assuming you've run sparse over this to make sure you've caught them all,
> and with the nit below addressed this is
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Indeed, re-running sparse again found a few conversions of ioread* I
missed as well as moving the force casting out of validate_vbt() to
find_vbt().

> Feel free to pull v2 into whatever tree you think it's suitable for (but
> you can also resend and I'll pick it up).

Please pick up v2 below.

> 
> > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > index e2ab3f6ed022..c8444d5f549f 100644
> > --- a/drivers/gpu/drm/i915/intel_panel.c
> > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
> >  
> >  	/* Assume that the BIOS does not lie through the OpRegion... */
> >  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> > -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> > +		return *(dev_priv->opregion.lid_state) & 0x1 ?
> 
> () are redundant now here.

Yup, fixed.

8<----
Subject: i915: switch from acpi_os_ioremap to memremap

From: Dan Williams <dan.j.williams@intel.com>

i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
map it with memremap rather than the implied cache setting of
acpi_os_ioremap().

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 ++---
 drivers/gpu/drm/i915/intel_bios.c     |   25 +++++-----
 drivers/gpu/drm/i915/intel_opregion.c |   83 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 5 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e3ec9049081f..15989cc16e92 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
 		goto out;
 
 	if (opregion->header) {
-		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
+		memcpy(data, opregion->header, OPREGION_SIZE);
 		seq_write(m, data, OPREGION_SIZE);
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e1db8de52851..d8684634a31d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -444,14 +444,14 @@ struct opregion_swsci;
 struct opregion_asle;
 
 struct intel_opregion {
-	struct opregion_header __iomem *header;
-	struct opregion_acpi __iomem *acpi;
-	struct opregion_swsci __iomem *swsci;
+	struct opregion_header *header;
+	struct opregion_acpi *acpi;
+	struct opregion_swsci *swsci;
 	u32 swsci_gbda_sub_functions;
 	u32 swsci_sbcb_sub_functions;
-	struct opregion_asle __iomem *asle;
-	void __iomem *vbt;
-	u32 __iomem *lid_state;
+	struct opregion_asle *asle;
+	void *vbt;
+	u32 *lid_state;
 	struct work_struct asle_work;
 };
 #define OPREGION_SIZE            (8*1024)
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c19e669ffe50..f6762a5faee8 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1231,20 +1231,13 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {
 	{ }
 };
 
-static const struct bdb_header *validate_vbt(const void __iomem *_base,
+static const struct bdb_header *validate_vbt(const void *base,
 					     size_t size,
-					     const void __iomem *_vbt,
+					     const void *_vbt,
 					     const char *source)
 {
-	/*
-	 * This is the one place where we explicitly discard the address space
-	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
-	 * From now on everything is based on 'base', and treated as regular
-	 * memory.
-	 */
-	const void *base = (const void *) _base;
-	size_t offset = _vbt - _base;
-	const struct vbt_header *vbt = base + offset;
+	size_t offset = _vbt - base;
+	const struct vbt_header *vbt = _vbt;
 	const struct bdb_header *bdb;
 
 	if (offset + sizeof(struct vbt_header) > size) {
@@ -1282,7 +1275,15 @@ static const struct bdb_header *find_vbt(void __iomem *bios, size_t size)
 	/* Scour memory looking for the VBT signature. */
 	for (i = 0; i + 4 < size; i++) {
 		if (ioread32(bios + i) == *((const u32 *) "$VBT")) {
-			bdb = validate_vbt(bios, size, bios + i, "PCI ROM");
+			/*
+			 * This is the one place where we explicitly discard the
+			 * address space (__iomem) of the BIOS/VBT. From now on
+			 * everything is based on 'base', and treated as regular
+			 * memory.
+			 */
+			void *_bios = (void __force *) bios;
+
+			bdb = validate_vbt(_bios, size, _bios + i, "PCI ROM");
 			break;
 		}
 	}
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index cb1c65739425..41d44a5ef626 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -239,7 +239,7 @@ struct opregion_asle {
 static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
+	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
 	u32 main_function, sub_function, scic;
 	u16 pci_swsci;
 	u32 dslp;
@@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* Driver sleep timeout in ms. */
-	dslp = ioread32(&swsci->dslp);
+	dslp = swsci->dslp;
 	if (!dslp) {
 		/* The spec says 2ms should be the default, but it's too small
 		 * for some machines. */
@@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* The spec tells us to do this, but we are the only user... */
-	scic = ioread32(&swsci->scic);
+	scic = swsci->scic;
 	if (scic & SWSCI_SCIC_INDICATOR) {
 		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
 		return -EBUSY;
@@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 
 	scic = function | SWSCI_SCIC_INDICATOR;
 
-	iowrite32(parm, &swsci->parm);
-	iowrite32(scic, &swsci->scic);
+	swsci->parm = parm;
+	swsci->scic = scic;
 
 	/* Ensure SCI event is selected and event trigger is cleared. */
 	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
@@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
 
 	/* Poll for the result. */
-#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
+#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
 	if (wait_for(C, dslp)) {
 		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
 		return -ETIMEDOUT;
@@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	if (parm_out)
-		*parm_out = ioread32(&swsci->parm);
+		*parm_out = swsci->parm;
 
 	return 0;
 
@@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_connector *intel_connector;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
 
@@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
 	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
 		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
-	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
+	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
 
 	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 
@@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
 	struct drm_i915_private *dev_priv =
 		container_of(opregion, struct drm_i915_private, opregion);
 	struct drm_device *dev = dev_priv->dev;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 aslc_stat = 0;
 	u32 aslc_req;
 
 	if (!asle)
 		return;
 
-	aslc_req = ioread32(&asle->aslc);
+	aslc_req = asle->aslc;
 
 	if (!(aslc_req & ASLC_REQ_MSK)) {
 		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
@@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
 	}
 
 	if (aslc_req & ASLC_SET_ALS_ILLUM)
-		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
+		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
 
 	if (aslc_req & ASLC_SET_BACKLIGHT)
-		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
+		aslc_stat |= asle_set_backlight(dev, asle->bclp);
 
 	if (aslc_req & ASLC_SET_PFIT)
-		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
+		aslc_stat |= asle_set_pfit(dev, asle->pfit);
 
 	if (aslc_req & ASLC_SET_PWM_FREQ)
-		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
+		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
 
 	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
 		aslc_stat |= asle_set_supported_rotation_angles(dev,
-							ioread32(&asle->srot));
+							asle->srot);
 
 	if (aslc_req & ASLC_BUTTON_ARRAY)
-		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_button_array(dev, asle->iuer);
 
 	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
-		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_convertible(dev, asle->iuer);
 
 	if (aslc_req & ASLC_DOCKING_INDICATOR)
-		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_docking(dev, asle->iuer);
 
 	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
 		aslc_stat |= asle_isct_state(dev);
 
-	iowrite32(aslc_stat, &asle->aslc);
+	asle->aslc = aslc_stat;
 }
 
 void intel_opregion_asle_intr(struct drm_device *dev)
@@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 	   Linux, these are handled by the dock, button and video drivers.
 	*/
 
-	struct opregion_acpi __iomem *acpi;
 	struct acpi_bus_event *event = data;
+	struct opregion_acpi *acpi;
 	int ret = NOTIFY_OK;
 
 	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
@@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 
 	acpi = system_opregion->acpi;
 
-	if (event->type == 0x80 &&
-	    (ioread32(&acpi->cevt) & 1) == 0)
+	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
 		ret = NOTIFY_BAD;
 
-	iowrite32(0, &acpi->csts);
+	acpi->csts = 0;
 
 	return ret;
 }
@@ -623,14 +622,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
 	u32 did;
 
 	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
-		did = ioread32(&opregion->acpi->didl[i]);
+		did = opregion->acpi->didl[i];
 	} else {
 		i -= ARRAY_SIZE(opregion->acpi->didl);
 
 		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
 			return 0;
 
-		did = ioread32(&opregion->acpi->did2[i]);
+		did = opregion->acpi->did2[i];
 	}
 
 	return did;
@@ -639,14 +638,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
 static void set_did(struct intel_opregion *opregion, int i, u32 val)
 {
 	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
-		iowrite32(val, &opregion->acpi->didl[i]);
+		opregion->acpi->didl[i] = val;
 	} else {
 		i -= ARRAY_SIZE(opregion->acpi->didl);
 
 		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
 			return;
 
-		iowrite32(val, &opregion->acpi->did2[i]);
+		opregion->acpi->did2[i] = val;
 	}
 }
 
@@ -768,7 +767,7 @@ static void intel_setup_cadls(struct drm_device *dev)
 	 * there are less than eight devices. */
 	do {
 		disp_id = get_did(opregion, i);
-		iowrite32(disp_id, &opregion->acpi->cadl[i]);
+		opregion->acpi->cadl[i] = disp_id;
 	} while (++i < 8 && disp_id != 0);
 }
 
@@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
 		/* Notify BIOS we are ready to handle ACPI video ext notifs.
 		 * Right now, all the events are handled by the ACPI video module.
 		 * We don't actually need to do anything with them. */
-		iowrite32(0, &opregion->acpi->csts);
-		iowrite32(1, &opregion->acpi->drdy);
+		opregion->acpi->csts = 0;
+		opregion->acpi->drdy = 1;
 
 		system_opregion = opregion;
 		register_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	if (opregion->asle) {
-		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
-		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
+		opregion->asle->tche = ASLE_TCHE_BLC_EN;
+		opregion->asle->ardy = ASLE_ARDY_READY;
 	}
 }
 
@@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
 		return;
 
 	if (opregion->asle)
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 
 	cancel_work_sync(&dev_priv->opregion.asle_work);
 
 	if (opregion->acpi) {
-		iowrite32(0, &opregion->acpi->drdy);
+		opregion->acpi->drdy = 0;
 
 		system_opregion = NULL;
 		unregister_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	/* just clear all opregion memory pointers now */
-	iounmap(opregion->header);
+	memunmap(opregion->header);
 	opregion->header = NULL;
 	opregion->acpi = NULL;
 	opregion->swsci = NULL;
@@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_opregion *opregion = &dev_priv->opregion;
-	void __iomem *base;
 	u32 asls, mboxes;
 	char buf[sizeof(OPREGION_SIGNATURE)];
 	int err = 0;
+	void *base;
 
 	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
 	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
@@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, asle_work);
 #endif
 
-	base = acpi_os_ioremap(asls, OPREGION_SIZE);
+	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
 	if (!base)
 		return -ENOMEM;
 
-	memcpy_fromio(buf, base, sizeof(buf));
+	memcpy(buf, base, sizeof(buf));
 
 	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
 		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
@@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
 
 	opregion->lid_state = base + ACPI_CLID;
 
-	mboxes = ioread32(&opregion->header->mboxes);
+	mboxes = opregion->header->mboxes;
 	if (mboxes & MBOX_ACPI) {
 		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
 		opregion->acpi = base + OPREGION_ACPI_OFFSET;
@@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
 		DRM_DEBUG_DRIVER("ASLE supported\n");
 		opregion->asle = base + OPREGION_ASLE_OFFSET;
 
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 	}
 
 	return 0;
 
 err_out:
-	iounmap(base);
+	memunmap(base);
 	return err;
 }
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index e2ab3f6ed022..efe5424b290c 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
 
 	/* Assume that the BIOS does not lie through the OpRegion... */
 	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
-		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
+		return *dev_priv->opregion.lid_state & 0x1 ?
 			connector_status_connected :
 			connector_status_disconnected;
 	}

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-12 21:12       ` Williams, Dan J
  0 siblings, 0 replies; 90+ messages in thread
From: Williams, Dan J @ 2015-10-12 21:12 UTC (permalink / raw)
  To: daniel
  Cc: dri-devel, linux-kernel, linux-arch, linux-arm-kernel, intel-gfx,
	Vetter, Daniel, airlied

On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> > map it with memremap rather than the implied cache setting of
> > acpi_os_ioremap().
> > 
> > Cc: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: intel-gfx@lists.freedesktop.org
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> 
> Assuming you've run sparse over this to make sure you've caught them all,
> and with the nit below addressed this is
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Indeed, re-running sparse again found a few conversions of ioread* I
missed as well as moving the force casting out of validate_vbt() to
find_vbt().

> Feel free to pull v2 into whatever tree you think it's suitable for (but
> you can also resend and I'll pick it up).

Please pick up v2 below.

> 
> > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > index e2ab3f6ed022..c8444d5f549f 100644
> > --- a/drivers/gpu/drm/i915/intel_panel.c
> > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
> >  
> >  	/* Assume that the BIOS does not lie through the OpRegion... */
> >  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> > -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> > +		return *(dev_priv->opregion.lid_state) & 0x1 ?
> 
> () are redundant now here.

Yup, fixed.

8<----
Subject: i915: switch from acpi_os_ioremap to memremap

From: Dan Williams <dan.j.williams@intel.com>

i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
map it with memremap rather than the implied cache setting of
acpi_os_ioremap().

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 ++---
 drivers/gpu/drm/i915/intel_bios.c     |   25 +++++-----
 drivers/gpu/drm/i915/intel_opregion.c |   83 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 5 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e3ec9049081f..15989cc16e92 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
 		goto out;
 
 	if (opregion->header) {
-		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
+		memcpy(data, opregion->header, OPREGION_SIZE);
 		seq_write(m, data, OPREGION_SIZE);
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e1db8de52851..d8684634a31d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -444,14 +444,14 @@ struct opregion_swsci;
 struct opregion_asle;
 
 struct intel_opregion {
-	struct opregion_header __iomem *header;
-	struct opregion_acpi __iomem *acpi;
-	struct opregion_swsci __iomem *swsci;
+	struct opregion_header *header;
+	struct opregion_acpi *acpi;
+	struct opregion_swsci *swsci;
 	u32 swsci_gbda_sub_functions;
 	u32 swsci_sbcb_sub_functions;
-	struct opregion_asle __iomem *asle;
-	void __iomem *vbt;
-	u32 __iomem *lid_state;
+	struct opregion_asle *asle;
+	void *vbt;
+	u32 *lid_state;
 	struct work_struct asle_work;
 };
 #define OPREGION_SIZE            (8*1024)
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c19e669ffe50..f6762a5faee8 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1231,20 +1231,13 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {
 	{ }
 };
 
-static const struct bdb_header *validate_vbt(const void __iomem *_base,
+static const struct bdb_header *validate_vbt(const void *base,
 					     size_t size,
-					     const void __iomem *_vbt,
+					     const void *_vbt,
 					     const char *source)
 {
-	/*
-	 * This is the one place where we explicitly discard the address space
-	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
-	 * From now on everything is based on 'base', and treated as regular
-	 * memory.
-	 */
-	const void *base = (const void *) _base;
-	size_t offset = _vbt - _base;
-	const struct vbt_header *vbt = base + offset;
+	size_t offset = _vbt - base;
+	const struct vbt_header *vbt = _vbt;
 	const struct bdb_header *bdb;
 
 	if (offset + sizeof(struct vbt_header) > size) {
@@ -1282,7 +1275,15 @@ static const struct bdb_header *find_vbt(void __iomem *bios, size_t size)
 	/* Scour memory looking for the VBT signature. */
 	for (i = 0; i + 4 < size; i++) {
 		if (ioread32(bios + i) == *((const u32 *) "$VBT")) {
-			bdb = validate_vbt(bios, size, bios + i, "PCI ROM");
+			/*
+			 * This is the one place where we explicitly discard the
+			 * address space (__iomem) of the BIOS/VBT. From now on
+			 * everything is based on 'base', and treated as regular
+			 * memory.
+			 */
+			void *_bios = (void __force *) bios;
+
+			bdb = validate_vbt(_bios, size, _bios + i, "PCI ROM");
 			break;
 		}
 	}
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index cb1c65739425..41d44a5ef626 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -239,7 +239,7 @@ struct opregion_asle {
 static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
+	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
 	u32 main_function, sub_function, scic;
 	u16 pci_swsci;
 	u32 dslp;
@@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* Driver sleep timeout in ms. */
-	dslp = ioread32(&swsci->dslp);
+	dslp = swsci->dslp;
 	if (!dslp) {
 		/* The spec says 2ms should be the default, but it's too small
 		 * for some machines. */
@@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* The spec tells us to do this, but we are the only user... */
-	scic = ioread32(&swsci->scic);
+	scic = swsci->scic;
 	if (scic & SWSCI_SCIC_INDICATOR) {
 		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
 		return -EBUSY;
@@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 
 	scic = function | SWSCI_SCIC_INDICATOR;
 
-	iowrite32(parm, &swsci->parm);
-	iowrite32(scic, &swsci->scic);
+	swsci->parm = parm;
+	swsci->scic = scic;
 
 	/* Ensure SCI event is selected and event trigger is cleared. */
 	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
@@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
 
 	/* Poll for the result. */
-#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
+#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
 	if (wait_for(C, dslp)) {
 		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
 		return -ETIMEDOUT;
@@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	if (parm_out)
-		*parm_out = ioread32(&swsci->parm);
+		*parm_out = swsci->parm;
 
 	return 0;
 
@@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_connector *intel_connector;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
 
@@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
 	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
 		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
-	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
+	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
 
 	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 
@@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
 	struct drm_i915_private *dev_priv =
 		container_of(opregion, struct drm_i915_private, opregion);
 	struct drm_device *dev = dev_priv->dev;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 aslc_stat = 0;
 	u32 aslc_req;
 
 	if (!asle)
 		return;
 
-	aslc_req = ioread32(&asle->aslc);
+	aslc_req = asle->aslc;
 
 	if (!(aslc_req & ASLC_REQ_MSK)) {
 		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
@@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
 	}
 
 	if (aslc_req & ASLC_SET_ALS_ILLUM)
-		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
+		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
 
 	if (aslc_req & ASLC_SET_BACKLIGHT)
-		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
+		aslc_stat |= asle_set_backlight(dev, asle->bclp);
 
 	if (aslc_req & ASLC_SET_PFIT)
-		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
+		aslc_stat |= asle_set_pfit(dev, asle->pfit);
 
 	if (aslc_req & ASLC_SET_PWM_FREQ)
-		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
+		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
 
 	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
 		aslc_stat |= asle_set_supported_rotation_angles(dev,
-							ioread32(&asle->srot));
+							asle->srot);
 
 	if (aslc_req & ASLC_BUTTON_ARRAY)
-		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_button_array(dev, asle->iuer);
 
 	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
-		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_convertible(dev, asle->iuer);
 
 	if (aslc_req & ASLC_DOCKING_INDICATOR)
-		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_docking(dev, asle->iuer);
 
 	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
 		aslc_stat |= asle_isct_state(dev);
 
-	iowrite32(aslc_stat, &asle->aslc);
+	asle->aslc = aslc_stat;
 }
 
 void intel_opregion_asle_intr(struct drm_device *dev)
@@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 	   Linux, these are handled by the dock, button and video drivers.
 	*/
 
-	struct opregion_acpi __iomem *acpi;
 	struct acpi_bus_event *event = data;
+	struct opregion_acpi *acpi;
 	int ret = NOTIFY_OK;
 
 	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
@@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 
 	acpi = system_opregion->acpi;
 
-	if (event->type == 0x80 &&
-	    (ioread32(&acpi->cevt) & 1) == 0)
+	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
 		ret = NOTIFY_BAD;
 
-	iowrite32(0, &acpi->csts);
+	acpi->csts = 0;
 
 	return ret;
 }
@@ -623,14 +622,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
 	u32 did;
 
 	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
-		did = ioread32(&opregion->acpi->didl[i]);
+		did = opregion->acpi->didl[i];
 	} else {
 		i -= ARRAY_SIZE(opregion->acpi->didl);
 
 		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
 			return 0;
 
-		did = ioread32(&opregion->acpi->did2[i]);
+		did = opregion->acpi->did2[i];
 	}
 
 	return did;
@@ -639,14 +638,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
 static void set_did(struct intel_opregion *opregion, int i, u32 val)
 {
 	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
-		iowrite32(val, &opregion->acpi->didl[i]);
+		opregion->acpi->didl[i] = val;
 	} else {
 		i -= ARRAY_SIZE(opregion->acpi->didl);
 
 		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
 			return;
 
-		iowrite32(val, &opregion->acpi->did2[i]);
+		opregion->acpi->did2[i] = val;
 	}
 }
 
@@ -768,7 +767,7 @@ static void intel_setup_cadls(struct drm_device *dev)
 	 * there are less than eight devices. */
 	do {
 		disp_id = get_did(opregion, i);
-		iowrite32(disp_id, &opregion->acpi->cadl[i]);
+		opregion->acpi->cadl[i] = disp_id;
 	} while (++i < 8 && disp_id != 0);
 }
 
@@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
 		/* Notify BIOS we are ready to handle ACPI video ext notifs.
 		 * Right now, all the events are handled by the ACPI video module.
 		 * We don't actually need to do anything with them. */
-		iowrite32(0, &opregion->acpi->csts);
-		iowrite32(1, &opregion->acpi->drdy);
+		opregion->acpi->csts = 0;
+		opregion->acpi->drdy = 1;
 
 		system_opregion = opregion;
 		register_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	if (opregion->asle) {
-		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
-		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
+		opregion->asle->tche = ASLE_TCHE_BLC_EN;
+		opregion->asle->ardy = ASLE_ARDY_READY;
 	}
 }
 
@@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
 		return;
 
 	if (opregion->asle)
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 
 	cancel_work_sync(&dev_priv->opregion.asle_work);
 
 	if (opregion->acpi) {
-		iowrite32(0, &opregion->acpi->drdy);
+		opregion->acpi->drdy = 0;
 
 		system_opregion = NULL;
 		unregister_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	/* just clear all opregion memory pointers now */
-	iounmap(opregion->header);
+	memunmap(opregion->header);
 	opregion->header = NULL;
 	opregion->acpi = NULL;
 	opregion->swsci = NULL;
@@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_opregion *opregion = &dev_priv->opregion;
-	void __iomem *base;
 	u32 asls, mboxes;
 	char buf[sizeof(OPREGION_SIGNATURE)];
 	int err = 0;
+	void *base;
 
 	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
 	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
@@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, asle_work);
 #endif
 
-	base = acpi_os_ioremap(asls, OPREGION_SIZE);
+	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
 	if (!base)
 		return -ENOMEM;
 
-	memcpy_fromio(buf, base, sizeof(buf));
+	memcpy(buf, base, sizeof(buf));
 
 	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
 		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
@@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
 
 	opregion->lid_state = base + ACPI_CLID;
 
-	mboxes = ioread32(&opregion->header->mboxes);
+	mboxes = opregion->header->mboxes;
 	if (mboxes & MBOX_ACPI) {
 		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
 		opregion->acpi = base + OPREGION_ACPI_OFFSET;
@@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
 		DRM_DEBUG_DRIVER("ASLE supported\n");
 		opregion->asle = base + OPREGION_ASLE_OFFSET;
 
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 	}
 
 	return 0;
 
 err_out:
-	iounmap(base);
+	memunmap(base);
 	return err;
 }
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index e2ab3f6ed022..efe5424b290c 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
 
 	/* Assume that the BIOS does not lie through the OpRegion... */
 	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
-		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
+		return *dev_priv->opregion.lid_state & 0x1 ?
 			connector_status_connected :
 			connector_status_disconnected;
 	}


^ permalink raw reply related	[flat|nested] 90+ messages in thread

* [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-12 21:12       ` Williams, Dan J
  0 siblings, 0 replies; 90+ messages in thread
From: Williams, Dan J @ 2015-10-12 21:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> > map it with memremap rather than the implied cache setting of
> > acpi_os_ioremap().
> > 
> > Cc: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: intel-gfx at lists.freedesktop.org
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel at lists.freedesktop.org
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> 
> Assuming you've run sparse over this to make sure you've caught them all,
> and with the nit below addressed this is
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Indeed, re-running sparse again found a few conversions of ioread* I
missed as well as moving the force casting out of validate_vbt() to
find_vbt().

> Feel free to pull v2 into whatever tree you think it's suitable for (but
> you can also resend and I'll pick it up).

Please pick up v2 below.

> 
> > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > index e2ab3f6ed022..c8444d5f549f 100644
> > --- a/drivers/gpu/drm/i915/intel_panel.c
> > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
> >  
> >  	/* Assume that the BIOS does not lie through the OpRegion... */
> >  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> > -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> > +		return *(dev_priv->opregion.lid_state) & 0x1 ?
> 
> () are redundant now here.

Yup, fixed.

8<----
Subject: i915: switch from acpi_os_ioremap to memremap

From: Dan Williams <dan.j.williams@intel.com>

i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
map it with memremap rather than the implied cache setting of
acpi_os_ioremap().

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx at lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
 drivers/gpu/drm/i915/i915_drv.h       |   12 ++---
 drivers/gpu/drm/i915/intel_bios.c     |   25 +++++-----
 drivers/gpu/drm/i915/intel_opregion.c |   83 ++++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_panel.c    |    2 -
 5 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e3ec9049081f..15989cc16e92 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
 		goto out;
 
 	if (opregion->header) {
-		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
+		memcpy(data, opregion->header, OPREGION_SIZE);
 		seq_write(m, data, OPREGION_SIZE);
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e1db8de52851..d8684634a31d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -444,14 +444,14 @@ struct opregion_swsci;
 struct opregion_asle;
 
 struct intel_opregion {
-	struct opregion_header __iomem *header;
-	struct opregion_acpi __iomem *acpi;
-	struct opregion_swsci __iomem *swsci;
+	struct opregion_header *header;
+	struct opregion_acpi *acpi;
+	struct opregion_swsci *swsci;
 	u32 swsci_gbda_sub_functions;
 	u32 swsci_sbcb_sub_functions;
-	struct opregion_asle __iomem *asle;
-	void __iomem *vbt;
-	u32 __iomem *lid_state;
+	struct opregion_asle *asle;
+	void *vbt;
+	u32 *lid_state;
 	struct work_struct asle_work;
 };
 #define OPREGION_SIZE            (8*1024)
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c19e669ffe50..f6762a5faee8 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1231,20 +1231,13 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {
 	{ }
 };
 
-static const struct bdb_header *validate_vbt(const void __iomem *_base,
+static const struct bdb_header *validate_vbt(const void *base,
 					     size_t size,
-					     const void __iomem *_vbt,
+					     const void *_vbt,
 					     const char *source)
 {
-	/*
-	 * This is the one place where we explicitly discard the address space
-	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
-	 * From now on everything is based on 'base', and treated as regular
-	 * memory.
-	 */
-	const void *base = (const void *) _base;
-	size_t offset = _vbt - _base;
-	const struct vbt_header *vbt = base + offset;
+	size_t offset = _vbt - base;
+	const struct vbt_header *vbt = _vbt;
 	const struct bdb_header *bdb;
 
 	if (offset + sizeof(struct vbt_header) > size) {
@@ -1282,7 +1275,15 @@ static const struct bdb_header *find_vbt(void __iomem *bios, size_t size)
 	/* Scour memory looking for the VBT signature. */
 	for (i = 0; i + 4 < size; i++) {
 		if (ioread32(bios + i) == *((const u32 *) "$VBT")) {
-			bdb = validate_vbt(bios, size, bios + i, "PCI ROM");
+			/*
+			 * This is the one place where we explicitly discard the
+			 * address space (__iomem) of the BIOS/VBT. From now on
+			 * everything is based on 'base', and treated as regular
+			 * memory.
+			 */
+			void *_bios = (void __force *) bios;
+
+			bdb = validate_vbt(_bios, size, _bios + i, "PCI ROM");
 			break;
 		}
 	}
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index cb1c65739425..41d44a5ef626 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -239,7 +239,7 @@ struct opregion_asle {
 static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
+	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
 	u32 main_function, sub_function, scic;
 	u16 pci_swsci;
 	u32 dslp;
@@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* Driver sleep timeout in ms. */
-	dslp = ioread32(&swsci->dslp);
+	dslp = swsci->dslp;
 	if (!dslp) {
 		/* The spec says 2ms should be the default, but it's too small
 		 * for some machines. */
@@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	/* The spec tells us to do this, but we are the only user... */
-	scic = ioread32(&swsci->scic);
+	scic = swsci->scic;
 	if (scic & SWSCI_SCIC_INDICATOR) {
 		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
 		return -EBUSY;
@@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 
 	scic = function | SWSCI_SCIC_INDICATOR;
 
-	iowrite32(parm, &swsci->parm);
-	iowrite32(scic, &swsci->scic);
+	swsci->parm = parm;
+	swsci->scic = scic;
 
 	/* Ensure SCI event is selected and event trigger is cleared. */
 	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
@@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
 
 	/* Poll for the result. */
-#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
+#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
 	if (wait_for(C, dslp)) {
 		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
 		return -ETIMEDOUT;
@@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
 	}
 
 	if (parm_out)
-		*parm_out = ioread32(&swsci->parm);
+		*parm_out = swsci->parm;
 
 	return 0;
 
@@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_connector *intel_connector;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
 
@@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
 	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
 		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
-	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
+	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
 
 	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 
@@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
 	struct drm_i915_private *dev_priv =
 		container_of(opregion, struct drm_i915_private, opregion);
 	struct drm_device *dev = dev_priv->dev;
-	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 aslc_stat = 0;
 	u32 aslc_req;
 
 	if (!asle)
 		return;
 
-	aslc_req = ioread32(&asle->aslc);
+	aslc_req = asle->aslc;
 
 	if (!(aslc_req & ASLC_REQ_MSK)) {
 		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
@@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
 	}
 
 	if (aslc_req & ASLC_SET_ALS_ILLUM)
-		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
+		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
 
 	if (aslc_req & ASLC_SET_BACKLIGHT)
-		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
+		aslc_stat |= asle_set_backlight(dev, asle->bclp);
 
 	if (aslc_req & ASLC_SET_PFIT)
-		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
+		aslc_stat |= asle_set_pfit(dev, asle->pfit);
 
 	if (aslc_req & ASLC_SET_PWM_FREQ)
-		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
+		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
 
 	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
 		aslc_stat |= asle_set_supported_rotation_angles(dev,
-							ioread32(&asle->srot));
+							asle->srot);
 
 	if (aslc_req & ASLC_BUTTON_ARRAY)
-		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_button_array(dev, asle->iuer);
 
 	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
-		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_convertible(dev, asle->iuer);
 
 	if (aslc_req & ASLC_DOCKING_INDICATOR)
-		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
+		aslc_stat |= asle_set_docking(dev, asle->iuer);
 
 	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
 		aslc_stat |= asle_isct_state(dev);
 
-	iowrite32(aslc_stat, &asle->aslc);
+	asle->aslc = aslc_stat;
 }
 
 void intel_opregion_asle_intr(struct drm_device *dev)
@@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 	   Linux, these are handled by the dock, button and video drivers.
 	*/
 
-	struct opregion_acpi __iomem *acpi;
 	struct acpi_bus_event *event = data;
+	struct opregion_acpi *acpi;
 	int ret = NOTIFY_OK;
 
 	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
@@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
 
 	acpi = system_opregion->acpi;
 
-	if (event->type == 0x80 &&
-	    (ioread32(&acpi->cevt) & 1) == 0)
+	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
 		ret = NOTIFY_BAD;
 
-	iowrite32(0, &acpi->csts);
+	acpi->csts = 0;
 
 	return ret;
 }
@@ -623,14 +622,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
 	u32 did;
 
 	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
-		did = ioread32(&opregion->acpi->didl[i]);
+		did = opregion->acpi->didl[i];
 	} else {
 		i -= ARRAY_SIZE(opregion->acpi->didl);
 
 		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
 			return 0;
 
-		did = ioread32(&opregion->acpi->did2[i]);
+		did = opregion->acpi->did2[i];
 	}
 
 	return did;
@@ -639,14 +638,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
 static void set_did(struct intel_opregion *opregion, int i, u32 val)
 {
 	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
-		iowrite32(val, &opregion->acpi->didl[i]);
+		opregion->acpi->didl[i] = val;
 	} else {
 		i -= ARRAY_SIZE(opregion->acpi->didl);
 
 		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
 			return;
 
-		iowrite32(val, &opregion->acpi->did2[i]);
+		opregion->acpi->did2[i] = val;
 	}
 }
 
@@ -768,7 +767,7 @@ static void intel_setup_cadls(struct drm_device *dev)
 	 * there are less than eight devices. */
 	do {
 		disp_id = get_did(opregion, i);
-		iowrite32(disp_id, &opregion->acpi->cadl[i]);
+		opregion->acpi->cadl[i] = disp_id;
 	} while (++i < 8 && disp_id != 0);
 }
 
@@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
 		/* Notify BIOS we are ready to handle ACPI video ext notifs.
 		 * Right now, all the events are handled by the ACPI video module.
 		 * We don't actually need to do anything with them. */
-		iowrite32(0, &opregion->acpi->csts);
-		iowrite32(1, &opregion->acpi->drdy);
+		opregion->acpi->csts = 0;
+		opregion->acpi->drdy = 1;
 
 		system_opregion = opregion;
 		register_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	if (opregion->asle) {
-		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
-		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
+		opregion->asle->tche = ASLE_TCHE_BLC_EN;
+		opregion->asle->ardy = ASLE_ARDY_READY;
 	}
 }
 
@@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
 		return;
 
 	if (opregion->asle)
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 
 	cancel_work_sync(&dev_priv->opregion.asle_work);
 
 	if (opregion->acpi) {
-		iowrite32(0, &opregion->acpi->drdy);
+		opregion->acpi->drdy = 0;
 
 		system_opregion = NULL;
 		unregister_acpi_notifier(&intel_opregion_notifier);
 	}
 
 	/* just clear all opregion memory pointers now */
-	iounmap(opregion->header);
+	memunmap(opregion->header);
 	opregion->header = NULL;
 	opregion->acpi = NULL;
 	opregion->swsci = NULL;
@@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_opregion *opregion = &dev_priv->opregion;
-	void __iomem *base;
 	u32 asls, mboxes;
 	char buf[sizeof(OPREGION_SIGNATURE)];
 	int err = 0;
+	void *base;
 
 	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
 	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
@@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
 	INIT_WORK(&opregion->asle_work, asle_work);
 #endif
 
-	base = acpi_os_ioremap(asls, OPREGION_SIZE);
+	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
 	if (!base)
 		return -ENOMEM;
 
-	memcpy_fromio(buf, base, sizeof(buf));
+	memcpy(buf, base, sizeof(buf));
 
 	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
 		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
@@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
 
 	opregion->lid_state = base + ACPI_CLID;
 
-	mboxes = ioread32(&opregion->header->mboxes);
+	mboxes = opregion->header->mboxes;
 	if (mboxes & MBOX_ACPI) {
 		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
 		opregion->acpi = base + OPREGION_ACPI_OFFSET;
@@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
 		DRM_DEBUG_DRIVER("ASLE supported\n");
 		opregion->asle = base + OPREGION_ASLE_OFFSET;
 
-		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
+		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
 	}
 
 	return 0;
 
 err_out:
-	iounmap(base);
+	memunmap(base);
 	return err;
 }
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index e2ab3f6ed022..efe5424b290c 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
 
 	/* Assume that the BIOS does not lie through the OpRegion... */
 	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
-		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
+		return *dev_priv->opregion.lid_state & 0x1 ?
 			connector_status_connected :
 			connector_status_disconnected;
 	}

^ permalink raw reply related	[flat|nested] 90+ messages in thread

* Re: [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
  2015-10-09 22:16   ` Dan Williams
@ 2015-10-12 21:58     ` Joerg Roedel
  -1 siblings, 0 replies; 90+ messages in thread
From: Joerg Roedel @ 2015-10-12 21:58 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel

Hi Dan,

On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
> In preparation for deprecating ioremap_cache() convert its usage in
> intel-iommu to memremap.  This also eliminates the mishandling of the
> __iomem annotation in the implementation.

I appreciate the change, but in the cover letter you write the API is
only implemented for x86 so far? The VT-d driver is also used on ia64,
will it still work there with this patch?


	Joerg


^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
@ 2015-10-12 21:58     ` Joerg Roedel
  0 siblings, 0 replies; 90+ messages in thread
From: Joerg Roedel @ 2015-10-12 21:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Dan,

On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
> In preparation for deprecating ioremap_cache() convert its usage in
> intel-iommu to memremap.  This also eliminates the mishandling of the
> __iomem annotation in the implementation.

I appreciate the change, but in the cover letter you write the API is
only implemented for x86 so far? The VT-d driver is also used on ia64,
will it still work there with this patch?


	Joerg

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
  2015-10-12 21:58     ` Joerg Roedel
  (?)
@ 2015-10-12 22:05       ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-12 22:05 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel

On Mon, Oct 12, 2015 at 2:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
> Hi Dan,
>
> On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
>> In preparation for deprecating ioremap_cache() convert its usage in
>> intel-iommu to memremap.  This also eliminates the mishandling of the
>> __iomem annotation in the implementation.
>
> I appreciate the change, but in the cover letter you write the API is
> only implemented for x86 so far? The VT-d driver is also used on ia64,
> will it still work there with this patch?
>
>

I did convert ia64 in the series [1]  but you're right this patch
can't go in independently of that conversion.  If you ack this one
I'll carry them in order.

[1]: https://lkml.org/lkml/2015/10/9/702

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
@ 2015-10-12 22:05       ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-12 22:05 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel

On Mon, Oct 12, 2015 at 2:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
> Hi Dan,
>
> On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
>> In preparation for deprecating ioremap_cache() convert its usage in
>> intel-iommu to memremap.  This also eliminates the mishandling of the
>> __iomem annotation in the implementation.
>
> I appreciate the change, but in the cover letter you write the API is
> only implemented for x86 so far? The VT-d driver is also used on ia64,
> will it still work there with this patch?
>
>

I did convert ia64 in the series [1]  but you're right this patch
can't go in independently of that conversion.  If you ack this one
I'll carry them in order.

[1]: https://lkml.org/lkml/2015/10/9/702

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
@ 2015-10-12 22:05       ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-12 22:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 12, 2015 at 2:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
> Hi Dan,
>
> On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
>> In preparation for deprecating ioremap_cache() convert its usage in
>> intel-iommu to memremap.  This also eliminates the mishandling of the
>> __iomem annotation in the implementation.
>
> I appreciate the change, but in the cover letter you write the API is
> only implemented for x86 so far? The VT-d driver is also used on ia64,
> will it still work there with this patch?
>
>

I did convert ia64 in the series [1]  but you're right this patch
can't go in independently of that conversion.  If you ack this one
I'll carry them in order.

[1]: https://lkml.org/lkml/2015/10/9/702

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
  2015-10-12 22:05       ` Dan Williams
  (?)
@ 2015-10-12 22:19         ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-12 22:19 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel

On Mon, Oct 12, 2015 at 3:05 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Mon, Oct 12, 2015 at 2:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
>> Hi Dan,
>>
>> On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
>>> In preparation for deprecating ioremap_cache() convert its usage in
>>> intel-iommu to memremap.  This also eliminates the mishandling of the
>>> __iomem annotation in the implementation.
>>
>> I appreciate the change, but in the cover letter you write the API is
>> only implemented for x86 so far? The VT-d driver is also used on ia64,
>> will it still work there with this patch?
>>
>>
>
> I did convert ia64 in the series [1]  but you're right this patch
> can't go in independently of that conversion.  If you ack this one
> I'll carry them in order.
>
> [1]: https://lkml.org/lkml/2015/10/9/702

Ah sorry, got ahead of myself ;-p.  You can safely take this patch
through your tree.  The ia64 patch can happen asynchronously because
kernel/memremap.c has:

__weak void *arch_memremap(resource_size_t offset, size_t size,
unsigned long flags)

...as a temporary fallback until the conversion is complete.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
@ 2015-10-12 22:19         ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-12 22:19 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel

On Mon, Oct 12, 2015 at 3:05 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Mon, Oct 12, 2015 at 2:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
>> Hi Dan,
>>
>> On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
>>> In preparation for deprecating ioremap_cache() convert its usage in
>>> intel-iommu to memremap.  This also eliminates the mishandling of the
>>> __iomem annotation in the implementation.
>>
>> I appreciate the change, but in the cover letter you write the API is
>> only implemented for x86 so far? The VT-d driver is also used on ia64,
>> will it still work there with this patch?
>>
>>
>
> I did convert ia64 in the series [1]  but you're right this patch
> can't go in independently of that conversion.  If you ack this one
> I'll carry them in order.
>
> [1]: https://lkml.org/lkml/2015/10/9/702

Ah sorry, got ahead of myself ;-p.  You can safely take this patch
through your tree.  The ia64 patch can happen asynchronously because
kernel/memremap.c has:

__weak void *arch_memremap(resource_size_t offset, size_t size,
unsigned long flags)

...as a temporary fallback until the conversion is complete.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
@ 2015-10-12 22:19         ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-12 22:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 12, 2015 at 3:05 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Mon, Oct 12, 2015 at 2:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
>> Hi Dan,
>>
>> On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
>>> In preparation for deprecating ioremap_cache() convert its usage in
>>> intel-iommu to memremap.  This also eliminates the mishandling of the
>>> __iomem annotation in the implementation.
>>
>> I appreciate the change, but in the cover letter you write the API is
>> only implemented for x86 so far? The VT-d driver is also used on ia64,
>> will it still work there with this patch?
>>
>>
>
> I did convert ia64 in the series [1]  but you're right this patch
> can't go in independently of that conversion.  If you ack this one
> I'll carry them in order.
>
> [1]: https://lkml.org/lkml/2015/10/9/702

Ah sorry, got ahead of myself ;-p.  You can safely take this patch
through your tree.  The ia64 patch can happen asynchronously because
kernel/memremap.c has:

__weak void *arch_memremap(resource_size_t offset, size_t size,
unsigned long flags)

...as a temporary fallback until the conversion is complete.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
  2015-10-12 21:12       ` Williams, Dan J
  (?)
@ 2015-10-13  8:24         ` Daniel Vetter
  -1 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2015-10-13  8:24 UTC (permalink / raw)
  To: Williams, Dan J
  Cc: daniel, dri-devel, linux-kernel, linux-arch, linux-arm-kernel,
	intel-gfx, Vetter, Daniel, airlied

On Mon, Oct 12, 2015 at 09:12:57PM +0000, Williams, Dan J wrote:
> On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> > On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> > > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> > > map it with memremap rather than the implied cache setting of
> > > acpi_os_ioremap().
> > > 
> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > > Cc: intel-gfx@lists.freedesktop.org
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> > 
> > Assuming you've run sparse over this to make sure you've caught them all,
> > and with the nit below addressed this is
> > 
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Indeed, re-running sparse again found a few conversions of ioread* I
> missed as well as moving the force casting out of validate_vbt() to
> find_vbt().
> 
> > Feel free to pull v2 into whatever tree you think it's suitable for (but
> > you can also resend and I'll pick it up).
> 
> Please pick up v2 below.

Queued for -next, thanks for the patch. Aside: Attached or separate mail
seems easier, somehow git apply-mbox can't auto-eat this for of patch.
-Daniel

> 
> > 
> > > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > > index e2ab3f6ed022..c8444d5f549f 100644
> > > --- a/drivers/gpu/drm/i915/intel_panel.c
> > > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > > @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
> > >  
> > >  	/* Assume that the BIOS does not lie through the OpRegion... */
> > >  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> > > -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> > > +		return *(dev_priv->opregion.lid_state) & 0x1 ?
> > 
> > () are redundant now here.
> 
> Yup, fixed.
> 
> 8<----
> Subject: i915: switch from acpi_os_ioremap to memremap
> 
> From: Dan Williams <dan.j.williams@intel.com>
> 
> i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> map it with memremap rather than the implied cache setting of
> acpi_os_ioremap().
> 
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
>  drivers/gpu/drm/i915/i915_drv.h       |   12 ++---
>  drivers/gpu/drm/i915/intel_bios.c     |   25 +++++-----
>  drivers/gpu/drm/i915/intel_opregion.c |   83 ++++++++++++++++-----------------
>  drivers/gpu/drm/i915/intel_panel.c    |    2 -
>  5 files changed, 62 insertions(+), 62 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index e3ec9049081f..15989cc16e92 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
>  		goto out;
>  
>  	if (opregion->header) {
> -		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
> +		memcpy(data, opregion->header, OPREGION_SIZE);
>  		seq_write(m, data, OPREGION_SIZE);
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e1db8de52851..d8684634a31d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -444,14 +444,14 @@ struct opregion_swsci;
>  struct opregion_asle;
>  
>  struct intel_opregion {
> -	struct opregion_header __iomem *header;
> -	struct opregion_acpi __iomem *acpi;
> -	struct opregion_swsci __iomem *swsci;
> +	struct opregion_header *header;
> +	struct opregion_acpi *acpi;
> +	struct opregion_swsci *swsci;
>  	u32 swsci_gbda_sub_functions;
>  	u32 swsci_sbcb_sub_functions;
> -	struct opregion_asle __iomem *asle;
> -	void __iomem *vbt;
> -	u32 __iomem *lid_state;
> +	struct opregion_asle *asle;
> +	void *vbt;
> +	u32 *lid_state;
>  	struct work_struct asle_work;
>  };
>  #define OPREGION_SIZE            (8*1024)
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index c19e669ffe50..f6762a5faee8 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1231,20 +1231,13 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {
>  	{ }
>  };
>  
> -static const struct bdb_header *validate_vbt(const void __iomem *_base,
> +static const struct bdb_header *validate_vbt(const void *base,
>  					     size_t size,
> -					     const void __iomem *_vbt,
> +					     const void *_vbt,
>  					     const char *source)
>  {
> -	/*
> -	 * This is the one place where we explicitly discard the address space
> -	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
> -	 * From now on everything is based on 'base', and treated as regular
> -	 * memory.
> -	 */
> -	const void *base = (const void *) _base;
> -	size_t offset = _vbt - _base;
> -	const struct vbt_header *vbt = base + offset;
> +	size_t offset = _vbt - base;
> +	const struct vbt_header *vbt = _vbt;
>  	const struct bdb_header *bdb;
>  
>  	if (offset + sizeof(struct vbt_header) > size) {
> @@ -1282,7 +1275,15 @@ static const struct bdb_header *find_vbt(void __iomem *bios, size_t size)
>  	/* Scour memory looking for the VBT signature. */
>  	for (i = 0; i + 4 < size; i++) {
>  		if (ioread32(bios + i) == *((const u32 *) "$VBT")) {
> -			bdb = validate_vbt(bios, size, bios + i, "PCI ROM");
> +			/*
> +			 * This is the one place where we explicitly discard the
> +			 * address space (__iomem) of the BIOS/VBT. From now on
> +			 * everything is based on 'base', and treated as regular
> +			 * memory.
> +			 */
> +			void *_bios = (void __force *) bios;
> +
> +			bdb = validate_vbt(_bios, size, _bios + i, "PCI ROM");
>  			break;
>  		}
>  	}
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index cb1c65739425..41d44a5ef626 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -239,7 +239,7 @@ struct opregion_asle {
>  static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
> +	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
>  	u32 main_function, sub_function, scic;
>  	u16 pci_swsci;
>  	u32 dslp;
> @@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	}
>  
>  	/* Driver sleep timeout in ms. */
> -	dslp = ioread32(&swsci->dslp);
> +	dslp = swsci->dslp;
>  	if (!dslp) {
>  		/* The spec says 2ms should be the default, but it's too small
>  		 * for some machines. */
> @@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	}
>  
>  	/* The spec tells us to do this, but we are the only user... */
> -	scic = ioread32(&swsci->scic);
> +	scic = swsci->scic;
>  	if (scic & SWSCI_SCIC_INDICATOR) {
>  		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
>  		return -EBUSY;
> @@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  
>  	scic = function | SWSCI_SCIC_INDICATOR;
>  
> -	iowrite32(parm, &swsci->parm);
> -	iowrite32(scic, &swsci->scic);
> +	swsci->parm = parm;
> +	swsci->scic = scic;
>  
>  	/* Ensure SCI event is selected and event trigger is cleared. */
>  	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
> @@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
>  
>  	/* Poll for the result. */
> -#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
> +#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
>  	if (wait_for(C, dslp)) {
>  		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
>  		return -ETIMEDOUT;
> @@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	}
>  
>  	if (parm_out)
> -		*parm_out = ioread32(&swsci->parm);
> +		*parm_out = swsci->parm;
>  
>  	return 0;
>  
> @@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_connector *intel_connector;
> -	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
> +	struct opregion_asle *asle = dev_priv->opregion.asle;
>  
>  	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
>  
> @@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
>  	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
>  	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
>  		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
> -	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
> +	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
>  
>  	drm_modeset_unlock(&dev->mode_config.connection_mutex);
>  
> @@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
>  	struct drm_i915_private *dev_priv =
>  		container_of(opregion, struct drm_i915_private, opregion);
>  	struct drm_device *dev = dev_priv->dev;
> -	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
> +	struct opregion_asle *asle = dev_priv->opregion.asle;
>  	u32 aslc_stat = 0;
>  	u32 aslc_req;
>  
>  	if (!asle)
>  		return;
>  
> -	aslc_req = ioread32(&asle->aslc);
> +	aslc_req = asle->aslc;
>  
>  	if (!(aslc_req & ASLC_REQ_MSK)) {
>  		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
> @@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
>  	}
>  
>  	if (aslc_req & ASLC_SET_ALS_ILLUM)
> -		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
> +		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
>  
>  	if (aslc_req & ASLC_SET_BACKLIGHT)
> -		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
> +		aslc_stat |= asle_set_backlight(dev, asle->bclp);
>  
>  	if (aslc_req & ASLC_SET_PFIT)
> -		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
> +		aslc_stat |= asle_set_pfit(dev, asle->pfit);
>  
>  	if (aslc_req & ASLC_SET_PWM_FREQ)
> -		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
> +		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
>  
>  	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
>  		aslc_stat |= asle_set_supported_rotation_angles(dev,
> -							ioread32(&asle->srot));
> +							asle->srot);
>  
>  	if (aslc_req & ASLC_BUTTON_ARRAY)
> -		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
> +		aslc_stat |= asle_set_button_array(dev, asle->iuer);
>  
>  	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
> -		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
> +		aslc_stat |= asle_set_convertible(dev, asle->iuer);
>  
>  	if (aslc_req & ASLC_DOCKING_INDICATOR)
> -		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
> +		aslc_stat |= asle_set_docking(dev, asle->iuer);
>  
>  	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
>  		aslc_stat |= asle_isct_state(dev);
>  
> -	iowrite32(aslc_stat, &asle->aslc);
> +	asle->aslc = aslc_stat;
>  }
>  
>  void intel_opregion_asle_intr(struct drm_device *dev)
> @@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
>  	   Linux, these are handled by the dock, button and video drivers.
>  	*/
>  
> -	struct opregion_acpi __iomem *acpi;
>  	struct acpi_bus_event *event = data;
> +	struct opregion_acpi *acpi;
>  	int ret = NOTIFY_OK;
>  
>  	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
> @@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
>  
>  	acpi = system_opregion->acpi;
>  
> -	if (event->type == 0x80 &&
> -	    (ioread32(&acpi->cevt) & 1) == 0)
> +	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
>  		ret = NOTIFY_BAD;
>  
> -	iowrite32(0, &acpi->csts);
> +	acpi->csts = 0;
>  
>  	return ret;
>  }
> @@ -623,14 +622,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
>  	u32 did;
>  
>  	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
> -		did = ioread32(&opregion->acpi->didl[i]);
> +		did = opregion->acpi->didl[i];
>  	} else {
>  		i -= ARRAY_SIZE(opregion->acpi->didl);
>  
>  		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
>  			return 0;
>  
> -		did = ioread32(&opregion->acpi->did2[i]);
> +		did = opregion->acpi->did2[i];
>  	}
>  
>  	return did;
> @@ -639,14 +638,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
>  static void set_did(struct intel_opregion *opregion, int i, u32 val)
>  {
>  	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
> -		iowrite32(val, &opregion->acpi->didl[i]);
> +		opregion->acpi->didl[i] = val;
>  	} else {
>  		i -= ARRAY_SIZE(opregion->acpi->didl);
>  
>  		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
>  			return;
>  
> -		iowrite32(val, &opregion->acpi->did2[i]);
> +		opregion->acpi->did2[i] = val;
>  	}
>  }
>  
> @@ -768,7 +767,7 @@ static void intel_setup_cadls(struct drm_device *dev)
>  	 * there are less than eight devices. */
>  	do {
>  		disp_id = get_did(opregion, i);
> -		iowrite32(disp_id, &opregion->acpi->cadl[i]);
> +		opregion->acpi->cadl[i] = disp_id;
>  	} while (++i < 8 && disp_id != 0);
>  }
>  
> @@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
>  		/* Notify BIOS we are ready to handle ACPI video ext notifs.
>  		 * Right now, all the events are handled by the ACPI video module.
>  		 * We don't actually need to do anything with them. */
> -		iowrite32(0, &opregion->acpi->csts);
> -		iowrite32(1, &opregion->acpi->drdy);
> +		opregion->acpi->csts = 0;
> +		opregion->acpi->drdy = 1;
>  
>  		system_opregion = opregion;
>  		register_acpi_notifier(&intel_opregion_notifier);
>  	}
>  
>  	if (opregion->asle) {
> -		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
> -		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
> +		opregion->asle->tche = ASLE_TCHE_BLC_EN;
> +		opregion->asle->ardy = ASLE_ARDY_READY;
>  	}
>  }
>  
> @@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
>  		return;
>  
>  	if (opregion->asle)
> -		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
> +		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
>  
>  	cancel_work_sync(&dev_priv->opregion.asle_work);
>  
>  	if (opregion->acpi) {
> -		iowrite32(0, &opregion->acpi->drdy);
> +		opregion->acpi->drdy = 0;
>  
>  		system_opregion = NULL;
>  		unregister_acpi_notifier(&intel_opregion_notifier);
>  	}
>  
>  	/* just clear all opregion memory pointers now */
> -	iounmap(opregion->header);
> +	memunmap(opregion->header);
>  	opregion->header = NULL;
>  	opregion->acpi = NULL;
>  	opregion->swsci = NULL;
> @@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_opregion *opregion = &dev_priv->opregion;
> -	void __iomem *base;
>  	u32 asls, mboxes;
>  	char buf[sizeof(OPREGION_SIGNATURE)];
>  	int err = 0;
> +	void *base;
>  
>  	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
>  	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
> @@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
>  	INIT_WORK(&opregion->asle_work, asle_work);
>  #endif
>  
> -	base = acpi_os_ioremap(asls, OPREGION_SIZE);
> +	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
>  	if (!base)
>  		return -ENOMEM;
>  
> -	memcpy_fromio(buf, base, sizeof(buf));
> +	memcpy(buf, base, sizeof(buf));
>  
>  	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
>  		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
> @@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
>  
>  	opregion->lid_state = base + ACPI_CLID;
>  
> -	mboxes = ioread32(&opregion->header->mboxes);
> +	mboxes = opregion->header->mboxes;
>  	if (mboxes & MBOX_ACPI) {
>  		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
>  		opregion->acpi = base + OPREGION_ACPI_OFFSET;
> @@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
>  		DRM_DEBUG_DRIVER("ASLE supported\n");
>  		opregion->asle = base + OPREGION_ASLE_OFFSET;
>  
> -		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
> +		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
>  	}
>  
>  	return 0;
>  
>  err_out:
> -	iounmap(base);
> +	memunmap(base);
>  	return err;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index e2ab3f6ed022..efe5424b290c 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
>  
>  	/* Assume that the BIOS does not lie through the OpRegion... */
>  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> +		return *dev_priv->opregion.lid_state & 0x1 ?
>  			connector_status_connected :
>  			connector_status_disconnected;
>  	}
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-13  8:24         ` Daniel Vetter
  0 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2015-10-13  8:24 UTC (permalink / raw)
  To: Williams, Dan J
  Cc: daniel, dri-devel, linux-kernel, linux-arch, linux-arm-kernel,
	intel-gfx, Vetter, Daniel, airlied

On Mon, Oct 12, 2015 at 09:12:57PM +0000, Williams, Dan J wrote:
> On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> > On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> > > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> > > map it with memremap rather than the implied cache setting of
> > > acpi_os_ioremap().
> > > 
> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > > Cc: intel-gfx@lists.freedesktop.org
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> > 
> > Assuming you've run sparse over this to make sure you've caught them all,
> > and with the nit below addressed this is
> > 
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Indeed, re-running sparse again found a few conversions of ioread* I
> missed as well as moving the force casting out of validate_vbt() to
> find_vbt().
> 
> > Feel free to pull v2 into whatever tree you think it's suitable for (but
> > you can also resend and I'll pick it up).
> 
> Please pick up v2 below.

Queued for -next, thanks for the patch. Aside: Attached or separate mail
seems easier, somehow git apply-mbox can't auto-eat this for of patch.
-Daniel

> 
> > 
> > > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > > index e2ab3f6ed022..c8444d5f549f 100644
> > > --- a/drivers/gpu/drm/i915/intel_panel.c
> > > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > > @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
> > >  
> > >  	/* Assume that the BIOS does not lie through the OpRegion... */
> > >  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> > > -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> > > +		return *(dev_priv->opregion.lid_state) & 0x1 ?
> > 
> > () are redundant now here.
> 
> Yup, fixed.
> 
> 8<----
> Subject: i915: switch from acpi_os_ioremap to memremap
> 
> From: Dan Williams <dan.j.williams@intel.com>
> 
> i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> map it with memremap rather than the implied cache setting of
> acpi_os_ioremap().
> 
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
>  drivers/gpu/drm/i915/i915_drv.h       |   12 ++---
>  drivers/gpu/drm/i915/intel_bios.c     |   25 +++++-----
>  drivers/gpu/drm/i915/intel_opregion.c |   83 ++++++++++++++++-----------------
>  drivers/gpu/drm/i915/intel_panel.c    |    2 -
>  5 files changed, 62 insertions(+), 62 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index e3ec9049081f..15989cc16e92 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
>  		goto out;
>  
>  	if (opregion->header) {
> -		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
> +		memcpy(data, opregion->header, OPREGION_SIZE);
>  		seq_write(m, data, OPREGION_SIZE);
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e1db8de52851..d8684634a31d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -444,14 +444,14 @@ struct opregion_swsci;
>  struct opregion_asle;
>  
>  struct intel_opregion {
> -	struct opregion_header __iomem *header;
> -	struct opregion_acpi __iomem *acpi;
> -	struct opregion_swsci __iomem *swsci;
> +	struct opregion_header *header;
> +	struct opregion_acpi *acpi;
> +	struct opregion_swsci *swsci;
>  	u32 swsci_gbda_sub_functions;
>  	u32 swsci_sbcb_sub_functions;
> -	struct opregion_asle __iomem *asle;
> -	void __iomem *vbt;
> -	u32 __iomem *lid_state;
> +	struct opregion_asle *asle;
> +	void *vbt;
> +	u32 *lid_state;
>  	struct work_struct asle_work;
>  };
>  #define OPREGION_SIZE            (8*1024)
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index c19e669ffe50..f6762a5faee8 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1231,20 +1231,13 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {
>  	{ }
>  };
>  
> -static const struct bdb_header *validate_vbt(const void __iomem *_base,
> +static const struct bdb_header *validate_vbt(const void *base,
>  					     size_t size,
> -					     const void __iomem *_vbt,
> +					     const void *_vbt,
>  					     const char *source)
>  {
> -	/*
> -	 * This is the one place where we explicitly discard the address space
> -	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
> -	 * From now on everything is based on 'base', and treated as regular
> -	 * memory.
> -	 */
> -	const void *base = (const void *) _base;
> -	size_t offset = _vbt - _base;
> -	const struct vbt_header *vbt = base + offset;
> +	size_t offset = _vbt - base;
> +	const struct vbt_header *vbt = _vbt;
>  	const struct bdb_header *bdb;
>  
>  	if (offset + sizeof(struct vbt_header) > size) {
> @@ -1282,7 +1275,15 @@ static const struct bdb_header *find_vbt(void __iomem *bios, size_t size)
>  	/* Scour memory looking for the VBT signature. */
>  	for (i = 0; i + 4 < size; i++) {
>  		if (ioread32(bios + i) == *((const u32 *) "$VBT")) {
> -			bdb = validate_vbt(bios, size, bios + i, "PCI ROM");
> +			/*
> +			 * This is the one place where we explicitly discard the
> +			 * address space (__iomem) of the BIOS/VBT. From now on
> +			 * everything is based on 'base', and treated as regular
> +			 * memory.
> +			 */
> +			void *_bios = (void __force *) bios;
> +
> +			bdb = validate_vbt(_bios, size, _bios + i, "PCI ROM");
>  			break;
>  		}
>  	}
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index cb1c65739425..41d44a5ef626 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -239,7 +239,7 @@ struct opregion_asle {
>  static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
> +	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
>  	u32 main_function, sub_function, scic;
>  	u16 pci_swsci;
>  	u32 dslp;
> @@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	}
>  
>  	/* Driver sleep timeout in ms. */
> -	dslp = ioread32(&swsci->dslp);
> +	dslp = swsci->dslp;
>  	if (!dslp) {
>  		/* The spec says 2ms should be the default, but it's too small
>  		 * for some machines. */
> @@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	}
>  
>  	/* The spec tells us to do this, but we are the only user... */
> -	scic = ioread32(&swsci->scic);
> +	scic = swsci->scic;
>  	if (scic & SWSCI_SCIC_INDICATOR) {
>  		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
>  		return -EBUSY;
> @@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  
>  	scic = function | SWSCI_SCIC_INDICATOR;
>  
> -	iowrite32(parm, &swsci->parm);
> -	iowrite32(scic, &swsci->scic);
> +	swsci->parm = parm;
> +	swsci->scic = scic;
>  
>  	/* Ensure SCI event is selected and event trigger is cleared. */
>  	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
> @@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
>  
>  	/* Poll for the result. */
> -#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
> +#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
>  	if (wait_for(C, dslp)) {
>  		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
>  		return -ETIMEDOUT;
> @@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	}
>  
>  	if (parm_out)
> -		*parm_out = ioread32(&swsci->parm);
> +		*parm_out = swsci->parm;
>  
>  	return 0;
>  
> @@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_connector *intel_connector;
> -	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
> +	struct opregion_asle *asle = dev_priv->opregion.asle;
>  
>  	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
>  
> @@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
>  	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
>  	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
>  		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
> -	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
> +	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
>  
>  	drm_modeset_unlock(&dev->mode_config.connection_mutex);
>  
> @@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
>  	struct drm_i915_private *dev_priv =
>  		container_of(opregion, struct drm_i915_private, opregion);
>  	struct drm_device *dev = dev_priv->dev;
> -	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
> +	struct opregion_asle *asle = dev_priv->opregion.asle;
>  	u32 aslc_stat = 0;
>  	u32 aslc_req;
>  
>  	if (!asle)
>  		return;
>  
> -	aslc_req = ioread32(&asle->aslc);
> +	aslc_req = asle->aslc;
>  
>  	if (!(aslc_req & ASLC_REQ_MSK)) {
>  		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
> @@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
>  	}
>  
>  	if (aslc_req & ASLC_SET_ALS_ILLUM)
> -		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
> +		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
>  
>  	if (aslc_req & ASLC_SET_BACKLIGHT)
> -		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
> +		aslc_stat |= asle_set_backlight(dev, asle->bclp);
>  
>  	if (aslc_req & ASLC_SET_PFIT)
> -		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
> +		aslc_stat |= asle_set_pfit(dev, asle->pfit);
>  
>  	if (aslc_req & ASLC_SET_PWM_FREQ)
> -		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
> +		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
>  
>  	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
>  		aslc_stat |= asle_set_supported_rotation_angles(dev,
> -							ioread32(&asle->srot));
> +							asle->srot);
>  
>  	if (aslc_req & ASLC_BUTTON_ARRAY)
> -		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
> +		aslc_stat |= asle_set_button_array(dev, asle->iuer);
>  
>  	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
> -		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
> +		aslc_stat |= asle_set_convertible(dev, asle->iuer);
>  
>  	if (aslc_req & ASLC_DOCKING_INDICATOR)
> -		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
> +		aslc_stat |= asle_set_docking(dev, asle->iuer);
>  
>  	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
>  		aslc_stat |= asle_isct_state(dev);
>  
> -	iowrite32(aslc_stat, &asle->aslc);
> +	asle->aslc = aslc_stat;
>  }
>  
>  void intel_opregion_asle_intr(struct drm_device *dev)
> @@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
>  	   Linux, these are handled by the dock, button and video drivers.
>  	*/
>  
> -	struct opregion_acpi __iomem *acpi;
>  	struct acpi_bus_event *event = data;
> +	struct opregion_acpi *acpi;
>  	int ret = NOTIFY_OK;
>  
>  	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
> @@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
>  
>  	acpi = system_opregion->acpi;
>  
> -	if (event->type == 0x80 &&
> -	    (ioread32(&acpi->cevt) & 1) == 0)
> +	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
>  		ret = NOTIFY_BAD;
>  
> -	iowrite32(0, &acpi->csts);
> +	acpi->csts = 0;
>  
>  	return ret;
>  }
> @@ -623,14 +622,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
>  	u32 did;
>  
>  	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
> -		did = ioread32(&opregion->acpi->didl[i]);
> +		did = opregion->acpi->didl[i];
>  	} else {
>  		i -= ARRAY_SIZE(opregion->acpi->didl);
>  
>  		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
>  			return 0;
>  
> -		did = ioread32(&opregion->acpi->did2[i]);
> +		did = opregion->acpi->did2[i];
>  	}
>  
>  	return did;
> @@ -639,14 +638,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
>  static void set_did(struct intel_opregion *opregion, int i, u32 val)
>  {
>  	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
> -		iowrite32(val, &opregion->acpi->didl[i]);
> +		opregion->acpi->didl[i] = val;
>  	} else {
>  		i -= ARRAY_SIZE(opregion->acpi->didl);
>  
>  		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
>  			return;
>  
> -		iowrite32(val, &opregion->acpi->did2[i]);
> +		opregion->acpi->did2[i] = val;
>  	}
>  }
>  
> @@ -768,7 +767,7 @@ static void intel_setup_cadls(struct drm_device *dev)
>  	 * there are less than eight devices. */
>  	do {
>  		disp_id = get_did(opregion, i);
> -		iowrite32(disp_id, &opregion->acpi->cadl[i]);
> +		opregion->acpi->cadl[i] = disp_id;
>  	} while (++i < 8 && disp_id != 0);
>  }
>  
> @@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
>  		/* Notify BIOS we are ready to handle ACPI video ext notifs.
>  		 * Right now, all the events are handled by the ACPI video module.
>  		 * We don't actually need to do anything with them. */
> -		iowrite32(0, &opregion->acpi->csts);
> -		iowrite32(1, &opregion->acpi->drdy);
> +		opregion->acpi->csts = 0;
> +		opregion->acpi->drdy = 1;
>  
>  		system_opregion = opregion;
>  		register_acpi_notifier(&intel_opregion_notifier);
>  	}
>  
>  	if (opregion->asle) {
> -		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
> -		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
> +		opregion->asle->tche = ASLE_TCHE_BLC_EN;
> +		opregion->asle->ardy = ASLE_ARDY_READY;
>  	}
>  }
>  
> @@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
>  		return;
>  
>  	if (opregion->asle)
> -		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
> +		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
>  
>  	cancel_work_sync(&dev_priv->opregion.asle_work);
>  
>  	if (opregion->acpi) {
> -		iowrite32(0, &opregion->acpi->drdy);
> +		opregion->acpi->drdy = 0;
>  
>  		system_opregion = NULL;
>  		unregister_acpi_notifier(&intel_opregion_notifier);
>  	}
>  
>  	/* just clear all opregion memory pointers now */
> -	iounmap(opregion->header);
> +	memunmap(opregion->header);
>  	opregion->header = NULL;
>  	opregion->acpi = NULL;
>  	opregion->swsci = NULL;
> @@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_opregion *opregion = &dev_priv->opregion;
> -	void __iomem *base;
>  	u32 asls, mboxes;
>  	char buf[sizeof(OPREGION_SIGNATURE)];
>  	int err = 0;
> +	void *base;
>  
>  	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
>  	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
> @@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
>  	INIT_WORK(&opregion->asle_work, asle_work);
>  #endif
>  
> -	base = acpi_os_ioremap(asls, OPREGION_SIZE);
> +	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
>  	if (!base)
>  		return -ENOMEM;
>  
> -	memcpy_fromio(buf, base, sizeof(buf));
> +	memcpy(buf, base, sizeof(buf));
>  
>  	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
>  		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
> @@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
>  
>  	opregion->lid_state = base + ACPI_CLID;
>  
> -	mboxes = ioread32(&opregion->header->mboxes);
> +	mboxes = opregion->header->mboxes;
>  	if (mboxes & MBOX_ACPI) {
>  		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
>  		opregion->acpi = base + OPREGION_ACPI_OFFSET;
> @@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
>  		DRM_DEBUG_DRIVER("ASLE supported\n");
>  		opregion->asle = base + OPREGION_ASLE_OFFSET;
>  
> -		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
> +		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
>  	}
>  
>  	return 0;
>  
>  err_out:
> -	iounmap(base);
> +	memunmap(base);
>  	return err;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index e2ab3f6ed022..efe5424b290c 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
>  
>  	/* Assume that the BIOS does not lie through the OpRegion... */
>  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> +		return *dev_priv->opregion.lid_state & 0x1 ?
>  			connector_status_connected :
>  			connector_status_disconnected;
>  	}
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-13  8:24         ` Daniel Vetter
  0 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2015-10-13  8:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 12, 2015 at 09:12:57PM +0000, Williams, Dan J wrote:
> On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> > On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> > > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> > > map it with memremap rather than the implied cache setting of
> > > acpi_os_ioremap().
> > > 
> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > > Cc: intel-gfx at lists.freedesktop.org
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: dri-devel at lists.freedesktop.org
> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> > 
> > Assuming you've run sparse over this to make sure you've caught them all,
> > and with the nit below addressed this is
> > 
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Indeed, re-running sparse again found a few conversions of ioread* I
> missed as well as moving the force casting out of validate_vbt() to
> find_vbt().
> 
> > Feel free to pull v2 into whatever tree you think it's suitable for (but
> > you can also resend and I'll pick it up).
> 
> Please pick up v2 below.

Queued for -next, thanks for the patch. Aside: Attached or separate mail
seems easier, somehow git apply-mbox can't auto-eat this for of patch.
-Daniel

> 
> > 
> > > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> > > index e2ab3f6ed022..c8444d5f549f 100644
> > > --- a/drivers/gpu/drm/i915/intel_panel.c
> > > +++ b/drivers/gpu/drm/i915/intel_panel.c
> > > @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
> > >  
> > >  	/* Assume that the BIOS does not lie through the OpRegion... */
> > >  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> > > -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> > > +		return *(dev_priv->opregion.lid_state) & 0x1 ?
> > 
> > () are redundant now here.
> 
> Yup, fixed.
> 
> 8<----
> Subject: i915: switch from acpi_os_ioremap to memremap
> 
> From: Dan Williams <dan.j.williams@intel.com>
> 
> i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> map it with memremap rather than the implied cache setting of
> acpi_os_ioremap().
> 
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: intel-gfx at lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel at lists.freedesktop.org
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c   |    2 -
>  drivers/gpu/drm/i915/i915_drv.h       |   12 ++---
>  drivers/gpu/drm/i915/intel_bios.c     |   25 +++++-----
>  drivers/gpu/drm/i915/intel_opregion.c |   83 ++++++++++++++++-----------------
>  drivers/gpu/drm/i915/intel_panel.c    |    2 -
>  5 files changed, 62 insertions(+), 62 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index e3ec9049081f..15989cc16e92 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1849,7 +1849,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
>  		goto out;
>  
>  	if (opregion->header) {
> -		memcpy_fromio(data, opregion->header, OPREGION_SIZE);
> +		memcpy(data, opregion->header, OPREGION_SIZE);
>  		seq_write(m, data, OPREGION_SIZE);
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e1db8de52851..d8684634a31d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -444,14 +444,14 @@ struct opregion_swsci;
>  struct opregion_asle;
>  
>  struct intel_opregion {
> -	struct opregion_header __iomem *header;
> -	struct opregion_acpi __iomem *acpi;
> -	struct opregion_swsci __iomem *swsci;
> +	struct opregion_header *header;
> +	struct opregion_acpi *acpi;
> +	struct opregion_swsci *swsci;
>  	u32 swsci_gbda_sub_functions;
>  	u32 swsci_sbcb_sub_functions;
> -	struct opregion_asle __iomem *asle;
> -	void __iomem *vbt;
> -	u32 __iomem *lid_state;
> +	struct opregion_asle *asle;
> +	void *vbt;
> +	u32 *lid_state;
>  	struct work_struct asle_work;
>  };
>  #define OPREGION_SIZE            (8*1024)
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index c19e669ffe50..f6762a5faee8 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1231,20 +1231,13 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {
>  	{ }
>  };
>  
> -static const struct bdb_header *validate_vbt(const void __iomem *_base,
> +static const struct bdb_header *validate_vbt(const void *base,
>  					     size_t size,
> -					     const void __iomem *_vbt,
> +					     const void *_vbt,
>  					     const char *source)
>  {
> -	/*
> -	 * This is the one place where we explicitly discard the address space
> -	 * (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
> -	 * From now on everything is based on 'base', and treated as regular
> -	 * memory.
> -	 */
> -	const void *base = (const void *) _base;
> -	size_t offset = _vbt - _base;
> -	const struct vbt_header *vbt = base + offset;
> +	size_t offset = _vbt - base;
> +	const struct vbt_header *vbt = _vbt;
>  	const struct bdb_header *bdb;
>  
>  	if (offset + sizeof(struct vbt_header) > size) {
> @@ -1282,7 +1275,15 @@ static const struct bdb_header *find_vbt(void __iomem *bios, size_t size)
>  	/* Scour memory looking for the VBT signature. */
>  	for (i = 0; i + 4 < size; i++) {
>  		if (ioread32(bios + i) == *((const u32 *) "$VBT")) {
> -			bdb = validate_vbt(bios, size, bios + i, "PCI ROM");
> +			/*
> +			 * This is the one place where we explicitly discard the
> +			 * address space (__iomem) of the BIOS/VBT. From now on
> +			 * everything is based on 'base', and treated as regular
> +			 * memory.
> +			 */
> +			void *_bios = (void __force *) bios;
> +
> +			bdb = validate_vbt(_bios, size, _bios + i, "PCI ROM");
>  			break;
>  		}
>  	}
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index cb1c65739425..41d44a5ef626 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -239,7 +239,7 @@ struct opregion_asle {
>  static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct opregion_swsci __iomem *swsci = dev_priv->opregion.swsci;
> +	struct opregion_swsci *swsci = dev_priv->opregion.swsci;
>  	u32 main_function, sub_function, scic;
>  	u16 pci_swsci;
>  	u32 dslp;
> @@ -264,7 +264,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	}
>  
>  	/* Driver sleep timeout in ms. */
> -	dslp = ioread32(&swsci->dslp);
> +	dslp = swsci->dslp;
>  	if (!dslp) {
>  		/* The spec says 2ms should be the default, but it's too small
>  		 * for some machines. */
> @@ -277,7 +277,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	}
>  
>  	/* The spec tells us to do this, but we are the only user... */
> -	scic = ioread32(&swsci->scic);
> +	scic = swsci->scic;
>  	if (scic & SWSCI_SCIC_INDICATOR) {
>  		DRM_DEBUG_DRIVER("SWSCI request already in progress\n");
>  		return -EBUSY;
> @@ -285,8 +285,8 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  
>  	scic = function | SWSCI_SCIC_INDICATOR;
>  
> -	iowrite32(parm, &swsci->parm);
> -	iowrite32(scic, &swsci->scic);
> +	swsci->parm = parm;
> +	swsci->scic = scic;
>  
>  	/* Ensure SCI event is selected and event trigger is cleared. */
>  	pci_read_config_word(dev->pdev, PCI_SWSCI, &pci_swsci);
> @@ -301,7 +301,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	pci_write_config_word(dev->pdev, PCI_SWSCI, pci_swsci);
>  
>  	/* Poll for the result. */
> -#define C (((scic = ioread32(&swsci->scic)) & SWSCI_SCIC_INDICATOR) == 0)
> +#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
>  	if (wait_for(C, dslp)) {
>  		DRM_DEBUG_DRIVER("SWSCI request timed out\n");
>  		return -ETIMEDOUT;
> @@ -317,7 +317,7 @@ static int swsci(struct drm_device *dev, u32 function, u32 parm, u32 *parm_out)
>  	}
>  
>  	if (parm_out)
> -		*parm_out = ioread32(&swsci->parm);
> +		*parm_out = swsci->parm;
>  
>  	return 0;
>  
> @@ -407,7 +407,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_connector *intel_connector;
> -	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
> +	struct opregion_asle *asle = dev_priv->opregion.asle;
>  
>  	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
>  
> @@ -432,7 +432,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
>  	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
>  	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
>  		intel_panel_set_backlight_acpi(intel_connector, bclp, 255);
> -	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
> +	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
>  
>  	drm_modeset_unlock(&dev->mode_config.connection_mutex);
>  
> @@ -519,14 +519,14 @@ static void asle_work(struct work_struct *work)
>  	struct drm_i915_private *dev_priv =
>  		container_of(opregion, struct drm_i915_private, opregion);
>  	struct drm_device *dev = dev_priv->dev;
> -	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
> +	struct opregion_asle *asle = dev_priv->opregion.asle;
>  	u32 aslc_stat = 0;
>  	u32 aslc_req;
>  
>  	if (!asle)
>  		return;
>  
> -	aslc_req = ioread32(&asle->aslc);
> +	aslc_req = asle->aslc;
>  
>  	if (!(aslc_req & ASLC_REQ_MSK)) {
>  		DRM_DEBUG_DRIVER("No request on ASLC interrupt 0x%08x\n",
> @@ -535,34 +535,34 @@ static void asle_work(struct work_struct *work)
>  	}
>  
>  	if (aslc_req & ASLC_SET_ALS_ILLUM)
> -		aslc_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
> +		aslc_stat |= asle_set_als_illum(dev, asle->alsi);
>  
>  	if (aslc_req & ASLC_SET_BACKLIGHT)
> -		aslc_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
> +		aslc_stat |= asle_set_backlight(dev, asle->bclp);
>  
>  	if (aslc_req & ASLC_SET_PFIT)
> -		aslc_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
> +		aslc_stat |= asle_set_pfit(dev, asle->pfit);
>  
>  	if (aslc_req & ASLC_SET_PWM_FREQ)
> -		aslc_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
> +		aslc_stat |= asle_set_pwm_freq(dev, asle->pfmb);
>  
>  	if (aslc_req & ASLC_SUPPORTED_ROTATION_ANGLES)
>  		aslc_stat |= asle_set_supported_rotation_angles(dev,
> -							ioread32(&asle->srot));
> +							asle->srot);
>  
>  	if (aslc_req & ASLC_BUTTON_ARRAY)
> -		aslc_stat |= asle_set_button_array(dev, ioread32(&asle->iuer));
> +		aslc_stat |= asle_set_button_array(dev, asle->iuer);
>  
>  	if (aslc_req & ASLC_CONVERTIBLE_INDICATOR)
> -		aslc_stat |= asle_set_convertible(dev, ioread32(&asle->iuer));
> +		aslc_stat |= asle_set_convertible(dev, asle->iuer);
>  
>  	if (aslc_req & ASLC_DOCKING_INDICATOR)
> -		aslc_stat |= asle_set_docking(dev, ioread32(&asle->iuer));
> +		aslc_stat |= asle_set_docking(dev, asle->iuer);
>  
>  	if (aslc_req & ASLC_ISCT_STATE_CHANGE)
>  		aslc_stat |= asle_isct_state(dev);
>  
> -	iowrite32(aslc_stat, &asle->aslc);
> +	asle->aslc = aslc_stat;
>  }
>  
>  void intel_opregion_asle_intr(struct drm_device *dev)
> @@ -587,8 +587,8 @@ static int intel_opregion_video_event(struct notifier_block *nb,
>  	   Linux, these are handled by the dock, button and video drivers.
>  	*/
>  
> -	struct opregion_acpi __iomem *acpi;
>  	struct acpi_bus_event *event = data;
> +	struct opregion_acpi *acpi;
>  	int ret = NOTIFY_OK;
>  
>  	if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
> @@ -599,11 +599,10 @@ static int intel_opregion_video_event(struct notifier_block *nb,
>  
>  	acpi = system_opregion->acpi;
>  
> -	if (event->type == 0x80 &&
> -	    (ioread32(&acpi->cevt) & 1) == 0)
> +	if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
>  		ret = NOTIFY_BAD;
>  
> -	iowrite32(0, &acpi->csts);
> +	acpi->csts = 0;
>  
>  	return ret;
>  }
> @@ -623,14 +622,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
>  	u32 did;
>  
>  	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
> -		did = ioread32(&opregion->acpi->didl[i]);
> +		did = opregion->acpi->didl[i];
>  	} else {
>  		i -= ARRAY_SIZE(opregion->acpi->didl);
>  
>  		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
>  			return 0;
>  
> -		did = ioread32(&opregion->acpi->did2[i]);
> +		did = opregion->acpi->did2[i];
>  	}
>  
>  	return did;
> @@ -639,14 +638,14 @@ static u32 get_did(struct intel_opregion *opregion, int i)
>  static void set_did(struct intel_opregion *opregion, int i, u32 val)
>  {
>  	if (i < ARRAY_SIZE(opregion->acpi->didl)) {
> -		iowrite32(val, &opregion->acpi->didl[i]);
> +		opregion->acpi->didl[i] = val;
>  	} else {
>  		i -= ARRAY_SIZE(opregion->acpi->didl);
>  
>  		if (WARN_ON(i >= ARRAY_SIZE(opregion->acpi->did2)))
>  			return;
>  
> -		iowrite32(val, &opregion->acpi->did2[i]);
> +		opregion->acpi->did2[i] = val;
>  	}
>  }
>  
> @@ -768,7 +767,7 @@ static void intel_setup_cadls(struct drm_device *dev)
>  	 * there are less than eight devices. */
>  	do {
>  		disp_id = get_did(opregion, i);
> -		iowrite32(disp_id, &opregion->acpi->cadl[i]);
> +		opregion->acpi->cadl[i] = disp_id;
>  	} while (++i < 8 && disp_id != 0);
>  }
>  
> @@ -787,16 +786,16 @@ void intel_opregion_init(struct drm_device *dev)
>  		/* Notify BIOS we are ready to handle ACPI video ext notifs.
>  		 * Right now, all the events are handled by the ACPI video module.
>  		 * We don't actually need to do anything with them. */
> -		iowrite32(0, &opregion->acpi->csts);
> -		iowrite32(1, &opregion->acpi->drdy);
> +		opregion->acpi->csts = 0;
> +		opregion->acpi->drdy = 1;
>  
>  		system_opregion = opregion;
>  		register_acpi_notifier(&intel_opregion_notifier);
>  	}
>  
>  	if (opregion->asle) {
> -		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
> -		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
> +		opregion->asle->tche = ASLE_TCHE_BLC_EN;
> +		opregion->asle->ardy = ASLE_ARDY_READY;
>  	}
>  }
>  
> @@ -809,19 +808,19 @@ void intel_opregion_fini(struct drm_device *dev)
>  		return;
>  
>  	if (opregion->asle)
> -		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
> +		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
>  
>  	cancel_work_sync(&dev_priv->opregion.asle_work);
>  
>  	if (opregion->acpi) {
> -		iowrite32(0, &opregion->acpi->drdy);
> +		opregion->acpi->drdy = 0;
>  
>  		system_opregion = NULL;
>  		unregister_acpi_notifier(&intel_opregion_notifier);
>  	}
>  
>  	/* just clear all opregion memory pointers now */
> -	iounmap(opregion->header);
> +	memunmap(opregion->header);
>  	opregion->header = NULL;
>  	opregion->acpi = NULL;
>  	opregion->swsci = NULL;
> @@ -894,10 +893,10 @@ int intel_opregion_setup(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_opregion *opregion = &dev_priv->opregion;
> -	void __iomem *base;
>  	u32 asls, mboxes;
>  	char buf[sizeof(OPREGION_SIGNATURE)];
>  	int err = 0;
> +	void *base;
>  
>  	BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
>  	BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
> @@ -915,11 +914,11 @@ int intel_opregion_setup(struct drm_device *dev)
>  	INIT_WORK(&opregion->asle_work, asle_work);
>  #endif
>  
> -	base = acpi_os_ioremap(asls, OPREGION_SIZE);
> +	base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
>  	if (!base)
>  		return -ENOMEM;
>  
> -	memcpy_fromio(buf, base, sizeof(buf));
> +	memcpy(buf, base, sizeof(buf));
>  
>  	if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
>  		DRM_DEBUG_DRIVER("opregion signature mismatch\n");
> @@ -931,7 +930,7 @@ int intel_opregion_setup(struct drm_device *dev)
>  
>  	opregion->lid_state = base + ACPI_CLID;
>  
> -	mboxes = ioread32(&opregion->header->mboxes);
> +	mboxes = opregion->header->mboxes;
>  	if (mboxes & MBOX_ACPI) {
>  		DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
>  		opregion->acpi = base + OPREGION_ACPI_OFFSET;
> @@ -946,12 +945,12 @@ int intel_opregion_setup(struct drm_device *dev)
>  		DRM_DEBUG_DRIVER("ASLE supported\n");
>  		opregion->asle = base + OPREGION_ASLE_OFFSET;
>  
> -		iowrite32(ASLE_ARDY_NOT_READY, &opregion->asle->ardy);
> +		opregion->asle->ardy = ASLE_ARDY_NOT_READY;
>  	}
>  
>  	return 0;
>  
>  err_out:
> -	iounmap(base);
> +	memunmap(base);
>  	return err;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index e2ab3f6ed022..efe5424b290c 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -387,7 +387,7 @@ intel_panel_detect(struct drm_device *dev)
>  
>  	/* Assume that the BIOS does not lie through the OpRegion... */
>  	if (!i915.panel_ignore_lid && dev_priv->opregion.lid_state) {
> -		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
> +		return *dev_priv->opregion.lid_state & 0x1 ?
>  			connector_status_connected :
>  			connector_status_disconnected;
>  	}
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
  2015-10-13  8:24         ` Daniel Vetter
  (?)
@ 2015-10-13 16:24           ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-13 16:24 UTC (permalink / raw)
  To: Williams, Dan J, dri-devel, linux-kernel, linux-arch,
	linux-arm-kernel, intel-gfx, Vetter, Daniel, airlied
  Cc: daniel

On Tue, Oct 13, 2015 at 1:24 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Oct 12, 2015 at 09:12:57PM +0000, Williams, Dan J wrote:
>> On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
>> > On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
>> > > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
>> > > map it with memremap rather than the implied cache setting of
>> > > acpi_os_ioremap().
>> > >
>> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
>> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> > > Cc: intel-gfx@lists.freedesktop.org
>> > > Cc: David Airlie <airlied@linux.ie>
>> > > Cc: dri-devel@lists.freedesktop.org
>> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> >
>> > Assuming you've run sparse over this to make sure you've caught them all,
>> > and with the nit below addressed this is
>> >
>> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>
>> Indeed, re-running sparse again found a few conversions of ioread* I
>> missed as well as moving the force casting out of validate_vbt() to
>> find_vbt().
>>
>> > Feel free to pull v2 into whatever tree you think it's suitable for (but
>> > you can also resend and I'll pick it up).
>>
>> Please pick up v2 below.
>
> Queued for -next, thanks for the patch. Aside: Attached or separate mail
> seems easier, somehow git apply-mbox can't auto-eat this for of patch.
> -Daniel
>

"git am --scissors" should detect the "8<---" cut line.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-13 16:24           ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-13 16:24 UTC (permalink / raw)
  To: Williams, Dan J, dri-devel, linux-kernel, linux-arch,
	linux-arm-kernel, intel-gfx, Vetter, Daniel, airlied
  Cc: daniel

On Tue, Oct 13, 2015 at 1:24 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Oct 12, 2015 at 09:12:57PM +0000, Williams, Dan J wrote:
>> On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
>> > On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
>> > > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
>> > > map it with memremap rather than the implied cache setting of
>> > > acpi_os_ioremap().
>> > >
>> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
>> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> > > Cc: intel-gfx@lists.freedesktop.org
>> > > Cc: David Airlie <airlied@linux.ie>
>> > > Cc: dri-devel@lists.freedesktop.org
>> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> >
>> > Assuming you've run sparse over this to make sure you've caught them all,
>> > and with the nit below addressed this is
>> >
>> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>
>> Indeed, re-running sparse again found a few conversions of ioread* I
>> missed as well as moving the force casting out of validate_vbt() to
>> find_vbt().
>>
>> > Feel free to pull v2 into whatever tree you think it's suitable for (but
>> > you can also resend and I'll pick it up).
>>
>> Please pick up v2 below.
>
> Queued for -next, thanks for the patch. Aside: Attached or separate mail
> seems easier, somehow git apply-mbox can't auto-eat this for of patch.
> -Daniel
>

"git am --scissors" should detect the "8<---" cut line.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-13 16:24           ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-13 16:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 13, 2015 at 1:24 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Oct 12, 2015 at 09:12:57PM +0000, Williams, Dan J wrote:
>> On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
>> > On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
>> > > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
>> > > map it with memremap rather than the implied cache setting of
>> > > acpi_os_ioremap().
>> > >
>> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
>> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> > > Cc: intel-gfx at lists.freedesktop.org
>> > > Cc: David Airlie <airlied@linux.ie>
>> > > Cc: dri-devel at lists.freedesktop.org
>> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> >
>> > Assuming you've run sparse over this to make sure you've caught them all,
>> > and with the nit below addressed this is
>> >
>> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>
>> Indeed, re-running sparse again found a few conversions of ioread* I
>> missed as well as moving the force casting out of validate_vbt() to
>> find_vbt().
>>
>> > Feel free to pull v2 into whatever tree you think it's suitable for (but
>> > you can also resend and I'll pick it up).
>>
>> Please pick up v2 below.
>
> Queued for -next, thanks for the patch. Aside: Attached or separate mail
> seems easier, somehow git apply-mbox can't auto-eat this for of patch.
> -Daniel
>

"git am --scissors" should detect the "8<---" cut line.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
  2015-10-13 16:24           ` Dan Williams
  (?)
@ 2015-10-14  7:33             ` Daniel Vetter
  -1 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2015-10-14  7:33 UTC (permalink / raw)
  To: Dan Williams
  Cc: dri-devel, linux-kernel, linux-arch, linux-arm-kernel, intel-gfx,
	Vetter, Daniel, airlied, daniel

On Tue, Oct 13, 2015 at 09:24:26AM -0700, Dan Williams wrote:
> On Tue, Oct 13, 2015 at 1:24 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Mon, Oct 12, 2015 at 09:12:57PM +0000, Williams, Dan J wrote:
> >> On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> >> > On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> >> > > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> >> > > map it with memremap rather than the implied cache setting of
> >> > > acpi_os_ioremap().
> >> > >
> >> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
> >> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> >> > > Cc: intel-gfx@lists.freedesktop.org
> >> > > Cc: David Airlie <airlied@linux.ie>
> >> > > Cc: dri-devel@lists.freedesktop.org
> >> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> >> >
> >> > Assuming you've run sparse over this to make sure you've caught them all,
> >> > and with the nit below addressed this is
> >> >
> >> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> >>
> >> Indeed, re-running sparse again found a few conversions of ioread* I
> >> missed as well as moving the force casting out of validate_vbt() to
> >> find_vbt().
> >>
> >> > Feel free to pull v2 into whatever tree you think it's suitable for (but
> >> > you can also resend and I'll pick it up).
> >>
> >> Please pick up v2 below.
> >
> > Queued for -next, thanks for the patch. Aside: Attached or separate mail
> > seems easier, somehow git apply-mbox can't auto-eat this for of patch.
> > -Daniel
> >
> 
> "git am --scissors" should detect the "8<---" cut line.

TIL, works nice indeed. Thanks for the hint.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-14  7:33             ` Daniel Vetter
  0 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2015-10-14  7:33 UTC (permalink / raw)
  To: Dan Williams
  Cc: dri-devel, linux-kernel, linux-arch, linux-arm-kernel, intel-gfx,
	Vetter, Daniel, airlied, daniel

On Tue, Oct 13, 2015 at 09:24:26AM -0700, Dan Williams wrote:
> On Tue, Oct 13, 2015 at 1:24 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Mon, Oct 12, 2015 at 09:12:57PM +0000, Williams, Dan J wrote:
> >> On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> >> > On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> >> > > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> >> > > map it with memremap rather than the implied cache setting of
> >> > > acpi_os_ioremap().
> >> > >
> >> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
> >> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> >> > > Cc: intel-gfx@lists.freedesktop.org
> >> > > Cc: David Airlie <airlied@linux.ie>
> >> > > Cc: dri-devel@lists.freedesktop.org
> >> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> >> >
> >> > Assuming you've run sparse over this to make sure you've caught them all,
> >> > and with the nit below addressed this is
> >> >
> >> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> >>
> >> Indeed, re-running sparse again found a few conversions of ioread* I
> >> missed as well as moving the force casting out of validate_vbt() to
> >> find_vbt().
> >>
> >> > Feel free to pull v2 into whatever tree you think it's suitable for (but
> >> > you can also resend and I'll pick it up).
> >>
> >> Please pick up v2 below.
> >
> > Queued for -next, thanks for the patch. Aside: Attached or separate mail
> > seems easier, somehow git apply-mbox can't auto-eat this for of patch.
> > -Daniel
> >
> 
> "git am --scissors" should detect the "8<---" cut line.

TIL, works nice indeed. Thanks for the hint.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [Intel-gfx] [PATCH 09/20] i915: switch from acpi_os_ioremap to memremap
@ 2015-10-14  7:33             ` Daniel Vetter
  0 siblings, 0 replies; 90+ messages in thread
From: Daniel Vetter @ 2015-10-14  7:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 13, 2015 at 09:24:26AM -0700, Dan Williams wrote:
> On Tue, Oct 13, 2015 at 1:24 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Mon, Oct 12, 2015 at 09:12:57PM +0000, Williams, Dan J wrote:
> >> On Mon, 2015-10-12 at 09:01 +0200, Daniel Vetter wrote:
> >> > On Fri, Oct 09, 2015 at 06:16:25PM -0400, Dan Williams wrote:
> >> > > i915 expects the OpRegion to be cached (i.e. not __iomem), so explicitly
> >> > > map it with memremap rather than the implied cache setting of
> >> > > acpi_os_ioremap().
> >> > >
> >> > > Cc: Daniel Vetter <daniel.vetter@intel.com>
> >> > > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> >> > > Cc: intel-gfx at lists.freedesktop.org
> >> > > Cc: David Airlie <airlied@linux.ie>
> >> > > Cc: dri-devel at lists.freedesktop.org
> >> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> >> >
> >> > Assuming you've run sparse over this to make sure you've caught them all,
> >> > and with the nit below addressed this is
> >> >
> >> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> >>
> >> Indeed, re-running sparse again found a few conversions of ioread* I
> >> missed as well as moving the force casting out of validate_vbt() to
> >> find_vbt().
> >>
> >> > Feel free to pull v2 into whatever tree you think it's suitable for (but
> >> > you can also resend and I'll pick it up).
> >>
> >> Please pick up v2 below.
> >
> > Queued for -next, thanks for the patch. Aside: Attached or separate mail
> > seems easier, somehow git apply-mbox can't auto-eat this for of patch.
> > -Daniel
> >
> 
> "git am --scissors" should detect the "8<---" cut line.

TIL, works nice indeed. Thanks for the hint.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
  2015-10-12 22:19         ` Dan Williams
  (?)
@ 2015-10-14 13:22           ` Joerg Roedel
  -1 siblings, 0 replies; 90+ messages in thread
From: Joerg Roedel @ 2015-10-14 13:22 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel

On Mon, Oct 12, 2015 at 03:19:24PM -0700, Dan Williams wrote:
> On Mon, Oct 12, 2015 at 3:05 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> > On Mon, Oct 12, 2015 at 2:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
> >> Hi Dan,
> >>
> >> On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
> >>> In preparation for deprecating ioremap_cache() convert its usage in
> >>> intel-iommu to memremap.  This also eliminates the mishandling of the
> >>> __iomem annotation in the implementation.
> >>
> >> I appreciate the change, but in the cover letter you write the API is
> >> only implemented for x86 so far? The VT-d driver is also used on ia64,
> >> will it still work there with this patch?
> >>
> >>
> >
> > I did convert ia64 in the series [1]  but you're right this patch
> > can't go in independently of that conversion.  If you ack this one
> > I'll carry them in order.
> >
> > [1]: https://lkml.org/lkml/2015/10/9/702
> 
> Ah sorry, got ahead of myself ;-p.  You can safely take this patch
> through your tree.  The ia64 patch can happen asynchronously because
> kernel/memremap.c has:
> 
> __weak void *arch_memremap(resource_size_t offset, size_t size,
> unsigned long flags)
> 
> ...as a temporary fallback until the conversion is complete.

Okay, thanks, applied.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
@ 2015-10-14 13:22           ` Joerg Roedel
  0 siblings, 0 replies; 90+ messages in thread
From: Joerg Roedel @ 2015-10-14 13:22 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-kernel, linux-arch, David Woodhouse, linux-arm-kernel

On Mon, Oct 12, 2015 at 03:19:24PM -0700, Dan Williams wrote:
> On Mon, Oct 12, 2015 at 3:05 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> > On Mon, Oct 12, 2015 at 2:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
> >> Hi Dan,
> >>
> >> On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
> >>> In preparation for deprecating ioremap_cache() convert its usage in
> >>> intel-iommu to memremap.  This also eliminates the mishandling of the
> >>> __iomem annotation in the implementation.
> >>
> >> I appreciate the change, but in the cover letter you write the API is
> >> only implemented for x86 so far? The VT-d driver is also used on ia64,
> >> will it still work there with this patch?
> >>
> >>
> >
> > I did convert ia64 in the series [1]  but you're right this patch
> > can't go in independently of that conversion.  If you ack this one
> > I'll carry them in order.
> >
> > [1]: https://lkml.org/lkml/2015/10/9/702
> 
> Ah sorry, got ahead of myself ;-p.  You can safely take this patch
> through your tree.  The ia64 patch can happen asynchronously because
> kernel/memremap.c has:
> 
> __weak void *arch_memremap(resource_size_t offset, size_t size,
> unsigned long flags)
> 
> ...as a temporary fallback until the conversion is complete.

Okay, thanks, applied.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 13/20] intel-iommu: switch from ioremap_cache to memremap
@ 2015-10-14 13:22           ` Joerg Roedel
  0 siblings, 0 replies; 90+ messages in thread
From: Joerg Roedel @ 2015-10-14 13:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 12, 2015 at 03:19:24PM -0700, Dan Williams wrote:
> On Mon, Oct 12, 2015 at 3:05 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> > On Mon, Oct 12, 2015 at 2:58 PM, Joerg Roedel <jroedel@suse.de> wrote:
> >> Hi Dan,
> >>
> >> On Fri, Oct 09, 2015 at 06:16:46PM -0400, Dan Williams wrote:
> >>> In preparation for deprecating ioremap_cache() convert its usage in
> >>> intel-iommu to memremap.  This also eliminates the mishandling of the
> >>> __iomem annotation in the implementation.
> >>
> >> I appreciate the change, but in the cover letter you write the API is
> >> only implemented for x86 so far? The VT-d driver is also used on ia64,
> >> will it still work there with this patch?
> >>
> >>
> >
> > I did convert ia64 in the series [1]  but you're right this patch
> > can't go in independently of that conversion.  If you ack this one
> > I'll carry them in order.
> >
> > [1]: https://lkml.org/lkml/2015/10/9/702
> 
> Ah sorry, got ahead of myself ;-p.  You can safely take this patch
> through your tree.  The ia64 patch can happen asynchronously because
> kernel/memremap.c has:
> 
> __weak void *arch_memremap(resource_size_t offset, size_t size,
> unsigned long flags)
> 
> ...as a temporary fallback until the conversion is complete.

Okay, thanks, applied.

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
  2015-10-09 22:16   ` Dan Williams
@ 2015-10-19 15:26     ` Mark Brown
  -1 siblings, 0 replies; 90+ messages in thread
From: Mark Brown @ 2015-10-19 15:26 UTC (permalink / raw)
  To: Dan Williams
  Cc: linux-kernel, linux-arch, Liam Girdwood, Takashi Iwai,
	Jaroslav Kysela, Jeeja KP, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> In preparation for deprecating ioremap_cache() convert its usage in
> skl-nhlt to memremap.

> -void __iomem *skl_nhlt_init(struct device *dev)
> +void *skl_nhlt_init(struct device *dev)

Why are we loosing the annotation here?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
@ 2015-10-19 15:26     ` Mark Brown
  0 siblings, 0 replies; 90+ messages in thread
From: Mark Brown @ 2015-10-19 15:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> In preparation for deprecating ioremap_cache() convert its usage in
> skl-nhlt to memremap.

> -void __iomem *skl_nhlt_init(struct device *dev)
> +void *skl_nhlt_init(struct device *dev)

Why are we loosing the annotation here?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151019/84ef4802/attachment.sig>

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
  2015-10-19 15:26     ` Mark Brown
  (?)
@ 2015-10-19 15:34       ` Takashi Iwai
  -1 siblings, 0 replies; 90+ messages in thread
From: Takashi Iwai @ 2015-10-19 15:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: Dan Williams, Liam Girdwood, Jeeja KP, linux-arm-kernel,
	Jaroslav Kysela, linux-arch, linux-kernel

On Mon, 19 Oct 2015 17:26:41 +0200,
Mark Brown wrote:
> 
> On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> > In preparation for deprecating ioremap_cache() convert its usage in
> > skl-nhlt to memremap.
> 
> > -void __iomem *skl_nhlt_init(struct device *dev)
> > +void *skl_nhlt_init(struct device *dev)
> 
> Why are we loosing the annotation here?

It's the exact purpose of this patchset, as far as I understand.
memremap() allows the driver accessing the mapped memory just like a
normal memory unlike ioremap().


Takashi

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
@ 2015-10-19 15:34       ` Takashi Iwai
  0 siblings, 0 replies; 90+ messages in thread
From: Takashi Iwai @ 2015-10-19 15:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: Dan Williams, Liam Girdwood, Jeeja KP, linux-arm-kernel,
	Jaroslav Kysela, linux-arch, linux-kernel

On Mon, 19 Oct 2015 17:26:41 +0200,
Mark Brown wrote:
> 
> On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> > In preparation for deprecating ioremap_cache() convert its usage in
> > skl-nhlt to memremap.
> 
> > -void __iomem *skl_nhlt_init(struct device *dev)
> > +void *skl_nhlt_init(struct device *dev)
> 
> Why are we loosing the annotation here?

It's the exact purpose of this patchset, as far as I understand.
memremap() allows the driver accessing the mapped memory just like a
normal memory unlike ioremap().


Takashi

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
@ 2015-10-19 15:34       ` Takashi Iwai
  0 siblings, 0 replies; 90+ messages in thread
From: Takashi Iwai @ 2015-10-19 15:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 19 Oct 2015 17:26:41 +0200,
Mark Brown wrote:
> 
> On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> > In preparation for deprecating ioremap_cache() convert its usage in
> > skl-nhlt to memremap.
> 
> > -void __iomem *skl_nhlt_init(struct device *dev)
> > +void *skl_nhlt_init(struct device *dev)
> 
> Why are we loosing the annotation here?

It's the exact purpose of this patchset, as far as I understand.
memremap() allows the driver accessing the mapped memory just like a
normal memory unlike ioremap().


Takashi

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
  2015-10-19 15:34       ` Takashi Iwai
@ 2015-10-19 16:08         ` Mark Brown
  -1 siblings, 0 replies; 90+ messages in thread
From: Mark Brown @ 2015-10-19 16:08 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Dan Williams, Liam Girdwood, Jeeja KP, linux-arm-kernel,
	Jaroslav Kysela, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

On Mon, Oct 19, 2015 at 05:34:48PM +0200, Takashi Iwai wrote:
> Mark Brown wrote:

> > On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> > > In preparation for deprecating ioremap_cache() convert its usage in
> > > skl-nhlt to memremap.

> > > -void __iomem *skl_nhlt_init(struct device *dev)
> > > +void *skl_nhlt_init(struct device *dev)

> > Why are we loosing the annotation here?

> It's the exact purpose of this patchset, as far as I understand.
> memremap() allows the driver accessing the mapped memory just like a
> normal memory unlike ioremap().

There's no mention of what the purpose of the conversion is in either
the patch or the cover letter so it's a bit unclear, some confirmation
would be good :(

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
@ 2015-10-19 16:08         ` Mark Brown
  0 siblings, 0 replies; 90+ messages in thread
From: Mark Brown @ 2015-10-19 16:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 19, 2015 at 05:34:48PM +0200, Takashi Iwai wrote:
> Mark Brown wrote:

> > On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
> > > In preparation for deprecating ioremap_cache() convert its usage in
> > > skl-nhlt to memremap.

> > > -void __iomem *skl_nhlt_init(struct device *dev)
> > > +void *skl_nhlt_init(struct device *dev)

> > Why are we loosing the annotation here?

> It's the exact purpose of this patchset, as far as I understand.
> memremap() allows the driver accessing the mapped memory just like a
> normal memory unlike ioremap().

There's no mention of what the purpose of the conversion is in either
the patch or the cover letter so it's a bit unclear, some confirmation
would be good :(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151019/9c29cd3b/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
  2015-10-19 16:08         ` Mark Brown
  (?)
@ 2015-10-19 16:59           ` Dan Williams
  -1 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-19 16:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: Takashi Iwai, Liam Girdwood, Jeeja KP, linux-arm-kernel,
	Jaroslav Kysela, linux-arch, linux-kernel

On Mon, Oct 19, 2015 at 9:08 AM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Oct 19, 2015 at 05:34:48PM +0200, Takashi Iwai wrote:
>> Mark Brown wrote:
>
>> > On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
>> > > In preparation for deprecating ioremap_cache() convert its usage in
>> > > skl-nhlt to memremap.
>
>> > > -void __iomem *skl_nhlt_init(struct device *dev)
>> > > +void *skl_nhlt_init(struct device *dev)
>
>> > Why are we loosing the annotation here?
>
>> It's the exact purpose of this patchset, as far as I understand.
>> memremap() allows the driver accessing the mapped memory just like a
>> normal memory unlike ioremap().
>
> There's no mention of what the purpose of the conversion is in either
> the patch or the cover letter so it's a bit unclear, some confirmation
> would be good :(

The cover letter linked this article which talked through the
motivation: https://lwn.net/Articles/653585/

Essentially an "__iomem" annotation on a cached mapping is
inconsistent as __iomem indicates "may have side effects, use special
accessors" and cached means "pre-fetching, asynchronous write-backs,
and cpu determined i/o sizes are permissible".

^ permalink raw reply	[flat|nested] 90+ messages in thread

* Re: [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
@ 2015-10-19 16:59           ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-19 16:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: Takashi Iwai, Liam Girdwood, Jeeja KP, linux-arm-kernel,
	Jaroslav Kysela, linux-arch, linux-kernel

On Mon, Oct 19, 2015 at 9:08 AM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Oct 19, 2015 at 05:34:48PM +0200, Takashi Iwai wrote:
>> Mark Brown wrote:
>
>> > On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
>> > > In preparation for deprecating ioremap_cache() convert its usage in
>> > > skl-nhlt to memremap.
>
>> > > -void __iomem *skl_nhlt_init(struct device *dev)
>> > > +void *skl_nhlt_init(struct device *dev)
>
>> > Why are we loosing the annotation here?
>
>> It's the exact purpose of this patchset, as far as I understand.
>> memremap() allows the driver accessing the mapped memory just like a
>> normal memory unlike ioremap().
>
> There's no mention of what the purpose of the conversion is in either
> the patch or the cover letter so it's a bit unclear, some confirmation
> would be good :(

The cover letter linked this article which talked through the
motivation: https://lwn.net/Articles/653585/

Essentially an "__iomem" annotation on a cached mapping is
inconsistent as __iomem indicates "may have side effects, use special
accessors" and cached means "pre-fetching, asynchronous write-backs,
and cpu determined i/o sizes are permissible".

^ permalink raw reply	[flat|nested] 90+ messages in thread

* [PATCH 11/20] sound, skylake: switch from ioremap_cache to memremap
@ 2015-10-19 16:59           ` Dan Williams
  0 siblings, 0 replies; 90+ messages in thread
From: Dan Williams @ 2015-10-19 16:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 19, 2015 at 9:08 AM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Oct 19, 2015 at 05:34:48PM +0200, Takashi Iwai wrote:
>> Mark Brown wrote:
>
>> > On Fri, Oct 09, 2015 at 06:16:36PM -0400, Dan Williams wrote:
>> > > In preparation for deprecating ioremap_cache() convert its usage in
>> > > skl-nhlt to memremap.
>
>> > > -void __iomem *skl_nhlt_init(struct device *dev)
>> > > +void *skl_nhlt_init(struct device *dev)
>
>> > Why are we loosing the annotation here?
>
>> It's the exact purpose of this patchset, as far as I understand.
>> memremap() allows the driver accessing the mapped memory just like a
>> normal memory unlike ioremap().
>
> There's no mention of what the purpose of the conversion is in either
> the patch or the cover letter so it's a bit unclear, some confirmation
> would be good :(

The cover letter linked this article which talked through the
motivation: https://lwn.net/Articles/653585/

Essentially an "__iomem" annotation on a cached mapping is
inconsistent as __iomem indicates "may have side effects, use special
accessors" and cached means "pre-fetching, asynchronous write-backs,
and cpu determined i/o sizes are permissible".

^ permalink raw reply	[flat|nested] 90+ messages in thread

end of thread, other threads:[~2015-10-19 16:59 UTC | newest]

Thread overview: 90+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09 22:15 [PATCH 00/20] tree-wide convert to memremap() Dan Williams
2015-10-09 22:15 ` Dan Williams
2015-10-09 22:15 ` Dan Williams
2015-10-09 22:15 ` Dan Williams
2015-10-09 22:15 ` [PATCH 01/20] x86: introduce arch_memremap() Dan Williams
2015-10-09 22:15   ` Dan Williams
2015-10-09 22:15 ` [PATCH 02/20] arm: " Dan Williams
2015-10-09 22:15   ` Dan Williams
2015-10-09 22:15 ` [PATCH 03/20] ia64: " Dan Williams
2015-10-09 22:15   ` Dan Williams
2015-10-09 22:15 ` [PATCH 04/20] sh: " Dan Williams
2015-10-09 22:15   ` Dan Williams
2015-10-09 22:16 ` [PATCH 05/20] m68k: " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-09 22:16 ` [PATCH 06/20] arm: switch from ioremap_cache to memremap Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-09 22:16 ` [PATCH 07/20] x86: " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-09 22:16 ` [PATCH 08/20] gma500: switch from acpi_os_ioremap " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-09 22:16 ` [PATCH 09/20] i915: " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-12  7:01   ` [Intel-gfx] " Daniel Vetter
2015-10-12  7:01     ` Daniel Vetter
2015-10-12  7:01     ` Daniel Vetter
2015-10-12 21:12     ` Williams, Dan J
2015-10-12 21:12       ` Williams, Dan J
2015-10-12 21:12       ` Williams, Dan J
2015-10-12 21:12       ` Williams, Dan J
2015-10-13  8:24       ` [Intel-gfx] " Daniel Vetter
2015-10-13  8:24         ` Daniel Vetter
2015-10-13  8:24         ` Daniel Vetter
2015-10-13 16:24         ` Dan Williams
2015-10-13 16:24           ` Dan Williams
2015-10-13 16:24           ` Dan Williams
2015-10-14  7:33           ` Daniel Vetter
2015-10-14  7:33             ` Daniel Vetter
2015-10-14  7:33             ` Daniel Vetter
2015-10-09 22:16 ` [PATCH 10/20] acpi: switch from ioremap_cache " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-09 22:16 ` [PATCH 11/20] sound, skylake: " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-19 15:26   ` Mark Brown
2015-10-19 15:26     ` Mark Brown
2015-10-19 15:34     ` Takashi Iwai
2015-10-19 15:34       ` Takashi Iwai
2015-10-19 15:34       ` Takashi Iwai
2015-10-19 16:08       ` Mark Brown
2015-10-19 16:08         ` Mark Brown
2015-10-19 16:59         ` Dan Williams
2015-10-19 16:59           ` Dan Williams
2015-10-19 16:59           ` Dan Williams
2015-10-09 22:16 ` [PATCH 12/20] memconsole: fix __iomem mishandling, switch " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-09 22:16 ` [PATCH 13/20] intel-iommu: switch from ioremap_cache " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-12 21:58   ` Joerg Roedel
2015-10-12 21:58     ` Joerg Roedel
2015-10-12 22:05     ` Dan Williams
2015-10-12 22:05       ` Dan Williams
2015-10-12 22:05       ` Dan Williams
2015-10-12 22:19       ` Dan Williams
2015-10-12 22:19         ` Dan Williams
2015-10-12 22:19         ` Dan Williams
2015-10-14 13:22         ` Joerg Roedel
2015-10-14 13:22           ` Joerg Roedel
2015-10-14 13:22           ` Joerg Roedel
2015-10-09 22:16 ` [PATCH 14/20] pxa2xx-flash: " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-12 17:58   ` Brian Norris
2015-10-12 17:58     ` Brian Norris
2015-10-12 20:31     ` Brian Norris
2015-10-12 20:31       ` Brian Norris
2015-10-12 20:36       ` Dan Williams
2015-10-12 20:36         ` Dan Williams
2015-10-12 20:36         ` Dan Williams
2015-10-09 22:16 ` [PATCH 15/20] sfi: " Dan Williams
2015-10-09 22:16   ` Dan Williams
2015-10-09 22:17 ` [PATCH 16/20] fbdev: switch from ioremap_wt " Dan Williams
2015-10-09 22:17   ` Dan Williams
2015-10-09 22:17   ` Dan Williams
2015-10-09 22:17 ` [PATCH 17/20] arch: kill ioremap_cached() Dan Williams
2015-10-09 22:17   ` Dan Williams
2015-10-09 22:17 ` [PATCH 18/20] arch: kill ioremap_fullcache() Dan Williams
2015-10-09 22:17   ` Dan Williams
2015-10-09 22:17 ` [PATCH 19/20] arch: remove ioremap_cache, replace with arch_memremap Dan Williams
2015-10-09 22:17   ` Dan Williams
2015-10-09 22:17 ` [PATCH 20/20] arch: remove ioremap_wt, optionally " Dan Williams
2015-10-09 22:17   ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.