Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp318114pxb; Mon, 31 Jan 2022 23:58:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhdi+r8mapg1o8afAle0UNQUgyitDZlkXm0VmDqZoFNCxnO8g9aPjbCy9Lmjr26sKPymdb X-Received: by 2002:a50:8e4b:: with SMTP id 11mr2579146edx.445.1643702280510; Mon, 31 Jan 2022 23:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643702280; cv=none; d=google.com; s=arc-20160816; b=b8FrwyZoj6M91WFMIhwig9oFCbEfLMs/dupInCUULc+LN0lnFAX3chKcFcnTBu2OyA lEbHfYCiDITrIdMoAjngW9w2DA2ZRwjO5kqfHp2L9FyuBq3yfNNWmWHEmC5oLXhHmYrY jqM3eN1mjtDgTetxF2599Zz5D397ptepoxaUqcWcPUe7hPJO7+kcnihkQDJ8hWiLwuYI c5ta+Ti1iM7h08g+t3DKD39Pb8bCw+GzlKH2fk3cbGYufA0kEOhv5bTL01b08oTE7Dp8 vhg6nsofzr6bt+1x9XMvhUcXna6sHKaez69m+Z7L778t6AGRwZW94zRsMgsBAJcWDkNV NfrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=MXYlJfXlN60mxSS0BSBfc1hKiDK+AFT0bqWKKCdmSWI=; b=GjhL8cYqKH4ApNvurqogLEoUrBin6Plgb/zzSXNLHdu23fUbGU0bzYe5fP3XdHPOuh xLjNLIgntzRqfEvQRFBrQzjDawAqiAkdqtqrWN0lCuRXxVxxy7aixk3ZvWFV8ME/oGjd 0+LWiYrklGo9QE+DwkscLEeFZqXmHvvjyR2JLQdb9e0iVRfYz719Y5WaVxEt7heI8FLp /KlUPfA+O/WjUaNavJkRUqovZS1+5DX+JZcSFfTD8s+ESvHFPSARbtt9TiSZCza2aCGL 3qeqDI0NbFZiVURg8SNO0FpVTmyZU3XDHDsIR61bBD6Bth6RqGST+S9btgOwb9GC7X6n HinA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f14si9979211edd.197.2022.01.31.23.57.36; Mon, 31 Jan 2022 23:58:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353053AbiA2SnH convert rfc822-to-8bit (ORCPT + 99 others); Sat, 29 Jan 2022 13:43:07 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:50143 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353019AbiA2SnC (ORCPT ); Sat, 29 Jan 2022 13:43:02 -0500 Received: from quad ([82.142.10.94]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1McYP5-1mfMoD0nW9-00cxX2; Sat, 29 Jan 2022 19:42:28 +0100 From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: Alessandro Zummo , Daniel Lezcano , Alexandre Belloni , Thomas Gleixner , Geert Uytterhoeven , Stephen Boyd , linux-m68k@lists.linux-m68k.org, linux-rtc@vger.kernel.org, Jiaxun Yang , Arnd Bergmann , John Stultz , Laurent Vivier Subject: [PATCH v13 0/5] m68k: Add Virtual M68k Machine Date: Sat, 29 Jan 2022 19:42:20 +0100 Message-Id: <20220129184225.407100-1-laurent@vivier.eu> X-Mailer: git-send-email 2.34.1 Content-Type: text/plain; charset="utf-8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W6VS0= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The most powerful m68k machine emulated by QEMU is a Quadra 800, but this machine is very limited: only 1 GiB of memory and only some specific interfaces, with no DMA. 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 early tty). The machine is created with 128 virtio-mmio buses, and they can be used to add serial console, GPU, disk, NIC, HID, hwrng, 9PFS... The virtual m68k machine has been merged in QEMU and will be available with the release 6.0. This series introduces the support of this new machine in the linux kernel. If you want to try: - Configure and build latest QEMU with (or download qemu 6.0 binary): .../configure --target-list=m68k-softmmu --enable-virglrenderer make - Configure and build linux with: make virt_defconfig make vmlinux A pre-installed qcow2 disk image is available at: http://vivier.eu/debian-10.0.qcow2 You can run the machine with something like: qemu-system-m68k -M virt \ -m 3G \ -chardev stdio,signal=off,mux=on,id=char0 \ -mon chardev=char0,mode=readline \ -kernel vmlinux \ -append "console=hvc0 root=/dev/vda2" \ -blockdev node-name=system,driver=file,filename=debian-10.0.qcow2 \ -blockdev node-name=drive0,driver=qcow2,file=system \ -device virtio-blk-device,drive=drive0 \ -serial chardev:char0 \ -device virtio-net-device,netdev=hostnet0 \ -netdev bridge,id=hostnet0,br=virbr0,helper=/usr/libexec/qemu-bridge-helper \ -device virtio-serial-device \ -device virtio-gpu-device \ -device virtconsole,chardev=char0 \ -device virtio-keyboard-device \ -device virtio-mouse-device You can watch a presentation about the machine on the Planet m68k channel: https://youtu.be/s_ve0bgoldfish_timer_shutdownCC9q4 [Demo at 38:00] v13: - rework clocksource according to Daniel's comments - move the timer registers definition to include/clocksource/timer-goldfish.h v12: - add request_resource() for pic and virtctrl - enable virtio-snd in virt_defconfig - add #include in rtc and timer v11: - rename goldfish_ioread32()/goldfish_iowrite32() to gf_ioread32()/gfiowrite32() - move them to linux/goldfish.h and m68k/asm/io.h - change patches order (tty first to revert my previous work) - fix clocksource by clearing interrupt on tick not on next_event() and clearing shift - add missing clocksource_register_hz() - rebase v10: - move goldfish_ioread32()/goldfish_iowrite32() to io.h - also update goldfish-tty - use READ_ONCE()/WRITE_ONCE() for in_nmi v9: - include to declare min_low_pfn - goldfish accessors: s/CONFIG_CPU_BIG_ENDIAN/CONFIG_M68K/ v8: - GF_PUT_CHAR is a 32bit register (in arch/m68k/kernel/head.S) - rework goldfish-pic and virt_ctrl v7: - add "#include " in timer-goldfish.c for kzalloc() - update timer-goldfish Kconfig - remove EXPORT_SYMBOL() - introduce goldfish_ioread32()/goldfish_iowrite32() v6: - fix goldfish-rtc endianness - move goldfish-timer code to drivers/clocksource - remove LEGACY_TIMER_TICK and use directly goldfish-timer v5: - add GENERIC_CLOCKEVENTS in Kconfig.machine v4: - update PATCH 1: comments and parameter names - add a patch to move to generic clockevents (I prefer to have a separate patch as it can be used as an example to move from legacy timer tick to generic clockevents) v3: - introduce config.h to export prototypes to arch/m68k/kernel/setup_mm.c - define virt_nmi_handler as static v2: - Remove VIRTO_MENU set y - sort the selects - add CONFIG_LOCALVERSION="-virt" - generate virt_defconfig using "make savedefconfig" - rename MACH_VIRTONLY to MACH_VIRT_ONLY - add a test_notvirt label in head.S - rework iounmap() to use two separate #ifdefs - use %u in virt_get_model() - drop show_registers() in config.c - drop pr_err() from config_virt() - sort includes in ints.c - call virt_irq_enable() in virt_irq_startup() - drop virt_irq_shutdown() and use virt_irq_disable() - move in_nmi into virt_nmi_handler() - use pr_warn() in virt_nmi_handler() - rework goldfish_pic_irq() IRQ scan - copy goldfish-pic IRQs related information from QEMU hw/m68k/virt - add a comment to "min_low_pfn = 0" - use platform_device_register_simple() - use goldfish_timer_read(), upper_32_bits() and lower_32_bits() Thanks, Laurent Laurent Vivier (5): m68k: add asm/config.h tty: goldfish: introduce gf_ioread32()/gf_iowrite32() rtc: goldfish: use gf_ioread32()/gf_iowrite32() clocksource/drivers: Add a goldfish-timer clocksource m68k: introduce a virtual m68k machine arch/m68k/Kbuild | 1 + arch/m68k/Kconfig.machine | 17 +++ arch/m68k/amiga/config.c | 1 + arch/m68k/apollo/config.c | 1 + arch/m68k/atari/config.c | 1 + arch/m68k/bvme6000/config.c | 1 + arch/m68k/configs/virt_defconfig | 68 +++++++++ arch/m68k/hp300/config.c | 1 + arch/m68k/include/asm/config.h | 35 +++++ arch/m68k/include/asm/io.h | 3 + arch/m68k/include/asm/irq.h | 3 +- arch/m68k/include/asm/pgtable_mm.h | 7 + arch/m68k/include/asm/setup.h | 44 ++++-- arch/m68k/include/asm/virt.h | 25 ++++ arch/m68k/include/uapi/asm/bootinfo-virt.h | 18 +++ arch/m68k/include/uapi/asm/bootinfo.h | 1 + arch/m68k/kernel/Makefile | 1 + arch/m68k/kernel/head.S | 31 +++++ arch/m68k/kernel/setup_mm.c | 30 ++-- arch/m68k/mac/config.c | 1 + arch/m68k/mm/kmap.c | 23 +++- arch/m68k/mvme147/config.c | 1 + arch/m68k/mvme16x/config.c | 1 + arch/m68k/q40/config.c | 1 + arch/m68k/virt/Makefile | 6 + arch/m68k/virt/config.c | 130 +++++++++++++++++ arch/m68k/virt/ints.c | 153 +++++++++++++++++++++ arch/m68k/virt/platform.c | 72 ++++++++++ drivers/clocksource/Kconfig | 7 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-goldfish.c | 153 +++++++++++++++++++++ drivers/rtc/rtc-goldfish.c | 44 +++--- drivers/tty/goldfish.c | 20 +-- include/clocksource/timer-goldfish.h | 31 +++++ include/linux/goldfish.h | 15 +- 35 files changed, 867 insertions(+), 81 deletions(-) create mode 100644 arch/m68k/configs/virt_defconfig create mode 100644 arch/m68k/include/asm/config.h create mode 100644 arch/m68k/include/asm/virt.h create mode 100644 arch/m68k/include/uapi/asm/bootinfo-virt.h create mode 100644 arch/m68k/virt/Makefile create mode 100644 arch/m68k/virt/config.c create mode 100644 arch/m68k/virt/ints.c create mode 100644 arch/m68k/virt/platform.c create mode 100644 drivers/clocksource/timer-goldfish.c create mode 100644 include/clocksource/timer-goldfish.h -- 2.34.1