diff options
author | Laurent Vivier <laurent@vivier.eu> | 2022-04-06 22:15:23 +0200 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2022-04-11 11:48:01 +0200 |
commit | 05d51e42df06f0211c7029ab9aa46c492ee85043 (patch) | |
tree | 0eaaad4386f25f382cdcf62e17090707d0e3f304 /arch/m68k/include | |
parent | c92e7ef16400bf035e8b49c7dd091bfce4f99773 (diff) | |
download | linux-05d51e42df06f0211c7029ab9aa46c492ee85043.tar.gz linux-05d51e42df06f0211c7029ab9aa46c492ee85043.tar.bz2 linux-05d51e42df06f0211c7029ab9aa46c492ee85043.zip |
m68k: Introduce a virtual m68k machine
This machine allows to have up to 3.2 GiB and 128 Virtio devices.
It is based on android goldfish devices.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Link: https://lore.kernel.org/r/20220406201523.243733-5-laurent@vivier.eu
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k/include')
-rw-r--r-- | arch/m68k/include/asm/config.h | 2 | ||||
-rw-r--r-- | arch/m68k/include/asm/io.h | 3 | ||||
-rw-r--r-- | arch/m68k/include/asm/irq.h | 3 | ||||
-rw-r--r-- | arch/m68k/include/asm/pgtable_mm.h | 7 | ||||
-rw-r--r-- | arch/m68k/include/asm/setup.h | 44 | ||||
-rw-r--r-- | arch/m68k/include/asm/virt.h | 25 | ||||
-rw-r--r-- | arch/m68k/include/uapi/asm/bootinfo-virt.h | 18 | ||||
-rw-r--r-- | arch/m68k/include/uapi/asm/bootinfo.h | 1 |
8 files changed, 92 insertions, 11 deletions
diff --git a/arch/m68k/include/asm/config.h b/arch/m68k/include/asm/config.h index e73ffa23c4f5..9bb888ab5009 100644 --- a/arch/m68k/include/asm/config.h +++ b/arch/m68k/include/asm/config.h @@ -17,6 +17,7 @@ extern int mac_parse_bootinfo(const struct bi_record *record); extern int mvme147_parse_bootinfo(const struct bi_record *record); extern int mvme16x_parse_bootinfo(const struct bi_record *record); extern int q40_parse_bootinfo(const struct bi_record *record); +extern int virt_parse_bootinfo(const struct bi_record *record); extern void config_amiga(void); extern void config_apollo(void); @@ -29,5 +30,6 @@ extern void config_mvme16x(void); extern void config_q40(void); extern void config_sun3(void); extern void config_sun3x(void); +extern void config_virt(void); #endif /* _M68K_CONFIG_H */ diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h index aabe6420ead2..aaeabc65e63c 100644 --- a/arch/m68k/include/asm/io.h +++ b/arch/m68k/include/asm/io.h @@ -8,6 +8,9 @@ #include <asm/io_mm.h> #endif +#define gf_ioread32 ioread32be +#define gf_iowrite32 iowrite32be + #include <asm-generic/io.h> #endif /* _M68K_IO_H */ diff --git a/arch/m68k/include/asm/irq.h b/arch/m68k/include/asm/irq.h index 91dd493791d7..7829e955ca04 100644 --- a/arch/m68k/include/asm/irq.h +++ b/arch/m68k/include/asm/irq.h @@ -12,7 +12,8 @@ */ #if defined(CONFIG_COLDFIRE) #define NR_IRQS 256 -#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) +#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || \ + defined(CONFIG_SUN3X) || defined(CONFIG_VIRT) #define NR_IRQS 200 #elif defined(CONFIG_ATARI) #define NR_IRQS 141 diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h index 143ba7de9bda..9b4e2fe2ac82 100644 --- a/arch/m68k/include/asm/pgtable_mm.h +++ b/arch/m68k/include/asm/pgtable_mm.h @@ -80,6 +80,9 @@ #elif defined(CONFIG_COLDFIRE) #define KMAP_START 0xe0000000 #define KMAP_END 0xf0000000 +#elif defined(CONFIG_VIRT) +#define KMAP_START 0xdf000000 +#define KMAP_END 0xff000000 #else #define KMAP_START 0xd0000000 #define KMAP_END 0xf0000000 @@ -92,6 +95,10 @@ extern unsigned long m68k_vmalloc_end; #elif defined(CONFIG_COLDFIRE) #define VMALLOC_START 0xd0000000 #define VMALLOC_END 0xe0000000 +#elif defined(CONFIG_VIRT) +#define VMALLOC_OFFSET PAGE_SIZE +#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_END KMAP_START #else /* Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the diff --git a/arch/m68k/include/asm/setup.h b/arch/m68k/include/asm/setup.h index 8f2023f8c1c4..2c99477aaf89 100644 --- a/arch/m68k/include/asm/setup.h +++ b/arch/m68k/include/asm/setup.h @@ -37,7 +37,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_ATARI) || defined(CONFIG_MAC) || defined(CONFIG_APOLLO) \ || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ - || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) \ + || defined(CONFIG_VIRT) # define MACH_IS_AMIGA (m68k_machtype == MACH_AMIGA) #else # define MACH_AMIGA_ONLY @@ -50,7 +51,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_APOLLO) \ || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ - || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) \ + || defined(CONFIG_VIRT) # define MACH_IS_ATARI (m68k_machtype == MACH_ATARI) #else # define MACH_ATARI_ONLY @@ -63,7 +65,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_AMIGA) || defined(CONFIG_ATARI) || defined(CONFIG_APOLLO) \ || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ - || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) \ + || defined(CONFIG_VIRT) # define MACH_IS_MAC (m68k_machtype == MACH_MAC) #else # define MACH_MAC_ONLY @@ -84,7 +87,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ - || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) \ + || defined(CONFIG_VIRT) # define MACH_IS_APOLLO (m68k_machtype == MACH_APOLLO) #else # define MACH_APOLLO_ONLY @@ -97,7 +101,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ || defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000) \ || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ - || defined(CONFIG_SUN3X) || defined(CONFIG_MVME16x) + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME16x) \ + || defined(CONFIG_VIRT) # define MACH_IS_MVME147 (m68k_machtype == MACH_MVME147) #else # define MACH_MVME147_ONLY @@ -110,7 +115,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ || defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000) \ || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ - || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) \ + || defined(CONFIG_VIRT) # define MACH_IS_MVME16x (m68k_machtype == MACH_MVME16x) #else # define MACH_MVME16x_ONLY @@ -123,7 +129,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ - || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) \ + || defined(CONFIG_VIRT) # define MACH_IS_BVME6000 (m68k_machtype == MACH_BVME6000) #else # define MACH_BVME6000_ONLY @@ -136,7 +143,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ || defined(CONFIG_BVME6000) || defined(CONFIG_Q40) \ - || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) \ + || defined(CONFIG_VIRT) # define MACH_IS_HP300 (m68k_machtype == MACH_HP300) #else # define MACH_HP300_ONLY @@ -149,7 +157,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) \ - || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) \ + || defined(CONFIG_VIRT) # define MACH_IS_Q40 (m68k_machtype == MACH_Q40) #else # define MACH_Q40_ONLY @@ -162,7 +171,8 @@ extern unsigned long m68k_machtype; #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) \ - || defined(CONFIG_Q40) || defined(CONFIG_MVME147) + || defined(CONFIG_Q40) || defined(CONFIG_MVME147) \ + || defined(CONFIG_VIRT) # define MACH_IS_SUN3X (m68k_machtype == MACH_SUN3X) #else # define CONFIG_SUN3X_ONLY @@ -170,6 +180,20 @@ extern unsigned long m68k_machtype; # define MACH_TYPE (MACH_SUN3X) #endif +#if !defined(CONFIG_VIRT) +# define MACH_IS_VIRT (0) +#elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ + || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ + || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) \ + || defined(CONFIG_Q40) || defined(CONFIG_SUN3X) \ + || defined(CONFIG_MVME147) +# define MACH_IS_VIRT (m68k_machtype == MACH_VIRT) +#else +# define MACH_VIRT_ONLY +# define MACH_IS_VIRT (1) +# define MACH_TYPE (MACH_VIRT) +#endif + #ifndef MACH_TYPE # define MACH_TYPE (m68k_machtype) #endif diff --git a/arch/m68k/include/asm/virt.h b/arch/m68k/include/asm/virt.h new file mode 100644 index 000000000000..d3320c954796 --- /dev/null +++ b/arch/m68k/include/asm/virt.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_VIRT_H +#define __ASM_VIRT_H + +#define NUM_VIRT_SOURCES 200 + +struct virt_booter_device_data { + u32 mmio; + u32 irq; +}; + +struct virt_booter_data { + u32 qemu_version; + struct virt_booter_device_data pic; + struct virt_booter_device_data rtc; + struct virt_booter_device_data tty; + struct virt_booter_device_data ctrl; + struct virt_booter_device_data virtio; +}; + +extern struct virt_booter_data virt_bi_data; + +extern void __init virt_init_IRQ(void); + +#endif diff --git a/arch/m68k/include/uapi/asm/bootinfo-virt.h b/arch/m68k/include/uapi/asm/bootinfo-virt.h new file mode 100644 index 000000000000..e4db7e2213ab --- /dev/null +++ b/arch/m68k/include/uapi/asm/bootinfo-virt.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * asm/bootinfo-virt.h -- Virtual-m68k-specific boot information definitions + */ + +#ifndef _UAPI_ASM_M68K_BOOTINFO_VIRT_H +#define _UAPI_ASM_M68K_BOOTINFO_VIRT_H + +#define BI_VIRT_QEMU_VERSION 0x8000 +#define BI_VIRT_GF_PIC_BASE 0x8001 +#define BI_VIRT_GF_RTC_BASE 0x8002 +#define BI_VIRT_GF_TTY_BASE 0x8003 +#define BI_VIRT_VIRTIO_BASE 0x8004 +#define BI_VIRT_CTRL_BASE 0x8005 + +#define VIRT_BOOTI_VERSION MK_BI_VERSION(2, 0) + +#endif /* _UAPI_ASM_M68K_BOOTINFO_MAC_H */ diff --git a/arch/m68k/include/uapi/asm/bootinfo.h b/arch/m68k/include/uapi/asm/bootinfo.h index 38d3140381fa..203d9cbf9630 100644 --- a/arch/m68k/include/uapi/asm/bootinfo.h +++ b/arch/m68k/include/uapi/asm/bootinfo.h @@ -83,6 +83,7 @@ struct mem_info { #define MACH_SUN3X 11 #define MACH_M54XX 12 #define MACH_M5441X 13 +#define MACH_VIRT 14 /* |