29#ifndef __CPU_KVM_X86_CPU_HH__
30#define __CPU_KVM_X86_CPU_HH__
37#include "params/X86KvmCPU.hh"
42struct kvm_vcpu_events;
62 void dump()
const override;
117 void setMSRs(
const struct kvm_msrs &msrs);
119 void getMSRs(
struct kvm_msrs &msrs)
const;
141 void getXCRs(
struct kvm_xcrs ®s)
const;
142 void setXCRs(
const struct kvm_xcrs ®s);
143 void getXSave(
struct kvm_xsave &xsave)
const;
144 void setXSave(
const struct kvm_xsave &xsave);
232 const struct kvm_sregs &sregs);
Base class for KVM based CPU models.
x86 implementation of a KVM-based hardware virtualized CPU.
void updateThreadContextFPU(const struct kvm_fpu &fpu)
Update FPU and SIMD registers using the legacy API.
Tick handleKvmExitIRQWindowOpen() override
The guest exited because an interrupt window was requested.
void updateThreadContextXSave(const struct kvm_xsave &kxsave)
Update FPU and SIMD registers using the XSave API.
void updateThreadContextMSRs()
Update MSR registers.
void startup() override
startup() is the final initialization call before simulation.
void updateKvmState() override
Update the KVM state from the current thread context.
void updateCPUID()
Transfer gem5's CPUID values into the virtual CPU.
void handleIOMiscReg32(int miscreg)
Handle a 32-bit IO access that should be mapped to a MiscReg.
void setMSRs(const struct kvm_msrs &msrs)
Methods to access MSRs in the guest.
void setCPUID(const struct kvm_cpuid2 &cpuid)
Methods to access CPUID information using the extended API.
void getXSave(struct kvm_xsave &xsave) const
bool haveXCRs
Kvm::capXCRs() available?
void updateKvmStateSRegs()
Update control registers (CRx, segments, etc.)
void getXCRs(struct kvm_xcrs ®s) const
bool useXSave
Should the XSave interface be used to sync the FPU and SIMD registers?
void getVCpuEvents(struct kvm_vcpu_events &events) const
X86KvmCPU(const X86KvmCPUParams ¶ms)
void updateKvmStateFPU()
Update FPU and SIMD registers.
std::vector< struct kvm_msr_entry > KvmMSRVector
uint64_t getHostCycles() const override
Get the value of the hardware cycle counter in the guest.
void updateKvmStateMSRs()
Update MSR registers.
void getDebugRegisters(struct kvm_debugregs ®s) const
Wrappers around KVM's state transfer methods.
void updateKvmStateRegs()
Support routines to update the state of the KVM CPU from gem5's state representation.
Tick kvmRunDrain() override
Run the virtual CPU until draining completes.
const Kvm::MSRIndexVector & getMsrIntersection() const
Get a list of MSRs supported by both gem5 and KVM.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void dumpSpecRegs() const
void setMSR(uint32_t index, uint64_t value)
void stutterPC(PCStateBase &pc) const override
Modify a PCStatePtr's value so that its next PC is the current PC.
void ioctlRun() override
Override for synchronizing state in kvm_run.
void setXCRs(const struct kvm_xcrs ®s)
void updateThreadContext() override
Update the current thread context with the KVM state.
void getMSRs(struct kvm_msrs &msrs) const
Tick kvmRun(Tick ticks) override
Request KVM to run the guest for a given number of ticks.
void updateKvmStateXCRs()
Update XCR registers.
void setVCpuEvents(const struct kvm_vcpu_events &events)
void deliverInterrupts()
Inject pending interrupts from gem5 into the virtual CPU.
void updateThreadContextXCRs()
Update XCR registers.
bool haveDebugRegs
Kvm::capDebugRegs() available?
void dump() const override
Dump the internal state to the terminal.
bool archIsDrained() const override
Check if there are pending events in the vCPU that prevents it from being drained.
Kvm::MSRIndexVector cachedMsrIntersection
Cached intersection of supported MSRs.
void setXSave(const struct kvm_xsave &xsave)
void dumpVCpuEvents() const
uint64_t getMSR(uint32_t index) const
Tick handleKvmExitIO() override
Handle x86 legacy IO (in/out)
void updateThreadContextRegs(const struct kvm_regs ®s, const struct kvm_sregs &sregs)
Support routines to update the state of gem5's thread context from KVM's state representation.
void setDebugRegisters(const struct kvm_debugregs ®s)
bool haveXSave
Kvm::capXSave() available?
void updateKvmStateFPUXSave()
Update FPU and SIMD registers using the XSave API.
void dumpDebugRegs() const
void updateKvmStateFPULegacy()
Update FPU and SIMD registers using the legacy API.
void updateThreadContextSRegs(const struct kvm_sregs &sregs)
Update control registers (CRx, segments, etc.)
const Params & params() const
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Tick
Tick count type.