summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-03-10elf-loader: Provide the possibility to relocate s390 ELF filesThomas Huth3-0/+82
On s390, we would like to load our "BIOS" s390-ccw.img to the end of the RAM. Therefor we need the possibility to relocate the ELF file so that it can also run from different addresses. This patch adds the necessary code to the QEMU ELF loader function. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Message-Id: <1425895973-15239-2-git-send-email-thuth@linux.vnet.ibm.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390-ccw.img: Reinitialize guessing on rebootChristian Borntraeger1-0/+1
guessed_disk_nature is a static zero variable. As the QEMU ELF loader does not zero the BSS section, lets do it explicitely here. This fixes reboot for some corner cases (like FCP flash devices with logical_block_size=512, physical_block_size=4096) Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Tested-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Message-Id: <1425310029-53396-3-git-send-email-borntraeger@de.ibm.com>
2015-03-10s390-ccw.img: Allow bigger ramdisk sizes or offsetsChristian Borntraeger3-2/+4
The s390-ccw bios creates the the virtqueue at 100MB. For big ramdisks or offsets (via zipl) this gets overwritten. As a quick band-aid, lets move the virtqueue into the bss section, which is at 0x7f00000. As the bios code (text) is at 0x7e00000 we can now handle ramdisk which are ~27MB bigger. Long term we want to make the s390-ccw bios position independent and load of at the end of memory. Reported-by: Alexander Graf <agraf@suse.de> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Message-Id: <1425310029-53396-2-git-send-email-borntraeger@de.ibm.com>
2015-03-10s390x/kvm: passing max memory size to acceleratorDominik Dingel3-0/+69
With "KVM: s390: Allow userspace to limit guest memory size" KVM is able to do some optimizations based on the guest memory limit. The guest memory limit is computed by the initial definition and with the notion of hotplugged memory. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Guenther Hutzl <hutzl@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Message-Id: <1425570981-40609-3-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10virtio-ccw: Convert to realize()Markus Armbruster2-61/+75
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1425045219-19958-1-git-send-email-armbru@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10virtio-s390: Convert to realize()Markus Armbruster2-35/+47
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1425045337-20138-3-git-send-email-armbru@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10virtio-s390: s390_virtio_device_init() can't fail, simplifyMarkus Armbruster1-14/+15
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1425045337-20138-2-git-send-email-armbru@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x/kvm: enable the new SIGP handling in user spaceDavid Hildenbrand1-0/+3
All required SIGP handlers have been implemented in QEMU. Let's enable the new sigp handling in user space if the kernel supports it. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-11-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x/kvm: deliver SIGP RESTART directly if stoppedDavid Hildenbrand1-2/+11
According to the PoP, a restart irq has to be delivered "without first honoring any other pending interruptions", if a cpu is in the STOPPED state. While it is hard to implement this case in kvm, it can easily be handled in qemu. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-10-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x: add function to deliver restart irqsDavid Hildenbrand2-8/+32
This patch adds a helper function to deliver restart irqs. To be able to be used by kvm, the psw load/store methods have to perform special cc-code handling only when running with tcg. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-9-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x/kvm: SIGP START is only applicable when STOPPEDDavid Hildenbrand1-0/+5
In preparation for other CPU states, SIGP START will only start a VCPU if it is in the STOPPED state. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-8-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x/kvm: implement handling of new SIGP ordersDavid Hildenbrand4-5/+218
This patch adds handling code for the following SIGP orders: - SIGP SET ARCHITECTURE - SIGP SET PREFIX - SIGP STOP - SIGP STOP AND STORE STATUS - SIGP STORE STATUS AT ADDRESS SIGP STOP (AND STORE STATUS) are the only orders that can stay pending forever (and may only be interrupted by resets), so special care has to be taken about them. Their status also has to be tracked within QEMU. This patch takes care of migrating this status (e.g. if migration happens during a SIGP STOP). Due to the BQL, only one VCPU is currently able to execute SIGP handlers at a time. According to the PoP, BUSY should be returned if another SIGP order is currently being executed on a VCPU. This can only be implemented when the BQL does not protect all handlers. For now, all SIGP orders on all VCPUs will be serialized, which will be okay for the first shot. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-7-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x/kvm: trace all SIGP ordersDavid Hildenbrand2-1/+4
This patch adds tracing code for all SIGP orders (including the destination vcpu and the resulting condition code). Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-6-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x/kvm: helper to set the SIGP status in SigpInfoDavid Hildenbrand1-3/+8
Whenever we set the SIGP status in the status register, we have to wipe out the lower 4 bytes and keep the higher 4 bytes. Also the condition code will always be set to STATUS_STORED. Let's introduce the wrapper for SigpInfo, as this will avoid most duplicate code in the future. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-5-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x/kvm: pass the SIGP instruction parameter to the SIGP handlerDavid Hildenbrand1-2/+6
The parameter of the SIGP instruction will be neded in the future. Let's read it out and store it in the struct sigp_info, so it can be passed to the sigp handlers. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-4-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x/kvm: more details for SIGP handler with one destination vcpuDavid Hildenbrand1-62/+91
Whenever a sigp order is to be executed by a target vcpu, we use run_on_cpu(). As we have only one pointer to pass all data to these sigp handlers, let's introduce the struct sigp_info and use it as a transport container. All orders targeting a single vcpu are now dispatched from a separate handler. The destination vcpu is only valid for these orders and must not be checked for SIGP SET ARCHITECTURE. The sigp_info is filled with life in this new handler and used to pass the information about the sigp order to the existing handlers. The cc is set within these handlers. Rename sigp_cpu_start() and sigp_cpu_restart() on the way to match the SIGP order names (in order to avoid touching affected lines several times). Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-3-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10s390x: introduce defines for SIGP condition codesDavid Hildenbrand3-10/+17
This patch introduces defines for the SIGP condition codes and replaces all occurrences of numeral condition codes with the new defines. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1424783731-43426-2-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-10synchronize Linux headers to 4.0-rc3Christian Borntraeger6-40/+93
synchronize linux headers up to commit 9eccca0843205f87c ("Linux 4.0-rc3") Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-09Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' ↵Peter Maydell41-383/+1284
into staging Patch queue for ppc - 2015-03-09 This is my current patch queue for 2.3. Highlights include: * pseries: 2.3 machine * pseries: Export RTC via QOM * pseries: EEH support * mac: save/restore support * fix POWER5 hosts * random bug fixes # gpg: Signature made Mon Mar 9 14:00:53 2015 GMT using RSA key ID 03FEDC60 # gpg: Good signature from "Alexander Graf <agraf@suse.de>" # gpg: aka "Alexander Graf <alex@csgraf.de>" * remotes/agraf/tags/signed-ppc-for-upstream: (38 commits) target-ppc: Fix warnings from Sparse sPAPR: Implement sPAPRPHBClass EEH callbacks sPAPR: Implement EEH RTAS calls target-ppc: Add versions to server CPU descriptions PPC: Introduce the Virtual Time Base (VTB) SPR register PPC: Remove duplicate OPENPIC defines in default-configs ppc64-softmmu: Remove duplicated OPENPIC from config Revert "default-configs/ppc64: add all components of i82378 SuperIO chip used by prep" spapr_vio: Convert to realize() openpic: convert to vmstate openpic: switch IRQQueue queue from inline to bitmap openpic: fix up loadvm under -M mac99 openpic: fix segfault on -M mac99 savevm target-ppc: force update of msr bits in cpu_post_load target-ppc: move sdr1 value change detection logic to helper_store_sdr1() cuda.c: include adb_poll_timer in VMStateDescription adb.c: include ADBDevice parent state in KBDState and MouseState macio.c: include parent PCIDevice state in VMStateDescription display cpu id dump state Openpic: check that cpu id is within the number of cpus ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-03-09target-ppc: Fix warnings from SparseStefan Weil1-2/+3
Sparse report: target-ppc/mmu-hash64.c:353:9: warning: returning void-valued expression target-ppc/mmu-hash64.c:620:9: warning: returning void-valued expression Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09sPAPR: Implement sPAPRPHBClass EEH callbacksGavin Shan2-0/+116
The patch implements sPAPRPHBClass EEH callbacks so that the EEH RTAS requests can be routed to VFIO for further handling. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09sPAPR: Implement EEH RTAS callsGavin Shan3-2/+316
The emulation for EEH RTAS requests from guest isn't covered by QEMU yet and the patch implements them. The patch defines constants used by EEH RTAS calls and adds callbacks sPAPRPHBClass::{eeh_set_option, eeh_get_state, eeh_reset, eeh_configure}, which are going to be used as follows: * RTAS calls are received in spapr_pci.c, sanity check is done there. * RTAS handlers handle what they can. If there is something it cannot handle and the corresponding sPAPRPHBClass callback is defined, it is called. * Those callbacks are only implemented for VFIO now. They do ioctl() to the IOMMU container fd to complete the calls. Error codes from that ioctl() are transferred back to the guest. [aik: defined RTAS tokens for EEH RTAS calls] Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09target-ppc: Add versions to server CPU descriptionsAlexey Kardashevskiy2-7/+9
5b79b1c "target-ppc: Create versionless CPU class per family if KVM" added a dynamic CPU class registration with the name of the CPU family which QEMU is running on. For example, this allowed specifying "-cpu POWER7" on every version of POWER7 machine, not just the one which POWER7 was an alias of. I.e. before 5b79b1c, "-cpu POWER7" would not work on real POWER7 2.1 and would work on POWER7 2.3 only. The same story for POWER8. However that patch broke POWER5+ support as POWER5+ CPU uses the same name as the CPU class so dynamic registering of the POWER5+ class failed. This redefines POWER5+ server CPUs by adding a version to them and adding an alias for TCG case. KVM will use dynamically registered CPUs. While we are here, do the same for 970 CPU. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09PPC: Introduce the Virtual Time Base (VTB) SPR registerCyril Bur2-0/+11
This patch adds basic support for the VTB. PowerISA: The Virtual Time Base (VTB) is a 64-bit incrementing counter. Virtual Time Base increments at the same rate as the Time Base until its value becomes 0xFFFF_FFFF_FFFF_FFFF (2 64 - 1); at the next increment its value becomes 0x0000_0000_0000_0000. There is no interrupt or other indication when this occurs. The operation of the Virtual Time Base has the following additional properties. 1. Loading a GPR from the Virtual Time Base has no effect on the accuracy of the Virtual Time Base. 2. Copying the contents of a GPR to the Virtual Time Base replaces the contents of the Virtual Time Base with the contents of the GPR. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09PPC: Remove duplicate OPENPIC defines in default-configsAlexander Graf2-2/+0
The CONFIG_OPENPIC variable was declared multiple times. We only need it once. Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09ppc64-softmmu: Remove duplicated OPENPIC from configAlexey Kardashevskiy1-1/+0
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09Revert "default-configs/ppc64: add all components of i82378 SuperIO chip ↵Alexey Kardashevskiy1-6/+0
used by prep" This reverts commit 9c9984242ce46ccf8636f5c19e81d794e84aa0c7 as even when it was applied, all supposedly new config options were already enabled. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09spapr_vio: Convert to realize()Markus Armbruster6-38/+27
Bonus fix: always set an error on failure. Some failures were silent before, except for the generic error set by device_realize(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09openpic: convert to vmstateMark Cave-Ayland1-134/+119
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Alexander Graf <agraf@suse.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09openpic: switch IRQQueue queue from inline to bitmapMark Cave-Ayland1-9/+16
This is in preparation for using VMSTATE_BITMAP in a followup vmstate migration patch. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09openpic: fix up loadvm under -M mac99Mark Cave-Ayland1-5/+3
Issuing loadvm under -M mac99 would fail for two reasons: firstly an incorrect version number for openpic would cause openpic_load() to abort, and secondly a cut/paste error when restoring the IVPR and IDR registers caused subsequent vmstate sections to become misaligned and abort early. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09openpic: fix segfault on -M mac99 savevmMark Cave-Ayland1-1/+1
A simple copy/paste error causes savevm on -M mac99 to segfault. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09target-ppc: force update of msr bits in cpu_post_loadMark Cave-Ayland1-1/+7
Since env->msr has already been restored by the time cpu_post_load is called, make sure that ppc_store_msr() is explicitly called with all msr bits except MSR_TGPR marked as invalid. This solves the issue where MSR flags aren't set correctly when restoring a VM snapshot, in particular the internal env->excp_prefix value when MSR_EP has been altered by a guest. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09target-ppc: move sdr1 value change detection logic to helper_store_sdr1()Mark Cave-Ayland2-21/+21
Otherwise when cpu_post_load calls ppc_store_sdr1() when restoring a VM snapshot the value is deemed unchanged and so the internal env->htab* variables aren't set correctly. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09cuda.c: include adb_poll_timer in VMStateDescriptionMark Cave-Ayland1-2/+3
Make sure that we include the adb_poll_timer when saving the VM state for client OSs that use it, e.g. Darwin. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09adb.c: include ADBDevice parent state in KBDState and MouseStateMark Cave-Ayland1-4/+18
The parent ADBDevice contains the device id on the ADB bus. Make sure that this state is included in both its subclasses since some clients (such as OpenBIOS) reprogram each device id after enumeration. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09macio.c: include parent PCIDevice state in VMStateDescriptionMark Cave-Ayland1-0/+24
This ensures that the macio PCI device is correctly configured when restoring from a VM snapshot. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09display cpu id dump stateTristan Gingold1-2/+3
Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09Openpic: check that cpu id is within the number of cpusFabien Chouteau1-2/+2
Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09pseries: Switch VGA endian on H_SET_MODEDavid Gibson3-0/+31
When the guest switches the interrupt endian mode, which essentially means a global machine endian switch, we want to change the VGA framebuffer endian mode as well in order to be backward compatible with existing guests who don't know about the new endian control register. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09vga: Expose framebuffer byteorder as a QOM propertyDavid Gibson1-0/+29
The VGA device model now supports having the framebuffer in either endian, and can be switched between these by the guest via a register in the qext region. However, in some cases (e.g. LE OS on the pseries machine) we have existing guest that don't know about the endian switch register, but other parts of the qemu code have better information to set a default endianness than the VGA code does of itself. In order to allow them to set a correct default endianness in these cases, without breaking abstraction walls, this patch exposes the VGA framebuffer endianness via a writable QOM property. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> [agraf: use instance_init for property exposure] Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09spapr: Clean up misuse of qdev_init() in xics-kvm creationMarkus Armbruster1-13/+12
We call try_create_xics() to create a "xics-kvm". If it fails, we call it again to fall back to plain "xics". try_create_xics() uses qdev_init(). qdev_init()'s error handling has an unwanted side effect: it calls qerror_report_err(), which prints to stderr. Looks like an error, but isn't. In QMP context, it would stash the error in the monitor instead, making the QMP command fail. Fortunately, it's only called from board initialization, never in QMP context. Clean up by cutting out the qdev_init() middle-man: set property "realized" directly. While there, improve the error message when we can't satisfy an explicit user request for "xics-kvm", and exit(1) instead of abort(). Simplify the abort when we can't create "xics". Signed-off-by: Markus Armbruster <armbru@redhat.com> [agraf: squash in fix for uninitialized variable from mdroth] Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09PPC: Clean up misuse of qdev_init() in kvm-openpic creationMarkus Armbruster1-9/+11
We call ppce500_init_mpic_kvm() to create a "kvm-openpic". If it fails, we call ppce500_init_mpic_qemu() to fall back to plain "openpic". ppce500_init_mpic_kvm() uses qdev_init(). qdev_init()'s error handling has an unwanted side effect: it calls qerror_report_err(), which prints to stderr. Looks like an error, but isn't. In QMP context, it would stash the error in the monitor instead, making the QMP command fail. Fortunately, it's only called from board initialization, never in QMP context. Clean up by cutting out the qdev_init() middle-man: set property "realized" directly. While there, improve the error message when we can't satisfy an explicit user request for "kvm-openpic", and exit(1) instead of abort(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09pseries: Export RTC time via QOMDavid Gibson2-0/+10
On x86, the guest's RTC can be read with QMP, either from the RTC device's "date" property or via the "rtc-time" property on the machine (which is an alias to the former). This is set up in the mc146818rtc driver, and doesn't work on other targets. This patch adds a similar "date" property to the pseries machine's RTAS RTC and adds a compatible alias to the machine. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09pseries: Move rtc_offset into RTC device's state structureDavid Gibson3-8/+66
The initial creation of the PAPR RTC qdev class left a wart - the rtc's offset was left in the sPAPREnvironment structure, accessed via a global. This patch moves it into the RTC device's own state structure, were it belongs. This requires a small change to the migration stream format. In order to handle incoming streams from older versions, we also need to retain the rtc_offset field in the sPAPREnvironment structure, so that it can be loaded into via the vmsd, then pushed into the RTC device. Since we're changing the migration format, this also takes the opportunity to: * Change the rtc offset from a value in seconds to a value in nanoseconds, allowing nanosecond offsets between host and guest rtc time, if desired. * Remove both the already unused "next_irq" field and now unused "rtc_offset" field from the new version of the spapr migration stream Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09pseries: Make the PAPR RTC a qdev deviceDavid Gibson4-7/+61
At present the PAPR RTC isn't a "device" as such - it's accessed only via firmware/hypervisor calls, and is handled in the sPAPR core code. This becomes inconvenient as we extend it in various ways. This patch makes the PAPR RTC a separate device in the qemu device model. For now, the only piece of device state - the rtc_offset - is still kept in the global sPAPREnvironment structure. That's clearly wrong, but leaving it to be fixed in a following patch makes for a clearer separation between the internal re-organization of the device, and the behavioural changes (because the migration stream format needs to change slightly when the offset is moved into the device's own state). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09pseries: Make RTAS time of day functions respect -rtc optionsDavid Gibson1-4/+36
In the 'pseries' machine the real time clock is provided by a paravirtualized firmware interface rather than a device per se; the RTAS get-time-of-day and set-time-of-day calls. Out current implementations of those work directly off host time (with an offset), not respecting options such as clock=vm which can be specified in the -rtc command line option. This patch reworks the RTAS RTC code to respect those options, primarily by basing them on the qemu_clock_get_ns(rtc_clock) function instead of directly on qemu_get_timedate() (which essentially handles host time, not virtual rtc time). As a bonus, this means our get-time-of-day function now also returns nanoseconds. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09pseries: Add spapr_rtc_read() helper functionDavid Gibson3-3/+13
The virtual RTC time is used in two places in the pseries machine. First is in the RTAS get-time-of-day function which returns the RTC time to the guest. Second is in the spapr events code which is used to timestamp event messages from the hypervisor to the guest. Currently both call qemu_get_timedate() directly, but we want to change that so we can properly handle the various -rtc options. In preparation, create a helper function to return the virtual RTC time. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09pseries: Add more parameter validation in RTAS time of day functionsDavid Gibson1-1/+6
Currently, the RTAS time of day functions only partially validate the number of parameters they receive and return. Because of how the parameters are used, this is unlikely to lead to a crash, but it's messy. This patch adds the missing checks. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2015-03-09pseries: Move sPAPR RTC code into its own fileDavid Gibson5-50/+88
At the moment the RTAS (firmware/hypervisor) time of day functions are implemented in spapr_rtas.c along with a bunch of other things. Since we're going to be expanding these a bit, move the RTAS RTC related code out into new file spapr_rtc.c. Also add its own initialization function, spapr_rtc_init() called from the main machine init routine. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>