PPC: Add clock-frequency export for Mac machines
Support in fwcfg has been around for exposure of the clock-frequencyCPU property. OpenBIOS reads it, we just never exposed it.
Since Mac OS X is very picky about its clock frequency values, let'sjust take a known good value and always expose that....
PPC: Newworld: Add uninorth token register
Mac OS X expects the uninorth control register set to contain oneregister that always reads back what it writes in. Expose that.
This is just a temporary hack. Eventually, we want to expose theuninorth (/uni-n in device tree) as a separate QOM device....
PPC: Newworld: Add second uninorth control register set
Mac OS X requires a second uninorth register set to be mapped a fewbytes above the first one. Let's just expose it to make it happy.
Signed-off-by: Alexander Graf <agraf@suse.de>
spapr-rtas: add CPU argument to RTAS calls
RTAS is a hypervisor provided binary blob that a guest loads andcalls into to execute certain functions. It's similar to thevsyscall page in Linux or the short lived VMCI paravirt interfacefrom VMware.
The QEMU implementation of the RTAS blob is simply a passthrough...
pseries: Fix compiler warning (conversion of pointer to integral value)
This kind of type cast must use uintptr_t or target_ulong to be portablefor hosts with sizeof(void *) != sizeof(long).
Here the value is assigned to a variable of type target_ulong....
booke_ppc: limit booke timer to max when timeout overflow
Limit watchdog and fit timer to maximum timeout value whichqemu timer can support (INT64_MAX). This maximum timeout will behundreds of years, so limiting to max timeout is pretty safe.
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>...
intc/openpic_kvm: Fix QOM and build issues
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
mpc8544_guts: Fix MemoryRegion name
6544 -> 8544
mpc8544_guts: QOM'ify
Introduce type constant, cast macro and rename parent field.
mpc8544_guts: Turn qdev initfn into instance_init
SysBus can deal with NULL SysBusDeviceClass::init since 4ce5dae.
target-ppc: Change default machine for 64-bit
Currently, for qemu-system-ppc64, the default machine type is 'mac99'.The mac99 machine is not being actively maintained, and represents abizarre hybrid of components that never actually existed as a real system....
PPC: e500: factor out mpic init code
KVM in-kernel MPIC support is going to expand this even more,so let's keep it contained.
Signed-off-by: Scott Wood <scottwood@freescale.com>Signed-off-by: Alexander Graf <agraf@suse.de>
kvm/openpic: in-kernel mpic support
Enables support for the in-kernel MPIC that thas been merged into theKVM next branch. This includes irqfd/KVM_IRQ_LINE support from AlexGraf (along with some other improvements).
Note from Alex regarding kvm_irqchip_create():...
intc/openpic: QOM'ify
Introduce type constant and cast macro.
Signed-off-by: Andreas Färber <afaerber@suse.de>Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>Signed-off-by: Alexander Graf <agraf@suse.de>
kvm: Change kvm_cpu_synchronize_state() argument to CPUState
It no longer relies on CPUArchState since 20d695a.
Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>Acked-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Richard Henderson <rth@twiddle.net>...
kvm: Change cpu_synchronize_state() argument to CPUState
Change Monitor::mon_cpu to CPUState as well.
Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>Acked-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Change cpu_exit() argument to CPUState
It no longer depends on CPUArchState, so move it to qom/cpu.c.
Prepares for changing GDBState::c_cpu to CPUState.
Signed-off-by: Andreas Färber <afaerber@suse.de>
dma: eliminate DMAContext
The DMAContext is a simple pointer to an AddressSpace that is now alwaysalready available. Make everyone hold the address space directly,and clean up the DMA API to use the AddressSpace directly.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
memory: give name to every AddressSpace
The "info mtree" command in QEMU console prints only "memory" and "I/O" address spaces while there are actually a lot more other AddressSpacestructs created by PCI and VIO devices. Those devices do not normallyhave names and therefore not present in "info mtree" output....
spapr_vio: take care of creating our own AddressSpace/DMAContext
Fetch the root region from the sPAPRTCETable, and use it to buildan AddressSpace and DMAContext.
Now, everywhere we have a DMAContext we also have access to thecorresponding AddressSpace (either because we create it just before...
spapr: convert TCE API to use an opaque type
The TCE table is currently returned as a DMAContext, and non-type-safeAPIs are called later passing back the DMAContext. Since we want to moveaway from DMAContext, use an opaque type instead, and add an accessor...
spapr: make IOMMU translation go through IOMMUTLBEntry
The next step is to introduce the translation code that will be used forIOMMU MemoryRegions, but still do the actual translation in a DMAContext.
Acked-by: David Gibson <david@gibson.dropbear.id.au>...
spapr: use memory core for iommu support
Now we can stop using a "translating" DMAContext, but we do not yet modifythe sPAPRTCETable users to get an AddressSpace; they keep using the tablevia a DMAContext.
dma: eliminate old-style IOMMU support
The translate function in the DMAContext is now always NULL.Remove every reference to it.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
pci: use memory core for iommu support
Use the new iommu support in the memory core for iommu support. The onlyuser, spapr, is also converted, but it still provides a DMAContextinterface until the non-PCI bits switch to AddressSpace.
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>...
Merge remote-tracking branch 'pmaydell/configury.next' into staging
Merge branch 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu
ppc: Remove CONFIG_FDT conditionals
Now that we know we're compiling with libfdt we can remove theCONFIG_FDT conditionals.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>...
spapr_rtas: Abstract rtas_start_cpu() with qemu_get_cpu()
Instead of looping over all CPUArchState, use a helper to obtain thedesired CPUState.Free the "cpu" variable for PowerPCCPU, to access its CPUPPCState.
spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu()
Instead of looping over all CPUArchState, use a helper to obtain thedesired CPUState directly. Saves a CPUPPCState variable and QOM cast.
isa: QOM'ify ISADevice
Rename its parent field and use DEVICE where necessary.
isa: QOM'ify ISABus
Rename its parent field and use ISA_BUS() where necessary.
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>
PPC: e500: correct params->ram_size with ram_size
We should sync params->ram_size after we fixup memory size ona alignment boundary. Otherwise Guest would exceed the actualmemory region.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>Signed-off-by: Alexander Graf <agraf@suse.de>
pseries: Factor out check for out-of-bounds LIOBN
PAPR defines LIOBNs (Logical IO Bus Numbers) to be 32-bit, and we check forvalues that aren't in the code for H_PUT_TCE. This patch factors the checkinto spapr_tce_find_by_liobn(), which already checks if a 32-bit LIOBN...
pseries: Fix debug message for out-of-bounds address in H_PUT_TCE
Due to a brain outage, this message says "out-of-boards" instead of"out-of-bounds".
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>...
PPC: e500: initialize GPRs as per epapr
ePAPR defines the initial values of cpu registers.This patch initialize the GPRs as per ePAPR specification.
This resolves the issue of guest reboot/reset (guest hang on reboot).
prep: Make System I/O port 0092 read/write
Port 0x0092 is documented as read/write, so for now return theendianness state instead of hardcoded 0x00.
Signed-off-by: Julio Guerra <guerr@julio.in>[AF: Extracted from larger port 0092 patch]Signed-off-by: Andreas Färber <andreas.faerber@web.de>
prep: Add ELF support for -bios
This prepares for switching from OpenHack'Ware to OpenBIOS.
While touching the error handling code, switch from aborting hw_error()to fprintf()+exit() and suppress failing without -bios for qtest.
Acked-by: Alexander Graf <agraf@suse.de>...
prep: Fix NIP reset value
The value was changed by commit 09d9828ace37ead29d510a7e24e63c2f15cd4b1c"PPC: fix hreset_vector for 60x, ...".
Change it back for prep machine to unbreak OpenHack'Ware.
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>Signed-off-by: Andreas Färber <andreas.faerber@web.de>
audio: enable PCI audio cards for all PCI-enabled targets
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Message-id: 1366303444-24620-9-git-send-email-pbonzini@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
audio: look for the ISA and PCI buses
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Message-id: 1366303444-24620-8-git-send-email-pbonzini@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
pseries: Generate device paths for VIO devices
This patch implements a get_dev_path qdev hook for the pseries paravirtualVIO bus. With upcoming savevm support, this will become very important forscsi disks hanging of VIO virtual SCSI adapters. scsibus_get_dev_path...
PPC: mac newworld: fix cpu NIP reset value
On -M mac99, we can run 970 CPUs. However, these CPUs define the initialinstruction pointer they start execution at as part of their bootup protocol,so effectively it's up to the board to decide where they start....
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...
pseries: Fix some small errors in XICS logic
Under certain circumstances the emulation for the pseries "XICS" interruptcontroller was clearing a pending interrupt from the XISR register, withoutalso clearing the corresponding priority variable. This will cause...
pseries: Convert VIO code to QOM style type safe(ish) casts
Curerntly the pseries VIO device code contains quite a few explicituses of DO_UPCAST and plain C casts. This is (obviously) type unsafe,and not the conventional way of doing things in the QOM model. This...
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....
PPC: Remove env->hreset_excp_prefix
This value is not needed if we use correctly the MSR[IP] bit.
excp_prefix is always 0x00000000, except when the MSR[IP] bit isimplemented and set to 1, in that case excp_prefix is 0xfff00000.
The handling of MSR[IP] was already implemented but not used at reset...
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....
Remove unneeded type casts
cpu_physical_memory_read, cpu_physical_memory_write take any pointeras 2nd argument without needing a type cast.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
sysemu: avoid proliferation of include/ subdirectories
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arm: fix location of some include files
The recent rearrangement of include files had some minor errors: devices.h is not ARM specific and should not be in arm/ arm.h should be in arm/
Move these two headers to correct this.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
hw: move interrupt controllers to hw/intc/, configure with default-configs/
hw: move NVRAM interfaces to hw/nvram/, configure with default-configs/
hw: move private headers to hw/ subdirectories.
Many headers are used only in a single directory. These can bekept in hw/.
hw: move char devices to hw/char/, configure via default-configs/
hw: move PCI bridges to hw/pci-* or hw/ARCH
hw: move MC146818RTC to hw/timer/, configure via default-configs/
hw: move NICs to hw/net/, configure via default-configs/
hw: move SCSI controllers to hw/scsi/, configure via default-configs/
hw: make all of hw/pci/ configurable via default-configs/
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...
mmu-hash*: Add hash pte load/store helpers
On real hardware the ppc hash page table is stored in memory; accordinglyour mmu emulation code can read a hash page table in guest memory. But,when paravirtualized under PAPR, the real hash page table is in host...
pseries: Fix breakage in CPU QOM conversion
Commit 259186a7d2f7184efc96ae99bc5658e6159f53ad "cpu: Move halted andinterrupt_request fields to CPUState" broke the pseries machine. That'sbecause it uses CPU instead of ENV_GET_CPU() to convert from the global...
pseries: Remove "busname" property for PCI host bridge
Currently the "spapr-pci-host-bridge" device has a "busname" property whichcan be used to override the default assignment of qbus names for the bussubordinate to the PHB. We use that for the default primary PCI bus, to...
pseries: Move XICS initialization before cpu initialization
Currently, the pseries machine initializes the cpus, then the XICSinterrupt controller. However, to support the upcoming in-kernel XICSimplementation we will need to initialize the irq controller before the...
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().
exec: Pass CPUState to cpu_reset_interrupt()
Move it to qom/cpu.c to avoid build failures depending on include orderof cpu-qom.h and exec/cpu-all.h.
Change opaques of various ..._irq_handler() functions to theappropriate CPU type to facilitate using cpu_reset_interrupt()....
cpu: Pass CPUState to cpu_interrupt()
Move it to qom/cpu.h to avoid issues with include order.
Change pc_acpi_smi_interrupt() opaque to X86CPU.
Merge remote-tracking branch 'origin/master' into staging
Merge remote-tracking branch 'bonzini/hw-dirs' into staging
PPC: Fix dma interrupt
In openbios (drivers/ide.c) they are set to
0000000d 00000000 00000002 000000000000000e 00000000 00000003 000000000000000f 00000000 00000004 00000000(The last one seems to be not implemented in qemu)
It follows convention of how they are set on real machines,...
pci_host: Drop write-only address_space field
The address_space field of PCIHostState was only ever written, never used.Drop it completely.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
build: always link device_tree.o into emulators if libfdt available
ppc: express FDT dependency of pSeries and e500 boards via default-configs/
hw: move boards and other isolated files to hw/ARCH
ppc: move files referencing CPU to hw/ppc/
ppc: move more files to hw/ppc
These sPAPR files do not implement devices, move them over.Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ppc: do not use ../ in include files
This simplifies the scripted execution of the next patch.
e500: Replace open-coded loop with qemu_get_cpu()
Since we still need env for ppc-specific fields, obtain it via the newenv_ptr fields to avoid "cpu" name conflicts between CPUState andPowerPCCPU for now.
This fixes a potential issue with env being NULL at the end of the loop...
Merge remote-tracking branch 'afaerber-or/prep-up' into staging
prep: Move PReP machine to hw/ppc/
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
fw_cfg: Remove FW_CFG_MAX_CPUS from fw_cfg_init()
PC will not use max_cpus for that field, so move it outside the commoncode so it can use a different value on PC.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
PPC: e500: fix mpic_iack address
MPIC+0xa0 is IACK for the current CPU. MPIC+0x200a0 is IACK for CPU 0.This fix allows EPR to work with an SMP target.
PPC: e500: Select MPIC v4.2 on ppce500 platform
The compatible string is changed to fsl,mpic on all e500 platforms, toadvertise the existence of BRR1. This matches what the device tree willhave on real hardware.
With MPIC v4.2 max_cpu can be increased from 15 to 32....
adb: QOM'ify ADB devices
They were not qdev'ified before. Derive ADBDevice from DeviceState andconvert reset callbacks to DeviceClass::reset, ADBDevice::opaque pointerto ADBDevice subtypes for mouse and keyboard and adb_{kbd,mouse}_init()to regular qdev functions....
cuda: Move ADB bus into CUDA state
Replace the global adb_bus with a CUDA-internal one, accessed usingregular qdev child bus accessor.
macio: Split MacIO in two
Let the machines create two different types. This prepares to moveknowledge about sub-devices from the machines into the devices.
mac_nvram: Clean up public API
The state data field is accessed in uint8_t quantities, so switch fromuint32_t argument and return value to uint8_t.
Fix debug format specifiers while at it.
mac_nvram: QOM'ify MacIO NVRAM
It was not qdev'ified before. Turn it into a SysBusDevice andinitialize it via static properties.
Prepare Old World specific MacIO state and embed the NVRAM state there.
Drop macio_nvram_setup_bar() in favor of sysbus_mmio_map() or...
ide/macio: QOM'ify MacIO IDE
It was not qdev'ified before. Turn it into a SysBusDevice.Embed them into the MacIO devices.
cuda: QOM'ify CUDA
It was not qdev'ified before. Turn it into a SysBusDevice and embed itin MacIO.
ppc: Move Mac machines to hw/ppc/
Signed-off-by: Andreas Färber <afaerber@suse.de>[agraf: squash in MAINTAINERS fix]Signed-off-by: Alexander Graf <agraf@suse.de>
sysbus: Drop sysbus_from_qdev() cast macro
Replace by SYS_BUS_DEVICE() QOM cast macro using a scripted conversion.Avoids the old macro creeping into new code.
Resolve a Coding Style warning in openpic code.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
PPC: E500: Calculate loading blob offsets properly
We have 3 blobs we need to load when booting the system:
- kernel - initrd - dtb
We place them in physical memory in that order. At least we should.This patch fixes the location calculation up to take any module into...
PPC: e500: Change in-memory order of load blobs
Today, we load
<kernel> <initrd> <dtb>
into memory in that order. However, Linux has a bug where it can onlyhandle the dtb if it's within the first 64MB of where <kernel> starts.
So instead, let's change the order to...
Make default boot order machine specific
This patch makes default boot order machine specific instead ofset globally. The default boot order can be set per machine inQEMUMachine boot_order. This also allows a machine to receive aNULL boot order when -boot isn't used and take an appropriate action...
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()....