arch-arm: Forward declare kvm_reg_list
The adoption of the gem5 namespace [1] broke aarch64 builds with
the following error:
build/ARM/arch/arm/kvm/base_cpu.cc:198:22: error: aggregate
'gem5::kvm_reg_list regs_probe' has incomplete type and cannot be
defined
In file included from build/ARM/arch/arm/kvm/base_cpu.cc:38:0:
build/ARM/arch/arm/kvm/base_cpu.hh:115:28: note: forward declaration of
'struct gem5::kvm_reg_list'
std::unique_ptr<struct kvm_reg_list> tryGetRegList(uint64_t nelem)
const;
Forward declaring the struct defined in linux/kvm.hh (included in source
file) in the global namespace, rather than the gem5 one fixes the
problem
[1]: https://gem5-review.googlesource.com/c/public/gem5/+/46323
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Change-Id: I96c7d31aa4810edcf98e23cefeaf4895620b6444
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47619
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -201,10 +201,10 @@ BaseArmKvmCPU::getRegList() const
|
||||
|
||||
// Request the actual register list now that we know how many
|
||||
// register we need to allocate space for.
|
||||
std::unique_ptr<struct kvm_reg_list> regs;
|
||||
const size_t size(sizeof(struct kvm_reg_list) +
|
||||
std::unique_ptr<kvm_reg_list> regs;
|
||||
const size_t size(sizeof(kvm_reg_list) +
|
||||
regs_probe.n * sizeof(uint64_t));
|
||||
regs.reset((struct kvm_reg_list *)operator new(size));
|
||||
regs.reset((kvm_reg_list *)operator new(size));
|
||||
regs->n = regs_probe.n;
|
||||
if (!getRegList(*regs))
|
||||
panic("Failed to determine register list size.\n");
|
||||
@@ -223,7 +223,7 @@ BaseArmKvmCPU::kvmArmVCpuInit(const struct kvm_vcpu_init &init)
|
||||
}
|
||||
|
||||
bool
|
||||
BaseArmKvmCPU::getRegList(struct kvm_reg_list ®s) const
|
||||
BaseArmKvmCPU::getRegList(kvm_reg_list ®s) const
|
||||
{
|
||||
if (ioctl(KVM_GET_REG_LIST, (void *)®s) == -1) {
|
||||
if (errno == E2BIG) {
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
#include "cpu/kvm/base.hh"
|
||||
#include "dev/arm/base_gic.hh"
|
||||
|
||||
struct kvm_reg_list;
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
|
||||
@@ -112,7 +114,7 @@ class BaseArmKvmCPU : public BaseKvmCPU
|
||||
void kvmArmVCpuInit(const struct kvm_vcpu_init &init);
|
||||
|
||||
private:
|
||||
std::unique_ptr<struct kvm_reg_list> tryGetRegList(uint64_t nelem) const;
|
||||
std::unique_ptr<kvm_reg_list> tryGetRegList(uint64_t nelem) const;
|
||||
|
||||
/**
|
||||
* Get a list of registers supported by getOneReg() and setOneReg().
|
||||
@@ -121,7 +123,7 @@ class BaseArmKvmCPU : public BaseKvmCPU
|
||||
* is too small to hold the complete register list (the required
|
||||
* size is written to regs.n in this case). True on success.
|
||||
*/
|
||||
bool getRegList(struct kvm_reg_list ®s) const;
|
||||
bool getRegList(kvm_reg_list ®s) const;
|
||||
|
||||
/**
|
||||
* Cached copy of the list of registers supported by KVM
|
||||
|
||||
Reference in New Issue
Block a user