From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Mikhail Tyutin" <m.tyutin@yadro.com>,
"Aleksandr Anenkov" <a.anenkov@yadro.com>,
qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Bin Meng" <bin.meng@windriver.com>,
"Weiwei Li" <liweiwei@iscas.ac.cn>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
"open list:RISC-V TCG CPUs" <qemu-riscv@nongnu.org>
Subject: Re: [PATCH v2 2/3] target/riscv: Initialize gdb_core_xml_file only once
Date: Sun, 15 Oct 2023 07:25:05 +0900 [thread overview]
Message-ID: <917cb69b-d97c-4f41-bf90-49ad3a42a3ba@daynix.com> (raw)
In-Reply-To: <6a06acfc-3ca0-402e-8a98-bdd1a22bdf0d@ventanamicro.com>
On 2023/10/15 3:19, Daniel Henrique Barboza wrote:
>
>
> On 10/14/23 00:35, Akihiko Odaki wrote:
>> gdb_core_xml_file was assigned each time a CPU is instantiated before
>> this change.
>>
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>> target/riscv/cpu.c | 5 +++++
>> target/riscv/tcg/tcg-cpu.c | 4 ----
>> 2 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
>> index ac4a6c7eec..a811215150 100644
>> --- a/target/riscv/cpu.c
>> +++ b/target/riscv/cpu.c
>> @@ -1575,6 +1575,11 @@ static void riscv_cpu_class_init(ObjectClass
>> *c, void *data)
>> cc->get_pc = riscv_cpu_get_pc;
>> cc->gdb_read_register = riscv_cpu_gdb_read_register;
>> cc->gdb_write_register = riscv_cpu_gdb_write_register;
>> +#ifdef TARGET_RISCV64
>> + cc->gdb_core_xml_file = "riscv-64bit-cpu.xml";
>> +#elif defined(TARGET_RISCV32)
>> + cc->gdb_core_xml_file = "riscv-32bit-cpu.xml";
>> +#endif
>> cc->gdb_num_core_regs = 33;
>> cc->gdb_stop_before_watchpoint = true;
>> cc->disas_set_info = riscv_cpu_disas_set_info;
>> diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
>> index e0cbc56320..626fb2acea 100644
>> --- a/target/riscv/tcg/tcg-cpu.c
>> +++ b/target/riscv/tcg/tcg-cpu.c
>> @@ -150,8 +150,6 @@ static void
>> riscv_cpu_validate_misa_priv(CPURISCVState *env, Error **errp)
>> static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, Error **errp)
>> {
>> - RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(cpu);
>> - CPUClass *cc = CPU_CLASS(mcc);
>> CPURISCVState *env = &cpu->env;
>> /* Validate that MISA_MXL is set properly. */
>> @@ -159,11 +157,9 @@ static void riscv_cpu_validate_misa_mxl(RISCVCPU
>> *cpu, Error **errp)
>> #ifdef TARGET_RISCV64
>> case MXL_RV64:
>> case MXL_RV128:
>> - cc->gdb_core_xml_file = "riscv-64bit-cpu.xml";
>> break;
>> #elif defined(TARGET_RISCV32)
>> case MXL_RV32:
>> - cc->gdb_core_xml_file = "riscv-32bit-cpu.xml";
>> break;
>
>
> Hmmm the issue here is that, in patch 1, you added an "elif
> defined(TARGET_RISCV32)"
> based on an assumption that you changed here since there's no more
> gdb_core files being
> set.
It's opposite. Patch 1 added "elif defined(TARGET_RISCV32)" because
configs/targets/riscv64-linux-user.mak and
configs/targets/riscv64-softmmu.mak do not list riscv-32bit-cpu.xml and
referencing it from TARGET_RISCV64 results in an error.
Since patch 1 now ensures TARGET_RISCV64 will never have MXL_RV32 as
misa_mxl_max, patch 2 can safely assume TARGET_RISCV64 always has
riscv-64bit-cpu.xml as gdb_core_xml_file.
>
> My suggestion is to use patch 1 from v1, where you removed the
> misa_mxl_max == misa_mxl
> check at the end of this function. And then in this patch you can remove
> this function
> altogether since you're assigning gdb_core in riscv_cpu_class_init() and
> the function will
> be left doing nothing of note.
Assigning gdb_core_xml_file is more like a side-effect of
riscv_cpu_validate_misa_mxl(), and the main purpose of this function is
to validate misa_mxl[_max]. I think it's still a good idea to validate
misa_mxl_max in particular. Specifying MXL_RV32 as misa_mxl_max for
TARGET_RISCV64 or specifying MXL_RV64/MXL_RV128 for TARGET_RISCV32 will
not work because of the incompatible gdb_core_xml_file (and probably
other reasons).
next prev parent reply other threads:[~2023-10-14 22:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-14 3:35 [PATCH v2 0/3] gdbstub and TCG plugin improvements Akihiko Odaki
2023-10-14 3:35 ` [PATCH v2 1/3] target/riscv: Do not allow MXL_RV32 for TARGET_RISCV64 Akihiko Odaki
2023-10-14 18:04 ` Daniel Henrique Barboza
2023-10-16 1:51 ` Alistair Francis
2023-10-16 3:22 ` Akihiko Odaki
2023-10-16 4:07 ` Alistair Francis
2023-10-16 4:19 ` Akihiko Odaki
2023-10-17 2:13 ` LIU Zhiwei
2023-10-17 3:32 ` Alistair Francis
2023-10-17 3:39 ` LIU Zhiwei
2023-10-14 3:35 ` [PATCH v2 2/3] target/riscv: Initialize gdb_core_xml_file only once Akihiko Odaki
2023-10-14 18:19 ` Daniel Henrique Barboza
2023-10-14 22:25 ` Akihiko Odaki [this message]
2023-10-14 3:35 ` [PATCH v2 3/3] plugins: Remove an extra parameter Akihiko Odaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=917cb69b-d97c-4f41-bf90-49ad3a42a3ba@daynix.com \
--to=akihiko.odaki@daynix.com \
--cc=a.anenkov@yadro.com \
--cc=alex.bennee@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=dbarboza@ventanamicro.com \
--cc=liweiwei@iscas.ac.cn \
--cc=m.tyutin@yadro.com \
--cc=palmer@dabbelt.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).