From patchwork Sun Feb 27 14:40:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 1598325 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K65mR27TZz9sG8 for ; Mon, 28 Feb 2022 01:41:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8230383A6B; Sun, 27 Feb 2022 15:40:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 64BEF83A29; Sun, 27 Feb 2022 15:40:51 +0100 (CET) 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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from zulu616.server4you.de (mail.csgraf.de [85.25.223.15]) by phobos.denx.de (Postfix) with ESMTP id A737A83BCC for ; Sun, 27 Feb 2022 15:40:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=agraf@csgraf.de Received: from localhost.localdomain (dynamic-095-118-033-200.95.118.pool.telefonica.de [95.118.33.200]) by csgraf.de (Postfix) with ESMTPSA id 17B5A60805FC; Sun, 27 Feb 2022 15:40:45 +0100 (CET) From: Alexander Graf To: u-boot@lists.denx.de Cc: Tuomas Tynkkynen , Simon Glass , Mark Kettenis , Bin Meng , Asherah Connor , Heinrich Schuchardt , Anatolij Gustschin Subject: [PATCH 1/4] qfw: Add WRITE definition Date: Sun, 27 Feb 2022 15:40:40 +0100 Message-Id: <20220227144043.37359-2-agraf@csgraf.de> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220227144043.37359-1-agraf@csgraf.de> References: <20220227144043.37359-1-agraf@csgraf.de> 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.5 at phobos.denx.de X-Virus-Status: Clean The QEMU fw_cfg device supports writing entries as well. Add the constant define for it so that we can leverage write functionality later. Signed-off-by: Alexander Graf Reviewed-by: Simon Glass --- include/qfw.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/qfw.h b/include/qfw.h index 7ca132e66a..e42960cbb4 100644 --- a/include/qfw.h +++ b/include/qfw.h @@ -70,6 +70,7 @@ enum { #define FW_CFG_DMA_READ (1 << 1) #define FW_CFG_DMA_SKIP (1 << 2) #define FW_CFG_DMA_SELECT (1 << 3) +#define FW_CFG_DMA_WRITE (1 << 4) /* Bit set in FW_CFG_ID response to indicate DMA interface availability. */ #define FW_CFG_DMA_ENABLED (1 << 1) From patchwork Sun Feb 27 14:40:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 1598326 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K65mZ3KHpz9sG8 for ; Mon, 28 Feb 2022 01:41:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC92B83C31; Sun, 27 Feb 2022 15:41:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 71A4A83A6B; Sun, 27 Feb 2022 15:40:52 +0100 (CET) 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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from zulu616.server4you.de (mail.csgraf.de [85.25.223.15]) by phobos.denx.de (Postfix) with ESMTP id 237F183BDC for ; Sun, 27 Feb 2022 15:40:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=agraf@csgraf.de Received: from localhost.localdomain (dynamic-095-118-033-200.95.118.pool.telefonica.de [95.118.33.200]) by csgraf.de (Postfix) with ESMTPSA id 9228B6080689; Sun, 27 Feb 2022 15:40:45 +0100 (CET) From: Alexander Graf To: u-boot@lists.denx.de Cc: Tuomas Tynkkynen , Simon Glass , Mark Kettenis , Bin Meng , Asherah Connor , Heinrich Schuchardt , Anatolij Gustschin Subject: [PATCH 2/4] ramfb: Add driver for ramfb display Date: Sun, 27 Feb 2022 15:40:41 +0100 Message-Id: <20220227144043.37359-3-agraf@csgraf.de> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220227144043.37359-1-agraf@csgraf.de> References: <20220227144043.37359-1-agraf@csgraf.de> 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.5 at phobos.denx.de X-Virus-Status: Clean QEMU implements multiple ways to expose graphics output to the virt machine, but most of them are incompatible with hardware virtualization. The one that does work reliably is ramfb. It's a very simple mechanism in which the guest reserves a memory region for the frame buffer and then notifies the host about its location and properties. The host then just displays the contents of the frame buffer on screen. This patch implements a trivial version of a ramfb driver - hard coded to a single resolution. Signed-off-by: Alexander Graf --- drivers/video/Kconfig | 8 +++ drivers/video/MAINTAINERS | 4 ++ drivers/video/Makefile | 1 + drivers/video/ramfb.c | 104 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 drivers/video/MAINTAINERS create mode 100644 drivers/video/ramfb.c diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index ff8e11f648..73a9e20534 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -871,6 +871,14 @@ config VIDEO_MCDE_SIMPLE before u-boot starts, and u-boot will simply render to the pre- allocated frame buffer surface. +config VIDEO_RAMFB + bool "QEMU ramfb display driver for in-RAM display" + depends on EFI_LOADER && DM_VIDEO && QFW + help + Enables a RAM based simple frame buffer driver which uses qfw to + notify the hypervisor about the location of a Frame Buffer allocated + in guest RAM as well as its properties. + config OSD bool "Enable OSD support" depends on DM diff --git a/drivers/video/MAINTAINERS b/drivers/video/MAINTAINERS new file mode 100644 index 0000000000..74c258a314 --- /dev/null +++ b/drivers/video/MAINTAINERS @@ -0,0 +1,4 @@ +QEMU RAMFB VIDEO DRIVER +M: Alexander Graf +S: Maintained +F: drivers/video/ramfb.c diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 4038395b12..6cfec17072 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -74,6 +74,7 @@ obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_VESA) += vesa.o obj-$(CONFIG_VIDEO_SEPS525) += seps525.o +obj-$(CONFIG_VIDEO_RAMFB) += ramfb.o obj-y += bridge/ obj-y += sunxi/ diff --git a/drivers/video/ramfb.c b/drivers/video/ramfb.c new file mode 100644 index 0000000000..c46bfa3baa --- /dev/null +++ b/drivers/video/ramfb.c @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2022 Alexander Graf + */ + +#include +#include +#include +#include +#include +#include +#include + +#define fourcc_code(a, b, c, d) ((u32)(a) | ((u32)(b) << 8) | \ + ((u32)(c) << 16) | ((u32)(d) << 24)) +#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') + +#define DEFAULT_WIDTH 1280 +#define DEFAULT_HEIGHT 900 +#define DEFAULT_BPIX VIDEO_BPP32 +#define DEFAULT_FORMAT VIDEO_X8R8G8B8 + +struct ramfb_cfg { + u64 addr; + u32 fourcc; + u32 flags; + u32 width; + u32 height; + u32 stride; +} __packed; + +static int ramfb_probe(struct udevice *dev) +{ + struct video_uc_plat *plat = dev_get_uclass_plat(dev); + struct video_priv *uc_priv = dev_get_uclass_priv(dev); + u32 selector; + u64 base; + u64 size; + efi_status_t ret; + struct fw_file *file; + struct udevice *qfw; + struct dm_qfw_ops *ops; + struct qfw_dma dma = {}; + struct ramfb_cfg cfg = { + .addr = 0, + .fourcc = cpu_to_be32(DRM_FORMAT_XRGB8888), + .flags = 0, + .width = cpu_to_be32(DEFAULT_WIDTH), + .height = cpu_to_be32(DEFAULT_HEIGHT), + .stride = 0, + }; + + ret = qfw_get_dev(&qfw); + if (ret) + return -EPROBE_DEFER; + + ops = dm_qfw_get_ops(qfw); + if (!ops) + return -EPROBE_DEFER; + + file = qfw_find_file(qfw, "etc/ramfb"); + if (!file) { + /* No ramfb available. At least we tried. */ + return -ENOENT; + } + + size = DEFAULT_WIDTH * DEFAULT_HEIGHT * VNBYTES(DEFAULT_BPIX); + ret = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, + EFI_RESERVED_MEMORY_TYPE, + efi_size_in_pages(size), &base); + if (ret != EFI_SUCCESS) + return -ENOMEM; + + debug("%s: base=%llx, size=%llu\n", __func__, base, size); + + cfg.addr = cpu_to_be64(base); + plat->base = base; + plat->size = size; + uc_priv->xsize = DEFAULT_WIDTH; + uc_priv->ysize = DEFAULT_HEIGHT; + uc_priv->bpix = DEFAULT_BPIX; + uc_priv->format = DEFAULT_FORMAT; + uc_priv->fb = (void *)base; + uc_priv->fb_size = size; + + selector = be16_to_cpu(file->cfg.select); + dma.length = cpu_to_be32(sizeof(cfg)); + dma.address = cpu_to_be64((uintptr_t)&cfg); + dma.control = cpu_to_be32(FW_CFG_DMA_WRITE | FW_CFG_DMA_SELECT | + (selector << 16)); + + barrier(); + + /* Send a DMA write request which enables the screen */ + ops->read_entry_dma(qfw, &dma); + + return 0; +} + +U_BOOT_DRIVER(ramfb) = { + .name = "ramfb", + .id = UCLASS_VIDEO, + .probe = ramfb_probe, +}; From patchwork Sun Feb 27 14:40:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 1598327 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K65mm2Pg1z9sG8 for ; Mon, 28 Feb 2022 01:41:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7360E83BDC; Sun, 27 Feb 2022 15:41:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 214CA83A29; Sun, 27 Feb 2022 15:40:55 +0100 (CET) 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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from zulu616.server4you.de (mail.csgraf.de [85.25.223.15]) by phobos.denx.de (Postfix) with ESMTP id 8455E83C08 for ; Sun, 27 Feb 2022 15:40:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=agraf@csgraf.de Received: from localhost.localdomain (dynamic-095-118-033-200.95.118.pool.telefonica.de [95.118.33.200]) by csgraf.de (Postfix) with ESMTPSA id 0FE9F608068B; Sun, 27 Feb 2022 15:40:46 +0100 (CET) From: Alexander Graf To: u-boot@lists.denx.de Cc: Tuomas Tynkkynen , Simon Glass , Mark Kettenis , Bin Meng , Asherah Connor , Heinrich Schuchardt , Anatolij Gustschin Subject: [PATCH 3/4] qfw: Spawn ramfb device if its file is present Date: Sun, 27 Feb 2022 15:40:42 +0100 Message-Id: <20220227144043.37359-4-agraf@csgraf.de> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220227144043.37359-1-agraf@csgraf.de> References: <20220227144043.37359-1-agraf@csgraf.de> 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.5 at phobos.denx.de X-Virus-Status: Clean Now that we have a ramfb device driver, let's add the necessary glueing magic to also spawn it when we find its qfw file node. Signed-off-by: Alexander Graf --- drivers/misc/qfw.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c index 7c6ed41f48..fefa0bce86 100644 --- a/drivers/misc/qfw.c +++ b/drivers/misc/qfw.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #if defined(CONFIG_GENERATE_ACPI_TABLE) && !defined(CONFIG_ARM) @@ -309,6 +310,26 @@ void qfw_read_entry(struct udevice *dev, u16 entry, u32 size, void *address) qfw_read_entry_io(qdev, entry, size, address); } +static void qfw_bind_ramfb(struct udevice *dev) +{ +#ifdef CONFIG_VIDEO_RAMFB + struct fw_file *file; + int ret; + + ret = qfw_read_firmware_list(dev); + if (ret) + return; + + file = qfw_find_file(dev, "etc/ramfb"); + if (!file) { + /* No ramfb available. */ + return; + } + + device_bind_driver(dev, "ramfb", "qfw-ramfb", NULL); +#endif +} + int qfw_register(struct udevice *dev) { struct qfw_dev *qdev = dev_get_uclass_priv(dev); @@ -325,6 +346,8 @@ int qfw_register(struct udevice *dev) if (dma_enabled & FW_CFG_DMA_ENABLED) qdev->dma_present = true; + qfw_bind_ramfb(dev); + return 0; } From patchwork Sun Feb 27 14:40:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 1598328 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K65mz1917z9sG8 for ; Mon, 28 Feb 2022 01:41:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0719D83C29; Sun, 27 Feb 2022 15:41:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 3120183A6B; Sun, 27 Feb 2022 15:40:56 +0100 (CET) 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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from zulu616.server4you.de (mail.csgraf.de [85.25.223.15]) by phobos.denx.de (Postfix) with ESMTP id 0906F83C2C for ; Sun, 27 Feb 2022 15:40:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=agraf@csgraf.de Received: from localhost.localdomain (dynamic-095-118-033-200.95.118.pool.telefonica.de [95.118.33.200]) by csgraf.de (Postfix) with ESMTPSA id 7D47760806B9; Sun, 27 Feb 2022 15:40:46 +0100 (CET) From: Alexander Graf To: u-boot@lists.denx.de Cc: Tuomas Tynkkynen , Simon Glass , Mark Kettenis , Bin Meng , Asherah Connor , Heinrich Schuchardt , Anatolij Gustschin Subject: [PATCH 4/4] qemu-arm*: Enable ramfb by default Date: Sun, 27 Feb 2022 15:40:43 +0100 Message-Id: <20220227144043.37359-5-agraf@csgraf.de> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220227144043.37359-1-agraf@csgraf.de> References: <20220227144043.37359-1-agraf@csgraf.de> 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.5 at phobos.denx.de X-Virus-Status: Clean Now that we have everything in place to support ramfb, let's wire it up by default in the ARM 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 --- arch/arm/Kconfig | 4 ++++ board/emulation/qemu-arm/qemu-arm.c | 14 ++++++++++++++ include/configs/qemu-arm.h | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 391a77c2b4..1f8b881c73 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -979,6 +979,10 @@ config ARCH_QEMU imply DM_RTC imply RTC_PL031 imply OF_HAS_PRIOR_STAGE + imply BOARD_EARLY_INIT_R + imply DM_VIDEO + imply VIDEO_RAMFB + imply SYS_CONSOLE_IS_IN_ENV config ARCH_RMOBILE bool "Renesas ARM SoCs" diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c index 16d5a97167..c898ea8a14 100644 --- a/board/emulation/qemu-arm/qemu-arm.c +++ b/board/emulation/qemu-arm/qemu-arm.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,19 @@ static struct mm_region qemu_arm64_mem_map[] = { struct mm_region *mem_map = qemu_arm64_mem_map; #endif +int board_early_init_r(void) +{ + struct udevice *qfw_dev; + + /* + * Make sure we enumerate the QEMU Firmware device to find ramfb + * before console init starts. + */ + qfw_get_dev(&qfw_dev); + + return 0; +} + int board_init(void) { return 0; diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h index 7ae71e0029..ac67e89a98 100644 --- a/include/configs/qemu-arm.h +++ b/include/configs/qemu-arm.h @@ -58,6 +58,12 @@ BOOT_TARGET_NVME(func) \ BOOT_TARGET_DHCP(func) +#ifdef CONFIG_VIDEO_RAMFB +# define QEMU_STDOUT "serial,vidconsole" +#else +# define QEMU_STDOUT "serial" +#endif + #include #define CONFIG_EXTRA_ENV_SETTINGS \ @@ -68,6 +74,9 @@ "pxefile_addr_r=0x40300000\0" \ "kernel_addr_r=0x40400000\0" \ "ramdisk_addr_r=0x44000000\0" \ + "stdin=serial\0" \ + "stdout=" QEMU_STDOUT "\0" \ + "stderr=" QEMU_STDOUT "\0" \ BOOTENV #define CONFIG_SYS_CBSIZE 512 From patchwork Sun Feb 27 17:03:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 1598381 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K68xG33n9z9s8q for ; Mon, 28 Feb 2022 04:04:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4C8DA83BCD; Sun, 27 Feb 2022 18:03:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 79B0D83A78; Sun, 27 Feb 2022 18:03:56 +0100 (CET) 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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from zulu616.server4you.de (mail.csgraf.de [85.25.223.15]) by phobos.denx.de (Postfix) with ESMTP id A78CF83BCD for ; Sun, 27 Feb 2022 18:03:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=agraf@csgraf.de Received: from localhost.localdomain (dynamic-095-118-033-200.95.118.pool.telefonica.de [95.118.33.200]) by csgraf.de (Postfix) with ESMTPSA id EE59F60805C6; Sun, 27 Feb 2022 18:03:52 +0100 (CET) From: Alexander Graf To: u-boot@lists.denx.de Cc: Tuomas Tynkkynen , Simon Glass , Mark Kettenis , Bin Meng , Asherah Connor , Heinrich Schuchardt , Anatolij Gustschin Subject: [PATCH 5/5] qemu-riscv: Enable ramfb by default Date: Sun, 27 Feb 2022 18:03:52 +0100 Message-Id: <20220227170352.49366-1-agraf@csgraf.de> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220227144043.37359-1-agraf@csgraf.de> References: <20220227144043.37359-1-agraf@csgraf.de> 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.5 at phobos.denx.de X-Virus-Status: Clean 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 --- board/emulation/qemu-riscv/Kconfig | 6 ++++++ board/emulation/qemu-riscv/qemu-riscv.c | 15 +++++++++++++++ include/configs/qemu-riscv.h | 9 +++++++++ 3 files changed, 30 insertions(+) diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig index 02bf84725b..1967fb3a63 100644 --- a/board/emulation/qemu-riscv/Kconfig +++ b/board/emulation/qemu-riscv/Kconfig @@ -67,5 +67,11 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply MTD_NOR_FLASH imply CFI_FLASH imply OF_HAS_PRIOR_STAGE + imply BOARD_EARLY_INIT_R + imply DM_VIDEO + imply VIDEO_RAMFB + imply SYS_CONSOLE_IS_IN_ENV + 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 ae3b7a3295..31799b8c3a 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 @@ -28,6 +29,20 @@ int is_flash_available(void) } #endif +int board_early_init_r(void) +{ + struct udevice *qfw_dev; + + /* + * Make sure we enumerate the QEMU Firmware device to find ramfb + * before console init starts. + */ + if (IS_ENABLED(CONFIG_CMD_QFW)) + qfw_get_dev(&qfw_dev); + + return 0; +} + int board_init(void) { /* diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h index 618c3b63d4..663ba50688 100644 --- a/include/configs/qemu-riscv.h +++ b/include/configs/qemu-riscv.h @@ -39,6 +39,12 @@ func(SCSI, scsi, 0) \ func(DHCP, dhcp, na) +#ifdef CONFIG_VIDEO_RAMFB +# define QEMU_STDOUT "serial,vidconsole" +#else +# define QEMU_STDOUT "serial" +#endif + #include #define BOOTENV_DEV_QEMU(devtypeu, devtypel, instance) \ @@ -58,6 +64,9 @@ "scriptaddr=0x88100000\0" \ "pxefile_addr_r=0x88200000\0" \ "ramdisk_addr_r=0x88300000\0" \ + "stdin=serial\0" \ + "stdout=" QEMU_STDOUT "\0" \ + "stderr=" QEMU_STDOUT "\0" \ BOOTENV #endif