qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] hw/hyperv: remove duplication compilation units
@ 2025-03-07 19:09 Pierrick Bouvier
  2025-03-07 19:09 ` [PATCH v2 1/7] hw/hyperv/hv-balloon-stub: common compilation unit Pierrick Bouvier
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Pierrick Bouvier @ 2025-03-07 19:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Maciej S. Szmigiero, pierrick.bouvier, alex.bennee, kvm,
	Paolo Bonzini, Marcelo Tosatti, richard.henderson,
	manos.pitsidianakis

Work towards having a single binary, by removing duplicated object files.

hw/hyperv/hyperv.c was excluded at this time, because it depends on target
dependent symbols:
- from system/kvm.h
    - kvm_check_extension
    - kvm_vm_ioctl
- from exec/cpu-all.h | memory_ldst_phys.h.inc
    - ldq_phys

v2
- remove osdep from header
- use hardcoded buffer size for syndbg, assuming page size is always 4Kb.

Pierrick Bouvier (7):
  hw/hyperv/hv-balloon-stub: common compilation unit
  hw/hyperv/hyperv.h: header cleanup
  hw/hyperv/vmbus: common compilation unit
  hw/hyperv/hyperv-proto: move SYNDBG definition from target/i386
  hw/hyperv/syndbg: common compilation unit
  hw/hyperv/balloon: common balloon compilation units
  hw/hyperv/hyperv_testdev: common compilation unit

 include/hw/hyperv/hyperv-proto.h | 12 ++++++++
 include/hw/hyperv/hyperv.h       |  3 +-
 target/i386/kvm/hyperv-proto.h   | 12 --------
 hw/hyperv/syndbg.c               | 10 +++++--
 hw/hyperv/vmbus.c                | 50 ++++++++++++++++----------------
 hw/hyperv/meson.build            |  9 +++---
 6 files changed, 51 insertions(+), 45 deletions(-)

-- 
2.39.5



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

* [PATCH v2 1/7] hw/hyperv/hv-balloon-stub: common compilation unit
  2025-03-07 19:09 [PATCH v2 0/7] hw/hyperv: remove duplication compilation units Pierrick Bouvier
@ 2025-03-07 19:09 ` Pierrick Bouvier
  2025-03-07 19:29   ` Richard Henderson
  2025-03-07 19:09 ` [PATCH v2 2/7] hw/hyperv/hyperv.h: header cleanup Pierrick Bouvier
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Pierrick Bouvier @ 2025-03-07 19:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Maciej S. Szmigiero, pierrick.bouvier, alex.bennee, kvm,
	Paolo Bonzini, Marcelo Tosatti, richard.henderson,
	manos.pitsidianakis

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/hyperv/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/hyperv/meson.build b/hw/hyperv/meson.build
index d3d2668c71a..f4aa0a5ada9 100644
--- a/hw/hyperv/meson.build
+++ b/hw/hyperv/meson.build
@@ -2,4 +2,5 @@ specific_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'))
 specific_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
 specific_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c'))
 specific_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
-specific_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'), if_false: files('hv-balloon-stub.c'))
+specific_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'))
+system_ss.add(when: 'CONFIG_HV_BALLOON', if_false: files('hv-balloon-stub.c'))
-- 
2.39.5



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

* [PATCH v2 2/7] hw/hyperv/hyperv.h: header cleanup
  2025-03-07 19:09 [PATCH v2 0/7] hw/hyperv: remove duplication compilation units Pierrick Bouvier
  2025-03-07 19:09 ` [PATCH v2 1/7] hw/hyperv/hv-balloon-stub: common compilation unit Pierrick Bouvier
@ 2025-03-07 19:09 ` Pierrick Bouvier
  2025-03-07 19:29   ` Richard Henderson
  2025-03-07 19:09 ` [PATCH v2 3/7] hw/hyperv/vmbus: common compilation unit Pierrick Bouvier
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Pierrick Bouvier @ 2025-03-07 19:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Maciej S. Szmigiero, pierrick.bouvier, alex.bennee, kvm,
	Paolo Bonzini, Marcelo Tosatti, richard.henderson,
	manos.pitsidianakis

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 include/hw/hyperv/hyperv.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/hw/hyperv/hyperv.h b/include/hw/hyperv/hyperv.h
index d717b4e13d4..63a8b65278f 100644
--- a/include/hw/hyperv/hyperv.h
+++ b/include/hw/hyperv/hyperv.h
@@ -10,7 +10,8 @@
 #ifndef HW_HYPERV_HYPERV_H
 #define HW_HYPERV_HYPERV_H
 
-#include "cpu-qom.h"
+#include "exec/hwaddr.h"
+#include "hw/core/cpu.h"
 #include "hw/hyperv/hyperv-proto.h"
 
 typedef struct HvSintRoute HvSintRoute;
-- 
2.39.5



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

* [PATCH v2 3/7] hw/hyperv/vmbus: common compilation unit
  2025-03-07 19:09 [PATCH v2 0/7] hw/hyperv: remove duplication compilation units Pierrick Bouvier
  2025-03-07 19:09 ` [PATCH v2 1/7] hw/hyperv/hv-balloon-stub: common compilation unit Pierrick Bouvier
  2025-03-07 19:09 ` [PATCH v2 2/7] hw/hyperv/hyperv.h: header cleanup Pierrick Bouvier
@ 2025-03-07 19:09 ` Pierrick Bouvier
  2025-03-07 19:30   ` Richard Henderson
  2025-03-07 19:10 ` [PATCH v2 4/7] hw/hyperv/hyperv-proto: move SYNDBG definition from target/i386 Pierrick Bouvier
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Pierrick Bouvier @ 2025-03-07 19:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Maciej S. Szmigiero, pierrick.bouvier, alex.bennee, kvm,
	Paolo Bonzini, Marcelo Tosatti, richard.henderson,
	manos.pitsidianakis

Replace TARGET_PAGE.* by runtime calls.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/hyperv/vmbus.c     | 50 +++++++++++++++++++++----------------------
 hw/hyperv/meson.build |  2 +-
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c
index 12a7dc43128..109ac319caf 100644
--- a/hw/hyperv/vmbus.c
+++ b/hw/hyperv/vmbus.c
@@ -18,7 +18,7 @@
 #include "hw/hyperv/vmbus.h"
 #include "hw/hyperv/vmbus-bridge.h"
 #include "hw/sysbus.h"
-#include "cpu.h"
+#include "exec/target_page.h"
 #include "trace.h"
 
 enum {
@@ -309,7 +309,7 @@ void vmbus_put_gpadl(VMBusGpadl *gpadl)
 
 uint32_t vmbus_gpadl_len(VMBusGpadl *gpadl)
 {
-    return gpadl->num_gfns * TARGET_PAGE_SIZE;
+    return gpadl->num_gfns * qemu_target_page_size();
 }
 
 static void gpadl_iter_init(GpadlIter *iter, VMBusGpadl *gpadl,
@@ -323,14 +323,14 @@ static void gpadl_iter_init(GpadlIter *iter, VMBusGpadl *gpadl,
 
 static inline void gpadl_iter_cache_unmap(GpadlIter *iter)
 {
-    uint32_t map_start_in_page = (uintptr_t)iter->map & ~TARGET_PAGE_MASK;
-    uint32_t io_end_in_page = ((iter->last_off - 1) & ~TARGET_PAGE_MASK) + 1;
+    uint32_t map_start_in_page = (uintptr_t)iter->map & ~qemu_target_page_mask();
+    uint32_t io_end_in_page = ((iter->last_off - 1) & ~qemu_target_page_mask()) + 1;
 
     /* mapping is only done to do non-zero amount of i/o */
     assert(iter->last_off > 0);
     assert(map_start_in_page < io_end_in_page);
 
-    dma_memory_unmap(iter->as, iter->map, TARGET_PAGE_SIZE - map_start_in_page,
+    dma_memory_unmap(iter->as, iter->map, qemu_target_page_size() - map_start_in_page,
                      iter->dir, io_end_in_page - map_start_in_page);
 }
 
@@ -348,17 +348,17 @@ static ssize_t gpadl_iter_io(GpadlIter *iter, void *buf, uint32_t len)
     assert(iter->active);
 
     while (len) {
-        uint32_t off_in_page = iter->off & ~TARGET_PAGE_MASK;
-        uint32_t pgleft = TARGET_PAGE_SIZE - off_in_page;
+        uint32_t off_in_page = iter->off & ~qemu_target_page_mask();
+        uint32_t pgleft = qemu_target_page_size() - off_in_page;
         uint32_t cplen = MIN(pgleft, len);
         void *p;
 
         /* try to reuse the cached mapping */
         if (iter->map) {
             uint32_t map_start_in_page =
-                (uintptr_t)iter->map & ~TARGET_PAGE_MASK;
-            uint32_t off_base = iter->off & ~TARGET_PAGE_MASK;
-            uint32_t mapped_base = (iter->last_off - 1) & ~TARGET_PAGE_MASK;
+                (uintptr_t)iter->map & ~qemu_target_page_mask();
+            uint32_t off_base = iter->off & ~qemu_target_page_mask();
+            uint32_t mapped_base = (iter->last_off - 1) & ~qemu_target_page_mask();
             if (off_base != mapped_base || off_in_page < map_start_in_page) {
                 gpadl_iter_cache_unmap(iter);
                 iter->map = NULL;
@@ -368,10 +368,10 @@ static ssize_t gpadl_iter_io(GpadlIter *iter, void *buf, uint32_t len)
         if (!iter->map) {
             dma_addr_t maddr;
             dma_addr_t mlen = pgleft;
-            uint32_t idx = iter->off >> TARGET_PAGE_BITS;
+            uint32_t idx = iter->off >> qemu_target_page_bits();
             assert(idx < iter->gpadl->num_gfns);
 
-            maddr = (iter->gpadl->gfns[idx] << TARGET_PAGE_BITS) | off_in_page;
+            maddr = (iter->gpadl->gfns[idx] << qemu_target_page_bits()) | off_in_page;
 
             iter->map = dma_memory_map(iter->as, maddr, &mlen, iter->dir,
                                        MEMTXATTRS_UNSPECIFIED);
@@ -382,7 +382,7 @@ static ssize_t gpadl_iter_io(GpadlIter *iter, void *buf, uint32_t len)
             }
         }
 
-        p = (void *)(uintptr_t)(((uintptr_t)iter->map & TARGET_PAGE_MASK) |
+        p = (void *)(uintptr_t)(((uintptr_t)iter->map & qemu_target_page_mask()) |
                 off_in_page);
         if (iter->dir == DMA_DIRECTION_FROM_DEVICE) {
             memcpy(p, buf, cplen);
@@ -591,9 +591,9 @@ static void ringbuf_init_common(VMBusRingBufCommon *ringbuf, VMBusGpadl *gpadl,
                                 uint32_t begin, uint32_t end)
 {
     ringbuf->as = as;
-    ringbuf->rb_addr = gpadl->gfns[begin] << TARGET_PAGE_BITS;
-    ringbuf->base = (begin + 1) << TARGET_PAGE_BITS;
-    ringbuf->len = (end - begin - 1) << TARGET_PAGE_BITS;
+    ringbuf->rb_addr = gpadl->gfns[begin] << qemu_target_page_bits();
+    ringbuf->base = (begin + 1) << qemu_target_page_bits();
+    ringbuf->len = (end - begin - 1) << qemu_target_page_bits();
     gpadl_iter_init(&ringbuf->iter, gpadl, as, dir);
 }
 
@@ -734,7 +734,7 @@ static int vmbus_channel_notify_guest(VMBusChannel *chan)
     unsigned long *int_map, mask;
     unsigned idx;
     hwaddr addr = chan->vmbus->int_page_gpa;
-    hwaddr len = TARGET_PAGE_SIZE / 2, dirty = 0;
+    hwaddr len = qemu_target_page_size() / 2, dirty = 0;
 
     trace_vmbus_channel_notify_guest(chan->id);
 
@@ -743,7 +743,7 @@ static int vmbus_channel_notify_guest(VMBusChannel *chan)
     }
 
     int_map = cpu_physical_memory_map(addr, &len, 1);
-    if (len != TARGET_PAGE_SIZE / 2) {
+    if (len != qemu_target_page_size() / 2) {
         res = -ENXIO;
         goto unmap;
     }
@@ -1038,14 +1038,14 @@ static int sgl_from_gpa_ranges(QEMUSGList *sgl, VMBusDevice *dev,
         }
         len -= sizeof(range);
 
-        if (range.byte_offset & TARGET_PAGE_MASK) {
+        if (range.byte_offset & qemu_target_page_mask()) {
             goto eio;
         }
 
         for (; range.byte_count; range.byte_offset = 0) {
             uint64_t paddr;
             uint32_t plen = MIN(range.byte_count,
-                                TARGET_PAGE_SIZE - range.byte_offset);
+                                qemu_target_page_size() - range.byte_offset);
 
             if (len < sizeof(uint64_t)) {
                 goto eio;
@@ -1055,7 +1055,7 @@ static int sgl_from_gpa_ranges(QEMUSGList *sgl, VMBusDevice *dev,
                 goto err;
             }
             len -= sizeof(uint64_t);
-            paddr <<= TARGET_PAGE_BITS;
+            paddr <<= qemu_target_page_bits();
             paddr |= range.byte_offset;
             range.byte_count -= plen;
 
@@ -1804,7 +1804,7 @@ static void handle_gpadl_header(VMBus *vmbus, vmbus_message_gpadl_header *msg,
      * anything else and simplify things greatly.
      */
     if (msg->rangecount != 1 || msg->range[0].byte_offset ||
-        (msg->range[0].byte_count != (num_gfns << TARGET_PAGE_BITS))) {
+        (msg->range[0].byte_count != (num_gfns << qemu_target_page_bits()))) {
         return;
     }
 
@@ -2240,10 +2240,10 @@ static void vmbus_signal_event(EventNotifier *e)
         return;
     }
 
-    addr = vmbus->int_page_gpa + TARGET_PAGE_SIZE / 2;
-    len = TARGET_PAGE_SIZE / 2;
+    addr = vmbus->int_page_gpa + qemu_target_page_size() / 2;
+    len = qemu_target_page_size() / 2;
     int_map = cpu_physical_memory_map(addr, &len, 1);
-    if (len != TARGET_PAGE_SIZE / 2) {
+    if (len != qemu_target_page_size() / 2) {
         goto unmap;
     }
 
diff --git a/hw/hyperv/meson.build b/hw/hyperv/meson.build
index f4aa0a5ada9..c855fdcf04c 100644
--- a/hw/hyperv/meson.build
+++ b/hw/hyperv/meson.build
@@ -1,6 +1,6 @@
 specific_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'))
 specific_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
-specific_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c'))
+system_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c'))
 specific_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
 specific_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'))
 system_ss.add(when: 'CONFIG_HV_BALLOON', if_false: files('hv-balloon-stub.c'))
-- 
2.39.5



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

* [PATCH v2 4/7] hw/hyperv/hyperv-proto: move SYNDBG definition from target/i386
  2025-03-07 19:09 [PATCH v2 0/7] hw/hyperv: remove duplication compilation units Pierrick Bouvier
                   ` (2 preceding siblings ...)
  2025-03-07 19:09 ` [PATCH v2 3/7] hw/hyperv/vmbus: common compilation unit Pierrick Bouvier
@ 2025-03-07 19:10 ` Pierrick Bouvier
  2025-03-07 19:30   ` Richard Henderson
  2025-03-07 19:10 ` [PATCH v2 5/7] hw/hyperv/syndbg: common compilation unit Pierrick Bouvier
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Pierrick Bouvier @ 2025-03-07 19:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Maciej S. Szmigiero, pierrick.bouvier, alex.bennee, kvm,
	Paolo Bonzini, Marcelo Tosatti, richard.henderson,
	manos.pitsidianakis

Allows them to be available for common compilation units.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 include/hw/hyperv/hyperv-proto.h | 12 ++++++++++++
 target/i386/kvm/hyperv-proto.h   | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/hw/hyperv/hyperv-proto.h b/include/hw/hyperv/hyperv-proto.h
index 4a2297307b0..fffc5ce342f 100644
--- a/include/hw/hyperv/hyperv-proto.h
+++ b/include/hw/hyperv/hyperv-proto.h
@@ -61,6 +61,18 @@
 #define HV_MESSAGE_X64_APIC_EOI               0x80010004
 #define HV_MESSAGE_X64_LEGACY_FP_ERROR        0x80010005
 
+/*
+ * Hyper-V Synthetic debug options MSR
+ */
+#define HV_X64_MSR_SYNDBG_CONTROL               0x400000F1
+#define HV_X64_MSR_SYNDBG_STATUS                0x400000F2
+#define HV_X64_MSR_SYNDBG_SEND_BUFFER           0x400000F3
+#define HV_X64_MSR_SYNDBG_RECV_BUFFER           0x400000F4
+#define HV_X64_MSR_SYNDBG_PENDING_BUFFER        0x400000F5
+#define HV_X64_MSR_SYNDBG_OPTIONS               0x400000FF
+
+#define HV_X64_SYNDBG_OPTION_USE_HCALLS         BIT(2)
+
 /*
  * Message flags
  */
diff --git a/target/i386/kvm/hyperv-proto.h b/target/i386/kvm/hyperv-proto.h
index 464fbf09e35..a9f056f2f3e 100644
--- a/target/i386/kvm/hyperv-proto.h
+++ b/target/i386/kvm/hyperv-proto.h
@@ -151,18 +151,6 @@
 #define HV_X64_MSR_STIMER3_CONFIG               0x400000B6
 #define HV_X64_MSR_STIMER3_COUNT                0x400000B7
 
-/*
- * Hyper-V Synthetic debug options MSR
- */
-#define HV_X64_MSR_SYNDBG_CONTROL               0x400000F1
-#define HV_X64_MSR_SYNDBG_STATUS                0x400000F2
-#define HV_X64_MSR_SYNDBG_SEND_BUFFER           0x400000F3
-#define HV_X64_MSR_SYNDBG_RECV_BUFFER           0x400000F4
-#define HV_X64_MSR_SYNDBG_PENDING_BUFFER        0x400000F5
-#define HV_X64_MSR_SYNDBG_OPTIONS               0x400000FF
-
-#define HV_X64_SYNDBG_OPTION_USE_HCALLS         BIT(2)
-
 /*
  * Guest crash notification MSRs
  */
-- 
2.39.5



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

* [PATCH v2 5/7] hw/hyperv/syndbg: common compilation unit
  2025-03-07 19:09 [PATCH v2 0/7] hw/hyperv: remove duplication compilation units Pierrick Bouvier
                   ` (3 preceding siblings ...)
  2025-03-07 19:10 ` [PATCH v2 4/7] hw/hyperv/hyperv-proto: move SYNDBG definition from target/i386 Pierrick Bouvier
@ 2025-03-07 19:10 ` Pierrick Bouvier
  2025-03-07 19:32   ` Richard Henderson
  2025-03-07 19:32   ` Pierrick Bouvier
  2025-03-07 19:10 ` [PATCH v2 6/7] hw/hyperv/balloon: common balloon compilation units Pierrick Bouvier
  2025-03-07 19:10 ` [PATCH v2 7/7] hw/hyperv/hyperv_testdev: common compilation unit Pierrick Bouvier
  6 siblings, 2 replies; 16+ messages in thread
From: Pierrick Bouvier @ 2025-03-07 19:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Maciej S. Szmigiero, pierrick.bouvier, alex.bennee, kvm,
	Paolo Bonzini, Marcelo Tosatti, richard.henderson,
	manos.pitsidianakis

Replace TARGET_PAGE.* by runtime calls

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/hyperv/syndbg.c    | 10 +++++++---
 hw/hyperv/meson.build |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hw/hyperv/syndbg.c b/hw/hyperv/syndbg.c
index d3e39170772..ee91266c070 100644
--- a/hw/hyperv/syndbg.c
+++ b/hw/hyperv/syndbg.c
@@ -14,7 +14,7 @@
 #include "migration/vmstate.h"
 #include "hw/qdev-properties.h"
 #include "hw/loader.h"
-#include "cpu.h"
+#include "exec/target_page.h"
 #include "hw/hyperv/hyperv.h"
 #include "hw/hyperv/vmbus-bridge.h"
 #include "hw/hyperv/hyperv-proto.h"
@@ -183,12 +183,14 @@ static bool create_udp_pkt(HvSynDbg *syndbg, void *pkt, uint32_t pkt_len,
     return true;
 }
 
+#define MSG_BUFSZ 4096
+
 static uint16_t handle_recv_msg(HvSynDbg *syndbg, uint64_t outgpa,
                                 uint32_t count, bool is_raw, uint32_t options,
                                 uint64_t timeout, uint32_t *retrieved_count)
 {
     uint16_t ret;
-    uint8_t data_buf[TARGET_PAGE_SIZE - UDP_PKT_HEADER_SIZE];
+    uint8_t data_buf[MSG_BUFSZ];
     hwaddr out_len;
     void *out_data;
     ssize_t recv_byte_count;
@@ -201,7 +203,7 @@ static uint16_t handle_recv_msg(HvSynDbg *syndbg, uint64_t outgpa,
         recv_byte_count = 0;
     } else {
         recv_byte_count = recv(syndbg->socket, data_buf,
-                               MIN(sizeof(data_buf), count), MSG_WAITALL);
+                               MIN(MSG_BUFSZ, count), MSG_WAITALL);
         if (recv_byte_count == -1) {
             return HV_STATUS_INVALID_PARAMETER;
         }
@@ -374,6 +376,8 @@ static const Property hv_syndbg_properties[] = {
 
 static void hv_syndbg_class_init(ObjectClass *klass, void *data)
 {
+    g_assert(MSG_BUFSZ > qemu_target_page_size());
+
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     device_class_set_props(dc, hv_syndbg_properties);
diff --git a/hw/hyperv/meson.build b/hw/hyperv/meson.build
index c855fdcf04c..a9f2045a9af 100644
--- a/hw/hyperv/meson.build
+++ b/hw/hyperv/meson.build
@@ -1,6 +1,6 @@
 specific_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'))
 specific_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
 system_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c'))
-specific_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
+system_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
 specific_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'))
 system_ss.add(when: 'CONFIG_HV_BALLOON', if_false: files('hv-balloon-stub.c'))
-- 
2.39.5



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

* [PATCH v2 6/7] hw/hyperv/balloon: common balloon compilation units
  2025-03-07 19:09 [PATCH v2 0/7] hw/hyperv: remove duplication compilation units Pierrick Bouvier
                   ` (4 preceding siblings ...)
  2025-03-07 19:10 ` [PATCH v2 5/7] hw/hyperv/syndbg: common compilation unit Pierrick Bouvier
@ 2025-03-07 19:10 ` Pierrick Bouvier
  2025-03-07 19:33   ` Richard Henderson
  2025-03-07 19:10 ` [PATCH v2 7/7] hw/hyperv/hyperv_testdev: common compilation unit Pierrick Bouvier
  6 siblings, 1 reply; 16+ messages in thread
From: Pierrick Bouvier @ 2025-03-07 19:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Maciej S. Szmigiero, pierrick.bouvier, alex.bennee, kvm,
	Paolo Bonzini, Marcelo Tosatti, richard.henderson,
	manos.pitsidianakis

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/hyperv/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/hyperv/meson.build b/hw/hyperv/meson.build
index a9f2045a9af..5acd709bdd5 100644
--- a/hw/hyperv/meson.build
+++ b/hw/hyperv/meson.build
@@ -2,5 +2,5 @@ specific_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'))
 specific_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
 system_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c'))
 system_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
-specific_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'))
+system_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'))
 system_ss.add(when: 'CONFIG_HV_BALLOON', if_false: files('hv-balloon-stub.c'))
-- 
2.39.5



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

* [PATCH v2 7/7] hw/hyperv/hyperv_testdev: common compilation unit
  2025-03-07 19:09 [PATCH v2 0/7] hw/hyperv: remove duplication compilation units Pierrick Bouvier
                   ` (5 preceding siblings ...)
  2025-03-07 19:10 ` [PATCH v2 6/7] hw/hyperv/balloon: common balloon compilation units Pierrick Bouvier
@ 2025-03-07 19:10 ` Pierrick Bouvier
  2025-03-07 19:33   ` Richard Henderson
  6 siblings, 1 reply; 16+ messages in thread
From: Pierrick Bouvier @ 2025-03-07 19:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Maciej S. Szmigiero, pierrick.bouvier, alex.bennee, kvm,
	Paolo Bonzini, Marcelo Tosatti, richard.henderson,
	manos.pitsidianakis

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/hyperv/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/hyperv/meson.build b/hw/hyperv/meson.build
index 5acd709bdd5..ef5a596c8ab 100644
--- a/hw/hyperv/meson.build
+++ b/hw/hyperv/meson.build
@@ -1,5 +1,5 @@
 specific_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'))
-specific_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
+system_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
 system_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c'))
 system_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
 system_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'))
-- 
2.39.5



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

* Re: [PATCH v2 1/7] hw/hyperv/hv-balloon-stub: common compilation unit
  2025-03-07 19:09 ` [PATCH v2 1/7] hw/hyperv/hv-balloon-stub: common compilation unit Pierrick Bouvier
@ 2025-03-07 19:29   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2025-03-07 19:29 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Maciej S. Szmigiero, alex.bennee, kvm, Paolo Bonzini,
	Marcelo Tosatti, manos.pitsidianakis

On 3/7/25 11:09, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/hyperv/meson.build | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/hyperv/meson.build b/hw/hyperv/meson.build
> index d3d2668c71a..f4aa0a5ada9 100644
> --- a/hw/hyperv/meson.build
> +++ b/hw/hyperv/meson.build
> @@ -2,4 +2,5 @@ specific_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'))
>   specific_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
>   specific_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c'))
>   specific_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
> -specific_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'), if_false: files('hv-balloon-stub.c'))
> +specific_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'))
> +system_ss.add(when: 'CONFIG_HV_BALLOON', if_false: files('hv-balloon-stub.c'))

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH v2 2/7] hw/hyperv/hyperv.h: header cleanup
  2025-03-07 19:09 ` [PATCH v2 2/7] hw/hyperv/hyperv.h: header cleanup Pierrick Bouvier
@ 2025-03-07 19:29   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2025-03-07 19:29 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Maciej S. Szmigiero, alex.bennee, kvm, Paolo Bonzini,
	Marcelo Tosatti, manos.pitsidianakis

On 3/7/25 11:09, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   include/hw/hyperv/hyperv.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/hyperv/hyperv.h b/include/hw/hyperv/hyperv.h
> index d717b4e13d4..63a8b65278f 100644
> --- a/include/hw/hyperv/hyperv.h
> +++ b/include/hw/hyperv/hyperv.h
> @@ -10,7 +10,8 @@
>   #ifndef HW_HYPERV_HYPERV_H
>   #define HW_HYPERV_HYPERV_H
>   
> -#include "cpu-qom.h"
> +#include "exec/hwaddr.h"
> +#include "hw/core/cpu.h"

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH v2 3/7] hw/hyperv/vmbus: common compilation unit
  2025-03-07 19:09 ` [PATCH v2 3/7] hw/hyperv/vmbus: common compilation unit Pierrick Bouvier
@ 2025-03-07 19:30   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2025-03-07 19:30 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Maciej S. Szmigiero, alex.bennee, kvm, Paolo Bonzini,
	Marcelo Tosatti, manos.pitsidianakis

On 3/7/25 11:09, Pierrick Bouvier wrote:
> Replace TARGET_PAGE.* by runtime calls.
> 
> Signed-off-by: Pierrick Bouvier<pierrick.bouvier@linaro.org>
> ---
>   hw/hyperv/vmbus.c     | 50 +++++++++++++++++++++----------------------
>   hw/hyperv/meson.build |  2 +-
>   2 files changed, 26 insertions(+), 26 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH v2 4/7] hw/hyperv/hyperv-proto: move SYNDBG definition from target/i386
  2025-03-07 19:10 ` [PATCH v2 4/7] hw/hyperv/hyperv-proto: move SYNDBG definition from target/i386 Pierrick Bouvier
@ 2025-03-07 19:30   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2025-03-07 19:30 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Maciej S. Szmigiero, alex.bennee, kvm, Paolo Bonzini,
	Marcelo Tosatti, manos.pitsidianakis

On 3/7/25 11:10, Pierrick Bouvier wrote:
> Allows them to be available for common compilation units.
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   include/hw/hyperv/hyperv-proto.h | 12 ++++++++++++
>   target/i386/kvm/hyperv-proto.h   | 12 ------------
>   2 files changed, 12 insertions(+), 12 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH v2 5/7] hw/hyperv/syndbg: common compilation unit
  2025-03-07 19:10 ` [PATCH v2 5/7] hw/hyperv/syndbg: common compilation unit Pierrick Bouvier
@ 2025-03-07 19:32   ` Richard Henderson
  2025-03-07 19:32   ` Pierrick Bouvier
  1 sibling, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2025-03-07 19:32 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Maciej S. Szmigiero, alex.bennee, kvm, Paolo Bonzini,
	Marcelo Tosatti, manos.pitsidianakis

On 3/7/25 11:10, Pierrick Bouvier wrote:
> Replace TARGET_PAGE.* by runtime calls

The description needs updating for MSG_BUFSZ.

> @@ -374,6 +376,8 @@ static const Property hv_syndbg_properties[] = {
>   
>   static void hv_syndbg_class_init(ObjectClass *klass, void *data)
>   {
> +    g_assert(MSG_BUFSZ > qemu_target_page_size());

 >=

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


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

* Re: [PATCH v2 5/7] hw/hyperv/syndbg: common compilation unit
  2025-03-07 19:10 ` [PATCH v2 5/7] hw/hyperv/syndbg: common compilation unit Pierrick Bouvier
  2025-03-07 19:32   ` Richard Henderson
@ 2025-03-07 19:32   ` Pierrick Bouvier
  1 sibling, 0 replies; 16+ messages in thread
From: Pierrick Bouvier @ 2025-03-07 19:32 UTC (permalink / raw)
  To: qemu-devel
  Cc: philmd, Maciej S. Szmigiero, alex.bennee, kvm, Paolo Bonzini,
	Marcelo Tosatti, richard.henderson, manos.pitsidianakis

On 3/7/25 11:10, Pierrick Bouvier wrote:
> Replace TARGET_PAGE.* by runtime calls
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/hyperv/syndbg.c    | 10 +++++++---
>   hw/hyperv/meson.build |  2 +-
>   2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/hyperv/syndbg.c b/hw/hyperv/syndbg.c
> index d3e39170772..ee91266c070 100644
> --- a/hw/hyperv/syndbg.c
> +++ b/hw/hyperv/syndbg.c
> @@ -14,7 +14,7 @@
>   #include "migration/vmstate.h"
>   #include "hw/qdev-properties.h"
>   #include "hw/loader.h"
> -#include "cpu.h"
> +#include "exec/target_page.h"
>   #include "hw/hyperv/hyperv.h"
>   #include "hw/hyperv/vmbus-bridge.h"
>   #include "hw/hyperv/hyperv-proto.h"
> @@ -183,12 +183,14 @@ static bool create_udp_pkt(HvSynDbg *syndbg, void *pkt, uint32_t pkt_len,
>       return true;
>   }
>   
> +#define MSG_BUFSZ 4096
> +
>   static uint16_t handle_recv_msg(HvSynDbg *syndbg, uint64_t outgpa,
>                                   uint32_t count, bool is_raw, uint32_t options,
>                                   uint64_t timeout, uint32_t *retrieved_count)
>   {
>       uint16_t ret;
> -    uint8_t data_buf[TARGET_PAGE_SIZE - UDP_PKT_HEADER_SIZE];
> +    uint8_t data_buf[MSG_BUFSZ];
>       hwaddr out_len;
>       void *out_data;
>       ssize_t recv_byte_count;
> @@ -201,7 +203,7 @@ static uint16_t handle_recv_msg(HvSynDbg *syndbg, uint64_t outgpa,
>           recv_byte_count = 0;
>       } else {
>           recv_byte_count = recv(syndbg->socket, data_buf,
> -                               MIN(sizeof(data_buf), count), MSG_WAITALL);
> +                               MIN(MSG_BUFSZ, count), MSG_WAITALL);
>           if (recv_byte_count == -1) {
>               return HV_STATUS_INVALID_PARAMETER;
>           }
> @@ -374,6 +376,8 @@ static const Property hv_syndbg_properties[] = {
>   
>   static void hv_syndbg_class_init(ObjectClass *klass, void *data)
>   {
> +    g_assert(MSG_BUFSZ > qemu_target_page_size());
> +

Should be >= here.

>       DeviceClass *dc = DEVICE_CLASS(klass);
>   
>       device_class_set_props(dc, hv_syndbg_properties);
> diff --git a/hw/hyperv/meson.build b/hw/hyperv/meson.build
> index c855fdcf04c..a9f2045a9af 100644
> --- a/hw/hyperv/meson.build
> +++ b/hw/hyperv/meson.build
> @@ -1,6 +1,6 @@
>   specific_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'))
>   specific_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
>   system_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c'))
> -specific_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
> +system_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
>   specific_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'))
>   system_ss.add(when: 'CONFIG_HV_BALLOON', if_false: files('hv-balloon-stub.c'))



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

* Re: [PATCH v2 6/7] hw/hyperv/balloon: common balloon compilation units
  2025-03-07 19:10 ` [PATCH v2 6/7] hw/hyperv/balloon: common balloon compilation units Pierrick Bouvier
@ 2025-03-07 19:33   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2025-03-07 19:33 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Maciej S. Szmigiero, alex.bennee, kvm, Paolo Bonzini,
	Marcelo Tosatti, manos.pitsidianakis

On 3/7/25 11:10, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier<pierrick.bouvier@linaro.org>
> ---
>   hw/hyperv/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH v2 7/7] hw/hyperv/hyperv_testdev: common compilation unit
  2025-03-07 19:10 ` [PATCH v2 7/7] hw/hyperv/hyperv_testdev: common compilation unit Pierrick Bouvier
@ 2025-03-07 19:33   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2025-03-07 19:33 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: philmd, Maciej S. Szmigiero, alex.bennee, kvm, Paolo Bonzini,
	Marcelo Tosatti, manos.pitsidianakis

On 3/7/25 11:10, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/hyperv/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/hyperv/meson.build b/hw/hyperv/meson.build
> index 5acd709bdd5..ef5a596c8ab 100644
> --- a/hw/hyperv/meson.build
> +++ b/hw/hyperv/meson.build
> @@ -1,5 +1,5 @@
>   specific_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'))
> -specific_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
> +system_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_testdev.c'))
>   system_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c'))
>   system_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c'))
>   system_ss.add(when: 'CONFIG_HV_BALLOON', if_true: files('hv-balloon.c', 'hv-balloon-page_range_tree.c', 'hv-balloon-our_range_memslots.c'))

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

end of thread, other threads:[~2025-03-07 19:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 19:09 [PATCH v2 0/7] hw/hyperv: remove duplication compilation units Pierrick Bouvier
2025-03-07 19:09 ` [PATCH v2 1/7] hw/hyperv/hv-balloon-stub: common compilation unit Pierrick Bouvier
2025-03-07 19:29   ` Richard Henderson
2025-03-07 19:09 ` [PATCH v2 2/7] hw/hyperv/hyperv.h: header cleanup Pierrick Bouvier
2025-03-07 19:29   ` Richard Henderson
2025-03-07 19:09 ` [PATCH v2 3/7] hw/hyperv/vmbus: common compilation unit Pierrick Bouvier
2025-03-07 19:30   ` Richard Henderson
2025-03-07 19:10 ` [PATCH v2 4/7] hw/hyperv/hyperv-proto: move SYNDBG definition from target/i386 Pierrick Bouvier
2025-03-07 19:30   ` Richard Henderson
2025-03-07 19:10 ` [PATCH v2 5/7] hw/hyperv/syndbg: common compilation unit Pierrick Bouvier
2025-03-07 19:32   ` Richard Henderson
2025-03-07 19:32   ` Pierrick Bouvier
2025-03-07 19:10 ` [PATCH v2 6/7] hw/hyperv/balloon: common balloon compilation units Pierrick Bouvier
2025-03-07 19:33   ` Richard Henderson
2025-03-07 19:10 ` [PATCH v2 7/7] hw/hyperv/hyperv_testdev: common compilation unit Pierrick Bouvier
2025-03-07 19:33   ` Richard Henderson

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).