[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v16 73/99] target/arm: cpu-sve: split TCG and KVM functionali
From: |
Richard Henderson |
Subject: |
Re: [PATCH v16 73/99] target/arm: cpu-sve: split TCG and KVM functionality |
Date: |
Sat, 5 Jun 2021 12:31:33 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
On 6/4/21 8:52 AM, Alex Bennée wrote:
DECLARE_BITMAP(kvm_supported, ARM_MAX_VQ);
- DECLARE_BITMAP(tmp, ARM_MAX_VQ);
- uint32_t vq, max_vq = 0;
-
- /* Collect the set of vector lengths supported by KVM. */
- bitmap_zero(kvm_supported, ARM_MAX_VQ);
- if (kvm_enabled() && kvm_arm_sve_supported()) {
- kvm_arm_sve_get_vls(CPU(cpu), kvm_supported);
- } else if (kvm_enabled()) {
- assert(!cpu_isar_feature(aa64_sve, cpu));
- }
+ uint32_t max_vq = 0;
+ if (kvm_enabled()) {
+ kvm_sve_get_supported_lens(cpu, kvm_supported);
+ }
Previously, kvm_supported was always initialized.
I guess this is sort-of a cleanup. But we've got 4 different checks for kvm
and tcg. I think we can actually tidy this up with a set of callbacks.
static bool do_sve_finalize(ARMCPU *cpu, Error **errp,
void (*get_supported_lens)(ARMCPU *, unsigned long *),
void (*enable_lens)(unsigned long *vq_map,
unsigned long *vq_init,
uint32_t max_vq,
unsigned long *supported),
void (*disable_lens)(unsigned long *vq_map,
unsigned long *vq_init,
unsigned long *supported,
Error **errp),
void (*validate_lens)(unsigned long *vq_map,
unsigned long *vq_init,
unsigned long *supported,
Error **errp, uint32_t max_vq))
{
...
}
bool cpu_sve_finalize_features(ARMCPU *cpu, Error **errp)
{
if (kvm_enabled()) {
return do_sve_finalize(cpu, errp,
kvm_sve_get_supported_lens,
kvm_sve_enable_lens,
kvm_sve_disable_lens,
kvm_sve_validate_lens);
} else if (tcg_enabled()) {
return do_sve_finalize(cpu, errp,
tcg_sve_get_supported_lens,
tcg_sve_enable_lens,
tcg_sve_disable_lens,
tcg_sve_validate_lens);
} else {
g_assert_not_reached(); /* ??? */
}
}
with
void tcg_sve_get_supported_lens(ARMCPU *cpu,
unsigned long *supported)
{
bitmap_fill(supported, ARM_MAX_VQ);
}
which we can later adjust for, e.g. -cpu a64fx and neoverse-v1, etc, which
don't support all vq sizes.
r~
- [PATCH v16 23/99] target/arm: only build psci for TCG, (continued)
- [PATCH v16 23/99] target/arm: only build psci for TCG, Alex Bennée, 2021/06/04
- [PATCH v16 67/99] target/arm: create kvm cpu accel class, Alex Bennée, 2021/06/04
- [PATCH v16 40/99] target/arm: move aarch64_sync_32_to_64 (and vv) to cpu code, Alex Bennée, 2021/06/04
- [PATCH v16 30/99] target/arm: only perform TCG cpu and machine inits if TCG enabled, Alex Bennée, 2021/06/04
- [PATCH v16 56/99] target/arm: wrap call to aarch64_sve_change_el in tcg_enabled(), Alex Bennée, 2021/06/04
- [PATCH v16 47/99] target/arm: move fp_exception_el out of TCG helpers, Alex Bennée, 2021/06/04
- [PATCH v16 89/99] target/arm: cpu64: some final cleanup on aarch64_cpu_finalize_features, Alex Bennée, 2021/06/04
- [PATCH v16 73/99] target/arm: cpu-sve: split TCG and KVM functionality, Alex Bennée, 2021/06/04
- [PATCH v16 38/99] target/arm: move arm_sctlr away from tcg helpers, Alex Bennée, 2021/06/04
- [PATCH v16 57/99] target/arm: remove kvm include file for PSCI and arm-powerctl, Alex Bennée, 2021/06/04
- [PATCH v16 27/99] target/arm: fix style in preparation of new cpregs module, Alex Bennée, 2021/06/04
- [PATCH v16 48/99] target/arm: remove now useless ifndef from fp_exception_el, Alex Bennée, 2021/06/04
- [PATCH v16 90/99] XXX target/arm: experiment refactoring cpu "max", Alex Bennée, 2021/06/04
- [PATCH v16 49/99] target/arm: make further preparation for the exception code to move, Alex Bennée, 2021/06/04