From patchwork Wed Dec 31 22:29:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1140 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=1767220241; bh=fBvBimDeSWzI5XAMYv5351giwEM9a0dRn20QHHS6dtE=; 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=oX3YupOx6q7D4uZmypxKCq+Pm0N84BPMWOc+hMa7RsMwU9wml1MqqcEKVKBd+eWht IaiBxyBzqaAeQCrO2MDERDp2cwnWUg4pliLBfBOvnBEoMNBUlF3GdZwHixCqvlppcW 11zHR+R5YgA/NvaO3n4h9swRcT6NIOeqs4GrUwatN/gKffeyAh/sViu64QFjeOIzDG HET01GIM7IqMKq2E0iZnmKKABS5DMWjpf4/nT+AHSGGxUgKF46Yp65OsiElhfRgZod cyt86wV+qVsCNQ/0/h2ub5XaODvui/rN1Lksbe2L3FJ2VI7ZSB8G73wC1gDqD4Qxod bCd3jtiKt70bA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6BC8F68FD3 for ; Wed, 31 Dec 2025 15:30:41 -0700 (MST) 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 Te6LVnyA6oVH for ; Wed, 31 Dec 2025 15:30:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220241; bh=fBvBimDeSWzI5XAMYv5351giwEM9a0dRn20QHHS6dtE=; 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=oX3YupOx6q7D4uZmypxKCq+Pm0N84BPMWOc+hMa7RsMwU9wml1MqqcEKVKBd+eWht IaiBxyBzqaAeQCrO2MDERDp2cwnWUg4pliLBfBOvnBEoMNBUlF3GdZwHixCqvlppcW 11zHR+R5YgA/NvaO3n4h9swRcT6NIOeqs4GrUwatN/gKffeyAh/sViu64QFjeOIzDG HET01GIM7IqMKq2E0iZnmKKABS5DMWjpf4/nT+AHSGGxUgKF46Yp65OsiElhfRgZod cyt86wV+qVsCNQ/0/h2ub5XaODvui/rN1Lksbe2L3FJ2VI7ZSB8G73wC1gDqD4Qxod bCd3jtiKt70bA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 53C1E68FCD for ; Wed, 31 Dec 2025 15:30:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220240; bh=smveTZ7RX1OiRVPJhTbtUw4vNJ22qZNzfs+hLvf7kV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G6HaeX0fDoasnsOo6JQhiW/PbBgobqJv2nh2MvaLzKNJDiT/GFKpaE6qq1r6WQbRJ nHcKILAsHZ8jLeB6GE0CulzlffYrB1H8jbzTmPIAvBxg1KE8h0Zy9pJavgXrmwyh/b P+8D7b+vdUYyIxE5FdAQrDuxyqsxIbctFBik3sTANwPbVAFsL8oVrS3avzHsUPQyEX HrT0dTrRyZjR/frdsz9T+FljUMCRAoxTdPW95XE+Es1eNAGdhJ4C1TSFWL+/fXB2w2 LKAHpOdrXFIOkaSeYDExxKeWDomlT6I4g265Zwrln6UGCUEAP1/mCOZYkB6V5/R8m7 kcEoiUEHgwI4Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5753C68F65; Wed, 31 Dec 2025 15:30:40 -0700 (MST) 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 2X3oC2EzlTYx; Wed, 31 Dec 2025 15:30:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220236; bh=cqkwKCTB/EVWibUZ4WS39zYO7l0YgI9M6QAyLTkt3AU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WVc/OsABgWixUufYeu6SUXUdo3b0sM/CtypRUPVOdQDYl8iLGnpZMqTBYXTusCVy3 Oe7QIWvqqApPyRLNTBZOpon+fw6jHdXorEHyWxeW91o7k2nSeARlsL3VThxyQM17uX ONx7Cs88HsYxNf+TxymNcE/mKNnjiK+VEpj5t0as94vufw2n2OswIt9pceSuwQaW9c B+Jpgl0mE4f1lYMgBQCOKvG9qtrPo5btXvfPDLQYG+rAEBbzzXld2vmEvYcZEFWCbz F4th3aVmyvKqGOw/bFB7NcE5HSvRrwCPu/SAiuVmaeMiw8wefOzjuApIa6J8VncBO2 9xRZ6DaIhXATw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E7CBE68C5D; Wed, 31 Dec 2025 15:30:35 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 31 Dec 2025 15:29:35 -0700 Message-ID: <20251231223008.3251711-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251231223008.3251711-1-sjg@u-boot.org> References: <20251231223008.3251711-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FL2Q546WBTGQEFATVSATFQJMJVLO2XMW X-Message-ID-Hash: FL2Q546WBTGQEFATVSATFQJMJVLO2XMW 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 Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/26] sandbox: Add --quiet_vidconsole option to speed up output 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 When running sandbox with lots of console output, the vidconsole slows things down significantly since it renders truetype fonts to the internal framebuffer. Add a -Q/--quiet_vidconsole command-line option that removes vidconsole from stdout and stderr, using only the serial console. This can provide a ~300x speedup for output-heavy operations. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- arch/sandbox/cpu/start.c | 10 ++++++++++ arch/sandbox/include/asm/state.h | 1 + board/sandbox/sandbox.c | 16 ++++++++++++++++ doc/arch/sandbox/sandbox.rst | 7 +++++++ test/py/tests/test_event_dump.py | 1 + 5 files changed, 35 insertions(+) diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 30d4f83b6ee..1a5ca97e15e 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -476,6 +476,16 @@ static int sandbox_cmdline_cb_no_term_present(struct sandbox_state *state, SANDBOX_CMDLINE_OPT_SHORT(no_term_present, 'A', 0, "Assume no terminal present (for pager testing)"); +static int sandbox_cmdline_cb_quiet_vidconsole(struct sandbox_state *state, + const char *arg) +{ + state->quiet_vidconsole = true; + + return 0; +} +SANDBOX_CMDLINE_OPT_SHORT(quiet_vidconsole, 'Q', 0, + "Don't use vidconsole for stdout/stderr"); + static int sandbox_cmdline_cb_upl(struct sandbox_state *state, const char *arg) { state->upl = true; diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 6a89f0ca5ef..ff7493ec5d6 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -177,6 +177,7 @@ struct sandbox_state { bool soft_fail; /* Continue on failure */ bool pager_bypass; /* Enable pager-bypass mode */ bool no_term_present; /* Assume no terminal present */ + bool quiet_vidconsole; /* Don't use vidconsole for stdout */ int video_test; /* ms to wait before next assert */ const char *video_frames_dir; /* Directory to write video frames */ int video_frame_count; /* Number of frames written */ diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index d97945e58fc..78b2b7b1f47 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -10,7 +10,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -19,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -185,3 +188,16 @@ void fwu_plat_get_bootidx(uint *boot_idx) *boot_idx = 0; } #endif + +static int sandbox_settings(void) +{ + struct sandbox_state *state = state_get_current(); + + if (state->quiet_vidconsole) { + env_set("stdout", "serial"); + env_set("stderr", "serial"); + } + + return 0; +} +EVENT_SPY_SIMPLE(EVT_SETTINGS_R, sandbox_settings); diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst index b2f4d8913d2..90c3dfa837e 100644 --- a/doc/arch/sandbox/sandbox.rst +++ b/doc/arch/sandbox/sandbox.rst @@ -208,6 +208,13 @@ available options. Some of these are described below: -P, --pager_bypass Enable pager bypass mode for testing. +-Q, --quiet_vidconsole + Don't use vidconsole for stdout/stderr. By default, sandbox outputs to both + serial and vidconsole. This can be slow when there is a lot of output, due to + truetype font rendering to the internal framebuffer. Use this option to use + only serial output, which can provide a significant speedup for output-heavy + operations. + -r, --read Read driver state from a dtb file. In conjunction with `-w`, this allows sandbox to save and restore emulated hardware state (such as a TPM) across diff --git a/test/py/tests/test_event_dump.py b/test/py/tests/test_event_dump.py index 3ddd60198fe..ff0da82196b 100644 --- a/test/py/tests/test_event_dump.py +++ b/test/py/tests/test_event_dump.py @@ -22,5 +22,6 @@ EVT_LAST_STAGE_INIT efi_block_device_create .*lib/efi_driver/efi_block EVT_LAST_STAGE_INIT install_smbios_table .*lib/efi_loader/efi_smbios.c:.* EVT_LAST_STAGE_INIT last_stage_init .*arch/sandbox/cpu/start.c:.* EVT_MISC_INIT_F sandbox_early_getopt_check .*arch/sandbox/cpu/start.c:.* +EVT_SETTINGS_R sandbox_settings .*board/sandbox/sandbox.c:.* EVT_TEST h_adder_simple .*test/common/event.c:''' assert re.match(expect, out, re.MULTILINE) is not None