All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
To: qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com,
	liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com,
	palmer@rivosinc.com, ajones@ventanamicro.com,
	Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Subject: [PATCH v2 0/9] target/riscv/kvm: CSR related fixes
Date: Fri, 25 Apr 2025 08:36:56 -0300	[thread overview]
Message-ID: <20250425113705.2741457-1-dbarboza@ventanamicro.com> (raw)

Hi,

In this second version the most noticeable changes are:

- patch "target/riscv/kvm: reset 'scounteren' with host val" was
  dropped. After the v1 reviews [1] we decided that a better way would
  be to change the default 'virt' CPU to max. This would prevent the
  error condition handled in that patch to occur in the first place;

- we're not saving the size of the CPURISCVState flags that will be used
  to store the KVM CSR regs. We'll write the flags directly;

- as a result of the aforementioned change, we're changing the size of
  scounteren from uint32_t to target_ulong. All KVM CSRs are ulongs, and
  we don't want to deal with a 64 bit CSR write into a 32 bit flag.
  mcounteren was changed for consistency;

- scounteren requires the size change to be effective before KVM can use
  it, so I've split the patch that introduced scounteren and senvcfg in
  two.

Other minor changes after feedback from v1 were also made. 

Patches based on alistair/riscv-to-apply.next branch with a build fix
(see [2] for more info). 

Changes from v1:
- patch 7 ("target/riscv/kvm: reset 'scounteren' with host val")
  - dropped
- patch 2 (new):
  - fix mem leak
- patch 5 (former 4):
  - kvm_cpu_csr_get_u32() now returns an uint32_t
  - removed prop_size attribute from KVMCPUConfig
  - use KVM_REG_SIZE to determine the read/write size of the CSR
- patch 6 (former 5):
  - rename kvm_riscv_init_multiext_csr_cfg() to kvm_riscv_init_cfg()
- patch 7 (former 6):
  - removed all tags
  - added 'Reported-by' tag
  - removed 'scounteren'
- patch 8 (new):
  - change scounteren and mcounteren to 'target_ulong'
- patch 9 (new):
  - add scounteren KVM CSR
  - added 'Reported-by' tag
- v1 link: https://lore.kernel.org/qemu-riscv/20250417124839.1870494-1-dbarboza@ventanamicro.com/ 


[1] https://lore.kernel.org/qemu-riscv/20250417124839.1870494-1-dbarboza@ventanamicro.com/
[2] https://lore.kernel.org/qemu-devel/8f3bae37-e1f3-4e55-9dc6-b7876992b47e@ventanamicro.com/

Daniel Henrique Barboza (9):
  target/riscv/kvm: minor fixes/tweaks
  target/riscv/kvm: fix leak in kvm_riscv_init_multiext_cfg()
  target/riscv/kvm: turn u32/u64 reg functions in macros
  target/riscv/kvm: turn kvm_riscv_reg_id_ulong() in a macro
  target/riscv/kvm: add kvm_csr_cfgs[]
  target/riscv/kvm: do not read unavailable CSRs
  target/riscv/kvm: add senvcfg CSR
  target/riscv: widen (m|s)counteren to target_ulong
  target/riscv/kvm: add scounteren CSR

 target/riscv/cpu.h         |   5 +-
 target/riscv/kvm/kvm-cpu.c | 331 +++++++++++++++++++++++--------------
 target/riscv/machine.c     |   8 +-
 3 files changed, 216 insertions(+), 128 deletions(-)

-- 
2.49.0



             reply	other threads:[~2025-04-25 11:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25 11:36 Daniel Henrique Barboza [this message]
2025-04-25 11:36 ` [PATCH v2 1/9] target/riscv/kvm: minor fixes/tweaks Daniel Henrique Barboza
2025-04-25 11:43   ` Andrew Jones
2025-04-25 11:36 ` [PATCH v2 2/9] target/riscv/kvm: fix leak in kvm_riscv_init_multiext_cfg() Daniel Henrique Barboza
2025-04-25 11:44   ` Andrew Jones
2025-04-25 11:36 ` [PATCH v2 3/9] target/riscv/kvm: turn u32/u64 reg functions in macros Daniel Henrique Barboza
2025-04-25 11:45   ` Andrew Jones
2025-04-25 11:37 ` [PATCH v2 4/9] target/riscv/kvm: turn kvm_riscv_reg_id_ulong() in a macro Daniel Henrique Barboza
2025-04-25 11:48   ` Andrew Jones
2025-04-25 11:37 ` [PATCH v2 5/9] target/riscv/kvm: add kvm_csr_cfgs[] Daniel Henrique Barboza
2025-04-25 11:58   ` Andrew Jones
2025-04-25 11:37 ` [PATCH v2 6/9] target/riscv/kvm: do not read unavailable CSRs Daniel Henrique Barboza
2025-04-25 12:02   ` Andrew Jones
2025-04-25 11:37 ` [PATCH v2 7/9] target/riscv/kvm: add senvcfg CSR Daniel Henrique Barboza
2025-04-25 12:03   ` Andrew Jones
2025-04-25 11:37 ` [PATCH v2 8/9] target/riscv: widen (m|s)counteren to target_ulong Daniel Henrique Barboza
2025-04-25 12:11   ` Andrew Jones
2025-04-25 13:10     ` Daniel Henrique Barboza
2025-04-25 11:37 ` [PATCH v2 9/9] target/riscv/kvm: add scounteren CSR Daniel Henrique Barboza
2025-04-25 12:12   ` Andrew Jones

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=20250425113705.2741457-1-dbarboza@ventanamicro.com \
    --to=dbarboza@ventanamicro.com \
    --cc=ajones@ventanamicro.com \
    --cc=alistair.francis@wdc.com \
    --cc=liwei1518@gmail.com \
    --cc=palmer@rivosinc.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.