From patchwork Fri Mar 7 19:10:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 871255 Delivered-To: patch@linaro.org Received: by 2002:a5d:64c8:0:b0:38f:210b:807b with SMTP id f8csp922107wri; Fri, 7 Mar 2025 11:11:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX8WFV96hDfzYmFLNd2YKPy7xgKxnIlIEg7XSZzFZJZ28h7Y9yI0BLFNrZ2iPkUuII78dm72w==@linaro.org X-Google-Smtp-Source: AGHT+IHsraZxNRFNo0KazvDwopoZ5OnsNgpWOSzAMmIwXISmmuwfTbeIEArn7j+wUzmdjqu/aa6N X-Received: by 2002:a05:622a:1983:b0:471:f141:c53 with SMTP id d75a77b69052e-47610940199mr59773031cf.5.1741374691236; Fri, 07 Mar 2025 11:11:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741374691; cv=none; d=google.com; s=arc-20240605; b=WzJPDZoF/jEWgB3/C9xVu9PQMSrn3iOiMJpRrN+X997PsM9m5s4Xs0U8KbHRA+a1jg YKDanDsHErj5rE2qkKex/mUopIuJDxXlaohUgJurWC9eBWOMDJHIeprE2DDMcNheV7D6 1Y5U3sKHafAbTA/AuJIJaFtDm4DutGwwVl+rXVl5iRxvswveC5/scmhuDEegEEfQ1R/v HurqWWi/YmJaIjhnLh6Pi59DBAhrB5TZOQc0hPdQkpwztiJ3c2DWLSHhkdzUCNca9ksT y947Wked8dVR3i75Ie9CMzjHPG00MdhcBsGotojdkRk05jJrCCLtS78sCEcz+yfXjbTy ntAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UxupFXt8v+cWVWtDpN1/5KOGycPEEPte7T4sMzf1eqQ=; fh=b4ezDBwGtpGBkmEzI/IO6I/lX+jQrRGiA8ytzjkz3zk=; b=N5hoNk8L8BiY2BQ0oDuTdFy8bcZ/LyCZJ9aLYjgCxvMWv9L1JN6yHPFSmoLdqKmuJ3 Hi1m09XSKzidqCYKcMQ2JOV3ToPtRDS2DKU5i3E9urGeEon4dHN/62LZgfwfxGRfWel2 O7m39DtBHqIHevFk3UEVrTSd131H8h0uFPa6CikplwS8xNidki8RQ8bBryB+pk+EZLOS wurPXF3lujV0ZO4wslNX6eTx5rRMCMCWowTCiFHtbiVPYFyR0NuEOrC0KbykFmbYJ0BQ X68tZvGC3UaBYVr7VRy4R17HaCGIM7PY6oxz4AAmSukIkyxVTd74rv998uKEgTJlHy0J /aYw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qLh7q6xK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4751db4279csi39920531cf.550.2025.03.07.11.11.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Mar 2025 11:11:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qLh7q6xK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqd5R-0002VL-ST; Fri, 07 Mar 2025 14:10:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqd5O-0002TW-Lm for qemu-devel@nongnu.org; Fri, 07 Mar 2025 14:10:18 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tqd5M-0005tf-OQ for qemu-devel@nongnu.org; Fri, 07 Mar 2025 14:10:18 -0500 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-219f8263ae0so44755725ad.0 for ; Fri, 07 Mar 2025 11:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741374615; x=1741979415; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UxupFXt8v+cWVWtDpN1/5KOGycPEEPte7T4sMzf1eqQ=; b=qLh7q6xKR+EFo0QUonYib+867XEL70Ep/5wEVjTqERdzp5DzowLb7wDDUtWN/J75LL 0BwbUqRD4LyOjigpu7/2gHxdvPw4wDy2Uy7l84+lBP/wvSGMzpDokcztIjxQilSvMOp8 Jmufd60fDjgjhSWflTb3psEjlArNczT9nTrU80e7s3eemdM3p/V05+R1bQ6jRCWTHFjV xFumUm07veliYIX6cMigsKPWtvJgOtGCgyhvdWMoYYjId0S5TGK57gtWjAsFqi9coD3q g9w0VMOsgy7cxAMBmcyN7Bw9q6SFGo/IbD23IXWxkA7gbFYhYE8wxqyqQWkTHIAJMmjH d72g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741374615; x=1741979415; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UxupFXt8v+cWVWtDpN1/5KOGycPEEPte7T4sMzf1eqQ=; b=hVDPOwD7evWvpjO0bJB8fiJJBOiVnWIo1hRs0xxQ6gf3peuGcjFO2ACF0OJeh5NOb0 65R8gobs83IBXTFTAI/JLZCcC8eGdx+kdYq5p3yrgmeJQD6zz4cdjO+cY9TezdZzxD2V Cm2Cz3FYYem55DdzS5K8fW6xYhjESbTeUExZ4a4gfoDd5KIDGwR9Ky+xOkGq8nSoXsGz vma3hIIc3JW9Pvm4jlC4Jf6fw5sONXcyMfDrMeg6NRgkTvoAeZfGcHm7a8V34BDjVKkg RIgdXVjfF2ckiTvkESKxbPMAwCz1b0MD5szjtMeioN7MgkpeUwoDyLgV8lPfHw3vxnxL Ke4g== X-Gm-Message-State: AOJu0Yyaf7FGJNA808tinhZmPYOC0ucIzh/fc4b1651mY5XSM2E71Nge Zny/HGgMcRWtqIsVgh9rGipjtuCEzlJsPvsuOaQgEDxingoomActKiY0U1rvwf2Bm9/u43bAak5 3 X-Gm-Gg: ASbGncvH79ogVcPcU10H3xRz80trqJ7l4QVWeP1XnOUOT4U6zxdLkwhTvhye4qyWUy+ x/h2LCArQvdBol6TqqEmQDwFnGbOhiiEJhBxlWMVskP89zJpMfahG6BiqPCzVbNXBPl0jTgPeYU Nj/j7+WlfMMvr0yLa7zVGMFFchfNCqrh2U3DdbJUsILV1GkTBi4U0YbgktgB0PNEul7Sn41Bsz4 Iv1uJCSURUuLncmuvtnOrxN7atzuOZmd1vsYdBTh9xGhnHg/ZW8NZK7Th/DFhYUowIz5weQWAjU flsWLpId6fdvAl6/IpB8nl9uTB3q/xJFIzCKu1lsJ+Fj X-Received: by 2002:a05:6a00:2e17:b0:736:a7ec:a366 with SMTP id d2e1a72fcca58-736aa9de241mr6584061b3a.9.1741374615256; Fri, 07 Mar 2025 11:10:15 -0800 (PST) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-736b2da32c6sm1449895b3a.149.2025.03.07.11.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 11:10:14 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: philmd@linaro.org, "Maciej S. Szmigiero" , pierrick.bouvier@linaro.org, alex.bennee@linaro.org, kvm@vger.kernel.org, Paolo Bonzini , Marcelo Tosatti , richard.henderson@linaro.org, manos.pitsidianakis@linaro.org Subject: [PATCH v2 5/7] hw/hyperv/syndbg: common compilation unit Date: Fri, 7 Mar 2025 11:10:01 -0800 Message-Id: <20250307191003.248950-6-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250307191003.248950-1-pierrick.bouvier@linaro.org> References: <20250307191003.248950-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Replace TARGET_PAGE.* by runtime calls Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- 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'))