summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* virtio-mmio: ioeventfd supportYing-Shiuan Pan2015-06-011-0/+181
| | | | | | | | | | | | | | | | set_host_notifier and set_guest_notifiers supported by virtio-mmio now. Most code copied from virtio-pci. This makes it possible to use vhost-net with virtio-mmio, improving performance by about 30%. The kvm-arm does not yet support irqfd, need to fix the hard-coded part after kvm-arm gets irqfd support. Signed-off-by: Ying-Shiuan Pan <yingshiuan.pan@gmail.com> Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* hw/acpi/aml-build: Fix memory leakShannon Zhao2015-06-011-0/+1
| | | | | | | | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
* acpi: add aml_while() termMarcel Apfelbaum2015-06-011-0/+1
| | | | | | | | | | Add encoding for ACPI DefWhile Opcode. Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* acpi: add aml_increment() termMarcel Apfelbaum2015-06-012-0/+9
| | | | | | | | | | Add encoding for ACPI DefIncrement Opcode. Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* acpi: add aml_shiftright() termMarcel Apfelbaum2015-06-012-0/+11
| | | | | | | | | | Add encoding for ACPI DefShiftRight Opcode. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
* acpi: add aml_shiftleft() termMarcel Apfelbaum2015-06-012-0/+11
| | | | | | | | | | Add encoding for ACPI DefShiftLeft Opcode. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
* acpi: add aml_index() termMarcel Apfelbaum2015-06-012-0/+11
| | | | | | | | | Add encoding for ACPI DefIndex Opcode. Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
* acpi: add aml_lless() termMarcel Apfelbaum2015-06-012-0/+10
| | | | | | | | | | Add encoding for ACPI DefLLess Opcode. Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* acpi: add aml_add() termMarcel Apfelbaum2015-06-012-0/+11
| | | | | | | | | | Add encoding for ACPI DefAdd Opcode. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
* TPM2 ACPI table supportStefan Berger2015-06-0110-28/+237
| | | | | | | | | | | | | | Add a TPM2 ACPI table if a TPM 2 is used in the backend. Also add an SSDT for the TPM 2. Rename tpm_find() to tpm_get_version() and have this function return the version of the TPM found, TPMVersion_Unspec if no TPM is found. Use the version number to build version specific ACPI tables. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tpm: Probe for connected TPM 1.2 or TPM 2Stefan Berger2015-05-315-54/+167
| | | | | | | | | | | | | | In the TPM passthrough backend driver, modify the probing code so that we can check whether a TPM 1.2 or TPM 2 is being used and adapt the behavior of the TPM TIS accordingly. Move the code that tested for a TPM 1.2 into tpm_utils.c and extend it with test for probing for TPM 2. Have the function return the version of TPM found. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Extend TPM TIS interface to support TPM 2Stefan Berger2015-05-317-9/+158
| | | | | | | | | | | | | | | | | | | | | Following the recent upgrade to version 1.3, extend the TPM TIS interface with capabilities introduced for support of a TPM 2. TPM TIS for TPM 2 introduced the following extensions beyond the TPM TIS 1.3 (used for TPM 1.2): - A new 32bit interface Id register was introduced. - New flags for the status (STS) register were defined. - New flags for the capability flags were defined. Support the above if a TPM TIS 1.3 for TPM 2 is used with a TPM 2 on the backend side. Support the old TPM TIS 1.3 configuration if a TPM 1.2 is being used. A subsequent patch will then determine which TPM version is being used in the backend. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Add stream ID to MSI writePavel Fedin2015-05-314-3/+13
| | | | | | | | | | | | | | | | | GICv3 ITS distinguishes between devices by using hardwired device IDs passed on the bus. This patch implements passing these IDs in qemu. SMMU is also known to use stream IDs, therefore this addition can also be useful for implementing platforms with SMMU. Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Changes from v1: - Added bus number to the stream ID - Added stream ID not only to MSI-X, but also to plain MSI. Some common code was made into msi_send_message() function. Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* acpi: Simplify printing to dynamic stringMarkus Armbruster2015-05-311-22/+5
| | | | | | | | | | | | | build_append_namestringv() and aml_string() first calculate the resulting string's length with vsnprintf(NULL, ...), then allocate, then print for real. Simply use g_strdup_vprintf() or g_vasprintf() instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
* i386: drop FDC in pc-q35-2.4+ if neither it nor floppy drives are wantedLaszlo Ersek2015-05-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | It is Very annoying to carry forward an outdatEd coNtroller with a mOdern Machine type. Hence, let us not instantiate the FDC when all of the following apply: - the machine type is pc-q35-2.4 or later, - "-device isa-fdc" is not passed on the command line (nor in the config file), - no "-drive if=floppy,..." is requested. Cc: Markus Armbruster <armbru@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: John Snow <jsnow@redhat.com> Cc: "Gabriel L. Somlo" <gsomlo@gmail.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Kevin Wolf <kwolf@redhat.com> Cc: qemu-block@nongnu.org Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* i386/pc_q35: don't insist on board FDC if there's no default floppyLaszlo Ersek2015-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "no_floppy = 1" machine class setting causes "default_floppy" in main() to become zero. Consequently, default_drive() will not call drive_add() and drive_new() for IF_FLOPPY, index=0, meaning that no default floppy drive will be created for the virtual machine. In that case, board code should also not insist on the creation of the board-default FDC. The board-default FDC will still be created if the user requests a floppy drive with "-drive if=floppy". Additionally, separate FDCs can be specified manually with "-device isa-fdc". They allow the -device isa-fdc,driveA=... syntax that is more flexible than the one required by the board-default FDC: -global isa-fdc.driveA=... This patch doesn't change the behavior observably, as all Q35 machine types have "no_floppy = 0". Cc: Markus Armbruster <armbru@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: John Snow <jsnow@redhat.com> Cc: "Gabriel L. Somlo" <gsomlo@gmail.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Kevin Wolf <kwolf@redhat.com> Cc: qemu-block@nongnu.org Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* i386/pc: '-drive if=floppy' should imply a board-default FDCLaszlo Ersek2015-05-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | Even if board code decides not to request the creation of the FDC (keyed off board-level factors, to be determined later), we should create the FDC nevertheless if the user passes '-drive if=floppy' on the command line. Otherwise '-drive if=floppy' would break without explicit '-device isa-fdc' on such boards. Cc: Markus Armbruster <armbru@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: John Snow <jsnow@redhat.com> Cc: "Gabriel L. Somlo" <gsomlo@gmail.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Kevin Wolf <kwolf@redhat.com> Cc: qemu-block@nongnu.org Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* i386/pc: pc_basic_device_init(): delegate FDC creation requestLaszlo Ersek2015-05-314-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces no observable change, but it allows the callers of pc_basic_device_init(), ie. pc_init1() and pc_q35_init(), to request (or not request) the creation of the FDC explicitly. At the moment both callers pass constant create_fdctrl=true (hence no observable change). Assuming a board passes create_fdctrl=false, "floppy" will be NULL on output, and (beyond the FDC not being created) that NULL will be passed on to pc_cmos_init(). Luckily, pc_cmos_init() already handles that case. Cc: Markus Armbruster <armbru@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: John Snow <jsnow@redhat.com> Cc: "Gabriel L. Somlo" <gsomlo@gmail.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Kevin Wolf <kwolf@redhat.com> Cc: qemu-block@nongnu.org Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* virtio: increase the queue limit to 1024Jason Wang2015-05-311-1/+1
| | | | | | | | | | Increase the queue limit to 1024. But virtio-ccw and s390-virtio won't support this, this is done through failing device_plugged() for those two transports if the number of virtqueues is greater than 64. Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio: rename VIRTIO_PCI_QUEUE_MAX to VIRTIO_QUEUE_MAXJason Wang2015-05-317-27/+27
| | | | | | | | | | VIRTIO_PCI_QUEUE_MAX is not only used for pci, so rename it be generic. Cc: Amit Shah <amit.shah@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio-s390: introduce virtio_s390_device_plugged()Jason Wang2015-05-311-0/+14
| | | | | | | | | | | This patch introduce a virtio-s390 specific device_plugged() function and doing the number of virtqueue validation inside. Cc: Alexander Graf <agraf@suse.de> Cc: Richard Henderson <rth@twiddle.net> Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio-s390: introduce virito s390 queue limitJason Wang2015-05-311-2/+4
| | | | | | | | Cc: Alexander Graf <agraf@suse.de> Cc: Richard Henderson <rth@twiddle.net> Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio-ccw: validate the number of queues against bus limitationJason Wang2015-05-311-0/+9
| | | | | | | | | | Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio-ccw: introduce ccw specific queue limitJason Wang2015-05-313-8/+11
| | | | | | | | | | Cc: Alexander Graf <agraf@suse.de> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Richard Henderson <rth@twiddle.net> Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio: introduce virtio_get_num_queues()Jason Wang2015-05-312-0/+14
| | | | | | | | | This patch introduces virtio_get_num_queues() which iterates the vqs array and return the number of virtqueues used by device. Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio: device_plugged() can failJason Wang2015-05-315-8/+12
| | | | | | | | | | | | | | | This patch passes error pointer to transport specific device_plugged() callback. Through this way, device_plugged() can do some transport specific check and fail. This will be uesd by following patches that check the number of virtqueues against the transport limitation. Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio-net: adding all queues in .realize()Jason Wang2015-05-311-42/+17
| | | | | | | | | | Instead of adding queues for multiqueue during feature set. This patch did this in .realize(), this will help the following patches that count the number of virtqueues used in .device_plugged() callback. Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio: move VIRTIO_F_NOTIFY_ON_EMPTY into coreCornelia Huck2015-05-314-18/+6
| | | | | | | | | | | | | | Nearly all transports have been offering VIRTIO_F_NOTIFY_ON_EMPTY, s390-virtio being the exception. There's no reason why it shouldn't offer it as well, though (handling is done in core anyway), so let's move it to the common virtio features. While we're changing it anyway, fix the indentation for the DEFINE_VIRTIO_COMMON_FEATURES macro. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio-ccw: Don't advertise VIRTIO_F_BAD_FEATURECornelia Huck2015-05-311-1/+0
| | | | | | | | | | This was copied from virtio-pci, but it doesn't make much sense for ccw, as it doesn't have to handle the broken implementations this bit is supposed to deal with. Remove it. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio: move host_featuresCornelia Huck2015-05-3111-99/+30
| | | | | | | | | | | | | | Move host_features from the individual transport proxies into the virtio device. Transports may continue to add feature bits during device plugging. This should it make easier to offer different sets of host features for virtio-1/transitional support. Tested-by: Shannon Zhao <shannon.zhao@linaro.org> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pc: acpi: fix pvpanic for buggy guestsRadim Krčmář2015-05-311-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the old times, we always had pvpanic in ACPI and a _STA method told the guest not to use it. Automatic generation dropped the _STA method as the specification says that missing _STA means enabled and working. Some guests (Linux) had buggy drivers and this change made them unable to utilize pvpanic. A Linux patch is posted as well, but I think it's worth to make pvpanic useable on old guests at the price of three lines and few bytes of SSDT. The old _STA method was Method (_STA, 0, NotSerialized) { Store (PEST, Local0) If (LEqual (Local0, Zero)) { Return (Zero) } Else { Return (0x0F) }} Igor pointed out that we don't need to use a method to return a constant and that 0xB (don't show in UI) is the common definition now. Also, the device used to be PEVT. (PEVT as in "panic event"?) Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pc: Generate init functions with a macroEduardo Habkost2015-05-312-170/+76
| | | | | | | | | | | | All pc-i440fx and pc-q35 init functions simply call the corresponding compat function and then call the main init function. Use a macro to generate that code. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* piix: Eliminate pc_init_pci()Eduardo Habkost2015-05-311-18/+13
| | | | | | | | | | | The function is not needed anymore, we can simply call pc_init1() directly. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* piix: Add kvmclock_enabled, pci_enabled globalsEduardo Habkost2015-05-311-7/+15
| | | | | | | | | | | | | This looks like a step backwards, but it will allow pc-0.1[0123] and isapc to follow the same compat+init pattern used by the other machine-types, allowing us to generate all init function using the same macro later. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* machine: Remove unused fields from QEMUMachineEduardo Habkost2015-05-312-29/+1
| | | | | | | | | | | | | | | | This removes the following fields from QEMUMachine: family, alias, reset, hot_add_cpu, units_per_default_bus, no_serial, no_parallel, use_virtcon, use_sclp, no_floppy, no_cdrom, default_display, compat_props, and hw_version. The only users of those fields were already converted to use QOM and MachineClass directly, so they are not needed anymore. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pc: Remove qemu_register_pc_machine() functionEduardo Habkost2015-05-312-47/+0
| | | | | | | | | | | The helper is not needed anymore, as the PC machine classes are registered using QOM directly. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pc: Don't use QEMUMachine anymoreEduardo Habkost2015-05-313-39/+47
| | | | | | | | | | | | Now that we have a DEFINE_PC_MACHINE helper macro that just requires an initialization function, it is trivial to convert them to register a QOM machine class directly, instead of using QEMUMachine. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pc: Move compat_props setting inside *_machine_options() functionsEduardo Habkost2015-05-313-36/+65
| | | | | | | | | | | | This will simplify the DEFINE_PC_MACHINE macro, and will help us to implement reuse of PC_COMPAT_* macros through class_init function reuse, in the future. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pc: Convert *_MACHINE_OPTIONS macros into functionsEduardo Habkost2015-05-313-151/+222
| | | | | | | | | | | By now the new functions will get QEMUMachine as argument, but they will be later converted to initialize a MachineClass struct directly. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pc: Define machines using a DEFINE_PC_MACHINE macroEduardo Habkost2015-05-313-301/+103
| | | | | | | | | | | | This will automatically generate the existing QEMUMachine structs based on the *_MACHINE_OPTIONS macros, and automatically add registration code for them. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pc: Define MACHINE_OPTIONS macros consistently for all machinesEduardo Habkost2015-05-312-52/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Define a MACHINE_OPTIONS macro for each PC machine, and move every field inside the QEMUMachine structs to the macros, except for name, init, and compat_props. This also ensures that all MACHINE_OPTIONS inherit the fields from the next version, so their definitions carry only the changes that exist between one version and the next one. Comments about specific cases: pc-*-2.1: Existing PC_*_2_1_MACHINE_OPTIONS macros were defined as: PC_*_MACHINE_OPTIONS, .default_machine_opts = "firmware=bios-256k.bin" PC_*_2_2_MACHINE_OPTIONS is: PC_*_2_3_MACHINE_OPTIONS which is expanded to: PC_*_MACHINE_OPTIONS, .default_machine_opts = "firmware=bios-256k.bin", .default_display = "std" The only difference between 2_1 and 2_2 is .default_display, that's why we didn't reuse PC_*_2_2_MACHINE_OPTIONS. The good news is that having multiple initializers for a field is allowed by C99, and the last initializer overrides the previous ones. So we can reuse the 2_2 macro in 2_1 and define PC_*_2_1_MACHINE_OPTIONS as: PC_*_2_2_MACHINE_OPTIONS, .default_display = NULL pc-*-1.7: PC_*_1_7_MACHINE_OPTIONS was defined as: PC_*_MACHINE_OPTIONS PC_*_2_0_MACHINE_OPTIONS is defined as: PC_*_2_1_MACHINE_OPTIONS which is expanded to: PC_*_2_2_MACHINE_OPTIONS, .default_display = NULL which is expanded to: PC_*_2_3_MACHINE_OPTIONS, .default_display = NULL which is expanded to: PC_*_MACHINE_OPTIONS, .default_machine_opts = "firmware=bios-256k.bin", .default_display = "std", .default_display = NULL /* overrides the previous line */ So, the only difference between PC_*_1_7_MACHINE_OPTIONS and PC_*_2_0_MACHINE_OPTIONS is .default_machine_opts (as .default_display is not explicitly set by PC_*_MACHINE_OPTIONS so it is NULL). So we can keep the macro reuse pattern and define PC_*_2_0_MACHINE_OPTIONS as: PC_*_2_0_MACHINE_OPTIONS, .default_machine_opts = NULL pc-*-2.4 (alias and is_default fields): Set alias and is_default fields inside the 2.4 MACHINE_OPTIONS macro, and clear it in the 2.3 macro (that reuses the 2.4 macro). hw_machine: As all the machines older than v1.0 set hw_version explicitly, we can safely move the field to the MACHINE_OPTIONS macros without affecting the other versions that reuse them. init function: Some machines had the init function set inside the MACHINE_OPTIONS macro. Move it to the QEMUMachine declaration, to keep it consistent with the other machines. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* piix: Define PC_COMPAT_0_10Eduardo Habkost2015-05-311-22/+25
| | | | | | | | | | | Move compat_props from pc-0.10 to the macro, to make it consistent with the other machines. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* piix: Move pc-0.1[23] rombar compat props to PC_COMPAT_0_13Eduardo Habkost2015-05-311-18/+8
| | | | | | | | | | | | | | | | | | | The VGA and vmware-svga rombar compat properties were added by commit 281a26b15b4adcecb8604216738975abd754bea8, but only to pc-0.13 and pc-0.12. This breaks the PC_COMPAT_* nesting pattern we currently follow. The new variables will now be inherited by pc-0.11 and older, but pc-0.11 and pc-0.10 already have PCI.rombar=0 on compat_props, so they shouldn't be affected at all. Cc: Stefan Weil <sw@weilnetz.de> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* piix: Move pc-0.13 virtio-9p-pci compat to PC_COMPAT_0_13Eduardo Habkost2015-05-311-4/+4
| | | | | | | | | | | | | | | | | | | The compat property was added by commit 9dbcca5aa13cb9ab40788ac4c56bc227d94ca920, and the pc-0.12 and older machine-types were not changed because virtio-9p-pci was introduced on QEMU 0.13 (commit 9f10751365b26b13b8a9b67e0e90536ae3d282df). The only problem is that this breaks the PC_COMPAT_* nesting pattern we currently use. So, move the property to PC_COMPAT_0_13. This make pc-0.12 and older inherit it, but that shouldn't be an issue as QEMU 0.12 didn't have virtio-9p-pci. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* piix: Move pc-0.11 drive version compat props to PC_COMPAT_0_11Eduardo Habkost2015-05-311-9/+8
| | | | | | | | | | | | | | | The current code setting ide-drive.ver and scsi-disk.ver on pc-0.11 breaks the PC_COMPAT_* nesting pattern we currently use. As those variables are overwritten in pc-0.10 too, they can be inherited by pc-0.10 with no side-effects at all. Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* piix: Move pc-0.14 qxl compat properties to PC_COMPAT_0_14Eduardo Habkost2015-05-311-9/+8
| | | | | | | | | | | | | | | | | | | Those properties were introduced by commit 3827cdb1c3aa17a792d1658161195b9d7173c26b. They were not duplicated into pc-0.13 and older because 0.14 was the first QEMU version supporting qxl. The only problem is that this breaks the PC_COMPAT_* nesting pattern we currently use. So, move the properties to PC_COMPAT_0_14. This makes pc-0.13 and older inherit them, but that shouldn't be an issue as QEMU 0.13 didn't support qxl. Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* spapr: define SPAPR_COMPAT_2_3Eduardo Habkost2015-05-311-0/+4
| | | | | | | | | | | | Don't add the pseries-2.3 machine yet, but define the corresponding SPAPR_COMPAT macro to make sure both pseries-2.2 and pseries-2.1 will inherit HW_COMPAT_2_3. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* spapr: Use HW_COMPAT_* inside SPAPR_COMPAT_* macrosEduardo Habkost2015-05-311-2/+3
| | | | | | | | | | | | SPAPR_COMPAT_2_1 will need to include both HW_COMPAT_2_2 and HW_COMPAT_2_1, so include HW_COMPAT_2_1 inside SPAPR_COMPAT_2_1 and HW_COMPAT_2_2 inside SPAPR_COMPAT_2_2. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pc: Define PC_COMPAT_2_[123] macrosEduardo Habkost2015-05-313-3/+30
| | | | | | | | | | | | | Once we start adding compat code for pc-2.3, the usage of HW_COMPAT_2_1 in pc-*-2.2 won't be enough, as it also has to include PC_COMPAT_2_3 inside it. To ensure that, define PC_COMPAT_2_3, PC_COMPAT_2_2, and PC_COMPAT_2_1 macros. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* hw: Define empty HW_COMPAT_2_[23] macrosEduardo Habkost2015-05-311-0/+6
| | | | | | | | | | | Now we can make everything consistent and define the macros even if they are still empty. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
OpenPOWER on IntegriCloud