qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 00/20] target/riscv, KVM: fixes and enhancements
@ 2023-06-28 21:30 Daniel Henrique Barboza
  2023-06-28 21:30 ` [PATCH v6 01/20] target/riscv: skip features setup for KVM CPUs Daniel Henrique Barboza
                   ` (19 more replies)
  0 siblings, 20 replies; 38+ messages in thread
From: Daniel Henrique Barboza @ 2023-06-28 21:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-riscv, alistair.francis, bmeng, liweiwei, zhiwei_liu, palmer,
	ajones, philmd, Daniel Henrique Barboza

Hi,

This new version has changes suggested by Phil in v5. It also has some
changes I made on the fly. The short summary is:

- use "#ifndef CONFIG_USER_MODE kvm_enabled() #endif" instead of a helper
  that wraps them all up. This was suggested by Phil to be more clear
  about the code that depends on KVM or not. A new patch (15) was added
  to keep the amount of #ifndefs in control in
  riscv_cpu_add_user_properties() due to this design change;

- misa_ext_info_arr[] is now indexed from 0 to 25 instead of 0 from
  potentially 1 << 25. Getters for 'name' and 'description' were added.

It's worth mentioning a change I decided to make that wasn't mentioned
in the v5 review. In patch 12, where we added KVM MISA properties, we
were trying to find the property before proceeding with
object_property_add() to add the remaining properties. I remembered that
we can also use object_property_try_add(). In fact,
object_property_add() is a simple call for object_property_try_add()
that uses &error_fatal. And it turns out that and the only error being
reported by try_add() happens when object_property_find() finds a
property with the same name. This means that we can use
object_property_try_add() with an error pointer and, if an error is
reported, it means that we already have the property. This change makes
us do a single object_property_find() instead of 2. 

Patches 6 and 17 (former 16) had trivial changes, all of them related to
the extinct riscv_running_kvm() helper, and I decided to keep their r-bs
for reviewer convenience.

Series was rebased on top of riscv-to-apply.next.

Patches missing reviews: 1, 11, 12, 14, 15.

Changes from v5:
- trivial changes (R-bs kept):
  - patch 6: use kvm_enabled() instead of riscv_running_kvm()
  - patch 17 (former 16): wrap cpu_set_cfg_unavailable() inside '#ifndef
    CONFIG_USER_MODE'
- patch 1:
  - riscv_running_kvm() removed
  - rename riscv_cpu_realize_functions() to riscv_cpu_realize_tcg()
  - use 'tcg_enabled()' before riscv_cpu_realize_tcg()
  - reword commit msg to indicate that we're checking positive for TCG
    instead of negative for KVM
- patch 11:
  - misa_ext_info_arr[] is now indexed from 0 (A-A) to 25 (Z-A)
  - getter functions for 'name' and 'description' were added
  - misa_ext_info_arr[] is no longer exported in target/riscv/cpu.h
  - 'name' and 'description' of misa_ext_cfg[] must now be populated
    after initialization because misa_ext_info_arr[] is no longer a
    constant array
- patch 12:
  - use object_property_try_add() in riscv_cpu_add_misa_properties().
    It'll set an Error pointer if the property already exists. Use that
    to skip an already created property instead of doing a redundant
    object_property_find() beforehand
  - moved the object_property_find() code that was checking for
    multi-letter properties to patch 14
  - use the new getters() from patch 11 instead of reading the array
    directly
- patch 14:
  - added the code from patch 12 that checks for an existing
    multi-letter property. Add a kvm_enabled() check around it in
    preparation for the mock KVM properties patch later on
- patch 15 (new):
  - create satp_mode properties earlier to avoid an extra #ifndef
    CONFIG_USER_MODE block
- v5 link: https://lists.gnu.org/archive/html/qemu-devel/2023-06/msg05984.html

Daniel Henrique Barboza (20):
  target/riscv: skip features setup for KVM CPUs
  hw/riscv/virt.c: skip 'mmu-type' FDT if satp mode not set
  target/riscv/cpu.c: restrict 'mvendorid' value
  target/riscv/cpu.c: restrict 'mimpid' value
  target/riscv/cpu.c: restrict 'marchid' value
  target/riscv: use KVM scratch CPUs to init KVM properties
  target/riscv: read marchid/mimpid in kvm_riscv_init_machine_ids()
  target/riscv: handle mvendorid/marchid/mimpid for KVM CPUs
  linux-headers: Update to v6.4-rc1
  target/riscv/kvm.c: init 'misa_ext_mask' with scratch CPU
  target/riscv/cpu: add misa_ext_info_arr[]
  target/riscv: add KVM specific MISA properties
  target/riscv/kvm.c: update KVM MISA bits
  target/riscv/kvm.c: add multi-letter extension KVM properties
  target/riscv/cpu.c: add satp_mode properties earlier
  target/riscv/cpu.c: remove priv_ver check from riscv_isa_string_ext()
  target/riscv/cpu.c: create KVM mock properties
  target/riscv: update multi-letter extension KVM properties
  target/riscv/kvm.c: add kvmconfig_get_cfg_addr() helper
  target/riscv/kvm.c: read/write (cbom|cboz)_blocksize in KVM

 hw/riscv/virt.c                               |  14 +-
 include/standard-headers/linux/const.h        |   2 +-
 include/standard-headers/linux/virtio_blk.h   |  18 +-
 .../standard-headers/linux/virtio_config.h    |   6 +
 include/standard-headers/linux/virtio_net.h   |   1 +
 linux-headers/asm-arm64/kvm.h                 |  33 ++
 linux-headers/asm-riscv/kvm.h                 |  53 +-
 linux-headers/asm-riscv/unistd.h              |   9 +
 linux-headers/asm-s390/unistd_32.h            |   1 +
 linux-headers/asm-s390/unistd_64.h            |   1 +
 linux-headers/asm-x86/kvm.h                   |   3 +
 linux-headers/linux/const.h                   |   2 +-
 linux-headers/linux/kvm.h                     |  12 +-
 linux-headers/linux/psp-sev.h                 |   7 +
 linux-headers/linux/userfaultfd.h             |  17 +-
 target/riscv/cpu.c                            | 322 +++++++++--
 target/riscv/cpu.h                            |   7 +-
 target/riscv/kvm.c                            | 499 +++++++++++++++++-
 target/riscv/kvm_riscv.h                      |   1 +
 19 files changed, 917 insertions(+), 91 deletions(-)

-- 
2.41.0



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

end of thread, other threads:[~2023-06-30  7:51 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-28 21:30 [PATCH v6 00/20] target/riscv, KVM: fixes and enhancements Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 01/20] target/riscv: skip features setup for KVM CPUs Daniel Henrique Barboza
2023-06-29  8:24   ` Andrew Jones
2023-06-28 21:30 ` [PATCH v6 02/20] hw/riscv/virt.c: skip 'mmu-type' FDT if satp mode not set Daniel Henrique Barboza
2023-06-30  7:36   ` Michael Tokarev
2023-06-30  7:46     ` Daniel Henrique Barboza
2023-06-30  7:51       ` Michael Tokarev
2023-06-28 21:30 ` [PATCH v6 03/20] target/riscv/cpu.c: restrict 'mvendorid' value Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 04/20] target/riscv/cpu.c: restrict 'mimpid' value Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 05/20] target/riscv/cpu.c: restrict 'marchid' value Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 06/20] target/riscv: use KVM scratch CPUs to init KVM properties Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 07/20] target/riscv: read marchid/mimpid in kvm_riscv_init_machine_ids() Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 08/20] target/riscv: handle mvendorid/marchid/mimpid for KVM CPUs Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 09/20] linux-headers: Update to v6.4-rc1 Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 10/20] target/riscv/kvm.c: init 'misa_ext_mask' with scratch CPU Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 11/20] target/riscv/cpu: add misa_ext_info_arr[] Daniel Henrique Barboza
2023-06-29  7:26   ` Philippe Mathieu-Daudé
2023-06-29 11:36     ` Daniel Henrique Barboza
2023-06-29 11:43       ` Daniel Henrique Barboza
2023-06-29  8:59   ` Andrew Jones
2023-06-29 11:40     ` Daniel Henrique Barboza
2023-06-29 22:04     ` Daniel Henrique Barboza
2023-06-30  7:21       ` Andrew Jones
2023-06-28 21:30 ` [PATCH v6 12/20] target/riscv: add KVM specific MISA properties Daniel Henrique Barboza
2023-06-29  9:12   ` Andrew Jones
2023-06-29 11:50     ` Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 13/20] target/riscv/kvm.c: update KVM MISA bits Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 14/20] target/riscv/kvm.c: add multi-letter extension KVM properties Daniel Henrique Barboza
2023-06-29  9:14   ` Andrew Jones
2023-06-28 21:30 ` [PATCH v6 15/20] target/riscv/cpu.c: add satp_mode properties earlier Daniel Henrique Barboza
2023-06-29  7:30   ` Philippe Mathieu-Daudé
2023-06-29  9:15   ` Andrew Jones
2023-06-28 21:30 ` [PATCH v6 16/20] target/riscv/cpu.c: remove priv_ver check from riscv_isa_string_ext() Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 17/20] target/riscv/cpu.c: create KVM mock properties Daniel Henrique Barboza
2023-06-29  9:17   ` Andrew Jones
2023-06-28 21:30 ` [PATCH v6 18/20] target/riscv: update multi-letter extension KVM properties Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 19/20] target/riscv/kvm.c: add kvmconfig_get_cfg_addr() helper Daniel Henrique Barboza
2023-06-28 21:30 ` [PATCH v6 20/20] target/riscv/kvm.c: read/write (cbom|cboz)_blocksize in KVM Daniel Henrique Barboza

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