[PATCH v3 0/2] RISC-V: Initial support versioning of debug specification

Alvin Chang via posted 2 patches 2 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251201014255.230069-1-alvinga@andestech.com
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
target/riscv/cpu.c                |  1 +
target/riscv/cpu_cfg_fields.h.inc |  1 +
target/riscv/debug.c              | 56 +++++++++++++++++++++++++++++--
target/riscv/debug.h              |  1 +
4 files changed, 56 insertions(+), 3 deletions(-)
[PATCH v3 0/2] RISC-V: Initial support versioning of debug specification
Posted by Alvin Chang via 2 months, 1 week ago
This series try to support versioning of debug specification. The early debug
implementation supports debug specification v0.13, and later new trigger types
were added which are defined in debug specification v1.0 version. To support
both v0.13 and v1.0, we add 'debug-1.0' as CPU property to let user choose
debug specification v1.0 by specifying "debug-1.0=true". The default version is
still v0.13 if 'debug-1.0' is not provided and set.

For example, to enable debug specification v1.0 on max CPU:
* -cpu max,debug-1.0=true

Changes since v2:
* Improve commit message and fix typo
* Apply "Reviewed-by" tags

Changes since v1:
* Apply suggestions from Daniel. Using boolean property instead of string.

Alvin Chang (2):
  target/riscv: Add "debug-1.0" to specify debug specification v1.0
  target/riscv: Simpily support versioning of debug trigger module

 target/riscv/cpu.c                |  1 +
 target/riscv/cpu_cfg_fields.h.inc |  1 +
 target/riscv/debug.c              | 56 +++++++++++++++++++++++++++++--
 target/riscv/debug.h              |  1 +
 4 files changed, 56 insertions(+), 3 deletions(-)

-- 
2.43.0
Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug specification
Posted by Chao Liu 1 month, 2 weeks ago
On Mon, 1 Dec 2025 09:42:53 +0800, Alvin Chang via wrote:
> This series try to support versioning of debug specification. The early debug
> implementation supports debug specification v0.13, and later new trigger types
> were added which are defined in debug specification v1.0 version. To support
> both v0.13 and v1.0, we add 'debug-1.0' as CPU property to let user choose
> debug specification v1.0 by specifying "debug-1.0=true". The default version
> is still v0.13 if 'debug-1.0' is not provided and set.
>
> For example, to enable debug specification v1.0 on max CPU:
> * -cpu max,debug-1.0=true
>
> Changes since v2:
> * Improve commit message and fix typo
> * Apply "Reviewed-by" tags
>
> Changes since v1:
> * Apply suggestions from Daniel. Using boolean property instead of string.

This is great work! Thanks to Alvin Chang for refining the sdext. It seems we
are one step closer to merging rvsp-ref into the mainline.

What are your thoughts on this, Daniel?

Thanks,
Chao
RE: [PATCH v3 0/2] RISC-V: Initial support versioning of debug specification
Posted by Alvin Che-Chia Chang(張哲嘉) 1 month, 2 weeks ago
Hi Chao,

> -----Original Message-----
> From: Chao Liu <chao.liu@zevorn.cn>
> Sent: Friday, December 19, 2025 4:09 PM
> To: qemu-devel@nongnu.org
> Cc: alistair.francis@wdc.com; Alvin Che-Chia Chang(張哲嘉)
> <alvinga@andestech.com>; bin.meng@windriver.com;
> dbarboza@ventanamicro.com; liwei1518@gmail.com;
> qemu-riscv@nongnu.org; vivahavey@gmail.com;
> zhiwei_liu@linux.alibaba.com
> Subject: Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug
> specification
>
> [EXTERNAL MAIL]
>
> On Mon, 1 Dec 2025 09:42:53 +0800, Alvin Chang via wrote:
> > This series try to support versioning of debug specification. The
> > early debug implementation supports debug specification v0.13, and
> > later new trigger types were added which are defined in debug
> > specification v1.0 version. To support both v0.13 and v1.0, we add
> > 'debug-1.0' as CPU property to let user choose debug specification
> > v1.0 by specifying "debug-1.0=true". The default version is still v0.13 if
> 'debug-1.0' is not provided and set.
> >
> > For example, to enable debug specification v1.0 on max CPU:
> > * -cpu max,debug-1.0=true
> >
> > Changes since v2:
> > * Improve commit message and fix typo
> > * Apply "Reviewed-by" tags
> >
> > Changes since v1:
> > * Apply suggestions from Daniel. Using boolean property instead of string.
>
> This is great work! Thanks to Alvin Chang for refining the sdext. It seems we
> are one step closer to merging rvsp-ref into the mainline.

Thank you, Chao.
Please note that this series doesn't implement Sdext infrastructure.
We have some patches for Sdtrig based on Debug spec v1.0 and we want to upstream those patches.
We ever submitted the patches, but unfortunately the patches were blocked.
The maintainer told me that QEMU should support both v0.13 and v1.0 for backward compatibility, rather than eliminating v0.13.
That why I submitted this series, trying to resolve the version issue.


Sincerely,
Alvin Chang


>
> What are your thoughts on this, Daniel?
>
> Thanks,
> Chao
CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug specification
Posted by Chao Liu 1 month, 2 weeks ago

On 12/19/2025 5:10 PM, Alvin Che-Chia Chang(張哲嘉) wrote:
> Hi Chao,
> 
>> -----Original Message-----
>> From: Chao Liu <chao.liu@zevorn.cn>
>> Sent: Friday, December 19, 2025 4:09 PM
>> To: qemu-devel@nongnu.org
>> Cc: alistair.francis@wdc.com; Alvin Che-Chia Chang(張哲嘉)
>> <alvinga@andestech.com>; bin.meng@windriver.com;
>> dbarboza@ventanamicro.com; liwei1518@gmail.com;
>> qemu-riscv@nongnu.org; vivahavey@gmail.com;
>> zhiwei_liu@linux.alibaba.com
>> Subject: Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug
>> specification
>>
>> [EXTERNAL MAIL]
>>
>> On Mon, 1 Dec 2025 09:42:53 +0800, Alvin Chang via wrote:
>>> This series try to support versioning of debug specification. The
>>> early debug implementation supports debug specification v0.13, and
>>> later new trigger types were added which are defined in debug
>>> specification v1.0 version. To support both v0.13 and v1.0, we add
>>> 'debug-1.0' as CPU property to let user choose debug specification
>>> v1.0 by specifying "debug-1.0=true". The default version is still v0.13 if
>> 'debug-1.0' is not provided and set.
>>>
>>> For example, to enable debug specification v1.0 on max CPU:
>>> * -cpu max,debug-1.0=true
>>>
>>> Changes since v2:
>>> * Improve commit message and fix typo
>>> * Apply "Reviewed-by" tags
>>>
>>> Changes since v1:
>>> * Apply suggestions from Daniel. Using boolean property instead of string.
>>
>> This is great work! Thanks to Alvin Chang for refining the sdext. It seems we
>> are one step closer to merging rvsp-ref into the mainline.
> 
> Thank you, Chao.
> Please note that this series doesn't implement Sdext infrastructure.
> We have some patches for Sdtrig based on Debug spec v1.0 and we want to upstream those patches.
> We ever submitted the patches, but unfortunately the patches were blocked.
> The maintainer told me that QEMU should support both v0.13 and v1.0 for backward compatibility, rather than eliminating v0.13.
> That why I submitted this series, trying to resolve the version issue.
> 
> 
> Sincerely,
> Alvin Chang
> 
> 
Oh, thank you for your clarification. I also noticed this when reviewing the
main patch series — it was my misunderstanding. Still, thank you for your
contribution!

I have done some development work on Sdext before, but I noticed that
implementations of the DM module vary among different vendors. In addition, how
to achieve compatibility with gdbstub is also a challenge. I will send out the
RFC patches at an appropriate time in the future.

Thanks,
Chao

Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug specification
Posted by Daniel Henrique Barboza 3 weeks, 3 days ago

On 12/19/2025 6:23 AM, Chao Liu wrote:
> 
> 
> On 12/19/2025 5:10 PM, Alvin Che-Chia Chang(張哲嘉) wrote:
>> Hi Chao,
>>
>>> -----Original Message-----
>>> From: Chao Liu <chao.liu@zevorn.cn>
>>> Sent: Friday, December 19, 2025 4:09 PM
>>> To: qemu-devel@nongnu.org
>>> Cc: alistair.francis@wdc.com; Alvin Che-Chia Chang(張哲嘉)
>>> <alvinga@andestech.com>; bin.meng@windriver.com;
>>> dbarboza@ventanamicro.com; liwei1518@gmail.com;
>>> qemu-riscv@nongnu.org; vivahavey@gmail.com;
>>> zhiwei_liu@linux.alibaba.com
>>> Subject: Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug
>>> specification
>>>
>>> [EXTERNAL MAIL]
>>>
>>> On Mon, 1 Dec 2025 09:42:53 +0800, Alvin Chang via wrote:
>>>> This series try to support versioning of debug specification. The
>>>> early debug implementation supports debug specification v0.13, and
>>>> later new trigger types were added which are defined in debug
>>>> specification v1.0 version. To support both v0.13 and v1.0, we add
>>>> 'debug-1.0' as CPU property to let user choose debug specification
>>>> v1.0 by specifying "debug-1.0=true". The default version is still v0.13 if
>>> 'debug-1.0' is not provided and set.
>>>>
>>>> For example, to enable debug specification v1.0 on max CPU:
>>>> * -cpu max,debug-1.0=true
>>>>
>>>> Changes since v2:
>>>> * Improve commit message and fix typo
>>>> * Apply "Reviewed-by" tags
>>>>
>>>> Changes since v1:
>>>> * Apply suggestions from Daniel. Using boolean property instead of string.
>>>
>>> This is great work! Thanks to Alvin Chang for refining the sdext. It seems we
>>> are one step closer to merging rvsp-ref into the mainline.
>>
>> Thank you, Chao.
>> Please note that this series doesn't implement Sdext infrastructure.
>> We have some patches for Sdtrig based on Debug spec v1.0 and we want to upstream those patches.
>> We ever submitted the patches, but unfortunately the patches were blocked.
>> The maintainer told me that QEMU should support both v0.13 and v1.0 for backward compatibility, rather than eliminating v0.13.
>> That why I submitted this series, trying to resolve the version issue.
>>
>>
>> Sincerely,
>> Alvin Chang
>>
>>
> Oh, thank you for your clarification. I also noticed this when reviewing the
> main patch series — it was my misunderstanding. Still, thank you for your
> contribution!
> 
> I have done some development work on Sdext before, but I noticed that
> implementations of the DM module vary among different vendors. In addition, how
> to achieve compatibility with gdbstub is also a challenge. I will send out the
> RFC patches at an appropriate time in the future.

Hi Chao,

If I understood correctly you might have some code that implements sdext 
  in QEMU. Is that the case?

If affirmative, feel free to send it at you earliest convenience, even 
if it's rough on the edges (you can tag it as RFC). We would like to get
the Server Platform Reference Board merged, preferably for this release, 
and we need sdext to be compliant with that spec.


Cheers,

Daniel



> 
> Thanks,
> Chao


Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug specification
Posted by Chao Liu 3 weeks, 2 days ago
On 1/14/2026 2:55 AM, Daniel Henrique Barboza wrote:
>
>
> On 12/19/2025 6:23 AM, Chao Liu wrote:
>>
>>
>> On 12/19/2025 5:10 PM, Alvin Che-Chia Chang(張哲嘉) wrote:
>>> Hi Chao,
>>>
>>>> -----Original Message-----
>>>> From: Chao Liu <chao.liu@zevorn.cn>
>>>> Sent: Friday, December 19, 2025 4:09 PM
>>>> To: qemu-devel@nongnu.org
>>>> Cc: alistair.francis@wdc.com; Alvin Che-Chia Chang(張哲嘉)
>>>> <alvinga@andestech.com>; bin.meng@windriver.com;
>>>> dbarboza@ventanamicro.com; liwei1518@gmail.com;
>>>> qemu-riscv@nongnu.org; vivahavey@gmail.com;
>>>> zhiwei_liu@linux.alibaba.com
>>>> Subject: Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug
>>>> specification
>>>>
>>>> [EXTERNAL MAIL]
>>>>
>>>> On Mon, 1 Dec 2025 09:42:53 +0800, Alvin Chang via wrote:
>>>>> This series try to support versioning of debug specification. The
>>>>> early debug implementation supports debug specification v0.13, and
>>>>> later new trigger types were added which are defined in debug
>>>>> specification v1.0 version. To support both v0.13 and v1.0, we add
>>>>> 'debug-1.0' as CPU property to let user choose debug specification
>>>>> v1.0 by specifying "debug-1.0=true". The default version is still v0.13 if
>>>> 'debug-1.0' is not provided and set.
>>>>>
>>>>> For example, to enable debug specification v1.0 on max CPU:
>>>>> * -cpu max,debug-1.0=true
>>>>>
>>>>> Changes since v2:
>>>>> * Improve commit message and fix typo
>>>>> * Apply "Reviewed-by" tags
>>>>>
>>>>> Changes since v1:
>>>>> * Apply suggestions from Daniel. Using boolean property instead of string.
>>>>
>>>> This is great work! Thanks to Alvin Chang for refining the sdext. It seems we
>>>> are one step closer to merging rvsp-ref into the mainline.
>>>
>>> Thank you, Chao.
>>> Please note that this series doesn't implement Sdext infrastructure.
>>> We have some patches for Sdtrig based on Debug spec v1.0 and we want to
>>> upstream those patches.
>>> We ever submitted the patches, but unfortunately the patches were blocked.
>>> The maintainer told me that QEMU should support both v0.13 and v1.0 for
>>> backward compatibility, rather than eliminating v0.13.
>>> That why I submitted this series, trying to resolve the version issue.
>>>
>>>
>>> Sincerely,
>>> Alvin Chang
>>>
>>>
>> Oh, thank you for your clarification. I also noticed this when reviewing the
>> main patch series — it was my misunderstanding. Still, thank you for your
>> contribution!
>>
>> I have done some development work on Sdext before, but I noticed that
>> implementations of the DM module vary among different vendors. In addition, how
>> to achieve compatibility with gdbstub is also a challenge. I will send out the
>> RFC patches at an appropriate time in the future.
>
> Hi Chao,
>
> If I understood correctly you might have some code that implements sdext  in
> QEMU. Is that the case?
>
> If affirmative, feel free to send it at you earliest convenience, even if it's
> rough on the edges (you can tag it as RFC). We would like to get
> the Server Platform Reference Board merged, preferably for this release, and we
> need sdext to be compliant with that spec.
>
>
Okay, I will send the RFC patch to the upstream for discussion in the next
couple of days. :)


Thanks,
Chao

> Cheers,
>
> Daniel
>
>
>
>>
>> Thanks,
>> Chao
>
RE: [PATCH v3 0/2] RISC-V: Initial support versioning of debug specification
Posted by Alvin Che-Chia Chang(張哲嘉) 1 month, 2 weeks ago

> -----Original Message-----
> From: Chao Liu <chao.liu.zevorn@gmail.com>
> Sent: Friday, December 19, 2025 5:24 PM
> To: Alvin Che-Chia Chang(張哲嘉) <alvinga@andestech.com>;
> qemu-devel@nongnu.org
> Cc: alistair.francis@wdc.com; bin.meng@windriver.com;
> dbarboza@ventanamicro.com; liwei1518@gmail.com;
> qemu-riscv@nongnu.org; vivahavey@gmail.com;
> zhiwei_liu@linux.alibaba.com
> Subject: Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug
> specification
>
> [EXTERNAL MAIL]
>
> On 12/19/2025 5:10 PM, Alvin Che-Chia Chang(張哲嘉) wrote:
> > Hi Chao,
> >
> >> -----Original Message-----
> >> From: Chao Liu <chao.liu@zevorn.cn>
> >> Sent: Friday, December 19, 2025 4:09 PM
> >> To: qemu-devel@nongnu.org
> >> Cc: alistair.francis@wdc.com; Alvin Che-Chia Chang(張哲嘉)
> >> <alvinga@andestech.com>; bin.meng@windriver.com;
> >> dbarboza@ventanamicro.com; liwei1518@gmail.com;
> >> qemu-riscv@nongnu.org; vivahavey@gmail.com;
> >> zhiwei_liu@linux.alibaba.com
> >> Subject: Re: [PATCH v3 0/2] RISC-V: Initial support versioning of
> >> debug specification
> >>
> >> [EXTERNAL MAIL]
> >>
> >> On Mon, 1 Dec 2025 09:42:53 +0800, Alvin Chang via wrote:
> >>> This series try to support versioning of debug specification. The
> >>> early debug implementation supports debug specification v0.13, and
> >>> later new trigger types were added which are defined in debug
> >>> specification v1.0 version. To support both v0.13 and v1.0, we add
> >>> 'debug-1.0' as CPU property to let user choose debug specification
> >>> v1.0 by specifying "debug-1.0=true". The default version is still
> >>> v0.13 if
> >> 'debug-1.0' is not provided and set.
> >>>
> >>> For example, to enable debug specification v1.0 on max CPU:
> >>> * -cpu max,debug-1.0=true
> >>>
> >>> Changes since v2:
> >>> * Improve commit message and fix typo
> >>> * Apply "Reviewed-by" tags
> >>>
> >>> Changes since v1:
> >>> * Apply suggestions from Daniel. Using boolean property instead of string.
> >>
> >> This is great work! Thanks to Alvin Chang for refining the sdext. It
> >> seems we are one step closer to merging rvsp-ref into the mainline.
> >
> > Thank you, Chao.
> > Please note that this series doesn't implement Sdext infrastructure.
> > We have some patches for Sdtrig based on Debug spec v1.0 and we want to
> upstream those patches.
> > We ever submitted the patches, but unfortunately the patches were blocked.
> > The maintainer told me that QEMU should support both v0.13 and v1.0 for
> backward compatibility, rather than eliminating v0.13.
> > That why I submitted this series, trying to resolve the version issue.
> >
> >
> > Sincerely,
> > Alvin Chang
> >
> >
> Oh, thank you for your clarification. I also noticed this when reviewing the
> main patch series — it was my misunderstanding. Still, thank you for your
> contribution!
>
> I have done some development work on Sdext before, but I noticed that
> implementations of the DM module vary among different vendors. In addition,
> how to achieve compatibility with gdbstub is also a challenge. I will send out
> the RFC patches at an appropriate time in the future.

Nice work! I remember that Spike has DM module, so I think vendor compatibility is not a critical issue.
It's better than nothing. Looking forward to your patches for DM module.

Sincerely,
Alvin

>
> Thanks,
> Chao
CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug specification
Posted by Chao Liu 1 month, 2 weeks ago

On 12/19/2025 5:47 PM, Alvin Che-Chia Chang(張哲嘉) wrote:
> 
> 
>> -----Original Message-----
>> From: Chao Liu <chao.liu.zevorn@gmail.com>
>> Sent: Friday, December 19, 2025 5:24 PM
>> To: Alvin Che-Chia Chang(張哲嘉) <alvinga@andestech.com>;
>> qemu-devel@nongnu.org
>> Cc: alistair.francis@wdc.com; bin.meng@windriver.com;
>> dbarboza@ventanamicro.com; liwei1518@gmail.com;
>> qemu-riscv@nongnu.org; vivahavey@gmail.com;
>> zhiwei_liu@linux.alibaba.com
>> Subject: Re: [PATCH v3 0/2] RISC-V: Initial support versioning of debug
>> specification
>>
>> [EXTERNAL MAIL]
>>
>> On 12/19/2025 5:10 PM, Alvin Che-Chia Chang(張哲嘉) wrote:
>>> Hi Chao,
>>>
>>>> -----Original Message-----
>>>> From: Chao Liu <chao.liu@zevorn.cn>
>>>> Sent: Friday, December 19, 2025 4:09 PM
>>>> To: qemu-devel@nongnu.org
>>>> Cc: alistair.francis@wdc.com; Alvin Che-Chia Chang(張哲嘉)
>>>> <alvinga@andestech.com>; bin.meng@windriver.com;
>>>> dbarboza@ventanamicro.com; liwei1518@gmail.com;
>>>> qemu-riscv@nongnu.org; vivahavey@gmail.com;
>>>> zhiwei_liu@linux.alibaba.com
>>>> Subject: Re: [PATCH v3 0/2] RISC-V: Initial support versioning of
>>>> debug specification
>>>>
>>>> [EXTERNAL MAIL]
>>>>
>>>> On Mon, 1 Dec 2025 09:42:53 +0800, Alvin Chang via wrote:
>>>>> This series try to support versioning of debug specification. The
>>>>> early debug implementation supports debug specification v0.13, and
>>>>> later new trigger types were added which are defined in debug
>>>>> specification v1.0 version. To support both v0.13 and v1.0, we add
>>>>> 'debug-1.0' as CPU property to let user choose debug specification
>>>>> v1.0 by specifying "debug-1.0=true". The default version is still
>>>>> v0.13 if
>>>> 'debug-1.0' is not provided and set.
>>>>>
>>>>> For example, to enable debug specification v1.0 on max CPU:
>>>>> * -cpu max,debug-1.0=true
>>>>>
>>>>> Changes since v2:
>>>>> * Improve commit message and fix typo
>>>>> * Apply "Reviewed-by" tags
>>>>>
>>>>> Changes since v1:
>>>>> * Apply suggestions from Daniel. Using boolean property instead of string.
>>>>
>>>> This is great work! Thanks to Alvin Chang for refining the sdext. It
>>>> seems we are one step closer to merging rvsp-ref into the mainline.
>>>
>>> Thank you, Chao.
>>> Please note that this series doesn't implement Sdext infrastructure.
>>> We have some patches for Sdtrig based on Debug spec v1.0 and we want to
>> upstream those patches.
>>> We ever submitted the patches, but unfortunately the patches were blocked.
>>> The maintainer told me that QEMU should support both v0.13 and v1.0 for
>> backward compatibility, rather than eliminating v0.13.
>>> That why I submitted this series, trying to resolve the version issue.
>>>
>>>
>>> Sincerely,
>>> Alvin Chang
>>>
>>>
>> Oh, thank you for your clarification. I also noticed this when reviewing the
>> main patch series — it was my misunderstanding. Still, thank you for your
>> contribution!
>>
>> I have done some development work on Sdext before, but I noticed that
>> implementations of the DM module vary among different vendors. In addition,
>> how to achieve compatibility with gdbstub is also a challenge. I will send out
>> the RFC patches at an appropriate time in the future.
> 
> Nice work! I remember that Spike has DM module, so I think vendor compatibility is not a critical issue.
> It's better than nothing. Looking forward to your patches for DM module.
> 

That's great news! Haha, referring to the implementation of the DM module in
Spike is a good choice. Thanks again! :)

Thanks,
Chao