History | View | Annotate | Download (48.3 kB)
cpu: Make first_cpu and next_cpu CPUState
Move next_cpu from CPU_COMMON to CPUState.Move first_cpu variable to qom/cpu.h.
gdbstub needs to use CPUState::env_ptr for now.cpu_copy() no longer needs to save and restore cpu_next.
Acked-by: Paolo Bonzini <pbonzini@redhat.com>...
memory: add owner argument to initialization functions
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-ppc kvm: save cr register
This adds a missing code to save CR (condition register) viakvm_arch_put_registers(). kvm_arch_get_registers() already has it.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>Signed-off-by: David Gibson <david@gibson.dropbear.id.au>...
KVM: PPC: Add dummy kvm_arch_init_irq_routing()
The common KVM code insists on calling kvm_arch_init_irq_routing()as soon as it sees kernel header support for it (regardless of whetherQEMU supports it). Provide a dummy function to satisfy this.
Unlike x86, PPC does not have one default irqchip, so there's no common...
remove some double-includes
Some source files #include the same header more thanonce for no good reason. Remove second #includes insuch cases.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
pseries: Fix incorrect calculation of RMA size in certain configurations
For the pseries machine, we need to advertise to the guest the size of itsRMA - that is the amount of memory it can access with the MMU off. For HVKVM, this is constrained by the hardware limitations on the virtual RMA of...
pseries: Fixes and enhancements to L1 cache properties
PAPR requires that the device tree's CPU nodes have several propertieswith information about the L1 cache. We already create two of theseproperties, but with incorrect names - "[id]cache-block-size" instead...
target-ppc: Synchronize VPA state with KVM
For PAPR guests, KVM tracks the various areas registered with theH_REGISTER_VPA hypercall. For full emulation, of course, these are trackedwithin qemu. At present these values are not synchronized. This is a...
PPC: e500: advertise 4.2 MPIC only if KVM supports EPR
Older KVM versions don't support EPR which breaks guests when we announceMPIC variants that support EPR.
Catch that case and expose only MPIC version 2.0 which tells the guest thatwe don't support the EPR capability yet....
Enable kvm emulated watchdog
Enable the KVM emulated watchdog if KVM supports (use thecapability enablement in watchdog handler). Also watchdog exit(KVM_EXIT_WATCHDOG) handling is added.Watchdog state machine is cleared whenever VM state changes to running....
hw: move headers to include/
Many of these should be cleaned up with proper qdev-/QOM-ification.Right now there are many catch-all headers in include/hw/ARCH dependingon cpu.h, and this makes it necessary to compile these files per-target.However, fixing this does not belong in these patches....
mmu-hash*: Add header file for definitions
Currently cpu.h contains a number of definitions relating to the 64-bithash MMU. Some are used in the MMU emulation code, but some are only usedin the spapr MMU management hcall implementations.
This patch moves these definitions (except for a few that are needed...
target-ppc: Remove CONFIG_PSERIES dependency in kvm.c
target-ppc/kvm.c has an #ifdef on CONFIG_PSERIES, for the handling ofKVM exits due to a PAPR hypercall from the guest. However, since commite4c8b28cde12d01ada8fe869567dc5717a2dfcb7 "ppc: express FDT dependency of...
cpu: Move halted and interrupt_request fields to CPUState
Both fields are used in VMState, thus need to be moved together.Explicitly zero them on reset since they were located beforebreakpoints.
Pass PowerPCCPU to kvmppc_handle_halt().
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-ppc: Make host CPU a subclass of the host's CPU model
This avoids assigning individual class fields and contributorsforgetting to add field assignments in KVM-only code.
ppc_cpu_class_find_by_pvr() requires the CPU model classes to beregistered, so defer host CPU type registration to kvm_arch_init()....
target-ppc: Add mechanism for synchronizing SPRs with KVM
Currently when runing under KVM on ppc, we synchronize a certain number ofvital SPRs to KVM through the SET_SREGS call. This leaves out quite a lotof important SPRs which are maintained in KVM. It would be helpful to...
target-ppc: Synchronize FPU state with KVM
Currently qemu does not get and put the state of the floating point andvector registers to KVM. This is obviously a problem for savevm, as wellas possibly being problematic for debugging of FP-using guests.
This patch fixes this by using new extensions to the ONE_REG interface to...
target-ppc: Convert CPU definitions
Turn the array of model definitions into a set of self-registering QOMtypes with their own class_init. Unique identifiers are obtained fromthe combination of PVR, SVR and family identifiers; this requires allalias #defines to be removed from the list. Possibly there are some more...
target-ppc: Split out SO, OV, CA fields from XER
In preparation for more efficient setting of these fields.
Cc: Alexander Graf <agraf@suse.de>Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
kvm: Create kvm_arch_vcpu_id() function
This will allow each architecture to define how the VCPU ID is set onthe KVM_CREATE_VCPU ioctl call.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Acked-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
PPC: KVM: Add support for EPR with KVM
This patch links KVM EPR support to the existing TCG support we have now.
Signed-off-by: Alexander Graf <agraf@suse.de>
cpu: Move cpu_index field to CPUState
Note that target-alpha accesses this field from TCG, now using anegative offset. Therefore the field is placed last in CPUState.
Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change.
Move common parts of mips cpu_state_reset() to mips_cpu_reset()....
PPC: KVM: set has-idle in guest device tree
On e500mc, the platform doesn't provide a way for the CPU to go idle.
To still not uselessly burn CPU time, expose an idle hypercall to the guestif kvm supports it.
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>...
target-ppc: Slim conversion of model definitions to QOM subclasses
Since the model list is highly macrofied, keep ppc_def_t for now andsave a pointer to it in PowerPCCPUClass. This results in a flat list ofsubclasses including aliases, to be refined later....
target-ppc: Error out for -cpu host on unknown PVR
Previously we silently exited, with subclasses we got an opcode warning.Instead, explicitly tell the user what's wrong.
An indication for this is -cpu ? showing "host" with an all-zero PVR.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
Merge branch 'master' of git://git.qemu.org/qemu into qom-cpu
Adapt header include paths.
cpu: Move kvm_state field into CPUState
Adapt some functions to take CPUState / {PowerPC,S390}CPU argument.
kvm: Pass CPUState to kvm_arch_*
Move kvm_vcpu_dirty field into CPUState to simplify things and changeits type to bool while at it.
kvm: Pass CPUState to kvm_vcpu_ioctl()
Adapt helper functions to pass X86CPU / PowerPCCPU / S390CPU.
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
target-ppc: Rename kvm_kick_{env => cpu} and pass PowerPCCPU
Needed for changing qemu_cpu_kick() argument type to CPUState.
cpus: Pass CPUState to qemu_cpu_kick()
CPUArchState is no longer needed there.
spapr: Pass PowerPCCPU to spapr_hypercall()
Needed for changing the hypercall handlers' argument type to PowerPCCPU.
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
ppc: avoid buffer overrun: use pstrcpy, not strncpy
A terminal NUL is required by caller's use of strchr.It's better not to use strncpy at all, since there is no needto zero out hundreds of trailing bytes for each iteration.
Signed-off-by: Jim Meyering <meyering@redhat.com>...
PPC: KVM: Fix BAT put
In the sregs API, upper and lower 32bit segments of the BAT registersare swapped when doing a set. Since we need to support old kernels outthere, don't bother to fix it in the kernel, but instead work aroundthe problem in QEMU by swapping on put....
target-ppc: KVM: Fix some kernel version edge cases for kvmppc_reset_htab()
The kvmppc_reset_htab() function invokes the KVM_PPC_ALLOCATE_HTAB vm ioctlto request KVM to allocate and reset a hash page table for the guest - itreturns the size of hash table allocated, or 0 to indicate that qemu needs...
ppc: Make kvm_arch_put_registers() put all the registers
At least when invoked with high enough 'level' arguments,kvm_arch_put_registers() is supposed to copy essentially all the cpu stateas encoded in qemu's internal structures into the kvm state. Currently...
pseries: Add support for new KVM hash table control call
This adds support for then new "reset htab" ioctl which allows qemuto properly cleanup the MMU hash table when the guest is reset. Withthe corresponding kernel support, reset of a guest now works properly....
ppc: Fix bug in handling of PAPR hypercall exits
Currently for powerpc, kvm_arch_handle_exit() always returns 1, meaningthat its caller - kvm_cpu_exec() - will always exit immediately afterwardsto the loop in qemu_kvm_cpu_thread_fn().
There's no need to do this. Once we've handled the hypercall there's no...
pseries: Convert sPAPR TCEs to use generic IOMMU infrastructure
The pseries platform already contains an IOMMU implementation, since it isessential for the platform's paravirtualized VIO devices. This IOMMUsupport is currently built into the implementation of the VIO "bus" and...
ppc64: Rudimentary Support for extra page sizes on server CPUs
More recent Power server chips (i.e. based on the 64 bit hash MMU)support more than just the traditional 4k and 16M page sizes. Thiscan get quite complicated, because which page sizes are supported,...
target-ppc: Add hooks for handling tcg and kvm limitations
On target-ppc, our table of CPU types and features encodes the features asfound on the hardware, regardless of whether these features are actuallyusable under TCG or KVM. We already have cases where the information from...
Replace Qemu by QEMU in comments
The official spelling is QEMU.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Andreas Färber <afaerber@suse.de>[blauwirbel@gmail.com: fixed comment style in hw/sun4m.c]Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
pseries: Don't try to munmap() a malloc()ed TCE table
For the pseries machine, TCE (IOMMU) tables can either be directlymalloc()ed in qemu or, when running on a KVM which supports it, mmap()edfrom a KVM ioctl. The latter option is used when available, because it...
target-ppc: Don't overuse CPUState
Scripted conversion: sed -i "s/CPUState/CPUPPCState/g" target-ppc/*.[hc] sed -i "s/#define CPUPPCState/#define CPUState/" target-ppc/cpu.h
Signed-off-by: Andreas Färber <afaerber@suse.de>Acked-by: Anthony Liguori <aliguori@us.ibm.com>
PPC: KVM: Update HIOR code to new interface
Unfortunately the HIOR setting code slipped into upstream QEMUbefore it was pulled into upstream KVM. And since Murphy is alwaysright, comments on the patches only emerged on the pull requestleading to changes in the interface....
kvm: fix build error in ppc kvm due to memory_region_init_ram_ptr() change
Commit c5705a772 ("vmstate, memory: decouple vmstate from memory API") changedthe signature of memory_region_init_ram_ptr() but did not update a caller inthe ppc kvm module. Fix....
kvm-ppc: halt secondary cpus when guest reset
When guest reset, we need to halt secondary cpus until guest kick them.This already works for tcg. The patch add the support for kvm.
Signed-off-by: Liu Yu <yu.liu@freescale.com>Signed-off-by: Alexander Graf <agraf@suse.de>...
KVM: PPC: Override host vmx/vsx/dfp only when information known
The -cpu host feature tries to find out the host capabilities basedon device tree information. However, we don't always have that availablebecause it's an optional property in dt.
So instead of force unsetting values depending on an unreliable source...
pseries: Allow writes to KVM accelerated TCE table
Sufficiently recent kernels include a KVM call to accelerate use ofPAPR TCE tables (IOMMU), which are used by PAPR virtual IO devices.This involves qemu mapping the TCE table in from a kernel obtained fd,...
pseries: Correct vmx/dfp handling in both KVM and TCG cases
Currently, when KVM is enabled, the pseries machine checks if the hostCPU supports VMX, VSX and/or DFP instructions and advertisesaccordingly in the guest device tree. It does this regardless of what...
ppc: First cut implementation of -cpu host
For convenience with kvm, x86 allows the user to specify -cpu host on theqemu command line, which means make the guest cpu the same as the hostcpu. This patch implements the same option for ppc targets.
For now, this just read the host PVR (Processor Version Register) and...
pseries: Support SMT systems for KVM Book3S-HV
Alex Graf has already made qemu support KVM for the pseries machinewhen using the Book3S-PR KVM variant (which runs the guest inusermode, emulating supervisor operations). This code allows gets usvery close to also working with KVM Book3S-HV (using the hypervisor...
pseries: Allow KVM Book3S-HV on PPC970 CPUS
At present, using the hypervisor aware Book3S-HV KVM will only workwith qemu on POWER7 CPUs. PPC970 CPUs also have hypervisorcapability, but they lack the VRMA feature which makes assigning guestmemory easier....
pseries: Use Book3S-HV TCE acceleration capabilities
The pseries machine of qemu implements the TCE mechanism used as avirtual IOMMU for the PAPR defined virtual IO devices. Because thePAPR spec only defines a small DMA address space, the guest VIOdrivers need to update TCE mappings very frequently - the virtual...
ppc: Generalize the kvmppc_get_clockfreq() function
Currently the kvmppc_get_clockfreq() function reads the host's clockfrequency from /proc/device-tree, which is useful to past to the guestin KVM setups. However, there are some other host propertiesadvertised in the device tree which can also be relevant to the...
pseries: Add device tree properties for VMX/VSX and DFP under kvm
Sufficiently recent PAPR specifications define properties "ibm,vmx" and "ibm,dfp" on the CPU node which advertise whether the VMX vectorextensions (or the later VSX version) and/or the Decimal Floating...
KVM: PPC: Use HIOR setting for -M pseries with PR KVM
When running with PR KVM, we need to set HIOR directly. Thankfully thereis now a new interface to set registers individually so we can just use thatand poke HIOR into the guest vcpu's HIOR register....
kvm: ppc: booke206: use MMU API
Share the TLB array with KVM. This allows us to set the initial TLBboth on initial boot and reset, is useful for debugging, and couldeventually be used to support migration.
Signed-off-by: Scott Wood <scottwood@freescale.com>...
PPC: Enable to use PAPR with PR style KVM
When running PR style KVM, we need to tell the kernel that we wantto run in PAPR mode now. This means that we need to pass some moreregister information down and enable papr mode. We also need to alignthe HTAB to htab_size boundary....
PPC: KVM: Add generic function to read host clockfreq
We need to find out the host's clock-frequency when running on KVM, solet's export a respective function.
v1 -> v2:
- enable 64bit values
kvm: ppc: Drop KVM_CAP build dependencies
No longer needed with accompanied kernel headers.
CC: Alexander Graf <agraf@suse.de>Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Reviewed-by: Alexander Graf <agraf@suse.de>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
kvm: ppc: Drop CONFIG_KVM_PPC_PVR
Required header support is now unconditionally available.
PPC: fix sregs usage on booke
When compiling qemu with kvm support on BookE PPC machines, I getthe following error:
cc1: warnings being treated as errors /tmp/qemu/target-ppc/kvm.c: In function 'kvm_arch_get_registers': /tmp/qemu/target-ppc/kvm.c:188: error: unused variable 'sregs'...
kvm: ppc: detect old headers
When compiling Qemu with older kernel headers, the PVR settingmechanism isn't available yet. Unfortunately, back then I didn't adda capability we could check against, so all we can do is add a configuretest to see if we support PVR setting. For BookE, we don't care yet....
kvm: ppc: fixes for KVM_SET_SREGS on init
Classic/server ppc has had SREGS for a while now (though I think notalways?), but it's still missing for booke. Check the capability beforecalling KVM_SET_SREGS.
Without this, booke kvm fails to boot as of commit...
monitor: add PPC BookE SPRs
Read them via KVM_GET_SREGS in kvm_arch_get_registers(),and display them in "info registers".
Also get CR and PID from the existing KVM_GET_REGS.
Signed-off-by: Scott Wood <scottwood@freescale.com>Signed-off-by: Alexander Graf <agraf@suse.de>
Parse SDR1 on mtspr instead of at translate time
On ppc machines with hash table MMUs, the special purpose register SDR1contains both the base address of the encoded size (hashed) page tables.
At present, we interpret the SDR1 value within the address translation...
Merge remote branch 'qemu-kvm/uq/master' into staging
change all other clock references to use nanosecond resolution accessors
This was done with:
sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \ $(git grep -l 'qemu_get_clock\>' ) sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \ $(git grep -l 'qemu_new_timer\>' )...
kvm: Align kvm_arch_handle_exit to kvm_cpu_exec changes
Make the return code of kvm_arch_handle_exit directly usable forkvm_cpu_exec. This is straightforward for x86 and ppc, just s390would require more work. Avoid this for now by pushing the return code...
kvm: Rename kvm_arch_process_irqchip_events to async_events
We will broaden the scope of this function on x86 beyond irqchip events.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
kvm: ppc: Fix breakage of kvm_arch_pre_run/process_irqchip_events
Commit 7a39fe5882 failed to convert the right arch function.
kvm: Drop return values from kvm_arch_pre/post_run
We do not check them, and the only arch with non-empty implementationsalways returns 0 (this is also true for qemu-kvm).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>CC: Alexander Graf <agraf@suse.de>...
kvm: Provide sigbus services arch-independently
Provide arch-independent kvm_on_sigbus* stubs to remove the #ifdef'eryfrom cpus.c. This patch also fixes --disable-kvm build by providing themissing kvm_on_sigbus_vcpu kvm-stub.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
kvm: Consolidate must-have capability checks
Instead of splattering the code with #ifdefs and runtime checks forcapabilities we cannot work without anyway, provide central testinfrastructure for verifying their availability both at build andruntime.
kvm: Drop smp_cpus argument from init functions
No longer used.
kvm: Stop on all fatal exit reasons
Ensure that we stop the guest whenever we face a fatal or unknown exitreason. If we stop, we also have to enforce a cpu loop exit.
ppc: kvm: fix signedness warning
I get a warning on a signed comparison with an unsigned variable, solet's make the variable signed and be happy.
Signed-off-by: Alexander Graf <agraf@suse.de>Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
KVM: PPC: Add level based interrupt logic
KVM on PowerPC used to have completely broken interrupt logic. Usually,interrupts work by having a PIC that pulls a line up/down, so the CPU knowsthat an interrupt is active. This line stays active until some action is...
PPC: Add PV hypercall transport through fw_cfg
On KVM for PPC we need to tell the guest which instructions to use whendoing a hypercall. The clean way to do this is to go through an ioctlfrom userspace and passing it on to the guest using the device tree....
PPC/KVM: make iothread work
When running with --enable-io-thread the timer we have doesn't help,because it doesn't wake up the CPU thread. So instead we need toactually kick it.
While at it I refined the logic a bit to not dumbly trigger a timerevery 500ms, but rather do it more often after an interrupt got injected....
Do not stop VM if emulation failed in userspace.
Continue vcpu execution in case emulation failure happened while vcpuwas in userspace. In this case #UD will be injected into the guestallowing guest OS to kill offending process and continue.
Signed-off-by: Gleb Natapov <gleb@redhat.com>...
kvm: enable smp > 1
Process INIT/SIPI requests and enable -smp > 1.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Avi Kivity <avi@redhat.com>
KVM: Rework VCPU state writeback API
This grand cleanup drops all reset and vmsave/load relatedsynchronization points in favor of four(!) generic hooks:
- cpu_synchronize_all_states in qemu_savevm_state_complete (initial sync from kernel before vmsave)...
PPC: tell the guest about the time base frequency
Our guest systems need to know by how much the timebase increases every second,so there usually is a "timebase-frequency" property in the cpu leaf of thedevice tree.
This property is missing in OpenBIOS....
PPC: Add timer when running KVM
For some odd reason we sometimes hang inside KVM forever. I'd guess it'sa race condition where we actually have a level triggered interrupt, butthe infrastructure can't expose that yet, so the guest ACKs it, goes tosleep and never gets notified that there's still an interrupt pending....
target-ppc: fix ppc32 kvm build
My segment sync patch broke compilation on PPC32, because it was trying tosync the SLB even though ppc32 CPUs don't have an SLB.
So let's only sync it when we're on a PP64 one!
Signed-off-by: Alexander Graf <agraf@suse.de>...
target-ppc: Get MMU state on register sync
While x86 only needs to sync cr0-4 to know all about its MMU state and enableqemu to resolve virtual to physical addresses, we need to sync all of thesegment registers on PPC to know which mapping we're in.
So let's grab the segment register contents to be able to use the "x" monitor...
kvm: Add arch reset handler
Will be required by succeeding changes.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Use correct input constant
440 and desktop codes use different input constants for interrupt indication.
Let's use the respective ones for KVM.
Signed-off-by: Alexander Graf <agraf@suse.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Set PVR in sregs
We need to tell the kernel about some initial CPU state we don't have yet,so let's use the "sregs" IOCTL for that and simply put the Processor VersionRegister in there.
Now the kernel knows which guest CPU to virtualize.
target-ppc: Enable KVM for ppcemb.
Implement hooks called by generic KVM code.
Also add code that will copy the host's CPU and timebase frequencies to theguest, which is necessary on KVM because the guest can directly access thetimebase.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>...