All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: qemu-devel@nongnu.org
Cc: chao.p.peng@intel.com,
	"Zhenzhong Duan" <zhenzhong.duan@intel.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	qemu-ppc@nongnu.org (open list:PowerPC TCG CPUs)
Subject: [PATCH] hw/ppc: Improve build for PPC VFIO
Date: Thu, 23 Nov 2023 14:01:09 +0800	[thread overview]
Message-ID: <20231123060109.131904-1-zhenzhong.duan@intel.com> (raw)

VFIO is not a required subsystem for the pseries machine but it's
force enabled currently. When --without-default-devices is used
to drop some default devices including vfio-pci, vfio core code
is still kept which is unnecessary.

Introduce a stub file to hold stub functions of VFIO EEH hooks,
then vfio core could be compiled out.

Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
Based on vfio-next/vfio-8.2

 hw/ppc/spapr_pci_vfio_stub.c | 33 +++++++++++++++++++++++++++++++++
 hw/ppc/Kconfig               |  2 +-
 hw/ppc/meson.build           |  6 +++---
 3 files changed, 37 insertions(+), 4 deletions(-)
 create mode 100644 hw/ppc/spapr_pci_vfio_stub.c

diff --git a/hw/ppc/spapr_pci_vfio_stub.c b/hw/ppc/spapr_pci_vfio_stub.c
new file mode 100644
index 0000000000..adb3fb5e35
--- /dev/null
+++ b/hw/ppc/spapr_pci_vfio_stub.c
@@ -0,0 +1,33 @@
+#include "qemu/osdep.h"
+#include "hw/pci-host/spapr.h"
+
+bool spapr_phb_eeh_available(SpaprPhbState *sphb)
+{
+    return false;
+}
+
+void spapr_phb_vfio_reset(DeviceState *qdev)
+{
+}
+
+int spapr_phb_vfio_eeh_set_option(SpaprPhbState *sphb,
+                                  unsigned int addr, int option)
+{
+    return RTAS_OUT_NOT_SUPPORTED;
+}
+
+int spapr_phb_vfio_eeh_get_state(SpaprPhbState *sphb, int *state)
+{
+    return RTAS_OUT_NOT_SUPPORTED;
+}
+
+int spapr_phb_vfio_eeh_reset(SpaprPhbState *sphb, int option)
+{
+    return RTAS_OUT_NOT_SUPPORTED;
+}
+
+int spapr_phb_vfio_eeh_configure(SpaprPhbState *sphb)
+{
+    return RTAS_OUT_NOT_SUPPORTED;
+}
+
diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
index edc6d2d139..b8dabdbfbe 100644
--- a/hw/ppc/Kconfig
+++ b/hw/ppc/Kconfig
@@ -3,11 +3,11 @@ config PSERIES
     imply PCI_DEVICES
     imply TEST_DEVICES
     imply VIRTIO_VGA
+    imply VFIO if LINUX   # needed by spapr_pci_vfio.c
     select NVDIMM
     select DIMM
     select PCI
     select SPAPR_VSCSI
-    select VFIO_PCI if LINUX   # needed by spapr_pci_vfio.c
     select XICS
     select XIVE
     select MSI_NONBROKEN
diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
index ea44856d43..2df5db2eef 100644
--- a/hw/ppc/meson.build
+++ b/hw/ppc/meson.build
@@ -34,9 +34,9 @@ ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_TCG'], if_true: files(
   'spapr_softmmu.c',
 ))
 ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c'))
-ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files(
-  'spapr_pci_vfio.c',
-))
+ppc_ss.add(when: [ 'CONFIG_VFIO_PCI', 'CONFIG_PSERIES', 'CONFIG_LINUX'],
+           if_true: files('spapr_pci_vfio.c'),
+           if_false: files('spapr_pci_vfio_stub.c'))
 
 # IBM PowerNV
 ppc_ss.add(when: 'CONFIG_POWERNV', if_true: files(
-- 
2.34.1



             reply	other threads:[~2023-11-23  6:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23  6:01 Zhenzhong Duan [this message]
2023-11-23  7:33 ` [PATCH] hw/ppc: Improve build for PPC VFIO Cédric Le Goater
2023-11-23  7:48   ` Duan, Zhenzhong
2023-11-23 10:19   ` Philippe Mathieu-Daudé
2023-11-23 13:45     ` Cédric Le Goater
2023-11-24  7:59       ` Cédric Le Goater
2023-11-24  8:01         ` Duan, Zhenzhong
2023-11-24  6:01   ` Nicholas Piggin

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=20231123060109.131904-1-zhenzhong.duan@intel.com \
    --to=zhenzhong.duan@intel.com \
    --cc=chao.p.peng@intel.com \
    --cc=clg@kaod.org \
    --cc=clg@redhat.com \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=harshpb@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.