From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 11/22] hw/hyperv/syndbg: common compilation unit
Date: Tue, 6 May 2025 16:35:00 +0200 [thread overview]
Message-ID: <20250506143512.4315-12-philmd@linaro.org> (raw)
In-Reply-To: <20250506143512.4315-1-philmd@linaro.org>
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
We assume that page size is 4KB only, to dimension buffer size for
receiving message.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20250424232829.141163-5-pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/hyperv/syndbg.c | 9 ++++++---
hw/hyperv/meson.build | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/hyperv/syndbg.c b/hw/hyperv/syndbg.c
index ca291826a07..8b8a14750dd 100644
--- a/hw/hyperv/syndbg.c
+++ b/hw/hyperv/syndbg.c
@@ -10,11 +10,11 @@
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
#include "qemu/sockets.h"
+#include "qemu/units.h"
#include "qapi/error.h"
#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"
@@ -184,12 +184,15 @@ static bool create_udp_pkt(HvSynDbg *syndbg, void *pkt, uint32_t pkt_len,
return true;
}
+#define MSG_BUFSZ (4 * KiB)
+
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];
+ g_assert(MSG_BUFSZ >= qemu_target_page_size());
+ uint8_t data_buf[MSG_BUFSZ];
hwaddr out_len;
void *out_data;
ssize_t recv_byte_count;
@@ -202,7 +205,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;
}
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.47.1
next prev parent reply other threads:[~2025-05-06 14:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 14:34 [PULL 00/22] Misc HW patches for 2025-05-06 Philippe Mathieu-Daudé
2025-05-06 14:34 ` [PULL 01/22] bsd-user: add option to enable plugins Philippe Mathieu-Daudé
2025-05-06 14:34 ` [PULL 02/22] qom: Factor qom_resolve_path() out Philippe Mathieu-Daudé
2025-05-06 14:34 ` [PULL 03/22] qom/object: Fix typo in comment Philippe Mathieu-Daudé
2025-05-06 14:34 ` [PULL 04/22] target/migration: Inline VMSTATE_CPU() Philippe Mathieu-Daudé
2025-05-06 14:34 ` [PULL 05/22] target/i386/hvf: Include missing 'exec/target_page.h' header Philippe Mathieu-Daudé
2025-05-07 6:35 ` Wei Liu
2025-05-07 11:20 ` Philippe Mathieu-Daudé
2025-05-08 1:09 ` Wei Liu
2025-05-06 14:34 ` [PULL 06/22] system/hvf: Avoid including 'cpu.h' Philippe Mathieu-Daudé
2025-05-06 14:34 ` [PULL 07/22] system/hvf: Expose hvf_enabled() to common code Philippe Mathieu-Daudé
2025-05-06 14:34 ` [PULL 08/22] hw/hyperv/hv-balloon-stub: common compilation unit Philippe Mathieu-Daudé
2025-05-06 14:34 ` [PULL 09/22] hw/hyperv/hyperv.h: header cleanup Philippe Mathieu-Daudé
2025-05-06 14:34 ` [PULL 10/22] hw/hyperv/vmbus: common compilation unit Philippe Mathieu-Daudé
2025-05-06 14:35 ` Philippe Mathieu-Daudé [this message]
2025-05-06 14:35 ` [PULL 12/22] hw/hyperv/balloon: common balloon compilation units Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 13/22] hw/hyperv/hyperv_testdev: common compilation unit Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 14/22] hw/hyperv/hyperv: " Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 15/22] hw/core/machine: Fix indentation Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 16/22] hw/pci/pcie_port: Fix pcie_slot_is_hotpluggbale_bus typo Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 17/22] hw/acpi/ged: Fix wrong identation Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 18/22] hw/i386/acpi-build: Fix build_append_notfication_callback typo Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 19/22] hw/i386/acpi-build: Update document reference Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 20/22] hw/i386/acpi-build: Fix typo and grammar in comment Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 21/22] hw/acpi/pcihp: Fix typo in function name Philippe Mathieu-Daudé
2025-05-06 14:35 ` [PULL 22/22] hw/isa/ich9: Remove stray empty comment Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250506143512.4315-12-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).