From patchwork Mon Mar 8 21:24:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1449398 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=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 ozlabs.org (Postfix) with ESMTPS id 4DvWc34sqsz9sVv for ; Tue, 9 Mar 2021 08:26:09 +1100 (AEDT) Received: from localhost ([::1]:35070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJNOA-0005QF-2V for incoming@patchwork.ozlabs.org; Mon, 08 Mar 2021 16:26:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJNNR-0005Q2-L6 for qemu-devel@nongnu.org; Mon, 08 Mar 2021 16:25:21 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:49295) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJNNP-00080R-C0 for qemu-devel@nongnu.org; Mon, 08 Mar 2021 16:25:21 -0500 Received: from localhost.localdomain ([82.252.131.214]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mi23L-1lx5yD3fnd-00e12u; Mon, 08 Mar 2021 22:25:05 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PATCH v6 0/5] m68k: add Virtual M68k Machine Date: Mon, 8 Mar 2021 22:24:56 +0100 Message-Id: <20210308212501.650740-1-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Provags-ID: V03:K1:snxTvmEhm4m7MDY5JiPST5+Bj4Pt1kh1WDLOa1mk+186TRzbyFD +1+CEX5jtf8tPiLUTFLXy2H55SFVftlkD/nQPgVJCMCe+uR3vE9esDYtQIDNcyJAkXlQPbu PlOUwzVW/Ca1d6iJbR6AGIetpqpRoa4Cqud0OZXarbaLIs68a0CRtFrwCwxOorXkCEQed59 9G9YTVVejKHCNvOKAHH+A== X-UI-Out-Filterresults: notjunk:1;V03:K0:4WXsomhksco=:JKS+oC0hIkdJmHXgUoV3oI klywkiB/pd/x85fm0I75zq8rRd4nk+TdIOee7sJi0pAjRJrVKHPVPInC4PcX3dWZENt970TWx Fmj1P4Sb0jAqzDp/k8tVhgCdzgaaWqT6QyPPU7LoZJ0v5ttWuuyY4Zwjw8DlREABecSKInzAB CBu1O6+OvwpSbthIS8gBwAxmJ4D144/d7zC3MmdotCwucFaPdRG9ziKWbuqj5ogZvnO+mluKU rLx9y9mF0L0xuJEG9D1UyxqcZBH372h17yuwmxM3Xi17hUL/qa2C0yWfLLWw++PBCO1Ez7IoO GYXKAdDiYpVAus2nH+hg51sesUWI+Aod5WNWFkvYmlRKMkChbD4h2JjmWY/0ojtLogZgvWtZs OWE1gT1Zukezb0HFH8oIpM8UoVfqvAMfD4C5I8BDakq3eI4a5MNkHSr65ziLw Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.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 v6: m68k-virt-ctrl: Renamed to virt-ctrl to be generic Add a simple specs document v5: goldfish-tty: Use deposit64() Add .impl.min_access_size Fix CMD_WRITE_BUFFER/CMD_READ_BUFFER v4: goldfish-tty: Use fifo8 for the data_in buffer Remove the data_out buffer from the struct and put it directly in the function. We don't need to use the fifo8 type because we can't bufferize the data as we can't stop the tx queue when the buffer is full. We rely on qemu_chr_fe_write_all() that blocks the thread for that. goldfish-pic: Add DEFINE_PROP_UINT8() for the index Add .impl.min_access_size v3: Add some #define for the interrupt controller (and fix the number of IRQs) Add some comments Update MAINTAINERS Remove "goldfish_rtc: re-arm the alarm after migration" that will be merged via the RISC-V branch. v2: Add an interrupt controller to replace the Q800 GLUE Add a system controller to shutdown the machine Add a fix for goldfish_rtc (already sent alone) Add statistics in goldfish-pic Add versionned machine type Use two goldfish-rtc rather than only one (for timer and RTC) Laurent Vivier (5): char: add goldfish-tty intc: add goldfish-pic m68k: add an interrupt controller m68k: add a system controller m68k: add Virtual M68k Machine docs/specs/virt-ctlr.txt | 26 ++ default-configs/devices/m68k-softmmu.mak | 1 + include/hw/char/goldfish_tty.h | 35 ++ include/hw/intc/goldfish_pic.h | 33 ++ include/hw/intc/m68k_irqc.h | 41 +++ include/hw/misc/virt_ctrl.h | 22 ++ .../standard-headers/asm-m68k/bootinfo-virt.h | 18 + hw/char/goldfish_tty.c | 283 ++++++++++++++++ hw/intc/goldfish_pic.c | 219 ++++++++++++ hw/intc/m68k_irqc.c | 119 +++++++ hw/m68k/virt.c | 313 ++++++++++++++++++ hw/misc/virt_ctrl.c | 151 +++++++++ MAINTAINERS | 13 + hw/char/Kconfig | 3 + hw/char/meson.build | 2 + hw/char/trace-events | 10 + hw/intc/Kconfig | 6 + hw/intc/meson.build | 2 + hw/intc/trace-events | 8 + hw/m68k/Kconfig | 10 + hw/m68k/meson.build | 1 + hw/misc/Kconfig | 3 + hw/misc/meson.build | 3 + hw/misc/trace-events | 7 + 24 files changed, 1329 insertions(+) create mode 100644 docs/specs/virt-ctlr.txt create mode 100644 include/hw/char/goldfish_tty.h create mode 100644 include/hw/intc/goldfish_pic.h create mode 100644 include/hw/intc/m68k_irqc.h create mode 100644 include/hw/misc/virt_ctrl.h create mode 100644 include/standard-headers/asm-m68k/bootinfo-virt.h create mode 100644 hw/char/goldfish_tty.c create mode 100644 hw/intc/goldfish_pic.c create mode 100644 hw/intc/m68k_irqc.c create mode 100644 hw/m68k/virt.c create mode 100644 hw/misc/virt_ctrl.c --=20 2.29.2 Tested-by: Philippe Mathieu-Daudé