]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agoconfigure: Autogenerate default target list
Peter Maydell [Mon, 20 May 2013 15:16:15 +0000 (16:16 +0100)]
configure: Autogenerate default target list

Autogenerate the default target list based on what files exist
in default-configs; this allows us to remove one of the places
that has to be kept up to date with a complete list of every
target we support.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1369062976-301-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'pmaydell/arm-devs.next' into staging
Anthony Liguori [Mon, 3 Jun 2013 18:24:25 +0000 (13:24 -0500)]
Merge remote-tracking branch 'pmaydell/arm-devs.next' into staging

# By Peter Crosthwaite (20) and others
# Via Peter Maydell
* pmaydell/arm-devs.next: (24 commits)
  i.MX: Improve EPIT timer code.
  exynos4210.c: register rom_mem for memory migration
  hw/arm/exynos4210.c: convert chipid_and_omr to an mmio region
  i.MX: split GPT and EPIT timer implementation
  sd/sd.c: Fix "inquiry" ACMD41
  sd/sdhci:ADMA: fix interrupt
  sd/sdhci.c: Fix bdata_read DPRINT message
  sd/sdhci: Fix Buffer Write Ready interrupt
  sd/sdhci.c: Only reset data_count on new commands
  xilinx_spips: lqspi: Fix byte/misaligned access
  xilinx_spips: lqspi: Push more data to tx-fifo
  xilinx_spips: Multiple debug verbosity levels
  xilinx_spips: Debug msgs for Snoop state
  xilinx_spips: Fix striping behaviour
  xilinx_spips: Fix CTRL register RW bits
  xilinx_spips: lqspi: Dont touch config register
  xilinx_spips: Implement automatic CS
  xilinx_spips: Add automatic start support
  xilinx_spips: Trash LQ page cache on mode change
  xilinx_spips: Fix QSPI FIFO size
  ...

Message-id: 1370277021-26129-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoi.MX: Improve EPIT timer code.
Jean-Christophe DUBOIS [Mon, 3 Jun 2013 16:17:46 +0000 (17:17 +0100)]
i.MX: Improve EPIT timer code.

* Unify function and type naming
* use dynamic cast whenever possible
* simplify Debug printf.
* use new style device intialization.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Reviewed-by: Peter Chubb <peter.chubb@nicta.com.au>
Message-id: 1369839656-24466-1-git-send-email-jcd@tribudubois.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoexynos4210.c: register rom_mem for memory migration
Igor Mitsyanko [Mon, 3 Jun 2013 16:17:46 +0000 (17:17 +0100)]
exynos4210.c: register rom_mem for memory migration

Even if we do not register newly created RAM MemoryRegion for migration with
vmstate_register_ram_global() function, ram_save_setup() still saves this region
to snapshot file with empty idstr=="". Consequently this results in error during
VM loading in ram_load().
Register rom_mem for migration.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Message-id: 1368199981-45292-3-git-send-email-i.mitsyanko@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/arm/exynos4210.c: convert chipid_and_omr to an mmio region
Igor Mitsyanko [Mon, 3 Jun 2013 16:17:46 +0000 (17:17 +0100)]
hw/arm/exynos4210.c: convert chipid_and_omr to an mmio region

Exynos SoC was misusing memory_region_init_ram_ptr(): this interface can safely
be used only for memory regions which size is a multiple of target page size.
Change chipid_and_omr memory to an mmio region to fix this.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Message-id: 1368199981-45292-2-git-send-email-i.mitsyanko@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoi.MX: split GPT and EPIT timer implementation
Jean-Christophe DUBOIS [Mon, 3 Jun 2013 16:17:45 +0000 (17:17 +0100)]
i.MX: split GPT and EPIT timer implementation

There is no common code between these 2 timer implementation.
So it is better to split them.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Message-id: 1368990197-19694-1-git-send-email-jcd@tribudubois.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agosd/sd.c: Fix "inquiry" ACMD41
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:45 +0000 (17:17 +0100)]
sd/sd.c: Fix "inquiry" ACMD41

QEMU models two (of the three) ACMD41 has two modes, "inquiry" and
"first". The selection logic for which of the two is incorrect - it
compares != 0 for the entire argument value rather than only bits 23:0
as per the spec. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 3ef0a7fd1b2f3ebb23b4fdeabcc14caf3fad6d71.1369622254.git.peter.crosthwaite@xilinx.com
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agosd/sdhci:ADMA: fix interrupt
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:45 +0000 (17:17 +0100)]
sd/sdhci:ADMA: fix interrupt

The end of transfer check was occurring and potentially returning before
the interrupt flag was checked. This means the interrupt will be missed
if it occurs on the last packet. Fix by checking for the interrupt
before checking for the end of transfer.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 9969ec154777957ec738fc4e539d68e7494d0081.1369370934.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agosd/sdhci.c: Fix bdata_read DPRINT message
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:45 +0000 (17:17 +0100)]
sd/sdhci.c: Fix bdata_read DPRINT message

This message was printing out the data in decimal only, which is not
very friendly to the debugging developer. Add hex variant in
parenthesis to make it consistent with other similar messages in this
module.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: d624179649137832eaa8caa263ef9589b4395d5e.1369370934.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agosd/sdhci: Fix Buffer Write Ready interrupt
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:44 +0000 (17:17 +0100)]
sd/sdhci: Fix Buffer Write Ready interrupt

This interrupt is not risen after the last block is written to sd. It
is mutually exclusive with the end of transfer conditions. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 7ca9fd3e03ce1bec94aff08f607c15a0ec3d3371.1369370934.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agosd/sdhci.c: Only reset data_count on new commands
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:44 +0000 (17:17 +0100)]
sd/sdhci.c: Only reset data_count on new commands

The data_count variable was being reset on every transfer, including
DMA transfer resumptions. This is incorrect, it should only be set
on a new command.

Manifests as a bug when using ADMA and there is a timer delay between
ADMA frames where the fifo is left in a non empty state.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 15a98609cc32315211b0963091a8efd67522e160.1369370934.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: lqspi: Fix byte/misaligned access
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:44 +0000 (17:17 +0100)]
xilinx_spips: lqspi: Fix byte/misaligned access

The LQSPI bus attachment supports byte/halfword and misaligned
accesses. Fixed. Refactored the LQSPI cache to be byte-wise
instead of word wise accordingly.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 5ec47b13563ad2d22105a1f26186d7756718394b.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: lqspi: Push more data to tx-fifo
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:44 +0000 (17:17 +0100)]
xilinx_spips: lqspi: Push more data to tx-fifo

Do 16 words per fifo flush. Increases performance and decreases
debug verbosity. This data depth has no real hardware analogue,
so just go with something that has reasonable performance.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 5621ee4621941d3639b5cacfdec26bd3148f31d5.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Multiple debug verbosity levels
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:43 +0000 (17:17 +0100)]
xilinx_spips: Multiple debug verbosity levels

The debug printfs on every SPI operation is extremely verbose. Add
a second level of debug for this.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: f63478b8e5b29cc011cdc10e29f8537bb2fc2b5e.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Debug msgs for Snoop state
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:43 +0000 (17:17 +0100)]
xilinx_spips: Debug msgs for Snoop state

This is worth keeping track of when debugging the device model.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: d3b44ecf23d671798b062eee5dc362c716ea54cd.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Fix striping behaviour
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:43 +0000 (17:17 +0100)]
xilinx_spips: Fix striping behaviour

The QSPI controller was using byte-wide stripes when striping across
the two flashes in dual parallel mode. The real hardware however uses
individual bit striping. QEMU misbehaves in the (corner) case where
data is written/read in dual-parallel mode and read/written back in
single mode.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 718a61df1bf746ec06f6da44d12f8317af7b08ce.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Fix CTRL register RW bits
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:43 +0000 (17:17 +0100)]
xilinx_spips: Fix CTRL register RW bits

The CTRL register was RAZ/WI on some of the RW bits. Even though the
function behind these bits is invalid in QEMU, they should still be
guest accessible. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: b7aaad93163ce4af0c428635804ac7b77a567b25.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: lqspi: Dont touch config register
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:43 +0000 (17:17 +0100)]
xilinx_spips: lqspi: Dont touch config register

The LQSPI mode is supposed to work via the automatic CS mode feature
rather than manipulate CS lines itself. Now that auto CS is implemented
remove LQSPIs CS mode override logic. There is still a need to
manipulate the U_PAGE bit in LQSPI config register to implement
dual-stack mode however.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 000c8dd54df09523f17052638100722ef0f5a3af.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Implement automatic CS
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:42 +0000 (17:17 +0100)]
xilinx_spips: Implement automatic CS

Implement the automatic CS control feature. If the MANUAL_CS bit is
cleared then the chip select stay de-asserted as long as the tx FIFO
is empty.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 1d67383adc42761af715a93f161344b9284dfc9a.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Add automatic start support
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:42 +0000 (17:17 +0100)]
xilinx_spips: Add automatic start support

SPI has a mode where it automatically starts based on tx fifo
occupancy. Implemented.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: f4e9accb5de87b526fff6ed937f63278db76533b.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Trash LQ page cache on mode change
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:42 +0000 (17:17 +0100)]
xilinx_spips: Trash LQ page cache on mode change

Invalidate the LQSPI cached page when transitioning into LQSPI mode.
Otherwise there is a possibility that the controller will return stale
data to the guest when transitioning back to LQ_MODE after a page
program.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 677490a6ee1953fe5d366e599d665de645ac84db.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Fix QSPI FIFO size
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:42 +0000 (17:17 +0100)]
xilinx_spips: Fix QSPI FIFO size

QSPI has a bigger FIFO than the regular SPI controller. Differentiate
between the two with correct FIFO sizes for each.

This is the first piece of class data for SPIPS, so this patch sees
the creation of the XilinxSPIPSClass definition and assoicated QOM
constructs.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: acee25dd5e203215cbc15ca5d3cb5d5b2efebe7b.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Add verbose LQSPI debug output
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:41 +0000 (17:17 +0100)]
xilinx_spips: Add verbose LQSPI debug output

You really need this is you want to track a guest banging on LQSPI.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 26e508da4af11058d37daa777064c9e5c2a69abb.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Inhibit interrupts in LQSPI mode
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:41 +0000 (17:17 +0100)]
xilinx_spips: Inhibit interrupts in LQSPI mode

The real hardware does not produce interrupts in LQSPI mode. Inhibit
generation of interrupts when the LQ_MODE bit is set.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: dff794a06872009ea7e5733ce6adcff94d18bbd0.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: Make interrupts clear on read
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:41 +0000 (17:17 +0100)]
xilinx_spips: Make interrupts clear on read

By default these interrupts are clear on read.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 999ff0091ed3cc3969a431bf55c00ef934cecc8e.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoxilinx_spips: seperate SPI and QSPI as two classes
Peter Crosthwaite [Mon, 3 Jun 2013 16:17:41 +0000 (17:17 +0100)]
xilinx_spips: seperate SPI and QSPI as two classes

Make SPI and QSPI different classes. QSPIPS is setup as a child of SPIPS.
Only QSPI has the LQSPI functionality, so move all that to the child class.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 2cdd0cadb5ba77ca02fde5cae627852dc9a64c71.1369117359.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agopo/hu.po: Hungarian translation for the GTK+ interface
Ákos Kovács [Mon, 6 May 2013 17:14:52 +0000 (19:14 +0200)]
po/hu.po: Hungarian translation for the GTK+ interface

Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ákos Kovács <akoskovacs@gmx.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1367860492-3357-1-git-send-email-akoskovacs@gmx.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/usb.83' into staging
Anthony Liguori [Mon, 3 Jun 2013 13:37:54 +0000 (08:37 -0500)]
Merge remote-tracking branch 'kraxel/usb.83' into staging

# By Gerd Hoffmann (5) and others
# Via Gerd Hoffmann
* kraxel/usb.83:
  xhci: add live migration support
  xhci: add xhci_init_epctx
  xhci: add xhci_alloc_epctx
  xhci: add XHCISlot->addressed
  pci: add VMSTATE_MSIX
  host-libusb: Correct test for USB packet state
  Fix usage of USB_DEV_FLAG_IS_HOST flag.

Message-id: 1370253951-12323-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Mon, 3 Jun 2013 13:37:44 +0000 (08:37 -0500)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

# By Ed Maste (3) and others
# Via Michael Tokarev
* mjt/trivial-patches:
  do not check pointers after dereferencing them
  m25p80: Add Micron n25q032a
  qemu: fix out of tree cross compile
  slirp: cleanup leftovers from misc.h
  migration: Remove duplicate bandwidth_limit set
  docs: Fix typo and update file in migration
  configure: try pkg-config ncurses first
  rtc: remove rtc_set_date
  linux-user: Fix typo in comment
  configure: remove confusing file manipulation
  debugcon: fix compiler warning when open DEBUG_DEBUGCON
  debugcon: make debug message more readable
  debugcon: fix always print "addr=0x0, val=0x0" bug when use DEBUG_DEBUGCON
  Remove unnecessary break statements
  don't run pkg-config for features explicitly disabled

Message-id: 51A9CCFB.1000109@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoxhci: add live migration support
Gerd Hoffmann [Thu, 21 Mar 2013 09:55:35 +0000 (10:55 +0100)]
xhci: add live migration support

With all preparing pieces in place we can finally drop in
the vmstate structs and the postload function.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: add xhci_init_epctx
Gerd Hoffmann [Wed, 24 Apr 2013 08:11:22 +0000 (10:11 +0200)]
xhci: add xhci_init_epctx

Factor out endpoint context initialization to a separate function.
xhci live migration will need that too, in post_load.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: add xhci_alloc_epctx
Gerd Hoffmann [Wed, 24 Apr 2013 07:33:35 +0000 (09:33 +0200)]
xhci: add xhci_alloc_epctx

Factor out endpoint context allocation to a separate function.
xhci live migration will need that too, in post_load.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: add XHCISlot->addressed
Gerd Hoffmann [Fri, 5 Apr 2013 10:37:32 +0000 (12:37 +0200)]
xhci: add XHCISlot->addressed

Preparing for live-migration support, post_load will need that.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopci: add VMSTATE_MSIX
Gerd Hoffmann [Tue, 7 May 2013 13:16:58 +0000 (15:16 +0200)]
pci: add VMSTATE_MSIX

Using a trick cut+pasted from vmstate_scsi_device
to wind up msix_save and msix_load.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
11 years agohost-libusb: Correct test for USB packet state
Ed Maste [Tue, 7 May 2013 14:06:12 +0000 (10:06 -0400)]
host-libusb: Correct test for USB packet state

USB_RET_ASYNC is -6, so inflight was always false.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoFix usage of USB_DEV_FLAG_IS_HOST flag.
Michael Marineau [Sun, 12 May 2013 23:19:37 +0000 (19:19 -0400)]
Fix usage of USB_DEV_FLAG_IS_HOST flag.

USB_DEV_FLAG_IS_HOST is the bit number, not value. Booting with a
"Fitbit Base Station" USB dongle was triggering this assert.

Signed-off-by: Michael Marineau <mike@marineau.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agotcx: Fix 24-bit display mode
Mark Cave-Ayland [Sun, 2 Jun 2013 16:23:00 +0000 (17:23 +0100)]
tcx: Fix 24-bit display mode

Commit d08151bf (conversion of tcx to the memory API) broke the 24-bit mode of
the tcx display adapter by accidentally passing in the final address of the
dirty region to memory_region_reset_dirty() instead of its size.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agodo not check pointers after dereferencing them
Paolo Bonzini [Fri, 31 May 2013 12:00:27 +0000 (14:00 +0200)]
do not check pointers after dereferencing them

Two instances, both spotted by Coverity.  In one, two blocks were
swapped.  In the other, the check is not needed anymore.

Cc: qemu-stable@nongnu.org
Cc: qemu-trivial@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agom25p80: Add Micron n25q032a
Ed Maste [Wed, 29 May 2013 13:58:29 +0000 (09:58 -0400)]
m25p80: Add Micron n25q032a

Based on the datasheet at
http://www.micron.com/~/media/Documents/Products/Data%20Sheet/NOR%20Flash/Serial%20NOR/N25Q/n25q_32mb_1_8v_65nm.pdf

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agoqemu: fix out of tree cross compile
Alexey Kardashevskiy [Wed, 29 May 2013 13:30:43 +0000 (23:30 +1000)]
qemu: fix out of tree cross compile

The symlink to "asm" platform linux headers is made in the build tree by
the configure script but gcc is not told to look for them there.

The patch fixes this.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agoslirp: cleanup leftovers from misc.h
Michael Tokarev [Mon, 27 May 2013 20:46:10 +0000 (00:46 +0400)]
slirp: cleanup leftovers from misc.h

There are quite a few leftover declarations in slirp/misc.h.
Remove them.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agomigration: Remove duplicate bandwidth_limit set
Lei Li [Mon, 27 May 2013 10:33:02 +0000 (18:33 +0800)]
migration: Remove duplicate bandwidth_limit set

bandwidth_limit is double set in migrate_init(), remove one.

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agodocs: Fix typo and update file in migration
Lei Li [Mon, 27 May 2013 10:33:01 +0000 (18:33 +0800)]
docs: Fix typo and update file in migration

This patch fix some typo and update the file that already
moved.

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agoconfigure: try pkg-config ncurses first
Ed Maste [Fri, 24 May 2013 20:07:00 +0000 (16:07 -0400)]
configure: try pkg-config ncurses first

When probing for ncurses, try pkg-config first rather than after
explicit -lncurses and -lcurses.  This fixes static linking in the case
that ncurses has additional dependencies, such as -ltinfo (as on FreeBSD).

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agortc: remove rtc_set_date
Hu Tao [Wed, 22 May 2013 05:33:12 +0000 (13:33 +0800)]
rtc: remove rtc_set_date

Since it's not defined and used anywhere.

Cc: qemu-trivial@nongnu.org
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agolinux-user: Fix typo in comment
Lei Li [Mon, 20 May 2013 09:20:50 +0000 (17:20 +0800)]
linux-user: Fix typo in comment

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agoconfigure: remove confusing file manipulation
Ed Maste [Wed, 22 May 2013 13:21:39 +0000 (09:21 -0400)]
configure: remove confusing file manipulation

The configure script had some code to manipulate config-host.ld~ (i.e.,
a common backup filename), comparing it with the newly-generated file.
I believe the sense of the comparison was backwards.

Since it seemed to serve little purpose anyway, remove it to avoid any
confusion.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agodebugcon: fix compiler warning when open DEBUG_DEBUGCON
liguang [Fri, 24 May 2013 02:47:33 +0000 (10:47 +0800)]
debugcon: fix compiler warning when open DEBUG_DEBUGCON

compiler warnings:
  CC    hw/char/debugcon.o
hw/char/debugcon.c: In function ‘debugcon_ioport_write’:
hw/char/debugcon.c:58: warning: format ‘%02x’ expects type ‘unsigned int’, but argument 3 has type ‘uint64_t’
hw/char/debugcon.c: In function ‘debugcon_ioport_read’:
hw/char/debugcon.c:70: warning: format ‘%04x’ expects type ‘unsigned int’, but argument 2 has type ‘hwaddr’

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agodebugcon: make debug message more readable
liguang [Fri, 24 May 2013 02:47:32 +0000 (10:47 +0800)]
debugcon: make debug message more readable

before change:
Bdebugcon: write addr=0x0000 val=0x6f
odebugcon: write addr=0x0000 val=0x6f
odebugcon: write addr=0x0000 val=0x74
tdebugcon: write addr=0x0000 val=0x69
idebugcon: write addr=0x0000 val=0x6e
ndebugcon: write addr=0x0000 val=0x67
gdebugcon: write addr=0x0000 val=0x20
 debugcon: write addr=0x0000 val=0x66

after change:
B [debugcon: write addr=0x0000 val=0x6f]
o [debugcon: write addr=0x0000 val=0x6f]
o [debugcon: write addr=0x0000 val=0x74]
t [debugcon: write addr=0x0000 val=0x69]
i [debugcon: write addr=0x0000 val=0x6e]
n [debugcon: write addr=0x0000 val=0x67]
g [debugcon: write addr=0x0000 val=0x20]
  [debugcon: write addr=0x0000 val=0x66]

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agodebugcon: fix always print "addr=0x0, val=0x0" bug when use DEBUG_DEBUGCON
liguang [Fri, 24 May 2013 02:47:31 +0000 (10:47 +0800)]
debugcon: fix always print "addr=0x0, val=0x0" bug when use DEBUG_DEBUGCON

when use DEBUG_DEBUGCON, screen spits:
debugcon: write addr=0x0000 val=0x00
Rdebugcon: write addr=0x0000 val=0x00
udebugcon: write addr=0x0000 val=0x00
ndebugcon: write addr=0x0000 val=0x00
ndebugcon: write addr=0x0000 val=0x00
idebugcon: write addr=0x0000 val=0x00
ndebugcon: write addr=0x0000 val=0x00
gdebugcon: write addr=0x0000 val=0x00
 debugcon: write addr=0x0000 val=0x00
odebugcon: write addr=0x0000 val=0x00
pdebugcon: write addr=0x0000 val=0x00
tdebugcon: write addr=0x0000 val=0x00
idebugcon: write addr=0x0000 val=0x00
odebugcon: write addr=0x0000 val=0x00
ndebugcon: write addr=0x0000 val=0x00
 debugcon: write addr=0x0000 val=0x00
rdebugcon: write addr=0x0000 val=0x00
odebugcon: write addr=0x0000 val=0x00
mdebugcon: write addr=0x0000 val=0x00
 debugcon: write addr=0x0000 val=0x00
adebugcon: write addr=0x0000 val=0x00
tdebugcon: write addr=0x0000 val=0x00
 debugcon: write addr=0x0000 val=0x00

Oh, that's wrong, val is not always be 0.
this bug caused by lack of length modifier
for specifier 'x'.

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agoRemove unnecessary break statements
Stefan Weil [Fri, 24 May 2013 10:19:25 +0000 (12:19 +0200)]
Remove unnecessary break statements

Fix these warnings from cppcheck:

hw/display/cirrus_vga.c:2603:
hw/sd/sd.c:348:
hw/timer/exynos4210_mct.c:1033:
target-arm/translate.c:9886:
target-s390x/mem_helper.c:518:
target-unicore32/translate.c:1936:
 style: Consecutive return, break, continue, goto or throw statements are unnecessary.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agodon't run pkg-config for features explicitly disabled
Michael Tokarev [Sat, 25 May 2013 09:17:21 +0000 (13:17 +0400)]
don't run pkg-config for features explicitly disabled

We test pkg-config for curses and curl even if those are explicitly
disabled.  Move these tests inside `if "$feature" != "no"' sections.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agotarget-i386: Fix aflag logic for CODE64 and the 0x67 prefix
Richard Henderson [Wed, 29 May 2013 19:30:51 +0000 (12:30 -0700)]
target-i386: Fix aflag logic for CODE64 and the 0x67 prefix

The code reorganization in commit 4a6fd938 broke handling of PREFIX_ADR.
While fixing this, tidy and comment the code so that it's more obvious
what's going on in setting both aflag and dflag.

The TARGET_X86_64 ifdef can be eliminated because CODE64 expands to the
constant zero when TARGET_X86_64 is undefined.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1369855851-21400-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agos390/ipl: Fix spurious errors in virtio
Christian Borntraeger [Thu, 23 May 2013 11:51:41 +0000 (13:51 +0200)]
s390/ipl: Fix spurious errors in virtio

With the ccw ipl code sometimes an error message like
"virtio: trying to map MMIO memory" or
"Guest moved used index from %u to %u" appeared. Turns out
that the ccw bios did not zero out the vring, which might
cause stale values in avail->idx and friends, especially
on reboot.

Lets zero out the relevant fields. To activate the patch we
need to rebuild s390-ccw.img as well.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-id: 1369309901-418-1-git-send-email-borntraeger@de.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mdroth/qga-pull-2013-05-30' into staging
Anthony Liguori [Fri, 31 May 2013 16:33:02 +0000 (11:33 -0500)]
Merge remote-tracking branch 'mdroth/qga-pull-2013-05-30' into staging

# By Laszlo Ersek
# Via Michael Roth
* mdroth/qga-pull-2013-05-30:
  Makefile: create ".../var/run" when installing the POSIX guest agent
  qga: save state directory in ga_install_service()
  qga: remove undefined behavior in ga_install_service()
  qga: create state directory on win32
  configure: don't save any fixed local_statedir for win32
  qga: determine default state dir and pidfile dynamically
  osdep: add qemu_get_local_state_pathname()

Message-id: 1369940341-9043-1-git-send-email-mdroth@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Fri, 31 May 2013 16:32:32 +0000 (11:32 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Luiz Capitulino (1) and others
# Via Luiz Capitulino
* luiz/queue/qmp:
  target-i386: Fix mask of pte index in memory mapping
  target-i386: fix abort on bad PML4E/PDPTE/PDE/PTE addresses
  qapi: pad GenericList value fields to 64 bits

Message-id: 1370009905-4255-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'bonzini/iommu-for-anthony' into staging
Anthony Liguori [Fri, 31 May 2013 16:32:25 +0000 (11:32 -0500)]
Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging

# By Paolo Bonzini
# Via Paolo Bonzini
* bonzini/iommu-for-anthony: (22 commits)
  memory: add return value to address_space_rw/read/write
  memory: propagate errors on I/O dispatch
  exec: just use io_mem_read/io_mem_write for 8-byte I/O accesses
  memory: correctly handle endian-swapped 64-bit accesses
  memory: split accesses even when the old MMIO callbacks are used
  memory: add big endian support to access_with_adjusted_size
  memory: accept mismatching sizes in memory_region_access_valid
  memory: add address_space_access_valid
  exec: implement .valid.accepts for subpages
  memory: export memory_region_access_valid to exec.c
  exec: introduce memory_access_size
  exec: introduce memory_access_is_direct
  exec: expect mr->ops to be initialized for ROM
  memory: assign MemoryRegionOps to all regions
  memory: move unassigned_mem_ops to memory.c
  memory: add address_space_translate
  memory: dispatch unassigned accesses based on .valid.accepts
  exec: do not use error_mem_read
  exec: make io_mem_unassigned private
  cputlb: simplify tlb_set_page
  ...

Message-id: 1369947836-2638-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-i386: Fix mask of pte index in memory mapping
Qiao Nuohan [Thu, 30 May 2013 15:07:54 +0000 (17:07 +0200)]
target-i386: Fix mask of pte index in memory mapping

Function walk_pte() needs pte index to calculate virtual address.
However, pte index of PAE paging or IA-32e paging is 9 bit, so the mask
should be 0x1ff.

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agotarget-i386: fix abort on bad PML4E/PDPTE/PDE/PTE addresses
Luiz Capitulino [Tue, 28 May 2013 18:19:22 +0000 (14:19 -0400)]
target-i386: fix abort on bad PML4E/PDPTE/PDE/PTE addresses

The code used to walk IA-32e page-tables, and possibly PAE page-tables,
uses the bit mask ~0xfff to get the next PML4E/PDPTE/PDE/PTE address.

However, as we use a uint64_t to store the resulting address, that mask
gets expanded to 0xfffffffffffff000 which not only ends up selecting
reserved bits but also selects the XD bit (execute-disable) which
happens to be enabled by Windows 8, causing qemu_get_ram_ptr() to abort.

This commit fixes that problem by replacing ~0xfff by a correct mask
that only selects the address bit range (ie. bits 51:12).

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agoseccomp: add the asynchronous I/O syscalls to the whitelist
Paul Moore [Wed, 29 May 2013 20:30:01 +0000 (16:30 -0400)]
seccomp: add the asynchronous I/O syscalls to the whitelist

In order to enable the asynchronous I/O functionality when using the
seccomp sandbox we need to add the associated syscalls to the
whitelist.

Signed-off-by: Paul Moore <pmoore@redhat.com>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Message-id: 20130529203001.20939.83322.stgit@localhost
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agogdbstub: do not restart crashed guest
Paolo Bonzini [Thu, 30 May 2013 11:20:40 +0000 (13:20 +0200)]
gdbstub: do not restart crashed guest

If a guest has crashed with an internal error or similar, detaching
gdb (or any other debugger action) should not restart it.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1369912840-18577-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: fix get_fw_dev_path to support to add nothing to fw_dev_path
Amos Kong [Wed, 29 May 2013 07:56:42 +0000 (15:56 +0800)]
qdev: fix get_fw_dev_path to support to add nothing to fw_dev_path

Recent virtio refactoring in QEMU made virtio-bus become the parent bus
of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation,
typename will be added to fw_dev_path by default, the new fw_dev_path
could not be identified by seabios. It causes that bootindex parameter
of scsi device doesn't work.

This patch implements get_fw_dev_path() in BusClass, it will be called
if bus doesn't implement the method, tyename will be added to
fw_dev_path. If the implemented method returns NULL, nothing will be
added to fw_dev_path.

It also implements virtio_bus_get_fw_dev_path() to return NULL. Then
QEMU will still pass original style of fw_dev_path to seabios.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1369814202-10346-1-git-send-email-akong@redhat.com
--
v2: only add nothing to fw_dev_path when get_fw_dev_path() is
    implemented and returns NULL. then it will not effect other devices
    don't have get_fw_dev_path() implementation.
v3: implement default get_fw_dev_path() in BusClass
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMakefile: create ".../var/run" when installing the POSIX guest agent
Laszlo Ersek [Sat, 18 May 2013 05:13:14 +0000 (07:13 +0200)]
Makefile: create ".../var/run" when installing the POSIX guest agent

Otherwise the default local state directory of POSIX qga won't exist after
installation with a non-standard ${prefix} or DESTDIR.

For now qga is the only user of ".../var" (= $qemu_localstatedir) too, so
don't create that directory either unless we're installing the agent.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqga: save state directory in ga_install_service()
Laszlo Ersek [Sat, 18 May 2013 04:31:53 +0000 (06:31 +0200)]
qga: save state directory in ga_install_service()

If the user selects a non-default state directory at service installation
time, we should remember it in the registered service.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqga: remove undefined behavior in ga_install_service()
Laszlo Ersek [Sat, 18 May 2013 04:31:52 +0000 (06:31 +0200)]
qga: remove undefined behavior in ga_install_service()

We shouldn't snprintf() from a buffer to the same buffer.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqga: create state directory on win32
Laszlo Ersek [Sat, 18 May 2013 04:31:51 +0000 (06:31 +0200)]
qga: create state directory on win32

On Win32 the local state directory is application specific and users might
expect qemu-ga to create it automatically.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoconfigure: don't save any fixed local_statedir for win32
Laszlo Ersek [Sat, 18 May 2013 04:31:50 +0000 (06:31 +0200)]
configure: don't save any fixed local_statedir for win32

... because now we can get the dynamic value with
qemu_get_local_state_pathname().

The only user of the fixed value was the guest agent, which we've moved to
qemu_get_local_state_pathname() in the previous patch.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqga: determine default state dir and pidfile dynamically
Laszlo Ersek [Sat, 18 May 2013 04:31:49 +0000 (06:31 +0200)]
qga: determine default state dir and pidfile dynamically

No effective change on POSIX, but on Win32 the defaults come from the
environment / session.

Since commit 39097daf ("qemu-ga: use key-value store to avoid recycling fd
handles after restart") we've relied on the state directory for the fd
handles' key-value store. Even though we don't support the guest-file-*
commands on win32 yet, the key-value store is written, and it's the first
use of the state directory on win32. We should have a sensible default for
its location.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoosdep: add qemu_get_local_state_pathname()
Laszlo Ersek [Sat, 18 May 2013 04:31:48 +0000 (06:31 +0200)]
osdep: add qemu_get_local_state_pathname()

This function returns ${prefix}/var/RELATIVE_PATHNAME on POSIX-y systems,
and <CSIDL_COMMON_APPDATA>/RELATIVE_PATHNAME on Win32.

http://msdn.microsoft.com/en-us/library/bb762494.aspx

  [...] This folder is used for application data that is not user
  specific. For example, an application can store a spell-check
  dictionary, a database of clip art, or a log file in the
  CSIDL_COMMON_APPDATA folder. [...]

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
11 years agoqapi: pad GenericList value fields to 64 bits
Michael Roth [Mon, 27 May 2013 03:20:58 +0000 (22:20 -0500)]
qapi: pad GenericList value fields to 64 bits

With the introduction of native list types, we now have types such as
int64List where the 'value' field is not a pointer, but the actual
64-bit value.

On 32-bit architectures, this can lead to situations where 'next' field
offset in GenericList does not correspond to the 'next' field in the
types that we cast to GenericList when using the visit_next_list()
interface, causing issues when we attempt to traverse linked list
structures of these types.

To fix this, pad the 'value' field of GenericList and other
schema-defined/native *List types out to 64-bits.

This is less memory-efficient for 32-bit architectures, but allows us to
continue to rely on list-handling interfaces that target GenericList to
simply visitor implementations.

In the future we can improve efficiency by defaulting to using native C
array backends to handle list of non-pointer types, which would be more
memory efficient in itself and allow us to roll back this change.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agomemory: add return value to address_space_rw/read/write
Paolo Bonzini [Tue, 21 May 2013 07:56:55 +0000 (09:56 +0200)]
memory: add return value to address_space_rw/read/write

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: propagate errors on I/O dispatch
Paolo Bonzini [Fri, 24 May 2013 14:10:39 +0000 (16:10 +0200)]
memory: propagate errors on I/O dispatch

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoexec: just use io_mem_read/io_mem_write for 8-byte I/O accesses
Paolo Bonzini [Fri, 24 May 2013 10:40:43 +0000 (12:40 +0200)]
exec: just use io_mem_read/io_mem_write for 8-byte I/O accesses

The memory API is able to split it in two 4-byte accesses.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: correctly handle endian-swapped 64-bit accesses
Paolo Bonzini [Fri, 24 May 2013 15:58:37 +0000 (17:58 +0200)]
memory: correctly handle endian-swapped 64-bit accesses

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: split accesses even when the old MMIO callbacks are used
Paolo Bonzini [Fri, 24 May 2013 15:45:48 +0000 (17:45 +0200)]
memory: split accesses even when the old MMIO callbacks are used

This is useful for 64-bit memory accesses.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: add big endian support to access_with_adjusted_size
Paolo Bonzini [Fri, 24 May 2013 10:54:01 +0000 (12:54 +0200)]
memory: add big endian support to access_with_adjusted_size

This will be used to split 8-byte access down to two four-byte accesses.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: accept mismatching sizes in memory_region_access_valid
Paolo Bonzini [Fri, 24 May 2013 15:48:52 +0000 (17:48 +0200)]
memory: accept mismatching sizes in memory_region_access_valid

The memory API is able to use smaller/wider accesses than requested,
match that in memory_region_access_valid.  Of course, the accepts
callback is still free to reject those accesses.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: add address_space_access_valid
Paolo Bonzini [Thu, 11 Apr 2013 13:40:59 +0000 (15:40 +0200)]
memory: add address_space_access_valid

The old-style IOMMU lets you check whether an access is valid in a
given DMAContext.  There is no equivalent for AddressSpace in the
memory API, implement it with a lookup of the dispatch tree.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoexec: implement .valid.accepts for subpages
Paolo Bonzini [Fri, 24 May 2013 12:02:39 +0000 (14:02 +0200)]
exec: implement .valid.accepts for subpages

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: export memory_region_access_valid to exec.c
Paolo Bonzini [Fri, 24 May 2013 09:55:06 +0000 (11:55 +0200)]
memory: export memory_region_access_valid to exec.c

We'll use it to implement address_space_access_valid.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoexec: introduce memory_access_size
Paolo Bonzini [Fri, 24 May 2013 09:59:43 +0000 (11:59 +0200)]
exec: introduce memory_access_size

This will be used by address_space_access_valid too.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoexec: introduce memory_access_is_direct
Paolo Bonzini [Fri, 24 May 2013 10:29:54 +0000 (12:29 +0200)]
exec: introduce memory_access_is_direct

After the previous patches, this is a common test for all read/write
functions.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoexec: expect mr->ops to be initialized for ROM
Paolo Bonzini [Fri, 24 May 2013 11:21:01 +0000 (13:21 +0200)]
exec: expect mr->ops to be initialized for ROM

There is no need to use the special phys_section_rom section.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: assign MemoryRegionOps to all regions
Paolo Bonzini [Fri, 24 May 2013 11:55:52 +0000 (13:55 +0200)]
memory: assign MemoryRegionOps to all regions

This allows to remove the checks on section->readonly.  Simply,
write accesses to ROM will not be considered "direct" and will
go through mr->ops without any special intervention.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: move unassigned_mem_ops to memory.c
Paolo Bonzini [Fri, 24 May 2013 11:23:38 +0000 (13:23 +0200)]
memory: move unassigned_mem_ops to memory.c

reservation_ops is already doing the same thing.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: add address_space_translate
Paolo Bonzini [Fri, 24 May 2013 10:59:37 +0000 (12:59 +0200)]
memory: add address_space_translate

Using phys_page_find to translate an AddressSpace to a MemoryRegionSection
is unwieldy.  It requires to pass the page index rather than the address,
and later memory_region_section_addr has to be called.  Replace
memory_region_section_addr with a function that does all of it: call
phys_page_find, compute the offset within the region, and check how
big the current mapping is.  This way, a large flat region can be written
with a single lookup rather than a page at a time.

address_space_translate will also provide a single point where IOMMU
forwarding is implemented.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomemory: dispatch unassigned accesses based on .valid.accepts
Paolo Bonzini [Fri, 24 May 2013 12:48:38 +0000 (14:48 +0200)]
memory: dispatch unassigned accesses based on .valid.accepts

This provides the basics for detecting accesses to unassigned memory
as soon as they happen, and also for a simple implementation of
address_space_access_valid.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoexec: do not use error_mem_read
Paolo Bonzini [Fri, 24 May 2013 12:39:13 +0000 (14:39 +0200)]
exec: do not use error_mem_read

We will soon reach this case when doing (unaligned) accesses that
span partly past the end of memory.  We do not want to crash in
that case.

unassigned_mem_ops and rom_mem_ops are now the same.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoexec: make io_mem_unassigned private
Paolo Bonzini [Fri, 24 May 2013 12:37:28 +0000 (14:37 +0200)]
exec: make io_mem_unassigned private

There is no reason to avoid a recompile before accessing unassigned
memory.  In the end it will be treated as MMIO anyway.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agocputlb: simplify tlb_set_page
Paolo Bonzini [Fri, 24 May 2013 14:45:30 +0000 (16:45 +0200)]
cputlb: simplify tlb_set_page

The same "if" condition is repeated twice.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoexec: drop useless #if
Paolo Bonzini [Fri, 24 May 2013 15:14:05 +0000 (17:14 +0200)]
exec: drop useless #if

This code is only compiled for softmmu targets.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoexec: eliminate io_mem_ram
Paolo Bonzini [Fri, 24 May 2013 12:34:08 +0000 (14:34 +0200)]
exec: eliminate io_mem_ram

It is never used, the IOTLB always goes through io_mem_notdirty.

In fact in softmmu_template.h, if it were, QEMU would crash just
below the tests, as soon as io_mem_read/write dispatches to
error_mem_read/write.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agovirtio-pci: drop unused wmb macro
Michael S. Tsirkin [Tue, 28 May 2013 10:20:23 +0000 (13:20 +0300)]
virtio-pci: drop unused wmb macro

The implementation is wrong for kvm, and it's unused anyway.
Drop it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20130528102023.GA30055@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotests: set MALLOC_PERTURB_ to expose memory bugs
Stefan Hajnoczi [Mon, 27 May 2013 13:28:51 +0000 (15:28 +0200)]
tests: set MALLOC_PERTURB_ to expose memory bugs

glibc wipes malloc(3) memory when the MALLOC_PERTURB_ environment
variable is set.  The value of the environment variable determines the
bit pattern used to wipe memory.  For more information, see
http://udrepper.livejournal.com/11429.html.

Set MALLOC_PERTURB_ for gtester and qemu-iotests.  Note we pick a random
value from 1 to 255 to expose more bugs.  If you need to reproduce a
crash use 'show environment' in gdb to extract the MALLOC_PERTURB_
value from a core dump.

Both make check and qemu-iotests pass with MALLOC_PERTURB_ enabled.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1369661331-28041-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc_sysfw: allow flash (-pflash) memory to be used with KVM
Jordan Justen [Wed, 29 May 2013 08:27:27 +0000 (01:27 -0700)]
pc_sysfw: allow flash (-pflash) memory to be used with KVM

When pc-sysfw.rom_only == 0, flash memory will be
usable with kvm. In order to enable flash memory mode,
a pflash device must be created. (For example, by
using the -pflash command line parameter.)

Usage of a flash memory device with kvm requires
KVM_CAP_READONLY_MEM, and kvm will abort if
a flash device is used with an older kvm which does
not support this capability.

If a flash device is not used, then qemu/kvm will
operate in the original rom-mode.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1369816047-16384-5-git-send-email-jordan.l.justen@intel.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agokvm: support using KVM_MEM_READONLY flag for regions
Jordan Justen [Wed, 29 May 2013 08:27:26 +0000 (01:27 -0700)]
kvm: support using KVM_MEM_READONLY flag for regions

For readonly memory regions and rom devices in romd_mode,
we make use of the KVM_MEM_READONLY. A slot that uses
KVM_MEM_READONLY can be read from and code can execute from the
region, but writes will exit to qemu.

For rom devices with !romd_mode, we force the slot to be
removed so reads or writes to the region will exit to qemu.
(Note that a memory region in this state is not executable
within kvm.)

v7:
 * Update for readable => romd_mode rename (5f9a5ea1)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> (v4)
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> (v5)
Message-id: 1369816047-16384-4-git-send-email-jordan.l.justen@intel.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agokvm: add kvm_readonly_mem_enabled
Jordan Justen [Wed, 29 May 2013 08:27:25 +0000 (01:27 -0700)]
kvm: add kvm_readonly_mem_enabled

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1369816047-16384-3-git-send-email-jordan.l.justen@intel.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoisapc: Fix non-KVM qemu boot (read/write memory for isapc BIOS)
Jordan Justen [Wed, 29 May 2013 08:27:24 +0000 (01:27 -0700)]
isapc: Fix non-KVM qemu boot (read/write memory for isapc BIOS)

The isapc machine with seabios currently requires the BIOS region
to be read/write memory rather than read-only memory.

KVM currently cannot support the BIOS as a ROM region, but qemu
in non-KVM mode can. Based on this, isapc machine currently only
works with KVM.

To work-around this isapc issue, this change avoids marking the
BIOS as readonly for isapc.

This change also will allow KVM to start supporting ROM mode
via KVM_CAP_READONLY_MEM.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1369816047-16384-2-git-send-email-jordan.l.justen@intel.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'aneesh/for-upstream' into staging
Anthony Liguori [Wed, 29 May 2013 13:13:20 +0000 (08:13 -0500)]
Merge remote-tracking branch 'aneesh/for-upstream' into staging

# By Aneesh Kumar K.V (3) and Gabriel de Perthuis (1)
# Via Aneesh Kumar K.V
* aneesh/for-upstream:
  hw/9pfs: Be robust against paths without FS_IOC_GETVERSION
  hw/9pfs: Use O_NOFOLLOW when opening files on server
  hw/9pfs: use O_NOFOLLOW for mapped readlink operation
  hw/9pfs: Fix segfault with 9p2000.u

Message-id: 87zjvevx4s.fsf@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'afaerber-or/cocoa-for-upstream' into staging
Anthony Liguori [Wed, 29 May 2013 13:13:09 +0000 (08:13 -0500)]
Merge remote-tracking branch 'afaerber-or/cocoa-for-upstream' into staging

# By Peter Maydell
# Via Andreas Färber
* afaerber-or/cocoa-for-upstream:
  cocoa: Avoid deprecated NSOpenPanel beginSheetForDirectory
  cocoa: Avoid deprecated NSOpenPanel filename method
  cocoa: Avoid deprecated CPS* functions
  cocoa: Fix leaks of NSScreen and NSConcreteMapTable