mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
19f8a5b5be
Commit24be85a23d
("powerpc/powernv: Clear PECE1 in LPCR via stop-api only on Hotplug", 2017-07-21) added two calls to opal_slw_set_reg() inside pnv_cpu_offline(), with the aim of changing the LPCR value in the SLW image to disable wakeups from the decrementer while a CPU is offline. However, pnv_cpu_offline() gets called each time a secondary CPU thread is woken up to participate in running a KVM guest, that is, not just when a CPU is offlined. Since opal_slw_set_reg() is a very slow operation (with observed execution times around 20 milliseconds), this means that an offline secondary CPU can often be busy doing the opal_slw_set_reg() call when the primary CPU wants to grab all the secondary threads so that it can run a KVM guest. This leads to messages like "KVM: couldn't grab CPU n" being printed and guest execution failing. There is no need to reprogram the SLW image on every KVM guest entry and exit. So that we do it only when a CPU is really transitioning between online and offline, this moves the calls to pnv_program_cpu_hotplug_lpcr() into pnv_smp_cpu_kill_self(). Fixes:24be85a23d
("powerpc/powernv: Clear PECE1 in LPCR via stop-api only on Hotplug") Cc: stable@vger.kernel.org # v4.14+ Signed-off-by: Paul Mackerras <paulus@ozlabs.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
48 lines
1.5 KiB
C
48 lines
1.5 KiB
C
/*
|
|
* Copyright 2017 IBM Corp.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#ifndef _ASM_POWERNV_H
|
|
#define _ASM_POWERNV_H
|
|
|
|
#ifdef CONFIG_PPC_POWERNV
|
|
#define NPU2_WRITE 1
|
|
extern void powernv_set_nmmu_ptcr(unsigned long ptcr);
|
|
extern struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev,
|
|
unsigned long flags,
|
|
void (*cb)(struct npu_context *, void *),
|
|
void *priv);
|
|
extern void pnv_npu2_destroy_context(struct npu_context *context,
|
|
struct pci_dev *gpdev);
|
|
extern int pnv_npu2_handle_fault(struct npu_context *context, uintptr_t *ea,
|
|
unsigned long *flags, unsigned long *status,
|
|
int count);
|
|
|
|
void pnv_program_cpu_hotplug_lpcr(unsigned int cpu, u64 lpcr_val);
|
|
|
|
void pnv_tm_init(void);
|
|
#else
|
|
static inline void powernv_set_nmmu_ptcr(unsigned long ptcr) { }
|
|
static inline struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev,
|
|
unsigned long flags,
|
|
struct npu_context *(*cb)(struct npu_context *, void *),
|
|
void *priv) { return ERR_PTR(-ENODEV); }
|
|
static inline void pnv_npu2_destroy_context(struct npu_context *context,
|
|
struct pci_dev *gpdev) { }
|
|
|
|
static inline int pnv_npu2_handle_fault(struct npu_context *context,
|
|
uintptr_t *ea, unsigned long *flags,
|
|
unsigned long *status, int count) {
|
|
return -ENODEV;
|
|
}
|
|
|
|
static inline void pnv_tm_init(void) { }
|
|
#endif
|
|
|
|
#endif /* _ASM_POWERNV_H */
|