Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: s390: pci: add basic kvm_zdev structure

This structure will be used to carry kvm passthrough information related to
zPCI devices.

Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
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-12-mjrosato@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>

authored by

Matthew Rosato and committed by
Christian Borntraeger
6438e307 c435c546

+61
+3
arch/s390/include/asm/pci.h
··· 97 97 }; 98 98 99 99 struct s390_domain; 100 + struct kvm_zdev; 100 101 101 102 #define ZPCI_FUNCTIONS_PER_BUS 256 102 103 struct zpci_bus { ··· 190 189 191 190 struct dentry *debugfs_dev; 192 191 192 + /* IOMMU and passthrough */ 193 193 struct s390_domain *s390_domain; /* s390 IOMMU domain data */ 194 + struct kvm_zdev *kzdev; 194 195 }; 195 196 196 197 static inline bool zdev_enabled(struct zpci_dev *zdev)
+1
arch/s390/kvm/Makefile
··· 10 10 kvm-y += kvm-s390.o intercept.o interrupt.o priv.o sigp.o 11 11 kvm-y += diag.o gaccess.o guestdbg.o vsie.o pv.o 12 12 13 + kvm-$(CONFIG_VFIO_PCI_ZDEV_KVM) += pci.o 13 14 obj-$(CONFIG_KVM) += kvm.o
+36
arch/s390/kvm/pci.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * s390 kvm PCI passthrough support 4 + * 5 + * Copyright IBM Corp. 2022 6 + * 7 + * Author(s): Matthew Rosato <mjrosato@linux.ibm.com> 8 + */ 9 + 10 + #include <linux/kvm_host.h> 11 + #include <linux/pci.h> 12 + #include "pci.h" 13 + 14 + static int kvm_s390_pci_dev_open(struct zpci_dev *zdev) 15 + { 16 + struct kvm_zdev *kzdev; 17 + 18 + kzdev = kzalloc(sizeof(struct kvm_zdev), GFP_KERNEL); 19 + if (!kzdev) 20 + return -ENOMEM; 21 + 22 + kzdev->zdev = zdev; 23 + zdev->kzdev = kzdev; 24 + 25 + return 0; 26 + } 27 + 28 + static void kvm_s390_pci_dev_release(struct zpci_dev *zdev) 29 + { 30 + struct kvm_zdev *kzdev; 31 + 32 + kzdev = zdev->kzdev; 33 + WARN_ON(kzdev->zdev != zdev); 34 + zdev->kzdev = NULL; 35 + kfree(kzdev); 36 + }
+21
arch/s390/kvm/pci.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * s390 kvm PCI passthrough support 4 + * 5 + * Copyright IBM Corp. 2022 6 + * 7 + * Author(s): Matthew Rosato <mjrosato@linux.ibm.com> 8 + */ 9 + 10 + #ifndef __KVM_S390_PCI_H 11 + #define __KVM_S390_PCI_H 12 + 13 + #include <linux/kvm_host.h> 14 + #include <linux/pci.h> 15 + 16 + struct kvm_zdev { 17 + struct zpci_dev *zdev; 18 + struct kvm *kvm; 19 + }; 20 + 21 + #endif /* __KVM_S390_PCI_H */