]> Git Repo - qemu.git/log
qemu.git
4 years agohw/pci: Fix crash when running QEMU with "-nic model=rocker"
Thomas Huth [Wed, 27 May 2020 15:31:52 +0000 (17:31 +0200)]
hw/pci: Fix crash when running QEMU with "-nic model=rocker"

QEMU currently aborts when being started with "-nic model=rocker" or with
"-net nic,model=rocker". This happens because the "rocker" device is not
a normal NIC but a switch, which has different properties. Thus we should
only consider real NIC devices for "-nic" and "-net". These devices can
be identified by the "netdev" property, so check for this property before
adding the device to the list.

Reported-by: Michael Tokarev <[email protected]>
Fixes: 52310c3fa7dc854d ("net: allow using any PCI NICs in -net or -nic")
Signed-off-by: Thomas Huth <[email protected]>
Message-Id: <20200527153152[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agolibvhost-user: advertise vring features
Stefan Hajnoczi [Fri, 29 May 2020 16:13:38 +0000 (17:13 +0100)]
libvhost-user: advertise vring features

libvhost-user implements several vring features without advertising
them. There is no way for the vhost-user master to detect support for
these features.

Things more or less work today because QEMU assumes the vhost-user
backend always implements certain feature bits like
VIRTIO_RING_F_EVENT_IDX. This is not documented anywhere.

This patch explicitly advertises features implemented in libvhost-user
so that the vhost-user master does not need to make undocumented
assumptions.

Feature bits that libvhost-user now advertises can be removed from
vhost-user-blk.c. Devices should not be responsible for advertising
vring feature bits, that is libvhost-user's job.

Cc: Marc-André Lureau <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Message-Id: <20200529161338[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
4 years agoLift max ram slots limit in libvhost-user
Raphael Norwitz [Thu, 21 May 2020 05:00:59 +0000 (05:00 +0000)]
Lift max ram slots limit in libvhost-user

Historically, VMs with vhost-user devices could hot-add memory a maximum
of 8 times. Now that the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS
protocol feature has been added, VMs with vhost-user backends which
support this new feature can support a configurable number of ram slots
up to the maximum supported by the target platform.

This change adds VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS support for
backends built with libvhost-user, and increases the number of supported
ram slots from 8 to 32.

Memory hot-add, hot-remove and postcopy migration were tested with
the vhost-user-bridge sample.

Signed-off-by: Raphael Norwitz <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agoSupport individual region unmap in libvhost-user
Raphael Norwitz [Thu, 21 May 2020 05:00:56 +0000 (05:00 +0000)]
Support individual region unmap in libvhost-user

When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature is
enabled, on memory hot-unplug qemu will transmit memory regions to
remove individually using the new message VHOST_USER_REM_MEM_REG
message. With this change, vhost-user backends build with libvhost-user
can now unmap individual memory regions when receiving the
VHOST_USER_REM_MEM_REG message.

Qemu only sends VHOST_USER_REM_MEM_REG messages when the
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and
support for that feature has not yet been added in libvhost-user, this
new functionality is not yet used.

Signed-off-by: Raphael Norwitz <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agoSupport adding individual regions in libvhost-user
Raphael Norwitz [Thu, 21 May 2020 05:00:52 +0000 (05:00 +0000)]
Support adding individual regions in libvhost-user

When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS is enabled, qemu will
transmit memory regions to a backend individually using the new message
VHOST_USER_ADD_MEM_REG. With this change vhost-user backends built with
libvhost-user can now map in new memory regions when VHOST_USER_ADD_MEM_REG
messages are received.

Qemu only sends VHOST_USER_ADD_MEM_REG messages when the
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and
since it is not yet supported in libvhost-user, this new functionality
is not yet used.

Signed-off-by: Raphael Norwitz <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agoSupport ram slot configuration in libvhost-user
Raphael Norwitz [Thu, 21 May 2020 05:00:50 +0000 (05:00 +0000)]
Support ram slot configuration in libvhost-user

The VHOST_USER_GET_MAX_MEM_SLOTS message allows a vhost-user backend to
specify a maximum number of ram slots it is willing to support. This
change adds support for libvhost-user to process this message. For now
the backend will reply with 8 as the maximum number of regions
supported.

libvhost-user does not yet support the vhost-user protocol feature
VHOST_USER_PROTOCOL_F_CONFIGIRE_MEM_SLOTS, so qemu should never
send the VHOST_USER_GET_MAX_MEM_SLOTS message. Therefore this new
functionality is not currently used.

Signed-off-by: Raphael Norwitz <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
4 years agoRefactor out libvhost-user fault generation logic
Raphael Norwitz [Thu, 21 May 2020 05:00:47 +0000 (05:00 +0000)]
Refactor out libvhost-user fault generation logic

In libvhost-user, the incoming postcopy migration path for setting the
backend's memory tables has become convolued. In particular, moving the
logic which starts generating faults, having received the final ACK from
qemu can be moved to a separate function. This simplifies the code
substantially.

This logic will also be needed by the postcopy path once the
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is supported.

Signed-off-by: Raphael Norwitz <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
4 years agoLift max memory slots limit imposed by vhost-user
Raphael Norwitz [Thu, 21 May 2020 05:00:40 +0000 (05:00 +0000)]
Lift max memory slots limit imposed by vhost-user

Historically, sending all memory regions to vhost-user backends in a
single message imposed a limitation on the number of times memory
could be hot-added to a VM with a vhost-user device. Now that backends
which support the VHOST_USER_PROTOCOL_F_CONFIGURE_SLOTS send memory
regions individually, we no longer need to impose this limitation on
devices which support this feature.

With this change, VMs with a vhost-user device which supports the
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS can support a configurable
number of memory slots, up to the maximum allowed by the target
platform.

Existing backends which do not support
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS are unaffected.

Signed-off-by: Raphael Norwitz <[email protected]>
Signed-off-by: Peter Turschmid <[email protected]>
Suggested-by: Mike Cui <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
4 years agoTransmit vhost-user memory regions individually
Raphael Norwitz [Thu, 21 May 2020 05:00:35 +0000 (05:00 +0000)]
Transmit vhost-user memory regions individually

With this change, when the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS
protocol feature has been negotiated, Qemu no longer sends the backend
all the memory regions in a single message. Rather, when the memory
tables are set or updated, a series of VHOST_USER_ADD_MEM_REG and
VHOST_USER_REM_MEM_REG messages are sent to transmit the regions to map
and/or unmap instead of sending send all the regions in one fixed size
VHOST_USER_SET_MEM_TABLE message.

The vhost_user struct maintains a shadow state of the VM’s memory
regions. When the memory tables are modified, the
vhost_user_set_mem_table() function compares the new device memory state
to the shadow state and only sends regions which need to be unmapped or
mapped in. The regions which must be unmapped are sent first, followed
by the new regions to be mapped in. After all the messages have been
sent, the shadow state is set to the current virtual device state.

Existing backends which do not support
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS are unaffected.

Signed-off-by: Raphael Norwitz <[email protected]>
Signed-off-by: Swapnil Ingle <[email protected]>
Signed-off-by: Peter Turschmid <[email protected]>
Suggested-by: Mike Cui <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Marc-André Lureau <[email protected]>
4 years agoAdd VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS
Raphael Norwitz [Thu, 21 May 2020 05:00:32 +0000 (05:00 +0000)]
Add VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS

This change introduces a new feature to the vhost-user protocol allowing
a backend device to specify the maximum number of ram slots it supports.

At this point, the value returned by the backend will be capped at the
maximum number of ram slots which can be supported by vhost-user, which
is currently set to 8 because of underlying protocol limitations.

The returned value will be stored inside the VhostUserState struct so
that on device reconnect we can verify that the ram slot limitation
has not decreased since the last time the device connected.

Signed-off-by: Raphael Norwitz <[email protected]>
Signed-off-by: Peter Turschmid <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
4 years agoAdd vhost-user helper to get MemoryRegion data
Raphael Norwitz [Thu, 21 May 2020 05:00:29 +0000 (05:00 +0000)]
Add vhost-user helper to get MemoryRegion data

When setting the memory tables, qemu uses a memory region's userspace
address to look up the region's MemoryRegion struct. Among other things,
the MemoryRegion contains the region's offset and associated file
descriptor, all of which need to be sent to the backend.

With VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS, this logic will be
needed in multiple places, so before feature support is added it
should be moved to a helper function.

This helper is also used to simplify the vhost_user_can_merge()
function.

Signed-off-by: Raphael Norwitz <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
4 years agoAdd helper to populate vhost-user message regions
Raphael Norwitz [Thu, 21 May 2020 05:00:26 +0000 (05:00 +0000)]
Add helper to populate vhost-user message regions

When setting vhost-user memory tables, memory region descriptors must be
copied from the vhost_dev struct to the vhost-user message. To avoid
duplicating code in setting the memory tables, we should use a helper to
populate this field. This change adds this helper.

Signed-off-by: Raphael Norwitz <[email protected]>
Message-Id: <1588533678[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
4 years agovhost-user-blk: delay vhost_user_blk_disconnect
Dima Stepanov [Thu, 28 May 2020 09:11:19 +0000 (12:11 +0300)]
vhost-user-blk: delay vhost_user_blk_disconnect

A socket write during vhost-user communication may trigger a disconnect
event, calling vhost_user_blk_disconnect() and clearing all the
vhost_dev structures holding data that vhost-user functions expect to
remain valid to roll back initialization correctly. Delay the cleanup to
keep vhost_dev structure valid.
There are two possible states to handle:
1. RUN_STATE_PRELAUNCH: skip bh oneshot call and perform disconnect in
the caller routine.
2. RUN_STATE_RUNNING: delay by using bh

BH changes are based on the similar changes for the vhost-user-net
device:
  commit e7c83a885f865128ae3cf1946f8cb538b63cbfba
  "vhost-user: delay vhost_user_stop"

Signed-off-by: Dima Stepanov <[email protected]>
Message-Id: <69b73b94dcd066065595266c852810e0863a0895.1590396396[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Li Feng <[email protected]>
Reviewed-by: Raphael Norwitz <[email protected]>
4 years agochar-socket: return -1 in case of disconnect during tcp_chr_write
Dima Stepanov [Thu, 28 May 2020 09:11:18 +0000 (12:11 +0300)]
char-socket: return -1 in case of disconnect during tcp_chr_write

During testing of the vhost-user-blk reconnect functionality the qemu
SIGSEGV was triggered:
 start qemu as:
 x86_64-softmmu/qemu-system-x86_64 -m 1024M -M q35 \
   -object memory-backend-file,id=ram-node0,size=1024M,mem-path=/dev/shm/qemu,share=on \
   -numa node,cpus=0,memdev=ram-node0 \
   -chardev socket,id=chardev0,path=./vhost.sock,noserver,reconnect=1 \
   -device vhost-user-blk-pci,chardev=chardev0,num-queues=4 --enable-kvm
 start vhost-user-blk daemon:
 ./vhost-user-blk -s ./vhost.sock -b test-img.raw

If vhost-user-blk will be killed during the vhost initialization
process, for instance after getting VHOST_SET_VRING_CALL command, then
QEMU will fail with the following backtrace:

Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
0x00005555559272bb in vhost_user_read (dev=0x7fffef2d53e0, msg=0x7fffffffd5b0)
    at ./hw/virtio/vhost-user.c:260
260         CharBackend *chr = u->user->chr;

 #0  0x00005555559272bb in vhost_user_read (dev=0x7fffef2d53e0, msg=0x7fffffffd5b0)
    at ./hw/virtio/vhost-user.c:260
 #1  0x000055555592acb8 in vhost_user_get_config (dev=0x7fffef2d53e0, config=0x7fffef2d5394 "", config_len=60)
    at ./hw/virtio/vhost-user.c:1645
 #2  0x0000555555925525 in vhost_dev_get_config (hdev=0x7fffef2d53e0, config=0x7fffef2d5394 "", config_len=60)
    at ./hw/virtio/vhost.c:1490
 #3  0x00005555558cc46b in vhost_user_blk_device_realize (dev=0x7fffef2d51a0, errp=0x7fffffffd8f0)
    at ./hw/block/vhost-user-blk.c:429
 #4  0x0000555555920090 in virtio_device_realize (dev=0x7fffef2d51a0, errp=0x7fffffffd948)
    at ./hw/virtio/virtio.c:3615
 #5  0x0000555555a9779c in device_set_realized (obj=0x7fffef2d51a0, value=true, errp=0x7fffffffdb88)
    at ./hw/core/qdev.c:891
 ...

The problem is that vhost_user_write doesn't get an error after
disconnect and try to call vhost_user_read(). The tcp_chr_write()
routine should return -1 in case of disconnect. Indicate the EIO error
if this routine is called in the disconnected state.

Signed-off-by: Dima Stepanov <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <aeb7806bfc945faadf09f64dcfa30f59de3ac053.1590396396[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agohw/pci-host: Use the IEC binary prefix definitions
Philippe Mathieu-Daudé [Mon, 1 Jun 2020 14:29:27 +0000 (16:29 +0200)]
hw/pci-host: Use the IEC binary prefix definitions

IEC binary prefixes ease code review: the unit is explicit.

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200601142930[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
4 years agohw/pci/pci_bridge: Use the IEC binary prefix definitions
Philippe Mathieu-Daudé [Mon, 1 Jun 2020 14:29:26 +0000 (16:29 +0200)]
hw/pci/pci_bridge: Use the IEC binary prefix definitions

IEC binary prefixes ease code review: the unit is explicit.

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200601142930[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
4 years agohw/pci/pci_bridge: Correct pci_bridge_io memory region size
Philippe Mathieu-Daudé [Mon, 1 Jun 2020 14:29:25 +0000 (16:29 +0200)]
hw/pci/pci_bridge: Correct pci_bridge_io memory region size

memory_region_set_size() handle the 16 Exabytes limit by
special-casing the UINT64_MAX value. This is not a problem
for the 32-bit maximum, 4 GiB.
By using the UINT32_MAX value, the pci_bridge_io MemoryRegion
ends up missing 1 byte:

  (qemu) info mtree
  memory-region: pci_bridge_io
    0000000000000000-00000000fffffffe (prio 0, i/o): pci_bridge_io
      0000000000000060-0000000000000060 (prio 0, i/o): i8042-data
      0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd
      00000000000001ce-00000000000001d1 (prio 0, i/o): vbe
      0000000000000378-000000000000037f (prio 0, i/o): parallel
      00000000000003b4-00000000000003b5 (prio 0, i/o): vga
      ...

Fix by using the correct value. We now have:

  memory-region: pci_bridge_io
    0000000000000000-00000000ffffffff (prio 0, i/o): pci_bridge_io
      0000000000000060-0000000000000060 (prio 0, i/o): i8042-data
      0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd
      ...

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200601142930[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
4 years agohw/pci-host/prep: Correct RAVEN bus bridge memory region size
Philippe Mathieu-Daudé [Mon, 1 Jun 2020 14:29:24 +0000 (16:29 +0200)]
hw/pci-host/prep: Correct RAVEN bus bridge memory region size

memory_region_set_size() handle the 16 Exabytes limit by
special-casing the UINT64_MAX value. This is not a problem
for the 32-bit maximum, 4 GiB.
By using the UINT32_MAX value, the bm-raven MemoryRegion
ends up missing 1 byte:

  $ qemu-system-ppc -M prep -S -monitor stdio -usb
  memory-region: bm-raven
    0000000000000000-00000000fffffffe (prio 0, i/o): bm-raven
      0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory @pci-memory 0000000000000000-000000003effffff
      0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @system 0000000000000000-000000007fffffff

Fix by using the correct value. We now have:

  memory-region: bm-raven
    0000000000000000-00000000ffffffff (prio 0, i/o): bm-raven
      0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory @pci-memory 0000000000000000-000000003effffff
      0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @system 0000000000000000-000000007fffffff

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200601142930[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
4 years agopci: assert configuration access is within bounds
Prasad J Pandit [Thu, 4 Jun 2020 11:35:25 +0000 (17:05 +0530)]
pci: assert configuration access is within bounds

While accessing PCI configuration bytes, assert that
'address + len' is within PCI configuration space.

Generally it is within bounds. This is more of a defensive
assert, in case a buggy device was to send 'address' which
may go out of bounds.

Suggested-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Prasad J Pandit <[email protected]>
Message-Id: <20200604113525[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agohw/pci/pcie: Move hot plug capability check to pre_plug callback
Julia Suvorova [Thu, 4 Jun 2020 12:59:46 +0000 (14:59 +0200)]
hw/pci/pcie: Move hot plug capability check to pre_plug callback

Check for hot plug capability earlier to avoid removing devices attached
during the initialization process.

Run qemu with an unattached drive:
  -drive file=$FILE,if=none,id=drive0 \
  -device pcie-root-port,id=rp0,slot=3,bus=pcie.0,hotplug=off
Hotplug a block device:
  device_add virtio-blk-pci,id=blk0,drive=drive0,bus=rp0
If hotplug fails on plug_cb, drive0 will be deleted.

Fixes: 0501e1aa1d32a6 ("hw/pci/pcie: Forbid hot-plug if it's disabled on the slot")
Acked-by: Igor Mammedov <[email protected]>
Signed-off-by: Julia Suvorova <[email protected]>
Message-Id: <20200604125947[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agoMAINTAINERS: Fix the classification of bios-tables-test-allowed-diff.h
Thomas Huth [Sun, 7 Jun 2020 05:20:22 +0000 (07:20 +0200)]
MAINTAINERS: Fix the classification of bios-tables-test-allowed-diff.h

The file tests/qtest/bios-tables-test-allowed-diff.h is currently only
assigned to the qtest section according MAINTAINERS. However, this file
normally only gets updated when the ACPI tables changed - something the
qtest maintainers don't have much clue of. Thus this file should rather
be assigned to the ACPI maintainers instead.

Signed-off-by: Thomas Huth <[email protected]>
Message-Id: <20200607052022[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agovirtio-balloon: Provide an interface for free page reporting
Alexander Duyck [Wed, 27 May 2020 04:14:07 +0000 (21:14 -0700)]
virtio-balloon: Provide an interface for free page reporting

Add support for free page reporting. The idea is to function very similar
to how the balloon works in that we basically end up madvising the page as
not being used. However we don't really need to bother with any deflate
type logic since the page will be faulted back into the guest when it is
read or written to.

This provides a new way of letting the guest proactively report free
pages to the hypervisor, so the hypervisor can reuse them. In contrast to
inflate/deflate that is triggered via the hypervisor explicitly.

Acked-by: David Hildenbrand <[email protected]>
Signed-off-by: Alexander Duyck <[email protected]>
Message-Id: <20200527041407[email protected]>

4 years agovirtio-balloon: Implement support for page poison reporting feature
Alexander Duyck [Wed, 27 May 2020 04:14:00 +0000 (21:14 -0700)]
virtio-balloon: Implement support for page poison reporting feature

We need to make certain to advertise support for page poison reporting if
we want to actually get data on if the guest will be poisoning pages.

Add a value for reporting the poison value being used if page poisoning is
enabled in the guest. With this we can determine if we will need to skip
free page reporting when it is enabled in the future.

The value currently has no impact on existing balloon interfaces. In the
case of existing balloon interfaces the onus is on the guest driver to
reapply whatever poison is in place.

When we add free page reporting the poison value is used to determine if
we can perform in-place page reporting. The expectation is that a reported
page will already contain the value specified by the poison, and the
reporting of the page should not change that value.

Acked-by: David Hildenbrand <[email protected]>
Signed-off-by: Alexander Duyck <[email protected]>
Message-Id: <20200527041400[email protected]>

4 years agovirtio-balloon: unref the iothread when unrealizing
David Hildenbrand [Wed, 20 May 2020 10:04:39 +0000 (12:04 +0200)]
virtio-balloon: unref the iothread when unrealizing

We took a reference when realizing, so let's drop that reference when
unrealizing.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Alexander Duyck <[email protected]>
Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
Cc: [email protected]
Cc: Wei Wang <[email protected]>
Cc: Alexander Duyck <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20200520100439[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agovirtio-balloon: fix free page hinting check on unrealize
David Hildenbrand [Wed, 20 May 2020 10:04:38 +0000 (12:04 +0200)]
virtio-balloon: fix free page hinting check on unrealize

Checking against guest features is wrong. We allocated data structures
based on host features. We can rely on "free_page_bh" as an indicator
whether to un-do stuff instead.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Alexander Duyck <[email protected]>
Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
Cc: [email protected]
Cc: Wei Wang <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Alexander Duyck <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20200520100439[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agovirtio-balloon: fix free page hinting without an iothread
David Hildenbrand [Wed, 20 May 2020 10:04:37 +0000 (12:04 +0200)]
virtio-balloon: fix free page hinting without an iothread

In case we don't have an iothread, we mark the feature as abscent but
still add the queue. 'free_page_bh' remains set to NULL.

qemu-system-i386 \
        -M microvm \
        -nographic \
        -device virtio-balloon-device,free-page-hint=true \
        -nographic \
        -display none \
        -monitor none \
        -serial none \
        -qtest stdio

Doing a "write 0xc0000e30 0x24
0x030000000300000003000000030000000300000003000000030000000300000003000000"

We will trigger a SEGFAULT. Let's move the check and bail out.

While at it, move the static initializations to instance_init().
free_page_report_status and block_iothread are implicitly set to the
right values (0/false) already, so drop the initialization.

Reviewed-by: Alexander Duyck <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
Reported-by: Alexander Bulekov <[email protected]>
Cc: [email protected]
Cc: Wei Wang <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Alexander Duyck <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20200520100439[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agobios-tables-test: Generate reference tables for Q35/TPM-TIS
Eric Auger [Tue, 9 Jun 2020 12:54:09 +0000 (14:54 +0200)]
bios-tables-test: Generate reference tables for Q35/TPM-TIS

TPM2, DSDT tables were generated using
tests/data/acpi/rebuild-expected-aml.sh

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Message-Id: <20200609125409[email protected]>

Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agobios-tables-test: Add Q35/TPM-TIS test
Eric Auger [Tue, 9 Jun 2020 12:54:08 +0000 (14:54 +0200)]
bios-tables-test: Add Q35/TPM-TIS test

Test tables specific to the TPM-TIS instantiation.
The TPM2 is added in the framework. Also the DSDT
is updated with the TPM. The new function should be
be usable for CRB as well, later one.

Signed-off-by: Eric Auger <[email protected]>
Message-Id: <20200609125409[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agotests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS
Eric Auger [Tue, 9 Jun 2020 12:54:07 +0000 (14:54 +0200)]
tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS

bios-tables-test executes SeaBIOS. Indeed FW is needed to
fetch tables from QEMU and put them into the guest RAM. Also
the FW patches cross table pointers. At some point, SeaBIOS
ends up calling the TPM2_CC_HierarchyControl command with
TPM2_ST_SESSIONS tag, most probably steming from
tpm_set_failure/tpm20_hierarchycontrol SeaBIOS call path.
This causes an assert() in the qtest tpm emulation code.

As the goal here is not to boot SeaBIOS completely but just
let it grab the ACPI tables and consolidate them, let's just
remove the assert().

Signed-off-by: Eric Auger <[email protected]>
Message-Id: <20200609125409[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agotests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test
Eric Auger [Tue, 9 Jun 2020 12:54:06 +0000 (14:54 +0200)]
tests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test

Add placeholders for TPM and DSDT reference tables for
Q35 TPM-TIS tests and ignore them for the time being.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Message-Id: <20200609125409[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agotest/tpm-emu: include sockets and channel headers in tpm-emu header
Eric Auger [Tue, 9 Jun 2020 12:54:05 +0000 (14:54 +0200)]
test/tpm-emu: include sockets and channel headers in tpm-emu header

Include sockets and channel headers to that the header is
self-contained.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Message-Id: <20200609125409[email protected]>

4 years agoarm/acpi: TPM2 ACPI table support
Eric Auger [Mon, 1 Jun 2020 09:57:36 +0000 (11:57 +0200)]
arm/acpi: TPM2 ACPI table support

Add a TPM2 ACPI table if a TPM2.0 sysbus device has been
dynamically instantiated.

Signed-off-by: Eric Auger <[email protected]>
Message-Id: <20200601095737[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agoacpi: Move build_tpm2() in the generic part
Eric Auger [Mon, 1 Jun 2020 09:57:35 +0000 (11:57 +0200)]
acpi: Move build_tpm2() in the generic part

We plan to build the TPM2 table on ARM too. In order to reuse the
generation code, let's move build_tpm2() to aml-build.c.

No change in the implementation.

Signed-off-by: Eric Auger <[email protected]>
Message-Id: <20200601095737[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agoacpi: Convert build_tpm2() to build_append* API
Eric Auger [Mon, 1 Jun 2020 09:57:34 +0000 (11:57 +0200)]
acpi: Convert build_tpm2() to build_append* API

In preparation of its move to the generic acpi code,
let's convert build_tpm2() to use build_append API. This
latter now is prefered in place of direct ACPI struct field
settings with manual endianness conversion.

Signed-off-by: Eric Auger <[email protected]>
Message-Id: <20200601095737[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agoacpi: tpm: Do not build TCPA table for TPM 2
Stefan Berger [Fri, 29 May 2020 19:28:40 +0000 (15:28 -0400)]
acpi: tpm: Do not build TCPA table for TPM 2

Do not build a TCPA table for TPM 2 anymore but create the log area when
building the TPM2 table. The TCPA table is only needed for TPM 1.2.

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
4 years agotests/acpi: update DSDT expected files
Michael S. Tsirkin [Tue, 9 Jun 2020 15:16:14 +0000 (11:16 -0400)]
tests/acpi: update DSDT expected files

Update DSDT after CRS changes and _STA methods dropped.

Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agoacpi: move aml builder code for parallel device
Gerd Hoffmann [Fri, 15 May 2020 15:04:12 +0000 (17:04 +0200)]
acpi: move aml builder code for parallel device

Also adds support for multiple LPT devices.

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200515150421[email protected]>

4 years agoacpi: parallel: don't use _STA method
Gerd Hoffmann [Fri, 15 May 2020 15:04:11 +0000 (17:04 +0200)]
acpi: parallel: don't use _STA method

The _STA method dates back to the days where we had a static DSDT.  The
device is listed in the DSDT table unconditionally and the _STA method
checks a bit in the isa bridge pci config space to figure whenever a
given is isa device is present or not, then evaluates to 0x0f (present)
or 0x00 (absent).

These days the DSDT is generated by qemu anyway, so if a device is not
present we can simply drop it from the DSDT instead.

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Message-Id: <20200515150421[email protected]>

4 years agoacpi: move aml builder code for serial device
Gerd Hoffmann [Fri, 15 May 2020 15:04:10 +0000 (17:04 +0200)]
acpi: move aml builder code for serial device

The code uses the isa_serial_io array to figure what the device uid is.
Side effect is that acpi antries are not limited to port 1+2 any more,
we'll also get entries for ports 3+4.

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200515150421[email protected]>

4 years agoacpi: serial: don't use _STA method
Gerd Hoffmann [Fri, 15 May 2020 15:04:09 +0000 (17:04 +0200)]
acpi: serial: don't use _STA method

The _STA method dates back to the days where we had a static DSDT.  The
device is listed in the DSDT table unconditionally and the _STA method
checks a bit in the isa bridge pci config space to figure whenever a
given is isa device is present or not, then evaluates to 0x0f (present)
or 0x00 (absent).

These days the DSDT is generated by qemu anyway, so if a device is not
present we can simply drop it from the DSDT instead.

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200515150421[email protected]>

4 years agoacpi: rtc: use a single crs range
Gerd Hoffmann [Fri, 15 May 2020 15:04:08 +0000 (17:04 +0200)]
acpi: rtc: use a single crs range

Use a single io range for _CRS instead of two,
following what real hardware does.

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Message-Id: <20200515150421[email protected]>

4 years agoacpi: move aml builder code for rtc device
Gerd Hoffmann [Fri, 15 May 2020 15:04:07 +0000 (17:04 +0200)]
acpi: move aml builder code for rtc device

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200515150421[email protected]>

4 years agoqtest: allow DSDT acpi table changes
Gerd Hoffmann [Fri, 15 May 2020 15:04:06 +0000 (17:04 +0200)]
qtest: allow DSDT acpi table changes

Signed-off-by: Gerd Hoffmann <[email protected]>
Message-Id: <20200515150421[email protected]>

4 years agotests/acpi: update expected SRAT files
Vishal Verma [Sat, 6 Jun 2020 00:09:11 +0000 (18:09 -0600)]
tests/acpi: update expected SRAT files

Update expected SRAT files for the change to account for NVDIMM NUMA
nodes in the SRAT.

AML diffs:

tests/data/acpi/pc/SRAT.dimmpxm:
Message-Id: <20200606000911[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agohw/acpi/nvdimm: add a helper to augment SRAT generation
Vishal Verma [Sat, 6 Jun 2020 00:09:10 +0000 (18:09 -0600)]
hw/acpi/nvdimm: add a helper to augment SRAT generation

NVDIMMs can belong to their own proximity domains, as described by the
NFIT. In such cases, the SRAT needs to have Memory Affinity structures
in the SRAT for these NVDIMMs, otherwise Linux doesn't populate node
data structures properly during NUMA initialization. See the following
for an example failure case.

https://lore.kernel.org/linux-nvdimm/20200416225438[email protected]/

Introduce a new helper, nvdimm_build_srat(), and call it for both the
i386 and arm versions of 'build_srat()' to augment the SRAT with
memory affinity information for NVDIMMs.

The relevant command line options to exercise this are below. Nodes 0-1
contain CPUs and regular memory, and nodes 2-3 are the NVDIMM address
space.

    -object memory-backend-ram,id=mem0,size=2048M
    -numa node,nodeid=0,memdev=mem0,
    -numa cpu,node-id=0,socket-id=0
    -object memory-backend-ram,id=mem1,size=2048M
    -numa node,nodeid=1,memdev=mem1,
    -numa cpu,node-id=1,socket-id=1
    -numa node,nodeid=2,
    -object memory-backend-file,id=nvmem0,share,mem-path=nvdimm-0,size=16384M,align=1G
    -device nvdimm,memdev=nvmem0,id=nv0,label-size=2M,node=2
    -numa node,nodeid=3,
    -object memory-backend-file,id=nvmem1,share,mem-path=nvdimm-1,size=16384M,align=1G
    -device nvdimm,memdev=nvmem1,id=nv1,label-size=2M,node=3

Cc: Jingqi Liu <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Reviewed-by: Jingqi Liu <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Vishal Verma <[email protected]>
Message-Id: <20200606000911[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agodiffs-allowed: add the SRAT AML to diffs-allowed
Vishal Verma [Sat, 6 Jun 2020 00:09:09 +0000 (18:09 -0600)]
diffs-allowed: add the SRAT AML to diffs-allowed

In anticipation of a change to the SRAT generation in qemu, add the AML
file to diffs-allowed.

Signed-off-by: Vishal Verma <[email protected]>
Message-Id: <20200606000911[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
4 years agomsix: allow qword MSI-X table accesses
Michael S. Tsirkin [Thu, 14 May 2020 15:14:39 +0000 (11:14 -0400)]
msix: allow qword MSI-X table accesses

PCI spec says:

For all accesses to MSI-X Table and MSI-X PBA fields, software must use
aligned full DWORD or aligned full QWORD transactions; otherwise, the
result is undefined.

However, since MSI-X was converted to use memory API, QEMU
started blocking qword transactions, only allowing DWORD
ones. Guests do not seem to use QWORD accesses, but let's
be spec compliant.

Fixes: 95524ae8dc8f ("msix: convert to memory API")
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
4 years agoMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.1-pull-request...
Peter Maydell [Mon, 8 Jun 2020 10:04:57 +0000 (11:04 +0100)]
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.1-pull-request' into staging

linux-user pull request 20200605-v2

Implement F_OFD_ fcntl() command, /proc/cpuinfo for hppa
Fix socket(), prnctl() error codes, underflow in target_mremap,
    epoll_create() strace, oldumount for alpha
User-mode build dependencies improvement

# gpg: Signature made Sat 06 Jun 2020 14:15:36 BST
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Laurent Vivier <[email protected]>" [full]
# gpg:                 aka "Laurent Vivier <[email protected]>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <[email protected]>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-5.1-pull-request:
  stubs: Restrict ui/win32-kbd-hook to system-mode
  hw/core: Restrict CpuClass::get_crash_info() to system-mode
  target/s390x: Restrict CpuClass::get_crash_info() to system-mode
  target/i386: Restrict CpuClass::get_crash_info() to system-mode
  arch_init: Remove unused 'qapi-commands-misc.h' include
  exec: Assert CPU migration is not used on user-only build
  target/riscv/cpu: Restrict CPU migration to system-mode
  stubs/Makefile: Reduce the user-mode object list
  util/Makefile: Reduce the user-mode object list
  tests/Makefile: Restrict some softmmu-only tests
  tests/Makefile: Only display TCG-related tests when TCG is available
  configure: Avoid building TCG when not needed
  Makefile: Only build virtiofsd if system-mode is enabled
  linux-user: implement OFD locks
  linux-user/mmap.c: fix integer underflow in target_mremap
  linux-user/strace.list: fix epoll_create{,1} -strace output
  linux-user: Add support for /proc/cpuinfo on hppa platform
  linux-user: return target error codes for socket() and prctl()
  linux-user, alpha: fix oldumount syscall

Signed-off-by: Peter Maydell <[email protected]>
4 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200605' into...
Peter Maydell [Fri, 5 Jun 2020 22:31:31 +0000 (23:31 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200605' into staging

target-arm queue:
 hw/ssi/imx_spi: Handle tx burst lengths other than 8 correctly
 hw/input/pxa2xx_keypad: Replace hw_error() by qemu_log_mask()
 hw/arm/pxa2xx: Replace printf() call by qemu_log_mask()
 target/arm: Convert crypto insns to gvec
 hw/adc/stm32f2xx_adc: Correct memory region size and access size
 tests/acceptance: Add a boot test for the xlnx-versal-virt machine
 docs/system: Document Aspeed boards
 raspi: Add model of the USB controller
 target/arm: Convert 2-reg-and-shift and 1-reg-imm Neon insns to decodetree

# gpg: Signature made Fri 05 Jun 2020 17:48:39 BST
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Peter Maydell <[email protected]>" [ultimate]
# gpg:                 aka "Peter Maydell <[email protected]>" [ultimate]
# gpg:                 aka "Peter Maydell <[email protected]>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20200605: (29 commits)
  target/arm: Convert Neon one-register-and-immediate insns to decodetree
  target/arm: Convert VCVT fixed-point ops to decodetree
  target/arm: Convert Neon VSHLL, VMOVL to decodetree
  target/arm: Convert Neon narrowing shifts with op==9 to decodetree
  target/arm: Convert Neon narrowing shifts with op==8 to decodetree
  target/arm: Convert VQSHLU, VQSHL 2-reg-shift insns to decodetree
  target/arm: Convert Neon VSRA, VSRI, VRSHR, VRSRA 2-reg-shift insns to decodetree
  target/arm: Convert Neon VSHR 2-reg-shift insns to decodetree
  target/arm: Convert Neon VSHL and VSLI 2-reg-shift insn to decodetree
  raspi2 acceptance test: add test for dwc-hsotg (dwc2) USB host
  wire in the dwc-hsotg (dwc2) USB host controller emulation
  usb: add short-packet handling to usb-storage driver
  dwc-hsotg (dwc2) USB host controller emulation
  dwc-hsotg (dwc2) USB host controller state definitions
  dwc-hsotg (dwc2) USB host controller register definitions
  raspi: add BCM2835 SOC MPHI emulation
  docs/system: Document Aspeed boards
  tests/acceptance: Add a boot test for the xlnx-versal-virt machine
  hw/adc/stm32f2xx_adc: Correct memory region size and access size
  target/arm: Split helper_crypto_sm3tt
  ...

Signed-off-by: Peter Maydell <[email protected]>
4 years agostubs: Restrict ui/win32-kbd-hook to system-mode
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:10 +0000 (19:25 +0200)]
stubs: Restrict ui/win32-kbd-hook to system-mode

In Makefile.objs, the ui/ directory is restricted to system-mode:

 43 ifeq ($(CONFIG_SOFTMMU),y)
 ...
 65 common-obj-y += ui/
 66 common-obj-m += ui/
 ...
 82 endif # CONFIG_SOFTMMU

Restrict the ui/ stub added in commit 2df9f5718df to only build
it for system-mode emulation.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agohw/core: Restrict CpuClass::get_crash_info() to system-mode
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:09 +0000 (19:25 +0200)]
hw/core: Restrict CpuClass::get_crash_info() to system-mode

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agotarget/s390x: Restrict CpuClass::get_crash_info() to system-mode
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:08 +0000 (19:25 +0200)]
target/s390x: Restrict CpuClass::get_crash_info() to system-mode

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agotarget/i386: Restrict CpuClass::get_crash_info() to system-mode
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:07 +0000 (19:25 +0200)]
target/i386: Restrict CpuClass::get_crash_info() to system-mode

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agoarch_init: Remove unused 'qapi-commands-misc.h' include
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:06 +0000 (19:25 +0200)]
arch_init: Remove unused 'qapi-commands-misc.h' include

Commit ffaee83bcb2 moved qmp_query_target but forgot to remove
this include.

Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agoexec: Assert CPU migration is not used on user-only build
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:05 +0000 (19:25 +0200)]
exec: Assert CPU migration is not used on user-only build

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agotarget/riscv/cpu: Restrict CPU migration to system-mode
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:04 +0000 (19:25 +0200)]
target/riscv/cpu: Restrict CPU migration to system-mode

Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agostubs/Makefile: Reduce the user-mode object list
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:03 +0000 (19:25 +0200)]
stubs/Makefile: Reduce the user-mode object list

These stubs are not required when configured with --disable-system.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agoutil/Makefile: Reduce the user-mode object list
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:02 +0000 (19:25 +0200)]
util/Makefile: Reduce the user-mode object list

These objects are not required when configured with --disable-system.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agotests/Makefile: Restrict some softmmu-only tests
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:01 +0000 (19:25 +0200)]
tests/Makefile: Restrict some softmmu-only tests

In the next commit we are going to remove some objects from the
util-obj-y variable (objects which are not used by user-mode,
when configured with --disable-system).
Then some system-mode tests are going to fail, due to the missing
objects:

  $ make check-unit -k
    LINK    tests/test-iov
  /usr/bin/ld: tests/test-iov.o: in function `iov_from_buf':
  include/qemu/iov.h:49: undefined reference to `iov_from_buf_full'
  make: *** [rules.mak:124: tests/test-iov] Error 1
    LINK    tests/test-timed-average
  /usr/bin/ld: tests/test-timed-average.o: in function `account':
  tests/test-timed-average.c:27: undefined reference to `timed_average_account'
  make: *** [rules.mak:124: tests/test-timed-average] Error 1
    LINK    tests/test-util-filemonitor
  /usr/bin/ld: tests/test-util-filemonitor.o: in function `qemu_file_monitor_test_event_loop':
  tests/test-util-filemonitor.c:83: undefined reference to `main_loop_wait'
  make: *** [rules.mak:124: tests/test-util-filemonitor] Error 1
    LINK    tests/test-util-sockets
  /usr/bin/ld: tests/test-util-sockets.o: in function `test_socket_fd_pass_name_good':
  tests/test-util-sockets.c:91: undefined reference to `socket_connect'
  make: *** [rules.mak:124: tests/test-util-sockets] Error 1
    LINK    tests/test-base64
  /usr/bin/ld: tests/test-base64.o: in function `test_base64_good':
  tests/test-base64.c:35: undefined reference to `qbase64_decode'
  collect2: error: ld returned 1 exit status
  make: *** [rules.mak:124: tests/test-base64] Error 1
    LINK    tests/test-bufferiszero
  /usr/bin/ld: tests/test-bufferiszero.o: in function `test_1':
  tests/test-bufferiszero.c:31: undefined reference to `buffer_is_zero'
  make: *** [rules.mak:124: tests/test-bufferiszero] Error 1
  make: Target 'check-unit' not remade because of errors.

Instead, restrict these tests to system-mode, by using the
$(CONFIG_SOFTMMU) variable.

Reviewed-by: Richard Henderson <[email protected]>
Tested-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agotests/Makefile: Only display TCG-related tests when TCG is available
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:25:00 +0000 (19:25 +0200)]
tests/Makefile: Only display TCG-related tests when TCG is available

Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agoconfigure: Avoid building TCG when not needed
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:24:59 +0000 (19:24 +0200)]
configure: Avoid building TCG when not needed

Avoid building TCG when building only tools:

  ./configure --enable-tools --disable-system --disable-user

This saves us from running the soft-float tests enabled since
commit 76170102508.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agoMakefile: Only build virtiofsd if system-mode is enabled
Philippe Mathieu-Daudé [Fri, 22 May 2020 17:24:58 +0000 (19:24 +0200)]
Makefile: Only build virtiofsd if system-mode is enabled

Do not build the virtiofsd helper when configured with
--disable-system.

Reviewed-by: Richard Henderson <[email protected]>
Acked-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200522172510[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agolinux-user: implement OFD locks
Andreas Schwab [Mon, 25 May 2020 07:59:28 +0000 (09:59 +0200)]
linux-user: implement OFD locks

Signed-off-by: Andreas Schwab <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agolinux-user/mmap.c: fix integer underflow in target_mremap
Jonathan Marler [Sat, 2 May 2020 16:12:25 +0000 (10:12 -0600)]
linux-user/mmap.c: fix integer underflow in target_mremap

Fixes: https://bugs.launchpad.net/bugs/1876373
This code path in mmap occurs when a page size is decreased with mremap.  When a section of pages is shrunk, qemu calls mmap_reserve on the pages that were released.  However, it has the diff operation reversed, subtracting the larger old_size from the smaller new_size.  Instead, it should be subtracting the smaller new_size from the larger old_size.  You can also see in the previous line of the change that this mmap_reserve call only occurs when old_size > new_size.

Bug: https://bugs.launchpad.net/qemu/+bug/1876373
Signed-off-by: Jonathan Marler <[email protected]>
Reviewded-by: Laurent Vivier <[email protected]>
Message-Id: <20200502161225[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agolinux-user/strace.list: fix epoll_create{,1} -strace output
Sergei Trofimovich [Thu, 16 Apr 2020 17:59:57 +0000 (18:59 +0100)]
linux-user/strace.list: fix epoll_create{,1} -strace output

Fix syscall name and parameters priinter.

Before the change:

```
$ alpha-linux-user/qemu-alpha -strace -L /usr/alpha-unknown-linux-gnu/ /tmp/a
...
1274697 %s(%d)(2097152,274903156744,274903156760,274905840712,274877908880,274903235616) = 3
1274697 exit_group(0)
```

After the change:

```
$ alpha-linux-user/qemu-alpha -strace -L /usr/alpha-unknown-linux-gnu/ /tmp/a
...
1273719 epoll_create1(2097152) = 3
1273719 exit_group(0)
```

Fixes: 9cbc0578cb6 ("Improve output of various syscalls")
Signed-off-by: Sergei Trofimovich <[email protected]>
CC: Riku Voipio <[email protected]>
CC: Laurent Vivier <[email protected]>
Cc: [email protected]
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200416175957.1274882[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
4 years agolinux-user: Add support for /proc/cpuinfo on hppa platform
Helge Deller [Fri, 24 Apr 2020 21:06:48 +0000 (23:06 +0200)]
linux-user: Add support for /proc/cpuinfo on hppa platform

Provide our own /proc/cpuinfo file for the hppa (parisc) platform.

Signed-off-by: Helge Deller <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-Id: <20200424210648[email protected]>
[lv: s/an/our/ and add TARGET_HPPA to guard is_proc()]
Signed-off-by: Laurent Vivier <[email protected]>
4 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20200605' into staging
Peter Maydell [Fri, 5 Jun 2020 16:45:59 +0000 (17:45 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20200605' into staging

s390x update:
- enhance s390x documentation
- allow ORBs without prefetch specified for vfio-ccw
- various cleanups and enhancements

# gpg: Signature made Fri 05 Jun 2020 16:32:43 BST
# gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Cornelia Huck <[email protected]>" [marginal]
# gpg:                 aka "Cornelia Huck <[email protected]>" [full]
# gpg:                 aka "Cornelia Huck <[email protected]>" [full]
# gpg:                 aka "Cornelia Huck <[email protected]>" [marginal]
# gpg:                 aka "Cornelia Huck <[email protected]>" [marginal]
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20200605:
  target/s390x: Restrict system-mode declarations
  target/s390x/helper: Clean ifdef'ry
  target/s390x: Only compile decode_basedisp() on system-mode
  MAINTAINERS: add Thomas as additional s390x maintainer
  docs/s390x: document vfio-ccw
  vfio-ccw: allow non-prefetch ORBs
  docs/s390x: document 3270
  docs/s390x: document the virtual css
  s390x: pv: Fix KVM_PV_PREP_RESET command wrapper name
  s390x/kvm: help valgrind in several places

Signed-off-by: Peter Maydell <[email protected]>
4 years agotarget/arm: Convert Neon one-register-and-immediate insns to decodetree
Peter Maydell [Fri, 22 May 2020 14:55:20 +0000 (15:55 +0100)]
target/arm: Convert Neon one-register-and-immediate insns to decodetree

Convert the insns in the one-register-and-immediate group to decodetree.

In the new decode, our asimd_imm_const() function returns a 64-bit value
rather than a 32-bit one, which means we don't need to treat cmode=14 op=1
as a special case in the decoder (it is the only encoding where the two
halves of the 64-bit value are different).

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20200522145520[email protected]

4 years agotarget/arm: Convert VCVT fixed-point ops to decodetree
Peter Maydell [Fri, 22 May 2020 14:55:19 +0000 (15:55 +0100)]
target/arm: Convert VCVT fixed-point ops to decodetree

Convert the VCVT fixed-point conversion operations in the
Neon 2-regs-and-shift group to decodetree.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20200522145520[email protected]

4 years agotarget/arm: Convert Neon VSHLL, VMOVL to decodetree
Peter Maydell [Fri, 22 May 2020 14:55:18 +0000 (15:55 +0100)]
target/arm: Convert Neon VSHLL, VMOVL to decodetree

Convert the VSHLL and VMOVL insns from the 2-reg-shift group
to decodetree. Since the loop always has two passes, we unroll
it to avoid the awkward reassignment of one TCGv to another.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20200522145520[email protected]

4 years agotarget/arm: Convert Neon narrowing shifts with op==9 to decodetree
Peter Maydell [Fri, 22 May 2020 14:55:17 +0000 (15:55 +0100)]
target/arm: Convert Neon narrowing shifts with op==9 to decodetree

Convert the remaining Neon narrowing shifts to decodetree:
  * VQSHRN
  * VQRSHRN

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20200522145520[email protected]

4 years agotarget/arm: Convert Neon narrowing shifts with op==8 to decodetree
Peter Maydell [Fri, 22 May 2020 14:55:16 +0000 (15:55 +0100)]
target/arm: Convert Neon narrowing shifts with op==8 to decodetree

Convert the Neon narrowing shifts where op==8 to decodetree:
 * VSHRN
 * VRSHRN
 * VQSHRUN
 * VQRSHRUN

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20200522145520[email protected]

4 years agotarget/arm: Convert VQSHLU, VQSHL 2-reg-shift insns to decodetree
Peter Maydell [Fri, 22 May 2020 14:55:15 +0000 (15:55 +0100)]
target/arm: Convert VQSHLU, VQSHL 2-reg-shift insns to decodetree

Convert the VQSHLU and QVSHL 2-reg-shift insns to decodetree.
These are the last of the simple shift-by-immediate insns.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20200522145520[email protected]

4 years agotarget/arm: Convert Neon VSRA, VSRI, VRSHR, VRSRA 2-reg-shift insns to decodetree
Peter Maydell [Fri, 22 May 2020 14:55:14 +0000 (15:55 +0100)]
target/arm: Convert Neon VSRA, VSRI, VRSHR, VRSRA 2-reg-shift insns to decodetree

Convert the VSRA, VSRI, VRSHR, VRSRA 2-reg-shift insns to decodetree.
(These are the last instructions in the group that are vectorized;
the rest all require looping over each element.)

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20200522145520[email protected]

4 years agotarget/arm: Convert Neon VSHR 2-reg-shift insns to decodetree
Peter Maydell [Fri, 22 May 2020 14:55:13 +0000 (15:55 +0100)]
target/arm: Convert Neon VSHR 2-reg-shift insns to decodetree

Convert the VSHR 2-reg-shift insns to decodetree.

Note that unlike the legacy decoder, we present the right shift
amount to the trans_ function as a positive integer.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20200522145520[email protected]

4 years agotarget/arm: Convert Neon VSHL and VSLI 2-reg-shift insn to decodetree
Peter Maydell [Fri, 22 May 2020 14:55:12 +0000 (15:55 +0100)]
target/arm: Convert Neon VSHL and VSLI 2-reg-shift insn to decodetree

Convert the VSHL and VSLI insns from the Neon 2-registers-and-a-shift
group to decodetree.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20200522145520[email protected]

4 years agoraspi2 acceptance test: add test for dwc-hsotg (dwc2) USB host
Paul Zimmerman [Wed, 20 May 2020 23:53:49 +0000 (16:53 -0700)]
raspi2 acceptance test: add test for dwc-hsotg (dwc2) USB host

Add a check for functional dwc-hsotg (dwc2) USB host emulation to
the Raspi 2 acceptance test

Signed-off-by: Paul Zimmerman <[email protected]>
Reviewed-by: Philippe Mathieu-Daude <[email protected]>
Message-id: 20200520235349[email protected]
Signed-off-by: Peter Maydell <[email protected]>
4 years agowire in the dwc-hsotg (dwc2) USB host controller emulation
Paul Zimmerman [Wed, 20 May 2020 23:53:48 +0000 (16:53 -0700)]
wire in the dwc-hsotg (dwc2) USB host controller emulation

Wire the dwc-hsotg (dwc2) emulation into Qemu

Signed-off-by: Paul Zimmerman <[email protected]>
Reviewed-by: Philippe Mathieu-Daude <[email protected]>
Message-id: 20200520235349[email protected]
Signed-off-by: Peter Maydell <[email protected]>
4 years agousb: add short-packet handling to usb-storage driver
Paul Zimmerman [Wed, 20 May 2020 23:53:47 +0000 (16:53 -0700)]
usb: add short-packet handling to usb-storage driver

The dwc-hsotg (dwc2) USB host depends on a short packet to
indicate the end of an IN transfer. The usb-storage driver
currently doesn't provide this, so fix it.

I have tested this change rather extensively using a PC
emulation with xhci, ehci, and uhci controllers, and have
not observed any regressions.

Signed-off-by: Paul Zimmerman <[email protected]>
Message-id: 20200520235349[email protected]
Signed-off-by: Peter Maydell <[email protected]>
4 years agodwc-hsotg (dwc2) USB host controller emulation
Paul Zimmerman [Wed, 20 May 2020 23:53:46 +0000 (16:53 -0700)]
dwc-hsotg (dwc2) USB host controller emulation

Add the dwc-hsotg (dwc2) USB host controller emulation code.
Based on hw/usb/hcd-ehci.c and hw/usb/hcd-ohci.c.

Note that to use this with the dwc-otg driver in the Raspbian
kernel, you must pass the option "dwc_otg.fiq_fsm_enable=0" on
the kernel command line.

Emulation of slave mode and of descriptor-DMA mode has not been
implemented yet. These modes are seldom used.

I have used some on-line sources of information while developing
this emulation, including:

http://www.capital-micro.com/PDF/CME-M7_Family_User_Guide_EN.pdf
which has a pretty complete description of the controller starting
on page 370.

https://sourceforge.net/p/wive-ng/wive-ng-mt/ci/master/tree/docs/DataSheets/RT3050_5x_V2.0_081408_0902.pdf
which has a description of the controller registers starting on
page 130.

Thanks to Felippe Mathieu-Daude for providing a cleaner method
of implementing the memory regions for the controller registers.

Signed-off-by: Paul Zimmerman <[email protected]>
Message-id: 20200520235349[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agodwc-hsotg (dwc2) USB host controller state definitions
Paul Zimmerman [Wed, 20 May 2020 23:53:45 +0000 (16:53 -0700)]
dwc-hsotg (dwc2) USB host controller state definitions

Add the dwc-hsotg (dwc2) USB host controller state definitions.
Mostly based on hw/usb/hcd-ehci.h.

Signed-off-by: Paul Zimmerman <[email protected]>
Message-id: 20200520235349[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agodwc-hsotg (dwc2) USB host controller register definitions
Paul Zimmerman [Wed, 20 May 2020 23:53:44 +0000 (16:53 -0700)]
dwc-hsotg (dwc2) USB host controller register definitions

Import the dwc-hsotg (dwc2) register definitions file from the
Linux kernel. This is a copy of drivers/usb/dwc2/hw.h from the
mainline Linux kernel, the only changes being to the header, and
two instances of 'u32' changed to 'uint32_t' to allow it to
compile. Checkpatch throws a boatload of errors due to the tab
indentation, but I would rather import it as-is than reformat it.

Signed-off-by: Paul Zimmerman <[email protected]>
Message-id: 20200520235349[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agoraspi: add BCM2835 SOC MPHI emulation
Paul Zimmerman [Wed, 20 May 2020 23:53:43 +0000 (16:53 -0700)]
raspi: add BCM2835 SOC MPHI emulation

Add BCM2835 SOC MPHI (Message-based Parallel Host Interface)
emulation. It is very basic, only providing the FIQ interrupt
needed to allow the dwc-otg USB host controller driver in the
Raspbian kernel to function.

Signed-off-by: Paul Zimmerman <[email protected]>
Acked-by: Philippe Mathieu-Daude <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20200520235349[email protected]
Signed-off-by: Peter Maydell <[email protected]>
4 years agodocs/system: Document Aspeed boards
Cédric Le Goater [Tue, 2 Jun 2020 13:50:50 +0000 (15:50 +0200)]
docs/system: Document Aspeed boards

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20200602135050[email protected]
Signed-off-by: Peter Maydell <[email protected]>
4 years agotests/acceptance: Add a boot test for the xlnx-versal-virt machine
Thomas Huth [Mon, 25 May 2020 14:12:37 +0000 (16:12 +0200)]
tests/acceptance: Add a boot test for the xlnx-versal-virt machine

As described by Edgar here:

 https://www.mail-archive.com/[email protected]/msg605124.html

we can use the Ubuntu kernel for testing the xlnx-versal-virt machine.
So let's add a boot test for this now.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Message-id: 20200525141237[email protected]
Signed-off-by: Peter Maydell <[email protected]>
4 years agohw/adc/stm32f2xx_adc: Correct memory region size and access size
Philippe Mathieu-Daudé [Wed, 3 Jun 2020 05:59:15 +0000 (07:59 +0200)]
hw/adc/stm32f2xx_adc: Correct memory region size and access size

The ADC region size is 256B, split as:
 - [0x00 - 0x4f] defined
 - [0x50 - 0xff] reserved

All registers are 32-bit (thus when the datasheet mentions the
last defined register is 0x4c, it means its address range is
0x4c .. 0x4f.

This model implementation is also 32-bit. Set MemoryRegionOps
'impl' fields.

See:
  'RM0033 Reference manual Rev 8', Table 10.13.18 "ADC register map".

Reported-by: Seth Kintigh <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20200603055915[email protected]
Signed-off-by: Peter Maydell <[email protected]>
4 years agotarget/arm: Split helper_crypto_sm3tt
Richard Henderson [Thu, 14 May 2020 21:28:31 +0000 (14:28 -0700)]
target/arm: Split helper_crypto_sm3tt

Rather than passing an opcode to a helper, fully decode the
operation at translate time.  Use clear_tail_16 to zap the
balance of the SVE register with the AdvSIMD write.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20200514212831[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agotarget/arm: Split helper_crypto_sha1_3reg
Richard Henderson [Thu, 14 May 2020 21:28:30 +0000 (14:28 -0700)]
target/arm: Split helper_crypto_sha1_3reg

Rather than passing an opcode to a helper, fully decode the
operation at translate time.  Use clear_tail_16 to zap the
balance of the SVE register with the AdvSIMD write.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20200514212831[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agotarget/arm: Convert sha1 and sha256 to gvec helpers
Richard Henderson [Thu, 14 May 2020 21:28:29 +0000 (14:28 -0700)]
target/arm: Convert sha1 and sha256 to gvec helpers

Do not yet convert the helpers to loop over opr_sz, but the
descriptor allows the vector tail to be cleared.  Which fixes
an existing bug vs SVE.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20200514212831[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agotarget/arm: Convert sha512 and sm3 to gvec helpers
Richard Henderson [Thu, 14 May 2020 21:28:28 +0000 (14:28 -0700)]
target/arm: Convert sha512 and sm3 to gvec helpers

Do not yet convert the helpers to loop over opr_sz, but the
descriptor allows the vector tail to be cleared.  Which fixes
an existing bug vs SVE.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20200514212831[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agotarget/arm: Convert rax1 to gvec helpers
Richard Henderson [Thu, 14 May 2020 21:28:27 +0000 (14:28 -0700)]
target/arm: Convert rax1 to gvec helpers

With this conversion, we will be able to use the same helpers
with sve.  This also fixes a bug in which we failed to clear
the high bits of the SVE register after an AdvSIMD operation.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20200514212831[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agotarget/arm: Convert aes and sm4 to gvec helpers
Richard Henderson [Thu, 14 May 2020 21:28:26 +0000 (14:28 -0700)]
target/arm: Convert aes and sm4 to gvec helpers

With this conversion, we will be able to use the same helpers
with sve.  In particular, pass 3 vector parameters for the
3-operand operations; for advsimd the destination register
is also an input.

This also fixes a bug in which we failed to clear the high bits
of the SVE register after an AdvSIMD operation.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20200514212831[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agohw/arm/pxa2xx: Replace printf() call by qemu_log_mask()
Philippe Mathieu-Daudé [Tue, 2 Jun 2020 12:44:35 +0000 (13:44 +0100)]
hw/arm/pxa2xx: Replace printf() call by qemu_log_mask()

Replace printf() calls by qemu_log_mask(), which is disabled
by default. This avoid flooding the terminal when fuzzing the
device.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20200525114123[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agohw/input/pxa2xx_keypad: Replace hw_error() by qemu_log_mask()
Philippe Mathieu-Daudé [Tue, 2 Jun 2020 12:44:34 +0000 (13:44 +0100)]
hw/input/pxa2xx_keypad: Replace hw_error() by qemu_log_mask()

hw_error() calls exit(). This a bit overkill when we can log
the accesses as unimplemented or guest error.

When fuzzing the devices, we don't want the whole process to
exit. Replace some hw_error() calls by qemu_log_mask()
(missed in commit 5a0001ec7e).

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20200525114123[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agohw/ssi/imx_spi: Removed unnecessary cast of rx data received from slave
Eden Mikitas [Tue, 2 Jun 2020 12:44:34 +0000 (13:44 +0100)]
hw/ssi/imx_spi: Removed unnecessary cast of rx data received from slave

When inserting the value retrieved (rx) from the spi slave, rx is pushed to
rx_fifo after being cast to uint8_t. rx_fifo is a fifo32, and the rx
register the driver uses is also 32 bit. This zeroes the 24 most
significant bits of rx. This proved problematic with devices that expect to
use the whole 32 bits of the rx register.

Signed-off-by: Eden Mikitas <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agohw/ssi/imx_spi: changed while statement to prevent underflow
Eden Mikitas [Tue, 2 Jun 2020 12:44:34 +0000 (13:44 +0100)]
hw/ssi/imx_spi: changed while statement to prevent underflow

The while statement in question only checked if tx_burst is not 0.
tx_burst is a signed int, which is assigned the value put by the
guest driver in ECSPI_CONREG. The burst length can be anywhere
between 1 and 4096, and since tx_burst is always decremented by 8
it could possibly underflow, causing an infinite loop.

Signed-off-by: Eden Mikitas <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
4 years agotarget/s390x: Restrict system-mode declarations
Philippe Mathieu-Daudé [Tue, 26 May 2020 17:24:27 +0000 (19:24 +0200)]
target/s390x: Restrict system-mode declarations

As these declarations are restricted to !CONFIG_USER_ONLY in
helper.c, only declare them when system-mode emulation is used.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-Id: <20200526172427[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
4 years agotarget/s390x/helper: Clean ifdef'ry
Philippe Mathieu-Daudé [Tue, 26 May 2020 17:24:26 +0000 (19:24 +0200)]
target/s390x/helper: Clean ifdef'ry

All this code is guarded checking CONFIG_USER_ONLY definition.
Drop the duplicated checks.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-Id: <20200526172427[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
4 years agotarget/s390x: Only compile decode_basedisp() on system-mode
Philippe Mathieu-Daudé [Tue, 26 May 2020 17:24:25 +0000 (19:24 +0200)]
target/s390x: Only compile decode_basedisp() on system-mode

The decode_basedisp*() methods are only used in ioinst.c,
which is only build in system-mode emulation.

I/O instructions are privileged, and other S instructions
are decoded elsewhere.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-Id: <20200526172427[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
4 years agoMAINTAINERS: add Thomas as additional s390x maintainer
Cornelia Huck [Mon, 25 May 2020 15:58:55 +0000 (17:58 +0200)]
MAINTAINERS: add Thomas as additional s390x maintainer

...because two people are better than one.

Signed-off-by: Cornelia Huck <[email protected]>
Acked-by: Thomas Huth <[email protected]>
Cc: Thomas Huth <[email protected]>
Message-Id: <20200525155855[email protected]>

This page took 0.101259 seconds and 4 git commands to generate.