Skip to content

Commit

Permalink
Automatic merge of 'next-test' into merge-test (2024-04-22 12:20)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpe committed Apr 22, 2024
2 parents be47b0d + 5a799af commit 6657736
Show file tree
Hide file tree
Showing 17 changed files with 81 additions and 59 deletions.
3 changes: 2 additions & 1 deletion arch/powerpc/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror -Wa,--fatal-warnings
subdir-asflags-$(CONFIG_PPC_WERROR) := -Wa,--fatal-warnings

obj-y += kernel/
obj-y += mm/
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/cpu_has_feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static __always_inline bool cpu_has_feature(unsigned long feature)
#endif

#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
if (!static_key_initialized) {
if (!static_key_feature_checks_initialized) {
printk("Warning! cpu_has_feature() used prior to jump label init!\n");
dump_stack();
return early_cpu_has_feature(feature);
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/include/asm/feature-fixups.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ extern long __start___rfi_flush_fixup, __stop___rfi_flush_fixup;
extern long __start___barrier_nospec_fixup, __stop___barrier_nospec_fixup;
extern long __start__btb_flush_fixup, __stop__btb_flush_fixup;

extern bool static_key_feature_checks_initialized;

void apply_feature_fixups(void);
void update_mmu_feature_fixups(unsigned long mask);
void setup_feature_keys(void);
Expand Down
10 changes: 10 additions & 0 deletions arch/powerpc/include/asm/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,14 @@ static inline void interrupt_nmi_enter_prepare(struct pt_regs *regs, struct inte
if (IS_ENABLED(CONFIG_KASAN))
return;

/*
* Likewise, do not use it in real mode if percpu first chunk is not
* embedded. With CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK enabled there
* are chances where percpu allocation can come from vmalloc area.
*/
if (percpu_first_chunk_is_paged)
return;

/* Otherwise, it should be safe to call it */
nmi_enter();
}
Expand All @@ -351,6 +359,8 @@ static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct inter
// no nmi_exit for a pseries hash guest taking a real mode exception
} else if (IS_ENABLED(CONFIG_KASAN)) {
// no nmi_exit for KASAN in real mode
} else if (percpu_first_chunk_is_paged) {
// no nmi_exit if percpu first chunk is not embedded
} else {
nmi_exit();
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static __always_inline bool mmu_has_feature(unsigned long feature)
#endif

#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
if (!static_key_initialized) {
if (!static_key_feature_checks_initialized) {
printk("Warning! mmu_has_feature() used prior to jump label init!\n");
dump_stack();
return early_mmu_has_feature(feature);
Expand Down
10 changes: 10 additions & 0 deletions arch/powerpc/include/asm/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
#endif /* CONFIG_SMP */
#endif /* __powerpc64__ */

#if defined(CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK) && defined(CONFIG_SMP)
#include <linux/jump_label.h>
DECLARE_STATIC_KEY_FALSE(__percpu_first_chunk_is_paged);

#define percpu_first_chunk_is_paged \
(static_key_enabled(&__percpu_first_chunk_is_paged.key))
#else
#define percpu_first_chunk_is_paged false
#endif /* CONFIG_PPC64 && CONFIG_SMP */

#include <asm-generic/percpu.h>

#include <asm/paca.h>
Expand Down
16 changes: 0 additions & 16 deletions arch/powerpc/kernel/fadump.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,22 +573,6 @@ int __init fadump_reserve_mem(void)
}
}

/*
* Calculate the memory boundary.
* If memory_limit is less than actual memory boundary then reserve
* the memory for fadump beyond the memory_limit and adjust the
* memory_limit accordingly, so that the running kernel can run with
* specified memory_limit.
*/
if (memory_limit && memory_limit < memblock_end_of_DRAM()) {
size = get_fadump_area_size();
if ((memory_limit + size) < memblock_end_of_DRAM())
memory_limit += size;
else
memory_limit = memblock_end_of_DRAM();
printk(KERN_INFO "Adjusted memory_limit for firmware-assisted"
" dump, now %#016llx\n", memory_limit);
}
if (memory_limit)
mem_boundary = memory_limit;
else
Expand Down
10 changes: 6 additions & 4 deletions arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,6 @@ static inline void save_fscr_to_task(void) {}

void __init early_init_devtree(void *params)
{
phys_addr_t limit;

DBG(" -> early_init_devtree(%px)\n", params);

Expand Down Expand Up @@ -846,9 +845,12 @@ void __init early_init_devtree(void *params)
reserve_crashkernel();
early_reserve_mem();

/* Ensure that total memory size is page-aligned. */
limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE);
memblock_enforce_memory_limit(limit);
if (memory_limit > memblock_phys_mem_size())
memory_limit = 0;

/* Align down to 16 MB which is large page size with hash page translation */
memory_limit = ALIGN_DOWN(memory_limit ?: memblock_phys_mem_size(), SZ_16M);
memblock_enforce_memory_limit(memory_limit);

#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_4K_PAGES)
if (!early_radix_enabled())
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/prom_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,8 @@ static void __init early_cmdline_parse(void)
opt += 4;
prom_memory_limit = prom_memparse(opt, (const char **)&opt);
#ifdef CONFIG_PPC64
/* Align to 16 MB == size of ppc64 large page */
prom_memory_limit = ALIGN(prom_memory_limit, 0x1000000);
/* Align down to 16 MB which is large page size with hash page translation */
prom_memory_limit = ALIGN_DOWN(prom_memory_limit, SZ_16M);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/setup-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ static void __init cpu_init_thread_core_maps(int tpc)
cpumask_set_cpu(i, &threads_core_mask);

printk(KERN_INFO "CPU maps initialized for %d thread%s per core\n",
tpc, tpc > 1 ? "s" : "");
tpc, str_plural(tpc));
printk(KERN_DEBUG " (thread shift is %d)\n", threads_shift);
}

Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/kernel/setup_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ static __init int pcpu_cpu_to_node(int cpu)

unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
EXPORT_SYMBOL(__per_cpu_offset);
DEFINE_STATIC_KEY_FALSE(__percpu_first_chunk_is_paged);

void __init setup_per_cpu_areas(void)
{
Expand Down Expand Up @@ -876,6 +877,7 @@ void __init setup_per_cpu_areas(void)
if (rc < 0)
panic("cannot initialize percpu area (err=%d)", rc);

static_key_enable(&__percpu_first_chunk_is_paged.key);
delta = (unsigned long)pcpu_base_addr - (unsigned long)__per_cpu_start;
for_each_possible_cpu(cpu) {
__per_cpu_offset[cpu] = delta + pcpu_unit_offsets[cpu];
Expand Down
8 changes: 8 additions & 0 deletions arch/powerpc/lib/feature-fixups.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
#include <asm/firmware.h>
#include <asm/inst.h>

/*
* Used to generate warnings if mmu or cpu feature check functions that
* use static keys before they are initialized.
*/
bool static_key_feature_checks_initialized __read_mostly;
EXPORT_SYMBOL_GPL(static_key_feature_checks_initialized);

struct fixup_entry {
unsigned long mask;
unsigned long value;
Expand Down Expand Up @@ -679,6 +686,7 @@ void __init setup_feature_keys(void)
jump_label_init();
cpu_feature_keys_init();
mmu_feature_keys_init();
static_key_feature_checks_initialized = true;
}

static int __init check_features(void)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/mm/ptdump/hashpagetable.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ static void walk_vmemmap(struct pg_state *st)
* Traverse the vmemmaped memory and dump pages that are in the hash
* pagetable.
*/
while (ptr->list) {
while (ptr) {
hpte_find(st, ptr->virt_addr, mmu_vmemmap_psize);
ptr = ptr->list;
}
Expand Down
2 changes: 0 additions & 2 deletions arch/powerpc/platforms/52xx/mpc52xx_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@

#undef DEBUG

#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/export.h>
#include <asm/io.h>
#include <asm/mpc52xx.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/52xx/mpc52xx_gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
* the output mode. This driver does not change the output mode setting.
*/

#include <linux/gpio/driver.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/io.h>
Expand All @@ -56,7 +57,6 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/kernel.h>
#include <linux/property.h>
Expand Down
61 changes: 32 additions & 29 deletions arch/powerpc/platforms/ps3/device-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,49 +770,51 @@ static struct task_struct *probe_task;

static int ps3_probe_thread(void *data)
{
struct ps3_notification_device dev;
struct {
struct ps3_notification_device dev;
u8 buf[512];
} *local;
struct ps3_notify_cmd *notify_cmd;
struct ps3_notify_event *notify_event;
int res;
unsigned int irq;
u64 lpar;
void *buf;
struct ps3_notify_cmd *notify_cmd;
struct ps3_notify_event *notify_event;

pr_debug(" -> %s:%u: kthread started\n", __func__, __LINE__);

buf = kzalloc(512, GFP_KERNEL);
if (!buf)
local = kzalloc(sizeof(*local), GFP_KERNEL);
if (!local)
return -ENOMEM;

lpar = ps3_mm_phys_to_lpar(__pa(buf));
notify_cmd = buf;
notify_event = buf;
lpar = ps3_mm_phys_to_lpar(__pa(&local->buf));
notify_cmd = (struct ps3_notify_cmd *)&local->buf;
notify_event = (struct ps3_notify_event *)&local->buf;

/* dummy system bus device */
dev.sbd.bus_id = (u64)data;
dev.sbd.dev_id = PS3_NOTIFICATION_DEV_ID;
dev.sbd.interrupt_id = PS3_NOTIFICATION_INTERRUPT_ID;
local->dev.sbd.bus_id = (u64)data;
local->dev.sbd.dev_id = PS3_NOTIFICATION_DEV_ID;
local->dev.sbd.interrupt_id = PS3_NOTIFICATION_INTERRUPT_ID;

res = lv1_open_device(dev.sbd.bus_id, dev.sbd.dev_id, 0);
res = lv1_open_device(local->dev.sbd.bus_id, local->dev.sbd.dev_id, 0);
if (res) {
pr_err("%s:%u: lv1_open_device failed %s\n", __func__,
__LINE__, ps3_result(res));
goto fail_free;
}

res = ps3_sb_event_receive_port_setup(&dev.sbd, PS3_BINDING_CPU_ANY,
&irq);
res = ps3_sb_event_receive_port_setup(&local->dev.sbd,
PS3_BINDING_CPU_ANY, &irq);
if (res) {
pr_err("%s:%u: ps3_sb_event_receive_port_setup failed %d\n",
__func__, __LINE__, res);
goto fail_close_device;
}

spin_lock_init(&dev.lock);
rcuwait_init(&dev.wait);
spin_lock_init(&local->dev.lock);
rcuwait_init(&local->dev.wait);

res = request_irq(irq, ps3_notification_interrupt, 0,
"ps3_notification", &dev);
"ps3_notification", &local->dev);
if (res) {
pr_err("%s:%u: request_irq failed %d\n", __func__, __LINE__,
res);
Expand All @@ -823,7 +825,7 @@ static int ps3_probe_thread(void *data)
notify_cmd->operation_code = 0; /* must be zero */
notify_cmd->event_mask = 1UL << notify_region_probe;

res = ps3_notification_read_write(&dev, lpar, 1);
res = ps3_notification_read_write(&local->dev, lpar, 1);
if (res)
goto fail_free_irq;

Expand All @@ -834,36 +836,37 @@ static int ps3_probe_thread(void *data)

memset(notify_event, 0, sizeof(*notify_event));

res = ps3_notification_read_write(&dev, lpar, 0);
res = ps3_notification_read_write(&local->dev, lpar, 0);
if (res)
break;

pr_debug("%s:%u: notify event type 0x%llx bus id %llu dev id %llu"
" type %llu port %llu\n", __func__, __LINE__,
notify_event->event_type, notify_event->bus_id,
notify_event->dev_id, notify_event->dev_type,
notify_event->dev_port);
notify_event->event_type, notify_event->bus_id,
notify_event->dev_id, notify_event->dev_type,
notify_event->dev_port);

if (notify_event->event_type != notify_region_probe ||
notify_event->bus_id != dev.sbd.bus_id) {
notify_event->bus_id != local->dev.sbd.bus_id) {
pr_warn("%s:%u: bad notify_event: event %llu, dev_id %llu, dev_type %llu\n",
__func__, __LINE__, notify_event->event_type,
notify_event->dev_id, notify_event->dev_type);
continue;
}

ps3_find_and_add_device(dev.sbd.bus_id, notify_event->dev_id);
ps3_find_and_add_device(local->dev.sbd.bus_id,
notify_event->dev_id);

} while (!kthread_should_stop());

fail_free_irq:
free_irq(irq, &dev);
free_irq(irq, &local->dev);
fail_sb_event_receive_port_destroy:
ps3_sb_event_receive_port_destroy(&dev.sbd, irq);
ps3_sb_event_receive_port_destroy(&local->dev.sbd, irq);
fail_close_device:
lv1_close_device(dev.sbd.bus_id, dev.sbd.dev_id);
lv1_close_device(local->dev.sbd.bus_id, local->dev.sbd.dev_id);
fail_free:
kfree(buf);
kfree(local);

probe_task = NULL;

Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/sysdev/fsl_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,12 @@ static const struct fsl_msi_feature ipic_msi_feature = {
.msiir_offset = 0x38,
};

#ifdef CONFIG_EPAPR_PARAVIRT
static const struct fsl_msi_feature vmpic_msi_feature = {
.fsl_pic_ip = FSL_PIC_IP_VMPIC,
.msiir_offset = 0,
};
#endif

static const struct of_device_id fsl_of_msi_ids[] = {
{
Expand Down

0 comments on commit 6657736

Please sign in to comment.