]> Git Repo - qemu.git/log
qemu.git
10 years agoPPC: Add u-boot firmware for e500
Alexander Graf [Sun, 19 Jan 2014 23:25:40 +0000 (00:25 +0100)]
PPC: Add u-boot firmware for e500

This adds a special build of u-boot tailored for the e500 platforms we
emulate. It is based on the current version of upstream u-boot which
contains all the code necessary to drive our QEMU provided machines.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: e500: Expose kernel load address in dt
Alexander Graf [Sun, 19 Jan 2014 23:21:04 +0000 (00:21 +0100)]
PPC: e500: Expose kernel load address in dt

We want to move to a model where firmware loads our kernel. To achieve
this we need to be able to tell firmware where the kernel lies.

Let's copy the mechanism we already use for -M pseries and expose the
kernel load address and size through the device tree.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: Add dcbtls emulation
Alexander Graf [Sun, 19 Jan 2014 16:50:09 +0000 (17:50 +0100)]
PPC: Add dcbtls emulation

The dcbtls instruction is able to lock data inside the L1 cache.

Unfortunately we don't emulate any caches, so we have to tell the guest
that its locking attempt failed.

However, by implementing the instruction we at least don't give the
guest a program exception which it definitely does not expect.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: Properly emulate L1CSR0 and L1CSR1
Alexander Graf [Sun, 19 Jan 2014 16:49:11 +0000 (17:49 +0100)]
PPC: Properly emulate L1CSR0 and L1CSR1

There are 2 L1 cache control registers - one for data (L1CSR0) and
one for instructions (L1CSR1).

Emulate both of them well enough to give the guest the illusion that
it could actually do anything about its caches.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: Add L1CFG1 SPR emulation
Alexander Graf [Sun, 19 Jan 2014 16:47:43 +0000 (17:47 +0100)]
PPC: Add L1CFG1 SPR emulation

In addition to the L1 data cache configuration register L1CFG0 there is
also another one for the L1 instruction cache called L1CFG1.

Emulate that one with the same values as the data one.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: Fix SPR access control of L1CFG0
Alexander Graf [Thu, 23 Jan 2014 10:43:49 +0000 (11:43 +0100)]
PPC: Fix SPR access control of L1CFG0

The L1CFG0 register on e200 and e500 is "User RO" according to the
specifications. So let's make it user readable and world unwritable.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: Add definitions for GIVORs
Alexander Graf [Sun, 19 Jan 2014 16:41:14 +0000 (17:41 +0100)]
PPC: Add definitions for GIVORs

We're missing SPR definitions for GIVORs. Add them to the list of SPRs.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: Make all e500 CPUs SVR aware
Alexander Graf [Sun, 19 Jan 2014 16:39:54 +0000 (17:39 +0100)]
PPC: Make all e500 CPUs SVR aware

Our pre-e500mc e500 CPU types didn't get instanciated with SVR information,
even though those systems do support the SVR register.

Spawn them with the SVR tag so that they don't get confused when someone tries
to read SPR_SVR.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: Fail on leaking temporaries
Alexander Graf [Sun, 19 Jan 2014 16:28:33 +0000 (17:28 +0100)]
PPC: Fail on leaking temporaries

When QEMU gets compiled with --enable-debug-tcg we can check for temporary
leakage. Implement the necessary target code for this and fail emulation
when we hit a leakage.

This hopefully ensures that we don't get new leaks.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: Fix TCG chunks that don't free their temps
Alexander Graf [Sun, 19 Jan 2014 16:26:33 +0000 (17:26 +0100)]
PPC: Fix TCG chunks that don't free their temps

We want to make sure that every instruction cleans up after itself and
clears every temporary it allocated.

While checking whether this is already the case, I came across a few
cases where it isn't. This patch fixes every translation I found that
doesn't free their allocated temporaries.

Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: e500: implement PCI INTx routing
Bharat Bhushan [Mon, 12 May 2014 09:45:40 +0000 (15:15 +0530)]
PPC: e500: implement PCI INTx routing

This patch adds pci pin to irq_num routing callback.
This callback is called from pci_device_route_intx_to_irq to
find which pci device maps to which irq.
This fix is required for pci-device passthrough using vfio.

Also without this patch we gets below prints

"
  PCI: Bug - unimplemented PCI INTx routing (e500-pcihost)
  qemu-system-ppc64: PCI: Bug - unimplemented PCI INTx routing (e500-pcihost) "

and Legacy interrupt does not work with pci device passthrough.

Signed-off-by: Bharat Bhushan <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
[agraf: remove double semicolon]
Signed-off-by: Alexander Graf <[email protected]>
10 years agoPPC: e500: some pci related cleanup
Bharat Bhushan [Mon, 12 May 2014 09:45:39 +0000 (15:15 +0530)]
PPC: e500: some pci related cleanup

- Use PCI_NUM_PINS rather than hardcoding
 - use "pin" wherever possible

Signed-off-by: Bharat Bhushan <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agoKVM: PPC: Don't secretly add 1T segment feature to CPU
Alexander Graf [Sun, 11 May 2014 16:37:00 +0000 (18:37 +0200)]
KVM: PPC: Don't secretly add 1T segment feature to CPU

When we select a CPU type that does not support 1TB segments, we should
not expose 1TB just because KVM supports 1TB segments. User configuration
always wins over feature availability.

Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Refactor AES Instructions
Tom Musta [Thu, 13 Mar 2014 14:13:30 +0000 (09:13 -0500)]
target-ppc: Refactor AES Instructions

This patch refactors the PowerPC Advanced Encryption Standard (AES) instructions
to use the common AES tables (include/qemu/aes.h).

Specifically:
    - vsbox is recoded to use the AES_sbox table.
    - vcipher, vcipherlast and vncipherlast are all recoded to use the optimized
      AES_t[ed][0-4] tables.
    - vncipher is recoded to use a combination of InvS-Box, InvShiftRows and
      InvMixColumns tables.  It was not possible to use AES_Td[0-4] due to a
      slight difference in how PowerPC implements vncipher.

Signed-off-by: Tom Musta <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-arm: Use Common Tables in AES Instructions
Tom Musta [Thu, 13 Mar 2014 14:13:29 +0000 (09:13 -0500)]
target-arm: Use Common Tables in AES Instructions

This patch refactors the ARM cryptographic instructions to use the
(newly) added common tables from include/qemu/aes.h.

Signed-off-by: Tom Musta <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-i386: Use Common ShiftRows and InvShiftRows Tables
Tom Musta [Thu, 13 Mar 2014 14:13:28 +0000 (09:13 -0500)]
target-i386: Use Common ShiftRows and InvShiftRows Tables

This patch eliminates the (now) redundant copy of the Advanced Encryption Standard (AES)
ShiftRows and InvShiftRows tables; the code is updated to use the common tables declared in
include/qemu/aes.h.

Signed-off-by: Tom Musta <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agoutil: Add InvMixColumns
Tom Musta [Thu, 13 Mar 2014 14:13:27 +0000 (09:13 -0500)]
util: Add InvMixColumns

This patch adds the table implementation of the Advanced Encryption Standard (AES)
InvMixColumns transformation.

The patch is intentionally asymmetrical -- the MixColumns table is not added because
there is no known use for it at this time.

Signed-off-by: Tom Musta <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agoutil: Add AES ShiftRows and InvShiftRows Tables
Tom Musta [Thu, 13 Mar 2014 14:13:26 +0000 (09:13 -0500)]
util: Add AES ShiftRows and InvShiftRows Tables

This patch adds tables that implement the Advanced Encryption Standard (AES) ShiftRows
and InvShiftRows transformations.  These are commonly used in instruction models.

Signed-off-by: Tom Musta <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agoutil: Add S-Box and InvS-Box Arrays to Common AES Utils
Tom Musta [Thu, 13 Mar 2014 14:13:25 +0000 (09:13 -0500)]
util: Add S-Box and InvS-Box Arrays to Common AES Utils

This patch adds tables for the S-Box and InvS-Box transformations commonly used by various
Advanced Encription Standard (AES) instruction models.

Signed-off-by: Tom Musta <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agospapr_pci: fix MSI limit
Alexey Kardashevskiy [Sun, 4 May 2014 14:09:48 +0000 (00:09 +1000)]
spapr_pci: fix MSI limit

At the moment XICS does not support interrupts reuse so sPAPR PHB
implements this. sPAPRPHBState holds array of 32 spapr_pci_msi to
describe PCI config address, first MSI and number of MSIs. Once
allocated for a device, QEMU tries reusing this config until the number
of MSIs changes.

Existing SPAPR guests call ibm,change-msi in a loop until the handler
returns the requested number of vectors.

Recently introduced check for the maximum number of MSI/MSIX vectors
supported by a device only works for a device which is new for PHB's
MSI cache. If it is already there, the check is not performed which
leads to new IRQ block allocation. This happens during PCI hotplug
even when the user hot plug the same device which he just hot unplugged.

This moves the check earlier.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Shift Significand
Tom Musta [Mon, 21 Apr 2014 20:55:21 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Shift Significand

Add emulation of the PowerPC Decimal Floating Point Shift Significand
Left Immediate (dscli[q][.]) and DFP Shift Significant Right Immediate
(dscri[q][.]) instructions.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Insert Biased Exponent
Tom Musta [Mon, 21 Apr 2014 20:55:20 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Insert Biased Exponent

Add emulation of the PowerPC Decimal Floating Point Insert Biased
Exponent instructions diex[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Extract Biased Exponent
Tom Musta [Mon, 21 Apr 2014 20:55:19 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Extract Biased Exponent

Add emulation of the PowerPC Decimal Floating Point Extract
Biased Exponent instructions dxex[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Encode BCD to DPD
Tom Musta [Mon, 21 Apr 2014 20:55:18 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Encode BCD to DPD

Add emulation of the PowerPC Decimal Floating Point Encode Binary
Coded Decimal to Densely Packed Decimal instructions denbcd[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Decode DPD to BCD
Tom Musta [Mon, 21 Apr 2014 20:55:17 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Decode DPD to BCD

Add emulation of the Power PC Decimal Floating Point Decode
Densely Packed Decimal to Binary Coded Decimal instructions
ddedpd[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Convert to Fixed
Tom Musta [Mon, 21 Apr 2014 20:55:16 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Convert to Fixed

Add emulation of the PowerPC Decimal Floating Point Convert to Fixed
instructions dctfix[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Convert to Fixed
Tom Musta [Mon, 21 Apr 2014 20:55:15 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Convert to Fixed

Add emulation of the PowerPC Decimal Floating Point Convert to
Fixed instructions dctfix[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce Round to DFP Short/Long
Tom Musta [Mon, 21 Apr 2014 20:55:14 +0000 (15:55 -0500)]
target-ppc: Introduce Round to DFP Short/Long

Add emulation of the PowerPC Round to DFP Short (drsp[.]) and Round to
DFP Long (drdpq[.]) instructions.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Convert to Long/Extended
Tom Musta [Mon, 21 Apr 2014 20:55:13 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Convert to Long/Extended

Add emulation of the PowerPC Convert to DFP Long (dctdp[.]) and
Convert to DFP Extended (dctqpq[.]) instructions.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Round to Integer
Tom Musta [Mon, 21 Apr 2014 20:55:12 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Round to Integer

Add emulation of the PowerPC Decimal Floating Point (DFP) Round
to FP Integer With Inexact (drintx[q][.]) and DFP Round to FP
Integer Without Inexact (drintn[q][.]) instructions.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Reround
Tom Musta [Mon, 21 Apr 2014 20:55:11 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Reround

Add emulation of the PowerPC Decimal Floating Point Reround instructions
drrnd[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Quantize
Tom Musta [Mon, 21 Apr 2014 20:55:10 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Quantize

Add emulation of the PowerPC Decimal Floating Point Quantize instructions
dquai[q][.] and dqua[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Test Significance
Tom Musta [Mon, 21 Apr 2014 20:55:09 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Test Significance

Add emulation of the PowerPC Decimal Floating Point Test Significance
instructions dtstsf[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Test Exponent
Tom Musta [Mon, 21 Apr 2014 20:55:08 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Test Exponent

Add emulation of the PowerPC Decimal Floating Point Test Exponent
instructions dtstex[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Test Data Group
Tom Musta [Mon, 21 Apr 2014 20:55:07 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Test Data Group

Add emulation of the PowerPC Decimal Floating Point Test Data
Group instructions dtstdg[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Test Data Class
Tom Musta [Mon, 21 Apr 2014 20:55:06 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Test Data Class

Add emulation of the PowerPC Decimal Floating Point Test Data Class
instructions dtstdc[q][.].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Compares
Tom Musta [Mon, 21 Apr 2014 20:55:05 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Compares

Add emulation of the PowerPC Decimal Floating Point Compare instructions
dcmpu[q] and dcmpo[q].

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Divide
Tom Musta [Mon, 21 Apr 2014 20:55:04 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Divide

Add emulation of the PowerPC Decimal Floating Point Divide instructions
ddiv[q][.]

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Multiply
Tom Musta [Mon, 21 Apr 2014 20:55:03 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Multiply

Add emulation of the PowerPC Decimal Floating Point Multiply instructions
dmul[q][.]

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Subtract
Tom Musta [Mon, 21 Apr 2014 20:55:02 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Subtract

Add emulation of the PowerPC Decimal Floating Point Subtract instructions
dsub[q][.]

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Add
Tom Musta [Mon, 21 Apr 2014 20:55:01 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Add

Add emulation of the PowerPC Decimal Floating Point Add instructions dadd[q][.]

Various GCC unused annotations are removed since it is now safe to remove them.

Signed-off-by: Tom Musta <[email protected]>
[agraf: move brace in function definition]
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Post Processor Utilities
Tom Musta [Mon, 21 Apr 2014 20:55:00 +0000 (15:55 -0500)]
target-ppc: Introduce DFP Post Processor Utilities

Add post-processing utilities to the PowerPC Decimal Floating Point
(DFP) helper code.  Post-processors are small routines that execute
after a preliminary DFP result is computed.  They are used, among other
things, to compute status bits.

This change defines a function type for post processors as well as a
generic routine to run a list (array) of post-processors.

Actual post-processor implementations will be added as needed by specific
DFP helpers in subsequent changes.

Some routines are annotated with the GCC unused attribute in order to
preserve build bisection.  The annotation will be removed in subsequent
patches.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce DFP Helper Utilities
Tom Musta [Mon, 21 Apr 2014 20:54:59 +0000 (15:54 -0500)]
target-ppc: Introduce DFP Helper Utilities

Add a new file (dfp_helper.c) to the PowerPC implementation for Decimal Floating
Point (DFP) emulation.  This first version of the file declares a structure that
will be used by DFP helpers.  It also implements utilities that will initialize
such a structure for either a long (64 bit) DFP instruction or an extended (128
bit, aka "quad") instruction.

Some utility functions are annotated with the unused attribute in order to preserve
build bisection.

Signed-off-by: Tom Musta <[email protected]>
[agraf: Add never reached assert on dfp_prepare_rounding_mode()]
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce Decoder Macros for DFP
Tom Musta [Mon, 21 Apr 2014 20:54:58 +0000 (15:54 -0500)]
target-ppc: Introduce Decoder Macros for DFP

Add decoder macros for the various Decimal Floating Point
instruction forms.  Illegal instruction masks are used to not only
guard against reserved instruction field use, but also to catch
illegal quad word forms that use odd-numbered floating point registers.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Introduce Generator Macros for DFP Arithmetic Forms
Tom Musta [Mon, 21 Apr 2014 20:54:57 +0000 (15:54 -0500)]
target-ppc: Introduce Generator Macros for DFP Arithmetic Forms

Add general support for generators of PowerPC Decimal Floating Point helpers.

Some utilities are annotated with GCC attribute unused in order to preserve
build bisection.  These annotations will be removed in later patches.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Define FPR Pointer Type for Helpers
Tom Musta [Mon, 21 Apr 2014 20:54:56 +0000 (15:54 -0500)]
target-ppc: Define FPR Pointer Type for Helpers

Define a floating pointer register pointer type in the PowerPC
helper header.  The type will be used to pass FPR register operands
to Decimal Floating Point (DFP) helpers.  A pointer is used because
the quad word forms of PowerPC DFP instructions operate on adjacent
pairs of floating point registers and thus can be thought of as
arrays of length 2.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Fix decNumberSetBCD
Tom Musta [Mon, 21 Apr 2014 20:54:55 +0000 (15:54 -0500)]
libdecnumber: Fix decNumberSetBCD

Fix a simple bug in the decNumberSetBCD() function.  This function
encodes a decNumber with "n" BCD digits.  The original code erroneously
computed the number of declets from the dn argument, which is the output
decNumber value, and hence may contain garbage.  Instead, the input "n"
value is used.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Introduce decNumberIntegralToInt64
Tom Musta [Mon, 21 Apr 2014 20:54:54 +0000 (15:54 -0500)]
libdecnumber: Introduce decNumberIntegralToInt64

Introduce a new conversion function to the libdecnumber library.
This function converts a decNumber to a signed 64-bit integer.
In order to support 64-bit integers (which may have up to 19
decimal digits), the existing "powers of 10" array is expanded
from 10 to 19 entries.

Signed-off-by: Tom Musta <[email protected]>
[agraf: fix 32bit host compile]
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Introduce decNumberFrom[U]Int64
Tom Musta [Mon, 21 Apr 2014 20:54:53 +0000 (15:54 -0500)]
libdecnumber: Introduce decNumberFrom[U]Int64

Introduce two conversion functions to the libdecnumber library.
These conversions transform 64 bit integers to the internal decNumber
representation.  Both a signed and unsigned version is added.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Enable Building of libdecnumber
Tom Musta [Mon, 21 Apr 2014 20:54:52 +0000 (15:54 -0500)]
target-ppc: Enable Building of libdecnumber

Enable compilation of the newly added libdecnumber library code.
Object file targets are added to Makefile.target using a newly
introduced flag CONFIG_LIBDECNUMBER.  The flag is added
to the PowerPC targets (ppc[64]-linux-user, ppc[64]-softmmu).

Signed-off-by: Tom Musta <[email protected]>
[agraf: add ppcemb and ppc64abi32 config]
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Eliminate Unused Variable in decSetSubnormal
Tom Musta [Mon, 21 Apr 2014 20:54:51 +0000 (15:54 -0500)]
libdecnumber: Eliminate Unused Variable in decSetSubnormal

Eliminate an unused variable in the decSetSubnormal routine.  The
variable dnexp is declared and eventually set but never used, and
thus may trigger an unused-but-set-variable warning.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Eliminate redundant declarations
Tom Musta [Mon, 21 Apr 2014 20:54:50 +0000 (15:54 -0500)]
libdecnumber: Eliminate redundant declarations

Eliminate redundant declarations of symbols DPD2BIN and BIN2DPD in
various .c source files.  These symbols are already declared in decDPD.h and
thus will trigger 'redundant redeclaration of ?XXX?' warnings, which, of
course, may fail QEMU compilation.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Change gstdint.h to stdint.h
Tom Musta [Mon, 21 Apr 2014 20:54:49 +0000 (15:54 -0500)]
libdecnumber: Change gstdint.h to stdint.h

Replace the inclusion of gstdint.h with the standard stdint.h
header file.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Modify dconfig.h to Integrate with QEMU
Tom Musta [Mon, 21 Apr 2014 20:54:48 +0000 (15:54 -0500)]
libdecnumber: Modify dconfig.h to Integrate with QEMU

Modify the dconfig.h header file so that libdecnumber code integrates QEMU
configuration.   Specifically:

  - the WORDS_BIGENDIAN preprocessor macro is used in libdecnumber code to
    determines endianness.  It is derived from the existing QEMU macro
    HOST_WORDS_BIGENDIAN which is defined in config-host.h.

  - the DECPUN macro determines the number of decimal digits (aka declets) per
    unit (byte).  This is 3 for PowerPC DFP.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Prepare libdecnumber for QEMU include structure
Tom Musta [Mon, 21 Apr 2014 20:54:47 +0000 (15:54 -0500)]
libdecnumber: Prepare libdecnumber for QEMU include structure

Consistent with other libraries in QEMU, the libdecnumber header files were
placed in include/libdecnumber, separate from the C code.  This is different
from the original libdecnumber source, where they were co-located.

Change the libdecnumber source code so that it reflects this split.  Specifically,
modify directives of the form:

    #include "xxx.h"

to look like:

    #include "libdecnumber/xxx.h"

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Eliminate #include *Symbols.h
Tom Musta [Mon, 21 Apr 2014 20:54:46 +0000 (15:54 -0500)]
libdecnumber: Eliminate #include *Symbols.h

The various *Symbols.h files were not copied from the original GCC libdecnumber
library; they are not necessary for use in QEMU.  Remove all instances of

    #include "*Symbols.h"

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agolibdecnumber: Introduce libdecnumber Code
Tom Musta [Mon, 21 Apr 2014 20:54:45 +0000 (15:54 -0500)]
libdecnumber: Introduce libdecnumber Code

Add files from the libdecnumber decimal floating point library to QEMU.  The libdecnumber
library was originally part of GCC and contains code that is useful in emulating the PowerPC
decimal floating point (DFP) instructions.  This particular copy of the source comes from
GCC 4.3 and is licensed at GPLv2+.

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agomac99: Added FW_CFG_PPC_BUSFREQ to match CLOCKFREQ and TBFREQ already there
BALATON Zoltan [Thu, 17 Apr 2014 17:04:44 +0000 (19:04 +0200)]
mac99: Added FW_CFG_PPC_BUSFREQ to match CLOCKFREQ and TBFREQ already there

While there, also moved the hard coded value for CLOCKFREQ to a #define.

Signed-off-by: BALATON Zoltan <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Remove PVR check from migration
Alexey Kardashevskiy [Tue, 15 Apr 2014 05:06:10 +0000 (15:06 +1000)]
target-ppc: Remove PVR check from migration

Currently migration fails if CPU version (PVR register) is different
even a bit. This check is performed at the very end of migration when
device states are sent. This is too late for management software and
we need to provide a way for the user to make sure that migration
will succeed if QEMU is started with appropritate command line parameters.

This removes the PVR check.

This resets PVR to the default value as the existing VMSTATE record
for SPR array sends all 1024 registers unconditionally and overwrites
the destination PVR.

If the user wants some guarantees for migration to succeed, then
a CPU name or "host" CPU with a "compat" option (on its way to upsteam)
should be used and KVM or TCG is expected to fail on unsupported values
at the moment of QEMU start.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Eliminate Magic Number MSR Masks
Tom Musta [Tue, 15 Apr 2014 17:21:12 +0000 (12:21 -0500)]
target-ppc: Eliminate Magic Number MSR Masks

Use MSR mnemonics from cpu.h instead of magic numbers for the CPUPPCState.msr_mask
initialization.

There is one bit in the 401x2 (and subsequent) model that I could not find any
documentation for.  It is open coded at little endian bit position 20:

    pcc->msr_mask = (1ull << 20) |
                    (1ull << MSR_KEY) |
                    (1ull << MSR_POW) |
                    (1ull << MSR_CE) |
                    ...

Signed-off-by: Tom Musta <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agospapr_pci: Fix number of returned vectors in ibm, change-msi
Alexey Kardashevskiy [Mon, 7 Apr 2014 12:53:21 +0000 (22:53 +1000)]
spapr_pci: Fix number of returned vectors in ibm, change-msi

Current guest kernels try allocating as many vectors as the quota is.
For example, in the case of virtio-net (which has just 3 vectors)
the guest requests 4 vectors (that is the quota in the test) and
the existing ibm,change-msi handler returns 4. But before it returns,
it calls msix_set_message() in a loop and corrupts memory behind
the end of msix_table.

This limits the number of vectors returned by ibm,change-msi to
the maximum supported by the actual device.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Cc: [email protected]
[agraf: squash in bugfix from aik]
Signed-off-by: Alexander Graf <[email protected]>
10 years agospapr-pci: remove io ports workaround
Greg Kurz [Fri, 7 Feb 2014 13:44:17 +0000 (14:44 +0100)]
spapr-pci: remove io ports workaround

In the past, IO space could not be mapped into the memory address space
so we introduced a workaround for that. Nowadays it does not look
necessary so we can remove the workaround and make sPAPR PCI
configuration simplier.

Signed-off-by: Greg Kurz <[email protected]>
Acked-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Remove redundant POWER7 declarations
Alexey Kardashevskiy [Fri, 11 Apr 2014 17:34:27 +0000 (03:34 +1000)]
target-ppc: Remove redundant POWER7 declarations

At the moment there are 3 versions of POWER7 CPUs defined. However
we do not emulate these CPUs diffent and it does not make much
sense to keep them all.

This removes POWER7_v2.0 and POWER7_v2.1 and leaves just one versioned
CPU per family which is POWER7_v2.3 with POWER7 alias.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Move alias lookup after class lookup
Alexey Kardashevskiy [Fri, 11 Apr 2014 17:34:26 +0000 (03:34 +1000)]
target-ppc: Move alias lookup after class lookup

This moves aliases lookup after CPU class lookup. This is to let new generic
CPU to be found first if it is present and only if it is not (TCG case), use
aliases.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Create versionless CPU class per family if KVM
Alexey Kardashevskiy [Fri, 11 Apr 2014 17:34:25 +0000 (03:34 +1000)]
target-ppc: Create versionless CPU class per family if KVM

At the moment generic version-less CPUs are supported via hardcoded aliases.
For example, POWER7 is an alias for POWER7_v2.1. So when QEMU is started
with -cpu POWER7, the POWER7_v2.1 class instance is created.

This approach works for TCG and KVMs other than HV KVM. HV KVM cannot emulate
PVR value so the guest always sees the real PVR. HV KVM will not allow setting
PVR other that the host PVR because of that (the kernel patch for it is on
its way). So in most cases it is impossible to run QEMU with -cpu POWER7
unless the host PVR is exactly the same as the one from the alias (which
is now POWER7_v2.3). It was decided that under HV KVM QEMU should use
-cpu host.

Using "host" CPU type creates a problem for management tools such as libvirt
because they want to know in advance if the destination guest can possibly
run on the destination. Since the "host" type is really not a type and will
always work with any KVM, there is no way for libvirt to know if the migration
will success.

This registers additional CPU class derived from the host CPU family.
The name for it is taken from @desc field of the CPU family class.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: gdbstub allow byte swapping for reading/writing registers
Thomas Falcon [Mon, 7 Apr 2014 21:41:00 +0000 (17:41 -0400)]
target-ppc: gdbstub allow byte swapping for reading/writing registers

This patch allows registers to be properly read from and written to
when using the gdbstub to debug a ppc guest running in little
endian mode.

Reviewed-by: Andreas Färber <[email protected]>
Signed-off-by: Thomas Falcon <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: extract register length calculation in gdbstub
Thomas Falcon [Mon, 7 Apr 2014 21:40:59 +0000 (17:40 -0400)]
target-ppc: extract register length calculation in gdbstub

This patch extracts the method to determine a register's size
into a separate function.

Reviewed-by: Andreas Färber <[email protected]>
Signed-off-by: Thomas Falcon <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agospapr_nvram: Correct max nvram size
Alexey Kardashevskiy [Fri, 4 Apr 2014 07:26:26 +0000 (18:26 +1100)]
spapr_nvram: Correct max nvram size

Currently it is UINT16_MAX*16 = 65536*16 = 1048560 which is not
a round number and therefore a bit confusing.

This defines MAX_NVRAM_SIZE precisely as 1MB.

Suggested-by: Thomas Huth <[email protected]>
Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agoFix typo in eTSEC Ethernet controller
Fabien Chouteau [Wed, 2 Apr 2014 14:49:32 +0000 (16:49 +0200)]
Fix typo in eTSEC Ethernet controller

IRQ are lowered when ievent bit is cleared, so irq_pulse makes no sense
here...

Signed-off-by: Fabien Chouteau <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agomonitor: QEMU Monitor Instruction Disassembly Incorrect for PowerPC LE Mode
Tom Musta [Wed, 9 Apr 2014 19:53:24 +0000 (14:53 -0500)]
monitor: QEMU Monitor Instruction Disassembly Incorrect for PowerPC LE Mode

The monitor support for disassembling instructions does not honor the MSR[LE]
bit for PowerPC processors.

This change enhances the monitor_disas() routine by supporting a flag bit
for Little Endian mode.  Bit 16 is used since that bit was used in the
analagous guest disassembly routine target_disas().

Also, to be consistent with target_disas(), the disassembler bfd_mach field
can be passed in the flags argument.

Reported-by: Anton Blanchard <[email protected]>
Signed-off-by: Tom Musta <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agotarget-ppc: Fix target_disas
Tom Musta [Wed, 9 Apr 2014 19:53:23 +0000 (14:53 -0500)]
target-ppc: Fix target_disas

Inspect only bit 16 for the Little Endian test.  Correct comment preceding
the target_disas() function.  Correct grammar in comment for flags processing.

Signed-off-by: Tom Musta <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20140616' into...
Peter Maydell [Mon, 16 Jun 2014 10:06:06 +0000 (11:06 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20140616' into staging

migration/next for 20140616

# gpg: Signature made Mon 16 Jun 2014 04:10:18 BST using RSA key ID 5872D723
# gpg: Can't check signature: public key not found

* remotes/juanquintela/tags/migration/20140616:
  migration: catch unknown flags in ram_load
  rdma: Fix block during rdma migration
  migration: Increase default max_downtime from 30ms to 300ms
  vmstate: Refactor opening of files
  savevm: Remove all the unneeded version_minimum_id_old (x86)
  savevm: Remove all the unneeded version_minimum_id_old (ppc)

Signed-off-by: Peter Maydell <[email protected]>
10 years agoQemuOpts: cleanup tmp 'allocated' member from QemuOptsList
Chunyan Liu [Thu, 5 Jun 2014 09:21:12 +0000 (17:21 +0800)]
QemuOpts: cleanup tmp 'allocated' member from QemuOptsList

Now only qemu_opts_append uses 'allocated' to indicate free memory.
For this function only, we can also let result list's (const char *)
members point to input list's members, only if the input list has
longer lifetime than result list. In current code, that is true.
So, we can remove the 'allocated' member from QemuOptsList definition
to keep code clean.

Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agocleanup QEMUOptionParameter
Chunyan Liu [Thu, 5 Jun 2014 09:21:11 +0000 (17:21 +0800)]
cleanup QEMUOptionParameter

Now that all backend drivers are using QemuOpts, remove all
QEMUOptionParameter related codes.

Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agovpc.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:10 +0000 (17:21 +0800)]
vpc.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agovmdk.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:09 +0000 (17:21 +0800)]
vmdk.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agovhdx.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:08 +0000 (17:21 +0800)]
vhdx.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agovdi.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:07 +0000 (17:21 +0800)]
vdi.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agossh.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:06 +0000 (17:21 +0800)]
ssh.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agosheepdog.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:05 +0000 (17:21 +0800)]
sheepdog.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agorbd.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:04 +0000 (17:21 +0800)]
rbd.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoraw_bsd.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:03 +0000 (17:21 +0800)]
raw_bsd.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoraw-win32.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:02 +0000 (17:21 +0800)]
raw-win32.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoraw-posix.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:01 +0000 (17:21 +0800)]
raw-posix.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoqed.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:21:00 +0000 (17:21 +0800)]
qed.c: replace QEMUOptionParameter with QemuOpts

One extra change is to define QED_DEFAULT_CLUSTER_SIZE = 65536 instead
of 64 * 1024; because:
according to existing create_options, "cluster size" has default value =
QED_DEFAULT_CLUSTER_SIZE, after switching to create_opts, this has to be
stringized and set to .def_value_str. That is,
  .def_value_str = stringify(QED_DEFAULT_CLUSTER_SIZE),
so the QED_DEFAULT_CLUSTER_SIZE could not be a expression.

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoqcow2.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:20:59 +0000 (17:20 +0800)]
qcow2.c: replace QEMUOptionParameter with QemuOpts

Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoQemuOpts: export qemu_opt_find
Chunyan Liu [Thu, 5 Jun 2014 09:20:58 +0000 (17:20 +0800)]
QemuOpts: export qemu_opt_find

Export qemu_opt_find for qcow2 driver using it.
After replacing QEMUOptionParameter with QemuOpts, qcow2 driver will
use qemu_opt_find to judge if an option is explicitly set, to replace
the usage of .assigned in QEMUOptionParameter.

Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoqcow.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:20:57 +0000 (17:20 +0800)]
qcow.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agonfs.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:20:56 +0000 (17:20 +0800)]
nfs.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoiscsi.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:20:55 +0000 (17:20 +0800)]
iscsi.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agogluster.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:20:54 +0000 (17:20 +0800)]
gluster.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agocow.c: replace QEMUOptionParameter with QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:20:53 +0000 (17:20 +0800)]
cow.c: replace QEMUOptionParameter with QemuOpts

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agovvfat.c: handle cross_driver's create_options and create_opts
Chunyan Liu [Thu, 5 Jun 2014 09:20:52 +0000 (17:20 +0800)]
vvfat.c: handle cross_driver's create_options and create_opts

vvfat shares create options of qcow driver. To avoid vvfat breaking when
qcow driver changes from QEMUOptionParameter to QemuOpts, let it able
to handle both cases.

Signed-off-by: Chunyan Liu <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agochange block layer to support both QemuOpts and QEMUOptionParamter
Chunyan Liu [Thu, 5 Jun 2014 09:20:51 +0000 (17:20 +0800)]
change block layer to support both QemuOpts and QEMUOptionParamter

Change block layer to support both QemuOpts and QEMUOptionParameter.
After this patch, it will change backend drivers one by one. At the end,
QEMUOptionParameter will be removed and only QemuOpts is kept.

Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoQemuOpts: check NULL input for qemu_opts_del
Chunyan Liu [Thu, 5 Jun 2014 09:20:50 +0000 (17:20 +0800)]
QemuOpts: check NULL input for qemu_opts_del

To simplify later using of qemu_opts_del, accept NULL input.

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Leandro Dorileo <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoQemuOpts: add qemu_opts_append to replace append_option_parameters
Chunyan Liu [Thu, 5 Jun 2014 09:20:49 +0000 (17:20 +0800)]
QemuOpts: add qemu_opts_append to replace append_option_parameters

For later merge .create_opts of drv and proto_drv in qemu-img commands.

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Leandro Dorileo <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoQemuOpts: add conversion between QEMUOptionParameter to QemuOpts
Chunyan Liu [Thu, 5 Jun 2014 09:20:48 +0000 (17:20 +0800)]
QemuOpts: add conversion between QEMUOptionParameter to QemuOpts

Add two temp conversion functions between QEMUOptionParameter to QemuOpts,
so that next patch can use it. It will simplify later patch for easier
review. And will be finally removed after all backend drivers switch to
QemuOpts.

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Leandro Dorileo <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoQemuOpts: add qemu_opts_print_help to replace print_option_help
Chunyan Liu [Thu, 5 Jun 2014 09:20:47 +0000 (17:20 +0800)]
QemuOpts: add qemu_opts_print_help to replace print_option_help

print_option_help takes QEMUOptionParameter as parameter, add
qemu_opts_print_help to take QemuOptsList as parameter for later
replace work.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Leandro Dorileo <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoQemuOpts: add qemu_opt_get_*_del functions for replace work
Chunyan Liu [Thu, 5 Jun 2014 09:20:46 +0000 (17:20 +0800)]
QemuOpts: add qemu_opt_get_*_del functions for replace work

Add qemu_opt_get_del, qemu_opt_get_bool_del, qemu_opt_get_number_del and
qemu_opt_get_size_del to replace the same handling of QEMUOptionParameter
(get and delete).

Several drivers are coded to parse a known subset of options, then
remove them from the list before handing all remaining options to a
second driver for further option processing.  get_*_del makes it easier
to retrieve a known option (or its default) and remove it from the list
all in one action.

Share common helper function:

For qemu_opt_get_bool/size/number, they and their get_*_del counterpart
could share most of the code except whether or not deleting the opt from
option list, so generate common helper functions.

For qemu_opt_get and qemu_opt_get_del, keep code duplication, since
1. qemu_opt_get_del returns malloc'd memory while qemu_opt_get returns
in-place memory
2. qemu_opt_get_del returns (char *), qemu_opt_get returns (const char *),
and could not change to (char *), since in one case, it will return
desc->def_value_str, which is (const char *).

Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Dong Xu Wang <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
10 years agoQemuOpts: move qemu_opt_del ahead for later calling
Chunyan Liu [Thu, 5 Jun 2014 09:20:45 +0000 (17:20 +0800)]
QemuOpts: move qemu_opt_del ahead for later calling

In later patch, qemu_opt_get_del functions will be added, they will
first get the option value, then call qemu_opt_del to remove the option
from opt list. To prepare for that purpose, move qemu_opt_del ahead first.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Leandro Dorileo <[email protected]>
Signed-off-by: Chunyan Liu <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
This page took 0.082608 seconds and 4 git commands to generate.