qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 3/5] target/riscv: Move misa_mxl_max to class


From: Akihiko Odaki
Subject: Re: [PATCH v4 3/5] target/riscv: Move misa_mxl_max to class
Date: Wed, 18 Oct 2023 22:31:44 +0900
User-agent: Mozilla Thunderbird

On 2023/10/18 22:01, Daniel Henrique Barboza wrote:


On 10/17/23 15:53, Akihiko Odaki wrote:
misa_mxl_max is common for all instances of a RISC-V CPU class so they
are better put into class.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---

I'll repeat what I said in the v1: this patch is adding an extra class parameter, an extra param required to each class_init, and an extra CPUClass cast every time we want to read misa_mxl_max, all of that because we want to assign gdb_core_xml_file
earlier.

If my previous suggestion of assigning gdb_core directly into riscv_cpu_class_init() doesn't work necause we need misa_mxl_max to do it, a good alternative is setting gdb_core_xml_file in riscv_cpu_post_init(), which is executed after all cpu_init()
functions where we already have env->misa_mxl_max set properly.

We want to assign gdb_core_xml_file *earlier* so assigning it after cpu_init() is not OK. In general it should be considered unsafe to initialize a class variable after class_init(); otherwise other subsystems cannot know when it becomes available.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]