LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] EDAC, mpc85xx: Prevent building as a module
From: Borislav Petkov @ 2019-05-10 14:13 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Johannes Thumshirn, linux-kernel, linuxppc-dev, james.morse,
	mchehab, linux-edac
In-Reply-To: <87bm0avb03.fsf@concordia.ellerman.id.au>

On Fri, May 10, 2019 at 08:50:52PM +1000, Michael Ellerman wrote:
> Yeah that looks better to me. I didn't think about the case where EDAC
> core is modular.
> 
> Do you want me to send a new patch?

Nah, I'll fix it up.

Thx.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply

* Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.2-1 tag
From: pr-tracker-bot @ 2019-05-10 12:35 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: sachinp, nathanl, maddy, aik, mahesh, thuth, weiyongjun1, leitao,
	nfont, paulmck, hch, mikey, horia.geanta, aneesh.kumar,
	yuehaibing, wen.yang99, anju, ganeshgr, joel, alastair, joe, ben,
	valentin.schneider, ricklind, lvivier, jagdsh.linux, ajd,
	laurentiu.tudor, npiggin, Julia.Lawall, cai, clg, lukas.bulwahn,
	tsu.yubo, dvyukov, dja, lkml, sukadev, malat, linuxppc-dev, cmr,
	ndesaulniers, linux-kernel, andrew.donnellan, fbarrat, colin.king,
	Linus Torvalds, tobin
In-Reply-To: <874l62v6u0.fsf@concordia.ellerman.id.au>

The pull request you sent on Fri, 10 May 2019 22:20:55 +1000:

> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.2-1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/b970afcfcabd63cd3832e95db096439c177c3592

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply

* [GIT PULL] Please pull powerpc/linux.git powerpc-5.2-1 tag
From: Michael Ellerman @ 2019-05-10 12:20 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: sachinp, nathanl, maddy, aik, mahesh, thuth, weiyongjun1, leitao,
	nfont, paulmck, hch, mikey, horia.geanta, aneesh.kumar,
	yuehaibing, wen.yang99, anju, ganeshgr, joel, alastair, fbarrat,
	ben, valentin.schneider, ricklind, lvivier, jagdsh.linux, ajd,
	laurentiu.tudor, npiggin, Julia.Lawall, cai, clg, lukas.bulwahn,
	tsu.yubo, dvyukov, dja, lkml, sukadev, malat, cmr, ndesaulniers,
	linux-kernel, andrew.donnellan, joe, colin.king, linuxppc-dev,
	tobin

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Linus,

Please pull powerpc updates for 5.2.

Slightly delayed due to the issue with printk() calling probe_kernel_read()
interacting with our new user access prevention stuff, but all fixed now.

The only out-of-area changes are the addition of a cpuhp_state, small additions
to Documentation and MAINTAINERS updates.

No conflicts that I'm aware of.

cheers


The following changes since commit 79a3aaa7b82e3106be97842dedfd8429248896e6:

  Linux 5.1-rc3 (2019-03-31 14:39:29 -0700)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.2-1

for you to fetch changes up to 8150a153c013aa2dd1ffae43370b89ac1347a7fb:

  powerpc/64s: Use early_mmu_has_feature() in set_kuap() (2019-05-09 14:28:56 +1000)

- ------------------------------------------------------------------
powerpc updates for 5.2

Highlights:

 - Support for Kernel Userspace Access/Execution Prevention (like
   SMAP/SMEP/PAN/PXN) on some 64-bit and 32-bit CPUs. This prevents the kernel
   from accidentally accessing userspace outside copy_to/from_user(), or
   ever executing userspace.

 - KASAN support on 32-bit.

 - Rework of where we map the kernel, vmalloc, etc. on 64-bit hash to use the
   same address ranges we use with the Radix MMU.

 - A rewrite into C of large parts of our idle handling code for 64-bit Book3S
   (ie. power8 & power9).

 - A fast path entry for syscalls on 32-bit CPUs, for a 12-17% speedup in the
   null_syscall benchmark.

 - On 64-bit bare metal we have support for recovering from errors with the time
   base (our clocksource), however if that fails currently we hang in __delay()
   and never crash. We now have support for detecting that case and short
   circuiting __delay() so we at least panic() and reboot.

 - Add support for optionally enabling the DAWR on Power9, which had to be
   disabled by default due to a hardware erratum. This has the effect of
   enabling hardware breakpoints for GDB, the downside is a badly behaved
   program could crash the machine by pointing the DAWR at cache inhibited
   memory. This is opt-in obviously.

 - xmon, our crash handler, gets support for a read only mode where operations
   that could change memory or otherwise disturb the system are disabled.

Plus many clean-ups, reworks and minor fixes etc.

Thanks to:
  Christophe Leroy, Akshay Adiga, Alastair D'Silva, Alexey Kardashevskiy, Andrew
  Donnellan, Aneesh Kumar K.V, Anju T Sudhakar, Anton Blanchard, Ben Hutchings,
  Bo YU, Breno Leitao, Cédric Le Goater, Christopher M. Riedl, Christoph
  Hellwig, Colin Ian King, David Gibson, Ganesh Goudar, Gautham R. Shenoy,
  George Spelvin, Greg Kroah-Hartman, Greg Kurz, Horia Geantă, Jagadeesh
  Pagadala, Joel Stanley, Joe Perches, Julia Lawall, Laurentiu Tudor, Laurent
  Vivier, Lukas Bulwahn, Madhavan Srinivasan, Mahesh Salgaonkar, Mathieu
  Malaterre, Michael Neuling, Mukesh Ojha, Nathan Fontenot, Nathan Lynch,
  Nicholas Piggin, Nick Desaulniers, Oliver O'Halloran, Peng Hao, Qian Cai, Ravi
  Bangoria, Rick Lindsley, Russell Currey, Sachin Sant, Stewart Smith, Sukadev
  Bhattiprolu, Thomas Huth, Tobin C. Harding, Tyrel Datwyler, Valentin
  Schneider, Wei Yongjun, Wen Yang, YueHaibing.

- ------------------------------------------------------------------
Alastair D'Silva (11):
      ocxl: Rename struct link to ocxl_link
      ocxl: read_pasid never returns an error, so make it void
      ocxl: Remove superfluous 'extern' from headers
      ocxl: Remove some unused exported symbols
      ocxl: Split pci.c
      ocxl: Don't pass pci_dev around
      ocxl: Create a clear delineation between ocxl backend & frontend
      ocxl: Allow external drivers to use OpenCAPI contexts
      ocxl: afu_irq only deals with IRQ IDs, not offsets
      ocxl: move event_fd handling to frontend
      ocxl: Provide global MMIO accessors for external drivers

Alexey Kardashevskiy (1):
      powerpc/powernv/ioda: Handle failures correctly in pnv_pci_ioda_iommu_bypass_supported()

Andrew Donnellan (2):
      powerpc/powernv: Squash sparse warnings in opal-call.c
      MAINTAINERS: Update cxl/ocxl email address

Aneesh Kumar K.V (16):
      powerpc/mm/radix: Don't do SLB preload when using the radix MMU
      powerpc/mm: Fix build error with FLATMEM book3s64 config
      powerpc/mm: Remove PPC_MM_SLICES #ifdef for book3s64
      powerpc/mm: Add helpers for accessing hash translation related variables
      powerpc/mm: Move slb_addr_linit to early_init_mmu
      powerpc/mm: Reduce memory usage for mm_context_t for radix
      powerc/mm/hash: Reduce hash_mm_context size
      powerpc/mm/hash64: Add a variable to track the end of IO mapping
      powerpc/mm/hash64: Map all the kernel regions in the same 0xc range
      powerpc/mm: Validate address values against different region limits
      powerpc/mm: Drop the unnecessary region check
      powerpc/mm/hash: Simplify the region id calculation.
      powerpc/mm: Print kernel map details to dmesg
      powerpc/mm/hash: Rename KERNEL_REGION_ID to LINEAR_MAP_REGION_ID
      powerpc/mm: Fix section mismatch warning
      powerpc/mm/radix: Fix kernel crash when running subpage protect test

Anju T Sudhakar (6):
      powerpc/perf: Return accordingly on invalid chip-id in
      powerpc/perf: Fix loop exit condition in nest_imc_event_init
      powerpc/include: Add data structures and macros for IMC trace mode
      powerpc/perf: Rearrange setting of ldbar for thread-imc
      powerpc/perf: Trace imc events detection and cpuhotplug
      powerpc/perf: Trace imc PMU functions

Anton Blanchard (1):
      powerpc: Add doorbell tracepoints

Ben Hutchings (1):
      powerpc: vdso: Make vdso32 installation conditional in vdso_install

Bo YU (1):
      powerpc/boot: Fix missing check of lseek() return value

Breno Leitao (2):
      powerpc/tm: Avoid machine crash on rt_sigreturn()
      selftests/powerpc: Add a signal fuzzer selftest

Christoph Hellwig (1):
      powerpc: remove the __kernel_io_end export

Christophe Leroy (101):
      powerpc/highmem: Change BUG_ON() to WARN_ON()
      powerpc: Add framework for Kernel Userspace Protection
      powerpc: Add skeleton for Kernel Userspace Execution Prevention
      powerpc: Add a framework for Kernel Userspace Access Protection
      powerpc/32: Remove MSR_PR test when returning from syscall
      powerpc/32: Prepare for Kernel Userspace Access Protection
      powerpc/8xx: Only define APG0 and APG1
      powerpc/8xx: Add Kernel Userspace Execution Prevention
      powerpc/8xx: Add Kernel Userspace Access Protection
      powerpc/32s: Implement Kernel Userspace Execution Prevention.
      powerpc/32s: Prepare Kernel Userspace Access Protection
      powerpc/32s: Implement Kernel Userspace Access Protection
      powerpc/book3e: drop BUG_ON() in map_kernel_page()
      powerpc/nohash64: clean pgtable.h
      powerpc/mm: change #include "mmu_decl.h" to <mm/mmu_decl.h>
      powerpc/mm: Move book3s64 specifics in subdirectory mm/book3s64
      powerpc/mm: Move book3s32 specifics in subdirectory mm/book3s64
      powerpc/mm: Move nohash specifics in subdirectory mm/nohash
      powerpc/mm: fix erroneous duplicate slb_addr_limit init
      powerpc/mm: no slice for nohash/64
      powerpc/mm: hand a context_t over to slice_mask_for_size() instead of mm_struct
      powerpc/mm: move slice_mask_for_size() into mmu.h
      powerpc/mm: get rid of mm_ctx_slice_mask_xxx()
      powerpc/mm: remove unnecessary #ifdef CONFIG_PPC64
      powerpc/mm: remove a couple of #ifdef CONFIG_PPC_64K_PAGES in mm/slice.c
      powerpc/8xx: get rid of #ifdef CONFIG_HUGETLB_PAGE for slices
      powerpc/mm: define get_slice_psize() all the time
      powerpc/mm: define subarch SLB_ADDR_LIMIT_DEFAULT
      powerpc/book3e: drop mmu_get_tsize()
      powerpc/64: only book3s/64 supports CONFIG_PPC_64K_PAGES
      powerpc/book3e: hugetlbpage is only for CONFIG_PPC_FSL_BOOK3E
      powerpc/mm: move __find_linux_pte() out of hugetlbpage.c
      powerpc/mm: make hugetlbpage.c depend on CONFIG_HUGETLB_PAGE
      powerpc/mm: make gup_hugepte() static
      powerpc/mm: split asm/hugetlb.h into dedicated subarch files
      powerpc/mm: add a helper to populate hugepd
      powerpc/mm: cleanup ifdef mess in add_huge_page_size()
      powerpc/mm: move hugetlb_disabled into asm/hugetlb.h
      powerpc/mm: cleanup HPAGE_SHIFT setup
      powerpc/mm: cleanup remaining ifdef mess in hugetlbpage.c
      powerpc/mm: flatten function __find_linux_pte() step 1
      powerpc/mm: flatten function __find_linux_pte() step 2
      powerpc/mm: flatten function __find_linux_pte() step 3
      powerpc/mm: drop __bad_pte()
      powerpc/mm: convert Book3E 64 to pte_fragment
      powerpc/mm: move pgtable_t in asm/mmu.h
      powerpc/mm: get rid of nohash/32/mmu.h and nohash/64/mmu.h
      powerpc/Kconfig: select PPC_MM_SLICES from subarch type
      powerpc/book3e: move early_alloc_pgtable() to init section
      powerpc/mm: don't use pte_alloc_kernel() until slab is available on PPC32
      powerpc/mm: inline pte_alloc_one_kernel() and pte_alloc_one() on PPC32
      powerpc/mm: refactor pte_alloc_one() and pte_free() families definition.
      powerpc/mm: refactor definition of pgtable_cache[]
      powerpc/mm: Only keep one version of pmd_populate() functions on nohash/32
      powerpc/mm: refactor pgtable freeing functions on nohash
      powerpc/mm: refactor pmd_pgtable()
      powerpc/mm: refactor pgd_alloc() and pgd_free() on nohash
      powerpc/32: Move early_init() in a separate file
      powerpc: prepare string/mem functions for KASAN
      powerpc: remove CONFIG_CMDLINE #ifdef mess
      powerpc/prom_init: don't use string functions from lib/
      powerpc: don't use direct assignation during early boot.
      powerpc/32: use memset() instead of memset_io() to zero BSS
      powerpc/32: make KVIRT_TOP dependent on FIXMAP_START
      powerpc/32: prepare shadow area for KASAN
      powerpc: disable KASAN instrumentation on early/critical files.
      powerpc/32: Add KASAN support
      powerpc/32s: move hash code patching out of MMU_init_hw()
      powerpc/32s: set up an early static hash table for KASAN.
      powerpc/32s: map kasan zero shadow with PAGE_READONLY instead of PAGE_KERNEL_RO
      powerpc/32s: drop Hash_end
      powerpc/32s: don't try to print hash table address.
      powerpc/mm: print hash info in a helper
      powerpc/32: Refactor EXCEPTION entry macros for head_8xx.S and head_32.S
      powerpc/32: move LOAD_MSR_KERNEL() into head_32.h and use it
      powerpc/32: make the 6xx/8xx EXC_XFER_TEMPLATE() similar to the 40x/booke one
      powerpc/40x: Don't use SPRN_SPRG_SCRATCH2 in EXCEPTION_PROLOG
      powerpc/40x: add exception frame marker
      powerpc/40x: Split and rename NORMAL_EXCEPTION_PROLOG
      powerpc/40x: Refactor exception entry macros by using head_32.h
      powerpc/fsl_booke: ensure SPEFloatingPointException() reenables interrupts
      powerpc/32: enter syscall with MSR_EE inconditionaly set
      powerpc/32: Enter exceptions with MSR_EE unset
      powerpc/32: get rid of COPY_EE in exception entry
      powerpc: Fix 32-bit handling of MSR_EE on exceptions
      powerpc/32: implement fast entry for syscalls on non BOOKE
      powerpc/32: implement fast entry for syscalls on BOOKE
      powerpc/32: don't do syscall stuff in transfer_to_handler
      powerpc/32: Don't add dummy frames when calling trace_hardirqs_on/off
      powerpc/fadump: define an empty fadump_cleanup()
      powerpc/mm: define an empty mm_iommu_init()
      powerpc/setup: Remove unnecessary #ifdef CONFIG_ALTIVEC
      powerpc/setup: cleanup ifdef mess in check_cache_coherency()
      powerpc/setup: cleanup the #ifdef CONFIG_TAU block
      powerpc/setup: replace ifdefs by IS_ENABLED() wherever possible.
      powerpc/irq: drop __irq_offset_value
      powerpc/prom_init: get rid of PROM_SCRATCH_SIZE
      powerpc/kasan: add missing/lost Makefile
      powerpc/mm: Fix makefile for KASAN
      powerpc/mm: fix redundant inclusion of pgtable-frag.o in Makefile
      powerpc/mm: fix section mismatch for setup_kup()

Christopher M. Riedl (1):
      powerpc/xmon: add read-only mode

Colin Ian King (1):
      powerpc/mm: fix spelling mistake "Outisde" -> "Outside"

Cédric Le Goater (1):
      powerpc/xive: add OPAL extensions for the XIVE native exploitation support

Ganesh Goudar (1):
      powerpc/pseries: hwpoison the pages upon hitting UE

George Spelvin (1):
      powerpc/crypto: Use cheaper random numbers for crc-vpmsum self-test

Horia Geantă (1):
      powerpc/dts/fsl: add crypto node alias for B4

Jagadeesh Pagadala (1):
      powerpc: Remove duplicate headers

Joe Perches (1):
      powerpc/powernv/ioda2: Add __printf format/argument verification

Joel Stanley (2):
      powerpc/configs: Add (back) MLX5 ethernet support to skiroot_defconfig
      Documentation: powerpc: Expand the DAWR acronym

Julia Lawall (1):
      powerpc/83xx: Add missing of_node_put() after of_device_is_available()

Laurent Vivier (1):
      powerpc/mm: move warning from resize_hpt_for_hotplug()

Laurentiu Tudor (1):
      powerpc/booke64: set RI in default MSR

Lukas Bulwahn (1):
      MAINTAINERS: Update remaining @linux.vnet.ibm.com addresses

Madhavan Srinivasan (4):
      powerpc/perf: init pmu from core-book3s
      powerpc/perf: Add generic compat mode pmu driver
      powerpc/perf: Remove PM_BR_CMPL_ALT from power9 event list
      powerpc/perf: Add privileged access check for thread_imc

Mahesh Salgaonkar (5):
      powerpc/pseries/mce: Improve array initialization.
      powerpc/powernv/mce: Reduce MCE console logs to lesser lines.
      powerpc/powernv/mce: Print correct severity for MCE error.
      powerpc/powernv/mce: Print additional information about MCE error.
      powerpc/hmi: Fix kernel hang when TB is in error state.

Mathieu Malaterre (3):
      powerpc/embedded6xx: Make some functions static
      powerpc/embedded6xx: Remove unused functions holly_power_off and holly_halt
      powerpc/64s: Remove 'dummy_copy_buffer'

Michael Ellerman (11):
      Merge branch 'fixes' into next
      powerpc/32: Add ppc_defconfig
      powerpc: Fix defconfig choice logic when cross compiling
      powerpc/mm/64: Document the sizes of/sizes mapped by Pxx_INDEX_SIZE
      powerpc/powernv/idle: Restore AMR/UAMOR/AMOR after idle
      powerpc/64s: Implement KUAP for Radix MMU
      powerpc/mm: Detect bad KUAP faults
      powerpc/powernv/idle: Restore AMR/UAMOR/AMOR/IAMR after idle
      Merge branch 'topic/ppc-kvm' into next
      powerpc/security: Show powerpc_security_features in debugfs
      powerpc/64s: Use early_mmu_has_feature() in set_kuap()

Michael Neuling (1):
      powerpc: Add force enable of DAWR on P9 option

Nathan Fontenot (1):
      powerpc/pseries: Track LMB nid instead of using device tree

Nathan Lynch (2):
      powerpc/numa: improve control of topology updates
      powerpc/numa: document topology_updates_enabled, disable by default

Nicholas Piggin (3):
      powerpc/watchdog: Use hrtimers for per-CPU heartbeat
      powerpc/64s: Reimplement book3s idle code in C
      powerpc/64: Don't trace code that runs with the soft irq mask unreconciled

Nick Desaulniers (1):
      powerpc/vdso: Drop unnecessary cc-ldoption

Qian Cai (3):
      powerpc/mm: Silence unused-but-set-variable warnings
      powerpc/pseries/iommu: Fix set but not used values
      powerpc/pseries/pmem: Fix a set but not used value

Rick Lindsley (1):
      powerpc/book3s/64: check for NULL pointer in pgd_alloc()

Russell Currey (7):
      powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX
      powerpc/powernv/idle: Restore IAMR after idle
      powerpc/64: Setup KUP on secondary CPUs
      powerpc/mm/radix: Use KUEP API for Radix MMU
      powerpc/lib: Refactor __patch_instruction() to use __put_user_asm()
      powerpc/mm/ptdump: Wrap seq_printf() to handle NULL pointers
      powerpc/mm: Warn if W+X pages found on boot

Sachin Sant (1):
      powerpc/mm: Fix hugetlb page initialization

Sukadev Bhattiprolu (1):
      MAINTAINERS: Remove non-existent VAS file

Thomas Huth (1):
      powerpc/configs: Enable CONFIG_USB_XHCI_HCD by default

Tobin C. Harding (1):
      powerpc/cacheinfo: Fix kobject memleak

Valentin Schneider (1):
      powerpc/entry: Remove unneeded need_resched() loop

Wei Yongjun (1):
      ocxl: Fix return value check in afu_ioctl()

Wen Yang (1):
      powerpc/8xx: Fix possible device node reference leak

YueHaibing (1):
      ocxl: remove set but not used variables 'tid' and 'lpid'


 Documentation/admin-guide/kernel-parameters.txt    |    4 +-
 Documentation/powerpc/DAWR-POWER9.txt              |   40 +-
 MAINTAINERS                                        |   13 +-
 arch/powerpc/Kconfig                               |   10 +-
 arch/powerpc/Kconfig.debug                         |   32 +
 arch/powerpc/Makefile                              |   15 +-
 arch/powerpc/boot/addnote.c                        |    6 +-
 arch/powerpc/boot/dts/fsl/b4qds.dtsi               |    1 +
 arch/powerpc/configs/pseries_defconfig             |    1 +
 arch/powerpc/configs/skiroot_defconfig             |    2 +
 arch/powerpc/crypto/crc-vpmsum_test.c              |   10 +-
 arch/powerpc/include/asm/book3s/32/kup.h           |  145 +++
 arch/powerpc/include/asm/book3s/32/mmu-hash.h      |    9 +-
 arch/powerpc/include/asm/book3s/32/pgalloc.h       |   41 -
 arch/powerpc/include/asm/book3s/32/pgtable.h       |   13 +-
 arch/powerpc/include/asm/book3s/64/hash-4k.h       |   23 +-
 arch/powerpc/include/asm/book3s/64/hash-64k.h      |   21 +-
 arch/powerpc/include/asm/book3s/64/hash.h          |   95 +-
 arch/powerpc/include/asm/book3s/64/hugetlb.h       |   72 ++
 arch/powerpc/include/asm/book3s/64/kup-radix.h     |  108 ++
 arch/powerpc/include/asm/book3s/64/mmu-hash.h      |   70 +-
 arch/powerpc/include/asm/book3s/64/mmu.h           |  104 +-
 arch/powerpc/include/asm/book3s/64/pgalloc.h       |   52 +-
 arch/powerpc/include/asm/book3s/64/pgtable.h       |   12 +-
 arch/powerpc/include/asm/book3s/64/radix-4k.h      |    9 +-
 arch/powerpc/include/asm/book3s/64/radix-64k.h     |    8 +-
 arch/powerpc/include/asm/book3s/64/radix.h         |   40 +-
 arch/powerpc/include/asm/book3s/64/slice.h         |   13 +-
 arch/powerpc/include/asm/cpuidle.h                 |   19 +-
 arch/powerpc/include/asm/drmem.h                   |   21 +
 arch/powerpc/include/asm/exception-64s.h           |    2 +
 arch/powerpc/include/asm/fadump.h                  |    1 +
 arch/powerpc/include/asm/feature-fixups.h          |    3 +
 arch/powerpc/include/asm/fixmap.h                  |    5 +
 arch/powerpc/include/asm/futex.h                   |    4 +
 arch/powerpc/include/asm/hugetlb.h                 |   87 +-
 arch/powerpc/include/asm/hw_breakpoint.h           |    8 +
 arch/powerpc/include/asm/imc-pmu.h                 |   39 +
 arch/powerpc/include/asm/kasan.h                   |   40 +
 arch/powerpc/include/asm/kup.h                     |   73 ++
 arch/powerpc/include/asm/mce.h                     |   97 +-
 arch/powerpc/include/asm/mmu.h                     |   28 +-
 arch/powerpc/include/asm/mmu_context.h             |    7 +-
 arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h   |   44 +
 arch/powerpc/include/asm/nohash/32/kup-8xx.h       |   58 ++
 arch/powerpc/include/asm/nohash/32/mmu-8xx.h       |  102 +-
 arch/powerpc/include/asm/nohash/32/mmu.h           |   25 -
 arch/powerpc/include/asm/nohash/32/pgalloc.h       |  123 +--
 arch/powerpc/include/asm/nohash/32/pgtable.h       |   13 +-
 arch/powerpc/include/asm/nohash/32/slice.h         |    2 +
 arch/powerpc/include/asm/nohash/64/mmu.h           |   12 -
 arch/powerpc/include/asm/nohash/64/pgalloc.h       |  117 +--
 arch/powerpc/include/asm/nohash/64/pgtable.h       |   12 +-
 arch/powerpc/include/asm/nohash/64/slice.h         |   12 -
 arch/powerpc/include/asm/nohash/hugetlb-book3e.h   |   45 +
 arch/powerpc/include/asm/nohash/mmu-book3e.h       |    2 +
 arch/powerpc/include/asm/nohash/mmu.h              |   16 +-
 arch/powerpc/include/asm/nohash/pgalloc.h          |   56 ++
 arch/powerpc/include/asm/nohash/pte-book3e.h       |    5 -
 arch/powerpc/include/asm/opal-api.h                |   18 +-
 arch/powerpc/include/asm/opal.h                    |    9 +
 arch/powerpc/include/asm/paca.h                    |   40 +-
 arch/powerpc/include/asm/page.h                    |   23 +-
 arch/powerpc/include/asm/pgalloc.h                 |   51 +
 arch/powerpc/include/asm/pgtable-be-types.h        |    9 +-
 arch/powerpc/include/asm/pgtable-types.h           |    9 +-
 arch/powerpc/include/asm/pgtable.h                 |    9 +-
 arch/powerpc/include/asm/processor.h               |   12 +-
 arch/powerpc/include/asm/ptrace.h                  |   11 +-
 arch/powerpc/include/asm/reg.h                     |    8 +-
 arch/powerpc/include/asm/reg_booke.h               |    2 +-
 arch/powerpc/include/asm/slice.h                   |    9 +-
 arch/powerpc/include/asm/sparsemem.h               |    4 +-
 arch/powerpc/include/asm/string.h                  |   32 +-
 arch/powerpc/include/asm/task_size_64.h            |    2 +-
 arch/powerpc/include/asm/time.h                    |    2 +
 arch/powerpc/include/asm/trace.h                   |   16 +
 arch/powerpc/include/asm/uaccess.h                 |   38 +-
 arch/powerpc/include/asm/xive.h                    |   14 +
 arch/powerpc/kernel/Makefile                       |   14 +-
 arch/powerpc/kernel/asm-offsets.c                  |   25 +-
 arch/powerpc/kernel/cacheinfo.c                    |   13 +-
 arch/powerpc/kernel/cputable.c                     |   13 +-
 arch/powerpc/kernel/dbell.c                        |    3 +
 arch/powerpc/kernel/early_32.c                     |   36 +
 arch/powerpc/kernel/entry_32.S                     |  186 ++--
 arch/powerpc/kernel/entry_64.S                     |   35 +-
 arch/powerpc/kernel/exceptions-64s.S               |   26 +-
 arch/powerpc/kernel/fadump.c                       |    1 +
 arch/powerpc/kernel/fpu.S                          |    1 +
 arch/powerpc/kernel/head_32.S                      |  258 ++---
 arch/powerpc/kernel/head_32.h                      |  203 ++++
 arch/powerpc/kernel/head_40x.S                     |  155 +--
 arch/powerpc/kernel/head_44x.S                     |   12 +-
 arch/powerpc/kernel/head_64.S                      |    4 +-
 arch/powerpc/kernel/head_8xx.S                     |  136 +--
 arch/powerpc/kernel/head_booke.h                   |  131 ++-
 arch/powerpc/kernel/head_fsl_booke.S               |   32 +-
 arch/powerpc/kernel/hw_breakpoint.c                |   62 +-
 arch/powerpc/kernel/idle_book3s.S                  | 1060 +++-----------------
 arch/powerpc/kernel/irq.c                          |   16 +-
 arch/powerpc/kernel/mce.c                          |  106 +-
 arch/powerpc/kernel/mce_power.c                    |  253 ++---
 arch/powerpc/kernel/paca.c                         |   12 +-
 arch/powerpc/kernel/process.c                      |   35 +-
 arch/powerpc/kernel/prom_init.c                    |  248 +++--
 arch/powerpc/kernel/prom_init_check.sh             |   12 +-
 arch/powerpc/kernel/ptrace.c                       |    3 +-
 arch/powerpc/kernel/security.c                     |    8 +
 arch/powerpc/kernel/setup-common.c                 |  116 +--
 arch/powerpc/kernel/setup_32.c                     |   28 -
 arch/powerpc/kernel/setup_64.c                     |   10 +
 arch/powerpc/kernel/signal_64.c                    |   27 +-
 arch/powerpc/kernel/time.c                         |   10 +-
 arch/powerpc/kernel/traps.c                        |    8 +
 arch/powerpc/kernel/vdso32/Makefile                |    5 +-
 arch/powerpc/kernel/vdso64/Makefile                |    5 +-
 arch/powerpc/kernel/vector.S                       |    1 +
 arch/powerpc/kernel/watchdog.c                     |   81 +-
 arch/powerpc/kvm/book3s_hv.c                       |    3 +-
 arch/powerpc/kvm/book3s_hv_rm_xics.c               |    2 +-
 arch/powerpc/kvm/book3s_hv_rmhandlers.S            |  141 +--
 arch/powerpc/lib/Makefile                          |   19 +-
 arch/powerpc/lib/checksum_wrappers.c               |    4 +
 arch/powerpc/lib/code-patching.c                   |    5 +-
 arch/powerpc/lib/copy_32.S                         |   12 +-
 arch/powerpc/lib/mem_64.S                          |    9 +-
 arch/powerpc/lib/memcpy_64.S                       |    4 +-
 arch/powerpc/mm/Makefile                           |   47 +-
 arch/powerpc/mm/book3s32/Makefile                  |    9 +
 .../mm/{hash_low_32.S => book3s32/hash_low.S}      |    6 +-
 arch/powerpc/mm/{ppc_mmu_32.c => book3s32/mmu.c}   |   76 +-
 .../mmu_context.c}                                 |    0
 arch/powerpc/mm/{tlb_hash32.c => book3s32/tlb.c}   |    2 +-
 arch/powerpc/mm/book3s64/Makefile                  |   24 +
 .../powerpc/mm/{hash64_4k.c => book3s64/hash_4k.c} |    2 +-
 .../mm/{hash64_64k.c => book3s64/hash_64k.c}       |    2 +-
 .../hash_hugepage.c}                               |    2 +-
 .../hash_hugetlbpage.c}                            |   31 +-
 .../{hash_native_64.c => book3s64/hash_native.c}   |    0
 .../{pgtable-hash64.c => book3s64/hash_pgtable.c}  |   15 +-
 .../mm/{tlb_hash64.c => book3s64/hash_tlb.c}       |   18 +-
 .../mm/{hash_utils_64.c => book3s64/hash_utils.c}  |  145 ++-
 .../{mmu_context_iommu.c => book3s64/iommu_api.c}  |    0
 .../mmu_context.c}                                 |   29 +-
 .../mm/{pgtable-book3s64.c => book3s64/pgtable.c}  |    2 +-
 arch/powerpc/mm/{ => book3s64}/pkeys.c             |    1 +
 .../radix_hugetlbpage.c}                           |    0
 .../{pgtable-radix.c => book3s64/radix_pgtable.c}  |  117 ++-
 .../mm/{tlb-radix.c => book3s64/radix_tlb.c}       |    0
 arch/powerpc/mm/{ => book3s64}/slb.c               |   31 +-
 .../mm/{subpage-prot.c => book3s64/subpage_prot.c} |   39 +-
 arch/powerpc/mm/{ => book3s64}/vphn.c              |    6 +-
 arch/powerpc/mm/{ => book3s64}/vphn.h              |    3 +-
 arch/powerpc/mm/copro_fault.c                      |   18 +-
 arch/powerpc/mm/dma-noncoherent.c                  |    2 +-
 arch/powerpc/mm/drmem.c                            |    6 +-
 arch/powerpc/mm/fault.c                            |   49 +-
 arch/powerpc/mm/highmem.c                          |   14 +-
 arch/powerpc/mm/hugetlbpage.c                      |  242 +----
 arch/powerpc/mm/init-common.c                      |   26 +
 arch/powerpc/mm/init_32.c                          |    8 +-
 arch/powerpc/mm/init_64.c                          |    2 +-
 arch/powerpc/mm/kasan/Makefile                     |    5 +
 arch/powerpc/mm/kasan/kasan_init_32.c              |  183 ++++
 arch/powerpc/mm/mem.c                              |   17 +-
 arch/powerpc/mm/mmu_context.c                      |    2 +-
 arch/powerpc/mm/mmu_decl.h                         |    9 +-
 arch/powerpc/mm/{40x_mmu.c => nohash/40x.c}        |    2 +-
 arch/powerpc/mm/{44x_mmu.c => nohash/44x.c}        |    2 +-
 arch/powerpc/mm/{8xx_mmu.c => nohash/8xx.c}        |   26 +-
 arch/powerpc/mm/nohash/Makefile                    |   18 +
 .../book3e_hugetlbpage.c}                          |   52 +-
 .../{pgtable-book3e.c => nohash/book3e_pgtable.c}  |    9 +-
 .../mm/{fsl_booke_mmu.c => nohash/fsl_booke.c}     |    2 +-
 .../{mmu_context_nohash.c => nohash/mmu_context.c} |    2 +-
 arch/powerpc/mm/{tlb_nohash.c => nohash/tlb.c}     |   19 +-
 .../mm/{tlb_nohash_low.S => nohash/tlb_low.S}      |    0
 arch/powerpc/mm/{ => nohash}/tlb_low_64e.S         |   31 -
 arch/powerpc/mm/numa.c                             |   35 +-
 arch/powerpc/mm/pgtable.c                          |  114 +++
 arch/powerpc/mm/pgtable_32.c                       |   47 +-
 arch/powerpc/mm/pgtable_64.c                       |   13 +-
 arch/powerpc/mm/ptdump/hashpagetable.c             |    2 +-
 arch/powerpc/mm/ptdump/ptdump.c                    |   86 +-
 arch/powerpc/mm/slice.c                            |  109 +-
 arch/powerpc/perf/Makefile                         |    3 +-
 arch/powerpc/perf/core-book3s.c                    |   28 +
 arch/powerpc/perf/generic-compat-pmu.c             |  234 +++++
 arch/powerpc/perf/imc-pmu.c                        |  347 ++++++-
 arch/powerpc/perf/internal.h                       |   12 +
 arch/powerpc/perf/power5+-pmu.c                    |    4 +-
 arch/powerpc/perf/power5-pmu.c                     |    4 +-
 arch/powerpc/perf/power6-pmu.c                     |    4 +-
 arch/powerpc/perf/power7-pmu.c                     |    4 +-
 arch/powerpc/perf/power8-pmu.c                     |    3 +-
 arch/powerpc/perf/power9-events-list.h             |    2 -
 arch/powerpc/perf/power9-pmu.c                     |    3 +-
 arch/powerpc/perf/ppc970-pmu.c                     |    4 +-
 arch/powerpc/platforms/83xx/usb.c                  |    4 +-
 arch/powerpc/platforms/8xx/pic.c                   |    3 +-
 arch/powerpc/platforms/Kconfig.cputype             |   45 +-
 arch/powerpc/platforms/cell/spu_base.c             |    4 +-
 arch/powerpc/platforms/embedded6xx/holly.c         |   19 +-
 arch/powerpc/platforms/powermac/Makefile           |    6 +
 arch/powerpc/platforms/powernv/idle.c              |  902 +++++++++++++----
 arch/powerpc/platforms/powernv/opal-call.c         |    6 +
 arch/powerpc/platforms/powernv/opal-imc.c          |    5 +-
 arch/powerpc/platforms/powernv/opal.c              |   23 +-
 arch/powerpc/platforms/powernv/pci-ioda.c          |   35 +-
 arch/powerpc/platforms/powernv/pci.h               |    2 +
 arch/powerpc/platforms/powernv/setup.c             |    5 +-
 arch/powerpc/platforms/powernv/subcore.c           |    2 +-
 arch/powerpc/platforms/pseries/hotplug-memory.c    |   17 +-
 arch/powerpc/platforms/pseries/iommu.c             |   13 +-
 arch/powerpc/platforms/pseries/lpar.c              |    3 +-
 arch/powerpc/platforms/pseries/pmem.c              |    3 +-
 arch/powerpc/platforms/pseries/ras.c               |  135 ++-
 arch/powerpc/purgatory/Makefile                    |    3 +
 arch/powerpc/sysdev/xive/native.c                  |   99 ++
 arch/powerpc/xmon/Makefile                         |    1 +
 arch/powerpc/xmon/xmon.c                           |   66 +-
 drivers/misc/cxl/fault.c                           |    2 +-
 drivers/misc/ocxl/Makefile                         |    3 +-
 drivers/misc/ocxl/afu_irq.c                        |  102 +-
 drivers/misc/ocxl/config.c                         |   13 +-
 drivers/misc/ocxl/context.c                        |   31 +-
 drivers/misc/ocxl/core.c                           |  574 +++++++++++
 drivers/misc/ocxl/file.c                           |  182 +++-
 drivers/misc/ocxl/link.c                           |   42 +-
 drivers/misc/ocxl/mmio.c                           |  234 +++++
 drivers/misc/ocxl/ocxl_internal.h                  |   94 +-
 drivers/misc/ocxl/pci.c                            |  565 +----------
 drivers/misc/ocxl/sysfs.c                          |   54 +-
 drivers/misc/ocxl/trace.h                          |   12 +-
 include/linux/cpuhotplug.h                         |    1 +
 include/misc/ocxl.h                                |  359 ++++++-
 .../selftests/powerpc/copyloops/asm/export.h       |    1 +
 .../selftests/powerpc/copyloops/asm/kasan.h        |    0
 .../selftests/powerpc/copyloops/asm/ppc_asm.h      |    1 +
 tools/testing/selftests/powerpc/harness.c          |    6 +-
 tools/testing/selftests/powerpc/include/reg.h      |    2 +
 tools/testing/selftests/powerpc/signal/.gitignore  |    1 +
 tools/testing/selftests/powerpc/signal/Makefile    |    3 +-
 tools/testing/selftests/powerpc/signal/sigfuz.c    |  325 ++++++
 tools/testing/selftests/powerpc/vphn/vphn.c        |    2 +-
 tools/testing/selftests/powerpc/vphn/vphn.h        |    2 +-
 247 files changed, 7819 insertions(+), 4558 deletions(-)
 create mode 100644 arch/powerpc/include/asm/book3s/32/kup.h
 create mode 100644 arch/powerpc/include/asm/book3s/64/kup-radix.h
 create mode 100644 arch/powerpc/include/asm/kasan.h
 create mode 100644 arch/powerpc/include/asm/kup.h
 create mode 100644 arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
 create mode 100644 arch/powerpc/include/asm/nohash/32/kup-8xx.h
 delete mode 100644 arch/powerpc/include/asm/nohash/32/mmu.h
 delete mode 100644 arch/powerpc/include/asm/nohash/64/mmu.h
 delete mode 100644 arch/powerpc/include/asm/nohash/64/slice.h
 create mode 100644 arch/powerpc/include/asm/nohash/hugetlb-book3e.h
 create mode 100644 arch/powerpc/kernel/early_32.c
 create mode 100644 arch/powerpc/kernel/head_32.h
 create mode 100644 arch/powerpc/mm/book3s32/Makefile
 rename arch/powerpc/mm/{hash_low_32.S => book3s32/hash_low.S} (99%)
 rename arch/powerpc/mm/{ppc_mmu_32.c => book3s32/mmu.c} (86%)
 rename arch/powerpc/mm/{mmu_context_hash32.c => book3s32/mmu_context.c} (100%)
 rename arch/powerpc/mm/{tlb_hash32.c => book3s32/tlb.c} (99%)
 create mode 100644 arch/powerpc/mm/book3s64/Makefile
 rename arch/powerpc/mm/{hash64_4k.c => book3s64/hash_4k.c} (98%)
 rename arch/powerpc/mm/{hash64_64k.c => book3s64/hash_64k.c} (99%)
 rename arch/powerpc/mm/{hugepage-hash64.c => book3s64/hash_hugepage.c} (98%)
 rename arch/powerpc/mm/{hugetlbpage-hash64.c => book3s64/hash_hugetlbpage.c} (84%)
 rename arch/powerpc/mm/{hash_native_64.c => book3s64/hash_native.c} (100%)
 rename arch/powerpc/mm/{pgtable-hash64.c => book3s64/hash_pgtable.c} (97%)
 rename arch/powerpc/mm/{tlb_hash64.c => book3s64/hash_tlb.c} (95%)
 rename arch/powerpc/mm/{hash_utils_64.c => book3s64/hash_utils.c} (94%)
 rename arch/powerpc/mm/{mmu_context_iommu.c => book3s64/iommu_api.c} (100%)
 rename arch/powerpc/mm/{mmu_context_book3s64.c => book3s64/mmu_context.c} (86%)
 rename arch/powerpc/mm/{pgtable-book3s64.c => book3s64/pgtable.c} (99%)
 rename arch/powerpc/mm/{ => book3s64}/pkeys.c (99%)
 rename arch/powerpc/mm/{hugetlbpage-radix.c => book3s64/radix_hugetlbpage.c} (100%)
 rename arch/powerpc/mm/{pgtable-radix.c => book3s64/radix_pgtable.c} (93%)
 rename arch/powerpc/mm/{tlb-radix.c => book3s64/radix_tlb.c} (100%)
 rename arch/powerpc/mm/{ => book3s64}/slb.c (97%)
 rename arch/powerpc/mm/{subpage-prot.c => book3s64/subpage_prot.c} (91%)
 rename arch/powerpc/mm/{ => book3s64}/vphn.c (94%)
 rename arch/powerpc/mm/{ => book3s64}/vphn.h (98%)
 create mode 100644 arch/powerpc/mm/kasan/Makefile
 create mode 100644 arch/powerpc/mm/kasan/kasan_init_32.c
 rename arch/powerpc/mm/{40x_mmu.c => nohash/40x.c} (99%)
 rename arch/powerpc/mm/{44x_mmu.c => nohash/44x.c} (99%)
 rename arch/powerpc/mm/{8xx_mmu.c => nohash/8xx.c} (92%)
 create mode 100644 arch/powerpc/mm/nohash/Makefile
 rename arch/powerpc/mm/{hugetlbpage-book3e.c => nohash/book3e_hugetlbpage.c} (93%)
 rename arch/powerpc/mm/{pgtable-book3e.c => nohash/book3e_pgtable.c} (93%)
 rename arch/powerpc/mm/{fsl_booke_mmu.c => nohash/fsl_booke.c} (99%)
 rename arch/powerpc/mm/{mmu_context_nohash.c => nohash/mmu_context.c} (99%)
 rename arch/powerpc/mm/{tlb_nohash.c => nohash/tlb.c} (98%)
 rename arch/powerpc/mm/{tlb_nohash_low.S => nohash/tlb_low.S} (100%)
 rename arch/powerpc/mm/{ => nohash}/tlb_low_64e.S (97%)
 create mode 100644 arch/powerpc/perf/generic-compat-pmu.c
 create mode 100644 arch/powerpc/perf/internal.h
 create mode 100644 drivers/misc/ocxl/core.c
 create mode 100644 drivers/misc/ocxl/mmio.c
 create mode 100644 tools/testing/selftests/powerpc/copyloops/asm/kasan.h
 create mode 100644 tools/testing/selftests/powerpc/signal/sigfuz.c
-----BEGIN PGP SIGNATURE-----

iQIcBAEBAgAGBQJc1WwkAAoJEFHr6jzI4aWANQgP/2RYeiPkwLHLaSzLug+hfKC9
lT0SdKT4nMcxZaT74FpYLpKihu5WaWO4Cye2UMNTZGR5ZeX7sOtTJJtGB9cHBs8s
/nXFunaaDI0R8qU73rRWezDGJ2iqQAfZb5eUIMByENM/paD7AIyeQjpC2ZLHJCVM
f4Yts/1dp7kdqiIZ0DOmeS1fqUSC6pRTZmZK34e5ALGuUUal7QIdQ406yjxszndW
cM09rS92skIXveHtABKvMetpezFt78aAv8Gq7OhJyR8ffos2/f7rXLi9F1Flg1o3
nQwtTy+SukTYqdYOukdVVJeRcHKnKyY0YyCj/5sVmLw9DFhLCzYdeSanSxT+O3zh
U/gXuH1AYL8dcKgOD9iEhzjISyeM5VXLxjaT7jAaltoVz/KXIDYLuWjVAjpwvLyv
ZFyGmDLQkvg2uoiaamdPBlTavx6x7PpoUyYuMxdznK4zkAB9be9Y5sG8bVlh0qeV
DsCiiecRbXt8Xp48rIfO483B7xaH2DKvFOnXR4AnWFFe+oUlpjnbELmJUryMxvmz
4Yv9sAgLl/6BGTe57HXAKGtzUUnRJXivnrelWrEz/jDk2x9vCgDfG4QFQNXt/acT
tATwAJWAMUklVXC6FwSjC7m344jzkGBeImINAX9rydwscljUgEgBX9dI4BMaJQij
XXnj5AMLik9Ka4i0i/jN
=cuou
-----END PGP SIGNATURE-----

^ permalink raw reply

* [PATCH 1/2] powerpc/8xx: move CPM1 related files from sysdev/ to platforms/8xx
From: Christophe Leroy @ 2019-05-10 11:25 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Vitaly Bordug, Scott Wood
  Cc: linuxppc-dev, linux-kernel

Only 8xx selects CPM1 and related CONFIG options are already
in platforms/8xx/Kconfig

This patch moves the related C files to platforms/8xx/.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/platforms/8xx/Makefile                 | 3 +++
 arch/powerpc/{sysdev => platforms/8xx}/cpm1.c       | 0
 arch/powerpc/{sysdev => platforms/8xx}/cpm_gpio.c   | 0
 arch/powerpc/{sysdev => platforms/8xx}/micropatch.c | 0
 arch/powerpc/sysdev/Makefile                        | 3 ---
 5 files changed, 3 insertions(+), 3 deletions(-)
 rename arch/powerpc/{sysdev => platforms/8xx}/cpm1.c (100%)
 rename arch/powerpc/{sysdev => platforms/8xx}/cpm_gpio.c (100%)
 rename arch/powerpc/{sysdev => platforms/8xx}/micropatch.c (100%)

diff --git a/arch/powerpc/platforms/8xx/Makefile b/arch/powerpc/platforms/8xx/Makefile
index 708ab099e886..10b338436655 100644
--- a/arch/powerpc/platforms/8xx/Makefile
+++ b/arch/powerpc/platforms/8xx/Makefile
@@ -3,6 +3,9 @@
 # Makefile for the PowerPC 8xx linux kernel.
 #
 obj-y			+= m8xx_setup.o machine_check.o pic.o
+obj-$(CONFIG_CPM1)		+= cpm1.o
+obj-$(CONFIG_UCODE_PATCH)	+= micropatch.o
+obj-$(CONFIG_8xx_GPIO)		+= cpm_gpio.o
 obj-$(CONFIG_MPC885ADS)   += mpc885ads_setup.o
 obj-$(CONFIG_MPC86XADS)   += mpc86xads_setup.o
 obj-$(CONFIG_PPC_EP88XC)  += ep88xc.o
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/platforms/8xx/cpm1.c
similarity index 100%
rename from arch/powerpc/sysdev/cpm1.c
rename to arch/powerpc/platforms/8xx/cpm1.c
diff --git a/arch/powerpc/sysdev/cpm_gpio.c b/arch/powerpc/platforms/8xx/cpm_gpio.c
similarity index 100%
rename from arch/powerpc/sysdev/cpm_gpio.c
rename to arch/powerpc/platforms/8xx/cpm_gpio.c
diff --git a/arch/powerpc/sysdev/micropatch.c b/arch/powerpc/platforms/8xx/micropatch.c
similarity index 100%
rename from arch/powerpc/sysdev/micropatch.c
rename to arch/powerpc/platforms/8xx/micropatch.c
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index aaf23283ba0c..cfcade8270a9 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -37,12 +37,9 @@ obj-$(CONFIG_XILINX_PCI)	+= xilinx_pci.o
 obj-$(CONFIG_OF_RTC)		+= of_rtc.o
 
 obj-$(CONFIG_CPM)		+= cpm_common.o
-obj-$(CONFIG_CPM1)		+= cpm1.o
 obj-$(CONFIG_CPM2)		+= cpm2.o cpm2_pic.o cpm_gpio.o
-obj-$(CONFIG_8xx_GPIO)		+= cpm_gpio.o
 obj-$(CONFIG_QUICC_ENGINE)	+= cpm_common.o
 obj-$(CONFIG_PPC_DCR)		+= dcr.o
-obj-$(CONFIG_UCODE_PATCH)	+= micropatch.o
 
 obj-$(CONFIG_PPC_MPC512x)	+= mpc5xxx_clocks.o
 obj-$(CONFIG_PPC_MPC52xx)	+= mpc5xxx_clocks.o
-- 
2.13.3


^ permalink raw reply related

* [PATCH 2/2] powerpc/8xx: Add microcode patch to move SMC parameter RAM.
From: Christophe Leroy @ 2019-05-10 11:25 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Vitaly Bordug, Scott Wood
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <35488171038e3d40e7680b8513dfbd52ff7b6ef2.1557487355.git.christophe.leroy@c-s.fr>

Some SCC functions like the QMC requires an extended parameter RAM.
On modern 8xx (ie 866 and 885), SPI area can already be relocated,
allowing the use of those functions on SCC2. But SCC3 and SCC4
parameter RAM collide with SMC1 and SMC2 parameter RAMs.

This patch adds microcode to allow the relocation of both SMC1 and
SMC2, and relocate them at offsets 0x1ec0 and 0x1fc0.
Those offsets are by default for the CPM1 DSP1 and DSP2, but there
is no kernel driver using them at the moment so this area can be
reused.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/platforms/8xx/Kconfig      |   7 ++
 arch/powerpc/platforms/8xx/micropatch.c | 109 +++++++++++++++++++++++++++++++-
 2 files changed, 114 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index d408162d5af4..e0fe670f06f6 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -157,6 +157,13 @@ config I2C_SPI_SMC1_UCODE_PATCH
 	help
 	  Help not implemented yet, coming soon.
 
+config SMC_UCODE_PATCH
+	bool "SMC relocation patch"
+	help
+	  This microcode relocates SMC1 and SMC2 parameter RAMs at
+	  offset 0x1ec0 and 0x1fc0 to allow extended parameter RAM
+	  for SCC3 and SCC4.
+
 endchoice
 
 config UCODE_PATCH
diff --git a/arch/powerpc/platforms/8xx/micropatch.c b/arch/powerpc/platforms/8xx/micropatch.c
index 33a9042fca80..dc4423daf7d4 100644
--- a/arch/powerpc/platforms/8xx/micropatch.c
+++ b/arch/powerpc/platforms/8xx/micropatch.c
@@ -622,6 +622,86 @@ static uint patch_2f00[] __initdata = {
 };
 #endif
 
+/*
+ * SMC relocation patch arrays.
+ */
+
+#ifdef CONFIG_SMC_UCODE_PATCH
+
+static uint patch_2000[] __initdata = {
+	0x3fff0000, 0x3ffd0000, 0x3ffb0000, 0x3ff90000,
+	0x5fefeff8, 0x5f91eff8, 0x3ff30000, 0x3ff10000,
+	0x3a11e710, 0xedf0ccb9, 0xf318ed66, 0x7f0e5fe2,
+	0x7fedbb38, 0x3afe7468, 0x7fedf4d8, 0x8ffbb92d,
+	0xb83b77fd, 0xb0bb5eb9, 0xdfda7fed, 0x90bde74d,
+	0x6f0dcbd3, 0xe7decfed, 0xcb50cfed, 0xcfeddf6d,
+	0x914d4f74, 0x5eaedfcb, 0x9ee0e7df, 0xefbb6ffb,
+	0xe7ef7f0e, 0x9ee57fed, 0xebb7effa, 0xeb30affb,
+	0x7fea90b3, 0x7e0cf09f, 0xbffff318, 0x5fffdfff,
+	0xac35efea, 0x7fce1fc1, 0xe2ff5fbd, 0xaffbe2ff,
+	0x5fbfaffb, 0xf9a87d0f, 0xaef8770f, 0x7d0fb0a2,
+	0xeffbbfff, 0xcfef5fba, 0x7d0fbfff, 0x5fba4cf8,
+	0x7fddd09b, 0x49f847fd, 0x7efdf097, 0x7fedfffd,
+	0x7dfdf093, 0xef7e7e1e, 0x5fba7f0e, 0x3a11e710,
+	0xedf0cc87, 0xfb18ad0a, 0x1f85bbb8, 0x74283b7e,
+	0x7375e4bb, 0x2ab64fb8, 0x5c7de4bb, 0x32fdffbf,
+	0x5f0843f8, 0x7ce3e1bb, 0xe74f7ded, 0x6f0f4fe8,
+	0xc7ba32be, 0x73f2efeb, 0x600b4f78, 0xe5bb760b,
+	0x5388aef8, 0x4ef80b6a, 0xcfef9ee5, 0xabf8751f,
+	0xefef5b88, 0x741f4fe8, 0x751e760d, 0x7fdb70dd,
+	0x741cafce, 0xefcc7fce, 0x751e7088, 0x741ce7bb,
+	0x334ecfed, 0xafdbefeb, 0xe5bb760b, 0x53ceaef8,
+	0xafe8e7eb, 0x4bf8771e, 0x7e007fed, 0x4fcbe2cc,
+	0x7fbc3085, 0x7b0f7a0f, 0x34b177fd, 0xb0e75e93,
+	0xdf313e3b, 0xaf78741f, 0x741f30cc, 0xcfef5f08,
+	0x741f3e88, 0xafb8771e, 0x5f437fed, 0x0bafe2cc,
+	0x741ccfec, 0xe5ca53a9, 0x6fcb4f74, 0x5e89df27,
+	0x2a923d14, 0x4b8fdf0c, 0x751f741c, 0x6c1eeffa,
+	0xefea7fce, 0x6ffc309a, 0xefec3fca, 0x308fdf0a,
+	0xadf85e7a, 0xaf7daefd, 0x5e7adf0a, 0x5e7aafdd,
+	0x761f1088, 0x1e7c7efd, 0x3089fffe, 0x4908fb18,
+	0x5fffdfff, 0xafbbf0f7, 0x4ef85f43, 0xadf81489,
+	0x7a0f7089, 0xcfef5089, 0x7a0fdf0c, 0x5e7cafed,
+	0xbc6e780f, 0xefef780f, 0xefef790f, 0xa7f85eeb,
+	0xffef790f, 0xefef790f, 0x1489df0a, 0x5e7aadfd,
+	0x5f09fffb, 0xe79aded9, 0xeff96079, 0x607ae79a,
+	0xded8eff9, 0x60795edb, 0x607acfef, 0xefefefdf,
+	0xefbfef7f, 0xeeffedff, 0xebffe7ff, 0xafefafdf,
+	0xafbfaf7f, 0xaeffadff, 0xabffa7ff, 0x6fef6fdf,
+	0x6fbf6f7f, 0x6eff6dff, 0x6bff67ff, 0x2fef2fdf,
+	0x2fbf2f7f, 0x2eff2dff, 0x2bff27ff, 0x4e08fd1f,
+	0xe5ff6e0f, 0xaff87eef, 0x7e0ffdef, 0xf11f6079,
+	0xabf8f51e, 0x7e0af11c, 0x37cfae16, 0x7fec909a,
+	0xadf8efdc, 0xcfeae52f, 0x7d0fe12b, 0xf11c6079,
+	0x7e0a4df8, 0xcfea5ea0, 0x7d0befec, 0xcfea5ea2,
+	0xe522efdc, 0x5ea2cfda, 0x4e08fd1f, 0x6e0faff8,
+	0x7c1f761f, 0xfdeff91f, 0x6079abf8, 0x761cee00,
+	0xf91f2bfb, 0xefefcfec, 0xf91f6079, 0x761c27fb,
+	0xefdf5e83, 0xcfdc7fdd, 0x50f84bf8, 0x47fd7c1f,
+	0x761ccfcf, 0x7eef7fed, 0x7dfd70ef, 0xef7e7f1e,
+	0x771efb18, 0x6079e722, 0xe6bbe5bb, 0x2e66e5bb,
+	0x600b2ee1, 0xe2bbe2bb, 0xe2bbe2bb, 0x2f5ee2bb,
+	0xe2bb2ff9, 0x6079e2bb,
+};
+
+static uint patch_2f00[] __initdata = {
+	0x30303030, 0x3e3e3030, 0xaf79b9b3, 0xbaa3b979,
+	0x9693369f, 0x79f79777, 0x97333fff, 0xfb3b9e9f,
+	0x79b91d11, 0x9e13f3ff, 0x3f9b6bd9, 0xe173d136,
+	0x695669d1, 0x697b3daf, 0x79b93a3a, 0x3f979f91,
+	0x379ff976, 0xf99777fd, 0x9779737d, 0xe9d6bbf9,
+	0xbfffd9df, 0x97f7fd97, 0x6f7b9bff, 0xf9bd9683,
+	0x397db973, 0xd97b3b9f, 0xd7f9f733, 0x9993bb9e,
+	0xe1f9ef93, 0x73773337, 0xb936917d, 0x11f87379,
+	0xb979d336, 0x8b7ded73, 0x1b7d9337, 0x31f3f22f,
+	0x3f2327ee, 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee,
+	0xeeeeee4b, 0xf4fbdbd2, 0x58bb1878, 0x577fdfd2,
+	0xd573b773, 0xf7374b4f, 0xbdbd25b8, 0xb177d2d1,
+	0x7376856b, 0xbfdd687b, 0xdd2fff8f, 0x78ffff8f,
+	0xf22f0000,
+};
+#endif
+
 void __init cpm_load_patch(cpm8xx_t *cp)
 {
 	volatile uint		*dp;		/* Dual-ported RAM. */
@@ -630,9 +710,9 @@ void __init cpm_load_patch(cpm8xx_t *cp)
     defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
 	volatile iic_t		*iip;
 	volatile struct spi_pram *spp;
-#ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH
-	volatile smc_uart_t	*smp;
 #endif
+#if defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH) || defined(CONFIG_SMC_UCODE_PATCH)
+	volatile smc_uart_t	*smp;
 #endif
 	int	i;
 
@@ -706,6 +786,31 @@ void __init cpm_load_patch(cpm8xx_t *cp)
 # endif /* CONFIG_I2C_SPI_SMC1_UCODE_PATCH) */
 
 #endif /* some variation of the I2C/SPI patch was selected */
+
+#if defined(CONFIG_SMC_UCODE_PATCH)
+
+	commproc->cp_rccr = 0;
+
+	dp = (uint *)commproc->cp_dpmem;
+	for (i = 0; i < sizeof(patch_2000) / 4; i++)
+		*dp++ = patch_2000[i];
+
+	dp = (uint *)&commproc->cp_dpmem[0x0f00];
+	for (i = 0; i < sizeof(patch_2f00) / 4; i++)
+		*dp++ = patch_2f00[i];
+
+
+	commproc->cp_cpmcr1 = 0x8080;
+	commproc->cp_cpmcr2 = 0x8088;
+	commproc->cp_rccr = 2;
+
+	smp = (smc_uart_t *)&commproc->cp_dparam[PROFF_SMC1];
+	smp->smc_rpbase = 0x1ec0;
+	smp = (smc_uart_t *)&commproc->cp_dparam[PROFF_SMC2];
+	smp->smc_rpbase = 0x1fc0;
+
+	pr_info("SMC microcode patch installed.\n");
+#endif /* CONFIG_SMC_UCODE_PATCH */
 }
 
 /*
-- 
2.13.3


^ permalink raw reply related

* Re: [PATCH 09/16] mmc: sdhci-xenon: use new match_string() helper/macro
From: Dan Carpenter @ 2019-05-10 11:01 UTC (permalink / raw)
  To: Ardelean, Alexandru
  Cc: linux-fbdev@vger.kernel.org, kvm@vger.kernel.org,
	linux-pci@vger.kernel.org, alsa-devel@alsa-project.org,
	dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org,
	linux-mtd@lists.infradead.org, linux-clk@vger.kernel.org,
	devel@driverdev.osuosl.org, andriy.shevchenko@linux.intel.com,
	linux-rockchip@lists.infradead.org, linux-mmc@vger.kernel.org,
	linux-pm@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	linux-gpio@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
	linux-tegra@vger.kernel.org, cgroups@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mm@kvack.org, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, netdev@vger.kernel.org,
	linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <31be52eb1a1abbc99a24729f5c65619235cb201f.camel@analog.com>

On Fri, May 10, 2019 at 09:13:26AM +0000, Ardelean, Alexandru wrote:
> On Wed, 2019-05-08 at 16:26 +0300, Alexandru Ardelean wrote:
> > On Wed, 2019-05-08 at 15:20 +0300, Dan Carpenter wrote:
> > > 
> > > 
> > > On Wed, May 08, 2019 at 02:28:35PM +0300, Alexandru Ardelean wrote:
> > > > -static const char * const phy_types[] = {
> > > > -     "emmc 5.0 phy",
> > > > -     "emmc 5.1 phy"
> > > > -};
> > > > -
> > > >  enum xenon_phy_type_enum {
> > > >       EMMC_5_0_PHY,
> > > >       EMMC_5_1_PHY,
> > > >       NR_PHY_TYPES
> > > 
> > > There is no need for NR_PHY_TYPES now so you could remove that as well.
> > > 
> > 
> > I thought the same.
> > The only reason to keep NR_PHY_TYPES, is for potential future patches,
> > where it would be just 1 addition
> > 
> >  enum xenon_phy_type_enum {
> >       EMMC_5_0_PHY,
> >       EMMC_5_1_PHY,
> > +      EMMC_5_2_PHY,
> >       NR_PHY_TYPES
> >   }
> > 
> > Depending on style/preference of how to do enums (allow comma on last
> > enum
> > or not allow comma on last enum value), adding new enum values woudl be 2
> > additions + 1 deletion lines.
> > 
> >  enum xenon_phy_type_enum {
> >       EMMC_5_0_PHY,
> > -      EMMC_5_1_PHY
> > +      EMM
> > C_5_1_PHY,
> > +      EMMC_5_2_PHY
> >  }
> > 
> > Either way (leave NR_PHY_TYPES or remove NR_PHY_TYPES) is fine from my
> > side.
> > 
> 
> Preference on this ?
> If no objection [nobody insists] I would keep.
> 
> I don't feel strongly about it [dropping NR_PHY_TYPES or not].

If you end up resending the series could you remove it, but if not then
it's not worth it.

regards,
dan carpenter


^ permalink raw reply

* Re: [PATCH 09/16] mmc: sdhci-xenon: use new match_string() helper/macro
From: Ardelean, Alexandru @ 2019-05-10 11:04 UTC (permalink / raw)
  To: dan.carpenter@oracle.com
  Cc: linux-wireless@vger.kernel.org, linux-fbdev@vger.kernel.org,
	kvm@vger.kernel.org, linux-pci@vger.kernel.org,
	alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org,
	linux-mm@kvack.org, linux-mtd@lists.infradead.org,
	linux-clk@vger.kernel.org, devel@driverdev.osuosl.org,
	andriy.shevchenko@linux.intel.com,
	linux-rockchip@lists.infradead.org, linux-pm@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, linux-gpio@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org, linux-tegra@vger.kernel.org,
	cgroups@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org,
	gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, netdev@vger.kernel.org,
	linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20190510110116.GB18105@kadam>

On Fri, 2019-05-10 at 14:01 +0300, Dan Carpenter wrote:
> [External]
> 
> 
> On Fri, May 10, 2019 at 09:13:26AM +0000, Ardelean, Alexandru wrote:
> > On Wed, 2019-05-08 at 16:26 +0300, Alexandru Ardelean wrote:
> > > On Wed, 2019-05-08 at 15:20 +0300, Dan Carpenter wrote:
> > > > 
> > > > 
> > > > On Wed, May 08, 2019 at 02:28:35PM +0300, Alexandru Ardelean wrote:
> > > > > -static const char * const phy_types[] = {
> > > > > -     "emmc 5.0 phy",
> > > > > -     "emmc 5.1 phy"
> > > > > -};
> > > > > -
> > > > >  enum xenon_phy_type_enum {
> > > > >       EMMC_5_0_PHY,
> > > > >       EMMC_5_1_PHY,
> > > > >       NR_PHY_TYPES
> > > > 
> > > > There is no need for NR_PHY_TYPES now so you could remove that as
> > > > well.
> > > > 
> > > 
> > > I thought the same.
> > > The only reason to keep NR_PHY_TYPES, is for potential future
> > > patches,
> > > where it would be just 1 addition
> > > 
> > >  enum xenon_phy_type_enum {
> > >       EMMC_5_0_PHY,
> > >       EMMC_5_1_PHY,
> > > +      EMMC_5_2_PHY,
> > >       NR_PHY_TYPES
> > >   }
> > > 
> > > Depending on style/preference of how to do enums (allow comma on last
> > > enum
> > > or not allow comma on last enum value), adding new enum values woudl
> > > be 2
> > > additions + 1 deletion lines.
> > > 
> > >  enum xenon_phy_type_enum {
> > >       EMMC_5_0_PHY,
> > > -      EMMC_5_1_PHY
> > > +      EMM
> > > C_5_1_PHY,
> > > +      EMMC_5_2_PHY
> > >  }
> > > 
> > > Either way (leave NR_PHY_TYPES or remove NR_PHY_TYPES) is fine from
> > > my
> > > side.
> > > 
> > 
> > Preference on this ?
> > If no objection [nobody insists] I would keep.
> > 
> > I don't feel strongly about it [dropping NR_PHY_TYPES or not].
> 
> If you end up resending the series could you remove it, but if not then
> it's not worth it.

ack

thanks
Alex

> 
> regards,
> dan carpenter
> 

^ permalink raw reply

* Re: [PATCH] EDAC, mpc85xx: Prevent building as a module
From: Michael Ellerman @ 2019-05-10 10:50 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Johannes Thumshirn, linux-kernel, linuxppc-dev, james.morse,
	mchehab, linux-edac
In-Reply-To: <20190509180220.GH17053@zn.tnic>

Borislav Petkov <bp@alien8.de> writes:

> On Thu, May 09, 2019 at 04:55:34PM +0200, Borislav Petkov wrote:
>> On Fri, May 10, 2019 at 12:52:05AM +1000, Michael Ellerman wrote:
>> > Thanks. It would be nice if you could send it as a fix for 5.2, it's the
>> > last thing blocking one of my allmodconfig builds. But if you don't
>> > think it qualifies as a fix that's fine too, it can wait.
>> 
>> Sure, no problem. Will do a pull request later.
>
> Hmm, so looking at this more, I was able to produce this config with my
> ancient cross-compiler:
>
> CONFIG_EDAC_SUPPORT=y
> CONFIG_EDAC=m
> CONFIG_EDAC_LEGACY_SYSFS=y
> CONFIG_EDAC_MPC85XX=y

Oh yeah good point.

> Now, mpc85xx_edac is built-in and edac_core.ko is a module
> (CONFIG_EDAC=m) and that should not work - i.e., builtin code calling
> module functions. But my cross-compiler is happily building this without
> complaint. Or maybe I'm missing something.

That's weird.

> In any case, I *think* the proper fix should be to do:
>
> config EDAC_MPC85XX
>         bool "Freescale MPC83xx / MPC85xx"
>         depends on FSL_SOC && EDAC=y
>
> so that you can't even produce the above invalid .config snippet.
>
> Hmmm?

Yeah that looks better to me. I didn't think about the case where EDAC
core is modular.

Do you want me to send a new patch?

cheers

^ permalink raw reply

* RE: [PATCH] vsprintf: Do not break early boot with probing addresses
From: Michael Ellerman @ 2019-05-10 10:21 UTC (permalink / raw)
  To: David Laight, 'Michal Suchánek', Petr Mladek
  Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	Sergey Senozhatsky, Rasmus Villemoes,
	linuxppc-dev@lists.ozlabs.org, Heiko Carstens,
	linux-kernel@vger.kernel.org, Steven Rostedt, Michal Hocko,
	Sergey Senozhatsky, Stephen Rothwell, Andy Shevchenko,
	Linus Torvalds, Martin Schwidefsky, Tobin C . Harding
In-Reply-To: <8ad8bb83b7034f7e92df12040fb8c2c2@AcuMS.aculab.com>

David Laight <David.Laight@ACULAB.COM> writes:
> From: Michal Suchánek
>> Sent: 09 May 2019 14:38
> ...
>> > The problem is the combination of some new code called via printk(),
>> > check_pointer() which calls probe_kernel_read(). That then calls
>> > allow_user_access() (PPC_KUAP) and that uses mmu_has_feature() too early
>> > (before we've patched features).
>> 
>> There is early_mmu_has_feature for this case. mmu_has_feature does not
>> work before patching so parts of kernel that can run before patching
>> must use the early_ variant which actually runs code reading the
>> feature bitmap to determine the answer.
>
> Does the early_ variant get patched so the it is reasonably
> efficient after the 'patching' is done?

No they don't get patched ever. The name is a bit misleading I guess.

> Or should there be a third version which gets patched across?

For a case like this it's entirely safe to just skip the code early in
boot, so if it was a static_key_false everything would just work.

Unfortunately the way the code is currently written we would have to
change all MMU features to static_key_false and that risks breaking
something else.

We have a long standing TODO to rework all our feature logic and unify
CPU/MMU/firmware/etc. features. Possibly as part of that we can come up
with a scheme where the default value is per-feature bit.

Having said all that, in this case the overhead of the test and branch
is small compared to the cost of writing to the SPR which controls user
access and then doing an isync, so it's all somewhat premature
optimisation.

cheers

^ permalink raw reply

* [PATCH net 4/5] net: ethernet: fix similar warning reported by kbuild test robot
From: Petr Štetiar @ 2019-05-10  9:35 UTC (permalink / raw)
  To: netdev, David S. Miller, Maxime Ripard, Chen-Yu Tsai,
	Madalin Bucur, Pantelis Antoniou, Claudiu Manoil, Li Yang,
	Sebastian Hesselbarth, Thomas Petazzoni, Mirko Lindner,
	Stephen Hemminger, Vladimir Zapolskiy, Sylvain Lemieux,
	Sergei Shtylyov, Grygorii Strashko, Michal Simek
  Cc: Andrew Lunn, Rob Herring, linux-kernel, linux-renesas-soc,
	Petr Štetiar, linux-omap, linuxppc-dev, linux-arm-kernel
In-Reply-To: <1557480918-9627-1-git-send-email-ynezz@true.cz>

This patch fixes following (similar) warning reported by kbuild test robot:

 In function ‘memcpy’,
  inlined from ‘smsc75xx_init_mac_address’ at drivers/net/usb/smsc75xx.c:778:3,
  inlined from ‘smsc75xx_bind’ at drivers/net/usb/smsc75xx.c:1501:2:
  ./include/linux/string.h:355:9: warning: argument 2 null where non-null expected [-Wnonnull]
  return __builtin_memcpy(p, q, size);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/net/usb/smsc75xx.c: In function ‘smsc75xx_bind’:
  ./include/linux/string.h:355:9: note: in a call to built-in function ‘__builtin_memcpy’

I've replaced the offending memcpy with ether_addr_copy, because I'm
100% sure, that of_get_mac_address can't return NULL as it returns valid
pointer or ERR_PTR encoded value, nothing else.

I'm hesitant to just change IS_ERR into IS_ERR_OR_NULL check, as this
would make the warning disappear also, but it would be confusing to
check for impossible return value just to make a compiler happy.

I'm now changing all occurencies of memcpy to ether_addr_copy after the
of_get_mac_address call, as it's very likely, that we're going to get
similar reports from kbuild test robot in the future.

Fixes: a51645f70f63 ("net: ethernet: support of_get_mac_address new ERR_PTR error")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 drivers/net/ethernet/allwinner/sun4i-emac.c           | 2 +-
 drivers/net/ethernet/arc/emac_main.c                  | 2 +-
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c      | 2 +-
 drivers/net/ethernet/davicom/dm9000.c                 | 2 +-
 drivers/net/ethernet/freescale/fec_mpc52xx.c          | 2 +-
 drivers/net/ethernet/freescale/fman/mac.c             | 2 +-
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +-
 drivers/net/ethernet/freescale/gianfar.c              | 2 +-
 drivers/net/ethernet/freescale/ucc_geth.c             | 2 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c            | 2 +-
 drivers/net/ethernet/marvell/mvneta.c                 | 2 +-
 drivers/net/ethernet/marvell/sky2.c                   | 2 +-
 drivers/net/ethernet/micrel/ks8851.c                  | 2 +-
 drivers/net/ethernet/micrel/ks8851_mll.c              | 2 +-
 drivers/net/ethernet/nxp/lpc_eth.c                    | 2 +-
 drivers/net/ethernet/renesas/sh_eth.c                 | 2 +-
 drivers/net/ethernet/ti/cpsw.c                        | 2 +-
 drivers/net/ethernet/xilinx/ll_temac_main.c           | 2 +-
 drivers/net/ethernet/xilinx/xilinx_emaclite.c         | 2 +-
 19 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index 37ebd890ef51..9e06dff619c3 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -871,7 +871,7 @@ static int emac_probe(struct platform_device *pdev)
 	/* Read MAC-address from DT */
 	mac_addr = of_get_mac_address(np);
 	if (!IS_ERR(mac_addr))
-		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(ndev->dev_addr, mac_addr);
 
 	/* Check if the MAC address is valid, if not get a random one */
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index 7f89ad5c336d..13a1d99b29c6 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -961,7 +961,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
 	mac_addr = of_get_mac_address(dev->of_node);
 
 	if (!IS_ERR(mac_addr))
-		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(ndev->dev_addr, mac_addr);
 	else
 		eth_hw_addr_random(ndev);
 
diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index 15b1130aa4ae..0e5de88fd6e8 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -1504,7 +1504,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
 	mac = of_get_mac_address(pdev->dev.of_node);
 
 	if (!IS_ERR(mac))
-		memcpy(netdev->dev_addr, mac, ETH_ALEN);
+		ether_addr_copy(netdev->dev_addr, mac);
 	else
 		eth_hw_addr_random(netdev);
 
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 953ee5616801..5e1aff9a5fd6 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1413,7 +1413,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
 
 	mac_addr = of_get_mac_address(np);
 	if (!IS_ERR(mac_addr))
-		memcpy(pdata->dev_addr, mac_addr, sizeof(pdata->dev_addr));
+		ether_addr_copy(pdata->dev_addr, mac_addr);
 
 	return pdata;
 }
diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c
index 7b7e526869a7..30cdb246d020 100644
--- a/drivers/net/ethernet/freescale/fec_mpc52xx.c
+++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c
@@ -903,7 +903,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)
 	 */
 	mac_addr = of_get_mac_address(np);
 	if (!IS_ERR(mac_addr)) {
-		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(ndev->dev_addr, mac_addr);
 	} else {
 		struct mpc52xx_fec __iomem *fec = priv->fec;
 
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 9cd2c28d17df..7ab8095db192 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -729,7 +729,7 @@ static int mac_probe(struct platform_device *_of_dev)
 		err = -EINVAL;
 		goto _return_of_get_parent;
 	}
-	memcpy(mac_dev->addr, mac_addr, sizeof(mac_dev->addr));
+	ether_addr_copy(mac_dev->addr, mac_addr);
 
 	/* Get the port handles */
 	nph = of_count_phandle_with_args(mac_node, "fsl,fman-ports", NULL);
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 90ea7a115d0f..5fad73b2e123 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -1015,7 +1015,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
 
 	mac_addr = of_get_mac_address(ofdev->dev.of_node);
 	if (!IS_ERR(mac_addr))
-		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(ndev->dev_addr, mac_addr);
 
 	ret = fep->ops->allocate_bd(ndev);
 	if (ret)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index df13c693b038..e670cd293dba 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -873,7 +873,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 	mac_addr = of_get_mac_address(np);
 
 	if (!IS_ERR(mac_addr))
-		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(dev->dev_addr, mac_addr);
 
 	if (model && !strcasecmp(model, "TSEC"))
 		priv->device_flags |= FSL_GIANFAR_DEV_HAS_GIGABIT |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 216e99af2b5a..4d6892d2f0a4 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3911,7 +3911,7 @@ static int ucc_geth_probe(struct platform_device* ofdev)
 
 	mac_addr = of_get_mac_address(np);
 	if (!IS_ERR(mac_addr))
-		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(dev->dev_addr, mac_addr);
 
 	ugeth->ug_info = ug_info;
 	ugeth->dev = device;
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 07e254fc96ef..409b69fd4374 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2750,7 +2750,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
 
 	mac_addr = of_get_mac_address(pnp);
 	if (!IS_ERR(mac_addr))
-		memcpy(ppd.mac_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(ppd.mac_addr, mac_addr);
 
 	mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
 	mv643xx_eth_property(pnp, "tx-sram-addr", ppd.tx_sram_addr);
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 8186135883ed..e758650b2c26 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4565,7 +4565,7 @@ static int mvneta_probe(struct platform_device *pdev)
 	dt_mac_addr = of_get_mac_address(dn);
 	if (!IS_ERR(dt_mac_addr)) {
 		mac_from = "device tree";
-		memcpy(dev->dev_addr, dt_mac_addr, ETH_ALEN);
+		ether_addr_copy(dev->dev_addr, dt_mac_addr);
 	} else {
 		mvneta_get_mac_addr(pp, hw_mac_addr);
 		if (is_valid_ether_addr(hw_mac_addr)) {
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 9d070cca3e9e..5adf307fbbfd 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -4805,7 +4805,7 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
 	 */
 	iap = of_get_mac_address(hw->pdev->dev.of_node);
 	if (!IS_ERR(iap))
-		memcpy(dev->dev_addr, iap, ETH_ALEN);
+		ether_addr_copy(dev->dev_addr, iap);
 	else
 		memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8,
 			      ETH_ALEN);
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index b44172a901ed..ba4fdf1b0dea 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -426,7 +426,7 @@ static void ks8851_init_mac(struct ks8851_net *ks)
 
 	mac_addr = of_get_mac_address(ks->spidev->dev.of_node);
 	if (!IS_ERR(mac_addr)) {
-		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(dev->dev_addr, mac_addr);
 		ks8851_write_mac_addr(dev);
 		return;
 	}
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index dc76b0d15234..e5c8412c08c1 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -1328,7 +1328,7 @@ static int ks8851_probe(struct platform_device *pdev)
 	if (pdev->dev.of_node) {
 		mac = of_get_mac_address(pdev->dev.of_node);
 		if (!IS_ERR(mac))
-			memcpy(ks->mac_addr, mac, ETH_ALEN);
+			ether_addr_copy(ks->mac_addr, mac);
 	} else {
 		struct ks8851_mll_platform_data *pdata;
 
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index da138edddd32..fec604c4c0d3 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1369,7 +1369,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		const char *macaddr = of_get_mac_address(np);
 		if (!IS_ERR(macaddr))
-			memcpy(ndev->dev_addr, macaddr, ETH_ALEN);
+			ether_addr_copy(ndev->dev_addr, macaddr);
 	}
 	if (!is_valid_ether_addr(ndev->dev_addr))
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 7c4e282242d5..6354f19a31eb 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3193,7 +3193,7 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
 
 	mac_addr = of_get_mac_address(np);
 	if (!IS_ERR(mac_addr))
-		memcpy(pdata->mac_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(pdata->mac_addr, mac_addr);
 
 	pdata->no_ether_link =
 		of_property_read_bool(np, "renesas,no-ether-link");
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index b18eeb05b993..634fc484a0b3 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2233,7 +2233,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
 no_phy_slave:
 		mac_addr = of_get_mac_address(slave_node);
 		if (!IS_ERR(mac_addr)) {
-			memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);
+			ether_addr_copy(slave_data->mac_addr, mac_addr);
 		} else {
 			ret = ti_cm_get_macid(&pdev->dev, i,
 					      slave_data->mac_addr);
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 997475c209c0..47c45152132e 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -361,7 +361,7 @@ static void temac_do_set_mac_address(struct net_device *ndev)
 
 static int temac_init_mac_address(struct net_device *ndev, const void *address)
 {
-	memcpy(ndev->dev_addr, address, ETH_ALEN);
+	ether_addr_copy(ndev->dev_addr, address);
 	if (!is_valid_ether_addr(ndev->dev_addr))
 		eth_hw_addr_random(ndev);
 	temac_do_set_mac_address(ndev);
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 691170753563..6886270da695 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1167,7 +1167,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 
 	if (!IS_ERR(mac_address)) {
 		/* Set the MAC address. */
-		memcpy(ndev->dev_addr, mac_address, ETH_ALEN);
+		ether_addr_copy(ndev->dev_addr, mac_address);
 	} else {
 		dev_warn(dev, "No MAC address found, using random\n");
 		eth_hw_addr_random(ndev);
-- 
1.9.1


^ permalink raw reply related

* [PATCH net 3/5] powerpc: tsi108: fix similar warning reported by kbuild test robot
From: Petr Štetiar @ 2019-05-10  9:35 UTC (permalink / raw)
  To: netdev, Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: Andrew Lunn, Petr Štetiar, linuxppc-dev, linux-kernel,
	Rob Herring
In-Reply-To: <1557480918-9627-1-git-send-email-ynezz@true.cz>

This patch fixes following (similar) warning reported by kbuild test robot:

 In function ‘memcpy’,
  inlined from ‘smsc75xx_init_mac_address’ at drivers/net/usb/smsc75xx.c:778:3,
  inlined from ‘smsc75xx_bind’ at drivers/net/usb/smsc75xx.c:1501:2:
  ./include/linux/string.h:355:9: warning: argument 2 null where non-null expected [-Wnonnull]
  return __builtin_memcpy(p, q, size);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/net/usb/smsc75xx.c: In function ‘smsc75xx_bind’:
  ./include/linux/string.h:355:9: note: in a call to built-in function ‘__builtin_memcpy’

I've replaced the offending memcpy with ether_addr_copy, because I'm
100% sure, that of_get_mac_address can't return NULL as it returns valid
pointer or ERR_PTR encoded value, nothing else.

I'm hesitant to just change IS_ERR into IS_ERR_OR_NULL check, as this
would make the warning disappear also, but it would be confusing to
check for impossible return value just to make a compiler happy.

I'm now changing all occurencies of memcpy to ether_addr_copy after the
of_get_mac_address call, as it's very likely, that we're going to get
similar reports from kbuild test robot in the future.

Fixes: ea168cdf1299 ("powerpc: tsi108: support of_get_mac_address new ERR_PTR error")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 arch/powerpc/sysdev/tsi108_dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c
index c92dcac85231..026619c9a8cb 100644
--- a/arch/powerpc/sysdev/tsi108_dev.c
+++ b/arch/powerpc/sysdev/tsi108_dev.c
@@ -18,6 +18,7 @@
 #include <linux/irq.h>
 #include <linux/export.h>
 #include <linux/device.h>
+#include <linux/etherdevice.h>
 #include <linux/platform_device.h>
 #include <linux/of_net.h>
 #include <asm/tsi108.h>
@@ -106,7 +107,7 @@ static int __init tsi108_eth_of_init(void)
 
 		mac_addr = of_get_mac_address(np);
 		if (!IS_ERR(mac_addr))
-			memcpy(tsi_eth_data.mac_addr, mac_addr, 6);
+			ether_addr_copy(tsi_eth_data.mac_addr, mac_addr);
 
 		ph = of_get_property(np, "mdio-handle", NULL);
 		mdio = of_find_node_by_phandle(*ph);
-- 
1.9.1


^ permalink raw reply related

* [RESEND PATCH] powerpc/pseries: Fix cpu_hotplug_lock acquisition in resize_hpt
From: Gautham R. Shenoy @ 2019-05-10  9:24 UTC (permalink / raw)
  To: Paul Mackerras, Nicholas Piggin, Michael Ellerman,
	Aneesh Kumar K.V
  Cc: Gautham R. Shenoy, linuxppc-dev, linux-kernel

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

During a memory hotplug operations involving resizing of the HPT, we
invoke a stop_machine() to perform the resizing. In this code path, we
end up recursively taking the cpu_hotplug_lock, first in
memory_hotplug_begin() and then subsequently in stop_machine(). This
causes the system to hang. With lockdep enabled we get the following
error message before the hang.

  swapper/0/1 is trying to acquire lock:
  (____ptrval____) (cpu_hotplug_lock.rw_sem){++++}, at: stop_machine+0x2c/0x60

  but task is already holding lock:
  (____ptrval____) (cpu_hotplug_lock.rw_sem){++++}, at: mem_hotplug_begin+0x20/0x50

  other info that might help us debug this:
   Possible unsafe locking scenario:

         CPU0
         ----
    lock(cpu_hotplug_lock.rw_sem);
    lock(cpu_hotplug_lock.rw_sem);

   *** DEADLOCK ***

Fix this issue by
  1) Requiring all the calls to pseries_lpar_resize_hpt() be made
     with cpu_hotplug_lock held.

  2) In pseries_lpar_resize_hpt() invoke stop_machine_cpuslocked()
     as a consequence of 1)

  3) To satisfy 1), in hpt_order_set(), call mmu_hash_ops.resize_hpt()
     with cpu_hotplug_lock held.

Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---

Rebased this one against powerpc/next instead of linux/master.

 arch/powerpc/mm/book3s64/hash_utils.c | 9 ++++++++-
 arch/powerpc/platforms/pseries/lpar.c | 8 ++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
index 919a861..d07fcafd 100644
--- a/arch/powerpc/mm/book3s64/hash_utils.c
+++ b/arch/powerpc/mm/book3s64/hash_utils.c
@@ -38,6 +38,7 @@
 #include <linux/libfdt.h>
 #include <linux/pkeys.h>
 #include <linux/hugetlb.h>
+#include <linux/cpu.h>
 
 #include <asm/debugfs.h>
 #include <asm/processor.h>
@@ -1928,10 +1929,16 @@ static int hpt_order_get(void *data, u64 *val)
 
 static int hpt_order_set(void *data, u64 val)
 {
+	int ret;
+
 	if (!mmu_hash_ops.resize_hpt)
 		return -ENODEV;
 
-	return mmu_hash_ops.resize_hpt(val);
+	cpus_read_lock();
+	ret = mmu_hash_ops.resize_hpt(val);
+	cpus_read_unlock();
+
+	return ret;
 }
 
 DEFINE_DEBUGFS_ATTRIBUTE(fops_hpt_order, hpt_order_get, hpt_order_set, "%llu\n");
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 1034ef1..2fc9756 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -859,7 +859,10 @@ static int pseries_lpar_resize_hpt_commit(void *data)
 	return 0;
 }
 
-/* Must be called in user context */
+/*
+ * Must be called in user context. The caller should hold the
+ * cpus_lock.
+ */
 static int pseries_lpar_resize_hpt(unsigned long shift)
 {
 	struct hpt_resize_state state = {
@@ -913,7 +916,8 @@ static int pseries_lpar_resize_hpt(unsigned long shift)
 
 	t1 = ktime_get();
 
-	rc = stop_machine(pseries_lpar_resize_hpt_commit, &state, NULL);
+	rc = stop_machine_cpuslocked(pseries_lpar_resize_hpt_commit,
+				     &state, NULL);
 
 	t2 = ktime_get();
 
-- 
1.9.4


^ permalink raw reply related

* [PATCH v2] powerpc: slightly improve cache helpers
From: Christophe Leroy @ 2019-05-10  9:24 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Segher Boessenkool
  Cc: linuxppc-dev, linux-kernel

Cache instructions (dcbz, dcbi, dcbf and dcbst) take two registers
that are summed to obtain the target address. Using 'Z' constraint
and '%y0' argument gives GCC the opportunity to use both registers
instead of only one with the second being forced to 0.

Suggested-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/include/asm/cache.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h
index 40ea5b3781c6..df8e4c407366 100644
--- a/arch/powerpc/include/asm/cache.h
+++ b/arch/powerpc/include/asm/cache.h
@@ -85,22 +85,22 @@ extern void _set_L3CR(unsigned long);
 
 static inline void dcbz(void *addr)
 {
-	__asm__ __volatile__ ("dcbz 0, %0" : : "r"(addr) : "memory");
+	__asm__ __volatile__ ("dcbz %y0" : : "Z"(*(u8 *)addr) : "memory");
 }
 
 static inline void dcbi(void *addr)
 {
-	__asm__ __volatile__ ("dcbi 0, %0" : : "r"(addr) : "memory");
+	__asm__ __volatile__ ("dcbi %y0" : : "Z"(*(u8 *)addr) : "memory");
 }
 
 static inline void dcbf(void *addr)
 {
-	__asm__ __volatile__ ("dcbf 0, %0" : : "r"(addr) : "memory");
+	__asm__ __volatile__ ("dcbf %y0" : : "Z"(*(u8 *)addr) : "memory");
 }
 
 static inline void dcbst(void *addr)
 {
-	__asm__ __volatile__ ("dcbst 0, %0" : : "r"(addr) : "memory");
+	__asm__ __volatile__ ("dcbst %y0" : : "Z"(*(u8 *)addr) : "memory");
 }
 #endif /* !__ASSEMBLY__ */
 #endif /* __KERNEL__ */
-- 
2.13.3


^ permalink raw reply related

* Re: [PATCH 03/16] lib,treewide: add new match_string() helper/macro
From: Ardelean, Alexandru @ 2019-05-10  9:15 UTC (permalink / raw)
  To: andriy.shevchenko@linux.intel.com, gregkh@linuxfoundation.org
  Cc: linux-wireless@vger.kernel.org, linux-fbdev@vger.kernel.org,
	kvm@vger.kernel.org, linux-pci@vger.kernel.org,
	alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org,
	linux-mm@kvack.org, linux-mtd@lists.infradead.org,
	linux-clk@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-rockchip@lists.infradead.org, linux-pm@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, linux-gpio@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org, linux-tegra@vger.kernel.org,
	cgroups@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <b2440bc9485456a7a90a488c528997587b22088b.camel@analog.com>

On Wed, 2019-05-08 at 16:22 +0300, Alexandru Ardelean wrote:
> On Wed, 2019-05-08 at 15:18 +0200, Greg KH wrote:
> > 
> > 
> > On Wed, May 08, 2019 at 04:11:28PM +0300, Andy Shevchenko wrote:
> > > On Wed, May 08, 2019 at 02:28:29PM +0300, Alexandru Ardelean wrote:
> > > > This change re-introduces `match_string()` as a macro that uses
> > > > ARRAY_SIZE() to compute the size of the array.
> > > > The macro is added in all the places that do
> > > > `match_string(_a, ARRAY_SIZE(_a), s)`, since the change is pretty
> > > > straightforward.
> > > 
> > > Can you split include/linux/ change from the rest?
> > 
> > That would break the build, why do you want it split out?  This makes
> > sense all as a single patch to me.
> > 
> 
> Not really.
> It would be just be the new match_string() helper/macro in a new commit.
> And the conversions of the simple users of match_string() (the ones using
> ARRAY_SIZE()) in another commit.
> 

I should have asked in my previous reply.
Leave this as-is or re-formulate in 2 patches ?

No strong preference from my side.

Thanks
Alex

> Thanks
> Alex
> 
> > thanks,
> > 
> > greg k-h

^ permalink raw reply

* Re: [PATCH 09/16] mmc: sdhci-xenon: use new match_string() helper/macro
From: Ardelean, Alexandru @ 2019-05-10  9:13 UTC (permalink / raw)
  To: dan.carpenter@oracle.com
  Cc: linux-wireless@vger.kernel.org, linux-fbdev@vger.kernel.org,
	kvm@vger.kernel.org, linux-pci@vger.kernel.org,
	alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org,
	linux-mm@kvack.org, linux-mtd@lists.infradead.org,
	linux-clk@vger.kernel.org, devel@driverdev.osuosl.org,
	andriy.shevchenko@linux.intel.com,
	linux-rockchip@lists.infradead.org, linux-pm@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, linux-gpio@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org, linux-tegra@vger.kernel.org,
	cgroups@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org,
	gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, netdev@vger.kernel.org,
	linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <2ec6812d6bf2f33860c7c816c641167a31eb2ed6.camel@analog.com>

On Wed, 2019-05-08 at 16:26 +0300, Alexandru Ardelean wrote:
> On Wed, 2019-05-08 at 15:20 +0300, Dan Carpenter wrote:
> > 
> > 
> > On Wed, May 08, 2019 at 02:28:35PM +0300, Alexandru Ardelean wrote:
> > > -static const char * const phy_types[] = {
> > > -     "emmc 5.0 phy",
> > > -     "emmc 5.1 phy"
> > > -};
> > > -
> > >  enum xenon_phy_type_enum {
> > >       EMMC_5_0_PHY,
> > >       EMMC_5_1_PHY,
> > >       NR_PHY_TYPES
> > 
> > There is no need for NR_PHY_TYPES now so you could remove that as well.
> > 
> 
> I thought the same.
> The only reason to keep NR_PHY_TYPES, is for potential future patches,
> where it would be just 1 addition
> 
>  enum xenon_phy_type_enum {
>       EMMC_5_0_PHY,
>       EMMC_5_1_PHY,
> +      EMMC_5_2_PHY,
>       NR_PHY_TYPES
>   }
> 
> Depending on style/preference of how to do enums (allow comma on last
> enum
> or not allow comma on last enum value), adding new enum values woudl be 2
> additions + 1 deletion lines.
> 
>  enum xenon_phy_type_enum {
>       EMMC_5_0_PHY,
> -      EMMC_5_1_PHY
> +      EMM
> C_5_1_PHY,
> +      EMMC_5_2_PHY
>  }
> 
> Either way (leave NR_PHY_TYPES or remove NR_PHY_TYPES) is fine from my
> side.
> 

Preference on this ?
If no objection [nobody insists] I would keep.

I don't feel strongly about it [dropping NR_PHY_TYPES or not].

Thanks
Alex

> Thanks
> Alex
> 
> > regards,
> > dan carpenter
> > 

^ permalink raw reply

* [PATCH] powerpc/pseries: Fix cpu_hotplug_lock acquisition in resize_hpt
From: Gautham R. Shenoy @ 2019-05-10  9:01 UTC (permalink / raw)
  To: Paul Mackerras, Nicholas Piggin, Michael Ellerman,
	Aneesh Kumar K.V
  Cc: Gautham R. Shenoy, linuxppc-dev, linux-kernel

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

During a memory hotplug operations involving resizing of the HPT, we
invoke a stop_machine() to perform the resizing. In this code path, we
end up recursively taking the cpu_hotplug_lock, first in
memory_hotplug_begin() and then subsequently in stop_machine(). This
causes the system to hang. With lockdep enabled we get the following
error message before the hang.

  swapper/0/1 is trying to acquire lock:
  (____ptrval____) (cpu_hotplug_lock.rw_sem){++++}, at: stop_machine+0x2c/0x60

  but task is already holding lock:
  (____ptrval____) (cpu_hotplug_lock.rw_sem){++++}, at: mem_hotplug_begin+0x20/0x50

  other info that might help us debug this:
   Possible unsafe locking scenario:

         CPU0
         ----
    lock(cpu_hotplug_lock.rw_sem);
    lock(cpu_hotplug_lock.rw_sem);

   *** DEADLOCK ***

Fix this issue by
  1) Requiring all the calls to pseries_lpar_resize_hpt() be made
     with cpu_hotplug_lock held.

  2) In pseries_lpar_resize_hpt() invoke stop_machine_cpuslocked()
     as a consequence of 1)

  3) To satisfy 1), in hpt_order_set(), call mmu_hash_ops.resize_hpt()
     with cpu_hotplug_lock held.

Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/mm/hash_utils_64.c       | 9 ++++++++-
 arch/powerpc/platforms/pseries/lpar.c | 8 ++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 0a4f939..b05c79c 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -37,6 +37,7 @@
 #include <linux/context_tracking.h>
 #include <linux/libfdt.h>
 #include <linux/pkeys.h>
+#include <linux/cpu.h>
 
 #include <asm/debugfs.h>
 #include <asm/processor.h>
@@ -1890,10 +1891,16 @@ static int hpt_order_get(void *data, u64 *val)
 
 static int hpt_order_set(void *data, u64 val)
 {
+	int ret;
+
 	if (!mmu_hash_ops.resize_hpt)
 		return -ENODEV;
 
-	return mmu_hash_ops.resize_hpt(val);
+	cpus_read_lock();
+	ret = mmu_hash_ops.resize_hpt(val);
+	cpus_read_unlock();
+
+	return ret;
 }
 
 DEFINE_DEBUGFS_ATTRIBUTE(fops_hpt_order, hpt_order_get, hpt_order_set, "%llu\n");
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index f2a9f0a..65df95b 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -859,7 +859,10 @@ static int pseries_lpar_resize_hpt_commit(void *data)
 	return 0;
 }
 
-/* Must be called in user context */
+/*
+ * Must be called in user context. The caller should hold the
+ * cpus_lock.
+ */
 static int pseries_lpar_resize_hpt(unsigned long shift)
 {
 	struct hpt_resize_state state = {
@@ -911,7 +914,8 @@ static int pseries_lpar_resize_hpt(unsigned long shift)
 
 	t1 = ktime_get();
 
-	rc = stop_machine(pseries_lpar_resize_hpt_commit, &state, NULL);
+	rc = stop_machine_cpuslocked(pseries_lpar_resize_hpt_commit,
+				     &state, NULL);
 
 	t2 = ktime_get();
 
-- 
1.9.4


^ permalink raw reply related

* Re: [PATCH] vsprintf: Do not break early boot with probing addresses
From: Sergey Senozhatsky @ 2019-05-10  8:51 UTC (permalink / raw)
  To: Petr Mladek
  Cc: linux-arch, Sergey Senozhatsky, Heiko Carstens, linux-s390,
	linuxppc-dev, Rasmus Villemoes, linux-kernel, Steven Rostedt,
	Michal Hocko, Sergey Senozhatsky, Stephen Rothwell,
	Andy Shevchenko, Linus Torvalds, Martin Schwidefsky,
	Tobin C . Harding
In-Reply-To: <20190510084213.22149-1-pmladek@suse.com>

On (05/10/19 10:42), Petr Mladek wrote:
[..]
> Fixes: 3e5903eb9cff70730 ("vsprintf: Prevent crash when dereferencing invalid pointers")
> Signed-off-by: Petr Mladek <pmladek@suse.com>

FWIW
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

^ permalink raw reply

* [PATCH] vsprintf: Do not break early boot with probing addresses
From: Petr Mladek @ 2019-05-10  8:42 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-arch, Sergey Senozhatsky, Heiko Carstens, linux-s390,
	Rasmus Villemoes, linux-kernel, Steven Rostedt, Michal Hocko,
	Sergey Senozhatsky, Stephen Rothwell, Petr Mladek,
	Andy Shevchenko, linuxppc-dev, Martin Schwidefsky,
	Tobin C . Harding
In-Reply-To: <20190510081635.GA4533@jagdpanzerIV>

The commit 3e5903eb9cff70730 ("vsprintf: Prevent crash when dereferencing
invalid pointers") broke boot on several architectures. The common
pattern is that probe_kernel_read() is not working during early
boot because userspace access framework is not ready.

It is a generic problem. We have to avoid any complex external
functions in vsprintf() code, especially in the common path.
They might break printk() easily and are hard to debug.

Replace probe_kernel_read() with some simple checks for obvious
problems.

Details:

1. Report on Power:

Kernel crashes very early during boot with with CONFIG_PPC_KUAP and
CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG

The problem is the combination of some new code called via printk(),
check_pointer() which calls probe_kernel_read(). That then calls
allow_user_access() (PPC_KUAP) and that uses mmu_has_feature() too early
(before we've patched features). With the JUMP_LABEL debug enabled that
causes us to call printk() & dump_stack() and we end up recursing and
overflowing the stack.

Because it happens so early you don't get any output, just an apparently
dead system.

The stack trace (which you don't see) is something like:

  ...
  dump_stack+0xdc
  probe_kernel_read+0x1a4
  check_pointer+0x58
  string+0x3c
  vsnprintf+0x1bc
  vscnprintf+0x20
  printk_safe_log_store+0x7c
  printk+0x40
  dump_stack_print_info+0xbc
  dump_stack+0x8
  probe_kernel_read+0x1a4
  probe_kernel_read+0x19c
  check_pointer+0x58
  string+0x3c
  vsnprintf+0x1bc
  vscnprintf+0x20
  vprintk_store+0x6c
  vprintk_emit+0xec
  vprintk_func+0xd4
  printk+0x40
  cpufeatures_process_feature+0xc8
  scan_cpufeatures_subnodes+0x380
  of_scan_flat_dt_subnodes+0xb4
  dt_cpu_ftrs_scan_callback+0x158
  of_scan_flat_dt+0xf0
  dt_cpu_ftrs_scan+0x3c
  early_init_devtree+0x360
  early_setup+0x9c

2. Report on s390:

vsnprintf invocations, are broken on s390. For example, the early boot
output now looks like this where the first (efault) should be
the linux_banner:

[    0.099985] (efault)
[    0.099985] setup: Linux is running as a z/VM guest operating system in 64-bit mode
[    0.100066] setup: The maximum memory size is 8192MB
[    0.100070] cma: Reserved 4 MiB at (efault)
[    0.100100] numa: NUMA mode: (efault)

The reason for this, is that the code assumes that
probe_kernel_address() works very early. This however is not true on
at least s390. Uaccess on KERNEL_DS works only after page tables have
been setup on s390, which happens with setup_arch()->paging_init().

Any probe_kernel_address() invocation before that will return -EFAULT.

Fixes: 3e5903eb9cff70730 ("vsprintf: Prevent crash when dereferencing invalid pointers")
Signed-off-by: Petr Mladek <pmladek@suse.com>
---
 lib/vsprintf.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 7b0a6140bfad..2f003cfe340e 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -628,19 +628,16 @@ static char *error_string(char *buf, char *end, const char *s,
 }
 
 /*
- * This is not a fool-proof test. 99% of the time that this will fault is
- * due to a bad pointer, not one that crosses into bad memory. Just test
- * the address to make sure it doesn't fault due to a poorly added printk
- * during debugging.
+ * Do not call any complex external code here. Nested printk()/vsprintf()
+ * might cause infinite loops. Failures might break printk() and would
+ * be hard to debug.
  */
 static const char *check_pointer_msg(const void *ptr)
 {
-	char byte;
-
 	if (!ptr)
 		return "(null)";
 
-	if (probe_kernel_address(ptr, byte))
+	if ((unsigned long)ptr < PAGE_SIZE || IS_ERR_VALUE(ptr))
 		return "(efault)";
 
 	return NULL;
-- 
2.16.4


^ permalink raw reply related

* Re: [PATCH] vsprintf: Do not break early boot with probing addresses
From: Sergey Senozhatsky @ 2019-05-10  8:16 UTC (permalink / raw)
  To: Petr Mladek
  Cc: linux-arch, Sergey Senozhatsky, Heiko Carstens, linux-s390,
	linuxppc-dev, Rasmus Villemoes, linux-kernel, Steven Rostedt,
	Michal Hocko, Sergey Senozhatsky, Stephen Rothwell,
	Andy Shevchenko, Linus Torvalds, Martin Schwidefsky,
	Tobin C . Harding
In-Reply-To: <20190510080602.mdfk54f6lpyg6unw@pathway.suse.cz>

On (05/10/19 10:06), Petr Mladek wrote:
[..]
> I am going to send a patch replacing probe_kernel_address() with
> a simple check:
> 
> 	if ((unsigned long)ptr < PAGE_SIZE || IS_ERR_VALUE(ptr))
> 		return "(efault)";

I'm OK with this.
Probing ptrs was a good idea, it just didn't work out.

	-ss

^ permalink raw reply

* Re: [PATCH] vsprintf: Do not break early boot with probing addresses
From: Petr Mladek @ 2019-05-10  8:06 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: linux-arch, Heiko Carstens, linux-s390, linuxppc-dev,
	Rasmus Villemoes, linux-kernel, Steven Rostedt, Michal Hocko,
	Sergey Senozhatsky, Stephen Rothwell, Andy Shevchenko,
	Linus Torvalds, Martin Schwidefsky, Tobin C . Harding
In-Reply-To: <20190510050709.GA1831@jagdpanzerIV>

On Fri 2019-05-10 14:07:09, Sergey Senozhatsky wrote:
> On (05/09/19 21:47), Linus Torvalds wrote:
> >    [ Sorry about html and mobile crud, I'm not at the computer right now ]
> >    How about we just undo the whole misguided probe_kernel_address() thing?
> 
> But the problem will remain - %pS/%pF on PPC (and some other arch-s)
> do dereference_function_descriptor(), which calls probe_kernel_address().
> So if probe_kernel_address() starts to dump_stack(), then we are heading
> towards stack overflow. Unless I'm totally missing something.

That is true. On the other hand, %pS/%pF uses
dereference_function_descriptor() only on three architectures.
And these modifiers are used only rarely (ok, in dump_stack()
but still).

On the other hand, any infinite loop in vsprintf() via
probe_kernel_address() would break any printk(). And would be
hard to debug.

I tend to agree with Linus. probe_kernel_address() is too complicated.
It is prone to these infinite loops and should not be used in
the default printk() path.

It would be nice to have a lightweight and safe alternative. But
I can't find any. And I think that it is not worth any huge
complexity. It was just a nice to have idea...


I am going to send a patch replacing probe_kernel_address() with
a simple check:

	if ((unsigned long)ptr < PAGE_SIZE || IS_ERR_VALUE(ptr))
		return "(efault)";

The original patch still makes sense because it adds the check
into more locations and replaces some custom variants.

Best Regards,
Petr

^ permalink raw reply

* Re: [PATCH] vsprintf: Do not break early boot with probing addresses
From: Michael Ellerman @ 2019-05-10  6:41 UTC (permalink / raw)
  To: Sergey Senozhatsky, Linus Torvalds
  Cc: Petr Mladek, linux-arch, Sergey Senozhatsky, linux-s390,
	Heiko Carstens, Rasmus Villemoes, linux-kernel, Steven Rostedt,
	Michal Hocko, Sergey Senozhatsky, Stephen Rothwell,
	Andy Shevchenko, linuxppc-dev, Martin Schwidefsky,
	Tobin C . Harding
In-Reply-To: <20190510050709.GA1831@jagdpanzerIV>

Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> writes:
> On (05/09/19 21:47), Linus Torvalds wrote:
>>    [ Sorry about html and mobile crud, I'm not at the computer right now ]
>>    How about we just undo the whole misguided probe_kernel_address() thing?
>
> But the problem will remain - %pS/%pF on PPC (and some other arch-s)
> do dereference_function_descriptor(), which calls probe_kernel_address().

(Only on 64-bit big endian, and we may even change that one day)

> So if probe_kernel_address() starts to dump_stack(), then we are heading
> towards stack overflow. Unless I'm totally missing something.

We only ended up calling dump_stack() from probe_kernel_address() due to
a combination of things:
  1. probe_kernel_address() actually uses __copy_from_user_inatomic()
     which is silly because it's not doing a user access.
  2. our user access code uses mmu_has_feature() which uses jump labels,
     and so isn't safe to call until we've initialised those jump labels.
     This is unnecessarily fragile, we can easily make the user access
     code safe to call before the jump labels are initialised.
  3. we had extra debug code enabled in mmu_has_feature() which calls
     dump_stack().

I've fixed 2, and plan to fix 1 as well at some point. And 3 is behind a
CONFIG option that no one except me is going to have enabled in
practice.

So in future we shouldn't be calling dump_stack() in that path.

cheers

^ permalink raw reply

* [PATCH] powerpc/64: mark start_here_multiplatform as __ref
From: Christophe Leroy @ 2019-05-10  6:31 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Russell Currey
  Cc: linuxppc-dev, linux-kernel

Otherwise, the following warning is encountered:

WARNING: vmlinux.o(.text+0x3dc6): Section mismatch in reference from the variable start_here_multiplatform to the function .init.text:.early_setup()
The function start_here_multiplatform() references
the function __init .early_setup().
This is often because start_here_multiplatform lacks a __init
annotation or the annotation of .early_setup is wrong.

Fixes: 56c46bba9bbf ("powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX")
Cc: Russell Currey <ruscur@russell.cc>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/kernel/head_64.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 5321a11c2835..259be7f6d551 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -904,6 +904,7 @@ p_toc:	.8byte	__toc_start + 0x8000 - 0b
 /*
  * This is where the main kernel code starts.
  */
+__REF
 start_here_multiplatform:
 	/* set up the TOC */
 	bl      relative_toc
@@ -979,6 +980,7 @@ start_here_multiplatform:
 	RFI
 	b	.	/* prevent speculative execution */
 
+	.previous
 	/* This is where all platforms converge execution */
 
 start_here_common:
-- 
2.13.3


^ permalink raw reply related

* [Bug 203125] Kernel 5.1-rc1 fails to boot on a PowerMac G4 3,6: Caused by (from SRR1=141020): Transfer error ack signal
From: bugzilla-daemon @ 2019-05-10  5:36 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <bug-203125-206035@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=203125

--- Comment #10 from Christophe Leroy (christophe.leroy@c-s.fr) ---
Thanks for testing.

Proposed patch at https://patchwork.ozlabs.org/patch/1097492/

Note that the backport to stable should be straight forward as the directory
and file name changes are in following commit:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=17312f258cf6eb584f276ad592972ade7e16e318

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply

* Re: [PATCH] vsprintf: Do not break early boot with probing addresses
From: Linus Torvalds @ 2019-05-10  4:47 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Petr Mladek, linux-arch, Heiko Carstens, linux-s390,
	Rasmus Villemoes, linux-kernel, Steven Rostedt, Michal Hocko,
	Sergey Senozhatsky, Stephen Rothwell, Andy Shevchenko,
	linuxppc-dev, Martin Schwidefsky, Tobin C . Harding
In-Reply-To: <20190510043200.GC15652@jagdpanzerIV>

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

[ Sorry about html and mobile crud, I'm not at the computer right now ]

How about we just undo the whole misguided probe_kernel_address() thing?

The excuse for is was that it would avoid crashes.

It turns out that was wrong, and that it just made things much worse.
Honestly, we haven't really had the crashes that the logic was supposed to
protect against in the first place, so by now it's clear that the whole
thing was a stupid and horrible mistake in the first place.

So let's admit that and just go back to the old sane model.

Seriously, we've never needed that odd probing. It causes issues. It's
wrong and pointless.

       Linus

On Thu, May 9, 2019, 21:32 Sergey Senozhatsky <
sergey.senozhatsky.work@gmail.com> wrote:

> On (05/09/19 14:19), Petr Mladek wrote:
> > 1. Report on Power:
> >
> > Kernel crashes very early during boot with with CONFIG_PPC_KUAP and
> > CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
> >
> > The problem is the combination of some new code called via printk(),
> > check_pointer() which calls probe_kernel_read(). That then calls
> > allow_user_access() (PPC_KUAP) and that uses mmu_has_feature() too early
> > (before we've patched features). With the JUMP_LABEL debug enabled that
> > causes us to call printk() & dump_stack() and we end up recursing and
> > overflowing the stack.
>
> Hmm... hmm... PPC does an .opd-based symbol dereference, which
> eventually probe_kernel_read()-s. So early printk(%pS) will do
>
>         printk(%pS)
>          dereference_function_descriptor()
>           probe_kernel_address()
>            dump_stack()
>             printk(%pS)
>              dereference_function_descriptor()
>               probe_kernel_address()
>                dump_stack()
>                 printk(%pS)
>                  ...
>
> I'd say... that it's not vsprintf that we want to fix, it's
> the idea that probe_kernel_address() can dump_stack() on any
> platform. On some archs probe_kernel_address()->dump_stack()
> is going nowhere:
>  dump_stack() does probe_kernel_address(), which calls dump_stack(),
>  which calls printk(%pS)->probe_kernel_address() again and again,
>  and again.
>
>         -ss
>

[-- Attachment #2: Type: text/html, Size: 2981 bytes --]

^ permalink raw reply

* Re: [PATCH] vsprintf: Do not break early boot with probing addresses
From: Sergey Senozhatsky @ 2019-05-10  5:07 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Petr Mladek, linux-arch, Sergey Senozhatsky, Heiko Carstens,
	linux-s390, Rasmus Villemoes, linux-kernel, Steven Rostedt,
	Michal Hocko, Sergey Senozhatsky, Stephen Rothwell,
	Andy Shevchenko, linuxppc-dev, Martin Schwidefsky,
	Tobin C . Harding
In-Reply-To: <CAHk-=wiP+hwSqEW0dM6AYNWUR7jXDkeueq69et6ahfUgV7hC3w@mail.gmail.com>

On (05/09/19 21:47), Linus Torvalds wrote:
>    [ Sorry about html and mobile crud, I'm not at the computer right now ]
>    How about we just undo the whole misguided probe_kernel_address() thing?

But the problem will remain - %pS/%pF on PPC (and some other arch-s)
do dereference_function_descriptor(), which calls probe_kernel_address().
So if probe_kernel_address() starts to dump_stack(), then we are heading
towards stack overflow. Unless I'm totally missing something.

	-ss

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox