1. 09 3月, 2015 18 次提交
    • D
      vga: Expose framebuffer byteorder as a QOM property · 3c2784fc
      David Gibson 提交于
      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: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      [agraf: use instance_init for property exposure]
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      3c2784fc
    • M
      spapr: Clean up misuse of qdev_init() in xics-kvm creation · 34f2af3d
      Markus Armbruster 提交于
      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: NMarkus Armbruster <armbru@redhat.com>
      [agraf: squash in fix for uninitialized variable from mdroth]
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      34f2af3d
    • M
      PPC: Clean up misuse of qdev_init() in kvm-openpic creation · fe656ebd
      Markus Armbruster 提交于
      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: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      fe656ebd
    • D
      pseries: Export RTC time via QOM · 74e5ae28
      David Gibson 提交于
      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: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      74e5ae28
    • D
      pseries: Move rtc_offset into RTC device's state structure · 880ae7de
      David Gibson 提交于
      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: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      880ae7de
    • D
      pseries: Make the PAPR RTC a qdev device · 28df36a1
      David Gibson 提交于
      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: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      28df36a1
    • D
      pseries: Make RTAS time of day functions respect -rtc options · f01c5d84
      David Gibson 提交于
      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: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      f01c5d84
    • D
      pseries: Add spapr_rtc_read() helper function · e5dad1d7
      David Gibson 提交于
      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: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      e5dad1d7
    • D
      pseries: Add more parameter validation in RTAS time of day functions · bbade206
      David Gibson 提交于
      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: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      bbade206
    • D
      pseries: Move sPAPR RTC code into its own file · 12f42174
      David Gibson 提交于
      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: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      12f42174
    • D
      Add more VMSTATE_*_TEST variants for integers · 87774a4a
      David Gibson 提交于
      Currently, vmstate.h includes helper macro variants for 8, 16 and 32-bit
      unsigned integers which include a "test" function which can selectively
      enable or disable the field's presence in the migration stream.
      
      There aren't similar helpers for 64-bit unsigned integers, or any size of
      signed integers.  This patch remedies this.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      87774a4a
    • D
      Generalize QOM publishing of date and time from mc146818rtc.c · 8e099d14
      David Gibson 提交于
      The mc146818rtc driver exposes the current RTC date and time via the "date"
      property in QOM (which is also aliased to the machine's "rtc-time"
      property).  Currently it uses a custom visitor function rtc_get_date to
      do this.
      
      This patch introduces new helpers to the QOM core to expose struct tm
      valued properties via a getter function, so that this functionality can be
      more easily duplicated in other RTC implementations.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      8e099d14
    • A
      spapr-pci: Enable huge BARs · b194df47
      Alexey Kardashevskiy 提交于
      At the moment sPAPR only supports 512MB window for MMIO BARs. However
      modern devices might want bigger 64bit BARs.
      
      This extends MMIO window from 512MB to 62GB (aligned to
      SPAPR_PCI_WINDOW_SPACING) and advertises it in 2 records in
      the PHB "ranges" property. 32bit gets the space from
      SPAPR_PCI_MEM_WIN_BUS_OFFSET till the end of 4GB, 64bit gets the rest
      of the space. If no space is left, 64bit range is not advertised.
      
      The MMIO space size is set to old value of 0x20000000 by default
      for pseries machines older than 2.3.
      
      The approach changes the device tree which is a guest visible change, however
      it won't break migration as:
      1. we do not support migration to older QEMU versions
      2. migration to newer QEMU will migrate the device tree as well and since
      the new layout only extends the old one and does not change address mappigns,
      no breakage is expected here too.
      
      SLOF change is required to utilize this extension.
      Suggested-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      b194df47
    • A
      spapr: Add pseries-2.3 machine · 3dab0244
      Alexey Kardashevskiy 提交于
      The next patch will make MMIO space bigger and keep the old value for
      older pseries machines.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      3dab0244
    • D
      pseries: Limit PCI host bridge "index" value · 3e4ac968
      David Gibson 提交于
      pseries guests can have large numbers of PCI host bridges.  To avoid the
      user having to specify a number of different configuration values for every
      one, the device supports an "index" property which is a shorthand setting
      the various window and configuration addresses from a predefined sensible
      set.
      
      There are some problems with the details at present:
        * The "index" propery is signed, but negative values will create PCI
      windows below where we expect, potentially colliding with other devices
        * No limit is imposed on the "index" property and large values can
      translate to extremely large window addresses.  With PCI passthrough in
      particular this can mean we exceed various mapping and physical address
      limits causing the guest host bridge to not work in strange ways.
      
      This patch addresses this, by making "index" unsigned, and imposing a
      limit.  Currently the limit allows indices from 0..255 which is probably
      enough host bridges for the time being.  It's fairly easy to extend if
      we discover we need more.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      3e4ac968
    • A
      target-ppc: Use right page size with hash table lookup · ad3e67d0
      Aneesh Kumar K.V 提交于
      We look at two sizes specified in ISA (4K, 64K). If not found matching,
      we consider it 16MB.
      
      Without this patch we would fail to lookup address above 16MB range.
      Below 16MB happened to work before because the kernel have a liner
      mapping and we always looked up hash for 0xc000000000000000. The
      actual real address was computed by using the 16MB offset
      with the real address found with the above hash.
      
      Without Fix:
      (gdb) x/16x 0xc000000001000000
      0xc000000001000000 <list_entries+453208>:       Cannot access memory at address 0xc000000001000000
      (gdb)
      
      With Fix:
      (gdb)  x/16x 0xc000000001000000
      0xc000000001000000 <list_entries+453208>:       0x00000000      0x00000000      0x00000000      0x00000000
      0xc000000001000010 <list_entries+453224>:       0x00000000      0x00000000      0x00000000      0x00000000
      0xc000000001000020 <list_entries+453240>:       0x00000000      0x00000000      0x00000000      0x00000000
      0xc000000001000030 <list_entries+453256>:       0x00000000      0x00000000      0x00000000      0x00000000
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ad3e67d0
    • A
      spapr_vio/spapr_iommu: Move VIO bypass where it belongs · ee9a569a
      Alexey Kardashevskiy 提交于
      Instead of tweaking a TCE table device by adding there a bypass flag,
      let's add an alias to RAM and IOMMU memory region, and enable/disable
      those according to the selected bypass mode.
      This way IOMMU memory region can have size of the actual window rather
      than ram_size which is essential for upcoming DDW support.
      
      This moves bypass logic to VIO layer and keeps @bypass flag in TCE table
      for migration compatibility only. This replaces spapr_tce_set_bypass()
      calls with explicit assignment to avoid confusion as the function could
      do something more that just syncing the @bypass flag.
      
      This adds a pointer to VIO device into the sPAPRTCETable struct to provide
      the sPAPRTCETable device a way to update bypass mode for the VIO device.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ee9a569a
    • P
      Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging · 0048fa6c
      Peter Maydell 提交于
      pci, pc, virtio fixes and cleanups
      
      A bunch of fixes all over the place.
      All of ACPI refactoring has been merged.
      Legacy pci commands have been dropped.
      virtio header cleanup
      initial patches from virtio-1.0 branch
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      
      * remotes/mst/tags/for_upstream: (130 commits)
        acpi: drop unused code
        aml-build: comment fix
        acpi-build: fix typo in comment
        acpi: update generated files
        vhost user:support vhost user nic for non msi guests
        aml-build: fix build for glib < 2.22
        acpi: update generated files
        Makefile.target: binary depends on config-devices
        acpi-test-data: update after pci rewrite
        acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb().
        pci-hotplug-old: Has been dead for five major releases, bury
        pci: Give a few helpers internal linkage
        acpi: make build_*() routines static to aml-build.c
        pc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs
        pc: acpi-build: drop template patching and create PCI bus tree dynamically
        tests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation
        pc: acpi-build: simplify PCI bus tree generation
        tests: add ACPI blobs for qemu with bridge cases
        tests: bios-tables-test: add support for testing bridges
        tests: ACPI test blobs update due to PCI0._CRS changes
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      
      Conflicts:
      	hw/pci/pci-hotplug-old.c
      0048fa6c
  2. 08 3月, 2015 9 次提交
  3. 07 3月, 2015 3 次提交
  4. 05 3月, 2015 5 次提交
  5. 04 3月, 2015 5 次提交