From patchwork Tue Aug 22 12:10:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 1824158 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=nclRN+Ct; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RVSrL3sLvz1yNm for ; Tue, 22 Aug 2023 22:11:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6912A864F8; Tue, 22 Aug 2023 14:10:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nclRN+Ct"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDDDC864F7; Tue, 22 Aug 2023 14:10:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,URIBL_CSS,URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 601A8864E2 for ; Tue, 22 Aug 2023 14:10:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fee06efd6bso18862815e9.0 for ; Tue, 22 Aug 2023 05:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692706252; x=1693311052; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xGoQ4jNs+N/QlQ+g76Ew8n/gmPoZlQSS+BRhjyXWnbw=; b=nclRN+CtMV0Q0oxln7YLW2r24k/7h/6R5wHeSTz8ZAPlSsCUHe0YB5Fm/EH3d2369j cht64UVvzvilFRlv4rznOlMNtf/rbiRVwU2OJJHao+oDuYol/n1xMco1GonHXALZRaA4 vOPzEFeTmPM8rAvnHu582lKDiWonlDMIyUradqB7nwS6t/rwm/CXy1efOa11+BMLNUAM tkwJuw8wuQ9luERJ6v9IsR9xOcx77odWMEfN7HUQEKP/NNuW2GrswNCfd6rnJodxQc5i Be5MJIhhVhYIyWBVZOcA5Ln46IYm3HyZKrdv2yzkx8hnk4/5rbfo0tmnvKzWzd/h/n5M G95Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692706252; x=1693311052; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xGoQ4jNs+N/QlQ+g76Ew8n/gmPoZlQSS+BRhjyXWnbw=; b=Myb6YAyY62PNqsDNlqGjgli978JpGgB4CfFNP6FLp7+YWhJoPEs28O1UK36/sQAfca /EAKiHh/W8f0XBjLUbeeWEUuOuEmhu68b3mDq22P9ma3lY+qzaoNJxpWMGWurEx+wmhp EmeebDCJIS4XgDFmb/8FtvbUSaIlRYMD2unCdtH2sGg1HJ5sCWTr3D4YtF8iik75J522 QTfxO1BWR7pZehzwKLS8NhCD0pAIGtIDpWDyCV0HPN7zieWZVuc5rMlfmC8VWM/QYn8A NUEXfUf6XxeptiVfbNdTGTe0TXfAHEYxBjmEeIft8ffprQcpV7kD3vNdqNBc6tmA8FvX XcyQ== X-Gm-Message-State: AOJu0YxPACK/GIE0lBZxu60NAnzlhy2QOAjn8okLyLt/t/S9pqS0p5a8 0qd5FroUbnvJs3cXAHpVbIVAB1cS0Rw= X-Google-Smtp-Source: AGHT+IH54t2CEuFXoKg9hr87mvp71CZ3YyZSiWhwWYlujCI2qR5RV5K/hNJFTyd2kUVpOnd2xM4O9A== X-Received: by 2002:adf:f74b:0:b0:319:7c17:4c65 with SMTP id z11-20020adff74b000000b003197c174c65mr8541000wrp.12.1692706251878; Tue, 22 Aug 2023 05:10:51 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id a2-20020adffac2000000b0031753073abcsm15704611wrs.36.2023.08.22.05.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 05:10:51 -0700 (PDT) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Tuomas Tynkkynen , Heinrich Schuchardt , Rayagonda Kokatanur , Anatolij Gustschin , Tom Rini , Bin Meng , Asherah Connor , Simon Glass , Alexander Graf , Mark Kettenis , Alper Nebi Yasak Subject: [PATCH v2 6/7] riscv: qemu: Enable ramfb by default Date: Tue, 22 Aug 2023 15:10:24 +0300 Message-Id: <20230822121026.1007105-7-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230822121026.1007105-1-alpernebiyasak@gmail.com> References: <20230822121026.1007105-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Alexander Graf Now that we have everything in place to support ramfb, let's wire it up by default in the RISC-V QEMU targets. That way, you can easily use a graphical console by just passing -device ramfb to the QEMU command line. Signed-off-by: Alexander Graf [Alper: Rebase on bochs changes, add pre-reloc init and error handling] Co-developed-by: Alper Nebi Yasak Signed-off-by: Alper Nebi Yasak --- Changes in v2: - Drop imply VIDEO, env changes from RISC-V patch (in u-boot/next) - Drop imply SYS_CONSOLE_IS_IN_ENV from RISC-V patch (def. y if VIDEO) - Probe QFW in RISC-V QEMU board_early_init_f to bind ramfb pre-reloc - Add IS_ENABLED(CONFIG_QFW) check and error handling to RISC-V QEMU board/emulation/qemu-riscv/Kconfig | 5 +++ board/emulation/qemu-riscv/qemu-riscv.c | 41 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig index d56b4b5bc1ed..b5c72982e565 100644 --- a/board/emulation/qemu-riscv/Kconfig +++ b/board/emulation/qemu-riscv/Kconfig @@ -82,5 +82,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply USB_XHCI_PCI imply USB_KEYBOARD imply CMD_USB + imply BOARD_EARLY_INIT_F + imply BOARD_EARLY_INIT_R + imply VIDEO_RAMFB + imply CMD_QFW + imply QFW_MMIO endif diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c index 181abbbf97d8..1041e936e9d1 100644 --- a/board/emulation/qemu-riscv/qemu-riscv.c +++ b/board/emulation/qemu-riscv/qemu-riscv.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,46 @@ int is_flash_available(void) } #endif +int board_early_init_f(void) +{ + struct udevice *dev; + int ret; + + /* + * Make sure we enumerate the QEMU Firmware device to bind ramfb + * so video_reserve() can reserve memory for it. + */ + if (IS_ENABLED(CONFIG_QFW)) { + ret = qfw_get_dev(&dev); + if (ret) { + log_err("Failed to get QEMU FW device: %d\n", ret); + return ret; + } + } + + return 0; +} + +int board_early_init_r(void) +{ + struct udevice *dev; + int ret; + + /* + * Make sure we enumerate the QEMU Firmware device to find ramfb + * before console_init. + */ + if (IS_ENABLED(CONFIG_QFW)) { + ret = qfw_get_dev(&dev); + if (ret) { + log_err("Failed to get QEMU FW device: %d\n", ret); + return ret; + } + } + + return 0; +} + int board_init(void) { /*