qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once
@ 2025-03-11  8:57 Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 1/8] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h' Philippe Mathieu-Daudé
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-11  8:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Cédric Le Goater, Halil Pasic, Philippe Mathieu-Daudé,
	Eric Farman, Peter Xu

Hi Cédric,

Here are the VFIO cleanup patches ready enough for 10.0,
with Richard and Eric comments from v2 addressed.

I'd prefer the rest (of v2) to wait for 10.1.

Thanks,

Phil.

Philippe Mathieu-Daudé (8):
  system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h'
  hw/vfio/spapr: Do not include <linux/kvm.h>
  hw/vfio/common: Include missing 'system/tcg.h' header
  hw/vfio/common: Get target page size using runtime helpers
  hw/vfio: Compile some common objects once
  hw/vfio: Compile more objects once
  hw/vfio: Compile iommufd.c once
  hw/vfio: Compile display.c once

 include/exec/ram_addr.h    |  3 ---
 include/system/hostmem.h   |  3 +++
 hw/ppc/spapr_caps.c        |  1 +
 hw/s390x/s390-virtio-ccw.c |  1 +
 hw/vfio/common.c           |  9 ++++++---
 hw/vfio/iommufd.c          |  1 -
 hw/vfio/migration.c        |  1 -
 hw/vfio/spapr.c            |  4 +---
 hw/vfio/meson.build        | 27 ++++++++++++++++-----------
 9 files changed, 28 insertions(+), 22 deletions(-)

-- 
2.47.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH-for-10.0 v3 1/8] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h'
  2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
@ 2025-03-11  8:57 ` Philippe Mathieu-Daudé
  2025-03-11  9:30   ` David Hildenbrand
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 2/8] hw/vfio/spapr: Do not include <linux/kvm.h> Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-11  8:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Cédric Le Goater, Halil Pasic, Philippe Mathieu-Daudé,
	Eric Farman, Peter Xu, Pierrick Bouvier, Eric Auger

Both qemu_minrampagesize() and qemu_maxrampagesize() are
related to host memory backends, having the following call
stack:

  qemu_minrampagesize()
     -> find_min_backend_pagesize()
         -> object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)

  qemu_maxrampagesize()
     -> find_max_backend_pagesize()
        -> object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)

Having TYPE_MEMORY_BACKEND defined in "system/hostmem.h":

  include/system/hostmem.h:23:#define TYPE_MEMORY_BACKEND "memory-backend"

Move their prototype declaration to "system/hostmem.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20250308230917.18907-7-philmd@linaro.org>
---
 include/exec/ram_addr.h    | 3 ---
 include/system/hostmem.h   | 3 +++
 hw/ppc/spapr_caps.c        | 1 +
 hw/s390x/s390-virtio-ccw.c | 1 +
 hw/vfio/spapr.c            | 1 +
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index 3d8df4edf15..e4c28fbec9b 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -102,9 +102,6 @@ static inline unsigned long int ramblock_recv_bitmap_offset(void *host_addr,
 
 bool ramblock_is_pmem(RAMBlock *rb);
 
-long qemu_minrampagesize(void);
-long qemu_maxrampagesize(void);
-
 /**
  * qemu_ram_alloc_from_file,
  * qemu_ram_alloc_from_fd:  Allocate a ram block from the specified backing
diff --git a/include/system/hostmem.h b/include/system/hostmem.h
index 5c21ca55c01..62642e602ca 100644
--- a/include/system/hostmem.h
+++ b/include/system/hostmem.h
@@ -93,4 +93,7 @@ bool host_memory_backend_is_mapped(HostMemoryBackend *backend);
 size_t host_memory_backend_pagesize(HostMemoryBackend *memdev);
 char *host_memory_backend_get_name(HostMemoryBackend *backend);
 
+long qemu_minrampagesize(void);
+long qemu_maxrampagesize(void);
+
 #endif
diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
index 904bff87ce1..9e53d0c1fd1 100644
--- a/hw/ppc/spapr_caps.c
+++ b/hw/ppc/spapr_caps.c
@@ -34,6 +34,7 @@
 #include "kvm_ppc.h"
 #include "migration/vmstate.h"
 #include "system/tcg.h"
+#include "system/hostmem.h"
 
 #include "hw/ppc/spapr.h"
 
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index a9b3db19f63..75b32182eb0 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -41,6 +41,7 @@
 #include "hw/s390x/tod.h"
 #include "system/system.h"
 #include "system/cpus.h"
+#include "system/hostmem.h"
 #include "target/s390x/kvm/pv.h"
 #include "migration/blocker.h"
 #include "qapi/visitor.h"
diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
index ad4c499eafe..237f96dd3fa 100644
--- a/hw/vfio/spapr.c
+++ b/hw/vfio/spapr.c
@@ -15,6 +15,7 @@
 #include <linux/kvm.h>
 #endif
 #include "system/kvm.h"
+#include "system/hostmem.h"
 #include "exec/address-spaces.h"
 
 #include "hw/vfio/vfio-common.h"
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH-for-10.0 v3 2/8] hw/vfio/spapr: Do not include <linux/kvm.h>
  2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 1/8] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h' Philippe Mathieu-Daudé
@ 2025-03-11  8:57 ` Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 3/8] hw/vfio/common: Include missing 'system/tcg.h' header Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-11  8:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Cédric Le Goater, Halil Pasic, Philippe Mathieu-Daudé,
	Eric Farman, Peter Xu, Pierrick Bouvier, Eric Auger

<linux/kvm.h> is already included by "system/kvm.h" in the next line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20250307180337.14811-3-philmd@linaro.org>
---
 hw/vfio/spapr.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
index 237f96dd3fa..1a5d1611f2c 100644
--- a/hw/vfio/spapr.c
+++ b/hw/vfio/spapr.c
@@ -11,9 +11,6 @@
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
 #include <linux/vfio.h>
-#ifdef CONFIG_KVM
-#include <linux/kvm.h>
-#endif
 #include "system/kvm.h"
 #include "system/hostmem.h"
 #include "exec/address-spaces.h"
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH-for-10.0 v3 3/8] hw/vfio/common: Include missing 'system/tcg.h' header
  2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 1/8] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h' Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 2/8] hw/vfio/spapr: Do not include <linux/kvm.h> Philippe Mathieu-Daudé
@ 2025-03-11  8:57 ` Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 4/8] hw/vfio/common: Get target page size using runtime helpers Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-11  8:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Cédric Le Goater, Halil Pasic, Philippe Mathieu-Daudé,
	Eric Farman, Peter Xu, Pierrick Bouvier, Eric Auger

Always include necessary headers explicitly, to avoid
when refactoring unrelated ones:

  hw/vfio/common.c:1176:45: error: implicit declaration of function ‘tcg_enabled’;
   1176 |                                             tcg_enabled() ? DIRTY_CLIENTS_ALL :
        |                                             ^~~~~~~~~~~

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20250307180337.14811-2-philmd@linaro.org>
---
 hw/vfio/common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 7a4010ef4ee..b1596b6bf64 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -42,6 +42,7 @@
 #include "migration/misc.h"
 #include "migration/blocker.h"
 #include "migration/qemu-file.h"
+#include "system/tcg.h"
 #include "system/tpm.h"
 
 VFIODeviceList vfio_device_list =
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH-for-10.0 v3 4/8] hw/vfio/common: Get target page size using runtime helpers
  2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 3/8] hw/vfio/common: Include missing 'system/tcg.h' header Philippe Mathieu-Daudé
@ 2025-03-11  8:57 ` Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 5/8] hw/vfio: Compile some common objects once Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-11  8:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Cédric Le Goater, Halil Pasic, Philippe Mathieu-Daudé,
	Eric Farman, Peter Xu

Prefer runtime helpers to get target page size.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250305153929.43687-3-philmd@linaro.org>
---
 hw/vfio/common.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index b1596b6bf64..1a0d9290f88 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -30,6 +30,7 @@
 #include "exec/address-spaces.h"
 #include "exec/memory.h"
 #include "exec/ram_addr.h"
+#include "exec/target_page.h"
 #include "hw/hw.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
@@ -393,13 +394,14 @@ static void vfio_register_ram_discard_listener(VFIOContainerBase *bcontainer,
                                                MemoryRegionSection *section)
 {
     RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr);
+    int target_page_size = qemu_target_page_size();
     VFIORamDiscardListener *vrdl;
 
     /* Ignore some corner cases not relevant in practice. */
-    g_assert(QEMU_IS_ALIGNED(section->offset_within_region, TARGET_PAGE_SIZE));
+    g_assert(QEMU_IS_ALIGNED(section->offset_within_region, target_page_size));
     g_assert(QEMU_IS_ALIGNED(section->offset_within_address_space,
-                             TARGET_PAGE_SIZE));
-    g_assert(QEMU_IS_ALIGNED(int128_get64(section->size), TARGET_PAGE_SIZE));
+                             target_page_size));
+    g_assert(QEMU_IS_ALIGNED(int128_get64(section->size), target_page_size));
 
     vrdl = g_new0(VFIORamDiscardListener, 1);
     vrdl->bcontainer = bcontainer;
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH-for-10.0 v3 5/8] hw/vfio: Compile some common objects once
  2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 4/8] hw/vfio/common: Get target page size using runtime helpers Philippe Mathieu-Daudé
@ 2025-03-11  8:57 ` Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 6/8] hw/vfio: Compile more " Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-11  8:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Cédric Le Goater, Halil Pasic, Philippe Mathieu-Daudé,
	Eric Farman, Peter Xu, Pierrick Bouvier, Eric Auger

Some files don't rely on any target-specific knowledge
and can be compiled once:

 - helpers.c
 - container-base.c
 - migration.c (removing unnecessary "exec/ram_addr.h")
 - migration-multifd.c
 - cpr.c

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20250308230917.18907-4-philmd@linaro.org>
---
 hw/vfio/migration.c |  1 -
 hw/vfio/meson.build | 13 ++++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 416643ddd69..fbff46cfc35 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -27,7 +27,6 @@
 #include "qapi/error.h"
 #include "qapi/qapi-events-vfio.h"
 #include "exec/ramlist.h"
-#include "exec/ram_addr.h"
 #include "pci.h"
 #include "trace.h"
 #include "hw/hw.h"
diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index 260d65febd6..8e376cfcbf8 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -1,12 +1,7 @@
 vfio_ss = ss.source_set()
 vfio_ss.add(files(
-  'helpers.c',
   'common.c',
-  'container-base.c',
   'container.c',
-  'migration.c',
-  'migration-multifd.c',
-  'cpr.c',
 ))
 vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))
 vfio_ss.add(when: 'CONFIG_IOMMUFD', if_true: files(
@@ -25,3 +20,11 @@ vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
 
 specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
+
+system_ss.add(when: 'CONFIG_VFIO', if_true: files(
+  'helpers.c',
+  'container-base.c',
+  'migration.c',
+  'migration-multifd.c',
+  'cpr.c',
+))
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH-for-10.0 v3 6/8] hw/vfio: Compile more objects once
  2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 5/8] hw/vfio: Compile some common objects once Philippe Mathieu-Daudé
@ 2025-03-11  8:57 ` Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 7/8] hw/vfio: Compile iommufd.c once Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-11  8:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Cédric Le Goater, Halil Pasic, Philippe Mathieu-Daudé,
	Eric Farman, Peter Xu, Pierrick Bouvier, Eric Auger

These files depend on the VFIO symbol in their Kconfig
definition. They don't rely on target specific definitions,
move them to system_ss[] to build them once.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20250308230917.18907-5-philmd@linaro.org>
---
 hw/vfio/meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index 8e376cfcbf8..784eae4b559 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -14,13 +14,13 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
 ))
 vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_PLATFORM', if_true: files('platform.c'))
-vfio_ss.add(when: 'CONFIG_VFIO_XGMAC', if_true: files('calxeda-xgmac.c'))
-vfio_ss.add(when: 'CONFIG_VFIO_AMD_XGBE', if_true: files('amd-xgbe.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
 
 specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
 
+system_ss.add(when: 'CONFIG_VFIO_XGMAC', if_true: files('calxeda-xgmac.c'))
+system_ss.add(when: 'CONFIG_VFIO_AMD_XGBE', if_true: files('amd-xgbe.c'))
 system_ss.add(when: 'CONFIG_VFIO', if_true: files(
   'helpers.c',
   'container-base.c',
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH-for-10.0 v3 7/8] hw/vfio: Compile iommufd.c once
  2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 6/8] hw/vfio: Compile more " Philippe Mathieu-Daudé
@ 2025-03-11  8:57 ` Philippe Mathieu-Daudé
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 8/8] hw/vfio: Compile display.c once Philippe Mathieu-Daudé
  2025-03-11 15:48 ` [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Cédric Le Goater
  8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-11  8:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Cédric Le Goater, Halil Pasic, Philippe Mathieu-Daudé,
	Eric Farman, Peter Xu, Pierrick Bouvier, Eric Auger

Removing unused "exec/ram_addr.h" header allow to compile
iommufd.c once for all targets.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20250308230917.18907-6-philmd@linaro.org>
---
 hw/vfio/iommufd.c   | 1 -
 hw/vfio/meson.build | 6 +++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index df61edffc08..42c8412bbf5 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -25,7 +25,6 @@
 #include "qemu/cutils.h"
 #include "qemu/chardev_open.h"
 #include "pci.h"
-#include "exec/ram_addr.h"
 
 static int iommufd_cdev_map(const VFIOContainerBase *bcontainer, hwaddr iova,
                             ram_addr_t size, void *vaddr, bool readonly)
diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index 784eae4b559..5c9ec7e8971 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -4,9 +4,6 @@ vfio_ss.add(files(
   'container.c',
 ))
 vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))
-vfio_ss.add(when: 'CONFIG_IOMMUFD', if_true: files(
-  'iommufd.c',
-))
 vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
   'display.c',
   'pci-quirks.c',
@@ -28,3 +25,6 @@ system_ss.add(when: 'CONFIG_VFIO', if_true: files(
   'migration-multifd.c',
   'cpr.c',
 ))
+system_ss.add(when: ['CONFIG_VFIO', 'CONFIG_IOMMUFD'], if_true: files(
+  'iommufd.c',
+))
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH-for-10.0 v3 8/8] hw/vfio: Compile display.c once
  2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 7/8] hw/vfio: Compile iommufd.c once Philippe Mathieu-Daudé
@ 2025-03-11  8:57 ` Philippe Mathieu-Daudé
  2025-03-11 15:48 ` [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Cédric Le Goater
  8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-11  8:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Cédric Le Goater, Halil Pasic, Philippe Mathieu-Daudé,
	Eric Farman, Peter Xu, Pierrick Bouvier, Eric Auger

display.c doesn't rely on target specific definitions,
move it to system_ss[] to build it once.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20250308230917.18907-8-philmd@linaro.org>
---
 hw/vfio/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index 5c9ec7e8971..a8939c83865 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -5,7 +5,6 @@ vfio_ss.add(files(
 ))
 vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
-  'display.c',
   'pci-quirks.c',
   'pci.c',
 ))
@@ -28,3 +27,6 @@ system_ss.add(when: 'CONFIG_VFIO', if_true: files(
 system_ss.add(when: ['CONFIG_VFIO', 'CONFIG_IOMMUFD'], if_true: files(
   'iommufd.c',
 ))
+system_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
+  'display.c',
+))
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH-for-10.0 v3 1/8] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h'
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 1/8] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h' Philippe Mathieu-Daudé
@ 2025-03-11  9:30   ` David Hildenbrand
  0 siblings, 0 replies; 11+ messages in thread
From: David Hildenbrand @ 2025-03-11  9:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, qemu-s390x, Ilya Leoshkevich,
	Igor Mammedov, Richard Henderson, Nicholas Piggin,
	Alex Williamson, Daniel Henrique Barboza, Cédric Le Goater,
	Halil Pasic, Eric Farman, Peter Xu, Pierrick Bouvier, Eric Auger

On 11.03.25 09:57, Philippe Mathieu-Daudé wrote:
> Both qemu_minrampagesize() and qemu_maxrampagesize() are
> related to host memory backends, having the following call
> stack:
> 
>    qemu_minrampagesize()
>       -> find_min_backend_pagesize()
>           -> object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)
> 
>    qemu_maxrampagesize()
>       -> find_max_backend_pagesize()
>          -> object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)
> 
> Having TYPE_MEMORY_BACKEND defined in "system/hostmem.h":
> 
>    include/system/hostmem.h:23:#define TYPE_MEMORY_BACKEND "memory-backend"
> 
> Move their prototype declaration to "system/hostmem.h".
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Reviewed-by: Eric Auger <eric.auger@redhat.com>
> Message-Id: <20250308230917.18907-7-philmd@linaro.org>
> ---

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once
  2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2025-03-11  8:57 ` [PATCH-for-10.0 v3 8/8] hw/vfio: Compile display.c once Philippe Mathieu-Daudé
@ 2025-03-11 15:48 ` Cédric Le Goater
  8 siblings, 0 replies; 11+ messages in thread
From: Cédric Le Goater @ 2025-03-11 15:48 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, qemu-ppc, Paolo Bonzini, Harsh Prateek Bora,
	Christian Borntraeger, David Hildenbrand, qemu-s390x,
	Ilya Leoshkevich, Igor Mammedov, Richard Henderson,
	Nicholas Piggin, Alex Williamson, Daniel Henrique Barboza,
	Halil Pasic, Eric Farman, Peter Xu

On 3/11/25 09:57, Philippe Mathieu-Daudé wrote:
> Hi Cédric,
> 
> Here are the VFIO cleanup patches ready enough for 10.0,
> with Richard and Eric comments from v2 addressed.

I dropped the previously applied patches from the v2 series and
applied this v3 in vfio-next instead.

> I'd prefer the rest (of v2) to wait for 10.1.

yes.


Thanks,

C.


  
> Thanks,
> 
> Phil.
> 
> Philippe Mathieu-Daudé (8):
>    system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h'
>    hw/vfio/spapr: Do not include <linux/kvm.h>
>    hw/vfio/common: Include missing 'system/tcg.h' header
>    hw/vfio/common: Get target page size using runtime helpers
>    hw/vfio: Compile some common objects once
>    hw/vfio: Compile more objects once
>    hw/vfio: Compile iommufd.c once
>    hw/vfio: Compile display.c once
> 
>   include/exec/ram_addr.h    |  3 ---
>   include/system/hostmem.h   |  3 +++
>   hw/ppc/spapr_caps.c        |  1 +
>   hw/s390x/s390-virtio-ccw.c |  1 +
>   hw/vfio/common.c           |  9 ++++++---
>   hw/vfio/iommufd.c          |  1 -
>   hw/vfio/migration.c        |  1 -
>   hw/vfio/spapr.c            |  4 +---
>   hw/vfio/meson.build        | 27 ++++++++++++++++-----------
>   9 files changed, 28 insertions(+), 22 deletions(-)
> 



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-03-11 15:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-11  8:57 [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Philippe Mathieu-Daudé
2025-03-11  8:57 ` [PATCH-for-10.0 v3 1/8] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h' Philippe Mathieu-Daudé
2025-03-11  9:30   ` David Hildenbrand
2025-03-11  8:57 ` [PATCH-for-10.0 v3 2/8] hw/vfio/spapr: Do not include <linux/kvm.h> Philippe Mathieu-Daudé
2025-03-11  8:57 ` [PATCH-for-10.0 v3 3/8] hw/vfio/common: Include missing 'system/tcg.h' header Philippe Mathieu-Daudé
2025-03-11  8:57 ` [PATCH-for-10.0 v3 4/8] hw/vfio/common: Get target page size using runtime helpers Philippe Mathieu-Daudé
2025-03-11  8:57 ` [PATCH-for-10.0 v3 5/8] hw/vfio: Compile some common objects once Philippe Mathieu-Daudé
2025-03-11  8:57 ` [PATCH-for-10.0 v3 6/8] hw/vfio: Compile more " Philippe Mathieu-Daudé
2025-03-11  8:57 ` [PATCH-for-10.0 v3 7/8] hw/vfio: Compile iommufd.c once Philippe Mathieu-Daudé
2025-03-11  8:57 ` [PATCH-for-10.0 v3 8/8] hw/vfio: Compile display.c once Philippe Mathieu-Daudé
2025-03-11 15:48 ` [PATCH-for-10.0 v3 0/8] hw/vfio: Build various objects once Cédric Le Goater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).