Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53366C001B0 for ; Sun, 23 Jul 2023 08:38:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DA36F86663; Sun, 23 Jul 2023 10:38:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xs4all.nl 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; secure) header.d=xs4all.nl header.i=@xs4all.nl header.b="AcYqeatr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 065A6862CB; Sun, 23 Jul 2023 10:38:05 +0200 (CEST) Received: from ewsoutbound.kpnmail.nl (ewsoutbound.kpnmail.nl [195.121.94.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F0B3D862CB for ; Sun, 23 Jul 2023 10:38:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mark.kettenis@xs4all.nl X-KPN-MessageId: ea78a9be-2933-11ee-a2b4-005056992ed3 Received: from smtp.kpnmail.nl (unknown [10.31.155.8]) by ewsoutbound.so.kpn.org (Halon) with ESMTPS id ea78a9be-2933-11ee-a2b4-005056992ed3; Sun, 23 Jul 2023 10:35:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=xs4all01; h=subject:to:from:message-id:date; bh=Ds3AdRlconVoCJ+exhO6ApWwViElOOb4mVCIz63GWUk=; b=AcYqeatr3w8vod5sRGJVkUHjdxIfGj0fberZ5Ms2Sv+hvn7zQk9/0GOLoRpQXuuSuYOz1E6e0QBsq iYi2FcVepgad8X3AJXMX2Qd/tvq66JrUd19pmCjyECDS2T1T5WiIrFzmTSWZ4KTAsXTcKZKcvq+s7h ODvlIpIAKf60zdtSU9z8xvZhEeOs15VnZhfw4/yXkF5Ey/kga6gBdWLVHXeNsrKJWwcEy1V2eJqieF P6cStKT3rBvTx7G79dZ6dWgfw9WiiaCFIZE3Vy/Hx2IBAgdPxmY3H9Swu2660GZJiTMwe6VfY4gVGG CaE/PL6h6HBNYHt1PEdmRClbu8F10lQ== X-KPN-MID: 33|6gNGq5bYo9y4eUa4sjtZZ9oXYKtNlH6245gzuwEKi+N+NKRfzQGgxDWtbFRDWPZ H47QDjmgeZvKN6DmEXkUA92paLtHUTSxQ4yuh5eA89bE= X-KPN-VerifiedSender: Yes X-CMASSUN: 33|etvOZhp2ZZHebSQWsVwwpAc7hBf1K2oF4JcraPqq+5HIp4BELrqhn9zESFBFQpj 5I7V5ikcPX8mKMLjVNZm5dA== X-Originating-IP: 80.61.163.207 Received: from bloch.sibelius.xs4all.nl (80-61-163-207.fixed.kpn.net [80.61.163.207]) by smtp.xs4all.nl (Halon) with ESMTPSA id 3b135be1-2934-11ee-8735-00505699d6e5; Sun, 23 Jul 2023 10:38:00 +0200 (CEST) Date: Sun, 23 Jul 2023 10:38:00 +0200 Message-Id: <87msznm39z.fsf@bloch.sibelius.xs4all.nl> From: Mark Kettenis To: Bin Meng Cc: sjg@chromium.org, u-boot@lists.denx.de, bmeng.cn@gmail.com, xypron.glpk@gmx.de In-Reply-To: <20230723044041.1089804-19-bmeng@tinylab.org> (message from Bin Meng on Sun, 23 Jul 2023 12:40:41 +0800) Subject: Re: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input device References: <20230723044041.1089804-1-bmeng@tinylab.org> <20230723044041.1089804-19-bmeng@tinylab.org> 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: Bin Meng > Date: Sun, 23 Jul 2023 12:40:41 +0800 > > This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard > as one of the input devices. > > Signed-off-by: Bin Meng > > --- > > board/emulation/qemu-riscv/Kconfig | 5 +++++ > board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ > doc/board/emulation/qemu-riscv.rst | 5 +++++ > include/configs/qemu-riscv.h | 2 +- > 4 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig > index 7220c55350..b503578d27 100644 > --- a/board/emulation/qemu-riscv/Kconfig > +++ b/board/emulation/qemu-riscv/Kconfig > @@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy > imply VIDEO_BOCHS > imply SYS_WHITE_ON_BLACK > imply PRE_CONSOLE_BUFFER > + imply USB > + imply USB_XHCI_HCD > + imply USB_XHCI_PCI > + imply USB_KEYBOARD > + imply CMD_USB > > endif > diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c > index f39f3be366..181abbbf97 100644 > --- a/board/emulation/qemu-riscv/qemu-riscv.c > +++ b/board/emulation/qemu-riscv/qemu-riscv.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -41,6 +42,10 @@ int board_init(void) > > int board_late_init(void) > { > + /* start usb so that usb keyboard can be used as input device */ > + if (CONFIG_IS_ENABLED(USB_KEYBOARD)) > + usb_init(); > + This is typically handled by including "usb start" in CONFIG_PREBOOT, which is done by boot/Kconfig. Any reason why that doesn't work for you? > return 0; > } > > diff --git a/doc/board/emulation/qemu-riscv.rst b/doc/board/emulation/qemu-riscv.rst > index 9d21f3270c..61137bcbf1 100644 > --- a/doc/board/emulation/qemu-riscv.rst > +++ b/doc/board/emulation/qemu-riscv.rst > @@ -138,6 +138,11 @@ and adding:: > > -serial stdio -device VGA > > +In addition, a usb keyboard can be attached to an emulated xHCI controller in > +RISC-V virt machine as an option of input devices by adding:: > + > + -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 > + > Running with KVM > ---------------- > > diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h > index d5146e70f7..584559cfa3 100644 > --- a/include/configs/qemu-riscv.h > +++ b/include/configs/qemu-riscv.h > @@ -17,7 +17,7 @@ > > /* Environment options */ > > -#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \ > +#define CFG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ > "stdout=serial,vidconsole\0" \ > "stderr=serial,vidconsole\0" > > -- > 2.34.1 > >