From patchwork Fri Mar 7 19:37:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 871264 Delivered-To: patch@linaro.org Received: by 2002:a5d:64c8:0:b0:38f:210b:807b with SMTP id f8csp932743wri; Fri, 7 Mar 2025 11:38:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWwDyjEYfiy2Nh+VLXHI8NomnkxWvosD4qJEbTKpDufgN9yZbEmA9/U9o6X5KCe42JmBHsQ1A==@linaro.org X-Google-Smtp-Source: AGHT+IEf3CGlc6NNKuRNv1Rpyn93mhzJIeigq47yp8vIl8ewoOhg3fk7iZhibXtDomVnsqoUcNX0 X-Received: by 2002:a05:620a:cfc:b0:7c5:c88:5ae2 with SMTP id af79cd13be357-7c50c886277mr487353985a.0.1741376295842; Fri, 07 Mar 2025 11:38:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741376295; cv=none; d=google.com; s=arc-20240605; b=BQWXwHv18SddOI9i3LEXozDhYBzgoGYT01RlrsBwupU9eNSqefadvhYSOg/mdoOF7c tdSBJ3yApiDJF0VsTAofjsvsjCz03nmFU916Z1P9ZAmsLtrcdPe840qF5Ky7ryXUehO2 4XjdtQ1lZoHOn92EHsmvfAeoWf4zfrI0Kb/9kgR3//jKqPFJntgoOUQEQJt8EW8Hw1e5 VhK4xj82haNVPX46bmtm2HCImBbHdKd3Xte8fWEqM5C7Hr2cGuIEz1LhZzbtrLZTJDzk 6rhib7JuzTLbBbLE1DmRafx/R0dx+esBmQdzV1T6YOX3ZDSt9jDOcvub5otvwu3LmN1r EuwA== 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=Y7TO8UyCMpQA9GFmU43KRp15LWAsbGPR+sOTKQ30ilM=; fh=6A2EuSh11aKMP/qbaWluvngkGosKumnmf4RXkewW5Y8=; b=IKtuiE53uEmDxWTtFklOQezgM0vmvLByMs6YKpqSGB6ZwWyo8htQo+6aJGySB/x//H 5UPD3z9a79zcK7Tv14fHPLG0I89KYGCQWr3k0cuI5vIxfjBfN+RpAWnJe7Xe3Muye0Fj QQ/c/MGgkYYF4+sDVphNzPJPFhpkXukVFu7WuGTAUJFqpTCSEoR1gKNAUXiNMRA/77Xa 8530xkUFyfYUFoql0FpjDyH2Ac+3yPsuFjLU2v1gsHAgYyrw9ehcn5sA0UZDtM34gg/m Hc2ZKxWBQRDn2sap+WKcSfD9artAZq5ZZpe4gkleZ7a8lc8PxsW4PqNMch+/fKL1GII6 zcuw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BFoMuCrv; 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 af79cd13be357-7c3e54fee3dsi426816785a.295.2025.03.07.11.38.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Mar 2025 11:38:15 -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=BFoMuCrv; 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 1tqdWG-000103-Ch; Fri, 07 Mar 2025 14:38:04 -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 1tqdVk-0000ut-2D for qemu-devel@nongnu.org; Fri, 07 Mar 2025 14:37:38 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tqdVh-0007Wx-I2 for qemu-devel@nongnu.org; Fri, 07 Mar 2025 14:37:31 -0500 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2ff6cf448b8so4273288a91.3 for ; Fri, 07 Mar 2025 11:37:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741376248; x=1741981048; 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=Y7TO8UyCMpQA9GFmU43KRp15LWAsbGPR+sOTKQ30ilM=; b=BFoMuCrvUuS4eXoFVuUPaxeu78aFzAQKUKHd9GgvIhJxNZMcdCJRQtiQQeVJpGNKpH Gim2aW71AVVhc2lvjGn+01t+jSqTTkDI9BwDxp7PopFXAmr+AybwalnZXlF1lCME8yL0 xDCYV/PzZHUfXQkxb84RTGJfUxDYVGNI3m2qO6redEBMLmmjUt1wWL3QJdrIrhKytYY8 IU6sXFpOKA2LNqIXmcYpw/xXmvdfg6oyu+H7z/VcfkVlxN5eZKAeIjx9L6WgZPWbrf7C edw5moN0bkUC/RHh7Wfcaf0Bw/uup1+qEKoM7Dq5C2Dq5kUf5fhGbNqvHAcVWIW978RL JD/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741376248; x=1741981048; 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=Y7TO8UyCMpQA9GFmU43KRp15LWAsbGPR+sOTKQ30ilM=; b=cMHQrdTaNUhzWNU4bVHENTUbzMSzYwIuInaNnl5jnM/lGFzAEZDzr2qAilAcP5kmGL G7V/srXi91BaocVmW7ppOga8C8JkFgj+BehO2fcpWxPYh6EwgOf5c4V1oBFiMMoZ6G4q H/p/XAb/y0+4q5zgcea39/i9PupWdMKTim2I0u6D5o1IJ3M8SfgW0fFoehZx5jyA5BxC AqJva9g8dKRhtwJ6aNkkcg5wNTlYYhEfiN5vtSMpfqp1YDsTmU61n8YuU2aUsWJqRQu9 59XF0waV9zildgy8O5HiFjarYXf918NVd/cDuTy++DdCV89CdXElJo5/jlqxXOlT6wDp PA1Q== X-Gm-Message-State: AOJu0YxN+lhbC6jPnw5drJWgAM4pgLWG1JNZD+O1MFEsfYrwLrYyGvH9 th/Hn0vnScY4L6WEWIWGP0hNYVy2GuhpO79hqSPO5QNJXrVxGILEO5SBQtv8wBXmvVEKK37vD8C U X-Gm-Gg: ASbGncu5z+VwV6A/MZleFq80VSnegnLOxEt1RUwfS0gQzFM3IUKkWPxvKMFCGNRQXES nttLpgc7aZqsTT/Pf1iPkCJPS9JBjJFxBAVcFj9CgrynWz3PN8Qrn2WFXXuM/iTRpPhLXiwjC+v 2QAuOX2DXGip9rOVhvixlA/s/qP6y3vqqYcY+xGMYp84U8xe2I9z1DhIjKBiW8k4pEiBAiS25NS tNb4KuLuNiTtaKcCHn6jPsrKEjsefu8WlF3lfowSMIuHD2LB9Cs1UhEpzgASeSX5bmPyzUz/NZt fd64+rvRvyXBYnUfzbSV1Gopa6Czd35KUxLL4OfHsn4k X-Received: by 2002:a17:90b:38cd:b0:2fa:17dd:6afa with SMTP id 98e67ed59e1d1-2ff7cea999amr8282502a91.17.1741376247034; Fri, 07 Mar 2025 11:37:27 -0800 (PST) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ff693739ecsm3821757a91.26.2025.03.07.11.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 11:37:26 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, kvm@vger.kernel.org, richard.henderson@linaro.org, "Maciej S. Szmigiero" , Paolo Bonzini , manos.pitsidianakis@linaro.org, pierrick.bouvier@linaro.org, Marcelo Tosatti Subject: [PATCH v3 5/7] hw/hyperv/syndbg: common compilation unit Date: Fri, 7 Mar 2025 11:37:10 -0800 Message-Id: <20250307193712.261415-6-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250307193712.261415-1-pierrick.bouvier@linaro.org> References: <20250307193712.261415-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pj1-x102b.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 We assume that page size is 4KB only, to dimension buffer size for receiving message. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daudé --- 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..0ec71d9bfb8 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'))