aboutsummaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)AuthorFilesLines
2018-02-06Merge remote-tracking branch 'remotes/rth/tags/pull-hppa-20180204' into stagingPeter Maydell1-9/+8
hppa-softmmu update # gpg: Signature made Sun 04 Feb 2018 22:20:40 GMT # gpg: using RSA key 64DF38E8AF7E215F # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F * remotes/rth/tags/pull-hppa-20180204: roms/seabios-hppa: Update submodule and image tests: Enable boot-serial-test for hppa hw/hppa: Use qemu_log_mask instead of fprintf to stderr Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-02-05Merge remote-tracking branch ↵Peter Maydell4-29/+47
'remotes/stefanberger/tags/pull-tpm-2018-02-03-1' into staging Merge tpm 2018/02/03 v1 # gpg: Signature made Sat 03 Feb 2018 14:02:35 GMT # gpg: using RSA key 75AD65802A0B4211 # gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.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: B818 B9CA DF90 89C2 D5CE C66B 75AD 6580 2A0B 4211 * remotes/stefanberger/tags/pull-tpm-2018-02-03-1: tpm: tis: move one-line function into caller MAINTAINERS: add pointer to tpm-next repository tpm: wrap stX_be_p in tpm_cmd_set_XYZ functions tpm: Split off tpm_crb_reset function Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-02-04hw/hppa: Use qemu_log_mask instead of fprintf to stderrRichard Henderson1-9/+8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reported-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-02-03tpm: tis: move one-line function into callerStefan Berger1-6/+1
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-02-03tpm: wrap stX_be_p in tpm_cmd_set_XYZ functionsStefan Berger2-3/+18
Wrap the calls to stl_be_p and stw_be_p in tpm_cmd_set_XYZ functions that are similar to existing getters. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-02-03tpm: Split off tpm_crb_reset functionStefan Berger1-20/+28
Split off the tpm_crb_reset function part from tpm_crb_realize that we need to run every time the machine resets. Also register our reset function with the system since TYPE_DEVICE seems to not get a reset otherwise. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-02-02Merge remote-tracking branch 'remotes/kraxel/tags/vga-20180202-pull-request' ↵Peter Maydell2-1/+12
into staging virtio-gpu: disallow vIOMMU # gpg: Signature made Fri 02 Feb 2018 08:31:52 GMT # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/vga-20180202-pull-request: virtio-gpu: disallow vIOMMU Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-02-02Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into stagingPeter Maydell7-17/+95
This series is mostly about 9p request cancellation. It fixes a long standing bug (read "specification violation") where the server would send an invalid response when the client has cancelled an in-flight request. This was causing annoying spurious EINTR returns in linux. The fix comes with some related testing in QTEST. Other patches are code cleanup and improvements. # gpg: Signature made Fri 02 Feb 2018 10:16:03 GMT # gpg: using RSA key 71D4D5E5822F73D6 # gpg: Good signature from "Greg Kurz <groug@kaod.org>" # gpg: aka "Gregory Kurz <gregory.kurz@free.fr>" # gpg: aka "[jpeg image of size 3330]" # Primary key fingerprint: B482 8BAF 9431 40CE F2A3 4910 71D4 D5E5 822F 73D6 * remotes/gkurz/tags/for-upstream: tests/virtio-9p: explicitly handle potential integer overflows tests: virtio-9p: add FLUSH operation test libqos/virtio: return length written into used descriptor tests: virtio-9p: add WRITE operation test tests: virtio-9p: add LOPEN operation test tests: virtio-9p: use the synth backend tests: virtio-9p: wait for completion in the test code tests: virtio-9p: move request tag to the test functions 9pfs: Correctly handle cancelled requests 9pfs: drop v9fs_register_transport() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-02-02Merge remote-tracking branch ↵Peter Maydell6-43/+52
'remotes/kraxel/tags/audio-20180202-pull-request' into staging audio: two small fixes. # gpg: Signature made Fri 02 Feb 2018 07:49:20 GMT # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/audio-20180202-pull-request: hw/audio/sb16.c: change dolog() to qemu_log_mask() hw/audio/wm8750: move WM8750 declarations from i2c/i2c.h to audio/wm8750.h Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-02-02Merge remote-tracking branch 'remotes/cminyard/tags/for-release-20180201' ↵Peter Maydell3-17/+58
into staging Lots of litte miscellaneous fixes for the IPMI code, plus add me as the IPMI maintainer. # gpg: Signature made Thu 01 Feb 2018 18:44:55 GMT # gpg: using RSA key 61F38C90919BFF81 # gpg: Good signature from "Corey Minyard <cminyard@mvista.com>" # gpg: aka "Corey Minyard <minyard@acm.org>" # gpg: aka "Corey Minyard <corey@minyard.net>" # gpg: aka "Corey Minyard <minyard@mvista.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: FD0D 5CE6 7CE0 F59A 6688 2686 61F3 8C90 919B FF81 * remotes/cminyard/tags/for-release-20180201: ipmi: Allow BMC device properties to be set ipmi: disable IRQ and ATN on an external disconnect ipmi: Fix macro issues ipmi: Add the platform event message command ipmi: Don't set the timestamp on add events that don't have it ipmi: Fix SEL get/set time commands Add maintainer for the IPMI code Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-02-02tests: virtio-9p: add FLUSH operation testGreg Kurz3-0/+28
The idea is to send a victim request that will possibly block in the server and to send a flush request to cancel the victim request. This patch adds two test to verifiy that: - the server does not reply to a victim request that was actually cancelled - the server replies to the flush request after replying to the victim request if it could not cancel it 9p request cancellation reference: http://man.cat-v.org/plan_9/5/flush Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> (groug, change the test to only write a single byte to avoid any alignment or endianess consideration)
2018-02-02virtio-gpu: disallow vIOMMUPeter Xu2-1/+12
virtio-gpu has special code path that bypassed vIOMMU protection. So for now let's disable iommu_platform for the device until we fully support that (if needed). After the patch, both virtio-vga and virtio-gpu won't allow to boot with iommu_platform parameter set. CC: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-id: 20180131040401.3550-1-peterx@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-02-02hw/audio/sb16.c: change dolog() to qemu_log_mask()John Arbuckle1-36/+43
Changes all the occurrances of dolog() to qemu_log_mask(). Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 20180201172744.7504-1-programmingkidx@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-02-02hw/audio/wm8750: move WM8750 declarations from i2c/i2c.h to audio/wm8750.hPhilippe Mathieu-Daudé5-7/+9
while here use TYPE_WM8750 and declare a data_req_cb() typedef. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20170919123053.32675-1-f4bug@amsat.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-02-01tests: virtio-9p: add WRITE operation testGreg Kurz2-0/+12
Trivial test of a successful write. Signed-off-by: Greg Kurz <groug@kaod.org> (groug, handle potential overflow when computing request size, add missing g_free(buf), backend handles one written byte at a time to validate the server doesn't do short-reads) Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-02-01tests: virtio-9p: add LOPEN operation testGreg Kurz2-0/+6
Trivial test of a successful open. Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-02-01tests: virtio-9p: use the synth backendGreg Kurz2-0/+20
The purpose of virtio-9p-test is to test the virtio-9p device, especially the 9p server state machine. We don't really care what fsdev backend we're using. Moreover, if we want to be able to test the flush request or a device reset with in-flights I/O, it is close to impossible to achieve with a physical backend because we cannot ask it reliably to put an I/O on hold at a specific point in time. Fortunately, we can do that with the synthetic backend, which allows to register callbacks on read/write accesses to a specific file. This will be used by a later patch to test the 9P flush request. The walk request test is converted to using the synth backend. Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-02-019pfs: Correctly handle cancelled requestsKeno Fischer2-0/+19
# Background I was investigating spurious non-deterministic EINTR returns from various 9p file system operations in a Linux guest served from the qemu 9p server. ## EINTR, ERESTARTSYS and the linux kernel When a signal arrives that the Linux kernel needs to deliver to user-space while a given thread is blocked (in the 9p case waiting for a reply to its request in 9p_client_rpc -> wait_event_interruptible), it asks whatever driver is currently running to abort its current operation (in the 9p case causing the submission of a TFLUSH message) and return to user space. In these situations, the error message reported is generally ERESTARTSYS. If the userspace processes specified SA_RESTART, this means that the system call will get restarted upon completion of the signal handler delivery (assuming the signal handler doesn't modify the process state in complicated ways not relevant here). If SA_RESTART is not specified, ERESTARTSYS gets translated to EINTR and user space is expected to handle the restart itself. ## The 9p TFLUSH command The 9p TFLUSH commands requests that the server abort an ongoing operation. The man page [1] specifies: ``` If it recognizes oldtag as the tag of a pending transaction, it should abort any pending response and discard that tag. [...] When the client sends a Tflush, it must wait to receive the corresponding Rflush before reusing oldtag for subsequent messages. If a response to the flushed request is received before the Rflush, the client must honor the response as if it had not been flushed, since the completed request may signify a state change in the server ``` In particular, this means that the server must not send a reply with the orignal tag in response to the cancellation request, because the client is obligated to interpret such a reply as a coincidental reply to the original request. # The bug When qemu receives a TFlush request, it sets the `cancelled` flag on the relevant pdu. This flag is periodically checked, e.g. in `v9fs_co_name_to_path`, and if set, the operation is aborted and the error is set to EINTR. However, the server then violates the spec, by returning to the client an Rerror response, rather than discarding the message entirely. As a result, the client is required to assume that said Rerror response is a result of the original request, not a result of the cancellation and thus passes the EINTR error back to user space. This is not the worst thing it could do, however as discussed above, the correct error code would have been ERESTARTSYS, such that user space programs with SA_RESTART set get correctly restarted upon completion of the signal handler. Instead, such programs get spurious EINTR results that they were not expecting to handle. It should be noted that there are plenty of user space programs that do not set SA_RESTART and do not correctly handle EINTR either. However, that is then a userspace bug. It should also be noted that this bug has been mitigated by a recent commit to the Linux kernel [2], which essentially prevents the kernel from sending Tflush requests unless the process is about to die (in which case the process likely doesn't care about the response). Nevertheless, for older kernels and to comply with the spec, I believe this change is beneficial. # Implementation The fix is fairly simple, just skipping notification of a reply if the pdu was previously cancelled. We do however, also notify the transport layer that we're doing this, so it can clean up any resources it may be holding. I also added a new trace event to distinguish operations that caused an error reply from those that were cancelled. One complication is that we only omit sending the message on EINTR errors in order to avoid confusing the rest of the code (which may assume that a client knows about a fid if it sucessfully passed it off to pud_complete without checking for cancellation status). This does mean that if the server acts upon the cancellation flag, it always needs to set err to EINTR. I believe this is true of the current code. [1] https://9fans.github.io/plan9port/man/man9/flush.html [2] https://github.com/torvalds/linux/commit/9523feac272ccad2ad8186ba4fcc891 Signed-off-by: Keno Fischer <keno@juliacomputing.com> Reviewed-by: Greg Kurz <groug@kaod.org> [groug, send a zero-sized reply instead of detaching the buffer] Signed-off-by: Greg Kurz <groug@kaod.org> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2018-02-019pfs: drop v9fs_register_transport()Greg Kurz4-17/+10
No good reasons to do this outside of v9fs_device_realize_common(). Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2018-01-31hw/hppa: Implement DINO system boardHelge Deller7-2/+923
Now that we have the prerequisites in target/hppa/, implement the hardware for a PA7100LC. This also enables build for hppa-softmmu. Signed-off-by: Helge Deller <deller@gmx.de> [rth: Since it is all new code, squashed all branch development withing hw/hppa/ to a single patch.] Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-01-30ipmi: Allow BMC device properties to be setCorey Minyard1-7/+14
Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-01-30ipmi: disable IRQ and ATN on an external disconnectCorey Minyard1-0/+5
Otherwise there's no way to clear them without an external command, and it could lock the OS in the VM if they were stuck. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2018-01-30ipmi: Fix macro issuesCorey Minyard1-6/+6
Macro parameters should almost always have () around them when used. llvm reported an error on this. Remove redundant parenthesis and put parenthesis around the entire macros with assignments in case they are used in an expression. The macros were doing ((v) & 1) for a binary input, but that only works if v == 0 or if v & 1. Changed to !!(v) so they work for all values. Remove some unused macros. Reported in https://bugs.launchpad.net/bugs/1651167 An audit of these changes found no semantic changes; this is just cleanups for proper style and to avoid a compiler warning. Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2018-01-30ipmi: Add the platform event message commandCorey Minyard1-0/+24
This lets an event be added to the SEL as if a sensor had generated it. The OpenIPMI driver uses it for storing panic event information. Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Cédric Le Goater <clg@kaod.org>
2018-01-30ipmi: Don't set the timestamp on add events that don't have itCorey Minyard1-2/+7
According to the spec, from section "32.3 OEM SEL Record - Type E0h-FFh", event types from 0x0e to 0xff do not have a timestamp. So don't set it when adding those types. This required putting the timestamp in a temporary buffer, since it's still required to set the last addition time. Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Cédric Le Goater <clg@kaod.org>
2018-01-30ipmi: Fix SEL get/set time commandsCorey Minyard1-2/+2
The minimum message size was on the wrong commands, for getting the time it's zero and for setting the time it's 6. Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-01-30target/hppa: Skeleton support for hppa-softmmuHelge Deller2-0/+39
With the addition of default-configs/hppa-softmmu.mak, this will compile. It is not enabled with this patch, however. Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-01-30Merge remote-tracking branch ↵Peter Maydell8-107/+436
'remotes/stefanberger/tags/pull-tpm-2018-01-26-2' into staging Merge tpm 2018/01/26 v2 # gpg: Signature made Mon 29 Jan 2018 22:20:05 GMT # gpg: using RSA key 0x75AD65802A0B4211 # gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.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: B818 B9CA DF90 89C2 D5CE C66B 75AD 6580 2A0B 4211 * remotes/stefanberger/tags/pull-tpm-2018-01-26-2: tpm: add CRB device tpm: report backend request error tpm: replace GThreadPool with AIO threadpool tpm: lookup cancel path under tpm device class tpm: fix alignment issues tpm: Set the flags of the CMD_INIT command to 0 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-01-29tpm: add CRB deviceMarc-André Lureau3-8/+330
tpm_crb is a device for TPM 2.0 Command Response Buffer (CRB) Interface as defined in TCG PC Client Platform TPM Profile (PTP) Specification Family “2.0” Level 00 Revision 01.03 v22. The PTP allows device implementation to switch between TIS and CRB model at run time, but given that CRB is a simpler device to implement, I chose to implement it as a different device. The device doesn't implement other locality than 0 for now (my laptop TPM doesn't either, so I assume this isn't so bad) Tested with some success with Linux upstream and Windows 10, seabios & modified ovmf. The device is recognized and correctly transmit command/response with passthrough & emu. However, we are missing PPI ACPI part atm. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-01-29tpm: report backend request errorMarc-André Lureau3-32/+23
Use an Error** for request to let the caller handle error reporting. This will also allow to inform the frontend of a backend error. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-01-29tpm: lookup cancel path under tpm device classMarc-André Lureau1-12/+22
Since Linux commit 313d21eeab9282e, tpm devices have their own device class "tpm" and the cancel path must be looked up under /sys/class/tpm/ instead of /sys/class/misc/. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-01-29tpm: fix alignment issuesMarc-André Lureau4-54/+58
The new tpm-crb-test fails on sparc host: TEST: tests/tpm-crb-test... (pid=230409) /i386/tpm-crb/test: Broken pipe FAIL GTester: last random seed: R02S29cea50247fe1efa59ee885a26d51a85 (pid=230423) FAIL: tests/tpm-crb-test and generates a new clang sanitizer runtime warning: /home/petmay01/linaro/qemu-for-merges/hw/tpm/tpm_util.h:36:24: runtime error: load of misaligned address 0x7fdc24c00002 for type 'const uint32_t' (aka 'const unsigned int'), which requires 4 byte alignment 0x7fdc24c00002: note: pointer points here <memory cannot be printed> The sparc architecture does not allow misaligned loads and will segfault if you try them. For example, this function: static inline uint32_t tpm_cmd_get_size(const void *b) { return be32_to_cpu(*(const uint32_t *)(b + 2)); } Should read, return ldl_be_p(b + 2); As a general rule you can't take an arbitrary pointer into a byte buffer and try to interpret it as a structure or a pointer to a larger-than-bytesize-data simply by casting the pointer. Use this clean up as an opportunity to remove unnecessary temporary buffers and casts. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-01-29tpm: Set the flags of the CMD_INIT command to 0Stefan Berger1-1/+3
The flags of the CMD_INIT control channel command were not initialized properly. Fix this and set to 0. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-01-29Merge remote-tracking branch ↵Peter Maydell3-661/+36
'remotes/kraxel/tags/input-20180129-v2-pull-request' into staging input: switch devices to keycodemapdb, bugfixes. # gpg: Signature made Mon 29 Jan 2018 10:23:00 GMT # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/input-20180129-v2-pull-request: hw: convert virtio-input-hid device to keycodemapdb ui: fix alphabetical ordering of keymaps hw: convert the escc device to keycodemapdb hw: convert ps2 device to keycodemapdb ps2: check PS2Queue pointers in post_load routine input: virtio: don't send mouse wheel event twice input: add mouse side buttons to virtio input Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-01-29hw: convert virtio-input-hid device to keycodemapdbDaniel P. Berrange1-127/+9
Replace the keymap_qcode table with automatically generated tables. Missing entries in keymap_qcode now fixed: Q_KEY_CODE_ASTERISK -> KEY_KPASTERISK Q_KEY_CODE_KP_MULTIPLY -> KEY_KPASTERISK Q_KEY_CODE_STOP -> KEY_STOP Q_KEY_CODE_AGAIN -> KEY_AGAIN Q_KEY_CODE_PROPS -> KEY_PROPS Q_KEY_CODE_UNDO -> KEY_UNDO Q_KEY_CODE_FRONT -> KEY_FRONT Q_KEY_CODE_COPY -> KEY_COPY Q_KEY_CODE_OPEN -> KEY_OPEN Q_KEY_CODE_PASTE -> KEY_PASTE Q_KEY_CODE_FIND -> KEY_FIND Q_KEY_CODE_CUT -> KEY_CUT Q_KEY_CODE_LF -> KEY_LINEFEED Q_KEY_CODE_HELP -> KEY_HELP Q_KEY_CODE_COMPOSE -> KEY_COMPOSE Q_KEY_CODE_RO -> KEY_RO Q_KEY_CODE_HIRAGANA -> KEY_HIRAGANA Q_KEY_CODE_HENKAN -> KEY_HENKAN Q_KEY_CODE_YEN -> KEY_YEN Q_KEY_CODE_KP_COMMA -> KEY_KPCOMMA Q_KEY_CODE_KP_EQUALS -> KEY_KPEQUAL Q_KEY_CODE_POWER -> KEY_POWER Q_KEY_CODE_SLEEP -> KEY_SLEEP Q_KEY_CODE_WAKE -> KEY_WAKEUP Q_KEY_CODE_AUDIONEXT -> KEY_NEXTSONG Q_KEY_CODE_AUDIOPREV -> KEY_PREVIOUSSONG Q_KEY_CODE_AUDIOSTOP -> KEY_STOPCD Q_KEY_CODE_AUDIOPLAY -> KEY_PLAYPAUSE Q_KEY_CODE_AUDIOMUTE -> KEY_MUTE Q_KEY_CODE_VOLUMEUP -> KEY_VOLUMEUP Q_KEY_CODE_VOLUMEDOWN -> KEY_VOLUMEDOWN Q_KEY_CODE_MEDIASELECT -> KEY_MEDIA Q_KEY_CODE_MAIL -> KEY_MAIL Q_KEY_CODE_CALCULATOR -> KEY_CALC Q_KEY_CODE_COMPUTER -> KEY_COMPUTER Q_KEY_CODE_AC_HOME -> KEY_HOMEPAGE Q_KEY_CODE_AC_BACK -> KEY_BACK Q_KEY_CODE_AC_FORWARD -> KEY_FORWARD Q_KEY_CODE_AC_REFRESH -> KEY_REFRESH Q_KEY_CODE_AC_BOOKMARKS -> KEY_BOOKMARKS NB, the virtio-input device reports a bitmask to the guest driver that has a bit set for each Linux keycode that the host is able to send to the guest. Thus by adding these extra key mappings we are technically changing the host<->guest ABI. This would also happen any time we defined new mappings for QEMU keycodes in future. When a keycode is removed from the list of possible keycodes that host can send to the guest, it means that the guest OS will think it is possible to receive a key that in pratice can never be generated, which is harmless. When a keycode is added to the list of possible keycodes that the host can send to the guest, it means that the guest OS can see an unexpected event. The Linux virtio_input.c driver code simply forwards this event to the input_event() method in the Linux input subsystem. This in turn calls input_handle_event(), which then calls input_get_disposition(). This method checks if the input event is present in the permitted keys bitmap, and if not returns INPUT_IGNORE_EVENT. Thus the unexpected event will get dropped, which is harmless. If the guest OS reboots, or otherwise re-initializes the virt-input device, it will read the new keycode bitmap. No matter how many keys are defined, the config space has a fixed 128 byte bitmap. There is, however, a size field defiend which says how many bytes in the bitmap are used. So the guest OS reads the size of the bitmap, and then it reads the data from bitmap upto the designated size. So if the guest OS re-initializes at precisely the time that QEMU is migrated across versions, in the worst case, it could conceivably read the old size field, but then get the newly updated bitmap. If a key were added this is harmless, since it simply means it may not process the newly added key. If a key were removed, then it could be readnig a byte from the bitmap that was not initialized. Fortunately QEMU always memsets() the entire bitmap to 0, prior to setting keybits. Thus the guest OS will simply read zeros, which is again harmless. Based on this analysis, it is believed that there is no need to preserve the virtio-input-hid keymaps across migration, as the host<->guest ABI change is harmless and self-resolving at time of guest reboot. NB, this behaviour should perhaps be formalized in the virtio-input spec to declare how guest OS drivers should be written to be robust in their handling of the potentially changable key bitmaps. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20180117164118.8510-5-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-01-29hw: convert the escc device to keycodemapdbDaniel P. Berrange1-121/+5
Replace the qcode_to_keycode table with automatically generated tables. Missing entries in qcode_to_keycode now fixed: - Q_KEY_CODE_KP_COMMA -> 0x2d Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20180117164118.8510-3-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-01-29hw: convert ps2 device to keycodemapdbDaniel P. Berrange1-399/+7
Replace the qcode_to_keycode_set1, qcode_to_keycode_set2, and qcode_to_keycode_set3 tables with automatically generated tables. Missing entries in qcode_to_keycode_set1 now fixed: - Q_KEY_CODE_SYSRQ -> 0x54 - Q_KEY_CODE_PRINT -> 0x54 (NB ignored due to special case) - Q_KEY_CODE_AGAIN -> 0xe005 - Q_KEY_CODE_PROPS -> 0xe006 - Q_KEY_CODE_UNDO -> 0xe007 - Q_KEY_CODE_FRONT -> 0xe00c - Q_KEY_CODE_COPY -> 0xe078 - Q_KEY_CODE_OPEN -> 0x64 - Q_KEY_CODE_PASTE -> 0x65 - Q_KEY_CODE_CUT -> 0xe03c - Q_KEY_CODE_LF -> 0x5b - Q_KEY_CODE_HELP -> 0xe075 - Q_KEY_CODE_COMPOSE -> 0xe05d - Q_KEY_CODE_PAUSE -> 0xe046 - Q_KEY_CODE_KP_EQUALS -> 0x59 And some mistakes corrected: - Q_KEY_CODE_HIRAGANA was mapped to 0x70 (Katakanahiragana) instead of of 0x77 (Hirigana) - Q_KEY_CODE_MENU was incorrectly mapped to the compose scancode (0xe05d) and is now mapped to 0xe01e - Q_KEY_CODE_FIND was mapped to 0xe065 (Search) instead of to 0xe041 (Find) - Q_KEY_CODE_POWER, SLEEP & WAKE had 0x0e instead of 0xe0 as the prefix Missing entries in qcode_to_keycode_set2 now fixed: - Q_KEY_CODE_PRINT -> 0x7f (NB ignored due to special case) - Q_KEY_CODE_COMPOSE -> 0xe02f - Q_KEY_CODE_PAUSE -> 0xe077 - Q_KEY_CODE_KP_EQUALS -> 0x0f And some mistakes corrected: - Q_KEY_CODE_HIRAGANA was mapped to 0x13 (Katakanahiragana) instead of of 0x62 (Hirigana) - Q_KEY_CODE_MENU was incorrectly mapped to the compose scancode (0xe02f) and is now not mapped - Q_KEY_CODE_FIND was mapped to 0xe010 (Search) and is now not mapped. - Q_KEY_CODE_POWER, SLEEP & WAKE had 0x0e instead of 0xe0 as the prefix Missing entries in qcode_to_keycode_set3 now fixed: - Q_KEY_CODE_ASTERISK -> 0x7e - Q_KEY_CODE_SYSRQ -> 0x57 - Q_KEY_CODE_LESS -> 0x13 - Q_KEY_CODE_STOP -> 0x0a - Q_KEY_CODE_AGAIN -> 0x0b - Q_KEY_CODE_PROPS -> 0x0c - Q_KEY_CODE_UNDO -> 0x10 - Q_KEY_CODE_COPY -> 0x18 - Q_KEY_CODE_OPEN -> 0x20 - Q_KEY_CODE_PASTE -> 0x28 - Q_KEY_CODE_FIND -> 0x30 - Q_KEY_CODE_CUT -> 0x38 - Q_KEY_CODE_HELP -> 0x09 - Q_KEY_CODE_COMPOSE -> 0x8d - Q_KEY_CODE_AUDIONEXT -> 0x93 - Q_KEY_CODE_AUDIOPREV -> 0x94 - Q_KEY_CODE_AUDIOSTOP -> 0x98 - Q_KEY_CODE_AUDIOMUTE -> 0x9c - Q_KEY_CODE_VOLUMEUP -> 0x95 - Q_KEY_CODE_VOLUMEDOWN -> 0x9d - Q_KEY_CODE_CALCULATOR -> 0xa3 - Q_KEY_CODE_AC_HOME -> 0x97 And some mistakes corrected: - Q_KEY_CODE_MENU was incorrectly mapped to the compose scancode (0x8d) and is now 0x91 Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20180117164118.8510-2-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-01-29ps2: check PS2Queue pointers in post_load routinePrasad J Pandit1-12/+9
During Qemu guest migration, a destination process invokes ps2 post_load function. In that, if 'rptr' and 'count' values were invalid, it could lead to OOB access or infinite loop issue. Add check to avoid it. Reported-by: Cyrille Chatras <cyrille.chatras@orange.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Message-id: 20171116075155.22378-1-ppandit@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-01-29input: virtio: don't send mouse wheel event twiceMiika S1-2/+4
On Linux, a mouse event is generated for both down and up when mouse wheel is used. This caused virtio_input_send() to be called twice each time the wheel was used. This commit adds a check for the button down state and only calls virtio_input_send() when it is true. Signed-off-by: Miika S <miika9764@gmail.com> Message-Id: <20171222152531.1849-4-miika9764@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-01-29input: add mouse side buttons to virtio inputMiika S1-0/+2
Signed-off-by: Miika S <miika9764@gmail.com> Message-Id: <20171222152531.1849-3-miika9764@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-01-29target/ppc/spapr: Add H-Call H_GET_CPU_CHARACTERISTICSSuraj Jitindar Singh1-0/+58
The new H-Call H_GET_CPU_CHARACTERISTICS is used by the guest to query behaviours and available characteristics of the cpu. Implement the handler for this new H-Call which formulates its response based on the setting of the spapr_caps cap-cfpc, cap-sbbc and cap-ibs. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-01-29target/ppc/spapr_caps: Add new tristate cap safe_indirect_branchSuraj Jitindar Singh2-0/+23
Add new tristate cap cap-ibs to represent the indirect branch serialisation capability. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-01-29target/ppc/spapr_caps: Add new tristate cap safe_bounds_checkSuraj Jitindar Singh2-0/+23
Add new tristate cap cap-sbbc to represent the speculation barrier bounds checking capability. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-01-29target/ppc/spapr_caps: Add new tristate cap safe_cacheSuraj Jitindar Singh2-10/+28
Add new tristate cap cap-cfpc to represent the cache flush on privilege change capability. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-01-29target/ppc/spapr_caps: Add support for tristate spapr_capabilitiesSuraj Jitindar Singh1-0/+66
spapr_caps are used to represent the level of support for various capabilities related to the spapr machine type. Currently there is only support for boolean capabilities. Add support for tristate capabilities by implementing their get/set functions. These capabilities can have the values 0, 1 or 2 corresponding to broken, workaround and fixed. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-01-29spapr_pci: fix MSI/MSIX selectionGreg Kurz1-19/+42
In various place we don't correctly check if the device supports MSI or MSI-X. This can cause devices to be advertised with MSI support, even if they only support MSI-X (like virtio-pci-* devices for example): ethernet@0 { ibm,req#msi = <0x1>; <--- wrong! . ibm,loc-code = "qemu_virtio-net-pci:0000:00:00.0"; . ibm,req#msi-x = <0x3>; }; Worse, this can also cause the "ibm,change-msi" RTAS call to corrupt the PCI status and cause migration to fail: qemu-system-ppc64: get_pci_config_device: Bad config data: i=0x6 read: 0 device: 10 cmask: 10 wmask: 0 w1cmask:0 ^^ PCI_STATUS_CAP_LIST bit which is assumed to be constant This patch changes spapr_populate_pci_child_dt() to properly check for MSI support using msi_present(): this ensures that PCIDevice::msi_cap was set by msi_init() and that msi_nr_vectors_allocated() will look at the right place in the config space. Checking PCIDevice::msix_entries_nr is enough for MSI-X but let's add a call to msix_present() there as well for consistency. It also changes rtas_ibm_change_msi() to select the appropriate MSI type in Function 1 instead of always selecting plain MSI. This new behaviour is compliant with LoPAPR 1.1, as described in "Table 71. ibm,change-msi Argument Call Buffer": Function 1: If Number Outputs is equal to 3, request to set to a new number of MSIs (including set to 0). If the “ibm,change-msix-capable” property exists and Number Outputs is equal to 4, request is to set to a new number of MSI or MSI-X (platform choice) interrupts (including set to 0). Since MSI is the the platform default (LoPAPR 6.2.3 MSI Option), let's check for MSI support first. And finally, it checks the input parameters are valid, as described in LoPAPR 1.1 "R1–7.3.10.5.1–3": For the MSI option: The platform must return a Status of -3 (Parameter error) from ibm,change-msi, with no change in interrupt assignments if the PCI configuration address does not support MSI and Function 3 was requested (that is, the “ibm,req#msi” property must exist for the PCI configuration address in order to use Function 3), or does not support MSI-X and Function 4 is requested (that is, the “ibm,req#msi-x” property must exist for the PCI configuration address in order to use Function 4), or if neither MSIs nor MSI-Xs are supported and Function 1 is requested. This ensures that the ret_intr_type variable contains a valid MSI type for this device, and that spapr_msi_setmsg() won't corrupt the PCI status. Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-01-27input: add missing newline from trace-eventsMark Cave-Ayland1-0/+1
This was accidentally omitted from 77cb0f5aaf "Split adb.c into adb.c, adb-mouse.c and adb-kbd.c". Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-01-27uninorth: convert to trace-eventsMark Cave-Ayland2-19/+11
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-01-27grackle: convert to trace-eventsMark Cave-Ayland2-11/+5
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-01-27ppc: Deprecate qemu-system-ppcembthuth@redhat.com3-0/+31
qemu-system-ppcemb has been once split of qemu-system-ppc to support CPU page sizes < 4096 for some of the embedded 4xx PowerPC CPUs. However, there was hardly any OS available in the wild that really used such small page sizes (Linux uses 4096 on PPC), so there is no known recent use case for this separate build anymore. It's rather cumbersome to maintain a separate set of config switches for this, and it's wasting compile and test time of all the developers who have to build all QEMU targets to verify that their changes did not break anything. Except for the small CPU page sizes, qemu-system-ppc can be used as a full replacement for qemu-system-ppcemb since it contains all the embedded 4xx PPC boards and CPUs, too. Thus let's start the deprecation process for qemu-system-ppcemb to see whether somebody still needs the small page sizes or whether we could finally remove this unloved separate build. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>