* [PATCH 0/6] single-binary: hw/virtio
@ 2026-01-31 2:00 Pierrick Bouvier
2026-01-31 2:00 ` [PATCH 1/6] target-info: add target_base_ppc, target_ppc and target_ppc64 Pierrick Bouvier
` (5 more replies)
0 siblings, 6 replies; 26+ messages in thread
From: Pierrick Bouvier @ 2026-01-31 2:00 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, Pierrick Bouvier, Philippe Mathieu-Daudé,
Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin,
Nicholas Piggin
This series eliminates target specifics in hw/virtio and replace them with
runtime functions where needed.
Pierrick Bouvier (6):
target-info: add target_base_ppc, target_ppc and target_ppc64
include/hw/virtio/virtio-access.h: remove target specifics define
include/hw/ppc/spapr: extract SPAPR_MAX_RAM_SLOTS in a new header
hw/virtio/vhost-user: make compilation unit common
hw/virtio/virtio-qmp: make compilation unit common
hw/virtio/: make all compilation units common
include/hw/ppc/spapr.h | 8 +---
include/hw/ppc/spapr_common.h | 16 +++++++
include/hw/virtio/virtio-access.h | 26 ++++++------
include/qemu/target-info.h | 21 ++++++++++
hw/virtio/vhost-user.c | 11 ++---
hw/virtio/virtio-qmp.c | 70 -------------------------------
target-info.c | 21 ++++++++++
hw/virtio/meson.build | 17 ++++----
8 files changed, 83 insertions(+), 107 deletions(-)
create mode 100644 include/hw/ppc/spapr_common.h
--
2.47.3
^ permalink raw reply [flat|nested] 26+ messages in thread* [PATCH 1/6] target-info: add target_base_ppc, target_ppc and target_ppc64 2026-01-31 2:00 [PATCH 0/6] single-binary: hw/virtio Pierrick Bouvier @ 2026-01-31 2:00 ` Pierrick Bouvier 2026-02-01 22:28 ` Philippe Mathieu-Daudé 2026-01-31 2:00 ` [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define Pierrick Bouvier ` (4 subsequent siblings) 5 siblings, 1 reply; 26+ messages in thread From: Pierrick Bouvier @ 2026-01-31 2:00 UTC (permalink / raw) To: qemu-devel Cc: qemu-ppc, Pierrick Bouvier, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> --- include/qemu/target-info.h | 21 +++++++++++++++++++++ target-info.c | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index 62359622232..e3287334304 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -71,4 +71,25 @@ bool target_arm(void); */ bool target_aarch64(void); +/** + * target_base_ppc: + * + * Returns whether the target architecture is PowerPC 32-bit or 64-bit. + */ +bool target_base_ppc(void); + +/** + * target_ppc: + * + * Returns whether the target architecture is PowerPC 32-bit. + */ +bool target_ppc(void); + +/** + * target_ppc64: + * + * Returns whether the target architecture is PowerPC 64-bit. + */ +bool target_ppc64(void); + #endif diff --git a/target-info.c b/target-info.c index 24696ff4111..5a6d7282524 100644 --- a/target-info.c +++ b/target-info.c @@ -73,3 +73,24 @@ bool target_aarch64(void) { return target_arch() == SYS_EMU_TARGET_AARCH64; } + +bool target_base_ppc(void) +{ + switch (target_arch()) { + case SYS_EMU_TARGET_PPC: + case SYS_EMU_TARGET_PPC64: + return true; + default: + return false; + } +} + +bool target_ppc(void) +{ + return target_arch() == SYS_EMU_TARGET_PPC; +} + +bool target_ppc64(void) +{ + return target_arch() == SYS_EMU_TARGET_PPC64; +} -- 2.47.3 ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 1/6] target-info: add target_base_ppc, target_ppc and target_ppc64 2026-01-31 2:00 ` [PATCH 1/6] target-info: add target_base_ppc, target_ppc and target_ppc64 Pierrick Bouvier @ 2026-02-01 22:28 ` Philippe Mathieu-Daudé 2026-02-01 23:11 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 22:28 UTC (permalink / raw) To: Pierrick Bouvier, qemu-devel Cc: qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin On 31/1/26 03:00, Pierrick Bouvier wrote: > Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > --- > include/qemu/target-info.h | 21 +++++++++++++++++++++ > target-info.c | 21 +++++++++++++++++++++ > 2 files changed, 42 insertions(+) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 1/6] target-info: add target_base_ppc, target_ppc and target_ppc64 2026-02-01 22:28 ` Philippe Mathieu-Daudé @ 2026-02-01 23:11 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 23:11 UTC (permalink / raw) To: Pierrick Bouvier, qemu-devel Cc: qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin On 1/2/26 23:28, Philippe Mathieu-Daudé wrote: > On 31/1/26 03:00, Pierrick Bouvier wrote: >> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> >> --- >> include/qemu/target-info.h | 21 +++++++++++++++++++++ >> target-info.c | 21 +++++++++++++++++++++ >> 2 files changed, 42 insertions(+) > > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> ^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-01-31 2:00 [PATCH 0/6] single-binary: hw/virtio Pierrick Bouvier 2026-01-31 2:00 ` [PATCH 1/6] target-info: add target_base_ppc, target_ppc and target_ppc64 Pierrick Bouvier @ 2026-01-31 2:00 ` Pierrick Bouvier 2026-01-31 17:48 ` Michael S. Tsirkin 2026-01-31 2:00 ` [PATCH 3/6] include/hw/ppc/spapr: extract SPAPR_MAX_RAM_SLOTS in a new header Pierrick Bouvier ` (3 subsequent siblings) 5 siblings, 1 reply; 26+ messages in thread From: Pierrick Bouvier @ 2026-01-31 2:00 UTC (permalink / raw) To: qemu-devel Cc: qemu-ppc, Pierrick Bouvier, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> --- include/hw/virtio/virtio-access.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h index cd17d0c87eb..51d9d725690 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -17,27 +17,27 @@ #define QEMU_VIRTIO_ACCESS_H #include "exec/hwaddr.h" +#include "qemu/target-info.h" #include "system/memory_cached.h" #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-bus.h" -#if defined(TARGET_PPC64) || defined(TARGET_ARM) -#define LEGACY_VIRTIO_IS_BIENDIAN 1 -#endif - static inline bool virtio_access_is_big_endian(VirtIODevice *vdev) { -#if defined(LEGACY_VIRTIO_IS_BIENDIAN) - return virtio_is_big_endian(vdev); -#elif TARGET_BIG_ENDIAN - if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { - /* Devices conforming to VIRTIO 1.0 or later are always LE. */ - return false; + if (target_ppc64() || target_base_arm()) { + return virtio_is_big_endian(vdev); } - return true; -#else + + if (target_big_endian()) { + if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { + /* Devices conforming to VIRTIO 1.0 or later are always LE. */ + return false; + } else { + return true; + } + } + return false; -#endif } static inline void virtio_stw_p(VirtIODevice *vdev, void *ptr, uint16_t v) -- 2.47.3 ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-01-31 2:00 ` [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define Pierrick Bouvier @ 2026-01-31 17:48 ` Michael S. Tsirkin 2026-02-01 22:36 ` Philippe Mathieu-Daudé 2026-02-02 1:24 ` Pierrick Bouvier 0 siblings, 2 replies; 26+ messages in thread From: Michael S. Tsirkin @ 2026-01-31 17:48 UTC (permalink / raw) To: Pierrick Bouvier Cc: qemu-devel, qemu-ppc, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: > Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Performance impact? the reason we have these is for performance ... > --- > include/hw/virtio/virtio-access.h | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) > > diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h > index cd17d0c87eb..51d9d725690 100644 > --- a/include/hw/virtio/virtio-access.h > +++ b/include/hw/virtio/virtio-access.h > @@ -17,27 +17,27 @@ > #define QEMU_VIRTIO_ACCESS_H > > #include "exec/hwaddr.h" > +#include "qemu/target-info.h" > #include "system/memory_cached.h" > #include "hw/virtio/virtio.h" > #include "hw/virtio/virtio-bus.h" > > -#if defined(TARGET_PPC64) || defined(TARGET_ARM) > -#define LEGACY_VIRTIO_IS_BIENDIAN 1 > -#endif > - > static inline bool virtio_access_is_big_endian(VirtIODevice *vdev) > { > -#if defined(LEGACY_VIRTIO_IS_BIENDIAN) > - return virtio_is_big_endian(vdev); > -#elif TARGET_BIG_ENDIAN > - if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { > - /* Devices conforming to VIRTIO 1.0 or later are always LE. */ > - return false; > + if (target_ppc64() || target_base_arm()) { > + return virtio_is_big_endian(vdev); > } > - return true; > -#else > + > + if (target_big_endian()) { > + if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { > + /* Devices conforming to VIRTIO 1.0 or later are always LE. */ > + return false; > + } else { > + return true; > + } > + } > + > return false; > -#endif > } > > static inline void virtio_stw_p(VirtIODevice *vdev, void *ptr, uint16_t v) > -- > 2.47.3 ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-01-31 17:48 ` Michael S. Tsirkin @ 2026-02-01 22:36 ` Philippe Mathieu-Daudé 2026-02-01 22:41 ` Philippe Mathieu-Daudé 2026-02-02 7:40 ` Michael S. Tsirkin 2026-02-02 1:24 ` Pierrick Bouvier 1 sibling, 2 replies; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 22:36 UTC (permalink / raw) To: Michael S. Tsirkin, Pierrick Bouvier Cc: qemu-devel, qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin On 31/1/26 18:48, Michael S. Tsirkin wrote: > On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: >> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > > Performance impact? > > the reason we have these is for performance ... If this is a worry, we can declare the virtio LD/ST helpers in VirtIODevice and set them in virtio_reset(); the call chain will be even simpler than doing that check on every calls. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-02-01 22:36 ` Philippe Mathieu-Daudé @ 2026-02-01 22:41 ` Philippe Mathieu-Daudé 2026-02-01 23:20 ` Philippe Mathieu-Daudé 2026-02-02 7:40 ` Michael S. Tsirkin 1 sibling, 1 reply; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 22:41 UTC (permalink / raw) To: Michael S. Tsirkin, Pierrick Bouvier Cc: qemu-devel, qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin On 1/2/26 23:36, Philippe Mathieu-Daudé wrote: > On 31/1/26 18:48, Michael S. Tsirkin wrote: >> On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: >>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> >> >> Performance impact? >> >> the reason we have these is for performance ... > > If this is a worry, we can declare the virtio LD/ST helpers in > VirtIODevice and set them in virtio_reset(); the call chain will > be even simpler than doing that check on every calls. Or just have a VirtIODevice::access_is_big_endian boolean field (re)initialized in virtio_reset(), and drop this virtio_access_is_big_endian() method. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-02-01 22:41 ` Philippe Mathieu-Daudé @ 2026-02-01 23:20 ` Philippe Mathieu-Daudé 2026-02-02 1:25 ` Pierrick Bouvier 0 siblings, 1 reply; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 23:20 UTC (permalink / raw) To: Michael S. Tsirkin, Pierrick Bouvier Cc: qemu-devel, qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin On 1/2/26 23:41, Philippe Mathieu-Daudé wrote: > On 1/2/26 23:36, Philippe Mathieu-Daudé wrote: >> On 31/1/26 18:48, Michael S. Tsirkin wrote: >>> On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: >>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> >>> >>> Performance impact? >>> >>> the reason we have these is for performance ... >> >> If this is a worry, we can declare the virtio LD/ST helpers in >> VirtIODevice and set them in virtio_reset(); the call chain will >> be even simpler than doing that check on every calls. > > Or just have a VirtIODevice::access_is_big_endian boolean > field (re)initialized in virtio_reset(), and drop this > virtio_access_is_big_endian() method. Implemented as v2: https://lore.kernel.org/qemu-devel/20260201231959.88559-1-philmd@linaro.org/ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-02-01 23:20 ` Philippe Mathieu-Daudé @ 2026-02-02 1:25 ` Pierrick Bouvier 0 siblings, 0 replies; 26+ messages in thread From: Pierrick Bouvier @ 2026-02-02 1:25 UTC (permalink / raw) To: Philippe Mathieu-Daudé, Michael S. Tsirkin Cc: qemu-devel, qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin On 2/1/26 3:20 PM, Philippe Mathieu-Daudé wrote: > On 1/2/26 23:41, Philippe Mathieu-Daudé wrote: >> On 1/2/26 23:36, Philippe Mathieu-Daudé wrote: >>> On 31/1/26 18:48, Michael S. Tsirkin wrote: >>>> On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: >>>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> >>>> >>>> Performance impact? >>>> >>>> the reason we have these is for performance ... >>> >>> If this is a worry, we can declare the virtio LD/ST helpers in >>> VirtIODevice and set them in virtio_reset(); the call chain will >>> be even simpler than doing that check on every calls. >> >> Or just have a VirtIODevice::access_is_big_endian boolean >> field (re)initialized in virtio_reset(), and drop this >> virtio_access_is_big_endian() method. > > Implemented as v2: > https://lore.kernel.org/qemu-devel/20260201231959.88559-1-philmd@linaro.org/ Let's go one step at a time. The refactoring you propose is worth investigating, but the current approach can be done first and effective now. Regards, Pierrick ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-02-01 22:36 ` Philippe Mathieu-Daudé 2026-02-01 22:41 ` Philippe Mathieu-Daudé @ 2026-02-02 7:40 ` Michael S. Tsirkin 2026-02-02 11:03 ` Philippe Mathieu-Daudé 1 sibling, 1 reply; 26+ messages in thread From: Michael S. Tsirkin @ 2026-02-02 7:40 UTC (permalink / raw) To: Philippe Mathieu-Daudé Cc: Pierrick Bouvier, qemu-devel, qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin On Sun, Feb 01, 2026 at 11:36:04PM +0100, Philippe Mathieu-Daudé wrote: > On 31/1/26 18:48, Michael S. Tsirkin wrote: > > On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: > > > Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > > > > Performance impact? > > > > the reason we have these is for performance ... > > If this is a worry, we can declare the virtio LD/ST helpers in > VirtIODevice and set them in virtio_reset(); the call chain will > be even simpler than doing that check on every calls. Would make them indirect calls though, no? So I suspect the performance of this needs to be tested, anyway. -- MST ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-02-02 7:40 ` Michael S. Tsirkin @ 2026-02-02 11:03 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-02 11:03 UTC (permalink / raw) To: Michael S. Tsirkin Cc: Pierrick Bouvier, qemu-devel, qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin On 2/2/26 08:40, Michael S. Tsirkin wrote: > On Sun, Feb 01, 2026 at 11:36:04PM +0100, Philippe Mathieu-Daudé wrote: >> On 31/1/26 18:48, Michael S. Tsirkin wrote: >>> On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: >>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> >>> >>> Performance impact? >>> >>> the reason we have these is for performance ... >> >> If this is a worry, we can declare the virtio LD/ST helpers in >> VirtIODevice and set them in virtio_reset(); the call chain will >> be even simpler than doing that check on every calls. > > Would make them indirect calls though, no? Currently I count 3 indirect calls; such approach would have only 1. Anyway I posted a v3 which should be even better. > > So I suspect the performance of this needs to be tested, anyway. > ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-01-31 17:48 ` Michael S. Tsirkin 2026-02-01 22:36 ` Philippe Mathieu-Daudé @ 2026-02-02 1:24 ` Pierrick Bouvier 2026-02-02 7:50 ` Michael S. Tsirkin 1 sibling, 1 reply; 26+ messages in thread From: Pierrick Bouvier @ 2026-02-02 1:24 UTC (permalink / raw) To: Michael S. Tsirkin Cc: qemu-devel, qemu-ppc, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin On 1/31/26 9:48 AM, Michael S. Tsirkin wrote: > On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: >> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > > Performance impact? > > the reason we have these is for performance ... > I would be very happy to run any benchmark that you might judge critical. Should we run a disk read/write sequence with a virtio disk, or a download with a virtio interface? Any other idea? Regards, Pierrick ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-02-02 1:24 ` Pierrick Bouvier @ 2026-02-02 7:50 ` Michael S. Tsirkin 2026-02-02 18:00 ` Stefan Hajnoczi 0 siblings, 1 reply; 26+ messages in thread From: Michael S. Tsirkin @ 2026-02-02 7:50 UTC (permalink / raw) To: Pierrick Bouvier Cc: qemu-devel, qemu-ppc, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin, Stefan Hajnoczi On Sun, Feb 01, 2026 at 05:24:03PM -0800, Pierrick Bouvier wrote: > On 1/31/26 9:48 AM, Michael S. Tsirkin wrote: > > On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: > > > Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > > > > Performance impact? > > > > the reason we have these is for performance ... > > > > I would be very happy to run any benchmark that you might judge critical. > > Should we run a disk read/write sequence with a virtio disk, or a download > with a virtio interface? Any other idea? block for sure, people who care about network perf go the vhost or vhost user path. So I CC'd Stefan Hajnoczi. Stefan do you feel this needs a test and what kind of test do you suggest as the most representative of I/O overhead? > > Regards, > Pierrick ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-02-02 7:50 ` Michael S. Tsirkin @ 2026-02-02 18:00 ` Stefan Hajnoczi 2026-02-02 19:12 ` Pierrick Bouvier 0 siblings, 1 reply; 26+ messages in thread From: Stefan Hajnoczi @ 2026-02-02 18:00 UTC (permalink / raw) To: Michael S. Tsirkin Cc: Pierrick Bouvier, qemu-devel, qemu-ppc, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin [-- Attachment #1: Type: text/plain, Size: 1877 bytes --] On Mon, Feb 02, 2026 at 02:50:28AM -0500, Michael S. Tsirkin wrote: > On Sun, Feb 01, 2026 at 05:24:03PM -0800, Pierrick Bouvier wrote: > > On 1/31/26 9:48 AM, Michael S. Tsirkin wrote: > > > On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: > > > > Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > > > > > > Performance impact? > > > > > > the reason we have these is for performance ... > > > > > > > I would be very happy to run any benchmark that you might judge critical. > > > > Should we run a disk read/write sequence with a virtio disk, or a download > > with a virtio interface? Any other idea? > > block for sure, people who care about network perf go the vhost or > vhost user path. > > So I CC'd Stefan Hajnoczi. Stefan do you feel this needs a test and what > kind of test do you suggest as the most representative of I/O overhead? This command-line lets you benchmark virtio-blk without actual I/O slowing down the request processing: qemu-system-x86_64 \ -M accel=kvm \ -cpu host \ -m 4G \ --blockdev file,node-name=drive0,filename=boot.img,cache.direct=on,aio=native \ --blockdev null-co,node-name=drive1,size=$((10 * 1024 * 1024 * 1024)) \ --object iothread,id=iothread0 \ --device virtio-blk-pci,drive=drive0,iothread=iothread0 \ --device virtio-blk-pci,drive=drive1,iothread=iothread0 Here is a fio command-line for 4 KiB random reads: fio \ --ioengine=libaio \ --direct=1 \ --runtime=30 \ --ramp_time=10 \ --rw=randread \ --bs=4k \ --iodepth=128 \ --filename=/dev/vdb \ --name=randread This is just a single vCPU, but it should be enough to see if there is any difference in I/O Operations Per Second (IOPS) or efficiency (IOPS/CPU utilization). Stefan [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define 2026-02-02 18:00 ` Stefan Hajnoczi @ 2026-02-02 19:12 ` Pierrick Bouvier 0 siblings, 0 replies; 26+ messages in thread From: Pierrick Bouvier @ 2026-02-02 19:12 UTC (permalink / raw) To: Stefan Hajnoczi, Michael S. Tsirkin Cc: qemu-devel, qemu-ppc, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Nicholas Piggin On 2/2/26 10:00 AM, Stefan Hajnoczi wrote: > On Mon, Feb 02, 2026 at 02:50:28AM -0500, Michael S. Tsirkin wrote: >> On Sun, Feb 01, 2026 at 05:24:03PM -0800, Pierrick Bouvier wrote: >>> On 1/31/26 9:48 AM, Michael S. Tsirkin wrote: >>>> On Fri, Jan 30, 2026 at 06:00:56PM -0800, Pierrick Bouvier wrote: >>>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> >>>> >>>> Performance impact? >>>> >>>> the reason we have these is for performance ... >>>> >>> >>> I would be very happy to run any benchmark that you might judge critical. >>> >>> Should we run a disk read/write sequence with a virtio disk, or a download >>> with a virtio interface? Any other idea? >> >> block for sure, people who care about network perf go the vhost or >> vhost user path. >> >> So I CC'd Stefan Hajnoczi. Stefan do you feel this needs a test and what >> kind of test do you suggest as the most representative of I/O overhead? > > This command-line lets you benchmark virtio-blk without actual I/O > slowing down the request processing: > > qemu-system-x86_64 \ > -M accel=kvm \ > -cpu host \ > -m 4G \ > --blockdev file,node-name=drive0,filename=boot.img,cache.direct=on,aio=native \ > --blockdev null-co,node-name=drive1,size=$((10 * 1024 * 1024 * 1024)) \ > --object iothread,id=iothread0 \ > --device virtio-blk-pci,drive=drive0,iothread=iothread0 \ > --device virtio-blk-pci,drive=drive1,iothread=iothread0 > > Here is a fio command-line for 4 KiB random reads: > > fio \ > --ioengine=libaio \ > --direct=1 \ > --runtime=30 \ > --ramp_time=10 \ > --rw=randread \ > --bs=4k \ > --iodepth=128 \ > --filename=/dev/vdb \ > --name=randread > > This is just a single vCPU, but it should be enough to see if there is > any difference in I/O Operations Per Second (IOPS) or efficiency > (IOPS/CPU utilization). > > Stefan I'll reply on v3 to keep conversation there. Thanks, Pierrick ^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 3/6] include/hw/ppc/spapr: extract SPAPR_MAX_RAM_SLOTS in a new header 2026-01-31 2:00 [PATCH 0/6] single-binary: hw/virtio Pierrick Bouvier 2026-01-31 2:00 ` [PATCH 1/6] target-info: add target_base_ppc, target_ppc and target_ppc64 Pierrick Bouvier 2026-01-31 2:00 ` [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define Pierrick Bouvier @ 2026-01-31 2:00 ` Pierrick Bouvier 2026-02-01 22:26 ` Philippe Mathieu-Daudé 2026-01-31 2:00 ` [PATCH 4/6] hw/virtio/vhost-user: make compilation unit common Pierrick Bouvier ` (2 subsequent siblings) 5 siblings, 1 reply; 26+ messages in thread From: Pierrick Bouvier @ 2026-01-31 2:00 UTC (permalink / raw) To: qemu-devel Cc: qemu-ppc, Pierrick Bouvier, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin Allow to include it from common code (vhost-user, in next commit), else it pulls ppc/cpu.h which has target specifics. Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> --- include/hw/ppc/spapr.h | 8 +------- include/hw/ppc/spapr_common.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 include/hw/ppc/spapr_common.h diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 5476ac7ce7b..b022f8dd25d 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -4,6 +4,7 @@ #include "qemu/units.h" #include "system/dma.h" #include "hw/core/boards.h" +#include "hw/ppc/spapr_common.h" #include "hw/ppc/spapr_drc.h" #include "hw/mem/pc-dimm.h" #include "hw/ppc/spapr_ovec.h" @@ -946,13 +947,6 @@ int spapr_rtc_import_offset(SpaprRtcState *rtc, int64_t legacy_offset); #define SPAPR_MEMORY_BLOCK_SIZE ((hwaddr)1 << 28) /* 256MB */ -/* - * This defines the maximum number of DIMM slots we can have for sPAPR - * guest. This is not defined by sPAPR but we are defining it to 32 slots - * based on default number of slots provided by PowerPC kernel. - */ -#define SPAPR_MAX_RAM_SLOTS 32 - /* 1GB alignment for hotplug memory region */ #define SPAPR_DEVICE_MEM_ALIGN (1 * GiB) diff --git a/include/hw/ppc/spapr_common.h b/include/hw/ppc/spapr_common.h new file mode 100644 index 00000000000..d799927ff5c --- /dev/null +++ b/include/hw/ppc/spapr_common.h @@ -0,0 +1,16 @@ +/* + * Common definitions for PPC SPAPR + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef HW_SPAPR_COMMON_H +#define HW_SPAPR_COMMON_H + +/* + * This defines the maximum number of DIMM slots we can have for sPAPR + * guest. This is not defined by sPAPR but we are defining it to 32 slots + * based on default number of slots provided by PowerPC kernel. + */ +#define SPAPR_MAX_RAM_SLOTS 32 + +#endif /* HW_SPAPR_COMMON_H */ -- 2.47.3 ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 3/6] include/hw/ppc/spapr: extract SPAPR_MAX_RAM_SLOTS in a new header 2026-01-31 2:00 ` [PATCH 3/6] include/hw/ppc/spapr: extract SPAPR_MAX_RAM_SLOTS in a new header Pierrick Bouvier @ 2026-02-01 22:26 ` Philippe Mathieu-Daudé 2026-02-01 23:11 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 22:26 UTC (permalink / raw) To: Pierrick Bouvier, qemu-devel Cc: qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin On 31/1/26 03:00, Pierrick Bouvier wrote: > Allow to include it from common code (vhost-user, in next commit), else > it pulls ppc/cpu.h which has target specifics. > > Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > --- > include/hw/ppc/spapr.h | 8 +------- > include/hw/ppc/spapr_common.h | 16 ++++++++++++++++ > 2 files changed, 17 insertions(+), 7 deletions(-) > create mode 100644 include/hw/ppc/spapr_common.h Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 3/6] include/hw/ppc/spapr: extract SPAPR_MAX_RAM_SLOTS in a new header 2026-02-01 22:26 ` Philippe Mathieu-Daudé @ 2026-02-01 23:11 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 23:11 UTC (permalink / raw) To: Pierrick Bouvier, qemu-devel Cc: qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin On 1/2/26 23:26, Philippe Mathieu-Daudé wrote: > On 31/1/26 03:00, Pierrick Bouvier wrote: >> Allow to include it from common code (vhost-user, in next commit), else >> it pulls ppc/cpu.h which has target specifics. >> >> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> >> --- >> include/hw/ppc/spapr.h | 8 +------- >> include/hw/ppc/spapr_common.h | 16 ++++++++++++++++ >> 2 files changed, 17 insertions(+), 7 deletions(-) >> create mode 100644 include/hw/ppc/spapr_common.h > > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> ^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 4/6] hw/virtio/vhost-user: make compilation unit common 2026-01-31 2:00 [PATCH 0/6] single-binary: hw/virtio Pierrick Bouvier ` (2 preceding siblings ...) 2026-01-31 2:00 ` [PATCH 3/6] include/hw/ppc/spapr: extract SPAPR_MAX_RAM_SLOTS in a new header Pierrick Bouvier @ 2026-01-31 2:00 ` Pierrick Bouvier 2026-02-01 23:11 ` Philippe Mathieu-Daudé 2026-01-31 2:00 ` [PATCH 5/6] hw/virtio/virtio-qmp: " Pierrick Bouvier 2026-01-31 2:01 ` [PATCH 6/6] hw/virtio/: make all compilation units common Pierrick Bouvier 5 siblings, 1 reply; 26+ messages in thread From: Pierrick Bouvier @ 2026-01-31 2:00 UTC (permalink / raw) To: qemu-devel Cc: qemu-ppc, Pierrick Bouvier, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin PPC architectures use a custom value for VHOST_USER_MAX_RAM_SLOTS (32 instead of 512). vhost_user struct and several functions use VHOST_USER_MAX_RAM_SLOTS to define stack allocated buffers. To avoid changing all functions to use heap allocated buffers, we keep this max, and simply add a target_base_ppc() conditional for the single place where size really matters. Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> --- hw/virtio/vhost-user.c | 11 ++++------- hw/virtio/meson.build | 3 +-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 63fa9a1b4b1..c8a004c6d2d 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -44,13 +44,8 @@ #define VHOST_USER_F_PROTOCOL_FEATURES 30 #define VHOST_USER_BACKEND_MAX_FDS 8 -#if defined(TARGET_PPC) || defined(TARGET_PPC64) -#include "hw/ppc/spapr.h" -#define VHOST_USER_MAX_RAM_SLOTS SPAPR_MAX_RAM_SLOTS - -#else +#include "hw/ppc/spapr_common.h" #define VHOST_USER_MAX_RAM_SLOTS 512 -#endif /* * Maximum size of virtio device config space @@ -2280,7 +2275,9 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque, return -EINVAL; } - u->user->memory_slots = MIN(ram_slots, VHOST_USER_MAX_RAM_SLOTS); + const uint64_t vhost_user_max_ram_slots = target_base_ppc() ? + SPAPR_MAX_RAM_SLOTS : VHOST_USER_MAX_RAM_SLOTS; + u->user->memory_slots = MIN(ram_slots, vhost_user_max_ram_slots); } } diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index affd66887db..ee397aaf196 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -17,8 +17,7 @@ if have_vhost system_virtio_ss.add(files('vhost.c')) system_virtio_ss.add(files('vhost-backend.c', 'vhost-iova-tree.c')) if have_vhost_user - # fixme - this really should be generic - specific_virtio_ss.add(files('vhost-user.c')) + system_virtio_ss.add(files('vhost-user.c')) system_virtio_ss.add(files('vhost-user-base.c')) # MMIO Stubs -- 2.47.3 ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 4/6] hw/virtio/vhost-user: make compilation unit common 2026-01-31 2:00 ` [PATCH 4/6] hw/virtio/vhost-user: make compilation unit common Pierrick Bouvier @ 2026-02-01 23:11 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 23:11 UTC (permalink / raw) To: Pierrick Bouvier, qemu-devel Cc: qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin On 31/1/26 03:00, Pierrick Bouvier wrote: > PPC architectures use a custom value for VHOST_USER_MAX_RAM_SLOTS (32 > instead of 512). > > vhost_user struct and several functions use VHOST_USER_MAX_RAM_SLOTS to > define stack allocated buffers. To avoid changing all functions to use > heap allocated buffers, we keep this max, and simply add a > target_base_ppc() conditional for the single place where size really > matters. > > Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > --- > hw/virtio/vhost-user.c | 11 ++++------- > hw/virtio/meson.build | 3 +-- > 2 files changed, 5 insertions(+), 9 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> ^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 5/6] hw/virtio/virtio-qmp: make compilation unit common 2026-01-31 2:00 [PATCH 0/6] single-binary: hw/virtio Pierrick Bouvier ` (3 preceding siblings ...) 2026-01-31 2:00 ` [PATCH 4/6] hw/virtio/vhost-user: make compilation unit common Pierrick Bouvier @ 2026-01-31 2:00 ` Pierrick Bouvier 2026-02-01 23:11 ` Philippe Mathieu-Daudé 2026-01-31 2:01 ` [PATCH 6/6] hw/virtio/: make all compilation units common Pierrick Bouvier 5 siblings, 1 reply; 26+ messages in thread From: Pierrick Bouvier @ 2026-01-31 2:00 UTC (permalink / raw) To: qemu-devel Cc: qemu-ppc, Pierrick Bouvier, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin All compile time conditionals have no impact at runtime, since they are representing only possible features for devices present at runtime. In case they are not present, associated features table will never be used. In case they are present but some features are not, matching bits will never be enabled, so those entries will be unused. Thus, simply expose everything and call it a day. Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> --- hw/virtio/virtio-qmp.c | 70 ------------------------------------------ hw/virtio/meson.build | 2 +- 2 files changed, 1 insertion(+), 71 deletions(-) diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c index 968299fda0c..f9cdca50d99 100644 --- a/hw/virtio/virtio-qmp.c +++ b/hw/virtio/virtio-qmp.c @@ -33,21 +33,17 @@ #include "standard-headers/linux/virtio_vsock.h" #include "standard-headers/linux/virtio_gpio.h" -#include CONFIG_DEVICES - #define FEATURE_ENTRY(name, desc) (qmp_virtio_feature_map_t) \ { .virtio_bit = name, .feature_desc = desc } /* Virtio transport features mapping */ static const qmp_virtio_feature_map_t virtio_transport_map[] = { /* Virtio device transport features */ -#ifndef VIRTIO_CONFIG_NO_LEGACY FEATURE_ENTRY(VIRTIO_F_NOTIFY_ON_EMPTY, \ "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. " "descs. on VQ"), FEATURE_ENTRY(VIRTIO_F_ANY_LAYOUT, \ "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts"), -#endif /* !VIRTIO_CONFIG_NO_LEGACY */ FEATURE_ENTRY(VIRTIO_F_VERSION_1, \ "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"), FEATURE_ENTRY(VIRTIO_F_IOMMU_PLATFORM, \ @@ -149,7 +145,6 @@ static const qmp_virtio_feature_map_t virtio_config_status_map[] = { }; /* virtio-blk features mapping */ -#ifdef CONFIG_VIRTIO_BLK static const qmp_virtio_feature_map_t virtio_blk_feature_map[] = { FEATURE_ENTRY(VIRTIO_BLK_F_SIZE_MAX, \ "VIRTIO_BLK_F_SIZE_MAX: Max segment size is size_max"), @@ -173,7 +168,6 @@ static const qmp_virtio_feature_map_t virtio_blk_feature_map[] = { "VIRTIO_BLK_F_SECURE_ERASE: Secure erase supported"), FEATURE_ENTRY(VIRTIO_BLK_F_ZONED, \ "VIRTIO_BLK_F_ZONED: Zoned block devices"), -#ifndef VIRTIO_BLK_NO_LEGACY FEATURE_ENTRY(VIRTIO_BLK_F_BARRIER, \ "VIRTIO_BLK_F_BARRIER: Request barriers supported"), FEATURE_ENTRY(VIRTIO_BLK_F_SCSI, \ @@ -183,7 +177,6 @@ static const qmp_virtio_feature_map_t virtio_blk_feature_map[] = { FEATURE_ENTRY(VIRTIO_BLK_F_CONFIG_WCE, \ "VIRTIO_BLK_F_CONFIG_WCE: Cache writeback and writethrough modes " "supported"), -#endif /* !VIRTIO_BLK_NO_LEGACY */ FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ @@ -191,10 +184,8 @@ static const qmp_virtio_feature_map_t virtio_blk_feature_map[] = { "negotiation supported"), { -1, "" } }; -#endif /* virtio-serial features mapping */ -#ifdef CONFIG_VIRTIO_SERIAL static const qmp_virtio_feature_map_t virtio_serial_feature_map[] = { FEATURE_ENTRY(VIRTIO_CONSOLE_F_SIZE, \ "VIRTIO_CONSOLE_F_SIZE: Host providing console size"), @@ -204,10 +195,8 @@ static const qmp_virtio_feature_map_t virtio_serial_feature_map[] = { "VIRTIO_CONSOLE_F_EMERG_WRITE: Emergency write supported"), { -1, "" } }; -#endif /* virtio-gpu features mapping */ -#ifdef CONFIG_VIRTIO_GPU static const qmp_virtio_feature_map_t virtio_gpu_feature_map[] = { FEATURE_ENTRY(VIRTIO_GPU_F_VIRGL, \ "VIRTIO_GPU_F_VIRGL: Virgl 3D mode supported"), @@ -227,10 +216,8 @@ static const qmp_virtio_feature_map_t virtio_gpu_feature_map[] = { "negotiation supported"), { -1, "" } }; -#endif /* virtio-input features mapping */ -#ifdef CONFIG_VIRTIO_INPUT static const qmp_virtio_feature_map_t virtio_input_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), @@ -239,10 +226,8 @@ static const qmp_virtio_feature_map_t virtio_input_feature_map[] = { "negotiation supported"), { -1, "" } }; -#endif /* virtio-net features mapping */ -#ifdef CONFIG_VIRTIO_NET static const qmp_virtio_feature_map_t virtio_net_feature_map[] = { FEATURE_ENTRY(VIRTIO_NET_F_CSUM, \ "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum " @@ -313,10 +298,8 @@ static const qmp_virtio_feature_map_t virtio_net_feature_map[] = { "device with same MAC addr. supported"), FEATURE_ENTRY(VIRTIO_NET_F_SPEED_DUPLEX, \ "VIRTIO_NET_F_SPEED_DUPLEX: Device set linkspeed and duplex"), -#ifndef VIRTIO_NET_NO_LEGACY FEATURE_ENTRY(VIRTIO_NET_F_GSO, \ "VIRTIO_NET_F_GSO: Handling GSO-type packets supported"), -#endif /* !VIRTIO_NET_NO_LEGACY */ FEATURE_ENTRY(VHOST_NET_F_VIRTIO_NET_HDR, \ "VHOST_NET_F_VIRTIO_NET_HDR: Virtio-net headers for RX and TX " "packets supported"), @@ -341,10 +324,8 @@ static const qmp_virtio_feature_map_t virtio_net_feature_map[] = { "header"), { -1, "" } }; -#endif /* virtio-scsi features mapping */ -#ifdef CONFIG_VIRTIO_SCSI static const qmp_virtio_feature_map_t virtio_scsi_feature_map[] = { FEATURE_ENTRY(VIRTIO_SCSI_F_INOUT, \ "VIRTIO_SCSI_F_INOUT: Requests including read and writable data " @@ -364,10 +345,8 @@ static const qmp_virtio_feature_map_t virtio_scsi_feature_map[] = { "negotiation supported"), { -1, "" } }; -#endif /* virtio/vhost-user-fs features mapping */ -#ifdef CONFIG_VHOST_USER_FS static const qmp_virtio_feature_map_t virtio_fs_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), @@ -376,10 +355,8 @@ static const qmp_virtio_feature_map_t virtio_fs_feature_map[] = { "negotiation supported"), { -1, "" } }; -#endif /* virtio/vhost-user-i2c features mapping */ -#ifdef CONFIG_VIRTIO_I2C_ADAPTER static const qmp_virtio_feature_map_t virtio_i2c_feature_map[] = { FEATURE_ENTRY(VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, \ "VIRTIO_I2C_F_ZERO_LEGNTH_REQUEST: Zero length requests supported"), @@ -390,10 +367,8 @@ static const qmp_virtio_feature_map_t virtio_i2c_feature_map[] = { "negotiation supported"), { -1, "" } }; -#endif /* virtio/vhost-vsock features mapping */ -#ifdef CONFIG_VHOST_VSOCK static const qmp_virtio_feature_map_t virtio_vsock_feature_map[] = { FEATURE_ENTRY(VIRTIO_VSOCK_F_SEQPACKET, \ "VIRTIO_VSOCK_F_SEQPACKET: SOCK_SEQPACKET supported"), @@ -404,10 +379,8 @@ static const qmp_virtio_feature_map_t virtio_vsock_feature_map[] = { "negotiation supported"), { -1, "" } }; -#endif /* virtio-balloon features mapping */ -#ifdef CONFIG_VIRTIO_BALLOON static const qmp_virtio_feature_map_t virtio_balloon_feature_map[] = { FEATURE_ENTRY(VIRTIO_BALLOON_F_MUST_TELL_HOST, \ "VIRTIO_BALLOON_F_MUST_TELL_HOST: Tell host before reclaiming " @@ -424,19 +397,15 @@ static const qmp_virtio_feature_map_t virtio_balloon_feature_map[] = { "VIRTIO_BALLOON_F_REPORTING: Page reporting VQ enabled"), { -1, "" } }; -#endif /* virtio-crypto features mapping */ -#ifdef CONFIG_VIRTIO_CRYPTO static const qmp_virtio_feature_map_t virtio_crypto_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), { -1, "" } }; -#endif /* virtio-iommu features mapping */ -#ifdef CONFIG_VIRTIO_IOMMU static const qmp_virtio_feature_map_t virtio_iommu_feature_map[] = { FEATURE_ENTRY(VIRTIO_IOMMU_F_INPUT_RANGE, \ "VIRTIO_IOMMU_F_INPUT_RANGE: Range of available virtual addrs. " @@ -458,15 +427,11 @@ static const qmp_virtio_feature_map_t virtio_iommu_feature_map[] = { "available"), { -1, "" } }; -#endif /* virtio-mem features mapping */ -#ifdef CONFIG_VIRTIO_MEM static const qmp_virtio_feature_map_t virtio_mem_feature_map[] = { -#ifndef CONFIG_ACPI FEATURE_ENTRY(VIRTIO_MEM_F_ACPI_PXM, \ "VIRTIO_MEM_F_ACPI_PXM: node_id is an ACPI PXM and is valid"), -#endif /* !CONFIG_ACPI */ FEATURE_ENTRY(VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, \ "VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE: Unplugged memory cannot be " "accessed"), @@ -475,10 +440,8 @@ static const qmp_virtio_feature_map_t virtio_mem_feature_map[] = { "plugged when suspending+resuming"), { -1, "" } }; -#endif /* virtio-rng features mapping */ -#ifdef CONFIG_VIRTIO_RNG static const qmp_virtio_feature_map_t virtio_rng_feature_map[] = { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), @@ -487,10 +450,8 @@ static const qmp_virtio_feature_map_t virtio_rng_feature_map[] = { "negotiation supported"), { -1, "" } }; -#endif /* virtio/vhost-gpio features mapping */ -#ifdef CONFIG_VHOST_USER_GPIO static const qmp_virtio_feature_map_t virtio_gpio_feature_map[] = { FEATURE_ENTRY(VIRTIO_GPIO_F_IRQ, \ "VIRTIO_GPIO_F_IRQ: Device supports interrupts on GPIO lines"), @@ -499,7 +460,6 @@ static const qmp_virtio_feature_map_t virtio_gpio_feature_map[] = { "negotiation supported"), { -1, "" } }; -#endif #define CONVERT_FEATURES(type, map, is_status, bitmap) \ ({ \ @@ -595,96 +555,66 @@ VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id, /* device features */ switch (device_id) { -#ifdef CONFIG_VIRTIO_SERIAL case VIRTIO_ID_CONSOLE: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_serial_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_BLK case VIRTIO_ID_BLOCK: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_blk_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_GPU case VIRTIO_ID_GPU: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_gpu_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_NET case VIRTIO_ID_NET: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_net_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_SCSI case VIRTIO_ID_SCSI: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_scsi_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_BALLOON case VIRTIO_ID_BALLOON: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_balloon_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_IOMMU case VIRTIO_ID_IOMMU: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_iommu_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_INPUT case VIRTIO_ID_INPUT: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_input_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VHOST_USER_FS case VIRTIO_ID_FS: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_fs_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VHOST_VSOCK case VIRTIO_ID_VSOCK: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_vsock_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_CRYPTO case VIRTIO_ID_CRYPTO: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_crypto_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_MEM case VIRTIO_ID_MEM: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_mem_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_I2C_ADAPTER case VIRTIO_ID_I2C_ADAPTER: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_i2c_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_RNG case VIRTIO_ID_RNG: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_rng_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VHOST_USER_GPIO case VIRTIO_ID_GPIO: features->dev_features = CONVERT_FEATURES_EX(strList, virtio_gpio_feature_map, bitmap); break; -#endif /* No features */ case VIRTIO_ID_9P: case VIRTIO_ID_PMEM: diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index ee397aaf196..d913b94e1ca 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -11,7 +11,7 @@ system_virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev.c') specific_virtio_ss = ss.source_set() specific_virtio_ss.add(files('virtio.c')) -specific_virtio_ss.add(files('virtio-qmp.c')) +system_virtio_ss.add(files('virtio-qmp.c')) if have_vhost system_virtio_ss.add(files('vhost.c')) -- 2.47.3 ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 5/6] hw/virtio/virtio-qmp: make compilation unit common 2026-01-31 2:00 ` [PATCH 5/6] hw/virtio/virtio-qmp: " Pierrick Bouvier @ 2026-02-01 23:11 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 23:11 UTC (permalink / raw) To: Pierrick Bouvier, qemu-devel Cc: qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin On 31/1/26 03:00, Pierrick Bouvier wrote: > All compile time conditionals have no impact at runtime, since they are > representing only possible features for devices present at runtime. > > In case they are not present, associated features table will never be > used. In case they are present but some features are not, matching bits > will never be enabled, so those entries will be unused. > > Thus, simply expose everything and call it a day. > > Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > --- > hw/virtio/virtio-qmp.c | 70 ------------------------------------------ > hw/virtio/meson.build | 2 +- > 2 files changed, 1 insertion(+), 71 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> ^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 6/6] hw/virtio/: make all compilation units common 2026-01-31 2:00 [PATCH 0/6] single-binary: hw/virtio Pierrick Bouvier ` (4 preceding siblings ...) 2026-01-31 2:00 ` [PATCH 5/6] hw/virtio/virtio-qmp: " Pierrick Bouvier @ 2026-01-31 2:01 ` Pierrick Bouvier 2026-02-01 22:28 ` Philippe Mathieu-Daudé 5 siblings, 1 reply; 26+ messages in thread From: Pierrick Bouvier @ 2026-01-31 2:01 UTC (permalink / raw) To: qemu-devel Cc: qemu-ppc, Pierrick Bouvier, Philippe Mathieu-Daudé, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> --- hw/virtio/meson.build | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index d913b94e1ca..4f308beb961 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -9,8 +9,7 @@ system_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK_COMMON', if_true: files('vhost-vs system_virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu.c')) system_virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev.c')) -specific_virtio_ss = ss.source_set() -specific_virtio_ss.add(files('virtio.c')) +system_virtio_ss.add(files('virtio.c')) system_virtio_ss.add(files('virtio-qmp.c')) if have_vhost @@ -52,10 +51,10 @@ endif system_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c')) -specific_virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-balloon.c')) -specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs.c')) -specific_virtio_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem.c')) -specific_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-balloon.c')) +system_virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem.c')) +system_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: files('virtio-nsm.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: [files('cbor-helpers.c'), libcbor]) @@ -97,5 +96,4 @@ system_ss.add(when: ['CONFIG_VIRTIO_MD', 'CONFIG_VIRTIO_PCI'], system_ss.add(files('virtio-hmp-cmds.c')) -specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: specific_virtio_ss) system_ss.add(when: 'CONFIG_ACPI', if_true: files('virtio-acpi.c')) -- 2.47.3 ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 6/6] hw/virtio/: make all compilation units common 2026-01-31 2:01 ` [PATCH 6/6] hw/virtio/: make all compilation units common Pierrick Bouvier @ 2026-02-01 22:28 ` Philippe Mathieu-Daudé 2026-02-01 23:13 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 22:28 UTC (permalink / raw) To: Pierrick Bouvier, qemu-devel Cc: qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin On 31/1/26 03:01, Pierrick Bouvier wrote: > Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > --- > hw/virtio/meson.build | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 6/6] hw/virtio/: make all compilation units common 2026-02-01 22:28 ` Philippe Mathieu-Daudé @ 2026-02-01 23:13 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 26+ messages in thread From: Philippe Mathieu-Daudé @ 2026-02-01 23:13 UTC (permalink / raw) To: Pierrick Bouvier, qemu-devel Cc: qemu-ppc, Stefano Garzarella, Harsh Prateek Bora, Michael S. Tsirkin, Nicholas Piggin On 1/2/26 23:28, Philippe Mathieu-Daudé wrote: > On 31/1/26 03:01, Pierrick Bouvier wrote: >> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> >> --- >> hw/virtio/meson.build | 12 +++++------- >> 1 file changed, 5 insertions(+), 7 deletions(-) > > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2026-02-02 19:13 UTC | newest] Thread overview: 26+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-01-31 2:00 [PATCH 0/6] single-binary: hw/virtio Pierrick Bouvier 2026-01-31 2:00 ` [PATCH 1/6] target-info: add target_base_ppc, target_ppc and target_ppc64 Pierrick Bouvier 2026-02-01 22:28 ` Philippe Mathieu-Daudé 2026-02-01 23:11 ` Philippe Mathieu-Daudé 2026-01-31 2:00 ` [PATCH 2/6] include/hw/virtio/virtio-access.h: remove target specifics define Pierrick Bouvier 2026-01-31 17:48 ` Michael S. Tsirkin 2026-02-01 22:36 ` Philippe Mathieu-Daudé 2026-02-01 22:41 ` Philippe Mathieu-Daudé 2026-02-01 23:20 ` Philippe Mathieu-Daudé 2026-02-02 1:25 ` Pierrick Bouvier 2026-02-02 7:40 ` Michael S. Tsirkin 2026-02-02 11:03 ` Philippe Mathieu-Daudé 2026-02-02 1:24 ` Pierrick Bouvier 2026-02-02 7:50 ` Michael S. Tsirkin 2026-02-02 18:00 ` Stefan Hajnoczi 2026-02-02 19:12 ` Pierrick Bouvier 2026-01-31 2:00 ` [PATCH 3/6] include/hw/ppc/spapr: extract SPAPR_MAX_RAM_SLOTS in a new header Pierrick Bouvier 2026-02-01 22:26 ` Philippe Mathieu-Daudé 2026-02-01 23:11 ` Philippe Mathieu-Daudé 2026-01-31 2:00 ` [PATCH 4/6] hw/virtio/vhost-user: make compilation unit common Pierrick Bouvier 2026-02-01 23:11 ` Philippe Mathieu-Daudé 2026-01-31 2:00 ` [PATCH 5/6] hw/virtio/virtio-qmp: " Pierrick Bouvier 2026-02-01 23:11 ` Philippe Mathieu-Daudé 2026-01-31 2:01 ` [PATCH 6/6] hw/virtio/: make all compilation units common Pierrick Bouvier 2026-02-01 22:28 ` Philippe Mathieu-Daudé 2026-02-01 23:13 ` Philippe Mathieu-Daudé
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.