From patchwork Tue Oct 13 15:51:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 302947 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EA76C433E7 for ; Tue, 13 Oct 2020 15:52:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01D7D25215 for ; Tue, 13 Oct 2020 15:52:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01D7D25215 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=vivier.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSMbT-0006jh-4b for qemu-devel@archiver.kernel.org; Tue, 13 Oct 2020 11:52:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSMaN-0005T8-6h for qemu-devel@nongnu.org; Tue, 13 Oct 2020 11:51:35 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:59037) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSMaK-00066I-Th for qemu-devel@nongnu.org; Tue, 13 Oct 2020 11:51:34 -0400 Received: from localhost.localdomain ([82.252.141.186]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MgzWP-1jyFy92vz3-00hNif; Tue, 13 Oct 2020 17:51:28 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PATCH 0/4] m68k: add Virtual M68k Machine Date: Tue, 13 Oct 2020 17:51:20 +0200 Message-Id: <20201013155124.451774-1-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Provags-ID: V03:K1:5maaWEAlVL3+AHNaBhP7/ZUcRZrsdaYknWPuItgwvvqtOR3R750 m5fFhfHhieO5G8IbqDx0AJhbGWVKqwmy15onV0EFK9BBb6bkSTmBBvltTqymUs8mJWnTb3V 1TZxrQ7xWbeRY0Jdc8gODWGY4LMia1uF9eL0+Om+cirwEx0nYfsWwlMcO8SckJbUxfr4Aff I6wK6ysI0bS2EVOSYejhw== X-UI-Out-Filterresults: notjunk:1; V03:K0:xbRCWQOZ3IA=:3xtMdsQlw6b5irYOxzXrP7 vMtmJ/g7eSZ9M0l1CCo8LilB1AU4KUIa0vWHgz7H9E8bQ1FB7AzjRctVb7oGIc/LHXRHuSxJT tmt2OLD61+gJLchMubWwIUZ1aj2h0mU5LLPM5mvmtf+J8SXd6o8DAtDdyZx6+sb2Bm6wZJNiz bsljf5OqvCBPIYT6Z8VDS2EPCmMroqTmgQk/hrKDpFHe18W96u7e3+UySHXey/57pWtik2a/h COB7nGYzL0P0PrTdDTNfgK4lVPZpgIuvGK/BAbYefyzUs5jrcMWQQ9WHyD+wr11xTeJf55FQZ YwFQXnEvPs0v+zD5cz0ADSLuEo38qcUK03XsKaHdeGOJ32JJuzizUyU4GmW2ebDHDV4EitfNr OgQDUc7zfDjUv/U7PHJujUNlg8P8w4sT0fIRBIEOv479iTvZm2/lImt3efhdEGlLXR6bwwIbb EKr5+mbhhVSK2bcYgdWn4o3NFNKMg5JfHPQY7khFXInODHoWiJiQS6TxYwX832k2n08faLtKj TNa/QR9sQmq+N17nD6xiPKaJPoj9CAYJM+ztn+KXfAeNkBEcQdma+oonTUE2jXEnLfygVjTdP 5uoU0zIUd64CLOPd6hqJOl+epfXFLD6ZHGAAv+sCn3LMm2WLVXEsaXPnZV6JVzyDipi//ojpp zerYwgdFjshcm2jV3tnTG1eEsw56TgWjPwWiFZoDXPMX0Imo5l9FuW+5JUOmfsiAkKIeCviNl qrUH6FJBCPvlTL9j1IIrzyLbQHsI91SmBm6V5c8nQoEGEBv7M9E3ZcYMNjwrwo9SB9U5HZDjC swmFoDuy32qZe275BSK1tg9+gS/F38oKT16wMH1elipOsMybsB2vPujAadcEorlJZfU89Jv Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/13 11:51:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The Quadra 800 machine is very limited to run linux, it manages only 1 GiB of memory and only some specific interfaces. The Virtual M68k Machine is based on Goldfish interfaces defined by Google for Android simulator. It uses Goldfish-rtc (timer and RTC), Goldfish-pic (PIC) and Goldfish-tty (for serial port and early tty). https://android.googlesource.com/platform/external/qemu/+/master/docs/GOLDFIS= H-VIRTUAL-HARDWARE.TXT The machine is created with 128 virtio-mmio busses, and they can be used to add serial console, GPU, disk, NIC, HID, ... This series re-use the goldfish-rtc implemented for RISCV, and adds the two others based on the goldfish specs, the kernel driver and android simulator ones. The machine can manage up to 3.2 GiB of memory, not because of an hardware limitation but because the kernel crashes after this value. Simply configure qemu with: .../configure --target-list=3Dm68k-softmmu To run the machine you need a modified kernel you can find here: https://github.com/vivier/linux/tree/m68k-virt You need to compile the kernel with: make virt_defconfig make vmlinux The disk must be installed using the q800 machine because the debian installer doesn't want to be used with a kernel that is not the one on the ISO. And then you can run the machine with something like: qemu-system-m68k -M virt \ -m 3399672K \ -chardev stdio,signal=3Doff,mux=3Don,id=3Dchar0 \ -mon chardev=3Dchar0,mode=3Dreadline \ -kernel vmlinux \ -append "console=3Dhvc0 root=3D/dev/vda2" \ -blockdev node-name=3Dsystem,driver=3Dfile,filename=3Ddebian-10.0.qcow2 \ -blockdev node-name=3Ddrive0,driver=3Dqcow2,file=3Dsystem \ -device virtio-blk-device,drive=3Ddrive0 \ -serial chardev:char0 \ -device virtio-net-device,netdev=3Dhostnet0 \ -netdev bridge,id=3Dhostnet0,br=3Dvirbr0 \ -device virtio-rng-device \ -device virtio-serial-device \ -device virtio-gpu-device \ -device virtconsole,chardev=3Dchar0 \ -device virtio-keyboard-device \ -device virtio-mouse-device if you want to use Goldfish-tty for the console rather than virtconsole, you can add "console=3DttyGF". To start the debian-installer, you can try by adding: -device virtio-scsi-device \ -blockdev node-name=3Ddebian10,driver=3Dfile,filename=3Ddebian-10.0.0-m68k-= NETINST-1.iso \ -blockdev node-name=3Dcdrom0,driver=3Draw,file=3Ddebian10 \ -device scsi-cd,drive=3Dcdrom0 \ -initrd installer-m68k/20200315/images/cdrom/initrd.gz ISO: https://cdimage.debian.org/cdimage/ports/snapshots/2020-10-12/debian-= 10.0.0-m68k-NETINST-1.iso initrd: https://cdimage.debian.org/cdimage/ports/debian-installer/2020-10-12/= m68k/debian-installer-images_20200315_m68k.tar.gz I think there are some endianness issues with virtio-gpu, because when the X server starts I have some errors in the kernel logs: vmap allocation for size 3149824 failed: use vmalloc=3D to increase s= ize I also tried virtiofsd but there is also an endianness problem and the server stops. Have Fun, Laurent PS: By reading the message to the end you have won the right to download the disk= image and the vmlinux. http://vivier.eu/debian-10.0.qcow2 343 MiB http://vivier.eu/vmlinux-virt-m68k 5.2 MiB Laurent Vivier (4): m68k: import bootinfo headers from linux char: add goldfish-tty intc: add goldfish-pic m68k: add Virtual M68k Machine default-configs/devices/m68k-softmmu.mak | 1 + hw/m68k/bootinfo.h | 55 ---- include/hw/char/goldfish_tty.h | 36 +++ include/hw/intc/goldfish_pic.h | 28 ++ .../standard-headers/asm-m68k/bootinfo-mac.h | 120 +++++++ .../standard-headers/asm-m68k/bootinfo-virt.h | 17 + include/standard-headers/asm-m68k/bootinfo.h | 166 ++++++++++ hw/char/goldfish_tty.c | 265 ++++++++++++++++ hw/intc/goldfish_pic.c | 178 +++++++++++ hw/m68k/q800.c | 20 +- hw/m68k/virt.c | 296 ++++++++++++++++++ MAINTAINERS | 11 + hw/char/Kconfig | 3 + hw/char/meson.build | 2 + hw/char/trace-events | 9 + hw/intc/Kconfig | 3 + hw/intc/meson.build | 1 + hw/intc/trace-events | 8 + hw/m68k/Kconfig | 8 + hw/m68k/meson.build | 1 + 20 files changed, 1160 insertions(+), 68 deletions(-) create mode 100644 include/hw/char/goldfish_tty.h create mode 100644 include/hw/intc/goldfish_pic.h create mode 100644 include/standard-headers/asm-m68k/bootinfo-mac.h create mode 100644 include/standard-headers/asm-m68k/bootinfo-virt.h create mode 100644 include/standard-headers/asm-m68k/bootinfo.h create mode 100644 hw/char/goldfish_tty.c create mode 100644 hw/intc/goldfish_pic.c create mode 100644 hw/m68k/virt.c --=20 2.26.2