mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
45824fc0da
- Initial support for running on a system with an Ultravisor, which is software that runs below the hypervisor and protects guests against some attacks by the hypervisor. - Support for building the kernel to run as a "Secure Virtual Machine", ie. as a guest capable of running on a system with an Ultravisor. - Some changes to our DMA code on bare metal, to allow devices with medium sized DMA masks (> 32 && < 59 bits) to use more than 2GB of DMA space. - Support for firmware assisted crash dumps on bare metal (powernv). - Two series fixing bugs in and refactoring our PCI EEH code. - A large series refactoring our exception entry code to use gas macros, both to make it more readable and also enable some future optimisations. As well as many cleanups and other minor features & fixups. Thanks to: Adam Zerella, Alexey Kardashevskiy, Alistair Popple, Andrew Donnellan, Aneesh Kumar K.V, Anju T Sudhakar, Anshuman Khandual, Balbir Singh, Benjamin Herrenschmidt, Cédric Le Goater, Christophe JAILLET, Christophe Leroy, Christopher M. Riedl, Christoph Hellwig, Claudio Carvalho, Daniel Axtens, David Gibson, David Hildenbrand, Desnes A. Nunes do Rosario, Ganesh Goudar, Gautham R. Shenoy, Greg Kurz, Guerney Hunt, Gustavo Romero, Halil Pasic, Hari Bathini, Joakim Tjernlund, Jonathan Neuschafer, Jordan Niethe, Leonardo Bras, Lianbo Jiang, Madhavan Srinivasan, Mahesh Salgaonkar, Mahesh Salgaonkar, Masahiro Yamada, Maxiwell S. Garcia, Michael Anderson, Nathan Chancellor, Nathan Lynch, Naveen N. Rao, Nicholas Piggin, Oliver O'Halloran, Qian Cai, Ram Pai, Ravi Bangoria, Reza Arbab, Ryan Grimm, Sam Bobroff, Santosh Sivaraj, Segher Boessenkool, Sukadev Bhattiprolu, Thiago Bauermann, Thiago Jung Bauermann, Thomas Gleixner, Tom Lendacky, Vasant Hegde. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAl2EtEcTHG1wZUBlbGxl cm1hbi5pZC5hdQAKCRBR6+o8yOGlgPfsD/9uXyBXn3anI/H08+mk74k5gCsmMQpn D442CD/ByogZcccp23yBTlhawtCE03hcHnCLygn0Xgd8a4YvHts/RGHUe3fPHqlG bEyZ7jsLVz5ebNZQP7r4eGs2pSzCajwJy2N9HJ/C1ojf15rrfRxoVJtnyhE2wXpm DL+6o2K+nUCB3gTQ1Inr3DnWzoGOOUfNTOea2u+J+yfHwGRqOBYpevwqiwy5eelK aRjUJCqMTvrzra49MeFwjo0Nt3/Y8UNcwA+JlGdeR8bRuWhFrYmyBRiZEKPaujNO 5EAfghBBlB0KQCqvF/tRM/c0OftHqK59AMobP9T7u9oOaBXeF/FpZX/iXjzNDPsN j9Oo2tKLTu/YVEXqBFuREGP+znANr1Wo4CFyOG8SbvYz0HFjR6XbtRJsS+0e8GWl kqX5/ZhYz3lBnKSNe9jgWOrh/J0KCSFigBTEWJT3xsn4YE8x8kK2l9KPqAIldWEP sKb2UjGS7v0NKq+NvShH88Q9AeQUEIjTcg/9aDDQDe6FaRQ7KiF8bUxSdwSPi+Fn j0lnF6i+1ATWZKuCr85veVi7C5qoe/+MqalnmP7MxULyzgXLLxUgN0SzEYO6QofK LQK/VaH2XVr5+M5YAb7K4/NX5gbM3s1bKrCiUy4EyHNvgG7gricYdbz6HgAjKpR7 oP0rHfgmVYvF1g== =WlW+ -----END PGP SIGNATURE----- Merge tag 'powerpc-5.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux Pull powerpc updates from Michael Ellerman: "This is a bit late, partly due to me travelling, and partly due to a power outage knocking out some of my test systems *while* I was travelling. - Initial support for running on a system with an Ultravisor, which is software that runs below the hypervisor and protects guests against some attacks by the hypervisor. - Support for building the kernel to run as a "Secure Virtual Machine", ie. as a guest capable of running on a system with an Ultravisor. - Some changes to our DMA code on bare metal, to allow devices with medium sized DMA masks (> 32 && < 59 bits) to use more than 2GB of DMA space. - Support for firmware assisted crash dumps on bare metal (powernv). - Two series fixing bugs in and refactoring our PCI EEH code. - A large series refactoring our exception entry code to use gas macros, both to make it more readable and also enable some future optimisations. As well as many cleanups and other minor features & fixups. Thanks to: Adam Zerella, Alexey Kardashevskiy, Alistair Popple, Andrew Donnellan, Aneesh Kumar K.V, Anju T Sudhakar, Anshuman Khandual, Balbir Singh, Benjamin Herrenschmidt, Cédric Le Goater, Christophe JAILLET, Christophe Leroy, Christopher M. Riedl, Christoph Hellwig, Claudio Carvalho, Daniel Axtens, David Gibson, David Hildenbrand, Desnes A. Nunes do Rosario, Ganesh Goudar, Gautham R. Shenoy, Greg Kurz, Guerney Hunt, Gustavo Romero, Halil Pasic, Hari Bathini, Joakim Tjernlund, Jonathan Neuschafer, Jordan Niethe, Leonardo Bras, Lianbo Jiang, Madhavan Srinivasan, Mahesh Salgaonkar, Mahesh Salgaonkar, Masahiro Yamada, Maxiwell S. Garcia, Michael Anderson, Nathan Chancellor, Nathan Lynch, Naveen N. Rao, Nicholas Piggin, Oliver O'Halloran, Qian Cai, Ram Pai, Ravi Bangoria, Reza Arbab, Ryan Grimm, Sam Bobroff, Santosh Sivaraj, Segher Boessenkool, Sukadev Bhattiprolu, Thiago Bauermann, Thiago Jung Bauermann, Thomas Gleixner, Tom Lendacky, Vasant Hegde" * tag 'powerpc-5.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (264 commits) powerpc/mm/mce: Keep irqs disabled during lockless page table walk powerpc: Use ftrace_graph_ret_addr() when unwinding powerpc/ftrace: Enable HAVE_FUNCTION_GRAPH_RET_ADDR_PTR ftrace: Look up the address of return_to_handler() using helpers powerpc: dump kernel log before carrying out fadump or kdump docs: powerpc: Add missing documentation reference powerpc/xmon: Fix output of XIVE IPI powerpc/xmon: Improve output of XIVE interrupts powerpc/mm/radix: remove useless kernel messages powerpc/fadump: support holes in kernel boot memory area powerpc/fadump: remove RMA_START and RMA_END macros powerpc/fadump: update documentation about option to release opalcore powerpc/fadump: consider f/w load area powerpc/opalcore: provide an option to invalidate /sys/firmware/opal/core file powerpc/opalcore: export /sys/firmware/opal/core for analysing opal crashes powerpc/fadump: update documentation about CONFIG_PRESERVE_FA_DUMP powerpc/fadump: add support to preserve crash data on FADUMP disabled kernel powerpc/fadump: improve how crashed kernel's memory is reserved powerpc/fadump: consider reserved ranges while releasing memory powerpc/fadump: make crash memory ranges array allocation generic ...
161 lines
5.0 KiB
C
161 lines
5.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Copyright 2016,2017 IBM Corporation.
|
|
*/
|
|
#ifndef _ASM_POWERPC_XIVE_H
|
|
#define _ASM_POWERPC_XIVE_H
|
|
|
|
#define XIVE_INVALID_VP 0xffffffff
|
|
|
|
#ifdef CONFIG_PPC_XIVE
|
|
|
|
/*
|
|
* Thread Interrupt Management Area (TIMA)
|
|
*
|
|
* This is a global MMIO region divided in 4 pages of varying access
|
|
* permissions, providing access to per-cpu interrupt management
|
|
* functions. It always identifies the CPU doing the access based
|
|
* on the PowerBus initiator ID, thus we always access via the
|
|
* same offset regardless of where the code is executing
|
|
*/
|
|
extern void __iomem *xive_tima;
|
|
extern unsigned long xive_tima_os;
|
|
|
|
/*
|
|
* Offset in the TM area of our current execution level (provided by
|
|
* the backend)
|
|
*/
|
|
extern u32 xive_tima_offset;
|
|
|
|
/*
|
|
* Per-irq data (irq_get_handler_data for normal IRQs), IPIs
|
|
* have it stored in the xive_cpu structure. We also cache
|
|
* for normal interrupts the current target CPU.
|
|
*
|
|
* This structure is setup by the backend for each interrupt.
|
|
*/
|
|
struct xive_irq_data {
|
|
u64 flags;
|
|
u64 eoi_page;
|
|
void __iomem *eoi_mmio;
|
|
u64 trig_page;
|
|
void __iomem *trig_mmio;
|
|
u32 esb_shift;
|
|
int src_chip;
|
|
u32 hw_irq;
|
|
|
|
/* Setup/used by frontend */
|
|
int target;
|
|
/*
|
|
* saved_p means that there is a queue entry for this interrupt
|
|
* in some CPU's queue (not including guest vcpu queues), even
|
|
* if P is not set in the source ESB.
|
|
* stale_p means that there is no queue entry for this interrupt
|
|
* in some CPU's queue, even if P is set in the source ESB.
|
|
*/
|
|
bool saved_p;
|
|
bool stale_p;
|
|
};
|
|
#define XIVE_IRQ_FLAG_STORE_EOI 0x01
|
|
#define XIVE_IRQ_FLAG_LSI 0x02
|
|
#define XIVE_IRQ_FLAG_SHIFT_BUG 0x04
|
|
#define XIVE_IRQ_FLAG_MASK_FW 0x08
|
|
#define XIVE_IRQ_FLAG_EOI_FW 0x10
|
|
#define XIVE_IRQ_FLAG_H_INT_ESB 0x20
|
|
|
|
/* Special flag set by KVM for excalation interrupts */
|
|
#define XIVE_IRQ_NO_EOI 0x80
|
|
|
|
#define XIVE_INVALID_CHIP_ID -1
|
|
|
|
/* A queue tracking structure in a CPU */
|
|
struct xive_q {
|
|
__be32 *qpage;
|
|
u32 msk;
|
|
u32 idx;
|
|
u32 toggle;
|
|
u64 eoi_phys;
|
|
u32 esc_irq;
|
|
atomic_t count;
|
|
atomic_t pending_count;
|
|
u64 guest_qaddr;
|
|
u32 guest_qshift;
|
|
};
|
|
|
|
/* Global enable flags for the XIVE support */
|
|
extern bool __xive_enabled;
|
|
|
|
static inline bool xive_enabled(void) { return __xive_enabled; }
|
|
|
|
extern bool xive_spapr_init(void);
|
|
extern bool xive_native_init(void);
|
|
extern void xive_smp_probe(void);
|
|
extern int xive_smp_prepare_cpu(unsigned int cpu);
|
|
extern void xive_smp_setup_cpu(void);
|
|
extern void xive_smp_disable_cpu(void);
|
|
extern void xive_teardown_cpu(void);
|
|
extern void xive_shutdown(void);
|
|
extern void xive_flush_interrupt(void);
|
|
|
|
/* xmon hook */
|
|
extern void xmon_xive_do_dump(int cpu);
|
|
extern int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d);
|
|
|
|
/* APIs used by KVM */
|
|
extern u32 xive_native_default_eq_shift(void);
|
|
extern u32 xive_native_alloc_vp_block(u32 max_vcpus);
|
|
extern void xive_native_free_vp_block(u32 vp_base);
|
|
extern int xive_native_populate_irq_data(u32 hw_irq,
|
|
struct xive_irq_data *data);
|
|
extern void xive_cleanup_irq_data(struct xive_irq_data *xd);
|
|
extern u32 xive_native_alloc_irq(void);
|
|
extern void xive_native_free_irq(u32 irq);
|
|
extern int xive_native_configure_irq(u32 hw_irq, u32 target, u8 prio, u32 sw_irq);
|
|
|
|
extern int xive_native_configure_queue(u32 vp_id, struct xive_q *q, u8 prio,
|
|
__be32 *qpage, u32 order, bool can_escalate);
|
|
extern void xive_native_disable_queue(u32 vp_id, struct xive_q *q, u8 prio);
|
|
|
|
extern void xive_native_sync_source(u32 hw_irq);
|
|
extern void xive_native_sync_queue(u32 hw_irq);
|
|
extern bool is_xive_irq(struct irq_chip *chip);
|
|
extern int xive_native_enable_vp(u32 vp_id, bool single_escalation);
|
|
extern int xive_native_disable_vp(u32 vp_id);
|
|
extern int xive_native_get_vp_info(u32 vp_id, u32 *out_cam_id, u32 *out_chip_id);
|
|
extern bool xive_native_has_single_escalation(void);
|
|
|
|
extern int xive_native_get_queue_info(u32 vp_id, uint32_t prio,
|
|
u64 *out_qpage,
|
|
u64 *out_qsize,
|
|
u64 *out_qeoi_page,
|
|
u32 *out_escalate_irq,
|
|
u64 *out_qflags);
|
|
|
|
extern int xive_native_get_queue_state(u32 vp_id, uint32_t prio, u32 *qtoggle,
|
|
u32 *qindex);
|
|
extern int xive_native_set_queue_state(u32 vp_id, uint32_t prio, u32 qtoggle,
|
|
u32 qindex);
|
|
extern int xive_native_get_vp_state(u32 vp_id, u64 *out_state);
|
|
extern bool xive_native_has_queue_state_support(void);
|
|
|
|
#else
|
|
|
|
static inline bool xive_enabled(void) { return false; }
|
|
|
|
static inline bool xive_spapr_init(void) { return false; }
|
|
static inline bool xive_native_init(void) { return false; }
|
|
static inline void xive_smp_probe(void) { }
|
|
static inline int xive_smp_prepare_cpu(unsigned int cpu) { return -EINVAL; }
|
|
static inline void xive_smp_setup_cpu(void) { }
|
|
static inline void xive_smp_disable_cpu(void) { }
|
|
static inline void xive_kexec_teardown_cpu(int secondary) { }
|
|
static inline void xive_shutdown(void) { }
|
|
static inline void xive_flush_interrupt(void) { }
|
|
|
|
static inline u32 xive_native_alloc_vp_block(u32 max_vcpus) { return XIVE_INVALID_VP; }
|
|
static inline void xive_native_free_vp_block(u32 vp_base) { }
|
|
|
|
#endif
|
|
|
|
#endif /* _ASM_POWERPC_XIVE_H */
|