From patchwork Thu Oct 23 09:42:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 633 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212621; bh=JPQ92QoKQc55mqHwGAQUbuYKWD9N5BjLqSQ9ExKKbhE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=mBTz+WUZcK5Y7EG3fVgnz4YMwNZsJ+wxj+Rnm+6VU3DCmfJdCYlwWZ0aaEwEr2Ki2 F+3hf6d9TZsPUpk/fZdBUbk7OX8FRaVwNvlPP5LFDhppUFI46ix72DnUUouyOrT7sN Ivx2c3Zy5jyKOooeFD1kPUkpuQ3p3nX8NSsaNrqp7YFfQX/9Wp0MJEM7HMC9ZFa94E OnB76ELvFU5v8vWPINPc8tyEw71WB2ykV7idAQ+p1xv6O4XFESfJ3yV97rxGVY6bBV kx0GenqZpl1VAMfo2Jc3Jpf5TH6+NcDnS1IDPYk+BvSyx9x61c18bCWTiPYmMzJHP5 QmV1wfa2XC7EA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C92D568195 for ; Thu, 23 Oct 2025 03:43:41 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id leoxcNgyZ43n for ; Thu, 23 Oct 2025 03:43:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212620; bh=JPQ92QoKQc55mqHwGAQUbuYKWD9N5BjLqSQ9ExKKbhE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=k6eUbuBDx5pJDWj9iYtLzsEtrJmUcmpSnhmJk/LCmfT/Ho7O5mNwg3GKVvZsjUU/M zO5DtYKfggSY+Xv5tOpWW0Yg+40F/P/KMUx9XbANngdGnaM4bQVWCu7OAOQ7Ozm4Ti zMicDMLKo/6S1QKrnPMgCPt2IfwYvCjByzJteF99V2kwudJugsGj71EDxSrqpEJ0Xn UbA6MZ/UbK1odpeEScYq1WvN3AaE4Fa228Md7bZ0aDVm+mPNSQapU7Qbt7+L/jA8Pn H1HrtwIKzvRIBBXYFyQ698CUTcQimPV4Ajk1jOi1LlDDpO0bDXDdTK88+AHMRh1KMx S/xq5pZqLnSoA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DDFCB68228 for ; Thu, 23 Oct 2025 03:43:40 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212617; bh=E8mwumk74sgLp+5uN0MJCHAIFBLGPQ2pl7GVywqZwNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5DO6qJPfiYJAlk6lIZO/i4WeajMtoZLDSdp34iVSUVJyWmU936Tzrc+oBb0RYwC9 Wk29Ukx1WgV5vaiHCUgvh8LHgBZG+PNB2NJpY5r9Hzvvql4Gmc2nqtG4AHkpqH8EHt BlBhYD+LgQSL1QbBU33aC8NxsvmYU3SR8bEBrQmd4vplutLlRCtvQ21rCvbaHEiHsA dKpQrifyl9uvTvvZkDRZVXfGMX3aX4oWVAo6vyBC+0hm3QnXes1ryHPeMIWTDqEtx7 0KjByHVr564OO42tLifQrg2zOXuq2QLN1AOCIn8nHCUiYqDs30EjI0XEiQUDwQu9WR b/UKxPRbYZPiA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 841CF68245; Thu, 23 Oct 2025 03:43:37 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id l2l37bbT9x7S; Thu, 23 Oct 2025 03:43:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212617; bh=H+TNFxGSfZnB4RjvDUojmOvrUv3O+2Cbb5gXLPP6XSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RA2dW7yCHXTheLYHbiLp+OgHdVCg8qYY0xvnPxn2qxbbgYiWwvqrHO2QlluJoyA6v k/TwWuPsyIXmoY9eMw9iUODV6Uvbw6yftPbboM6C5iNjx7zdikR/GEQ+z8755DA47R SB9qpzy1qJQ+YneCFhvBc9DeEEPCNsnkisgBNczXXelMA6RWL8vr6E2vkcR2CAKgN6 1WrXbIHzeAuUzVID1rvmNP67nXf1596mhUDOCJ8Q0g4HQi4p7zO4DV5fKtkgVVEILq 4mZr1JSjogbiJFDpWMeyiVInXIfV9hxwzl7+uJTL02ICP4pKjm5x/VUjX/bl7iCFCQ DdRHg7aGF1J9Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E6B5C6819C; Thu, 23 Oct 2025 03:43:36 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:50 -0600 Message-ID: <20251023094308.3406453-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UIDMYJA7NFXF7WSCIEEWCIL5FYWMZF7J X-Message-ID-Hash: UIDMYJA7NFXF7WSCIEEWCIL5FYWMZF7J X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/11] expo: Correct handling of mouse clicks List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Due to a missing return in bootflow_menu_poll() a click on any object is handled as if it were a click on the settings object. Fix this by returning the correct error code for unrecognised clicks. Signed-off-by: Simon Glass Fixes: e94de63e6c8 ("expo: Add a way to select settings") --- boot/bootflow_menu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c index 26a2f559958..eda95428bf4 100644 --- a/boot/bootflow_menu.c +++ b/boot/bootflow_menu.c @@ -418,6 +418,7 @@ int bootflow_menu_poll(struct expo *exp, int *seqp) case EXPOACT_CLICK: if (act.select.id == OBJ_SETTINGS) return -ECOMM; /* layout change request */ + return -EAGAIN; case EXPOACT_SETTINGS: return -ECOMM; /* layout change request */ default: From patchwork Thu Oct 23 09:42:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 634 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212622; bh=AjQi+OdP6HEEXVefrpket3GdXLRgcsOZOURyQYk3JhU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=sTBxMENioGoc//f5XMyvA0FZCh7i9AitHk5ZFpdsopMFl0aQW7L/Owb91s4I/qrXB S4y7G7R/hnygjTpvEAtwj92gIrpqz6FFlg2tIyy/FSl0fmde4xAXCZr2vleAZEHGrt hzfLXLdGbmvxyBNP5zNUGsBC8hLrfEat89O5mJ3Iig2+wDkyNcOBdKEMFi+6bW9S+w 0mC9CvkZ0wox+a335o2p02KFBnYo84CIvO4BaOyGirURFrUPHsx44yMtur+4tMMEfJ I1AB9kXlfod/KSb0u/ew2c6hcw4gaLS6/PRFYMOvA4xDxqJuqLVq3hfQfomRnEmnL8 IeX2M6p1zDG5Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3342F682A5 for ; Thu, 23 Oct 2025 03:43:42 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Oby-nAXGe8od for ; Thu, 23 Oct 2025 03:43:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212621; bh=AjQi+OdP6HEEXVefrpket3GdXLRgcsOZOURyQYk3JhU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Z9og4PNIjkqUFAOKjh1NXTRkZ82sm61EY4iDhYdyEoEGJbv+zBfoDC63TM2yEb57P 1h4Fw+tfTp5TkqV2Lo43jWuiYZk1oNm0/NeD8iMsoJvXK11fEhufRB5FqAx1kuS215 kUaSz1dV5FPb9ITUtL5sdl8gBNqsbu/Ahz+E+F40VVAOOy5wmBKeuS8uYUUtCo3VSZ qrOjbNWrj7wIdl4CswR3NRf5srrb7ApKC+9TJ4FaJs0keUTPFM06Mtg/NP4cxQZDee yZpfbICkN6mIPNVADgg96gK/NssHBbRTaI5GpOuYvzm+aXnAQdvOv/UidZjwfDnah4 PsSd8PukEdcOg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 40E30682A8 for ; Thu, 23 Oct 2025 03:43:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212618; bh=P625vaKKmB/9oivVVxuYjy5HUrv2jc0qYcVejwKxjc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bh1GQKpfWvBkfDx2lqrbjICSJkUZJG6eTlnfT1n7M1H2BliWcP2SAFutlfDM0jXL4 w1PfHISdQKo8n4YV85+ho89GsOp5GN8zZ+ODLDwrw0LAoV7K2L2YLQS/9CGdb7XfXa Hq2DhTMKpRoghFo1z4jHKr+eeIa5tpW7RJnF59nDtOvqvfVQw5LpFRijui3YK42FlB V93WAwvA78Ma9QFNH2p88TLIlUShAH/TBv62qX3kr+Fz9tK7S3SMruvOH7eWK1oKjQ ZpBxY2o349DSWC5HoGzFGZUGH0LXIpLRSI4PFMI1eqCQ54l6MCTtxrEAIQAmiX7UvS YsIox5gHjHBRg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5AC9A68195; Thu, 23 Oct 2025 03:43:38 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id GNCgNeIsqLnr; Thu, 23 Oct 2025 03:43:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212618; bh=zajFjaUC3qRolKqOfEN00KDaaAzvKAjve7WHAnaOA3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GyTHj+Cmzyr+XdpAnHr+r8mncJWd8etTwFKvTAHjkepbFh0gi++dvojkymCaHZo7y iNTm+9aFyeWu+6viyS23CAK9zNeCEaiyT6sMwRQbmaX4qFy1FFvyKM42zZTopVzpxo c86M6m8OpplMphMjfMiX8z3hr+aZfEmSkBDRCDQHMpRS8+kZrPuDuerbjf3+CfFDhY s814FwQ8Sb2RKw/Jp2pZFpA85t5eJlVV3eQ/RMyk9v4EcNn08nFIvFZryeNDeVcImW dn0QYmDNY5Jfwvhv4x2jkhwuTK/zLRZNuP7xubUDLm+GM9h22Is7bI7XgUTubOPzM1 LD/blaAvn+0tA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C88DF6819C; Thu, 23 Oct 2025 03:43:37 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:51 -0600 Message-ID: <20251023094308.3406453-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7KZPP76SIZCDMVCPUFPMOAMLVQZOOQIB X-Message-ID-Hash: 7KZPP76SIZCDMVCPUFPMOAMLVQZOOQIB X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/11] bootstage: Move the bootstage record to the header file List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Move struct bootstage_record to the header file so it can be used from tests. Add some more comments for the struct, while we are here. Signed-off-by: Simon Glass --- common/bootstage.c | 8 -------- include/bootstage.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/common/bootstage.c b/common/bootstage.c index 4532100acea..1fee2edeef3 100644 --- a/common/bootstage.c +++ b/common/bootstage.c @@ -26,14 +26,6 @@ enum { RECORD_COUNT = CONFIG_VAL(BOOTSTAGE_RECORD_COUNT), }; -struct bootstage_record { - ulong time_us; - uint32_t start_us; - const char *name; - int flags; /* see enum bootstage_flags */ - enum bootstage_id id; -}; - struct bootstage_data { uint rec_count; uint next_id; diff --git a/include/bootstage.h b/include/bootstage.h index ad98bffedc3..98bd9024da8 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -220,6 +220,24 @@ enum bootstage_id { BOOTSTAGE_ID_ALLOC, }; +/** + * struct bootstage_record - information about a bootstage timing + * + * @time_us: time in microseconds, either the timestamp or the total accumulated + * time for this ID + * @start_us: timestamp of the current starting point for this ID + * @name: name of the timestamp + * @flags: Flags (enum bootstage_flags) + * @id: Bootstage ID + */ +struct bootstage_record { + ulong time_us; + u32 start_us; + const char *name; + int flags; + enum bootstage_id id; +}; + /* * Return the time since boot in microseconds, This is needed for bootstage * and should be defined in CPU- or board-specific code. If undefined then From patchwork Thu Oct 23 09:42:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 635 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212631; bh=ezoBY803esBQQDcDhccA+1dIlCgWQAvAMnl2lK8WvyU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XGyfW/Hz9JwSGjHs0/FWC9n/uO7L3VIuXxDseSm/9NoCitaMcP9J1ZxW+TFTel2xC X96xChBEcjuVDgnlohPRL9Gm1YZA4qOkOI94JrPZ7hk/TjGhMq8oM/CdBaG2QXIpKc ZkRQnrrYcx0GFSag6MXWHLolYZZW7+UZAEKdZAHCafWDSSf4jD5DcMcq4Raj3PcOTb Z1Z2pfQnMbAazoLACKHGrLCVh7ni8XaoxvgT+nhQbJcRyynk3MfgOUqnZ5ULqlPgy7 38AKRYDv7GVd6XudXEeefazJ/udIfetsDoipYiEi9PvG4L4fiXygBuRh7CI7JjwHvW 6qFAq7tb+WT+w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2D4746819C for ; Thu, 23 Oct 2025 03:43:51 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 4L99IS-3oJMw for ; Thu, 23 Oct 2025 03:43:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212629; bh=ezoBY803esBQQDcDhccA+1dIlCgWQAvAMnl2lK8WvyU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=O0DUzjF8ohtYwzUqB1roo+tT6iWoQRwFxN4rg/vtp5SLAG20cf/SgejwhZNmI+9Xe dVCjooeY5V5V01kxvYb/k460FTc56rOaxllitsrBtZrDPjkRPa99hE2dXpHbz+lTWI WV6Ort/Lj8lvc1dH1r/hMpgjlTvxbcvNXFKTSq18bqCshoz/8BrfmGkz/S/+AQOInt AN3sdplk8qUGyshb1Ku1YSn/hua85figamP1m0IbfXTXL0nx7n6TYPHOuDwwYB/jNW uxZqd2pR3JbZxF/hGDGr+cSj0EveLW5Vm+XBOwgD79FAMbZjJCxlAoQJmKlkQAV8xl Tp7Q/QaBPNfJQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DB55D68228 for ; Thu, 23 Oct 2025 03:43:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212626; bh=intczG/AjPUPjVb6IAZHcXYFcFnlAJk2At9zR6BAR+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BiikgPWK3xQUJ/A/y1QiMdpxFspbfhui5NygOeOHqGRBxH27y7AZv1cF64BT78LMd +Lj1bLIPoS0n1w1sVynpE+J6ygNjSybRfKubWX0MRPQm1Bze0nOzCUXlVzA0MbsnWc dcdzKQ3b0YDOwY9Olk0aI3z9EXj8IcDCsTYJWZjh0Kp4VQc3o2tkvOmYMvg4siExNp OGGp1Z+gOhj/RqaiO6DAdojKQf3JlqtEqWD/aKGEoFJtctVqX5vlo9QIOhpjZWHsnV 5ambNWCj7mjhrffHkdcUzTiz1I10b61j0cVO0hEdxZDl8lPZ/mGMYmtOmw3PYXlNXJ C1ABrFLZfh3Ig== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A82D868228; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id pmYvyq-Zpoy3; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212618; bh=cy4UFeXdCj4T/UKByURgIXnBffIkFolrGL34FNmgWZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nEYOTpgwceKhV89yOv5gu9f2OfcWitUoHSGzBr4Iuj5znXSt5Zy+0rElBuAxayGwa nmZ+6SLzLenQ+E9vddLOFY7R3p08VI00Gqq3bDAfeNFeYzP8rL13BHWJZnv785O+yl lbnbc3FgOfQjEIEhpGxmy9HgFlNWCCzXRn1T9o5JC1U3WNEUF//yavkL+Nz9crviaJ 0yaTBPYm/2pjMmWlbtFIdnvtgpMbRdch9cua9DFc4TF4iote0a2n7tuMqKO8CWFvRO t3ddJGdNLZA1CJDxQldAedUDilObwORDjKctWx8dx6vcDnZWQMSmcuJuZtYcxmNAEg Y67jTczmrQGmQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9CB536819C; Thu, 23 Oct 2025 03:43:38 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:52 -0600 Message-ID: <20251023094308.3406453-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ICBZOYP6TLOR7QLQVDJBCSS4H3H54STP X-Message-ID-Hash: ICBZOYP6TLOR7QLQVDJBCSS4H3H54STP X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/11] bootstage: Add some more tests List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass There is already a Python test. Add a few C tests as well, for bootstage itself and for the 'bootstage' command. Add helpers to access the internal state. Be careful to zero records when removing them, since if the record is later reused, bootstage expects the time to be zero. Co-developed-by: Claude Signed-off-by: Simon Glass --- common/bootstage.c | 37 ++++++++ include/bootstage.h | 24 +++++ test/cmd/Makefile | 1 + test/cmd/bootstage.c | 32 +++++++ test/common/Makefile | 2 + test/common/bootstage.c | 199 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 295 insertions(+) create mode 100644 test/cmd/bootstage.c create mode 100644 test/common/bootstage.c diff --git a/common/bootstage.c b/common/bootstage.c index 1fee2edeef3..e0298991fa9 100644 --- a/common/bootstage.c +++ b/common/bootstage.c @@ -212,6 +212,43 @@ uint32_t bootstage_accum(enum bootstage_id id) return duration; } +uint bootstage_get_rec_count(void) +{ + struct bootstage_data *data = gd->bootstage; + + if (!data) + return 0; + + return data->rec_count; +} + +const struct bootstage_record *bootstage_get_rec(uint index) +{ + struct bootstage_data *data = gd->bootstage; + + if (!data || index >= data->rec_count) + return NULL; + + return &data->record[index]; +} + +void bootstage_set_rec_count(uint count) +{ + struct bootstage_data *data = gd->bootstage; + uint i; + + if (!data || count > RECORD_COUNT) + return; + + /* Clear any records beyond the new count */ + for (i = count; i < data->rec_count; i++) { + data->record[i].time_us = 0; + data->record[i].start_us = 0; + } + + data->rec_count = count; +} + /** * Get a record name as a printable string * diff --git a/include/bootstage.h b/include/bootstage.h index 98bd9024da8..adc7b8f0a35 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -354,6 +354,30 @@ uint32_t bootstage_start(enum bootstage_id id, const char *name); */ uint32_t bootstage_accum(enum bootstage_id id); +/** + * bootstage_get_rec_count() - Get the number of bootstage records + * + * Return: number of bootstage records + */ +uint bootstage_get_rec_count(void); + +/** + * bootstage_get_rec() - Get a bootstage record by index + * + * @index: Index of the record to retrieve (numbered from 0) + * Return: pointer to the record, or NULL if @index is out of range + */ +const struct bootstage_record *bootstage_get_rec(uint index); + +/** + * bootstage_set_rec_count() - Set the number of bootstage records + * + * This can be used to restore the record count after testing + * + * @count: New record count (must be <= RECORD_COUNT) + */ +void bootstage_set_rec_count(uint count); + /* Print a report about boot time */ void bootstage_report(void); diff --git a/test/cmd/Makefile b/test/cmd/Makefile index 3fc07f0cacf..9cd8ea3aaf0 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -15,6 +15,7 @@ obj-$(CONFIG_X86) += cpuid.o msr.o obj-$(CONFIG_CMD_ADDR_FIND) += addr_find.o obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o obj-$(CONFIG_CMD_BDI) += bdinfo.o +obj-$(CONFIG_CMD_BOOTSTAGE) += bootstage.o obj-$(CONFIG_CMD_CHID) += chid.o obj-$(CONFIG_COREBOOT_SYSINFO) += coreboot.o obj-$(CONFIG_CMD_FDT) += fdt.o diff --git a/test/cmd/bootstage.c b/test/cmd/bootstage.c new file mode 100644 index 00000000000..dee4a0671fa --- /dev/null +++ b/test/cmd/bootstage.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Tests for bootstage command + * + * Copyright 2025 Canonical Ltd + */ + +#include +#include +#include + +static int cmd_bootstage_report(struct unit_test_state *uts) +{ + uint count; + + /* Get the current record count */ + count = bootstage_get_rec_count(); + ut_assert(count > 0); + + /* Test the bootstage report command runs successfully */ + ut_assertok(run_command("bootstage report", 0)); + + /* Verify the report contains expected headers and stages */ + ut_assert_nextline("Timer summary in microseconds (%u records):", + count); + ut_assert_nextline(" Mark Elapsed Stage"); + ut_assert_nextline(" 0 0 reset"); + ut_assert_skip_to_line("Accumulated time:"); + + return 0; +} +CMD_TEST(cmd_bootstage_report, UTF_CONSOLE); diff --git a/test/common/Makefile b/test/common/Makefile index 7b5927b5a44..a5df946396a 100644 --- a/test/common/Makefile +++ b/test/common/Makefile @@ -7,6 +7,8 @@ obj-$(CONFIG_$(PHASE_)CMDLINE) += bloblist.o endif endif +obj-$(CONFIG_BOOTSTAGE) += bootstage.o + obj-$(CONFIG_CONSOLE_PAGER) += console.o obj-$(CONFIG_CYCLIC) += cyclic.o obj-$(CONFIG_EVENT_DYNAMIC) += event.o diff --git a/test/common/bootstage.c b/test/common/bootstage.c new file mode 100644 index 00000000000..6e97c3e3a72 --- /dev/null +++ b/test/common/bootstage.c @@ -0,0 +1,199 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Tests for bootstage API + * + * Copyright 2025 Canonical Ltd + */ + +#include +#include +#include +#include +#include + +/* Test bootstage_mark_name() */ +static int test_bootstage_mark(struct unit_test_state *uts) +{ + const struct bootstage_record *rec; + ulong time; + int count; + + /* Get the current count so we know where our record will be */ + count = bootstage_get_rec_count(); + + /* Mark a stage and verify we get a valid timestamp */ + time = bootstage_mark_name(BOOTSTAGE_ID_USER + 50, "test_stage_mark"); + ut_assert(time > 0); + + /* Verify the count increased by 1 */ + ut_asserteq(count + 1, bootstage_get_rec_count()); + + /* Check that the record was added correctly */ + rec = bootstage_get_rec(count); + ut_assertnonnull(rec); + ut_asserteq(BOOTSTAGE_ID_USER + 50, rec->id); + ut_asserteq_str("test_stage_mark", rec->name); + ut_asserteq(time, rec->time_us); + ut_asserteq(0, rec->flags); + + /* Restore the original count */ + bootstage_set_rec_count(count); + + return 0; +} +COMMON_TEST(test_bootstage_mark, 0); + +/* Test bootstage_error_name() */ +static int test_bootstage_error(struct unit_test_state *uts) +{ + const struct bootstage_record *rec; + ulong time; + int count; + + count = bootstage_get_rec_count(); + + /* Mark an error stage and verify we get a valid timestamp */ + time = bootstage_error_name(BOOTSTAGE_ID_USER + 51, "test_error"); + ut_assert(time > 0); + + /* Check the error record */ + rec = bootstage_get_rec(count); + ut_assertnonnull(rec); + ut_asserteq(BOOTSTAGE_ID_USER + 51, rec->id); + ut_asserteq_str("test_error", rec->name); + ut_asserteq(time, rec->time_us); + ut_asserteq(BOOTSTAGEF_ERROR, rec->flags); + + /* Restore the original count */ + bootstage_set_rec_count(count); + + return 0; +} +COMMON_TEST(test_bootstage_error, 0); + +/* Test bootstage_start() and bootstage_accum() */ +static int test_bootstage_accum(struct unit_test_state *uts) +{ + enum bootstage_id id = BOOTSTAGE_ID_USER + 53; + uint start_time, elapsed1, elapsed2; + const struct bootstage_record *rec; + int index, count; + + count = bootstage_get_rec_count(); + + /* Start an accumulator */ + start_time = bootstage_start(id, "test_accum"); + ut_assert(start_time > 0); + + /* Check the accumulator record was created */ + index = count; + rec = bootstage_get_rec(index); + ut_assertnonnull(rec); + ut_asserteq(id, rec->id); + ut_asserteq_str("test_accum", rec->name); + ut_asserteq(start_time, rec->start_us); + + /* Accumulate the time */ + udelay(1); + elapsed1 = bootstage_accum(id); + ut_assert(elapsed1 >= 0); + + /* Check the accumulated time was recorded */ + ut_asserteq(elapsed1, rec->time_us); + + /* Start and accumulate again */ + bootstage_start(id, "test_accum"); + udelay(1); + elapsed2 = bootstage_accum(id); + ut_assert(elapsed2 >= 0); + + /* Check the total time accumulated */ + rec = bootstage_get_rec(index); + ut_asserteq(rec->time_us, elapsed1 + elapsed2); + + /* Restore the original count */ + bootstage_set_rec_count(count); + + return 0; +} +COMMON_TEST(test_bootstage_accum, 0); + +/* Test bootstage_mark_code() */ +static int test_bootstage_mark_code(struct unit_test_state *uts) +{ + const struct bootstage_record *rec; + ulong time; + int count; + + count = bootstage_get_rec_count(); + + /* Mark with file, function, and line number */ + time = bootstage_mark_code("file.c", __func__, 123); + ut_assert(time > 0); + + /* Check the record */ + rec = bootstage_get_rec(count); + ut_assertnonnull(rec); + ut_asserteq(time, rec->time_us); + ut_asserteq_str("file.c,123: test_bootstage_mark_code", rec->name); + + /* Restore the original count */ + bootstage_set_rec_count(count); + + return 0; +} +COMMON_TEST(test_bootstage_mark_code, 0); + +/* Test bootstage_get_rec_count() */ +static int test_bootstage_get_rec_count(struct unit_test_state *uts) +{ + const struct bootstage_record *rec; + int orig, count; + + /* Get initial count */ + orig = bootstage_get_rec_count(); + ut_assert(orig > 0); + + /* Add a new record */ + bootstage_mark_name(BOOTSTAGE_ID_USER + 52, "test_count"); + + /* Verify count increased */ + count = bootstage_get_rec_count(); + ut_asserteq(orig + 1, count); + + /* Verify the record was added at the correct index */ + rec = bootstage_get_rec(orig); + ut_assertnonnull(rec); + ut_asserteq(BOOTSTAGE_ID_USER + 52, rec->id); + ut_asserteq_str("test_count", rec->name); + + /* Restore the original count */ + bootstage_set_rec_count(orig); + + return 0; +} +COMMON_TEST(test_bootstage_get_rec_count, 0); + +/* Test bootstage_get_rec() */ +static int test_bootstage_get_rec(struct unit_test_state *uts) +{ + const struct bootstage_record *rec; + int count; + + /* Get total count */ + count = bootstage_get_rec_count(); + ut_assert(count > 0); + + /* Get first record (should be "reset") */ + rec = bootstage_get_rec(0); + ut_assertnonnull(rec); + ut_asserteq_str("reset", rec->name); + + /* Test out of bounds access */ + ut_assertnull(bootstage_get_rec(count)); + ut_assertnull(bootstage_get_rec(count + 100)); + ut_assertnull(bootstage_get_rec(-1)); + + return 0; +} +COMMON_TEST(test_bootstage_get_rec, 0); From patchwork Thu Oct 23 09:42:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 636 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212631; bh=9prLg2zCsHQrbj5YTMOd943zSLh54kqXWHsKC+mlR/g=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=rnPeEn0Elf9eyU1b1Tc+FEcj83x7I4fVaf02kUTai9NW5KdE7Azf4endEIZ4stL1z 3ota0iB0XtGSTNarGfoPlx1qoHNSS1QO47cLotnK8R5NeryCRvrysQGGULkCiHbj9s mkp4lE1zyRCtA08b9+RW3IT6jkLbPLIpTk5Txh4wyYeL0wDwZNmIGvFvQ3waLYddY7 m7a3SQQva5V47f66xfZf6ian9Av9SQFTzrA7wkxI/eGZWHUeyMAzZqFeOjDQg/E57m U+5eOK/fE3P2RiPniNvfln97txPZF7fN8RFpoc31lpseyip8jegmO4tmm42Q0YjoJC yn8kP5D/S/o2w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8C07A682BB for ; Thu, 23 Oct 2025 03:43:51 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id YzDgjxEwtwdW for ; Thu, 23 Oct 2025 03:43:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212630; bh=9prLg2zCsHQrbj5YTMOd943zSLh54kqXWHsKC+mlR/g=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=gjqBJzJQKCWM9GGyBE1ZJDHRYCyGkYDTiJS6KzsCjjfDLmIrLdGPDy57nuadJSxjv 8Tb+hO9omvXv0S8fkshHJkhnfsXp6vQr9Ol1jw321NVwD+R4/DNZ1b4oSiFX/5x09M ArYSRDnj5z/JON358k/PKCT6d6wtHtRUMNEVrMyZcxlHCOqkoaneO+CmDP7T8IVBJZ nL/TT4aA5SRcTtsdp6z6jH4IGlVN5pRE6SiFU89Wrht+TLiaREcjmyX/XNYSa8jE0d el/mB2LZmkqQhzoqnQr/KhtI9NKHMQywWn/i57tttBdWyUrQXSntVym23r+ZhP5L2f c5A8zVDDw/6RA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 83BA6682A9 for ; Thu, 23 Oct 2025 03:43:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212626; bh=KxDJnXLZz565EQ/oX7T4bUM0drUcEr8HE/6Bi3kHweE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qgJGticNu8TyIemZDMHpF/be2Ry+v6MC2gDq9Od7CFS3l9rrT+ySLnQqzi8ASa5RR 9XJsHWowV8G6BvOsB3jxcGmfd2//4K4ge4OxN/fn36d5jRSyWVQK/QfXyMxNOwZA2a MPuu9bBsuJZTeJ+H8R7/vI2L+p7OqEDWbpkExHwe7PAISkR3i9mExrCEnMC4vdto4p zjB9flxxvA9njudJPf7H7Jv499esW0XNzvX3wJXqgS/LhbHr6hlQuhtGo1uRRdpWnc Enc786mMHnXQExtYHUIS6t6z6E2Aar/f7+2U5V3mjvAtVEZGQ0YhdOfyXS13WWz1fx qYx1BhVyjg8mw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BBC1C6819C; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 98rZyKAdOfea; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212623; bh=eFGHwTQdupANnKvSqY7G74bRVZrODOxF2UsNT2t6Bfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXaHksbwMNRBa+RcdXZ6vCi2Zci2VbWQ6suh0VdCzK5OohcAcVJjjSscMV7APO3Wv N2b6VD7xE5HxE7pD1xGIYHO1ffPMT8wRPEwCbsSbII/pfisMlPMxtdDFYTHfXsqrU8 /SzQZUaROPA892xE8ROLPEufCLSL8pag1Mj7MQ3zYDHkxqeyjh+igRWQIdiD+af95a /0UiC2Fs72RRcZTQW0POuBIQZcMHoh0e93nqOjIe0/95ujbtz8bhCox5KVqtF1f2/k r0I+Xmiy+KGIGD6FQixzjcNsGXCrvtgYoLemkfNv0GD9Ax7kjfpRyHzxRLIiwx2t2h Fj7AHk3K2Dt3A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6819568195; Thu, 23 Oct 2025 03:43:43 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:53 -0600 Message-ID: <20251023094308.3406453-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JJ2RYEFUFN5ZXDUPFE5AFEGMJE62BYBH X-Message-ID-Hash: JJ2RYEFUFN5ZXDUPFE5AFEGMJE62BYBH X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/11] bootstage: Add a way to read the time from a record List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a function which returns the time given a record ID. Signed-off-by: Simon Glass --- common/bootstage.c | 14 ++++++++++++++ include/bootstage.h | 13 +++++++++++++ test/common/bootstage.c | 2 ++ 3 files changed, 29 insertions(+) diff --git a/common/bootstage.c b/common/bootstage.c index e0298991fa9..567b084668b 100644 --- a/common/bootstage.c +++ b/common/bootstage.c @@ -249,6 +249,20 @@ void bootstage_set_rec_count(uint count) data->rec_count = count; } +ulong bootstage_get_time(enum bootstage_id id) +{ + struct bootstage_data *data = gd->bootstage; + struct bootstage_record *rec; + + if (!data) + return 0; + rec = find_id(data, id); + if (!rec) + return 0; + + return rec->time_us; +} + /** * Get a record name as a printable string * diff --git a/include/bootstage.h b/include/bootstage.h index adc7b8f0a35..a0f687a9a4b 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -378,6 +378,14 @@ const struct bootstage_record *bootstage_get_rec(uint index); */ void bootstage_set_rec_count(uint count); +/* + * bootstage_get_time() - Get the timestamp for a bootstage ID + * + * @id: Bootstage id to look up + * Return: timestamp in us for that stage, or 0 if not found + */ +ulong bootstage_get_time(enum bootstage_id id); + /* Print a report about boot time */ void bootstage_report(void); @@ -478,6 +486,11 @@ static inline uint32_t bootstage_accum(enum bootstage_id id) return 0; } +static inline ulong bootstage_get_time(enum bootstage_id id) +{ + return 0; +} + static inline void bootstage_report(void) { } diff --git a/test/common/bootstage.c b/test/common/bootstage.c index 6e97c3e3a72..d8f1d1d32f9 100644 --- a/test/common/bootstage.c +++ b/test/common/bootstage.c @@ -35,6 +35,7 @@ static int test_bootstage_mark(struct unit_test_state *uts) ut_asserteq_str("test_stage_mark", rec->name); ut_asserteq(time, rec->time_us); ut_asserteq(0, rec->flags); + ut_asserteq(time, bootstage_get_time(BOOTSTAGE_ID_USER + 50)); /* Restore the original count */ bootstage_set_rec_count(count); @@ -110,6 +111,7 @@ static int test_bootstage_accum(struct unit_test_state *uts) /* Check the total time accumulated */ rec = bootstage_get_rec(index); ut_asserteq(rec->time_us, elapsed1 + elapsed2); + ut_asserteq(rec->time_us, bootstage_get_time(id)); /* Restore the original count */ bootstage_set_rec_count(count); From patchwork Thu Oct 23 09:42:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 637 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212631; bh=QIxu9zplHX1egjuLyF+nw8AITqLny90OGPc904iYxVk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=k6sbbhoCdEgBZhYVGCPGnA7JskVMBPyuZi2cEkrVS2NeyQdAXt/MwvUj0jBs0WHcw yxiWA3vpBM2Xqk+WhJLA4tzp+Tkww3zji6HXkTOBJsYVhnpQPQKldZZFbNdsU5rwni Ly2OgZcXlKsvXZ6S5HH47Ak3JSns6hoRTw3lZS3aozWdZd37ZwmbeEkfM0VM5L+N9j 0puL4EnPl6+9N21beeW2KLOKIKSICVoJgDch8GclBNAZVwUnI4yDqAUqBkh8heloYP 0iJTtkI/TrQOde/I2wLShToI0zGLdj2USVvZd/aWqGIFE4FghFh4hgMziLTBbuFdJ/ U8Hk83id1TEwQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EA2C4682B1 for ; Thu, 23 Oct 2025 03:43:51 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id afOUpdT9LJQC for ; Thu, 23 Oct 2025 03:43:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212630; bh=QIxu9zplHX1egjuLyF+nw8AITqLny90OGPc904iYxVk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RWNFiOUx//1I1yEWQvG7Pm2of/r91kop3Rzm2HbJ/WARlkhYLG1H2YEzPLtfcJH85 5fJp1dyiQB5/8tEdvvCqYfyZLQFKkzoYKP6lgLvwhf/EGSFycGL30tMSbbQZZVWik8 jU5/rufSZpfwlrf0NBnYuD/brDFxbS4NpgxPto5bpvgk6J8d2casmL3e42BNRo1yUy 3p7ITadi1zalGvApkQnbOPU1Qei4kdJWKqEaNPxYTpjL8ez+19/x71E+vNb9kboPyL ui1R02z8HuFfs3s6PGBQ3eM95BZOFvRg+4VHJ5StDTM2wz/RhNRK4G89H9qfDCfzNZ harppmGGLi4ag== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DF4AA682B2 for ; Thu, 23 Oct 2025 03:43:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212626; bh=RWMljvImtCQBuMrLwLHOTS8/4extInyZQgKCesZBZC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSqlR0j9/i/Ek6pGo9loB+fl9eq0Zlwly5bFdz++ZAZ3Gvcl3wDrgNk0G/dal/S5K eMXabnb8scrozzUBBw3eK1mM393b/c/5D2JWXOV8lELq1KEJsqnMGbdRwuG2NAxsDN SKCVTxLmAck99/GqdLyEjUKi/wlONXAWhKo3q/Q1RgUx95s/ptoLCOG0r1om9z3Ehz 3ACp69boQeRM5ga3a19LGafCgGmRuSUiTR+MqPpalVPmRsMzUwF5WVsMLmVrsrVDEw F4SZD8d5BvSbF5naB70174Ulk67vq2WA/KuZa+MMNb6N04/865v0sGgrkC6g7H2tvx gbsHfZxeVtCMQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CFF3F68195; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 9eN7-WJgVTrY; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212624; bh=DXydtS9ZE0KGYbKszHuU57d9u3kMse18/K0DvQq4tN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IsvPT7oi0x0WBfV28x6ZvY+xiecD5qHYjn9TWg4zsmlo3q/PEUtJwomYiKZlijutG OYje7H++y4wfgGYWPLJqX/dDGKdkfLvgXz/U6tvFKVIXyjwYAXukBbGwjN3FkmqAfd FkiytAGpWHzLlNuozNior3nr7SuXkY5i5ue8D3zelIpZNvQWlgdpM5IFGaTASqUtI8 8rhAvWascHqkdfw1GUrcscVd3Rejj6NYLyKe1BmrcRVWHR+GVE6xcvPgPxSeDnIF3C /8KZ50fhWOU/JPA+F+wFUkmzaivoDCvItbeiXozQN6/YBgnUo8Phomrf7LVGiEGkLt XnmCWOAiQiGcg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3D98A6822E; Thu, 23 Oct 2025 03:43:44 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:54 -0600 Message-ID: <20251023094308.3406453-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: PLAJ5MPEXTHOYOAWM6OHF7P5442RIBW4 X-Message-ID-Hash: PLAJ5MPEXTHOYOAWM6OHF7P5442RIBW4 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/11] acpi: Add support for Firmware Performance Data Table List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add ACPI FPDT support to report firmware boot timing information to the OS. The FPDT table contains timing data for firmware phases from reset through OS handoff. Add some functions to enable generation of this table. Co-developed-by: Claude Signed-off-by: Simon Glass --- include/acpi/acpi_table.h | 76 +++++++++++++++++++++++++++++++++++++++ lib/acpi/acpi_table.c | 75 ++++++++++++++++++++++++++++++++++++++ test/dm/acpi.c | 73 +++++++++++++++++++++++++++++++++++++ 3 files changed, 224 insertions(+) diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h index 850cb8db816..8459fa60c25 100644 --- a/include/acpi/acpi_table.h +++ b/include/acpi/acpi_table.h @@ -760,6 +760,49 @@ struct __packed acpi_bgrt { u32 offset_y; }; +/** + * struct acpi_fpdt - Firmware Performance Data Table (FPDT) header + * + * See ACPI Spec v6.5 section 5.2.24 for details + */ +struct acpi_fpdt { + struct acpi_table_header header; +}; + +/* FPDT Performance Record Types */ +#define FPDT_REC_BOOT 0 + +/* FPDT Performance Record Header */ +struct acpi_fpdt_hdr { + u16 type; + u8 length; + u8 revision; +} __packed; + +/** + * struct acpi_fpdt_boot - Firmware Basic Boot Performance Record + * + * This record describes the boot performance from power-on to OS handoff. + * All timing values are in microseconds since system reset. + * + * @hdr: Record header + * @reserved: Reserved, must be zero + * @reset_end: Timer value at start of firmware (microseconds) + * @loader_start: Start of OS loader load (microseconds) + * @loader_exec: Start of OS loader execution (microseconds) + * @ebs_entry: Entry to ExitBootServices (microseconds) + * @ebs_exit: Exit from ExitBootServices (microseconds) + */ +struct acpi_fpdt_boot { + struct acpi_fpdt_hdr hdr; + u32 reserved; + u64 reset_end; + u64 loader_start; + u64 loader_exec; + u64 ebs_entry; + u64 ebs_exit; +} __packed; + /* Types for PPTT */ #define ACPI_PPTT_TYPE_PROC 0 #define ACPI_PPTT_TYPE_CACHE 1 @@ -952,6 +995,7 @@ enum acpi_tables { ACPITAB_ECDT, ACPITAB_FACS, ACPITAB_FADT, + ACPITAB_FPDT, ACPITAB_GTDT, ACPITAB_HEST, ACPITAB_HPET, @@ -1307,6 +1351,38 @@ void *acpi_get_end(void); */ int acpi_write_bgrt(struct acpi_ctx *ctx); +/** + * acpi_write_fpdt() - Write a Firmware Performance Data Table (FPDT) + * + * This creates an FPDT table with firmware boot timing information + * + * @ctx: ACPI context + * @uboot_start: U-Boot start time in microseconds + * Return: 0 if OK, -ve on error + */ +int acpi_write_fpdt(struct acpi_ctx *ctx, u64 uboot_start); + +/** + * acpi_get_fpdt_boot() - Get pointer to FPDT boot performance record + * + * This allows the caller to update the boot performance timing fields + * after the FPDT table has been created. After updating, call + * acpi_fix_fpdt_checksum() to recalculate the table checksum. + * + * Return: pointer to boot performance record, or NULL if not found + */ +struct acpi_fpdt_boot *acpi_get_fpdt_boot(void); + +/** + * acpi_fix_fpdt_checksum() - Recalculate FPDT table checksum + * + * Call this after updating the boot performance record to fix the + * table checksum. + * + * Return: 0 if OK, -ENOENT if FPDT table not found + */ +int acpi_fix_fpdt_checksum(void); + #endif /* !__ACPI__*/ #include diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c index f2dadd792bd..31d8d314314 100644 --- a/lib/acpi/acpi_table.c +++ b/lib/acpi/acpi_table.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -106,6 +107,8 @@ int acpi_get_table_revision(enum acpi_tables table) return 1; case ACPITAB_GTDT: /* ACPI 6.2: 2, ACPI 6.3: 3 */ return 2; + case ACPITAB_FPDT: /* ACPI 6.4+: 1 */ + return 1; default: return -EINVAL; } @@ -710,3 +713,75 @@ static int acpi_create_bgrt(struct acpi_ctx *ctx, } ACPI_WRITER(6bgrt, "BGRT", acpi_create_bgrt, 0); #endif + +int acpi_write_fpdt(struct acpi_ctx *ctx, u64 uboot_start) +{ + struct acpi_fpdt *fpdt; + struct acpi_fpdt_boot *rec; + struct acpi_table_header *header; + u64 current_time; + int size; + + fpdt = ctx->current; + header = &fpdt->header; + + /* Calculate total size: FPDT header + boot performance record */ + size = sizeof(struct acpi_fpdt) + sizeof(struct acpi_fpdt_boot); + + memset(fpdt, '\0', size); + + /* Fill out FPDT header */ + acpi_fill_header(header, "FPDT"); + header->length = size; + header->revision = acpi_get_table_revision(ACPITAB_FPDT); + + /* Add boot performance record right after FPDT header */ + rec = (struct acpi_fpdt_boot *)(fpdt + 1); + + /* Fill in record header */ + rec->hdr.type = FPDT_REC_BOOT; + rec->hdr.length = sizeof(struct acpi_fpdt_boot); + rec->hdr.revision = 2; /* FPDT Boot Performance Record revision */ + + /* Fill in timing data */ + current_time = timer_get_boot_us(); + rec->reset_end = uboot_start; + rec->loader_start = current_time; + rec->loader_exec = current_time; + rec->ebs_entry = current_time; + rec->ebs_exit = current_time; + + header->checksum = table_compute_checksum(fpdt, header->length); + + acpi_inc_align(ctx, size); + acpi_add_table(ctx, fpdt); + + return 0; +} + +struct acpi_fpdt_boot *acpi_get_fpdt_boot(void) +{ + struct acpi_table_header *header; + struct acpi_fpdt *fpdt; + + header = acpi_find_table("FPDT"); + if (!header) + return NULL; + + fpdt = (struct acpi_fpdt *)header; + return (struct acpi_fpdt_boot *)(fpdt + 1); +} + +int acpi_fix_fpdt_checksum(void) +{ + struct acpi_table_header *header; + + header = acpi_find_table("FPDT"); + if (!header) + return -ENOENT; + + header->checksum = 0; + header->checksum = table_compute_checksum(header, header->length); + + return 0; +} diff --git a/test/dm/acpi.c b/test/dm/acpi.c index a274671de02..1409c333eb1 100644 --- a/test/dm/acpi.c +++ b/test/dm/acpi.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -961,3 +962,75 @@ static int dm_test_acpi_bgrt(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_acpi_bgrt, UTF_SCAN_FDT); + +/* Test ACPI FPDT (Firmware Performance Data Table) generation */ +static int dm_test_acpi_fpdt(struct unit_test_state *uts) +{ + struct acpi_fpdt_boot *rec; + struct acpi_fpdt *fpdt; + struct acpi_ctx ctx; + ulong addr, time; + void *buf; + + addr = 0; + buf = map_sysmem(addr, BUF_SIZE); + + /* Set up context with base tables (RSDP, RSDT, XSDT) */ + ut_assertok(setup_ctx_and_base_tables(uts, &ctx, addr)); + + /* Save where the FPDT will be written */ + fpdt = ctx.current; + + /* Write the FPDT table with test U-Boot start time */ + time = timer_get_boot_us(); + ut_assertok(acpi_write_fpdt(&ctx, 1234)); + + /* Verify the FPDT was written at the saved location */ + ut_asserteq_mem("FPDT", fpdt->header.signature, ACPI_NAME_LEN); + ut_asserteq(1, fpdt->header.revision); + ut_asserteq(sizeof(struct acpi_fpdt) + sizeof(struct acpi_fpdt_boot), + fpdt->header.length); + + /* Verify the boot performance record */ + rec = (struct acpi_fpdt_boot *)(fpdt + 1); + ut_asserteq(FPDT_REC_BOOT, rec->hdr.type); + ut_asserteq(sizeof(struct acpi_fpdt_boot), rec->hdr.length); + ut_asserteq(2, rec->hdr.revision); + + ut_asserteq(1234, rec->reset_end); + ut_assert(rec->loader_start != 0); + ut_assert(rec->loader_exec != 0); + ut_assert(rec->ebs_entry != 0); + ut_assert(rec->ebs_exit != 0); + + /* Verify checksum is valid */ + ut_asserteq(0, table_compute_checksum(fpdt, fpdt->header.length)); + + /* Get pointer to boot record and verify it matches */ + rec = acpi_get_fpdt_boot(); + ut_assertnonnull(rec); + ut_asserteq_ptr(rec, (struct acpi_fpdt_boot *)(fpdt + 1)); + ut_asserteq(1234, rec->reset_end); + + /* Update a timing field */ + rec->ebs_entry = 123; + rec->ebs_exit = 456; + + /* Checksum should now be invalid */ + ut_assert(table_compute_checksum(fpdt, fpdt->header.length) != 0); + + /* Fix the checksum */ + ut_assertok(acpi_fix_fpdt_checksum()); + + /* Checksum should now be valid again */ + ut_asserteq(0, table_compute_checksum(fpdt, fpdt->header.length)); + + /* Verify the updated values are still there */ + ut_asserteq(123, rec->ebs_entry); + ut_asserteq(456, rec->ebs_exit); + + unmap_sysmem(buf); + + return 0; +} +DM_TEST(dm_test_acpi_fpdt, 0); From patchwork Thu Oct 23 09:42:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 639 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212632; bh=PahhOXoFhKzNUdkwH4zbi90Ms51kSdQTYfjckXuQAJ4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=YtpRakNEkJ2ycPHX/NXJfFitFnH1YrxL4qkXqG4sxSAL1YjvXASBcm/85ZN8AnWUo SwmHra09vX298aBM0iQ0TCqddmDxQiRnkZzD29cVmjR0Gz/ga6IefovejWGhB8+m+v kouhzKL1IsqSElSZoZVbPl06CKU2fi+7mb5C00d+rwHutjzGx8EuIrO/CPvocsGg0w MoDujbpVMZ9LvtFudfoxBraSSzurrgJj3AvcvVSXUvSNW96WCxm2ZmE72g4HaD8BZY E5P3TOxegJ+EnQPe8QBspddafQaTHhay6OWotY/6oidNnmY5marYGahoJE/rreFOhB OcOuWXCDpX1iA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C2BA6682AE for ; Thu, 23 Oct 2025 03:43:52 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id wiab9vYp_Hb3 for ; Thu, 23 Oct 2025 03:43:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212631; bh=PahhOXoFhKzNUdkwH4zbi90Ms51kSdQTYfjckXuQAJ4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UQHzrpl6REuYcnz1dW8zlUAIEUXdBE8HrEfpcheOZhlDsr3RsFmB1uLSE66rQahQM TdfNRuJHcXtABFS5iSiBvw5HAVZFx4Wy8PwGfcTEcSourjsM/Og0bmToXcYfSRmRkX ML87UnlZCiJaeqxSN8rUt5ckYBVjuuVvuk76pwZ1fv11FzfY5NUL4Ngk9iyDF1leKs 2wCBqJEvYkGRhpCFMikPiokUbyptg5GnzVGztG+tJ+mfPeFgN8ElShe0Dvv5LRHrCA Hdg/FPN5V3mFcxhLkLTCzy4pkD2L7LgeeDDYX7PnM+SHybZqtt/5J3dyxNIDpyK18/ J57ynMfrTGmCQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E9C4C682B0 for ; Thu, 23 Oct 2025 03:43:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212629; bh=9h3G9GVFgVdw3g1GraNbP2+G+GZnmwXCcYtBKqi5FZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Imjwg1qlQESTKz7pLJEbXnJ4gdPnveKjdKHz7O08yyTF448RctPvY0VJim7F02U4j 1Tx6kk6gRYh4T1Os1oxjZtOBgMK56v2Nr0Cx8b5/EFYoBtLSSgvnuWYpwWwiLIYJcu MGxcaVBakljE1J+kERYw8ijA013DFFZOYDgCyMFPaym5ha6eQLO1nTC5iKKMJznngG h3JbYDAqJ5kOC5B38Y642j8P1FDbu8rxq5Xmxphdk9VOTGuicKOWGSifCOAUp0PWi5 /d18aItsc/SChXiAHC2riVzVvJbY8+azhpZ4JIp9ynsA5Hd7n1zWr+iJOB3K92z0Eq AIRjbKqov2ZqA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 039CC68195; Thu, 23 Oct 2025 03:43:49 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 9raDCDC27mAR; Thu, 23 Oct 2025 03:43:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212625; bh=jZKVxzmQqwRynFoFR1xj41b148QV3GQoBR/RmE3LH44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H4gSNEm1ztRZuN4hJcUymOvPwGoiHDcGyai+qNWV3Q4lS1w+dPRaZ+BNk2E8yp35T FsqJojI4c6sz7MDTzK02v65Aky5BJ1c6yaODLo0eUiIh9RzpNM1AGf6Tx7ZSb5ej9A YarOaRQtETMnXMpl5yNUZk90i3hbEKhJU462jJZutfrNUhILJxfy/BG9xIXLMAYAuy YhHpkI/PiFaWin9LPazOSc7f5jvKU8wqDvuzdKZ1S3Kdq/vWt/OS3ffdzu5voadfam Qsz7YS6pWNhvJv0UAYycXkO6nOFHk6MGloHCFidzExadwU3RLlaiVPhODRG8a8pHMx 2+KL7itlxBafg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4181E68245; Thu, 23 Oct 2025 03:43:45 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:55 -0600 Message-ID: <20251023094308.3406453-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5OMJ7HRYVXECLFKK6QJKDPDSFKG3B2HI X-Message-ID-Hash: 5OMJ7HRYVXECLFKK6QJKDPDSFKG3B2HI X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/11] acpi: fpdt: Generate the table List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add an ACPI writer to automatically generate the FPDT table with boot timing information when ACPI tables are created. This allows the OS to read firmware boot-timing metrics from the FPDT table. Co-developed-by: Claude Signed-off-by: Simon Glass --- lib/acpi/acpi_table.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c index 31d8d314314..0c1b8e20cf4 100644 --- a/lib/acpi/acpi_table.c +++ b/lib/acpi/acpi_table.c @@ -785,3 +785,14 @@ int acpi_fix_fpdt_checksum(void) return 0; } + +static int acpi_create_fpdt(struct acpi_ctx *ctx, + const struct acpi_writer *entry) +{ + u64 uboot_start; + + uboot_start = bootstage_get_time(BOOTSTAGE_ID_START_UBOOT_F); + + return acpi_write_fpdt(ctx, uboot_start); +} +ACPI_WRITER(6fpdt, "FPDT", acpi_create_fpdt, 0); From patchwork Thu Oct 23 09:42:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 638 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212632; bh=ge7XGkHtQKd6Zk6/xUvdSvjvvGBVgI8rz8AGKhQXODc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=oy/qpfWboXD5a4tqkU/cv65gvFfnpZQzcjChNNvOZZE9p8XyDJGRLspXa932pbupY JJfLkl3IoVIJi5/y2PFmmk3iBvWZXBJlTzZ75Z4TeBMTqCZPoQ8ZfbU9uHjZxwhyrR LdnQb0PjO7HVHXngQRDwjTFtQvY3mK8ARRmuu2O2iKN4FdZ3I7PX+I6WQQ/JC0HgQM ENCCLY0ephWXyxJtemTU/i90XV/ae1xZUHMyT4U/EutyY95MpqB0Zm0u5RZpr4bwOT KLV39jv8N6z+dRZwercBXM47GridoyTPhHqRQzAvXUgJLVKcTlhghdnRB+DGhWWJtn /j7L+zLp7tqmA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5333968228 for ; Thu, 23 Oct 2025 03:43:52 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qsVx8jppaJvz for ; Thu, 23 Oct 2025 03:43:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212631; bh=ge7XGkHtQKd6Zk6/xUvdSvjvvGBVgI8rz8AGKhQXODc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jE1XkMVQWtBEs1Kmk8IVcxYLzd2i5fOJuLbWOUq27dsy1yiFPcmD5qAMHSa7eYopZ th3uq2GkcNCe2Rblrqpszsaw7eostP+F8DptUVfJ7RmI9ryv8SHdbHG8puDGIb3fJe c++w4XxgJHTFdy8mOT5vKctT/e+l9ekoa/tatnZac/EvFza94HVVjC+y+vRLFLhHfF cYa0LsJt2iyrswUrK0nL3PQhhZ0BiDQfXs+GUlOYUeQ8Lo7TmBsOdVpAi4FkrTJPji mgr51f31qacKTy9pIGGnP2Y6UFCrNweD+TtaxpK7GW+Y9t3Uo+HiDbnFgpSx3nhvFe jjpyK/yKGX/Zg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7A136682BA for ; Thu, 23 Oct 2025 03:43:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212626; bh=DGPnd7aBMI4B2JuQ9XYoARaPBLKKiqrYYg9y8Si2u4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IwYRmPTMwxLTzyq6l5BVNSs3t5Z3CGi/2214Ve38MydEmU2LyP+8bGKlCFwpE62vc UupRrtb4eva2UDFOUeKWK4IKsRNDdDfHPvN6fTrGkJ0vVNZeOqPL6CIlFVofoiCZw8 Carkr+sw+/Z8w+FdaBqh15DLahF7HPvhSlp/+ak1rtiDyx5zDFzyyVf2tVbkkeAZue +ZEq5Nba6jVDN4dd+Qek9capvRUFnZwf+jKwlnkYhmTzKqRs7Oo0YlmaxDXGg5MBH9 8NI1G9XStUaTaYK9eezJhLfPzs9S225PnqsZZrLTuyWvva+nPINkeQqdPsIRDcx1ja NRvuUrVR0SCqw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E3C2968288; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id ei5N8F5REqFS; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212626; bh=ZyrLP/W3G0GyyR57I/fhUsXxRXlrcCk8Kx3Zy4krtv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWkwqqez55FajlQK4+H653gC9xZdoSmNiuoaH+oXK+uVzFt5ob5Xkt0OTdtDVum4A eGOLvyLx9Gizd7r/PflfoeuuONJY8rmTOt1Q/SMljcfUR3vqyaC+MC746OK+QLepug aMantaeIJJKdpJ2G8lhRW8Bdu+2aLvYutNm0NBz3owMOwrN21OVylPXGISrpsEPgV0 3dJngIML45nuFMNl03a4+6Im4ELveXy1MmHvPmAMLGbUlZzFYl8IeKqb4EG0ZciKOG Z+K/2fE+W8+SMb56Ijgb/SaUZy2DKPbcIAYFRIl9fcUWDVCORc7Dc6Lo9zjCu8MT/m 8qdR6UZnEH+yA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0EB8168263; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:56 -0600 Message-ID: <20251023094308.3406453-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: XVGDL57VQY7RJ2DBMYS4IKV5JKG7C4XF X-Message-ID-Hash: XVGDL57VQY7RJ2DBMYS4IKV5JKG7C4XF X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/11] bootm: Update FPDT boot times before handing off to OS List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Update the FPDT boot performance record's ebs_entry and ebs_exit fields in bootm_final() to record the time when we're about to hand off to the operating system. The timing is recorded just before we start the kernel, after all device cleanup and before interrupts are disabled, which corresponds to the ExitBootServices phase in UEFI. If EFI is used to boot, a further update could be made, but that is left for later. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/bootm_final.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/boot/bootm_final.c b/boot/bootm_final.c index 881d737ce67..870c16b7853 100644 --- a/boot/bootm_final.c +++ b/boot/bootm_final.c @@ -5,9 +5,11 @@ * Copyright 2025 Simon Glass */ +#include #include #include #include +#include #include #include @@ -25,6 +27,21 @@ void bootm_final(enum bootm_final_t flags) bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel"); + /* Update FPDT boot performance record if it exists */ + if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) { + struct acpi_fpdt_boot *fpdt; + + fpdt = acpi_get_fpdt_boot(); + if (fpdt) { + u64 time; + + time = timer_get_boot_us(); + fpdt->ebs_entry = time; + fpdt->ebs_exit = time; + acpi_fix_fpdt_checksum(); + } + } + if (IS_ENABLED(CONFIG_BOOTSTAGE_FDT) && IS_ENABLED(CONFIG_CMD_FDT)) bootstage_fdt_add_report(); if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT)) From patchwork Thu Oct 23 09:42:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 640 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212637; bh=eWd2DANFjRWnyNxq898CRYh/WfZ9ZceSgbqtdxD9wWo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jJT3XtFWQP2iLtaFuq4S5Y42r8seHL5bhfmkjzxHPkIJ4yjgZXdCuQ86DrDtq0kst ZvUBWGj2x5C9vigo5yzpTl89cxjp92lTmbUfIMk8aaiQlP5sWg4TFUGgpdLhwLGCx1 5k+6sa8+mnyt4pqZCHAcgyAAbRDctMcYxLcobyA6lWjKxSdAF76IIq+wtAGSMTvRn5 kDXKiFueWUIPUfUf7GKAJLOZrijtKQJmCoRCnJR/ANjAWuTdRgJ+ZuKcmEjbE5FXzE kj5V+VhjHh6H14jvlP020MsQ7LmRc/ZYbec5lEOLPWWWxhVbYP2kH7JbPE1dawpGeL SHMmHgM6YIKyQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7692768228 for ; Thu, 23 Oct 2025 03:43:57 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id T7El_CH9pKwe for ; Thu, 23 Oct 2025 03:43:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212637; bh=eWd2DANFjRWnyNxq898CRYh/WfZ9ZceSgbqtdxD9wWo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jJT3XtFWQP2iLtaFuq4S5Y42r8seHL5bhfmkjzxHPkIJ4yjgZXdCuQ86DrDtq0kst ZvUBWGj2x5C9vigo5yzpTl89cxjp92lTmbUfIMk8aaiQlP5sWg4TFUGgpdLhwLGCx1 5k+6sa8+mnyt4pqZCHAcgyAAbRDctMcYxLcobyA6lWjKxSdAF76IIq+wtAGSMTvRn5 kDXKiFueWUIPUfUf7GKAJLOZrijtKQJmCoRCnJR/ANjAWuTdRgJ+ZuKcmEjbE5FXzE kj5V+VhjHh6H14jvlP020MsQ7LmRc/ZYbec5lEOLPWWWxhVbYP2kH7JbPE1dawpGeL SHMmHgM6YIKyQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 64F9B68244 for ; Thu, 23 Oct 2025 03:43:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212635; bh=0Voyt4OtnMVK8Uz8yzyD60h2y8bJ7PxnxZGtBQzm1og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nfvplD42g278UUC8EuOOtHJZsjiSH+2N8ECObG5yYy1Se74tfyCPlBffgcJMocmSf uzdct6m5eV3FphbozK2fYb0Ja8eEvvE9kVeLf0uutJIeB3pZ+F8kXWvRvLeUnbMk+2 1BwZ7zfr9n4b67bvkorplBl7x6NRXdn9eLsSA1NEyoW56HJ+12O4SKTgyk2I+e7Kfg rdfrGyUPZrVlkSXWNufpRjsDpxmSrcnb+g3Bq/+yJTP6qgcYXJ4IwE6ihxQTydM4Vk 6hhJXoKZoc/q3pIvbeUdtQye6Xt2cz7Rtx9MaqtrIxi/qsNJgM/5RqV6fDzyVlqSNh hbKIWwiXA3ILQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 284676819C; Thu, 23 Oct 2025 03:43:55 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id D55vzkBYWcJj; Thu, 23 Oct 2025 03:43:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212627; bh=7tRIoCjwqNraUytXBJskrKa0IDbaZx252C2OwzTwdr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYLdlotygf7pOGTxzMr+DJPgQrSMYhGu5b7sxE5SXrnDRfj7fBtnMW7lah16RqUqk /kAIXhKiT3J9es2xF48KmAPovrbY8wkgYYvG06AZGFQ7COJXfWuJLMELXEyJX8CeOh eBdNshxUocbjjuunvA4EMuMhv2US92MjV4C4ZykY4NSAb8QD4yO4UIqd6NWzvIuBEo G4zWiLnBdCHRw/L87mM6/Ofl+oDuuij4z9v9Dp0vemjoCmWxwtWszZw/qJCN5RgH8p +cZG5gPwmGpkTPSr1GLAJApAfs3JfcAgkPK8CqxybFdnvt2IXtHkoVeuQcjy/31e2E mrSSrdnYrdsBg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D88076822E; Thu, 23 Oct 2025 03:43:46 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:57 -0600 Message-ID: <20251023094308.3406453-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 3NEKBEFSVH6NZSQD565DR4FU3OQRMY2B X-Message-ID-Hash: 3NEKBEFSVH6NZSQD565DR4FU3OQRMY2B X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/11] scripts: build-efi: Support spice integration List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a -c/--spice flag to enable spice, so that copy/paste works between the guest and host. Signed-off-by: Simon Glass --- scripts/build-efi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/build-efi b/scripts/build-efi index fffe699e80a..359f8ff4052 100755 --- a/scripts/build-efi +++ b/scripts/build-efi @@ -47,6 +47,8 @@ def parse_args(): help='Package up the payload instead of the app') parser.add_argument('-P', '--partition', action='store_true', help='Create a partition table') + parser.add_argument('-c', '--spice', action='store_true', + help='Enable SPICE for clipboard sharing') parser.add_argument('-v', '--verbose', action='store_true', help='Show executed commands') @@ -115,6 +117,12 @@ class BuildEfi: else: # x86 extra += ['-device', 'qemu-xhci', '-device', 'usb-kbd', '-device', 'usb-mouse'] + + # This uses QEMU's GTK clipboard integration with SPICE vdagent + if self.args.spice: + extra += ['-device', 'virtio-serial-pci'] + extra += ['-chardev', 'qemu-vdagent,id=spicechannel0,name=vdagent,clipboard=on'] + extra += ['-device', 'virtserialport,chardev=spicechannel0,name=com.redhat.spice.0'] extra += ['-serial', 'mon:stdio'] serial_msg = '' if self.args.kvm: From patchwork Thu Oct 23 09:42:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 641 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212638; bh=gOjZEvi/fiQ7tl3vfjAnHR9WgZu0DXvQZ7h4rCWOKDI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DvMmmd2Lqcfd+1fU+SJYQUl8+FLDPP89ovXpZ8TqsUivayu4g9sUvegOT6tHHeFjB 3ymQ/h5lV3por1PWPISKFz4ALEBbcKoncEb2ekcWKaFb8PVBZc8SDRncM0CewIjYW1 0MZ1CtIKH0j4+igwuiu5vwnwIEopRuSRBfeGI7FD2n9WpTEpYqZQCTk/ptyx0i5AZF AJ7RUBq1pA+TyYZyRhF1+BKZKI/BlgcwBpBB9msYxs36zurak4LocAyXuyTzN6sKtX OewvqO6ZdRMrX2Ivz5gzrhBsJtQXsS0L0GSmbAgqirg3fTPLhLSUSctHwW1fXXs04/ P9ebTvjYgFoYw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 568916822F for ; Thu, 23 Oct 2025 03:43:58 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 43kRDHd1y8Cr for ; Thu, 23 Oct 2025 03:43:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212638; bh=gOjZEvi/fiQ7tl3vfjAnHR9WgZu0DXvQZ7h4rCWOKDI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DvMmmd2Lqcfd+1fU+SJYQUl8+FLDPP89ovXpZ8TqsUivayu4g9sUvegOT6tHHeFjB 3ymQ/h5lV3por1PWPISKFz4ALEBbcKoncEb2ekcWKaFb8PVBZc8SDRncM0CewIjYW1 0MZ1CtIKH0j4+igwuiu5vwnwIEopRuSRBfeGI7FD2n9WpTEpYqZQCTk/ptyx0i5AZF AJ7RUBq1pA+TyYZyRhF1+BKZKI/BlgcwBpBB9msYxs36zurak4LocAyXuyTzN6sKtX OewvqO6ZdRMrX2Ivz5gzrhBsJtQXsS0L0GSmbAgqirg3fTPLhLSUSctHwW1fXXs04/ P9ebTvjYgFoYw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4640E68228 for ; Thu, 23 Oct 2025 03:43:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212635; bh=nvmIm+UTQYXW3I+i1+zR4JNfHnQ+eIusRmXjYoBCOlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MHWvJMJ8Vwet2Uhqvc01nwrVYC4+lteZav6yJPZ+fe39BwNnYS1oEu8yaiZ8OgADt pBsiiMbb/iIHco/pFzgUXn37K93ZGVf7KnlmjTUar17BGS/+Py2LYNDQ/wcY6bKfp/ Q/7Es3cV0X8ex74MFXOHwYazIQKUdoWRY5IKCnuOm2Xc5KHhe6vbRwMEQLMnHuXgow /X1VwnLiT7nEJ3yyXJEQOBsLxI/lokyl96o7Jd+FiGYytlDLRYNM27Xl51OAgCUPXS SK4fZ3dVBX8iiqJ59HKEEZOgJ8xVJaR7zCHdHZzrRCAbngJ04bB/czvkc9Zq8Rixc6 eBViJmeB4PCaA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C2DBD6822E; Thu, 23 Oct 2025 03:43:55 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id zuSw_A4UEaHy; Thu, 23 Oct 2025 03:43:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212631; bh=JqXM400kyapPU5yIXA7jBHDj6a/Ml7k/ke8dRz4ULlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N8PUrzkzn8xxCFbc7pLK8zoxaogTTlRKixSM/iRuTU8+UVug7npTY5FxORcFeOq/C zGl1NmIevdHg8Cekq7tMuTQRm3lNw/1tGzn4es3v30LXQJFGzojooCZ/ma/6RbGADD KQFeZcubWEfeY2JhJ3gdv2F33mLQ1D66iznygYIXv7FIECRsE8wfcR+k/g60zJC+C/ J334OHwN7VCPuWgq9hbbdlWsq1htjetVauQ6QG4z+ffmQTwiUpyttyGMIK0+3akODM Z7j3TSANeCi3QMbucAD2Ff5sv0rCg/oKTF5D3cuOQ8ZL1NwjbMXwFGwUym9dv/8ErD MGJa+ZFtSuHzw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7248F68288; Thu, 23 Oct 2025 03:43:51 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:58 -0600 Message-ID: <20251023094308.3406453-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ECUHK45LI6ZHIJU2MRKTUGIZPEQVUNXG X-Message-ID-Hash: ECUHK45LI6ZHIJU2MRKTUGIZPEQVUNXG X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/11] scripts: build-efi: Allow enabling networking List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Provide a -N/--net flag to enable networking for the guest. Signed-off-by: Simon Glass --- scripts/build-efi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/build-efi b/scripts/build-efi index 359f8ff4052..340ff5ac445 100755 --- a/scripts/build-efi +++ b/scripts/build-efi @@ -49,6 +49,8 @@ def parse_args(): help='Create a partition table') parser.add_argument('-c', '--spice', action='store_true', help='Enable SPICE for clipboard sharing') + parser.add_argument('-N', '--net', action='store_true', + help='Enable networking (with SSH forwarding on port 2222)') parser.add_argument('-v', '--verbose', action='store_true', help='Show executed commands') @@ -142,7 +144,11 @@ class BuildEfi: cmd = [qemu] cmd += '-m', mem - cmd += '-nic', 'none' + if self.args.net: + cmd += '-netdev', 'user,id=net0,hostfwd=tcp::2222-:22' + cmd += '-device', 'virtio-net-pci,netdev=net0' + else: + cmd += '-nic', 'none' cmd += extra self.helper.add_qemu_args(self.args, cmd, base_hd=1) tout.info(' '.join(cmd)) From patchwork Thu Oct 23 09:42:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 642 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212640; bh=VJajDDwDKyeAimAfG2kcm1/D606q8Oph1jd++/rjfFs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=LY/e8ViftB1iC3dmujdmrfCn34JRsEawzju8cxWQtYbmKp7CBaCikFMbdQXOROHfx mKc15bzYW+QptWhkCzPYM5LHRwcz7r9YaQBEsS8aHQxoIcYpamIoRZ4lG9diE1nAZH WOQccbWMTiwZFxsVFFmyGZaSGWJ/mUkuYiyxVwfMNFBCX1wiIdFV6NUSgli7Lpxhtu grZBAr5Lz1snxkOtHxKdClRJZ04wFHGMA+2ZoB2DGKUHsPoD0V97NxsXNLJw1rInLm Pkm1mZZ+u+aq3VBn6oV7FE9ZCFra3e3gHgd4B60S/JvNOXUqy08EqXm3YZ2l9KmUh2 rH+URbM3yjj1g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A7F8568263 for ; Thu, 23 Oct 2025 03:44:00 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Y3OWdvXaBXsn for ; Thu, 23 Oct 2025 03:44:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212638; bh=VJajDDwDKyeAimAfG2kcm1/D606q8Oph1jd++/rjfFs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=oyDTbRRTJRB0pNxuC+oEDiSwfFuFd/Cyx642F9LhWvfZvXe/9FD82dxY//OaEbwn0 C/Y9GvQzdrsRnJ0UBb3m4tFQjVWoppoCsM9qQMXDb89YnxRukfJwZVGCMa2upgzR/Z XAC4c0DsujpN93SaOHNSKkoNgzDhtRfwMjKuC5lVcbnIg6n67ia9G0NAqIhRTuRAlK 7uyOf84mS3dNpXXsOO6Tjr5bh7giTrNlwIsFodPd8fYiBh9zNO8lyBBI1uLdWjhohQ Qzo2nd1AG7ajHNDqTaZRy1kuTxeRCyEPwcAS7ZBQJ7OHf1shb2GozojX7Xh7W7KlqP dO15uGY6T5f/g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9CF7068228 for ; Thu, 23 Oct 2025 03:43:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212636; bh=+W6al069Ejxluc0O7aXjFLSfhkIPBrSLEX0/UUpoFDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K/FXV1sX2m1WASAnw3rfz/yjr6uwaMEi580Xt9CDJoF3RzVe/HkxS+dtwyEeuKY2R FSscQ0mC6DQ1V7FP5EInVs5//TbGHGc7YjMscA6uL0zUP1I4IKhEh8RGHeUt5t+mAe UoiOupFKUVyzK8CeGh5Ny/Xk5BxorObFeqrcQq2jReKpLuZX/Aj2YAHiwDx2srG/uv CwDRJSgLKiFij9UxVIqgOmhLlZ2F4RQD1yH5e1TMmfBuH5bwuSa1E4jDqFPaFDtizY 9pRfHKlMC6LxtgREJjUJh3JYcAkuT+2lqbsA0+WQ/3i1yXP5rmQKeZkvQ/ygrEfEfr VUlWpFNECgI4Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8D16F68263; Thu, 23 Oct 2025 03:43:56 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id wdrfLWdhdHJx; Thu, 23 Oct 2025 03:43:56 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212636; bh=yZN6YmEr7AVMLiXkUjlGgkbIee2JSPQXdU9my0wi2dM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqWemUIoV2N4uE1JDEL2A1WO9DTkCGaj93mz3C6zxwKZev0CkXO/k/CGwggldYq8S K/zzt60KezuTojmxlBrpdxYBe2nZd3Ziiv+Z0mHvMa+W15UP0f0WbxbOgqQue9DuOJ fHLVN+aAdpTGfvMR5PTEP+kGBYRDBy+9WkmrH8UYAQpRd8ajEI3ojToavIBJQ9CulB AbeitisVRp5sMj8Cxk8IyCb25goGCTm3b3W3kpbrmKGe5h5VTgWspNoII8wiDVZ+W9 wY+rbuL2PX7ABRenMSNris3/8YxZunViXpz49uoTf7dyIjMOKwZbyM76cD7ZQRVsRZ FGjg0ukUwkocw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1152068245; Thu, 23 Oct 2025 03:43:56 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:42:59 -0600 Message-ID: <20251023094308.3406453-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: RG2ARVQE6ZTSE4I6YYMTQTOX6F22FFD3 X-Message-ID-Hash: RG2ARVQE6ZTSE4I6YYMTQTOX6F22FFD3 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/11] scripts: build-efi: Flush output before running QEMU List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Complete writing of any output before running QEMU, since otherwise it does not always appear until QEMU exits (e.g. with 'tee') Signed-off-by: Simon Glass --- scripts/build-efi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/build-efi b/scripts/build-efi index 340ff5ac445..95a8f456097 100755 --- a/scripts/build-efi +++ b/scripts/build-efi @@ -19,6 +19,7 @@ from argparse import ArgumentParser import os from pathlib import Path import shutil +import sys import build_helper @@ -152,6 +153,7 @@ class BuildEfi: cmd += extra self.helper.add_qemu_args(self.args, cmd, base_hd=1) tout.info(' '.join(cmd)) + sys.stdout.flush() command.run(*cmd) def setup_files(self, build, build_type, dst): From patchwork Thu Oct 23 09:43:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 643 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212645; bh=InWVwrUME6nj+cwO7VDSzo7S3Xhg+IV0fjRAo1/pvs8=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Q5pKhVCmgabC+RlsvCRTtD6MJtHnnRPs8C2HWGEmEhjmvjIqLIfnXmYzmTJggawSw QGNAYDnwXzMsAeXUHCd50Qak0mLqqCGlQ+hv8eJQh2nKMjgvf5KT9/QiFxFzUDCYiF dl6arMkDUDNcemxa9+Xp/hJXhcTDBy5MHiXFHZwaSUYqUIFrnz1OIsY/N+9a9tbX9/ +dOWLBUnsnQC3RcLQwBEYTjIpAZKDJ0zFntKV51uBj3vmRl9Y56ylPuYiPVI9+eodd ut2HgjU0QYxQsG/AeGxxOQHfAovm3FuPj8Cl7xqwF/haL1rwUXTkd2zBGk5wyI/CG1 DTDRL8oLWKNiw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0C5FC68244 for ; Thu, 23 Oct 2025 03:44:05 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1hNeJxScyGc5 for ; Thu, 23 Oct 2025 03:44:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212644; bh=InWVwrUME6nj+cwO7VDSzo7S3Xhg+IV0fjRAo1/pvs8=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=QwVKOnLWhUNvU6/tmFk/4bCVUu2tjjHEwu2i9CN2JXW2pFSOZ1unVjhM0ewnEzilZ 5jA449Qx5FKHW+ZGasJXsUTz0XhfDFwZ+JKBXv/37vVlCM+XEg4F2YydYjvNmCjCAv qLlpXKBHuEFVz3kFGp/Sel2M08OztTa85yGoxw9JujEibvCmnAFSGpFDvXyRzDD0VG XJfUfVeRcHDr++vrzb34obIhVPGSBuSX1UsTaaYDhiD3lqFi6ZvxWhvJz51IkR9/XV w9Jr07kxsq2iLiW080sD4ac5NcrnNL73+n160DTgBfbhaqpLyHMK3nroDt0h3yrcd0 9/sfbYps+qnSg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F05626822E for ; Thu, 23 Oct 2025 03:44:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212642; bh=nOBkqxi0oNkiuchAM43XUTKQT7XLi1gmcj3pRW1NTl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y66hGp6vDTjRVcbjm1XJsDDrA5HnZsVRQcZUPX/Fk0XVmcjhF5gNcZ99iMHQnNhDz FJvl8PnnISAty2391yZ5eLNhhLuNX7st5si8DIGxqHW+2VFNqUr6YvfqgntfJP7SxU IRSNSuwYNTpe/wzWElnxngyzzAb0bUW6YaeIuZ6Pq/cqml0eMrDRCcupfwlKajaO2F qCZD4l+8njAywL3bFB9pXWwTjIxc///BLhl0T5GRbPDPAMxmGRueAVxDVPgWn2/C0O G3w0mRjJYFJNUjla2/676m8+JY+3QIBLa7cr1slCwGsLwq+1PEkfuN6+4PXtWCfLHn 4Du4p/1Er9sIg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E85636822F; Thu, 23 Oct 2025 03:44:02 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 2whTqESdA1PJ; Thu, 23 Oct 2025 03:44:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1761212637; bh=gznk3om/rU/EDcYZgp6D0XMGvIYgfn9i8Cm0aEtzJ+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mTUHbFD8hK/UTxuhfEmnYNP21VtJxlUkh8HQQfmtXS+SR8dsesYHBri51yFVXIzhM +/TlZi8NQfq+dyPQY1FFcfdg62No5ZbTZyRw4doYsNur3I25oA6PbuW5cC1eD8ZQG6 0NEVKvCuT4so2oHAaKeNpIS3+F30CkqJsJa86D8VOYuEIlY2pJ2Rlsn1goH4R+ndVx 8yRGWAeZUsEDXQEM81gVINzWIIVrF7GRiT3Bqs+TYEFYH3OWHx0t/kkkwJQ/XC4RvO roWboC7MD4TVYdIX16SJSJlHEpHbne+webNfzxZzbu0QNN+0mCL9ilMb+SurFzmZXD WqL7nZAZaGtVw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CDC1968245; Thu, 23 Oct 2025 03:43:56 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 23 Oct 2025 03:43:00 -0600 Message-ID: <20251023094308.3406453-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251023094308.3406453-1-sjg@u-boot.org> References: <20251023094308.3406453-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UQD6PGXGPH5CLOEUK562Q6AAI7UHC67U X-Message-ID-Hash: UQD6PGXGPH5CLOEUK562Q6AAI7UHC67U X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/11] scripts: build-qemu: Allow enabling TKey access List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Provide a -T/--tkey option to enable access to a USB-attached Tillitis TKey. Signed-off-by: Simon Glass --- scripts/build-qemu | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/build-qemu b/scripts/build-qemu index ddaafc7587f..70dfe968f66 100755 --- a/scripts/build-qemu +++ b/scripts/build-qemu @@ -51,6 +51,8 @@ def parse_args(): help='Run qboot instead of U-Boot') parser.add_argument('-x', '--xpl', action='store_true', help='Use xPL image rather than U-Boot proper') + parser.add_argument('-T', '--tkey', action='store_true', + help='Enable TKey USB passthrough for testing') parser.add_argument( '--sct-seq', help='SCT sequence-file to be written into the SCT image if -e') @@ -153,6 +155,9 @@ class BuildQemu: default_bios = 'u-boot.rom' self.helper.qemu = 'qemu-system-i386' self.qemu_extra.extend(['-machine', 'q35']) + if args.tkey: + # Pass through TKey USB device to QEMU + self.qemu_extra.extend(['-device', 'usb-host,vendorid=0x1207,productid=0x8887']) if self.helper.bitness == 64: self.board = 'qemu-x86_64' self.helper.qemu = 'qemu-system-x86_64'