diff options
author | Matthew Rosato <mjrosato@linux.ibm.com> | 2022-06-06 23:33:16 +0300 |
---|---|---|
committer | Christian Borntraeger <borntraeger@linux.ibm.com> | 2022-07-11 10:54:28 +0300 |
commit | 98b1d33dac5fd09060486762c02fd1a78baeb1e0 (patch) | |
tree | d497644d8dd17f4d2d4681f109c3d8da434a9b8f /arch/s390/kvm/pci.h | |
parent | 6438e30714abd1bf7408356d3e86127d1fb379c0 (diff) | |
download | linux-98b1d33dac5fd09060486762c02fd1a78baeb1e0.tar.xz |
KVM: s390: pci: do initial setup for AEN interpretation
Initial setup for Adapter Event Notification Interpretation for zPCI
passthrough devices. Specifically, allocate a structure for forwarding of
adapter events and pass the address of this structure to firmware.
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Link: https://lore.kernel.org/r/20220606203325.110625-13-mjrosato@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Diffstat (limited to 'arch/s390/kvm/pci.h')
-rw-r--r-- | arch/s390/kvm/pci.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/s390/kvm/pci.h b/arch/s390/kvm/pci.h index ce93978e8913..c357d900f8b0 100644 --- a/arch/s390/kvm/pci.h +++ b/arch/s390/kvm/pci.h @@ -12,10 +12,59 @@ #include <linux/kvm_host.h> #include <linux/pci.h> +#include <linux/mutex.h> +#include <asm/airq.h> +#include <asm/cpu.h> struct kvm_zdev { struct zpci_dev *zdev; struct kvm *kvm; }; +struct zpci_gaite { + u32 gisa; + u8 gisc; + u8 count; + u8 reserved; + u8 aisbo; + u64 aisb; +}; + +struct zpci_aift { + struct zpci_gaite *gait; + struct airq_iv *sbv; + struct kvm_zdev **kzdev; + spinlock_t gait_lock; /* Protects the gait, used during AEN forward */ + struct mutex aift_lock; /* Protects the other structures in aift */ +}; + +extern struct zpci_aift *aift; + +int kvm_s390_pci_aen_init(u8 nisc); +void kvm_s390_pci_aen_exit(void); + +int kvm_s390_pci_init(void); +void kvm_s390_pci_exit(void); + +static inline bool kvm_s390_pci_interp_allowed(void) +{ + struct cpuid cpu_id; + + get_cpu_id(&cpu_id); + switch (cpu_id.machine) { + case 0x2817: + case 0x2818: + case 0x2827: + case 0x2828: + case 0x2964: + case 0x2965: + /* No SHM on certain machines */ + return false; + default: + return (IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) && + sclp.has_zpci_lsi && sclp.has_aeni && sclp.has_aisi && + sclp.has_aisii); + } +} + #endif /* __KVM_S390_PCI_H */ |