qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] riscv: detecting user choice in TCG extensions
@ 2023-07-28 13:15 Daniel Henrique Barboza
  2023-07-28 13:15 ` [PATCH 1/8] target/riscv/cpu.c: use offset in isa_ext_is_enabled/update_enabled Daniel Henrique Barboza
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Daniel Henrique Barboza @ 2023-07-28 13:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-riscv, alistair.francis, bmeng, liweiwei, zhiwei_liu, palmer,
	Daniel Henrique Barboza

Hi,

This series, based on the work done in "[PATCH for-8.2 v6 00/11] riscv:
add 'max' CPU, deprecate 'any'", aims to solve two problem we have in
TCG properties handling:

- we are not checking for priv_ver when auto-enabling extensions during
  realize();

- we are not able to honor user choice during validation because we're
  not able to tell if the user set an extension flag or not.

The solution adopted here is a modification of what we did in the RISC-V
KVM driver for 8.1. Instead of adding an 'user_set' flag and doing a
linear search in all the extensions (now split between multiple arrays),
we'll use a hash to store the 'offset' value of the property that the
user set in the command line in the set() callback of the property. The
existence of an entry in the hash indicates that the user set a value
for that extension, and the store val indicates what the user set. This
can be used in the future in case we decide to overwrite the user input
in a corner case.

Aside from this detail, the changes to convert the existing code to use
the new structure (RISCVCPUMultiExtConfig) is quite similar to what was
already done before in the KVM driver.

I also added a new concept called 'auto_update' (any other name is
welcome) to refer to the action of changing extension state during
realize() without user knowledge. All these cases are now wrapped in a
cpu_cfg_ext_auto_update() function that checks if the priv_ver is valid
and if the user set the extension to an specific val. User choice
prevails in this case, regardless of the noble intentions we have when
auto-updating an extensions (e.g. extension dependencies).

Yes, users will have an easier time breaking validation and guest boot,
but that's the idea. Users will have more power, and the adequate dose
of responsibility that comes with it.


Daniel Henrique Barboza (8):
  target/riscv/cpu.c: use offset in isa_ext_is_enabled/update_enabled
  target/riscv: make CPUCFG() macro public
  target/riscv/cpu.c: introduce cpu_cfg_ext_auto_update()
  target/riscv/cpu.c: use cpu_cfg_ext_auto_update() during realize()
  target/riscv/cpu.c: introduce RISCVCPUMultiExtConfig
  target/riscv: use isa_ext_update_enabled() in
    init_max_cpu_extensions()
  target/riscv/cpu.c: honor user choice in cpu_cfg_ext_auto_update()
  target/riscv/cpu.c: consider user option with RVG

 target/riscv/cpu.c | 392 +++++++++++++++++++++++++++++----------------
 target/riscv/cpu.h |   2 +
 target/riscv/kvm.c |   8 +-
 3 files changed, 261 insertions(+), 141 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-08-11 15:06 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28 13:15 [PATCH 0/8] riscv: detecting user choice in TCG extensions Daniel Henrique Barboza
2023-07-28 13:15 ` [PATCH 1/8] target/riscv/cpu.c: use offset in isa_ext_is_enabled/update_enabled Daniel Henrique Barboza
2023-08-10 17:30   ` Alistair Francis
2023-07-28 13:15 ` [PATCH 2/8] target/riscv: make CPUCFG() macro public Daniel Henrique Barboza
2023-08-10 17:31   ` Alistair Francis
2023-07-28 13:15 ` [PATCH 3/8] target/riscv/cpu.c: introduce cpu_cfg_ext_auto_update() Daniel Henrique Barboza
2023-08-11 14:50   ` Alistair Francis
2023-07-28 13:15 ` [PATCH 4/8] target/riscv/cpu.c: use cpu_cfg_ext_auto_update() during realize() Daniel Henrique Barboza
2023-08-11 14:52   ` Alistair Francis
2023-07-28 13:15 ` [PATCH 5/8] target/riscv/cpu.c: introduce RISCVCPUMultiExtConfig Daniel Henrique Barboza
2023-08-11 15:03   ` Alistair Francis
2023-07-28 13:15 ` [PATCH 6/8] target/riscv: use isa_ext_update_enabled() in init_max_cpu_extensions() Daniel Henrique Barboza
2023-08-11 15:04   ` Alistair Francis
2023-07-28 13:15 ` [PATCH 7/8] target/riscv/cpu.c: honor user choice in cpu_cfg_ext_auto_update() Daniel Henrique Barboza
2023-08-11 15:04   ` Alistair Francis
2023-07-28 13:15 ` [PATCH 8/8] target/riscv/cpu.c: consider user option with RVG Daniel Henrique Barboza
2023-08-11 15:05   ` Alistair Francis

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).