From: Pierre Morel <pmorel@linux.ibm.com>
To: mjrosato@linux.ibm.com
Cc: rdunlap@infradead.org, linux-kernel@vger.kernel.org,
lkp@intel.com, borntraeger@linux.ibm.com, farman@linux.ibm.com,
linux-s390@vger.kernel.org, kvm@vger.kernel.org
Subject: [PATCH] KVM: s390: pci: VFIO_PCI ZDEV configuration fix
Date: Tue, 16 Aug 2022 22:28:55 +0200 [thread overview]
Message-ID: <20220816202855.189410-1-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1f2dd65e-b79b-44df-cc6a-8b3aa8fd61af@linux.ibm.com>
Fixing configuration for VFIO PCI interpretation.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
Fixes: 09340b2fca007 ("KVM: s390: pci: add routines to start/stop inter..")
Fixes: c435c54639aa5 ("vfio/pci: introduce CONFIG_VFIO_PCI_ZDEV_KVM..")
Cc: <stable@vger.kernel.org>
---
arch/s390/include/asm/kvm_host.h | 9 ---------
arch/s390/kvm/Makefile | 2 +-
arch/s390/kvm/pci.c | 4 ++--
drivers/vfio/pci/Kconfig | 4 ++--
include/linux/vfio_pci_core.h | 2 +-
5 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index f39092e0ceaa..f6cf961731af 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -1038,16 +1038,7 @@ static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
#define __KVM_HAVE_ARCH_VM_FREE
void kvm_arch_free_vm(struct kvm *kvm);
-#ifdef CONFIG_VFIO_PCI_ZDEV_KVM
int kvm_s390_pci_register_kvm(struct zpci_dev *zdev, struct kvm *kvm);
void kvm_s390_pci_unregister_kvm(struct zpci_dev *zdev);
-#else
-static inline int kvm_s390_pci_register_kvm(struct zpci_dev *dev,
- struct kvm *kvm)
-{
- return -EPERM;
-}
-static inline void kvm_s390_pci_unregister_kvm(struct zpci_dev *dev) {}
-#endif
#endif
diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile
index 02217fb4ae10..be36afcfd6ff 100644
--- a/arch/s390/kvm/Makefile
+++ b/arch/s390/kvm/Makefile
@@ -9,6 +9,6 @@ ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
kvm-y += kvm-s390.o intercept.o interrupt.o priv.o sigp.o
kvm-y += diag.o gaccess.o guestdbg.o vsie.o pv.o
+kvm-y += pci.o
-kvm-$(CONFIG_VFIO_PCI_ZDEV_KVM) += pci.o
obj-$(CONFIG_KVM) += kvm.o
diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
index 4946fb7757d6..cf8ab72a2109 100644
--- a/arch/s390/kvm/pci.c
+++ b/arch/s390/kvm/pci.c
@@ -435,7 +435,7 @@ int kvm_s390_pci_register_kvm(struct zpci_dev *zdev, struct kvm *kvm)
{
int rc;
- if (!zdev)
+ if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || !zdev)
return -EINVAL;
mutex_lock(&zdev->kzdev_lock);
@@ -516,7 +516,7 @@ void kvm_s390_pci_unregister_kvm(struct zpci_dev *zdev)
{
struct kvm *kvm;
- if (!zdev)
+ if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || !zdev)
return;
mutex_lock(&zdev->kzdev_lock);
diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig
index f9d0c908e738..bbc375b028ef 100644
--- a/drivers/vfio/pci/Kconfig
+++ b/drivers/vfio/pci/Kconfig
@@ -45,9 +45,9 @@ config VFIO_PCI_IGD
endif
config VFIO_PCI_ZDEV_KVM
- bool "VFIO PCI extensions for s390x KVM passthrough"
+ def_tristate y
+ prompt "VFIO PCI extensions for s390x KVM passthrough"
depends on S390 && KVM
- default y
help
Support s390x-specific extensions to enable support for enhancements
to KVM passthrough capabilities, such as interpretive execution of
diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
index 5579ece4347b..7db3bb8129b1 100644
--- a/include/linux/vfio_pci_core.h
+++ b/include/linux/vfio_pci_core.h
@@ -205,7 +205,7 @@ static inline int vfio_pci_igd_init(struct vfio_pci_core_device *vdev)
}
#endif
-#ifdef CONFIG_VFIO_PCI_ZDEV_KVM
+#if IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM)
int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,
struct vfio_info_cap *caps);
int vfio_pci_zdev_open_device(struct vfio_pci_core_device *vdev);
--
2.31.1
next prev parent reply other threads:[~2022-08-16 20:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-14 21:51 [PATCH] vfio-pci/zdev: require KVM to be built-in Randy Dunlap
2022-08-15 9:43 ` Pierre Morel
2022-08-16 6:04 ` Randy Dunlap
2022-08-16 7:55 ` Pierre Morel
2022-08-16 13:47 ` Pierre Morel
2022-08-16 18:06 ` Randy Dunlap
2022-08-16 19:46 ` Matthew Rosato
2022-08-16 20:22 ` Pierre Morel
2022-08-16 20:28 ` Pierre Morel [this message]
2022-08-16 22:15 ` [PATCH] KVM: s390: pci: VFIO_PCI ZDEV configuration fix Matthew Rosato
2022-08-17 7:10 ` Pierre Morel
2022-08-18 10:23 ` [PATCH] KVM: s390: pci: Hook to access KVM lowlevel from VFIO Pierre Morel
2022-08-18 13:33 ` Matthew Rosato
2022-08-18 14:06 ` Pierre Morel
2022-08-18 14:20 ` Niklas Schnelle
2022-08-18 15:13 ` Matthew Rosato
2022-08-18 15:22 ` Niklas Schnelle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220816202855.189410-1-pmorel@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=farman@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mjrosato@linux.ibm.com \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox