[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v14 02/26] target/loongarch: Add core definition
From: |
gaosong |
Subject: |
Re: [PATCH v14 02/26] target/loongarch: Add core definition |
Date: |
Mon, 10 Jan 2022 20:34:09 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
Hi,
On 2022/1/10 上午2:49, Richard Henderson
wrote:
+static bool
loongarch_cpu_has_work(CPUState *cs)
+{
+ return true;
Note: this is only applicable to CONFIG_USER_ONLY, and needs to
be changed in the following commits adding system emulation. To
better convey your intention it may be better to use an #ifdef
guard, something like this:
#ifndef CONFIG_USER_ONLY
#error System emulation TODO
#else
return true;
#endif
(I'm not sure if this is okay in QEMU coding style, so please
correct me if this isn't the case.)
In my opinion, we don't need to do this. As you pointed out below, SPW shouldn't appear in this series. All CONFIG_USER_ONLY macors should appear in the system emulation series.
Liks this:
20220108091419.2027710-1-yangxiaojuan@loongson.cn/20220108091419.2027710-12-yangxiaojuan@loongson.cn/">https://patchew.org/QEMU/20220108091419.2027710-1-yangxiaojuan@loongson.cn/20220108091419.2027710-12-yangxiaojuan@loongson.cn/
static bool loongarch_cpu_has_work(CPUState *cs)
{
+#ifdef CONFIG_USER_ONLY
return true;
+#else
+ LoongArchCPU *cpu = LOONGARCH_CPU(cs);
+ CPULoongArchState *env = &cpu->env;
+ bool has_work = false;
+
+ if ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
+ cpu_loongarch_hw_interrupts_pending(env)) {
+ has_work = true;
+ }
+
+ return has_work;
+#endif
}
Prefer
positive tests over negative tests, so
#ifdef CONFIG_USER_ONLY
return true;
#else
#error
#endif
+ data =
"" CPUCFG2, LSPW, 1);
Do you support the SPW extension in this series? If not you
probably don't want to set this bit.
Correct, you can't expose features that you don't implement.
Accept this suggesstions.
Thanks
Song
- [PATCH v14 00/26] Add LoongArch linux-user emulation support, Song Gao, 2022/01/06
- [PATCH v14 03/26] target/loongarch: Add main translation routines, Song Gao, 2022/01/06
- [PATCH v14 04/26] target/loongarch: Add fixed point arithmetic instruction translation, Song Gao, 2022/01/06
- [PATCH v14 05/26] target/loongarch: Add fixed point shift instruction translation, Song Gao, 2022/01/06
- [PATCH v14 06/26] target/loongarch: Add fixed point bit instruction translation, Song Gao, 2022/01/06
- [PATCH v14 02/26] target/loongarch: Add core definition, Song Gao, 2022/01/06
- Re: [PATCH v14 02/26] target/loongarch: Add core definition, gaosong, 2022/01/10
- Re: [PATCH v14 02/26] target/loongarch: Add core definition, WANG Xuerui, 2022/01/10
- Re: [PATCH v14 02/26] target/loongarch: Add core definition, gaosong, 2022/01/12
- Re: [PATCH v14 02/26] target/loongarch: Add core definition, gaosong, 2022/01/12
- Re: [PATCH v14 02/26] target/loongarch: Add core definition, WANG Xuerui, 2022/01/12
[PATCH v14 09/26] target/loongarch: Add fixed point extra instruction translation, Song Gao, 2022/01/06
[PATCH v14 11/26] target/loongarch: Add floating point comparison instruction translation, Song Gao, 2022/01/06
[PATCH v14 12/26] target/loongarch: Add floating point conversion instruction translation, Song Gao, 2022/01/06
[PATCH v14 14/26] target/loongarch: Add floating point load/store instruction translation, Song Gao, 2022/01/06