]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agotarget-i386: cpu: make -cpu host/check/enforce code KVM-specific
Eduardo Habkost [Wed, 24 Oct 2012 21:44:06 +0000 (19:44 -0200)]
target-i386: cpu: make -cpu host/check/enforce code KVM-specific

Rationale:
 * "-cpu host" is available only when using KVM
 * The current implementation of -cpu check/enforce
   (check_features_against_host()) makes sense only when using KVM.

So this makes the functions check_features_against_host() and
cpu_x86_fill_host() KVM-specific, document them as such, and rename them
to kvm_check_features_against_host() and kvm_cpu_fill_host().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agotarget-i386: make cpu_x86_fill_host() void
Eduardo Habkost [Wed, 24 Oct 2012 21:44:05 +0000 (19:44 -0200)]
target-i386: make cpu_x86_fill_host() void

The return value of that function is always 0, and is always ignored.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoEmulate qemu-kvms -no-kvm option
Jan Kiszka [Fri, 5 Oct 2012 17:51:45 +0000 (14:51 -0300)]
Emulate qemu-kvms -no-kvm option

Releases of qemu-kvm will be interrupted at qemu 1.3.0.
Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line
options specific to qemu-kvm, port these switches from qemu-kvm
to qemu.git.

Port -no-kvm option.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoIssue warning when deprecated -tdf option is used
Jan Kiszka [Fri, 5 Oct 2012 17:51:44 +0000 (14:51 -0300)]
Issue warning when deprecated -tdf option is used

Releases of qemu-kvm will be interrupted at qemu 1.3.0.
Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line
options specific to qemu-kvm, port these switches from qemu-kvm
to qemu.git.

Port -tdf option.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoIssue warning when deprecated drive parameter boot=on|off is used
Jan Kiszka [Fri, 5 Oct 2012 17:51:43 +0000 (14:51 -0300)]
Issue warning when deprecated drive parameter boot=on|off is used

Releases of qemu-kvm will be interrupted at qemu 1.3.0.
Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line
options specific to qemu-kvm, port these switches from qemu-kvm
to qemu.git.

Port drive boot option. From the qemu-kvm original commit message:

We do not want to maintain this option forever. It will be removed after
a grace period of a few releases. So warn the user that this option has
no effect and will become invalid soon.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoUse global properties to emulate -no-kvm-pit-reinjection
Jan Kiszka [Fri, 5 Oct 2012 17:51:42 +0000 (14:51 -0300)]
Use global properties to emulate -no-kvm-pit-reinjection

Releases of qemu-kvm will be interrupted at qemu 1.3.0.
Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line
options specific to qemu-kvm, port these switches from qemu-kvm
to qemu.git.

Port -no-kvm-pit-reinjection.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoIssue warning when deprecated -no-kvm-pit is used
Jan Kiszka [Fri, 5 Oct 2012 17:51:41 +0000 (14:51 -0300)]
Issue warning when deprecated -no-kvm-pit is used

Releases of qemu-kvm will be interrupted at qemu 1.3.0.
Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line
options specific to qemu-kvm, port these switches from qemu-kvm
to qemu.git.

Port -no-kvm-pit option.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoUse machine options to emulate -no-kvm-irqchip
Jan Kiszka [Fri, 5 Oct 2012 17:51:40 +0000 (14:51 -0300)]
Use machine options to emulate -no-kvm-irqchip

Releases of qemu-kvm will be interrupted at qemu 1.3.0.
Users should switch to plain qemu releases.
To avoid breaking scenarios which are setup with command line
options specific to qemu-kvm, port these switches from qemu-kvm
to qemu.git.

Port -no-kvm-irqchip option.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agocirrus_vga: allow configurable vram size
Marcelo Tosatti [Fri, 5 Oct 2012 17:51:39 +0000 (14:51 -0300)]
cirrus_vga: allow configurable vram size

Allow RAM size to be configurable for cirrus, to allow migration
compatibility from qemu-kvm.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agotarget-i386: Add missing kvm cpuid feature name
Don Slutz [Fri, 12 Oct 2012 19:43:23 +0000 (15:43 -0400)]
target-i386: Add missing kvm cpuid feature name

Currently "-cpu host,-kvmclock,-kvm_nopiodelay,-kvm_mmu" does not
turn off all bits in CPUID 0x40000001 EAX.

The missing ones is KVM_FEATURE_STEAL_TIME.

This adds the name kvm_steal_time.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: cpu: add missing CPUID[EAX=7,ECX=0] flag names
Eduardo Habkost [Tue, 9 Oct 2012 14:03:59 +0000 (11:03 -0300)]
i386: cpu: add missing CPUID[EAX=7,ECX=0] flag names

This makes QEMU recognize the following CPU flag names:

 Flags            | Corresponding KVM kernel commit
 -----------------+----------------------------------------
 FSGSBASE         | 176f61da82435eae09cc96f70b530d1ba0746b8b
 AVX2, BMI1, BMI2 | fb215366b3c7320ac25dca766a0152df16534932
 HLE, RTM         | 83c529151ab0d4a813e3f6a3e293fff75d468519
 INVPCID          | ad756a1603c5fac207758faaac7f01c34c9d0b7b
 ERMS             | a01c8f9b4e266df1d7166d23216f2060648f862d

Reviewed-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: filter CPUID leaf 7 based on GET_SUPPORTED_CPUID, too
Eduardo Habkost [Thu, 4 Oct 2012 20:49:07 +0000 (17:49 -0300)]
i386: kvm: filter CPUID leaf 7 based on GET_SUPPORTED_CPUID, too

Now that CPUID leaf 7 features can be enabled/disabled on the
command-line, we need to filter them properly using GET_SUPPORTED_CPUID,
at the same place where other features are filtered out.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: reformat filter_features_for_kvm() code
Eduardo Habkost [Thu, 4 Oct 2012 20:49:06 +0000 (17:49 -0300)]
i386: kvm: reformat filter_features_for_kvm() code

Cosmetic, but it will also help to make futher patches easier to review.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: filter CPUID feature words earlier, on cpu.c
Eduardo Habkost [Thu, 4 Oct 2012 20:49:05 +0000 (17:49 -0300)]
i386: kvm: filter CPUID feature words earlier, on cpu.c

cpu.c contains the code that will check if all requested CPU features
are available, so the filtering of KVM features must be there, so we can
implement "check" and "enforce" properly.

The only point where kvm_arch_init_vcpu() is called on i386 is:

- cpu_x86_init()
  - x86_cpu_realize() (after cpu_x86_register() is called)
    - qemu_init_vcpu()
      - qemu_kvm_start_vcpu()
        - qemu_kvm_thread_fn() (on a new thread)
          - kvm_init_vcpu()
            - kvm_arch_init_vcpu()

With this patch, the filtering will be done earlier, at:
- cpu_x86_init()
  - cpu_x86_register() (before x86_cpu_realize() is called)

Also, the KVM CPUID filtering will now be done at the same place where
the TCG CPUID feature filtering is done. Later, the code can be changed
to use the same filtering code for the "check" and "enforce" modes, as
now the cpu.c code knows exactly which CPU features are going to be
exposed to the guest (and much earlier).

One thing I was worrying about when doing this is that
kvm_arch_get_supported_cpuid() depends on kvm_irqchip_in_kernel(), and
maybe the 'kvm_kernel_irqchip' global variable wasn't initialized yet at
CPU creation time. But kvm_kernel_irqchip is initialized during
kvm_init(), that is called very early (much earlier than the machine
init function), and kvm_init() is already a requirement to run the
GET_SUPPORTED_CPUID ioctl() (as kvm_init() initializes the kvm_state
global variable).

Side note: it would be nice to keep KVM-specific code inside kvm.c. The
problem is that properly implementing -cpu check/enforce code (that's
inside cpu.c) depends directly on the feature bit filtering done using
kvm_arch_get_supported_cpuid(). Currently -cpu check/enforce is broken
because it simply uses the host CPU feature bits instead of
GET_SUPPORTED_CPUID, and we need to fix that.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: mask cpuid_ext4_features bits earlier
Eduardo Habkost [Thu, 4 Oct 2012 20:49:04 +0000 (17:49 -0300)]
i386: kvm: mask cpuid_ext4_features bits earlier

This way all the filtering by GET_SUPPORTED_CPUID is being done at the
same place in the code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: mask cpuid_kvm_features earlier
Eduardo Habkost [Thu, 4 Oct 2012 20:49:03 +0000 (17:49 -0300)]
i386: kvm: mask cpuid_kvm_features earlier

Instead of masking the KVM feature bits very late (while building the
KVM_SET_CPUID2 data), mask it out on env->cpuid_kvm_features, at the
same point where the other feature words are masked out.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: x2apic is not supported without in-kernel irqchip
Eduardo Habkost [Thu, 4 Oct 2012 20:49:02 +0000 (17:49 -0300)]
i386: kvm: x2apic is not supported without in-kernel irqchip

This is necessary so that x2apic is not improperly enabled when the
in-kernel irqchip is disabled.

This won't generate a warning with "-cpu ...,check" because the current
check/enforce code is broken (it checks the host CPU data directly,
instead of using kvm_arch_get_supported_cpuid()), but it will be
eventually fixed to properly report the missing x2apic flag.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: set CPUID_EXT_TSC_DEADLINE_TIMER on kvm_arch_get_supported_cpuid()
Eduardo Habkost [Thu, 4 Oct 2012 20:49:01 +0000 (17:49 -0300)]
i386: kvm: set CPUID_EXT_TSC_DEADLINE_TIMER on kvm_arch_get_supported_cpuid()

This moves the CPUID_EXT_TSC_DEADLINE_TIMER CPUID flag hacking from
kvm_arch_init_vcpu() to kvm_arch_get_supported_cpuid().

Full git grep for kvm_arch_get_supported_cpuid:

   kvm.h:uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
   target-i386/cpu.c:        x86_cpu_def->cpuid_7_0_ebx_features = kvm_arch_get_supported_cpuid(kvm_state, 0x7, 0, R_EBX);
   target-i386/cpu.c:            *eax = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EAX);
   target-i386/cpu.c:            *ebx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EBX);
   target-i386/cpu.c:            *ecx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_ECX);
   target-i386/cpu.c:            *edx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EDX);
   target-i386/cpu.c:            *eax = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EAX);
   target-i386/cpu.c:            *ebx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EBX);
   target-i386/cpu.c:            *ecx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_ECX);
   target-i386/cpu.c:            *edx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EDX);
   target-i386/kvm.c:uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
   target-i386/kvm.c:        cpuid_1_edx = kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
   target-i386/kvm.c:    env->cpuid_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
 * target-i386/kvm.c:    env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX);
   target-i386/kvm.c:    env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
   target-i386/kvm.c:    env->cpuid_ext3_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
   target-i386/kvm.c:    env->cpuid_svm_features  &= kvm_arch_get_supported_cpuid(s, 0x8000000A,
   target-i386/kvm.c:        kvm_arch_get_supported_cpuid(s, KVM_CPUID_FEATURES, 0, R_EAX);
   target-i386/kvm.c:            kvm_arch_get_supported_cpuid(s, 0xC0000001, 0, R_EDX);

Note that there is only one call for CPUID[1].ECX above (*), and it is
the one that gets hacked to include CPUID_EXT_TSC_DEADLINE_TIMER, so we
can simply make kvm_arch_get_supported_cpuid() set it, to let the rest
of the code know the flag can be safely set by QEMU.

One thing I was worrying about when doing this is that now
kvm_arch_get_supported_cpuid() depends on kvm_irqchip_in_kernel(). But
the 'kvm_kernel_irqchip' global variable is initialized during
kvm_init(), that is called very early, and kvm_init() is already a
requirement to run the GET_SUPPORTED_CPUID ioctl() (as kvm_init() is the
function that initializes the 'kvm_state' global variable).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: set CPUID_EXT_HYPERVISOR on kvm_arch_get_supported_cpuid()
Eduardo Habkost [Thu, 4 Oct 2012 20:49:00 +0000 (17:49 -0300)]
i386: kvm: set CPUID_EXT_HYPERVISOR on kvm_arch_get_supported_cpuid()

Full grep for kvm_arch_get_supported_cpuid:

   kvm.h:uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
   target-i386/cpu.c:        x86_cpu_def->cpuid_7_0_ebx_features = kvm_arch_get_supported_cpuid(kvm_state, 0x7, 0, R_EBX);
   target-i386/cpu.c:            *eax = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EAX);
   target-i386/cpu.c:            *ebx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EBX);
   target-i386/cpu.c:            *ecx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_ECX);
   target-i386/cpu.c:            *edx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EDX);
   target-i386/cpu.c:            *eax = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EAX);
   target-i386/cpu.c:            *ebx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EBX);
   target-i386/cpu.c:            *ecx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_ECX);
   target-i386/cpu.c:            *edx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EDX);
   target-i386/kvm.c:uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
   target-i386/kvm.c:        cpuid_1_edx = kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
   target-i386/kvm.c:    env->cpuid_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
 * target-i386/kvm.c:    env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX);
   target-i386/kvm.c:    env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
   target-i386/kvm.c:    env->cpuid_ext3_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
   target-i386/kvm.c:    env->cpuid_svm_features  &= kvm_arch_get_supported_cpuid(s, 0x8000000A,
   target-i386/kvm.c:        kvm_arch_get_supported_cpuid(s, KVM_CPUID_FEATURES, 0, R_EAX);
   target-i386/kvm.c:            kvm_arch_get_supported_cpuid(s, 0xC0000001, 0, R_EDX);

Note that there is only one call for CPUID[1].ECX above (*), and it is
the one that gets hacked to include CPUID_EXT_HYPERVISOR, so we can
simply make kvm_arch_get_supported_cpuid() set it, to let the rest of
the code automatically know that the flag can be safely set by QEMU.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: kvm_arch_get_supported_cpuid: replace if+switch with single 'if'
Eduardo Habkost [Thu, 4 Oct 2012 20:48:59 +0000 (17:48 -0300)]
i386: kvm: kvm_arch_get_supported_cpuid: replace if+switch with single 'if'

Additional fixups will be added, and making them a single 'if/else if'
chain makes it clearer than two nested switch statements.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: extract try_get_cpuid() loop to get_supported_cpuid() function
Eduardo Habkost [Thu, 4 Oct 2012 20:48:58 +0000 (17:48 -0300)]
i386: kvm: extract try_get_cpuid() loop to get_supported_cpuid() function

No behavior change, just code movement.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: extract CPUID entry lookup to cpuid_find_entry() function
Eduardo Habkost [Thu, 4 Oct 2012 20:48:57 +0000 (17:48 -0300)]
i386: kvm: extract CPUID entry lookup to cpuid_find_entry() function

No behavior change, just code movement.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: extract register switch to cpuid_entry_get_reg() function
Eduardo Habkost [Thu, 4 Oct 2012 20:48:56 +0000 (17:48 -0300)]
i386: kvm: extract register switch to cpuid_entry_get_reg() function

No behavior change: just code movement.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: kvm_arch_get_supported_cpuid: use 'entry' variable
Eduardo Habkost [Thu, 4 Oct 2012 20:48:55 +0000 (17:48 -0300)]
i386: kvm: kvm_arch_get_supported_cpuid: use 'entry' variable

The reg switch will be moved to a separate function, so store the entry
pointer in a variable.

No behavior change, just code movement.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: kvm_arch_get_supported_cpuid: clean up has_kvm_features check
Eduardo Habkost [Thu, 4 Oct 2012 20:48:54 +0000 (17:48 -0300)]
i386: kvm: kvm_arch_get_supported_cpuid: clean up has_kvm_features check

Instead of a function-specific has_kvm_features variable, simply use a
"found" variable that will be checked in case we have to use the legacy
get_para_features() interface.

No behavior change, just code cleanup.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agoi386: kvm: kvm_arch_get_supported_cpuid: move R_EDX hack outside of for loop
Eduardo Habkost [Thu, 4 Oct 2012 20:48:53 +0000 (17:48 -0300)]
i386: kvm: kvm_arch_get_supported_cpuid: move R_EDX hack outside of for loop

The for loop will become a separate function, so clean it up so it can
become independent from the bit hacking for R_EDX.

No behavior change[1], just code movement.

[1] Well, only if the kernel returned CPUID leafs 1 or 0x80000001 as
    unsupported, but there's no kernel version that does that.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agotap-win32: stubs to fix win32 build
Michael S. Tsirkin [Tue, 30 Oct 2012 14:04:50 +0000 (16:04 +0200)]
tap-win32: stubs to fix win32 build

Add missing stubs to win32 to fix link failure.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotests/tcg: fix unused result warnings
Catalin Patulea [Mon, 29 Oct 2012 18:01:07 +0000 (14:01 -0400)]
tests/tcg: fix unused result warnings

With i386-linux-user target on x86_64 host, this does not introduce any new test
failures.

Signed-off-by: Catalin Patulea <catalinp@google.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: use -Wwombat to test whether gcc recognizes -Wno-wombat
Peter Maydell [Sat, 27 Oct 2012 21:19:07 +0000 (22:19 +0100)]
configure: use -Wwombat to test whether gcc recognizes -Wno-wombat

gcc will silently accept unrecognized -Wno-wombat warning suppression
options (it only mentions them if it has to print a compiler warning
for some other reason). Since we already run a check for whether gcc
recognizes the warning options we use, we can easily make this use
the positive sense of the option when checking for support for the
suppression option. This doesn't have any effect except that it avoids
gcc emitting extra messages about unrecognized command line options
when it is printing other warning messages.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-sparc: Revert setting cpu_dst to gen_dest_gpr
Richard Henderson [Mon, 29 Oct 2012 04:50:20 +0000 (15:50 +1100)]
target-sparc: Revert setting cpu_dst to gen_dest_gpr

There is some read-after-write error within the OP=2 insns which
prevents setting cpu_dst to the real output register.  Until this
is found and fixed, always write to a temporary first.

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'qspi.2' of git://developer.petalogix.com/public/qemu
Blue Swirl [Tue, 30 Oct 2012 18:35:18 +0000 (18:35 +0000)]
Merge branch 'qspi.2' of git://developer.petalogix.com/public/qemu

* 'qspi.2' of git://developer.petalogix.com/public/qemu:
  xilinx_zynq: added QSPI controller
  xilinx_spips: Generalised to model QSPI
  m25p80: Support for Quad SPI

11 years agoMerge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf
Aurelien Jarno [Mon, 29 Oct 2012 23:35:43 +0000 (00:35 +0100)]
Merge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf

* 's390-for-upstream' of git://repo.or.cz/qemu/agraf:
  s390: sclp ascii console support
  s390: sclp signal quiesce support
  s390: sclp event support
  s390: sclp base support
  s390: use sync regs for register transfer
  s390/kvm_stat: correct sys_perf_event_open syscall number
  s390x: fix -initrd in virtio machine

11 years agotcg/mips: use MUL instead of MULT on MIPS32 and above
Aurelien Jarno [Fri, 19 Oct 2012 21:48:13 +0000 (23:48 +0200)]
tcg/mips: use MUL instead of MULT on MIPS32 and above

MIPS32 and later instruction sets have a multiplication instruction
directly operating on GPRs. It only produces a 32-bit result but
it is exactly what is needed by QEMU.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agomemory: fix rendering of a region obscured by another
Avi Kivity [Mon, 29 Oct 2012 16:22:36 +0000 (18:22 +0200)]
memory: fix rendering of a region obscured by another

The memory core drops regions that are hidden by another region (for example,
during BAR sizing), but it doesn't do so correctly if the lower address of the
existing range is below the lower address of the new range.

Example (qemu-system-mips -M malta -kernel vmlinux-2.6.32-5-4kc-malta
         -append "console=ttyS0"  -nographic -vga cirrus):

Existing range: 10000000-107fffff
New range:      100a0000-100bffff

Correct behaviour: drop new range
Incorrect behaviour: add new range

Fix by taking this case into account (previously we only considered
equal lower boundaries).

Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 29 Oct 2012 19:31:47 +0000 (14:31 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

virtio,pci infrastructure

This includes infrastructure patches that don't do much by themselves
but should help vfio and q35 make progress.
Also included is rework of virtio-net to use iovec APIs
for vector access - helpful to make it more secure
and in preparation for a new feature that will allow
arbitrary s/g layout for guests.
Also included is a pci bridge bugfix by Avi.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* mst/tags/for_anthony: (25 commits)
  pci: avoid destroying bridge address space windows in a transaction
  virtio-net: enable mrg buf header in tap on linux
  virtio-net: test peer header support at init time
  virtio-net: minor code simplification
  virtio-net: simplify rx code
  virtio-net: switch tx to safe iov functions
  virtio-net: first s/g is always at start of buf
  virtio-net: refactor receive_hdr
  virtio-net: use safe iov operations for rx
  virtio-net: avoid sg copy
  iov: add iov_cpy
  virtio-net: track host/guest header length
  pcie: Convert PCIExpressHost to use the QOM.
  pcie: pass pcie window size to pcie_host_mmcfg_update()
  pci: Add class 0xc05 as 'SMBus'
  pci: introduce pci_swizzle_map_irq_fn() for standardized interrupt pin swizzle
  pci_ids: add intel 82801BA pci-to-pci bridge id
  pci: pci capability must be in PCI space
  pci: make each capability DWORD aligned
  qemu: enable PV EOI for qemu 1.3
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agos390: sclp ascii console support
Heinz Graalfs [Mon, 29 Oct 2012 02:13:25 +0000 (02:13 +0000)]
s390: sclp ascii console support

This code adds console support  by implementing SCLP's ASCII Console
Data event. This is the same console as LPARs ASCII console or z/VMs
sysascii.

The console can be specified manually with something like
-chardev stdio,id=charconsole0 -device sclpconsole,chardev=charconsole0,id=console0

Newer kernels will autodetect that console and prefer that over virtio
console.

When data is received from the character layer it creates a service
interrupt to trigger a Read Event Data command from the guest that will
pick up the received character byte-stream.
When characters are echo'ed by the linux guest a Write Event Data occurs
which is forwarded by the Event Facility to the console that supports
a corresponding mask value.
Console resizing is not supported.
The character layer byte-stream is buffered using a fixed size iov
buffer.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390: sclp signal quiesce support
Heinz Graalfs [Mon, 29 Oct 2012 02:13:24 +0000 (02:13 +0000)]
s390: sclp signal quiesce support

This implements the sclp signal quiesce event via the SCLP Event
Facility.
This allows to gracefully shutdown a guest by using system_powerdown
notifiers. It creates a service interrupt that will trigger a
Read Event Data command from the guest. This code will then add an
event that is interpreted by linux guests as ctrl-alt-del.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390: sclp event support
Heinz Graalfs [Mon, 29 Oct 2012 02:13:23 +0000 (02:13 +0000)]
s390: sclp event support

Several SCLP features are considered to be events. Those events don't
provide SCLP commands on their own, instead they are all based on
Read Event Data, Write Event Data, Write Event Mask and the service
interrupt. Follow-on patches will provide SCLP's Signal Quiesce (via
system_powerdown) and the ASCII console.
Further down the road the sclp line mode console and configuration
change events (e.g. cpu hotplug) can be implemented.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390: sclp base support
Heinz Graalfs [Mon, 29 Oct 2012 02:13:22 +0000 (02:13 +0000)]
s390: sclp base support

This adds a more generic infrastructure for handling Service-Call
requests on s390. Currently we only support a small subset of Read
SCP Info directly in target-s390x. This patch provides the base
infrastructure for supporting more commands and moves Read SCP
Info.
In the future we could add additional commands for hotplug, call
home and event handling.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390: use sync regs for register transfer
Christian Borntraeger [Mon, 29 Oct 2012 02:13:21 +0000 (02:13 +0000)]
s390: use sync regs for register transfer

Newer kernels provide the guest registers in kvm_run. Lets use
those if available (i.e. the capability is set). This avoids
ioctls on cpu_synchronize_state making intercepts faster.

In addition, we have now the prefix register, the access registers
the control registers up to date. This helps in certain cases,
e.g. for resolving kernel module addresses with gdb on a guest.

On return, we update the registers according to the level statement,
i.e. we put all registers for KVM_PUT_FULL_STATE and _RESET_STATE.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390/kvm_stat: correct sys_perf_event_open syscall number
Heinz Graalfs [Mon, 29 Oct 2012 02:13:20 +0000 (02:13 +0000)]
s390/kvm_stat: correct sys_perf_event_open syscall number

Correct sys_perf_event_open syscall number for s390 architecture
   - the hardcoded syscall number 298 is for x86 but should
     be different for other architectures.
     In case we figure out via /proc/cpuinfo that we are running
     on s390 the appropriate syscall number is used from map
     syscall_numbers; other architectures can extend this.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agos390x: fix -initrd in virtio machine
Alexander Graf [Wed, 19 Sep 2012 15:24:46 +0000 (17:24 +0200)]
s390x: fix -initrd in virtio machine

When using -initrd in the virtio machine, we need to indicate the initrd
start and size inside the kernel image. These parameters need to be stored
in native endianness.

Signed-off-by: Alexander Graf <agraf@suse.de>
Acked-by: Richard Henderson <rth@twiddle.net>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
11 years agopci: avoid destroying bridge address space windows in a transaction
Avi Kivity [Thu, 25 Oct 2012 10:37:57 +0000 (12:37 +0200)]
pci: avoid destroying bridge address space windows in a transaction

Calling memory_region_destroy() in a transaction is illegal (and aborts),
as until the transaction is committed, the region remains live.

Fix by moving destruction until after the transaction commits.  This requires
having an extra set of regions, so the new and old regions can coexist.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: enable mrg buf header in tap on linux
Michael S. Tsirkin [Mon, 24 Sep 2012 19:05:03 +0000 (21:05 +0200)]
virtio-net: enable mrg buf header in tap on linux

Modern linux supports arbitrary header size,
which makes it possible to pass mrg buf header
to tap directly without iovec mangling.
Use this capability when it is there.

This removes the need to deal with it in
vhost-net as we do now.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: test peer header support at init time
Michael S. Tsirkin [Mon, 24 Sep 2012 15:04:21 +0000 (17:04 +0200)]
virtio-net: test peer header support at init time

There's no reason to query header support at random
times: at load or feature query.
Driver also might not query functions.
Cleaner to do it at device init.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: minor code simplification
Michael S. Tsirkin [Mon, 24 Sep 2012 14:27:27 +0000 (16:27 +0200)]
virtio-net: minor code simplification

During packet filtering, we can now use host hdr len
to offset incoming buffer unconditionally.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: simplify rx code
Michael S. Tsirkin [Mon, 24 Sep 2012 12:54:44 +0000 (14:54 +0200)]
virtio-net: simplify rx code

Remove code duplication using guest header length that we track.
Drop specific layout requirement for rx buffers: things work
using generic iovec functions in any case.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: switch tx to safe iov functions
Michael S. Tsirkin [Mon, 24 Sep 2012 12:52:28 +0000 (14:52 +0200)]
virtio-net: switch tx to safe iov functions

Avoid mangling iovec manually: use safe iov_*
functions.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: first s/g is always at start of buf
Michael S. Tsirkin [Mon, 24 Sep 2012 11:26:55 +0000 (13:26 +0200)]
virtio-net: first s/g is always at start of buf

We know offset is 0, assert that.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: refactor receive_hdr
Michael S. Tsirkin [Mon, 24 Sep 2012 11:24:17 +0000 (13:24 +0200)]
virtio-net: refactor receive_hdr

Now that we know host hdr length, we don't need to
duplicate the logic in receive_hdr: caller can
figure out the offset itself.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: use safe iov operations for rx
Michael S. Tsirkin [Mon, 24 Sep 2012 11:17:13 +0000 (13:17 +0200)]
virtio-net: use safe iov operations for rx

Avoid magling iov manually: use safe iov operations
for processing packets incoming to guest.
This also removes the requirement for virtio header to
fit the first s/g entry exactly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: avoid sg copy
Michael S. Tsirkin [Mon, 24 Sep 2012 11:14:16 +0000 (13:14 +0200)]
virtio-net: avoid sg copy

Avoid tweaking iovec during receive. This removes
the need to copy the vector.
Note: we currently have an evil cast in work_around_broken_dhclient
and unfortunately this patch does not fix it - just
pushes the evil cast to another place.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoiov: add iov_cpy
Michael S. Tsirkin [Mon, 24 Sep 2012 11:02:52 +0000 (13:02 +0200)]
iov: add iov_cpy

Add API to copy part of iovec safely.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agovirtio-net: track host/guest header length
Michael S. Tsirkin [Mon, 24 Sep 2012 10:12:25 +0000 (12:12 +0200)]
virtio-net: track host/guest header length

Tracking these in device state instead of
re-calculating on each packet. No functional
changes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: avoid destroying bridge address space windows in a transaction
Avi Kivity [Thu, 25 Oct 2012 10:37:57 +0000 (12:37 +0200)]
pci: avoid destroying bridge address space windows in a transaction

Calling memory_region_destroy() in a transaction is illegal (and aborts),
as until the transaction is committed, the region remains live.

Fix by moving destruction until after the transaction commits.  This requires
having an extra set of regions, so the new and old regions can coexist.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopcie: Convert PCIExpressHost to use the QOM.
Jason Baron [Fri, 19 Oct 2012 20:43:33 +0000 (16:43 -0400)]
pcie: Convert PCIExpressHost to use the QOM.

Let's use PCIExpressHost with QOM.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopcie: pass pcie window size to pcie_host_mmcfg_update()
Jason Baron [Fri, 19 Oct 2012 20:43:32 +0000 (16:43 -0400)]
pcie: pass pcie window size to pcie_host_mmcfg_update()

This allows q35 to pass/set the size of the pcie window in its update routine.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Add class 0xc05 as 'SMBus'
Jan Kiszka [Fri, 19 Oct 2012 20:43:31 +0000 (16:43 -0400)]
pci: Add class 0xc05 as 'SMBus'

[jbaron@redhat.com: add PCI_CLASS_SERIAL_SMBUS definition]
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: introduce pci_swizzle_map_irq_fn() for standardized interrupt pin swizzle
Isaku Yamahata [Fri, 19 Oct 2012 20:43:28 +0000 (16:43 -0400)]
pci: introduce pci_swizzle_map_irq_fn() for standardized interrupt pin swizzle

Introduce pci_swizzle_map_irq_fn() for interrupt pin swizzle which is
standardized. PCI bridge swizzle is common logic, by introducing
this function duplicated swizzle logic will be avoided later.

[jbaron@redhat.com: drop opaque argument]
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci_ids: add intel 82801BA pci-to-pci bridge id
Isaku Yamahata [Fri, 19 Oct 2012 20:43:31 +0000 (16:43 -0400)]
pci_ids: add intel 82801BA pci-to-pci bridge id

Adds pci id constants which will be used by q35.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: pci capability must be in PCI space
Isaku Yamahata [Fri, 19 Oct 2012 20:43:28 +0000 (16:43 -0400)]
pci: pci capability must be in PCI space

pci capability must be in PCI space.
It can't lay in PCIe extended config space.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: make each capability DWORD aligned
Michael S. Tsirkin [Mon, 22 Oct 2012 10:35:00 +0000 (12:35 +0200)]
pci: make each capability DWORD aligned

PCI spec (see e.g. 6.7 Capabilities List in spec rev 3.0)
requires that each capability is DWORD aligned.
Ensure this when allocating space by rounding size up to 4.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoqemu: enable PV EOI for qemu 1.3
Michael S. Tsirkin [Wed, 17 Oct 2012 22:15:48 +0000 (00:15 +0200)]
qemu: enable PV EOI for qemu 1.3

Enable KVM PV EOI by default. You can still disable it with
-kvm_pv_eoi cpu flag. To avoid breaking cross-version migration,
enable only for qemu 1.3 (or in the future, newer) machine type.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Return PCI_INTX_DISABLED when no bus INTx routing support
Alex Williamson [Wed, 17 Oct 2012 22:13:12 +0000 (16:13 -0600)]
pci: Return PCI_INTX_DISABLED when no bus INTx routing support

Rather than assert, simply return PCI_INTX_DISABLED when we don't
have a pci_route_irq_fn.  PIIX already returns DISABLED for an
invalid pin, so users already deal with this state.  Users of this
interface should only be acting on an ENABLED or INVERTED return
value (though we really have no support for INVERTED).  Also
complain loudly when we hit this so we don't forget it's missing.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agopci-assign: Use msi_get_message()
Alex Williamson [Tue, 2 Oct 2012 19:22:14 +0000 (13:22 -0600)]
pci-assign: Use msi_get_message()

pci-assign only uses a subset of the flexibility msi_get_message()
provides, but it's still worthwhile to use it.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agomsi: Add msi_get_message()
Alex Williamson [Tue, 2 Oct 2012 19:22:07 +0000 (13:22 -0600)]
msi: Add msi_get_message()

vfio-pci and pci-assign both do this on their own for setting up
direct MSI injection through KVM.  Provide a helper function for
this in MSI code.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci-assign: Use pci_intx_route_changed()
Alex Williamson [Tue, 2 Oct 2012 19:22:01 +0000 (13:22 -0600)]
pci-assign: Use pci_intx_route_changed()

Replace open coded version

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Helper function for testing if an INTx route changed
Alex Williamson [Tue, 2 Oct 2012 19:21:54 +0000 (13:21 -0600)]
pci: Helper function for testing if an INTx route changed

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoMerge remote-tracking branch 'kraxel/usb.68' into staging
Anthony Liguori [Mon, 29 Oct 2012 15:34:29 +0000 (10:34 -0500)]
Merge remote-tracking branch 'kraxel/usb.68' into staging

* kraxel/usb.68: (36 commits)
  xhci: fix usb name in caps
  xhci: make number of interrupters and slots configurable
  xhci: allow disabling interrupters
  xhci: flush endpoint context unconditinally
  xhci: fix function name in error message
  uhci: Use only one queue for ctrl endpoints
  uhci: Retry to fill the queue while waiting for td completion
  uhci: Always mark a queue valid when we encounter it
  uhci: When the guest marks a pending td non-active, cancel the queue
  uhci: Detect guest td re-use
  uhci: Verify queue has not been changed by guest
  uhci: Immediately free queues on device disconnect
  uhci: Store ep in UHCIQueue
  uhci: Make uhci_fill_queue() actually operate on an UHCIQueue
  uhci: Add uhci_read_td() helper function
  uhci: Rename UHCIAsync->td to UHCIAsync->td_addr
  uhci: Move emptying of the queue's asyncs' queue to uhci_queue_free
  uhci: Drop unnecessary forward declaration of some static functions
  uhci: Don't retry on error
  uhci: cleanup: Add an unlink call to uhci_async_cancel()
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 29 Oct 2012 15:34:05 +0000 (10:34 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (32 commits)
  osdep: Less restrictive F_SEFL in qemu_dup_flags()
  qemu-iotests: add testcases for mirroring on-source-error/on-target-error
  qmp: add pull_event function
  mirror: add support for on-source-error/on-target-error
  iostatus: forward block_job_iostatus_reset to block job
  qemu-iotests: add mirroring test case
  mirror: implement completion
  qmp: add drive-mirror command
  mirror: introduce mirror job
  block: introduce BLOCK_JOB_READY event
  block: add block-job-complete
  block: rename block_job_complete to block_job_completed
  block: export dirty bitmap information in query-block
  block: introduce new dirty bitmap functionality
  block: add bdrv_open_backing_file
  block: add bdrv_query_stats
  block: add bdrv_query_info
  qemu-config: Add new -add-fd command line option
  monitor: Prevent removing fd from set during init
  monitor: Enable adding an inherited fd to an fd set
  ...

Conflicts:
vl.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
Aurelien Jarno [Mon, 29 Oct 2012 13:56:17 +0000 (14:56 +0100)]
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf

* 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf: (22 commits)
  PPC: pseries: Remove hack for PIO window
  PPC: e500: Map PIO space into core memory region
  xen_platform: convert PIO to new memory api read/write
  vmport: convert PIO to new memory api read/write
  serial: convert PIO to new memory api read/write
  rtl8139: convert PIO to new memory api read/write
  pckbd: convert PIO to new memory api read/write
  pc port92: convert PIO to new memory api read/write
  mc146818rtc: convert PIO to new memory api read/write
  m48t59: convert PIO to new memory api read/write
  i8254: convert PIO to new memory api read/write
  es1370: convert PIO to new memory api read/write
  virtio-pci: convert PIO to new memory api read/write
  ac97: convert PIO to new memory api read/write
  pseries: Implement qemu initiated shutdowns using EPOW events
  target-ppc: Rework storage of VPA registration state
  pseries: Don't allow duplicate registration of hcalls or RTAS calls
  Add USB option in machine options
  e500: Fix serial initialization
  PPC: 440: Emulate DCBR0
  ...

11 years agoMerge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable
Aurelien Jarno [Mon, 29 Oct 2012 13:55:51 +0000 (14:55 +0100)]
Merge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable

* 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable:
  migration: go to paused state after finishing incoming migration with -S
  qmp: handle stop/cont in INMIGRATE state
  hmp: fix info cpus for sparc targets

11 years agoPPC: pseries: Remove hack for PIO window
Alexander Graf [Mon, 8 Oct 2012 11:54:18 +0000 (13:54 +0200)]
PPC: pseries: Remove hack for PIO window

Now that all users of old_portio are gone, we can remove the hack
that enabled us to support them.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: e500: Map PIO space into core memory region
Alexander Graf [Mon, 8 Oct 2012 10:21:30 +0000 (12:21 +0200)]
PPC: e500: Map PIO space into core memory region

On PPC, we don't have PIO. So usually PIO space behind a PCI bridge is
accessible via MMIO. Do this mapping explicitly by mapping the PIO space
of our PCI bus into a memory region that lives in memory space.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoxen_platform: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:47:30 +0000 (13:47 +0200)]
xen_platform: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agovmport: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:44:24 +0000 (13:44 +0200)]
vmport: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoserial: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:40:29 +0000 (13:40 +0200)]
serial: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agortl8139: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:35:24 +0000 (13:35 +0200)]
rtl8139: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopckbd: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:30:08 +0000 (13:30 +0200)]
pckbd: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopc port92: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:24:52 +0000 (13:24 +0200)]
pc port92: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agomc146818rtc: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:22:28 +0000 (13:22 +0200)]
mc146818rtc: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agom48t59: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:19:48 +0000 (13:19 +0200)]
m48t59: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoi8254: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:12:31 +0000 (13:12 +0200)]
i8254: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoes1370: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:09:44 +0000 (13:09 +0200)]
es1370: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agovirtio-pci: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:02:30 +0000 (13:02 +0200)]
virtio-pci: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoac97: convert PIO to new memory api read/write
Alexander Graf [Mon, 8 Oct 2012 11:02:20 +0000 (13:02 +0200)]
ac97: convert PIO to new memory api read/write

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Implement qemu initiated shutdowns using EPOW events
David Gibson [Mon, 8 Oct 2012 18:17:39 +0000 (18:17 +0000)]
pseries: Implement qemu initiated shutdowns using EPOW events

At present, using 'system_powerdown' from the monitor or otherwise
instructing qemu to (cleanly) shut down a pseries guest will not work,
because we did not have a method of signalling the shutdown request to the
guest.

PAPR does include a usable mechanism for this, though it is rather more
involved than the equivalent on x86.  This involves sending an EPOW
(Environmental and POwer Warning) event through the PAPR event and error
logging mechanism, which also has a number of other functions.

This patch implements just enough of the event/error logging functionality
to be able to send a shutdown event to the guest.  At least with modern
guest kernels and a userspace that is up and running, this means that
system_powerdown from the qemu monitor should now work correctly on pseries
guests.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Rework storage of VPA registration state
David Gibson [Mon, 8 Oct 2012 18:17:38 +0000 (18:17 +0000)]
target-ppc: Rework storage of VPA registration state

With PAPR guests, hypercalls allow registration of the Virtual Processor
Area (VPA), SLB shadow and dispatch trace log (DTL), each of which allow
for certain communication between the guest and hypervisor.  Currently, we
store the addresses of the three areas and the size of the dtl in
CPUPPCState.

The SLB shadow and DTL are variable sized, with the size being retrieved
from within the registered memory area at the hypercall time.  This size
can later be overwritten with other information, however, so we need to
save the size as of registration time.  We already do this for the DTL,
but not for the SLB shadow, so this patch fixes that.

In addition, we change the storage of the VPA information to use fixed
size integer types which will make life easier for syncing this data with
KVM, which we will need in future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Don't allow duplicate registration of hcalls or RTAS calls
David Gibson [Mon, 8 Oct 2012 18:17:36 +0000 (18:17 +0000)]
pseries: Don't allow duplicate registration of hcalls or RTAS calls

Currently the pseries machine code allows a callback to be registered
for a hypercall number twice, as long as it's the same callback the second
time.  We don't test for duplicate registrations of RTAS callbacks at all
so it will effectively be last registratiojn wins.

This was originally done because it was awkward to ensure that the
registration happened exactly once, but the code has since been
restructured so that's no longer the case.

Duplicate registration of a hypercall or RTAS call could well suggest
a duplicate initialization which could cause other problems, so this patch
makes duplicate registrations a bug, to prevent the old behaviour from
hiding other bugs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoAdd USB option in machine options
zhlcindy@gmail.com [Sun, 2 Sep 2012 19:25:28 +0000 (19:25 +0000)]
Add USB option in machine options

When -usb option is used, global varible usb_enabled is set.
And all the plaform will create one USB controller according
to this variable. In fact, global varibles make code hard
to read.

So this patch is to remove global variable usb_enabled and
add USB option in machine options. All the plaforms will get
USB option value from machine options.

USB option of machine options will be set either by:
  * -usb
  * -machine type=pseries,usb=on

Both these ways can work now. They both set USB option in
machine options. In the future, the first way will be removed.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoe500: Fix serial initialization
Bharat Bhushan [Mon, 8 Oct 2012 06:46:54 +0000 (06:46 +0000)]
e500: Fix serial initialization

it was wrongly using serial_hds[0] instead of serial_hds[1]

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: 440: Emulate DCBR0
Alexander Graf [Sat, 6 Oct 2012 20:54:25 +0000 (22:54 +0200)]
PPC: 440: Emulate DCBR0

The DCBR0 register on 440 is used to implement system reset. The same
register is used on 405 as well, so just reuse the code.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: Bamboo: Fix memory size DT property
Alexander Graf [Sat, 6 Oct 2012 00:02:05 +0000 (02:02 +0200)]
PPC: Bamboo: Fix memory size DT property

Device tree properties need to be specified in big endian. Fix the
bamboo memory size property accordingly.

Signed-off-by: Alexander Graf <agraf@suse.de>
CC: qemu-stable@nongnu.org
11 years agoDrop unnecessary check of TARGET_PHYS_ADDR_SPACE_BITS
Peter Maydell [Fri, 5 Oct 2012 07:09:02 +0000 (07:09 +0000)]
Drop unnecessary check of TARGET_PHYS_ADDR_SPACE_BITS

For all our PPC targets the physical address space is at least
36 bits, so drop an unnecessary preprocessor conditional check
on TARGET_PHYS_ADDR_SPACE_BITS (erroneously introduced as part
of the change from target_phys_addr_t to hwaddr). This brings
this bit of code into line with the way we handle the other
cases which were originally checking TARGET_PHYS_ADDR_BITS in
order to avoid compiler complaints about overflowing a 32 bit type.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoxilinx_zynq: added QSPI controller
Peter Crosthwaite [Mon, 15 Oct 2012 04:40:21 +0000 (14:40 +1000)]
xilinx_zynq: added QSPI controller

Added the QSPI controller to the Zynq. 4 SPI devices are attached to allow
modelling of the different geometries. E.G. Dual parallel and dual stacked
mode can both be tested with this one arrangement.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
11 years agoxilinx_spips: Generalised to model QSPI
Peter Crosthwaite [Mon, 15 Oct 2012 04:37:04 +0000 (14:37 +1000)]
xilinx_spips: Generalised to model QSPI

Extended the xilinx spips controller to model QSPI as well. Paremeterised the
operational difference with the normal spi controller (num_ss_bits, width of the
tx/rx fifo heads etc.). Multiple bus functionality is modelled (needed for QSPI
dual parallel mode. LQSPI is modelled.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
11 years agom25p80: Support for Quad SPI
Peter Crosthwaite [Mon, 15 Oct 2012 04:34:37 +0000 (14:34 +1000)]
m25p80: Support for Quad SPI

Added the Quad mode read and write commands. Data remains serialized on a
single wire, i.e. the quad mode instructions just behave the same as single
mode, with the expection of modelling the varying number of dummy/mode bytes
between the address bytes and the first data word.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
11 years agotarget-i386: cpu: recover items 28-31 of ext2_feature_name
Eduardo Habkost [Wed, 24 Oct 2012 14:10:33 +0000 (12:10 -0200)]
target-i386: cpu: recover items 28-31 of ext2_feature_name

I removed a line by mistake on commit
3b671a40cab2404bc63e57db8cd3afa4ec70bfab, containing the flags lm/i64,
3dnow, and 3dnowext. This patch restores the removed line.

Reviewed-by: Don Slutz <Don@cloudswitch.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoqemu-timer: Check for usable fields for SIGEV_THREAD_ID
Richard Henderson [Mon, 22 Oct 2012 21:33:00 +0000 (07:33 +1000)]
qemu-timer: Check for usable fields for SIGEV_THREAD_ID

Older glibc (RHEL 5.x, Debian 5.x) does not have the _sigev_un._tid
member in its structure definition, while the accompanying kernel
headers do define SIGEV_THREAD_ID.  We need configure to check for
both before using it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotcg-i386: Use %gs prefixes for x86_64 GUEST_BASE
Richard Henderson [Mon, 22 Oct 2012 02:11:07 +0000 (12:11 +1000)]
tcg-i386: Use %gs prefixes for x86_64 GUEST_BASE

When we allocate a reserved_va for the guest, the kernel will likely
choose an address well above 4G.  At which point we must use a pair
of movabsq+addq to form the host address.  If we have OS support,
set up a segment register to point to guest_base instead.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>