KVM: PPC: Book3S HV: add a SET_SOURCE control to the XIVE native device
Subsystems (2)
RFC PATCH 6/16 KVM: PPC: Book3S HV: add a SET_SOURCE control to the XIVE native device
Interrupt sources are simply created at the OPAL level and then MASKED. KVM only needs to know about their type: LSI or MSI.
Signed-off-by Cédric Le Goater <[email protected]>
--- arch/powerpc/include/uapi/asm/kvm.h | 7 ++ arch/powerpc/kvm/book3s_xive_native.c | 106 +++++++++++++++++++++++++ arch/powerpc/kvm/book3s_xive_native_template.c | 30 +++++++ 3 files changed, 143 insertions(+) create mode 100644 arch/powerpc/kvm/book3s_xive_native_template.c
arch/powerpc/include/uapi/asm/kvm.h +7 -0
@@ -673,4 +673,11 @@ struct kvm_ppc_cpu_char {#define KVM_XICS_PRESENTED (1ULL << 43)#define KVM_XICS_QUEUED (1ULL << 44) +/* POWER9 XIVE Native Interrupt Controller */ +#define KVM_DEV_XIVE_GRP_SOURCES 1/* 64-bit source attributes */ + +/* Layout of 64-bit XIVE source attribute values */ +#define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0) +#define KVM_XIVE_LEVEL_ASSERTED (1ULL << 1) +#endif /* __LINUX_KVM_POWERPC_H */
arch/powerpc/kvm/book3s_xive_native.c +106 -0
127 lines not on this page · raw message
arch/powerpc/kvm/book3s_xive_native_template.c new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright (c) 2017-2018, IBM Corporation. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License, version 2, as +* published by the Free Software Foundation. +*/ + +/* File to be included by other .c files */ + +#define XGLUE (a, b) a##b +#define GLUE (a, b) XGLUE(a, b) + +/* +* TODO: introduce a common template file with the XIVE native layer +* and the XICS-on-XIVE glue for the utility functions +*/ +static u8 GLUE (X_PFX ,esb_load )(struct xive_irq_data *xd,u32 offset) +{ +u64 val; + +if (xd->flags &XIVE_IRQ_FLAG_SHIFT_BUG ) + offset |= offset <<4 ; + + val =__x_readq (__x_eoi_page (xd) + offset); +#ifdef __LITTLE_ENDIAN__ + val >>=64 -8 ; +#endif +return (u8 )val; +}
Signature · 1 line
2.13.6