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().
Signed-off-by: Andreas Färber <afaerber@suse.de>
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.
Signed-off-by: Scott Wood <scottwood@freescale.com>Signed-off-by: Alexander Graf <agraf@suse.de>
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.
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
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()....
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>...
PPC: Bring EPR support closer to reality
We already used to support the external proxy facility of FSL MPICs,but only implemented it halfway correctly.
This patch adds support for
Merge branch 'master' of git://git.qemu.org/qemu into qom-cpu
Adapt header include paths.
ppc_booke: Pass PowerPCCPU to ppc_booke_timers_init()
Cleans up after passing PowerPCCPU to timer callbacks.
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
exec: move include files to include/exec/
net: reorganize headers
Move public headers to include/net, and leave private headers in net/.Put the virtio headers in include/net/tap.h, removing the multiple copiesthat existed. Leave include/net/tap.h as the interface for NICs, andnet/tap_int.h as the interface for OS-specific parts of the tap backend....
janitor: do not rely on indirect inclusions of or from qemu-char.h
Various header files rely on qemu-char.h including qemu-config.h ormain-loop.h, but they really do not need qemu-char.h at all (particularlyinteresting is the case of the block layer!). Clean this up, and also...
Merge commit '1dd3a74d2ee2d873cde0b390b536e45420b3fe05' into HEAD
pci: update all users to look in pci/
update all users so we can remove the makefile hack.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: move pci core code to hw/pci
Move files and modify makefiles to pick them at thenew location.
PPC: E500: Generate dt pci irq map dynamically
Today we're hardcoding the PCI interrupt map in the e500 machine file.Instead, let's write it dynamically so that different machine typescan have different slot properties.
Signed-off-by: Alexander Graf <agraf@suse.de>
PPC: E500: Move PCI slot information into params
We have a params struct that allows us to expose differences betweene500 machine models. Include PCI slot information there, so we can havedifferent machines with different PCI slot topology.
PPC: E500plat: Make a lot of PCI slots available
The ppce500 machine doesn't have to stick to hardware limitations,as it's defined as being fully device tree based.
Thus we can change the initial PCI slot ID to 0x1 which gives us awhopping 31 PCI devices we can support with this machine now!...
PPC: e500: pci: Export slot2irq calculation
We need the calculation method to get from a PCI slot ID to its respectiveinterrupt line twice. Once in the internal map function and once whenassembling the device tree.
So let's extract the calculation to a separate function that can be called...
openpic: remove irq_out
The current openpic emulation contains half-ready code for bypass mode.Remove it, so that when someone wants to finish it they can start from aclean state.
openpic: convert to qdev
This patch converts the OpenPIC device to qdev. Along the way itrenames the "openpic" target to "raven" and the "mpic" target to"fsl_mpic_20", to better reflect the actual models they implement.
This way we have a generic OpenPIC device now that can handle...
PPC: e500: Add MSI support
Now that our interrupt controller supports MSIs, let's expose that featureto the guest through the device tree!
mpic: Unify numbering scheme
MPIC interrupt numbers in Linux (device tree) and in QEMU are different,because QEMU takes the sparseness of the IRQ number space into account.
Remove that cleverness and instead assume a flat number space. This makesthe code easier to understand, because we are actually aligned with Linux...
pseries: Implement PAPR NVRAM
The PAPR specification requires a certain amount of NVRAM, accessed viaRTAS, which we don't currently implement in qemu. This patch addressesthis deficiency, implementing the NVRAM as a VIO device, with some glue toinstantiate it automatically based on a machine option....
e500: Adding CCSR memory region
All devices are also placed under CCSR memory region.The CCSR memory region is exported to pci device. The MSI interruptgeneration is the main reason to export the CCSR region to PCI device.This put the requirement to move mpic under CCSR region, but logically...
Adding BAR0 for e500 PCI controller
PCI Root complex have TYPE-1 configuration header while PCI endpointhave type-0 configuration header. The type-1 configuration header havea BAR (BAR0). In Freescale PCI controller BAR0 is used for mapping pciaddress space to CCSR address space. This can used for 2 purposes: 1)...
PPC: e500: Map PIO space into core memory region
On PPC, we don't have PIO. So usually PIO space behind a PCI bridge isaccessible via MMIO. Do this mapping explicitly by mapping the PIO spaceof our PCI bus into a memory region that lives in memory space....
e500: Fix serial initialization
it was wrongly using serial_hds0 instead of serial_hds1
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
pseries: Implement qemu initiated shutdowns using EPOW events
At present, using 'system_powerdown' from the monitor or otherwiseinstructing qemu to (cleanly) shut down a pseries guest will not work,because we did not have a method of signalling the shutdown request to the...
Rename target_phys_addr_t to hwaddr
target_phys_addr_t is unwieldly, violates the C standard (_t suffixes arereserved) and its purpose doesn't match the name (most target_phys_addr_taddresses are not target specific). Replace it with a finger-friendly,...
serial: split serial.c
Split serial.c into serial.c, serial.h and serial-isa.c. While being atcreating a serial.h header file move the serial prototypes from pc.h tothe new serial.h. The latter leads to s/pc.h/serial.h/ in tons ofboards which just want the serial bits from pc.h...
create struct for machine initialization arguments
This should help us to:- More easily add or remove machine initialization arguments without having to change every single machine init function;- More easily make mechanical changes involving the machine init...
fdt: move dumpdtb interpretation code to device_tree.c
The dumpdtb code can be useful in more places than just for e500. Move itto a generic place.
PPC: e500: increase DTC_LOAD_PAD
An allowance of 5 MiB for BSS is not enough for Linux kernels with certaindebug options enabled (not sure exactly which one caused it, but I'd guesslockdep). The kernel I ran into this with had a BSS of around 6.4 MB....
PPC: e500: calculate initrd_base like dt_base
While investigating dtb pad issues, I noticed that initrd_base wasn't takingloadaddr into account the way dt_base was. This seems wrong.
PPC: e500: Only expose even TLB sizes in initial TLB
When booting our e500 machine, we automatically generate a big TLB entryin TLB1 that covers all of the code we need to run in there until the guestcan handle its TLB on its own.
However, e500v2 can only handle MAS1.0 sizes. However, we keep our TLB...
Revert "PPC: e500: Use new MPIC dt format"
This reverts commit 518c7fb44f2182cde943dc64f88cb2fd4e4ff6b5. It breaksnew Linux guests with SMP, because IPIs get mapped to large vectors whichour MPIC emulation does not implement.
Conflicts:
hw/ppc/e500.c
PPC: e500: rename mpc8544ds into generic file
Rename the file (with no changes other than fixing up the header paths)in preparation for refactoring into a generic e500 platform. Also moveit into the newly created ppc/ directory.
Signed-off-by: Scott Wood <scottwood@freescale.com>...
PPC: e500: change internal references away from mpc8544ds
No functional changes -- machine is still outwardly mpc8544ds.
The references that are not changed contain mpc8544 hardware details thatneed to be parameterized if/when a different e500 platform wants to...
PPC: e500: split mpc8544ds machine from generic e500 code
Currently the only mpc8544ds-ism that is factored out istoplevel compatible and model. In the future the generic e500code is expected to become more generic.
PPC: e500: add generic e500 platform
This gives the kernel a paravirtualized machine to target, withoutrequiring both sides to pretend to be targeting a specific boardthat likely has little to do with the host in KVM scenarios. Thisavoids the need to add new boards to QEMU, just to be able to...
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...
PPC: e500: require libfdt
Now that we're moving all of the device tree generation from an externalpre-execution generated blob to runtime generation using libfdt, we absolutelymust have libfdt around.
This requirement was there before already, as the only way to not require libfdt...
hw/xilinx_*: Share Xilinx devices between ppc and microblaze
Speeds up the build.
xilinx_ethlite uses tswap32() and is thus target-dependent.
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
target-ppc: Unbreak kvm_ppc.c build
The file is located in target-ppc/, not hw/.
Signed-off-by: Andreas Färber <andreas.faerber@web.de>Cc: Paolo Bonzini <pbonzini@redhat.com>Cc: Anthony Liguori <anthony@codemonkey.ws>Cc: Blue Swirl <blauwirbel@gmail.com>...
build: move device tree to per-target Makefile.objs