forked from Minki/linux
powerpc fixes for 5.19 #3
- A fix for a CMA change that broke booting guests with > 2G RAM on Power8 hosts. - Fix the RTAS call filter to allow a special case that applications rely on. - A change to our execve path, to make the execve syscall exit tracepoint work. - Three fixes to wire up our various RNGs earlier in boot so they're available for use in the initial seeding in random_init(). - A build fix for when KASAN is enabled along with STRUCTLEAK_BYREF_ALL. Thanks to: Andrew Donnellan, Aneesh Kumar K.V, Christophe Leroy, Jason A. Donenfeld, Nathan Lynch, Naveen N. Rao, Sathvika Vasireddy, Sumit Dubey2, Tyrel Datwyler, Zi Yan. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmK3qZITHG1wZUBlbGxl cm1hbi5pZC5hdQAKCRBR6+o8yOGlgBK8D/40Jyn/AJdTXstysP3cNMiQh/Ttjq/d UlYBIdNu5C/BwSZKXl0q0UtrvvTAZsLKfvNIl/xdGHDoCKYF7ckG4aURc+Uhh4Dw +/uPYi7Ompfwt5xIjOwOpocYX3dGbhoECB4J0H8kW9cLFpxAsw17sCH9mPcRXFMp BEYdnbCmDpdBLvX/fI6YI4sHenqhyxCPwU/m0rbRD4DZI7qaS70wc8hwt4KNeo72 1xt+q6491sh1xmyA6UzE2Sz8ZeLgdppwrfg6uPbRtPwVNV4zUFfPVxXbYZE2k1VZ tJm/54w5R+2qeuQAstcRxjegPSostG55/WonDIV4IpAHk4f29DnRgUJZaSR1WvP0 ebScLjk7/rXTbqB5MpSITII6F39JKzpIMny6nZw8qZBpeRx4s1RZYLu8nTIspd1t qr1l0RxGAudJbU8xZMH8b8VYoQGyXfPx/RZ7Qi9ZR8FqQtB9fTPTdxsEv88cSmIV uVif+H5zDe29mvhmCP/KhclmFl9JxwT2SFxgrUPwwhBk3JEIFaSMFLjYp1WpQ+z6 Dehv0k9DIuR9MsiZX/+vLszQkEsGvTs4zMHEHCOY67dA2WJaEES14Ya9nWzowuGM /9N0zJ+BiZr6KoZ96W9m+WN29LlwNC/RYuqXtfpdtbxW0vjhZc9A82Ltydxb9EkJ mOzaSMbx3OO/0g== =n88O -----END PGP SIGNATURE----- Merge tag 'powerpc-5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux Pull powerpc fixes from Michael Ellerman: - A fix for a CMA change that broke booting guests with > 2G RAM on Power8 hosts. - Fix the RTAS call filter to allow a special case that applications rely on. - A change to our execve path, to make the execve syscall exit tracepoint work. - Three fixes to wire up our various RNGs earlier in boot so they're available for use in the initial seeding in random_init(). - A build fix for when KASAN is enabled along with STRUCTLEAK_BYREF_ALL. Thanks to Andrew Donnellan, Aneesh Kumar K.V, Christophe Leroy, Jason Donenfeld, Nathan Lynch, Naveen N. Rao, Sathvika Vasireddy, Sumit Dubey2, Tyrel Datwyler, and Zi Yan. * tag 'powerpc-5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/powernv: wire up rng during setup_arch powerpc/prom_init: Fix build failure with GCC_PLUGIN_STRUCTLEAK_BYREF_ALL and KASAN powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address powerpc: Enable execve syscall exit tracepoint powerpc/pseries: wire up rng during setup_arch() powerpc/microwatt: wire up rng during setup_arch() powerpc/mm: Move CMA reservations after initmem_init()
This commit is contained in:
commit
8100775d59
@ -1855,7 +1855,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
|
||||
tm_reclaim_current(0);
|
||||
#endif
|
||||
|
||||
memset(regs->gpr, 0, sizeof(regs->gpr));
|
||||
memset(®s->gpr[1], 0, sizeof(regs->gpr) - sizeof(regs->gpr[0]));
|
||||
regs->ctr = 0;
|
||||
regs->link = 0;
|
||||
regs->xer = 0;
|
||||
|
@ -2302,7 +2302,7 @@ static void __init prom_init_stdout(void)
|
||||
|
||||
static int __init prom_find_machine_type(void)
|
||||
{
|
||||
char compat[256];
|
||||
static char compat[256] __prombss;
|
||||
int len, i = 0;
|
||||
#ifdef CONFIG_PPC64
|
||||
phandle rtas;
|
||||
|
@ -1071,7 +1071,7 @@ static struct rtas_filter rtas_filters[] __ro_after_init = {
|
||||
{ "get-time-of-day", -1, -1, -1, -1, -1 },
|
||||
{ "ibm,get-vpd", -1, 0, -1, 1, 2 },
|
||||
{ "ibm,lpar-perftools", -1, 2, 3, -1, -1 },
|
||||
{ "ibm,platform-dump", -1, 4, 5, -1, -1 },
|
||||
{ "ibm,platform-dump", -1, 4, 5, -1, -1 }, /* Special cased */
|
||||
{ "ibm,read-slot-reset-state", -1, -1, -1, -1, -1 },
|
||||
{ "ibm,scan-log-dump", -1, 0, 1, -1, -1 },
|
||||
{ "ibm,set-dynamic-indicator", -1, 2, -1, -1, -1 },
|
||||
@ -1120,6 +1120,15 @@ static bool block_rtas_call(int token, int nargs,
|
||||
size = 1;
|
||||
|
||||
end = base + size - 1;
|
||||
|
||||
/*
|
||||
* Special case for ibm,platform-dump - NULL buffer
|
||||
* address is used to indicate end of dump processing
|
||||
*/
|
||||
if (!strcmp(f->name, "ibm,platform-dump") &&
|
||||
base == 0)
|
||||
return false;
|
||||
|
||||
if (!in_rmo_buf(base, end))
|
||||
goto err;
|
||||
}
|
||||
|
@ -935,12 +935,6 @@ void __init setup_arch(char **cmdline_p)
|
||||
/* Print various info about the machine that has been gathered so far. */
|
||||
print_system_info();
|
||||
|
||||
/* Reserve large chunks of memory for use by CMA for KVM. */
|
||||
kvm_cma_reserve();
|
||||
|
||||
/* Reserve large chunks of memory for us by CMA for hugetlb */
|
||||
gigantic_hugetlb_cma_reserve();
|
||||
|
||||
klp_init_thread_info(&init_task);
|
||||
|
||||
setup_initial_init_mm(_stext, _etext, _edata, _end);
|
||||
@ -955,6 +949,13 @@ void __init setup_arch(char **cmdline_p)
|
||||
|
||||
initmem_init();
|
||||
|
||||
/*
|
||||
* Reserve large chunks of memory for use by CMA for KVM and hugetlb. These must
|
||||
* be called after initmem_init(), so that pageblock_order is initialised.
|
||||
*/
|
||||
kvm_cma_reserve();
|
||||
gigantic_hugetlb_cma_reserve();
|
||||
|
||||
early_memtest(min_low_pfn << PAGE_SHIFT, max_low_pfn << PAGE_SHIFT);
|
||||
|
||||
if (ppc_md.setup_arch)
|
||||
|
7
arch/powerpc/platforms/microwatt/microwatt.h
Normal file
7
arch/powerpc/platforms/microwatt/microwatt.h
Normal file
@ -0,0 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _MICROWATT_H
|
||||
#define _MICROWATT_H
|
||||
|
||||
void microwatt_rng_init(void);
|
||||
|
||||
#endif /* _MICROWATT_H */
|
@ -11,6 +11,7 @@
|
||||
#include <asm/archrandom.h>
|
||||
#include <asm/cputable.h>
|
||||
#include <asm/machdep.h>
|
||||
#include "microwatt.h"
|
||||
|
||||
#define DARN_ERR 0xFFFFFFFFFFFFFFFFul
|
||||
|
||||
@ -29,7 +30,7 @@ static int microwatt_get_random_darn(unsigned long *v)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static __init int rng_init(void)
|
||||
void __init microwatt_rng_init(void)
|
||||
{
|
||||
unsigned long val;
|
||||
int i;
|
||||
@ -37,12 +38,7 @@ static __init int rng_init(void)
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (microwatt_get_random_darn(&val)) {
|
||||
ppc_md.get_random_seed = microwatt_get_random_darn;
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pr_warn("Unable to use DARN for get_random_seed()\n");
|
||||
|
||||
return -EIO;
|
||||
}
|
||||
machine_subsys_initcall(, rng_init);
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include <asm/xics.h>
|
||||
#include <asm/udbg.h>
|
||||
|
||||
#include "microwatt.h"
|
||||
|
||||
static void __init microwatt_init_IRQ(void)
|
||||
{
|
||||
xics_init();
|
||||
@ -32,10 +34,16 @@ static int __init microwatt_populate(void)
|
||||
}
|
||||
machine_arch_initcall(microwatt, microwatt_populate);
|
||||
|
||||
static void __init microwatt_setup_arch(void)
|
||||
{
|
||||
microwatt_rng_init();
|
||||
}
|
||||
|
||||
define_machine(microwatt) {
|
||||
.name = "microwatt",
|
||||
.probe = microwatt_probe,
|
||||
.init_IRQ = microwatt_init_IRQ,
|
||||
.setup_arch = microwatt_setup_arch,
|
||||
.progress = udbg_progress,
|
||||
.calibrate_decr = generic_calibrate_decr,
|
||||
};
|
||||
|
@ -42,4 +42,6 @@ ssize_t memcons_copy(struct memcons *mc, char *to, loff_t pos, size_t count);
|
||||
u32 __init memcons_get_size(struct memcons *mc);
|
||||
struct memcons *__init memcons_init(struct device_node *node, const char *mc_prop_name);
|
||||
|
||||
void pnv_rng_init(void);
|
||||
|
||||
#endif /* _POWERNV_H */
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <asm/prom.h>
|
||||
#include <asm/machdep.h>
|
||||
#include <asm/smp.h>
|
||||
#include "powernv.h"
|
||||
|
||||
#define DARN_ERR 0xFFFFFFFFFFFFFFFFul
|
||||
|
||||
@ -28,7 +29,6 @@ struct powernv_rng {
|
||||
|
||||
static DEFINE_PER_CPU(struct powernv_rng *, powernv_rng);
|
||||
|
||||
|
||||
int powernv_hwrng_present(void)
|
||||
{
|
||||
struct powernv_rng *rng;
|
||||
@ -98,9 +98,6 @@ static int __init initialise_darn(void)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
pr_warn("Unable to use DARN for get_random_seed()\n");
|
||||
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@ -163,32 +160,55 @@ static __init int rng_create(struct device_node *dn)
|
||||
|
||||
rng_init_per_cpu(rng, dn);
|
||||
|
||||
pr_info_once("Registering arch random hook.\n");
|
||||
|
||||
ppc_md.get_random_seed = powernv_get_random_long;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __init int rng_init(void)
|
||||
static int __init pnv_get_random_long_early(unsigned long *v)
|
||||
{
|
||||
struct device_node *dn;
|
||||
int rc;
|
||||
|
||||
if (!slab_is_available())
|
||||
return 0;
|
||||
|
||||
if (cmpxchg(&ppc_md.get_random_seed, pnv_get_random_long_early,
|
||||
NULL) != pnv_get_random_long_early)
|
||||
return 0;
|
||||
|
||||
for_each_compatible_node(dn, NULL, "ibm,power-rng") {
|
||||
rc = rng_create(dn);
|
||||
if (rc) {
|
||||
pr_err("Failed creating rng for %pOF (%d).\n",
|
||||
dn, rc);
|
||||
if (rng_create(dn))
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Create devices for hwrng driver */
|
||||
of_platform_device_create(dn, NULL, NULL);
|
||||
}
|
||||
|
||||
initialise_darn();
|
||||
if (!ppc_md.get_random_seed)
|
||||
return 0;
|
||||
return ppc_md.get_random_seed(v);
|
||||
}
|
||||
|
||||
void __init pnv_rng_init(void)
|
||||
{
|
||||
struct device_node *dn;
|
||||
|
||||
/* Prefer darn over the rest. */
|
||||
if (!initialise_darn())
|
||||
return;
|
||||
|
||||
dn = of_find_compatible_node(NULL, NULL, "ibm,power-rng");
|
||||
if (dn)
|
||||
ppc_md.get_random_seed = pnv_get_random_long_early;
|
||||
|
||||
of_node_put(dn);
|
||||
}
|
||||
|
||||
static int __init pnv_rng_late_init(void)
|
||||
{
|
||||
unsigned long v;
|
||||
/* In case it wasn't called during init for some other reason. */
|
||||
if (ppc_md.get_random_seed == pnv_get_random_long_early)
|
||||
pnv_get_random_long_early(&v);
|
||||
return 0;
|
||||
}
|
||||
machine_subsys_initcall(powernv, rng_init);
|
||||
machine_subsys_initcall(powernv, pnv_rng_late_init);
|
||||
|
@ -203,6 +203,8 @@ static void __init pnv_setup_arch(void)
|
||||
pnv_check_guarded_cores();
|
||||
|
||||
/* XXX PMCS */
|
||||
|
||||
pnv_rng_init();
|
||||
}
|
||||
|
||||
static void __init pnv_init(void)
|
||||
|
@ -122,4 +122,6 @@ void pseries_lpar_read_hblkrm_characteristics(void);
|
||||
static inline void pseries_lpar_read_hblkrm_characteristics(void) { }
|
||||
#endif
|
||||
|
||||
void pseries_rng_init(void);
|
||||
|
||||
#endif /* _PSERIES_PSERIES_H */
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <asm/archrandom.h>
|
||||
#include <asm/machdep.h>
|
||||
#include <asm/plpar_wrappers.h>
|
||||
#include "pseries.h"
|
||||
|
||||
|
||||
static int pseries_get_random_long(unsigned long *v)
|
||||
@ -24,19 +25,13 @@ static int pseries_get_random_long(unsigned long *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __init int rng_init(void)
|
||||
void __init pseries_rng_init(void)
|
||||
{
|
||||
struct device_node *dn;
|
||||
|
||||
dn = of_find_compatible_node(NULL, NULL, "ibm,random");
|
||||
if (!dn)
|
||||
return -ENODEV;
|
||||
|
||||
pr_info("Registering arch random hook.\n");
|
||||
|
||||
return;
|
||||
ppc_md.get_random_seed = pseries_get_random_long;
|
||||
|
||||
of_node_put(dn);
|
||||
return 0;
|
||||
}
|
||||
machine_subsys_initcall(pseries, rng_init);
|
||||
|
@ -839,6 +839,7 @@ static void __init pSeries_setup_arch(void)
|
||||
}
|
||||
|
||||
ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
|
||||
pseries_rng_init();
|
||||
}
|
||||
|
||||
static void pseries_panic(char *str)
|
||||
|
Loading…
Reference in New Issue
Block a user