powerpc/powernv: rename remaining rng powernv_ functions to pnv_

The preferred nomenclature is pnv_, not powernv_, but rng.c used
powernv_ for some reason, which isn't consistent with the rest. A recent
commit added a few pnv_ functions to rng.c, making the file a bit of a
mishmash. This commit just replaces the rest of them.

Fixes: f3eac42665 ("powerpc/powernv: wire up rng during setup_arch")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tested-by: Sachin Sant <sachinp@linux.ibm.com>
[mpe: Reorder after bug fix commits]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220727143219.2684192-3-mpe@ellerman.id.au
This commit is contained in:
Jason A. Donenfeld 2022-07-28 00:32:19 +10:00 committed by Michael Ellerman
parent 7ef3d06f1b
commit 978030f054
3 changed files with 19 additions and 19 deletions

View File

@ -38,7 +38,7 @@ static inline bool __must_check arch_get_random_seed_int(unsigned int *v)
#endif /* CONFIG_ARCH_RANDOM */
#ifdef CONFIG_PPC_POWERNV
int powernv_get_random_long(unsigned long *v);
int pnv_get_random_long(unsigned long *v);
#endif
#endif /* _ASM_POWERPC_ARCHRANDOM_H */

View File

@ -21,15 +21,15 @@
#define DARN_ERR 0xFFFFFFFFFFFFFFFFul
struct powernv_rng {
struct pnv_rng {
void __iomem *regs;
void __iomem *regs_real;
unsigned long mask;
};
static DEFINE_PER_CPU(struct powernv_rng *, powernv_rng);
static DEFINE_PER_CPU(struct pnv_rng *, pnv_rng);
static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val)
static unsigned long rng_whiten(struct pnv_rng *rng, unsigned long val)
{
unsigned long parity;
@ -49,7 +49,7 @@ static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val)
return val;
}
static int powernv_get_random_darn(unsigned long *v)
static int pnv_get_random_darn(unsigned long *v)
{
unsigned long val;
@ -73,31 +73,31 @@ static int __init initialise_darn(void)
return -ENODEV;
for (i = 0; i < 10; i++) {
if (powernv_get_random_darn(&val)) {
ppc_md.get_random_seed = powernv_get_random_darn;
if (pnv_get_random_darn(&val)) {
ppc_md.get_random_seed = pnv_get_random_darn;
return 0;
}
}
return -EIO;
}
int powernv_get_random_long(unsigned long *v)
int pnv_get_random_long(unsigned long *v)
{
struct powernv_rng *rng;
struct pnv_rng *rng;
if (mfmsr() & MSR_DR) {
rng = get_cpu_var(powernv_rng);
rng = get_cpu_var(pnv_rng);
*v = rng_whiten(rng, in_be64(rng->regs));
put_cpu_var(rng);
} else {
rng = raw_cpu_read(powernv_rng);
rng = raw_cpu_read(pnv_rng);
*v = rng_whiten(rng, __raw_rm_readq(rng->regs_real));
}
return 1;
}
EXPORT_SYMBOL_GPL(powernv_get_random_long);
EXPORT_SYMBOL_GPL(pnv_get_random_long);
static __init void rng_init_per_cpu(struct powernv_rng *rng,
static __init void rng_init_per_cpu(struct pnv_rng *rng,
struct device_node *dn)
{
int chip_id, cpu;
@ -107,16 +107,16 @@ static __init void rng_init_per_cpu(struct powernv_rng *rng,
pr_warn("No ibm,chip-id found for %pOF.\n", dn);
for_each_possible_cpu(cpu) {
if (per_cpu(powernv_rng, cpu) == NULL ||
if (per_cpu(pnv_rng, cpu) == NULL ||
cpu_to_chip_id(cpu) == chip_id) {
per_cpu(powernv_rng, cpu) = rng;
per_cpu(pnv_rng, cpu) = rng;
}
}
}
static __init int rng_create(struct device_node *dn)
{
struct powernv_rng *rng;
struct pnv_rng *rng;
struct resource res;
unsigned long val;
@ -142,7 +142,7 @@ static __init int rng_create(struct device_node *dn)
rng_init_per_cpu(rng, dn);
ppc_md.get_random_seed = powernv_get_random_long;
ppc_md.get_random_seed = pnv_get_random_long;
return 0;
}
@ -190,7 +190,7 @@ static int __init pnv_rng_late_init(void)
if (ppc_md.get_random_seed == pnv_get_random_long_early)
pnv_get_random_long_early(&v);
if (ppc_md.get_random_seed == powernv_get_random_long) {
if (ppc_md.get_random_seed == pnv_get_random_long) {
for_each_compatible_node(dn, NULL, "ibm,power-rng")
of_platform_device_create(dn, NULL, NULL);
}

View File

@ -23,7 +23,7 @@ static int powernv_rng_read(struct hwrng *rng, void *data, size_t max, bool wait
buf = (unsigned long *)data;
for (i = 0; i < len; i++)
powernv_get_random_long(buf++);
pnv_get_random_long(buf++);
return len * sizeof(unsigned long);
}