* Re: [PATCH V2] powerpc/perf: Record counter overflow always if SAMPLE_IP is unset
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: Athira Rajeev, mpe; +Cc: maddy, linuxppc-dev
In-Reply-To: <1612516492-1428-1-git-send-email-atrajeev@linux.vnet.ibm.com>
On Fri, 5 Feb 2021 04:14:52 -0500, Athira Rajeev wrote:
> While sampling for marked events, currently we record the sample only
> if the SIAR valid bit of Sampled Instruction Event Register (SIER) is
> set. SIAR_VALID bit is used for fetching the instruction address from
> Sampled Instruction Address Register(SIAR). But there are some usecases,
> where the user is interested only in the PMU stats at each counter
> overflow and the exact IP of the overflow event is not required.
> Dropping SIAR invalid samples will fail to record some of the counter
> overflows in such cases.
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/perf: Record counter overflow always if SAMPLE_IP is unset
https://git.kernel.org/powerpc/c/d137845c973147a22622cc76c7b0bc16f6206323
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/uaccess: Perform barrier_nospec() in KUAP allowance helpers
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: Michael Ellerman, cmr, Benjamin Herrenschmidt, Christophe Leroy,
Paul Mackerras
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <c72f014730823b413528e90ab6c4d3bcb79f8497.1612692067.git.christophe.leroy@csgroup.eu>
On Sun, 7 Feb 2021 10:08:11 +0000 (UTC), Christophe Leroy wrote:
> barrier_nospec() in uaccess helpers is there to protect against
> speculative accesses around access_ok().
>
> When using user_access_begin() sequences together with
> unsafe_get_user() like macros, barrier_nospec() is called for
> every single read although we know the access_ok() is done
> onece.
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/uaccess: Perform barrier_nospec() in KUAP allowance helpers
https://git.kernel.org/powerpc/c/8524e2e76441fc615a3b5c1415823e051cc79eae
cheers
^ permalink raw reply
* Re: [PATCH v2] powerpc64/idle: Fix SP offsets when saving GPRs
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: linuxppc-dev, Christopher M. Riedl
In-Reply-To: <20210206072342.5067-1-cmr@codefail.de>
On Sat, 6 Feb 2021 01:23:42 -0600, Christopher M. Riedl wrote:
> The idle entry/exit code saves/restores GPRs in the stack "red zone"
> (Protected Zone according to PowerPC64 ELF ABI v2). However, the offset
> used for the first GPR is incorrect and overwrites the back chain - the
> Protected Zone actually starts below the current SP. In practice this is
> probably not an issue, but it's still incorrect so fix it.
>
> Also expand the comments to explain why using the stack "red zone"
> instead of creating a new stackframe is appropriate here.
Applied to powerpc/next.
[1/1] powerpc64/idle: Fix SP offsets when saving GPRs
https://git.kernel.org/powerpc/c/73287caa9210ded6066833195f4335f7f688a46b
cheers
^ permalink raw reply
* Re: [PATCH] powerpc: remove unneeded semicolons
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: Chengyang Fan, mpe; +Cc: joe, linuxppc-dev
In-Reply-To: <20210125095338.1719405-1-cy.fan@huawei.com>
On Mon, 25 Jan 2021 17:53:38 +0800, Chengyang Fan wrote:
> Remove superfluous semicolons after function definitions.
Applied to powerpc/next.
[1/1] powerpc: remove unneeded semicolons
https://git.kernel.org/powerpc/c/6c6fdbb2b7002aa04e418b5d2b26df1c5ba5ab80
cheers
^ permalink raw reply
* Re: [PATCH 1/2] powerpc/64: Make stack tracing work during very early boot
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman
In-Reply-To: <20210202130207.1303975-1-mpe@ellerman.id.au>
On Wed, 3 Feb 2021 00:02:06 +1100, Michael Ellerman wrote:
> If we try to stack trace very early during boot, either due to a
> WARN/BUG or manual dump_stack(), we will oops in
> valid_emergency_stack() when we try to dereference the paca_ptrs
> array.
>
> The fix is simple, we just return false if paca_ptrs isn't allocated
> yet. The stack pointer definitely isn't part of any emergency stack
> because we haven't allocated any yet.
Applied to powerpc/next.
[1/2] powerpc/64: Make stack tracing work during very early boot
https://git.kernel.org/powerpc/c/0ecf6a9e47d825b7dddfebca738386b809e59a94
[2/2] powerpc/64s: Handle program checks in wrong endian during early boot
https://git.kernel.org/powerpc/c/e7eb919057c3450cdd9d335e4a23a4da8da58db4
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/akebono: Fix unmet dependency errors
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman; +Cc: f.fainelli, rdunlap, yury.norov
In-Reply-To: <20210201012503.940145-1-mpe@ellerman.id.au>
On Mon, 1 Feb 2021 12:25:03 +1100, Michael Ellerman wrote:
> The AKEBONO config has various selects under it, including some with
> user-selectable dependencies, which means those dependencies can be
> disabled. This leads to warnings from Kconfig.
>
> This can be seen with eg:
>
> $ make allnoconfig
> $ ./scripts/config --file build~/.config -k -e CONFIG_44x -k -e CONFIG_PPC_47x -e CONFIG_AKEBONO
> $ make olddefconfig
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/akebono: Fix unmet dependency errors
https://git.kernel.org/powerpc/c/665d8d58761cba41147fe7e98e2ceed1cbf603a2
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/pseries/dlpar: handle ibm, configure-connector delay status
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: linuxppc-dev, Nathan Lynch; +Cc: tyreld, brking
In-Reply-To: <20210107025900.410369-1-nathanl@linux.ibm.com>
On Wed, 6 Jan 2021 20:59:00 -0600, Nathan Lynch wrote:
> dlpar_configure_connector() has two problems in its handling of
> ibm,configure-connector's return status:
>
> 1. When the status is -2 (busy, call again), we call
> ibm,configure-connector again immediately without checking whether
> to schedule, which can result in monopolizing the CPU.
> 2. Extended delay status (9900..9905) goes completely unhandled,
> causing the configuration to unnecessarily terminate.
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/pseries/dlpar: handle ibm, configure-connector delay status
https://git.kernel.org/powerpc/c/768d70e19ba525debd571b36e6d0ab19956c63d7
cheers
^ permalink raw reply
* Re: [PATCH 0/7] powerpc/64s: TLB flushing improvements
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: linuxppc-dev, Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>
On Thu, 17 Dec 2020 23:47:24 +1000, Nicholas Piggin wrote:
> Another round of reducing TLB flushing (mostly on radix).
>
> Thanks,
> Nick
>
> Nicholas Piggin (7):
> powerpc/64s/radix: add warning and comments in mm_cpumask trim
> powerpc/64s/radix: refactor TLB flush type selection
> powerpc/64s/radix: Check for no TLB flush required
> powerpc/64s/radix: Allow mm_cpumask trimming from external sources
> powerpc/64s/radix: occasionally attempt to trim mm_cpumask
> powerpc/64s/radix: serialize_against_pte_lookup IPIs trim mm_cpumask
> powerpc/64s: Implement ptep_clear_flush_young that does not flush TLBs
>
> [...]
Applied to powerpc/next.
[1/7] powerpc/64s/radix: add warning and comments in mm_cpumask trim
https://git.kernel.org/powerpc/c/a2496049f1f1006178d0db706a8451dd03bd3ec6
[2/7] powerpc/64s/radix: refactor TLB flush type selection
https://git.kernel.org/powerpc/c/26418b36a11f2eaf2556aa8cefe86132907e311f
[3/7] powerpc/64s/radix: Check for no TLB flush required
https://git.kernel.org/powerpc/c/54bb503345b81399575e2b7a3a6497ae212ad827
[4/7] powerpc/64s/radix: Allow mm_cpumask trimming from external sources
https://git.kernel.org/powerpc/c/780de40601aabeca41bc9aa717a329a77aa85e1a
[5/7] powerpc/64s/radix: occasionally attempt to trim mm_cpumask
https://git.kernel.org/powerpc/c/9393544842d6c85ebfc387c43a5059f8171d598f
[6/7] powerpc/64s/radix: serialize_against_pte_lookup IPIs trim mm_cpumask
https://git.kernel.org/powerpc/c/032b7f08932c9b212952d6d585e45b2941b3e8be
[7/7] powerpc/64s: Implement ptep_clear_flush_young that does not flush TLBs
https://git.kernel.org/powerpc/c/3cb1aa7aa39402f4f2cb847b1f16ade3bce43a97
cheers
^ permalink raw reply
* Re: [PATCH v7 00/42] powerpc: interrupt wrappers
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: linuxppc-dev, Nicholas Piggin; +Cc: Athira Rajeev
In-Reply-To: <20210130130852.2952424-1-npiggin@gmail.com>
On Sat, 30 Jan 2021 23:08:10 +1000, Nicholas Piggin wrote:
> This adds interrupt handler wrapper functions, similar to the
> generic / x86 code, and moves several common operations into them
> from either asm or open coded in the individual handlers.
>
> This series is based on powerpc fixes-test tree, there's another
> unrelated pending fix in patch 1 of the series which clashes a
> bit.
>
> [...]
Patches 1-41 applied to powerpc/next.
[01/42] powerpc/64s: interrupt exit improve bounding of interrupt recursion
https://git.kernel.org/powerpc/c/c0ef717305f51e29b5ce0c78a6bfe566b3283415
[02/42] KVM: PPC: Book3S HV: Context tracking exit guest context before enabling irqs
https://git.kernel.org/powerpc/c/112665286d08c87e66d699e7cba43c1497ad165f
[03/42] powerpc/32s: move DABR match out of handle_page_fault
https://git.kernel.org/powerpc/c/7a24ae2e172f770df07f8e48ed3ed2f3a6b17e37
[04/42] powerpc/64s: move DABR match out of handle_page_fault
https://git.kernel.org/powerpc/c/36f0114140eef53e931592b65bdf8bb61ffac1f8
[05/42] powerpc/64s: move the hash fault handling logic to C
https://git.kernel.org/powerpc/c/a4922f5442e7e6ce85da304e224d940edec2f1fb
[06/42] powerpc: remove arguments from fault handler functions
https://git.kernel.org/powerpc/c/a01a3f2ddbcda83e8572787c0ec1dcbeba86915a
[07/42] powerpc/fsl_booke/32: CacheLockingException remove args
https://git.kernel.org/powerpc/c/b4ced8031000b832d845dd17994e0fa1b8310496
[08/42] powerpc: do_break get registers from regs
https://git.kernel.org/powerpc/c/18722ecf9efdc6a7ca933a3e5a83cc9dba375847
[09/42] powerpc: DebugException remove args
https://git.kernel.org/powerpc/c/755d664174463791489dddf34c33308b61de68c3
[10/42] powerpc/32: transfer can avoid saving r4/r5 over trace call
https://git.kernel.org/powerpc/c/73d7a97914f23397b012e851f6a1fe4061923a82
[11/42] powerpc: bad_page_fault get registers from regs
https://git.kernel.org/powerpc/c/8458c628a53ba4311b2df12370be1a6f1870ff37
[12/42] powerpc/64s: add do_bad_page_fault_segv handler
https://git.kernel.org/powerpc/c/71f47976fafc4375674bd0714153be10f878040a
[13/42] powerpc: rearrange do_page_fault error case to be inside exception_enter
https://git.kernel.org/powerpc/c/4cb8428465148bcca0b6b8593d51f805818a70e0
[14/42] powerpc/64s: move bad_page_fault handling to C
https://git.kernel.org/powerpc/c/f4c03b0e520c5f56e569a8da3fce5ddbd0696742
[15/42] powerpc/64s: split do_hash_fault
https://git.kernel.org/powerpc/c/bf0e2374aa7b4f8b01fd59fcb0746a9b6b05326a
[16/42] powerpc/mm: Remove stale do_page_fault comment referring to SLB faults
https://git.kernel.org/powerpc/c/31d6490ccb2868530300381d8079026cd4a9f7ad
[17/42] powerpc/64s: slb comment update
https://git.kernel.org/powerpc/c/e44370abb2e99299678ec6b209f8aad574fa5f36
[18/42] powerpc/traps: add NOKPROBE_SYMBOL for sreset and mce
https://git.kernel.org/powerpc/c/3a3138836bc35966d59742512b597997755878f7
[19/42] powerpc/perf: move perf irq/nmi handling details into traps.c
https://git.kernel.org/powerpc/c/156b5371a9c2482a9ad23ec82d1a4f89a3ab430d
[20/42] powerpc/time: move timer_broadcast_interrupt prototype to asm/time.h
https://git.kernel.org/powerpc/c/0440b8a22cc48922f7c6ae894abd221cf7cc4b64
[21/42] powerpc: add and use unknown_async_exception
https://git.kernel.org/powerpc/c/6c6aee009ec34cb7f5ef76f910c1b9417c81efd8
[22/42] powerpc/cell: tidy up pervasive declarations
https://git.kernel.org/powerpc/c/dcdb4f12963f3f4200e24e1dad78564a98736f67
[23/42] powerpc: introduce die_mce
https://git.kernel.org/powerpc/c/209e9d500e25eada096b2c09a34093bc458166f3
[24/42] powerpc/mce: ensure machine check handler always tests RI
https://git.kernel.org/powerpc/c/c538938fa2cfdc806c6304888e3876729e6939e0
[25/42] powerpc: improve handling of unrecoverable system reset
https://git.kernel.org/powerpc/c/11cb0a25f71818ca7ab4856548ecfd83c169aa4d
[26/42] powerpc: interrupt handler wrapper functions
https://git.kernel.org/powerpc/c/8d41fc618ab804657acd2df8e761ce1001f41513
[27/42] powerpc: add interrupt wrapper entry / exit stub functions
https://git.kernel.org/powerpc/c/25b7e6bb743ca5a375bb89522a2c2bec840d5fc3
[28/42] powerpc: convert interrupt handlers to use wrappers
https://git.kernel.org/powerpc/c/3a96570ffceb15c6ed9cc6f990f172dcdc8ac279
[29/42] powerpc: add interrupt_cond_local_irq_enable helper
https://git.kernel.org/powerpc/c/e6f8a6c86ce7b2108c03c1cc014fdae278573df1
[30/42] powerpc/64: context tracking remove _TIF_NOHZ
https://git.kernel.org/powerpc/c/2a06bf3e95cd93e3640d431960181b8e47415f33
[31/42] powerpc/64s/hash: improve context tracking of hash faults
https://git.kernel.org/powerpc/c/a008f8f9fd67ffb13d906ef4ea6235a3d62dfdb6
[32/42] powerpc/64: context tracking move to interrupt wrappers
https://git.kernel.org/powerpc/c/540d4d34bef4ec58aba12b159030492616d6f54e
[33/42] powerpc/64: add context tracking to asynchronous interrupts
https://git.kernel.org/powerpc/c/6fdb0f410bb026ade092039a6c2655a53323c996
[34/42] powerpc: handle irq_enter/irq_exit in interrupt handler wrappers
https://git.kernel.org/powerpc/c/1b1b6a6f4cc0ecc27745fa578cbaf912d76dbdda
[35/42] powerpc/64s: move context tracking exit to interrupt exit path
https://git.kernel.org/powerpc/c/f821bc97dee4f3ee92c3668d495af49dfd720fe0
[36/42] powerpc/64s: reconcile interrupts in C
https://git.kernel.org/powerpc/c/75b96950fddab6f1c59a10160b6bf38948bdb0e3
[37/42] powerpc/64: move account_stolen_time into its own function
https://git.kernel.org/powerpc/c/2994e1babfc477a3101ec6841b9dc5b770c1ec18
[38/42] powerpc/64: entry cpu time accounting in C
https://git.kernel.org/powerpc/c/56acfdd8bf9f75e83a1b2957bd415368f39b67b6
[39/42] powerpc: move NMI entry/exit code into wrapper
https://git.kernel.org/powerpc/c/118178e62e2e0da39b394e812fef7179c8bdb3bc
[40/42] powerpc/64s: move NMI soft-mask handling to C
https://git.kernel.org/powerpc/c/6ecbb582b6947f041832fff07c2f38791ae19287
[41/42] powerpc/64s: runlatch interrupt handling in C
https://git.kernel.org/powerpc/c/86dbb39416493add2bdf5b7ad39a1276f2107b83
cheers
^ permalink raw reply
* Re: [PATCH 01/18] powerpc/pci: Add ppc_md.discover_phbs()
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: linuxppc-dev, Oliver O'Halloran; +Cc: Paul Mackerras
In-Reply-To: <20201103043523.916109-1-oohall@gmail.com>
On Tue, 3 Nov 2020 15:35:06 +1100, Oliver O'Halloran wrote:
> On many powerpc platforms the discovery and initalisation of
> pci_controllers (PHBs) happens inside of setup_arch(). This is very early
> in boot (pre-initcalls) and means that we're initialising the PHB long
> before many basic kernel services (slab allocator, debugfs, a real ioremap)
> are available.
>
> On PowerNV this causes an additional problem since we map the PHB registers
> with ioremap(). As of commit d538aadc2718 ("powerpc/ioremap: warn on early
> use of ioremap()") a warning is printed because we're using the "incorrect"
> API to setup and MMIO mapping in searly boot. The kernel does provide
> early_ioremap(), but that is not intended to create long-lived MMIO
> mappings and a seperate warning is printed by generic code if
> early_ioremap() mappings are "leaked."
>
> [...]
Applied to powerpc/next.
[01/18] powerpc/pci: Add ppc_md.discover_phbs()
https://git.kernel.org/powerpc/c/5537fcb319d016ce387f818dd774179bc03217f5
[02/18] powerpc/pci: Move PHB discovery for PCI_DN using platforms
https://git.kernel.org/powerpc/c/fbbefb320214db14c3e740fce98e2c95c9d0669b
[03/18] powerpc/maple: Move PHB discovery
(squashed into 2)
[04/18] powerpc/512x: Move PHB discovery
https://git.kernel.org/powerpc/c/893586ec949d3e48573a585c26bf04998fea6e1f
[05/18] powerpc/52xx/efika: Move PHB discovery
https://git.kernel.org/powerpc/c/eab3166f4eac384b48ebd2ed7b61dc465c1912cf
[06/18] powerpc/52xx/lite5200: Move PHB discovery
https://git.kernel.org/powerpc/c/e0bf9de2242a31a8f79015376ed08c4efe74774a
[07/18] powerpc/52xx/media5200: Move PHB discovery
https://git.kernel.org/powerpc/c/ba5087622a0f11c8d3c6587392ebc70f96503e51
[08/18] powerpc/52xx/mpc5200_simple: Move PHB discovery
https://git.kernel.org/powerpc/c/a760cfd9cfa2193961d7e599f46fbfe2498c400a
[09/18] powerpc/82xx/*: Move PHB discovery
https://git.kernel.org/powerpc/c/3c82a6aecd367bbbe7876c406cd3e12b5b0e4204
[10/18] powerpc/83xx: Move PHB discovery
https://git.kernel.org/powerpc/c/83f84041ff1cf6c23fc38861218af2d4ca2d9b38
[11/18] powerpc/amigaone: Move PHB discovery
https://git.kernel.org/powerpc/c/053d58c870298d62b9c5154672ef2f1684c4ea43
[12/18] powerpc/chrp: Move PHB discovery
https://git.kernel.org/powerpc/c/407d418f2fd4c20aa8ca1cf4168a414d77766852
[13/18] powerpc/embedded6xx/holly: Move PHB discovery
https://git.kernel.org/powerpc/c/08c4738254b87117c69816d8033dd25f38185f92
[14/18] powerpc/embedded6xx/linkstation: Move PHB discovery
https://git.kernel.org/powerpc/c/daa6c24780c15f4abcb76a9d426142beff9f62c6
[15/18] powerpc/embedded6xx/mpc7448: Move PHB discovery
https://git.kernel.org/powerpc/c/748770aeb44108ecb4e09d273e7718611cd60a98
[16/18] powerpc/embedded6xx/mve5100: Move PHB discovery
https://git.kernel.org/powerpc/c/d20a864f434b277b245ac6508920d90a48f6155d
[17/18] powerpc/pasemi: Move PHB discovery
https://git.kernel.org/powerpc/c/c144bc719234500e292c0545de99822bd8a78a6b
[18/18] powerpc/powermac: Move PHB discovery
(squashed into 2)
cheers
^ permalink raw reply
* Re: [PATCH v2] powerpc/powernv/pci: Drop pnv_phb->initialized
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: linuxppc-dev, Oliver O'Halloran
In-Reply-To: <20200902013657.1753830-1-oohall@gmail.com>
On Wed, 2 Sep 2020 11:36:57 +1000, Oliver O'Halloran wrote:
> The pnv_phb->initialized flag is an odd beast. It was added back in 2012 in
> commit db1266c85261 ("powerpc/powernv: Skip check on PE if necessary") to
> allow devices to be enabled even if the device had not yet been assigned to
> a PE. Allowing the device to be enabled before the PE is configured may
> cause spurious EEH events since none of the IOMMU context has been setup.
>
> I'm not entirely sure why this was ever necessary. My best guess is that it
> was an workaround for a bug or some other undesireable behaviour from the
> PCI core. Either way, it's unnecessary now since as of commit dc3d8f85bb57
> ("powerpc/powernv/pci: Re-work bus PE configuration") we can guarantee that
> the PE will be configured before the PCI core will allow drivers to bind to
> the device.
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/powernv/pci: Drop pnv_phb->initialized
https://git.kernel.org/powerpc/c/24b4c6b1a7fc79fe8142d50cb439944b81b659ff
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/pkeys: Remove unused code
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: mpe, Sandipan Das; +Cc: linuxram, linuxppc-dev, aneesh.kumar
In-Reply-To: <20210202150050.75335-1-sandipan@linux.ibm.com>
On Tue, 2 Feb 2021 20:30:50 +0530, Sandipan Das wrote:
> This removes arch_supports_pkeys(), arch_usable_pkeys() and
> thread_pkey_regs_*() which are remnants from the following:
>
> commit 06bb53b33804 ("powerpc: store and restore the pkey state across context switches")
> commit 2cd4bd192ee9 ("powerpc/pkeys: Fix handling of pkey state across fork()")
> commit cf43d3b26452 ("powerpc: Enable pkey subsystem")
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/pkeys: Remove unused code
https://git.kernel.org/powerpc/c/266d8f7586533a4c473ccb392204e32df99b72b5
cheers
^ permalink raw reply
* Re: [PATCH v4 1/2] powerpc: sstep: Fix load-store and update emulation
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: mpe, Sandipan Das
Cc: ravi.bangoria, ananth, jniethe5, paulus, naveen.n.rao,
linuxppc-dev, dja
In-Reply-To: <20210204080744.135785-1-sandipan@linux.ibm.com>
On Thu, 4 Feb 2021 13:37:43 +0530, Sandipan Das wrote:
> The Power ISA says that the fixed-point load and update
> instructions must neither use R0 for the base address (RA)
> nor have the destination (RT) and the base address (RA) as
> the same register. Similarly, for fixed-point stores and
> floating-point loads and stores, the instruction is invalid
> when R0 is used as the base address (RA).
>
> [...]
Applied to powerpc/next.
[1/2] powerpc/sstep: Fix load-store and update emulation
https://git.kernel.org/powerpc/c/bbda4b6c7d7c7f79da71f95c92a5d76be22c3efd
[2/2] powerpc/sstep: Fix darn emulation
https://git.kernel.org/powerpc/c/22b89ba178dd0a66a26699ead014a3e73ff8e044
cheers
^ permalink raw reply
* Re: [PATCH] arch: powerpc: kernel: Fix the spelling mismach to mismatch in head.44x.S
From: Michael Ellerman @ 2021-02-10 12:57 UTC (permalink / raw)
To: Bhaskar Chowdhury, mpe, linuxppc-dev, akpm, rppt, paulus,
linux-kernel, benh
Cc: rdunlap
In-Reply-To: <20210202093746.5198-1-unixbhaskar@gmail.com>
On Tue, 2 Feb 2021 15:07:46 +0530, Bhaskar Chowdhury wrote:
> s/mismach/mismatch/
Applied to powerpc/next.
[1/1] powerpc/44x: Fix a spelling mismach to mismatch in head_44x.S
https://git.kernel.org/powerpc/c/ea7826583f5ed7abca97e6e56441caadcbbd957a
cheers
^ permalink raw reply
* Re: [PATCH v3] powerpc/kuap: Allow kernel thread to access userspace after kthread_use_mm
From: Michael Ellerman @ 2021-02-10 13:02 UTC (permalink / raw)
To: Aneesh Kumar K.V, linuxppc-dev, mpe
Cc: Jens Axboe, Zorro Lang, Nicholas Piggin
In-Reply-To: <20210206025634.521979-1-aneesh.kumar@linux.ibm.com>
On Sat, 6 Feb 2021 08:26:34 +0530, Aneesh Kumar K.V wrote:
> This fix the bad fault reported by KUAP when io_wqe_worker access userspace.
>
> Bug: Read fault blocked by KUAP!
> WARNING: CPU: 1 PID: 101841 at arch/powerpc/mm/fault.c:229 __do_page_fault+0x6b4/0xcd0
> NIP [c00000000009e7e4] __do_page_fault+0x6b4/0xcd0
> LR [c00000000009e7e0] __do_page_fault+0x6b0/0xcd0
> ..........
> Call Trace:
> [c000000016367330] [c00000000009e7e0] __do_page_fault+0x6b0/0xcd0 (unreliable)
> [c0000000163673e0] [c00000000009ee3c] do_page_fault+0x3c/0x120
> [c000000016367430] [c00000000000c848] handle_page_fault+0x10/0x2c
> --- interrupt: 300 at iov_iter_fault_in_readable+0x148/0x6f0
> ..........
> NIP [c0000000008e8228] iov_iter_fault_in_readable+0x148/0x6f0
> LR [c0000000008e834c] iov_iter_fault_in_readable+0x26c/0x6f0
> interrupt: 300
> [c0000000163677e0] [c0000000007154a0] iomap_write_actor+0xc0/0x280
> [c000000016367880] [c00000000070fc94] iomap_apply+0x1c4/0x780
> [c000000016367990] [c000000000710330] iomap_file_buffered_write+0xa0/0x120
> [c0000000163679e0] [c00800000040791c] xfs_file_buffered_aio_write+0x314/0x5e0 [xfs]
> [c000000016367a90] [c0000000006d74bc] io_write+0x10c/0x460
> [c000000016367bb0] [c0000000006d80e4] io_issue_sqe+0x8d4/0x1200
> [c000000016367c70] [c0000000006d8ad0] io_wq_submit_work+0xc0/0x250
> [c000000016367cb0] [c0000000006e2578] io_worker_handle_work+0x498/0x800
> [c000000016367d40] [c0000000006e2cdc] io_wqe_worker+0x3fc/0x4f0
> [c000000016367da0] [c0000000001cb0a4] kthread+0x1c4/0x1d0
> [c000000016367e10] [c00000000000dbf0] ret_from_kernel_thread+0x5c/0x6c
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/kuap: Allow kernel thread to access userspace after kthread_use_mm
https://git.kernel.org/powerpc/c/8c511eff1827239f24ded212b1bcda7ca5b16203
cheers
^ permalink raw reply
* [PATCH 1/3] powerpc/83xx: Fix build error when CONFIG_PCI=n
From: Michael Ellerman @ 2021-02-10 13:08 UTC (permalink / raw)
To: linuxppc-dev
As reported by lkp:
arch/powerpc/platforms/83xx/km83xx.c:183:19: error: 'mpc83xx_setup_pci' undeclared here (not in a function)
183 | .discover_phbs = mpc83xx_setup_pci,
| ^~~~~~~~~~~~~~~~~
| mpc83xx_setup_arch
There is a stub defined for the CONFIG_PCI=n case, but now that
mpc83xx_setup_pci() is being assigned to discover_phbs the correct
empty value is NULL.
Fixes: 83f84041ff1c ("powerpc/83xx: Move PHB discovery")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/platforms/83xx/mpc83xx.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index f37d04332fc7..a30d30588cf6 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -76,7 +76,7 @@ extern void mpc83xx_ipic_init_IRQ(void);
#ifdef CONFIG_PCI
extern void mpc83xx_setup_pci(void);
#else
-#define mpc83xx_setup_pci() do {} while (0)
+#define mpc83xx_setup_pci NULL
#endif
extern int mpc83xx_declare_of_platform_devices(void);
--
2.25.1
^ permalink raw reply related
* [PATCH 2/3] powerpc/mm/64s: Fix no previous prototype warning
From: Michael Ellerman @ 2021-02-10 13:08 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <20210210130804.3190952-1-mpe@ellerman.id.au>
As reported by lkp:
arch/powerpc/mm/book3s64/radix_tlb.c:646:6: warning: no previous
prototype for function 'exit_lazy_flush_tlb'
Fix it by moving the prototype into the existing header.
Fixes: 032b7f08932c ("powerpc/64s/radix: serialize_against_pte_lookup IPIs trim mm_cpumask")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/book3s64/internal.h | 2 ++
arch/powerpc/mm/book3s64/pgtable.c | 4 ++--
arch/powerpc/mm/book3s64/radix_tlb.c | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/book3s64/internal.h b/arch/powerpc/mm/book3s64/internal.h
index c12d78ee42f5..5045048ce244 100644
--- a/arch/powerpc/mm/book3s64/internal.h
+++ b/arch/powerpc/mm/book3s64/internal.h
@@ -15,4 +15,6 @@ static inline bool stress_slb(void)
void slb_setup_new_exec(void);
+void exit_lazy_flush_tlb(struct mm_struct *mm, bool always_flush);
+
#endif /* ARCH_POWERPC_MM_BOOK3S64_INTERNAL_H */
diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index 78c492e86752..9ffa65074cb0 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -20,6 +20,8 @@
#include <mm/mmu_decl.h>
#include <trace/events/thp.h>
+#include "internal.h"
+
unsigned long __pmd_frag_nr;
EXPORT_SYMBOL(__pmd_frag_nr);
unsigned long __pmd_frag_size_shift;
@@ -79,8 +81,6 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd));
}
-void exit_lazy_flush_tlb(struct mm_struct *mm, bool always_flush);
-
static void do_serialize(void *arg)
{
/* We've taken the IPI, so try to trim the mask while here */
diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index d7f1a6bd08ef..409e61210789 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -18,6 +18,8 @@
#include <asm/cputhreads.h>
#include <asm/plpar_wrappers.h>
+#include "internal.h"
+
#define RIC_FLUSH_TLB 0
#define RIC_FLUSH_PWC 1
#define RIC_FLUSH_ALL 2
--
2.25.1
^ permalink raw reply related
* [PATCH 3/3] powerpc/amigaone: Make amigaone_discover_phbs() static
From: Michael Ellerman @ 2021-02-10 13:08 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <20210210130804.3190952-1-mpe@ellerman.id.au>
It's only used in setup.c, so make it static.
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 053d58c87029 ("powerpc/amigaone: Move PHB discovery")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/platforms/amigaone/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/amigaone/setup.c b/arch/powerpc/platforms/amigaone/setup.c
index b25ddf39dd43..9d252c554f7f 100644
--- a/arch/powerpc/platforms/amigaone/setup.c
+++ b/arch/powerpc/platforms/amigaone/setup.c
@@ -70,7 +70,7 @@ void __init amigaone_setup_arch(void)
ppc_md.progress("Linux/PPC "UTS_RELEASE"\n", 0);
}
-void __init amigaone_discover_phbs(void)
+static void __init amigaone_discover_phbs(void)
{
struct device_node *np;
int phb = -ENODEV;
--
2.25.1
^ permalink raw reply related
* Re: [PATCH v2 2/7] ASoC: fsl_rpmsg: Add CPU DAI driver for audio base on rpmsg
From: Mark Brown @ 2021-02-10 15:38 UTC (permalink / raw)
To: Shengjiu Wang
Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
alsa-devel, Timur Tabi, Xiubo Li, Fabio Estevam, Shengjiu Wang,
Takashi Iwai, Liam Girdwood, linux-kernel, Nicolin Chen,
Rob Herring, linuxppc-dev
In-Reply-To: <CAA+D8AN=SDMLhuNbstzHL_H2p_L6cr+oCXbauNB0gGs2BW5tmA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]
On Wed, Feb 10, 2021 at 02:35:29PM +0800, Shengjiu Wang wrote:
> On Wed, Feb 10, 2021 at 6:30 AM Mark Brown <broonie@kernel.org> wrote:
> > Like I say I'd actually recommend moving this control to DAPM.
> I may understand your point, you suggest to use the .set_bias_level
> interface. But in my case I need to enable the clock in earlier stage
> and keep the clock on when system go to suspend.
The device can be kept alive over system suspend if that's needed, or
possibly it sounds like runtime PM is a better fit? There's callbacks
in the core to keep the device runtime PM enabled while it's open which
is probably about the time range you're looking for.
> I am not sure .set_bias_level can met my requirement. we start
> the Chinese new year holiday now, so currently I can't do test for this
> recommendation.
> Maybe we can keep current implementation, can we?
> Later after I do the test, I can submit another patch for it.
Well, the current version is clearly going to leak clock enables with
valid userspace so
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Declaring unrecoverable_exception() as __noreturn ?
From: Christophe Leroy @ 2021-02-10 16:44 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev@lists.ozlabs.org
As far as I can see, almost all callers of unrecoverable_exception() expect it to never return.
Can we mark it __noreturn ?
Below is interrupt_exit_kernel_prepare() with then without unrecoverable_exception() declared as
__noreturn. (CONFIG_PREEMPT_NONE, and with the BUG_ON() removed)
With the __noreturn added, we get no stack frame on the likely path
000003a8 <interrupt_exit_kernel_prepare>:
3a8: 81 43 00 84 lwz r10,132(r3)
3ac: 71 4a 00 02 andi. r10,r10,2
3b0: 41 82 00 30 beq 3e0 <interrupt_exit_kernel_prepare+0x38>
3b4: 80 62 00 70 lwz r3,112(r2)
3b8: 74 63 00 01 andis. r3,r3,1
3bc: 40 82 00 34 bne 3f0 <interrupt_exit_kernel_prepare+0x48>
3c0: 7d 40 00 a6 mfmsr r10
3c4: 55 4a 04 5e rlwinm r10,r10,0,17,15
3c8: 7d 40 01 24 mtmsr r10
3cc: 7d 20 00 a6 mfmsr r9
3d0: 55 29 07 fa rlwinm r9,r9,0,31,29
3d4: 55 29 04 5e rlwinm r9,r9,0,17,15
3d8: 7d 20 01 24 mtmsr r9
3dc: 4e 80 00 20 blr
3e0: 94 21 ff f0 stwu r1,-16(r1)
3e4: 7c 08 02 a6 mflr r0
3e8: 90 01 00 14 stw r0,20(r1)
3ec: 48 00 00 01 bl 3ec <interrupt_exit_kernel_prepare+0x44>
3ec: R_PPC_REL24 unrecoverable_exception
3f0: 38 e2 00 70 addi r7,r2,112
3f4: 3d 00 00 01 lis r8,1
3f8: 7c c0 38 28 lwarx r6,0,r7
3fc: 7c c6 40 78 andc r6,r6,r8
400: 7c c0 39 2d stwcx. r6,0,r7
404: 40 a2 ff f4 bne 3f8 <interrupt_exit_kernel_prepare+0x50>
408: 38 60 00 01 li r3,1
40c: 4b ff ff b4 b 3c0 <interrupt_exit_kernel_prepare+0x18>
Without the modification:
000003a8 <interrupt_exit_kernel_prepare>:
3a8: 94 21 ff f0 stwu r1,-16(r1)
3ac: 93 e1 00 0c stw r31,12(r1)
3b0: 81 23 00 84 lwz r9,132(r3)
3b4: 71 29 00 02 andi. r9,r9,2
3b8: 41 82 00 38 beq 3f0 <interrupt_exit_kernel_prepare+0x48>
3bc: 81 22 00 70 lwz r9,112(r2)
3c0: 75 23 00 01 andis. r3,r9,1
3c4: 40 82 00 4c bne 410 <interrupt_exit_kernel_prepare+0x68>
3c8: 7d 20 00 a6 mfmsr r9
3cc: 55 29 04 5e rlwinm r9,r9,0,17,15
3d0: 7d 20 01 24 mtmsr r9
3d4: 7d 20 00 a6 mfmsr r9
3d8: 55 29 07 fa rlwinm r9,r9,0,31,29
3dc: 55 29 04 5e rlwinm r9,r9,0,17,15
3e0: 7d 20 01 24 mtmsr r9
3e4: 83 e1 00 0c lwz r31,12(r1)
3e8: 38 21 00 10 addi r1,r1,16
3ec: 4e 80 00 20 blr
3f0: 7c 08 02 a6 mflr r0
3f4: 90 01 00 14 stw r0,20(r1)
3f8: 48 00 00 01 bl 3f8 <interrupt_exit_kernel_prepare+0x50>
3f8: R_PPC_REL24 unrecoverable_exception
3fc: 81 22 00 70 lwz r9,112(r2)
400: 80 01 00 14 lwz r0,20(r1)
404: 75 23 00 01 andis. r3,r9,1
408: 7c 08 03 a6 mtlr r0
40c: 41 82 ff bc beq 3c8 <interrupt_exit_kernel_prepare+0x20>
410: 39 02 00 70 addi r8,r2,112
414: 3d 20 00 01 lis r9,1
418: 7c e0 40 28 lwarx r7,0,r8
41c: 7c e7 48 78 andc r7,r7,r9
420: 7c e0 41 2d stwcx. r7,0,r8
424: 40 a2 ff f4 bne 418 <interrupt_exit_kernel_prepare+0x70>
428: 38 60 00 01 li r3,1
42c: 7d 20 00 a6 mfmsr r9
430: 55 29 04 5e rlwinm r9,r9,0,17,15
434: 7d 20 01 24 mtmsr r9
438: 7d 20 00 a6 mfmsr r9
43c: 55 29 07 fa rlwinm r9,r9,0,31,29
440: 55 29 04 5e rlwinm r9,r9,0,17,15
444: 7d 20 01 24 mtmsr r9
448: 83 e1 00 0c lwz r31,12(r1)
44c: 38 21 00 10 addi r1,r1,16
450: 4e 80 00 20 blr
^ permalink raw reply
* Re: [PATCH v17 00/10] Carry forward IMA measurement log on kexec on ARM64
From: Rob Herring @ 2021-02-10 17:15 UTC (permalink / raw)
To: Lakshmi Ramasubramanian
Cc: mark.rutland, tao.li, zohar, paulus, vincenzo.frascino,
frowand.list, sashal, masahiroy, jmorris, takahiro.akashi,
linux-arm-kernel, catalin.marinas, serge, devicetree,
pasha.tatashin, will, prsriva, hsinyi, allison, christophe.leroy,
mbrugger, balajib, dmitry.kasatkin, linux-kernel, james.morse,
gregkh, joe, linux-integrity, linuxppc-dev, bauerman
In-Reply-To: <20210209182200.30606-1-nramas@linux.microsoft.com>
On Tue, Feb 09, 2021 at 10:21:50AM -0800, Lakshmi Ramasubramanian wrote:
> On kexec file load Integrity Measurement Architecture (IMA) subsystem
> may verify the IMA signature of the kernel and initramfs, and measure
> it. The command line parameters passed to the kernel in the kexec call
> may also be measured by IMA. A remote attestation service can verify
> a TPM quote based on the TPM event log, the IMA measurement list, and
> the TPM PCR data. This can be achieved only if the IMA measurement log
> is carried over from the current kernel to the next kernel across
> the kexec call.
>
> powerpc already supports carrying forward the IMA measurement log on
> kexec. This patch set adds support for carrying forward the IMA
> measurement log on kexec on ARM64.
>
> This patch set moves the platform independent code defined for powerpc
> such that it can be reused for other platforms as well. A chosen node
> "linux,ima-kexec-buffer" is added to the DTB for ARM64 to hold
> the address and the size of the memory reserved to carry
> the IMA measurement log.
>
> This patch set has been tested for ARM64 platform using QEMU.
> I would like help from the community for testing this change on powerpc.
> Thanks.
>
> This patch set is based on
> commit 96acc833dec8 ("ima: Free IMA measurement buffer after kexec syscall")
> in https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
> "next-integrity" branch.
Is that a hard dependency still? Given this is now almost entirely
deleting arch code and adding drivers/of/ code, I was going to apply it.
Rob
^ permalink raw reply
* Re: [PATCH v17 05/10] powerpc: Move ima buffer fields to struct kimage
From: Rob Herring @ 2021-02-10 17:20 UTC (permalink / raw)
To: Lakshmi Ramasubramanian
Cc: mark.rutland, tao.li, zohar, paulus, vincenzo.frascino,
frowand.list, sashal, masahiroy, jmorris, takahiro.akashi,
linux-arm-kernel, catalin.marinas, serge, devicetree,
pasha.tatashin, will, prsriva, hsinyi, allison, christophe.leroy,
mbrugger, balajib, dmitry.kasatkin, linux-kernel, james.morse,
gregkh, joe, linux-integrity, linuxppc-dev, bauerman
In-Reply-To: <20210209182200.30606-6-nramas@linux.microsoft.com>
On Tue, Feb 09, 2021 at 10:21:55AM -0800, Lakshmi Ramasubramanian wrote:
> The fields ima_buffer_addr and ima_buffer_size in "struct kimage_arch"
> for powerpc are used to carry forward the IMA measurement list across
> kexec system call. These fields are not architecture specific, but are
> currently limited to powerpc.
>
> arch_ima_add_kexec_buffer() defined in "arch/powerpc/kexec/ima.c"
> sets ima_buffer_addr and ima_buffer_size for the kexec system call.
> This function does not have architecture specific code, but is
> currently limited to powerpc.
>
> Move ima_buffer_addr and ima_buffer_size to "struct kimage".
> Rename arch_ima_add_kexec_buffer() to of_ima_add_kexec_buffer()
> and move it in drivers/of/kexec.c.
>
> Co-developed-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> Signed-off-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
> Suggested-by: Will Deacon <will@kernel.org>
> ---
> arch/powerpc/include/asm/ima.h | 3 ---
> arch/powerpc/include/asm/kexec.h | 5 -----
> arch/powerpc/kexec/ima.c | 29 ++++++-----------------------
> drivers/of/kexec.c | 23 +++++++++++++++++++++++
> include/linux/kexec.h | 3 +++
> include/linux/of.h | 5 +++++
> security/integrity/ima/ima_kexec.c | 3 ++-
> 7 files changed, 39 insertions(+), 32 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/ima.h b/arch/powerpc/include/asm/ima.h
> index ead488cf3981..51f64fd06c19 100644
> --- a/arch/powerpc/include/asm/ima.h
> +++ b/arch/powerpc/include/asm/ima.h
> @@ -14,9 +14,6 @@ static inline void remove_ima_buffer(void *fdt, int chosen_node) {}
> #endif
>
> #ifdef CONFIG_IMA_KEXEC
> -int arch_ima_add_kexec_buffer(struct kimage *image, unsigned long load_addr,
> - size_t size);
> -
> int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node);
> #else
> static inline int setup_ima_buffer(const struct kimage *image, void *fdt,
> diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
> index bdd0ddb9ac4d..ecf88533d6b4 100644
> --- a/arch/powerpc/include/asm/kexec.h
> +++ b/arch/powerpc/include/asm/kexec.h
> @@ -112,11 +112,6 @@ struct kimage_arch {
> unsigned long elf_headers_sz;
> void *elf_headers;
> void *fdt;
> -
> -#ifdef CONFIG_IMA_KEXEC
> - phys_addr_t ima_buffer_addr;
> - size_t ima_buffer_size;
> -#endif
> };
>
> char *setup_kdump_cmdline(struct kimage *image, char *cmdline,
> diff --git a/arch/powerpc/kexec/ima.c b/arch/powerpc/kexec/ima.c
> index 720e50e490b6..ed38125e2f87 100644
> --- a/arch/powerpc/kexec/ima.c
> +++ b/arch/powerpc/kexec/ima.c
> @@ -128,23 +128,6 @@ void remove_ima_buffer(void *fdt, int chosen_node)
> }
>
> #ifdef CONFIG_IMA_KEXEC
> -/**
> - * arch_ima_add_kexec_buffer - do arch-specific steps to add the IMA buffer
> - *
> - * Architectures should use this function to pass on the IMA buffer
> - * information to the next kernel.
> - *
> - * Return: 0 on success, negative errno on error.
> - */
> -int arch_ima_add_kexec_buffer(struct kimage *image, unsigned long load_addr,
> - size_t size)
> -{
> - image->arch.ima_buffer_addr = load_addr;
> - image->arch.ima_buffer_size = size;
> -
> - return 0;
> -}
> -
> static int write_number(void *p, u64 value, int cells)
> {
> if (cells == 1) {
> @@ -180,7 +163,7 @@ int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node)
> u8 value[16];
>
> remove_ima_buffer(fdt, chosen_node);
> - if (!image->arch.ima_buffer_size)
> + if (!image->ima_buffer_size)
> return 0;
>
> ret = get_addr_size_cells(&addr_cells, &size_cells);
> @@ -192,11 +175,11 @@ int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node)
> if (entry_size > sizeof(value))
> return -EINVAL;
>
> - ret = write_number(value, image->arch.ima_buffer_addr, addr_cells);
> + ret = write_number(value, image->ima_buffer_addr, addr_cells);
> if (ret)
> return ret;
>
> - ret = write_number(value + 4 * addr_cells, image->arch.ima_buffer_size,
> + ret = write_number(value + 4 * addr_cells, image->ima_buffer_size,
> size_cells);
> if (ret)
> return ret;
> @@ -206,13 +189,13 @@ int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node)
> if (ret < 0)
> return -EINVAL;
>
> - ret = fdt_add_mem_rsv(fdt, image->arch.ima_buffer_addr,
> - image->arch.ima_buffer_size);
> + ret = fdt_add_mem_rsv(fdt, image->ima_buffer_addr,
> + image->ima_buffer_size);
> if (ret)
> return -EINVAL;
>
> pr_debug("IMA buffer at 0x%llx, size = 0x%zx\n",
> - image->arch.ima_buffer_addr, image->arch.ima_buffer_size);
> + image->ima_buffer_addr, image->ima_buffer_size);
>
> return 0;
> }
> diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
> index 469e09613cdd..9f33d215b9f2 100644
> --- a/drivers/of/kexec.c
> +++ b/drivers/of/kexec.c
> @@ -63,6 +63,29 @@ static int fdt_find_and_del_mem_rsv(void *fdt, unsigned long start, unsigned lon
> return -ENOENT;
> }
>
> +#ifdef CONFIG_IMA_KEXEC
> +/**
> + * of_ima_add_kexec_buffer - Add IMA buffer for next kernel
> + *
> + * @image: kimage struct to set IMA buffer data
> + * @load_addr: Starting address where IMA buffer is loaded at
> + * @size: Number of bytes in the IMA buffer
> + *
> + * Use this function to pass on the IMA buffer information to
> + * the next kernel across kexec system call.
> + *
> + * Return: 0 on success, negative errno on error.
> + */
> +int of_ima_add_kexec_buffer(struct kimage *image,
> + unsigned long load_addr, size_t size)
> +{
> + image->ima_buffer_addr = load_addr;
> + image->ima_buffer_size = size;
> +
There's nothing DT specific about this function, so this is the wrong
place for it. I would just remove it and directly set the members.
Rob
^ permalink raw reply
* Re: [PATCH v17 02/10] of: Add a common kexec FDT setup function
From: Rob Herring @ 2021-02-10 17:23 UTC (permalink / raw)
To: Lakshmi Ramasubramanian
Cc: mark.rutland, tao.li, zohar, paulus, vincenzo.frascino,
frowand.list, sashal, masahiroy, jmorris, takahiro.akashi,
linux-arm-kernel, catalin.marinas, serge, devicetree,
pasha.tatashin, will, prsriva, hsinyi, allison, christophe.leroy,
mbrugger, balajib, dmitry.kasatkin, linux-kernel, james.morse,
gregkh, joe, linux-integrity, linuxppc-dev, bauerman
In-Reply-To: <20210209182200.30606-3-nramas@linux.microsoft.com>
On Tue, Feb 09, 2021 at 10:21:52AM -0800, Lakshmi Ramasubramanian wrote:
> From: Rob Herring <robh@kernel.org>
>
> Both arm64 and powerpc do essentially the same FDT /chosen setup for
> kexec. The differences are either omissions that arm64 should have
> or additional properties that will be ignored. The setup code can be
> combined and shared by both powerpc and arm64.
>
> The differences relative to the arm64 version:
> - If /chosen doesn't exist, it will be created (should never happen).
> - Any old dtb and initrd reserved memory will be released.
> - The new initrd and elfcorehdr are marked reserved.
> - "linux,booted-from-kexec" is set.
>
> The differences relative to the powerpc version:
> - "kaslr-seed" and "rng-seed" may be set.
> - "linux,elfcorehdr" is set.
> - Any existing "linux,usable-memory-range" is removed.
>
> Combine the code for setting up the /chosen node in the FDT and updating
> the memory reservation for kexec, for powerpc and arm64, in
> of_kexec_alloc_and_setup_fdt() and move it to "drivers/of/kexec.c".
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
> ---
> drivers/of/Makefile | 6 ++
> drivers/of/kexec.c | 258 ++++++++++++++++++++++++++++++++++++++++++++
> include/linux/of.h | 13 +++
> 3 files changed, 277 insertions(+)
> create mode 100644 drivers/of/kexec.c
>
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index 6e1e5212f058..c13b982084a3 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -14,4 +14,10 @@ obj-$(CONFIG_OF_RESOLVE) += resolver.o
> obj-$(CONFIG_OF_OVERLAY) += overlay.o
> obj-$(CONFIG_OF_NUMA) += of_numa.o
>
> +ifdef CONFIG_KEXEC_FILE
> +ifdef CONFIG_OF_FLATTREE
> +obj-y += kexec.o
> +endif
> +endif
> +
> obj-$(CONFIG_OF_UNITTEST) += unittest-data/
> diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
> new file mode 100644
> index 000000000000..469e09613cdd
> --- /dev/null
> +++ b/drivers/of/kexec.c
> @@ -0,0 +1,258 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (C) 2020 Arm Limited
> + *
> + * Based on arch/arm64/kernel/machine_kexec_file.c:
> + * Copyright (C) 2018 Linaro Limited
> + *
> + * And arch/powerpc/kexec/file_load.c:
> + * Copyright (C) 2016 IBM Corporation
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/kexec.h>
> +#include <linux/libfdt.h>
> +#include <linux/of.h>
> +#include <linux/of_fdt.h>
> +#include <linux/random.h>
> +#include <linux/types.h>
> +
> +/* relevant device tree properties */
> +#define FDT_PROP_KEXEC_ELFHDR "linux,elfcorehdr"
> +#define FDT_PROP_MEM_RANGE "linux,usable-memory-range"
> +#define FDT_PROP_INITRD_START "linux,initrd-start"
> +#define FDT_PROP_INITRD_END "linux,initrd-end"
> +#define FDT_PROP_BOOTARGS "bootargs"
> +#define FDT_PROP_KASLR_SEED "kaslr-seed"
> +#define FDT_PROP_RNG_SEED "rng-seed"
> +#define RNG_SEED_SIZE 128
> +
> +/**
> + * fdt_find_and_del_mem_rsv - delete memory reservation with given address and size
> + *
> + * @fdt: Flattened device tree for the current kernel.
> + * @start: Starting address of the reserved memory.
> + * @size: Size of the reserved memory.
> + *
> + * Return: 0 on success, or negative errno on error.
> + */
> +static int fdt_find_and_del_mem_rsv(void *fdt, unsigned long start, unsigned long size)
> +{
> + int i, ret, num_rsvs = fdt_num_mem_rsv(fdt);
> +
> + for (i = 0; i < num_rsvs; i++) {
> + u64 rsv_start, rsv_size;
> +
> + ret = fdt_get_mem_rsv(fdt, i, &rsv_start, &rsv_size);
> + if (ret) {
> + pr_err("Malformed device tree.\n");
> + return -EINVAL;
> + }
> +
> + if (rsv_start == start && rsv_size == size) {
> + ret = fdt_del_mem_rsv(fdt, i);
> + if (ret) {
> + pr_err("Error deleting device tree reservation.\n");
> + return -EINVAL;
> + }
> +
> + return 0;
> + }
> + }
> +
> + return -ENOENT;
> +}
> +
> +/*
> + * of_kexec_alloc_and_setup_fdt - Alloc and setup a new Flattened Device Tree
> + *
> + * @image: kexec image being loaded.
> + * @initrd_load_addr: Address where the next initrd will be loaded.
> + * @initrd_len: Size of the next initrd, or 0 if there will be none.
> + * @cmdline: Command line for the next kernel, or NULL if there will
> + * be none.
> + *
> + * Return: fdt on success, or NULL errno on error.
> + */
> +void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
> + unsigned long initrd_load_addr,
> + unsigned long initrd_len,
> + const char *cmdline)
> +{
> + void *fdt;
> + int ret, chosen_node;
> + const void *prop;
> + unsigned long fdt_size;
> +
> + fdt_size = fdt_totalsize(initial_boot_params) +
> + (cmdline ? strlen(cmdline) : 0) +
> + FDT_EXTRA_SPACE;
> +
> + fdt = kvmalloc(fdt_size, GFP_KERNEL);
> + if (!fdt)
> + return NULL;
> +
> + ret = fdt_open_into(initial_boot_params, fdt, fdt_size);
> + if (ret < 0) {
> + pr_err("Error %d setting up the new device tree.\n", ret);
> + goto out;
> + }
> +
> + /* Remove memory reservation for the current device tree. */
> + ret = fdt_find_and_del_mem_rsv(fdt, __pa(initial_boot_params),
> + fdt_totalsize(initial_boot_params));
> + if (ret == -EINVAL) {
> + pr_err("Error removing memory reservation.\n");
> + goto out;
> + }
> +
> + chosen_node = fdt_path_offset(fdt, "/chosen");
> + if (chosen_node == -FDT_ERR_NOTFOUND)
> + chosen_node = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
> + "chosen");
> + if (chosen_node < 0) {
> + ret = chosen_node;
> + goto out;
> + }
> +
> + ret = fdt_delprop(fdt, chosen_node, FDT_PROP_KEXEC_ELFHDR);
> + if (ret && ret != -FDT_ERR_NOTFOUND)
> + goto out;
> + ret = fdt_delprop(fdt, chosen_node, FDT_PROP_MEM_RANGE);
> + if (ret && ret != -FDT_ERR_NOTFOUND)
> + goto out;
> +
> + /* Did we boot using an initrd? */
> + prop = fdt_getprop(fdt, chosen_node, "linux,initrd-start", NULL);
> + if (prop) {
> + u64 tmp_start, tmp_end, tmp_size;
> +
> + tmp_start = fdt64_to_cpu(*((const fdt64_t *) prop));
> +
> + prop = fdt_getprop(fdt, chosen_node, "linux,initrd-end", NULL);
> + if (!prop) {
> + ret = -EINVAL;
> + goto out;
> + }
> +
> + tmp_end = fdt64_to_cpu(*((const fdt64_t *) prop));
> +
> + /*
> + * kexec reserves exact initrd size, while firmware may
> + * reserve a multiple of PAGE_SIZE, so check for both.
> + */
> + tmp_size = tmp_end - tmp_start;
> + ret = fdt_find_and_del_mem_rsv(fdt, tmp_start, tmp_size);
> + if (ret == -ENOENT)
> + ret = fdt_find_and_del_mem_rsv(fdt, tmp_start,
> + round_up(tmp_size, PAGE_SIZE));
> + if (ret == -EINVAL)
> + goto out;
> + }
> +
> + /* add initrd-* */
> + if (initrd_load_addr) {
> + ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_INITRD_START,
> + initrd_load_addr);
> + if (ret)
> + goto out;
> +
> + ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_INITRD_END,
> + initrd_load_addr + initrd_len);
> + if (ret)
> + goto out;
> +
> + ret = fdt_add_mem_rsv(fdt, initrd_load_addr, initrd_len);
> + if (ret)
> + goto out;
> +
> + } else {
> + ret = fdt_delprop(fdt, chosen_node, FDT_PROP_INITRD_START);
> + if (ret && (ret != -FDT_ERR_NOTFOUND))
> + goto out;
> +
> + ret = fdt_delprop(fdt, chosen_node, FDT_PROP_INITRD_END);
> + if (ret && (ret != -FDT_ERR_NOTFOUND))
> + goto out;
> + }
> +
> + if (image->type == KEXEC_TYPE_CRASH) {
> + /* add linux,elfcorehdr */
> + ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
> + FDT_PROP_KEXEC_ELFHDR,
> + image->arch.elf_headers_mem,
> + image->arch.elf_headers_sz);
> + if (ret)
> + goto out;
> +
> + /*
> + * Avoid elfcorehdr from being stomped on in kdump kernel by
> + * setting up memory reserve map.
> + */
> + ret = fdt_add_mem_rsv(fdt, image->arch.elf_headers_mem,
> + image->arch.elf_headers_sz);
> + if (ret)
> + goto out;
> +
> + /* add linux,usable-memory-range */
> + ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
> + FDT_PROP_MEM_RANGE,
> + crashk_res.start,
> + crashk_res.end - crashk_res.start + 1);
> + if (ret)
> + goto out;
> + }
> +
> + /* add bootargs */
> + if (cmdline) {
> + ret = fdt_setprop_string(fdt, chosen_node, FDT_PROP_BOOTARGS, cmdline);
> + if (ret)
> + goto out;
> + } else {
> + ret = fdt_delprop(fdt, chosen_node, FDT_PROP_BOOTARGS);
> + if (ret && (ret != -FDT_ERR_NOTFOUND))
> + goto out;
> + }
> +
> + /* add kaslr-seed */
> + ret = fdt_delprop(fdt, chosen_node, FDT_PROP_KASLR_SEED);
> + if (ret == -FDT_ERR_NOTFOUND)
> + ret = 0;
> + else if (ret)
> + goto out;
> +
> + if (rng_is_initialized()) {
> + u64 seed = get_random_u64();
> +
> + ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_KASLR_SEED, seed);
> + if (ret)
> + goto out;
> + } else {
> + pr_notice("RNG is not initialised: omitting \"%s\" property\n",
> + FDT_PROP_KASLR_SEED);
> + }
> +
> + /* add rng-seed */
> + if (rng_is_initialized()) {
> + void *rng_seed;
> +
> + ret = fdt_setprop_placeholder(fdt, chosen_node, FDT_PROP_RNG_SEED,
> + RNG_SEED_SIZE, &rng_seed);
> + if (ret)
> + goto out;
> + get_random_bytes(rng_seed, RNG_SEED_SIZE);
> + } else {
> + pr_notice("RNG is not initialised: omitting \"%s\" property\n",
> + FDT_PROP_RNG_SEED);
> + }
> +
> + ret = fdt_setprop(fdt, chosen_node, "linux,booted-from-kexec", NULL, 0);
> +
> +out:
> + if (ret) {
> + kvfree(fdt);
> + fdt = NULL;
> + }
> +
> + return fdt;
> +}
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 4b27c9a27df3..f0eff5e84353 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -560,6 +560,19 @@ int of_map_id(struct device_node *np, u32 id,
>
> phys_addr_t of_dma_get_max_cpu_address(struct device_node *np);
>
> +/*
> + * Additional space needed for the buffer to build the new FDT
> + * so that we can add initrd, bootargs, kaslr-seed, rng-seed,
> + * userable-memory-range and elfcorehdr.
> + */
> +#define FDT_EXTRA_SPACE 0x1000
No need for this to be public now. Move it to of/kexec.c.
Rob
^ permalink raw reply
* Re: [PATCH v17 03/10] arm64: Use common of_kexec_alloc_and_setup_fdt()
From: Will Deacon @ 2021-02-10 17:26 UTC (permalink / raw)
To: Lakshmi Ramasubramanian
Cc: mark.rutland, tao.li, zohar, paulus, vincenzo.frascino,
frowand.list, sashal, robh, masahiroy, jmorris, takahiro.akashi,
linux-arm-kernel, catalin.marinas, serge, devicetree,
pasha.tatashin, prsriva, hsinyi, allison, christophe.leroy,
mbrugger, balajib, dmitry.kasatkin, linux-kernel, james.morse,
gregkh, joe, linux-integrity, linuxppc-dev, bauerman
In-Reply-To: <20210209182200.30606-4-nramas@linux.microsoft.com>
On Tue, Feb 09, 2021 at 10:21:53AM -0800, Lakshmi Ramasubramanian wrote:
> From: Rob Herring <robh@kernel.org>
>
> The code for setting up the /chosen node in the device tree
> and updating the memory reservation for the next kernel has been
> moved to of_kexec_alloc_and_setup_fdt() defined in "drivers/of/kexec.c".
>
> Use the common of_kexec_alloc_and_setup_fdt() to setup the device tree
> and update the memory reservation for kexec for arm64.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
> ---
> arch/arm64/kernel/machine_kexec_file.c | 180 ++-----------------------
> 1 file changed, 8 insertions(+), 172 deletions(-)
I mean, of course I'm going to Ack that!
Acked-by: Will Deacon <will@kernel.org>
Will
^ permalink raw reply
* [PATCH v6 05/10] powerpc: dts: akebono: Harmonize EHCI/OHCI DT nodes name
From: Serge Semin @ 2021-02-10 17:28 UTC (permalink / raw)
To: Felipe Balbi, Bjorn Andersson, Krzysztof Kozlowski,
Florian Fainelli, Rob Herring, Greg Kroah-Hartman,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
Cc: devicetree, linux-usb, linuxppc-dev, linux-kernel
In-Reply-To: <20210210172850.20849-1-Sergey.Semin@baikalelectronics.ru>
In accordance with the Generic EHCI/OHCI bindings the corresponding node
name is suppose to comply with the Generic USB HCD DT schema, which
requires the USB nodes to have the name acceptable by the regexp:
"^usb(@.*)?" . Make sure the "generic-ehci" and "generic-ohci"-compatible
nodes are correctly named.
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
---
arch/powerpc/boot/dts/akebono.dts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/boot/dts/akebono.dts b/arch/powerpc/boot/dts/akebono.dts
index df18f8dc4642..343326c30380 100644
--- a/arch/powerpc/boot/dts/akebono.dts
+++ b/arch/powerpc/boot/dts/akebono.dts
@@ -126,7 +126,7 @@ SATA0: sata@30000010000 {
interrupts = <93 2>;
};
- EHCI0: ehci@30010000000 {
+ EHCI0: usb@30010000000 {
compatible = "ibm,476gtr-ehci", "generic-ehci";
reg = <0x300 0x10000000 0x0 0x10000>;
interrupt-parent = <&MPIC>;
@@ -140,14 +140,14 @@ SD0: sd@30000000000 {
interrupt-parent = <&MPIC>;
};
- OHCI0: ohci@30010010000 {
+ OHCI0: usb@30010010000 {
compatible = "ibm,476gtr-ohci", "generic-ohci";
reg = <0x300 0x10010000 0x0 0x10000>;
interrupt-parent = <&MPIC>;
interrupts = <89 1>;
};
- OHCI1: ohci@30010020000 {
+ OHCI1: usb@30010020000 {
compatible = "ibm,476gtr-ohci", "generic-ohci";
reg = <0x300 0x10020000 0x0 0x10000>;
interrupt-parent = <&MPIC>;
--
2.30.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox