68aba1f2af
Future patches will split the existing Property arrays even further, and the existing code in riscv_cpu_add_user_properties() will start to scale bad with it because it's dealing with KVM constraints mixed in with TCG constraints. We're going to pay a high price to share a couple of common lines of code between the two. Create a new kvm_riscv_cpu_add_kvm_properties() helper that will be forked from riscv_cpu_add_user_properties() if we're running KVM. The helper includes all properties that a KVM CPU will add. The rest of riscv_cpu_add_user_properties() body will then be relieved from having to deal with KVM constraints. The helper was declared in kvm_stubs.h, while being implemented in cpu.c, to allow '--enable-debug' builds to work. The compiler won't remove the kvm_riscv_cpu_add_kvm_properties() reference when 'kvm_enabled()' is false if we end up with an unused function. Even though being a KVM only helper we can't implement it in kvm.c due to its many dependencies inside cpu.c, so make it public in kvm_riscv.h and keep its implementation in cpu.c for now. We'll move it to kvm.c in the near future. Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Message-ID: <20230912132423.268494-4-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
35 lines
1.3 KiB
C
35 lines
1.3 KiB
C
/*
|
|
* QEMU KVM support -- RISC-V specific functions.
|
|
*
|
|
* Copyright (c) 2020 Huawei Technologies Co., Ltd
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms and conditions of the GNU General Public License,
|
|
* version 2 or later, as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef QEMU_KVM_RISCV_H
|
|
#define QEMU_KVM_RISCV_H
|
|
|
|
/* Temporarily implemented in cpu.c */
|
|
void kvm_riscv_cpu_add_kvm_properties(Object *obj);
|
|
|
|
void kvm_riscv_init_user_properties(Object *cpu_obj);
|
|
void kvm_riscv_reset_vcpu(RISCVCPU *cpu);
|
|
void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level);
|
|
void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift,
|
|
uint64_t aia_irq_num, uint64_t aia_msi_num,
|
|
uint64_t aplic_base, uint64_t imsic_base,
|
|
uint64_t guest_num);
|
|
void riscv_kvm_aplic_request(void *opaque, int irq, int level);
|
|
|
|
#endif
|