OSDN Git Service

qmiga/qemu.git
7 years agoaudio: UpdateHandler is not used anymore
Juan Quintela [Tue, 25 Apr 2017 22:37:36 +0000 (00:37 +0200)]
audio: UpdateHandler is not used anymore

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-24-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: IRQHandler is not used anymore
Juan Quintela [Tue, 25 Apr 2017 22:37:35 +0000 (00:37 +0200)]
audio: IRQHandler is not used anymore

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-23-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: OPLSetUpdateHandler is not used anywhere
Juan Quintela [Tue, 25 Apr 2017 22:37:34 +0000 (00:37 +0200)]
audio: OPLSetUpdateHandler is not used anywhere

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-22-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: OPLSetIRQHandler is not used anywhere
Juan Quintela [Tue, 25 Apr 2017 22:37:33 +0000 (00:37 +0200)]
audio: OPLSetIRQHandler is not used anywhere

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-21-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: GUSsample is int16_t
Juan Quintela [Tue, 25 Apr 2017 22:37:32 +0000 (00:37 +0200)]
audio: GUSsample is int16_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-20-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: GUSword is uint16_t
Juan Quintela [Tue, 25 Apr 2017 22:37:31 +0000 (00:37 +0200)]
audio: GUSword is uint16_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-19-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: GUSword is uint16_t
Juan Quintela [Tue, 25 Apr 2017 22:37:30 +0000 (00:37 +0200)]
audio: GUSword is uint16_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-18-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove GUSchar
Juan Quintela [Tue, 25 Apr 2017 22:37:29 +0000 (00:37 +0200)]
audio: remove GUSchar

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-17-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: GUSbyte is uint8_t
Juan Quintela [Tue, 25 Apr 2017 22:37:28 +0000 (00:37 +0200)]
audio: GUSbyte is uint8_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-16-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove unused fields
Juan Quintela [Tue, 25 Apr 2017 22:37:27 +0000 (00:37 +0200)]
audio: Remove unused fields

These were used for the remove stuff.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-15-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove type field
Juan Quintela [Tue, 25 Apr 2017 22:37:26 +0000 (00:37 +0200)]
audio: Remove type field

It was not used anymore as now there is only one type of devices.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-14-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove Unused OPL_TYPE_*
Juan Quintela [Tue, 25 Apr 2017 22:37:25 +0000 (00:37 +0200)]
audio: Remove Unused OPL_TYPE_*

Since we removed the previous unused devices, they are not used anymore.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-13-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Unfold OPLSAMPLE
Juan Quintela [Tue, 25 Apr 2017 22:37:24 +0000 (00:37 +0200)]
audio: Unfold OPLSAMPLE

It was used only once, and now it was always int16_t.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-12-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove INT32
Juan Quintela [Tue, 25 Apr 2017 22:37:23 +0000 (00:37 +0200)]
audio: Remove INT32

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-11-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove INT16
Juan Quintela [Tue, 25 Apr 2017 22:37:22 +0000 (00:37 +0200)]
audio: remove INT16

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-10-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove INT8
Juan Quintela [Tue, 25 Apr 2017 22:37:21 +0000 (00:37 +0200)]
audio: Remove INT8

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-9-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove UINT32
Juan Quintela [Tue, 25 Apr 2017 22:37:20 +0000 (00:37 +0200)]
audio: remove UINT32

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-8-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove UINT16
Juan Quintela [Tue, 25 Apr 2017 22:37:19 +0000 (00:37 +0200)]
audio: remove UINT16

More modernitation.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-7-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove UINT8
Juan Quintela [Tue, 25 Apr 2017 22:37:18 +0000 (00:37 +0200)]
audio: Remove UINT8

uint8_t has existed since ..... all this century?

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-6-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: YM3812 was always defined
Juan Quintela [Tue, 25 Apr 2017 22:37:17 +0000 (00:37 +0200)]
audio: YM3812 was always defined

So, remove the ifdefs.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-5-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove YM3526 support
Juan Quintela [Tue, 25 Apr 2017 22:37:16 +0000 (00:37 +0200)]
audio: Remove YM3526 support

It was never compiled in.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-4-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove Y8950 configuration
Juan Quintela [Tue, 25 Apr 2017 22:37:15 +0000 (00:37 +0200)]
audio: remove Y8950 configuration

Include file has never been on qemu and it has been undefined from the very beginning.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-3-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoadlib: Remove support for YMF262
Juan Quintela [Tue, 25 Apr 2017 22:37:14 +0000 (00:37 +0200)]
adlib: Remove support for YMF262

Notice that the code was supposed to be in the file ymf262.h, that has
never been on qemu source tree.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-2-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: fix WAVState leak
Marc-André Lureau [Wed, 3 May 2017 22:38:44 +0000 (02:38 +0400)]
audio: fix WAVState leak

Spotted by ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170503223846.6559-4-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: release capture buffers
Gerd Hoffmann [Fri, 28 Apr 2017 07:56:12 +0000 (09:56 +0200)]
audio: release capture buffers

AUD_add_capture() allocates two buffers which are never released.
Add the missing calls to AUD_del_capture().

Impact: Allows vnc clients to exhaust host memory by repeatedly
starting and stopping audio capture.

Fixes: CVE-2017-8309
Cc: P J P <ppandit@redhat.com>
Cc: Huawei PSIRT <PSIRT@huawei.com>
Reported-by: "Jiangxin (hunter, SCC)" <jiangxin1@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-id: 20170428075612.9997-1-kraxel@redhat.com

7 years agohw/audio: convert exit callback in HDACodecDeviceClass to void
Zihan Yang [Wed, 26 Apr 2017 12:53:08 +0000 (20:53 +0800)]
hw/audio: convert exit callback in HDACodecDeviceClass to void

The exit callback always return 0, convert it to void

Signed-off-by: Zihan Yang <tgnyang@gmail.com>
Message-id: 1493211188-24086-5-git-send-email-tgnyang@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agohw/audio: replace exit with unrealize in hda_codec_device_class_init
Zihan Yang [Wed, 26 Apr 2017 12:53:07 +0000 (20:53 +0800)]
hw/audio: replace exit with unrealize in hda_codec_device_class_init

The exit callback of DeviceClass will be removed in the future, so
convert to unrealize in the init functioin

Signed-off-by: Zihan Yang <tgnyang@gmail.com>
Message-id: 1493211188-24086-4-git-send-email-tgnyang@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoMerge remote-tracking branch 'sthibault/tags/samuel-thibault' into staging
Stefan Hajnoczi [Tue, 2 May 2017 14:16:20 +0000 (15:16 +0100)]
Merge remote-tracking branch 'sthibault/tags/samuel-thibault' into staging

slirp updates

# gpg: Signature made Sat 29 Apr 2017 05:45:24 PM BST
# gpg:                using RSA key 0xB0A51BF58C9179C5
# gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>"
# gpg:                 aka "Samuel Thibault <sthibault@debian.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@gnu.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>"
# Primary key fingerprint: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: AEBF 7448 FAB9 453A 4552  390E B0A5 1BF5 8C91 79C5

* sthibault/tags/samuel-thibault:
  slirp: VMStatify remaining except for loop
  slirp: VMStatify socket level
  slirp: Common lhost/fhost union
  slirp: VMStatify sbuf
  slirp: VMState conversion; tcpcb
  slirp: fix pinging the virtual ipv4 DNS server
  slirp: tftp, copy sockaddr_size
  slirp/smb: Replace constant strings by glib string
  slirp: allow host port 0 for hostfwd

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoslirp: VMStatify remaining except for loop
Dr. David Alan Gilbert [Mon, 3 Apr 2017 17:18:43 +0000 (18:18 +0100)]
slirp: VMStatify remaining except for loop

This converts the remaining components, except for the top level
loop, to VMState.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp: VMStatify socket level
Dr. David Alan Gilbert [Mon, 3 Apr 2017 17:18:42 +0000 (18:18 +0100)]
slirp: VMStatify socket level

Working up the stack, this replaces the slirp_socket_load/save
with VMState definitions.

A place holder for IPv6 support is added as a comment; it needs
testing once the rest of the IPv6 code is there.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp: Common lhost/fhost union
Dr. David Alan Gilbert [Mon, 20 Feb 2017 18:50:18 +0000 (18:50 +0000)]
slirp: Common lhost/fhost union

The socket structure has a pair of unions for lhost and fhost
addresses; the unions are identical so split them out into
a separate union declaration.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp: VMStatify sbuf
Dr. David Alan Gilbert [Mon, 20 Feb 2017 18:50:17 +0000 (18:50 +0000)]
slirp: VMStatify sbuf

Convert the sbuf structure to a VMStateDescription.
Note this uses the VMSTATE_WITH_TMP mechanism to calculate
and reload the offsets based on the pointers.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp: VMState conversion; tcpcb
Dr. David Alan Gilbert [Mon, 20 Feb 2017 18:50:16 +0000 (18:50 +0000)]
slirp: VMState conversion; tcpcb

Convert the migration of the struct tcpcb to use a VMStateDescription,
the rest of it will come later.

Mostly mechanical, except for conversion of some 'char' to uint8_t
to ensure portability.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp: fix pinging the virtual ipv4 DNS server
Samuel Thibault [Sat, 29 Apr 2017 12:37:09 +0000 (14:37 +0200)]
slirp: fix pinging the virtual ipv4 DNS server

so that people do not think it is not working at least basically.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp: tftp, copy sockaddr_size
Marc-André Lureau [Thu, 23 Mar 2017 11:31:56 +0000 (15:31 +0400)]
slirp: tftp, copy sockaddr_size

ASAN detects an "unknown-crash" when running pxe-test:

/ppc64/pxe/spapr-vlan: =================================================================
==7143==ERROR: AddressSanitizer: unknown-crash on address 0x7f6dcd298d30 at pc 0x55e22218830d bp 0x7f6dcd2989e0 sp 0x7f6dcd2989d0
READ of size 128 at 0x7f6dcd298d30 thread T2
    #0 0x55e22218830c in tftp_session_allocate /home/elmarco/src/qq/slirp/tftp.c:73
    #1 0x55e22218a1f8 in tftp_handle_rrq /home/elmarco/src/qq/slirp/tftp.c:289
    #2 0x55e22218b54c in tftp_input /home/elmarco/src/qq/slirp/tftp.c:446
    #3 0x55e2221833fe in udp6_input /home/elmarco/src/qq/slirp/udp6.c:82
    #4 0x55e222137b17 in ip6_input /home/elmarco/src/qq/slirp/ip6_input.c:67

Address 0x7f6dcd298d30 is located in stack of thread T2 at offset 96 in frame
    #0 0x55e222182420 in udp6_input /home/elmarco/src/qq/slirp/udp6.c:13

  This frame has 3 object(s):
    [32, 48) '<unknown>'
    [96, 124) 'lhost' <== Memory access at offset 96 partially overflows this variable
    [160, 200) 'save_ip' <== Memory access at offset 96 partially underflows this variable

The sockaddr_storage pointer is the sockaddr_in6 lhost on the
stack. Copy only the source addr size.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp/smb: Replace constant strings by glib string
Dr. David Alan Gilbert [Fri, 7 Apr 2017 14:32:54 +0000 (15:32 +0100)]
slirp/smb: Replace constant strings by glib string

gcc 7 (on fedora 26) objects to many of the snprintf's
in the smb path and command creation because it can't
figure out that the smb_dir (i.e. the /tmp dir for the configuration)
is known to be short.

Replace all these fixed length buffers by g_str* functions that dynamically
allocate and use g_dir_make_tmp to make the directory.
(It's fairly new glib but we have a compat function for it).

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp: allow host port 0 for hostfwd
Vincent Bernat [Sat, 25 Feb 2017 21:31:58 +0000 (22:31 +0100)]
slirp: allow host port 0 for hostfwd

The OS will allocate automatically a free port. This is useful if you
want to be sure to not get any port conflict. You still have to figure
out which port you got, for example with "lsof" (this could be exposed
in the monitor if needed).

Example of use:

     $ qemu-system-x86_64 -net user,hostfwd=127.0.0.1:0-:22 ...

Then, get your port with:

     $ lsof -np 1474 | grep LISTEN
     qemu-syst 31777 bernat 12u IPv4 [...] TCP 127.0.0.1:35145 (LISTEN)

Signed-off-by: Vincent Bernat <vincent@bernat.im>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoreplication: Make --disable-replication compile again
Markus Armbruster [Thu, 27 Apr 2017 13:00:53 +0000 (15:00 +0200)]
replication: Make --disable-replication compile again

Broken in commit daa33c5.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Message-id: 1493298053-17140-1-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoconfigure: fix trace backend list for out-of-tree builds
Greg Kurz [Wed, 26 Apr 2017 13:36:07 +0000 (15:36 +0200)]
configure: fix trace backend list for out-of-tree builds

Since commit "c53eeaf75a04 configure: eliminate Python dependency for
--help", configure --help fails to produce the list of available trace
backends if invoked out-of-tree. It also spits the following error:

grep: scripts/tracetool/backend/*.py: No such file or directory

This patch simply adds the missing $source_path to fix it.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-id: 149321376763.7874.12797658801011614451.stgit@bahia
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'mdroth/tags/qga-pull-2017-04-25-v2-tag' into staging
Stefan Hajnoczi [Fri, 28 Apr 2017 15:12:11 +0000 (16:12 +0100)]
Merge remote-tracking branch 'mdroth/tags/qga-pull-2017-04-25-v2-tag' into staging

qemu-ga patch queue

* new commands: guest-get-timezone, guest-get-users, guest-get-host-name
* fix hang on w32 when stopping qemu-ga service while fs frozen
* fix missing setting of can-offline in guest-get-vcpus
* make qemu-ga VSS w32 service on-demand rather than on-startup
* fix unecessary errors to EventLog on w32
* improvements to fsfreeze documentation

v2:
 * document 'zone' field of guest-get-timezone as informational-only
   (Daniel, Eric)
 * fix build error for glib < 2.32 (Peter)

# gpg: Signature made Thu 27 Apr 2017 06:43:42 AM BST
# gpg:                using RSA key 0x3353C9CEF108B584
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
# gpg:                 aka "Michael Roth <mdroth@utexas.edu>"
# gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>"
# Primary key fingerprint: CEAC C9E1 5534 EBAB B82D  3FA0 3353 C9CE F108 B584

* mdroth/tags/qga-pull-2017-04-25-v2-tag:
  qga: Add `guest-get-timezone` command
  qga: Add 'guest-get-users' command
  qga: improve fsfreeze documentations
  qga: Add 'guest-get-host-name' command
  qga-win: Fix Event Viewer errors caused by qemu-ga
  qga-win: Fix a bug where qemu-ga service is stuck during stop operation
  qga-win: Enable 'can-offline' field in 'guest-get-vcpus' reply
  qemu-ga: Make QGA VSS provider service run only when needed

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoqga: Add `guest-get-timezone` command
Vinzenz Feenstra [Wed, 19 Apr 2017 10:52:58 +0000 (12:52 +0200)]
qga: Add `guest-get-timezone` command

Adds a new command `guest-get-timezone` reporting the currently
configured timezone on the system. The information on what timezone is
currently is configured is useful in case of Windows VMs where the
offset of the hardware clock is required to have the same offset. This
can be used for management systems like `oVirt` to detect the timezone
difference and warn administrators of the misconfiguration.

Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-by: Sameeh Jubran <sameeh@daynix.com>
Tested-by: Sameeh Jubran <sameeh@daynix.com>
* moved stub implementation to end of function for consistency
* document that timezone names are for informational use only.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
7 years agoqga: Add 'guest-get-users' command
Vinzenz Feenstra [Wed, 19 Apr 2017 09:26:15 +0000 (11:26 +0200)]
qga: Add 'guest-get-users' command

A command that will list all currently logged in users, and the time
since when they are logged in.

Examples:

virsh # qemu-agent-command F25 '{ "execute": "guest-get-users" }'
{"return":[{"login-time":1490622289.903835,"user":"root"}]}

virsh # qemu-agent-command Win2k12r2 '{ "execute": "guest-get-users" }'
{"return":[{"login-time":1490351044.670552,"domain":"LADIDA",
"user":"Administrator"}]}

Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
* make g_hash_table_contains compat func inline to avoid
  unused warnings
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
7 years agoqga: improve fsfreeze documentations
Marc-André Lureau [Mon, 3 Apr 2017 09:54:38 +0000 (11:54 +0200)]
qga: improve fsfreeze documentations

Some users find the fsfreeze behaviour confusing. Add some notes about
invalid mount points and Windows usage.

Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=1436976

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
7 years agoqga: Add 'guest-get-host-name' command
Vinzenz Feenstra [Tue, 4 Apr 2017 06:46:31 +0000 (08:46 +0200)]
qga: Add 'guest-get-host-name' command

Retrieving the guest host name is a very useful feature for virtual management
systems. This information can help to have more user friendly VM access
details, instead of an IP there would be the host name. Also the host name
reported can be used to have automated checks for valid SSL certificates.

virsh # qemu-agent-command F25 '{ "execute": "guest-get-host-name" }'
{"return":{"host-name":"F25.lab.evilissimo.net"}}

Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com>
* minor whitespace fix-ups
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
7 years agoqga-win: Fix Event Viewer errors caused by qemu-ga
Sameeh Jubran [Wed, 5 Apr 2017 12:01:06 +0000 (15:01 +0300)]
qga-win: Fix Event Viewer errors caused by qemu-ga

When the command "guest-fsfreeze-freeze" is executed it causes
the VSS service to log the error below in the Event Viewer. This
error is caused by an issue in the function "CommitSnapshots" in
provider.cpp:

* When VSS_TIMEOUT_MSEC expires the funtion returns E_ABORT. This causes
the error #12293.

|event id|                           error                               |
* 12293  : Volume Shadow Copy Service error: Error calling a routine on a
           Shadow Copy Provider {00000000-0000-0000-0000-000000000000}.
           Routine details CommitSnapshots [hr = 0x80004004, Operation
           aborted.

Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
7 years agoqga-win: Fix a bug where qemu-ga service is stuck during stop operation
Sameeh Jubran [Tue, 11 Apr 2017 07:50:36 +0000 (10:50 +0300)]
qga-win: Fix a bug where qemu-ga service is stuck during stop operation

After triggering a freeze command without any following thaw command,
qemu-ga will not respond to stop operation. This behaviour is wanted on Linux
as there is no time limit for a freeze command and we want to prevent
quitting in the middle of freeze, on the other hand on Windows the time
limit for freeze is 10 seconds, so we should wait for the timeout, thaw
the file system and quit.

Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
7 years agoqga-win: Enable 'can-offline' field in 'guest-get-vcpus' reply
Sameeh Jubran [Tue, 11 Apr 2017 12:52:05 +0000 (15:52 +0300)]
qga-win: Enable 'can-offline' field in 'guest-get-vcpus' reply

The QGA schema states:

@can-offline: Whether offlining the VCPU is possible. This member
               is always filled in by the guest agent when the structure
               is returned, and always ignored on input (hence it can be
               omitted then).

Currently 'can-offline' is missing entirely from the reply. This causes
errors in libvirt which is expecting the reply to be compliant with the
schema docs.

BZ#1438735: https://bugzilla.redhat.com/show_bug.cgi?id=1438735

Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
7 years agoqemu-ga: Make QGA VSS provider service run only when needed
Sameeh Jubran [Thu, 23 Mar 2017 16:26:50 +0000 (18:26 +0200)]
qemu-ga: Make QGA VSS provider service run only when needed

Currently the service runs in background on boot even though it is not
needed and once it is running it never stops. The service needs to be
running only during freeze operation and it should be stopped after
executing thaw.

Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
7 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20170426' into staging
Peter Maydell [Wed, 26 Apr 2017 19:50:49 +0000 (20:50 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20170426' into staging

Fix for exit_atomic tcg opcode paths

# gpg: Signature made Wed 26 Apr 2017 18:27:11 BST
# gpg:                using RSA key 0xAD1270CC4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"
# Primary key fingerprint: 9CB1 8DDA F8E8 49AD 2AFC  16A4 AD12 70CC 4DD0 279B

* remotes/rth/tags/pull-tcg-20170426:
  tcg: Initialize return value after exit_atomic

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agotcg: Initialize return value after exit_atomic
Richard Henderson [Tue, 25 Apr 2017 10:38:52 +0000 (12:38 +0200)]
tcg: Initialize return value after exit_atomic

Users of tcg_gen_atomic_cmpxchg and do_atomic_op rightfully utilize
the output.  Even though this code is dead, it gets translated, and
without the initialization we encounter a tcg_error.

Reported-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Tested-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agoRevert "COLO-compare: Optimize tcp compare trace event"
Peter Maydell [Wed, 26 Apr 2017 15:19:27 +0000 (16:19 +0100)]
Revert "COLO-compare: Optimize tcp compare trace event"

This reverts commit 0fc8aec7de64f2bf83a274a2a38b938ce03425d2.

In commit 2dfe5113b11 we split a trace event with a lot of arguments
in two, because the UST trace backend has a limit on the number
of arguments you can have in a single trace event. Unfortunately
we subsequently forgot about this, and in commit 0fc8aec7de64f2
we merged the two trace events again, recreating the "UST backend
doesn't build" bug.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170426' into staging
Peter Maydell [Wed, 26 Apr 2017 14:32:20 +0000 (15:32 +0100)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170426' into staging

HMP pull, with tcg fix

# gpg: Signature made Wed 26 Apr 2017 14:55:30 BST
# gpg:                using RSA key 0x0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-hmp-20170426:
  tests: Add a tester for HMP commands
  libqtest: Add a generic function to run a callback function for every machine
  libqtest: Ignore QMP events when parsing the response for HMP commands
  monitor: Check whether TCG is enabled before running the "info jit" code
  hmp: gpa2hva and gpa2hpa hostaddr command

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agotests: Add a tester for HMP commands
Thomas Huth [Tue, 25 Apr 2017 05:16:47 +0000 (07:16 +0200)]
tests: Add a tester for HMP commands

HMP commands do not get any automatic testing yet, so on certain
QEMU machines, some HMP commands were causing crashes in the past.
Thus we should test HMP commands in our test suite, too, to avoid
that such problems creep in again in the future.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1493097407-20482-1-git-send-email-thuth@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agolibqtest: Add a generic function to run a callback function for every machine
Thomas Huth [Thu, 30 Mar 2017 07:50:06 +0000 (09:50 +0200)]
libqtest: Add a generic function to run a callback function for every machine

Some tests need to run single tests for every available machine of the
current QEMU binary. To avoid code duplication, let's extract this
code that deals with 'query-machines' into a separate function.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1490860207-8302-3-git-send-email-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agolibqtest: Ignore QMP events when parsing the response for HMP commands
Thomas Huth [Thu, 30 Mar 2017 07:50:05 +0000 (09:50 +0200)]
libqtest: Ignore QMP events when parsing the response for HMP commands

When running certain HMP commands (like "device_del") via QMP, we
can sometimes get a QMP event in the response first, so that the
"g_assert(ret)" statement in qtest_hmp() triggers and the test
fails. Fix this by ignoring such QMP events while looking for the
real return value from QMP.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1490860207-8302-2-git-send-email-thuth@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  Added note to qtest_hmp/qtest_hmpv's header description to say
  it discards events

7 years agomonitor: Check whether TCG is enabled before running the "info jit" code
Thomas Huth [Wed, 26 Apr 2017 04:11:47 +0000 (06:11 +0200)]
monitor: Check whether TCG is enabled before running the "info jit" code

The "info jit" command currently aborts on Mac OS X with the message
"qemu_mutex_lock: Invalid argument" when running with "-M accel=qtest".
We should only call into the TCG code here if TCG has really been
enabled and initialized.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1493179907-22516-1-git-send-email-thuth@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agohmp: gpa2hva and gpa2hpa hostaddr command
Paolo Bonzini [Thu, 20 Apr 2017 13:30:58 +0000 (15:30 +0200)]
hmp: gpa2hva and gpa2hpa hostaddr command

These commands are useful when testing machine-check passthrough.
gpa2hva is useful to inject a MADV_HWPOISON madvise from gdb, while
gpa2hpa is useful to inject an error with the mce-inject kernel
module.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1490021158-4469-1-git-send-email-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20170420133058.12911-1-pbonzini@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.10-20170426' into staging
Peter Maydell [Wed, 26 Apr 2017 12:17:11 +0000 (13:17 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.10-20170426' into staging

ppc patch queue 2017-04-26

Here's a respind of my first pull request for qemu-2.10, consisting of
assorted patches which have accumulated while qemu-2.9 stabilized.
Highlights are:
    * Rework / cleanup of the XICS interrupt controller
    * Substantial improvement to the 'powernv' machine type
        - Includes an MMIO XICS version
    * POWER9 support improvements
        - POWER9 guests with KVM
        - Partial support for POWER9 guests with TCG
    * IOMMU and VFIO improvements
    * Assorted minor changes

There are several IPMI patches here that aren't usually in my area of
maintenance, but there isn't a regular maintainer and these patches
are for the benefit of the powernv machine type.

This pull request supersedes my 2017-04-26 pull request.  This new set
fixes a bug in one of the aforementioned IPMI patches which caused
clang sanitizer failures (and may have crashed on some libc / host
versions).

# gpg: Signature made Wed 26 Apr 2017 07:58:10 BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.10-20170426: (48 commits)
  MAINTAINERS: Remove myself from e500
  target/ppc: Style fixes
  e500,book3s: mfspr 259: Register mapped/aliased SPRG3 user read
  target/ppc: Flush TLB on write to PIDR
  spapr-cpu-core: Release ICPState object during CPU unrealization
  ppc/pnv: generate an OEM SEL event on shutdown
  ppc/pnv: add initial IPMI sensors for the BMC simulator
  ppc/pnv: populate device tree for IPMI BT devices
  ppc/pnv: populate device tree for serial devices
  ppc/pnv: populate device tree for RTC devices
  ppc/pnv: scan ISA bus to populate device tree
  ppc/pnv: enable only one LPC bus
  ppc/pnv: Add support for POWER8+ LPC Controller
  spapr: remove the 'nr_servers' field from the machine
  target/ppc: Fix size of struct PPCElfPrstatus
  ipmi: introduce an ipmi_bmc_gen_event() API
  ipmi: introduce an ipmi_bmc_sdr_find() API
  ipmi: provide support for FRUs
  ipmi: use a file to load SDRs
  ppc: add IPMI support
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/sstabellini/tags/xen-20170421-v2-tag' into...
Peter Maydell [Wed, 26 Apr 2017 09:22:31 +0000 (10:22 +0100)]
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20170421-v2-tag' into staging

Xen 2017/04/21 + fix

# gpg: Signature made Tue 25 Apr 2017 19:10:37 BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# gpg:                 aka "Stefano Stabellini <sstabellini@kernel.org>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* remotes/sstabellini/tags/xen-20170421-v2-tag: (21 commits)
  move xen-mapcache.c to hw/i386/xen/
  move xen-hvm.c to hw/i386/xen/
  move xen-common.c to hw/xen/
  add xen-9p-backend to MAINTAINERS under Xen
  xen/9pfs: build and register Xen 9pfs backend
  xen/9pfs: send responses back to the frontend
  xen/9pfs: implement in/out_iov_from_pdu and vmarshal/vunmarshal
  xen/9pfs: receive requests from the frontend
  xen/9pfs: connect to the frontend
  xen/9pfs: introduce Xen 9pfs backend
  9p: introduce a type for the 9p header
  xen: import ring.h from xen
  configure: use pkg-config for obtaining xen version
  xen: additionally restrict xenforeignmemory operations
  xen: use libxendevice model to restrict operations
  xen: use 5 digit xen versions
  xen: use libxendevicemodel when available
  configure: detect presence of libxendevicemodel
  xen: create wrappers for all other uses of xc_hvm_XXX() functions
  xen: rename xen_modified_memory() to xen_hvm_modified_memory()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMAINTAINERS: Remove myself from e500
Scott Wood [Fri, 21 Apr 2017 02:05:28 +0000 (21:05 -0500)]
MAINTAINERS: Remove myself from e500

I recently left Freescale/NXP, and even before that it'd been a few years
since I was actively involved in KVM/QEMU work.

Signed-off-by: Scott Wood <oss@buserror.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget/ppc: Style fixes
David Gibson [Thu, 20 Apr 2017 01:05:26 +0000 (11:05 +1000)]
target/ppc: Style fixes

This makes a small step fixing one of many style problems that exist in
the older ppc code.  This removes spaces between function (or macro) name
and the following '('.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoe500,book3s: mfspr 259: Register mapped/aliased SPRG3 user read
Bernhard Kaindl [Wed, 19 Apr 2017 16:48:22 +0000 (18:48 +0200)]
e500,book3s: mfspr 259: Register mapped/aliased SPRG3 user read

This patch registers mfspr 259 for Book3S and e500 family cores
following this research:

mfspr 259 provides read-only mapped user access to SPRG3(SPR 275) according to:

- PowerISA 2.02, Book III (documents implementation starting with POWER4+ @ p20)
- IBM PowerPC 970MP RISC Microprocessor User's Manual v2.1, page 48
- Amit Singh: "Mac OS X Internals: A Systems Approach" on 970 and 970FX cores:
  He demonstrates mfspr 259 reading TLS data from Mac OS X on G5 on page 588
- NXP documents it in the Core Reference Manuals of: e500, e500mc and e5500
- getcpu() of the 32 & 64-bit Book3S Linux vDSOs use it to read the core number

mfspr 259 does not appear to be implemented in these cores according to:

- 74xx series: MPC7410/MPC7400 and MPC7450 RISC Microprocessor Reference Manuals
- 4xx series:  PPC440 Processor User's Manual, Revision 1.09 by AMCC
- 750 series:  IBM PowerPC 750CL RISC Microprocessor User's Manual
- e200 series: e200z4 Power Architectureâ Core Reference Manual

Implementation: gen_spr_usprg3() is called from init_proc_book3s_common()
(covers the 970 and POWER cores) and init_proc_e500() (covers the e500 family)
to register spr_read_ureg() in the same way which it already provides
the mapped SPR access for SPR_USPRG4-7 in gen_spr_usprgh() for cores
which have the same read-only mapped SPRG register access for SPRG4-7.

Verified using Linux by pinning a thread to a core and checking sched_getcpu()
using qemu-system-ppc64 -M pseries -cpu POWER8 using MTTCG on a x86_64 host.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@thalesgroup.com>
Reviewed-by: Stefan Resch <stefan.resch@thalesgroup.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget/ppc: Flush TLB on write to PIDR
Suraj Jitindar Singh [Thu, 13 Apr 2017 06:02:36 +0000 (16:02 +1000)]
target/ppc: Flush TLB on write to PIDR

The PIDR (process id register) is used to store the id of the currently
running process, which is used to select the process table entry used to
perform address translation. This means that when we write to this register
all the translations in the TLB become outdated as they are for a
previously running process. Thus when this register is written to we need
to invalidate the TLB entries to ensure stale entries aren't used to
to perform translation for the new process, which would result in at best
segfaults or alternatively just random memory being accessed.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
[dwg: Fixed compile error for 32-bit targets]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr-cpu-core: Release ICPState object during CPU unrealization
Bharata B Rao [Wed, 12 Apr 2017 08:15:07 +0000 (13:45 +0530)]
spapr-cpu-core: Release ICPState object during CPU unrealization

Recent commits that re-organized ICPState object missed to destroy
the object when CPU is unrealized. Fix this so that CPU unplug
doesn't abort QEMU.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: generate an OEM SEL event on shutdown
Cédric Le Goater [Tue, 11 Apr 2017 15:30:06 +0000 (17:30 +0200)]
ppc/pnv: generate an OEM SEL event on shutdown

OpenPOWER systems expect to be notified with such an event before a
shutdown or a reboot. An OEM SEL message is sent with specific
identifiers and a user data containing the request : OFF or REBOOT.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: add initial IPMI sensors for the BMC simulator
Cédric Le Goater [Tue, 11 Apr 2017 15:30:05 +0000 (17:30 +0200)]
ppc/pnv: add initial IPMI sensors for the BMC simulator

Skiboot, the firmware for the PowerNV platform, expects the BMC to
provide some specific IPMI sensors. These sensors are exposed in the
device tree and their values are updated by the firmware at boot time.

Sensors of interest are :

"FW Boot Progress"
"Boot Count"

As such a device is defined on the command line, we can only detect
its presence at reset time.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: populate device tree for IPMI BT devices
Cédric Le Goater [Tue, 11 Apr 2017 15:30:04 +0000 (17:30 +0200)]
ppc/pnv: populate device tree for IPMI BT devices

When an ipmi-bt device [1] is defined on the ISA bus, we need to
populate the device tree with the object properties. Such devices are
created with the command line options :

   -device ipmi-bmc-sim,id=bmc0 -device isa-ipmi-bt,bmc=bmc0,irq=10

[1] https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg03168.html

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: populate device tree for serial devices
Cédric Le Goater [Tue, 11 Apr 2017 15:30:03 +0000 (17:30 +0200)]
ppc/pnv: populate device tree for serial devices

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: populate device tree for RTC devices
Cédric Le Goater [Tue, 11 Apr 2017 15:30:02 +0000 (17:30 +0200)]
ppc/pnv: populate device tree for RTC devices

The code could be common to any ISA device but we are missing the IO
length.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: scan ISA bus to populate device tree
Cédric Le Goater [Tue, 11 Apr 2017 15:30:01 +0000 (17:30 +0200)]
ppc/pnv: scan ISA bus to populate device tree

This is an empty shell that we will use to include nodes in the device
tree for ISA devices. We expect RTC, UART and IPMI BT devices.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: enable only one LPC bus
Cédric Le Goater [Tue, 11 Apr 2017 15:30:00 +0000 (17:30 +0200)]
ppc/pnv: enable only one LPC bus

The default LPC bus of a multichip system is on chip 0. It's
recognized by the firmware (skiboot) using a "primary" property in the
device tree.

We introduce a pnv_chip_lpc_offset() routine to locate the LPC node of
a chip and set the property directly from the machine level.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: Add support for POWER8+ LPC Controller
Benjamin Herrenschmidt [Tue, 11 Apr 2017 15:29:59 +0000 (17:29 +0200)]
ppc/pnv: Add support for POWER8+ LPC Controller

It adds the Naples chip which supports proper LPC interrupts via the
LPC controller rather than via an external CPLD.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[clg: - updated for qemu-2.9
      - ported on latest PowerNV patchset
      - moved the IRQ handler in pnv_lpc.c
      - introduced pnv_lpc_isa_irq_create() to create the ISA IRQs ]
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr: remove the 'nr_servers' field from the machine
Cédric Le Goater [Wed, 5 Apr 2017 06:37:44 +0000 (08:37 +0200)]
spapr: remove the 'nr_servers' field from the machine

xics_system_init() does not need 'nr_servers' anymore as it is only
used to define the 'interrupt-controller' node in the device tree. So
let's just compute the value when calling spapr_dt_xics().

This also gives us an opportunity to simplify the xics_system_init()
routine and introduce a specific spapr_ics_create() helper to create
the sPAPR ICS object.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget/ppc: Fix size of struct PPCElfPrstatus
Anton Blanchard [Tue, 11 Apr 2017 06:04:56 +0000 (16:04 +1000)]
target/ppc: Fix size of struct PPCElfPrstatus

gdb refuses to parse QEMU memory dumps because struct PPCElfPrstatus
is the wrong size. Fix it.

Signed-off-by: Anton Blanchard <anton@samba.org>
Fixes: e62fbc54d459 ("target-ppc: dump-guest-memory support")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoipmi: introduce an ipmi_bmc_gen_event() API
Cédric Le Goater [Wed, 5 Apr 2017 12:41:34 +0000 (14:41 +0200)]
ipmi: introduce an ipmi_bmc_gen_event() API

It will be used to fill the message buffer with custom events expected
by some systems. Typically, an Open PowerNV platform guest is notified
with an OEM SEL message before a shutdown or a reboot.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoipmi: introduce an ipmi_bmc_sdr_find() API
Cédric Le Goater [Wed, 5 Apr 2017 12:41:33 +0000 (14:41 +0200)]
ipmi: introduce an ipmi_bmc_sdr_find() API

This patch exposes a new IPMI routine to query a sdr entry from the
sdr table maintained by the IPMI BMC simulator. The API is very
similar to the internal sdr_find_entry() routine and should be used
the same way to query one or all sdrs.

A typical use would be to loop on the sdrs to build nodes of a device
tree.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoipmi: provide support for FRUs
Cédric Le Goater [Wed, 5 Apr 2017 12:41:32 +0000 (14:41 +0200)]
ipmi: provide support for FRUs

This patch provides a simple FRU support for the BMC simulator. FRUs
are loaded from a file which name is specified in the object
properties, each entry having a fixed size, also specified in the
properties. If the file is unknown or not accessible for some reason,
a unique entry of 1024 bytes is created as a default. Just enough to
start some simulation.

These commands complies with the IPMI spec : "34. FRU Inventory Device
Commands".

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Corey Minyard <cminyard@mvista.com>
[dwg: Folded in subsequent fix to handle NULL filename]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoipmi: use a file to load SDRs
Cédric Le Goater [Wed, 5 Apr 2017 12:41:31 +0000 (14:41 +0200)]
ipmi: use a file to load SDRs

The IPMI BMC simulator populates the sdr/sensor tables with a minimal
set of entries (Watchdog). But some qemu platforms might want to use
extra entries for their custom needs.

This patch modifies slighty the initializing routine to take into
account a larger set read from a file. The name of the file to use is
defined through a new 'sdr' property of the simulator device.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Corey Minyard <cminyard@mvista.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: add IPMI support
Cédric Le Goater [Wed, 5 Apr 2017 12:41:30 +0000 (14:41 +0200)]
ppc: add IPMI support

OpenPOWER systems use a BT device to communicate with the BMC.
Provide support for it.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: Add OCC model stub with interrupt support
Benjamin Herrenschmidt [Wed, 5 Apr 2017 12:41:27 +0000 (14:41 +0200)]
ppc/pnv: Add OCC model stub with interrupt support

The OCC is an on-chip microcontroller based on a ppc405 core used
for various power management tasks. It comes with a pile of additional
hardware sitting on the PIB (aka XSCOM bus). At this point we don't
emulate it (nor plan to do so). However there is one facility which
is provided by the surrounding hardware that we do need, which is the
interrupt generation facility. OPAL uses it to send itself interrupts
under some circumstances and there are other uses around the corner.

So this implement just enough to support this.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[clg: - updated for qemu-2.9
      - changed the XSCOM interface to fit new model
      - QOMified the model ]
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: Add cut down PSI bridge model and hookup external interrupt
Cédric Le Goater [Wed, 5 Apr 2017 12:41:26 +0000 (14:41 +0200)]
ppc/pnv: Add cut down PSI bridge model and hookup external interrupt

The Processor Service Interface (PSI) Controller is one of the engines
of the "Bridge" unit which connects the different interfaces to the
Power Processor.

This adds just enough of the PSI bridge to handle various on-chip and
the one external interrupt. The rest of PSI has to do with the link to
the IBM FSP service processor which we don't plan to emulate (not used
on OpenPower machines).

The ics_get() and ics_resend() handlers of the XICSFabric interface of
the PowerNV machine are now defined to handle the Interrupt Control
Source of PSI. The InterruptStatsProvider interface is also modified
to dump the new ICS.

Originally from Benjamin Herrenschmidt <benh@kernel.crashing.org>

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: add memory regions for the ICP registers
Cédric Le Goater [Mon, 3 Apr 2017 07:46:05 +0000 (09:46 +0200)]
ppc/pnv: add memory regions for the ICP registers

This provides to a PowerNV chip (POWER8) access to the Interrupt
Management area, which contains the registers of the Interrupt Control
Presenters of each thread. These are used to accept, return, forward
interrupts in the system.

This area is modeled with a per-chip container memory region holding
all the ICP registers. Each thread of a chip is then associated with
its ICP registers using a memory subregion indexed by its PIR number
in the overall region.

The device tree is populated accordingly.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: add a helper to calculate MMIO addresses registers
Cédric Le Goater [Mon, 3 Apr 2017 07:46:04 +0000 (09:46 +0200)]
ppc/pnv: add a helper to calculate MMIO addresses registers

Some controllers (ICP, PSI) have a base register address which is
calculated using the chip id.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: create the ICP object under PnvCore
Cédric Le Goater [Mon, 3 Apr 2017 07:46:03 +0000 (09:46 +0200)]
ppc/pnv: create the ICP object under PnvCore

Each thread of a core is linked to an ICP. This allocates a PnvICPState
object before the PowerPCCPU object is realized and lets the XICSFabric
do the store under the 'intc' backlink when xics_cpu_setup() is
called.

This modeling removes the need of maintaining an array of ICP objects
under the PowerNV machine and also simplifies the XICSFabric icp_get()
handler.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: extend the machine with a InterruptStatsProvider interface
Cédric Le Goater [Mon, 3 Apr 2017 07:46:02 +0000 (09:46 +0200)]
ppc/pnv: extend the machine with a InterruptStatsProvider interface

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: extend the machine with a XICSFabric interface
Cédric Le Goater [Mon, 3 Apr 2017 07:46:01 +0000 (09:46 +0200)]
ppc/pnv: extend the machine with a XICSFabric interface

A XICSFabric QOM interface is used by the XICS layer to manipulate the
ICP and ICS objects. Let's define the associated handlers for the
PowerNV machine. All handlers should be defined even if there is no
ICS under the PowerNV machine yet.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/pnv: add a PnvICPState object
Cédric Le Goater [Mon, 3 Apr 2017 07:46:00 +0000 (09:46 +0200)]
ppc/pnv: add a PnvICPState object

This provides a new ICPState object for the PowerNV machine (POWER8).
Access to the Interrupt Management area is done though a memory
region. It contains the registers of the Interrupt Control Presenters
of each thread which are used to accept, return, forward interrupts in
the system.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/xics: add a realize() handler to ICPStateClass
Cédric Le Goater [Mon, 3 Apr 2017 07:45:59 +0000 (09:45 +0200)]
ppc/xics: add a realize() handler to ICPStateClass

It will be used by derived classes in PowerNV for customization.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr: allocate the ICPState object from under sPAPRCPUCore
Cédric Le Goater [Mon, 3 Apr 2017 07:45:58 +0000 (09:45 +0200)]
spapr: allocate the ICPState object from under sPAPRCPUCore

Today, all the ICPs are created before the CPUs, stored in an array
under the sPAPR machine and linked to the CPU when the core threads
are realized. This modeling brings some complexity when a lookup in
the array is required and it can be simplified by allocating the ICPs
when the CPUs are.

This is the purpose of this proposal which introduces a new 'icp_type'
field under the machine and creates the ICP objects of the right type
(KVM or not) before the PowerPCCPU object are.

This change allows more cleanups : the removal of the icps array under
the sPAPR machine and the removal of the xics_get_cpu_index_by_dt_id()
helper.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr: move the IRQ server number mapping under the machine
Cédric Le Goater [Mon, 3 Apr 2017 07:45:57 +0000 (09:45 +0200)]
spapr: move the IRQ server number mapping under the machine

This is the second step to abstract the IRQ 'server' number of the
XICS layer. Now that the prereq cleanups have been done in the
previous patch, we can move down the 'cpu_dt_id' to 'cpu_index'
mapping in the sPAPR machine handler.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc/xics: introduce an 'intc' backlink under PowerPCCPU
Cédric Le Goater [Wed, 29 Mar 2017 13:53:23 +0000 (15:53 +0200)]
ppc/xics: introduce an 'intc' backlink under PowerPCCPU

Today, the ICPState array of the sPAPR machine is indexed with
'cpu_index' of the CPUState. This numbering of CPUs is internal to
QEMU and the guest only knows about what is exposed in the device
tree, that is the 'cpu_dt_id'. This is why sPAPR uses the helper
xics_get_cpu_index_by_dt_id() to do the mapping in a couple of places.

To provide a more generic XICS layer, we need to abstract the IRQ
'server' number and remove any assumption made on its nature. It
should not be used as a 'cpu_index' for lookups like xics_cpu_setup()
and xics_cpu_destroy() do.

To reach that goal, we choose to introduce a generic 'intc' backlink
under PowerPCCPU, and let the machine core init routine do the
ICPState lookup. The resulting object is passed on to xics_cpu_setup()
which does the store under PowerPCCPU. The IRQ 'server' number in XICS
is now generic. sPAPR uses 'cpu_dt_id' and PowerNV will use 'PIR'
number.

This also has the benefit of simplifying the sPAPR hcall routines
which do not need to do any ICPState lookups anymore.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget/ppc: Add ibm,processor-radix-AP-encodings for TCG
Suraj Jitindar Singh [Wed, 29 Mar 2017 05:43:45 +0000 (16:43 +1100)]
target/ppc: Add ibm,processor-radix-AP-encodings for TCG

The ibm,processor-radix-AP-encodings device tree property of the cpu node
is used to specify the radix mode supported page sizes of the processor
to the guest os. Contained in the top 3 bits of the msb is the actual
page size (AP) encoding associated with the corresponding radix mode
supported page size. Add this property for a TCG guest, note the TCG code
is capable of translating any format so just add the 4 default page sizes.

The ibm,processor-radix-AP-encodings device tree property is defined as:
One to n cells in ascending order of radix mode supported page sizes
encoded as BE ints (32bit on ppc) in the form:
0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
- 0bxxx -> AP encoding
- 0byyyyyyyyyyyyyyyyyyyyyyyyyyyyy -> supported page size encoded as a shift

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr_pci: Removed unused include
Alexey Kardashevskiy [Wed, 29 Mar 2017 05:09:58 +0000 (16:09 +1100)]
spapr_pci: Removed unused include

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr_pci: Warn when RAM page size is not enabled in IOMMU page mask
Alexey Kardashevskiy [Tue, 28 Mar 2017 08:13:49 +0000 (19:13 +1100)]
spapr_pci: Warn when RAM page size is not enabled in IOMMU page mask

If a page size used by QEMU is not enabled in the PHB IOMMU page mask,
in-kernel acceleration of TCE handling won't be enabled and performance
might be slower than expected.

This prints a warning if system page size is not enabled. This should
print a warning if huge pages are enabled but sphb.pgsz still uses
the default value of 4K|64K.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc/kvm: Enable in-kernel TCE acceleration for multi-tce
Alexey Kardashevskiy [Mon, 27 Mar 2017 05:22:19 +0000 (16:22 +1100)]
target-ppc/kvm: Enable in-kernel TCE acceleration for multi-tce

This enables in-kernel handling of H_PUT_TCE_INDIRECT and
H_STUFF_TCE hypercalls. The host kernel support is there since v4.6,
in particular d3695aa4f452
("KVM: PPC: Add support for multiple-TCE hcalls").

H_PUT_TCE is already accelerated and does not need any special enablement.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr: Workaround for broken radix guests
Sam Bobroff [Sun, 19 Mar 2017 23:46:49 +0000 (10:46 +1100)]
spapr: Workaround for broken radix guests

For a little while around 4.9, Linux kernels that saw the radix bit in
ibm,pa-features would attempt to set up the MMU as if they were a
hypervisor, even if they were a guest, which would cause them to
crash.

Work around this by detecting pre-ISA 3.0 guests by their lack of that
bit in option vector 1, and then removing the radix bit from
ibm,pa-features. Note: This now requires regeneration of that node
after CAS negotiation.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
[dwg: Fix style nits]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr: Enable ISA 3.0 MMU mode selection via CAS
Sam Bobroff [Thu, 23 Mar 2017 03:46:00 +0000 (14:46 +1100)]
spapr: Enable ISA 3.0 MMU mode selection via CAS

Add the new node, /chosen/ibm,arch-vec-5-platform-support to the
device tree. This allows the guest to determine which modes are
supported by the hypervisor.

Update the option vector processing in h_client_architecture_support()
to handle the new MMU bits. This allows guests to request hash or
radix mode and QEMU to create the guest's HPT at this time if it is
necessary but hasn't yet been done.  QEMU will terminate the guest if
it requests an unavailable mode, as required by the architecture.

Extend the ibm,pa-features node with the new ISA 3.0 values
and set the radix bit if KVM supports radix mode. This probably won't
be used directly by guests to determine the availability of radix mode
(that is indicated by the new node added above) but the architecture
requires that it be set when the hardware supports it.

If QEMU is using KVM, and KVM is capable of running in radix mode,
guests can be run in real-mode without allocating a HPT (because KVM
will use a minimal RPT). So in this case, we avoid creating the HPT
at reset time and later (during CAS) create it if it is necessary.

ISA 3.0 guests will now begin to call h_register_process_table(),
which has been added previously.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
[dwg: Strip some unneeded prefix from error messages]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr: move spapr_populate_pa_features()
Sam Bobroff [Sun, 19 Mar 2017 23:46:47 +0000 (10:46 +1100)]
spapr: move spapr_populate_pa_features()

In the next patch, spapr_fixup_cpu_dt() will need to call
spapr_populate_pa_features() so move it's definition up without making
any other changes.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget/ppc: Implement H_REGISTER_PROCESS_TABLE H_CALL
Suraj Jitindar Singh [Sun, 19 Mar 2017 23:46:46 +0000 (10:46 +1100)]
target/ppc: Implement H_REGISTER_PROCESS_TABLE H_CALL

The H_REGISTER_PROCESS_TABLE H_CALL is used by a guest to indicate to the
hypervisor where in memory its process table is and how translation should
be performed using this process table.

Provide the implementation of this H_CALL for a guest.

We first check for invalid flags, then parse the flags to determine the
operation, and then check the other parameters for valid values based on
the operation (register new table/deregister table/maintain registration).
The process table is then stored in the appropriate location and registered
with the hypervisor (if running under KVM), and the LPCR_[UPRT/GTSE] bits
are updated as required.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
[dwg: Correct missing prototype and uninitialized variable]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget/ppc: Add new H-CALL shells for in memory table translation
Suraj Jitindar Singh [Sun, 19 Mar 2017 23:46:45 +0000 (10:46 +1100)]
target/ppc: Add new H-CALL shells for in memory table translation

The use of the new in memory tables introduced in ISAv3.00 for translation,
also referred to as process tables, requires the introduction of 3 new
H-CALLs; H_REGISTER_PROCESS_TABLE, H_CLEAN_SLB, and H_INVALIDATE_PID.

Add shells for each of these and register them as the hypercall handlers.
Currently they all log an unimplemented hypercall and return H_FUNCTION.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
[dwg: Fix style nits]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>