Skip to contentSkip to conversation

Add options to config/meson files for custom CSR

RFC PATCH Jessica Clarke 3 participants 4 messages Aug 6, 2021 – Aug 13, 2021

lore
Share & tools
lore
#0 lore raw
Quoted 19 lines · Bin Meng
Quoted 18 lines
Quoted 14 lines · Ruinland Chuan-Tzu Tsai

From: Ruinland ChuanTzu Tsai <[email protected]>

Adding option riscv_custom to configure script, meson.build and meson_options.txt so as to toggle custom CSR and will-be-upstreamed custom instructions handling logic.

---
 configure         | 6 ++++++
 meson.build       | 2 ++
 meson_options.txt | 2 ++
 3 files changed, 10 insertions(+)
Quoted 5 lines
Quoted 3 lines

This sounds like unnecessary to bring such a config option to the meson level.

I believe a Kconfig option should just be fine.

+Alistair

I don’t see why this is even a config option. If you request a vendor’s CPU you should get any custom CSRs defined for that vendor’s CPU. If you don’t you don’t. This should be purely a run-time thing, no?

Jess

#1 lore raw
Quoted 22 lines · Jessica Clarke
Quoted 22 lines · Bin Meng
Quoted 20 lines
Quoted 7 lines · Ruinland Chuan-Tzu Tsai

From: Ruinland ChuanTzu Tsai <[email protected]>

Adding option riscv_custom to configure script, meson.build and meson_options.txt so as to toggle custom CSR and will-be-upstreamed custom instructions handling logic.

Quoted 7 lines
---
 configure         | 6 ++++++
 meson.build       | 2 ++
 meson_options.txt | 2 ++
 3 files changed, 10 insertions(+)

This sounds like unnecessary to bring such a config option to the meson level.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I believe a Kconfig option should just be fine.

+Alistair

I don’t see why this is even a config option. If you request a vendor’s CPU you should get any custom CSRs defined for that vendor’s CPU. If you don’t you don’t. This should be purely a run-time thing, no?

In a generic use case where we build all RISC-V machines into one qemu-system-riscv{32,64} executable this makes no difference. The Kconfig option will be turned on if any one of the machines requires it. It only gets benefits when we build a QEMU executable on a per-machine basis.

Regards,
Bin

#2 lore raw
Quoted 31 lines · Bin Meng
Quoted 22 lines · Jessica Clarke
Quoted 22 lines · Bin Meng
Quoted 20 lines
Quoted 7 lines · Ruinland Chuan-Tzu Tsai

From: Ruinland ChuanTzu Tsai <[email protected]>

Adding option riscv_custom to configure script, meson.build and meson_options.txt so as to toggle custom CSR and will-be-upstreamed custom instructions handling logic.

Quoted 7 lines

---

configure         | 6 ++++++
meson.build       | 2 ++
meson_options.txt | 2 ++
3 files changed, 10 insertions(+)

This sounds like unnecessary to bring such a config option to the meson level.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I believe a Kconfig option should just be fine.

+Alistair

I don’t see why this is even a config option. If you request a vendor’s CPU you should get any custom CSRs defined for that vendor’s CPU. If you don’t you don’t. This should be purely a run-time thing, no?

Quoted 5 lines

In a generic use case where we build all RISC-V machines into one qemu-system-riscv{32,64} executable this makes no difference. The Kconfig option will be turned on if any one of the machines requires it. It only gets benefits when we build a QEMU executable on a per-machine basis.

The machines live in hw, the current patch is using the config option in target, and hw depends on target not the other way round. I don’t see how your example fits with that; it’d result in a layering violation (target depending on a hw config option), no?

In your example you still wouldn’t have a config option for the feature, I believe. You’d always have the hooks in target, and then if you enable support for a specific CPU at compile time you get its CSRs along with all its other bits, and at run-time you choose which to use.

So I still don’t see how this option is useful.

Jess

#3 lore raw
In reply to Bin Meng
Quoted 32 lines · Bin Meng
Quoted 22 lines · Jessica Clarke
Quoted 22 lines · Bin Meng
Quoted 20 lines
Quoted 7 lines · Ruinland Chuan-Tzu Tsai

From: Ruinland ChuanTzu Tsai <[email protected]>

Adding option riscv_custom to configure script, meson.build and meson_options.txt so as to toggle custom CSR and will-be-upstreamed custom instructions handling logic.

Quoted 7 lines
---
 configure         | 6 ++++++
 meson.build       | 2 ++
 meson_options.txt | 2 ++
 3 files changed, 10 insertions(+)

This sounds like unnecessary to bring such a config option to the meson level.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I believe a Kconfig option should just be fine.

+Alistair

I don’t see why this is even a config option. If you request a vendor’s CPU you should get any custom CSRs defined for that vendor’s CPU. If you don’t you don’t. This should be purely a run-time thing, no?

Quoted 5 lines

In a generic use case where we build all RISC-V machines into one qemu-system-riscv{32,64} executable this makes no difference. The Kconfig option will be turned on if any one of the machines requires it. It only gets benefits when we build a QEMU executable on a per-machine basis.

I agree with Bin that this could be a Kconfig option, that is selected when a vendor CPU is enabled.

It also doesn't have to be a config and could just be built all the time. I don't see much of an advantage in allowing it to be disabled, it's just another thing we would need to test. Maybe is a user was just interested in the virt machine/KVM they could disable it to avoid any overhead.

Alistair

Quoted 4 lines

Regards,
Bin