From nobody Sun Feb 8 05:29:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1770321613; cv=none; d=zohomail.com; s=zohoarc; b=A58YwT1CQOtMyLYdz5/+zxDUuouTjNJ131ko0il/gSzcQ97OorbiayVa+o9keJkUDYG1S0gcBQRGJvxcNAOebcrWWcKcHaReNiXcCD1LS5GiXrmByWea3PfjFkwCs7BhNTyW4aApQNDCfPk5zUQcIJ8FfPDi4czym6m4Brf3+hM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770321613; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hwJ8SbAz2trPDggbZFa9euH7TZu8N5wzkSpK4AYe4+g=; b=jF6Cu8cGENnd+X3alK0yuyN2F2RjiGsfaan01CgElmfw2Aj+l/oAFvpDegO++kFIGbMSJ6GJtn8J+GBOr+Ds+nsD+Enoqmlg/PTfhMTbPa3TrbCL7FAYayWxAjq1HxaWFPqL0kffHD0n+Fj4OYsPtZQ0qYQilaoi/ZmfjByNhtM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17703216135841002.5719948055477; Thu, 5 Feb 2026 12:00:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo5V4-0006VQ-2f; Thu, 05 Feb 2026 14:58:50 -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 1vo5V1-0006U7-So for qemu-devel@nongnu.org; Thu, 05 Feb 2026 14:58:47 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vo5Uz-000311-D6 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 14:58:47 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-42fbc544b09so1266159f8f.1 for ; Thu, 05 Feb 2026 11:58:45 -0800 (PST) Received: from thinkpad-t470s.. ([93.140.16.93]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-436297450b4sm514079f8f.34.2026.02.05.11.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 11:58:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770321523; x=1770926323; 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=hwJ8SbAz2trPDggbZFa9euH7TZu8N5wzkSpK4AYe4+g=; b=fDVPGLmCCL1w9uolhwCfLKFh9mNpgvEEUF4+mfvQwMDV0NiGDd/9INbO2Ji60fb1GY IAFsWBlMU4naF67xCc80qIXujkS1jVs4HRq69pL9DS21XgskY02V4V4jrt1weFdOA2TW ALhX1ULzj0fpT8UI0aS+ex9WwaiFqU+dJo1ZMSCEDmtcOXUlpgHnGXFure72qar02g2J s+z+Uv8dj74WEwa/4TSbEGFokuSNmk4vFd6wsdgohU7cJHu+w/j5IBHcSjg/rtfVtuVG aS/twF4UxfspUpYmtWdkJM+TrtlOTDJpVoOnTlT2qk3tyE5GYSnQpf1dQEAThwKH1yGQ n8AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770321523; x=1770926323; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hwJ8SbAz2trPDggbZFa9euH7TZu8N5wzkSpK4AYe4+g=; b=jVpc/CtERAtqGoIhcOo8RMhZDZWs2XEU0qodaZXUtIGvNqB9wLh+MUyc+KRgjSBvU8 T+T0Nr05tgHW8B7Fpuw8mNyoy4AWeJszBYEnWhs6kiOHquMO7oPSQaMwOgTc2rfJG6/8 QHqCTVSBc0o+V/M0F2N2JKnHnFcU+SHF5in13ePBlyLDYGQa74k1Kzj1WJq1+ZqGqjXF 5hknc9LRKpua1U+X6j4LBG5rfpvFzzMW+/dIhpsHCkIc7IjCGgKmBQAK/6xcwL5Q5YIM gtlgtVLlYwbwUATf/XUpZRQlSYdhzr20SVQxe5kInftdjzl6iao5pReEB+ovsJqt5gh6 7vkw== X-Gm-Message-State: AOJu0Ywqhfzhv22CcvI0iXjTqCbu8bULgIeKslC7NMdEHAfJYmLEoTSM feJd7tO+TG3hKrjBTfs1ZZFIIX5Q+f9uQjkt651kAd6mawGixvGX6WryCXKCsXov07k= X-Gm-Gg: AZuq6aJgZFLLbvSUwfj5ZLASD5kxkzvPzezi0rUmJpqqOCmwPUjfQHwVIkppgFGtojf 13CV9Dk1bXcjvEUI2Aosc8lMI9+oMrvxe3pbS2OVXiX+jlshG/40zR4X0vshzpn1yZLpNsycQkN WWg2xAO4EP4E/V3mrT3PMQkXcfsRUMt7IhONTgkkvg1HnSzExdYwqrNIYQDGVwf9DzO8vyI0/o/ ZH32OyiZlTCsx5RnowY9a8iTZzWkOZ88hSpPMrdUaho8SyJ777dVrtdhGuHdRplYhC7nbdJ5YCF C8QhO33dnzOWFtTz4seTC0d1e68Ineg4Wvn+M94v9Mi7LCZ4AYyuAGY3ZTYJ4DIf2bEy+jB+gWe ZUecukEZ3k8pNrlrG/1NpoU4Uv3/Awvoyfzgz/WWPxRzR2NOj4fUw32AjLckl/+WMbWpoQJu+3o VXQKswHWKILaKYbZxxBU4= X-Received: by 2002:a5d:64c7:0:b0:429:c851:69ab with SMTP id ffacd0b85a97d-4362937fa27mr590559f8f.55.1770321523040; Thu, 05 Feb 2026 11:58:43 -0800 (PST) From: Ruslan Ruslichenko To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org, artem_mygaiev@epam.com, volodymyr_babchuk@epam.com, takahiro.nakata.wr@renesas.com, "Edgar E . Iglesias" , francisco.iglesias@amd.com, Ruslan_Ruslichenko@epam.com, "Edgar E . Iglesias" Subject: [PATCH 01/29] hw/core: Add Remote Port protocol packet definition Date: Thu, 5 Feb 2026 20:57:56 +0100 Message-ID: <20260205195824.2610192-2-ruslichenko.r@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260205195824.2610192-1-ruslichenko.r@gmail.com> References: <20260205195824.2610192-1-ruslichenko.r@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=ruslichenko.r@gmail.com; helo=mail-wr1-x436.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, FREEMAIL_FROM=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1770321615154158500 Content-Type: text/plain; charset="utf-8" From: Ruslan Ruslichenko Introduce packet definition for Remote Port protocol. Remote Port is a socket based inter-simulation protocol designed to connect QEMU to external simulator (such as SystemC models, RTL simulators, etc) for hardware co- simulation. The protocol supports bidirectional communication for: - Connection setup, version negotiation (Hello/Cfg packets) - Memory and MMIO transactions (Read/Write packets) - Interrupts and GPIO signaling (Interrupt packets) - Time synchronization (Sync packets) The patch introduces header file with packet definition used by protocol. Signed-off-by: Edgar E. Iglesias Signed-off-by: Takahiro Nakata Signed-off-by: Ruslan Ruslichenko --- include/hw/core/remote-port-proto.h | 305 ++++++++++++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100644 include/hw/core/remote-port-proto.h diff --git a/include/hw/core/remote-port-proto.h b/include/hw/core/remote-p= ort-proto.h new file mode 100644 index 0000000000..cbe1498df0 --- /dev/null +++ b/include/hw/core/remote-port-proto.h @@ -0,0 +1,305 @@ +// SPDX-License-Identifier: MIT +/* + * QEMU remote port protocol parts. + * + * Copyright (c) 2013 Xilinx Inc + * Written by Edgar E. Iglesias + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ +#ifndef REMOTE_PORT_PROTO_H__ +#define REMOTE_PORT_PROTO_H__ + +/* + * Remote-Port (RP) is an inter-simulator protocol. It assumes a reliable + * point to point communcation with the remote simulation environment. + * + * Setup + * In the SETUP phase a mandatory HELLO packet is exchanged with optional + * CFG packets following. HELLO packets are useful to ensure that both + * sides are speaking the same protocol and using compatible versions. + * + * CFG packets are used to negotiate configuration options. At the moment + * these remain unimplemented. + * + * Once the session is up, communication can start through various other + * commands. The list can be found further down this document. + * Commands are carried over RP packets. Every RP packet contains a header + * with length, flags and an ID to track potential responses. + * The header is followed by a packet specific payload. You'll find the + * details of the various commands packet layouts here. Some commands can + * carry data/blobs in their payload. + */ + + +#define RP_VERSION_MAJOR 4 +#define RP_VERSION_MINOR 3 + +#if defined(_WIN32) && defined(__MINGW32__) +/* mingw GCC has a bug with packed attributes. */ +#define PACKED __attribute__ ((gcc_struct, packed)) +#else +#define PACKED __attribute__ ((packed)) +#endif + +/* Could be auto generated. */ +enum rp_cmd { + RP_CMD_nop =3D 0, + RP_CMD_hello =3D 1, + RP_CMD_cfg =3D 2, + RP_CMD_read =3D 3, + RP_CMD_write =3D 4, + RP_CMD_interrupt =3D 5, + RP_CMD_sync =3D 6, + RP_CMD_ats_req =3D 7, + RP_CMD_ats_inv =3D 8, + RP_CMD_max =3D 8 +}; + +enum { + RP_OPT_quantum =3D 0, +}; + +struct rp_cfg_state { + uint64_t quantum; +}; + +enum { + RP_PKT_FLAGS_optional =3D 1 << 0, + RP_PKT_FLAGS_response =3D 1 << 1, + + /* + * Posted hint. + * When set this means that the receiver is not required to respond to + * the message. Since it's just a hint, the sender must be prepared to + * drop responses. Note that since flags are echoed back in responses + * a response to a posted packet will be easy to identify early in the + * protocol stack. + */ + RP_PKT_FLAGS_posted =3D 1 << 2, +}; + +struct rp_pkt_hdr { + uint32_t cmd; + uint32_t len; + uint32_t id; + uint32_t flags; + uint32_t dev; +} PACKED; + +struct rp_pkt_cfg { + struct rp_pkt_hdr hdr; + uint32_t opt; + uint8_t set; +} PACKED; + +struct rp_version { + uint16_t major; + uint16_t minor; +} PACKED; + +struct rp_capabilities { + /* Offset from start of packet. */ + uint32_t offset; + uint16_t len; + uint16_t reserved0; +} PACKED; + +enum { + CAP_BUSACCESS_EXT_BASE =3D 1, /* New header layout. */ + CAP_BUSACCESS_EXT_BYTE_EN =3D 2, /* Support for Byte Enables. */ + + /* + * Originally, all interrupt/wire updates over remote-port were posted. + * This turned out to be a bad idea. To fix it without breaking backwa= rds + * compatibility, we add the WIRE Posted updates capability. + * + * If the peer supportes this, it will respect the RP_PKT_FLAGS_posted + * flag. If the peer doesn't support this capability, senders need to + * be aware that the peer will not respond to wire updates regardless + * of the posted header-flag. + */ + CAP_WIRE_POSTED_UPDATES =3D 3, + + CAP_ATS =3D 4, /* Address translation services */ +}; + +struct rp_pkt_hello { + struct rp_pkt_hdr hdr; + struct rp_version version; + struct rp_capabilities caps; +} PACKED; + +enum { + /* Remote port responses. */ + RP_RESP_OK =3D 0x0, + RP_RESP_BUS_GENERIC_ERROR =3D 0x1, + RP_RESP_ADDR_ERROR =3D 0x2, + RP_RESP_MAX =3D 0xF, +}; + +enum { + RP_BUS_ATTR_EOP =3D (1 << 0), + RP_BUS_ATTR_SECURE =3D (1 << 1), + RP_BUS_ATTR_EXT_BASE =3D (1 << 2), + RP_BUS_ATTR_PHYS_ADDR =3D (1 << 3), + + /* + * The access targets the I/O address space. + */ + RP_BUS_ATTR_IO_ACCESS =3D (1 << 4), + + /* + * Bits [11:8] are allocated for storing transaction response codes. + * These new response codes are backward compatible as existing + * implementations will not set/read these bits. + * For existing implementations, these bits will be zero which is RESP= _OKAY. + */ + RP_BUS_RESP_SHIFT =3D 8, + RP_BUS_RESP_MASK =3D (RP_RESP_MAX << RP_BUS_RESP_SHIFT), +}; + +struct rp_pkt_busaccess { + struct rp_pkt_hdr hdr; + uint64_t timestamp; + uint64_t attributes; + uint64_t addr; + + /* Length in bytes. */ + uint32_t len; + + /* + * Width of each beat in bytes. Set to zero for unknown (let the remote + * side choose). + */ + uint32_t width; + + /* + * Width of streaming, must be a multiple of width. + * addr should repeat itself around this width. Set to same as len + * for incremental (normal) accesses. In bytes. + */ + uint32_t stream_width; + + /* Implementation specific source or master-id. */ + uint16_t master_id; +} PACKED; + + +/* This is the new extended busaccess packet layout. */ +struct rp_pkt_busaccess_ext_base { + struct rp_pkt_hdr hdr; + uint64_t timestamp; + uint64_t attributes; + uint64_t addr; + + /* Length in bytes. */ + uint32_t len; + + /* + * Width of each beat in bytes. Set to zero for unknown (let the remote + * side choose). + */ + uint32_t width; + + /* + * Width of streaming, must be a multiple of width. + * addr should repeat itself around this width. Set to same as len + * for incremental (normal) accesses. In bytes. + */ + uint32_t stream_width; + + /* Implementation specific source or master-id. */ + uint16_t master_id; + /* ---- End of 4.0 base busaccess. ---- */ + + uint16_t master_id_31_16; /* MasterID bits [31:16]. */ + uint32_t master_id_63_32; /* MasterID bits [63:32]. */ + /* + * --------------------------------------------------- + * Since hdr is 5 x 32bit, we are now 64bit aligned. + */ + + uint32_t data_offset; /* Offset to data from start of pkt. */ + uint32_t next_offset; /* Offset to next extension. 0 if none. */ + + uint32_t byte_enable_offset; + uint32_t byte_enable_len; + + /* ---- End of CAP_BUSACCESS_EXT_BASE. ---- */ + + /* + * If new features are needed that may always occupy space + * in the header, then add a new capability and extend the + * this area with new fields. + * Will help receivers find data_offset and next offset, + * even those that don't know about extended fields. + */ +} PACKED; + +struct rp_pkt_interrupt { + struct rp_pkt_hdr hdr; + uint64_t timestamp; + uint64_t vector; + uint32_t line; + uint8_t val; +} PACKED; + +struct rp_pkt_sync { + struct rp_pkt_hdr hdr; + uint64_t timestamp; +} PACKED; + +enum { + RP_ATS_ATTR_exec =3D 1 << 0, + RP_ATS_ATTR_read =3D 1 << 1, + RP_ATS_ATTR_write =3D 1 << 2, +}; + +enum { + RP_ATS_RESULT_ok =3D 0, + RP_ATS_RESULT_error =3D 1, +}; + +struct rp_pkt_ats { + struct rp_pkt_hdr hdr; + uint64_t timestamp; + uint64_t attributes; + uint64_t addr; + uint64_t len; + uint32_t result; + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; + uint64_t reserved3; +} PACKED; + +struct rp_pkt { + union { + struct rp_pkt_hdr hdr; + struct rp_pkt_hello hello; + struct rp_pkt_busaccess busaccess; + struct rp_pkt_busaccess_ext_base busaccess_ext_base; + struct rp_pkt_interrupt interrupt; + struct rp_pkt_sync sync; + struct rp_pkt_ats ats; + }; +}; + +#endif --=20 2.43.0