[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 00/20] target/riscv, KVM: fixes and enhancements
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH v6 00/20] target/riscv, KVM: fixes and enhancements |
Date: |
Wed, 28 Jun 2023 18:30:13 -0300 |
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
- [PATCH v6 00/20] target/riscv, KVM: fixes and enhancements,
Daniel Henrique Barboza <=
- [PATCH v6 03/20] target/riscv/cpu.c: restrict 'mvendorid' value, Daniel Henrique Barboza, 2023/06/28
- [PATCH v6 04/20] target/riscv/cpu.c: restrict 'mimpid' value, Daniel Henrique Barboza, 2023/06/28
- [PATCH v6 05/20] target/riscv/cpu.c: restrict 'marchid' value, Daniel Henrique Barboza, 2023/06/28
- [PATCH v6 06/20] target/riscv: use KVM scratch CPUs to init KVM properties, Daniel Henrique Barboza, 2023/06/28