2019-08-17 17:55:58 +08:00
|
|
|
mips_ss = ss.source_set()
|
2021-01-27 14:54:21 +08:00
|
|
|
mips_ss.add(files('bootloader.c', 'mips_int.c'))
|
2020-09-22 10:49:25 +08:00
|
|
|
mips_ss.add(when: 'CONFIG_FW_CFG_MIPS', if_true: files('fw_cfg.c'))
|
hw/mips: Add Loongson-3 machine support
Add Loongson-3 based machine support, it use liointc as the interrupt
controler and use GPEX as the pci controller. Currently it can work with
both TCG and KVM.
As the machine model is not based on any exiting physical hardware, the
name of the machine is "loongson3-virt". It may be superseded in future
by a real machine model. If this happens, then a regular deprecation
procedure shall occur for "loongson3-virt" machine.
We now already have a full functional Linux kernel (based on Linux-5.4.x
LTS) here:
https://github.com/chenhuacai/linux
Of course the upstream kernel is also usable (the kvm host side and
guest side have both been upstream in Linux-5.9):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
How to use QEMU/Loongson-3?
1, Download kernel source from the above URL;
2, Build a kernel with arch/mips/configs/loongson3_defconfig;
3, Boot a Loongson-3A4000 host with this kernel (for KVM mode);
4, Build QEMU-master with this patchset;
5, modprobe kvm (only necessary for KVM mode);
6, Use QEMU with TCG:
qemu-system-mips64el -M loongson3-virt,accel=tcg -cpu Loongson-3A1000 -kernel <path_to_kernel> -append ...
Use QEMU with KVM:
qemu-system-mips64el -M loongson3-virt,accel=kvm -cpu Loongson-3A4000 -kernel <path_to_kernel> -append ...
The "-cpu" parameter is optional here and QEMU will use the correct type for TCG/KVM automatically.
Co-developed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Huacai Chen <chenhuacai@kernel.org>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201221110538.3186646-5-chenhuacai@kernel.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
[PMD: Set TYPE_LOONGSON_MACHINE instance_size in TypeInfo,
select FW_CFG_MIPS in Kconfig]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2020-04-27 17:33:14 +08:00
|
|
|
mips_ss.add(when: 'CONFIG_LOONGSON3V', if_true: files('loongson3_bootp.c', 'loongson3_virt.c'))
|
2019-03-10 09:25:07 +08:00
|
|
|
mips_ss.add(when: 'CONFIG_MALTA', if_true: files('malta.c'))
|
2021-04-12 06:11:07 +08:00
|
|
|
mips_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('cps.c'))
|
|
|
|
|
|
|
|
if 'CONFIG_TCG' in config_all
|
|
|
|
mips_ss.add(when: 'CONFIG_JAZZ', if_true: files('jazz.c'))
|
2019-08-17 17:55:58 +08:00
|
|
|
mips_ss.add(when: 'CONFIG_MIPSSIM', if_true: files('mipssim.c'))
|
2021-04-12 06:11:07 +08:00
|
|
|
mips_ss.add(when: 'CONFIG_FULOONG', if_true: files('fuloong2e.c'))
|
2020-09-01 18:15:41 +08:00
|
|
|
mips_ss.add(when: 'CONFIG_MIPS_BOSTON', if_true: [files('boston.c'), fdt])
|
2021-04-12 06:11:07 +08:00
|
|
|
endif
|
2019-08-17 17:55:58 +08:00
|
|
|
|
|
|
|
hw_arch += {'mips': mips_ss}
|