Skip to content

Commit c6653f4

Browse files
committed
Merge tag 'powerpc-6.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: - Fix unnecessary copy to 0 when kernel is booted at address 0 - Fix usercopy crash when dumping dtl via debugfs - Avoid possible crash when PCI hotplug races with error handling - Fix kexec crash caused by scv being disabled before other CPUs call-in - Fix powerpc selftests build with USERCFLAGS set Thanks to Anjali K, Ganesh Goudar, Gautam Menghani, Jinglin Wen, Nicholas Piggin, Sourabh Jain, Srikar Dronamraju, and Vishal Chourasia. * tag 'powerpc-6.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: selftests/powerpc: Fix build with USERCFLAGS set powerpc/pseries: Fix scv instruction crash with kexec powerpc/eeh: avoid possible crash when edev->pdev changes powerpc/pseries: Whitelist dtl slub object for copying to userspace powerpc/64s: Fix unnecessary copy to 0 when kernel is booted at address 0
2 parents 256fdd4 + 8b7f59d commit c6653f4

File tree

7 files changed

+22
-20
lines changed

7 files changed

+22
-20
lines changed

arch/powerpc/kernel/eeh_pe.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
849849
{
850850
struct eeh_dev *edev;
851851
struct pci_dev *pdev;
852+
struct pci_bus *bus = NULL;
852853

853854
if (pe->type & EEH_PE_PHB)
854855
return pe->phb->bus;
@@ -859,9 +860,11 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
859860

860861
/* Retrieve the parent PCI bus of first (top) PCI device */
861862
edev = list_first_entry_or_null(&pe->edevs, struct eeh_dev, entry);
863+
pci_lock_rescan_remove();
862864
pdev = eeh_dev_to_pci_dev(edev);
863865
if (pdev)
864-
return pdev->bus;
866+
bus = pdev->bus;
867+
pci_unlock_rescan_remove();
865868

866-
return NULL;
869+
return bus;
867870
}

arch/powerpc/kernel/head_64.S

+3-2
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,9 @@ __after_prom_start:
647647
* Note: This process overwrites the OF exception vectors.
648648
*/
649649
LOAD_REG_IMMEDIATE(r3, PAGE_OFFSET)
650-
mr. r4,r26 /* In some cases the loader may */
651-
beq 9f /* have already put us at zero */
650+
mr r4,r26 /* Load the virtual source address into r4 */
651+
cmpld r3,r4 /* Check if source == dest */
652+
beq 9f /* If so skip the copy */
652653
li r6,0x100 /* Start offset, the first 0x100 */
653654
/* bytes were copied earlier. */
654655

arch/powerpc/kexec/core_64.c

+11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <asm/paca.h>
2828
#include <asm/mmu.h>
2929
#include <asm/sections.h> /* _end */
30+
#include <asm/setup.h>
3031
#include <asm/smp.h>
3132
#include <asm/hw_breakpoint.h>
3233
#include <asm/svm.h>
@@ -317,6 +318,16 @@ void default_machine_kexec(struct kimage *image)
317318
if (!kdump_in_progress())
318319
kexec_prepare_cpus();
319320

321+
#ifdef CONFIG_PPC_PSERIES
322+
/*
323+
* This must be done after other CPUs have shut down, otherwise they
324+
* could execute the 'scv' instruction, which is not supported with
325+
* reloc disabled (see configure_exceptions()).
326+
*/
327+
if (firmware_has_feature(FW_FEATURE_SET_MODE))
328+
pseries_disable_reloc_on_exc();
329+
#endif
330+
320331
printk("kexec: Starting switchover sequence.\n");
321332

322333
/* switch to a staticly allocated stack. Based on irq stack code.

arch/powerpc/platforms/pseries/kexec.c

-8
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,3 @@ void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
6161
} else
6262
xics_kexec_teardown_cpu(secondary);
6363
}
64-
65-
void pseries_machine_kexec(struct kimage *image)
66-
{
67-
if (firmware_has_feature(FW_FEATURE_SET_MODE))
68-
pseries_disable_reloc_on_exc();
69-
70-
default_machine_kexec(image);
71-
}

arch/powerpc/platforms/pseries/pseries.h

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ static inline void smp_init_pseries(void) { }
3838
#endif
3939

4040
extern void pseries_kexec_cpu_down(int crash_shutdown, int secondary);
41-
void pseries_machine_kexec(struct kimage *image);
4241

4342
extern void pSeries_final_fixup(void);
4443

arch/powerpc/platforms/pseries/setup.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ static int alloc_dispatch_log_kmem_cache(void)
343343
{
344344
void (*ctor)(void *) = get_dtl_cache_ctor();
345345

346-
dtl_cache = kmem_cache_create("dtl", DISPATCH_LOG_BYTES,
347-
DISPATCH_LOG_BYTES, 0, ctor);
346+
dtl_cache = kmem_cache_create_usercopy("dtl", DISPATCH_LOG_BYTES,
347+
DISPATCH_LOG_BYTES, 0, 0, DISPATCH_LOG_BYTES, ctor);
348348
if (!dtl_cache) {
349349
pr_warn("Failed to create dispatch trace log buffer cache\n");
350350
pr_warn("Stolen time statistics will be unreliable\n");
@@ -1159,7 +1159,6 @@ define_machine(pseries) {
11591159
.machine_check_exception = pSeries_machine_check_exception,
11601160
.machine_check_log_err = pSeries_machine_check_log_err,
11611161
#ifdef CONFIG_KEXEC_CORE
1162-
.machine_kexec = pseries_machine_kexec,
11631162
.kexec_cpu_down = pseries_kexec_cpu_down,
11641163
#endif
11651164
#ifdef CONFIG_MEMORY_HOTPLUG

tools/testing/selftests/powerpc/flags.mk

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@ GIT_VERSION := $(shell git describe --always --long --dirty || echo "unknown")
55
export GIT_VERSION
66
endif
77

8-
ifeq ($(CFLAGS),)
9-
CFLAGS := -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(selfdir)/powerpc/include $(CFLAGS)
8+
CFLAGS := -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(selfdir)/powerpc/include $(USERCFLAGS)
109
export CFLAGS
11-
endif
12-

0 commit comments

Comments
 (0)