[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes
|
From: |
Jiaxun Yang |
|
Subject: |
Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes |
|
Date: |
Tue, 23 May 2023 12:18:19 +0100 |
> 2023年5月23日 11:01,Song Gao <gaosong@loongson.cn> 写道:
>
>
>
> 在 2023/5/23 上午11:22, Jiaxun Yang 写道:
[...]
>>
>>>
>> Is totally the same on MIPS and LoongArch. I’m guarding them out because
>> We have different way to get IOCSR address space on MIPS, which is due
>> to be implemented.
>>
>> I can further abstract out a function to get IOCSR address space. But still,
>> I think the best way to differ those two architecture is using TARGET_*
>> macros,
>> as it doesn’t make much sense to have unused code for another architecture
>> compiled.
> Most of the code in hw/intc or hw/ uses property to distinguish between
> different devices, not TARGE_* macro.
They are the *same* device, with different way to handle IOCSR address space.
Another problem is casting CPUState with LOONGARCH_CPU() is something invalid on
MIPS, vice-versa. We are potentially introducing a security issue here.
I know nobody have done something like this before, but not necessarily to be a
bad idea.
I’ll introduce something like:
+#ifdef TARGET_LOONGARCH64
+static inline void *AddressSpace get_iocsr_as(int cpuid)
+{
+ CPUState *cs = qemu_get_cpu(cpuid);
+ LoongArchCPU *cpu = LOONGARCH_CPU(cs);
+
+ return &cpu->env.address_space_iocsr;
+}
+#endif
+
+#ifdef TARGET_MIPS64
+static inline void *AddressSpace get_iocsr_as(int cpuid)
+{
+ CPUState *cs = qemu_get_cpu(cpuid);
+ MIPSCPU *cpu = MIPS_CPU(cs);
+
+ return &cpu->env.iocsr.as;
+}
+#endif
Thanks
- Jiaxun
>
> I still think it is better to use property.
>
> Thanks.
> Song Gao
>>> All references to loongarch_ipi should also be changed.
>> Sure.
>>
>> Thanks
>> - Jiaxun
>
- [PATCH 0/4] hw/mips/loongson3_virt: Wire up loongarch_ipi device, Jiaxun Yang, 2023/05/21
- [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes, Jiaxun Yang, 2023/05/21
- Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes, Huacai Chen, 2023/05/21
- Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes, Jiaxun Yang, 2023/05/22
- Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes, Philippe Mathieu-Daudé, 2023/05/22
- Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes, Song Gao, 2023/05/22
- Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes, Jiaxun Yang, 2023/05/22
- Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes, Song Gao, 2023/05/23
- Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes,
Jiaxun Yang <=
- Re: [PATCH 1/4] hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes, Philippe Mathieu-Daudé, 2023/05/23
[PATCH 2/4] hw/intc/loongarch_ipi: Guard LoongArch only features with ifdef, Jiaxun Yang, 2023/05/21
[PATCH 4/4] tests/avocado: Add boot_linux_console test for loongson3-virt, Jiaxun Yang, 2023/05/21
[PATCH 3/4] hw/mips/loongson3_virt: Wire up loongarch_ipi device, Jiaxun Yang, 2023/05/21