From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:a17:906:d7a2:b0:96f:a786:ac5c with SMTP id pk2csp2791023ejb; Wed, 31 May 2023 04:48:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7QFWacB2ANXpqLu4LRnpOyycJhCNL6kCFYuaso4q2QGZACACSz+ifkQ9tmdaym/39c8efj X-Received: by 2002:a05:622a:1303:b0:3f3:96c9:b075 with SMTP id v3-20020a05622a130300b003f396c9b075mr5748515qtk.31.1685533698786; Wed, 31 May 2023 04:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685533698; cv=none; d=google.com; s=arc-20160816; b=lBH5zM3RxTpRTkQHLfxTZhEzU8BqblvOiZRaM1TVS53IuOb+TouWf91ZJ/xnXRnMgr 5QqjzDP9aR6x9s/rf/Rn0M1Q3+nHswatXTPWoYuwuPGYpCQ2EgBNT4YlEsIJbesP53LL /Z/9Ml8f73Qj1BtcNbbd1JRhiI9mtnzLENrc6XV89FaKXI0KaZNF5rm1pxQxIz6MAEeY wG2Hey2W68qiKKF0veB81YVlE0KfKrR8jJxZfBcEdTvJfZMeoH7xeOnnAHbJdWfdAUI+ 7WkIvW6Gv4KnOXTIvMMo2/mYXz2YtxfM3wz3ageteW0aQVBFMGaPgkaSCmq9XDxpVO2u 2fMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:feedback-id :dkim-signature:dkim-signature; bh=a1k2OEmy5YzcGYZ7zxNK0XmeUsHldEWsiG8FKet/Kx0=; b=XAn3D4Ur1zprTpc0vK1208awNZEe0FGV2xaTfmMeWwwAZNZfzg7JH7nQv2P2w3UqrJ sLJysnT+vUjbRAaCeU8zZGeOQmBUg1JetqQGg0wIaaXKB3ZvtkFbyyrs+FjM9CdJLVGb 8Q/C9eS8gYJMZ+mF+LosoSsDrgo7+Gm7taOVW4+OVBnjA9wh7eWefHxY4PCGffgHe02W CLSKyLpZ+lfGs/9kwKSkHhEGGxeaJfM2MX+EaNL5Q/q1j/y3T2Dj1ouL1ttRjJku+7It YCgs6BJUzTarA9VML7L5Ai2SM2UpDtYJ7XtiFprQsujA5jOeWor1R0K0lid9WrjmKXDA JApA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@irrelevant.dk header.s=fm3 header.b=XNqSbRdb; dkim=fail header.i=@messagingengine.com header.s=fm1 header.b=BRIdZs+O; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u18-20020a05622a14d200b003f38d64e109si7762566qtx.722.2023.05.31.04.48.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 May 2023 04:48:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@irrelevant.dk header.s=fm3 header.b=XNqSbRdb; dkim=fail header.i=@messagingengine.com header.s=fm1 header.b=BRIdZs+O; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4KJ9-0001On-SJ; Wed, 31 May 2023 07:48:05 -0400 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 1q4KJ3-0001OC-H9; Wed, 31 May 2023 07:47:57 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4KJ0-0002xx-RN; Wed, 31 May 2023 07:47:57 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 86FF35C0195; Wed, 31 May 2023 07:47:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 31 May 2023 07:47:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to; s=fm3; t=1685533669; x= 1685620069; bh=a1k2OEmy5YzcGYZ7zxNK0XmeUsHldEWsiG8FKet/Kx0=; b=X NqSbRdbM8GGItOMKjllLFbsNGVchuBn+jbgLLFVa09x+2NG657ftAgOFupAw+YOa 7V9X+ZyDN/59F8G6oWVSDm+XvexkcPVW+MLBNhOXXtxIgM1WiXb4FkWibRv5aTsR iXVUzzofhoRdGLgTDwxn3tij33Z4gTSMlLfe+IYzIqYR10GvXlmP8PQbxELOW4k+ xu9Uv289J+6sz69869EFf8n4G3ZUrW4je8rvn/5NU5KGa1/f74jll5UymnSi+aXH R/OJ8TXrrt8Qjv0gcD6DBc/jM/20cTjOMdUG5DtLmvMTPHLqJOcQ41vK2teQ3krs Qc3ierd1Mf5M6wfQFJfmg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1685533669; x=1685620069; bh=a 1k2OEmy5YzcGYZ7zxNK0XmeUsHldEWsiG8FKet/Kx0=; b=BRIdZs+O1t7XDHWCL Eyhry9Bb784Da6mXXd5XLMYse2a5lIynjyBQi56p9ZjP5acq/gNGA165i2NGCVEg NN//dG21KCrR/pbJoqI0rAsZz9uflq45JQSgsgkKifj8BmbeigNVfePEJUUGlh6C hv81ldJ3PeUwJaw6tI+/zSe/CbnAPd4L+2PjHW0+AjSnV4TBAMK1RW7ArKvcuN1N +GCe7zpbaR0qHALaEnII/7KXwgG/k4jfeBjijNEIPKpTVUATA5R4ziuLpxlviBoM Y3MNBQcnKgA7w0VKdXJRta9P/p7c+EImXhienQ1DmPXvWrVG0bNcfdE9bOtAjyQf S8bRw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeekledggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgtggfgsehtkeertdertdejnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeefgfehudefjedvgffhheelvddvvdehfffgtedvffeugeeigefggffggefhieej leenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepihhtshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 31 May 2023 07:47:45 -0400 (EDT) From: Klaus Jensen To: qemu-devel@nongnu.org Cc: Corey Minyard , Keith Busch , Jason Wang , Lior Weintraub , Paolo Bonzini , Jeremy Kerr , qemu-arm@nongnu.org, Matt Johnston , Peter Delevoryas , Jonathan Cameron , qemu-block@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Klaus Jensen , Peter Maydell , Klaus Jensen , gost.dev@samsung.com Subject: [PATCH v3 0/3] hw/{i2c, nvme}: mctp endpoint, nvme management interface model Date: Wed, 31 May 2023 13:47:41 +0200 Message-Id: <20230531114744.9946-1-its@irrelevant.dk> X-Mailer: git-send-email 2.40.0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3237; i=k.jensen@samsung.com; h=from:subject; bh=4j/eaYhClLaSlHdkVQI4N2TzX2t5KsyuOnHaHFUytnY=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGR3M919i45+JRsZuRLELXCLjRWydkvQqx8fZ aAZ7/tPASf6EokBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJkdzPdAAoJEE3hrzFt Tw3p//gIALovzf+ZLUwAMHTL5RqQhWvPjsAgsdQcSGU6SirKrvE5vebDIUUwMjrBMUIkxI7JRT+ ve/6VQmkxtI6KCaH6m253Wwl83OrRKtpAYbwtRZLT7hAwr8vN6qakHnUa8lR1bbaP04PKn4h9Ny go2eWTIZ/UptmpUfUKiPojJefbpuvK6qA+R41p0P+U0FUKDSIrjTgmaf/Cex++4tvmNXUKlYk36 nspTh0WWzsaJ085J6zrnYmnuFO8SoeokMvoS7wNBpN6u/712Gdp2fGpLnqTvo3RPI+or6ll3oD1 C9ziZHTZH9l28SUOBRQSkz2uEL7uOqnEAtQmXeqm4HbEEq7tsyUAM6vI X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=66.111.4.29; envelope-from=its@irrelevant.dk; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@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-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: c/z2Z5J0nkzi From: Klaus Jensen This adds a generic MCTP endpoint model that other devices may derive from. I'm not 100% happy with the design of the class methods, but it's a start. Also included is a very basic implementation of an NVMe-MI device, supporting only a small subset of the required commands. Lior (CC'ed) has some patches coming up that adds futher support. Since this all relies on i2c target mode, this can currently only be used with an SoC that includes the Aspeed I2C controller. The easiest way to get up and running with this, is to grab my buildroot overlay[1]. It includes modified a modified dts as well as a couple of required packages. QEMU can then be launched along these lines: qemu-system-arm \ -nographic \ -M ast2600-evb \ -kernel output/images/zImage \ -initrd output/images/rootfs.cpio \ -dtb output/images/aspeed-ast2600-evb-nmi.dtb \ -nic user,hostfwd=tcp::2222-:22 \ -device nmi-i2c,address=0x3a \ -serial mon:stdio >From within the booted system, mctp addr add 8 dev mctpi2c15 mctp link set mctpi2c15 up mctp route add 9 via mctpi2c15 mctp neigh add 9 dev mctpi2c15 lladdr 0x3a mi-mctp 1 9 info Comments are very welcome! [1]: https://github.com/birkelund/buildroots/tree/main/mctp-i2c Changes since v2 ~~~~~~~~~~~~~~~~ - Applied a bunch of feedback from Jonathan: + Moved a lot of internally used structs out of the include headers and into the source files. + Added spec references in various places + Split the patch for i2c_smbus_pec() into its own + Fix a compile error (and bug) in nmi-i2c.c. - From Corey: + Reworked the buffer handling. The deriving devices now returns a pointer to their own buffer that the mctp core copies into. + Added a couple of extra debugging trace events. Changes since v1 ~~~~~~~~~~~~~~~~ - Fix SPDX-License tag for hw/nvme/nmi-i2c.c (Philippe) - Add some asserts to verify buffer indices (by request from Corey). - Drop short packets that could result in underflow (Corey) - Move i2c_smbus_pec() to smbus common code (Corey) - A couple of logic fixes (patch from Jeremy squashed in) - Added a patch to handle messages with dest eid 0 (Matt) Maybe squash this as well. Klaus Jensen (3): hw/i2c: add smbus pec utility function hw/i2c: add mctp core hw/nvme: add nvme management interface model MAINTAINERS | 7 + hw/arm/Kconfig | 1 + hw/i2c/Kconfig | 4 + hw/i2c/mctp.c | 398 ++++++++++++++++++++++++++++++++++ hw/i2c/meson.build | 1 + hw/i2c/smbus_master.c | 28 +++ hw/i2c/trace-events | 13 ++ hw/nvme/meson.build | 1 + hw/nvme/nmi-i2c.c | 367 +++++++++++++++++++++++++++++++ hw/nvme/trace-events | 6 + include/hw/i2c/mctp.h | 137 ++++++++++++ include/hw/i2c/smbus_master.h | 2 + include/net/mctp.h | 28 +++ 13 files changed, 993 insertions(+) create mode 100644 hw/i2c/mctp.c create mode 100644 hw/nvme/nmi-i2c.c create mode 100644 include/hw/i2c/mctp.h create mode 100644 include/net/mctp.h -- 2.40.0