Message ID | 1602831120-3377-1-git-send-email-chenhc@lemote.com |
---|---|
Headers | show |
Series | mips: Add Loongson-3 machine support | expand |
Patchew URL: https://patchew.org/QEMU/1602831120-3377-1-git-send-email-chenhc@lemote.com/ Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 1602831120-3377-1-git-send-email-chenhc@lemote.com Subject: [PATCH V14 0/8] mips: Add Loongson-3 machine support === TEST SCRIPT BEGIN === #!/bin/bash git rev-parse base > /dev/null || exit 0 git config --local diff.renamelimit 0 git config --local diff.renames True git config --local diff.algorithm histogram ./scripts/checkpatch.pl --mailback base.. === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu * [new tag] patchew/1602831120-3377-1-git-send-email-chenhc@lemote.com -> patchew/1602831120-3377-1-git-send-email-chenhc@lemote.com Switched to a new branch 'test' d292df4 docs/system: Update MIPS machine documentation 4e63ead hw/mips: Add Loongson-3 machine support 1bf0737 hw/mips: Add Loongson-3 boot parameter helpers bd43b2f hw/mips: Implement fw_cfg_arch_key_name() f93634a target/mips: Add loongson-ext lsdc2 group of instructions b55eee0 target/mips: Add loongson-ext lswc2 group of instructions (Part 2) 2c2eaaa target/mips: Add loongson-ext lswc2 group of instructions (Part 1) ab68efd target/mips: Fix PageMask with variable page size === OUTPUT BEGIN === 1/8 Checking commit ab68efdc70ef (target/mips: Fix PageMask with variable page size) 2/8 Checking commit 2c2eaaabbd3a (target/mips: Add loongson-ext lswc2 group of instructions (Part 1)) 3/8 Checking commit b55eee07bfbe (target/mips: Add loongson-ext lswc2 group of instructions (Part 2)) 4/8 Checking commit f93634a586de (target/mips: Add loongson-ext lsdc2 group of instructions) 5/8 Checking commit bd43b2ff95e9 (hw/mips: Implement fw_cfg_arch_key_name()) WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #16: new file mode 100644 total: 0 errors, 1 warnings, 60 lines checked Patch 5/8 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. 6/8 Checking commit 1bf0737aee8c (hw/mips: Add Loongson-3 boot parameter helpers) WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #15: new file mode 100644 WARNING: line over 80 characters #47: FILE: hw/mips/loongson3_bootp.c:28: +static struct efi_cpuinfo_loongson *init_cpu_info(void *g_cpuinfo, uint64_t cpu_freq) WARNING: line over 80 characters #66: FILE: hw/mips/loongson3_bootp.c:47: +static struct efi_memory_map_loongson *init_memory_map(void *g_map, uint64_t ram_size) total: 0 errors, 3 warnings, 394 lines checked Patch 6/8 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. 7/8 Checking commit 4e63ead64501 (hw/mips: Add Loongson-3 machine support) WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #80: new file mode 100644 ERROR: line over 90 characters #151: FILE: hw/mips/loongson3_virt.c:67: + * 3, http://www.anheng.com.cn/loongson/firmware-nonfree/uefi/loongson3-virt/bios_loongson3.bin ERROR: line over 90 characters #152: FILE: hw/mips/loongson3_virt.c:68: + * 4, http://mirrors.ustc.edu.cn/loongson/firmware-nonfree/uefi/loongson3-virt/bios_loongson3.bin ERROR: line over 90 characters #153: FILE: hw/mips/loongson3_virt.c:69: + * 5, http://mirrors.nju.edu.cn/loongson/firmware-nonfree/uefi/loongson3-virt/bios_loongson3.bin ERROR: line over 90 characters #154: FILE: hw/mips/loongson3_virt.c:70: + * 6, https://mirrors.tuna.tsinghua.edu.cn/loongson/firmware-nonfree/uefi/loongson3-virt/bios_loongson3.bin ERROR: line over 90 characters #155: FILE: hw/mips/loongson3_virt.c:71: + * 7, https://mirrors.bfsu.edu.cn/loongson/firmware-nonfree/uefi/loongson3-virt/bios_loongson3.bin ERROR: line over 90 characters #156: FILE: hw/mips/loongson3_virt.c:72: + * 8, https://mirrors.cloud.tencent.com/loongson/firmware-nonfree/uefi/loongson3-virt/bios_loongson3.bin WARNING: line over 80 characters #204: FILE: hw/mips/loongson3_virt.c:120: +static void loongson3_pm_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) WARNING: line over 80 characters #279: FILE: hw/mips/loongson3_virt.c:195: + loaderparams.a2 = cpu_mips_phys_to_kseg0(NULL, loader_rommap[LOADER_PARAM].base); WARNING: line over 80 characters #361: FILE: hw/mips/loongson3_virt.c:277: + fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)current_machine->smp.max_cpus); WARNING: line over 80 characters #409: FILE: hw/mips/loongson3_virt.c:325: + sprintf(highmemenv, "%ld", (unsigned long)(loaderparams.ram_size / MiB) - 256); WARNING: line over 80 characters #495: FILE: hw/mips/loongson3_virt.c:411: +static inline void loongson3_virt_devices_init(MachineState *machine, DeviceState *pic) WARNING: line over 80 characters #526: FILE: hw/mips/loongson3_virt.c:442: + get_system_io(), 0, virt_memmap[VIRT_PCIE_PIO].size); WARNING: line over 80 characters #640: FILE: hw/mips/loongson3_virt.c:556: + /* Allocate RAM/BIOS, 0x00000000~0x10000000 is alias of 0x80000000~0x90000000 */ total: 6 errors, 8 warnings, 660 lines checked Patch 7/8 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. 8/8 Checking commit d292df465eb8 (docs/system: Update MIPS machine documentation) === OUTPUT END === Test command exited with code: 1 The full log is available at http://patchew.org/logs/1602831120-3377-1-git-send-email-chenhc@lemote.com/testing.checkpatch/?type=message. --- Email generated automatically by Patchew [https://patchew.org/]. Please send your feedback to patchew-devel@redhat.com
On 10/16/20 8:51 AM, Huacai Chen wrote: > Loongson-3 CPU family include Loongson-3A R1/R2/R3/R4 and Loongson-3B > R1/R2. Loongson-3A R1 is the oldest and its ISA is the smallest, while > Loongson-3A R4 is the newest and its ISA is almost the superset of all > others. To reduce complexity, in QEMU we just define two CPU types: > > 1, "Loongson-3A1000" CPU which is corresponding to Loongson-3A R1. It is > suitable for TCG because Loongson-3A R1 has fewest ASE. > 2, "Loongson-3A4000" CPU which is corresponding to Loongson-3A R4. It is > suitable for KVM because Loongson-3A R4 has the VZ ASE. > > Loongson-3 lacks English documents. I've tried to translated them with > translate.google.com, and the machine translated documents (together > with their original Chinese versions) are available here. > > Loongson-3A R1 (Loongson-3A1000) > User Manual Part 1: > http://ftp.godson.ac.cn/lemote/3A1000_p1.pdf > http://ftp.godson.ac.cn/lemote/Loongson3A1000_processor_user_manual_P1.pdf (Chinese Version) > User Manual Part 2: > http://ftp.godson.ac.cn/lemote/3A1000_p2.pdf > http://ftp.godson.ac.cn/lemote/Loongson3A1000_processor_user_manual_P2.pdf (Chinese Version) > > Loongson-3A R2 (Loongson-3A2000) > User Manual Part 1: > http://ftp.godson.ac.cn/lemote/3A2000_p1.pdf > http://ftp.godson.ac.cn/lemote/Loongson3A2000_user1.pdf (Chinese Version) > User Manual Part 2: > http://ftp.godson.ac.cn/lemote/3A2000_p2.pdf > http://ftp.godson.ac.cn/lemote/Loongson3A2000_user2.pdf (Chinese Version) > > Loongson-3A R3 (Loongson-3A3000) > User Manual Part 1: > http://ftp.godson.ac.cn/lemote/3A3000_p1.pdf > http://ftp.godson.ac.cn/lemote/Loongson3A3000_3B3000usermanual1.pdf (Chinese Version) > User Manual Part 2: > http://ftp.godson.ac.cn/lemote/3A3000_p2.pdf > http://ftp.godson.ac.cn/lemote/Loongson3A3000_3B3000usermanual2.pdf (Chinese Version) > > Loongson-3A R4 (Loongson-3A4000) > User Manual Part 1: > http://ftp.godson.ac.cn/lemote/3A4000_p1.pdf > http://ftp.godson.ac.cn/lemote/3A4000user.pdf (Chinese Version) > User Manual Part 2: > I'm sorry that it is unavailable now. > > And human-translated documents (W.I.P) are available here now: > https://github.com/loongson-community/docs/tree/master/English-translation-of-Loongson-manual Patches 2-4 applied to mips-next (fixing the bisectability build failure in patch 2 & 3).
Loongson-3 CPU family include Loongson-3A R1/R2/R3/R4 and Loongson-3B R1/R2. Loongson-3A R1 is the oldest and its ISA is the smallest, while Loongson-3A R4 is the newest and its ISA is almost the superset of all others. To reduce complexity, in QEMU we just define two CPU types: 1, "Loongson-3A1000" CPU which is corresponding to Loongson-3A R1. It is suitable for TCG because Loongson-3A R1 has fewest ASE. 2, "Loongson-3A4000" CPU which is corresponding to Loongson-3A R4. It is suitable for KVM because Loongson-3A R4 has the VZ ASE. Loongson-3 lacks English documents. I've tried to translated them with translate.google.com, and the machine translated documents (together with their original Chinese versions) are available here. Loongson-3A R1 (Loongson-3A1000) User Manual Part 1: http://ftp.godson.ac.cn/lemote/3A1000_p1.pdf http://ftp.godson.ac.cn/lemote/Loongson3A1000_processor_user_manual_P1.pdf (Chinese Version) User Manual Part 2: http://ftp.godson.ac.cn/lemote/3A1000_p2.pdf http://ftp.godson.ac.cn/lemote/Loongson3A1000_processor_user_manual_P2.pdf (Chinese Version) Loongson-3A R2 (Loongson-3A2000) User Manual Part 1: http://ftp.godson.ac.cn/lemote/3A2000_p1.pdf http://ftp.godson.ac.cn/lemote/Loongson3A2000_user1.pdf (Chinese Version) User Manual Part 2: http://ftp.godson.ac.cn/lemote/3A2000_p2.pdf http://ftp.godson.ac.cn/lemote/Loongson3A2000_user2.pdf (Chinese Version) Loongson-3A R3 (Loongson-3A3000) User Manual Part 1: http://ftp.godson.ac.cn/lemote/3A3000_p1.pdf http://ftp.godson.ac.cn/lemote/Loongson3A3000_3B3000usermanual1.pdf (Chinese Version) User Manual Part 2: http://ftp.godson.ac.cn/lemote/3A3000_p2.pdf http://ftp.godson.ac.cn/lemote/Loongson3A3000_3B3000usermanual2.pdf (Chinese Version) Loongson-3A R4 (Loongson-3A4000) User Manual Part 1: http://ftp.godson.ac.cn/lemote/3A4000_p1.pdf http://ftp.godson.ac.cn/lemote/3A4000user.pdf (Chinese Version) User Manual Part 2: I'm sorry that it is unavailable now. And human-translated documents (W.I.P) are available here now: https://github.com/loongson-community/docs/tree/master/English-translation-of-Loongson-manual Both KVM and TCG are available now! We now already have a full functional Linux kernel (based on Linux-5.4.x LTS, the kvm host side and guest side have both been upstream for Linux- 5.9, but Linux-5.9 has not been released yet) here: https://github.com/chenhuacai/linux Of course the upstream kernel is also usable (though it is "unstable" now): 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_{def,hpc}config; 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. V1 -> V2: 1, Add a cover letter; 2, Improve CPU definitions; 3, Remove LS7A-related things (Use GPEX instead); 4, Add a description of how to run QEMU/Loongson-3. V2 -> V3: 1, Fix all possible checkpatch.pl errors and warnings. V3 -> V4: 1, Sync code with upstream; 2, Remove merged patches; 3, Fix build failure without CONFIG_KVM; 4, Add Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>. V4 -> V5: 1, Improve coding style; 2, Remove merged patches; 3, Rename machine name from "loongson3" to "loongson3-virt"; 4, Rework the "loongson3-virt" machine to drop any ISA things; 5, Rework "hw/mips: Implement the kvm_type() hook in MachineClass"; 6, Add Jiaxun Yang as a reviewer of Loongson-3. V5 -> V6: 1, Fix license preamble; 2, Improve commit messages; 3, Add hw/intc/loongson_liointc.c to MAINTAINERS; 4, Fix all possible checkpatch.pl errors and warnings. V7 and V8 have only one patch (machine definition) with some minor improvements. V8 -> V9: 1, Update KVM type definition from kernel; 2, Fix PageMask with variable page size for TCG; 3, Add TCG support (add Loongson-EXT instructions). V9 -> V10: 1, Split fw_cfg to a separate patch; 2, Split boot parameters definition to a local header; 3, Update MIPS machine documentation; 4, Many other improvements suggested by Philippe Mathieu-Daudé. V10 -> V11: 1, Fix some typos; 2, Add Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>. V11 -> V12: 1, Split boot parameter helpers to loongson3_bootp.c; 2, Support both BE and LE host (Loongson guests are always LE). V12 -> V13: 1, Sync code with upstream; 2, Re-enable KVM support for MIPS in meson; V13 -> V14: 1, Remove merged patches; 2, Split boot parameter helpers to a separate patch; 4, Many other improvements suggested by Philippe Mathieu-Daudé. Huacai Chen and Jiaxun Yang (8): target/mips: Fix PageMask with variable page size target/mips: Add loongson-ext lswc2 group of instructions (Part 1) target/mips: Add loongson-ext lswc2 group of instructions (Part 2) target/mips: Add loongson-ext lsdc2 group of instructions hw/mips: Implement fw_cfg_arch_key_name() hw/mips: Add Loongson-3 boot parameter helpers hw/mips: Add Loongson-3 machine support docs/system: Update MIPS machine documentation Signed-off-by: Huacai Chen <chenhc@lemote.com> --- default-configs/devices/mips64el-softmmu.mak | 1 + docs/system/cpu-models-mips.rst.inc | 10 +- docs/system/target-mips.rst | 10 + hw/mips/Kconfig | 12 + hw/mips/fw_cfg.c | 35 ++ hw/mips/fw_cfg.h | 19 + hw/mips/loongson3_bootp.c | 162 +++++++ hw/mips/loongson3_bootp.h | 225 ++++++++++ hw/mips/loongson3_virt.c | 627 +++++++++++++++++++++++++++ hw/mips/meson.build | 3 +- target/mips/cp0_helper.c | 36 +- target/mips/cpu.h | 1 + target/mips/translate.c | 443 +++++++++++++++++++ 13 files changed, 1574 insertions(+), 10 deletions(-) create mode 100644 hw/mips/fw_cfg.c create mode 100644 hw/mips/fw_cfg.h create mode 100644 hw/mips/loongson3_bootp.c create mode 100644 hw/mips/loongson3_bootp.h create mode 100644 hw/mips/loongson3_virt.c -- 2.7.0